@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
|
@@ -33,10 +33,9 @@ import { join } from 'node:path';
|
|
|
33
33
|
import { loader as bundleLoader } from '@/server/routes/panels/bundle';
|
|
34
34
|
import { loader as iconLoader } from '@/server/routes/panels/icon';
|
|
35
35
|
import { loader as readmeLoader } from '@/server/routes/panels/readme';
|
|
36
|
-
import { action as installAction } from '@/server/routes/panels/install';
|
|
37
36
|
import { discoverPanelPlugins, getMarketplacePluginsDir, invalidatePanelScan } from '@/server/lib/panels/registry.server';
|
|
38
37
|
import { setPluginEnabled } from '@/server/lib/panels/state.server';
|
|
39
|
-
import { call, dirs,
|
|
38
|
+
import { call, dirs, usePanelRouteFixtures, writePlugin } from '@/server/routes/panels/panel-routes.test-util';
|
|
40
39
|
|
|
41
40
|
usePanelRouteFixtures();
|
|
42
41
|
|
|
@@ -134,122 +133,6 @@ describe('the README route', () => {
|
|
|
134
133
|
});
|
|
135
134
|
});
|
|
136
135
|
|
|
137
|
-
describe('the install route', () => {
|
|
138
|
-
test('forget drops a dangling catalog entry and reports the scan without it', async () => {
|
|
139
|
-
// The reported state: the catalog names a directory that is not there, so
|
|
140
|
-
// the scan rejects it and the pane has a dead-end row.
|
|
141
|
-
writePlugin('other', getMarketplacePluginsDir());
|
|
142
|
-
fs.mkdirSync(dirs.root, { recursive: true });
|
|
143
|
-
fs.writeFileSync(
|
|
144
|
-
join(dirs.root, 'marketplace.json'),
|
|
145
|
-
JSON.stringify({
|
|
146
|
-
name: 'Kabmo',
|
|
147
|
-
plugins: [
|
|
148
|
-
{ name: 'ghost', source: 'plugins/ghost' },
|
|
149
|
-
{ name: 'other', source: 'plugins/other' },
|
|
150
|
-
],
|
|
151
|
-
}),
|
|
152
|
-
);
|
|
153
|
-
invalidatePanelScan();
|
|
154
|
-
expect((await discoverPanelPlugins()).errors.map((error) => error.source)).toEqual(['plugins/ghost']);
|
|
155
|
-
|
|
156
|
-
const response = await post(installAction, { type: 'forget', source: 'plugins/ghost' });
|
|
157
|
-
expect(response.status).toBe(200);
|
|
158
|
-
const body = (await response.json()) as { ok: boolean; errors: unknown[] };
|
|
159
|
-
expect(body.ok).toBe(true);
|
|
160
|
-
// The whole payload comes back, so the pane clears the row without a second
|
|
161
|
-
// read that could race the write.
|
|
162
|
-
expect(body.errors).toEqual([]);
|
|
163
|
-
|
|
164
|
-
const catalog = JSON.parse(fs.readFileSync(join(dirs.root, 'marketplace.json'), 'utf8')) as {
|
|
165
|
-
name: string;
|
|
166
|
-
plugins: Array<{ source: string }>;
|
|
167
|
-
};
|
|
168
|
-
expect(catalog.plugins.map((entry) => entry.source)).toEqual(['plugins/other']);
|
|
169
|
-
expect(catalog.name).toBe('Kabmo');
|
|
170
|
-
});
|
|
171
|
-
|
|
172
|
-
test('forget refuses a source that is missing or escapes the marketplace', async () => {
|
|
173
|
-
expect((await post(installAction, { type: 'forget' })).status).toBe(400);
|
|
174
|
-
expect((await post(installAction, { type: 'forget', source: '../../etc' })).status).toBe(400);
|
|
175
|
-
});
|
|
176
|
-
|
|
177
|
-
test('forget leaves the directory alone when one is there', async () => {
|
|
178
|
-
// The repair for a MISSING directory must not become a delete: only the
|
|
179
|
-
// remove action may touch files.
|
|
180
|
-
const dir = writePlugin('demo', getMarketplacePluginsDir());
|
|
181
|
-
fs.mkdirSync(dirs.root, { recursive: true });
|
|
182
|
-
fs.writeFileSync(
|
|
183
|
-
join(dirs.root, 'marketplace.json'),
|
|
184
|
-
JSON.stringify({ plugins: [{ name: 'demo', source: 'plugins/demo' }] }),
|
|
185
|
-
);
|
|
186
|
-
|
|
187
|
-
expect((await post(installAction, { type: 'forget', source: 'plugins/demo' })).status).toBe(200);
|
|
188
|
-
expect(fs.existsSync(dir)).toBe(true);
|
|
189
|
-
// The plugin still loads — the directory is what makes it exist.
|
|
190
|
-
invalidatePanelScan();
|
|
191
|
-
expect((await discoverPanelPlugins()).plugins.map((plugin) => plugin.pluginId)).toEqual(['demo']);
|
|
192
|
-
});
|
|
193
|
-
|
|
194
|
-
test('set_auto_update flips the flag and answers with the payload', async () => {
|
|
195
|
-
const on = await post(installAction, { type: 'set_auto_update', enabled: true });
|
|
196
|
-
expect(on.status).toBe(200);
|
|
197
|
-
const body = (await on.json()) as { ok: boolean; autoUpdate: boolean };
|
|
198
|
-
expect(body.ok).toBe(true);
|
|
199
|
-
expect(body.autoUpdate).toBe(true);
|
|
200
|
-
|
|
201
|
-
const off = await post(installAction, { type: 'set_auto_update', enabled: false });
|
|
202
|
-
expect(((await off.json()) as { autoUpdate: boolean }).autoUpdate).toBe(false);
|
|
203
|
-
});
|
|
204
|
-
|
|
205
|
-
test('check_updates answers even with nothing to probe', async () => {
|
|
206
|
-
// The button is disabled with no git plugins, but the route must not throw
|
|
207
|
-
// for a stale client that asks anyway.
|
|
208
|
-
writePlugin('demo', getMarketplacePluginsDir());
|
|
209
|
-
invalidatePanelScan();
|
|
210
|
-
|
|
211
|
-
const response = await post(installAction, { type: 'check_updates' });
|
|
212
|
-
expect(response.status).toBe(200);
|
|
213
|
-
const body = (await response.json()) as { ok: boolean; gitStatus: Record<string, unknown> };
|
|
214
|
-
expect(body.ok).toBe(true);
|
|
215
|
-
expect(body.gitStatus).toEqual({});
|
|
216
|
-
});
|
|
217
|
-
|
|
218
|
-
test('update_git refuses a plugin that is not a clone', async () => {
|
|
219
|
-
writePlugin('demo', getMarketplacePluginsDir());
|
|
220
|
-
invalidatePanelScan();
|
|
221
|
-
|
|
222
|
-
const response = await post(installAction, { type: 'update_git', pluginId: 'demo' });
|
|
223
|
-
expect(response.status).toBe(400);
|
|
224
|
-
expect(((await response.json()) as { error: string }).error).toContain('not a git clone');
|
|
225
|
-
});
|
|
226
|
-
|
|
227
|
-
test('update_git requires a plugin id', async () => {
|
|
228
|
-
expect((await post(installAction, { type: 'update_git' })).status).toBe(400);
|
|
229
|
-
});
|
|
230
|
-
|
|
231
|
-
test('force_sync refuses a plugin that is not a bundled install', async () => {
|
|
232
|
-
writePlugin('demo', getMarketplacePluginsDir());
|
|
233
|
-
invalidatePanelScan();
|
|
234
|
-
|
|
235
|
-
const response = await post(installAction, { type: 'force_sync', pluginId: 'demo' });
|
|
236
|
-
expect(response.status).toBe(400);
|
|
237
|
-
expect(((await response.json()) as { error: string }).error).toContain('No bundled plugin');
|
|
238
|
-
});
|
|
239
|
-
|
|
240
|
-
test('force_sync requires a plugin id', async () => {
|
|
241
|
-
expect((await post(installAction, { type: 'force_sync' })).status).toBe(400);
|
|
242
|
-
});
|
|
243
|
-
|
|
244
|
-
test('the payload carries an empty syncBlocked by default', async () => {
|
|
245
|
-
writePlugin('demo', getMarketplacePluginsDir());
|
|
246
|
-
invalidatePanelScan();
|
|
247
|
-
// The field is always present, so the pane's notice has one shape to read
|
|
248
|
-
// rather than two (absent versus empty).
|
|
249
|
-
expect((await discoverPanelPlugins()).syncBlocked).toEqual({});
|
|
250
|
-
});
|
|
251
|
-
});
|
|
252
|
-
|
|
253
136
|
describe('the bundled store is reachable', () => {
|
|
254
137
|
test('an uninstalled store plugin serves its icon and README', async () => {
|
|
255
138
|
// The store card has to draw the mark and open the details BEFORE the plugin
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The official colour of every file-type brand mark, resolved for both variants.
|
|
8
|
+
*
|
|
9
|
+
* `file-brand-paths.ts` carries Simple Icons' hex, which is chosen for the
|
|
10
|
+
* brand's own background. The same problem the provider marks have applies here
|
|
11
|
+
* — a `#F7DF1E` JavaScript yellow is 1.28:1 on the lightest paper — so the
|
|
12
|
+
* painted values come from the shared {@link legiblePair} rule instead of a
|
|
13
|
+
* second hand-maintained table.
|
|
14
|
+
*
|
|
15
|
+
* `dark: null` means "monochrome art": the mark is drawn in the theme's ink.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { BRAND_ICONS } from '@/shared/lib/icons/file-brand-paths';
|
|
19
|
+
import { legiblePair } from '@/shared/lib/theme/legibility';
|
|
20
|
+
|
|
21
|
+
export interface FileBrandColor {
|
|
22
|
+
/** The official Simple Icons hex, as published. */
|
|
23
|
+
base: string;
|
|
24
|
+
light: string;
|
|
25
|
+
dark: string | null;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const FILE_BRAND_COLORS: Readonly<Record<string, FileBrandColor>> = Object.fromEntries(
|
|
29
|
+
Object.entries(BRAND_ICONS).map(([name, brand]) => [name, { base: brand.color, ...legiblePair(brand.color) }]),
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
/** The colour a file-type mark is painted in, or `null` for the theme ink. */
|
|
33
|
+
export function fileBrandColorFor(name: string | null | undefined, variant: 'light' | 'dark'): string | null {
|
|
34
|
+
if (!name) return null;
|
|
35
|
+
const entry = FILE_BRAND_COLORS[name];
|
|
36
|
+
if (!entry) return null;
|
|
37
|
+
return variant === 'dark' ? entry.dark : entry.light;
|
|
38
|
+
}
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The generated paint stylesheet.
|
|
8
|
+
*
|
|
9
|
+
* Three properties are load-bearing and each fails silently:
|
|
10
|
+
*
|
|
11
|
+
* - **The sheet is inside `@layer utilities` and every rule is
|
|
12
|
+
* `:where()`-wrapped.** Both halves are needed: a cascade layer beats
|
|
13
|
+
* specificity, so an unlayered rule shrugs off `text-ink/75` no matter how low
|
|
14
|
+
* its specificity is (measured: a muted folder icon kept its generated hue).
|
|
15
|
+
* Together they keep a caller's `text-error` on a missing file — and a muted
|
|
16
|
+
* `text-ink/40` on a disabled row — winning over the mode.
|
|
17
|
+
* - **Every rule is gated on `[data-icon-style="color"]`.** A rule that leaked
|
|
18
|
+
* would tint icons for a user who chose monochrome.
|
|
19
|
+
* - **Signal rows come after the hue rows**, so `--icon-hue` cannot shadow a
|
|
20
|
+
* palette signal on the same element.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
import { describe, expect, test } from 'bun:test';
|
|
24
|
+
import {
|
|
25
|
+
ICON_PAINT_STYLE_ELEMENT_ID,
|
|
26
|
+
iconPaintStyleSheet,
|
|
27
|
+
} from '@/shared/lib/icons/icon-paint-css';
|
|
28
|
+
import { BRAND_COLORS } from '@/shared/lib/models/provider/brand-color';
|
|
29
|
+
import { FILE_BRAND_COLORS } from '@/shared/lib/icons/file-brand-color';
|
|
30
|
+
import { ICON_HUE_ROWS, ICON_TINT_ROWS, ICON_TINT_TOKENS } from '@/shared/lib/icons/tint';
|
|
31
|
+
import { ICON_TONES } from '@/shared/lib/icons/tint-hues.generated';
|
|
32
|
+
|
|
33
|
+
const css = iconPaintStyleSheet();
|
|
34
|
+
const rules = css.split('\n').filter((line) => line.startsWith(':where('));
|
|
35
|
+
|
|
36
|
+
describe('the icon paint stylesheet', () => {
|
|
37
|
+
test('exports the element id the SSR shell and the client both look for', () => {
|
|
38
|
+
expect(ICON_PAINT_STYLE_ELEMENT_ID).toBe('omp-icon-paint');
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
test('the whole sheet sits in the utilities layer, and states the order first', () => {
|
|
42
|
+
// A cascade layer outranks specificity: an unlayered rule would beat the
|
|
43
|
+
// author's `text-*` class however low its own specificity is. And the ORDER
|
|
44
|
+
// has to be stated here, because this sheet is inlined into <head> and is
|
|
45
|
+
// parsed BEFORE the bundled stylesheet — a bare `@layer utilities { … }`
|
|
46
|
+
// would freeze utilities as the lowest layer and demote every utility
|
|
47
|
+
// (measured: the sidebar collapsed to a 0-width column).
|
|
48
|
+
const orderIndex = css.indexOf('@layer theme, base, components, utilities;');
|
|
49
|
+
const blockIndex = css.indexOf('@layer utilities {');
|
|
50
|
+
expect(orderIndex).toBeGreaterThanOrEqual(0);
|
|
51
|
+
expect(blockIndex).toBeGreaterThan(orderIndex);
|
|
52
|
+
expect(css.trimEnd().endsWith('}')).toBe(true);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
test('every rule either turns colour ON or states what monochrome means', () => {
|
|
56
|
+
// Three families of exception, each deliberate: the monochrome rules (the
|
|
57
|
+
// absence of the attribute is a mode too), the project accent (which belongs
|
|
58
|
+
// to the colour mode), and the tool-card rules (ink in BOTH modes).
|
|
59
|
+
const monochrome = /^:root:not\(\[data-icon-style="color"\]\)/;
|
|
60
|
+
const accent = /^:root\[data-icon-style="color"\] \.project-accent-mark/;
|
|
61
|
+
const toolCard = /^\[data-tool-row\] /;
|
|
62
|
+
for (const rule of rules) {
|
|
63
|
+
const ok =
|
|
64
|
+
rule.startsWith(':where([data-icon-style="color"]') ||
|
|
65
|
+
monochrome.test(rule) ||
|
|
66
|
+
accent.test(rule) ||
|
|
67
|
+
toolCard.test(rule);
|
|
68
|
+
expect(ok, rule.slice(0, 70)).toBe(true);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
test('monochrome paints ink, not the inherited colour, and skips inverted surfaces', () => {
|
|
73
|
+
// `currentColor` was not enough: a `Check` inside a green chip INHERITS the
|
|
74
|
+
// chip's green, so two icons survived a monochrome pass that way.
|
|
75
|
+
expect(css).toContain(
|
|
76
|
+
':root:not([data-icon-style="color"]) svg.lucide:not([class*="text-ink"]):not(.bg-ink *) { color: var(--theme-ink); }',
|
|
77
|
+
);
|
|
78
|
+
expect(css).toContain(':root:not([data-icon-style="color"]) [data-plugin-mark] { --plugin-color: currentColor; }');
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
test('a tool card is ink in both modes, so the transcript never turns into confetti', () => {
|
|
82
|
+
expect(css).toContain('[data-tool-row] svg.lucide:not([class*="text-ink"]):not(.bg-ink *) { color: var(--theme-ink); }');
|
|
83
|
+
expect(css).toContain('[data-tool-row] [data-plugin-mark] { --plugin-color: var(--theme-ink); }');
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
test('a muted ink icon takes its hue, muted toward the ink rather than faded out', () => {
|
|
87
|
+
// `text-ink/60` is a WEIGHT. It is (0,1,0) and the hue rules are (0,0,0), so
|
|
88
|
+
// the mute won and every muted icon stayed ink in the colour mode — the
|
|
89
|
+
// reported "icon di setting modal kenapa gk full color".
|
|
90
|
+
expect(css).toContain('[data-icon-style="color"] svg.lucide:not(.project-accent-mark)[class*="text-ink/60"] { color: color-mix(in srgb,');
|
|
91
|
+
expect(css).toContain('[data-icon-style="color"] svg.lucide:not(.project-accent-mark)[class~="text-ink"] { color: var(--icon-tone, hsl(var(--icon-hue');
|
|
92
|
+
// Mixed toward the INK, never toward transparency: a hue at 40% alpha is
|
|
93
|
+
// 1.56:1 against its surface, worse than the `text-ink/40` it replaces.
|
|
94
|
+
const muted = css.split('\n').find((line) => line.includes('text-ink/40"')) ?? '';
|
|
95
|
+
expect(muted).toContain('var(--theme-ink)');
|
|
96
|
+
expect(muted).not.toContain('transparent');
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
test('the project accent survives the dark ink weights', () => {
|
|
100
|
+
// Each folder mark carries the user's OWN colour as `--project-accent`, and
|
|
101
|
+
// the call sites also write `text-ink/70`. The dark weight selector is
|
|
102
|
+
// `[data-icon-style="color"][data-theme-variant="dark"] svg.lucide[class*="text-ink/70"]`
|
|
103
|
+
// = (0,4,1) — one ELEMENT above
|
|
104
|
+
// `:root[data-icon-style="color"] .project-accent-mark` = (0,4,0) — so on a
|
|
105
|
+
// dark theme every folder icon came out the same hue and light looked fine.
|
|
106
|
+
// "A weight does not apply to the user's own colour" is the fix; out-specifying
|
|
107
|
+
// it would be a tie waiting for the next attribute.
|
|
108
|
+
expect(css).toContain('[data-icon-style="color"] svg.lucide:not(.project-accent-mark)[class*="text-ink/70"]');
|
|
109
|
+
expect(css).toContain(
|
|
110
|
+
'[data-icon-style="color"][data-theme-variant="dark"] svg.lucide:not(.project-accent-mark)[class*="text-ink/70"]',
|
|
111
|
+
);
|
|
112
|
+
expect(css).toContain(':root[data-icon-style="color"] .project-accent-mark { color: var(--project-accent); }');
|
|
113
|
+
// Every weight rule, not just the one probed by hand: a single step that
|
|
114
|
+
// forgets the `:not()` is a folder mark that goes back to the shared hue.
|
|
115
|
+
const weightRules = css.split('\n').filter((line) => line.includes('svg.lucide[class*="text-ink/') || line.includes('svg.lucide:not(.project-accent-mark)[class~="text-ink"'));
|
|
116
|
+
expect(weightRules.length).toBeGreaterThan(0);
|
|
117
|
+
for (const line of weightRules) expect(line).toContain(':not(.project-accent-mark)');
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
test('the project accent belongs to the colour mode', () => {
|
|
121
|
+
expect(css).toContain(':root[data-icon-style="color"] .project-accent-mark { color: var(--project-accent); }');
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
test('every selector is wrapped in :where(), so a caller class still wins', () => {
|
|
125
|
+
for (const rule of rules) {
|
|
126
|
+
const selector = rule.slice(0, rule.indexOf('{'));
|
|
127
|
+
// Balanced `:where(` and `)`: every compound in the selector is wrapped.
|
|
128
|
+
const opens = selector.split(':where(').length - 1;
|
|
129
|
+
const closes = selector.split(')').length - 1;
|
|
130
|
+
expect(opens, selector).toBeGreaterThan(0);
|
|
131
|
+
expect(closes, selector).toBe(opens);
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
test('the base hue rule paints a custom-property hsl(), per variant', () => {
|
|
136
|
+
expect(css).toContain(':where(svg.lucide) { color: hsl(var(--icon-hue,');
|
|
137
|
+
expect(css).toContain(':where([data-icon-style="color"][data-theme-variant="dark"]) :where(svg.lucide) { color: hsl(var(--icon-hue,');
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
test('one hue statement per generated row', () => {
|
|
141
|
+
for (const { className, hue } of ICON_HUE_ROWS) {
|
|
142
|
+
expect(css).toContain(`:where(svg.${className}) { --icon-hue: ${hue}; --icon-tone: ${ICON_TONES[hue]}; }`);
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
test('every signal row paints its palette token, after the hue rows', () => {
|
|
147
|
+
const hueIndex = css.indexOf('--icon-hue');
|
|
148
|
+
for (const { className, role } of ICON_TINT_ROWS) {
|
|
149
|
+
const needle = `:where(svg.${className}) { color: ${ICON_TINT_TOKENS[role]}; }`;
|
|
150
|
+
expect(css).toContain(needle);
|
|
151
|
+
expect(css.indexOf(needle), `${className} must follow the hue rules`).toBeGreaterThan(hueIndex);
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
test('every provider row paints both variants', () => {
|
|
156
|
+
for (const [name, entry] of Object.entries(BRAND_COLORS)) {
|
|
157
|
+
const selector = `svg[data-provider="${name}"]`;
|
|
158
|
+
expect(css).toContain(`:where(${selector}) { color: ${entry.light}; }`);
|
|
159
|
+
expect(css).toContain(`color: ${entry.dark ?? 'var(--theme-ink)'}; }`);
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
test('every file-brand row paints both variants', () => {
|
|
164
|
+
for (const [name, entry] of Object.entries(FILE_BRAND_COLORS)) {
|
|
165
|
+
const selector = `svg[data-file-brand="${name}"]`;
|
|
166
|
+
expect(css).toContain(`:where(${selector}) { color: ${entry.light}; }`);
|
|
167
|
+
expect(css).toContain(`color: ${entry.dark ?? 'var(--theme-ink)'}; }`);
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
test('a plugin mark takes a runtime hue through --plugin-color', () => {
|
|
172
|
+
// The hue is `hashHue(name)`, which no build can enumerate: the component
|
|
173
|
+
// sets `--icon-hue` inline and these rules turn it into paint.
|
|
174
|
+
expect(css).toContain(':where([data-plugin-mark]) { --plugin-color: var(--plugin-declared-light, var(--icon-tone, hsl(var(--icon-hue,');
|
|
175
|
+
expect(css).toContain(':where([data-icon-style="color"][data-theme-variant="dark"]) :where([data-plugin-mark])');
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
test('a panel mark outranks a caller state class, and dims by LUMINANCE', () => {
|
|
179
|
+
// Two surfaces write a WEIGHT (`text-ink/70`, `text-ink/30`) to say whether
|
|
180
|
+
// a panel is active: the rail's button and the Built-in list's off row. A
|
|
181
|
+
// zero-specificity hue rule lost to it, which is what kept the right rail
|
|
182
|
+
// monochrome. These rules carry enough specificity to win, `:not(.bg-ink *)`
|
|
183
|
+
// keeps an inverted chip on its own foreground, and `[data-idle]` replaces
|
|
184
|
+
// the colour as the state instead of stacking a second one on top.
|
|
185
|
+
expect(css).toContain(':root[data-icon-style="color"] [data-panel-mark]:not(.bg-ink *) svg.lucide { color: var(--panel-color-light, var(--panel-tone, hsl(var(--panel-hue, var(--icon-hue,');
|
|
186
|
+
expect(css).toContain(':root[data-icon-style="color"][data-theme-variant="dark"] [data-panel-mark]:not(.bg-ink *) svg.lucide');
|
|
187
|
+
// A plugin's own mark states `--plugin-color` from its name; inside a panel
|
|
188
|
+
// mark the panel's declared colour (or its assigned hue) is the authority.
|
|
189
|
+
expect(css).toContain(':root[data-icon-style="color"] [data-panel-mark] [data-plugin-mark] { --plugin-color: var(--panel-color-light,');
|
|
190
|
+
// The idle state must NOT be alpha. `opacity: 0.45` composites the hue with
|
|
191
|
+
// the rail's near-neutral chrome and throws most of the chroma away — the
|
|
192
|
+
// measured 95 → 62 on a 64px glyph, which is the "kusem" report. A brightness
|
|
193
|
+
// shift moves luminance only; the two variants shift opposite ways because
|
|
194
|
+
// "recede" is darker on ink and lighter on paper.
|
|
195
|
+
expect(css).toContain('[data-icon-style="color"] [data-panel-mark][data-idle]:not([data-declared]) { filter: brightness(1.08) saturate(1.1); }');
|
|
196
|
+
expect(css).toContain(
|
|
197
|
+
'[data-icon-style="color"][data-theme-variant="dark"] [data-panel-mark][data-idle]:not([data-declared]) { filter: brightness(0.62) saturate(1.4); }',
|
|
198
|
+
);
|
|
199
|
+
// And the state must not be stated twice: an opacity left behind would
|
|
200
|
+
// desaturate exactly what the filter restored.
|
|
201
|
+
expect(css).not.toContain('[data-panel-mark][data-idle] { opacity');
|
|
202
|
+
// A plugin that DECLARES its own colour is exempt: the settings card draws
|
|
203
|
+
// the same mark at full strength, and one brand in two intensities is what
|
|
204
|
+
// made the two views disagree.
|
|
205
|
+
expect(css).toContain('[data-panel-mark][data-idle]:not([data-declared])');
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
test('an inverted surface takes its own foreground, not a hue', () => {
|
|
209
|
+
// `bg-ink` is the palette's FOREGROUND used as a fill, so it is dark on a
|
|
210
|
+
// light theme and light on a dark one — a paper-tuned hue is invisible on it
|
|
211
|
+
// in one of the two (measured 1.6:1 and 1.9:1 on the primary New Session
|
|
212
|
+
// button). Swapping the variant is not enough either: several palettes have a
|
|
213
|
+
// mid-tone ink (`#586e75`, `#93a1a1`), where no hue at any lightness clears
|
|
214
|
+
// 3:1. The surface already declares `text-canvas`/`text-paper`, and the
|
|
215
|
+
// palette guarantees that pair, so the icon inherits it.
|
|
216
|
+
expect(css).toContain(':where([data-icon-style="color"]) :where(.bg-ink) :where(svg.lucide) { color: currentColor; }');
|
|
217
|
+
expect(css).toContain(':where([data-icon-style="color"]) :where(.bg-ink) :where([data-plugin-mark]) { --plugin-color: currentColor; }');
|
|
218
|
+
// Same zero specificity as the base rules, so it has to come AFTER them.
|
|
219
|
+
expect(css.indexOf(':where(.bg-ink) :where(svg.lucide)')).toBeGreaterThan(css.indexOf(':where(svg.lucide) { color: hsl(var(--icon-hue'));
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
test('a plugin manifest colour wins over the hashed hue', () => {
|
|
223
|
+
// `--panel-declared`/`--panel-color` is the plugin's OWN brand, and the
|
|
224
|
+
// hashed hue is only the fallback — the order inside the `var()` chain is the
|
|
225
|
+
// contract, so it is pinned literally.
|
|
226
|
+
expect(css).toContain('--plugin-color: var(--plugin-declared-light, var(--icon-tone, hsl(var(--icon-hue');
|
|
227
|
+
expect(css).toContain('--plugin-color: var(--plugin-declared-dark, hsl(var(--icon-hue');
|
|
228
|
+
expect(css).toContain('color: var(--panel-color-light, var(--panel-tone, hsl(var(--panel-hue, var(--icon-hue,');
|
|
229
|
+
expect(css).toContain('color: var(--panel-color-dark, hsl(var(--panel-hue, var(--icon-hue,');
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
test('the string is cached, not rebuilt per call', () => {
|
|
233
|
+
expect(iconPaintStyleSheet()).toBe(css);
|
|
234
|
+
});
|
|
235
|
+
});
|