@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,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* How legible a brand colour is on the palettes this build actually ships.
|
|
8
|
+
*
|
|
9
|
+
* Brand art arrives with ONE hex, chosen by the brand for its own background.
|
|
10
|
+
* Kabmo paints it on 63 palettes, so "the brand's colour" is not paintable
|
|
11
|
+
* as-is: measured, `claude`'s `#D97757` reads 2.77:1 on `#f4f1ea` (the darkest
|
|
12
|
+
* light paper shipped) while it is 5.25:1 on `#201E2B` (the lightest dark one).
|
|
13
|
+
* This module is the one place that decides what to paint instead, so the
|
|
14
|
+
* provider table and the file-type table cannot disagree about the rule.
|
|
15
|
+
*
|
|
16
|
+
* Two properties are load-bearing:
|
|
17
|
+
*
|
|
18
|
+
* - **The worst surface is MEASURED, not assumed.** It is the minimum contrast
|
|
19
|
+
* against every palette of that variant (`THEMES`), not against one hardcoded
|
|
20
|
+
* hex — a new palette with a mid-tone paper would otherwise silently drop a
|
|
21
|
+
* mark below the floor. Cost is 63 comparisons per brand, once per process.
|
|
22
|
+
* - **A near-monochrome brand gets NO dark value.** `#000000` mixed toward white
|
|
23
|
+
* lands on `#737373`, which is indistinguishable from the ink it was meant to
|
|
24
|
+
* replace while claiming to be a brand colour; those brands are drawn in the
|
|
25
|
+
* theme's ink instead (`dark: null`), which is what the reference
|
|
26
|
+
* implementation does with `filter: invert()`.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
import { THEMES } from '@/shared/lib/theme/catalog';
|
|
30
|
+
import { mixHex, parseHexColor, relativeLuminance } from '@/shared/lib/theme/color';
|
|
31
|
+
|
|
32
|
+
/** WCAG's non-text floor: an icon is a graphic, not body copy. */
|
|
33
|
+
export const BRAND_CONTRAST_FLOOR = 3;
|
|
34
|
+
|
|
35
|
+
/** Below this channel spread a hex carries no hue worth keeping. */
|
|
36
|
+
const MONOCHROME_CHROMA = 24;
|
|
37
|
+
|
|
38
|
+
/** The largest step the mixer takes while searching for a legible shade. */
|
|
39
|
+
const MIX_STEP = 5;
|
|
40
|
+
const MIX_MAX = 95;
|
|
41
|
+
|
|
42
|
+
export function contrastRatio(a: string, b: string): number {
|
|
43
|
+
const [hi, lo] = [relativeLuminance(a), relativeLuminance(b)].sort((x, y) => y - x);
|
|
44
|
+
return (hi + 0.05) / (lo + 0.05);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** Channel spread of a hex: at most 24 apart means the art is monochrome. */
|
|
48
|
+
export function isNearMonochrome(hex: string): boolean {
|
|
49
|
+
const color = parseHexColor(hex);
|
|
50
|
+
if (!color) return true;
|
|
51
|
+
return Math.max(color.r, color.g, color.b) - Math.min(color.r, color.g, color.b) < MONOCHROME_CHROMA;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* The lowest contrast `color` reaches on any palette surface of `variant`.
|
|
56
|
+
*
|
|
57
|
+
* `paper` is the surface a mark is drawn on (a plate, a row, a card); the
|
|
58
|
+
* canvas is behind panels and never touches a mark directly.
|
|
59
|
+
*/
|
|
60
|
+
export function worstSurfaceContrast(color: string, variant: 'light' | 'dark'): number {
|
|
61
|
+
let worst = Number.POSITIVE_INFINITY;
|
|
62
|
+
for (const theme of THEMES) {
|
|
63
|
+
if (theme.variant !== variant) continue;
|
|
64
|
+
worst = Math.min(worst, contrastRatio(color, theme.paper));
|
|
65
|
+
}
|
|
66
|
+
return worst === Number.POSITIVE_INFINITY ? BRAND_CONTRAST_FLOOR : worst;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** `hex` moved toward `toward` in 5% steps until it clears the floor. */
|
|
70
|
+
function legibleToward(hex: string, toward: string, variant: 'light' | 'dark'): string {
|
|
71
|
+
if (worstSurfaceContrast(hex, variant) >= BRAND_CONTRAST_FLOOR) return hex;
|
|
72
|
+
for (let percent = MIX_STEP; percent <= MIX_MAX; percent += MIX_STEP) {
|
|
73
|
+
const mixed = mixHex(hex, toward, percent / 100);
|
|
74
|
+
if (worstSurfaceContrast(mixed, variant) >= BRAND_CONTRAST_FLOOR) return mixed;
|
|
75
|
+
}
|
|
76
|
+
return hex;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* The two values a brand colour is painted in.
|
|
81
|
+
*
|
|
82
|
+
* The light value is the brand hex, or the same hue mixed toward black until it
|
|
83
|
+
* clears the floor on every light palette; the dark value is the mirror image
|
|
84
|
+
* toward white. `dark: null` means "this brand is monochrome art — draw it in
|
|
85
|
+
* the theme's ink", which is the only honest answer for a black logo.
|
|
86
|
+
*/
|
|
87
|
+
export function legiblePair(base: string): { light: string; dark: string | null } {
|
|
88
|
+
const light = legibleToward(base, '#000000', 'light');
|
|
89
|
+
const dark = isNearMonochrome(base) ? null : legibleToward(base, '#ffffff', 'dark');
|
|
90
|
+
return { light, dark };
|
|
91
|
+
}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Dark palettes ported verbatim from OpenChamber
|
|
8
|
+
* (packages/ui/src/lib/theme/themes/*.json, MIT, upstream `main`), split out of
|
|
9
|
+
* `dark.ts` only because that file is at the 350-line ceiling.
|
|
10
|
+
*
|
|
11
|
+
* Only the values Kabmo consumes are carried: surface.background -> canvas,
|
|
12
|
+
* surface.elevated -> paper, surface.foreground -> ink, status.* -> signal
|
|
13
|
+
* colors, primary.base -> accent. Field order is the swatch order.
|
|
14
|
+
*
|
|
15
|
+
* The same two normalizations as `light-extended.ts` apply: `osaka-jade`'s ids
|
|
16
|
+
* are spelled `${family}-${variant}` here (upstream's dark file names itself
|
|
17
|
+
* without the variant), and `opencode`'s opaque `#rrggbbff` values drop the
|
|
18
|
+
* alpha byte.
|
|
19
|
+
*
|
|
20
|
+
* Generated data — re-port rather than hand-editing a color here.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
import type { ThemePalette } from '@/shared/types/theme';
|
|
24
|
+
|
|
25
|
+
export const DARK_EXTENDED_PALETTES = [
|
|
26
|
+
{
|
|
27
|
+
id: 'aurora-dark',
|
|
28
|
+
name: 'Aurora',
|
|
29
|
+
family: 'aurora',
|
|
30
|
+
variant: 'dark',
|
|
31
|
+
canvas: '#131515',
|
|
32
|
+
paper: '#181b1b',
|
|
33
|
+
ink: '#ced2d2',
|
|
34
|
+
error: '#df746d',
|
|
35
|
+
success: '#6bce71',
|
|
36
|
+
info: '#67abe5',
|
|
37
|
+
warning: '#e2a85c',
|
|
38
|
+
meta: '#239d6a',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
id: 'cursor-dark',
|
|
42
|
+
name: 'Cursor',
|
|
43
|
+
family: 'cursor',
|
|
44
|
+
variant: 'dark',
|
|
45
|
+
canvas: '#1a1a1a',
|
|
46
|
+
paper: '#232323',
|
|
47
|
+
ink: '#e1e1e2',
|
|
48
|
+
error: '#c6747b',
|
|
49
|
+
success: '#A3BE8C',
|
|
50
|
+
info: '#81A1C1',
|
|
51
|
+
warning: '#EBCB8B',
|
|
52
|
+
meta: '#4c9df3',
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
id: 'everforest-dark',
|
|
56
|
+
name: 'Everforest',
|
|
57
|
+
family: 'everforest',
|
|
58
|
+
variant: 'dark',
|
|
59
|
+
canvas: '#1c252b',
|
|
60
|
+
paper: '#222c32',
|
|
61
|
+
ink: '#f0efed',
|
|
62
|
+
error: '#e67e80',
|
|
63
|
+
success: '#a7c080',
|
|
64
|
+
info: '#83afe0',
|
|
65
|
+
warning: '#e69875',
|
|
66
|
+
meta: '#a7c080',
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
id: 'github-dark',
|
|
70
|
+
name: 'GitHub',
|
|
71
|
+
family: 'github',
|
|
72
|
+
variant: 'dark',
|
|
73
|
+
canvas: '#0a0e14',
|
|
74
|
+
paper: '#13171e',
|
|
75
|
+
ink: '#d7d8da',
|
|
76
|
+
error: '#f85149',
|
|
77
|
+
success: '#3fb950',
|
|
78
|
+
info: '#83afe0',
|
|
79
|
+
warning: '#e3b341',
|
|
80
|
+
meta: '#58a6ff',
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
id: 'material-dark',
|
|
84
|
+
name: 'Material',
|
|
85
|
+
family: 'material',
|
|
86
|
+
variant: 'dark',
|
|
87
|
+
canvas: '#1a252a',
|
|
88
|
+
paper: '#212c31',
|
|
89
|
+
ink: '#edeff0',
|
|
90
|
+
error: '#f07178',
|
|
91
|
+
success: '#c3e88d',
|
|
92
|
+
info: '#83afe0',
|
|
93
|
+
warning: '#ffcb6b',
|
|
94
|
+
meta: '#82aaff',
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
id: 'opencode-dark',
|
|
98
|
+
name: 'OpenCode',
|
|
99
|
+
family: 'opencode',
|
|
100
|
+
variant: 'dark',
|
|
101
|
+
canvas: '#161616',
|
|
102
|
+
paper: '#1f1f1f',
|
|
103
|
+
ink: '#dfdfdf',
|
|
104
|
+
error: '#f17471',
|
|
105
|
+
success: '#6bd586',
|
|
106
|
+
info: '#7698fd',
|
|
107
|
+
warning: '#f2cf76',
|
|
108
|
+
meta: '#637ef8',
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
id: 'osaka-jade-dark',
|
|
112
|
+
name: 'Osaka Jade',
|
|
113
|
+
family: 'osaka-jade',
|
|
114
|
+
variant: 'dark',
|
|
115
|
+
canvas: '#0a1611',
|
|
116
|
+
paper: '#121f18',
|
|
117
|
+
ink: '#d9dbd6',
|
|
118
|
+
error: '#ff5345',
|
|
119
|
+
success: '#63b07a',
|
|
120
|
+
info: '#82aecb',
|
|
121
|
+
warning: '#e7c831',
|
|
122
|
+
meta: '#2dd5b7',
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
id: 'rose-pine-dark',
|
|
126
|
+
name: 'Rose Pine',
|
|
127
|
+
family: 'rose-pine',
|
|
128
|
+
variant: 'dark',
|
|
129
|
+
canvas: '#12101d',
|
|
130
|
+
paper: '#1c1a28',
|
|
131
|
+
ink: '#dbdade',
|
|
132
|
+
error: '#eb6f92',
|
|
133
|
+
success: '#80b888',
|
|
134
|
+
info: '#9ccfd8',
|
|
135
|
+
warning: '#f6c177',
|
|
136
|
+
meta: '#9ccfd8',
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
id: 'vercel-dark',
|
|
140
|
+
name: 'Vercel',
|
|
141
|
+
family: 'vercel',
|
|
142
|
+
variant: 'dark',
|
|
143
|
+
canvas: '#000000',
|
|
144
|
+
paper: '#070707',
|
|
145
|
+
ink: '#cfcfcf',
|
|
146
|
+
error: '#E5484D',
|
|
147
|
+
success: '#46A758',
|
|
148
|
+
info: '#52A8FF',
|
|
149
|
+
warning: '#FFB224',
|
|
150
|
+
meta: '#0674f3',
|
|
151
|
+
},
|
|
152
|
+
] as const satisfies readonly ThemePalette[];
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Light palettes ported verbatim from OpenChamber
|
|
8
|
+
* (packages/ui/src/lib/theme/themes/*.json, MIT, upstream `main`), split out of
|
|
9
|
+
* `light.ts` only because that file is at the 350-line ceiling.
|
|
10
|
+
*
|
|
11
|
+
* Only the values Kabmo consumes are carried: surface.background -> canvas,
|
|
12
|
+
* surface.elevated -> paper, surface.foreground -> ink, status.* -> signal
|
|
13
|
+
* colors, primary.base -> accent. Field order is the swatch order.
|
|
14
|
+
*
|
|
15
|
+
* These are the families upstream added AFTER the snapshot `light.ts` records,
|
|
16
|
+
* and they are the ones this catalog was missing. Two normalizations, stated
|
|
17
|
+
* because neither changes a color:
|
|
18
|
+
*
|
|
19
|
+
* - `osaka-jade-refined`'s upstream ids disagree across the pair (the dark file
|
|
20
|
+
* calls itself `osaka-jade-refined`); the catalog's own `${family}-${variant}`
|
|
21
|
+
* shape is used instead, and the shared name drops the per-variant suffix.
|
|
22
|
+
* - `opencode`'s JSON carries `#rrggbbff` — opaque, so the alpha byte is
|
|
23
|
+
* dropped. An 8-digit value that only ever says "1.0" is noise in a palette.
|
|
24
|
+
*
|
|
25
|
+
* Generated data — re-port rather than hand-editing a color here.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
import type { ThemePalette } from '@/shared/types/theme';
|
|
29
|
+
|
|
30
|
+
export const LIGHT_EXTENDED_PALETTES = [
|
|
31
|
+
{
|
|
32
|
+
id: 'aurora-light',
|
|
33
|
+
name: 'Aurora',
|
|
34
|
+
family: 'aurora',
|
|
35
|
+
variant: 'light',
|
|
36
|
+
canvas: '#fdfcfa',
|
|
37
|
+
paper: '#f0f3f1',
|
|
38
|
+
ink: '#48423d',
|
|
39
|
+
error: '#b63b32',
|
|
40
|
+
success: '#507308',
|
|
41
|
+
info: '#1b69ad',
|
|
42
|
+
warning: '#975d04',
|
|
43
|
+
meta: '#063e2a',
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
id: 'cursor-light',
|
|
47
|
+
name: 'Cursor',
|
|
48
|
+
family: 'cursor',
|
|
49
|
+
variant: 'light',
|
|
50
|
+
canvas: '#FCFCFC',
|
|
51
|
+
paper: '#f2f2f2',
|
|
52
|
+
ink: '#454a50',
|
|
53
|
+
error: '#A3424B',
|
|
54
|
+
success: '#467037',
|
|
55
|
+
info: '#315D9B',
|
|
56
|
+
warning: '#806015',
|
|
57
|
+
meta: '#2567A8',
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
id: 'everforest-light',
|
|
61
|
+
name: 'Everforest',
|
|
62
|
+
family: 'everforest',
|
|
63
|
+
variant: 'light',
|
|
64
|
+
canvas: '#fdf8e8',
|
|
65
|
+
paper: '#f5f2e2',
|
|
66
|
+
ink: '#3b474e',
|
|
67
|
+
error: '#c4222a',
|
|
68
|
+
success: '#66731b',
|
|
69
|
+
info: '#366eaa',
|
|
70
|
+
warning: '#ad5410',
|
|
71
|
+
meta: '#65740b',
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
id: 'github-light',
|
|
75
|
+
name: 'GitHub',
|
|
76
|
+
family: 'github',
|
|
77
|
+
variant: 'light',
|
|
78
|
+
canvas: '#ffffff',
|
|
79
|
+
paper: '#f5f5f4',
|
|
80
|
+
ink: '#464a4e',
|
|
81
|
+
error: '#8f0617',
|
|
82
|
+
success: '#105122',
|
|
83
|
+
info: '#09448f',
|
|
84
|
+
warning: '#664407',
|
|
85
|
+
meta: '#0f69d8',
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
id: 'material-light',
|
|
89
|
+
name: 'Material',
|
|
90
|
+
family: 'material',
|
|
91
|
+
variant: 'light',
|
|
92
|
+
canvas: '#fafafa',
|
|
93
|
+
paper: '#f1f1f0',
|
|
94
|
+
ink: '#3e484c',
|
|
95
|
+
error: '#aa0d15',
|
|
96
|
+
success: '#537702',
|
|
97
|
+
info: '#12787f',
|
|
98
|
+
warning: '#8f6510',
|
|
99
|
+
meta: '#19787f',
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
id: 'opencode-light',
|
|
103
|
+
name: 'OpenCode',
|
|
104
|
+
family: 'opencode',
|
|
105
|
+
variant: 'light',
|
|
106
|
+
canvas: '#ffffff',
|
|
107
|
+
paper: '#fafafa',
|
|
108
|
+
ink: '#4a4a4a',
|
|
109
|
+
error: '#b82d35',
|
|
110
|
+
success: '#18833f',
|
|
111
|
+
info: '#3250df',
|
|
112
|
+
warning: '#8c6e24',
|
|
113
|
+
meta: '#3b5cf6',
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
id: 'osaka-jade-light',
|
|
117
|
+
name: 'Osaka Jade',
|
|
118
|
+
family: 'osaka-jade',
|
|
119
|
+
variant: 'light',
|
|
120
|
+
canvas: '#f1eee8',
|
|
121
|
+
paper: '#e7e4de',
|
|
122
|
+
ink: '#40463e',
|
|
123
|
+
error: '#8f110b',
|
|
124
|
+
success: '#02532a',
|
|
125
|
+
info: '#33679f',
|
|
126
|
+
warning: '#73650e',
|
|
127
|
+
meta: '#197160',
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
id: 'rose-pine-light',
|
|
131
|
+
name: 'Rose Pine',
|
|
132
|
+
family: 'rose-pine',
|
|
133
|
+
variant: 'light',
|
|
134
|
+
canvas: '#fbf5ef',
|
|
135
|
+
paper: '#f5ede7',
|
|
136
|
+
ink: '#464061',
|
|
137
|
+
error: '#942a50',
|
|
138
|
+
success: '#347846',
|
|
139
|
+
info: '#0c4b62',
|
|
140
|
+
warning: '#965f0b',
|
|
141
|
+
meta: '#177394',
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
id: 'vercel-light',
|
|
145
|
+
name: 'Vercel',
|
|
146
|
+
family: 'vercel',
|
|
147
|
+
variant: 'light',
|
|
148
|
+
canvas: '#ffffff',
|
|
149
|
+
paper: '#f4f4f4',
|
|
150
|
+
ink: '#4a4a4a',
|
|
151
|
+
error: '#a10725',
|
|
152
|
+
success: '#14621b',
|
|
153
|
+
info: '#0a4ca2',
|
|
154
|
+
warning: '#a35d02',
|
|
155
|
+
meta: '#0769e1',
|
|
156
|
+
},
|
|
157
|
+
] as const satisfies readonly ThemePalette[];
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The surface style's contract.
|
|
8
|
+
*
|
|
9
|
+
* The rule that matters is the FALLBACK and the DEFAULT: a stored value this
|
|
10
|
+
* build cannot draw must resolve to the shipped default, and that default must
|
|
11
|
+
* be the opaque style — a document that resolved to `glass` by accident would
|
|
12
|
+
* restyle every window on upgrade.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { describe, expect, test } from 'bun:test';
|
|
16
|
+
import {
|
|
17
|
+
DEFAULT_SURFACE_STYLE,
|
|
18
|
+
SURFACE_ATTRIBUTE,
|
|
19
|
+
SURFACE_STYLES,
|
|
20
|
+
SURFACE_STYLE_COPY,
|
|
21
|
+
isSurfaceStyle,
|
|
22
|
+
resolveSurfaceStyle,
|
|
23
|
+
} from '@/shared/lib/theme/surface-style';
|
|
24
|
+
|
|
25
|
+
describe('isSurfaceStyle', () => {
|
|
26
|
+
test('accepts exactly the two styles', () => {
|
|
27
|
+
expect(SURFACE_STYLES.map(isSurfaceStyle)).toEqual([true, true]);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
test('refuses what another build or a corrupted blob could carry', () => {
|
|
31
|
+
for (const value of ['', 'Glass', 'frosted', 'blurred', 0, 1, true, null, undefined, {}, ['glass']]) {
|
|
32
|
+
expect(isSurfaceStyle(value)).toBe(false);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
describe('resolveSurfaceStyle', () => {
|
|
38
|
+
test('keeps a style this build draws', () => {
|
|
39
|
+
expect(resolveSurfaceStyle('classic')).toBe('classic');
|
|
40
|
+
expect(resolveSurfaceStyle('glass')).toBe('glass');
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
test('an unknown value lands on the shipped default, not on undefined', () => {
|
|
44
|
+
expect(resolveSurfaceStyle('liquid')).toBe(DEFAULT_SURFACE_STYLE);
|
|
45
|
+
expect(resolveSurfaceStyle(undefined)).toBe(DEFAULT_SURFACE_STYLE);
|
|
46
|
+
expect(resolveSurfaceStyle(null)).toBe(DEFAULT_SURFACE_STYLE);
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
describe('the style table', () => {
|
|
51
|
+
test('the default is the opaque style, so an upgrade restyles nothing', () => {
|
|
52
|
+
expect(DEFAULT_SURFACE_STYLE).toBe('classic');
|
|
53
|
+
expect(SURFACE_STYLES).toContain(DEFAULT_SURFACE_STYLE);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
test('the attribute is a plain `data-` name', () => {
|
|
57
|
+
expect(SURFACE_ATTRIBUTE).toBe('data-surface');
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
test('every style carries its own label, caption and description', () => {
|
|
61
|
+
const labels = SURFACE_STYLES.map((style) => SURFACE_STYLE_COPY[style].label);
|
|
62
|
+
expect(new Set(labels).size).toBe(SURFACE_STYLES.length);
|
|
63
|
+
for (const style of SURFACE_STYLES) {
|
|
64
|
+
expect(SURFACE_STYLE_COPY[style].description.length).toBeGreaterThan(0);
|
|
65
|
+
expect(SURFACE_STYLE_COPY[style].caption.length).toBeGreaterThan(0);
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
});
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* How the app's surfaces are painted, as ONE of two styles.
|
|
8
|
+
*
|
|
9
|
+
* This is a PRESENTATION choice over the same shell: both styles render the
|
|
10
|
+
* same panels, rows, controls and dialogs. Nothing is hidden, moved or
|
|
11
|
+
* re-ordered — only the material the surfaces are cut from changes, which is
|
|
12
|
+
* why this module states names and copy while `src/client/tailwind.css` states
|
|
13
|
+
* every pixel.
|
|
14
|
+
*
|
|
15
|
+
* - `classic` — opaque paper over the palette's canvas. The look Kabmo has
|
|
16
|
+
* always shipped, and the DEFAULT: an upgrade must not restyle a window the
|
|
17
|
+
* user did not ask to change (the rule `DEFAULT_SIDEBAR_STYLE` follows).
|
|
18
|
+
* - `glass` — one frosted plane over a palette-coloured aura, with the
|
|
19
|
+
* panels above it as translucent tints. The plane owns the blur (a single
|
|
20
|
+
* `backdrop-filter` per window), so the panel count does not decide the
|
|
21
|
+
* frame budget.
|
|
22
|
+
*
|
|
23
|
+
* The style reaches the document as `data-surface` on `<html>`, never as a
|
|
24
|
+
* prop: the sidebar, the navbar, the composer and every modal are separate
|
|
25
|
+
* subtrees, and a prop would be one call site each — the exact shape that lets
|
|
26
|
+
* one surface stay classic while the rest turn to glass.
|
|
27
|
+
*
|
|
28
|
+
* A style added here without a CSS rule renders EXACTLY like `classic`, and the
|
|
29
|
+
* settings card is the only place that can notice. There is deliberately no
|
|
30
|
+
* error for that: an attribute with no matching rule is a valid document.
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
export type SurfaceStyle = 'classic' | 'glass';
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The style a document with no stored preference renders at — the one Kabmo
|
|
37
|
+
* shipped before the setting existed, so an upgrade changes nothing.
|
|
38
|
+
*/
|
|
39
|
+
export const DEFAULT_SURFACE_STYLE: SurfaceStyle = 'classic';
|
|
40
|
+
|
|
41
|
+
/** Document attribute carrying the style. Read by CSS only. */
|
|
42
|
+
export const SURFACE_ATTRIBUTE = 'data-surface';
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* `app_settings` key holding the style, in the `kabmo_settings` blob.
|
|
46
|
+
*
|
|
47
|
+
* It lives HERE, beside the type and the copy, because two processes read it:
|
|
48
|
+
* the browser (`client/hooks/ui/surface-style.ts`) and the SSR shell that has to
|
|
49
|
+
* paint the first frame (`server/lib/assets/shell-attributes.server.ts`). A key
|
|
50
|
+
* spelled at both ends is a setting that saves and never loads.
|
|
51
|
+
*/
|
|
52
|
+
export const SURFACE_STYLE_SETTING_KEY = 'surfaceStyle';
|
|
53
|
+
|
|
54
|
+
/** Every style, in the order the settings control lists them. */
|
|
55
|
+
export const SURFACE_STYLES = ['classic', 'glass'] as const;
|
|
56
|
+
|
|
57
|
+
/** A stored value written by another build is not a style this one can draw. */
|
|
58
|
+
export function isSurfaceStyle(value: unknown): value is SurfaceStyle {
|
|
59
|
+
return value === 'classic' || value === 'glass';
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* The style to APPLY for a stored value. Anything this build cannot draw — a
|
|
64
|
+
* value from a newer build, a corrupted blob, `undefined` on a fresh install —
|
|
65
|
+
* resolves to the default rather than to a rule that does not exist.
|
|
66
|
+
*/
|
|
67
|
+
export function resolveSurfaceStyle(value: unknown): SurfaceStyle {
|
|
68
|
+
return isSurfaceStyle(value) ? value : DEFAULT_SURFACE_STYLE;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface SurfaceStyleCopy {
|
|
72
|
+
/** Card title. */
|
|
73
|
+
label: string;
|
|
74
|
+
/** One line under the title: the tradeoff, not the aesthetic. */
|
|
75
|
+
description: string;
|
|
76
|
+
/** The card's miniature caption, so the drawing is not the only cue. */
|
|
77
|
+
caption: string;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export const SURFACE_STYLE_COPY: Record<SurfaceStyle, SurfaceStyleCopy> = {
|
|
81
|
+
classic: {
|
|
82
|
+
label: 'Classic',
|
|
83
|
+
description: 'Opaque panels on the palette canvas. The sharpest text, the cheapest frame, and what an upgrade keeps.',
|
|
84
|
+
caption: 'Opaque · no blur',
|
|
85
|
+
},
|
|
86
|
+
glass: {
|
|
87
|
+
label: 'Glass',
|
|
88
|
+
description: 'One frosted plane under a palette-tinted glow, with translucent panels above it. Softer edges, one blur pass per window.',
|
|
89
|
+
caption: 'Frosted · 1 blur pass',
|
|
90
|
+
},
|
|
91
|
+
};
|
|
@@ -30,7 +30,9 @@ import { mixHex, parseHexColor, relativeLuminance, rgbaToHex } from '@/shared/li
|
|
|
30
30
|
import { THEME_STYLE_ELEMENT_ID, themeStyleSheet } from '@/shared/lib/theme/css';
|
|
31
31
|
import { KABMO_PALETTES } from '@/shared/lib/theme/palettes/kabmo';
|
|
32
32
|
import { DARK_PALETTES } from '@/shared/lib/theme/palettes/dark';
|
|
33
|
+
import { DARK_EXTENDED_PALETTES } from '@/shared/lib/theme/palettes/dark-extended';
|
|
33
34
|
import { LIGHT_PALETTES } from '@/shared/lib/theme/palettes/light';
|
|
35
|
+
import { LIGHT_EXTENDED_PALETTES } from '@/shared/lib/theme/palettes/light-extended';
|
|
34
36
|
import { THEMES } from '@/shared/lib/theme/catalog';
|
|
35
37
|
|
|
36
38
|
const PALETTE_KEYS = [
|
|
@@ -160,7 +162,9 @@ describe('generated stylesheet', () => {
|
|
|
160
162
|
});
|
|
161
163
|
|
|
162
164
|
describe('palette sources', () => {
|
|
163
|
-
const
|
|
165
|
+
const LIGHT_ALL = [...LIGHT_PALETTES, ...LIGHT_EXTENDED_PALETTES];
|
|
166
|
+
const DARK_ALL = [...DARK_PALETTES, ...DARK_EXTENDED_PALETTES];
|
|
167
|
+
const all = [...KABMO_PALETTES, ...LIGHT_ALL, ...DARK_ALL];
|
|
164
168
|
|
|
165
169
|
test('every palette declares the same twelve keys', () => {
|
|
166
170
|
for (const palette of all) {
|
|
@@ -183,16 +187,16 @@ describe('palette sources', () => {
|
|
|
183
187
|
expect(seen.has(palette.id), `duplicate id ${palette.id}`).toBe(false);
|
|
184
188
|
seen.add(palette.id);
|
|
185
189
|
}
|
|
186
|
-
for (const palette of
|
|
187
|
-
for (const palette of
|
|
190
|
+
for (const palette of LIGHT_ALL) expect(palette.variant).toBe('light');
|
|
191
|
+
for (const palette of DARK_ALL) expect(palette.variant).toBe('dark');
|
|
188
192
|
expect(all.length).toBe(THEMES.length);
|
|
189
193
|
});
|
|
190
194
|
|
|
191
195
|
test('the ported families pair up: every light family has a dark twin', () => {
|
|
192
|
-
const light = new Set(
|
|
193
|
-
const dark = new Set(
|
|
194
|
-
expect(
|
|
195
|
-
expect(
|
|
196
|
+
const light = new Set(LIGHT_ALL.map((palette) => palette.family));
|
|
197
|
+
const dark = new Set(DARK_ALL.map((palette) => palette.family));
|
|
198
|
+
expect(light.size).toBe(LIGHT_ALL.length);
|
|
199
|
+
expect(dark.size).toBe(DARK_ALL.length);
|
|
196
200
|
expect([...light].filter((family) => !dark.has(family))).toEqual([]);
|
|
197
201
|
expect([...dark].filter((family) => !light.has(family))).toEqual([]);
|
|
198
202
|
});
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* One panel id, ONE hue — the property that four surfaces were breaking.
|
|
8
|
+
*
|
|
9
|
+
* The measurements that motivated this: `Files` drew at `hsl(0 …)` on the
|
|
10
|
+
* activity bar (hash of the PANEL id) and `hsl(320 …)` in Settings → Panel
|
|
11
|
+
* Plugins → Built-in (hash of the GLYPH `Files`), and `Wiki`'s `BookOpen` was
|
|
12
|
+
* `info` in Settings because a glyph that MEANS something takes a signal colour.
|
|
13
|
+
* These tests pin the two things that make the disagreement impossible: the map
|
|
14
|
+
* is derived from the whole built-in set (so it cannot depend on what a surface
|
|
15
|
+
* is drawing), and every view gets a slot of its own.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { describe, expect, test } from 'bun:test';
|
|
19
|
+
import { RIGHT_PANEL_TYPES } from '@/shared/lib/workspace/right-panels';
|
|
20
|
+
import { SESSIONS_VIEW_ID } from '@/shared/lib/workspace/left-dock';
|
|
21
|
+
import { hashHue } from '@/shared/lib/icons/tint';
|
|
22
|
+
import { panelHueOf, panelHueUniverse, resolvePanelHues } from '@/shared/lib/workspace/panel-hues';
|
|
23
|
+
|
|
24
|
+
describe('panel hues', () => {
|
|
25
|
+
test('the universe holds every built-in view and the dock view, and nothing else', () => {
|
|
26
|
+
const universe = panelHueUniverse();
|
|
27
|
+
expect(new Set(universe)).toEqual(new Set([SESSIONS_VIEW_ID, ...RIGHT_PANEL_TYPES]));
|
|
28
|
+
expect(universe.length).toBe(RIGHT_PANEL_TYPES.length + 1);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
test('every built-in view gets a hue of its own', () => {
|
|
32
|
+
// A collision is what `assignPanelHues` exists to resolve: 13 views on a
|
|
33
|
+
// 36-slot wheel collide by birthday about nine times in ten, and two
|
|
34
|
+
// neighbours on one blue is the opposite of "each panel has its colour".
|
|
35
|
+
const hues = resolvePanelHues();
|
|
36
|
+
expect(hues.size).toBe(panelHueUniverse().length);
|
|
37
|
+
expect(new Set(hues.values()).size).toBe(hues.size);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
test('the answer does not depend on what a surface draws or the order it asks', () => {
|
|
41
|
+
// The defect this replaces: the rail built its map from the panels it was
|
|
42
|
+
// DRAWING, so switching one off or dragging it recoloured the rest, and
|
|
43
|
+
// Settings (which lists the switched-off views too) could never agree.
|
|
44
|
+
// `panelHueOf` is a pure lookup on one static map.
|
|
45
|
+
const hues = resolvePanelHues();
|
|
46
|
+
const forward = panelHueUniverse().map((id) => panelHueOf(hues, id));
|
|
47
|
+
const reversed = [...panelHueUniverse()].reverse().map((id) => panelHueOf(hues, id));
|
|
48
|
+
expect(reversed).toEqual([...forward].reverse());
|
|
49
|
+
expect(panelHueOf(hues, 'files')).toBe(hues.get('files')!);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
test('an id outside the map keeps a stable hue instead of a shared default', () => {
|
|
53
|
+
// A plugin's slot id, or an id from a newer version. Falling back to
|
|
54
|
+
// `DEFAULT_ICON_HUE` would paint every unknown panel the same neutral blue,
|
|
55
|
+
// which is the "one colour for everything" failure the mode exists to avoid.
|
|
56
|
+
const hues = resolvePanelHues();
|
|
57
|
+
expect(panelHueOf(hues, 'plugin:unknown:rightPanel')).toBe(hashHue('plugin:unknown:rightPanel'));
|
|
58
|
+
expect(panelHueOf(hues, 'plugin:a:rightPanel')).not.toBe(panelHueOf(hues, 'plugin:b:rightPanel'));
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
test('a built-in hue is keyed by the PANEL id, never the glyph', () => {
|
|
62
|
+
// The literal defect: `lucide-files` hashes to 320, `files` to 0. If the map
|
|
63
|
+
// ever answered with the glyph's hue again, these two lines catch it.
|
|
64
|
+
const hues = resolvePanelHues();
|
|
65
|
+
expect(panelHueOf(hues, 'files')).toBe(hashHue('files'));
|
|
66
|
+
expect(panelHueOf(hues, 'files')).not.toBe(hashHue('Files'));
|
|
67
|
+
});
|
|
68
|
+
});
|