@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,277 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* GENERATED by `scripts/icon-tints.mjs` — do not hand-edit.
|
|
8
|
+
*
|
|
9
|
+
* One hue per functional glyph, 36 hues 10° apart, assigned by a stable hash of
|
|
10
|
+
* the icon name. The signal icons in `tint.ts` are deliberately absent: they
|
|
11
|
+
* paint a palette token, because a trash can has to be the theme's error colour
|
|
12
|
+
* and not whatever the hash said.
|
|
13
|
+
*
|
|
14
|
+
* `ICON_TONES` is the LIGHT paint for each wheel hue, solved by
|
|
15
|
+
* `shared/lib/icons/icon-tone.ts` against every light palette this build ships.
|
|
16
|
+
* It is a table rather than a call because the solve needs the palette catalog,
|
|
17
|
+
* which the client would otherwise carry — and 11k contrast checks — only to
|
|
18
|
+
* colour a toolbar glyph. Dark keeps its single `hsl()` pair: it already reads
|
|
19
|
+
* bright, and one pair is enough when the budget is not spent.
|
|
20
|
+
*
|
|
21
|
+
* Regenerate with `bun run icons:tints` after adding an icon OR a palette. The
|
|
22
|
+
* suite fails when this table and the imports disagree (`icons:tints:check`),
|
|
23
|
+
* so a stale table cannot ship.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
export const ICON_HUES: Readonly<Record<string, number>> = {
|
|
27
|
+
Activity: 240,
|
|
28
|
+
AlignJustify: 100,
|
|
29
|
+
AlignLeft: 150,
|
|
30
|
+
Archive: 50,
|
|
31
|
+
ArchiveRestore: 90,
|
|
32
|
+
ArrowDown: 100,
|
|
33
|
+
ArrowDownToLine: 330,
|
|
34
|
+
ArrowLeft: 350,
|
|
35
|
+
ArrowRight: 80,
|
|
36
|
+
ArrowUp: 150,
|
|
37
|
+
ArrowUpDown: 310,
|
|
38
|
+
BarChart3: 150,
|
|
39
|
+
Blocks: 110,
|
|
40
|
+
Bot: 220,
|
|
41
|
+
Box: 260,
|
|
42
|
+
Boxes: 220,
|
|
43
|
+
Brain: 350,
|
|
44
|
+
BrainCircuit: 300,
|
|
45
|
+
Briefcase: 310,
|
|
46
|
+
Camera: 60,
|
|
47
|
+
CaseSensitive: 110,
|
|
48
|
+
ChevronDown: 120,
|
|
49
|
+
ChevronLeft: 250,
|
|
50
|
+
ChevronRight: 300,
|
|
51
|
+
ChevronUp: 250,
|
|
52
|
+
ChevronsUpDown: 80,
|
|
53
|
+
Circle: 50,
|
|
54
|
+
CircleDot: 240,
|
|
55
|
+
ClipboardCopy: 280,
|
|
56
|
+
ClipboardList: 290,
|
|
57
|
+
ClipboardPaste: 200,
|
|
58
|
+
Cloud: 340,
|
|
59
|
+
CloudDownload: 300,
|
|
60
|
+
Code: 200,
|
|
61
|
+
Code2: 260,
|
|
62
|
+
Coins: 210,
|
|
63
|
+
Columns: 280,
|
|
64
|
+
Columns2: 20,
|
|
65
|
+
Command: 100,
|
|
66
|
+
Component: 200,
|
|
67
|
+
Copy: 320,
|
|
68
|
+
CopyPlus: 40,
|
|
69
|
+
CornerDownLeft: 10,
|
|
70
|
+
Cpu: 250,
|
|
71
|
+
Database: 280,
|
|
72
|
+
Dice5: 50,
|
|
73
|
+
Diff: 300,
|
|
74
|
+
DollarSign: 220,
|
|
75
|
+
Download: 210,
|
|
76
|
+
DownloadCloud: 180,
|
|
77
|
+
Edit2: 210,
|
|
78
|
+
Ellipsis: 100,
|
|
79
|
+
ExternalLink: 60,
|
|
80
|
+
Eye: 20,
|
|
81
|
+
EyeOff: 350,
|
|
82
|
+
File: 310,
|
|
83
|
+
FileCode: 260,
|
|
84
|
+
FileCog: 340,
|
|
85
|
+
FileEdit: 270,
|
|
86
|
+
FileImage: 40,
|
|
87
|
+
FilePlus: 350,
|
|
88
|
+
FilePlus2: 350,
|
|
89
|
+
FileSearch: 310,
|
|
90
|
+
FileText: 80,
|
|
91
|
+
Files: 320,
|
|
92
|
+
Flag: 350,
|
|
93
|
+
FlaskConical: 170,
|
|
94
|
+
Folder: 290,
|
|
95
|
+
FolderGit: 190,
|
|
96
|
+
FolderGit2: 190,
|
|
97
|
+
FolderInput: 310,
|
|
98
|
+
FolderOpen: 330,
|
|
99
|
+
FolderPlus: 250,
|
|
100
|
+
FolderSearch: 10,
|
|
101
|
+
FolderTree: 10,
|
|
102
|
+
Gamepad2: 300,
|
|
103
|
+
GitBranch: 30,
|
|
104
|
+
GitCommitVertical: 240,
|
|
105
|
+
GitCompare: 340,
|
|
106
|
+
GitFork: 30,
|
|
107
|
+
GitMerge: 90,
|
|
108
|
+
GitPullRequest: 10,
|
|
109
|
+
Globe: 340,
|
|
110
|
+
GraduationCap: 190,
|
|
111
|
+
GripVertical: 350,
|
|
112
|
+
Hammer: 310,
|
|
113
|
+
Hand: 200,
|
|
114
|
+
HardDrive: 0,
|
|
115
|
+
Hash: 330,
|
|
116
|
+
Heading: 250,
|
|
117
|
+
Heart: 270,
|
|
118
|
+
History: 110,
|
|
119
|
+
Home: 20,
|
|
120
|
+
Image: 140,
|
|
121
|
+
Key: 240,
|
|
122
|
+
KeyRound: 240,
|
|
123
|
+
Keyboard: 120,
|
|
124
|
+
Laptop: 170,
|
|
125
|
+
Layers: 30,
|
|
126
|
+
LayoutTemplate: 170,
|
|
127
|
+
Leaf: 50,
|
|
128
|
+
Library: 160,
|
|
129
|
+
Lightbulb: 0,
|
|
130
|
+
List: 170,
|
|
131
|
+
ListChecks: 320,
|
|
132
|
+
ListFilter: 230,
|
|
133
|
+
ListOrdered: 220,
|
|
134
|
+
ListTodo: 210,
|
|
135
|
+
ListTree: 330,
|
|
136
|
+
Loader2: 40,
|
|
137
|
+
Lock: 220,
|
|
138
|
+
LockKeyhole: 270,
|
|
139
|
+
LockOpen: 180,
|
|
140
|
+
LogIn: 140,
|
|
141
|
+
LogOut: 190,
|
|
142
|
+
Maximize: 310,
|
|
143
|
+
Maximize2: 270,
|
|
144
|
+
Menu: 100,
|
|
145
|
+
MessageSquare: 150,
|
|
146
|
+
MessageSquareOff: 40,
|
|
147
|
+
MessageSquarePlus: 350,
|
|
148
|
+
MessagesSquare: 220,
|
|
149
|
+
Mic: 160,
|
|
150
|
+
MicOff: 170,
|
|
151
|
+
Minimize: 290,
|
|
152
|
+
Minimize2: 130,
|
|
153
|
+
Minus: 110,
|
|
154
|
+
Monitor: 250,
|
|
155
|
+
Moon: 80,
|
|
156
|
+
MoreHorizontal: 160,
|
|
157
|
+
MousePointerClick: 70,
|
|
158
|
+
MoveVertical: 300,
|
|
159
|
+
Music: 280,
|
|
160
|
+
Package: 270,
|
|
161
|
+
Paintbrush: 250,
|
|
162
|
+
Palette: 320,
|
|
163
|
+
PanelLeft: 280,
|
|
164
|
+
PanelLeftClose: 160,
|
|
165
|
+
PanelRight: 330,
|
|
166
|
+
PanelRightClose: 350,
|
|
167
|
+
Paperclip: 310,
|
|
168
|
+
Pause: 10,
|
|
169
|
+
Pencil: 0,
|
|
170
|
+
PencilLine: 260,
|
|
171
|
+
Pin: 0,
|
|
172
|
+
PinOff: 50,
|
|
173
|
+
Pipette: 120,
|
|
174
|
+
Play: 310,
|
|
175
|
+
Plug: 50,
|
|
176
|
+
Plus: 210,
|
|
177
|
+
Power: 340,
|
|
178
|
+
Puzzle: 50,
|
|
179
|
+
Quote: 110,
|
|
180
|
+
Radio: 320,
|
|
181
|
+
Ratio: 160,
|
|
182
|
+
RefreshCw: 180,
|
|
183
|
+
Regex: 280,
|
|
184
|
+
Replace: 190,
|
|
185
|
+
ReplaceAll: 140,
|
|
186
|
+
Rocket: 210,
|
|
187
|
+
RotateCcw: 330,
|
|
188
|
+
RotateCw: 0,
|
|
189
|
+
Rows: 160,
|
|
190
|
+
Rows3: 250,
|
|
191
|
+
Save: 40,
|
|
192
|
+
SaveAll: 190,
|
|
193
|
+
Scissors: 260,
|
|
194
|
+
Search: 250,
|
|
195
|
+
Send: 110,
|
|
196
|
+
Server: 300,
|
|
197
|
+
ServerCog: 50,
|
|
198
|
+
Settings: 240,
|
|
199
|
+
Settings2: 20,
|
|
200
|
+
Shield: 160,
|
|
201
|
+
Shrink: 160,
|
|
202
|
+
Sliders: 290,
|
|
203
|
+
SlidersHorizontal: 50,
|
|
204
|
+
Smartphone: 20,
|
|
205
|
+
Space: 290,
|
|
206
|
+
Sparkles: 180,
|
|
207
|
+
Square: 60,
|
|
208
|
+
SquareFunction: 220,
|
|
209
|
+
SquarePen: 10,
|
|
210
|
+
Star: 170,
|
|
211
|
+
StickyNote: 100,
|
|
212
|
+
Store: 340,
|
|
213
|
+
Sun: 90,
|
|
214
|
+
Tablet: 290,
|
|
215
|
+
Tag: 310,
|
|
216
|
+
Target: 200,
|
|
217
|
+
Terminal: 210,
|
|
218
|
+
TextSelect: 220,
|
|
219
|
+
Ticket: 170,
|
|
220
|
+
Type: 170,
|
|
221
|
+
Undo2: 310,
|
|
222
|
+
Upload: 0,
|
|
223
|
+
UploadCloud: 50,
|
|
224
|
+
User: 140,
|
|
225
|
+
Variable: 330,
|
|
226
|
+
Volume2: 270,
|
|
227
|
+
VolumeX: 50,
|
|
228
|
+
Wand2: 270,
|
|
229
|
+
WandSparkles: 40,
|
|
230
|
+
WholeWord: 240,
|
|
231
|
+
WrapText: 340,
|
|
232
|
+
Wrench: 0,
|
|
233
|
+
X: 230,
|
|
234
|
+
Zap: 120,
|
|
235
|
+
ZoomIn: 250,
|
|
236
|
+
ZoomOut: 340,
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
/** The light paint for each wheel hue, darkest-legible-but-most-chromatic. */
|
|
240
|
+
export const ICON_TONES: Readonly<Record<number, string>> = {
|
|
241
|
+
0: '#db4241',
|
|
242
|
+
10: '#da4528',
|
|
243
|
+
20: '#cf5500',
|
|
244
|
+
30: '#b06600',
|
|
245
|
+
40: '#9e7200',
|
|
246
|
+
50: '#8e7a00',
|
|
247
|
+
60: '#808000',
|
|
248
|
+
70: '#738400',
|
|
249
|
+
80: '#5f8200',
|
|
250
|
+
90: '#4f8600',
|
|
251
|
+
100: '#3a8a00',
|
|
252
|
+
110: '#218c00',
|
|
253
|
+
120: '#008e0a',
|
|
254
|
+
130: '#008d29',
|
|
255
|
+
140: '#008c3e',
|
|
256
|
+
150: '#008b53',
|
|
257
|
+
160: '#008965',
|
|
258
|
+
170: '#008876',
|
|
259
|
+
180: '#008686',
|
|
260
|
+
190: '#00899f',
|
|
261
|
+
200: '#0085b7',
|
|
262
|
+
210: '#007cd8',
|
|
263
|
+
220: '#3972e9',
|
|
264
|
+
230: '#4f6de9',
|
|
265
|
+
240: '#6070ef',
|
|
266
|
+
250: '#736aec',
|
|
267
|
+
260: '#8663e6',
|
|
268
|
+
270: '#985cdc',
|
|
269
|
+
280: '#a556d0',
|
|
270
|
+
290: '#b051c4',
|
|
271
|
+
300: '#b94db8',
|
|
272
|
+
310: '#c149ab',
|
|
273
|
+
320: '#c9459b',
|
|
274
|
+
330: '#d04188',
|
|
275
|
+
340: '#d63f70',
|
|
276
|
+
350: '#da3f58',
|
|
277
|
+
};
|
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The functional-glyph colour table.
|
|
8
|
+
*
|
|
9
|
+
* Four facts are worth pinning, and each is invisible until wrong:
|
|
10
|
+
*
|
|
11
|
+
* - **The class conversion matches what Lucide emits.** `Trash2` is an alias of
|
|
12
|
+
* `trash` (class `lucide-trash-2`), `AlertTriangle` of `triangle-alert`, so a
|
|
13
|
+
* table keyed on the IMPORT name is only useful if the kebab translation lands
|
|
14
|
+
* on a class the component really carries. Every row is RENDERED here rather
|
|
15
|
+
* than trusted.
|
|
16
|
+
* - **The hue table matches the imports.** It is generated from `src/`; a stale
|
|
17
|
+
* copy would leave a newly added icon on the default hue, which looks like the
|
|
18
|
+
* mode half-applied. `scripts/icon-tints.mjs --check` is the same comparison.
|
|
19
|
+
* - **Every generated hue clears the non-text contrast floor** on every palette
|
|
20
|
+
* of its variant, at the lightness `ICON_HUE_PAINT` states. That is the whole
|
|
21
|
+
* reason the lightness is 30% / 70% and not something prettier.
|
|
22
|
+
* - **A signal icon is never also a hue row**, so the signal colour cannot be
|
|
23
|
+
* shadowed by a `--icon-hue` on the same element.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
import { afterAll, afterEach, beforeEach, describe, expect, test } from 'bun:test';
|
|
27
|
+
import { Window } from 'happy-dom';
|
|
28
|
+
import { h, render } from 'preact';
|
|
29
|
+
import * as lucide from 'lucide-preact';
|
|
30
|
+
import {
|
|
31
|
+
assignPanelHues,
|
|
32
|
+
DEFAULT_ICON_HUE,
|
|
33
|
+
ICON_HUE_PAINT,
|
|
34
|
+
ICON_HUE_ROWS,
|
|
35
|
+
ICON_TINTS,
|
|
36
|
+
ICON_TINT_ROWS,
|
|
37
|
+
ICON_TINT_TOKENS,
|
|
38
|
+
iconHue,
|
|
39
|
+
hashHue,
|
|
40
|
+
iconHueColor,
|
|
41
|
+
iconHuePaint,
|
|
42
|
+
iconTintRole,
|
|
43
|
+
iconTone,
|
|
44
|
+
kebabIconName,
|
|
45
|
+
lucideClassName,
|
|
46
|
+
} from '@/shared/lib/icons/tint';
|
|
47
|
+
import { ICON_HUES, ICON_TONES } from '@/shared/lib/icons/tint-hues.generated';
|
|
48
|
+
import { oklchOf } from '@/shared/lib/icons/icon-tone';
|
|
49
|
+
import { THEMES } from '@/shared/lib/theme/catalog';
|
|
50
|
+
import { BRAND_CONTRAST_FLOOR, contrastRatio } from '@/shared/lib/theme/legibility';
|
|
51
|
+
|
|
52
|
+
const DOM_GLOBALS = ['window', 'document', 'navigator', 'Node', 'Element', 'HTMLElement', 'Event'] as const;
|
|
53
|
+
const nativeGlobals: Partial<Record<(typeof DOM_GLOBALS)[number], unknown>> = {};
|
|
54
|
+
let container: HTMLElement;
|
|
55
|
+
|
|
56
|
+
beforeEach(() => {
|
|
57
|
+
const win = new Window({ url: 'http://localhost' });
|
|
58
|
+
const target = globalThis as unknown as Record<string, unknown>;
|
|
59
|
+
for (const key of DOM_GLOBALS) {
|
|
60
|
+
if (!(key in nativeGlobals)) nativeGlobals[key] = win[key as keyof Window];
|
|
61
|
+
target[key] = win[key as keyof Window];
|
|
62
|
+
}
|
|
63
|
+
container = document.createElement('div');
|
|
64
|
+
document.body.appendChild(container);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
afterEach(() => {
|
|
68
|
+
render(null, container);
|
|
69
|
+
container.remove();
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
afterAll(() => {
|
|
73
|
+
const target = globalThis as unknown as Record<string, unknown>;
|
|
74
|
+
for (const key of DOM_GLOBALS) {
|
|
75
|
+
if (key in nativeGlobals) target[key] = nativeGlobals[key];
|
|
76
|
+
else delete target[key];
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
/** `hsl(<hue> <sat>% <light>%)` as a hex, so contrast can be measured. */
|
|
81
|
+
function hslHex(hue: number, saturation: number, lightness: number): string {
|
|
82
|
+
const s = saturation / 100;
|
|
83
|
+
const l = lightness / 100;
|
|
84
|
+
const k = (n: number) => (n + hue / 30) % 12;
|
|
85
|
+
const a = s * Math.min(l, 1 - l);
|
|
86
|
+
const channel = (n: number) => l - a * Math.max(-1, Math.min(k(n) - 3, Math.min(9 - k(n), 1)));
|
|
87
|
+
const toHex = (value: number) =>
|
|
88
|
+
Math.round(Math.min(1, Math.max(0, value)) * 255)
|
|
89
|
+
.toString(16)
|
|
90
|
+
.padStart(2, '0');
|
|
91
|
+
return `#${toHex(channel(0))}${toHex(channel(8))}${toHex(channel(4))}`;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
describe('kebabIconName', () => {
|
|
97
|
+
test('lowercase, camel and digit boundaries', () => {
|
|
98
|
+
expect(kebabIconName('Trash2')).toBe('trash-2');
|
|
99
|
+
expect(kebabIconName('AlertTriangle')).toBe('alert-triangle');
|
|
100
|
+
expect(kebabIconName('ChevronsUpDown')).toBe('chevrons-up-down');
|
|
101
|
+
expect(kebabIconName('BarChart3')).toBe('bar-chart-3');
|
|
102
|
+
expect(kebabIconName('CircleQuestionMark')).toBe('circle-question-mark');
|
|
103
|
+
expect(kebabIconName('ZoomIn')).toBe('zoom-in');
|
|
104
|
+
expect(kebabIconName('Cpu')).toBe('cpu');
|
|
105
|
+
expect(kebabIconName('X')).toBe('x');
|
|
106
|
+
expect(kebabIconName('Settings2')).toBe('settings-2');
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
test('the class is the kebab name behind the component prefix', () => {
|
|
110
|
+
expect(lucideClassName('Trash2')).toBe('lucide-trash-2');
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
describe('the signal table', () => {
|
|
115
|
+
test('every row names an icon this build can import', () => {
|
|
116
|
+
for (const name of Object.keys(ICON_TINTS)) {
|
|
117
|
+
expect((lucide as Record<string, unknown>)[name], `${name} is not a lucide export`).toBeDefined();
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
test('every row renders the class the stylesheet keys on', () => {
|
|
122
|
+
for (const name of Object.keys(ICON_TINTS)) {
|
|
123
|
+
const Icon = (lucide as unknown as Record<string, (props: object) => unknown>)[name] as (props: object) => unknown;
|
|
124
|
+
render(h(Icon as never, { 'aria-hidden': true }), container);
|
|
125
|
+
const svg = container.querySelector('svg');
|
|
126
|
+
expect(svg, `${name} draws an svg`).not.toBeNull();
|
|
127
|
+
expect(svg?.classList.contains(lucideClassName(name)), `${name} -> ${lucideClassName(name)}`).toBe(true);
|
|
128
|
+
render(null, container);
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
test('an unlisted icon has no role, so it takes its own hue', () => {
|
|
133
|
+
expect(iconTintRole('Sparkles')).toBeNull();
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
test('a signal role answers its own token', () => {
|
|
137
|
+
expect(iconTintRole('Trash2')).toBe('error');
|
|
138
|
+
expect(iconTintRole('CheckCircle2')).toBe('success');
|
|
139
|
+
expect(iconTintRole('Hourglass')).toBe('warning');
|
|
140
|
+
expect(iconTintRole('Info')).toBe('info');
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
test('every role paints a theme token, never a hex', () => {
|
|
144
|
+
for (const role of new Set(Object.values(ICON_TINTS))) {
|
|
145
|
+
expect(ICON_TINT_TOKENS[role], role).toMatch(/^var\(--theme-[a-z]+\)$/);
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
test('the signal rows are unique, so no rule can be shadowed', () => {
|
|
150
|
+
const classes = ICON_TINT_ROWS.map((row) => row.className);
|
|
151
|
+
expect(new Set(classes).size).toBe(classes.length);
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
describe('the generated hues', () => {
|
|
156
|
+
test('the table has one entry per imported, non-signal icon', () => {
|
|
157
|
+
expect(Object.keys(ICON_HUES).length).toBeGreaterThan(100);
|
|
158
|
+
for (const name of Object.keys(ICON_TINTS)) {
|
|
159
|
+
expect(ICON_HUES[name], `${name} is a signal and must not carry a hue`).toBeUndefined();
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
test('every hue is a step on the 36-hue wheel', () => {
|
|
164
|
+
for (const [name, hue] of Object.entries(ICON_HUES)) {
|
|
165
|
+
expect(hue % 10, name).toBe(0);
|
|
166
|
+
expect(hue, name).toBeGreaterThanOrEqual(0);
|
|
167
|
+
expect(hue, name).toBeLessThan(360);
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
test('neighbouring icons are not all the same colour', () => {
|
|
172
|
+
const hues = new Set(Object.values(ICON_HUES));
|
|
173
|
+
// The whole point of a per-icon hue: a dense list must not be one colour.
|
|
174
|
+
expect(hues.size).toBeGreaterThan(20);
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
test('the hue table matches the icons this repo imports', async () => {
|
|
178
|
+
// The generator is the source of truth; running its `--check` here is what
|
|
179
|
+
// makes a stale table a test failure instead of a review miss.
|
|
180
|
+
//
|
|
181
|
+
// `Bun.fileURLToPath`, not `URL.pathname`: on a Windows host the pathname
|
|
182
|
+
// is `/D:/a/kabmo/kabmo/`, which no process can open, so the spawn failed
|
|
183
|
+
// for a reason that had nothing to do with the table — measured on the
|
|
184
|
+
// Windows gate, where this case failed while every other row passed.
|
|
185
|
+
//
|
|
186
|
+
// The script is resolved THROUGH the URL rather than by string-joining onto
|
|
187
|
+
// the directory: `fileURLToPath` keeps a trailing separator (`…/kabmo/`),
|
|
188
|
+
// and a hand-written join would then carry one separator style into a path
|
|
189
|
+
// the other half spelled the other way.
|
|
190
|
+
const repoUrl = new URL('../../../..', import.meta.url);
|
|
191
|
+
const repoRoot = Bun.fileURLToPath(repoUrl);
|
|
192
|
+
const script = Bun.fileURLToPath(new URL('scripts/icon-tints.mjs', repoUrl));
|
|
193
|
+
const check = Bun.spawnSync(['bun', 'run', script, '--check'], {
|
|
194
|
+
cwd: repoRoot,
|
|
195
|
+
stdout: 'pipe',
|
|
196
|
+
stderr: 'pipe',
|
|
197
|
+
});
|
|
198
|
+
expect(check.exitCode, check.stderr.toString()).toBe(0);
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
test('every light tone clears the non-text floor on every light palette', () => {
|
|
202
|
+
// The tone is SOLVED per hue (see `icon-tone.ts`); this is the property that
|
|
203
|
+
// let the mode carry 39% more chroma without losing a single row, so it is
|
|
204
|
+
// pinned per palette rather than against one hex.
|
|
205
|
+
const papers = THEMES.filter((theme) => theme.variant === 'light').map((theme) => theme.paper);
|
|
206
|
+
for (const [hue, tone] of Object.entries(ICON_TONES)) {
|
|
207
|
+
expect(tone, hue).toMatch(/^#[0-9a-f]{6}$/);
|
|
208
|
+
const worst = Math.min(...papers.map((paper) => contrastRatio(tone, paper)));
|
|
209
|
+
expect(worst, `hue ${hue} (${tone})`).toBeGreaterThanOrEqual(BRAND_CONTRAST_FLOOR);
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
test('the dark hue still clears the floor at its one stated pair', () => {
|
|
214
|
+
// Dark is deliberately untouched: it reads bright already, and raising its
|
|
215
|
+
// chroma would only invert the complaint.
|
|
216
|
+
const { saturation, lightness } = ICON_HUE_PAINT.dark;
|
|
217
|
+
const papers = THEMES.filter((theme) => theme.variant === 'dark').map((theme) => theme.paper);
|
|
218
|
+
for (const hue of new Set(Object.values(ICON_HUES))) {
|
|
219
|
+
const color = hslHex(hue, saturation, lightness);
|
|
220
|
+
const worst = Math.min(...papers.map((paper) => contrastRatio(color, paper)));
|
|
221
|
+
expect(worst, `hue ${hue} (${color})`).toBeGreaterThanOrEqual(BRAND_CONTRAST_FLOOR);
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
test('a light tone carries MORE chroma than the pair it replaced', () => {
|
|
226
|
+
// The report — "warna icon di mode full color ketika light mode kelihatan
|
|
227
|
+
// kusem" — is this measurement, and nothing else: the old pair maxed out at
|
|
228
|
+
// OKLCH chroma 0.075 on the muddiest hue because one saturation had to suit
|
|
229
|
+
// every hue on the wheel. Solving per hue is what buys the colour back, and
|
|
230
|
+
// this is the assertion that would fail if a future edit quietly put a
|
|
231
|
+
// uniform pair back.
|
|
232
|
+
const hues = Object.keys(ICON_TONES).map(Number);
|
|
233
|
+
const mean = (values: number[]) => values.reduce((a, b) => a + b, 0) / values.length;
|
|
234
|
+
const before = hues.map((hue) => oklchOf(hslHex(hue, ICON_HUE_PAINT.light.saturation, ICON_HUE_PAINT.light.lightness)).chroma);
|
|
235
|
+
const after = hues.map((hue) => oklchOf(ICON_TONES[hue]!).chroma);
|
|
236
|
+
expect(mean(after)).toBeGreaterThan(mean(before) * 1.3);
|
|
237
|
+
// Every single hue must improve — a table that traded one muddy row for
|
|
238
|
+
// another would still pass the mean.
|
|
239
|
+
for (const hue of hues) {
|
|
240
|
+
expect(oklchOf(ICON_TONES[hue]!).chroma, `hue ${hue}`).toBeGreaterThan(
|
|
241
|
+
oklchOf(hslHex(hue, ICON_HUE_PAINT.light.saturation, ICON_HUE_PAINT.light.lightness)).chroma,
|
|
242
|
+
);
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
|
|
246
|
+
test('a light tone keeps its hue, so a row does not change colour', () => {
|
|
247
|
+
// Solved in OKLCH, but the hue is the OKLCH angle of the OLD paint: a tone
|
|
248
|
+
// that drifted would recolour every icon in the app, which is not what
|
|
249
|
+
// "more colour" means.
|
|
250
|
+
for (const [hue, tone] of Object.entries(ICON_TONES)) {
|
|
251
|
+
const before = oklchOf(hslHex(Number(hue), ICON_HUE_PAINT.light.saturation, ICON_HUE_PAINT.light.lightness)).hue;
|
|
252
|
+
const after = oklchOf(tone).hue;
|
|
253
|
+
const circular = Math.min(Math.abs(before - after), 360 - Math.abs(before - after));
|
|
254
|
+
expect(circular, `hue ${hue} (${tone})`).toBeLessThan(12);
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
test('the light tone is a table lookup, not a solve, and it snaps to the wheel', () => {
|
|
259
|
+
expect(iconTone(120)).toBe(ICON_TONES[120]!);
|
|
260
|
+
// `hashHue` only produces wheel steps, but a stored or plugin name could
|
|
261
|
+
// still reach here with something else; the nearest step keeps it a colour.
|
|
262
|
+
expect(iconTone(124)).toBe(ICON_TONES[120]!);
|
|
263
|
+
expect(iconTone(356)).toBe(ICON_TONES[0]!);
|
|
264
|
+
expect(iconTone(-10)).toBe(ICON_TONES[350]!);
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
test('the paint rule and the concrete colour share one formula', () => {
|
|
268
|
+
// The stylesheet leaves the hue to `--icon-hue`; the settings preview needs a
|
|
269
|
+
// real colour. Both must come from the same numbers, or the preview lies.
|
|
270
|
+
// LIGHT reads the solved `--icon-tone` (falling back to the old pair), which
|
|
271
|
+
// is why it is not a bare `hsl()` any more.
|
|
272
|
+
const { saturation, lightness } = ICON_HUE_PAINT.dark;
|
|
273
|
+
expect(iconHuePaint('light')).toBe(
|
|
274
|
+
`var(--icon-tone, hsl(var(--icon-hue, ${DEFAULT_ICON_HUE}) ${ICON_HUE_PAINT.light.saturation}% ${ICON_HUE_PAINT.light.lightness}%))`,
|
|
275
|
+
);
|
|
276
|
+
expect(iconHuePaint('dark')).toBe(`hsl(var(--icon-hue, ${DEFAULT_ICON_HUE}) ${saturation}% ${lightness}%)`);
|
|
277
|
+
expect(iconHueColor(120, 'light')).toBe(ICON_TONES[120]!);
|
|
278
|
+
expect(iconHueColor(120, 'dark')).toBe(`hsl(120 ${saturation}% ${lightness}%)`);
|
|
279
|
+
});
|
|
280
|
+
|
|
281
|
+
test('the table is exactly what the runtime hash produces', () => {
|
|
282
|
+
// One formula for both: a plugin's mark is coloured by `hashHue` at runtime,
|
|
283
|
+
// so if the generated rows drifted from it, an installed plugin would sit on
|
|
284
|
+
// a different wheel than the glyphs beside it.
|
|
285
|
+
for (const [name, hue] of Object.entries(ICON_HUES)) {
|
|
286
|
+
expect(hashHue(name), name).toBe(hue);
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
|
|
290
|
+
test('a plugin name gets a stable hue on the same wheel', () => {
|
|
291
|
+
expect(hashHue('Demo Plugin')).toBe(hashHue('Demo Plugin'));
|
|
292
|
+
expect(hashHue('Demo Plugin')).not.toBe(hashHue('Other Plugin'));
|
|
293
|
+
for (const name of ['Demo', 'Session Info', 'git-forge', 'Stats — CPU & RAM']) {
|
|
294
|
+
expect(hashHue(name) % 10, name).toBe(0);
|
|
295
|
+
expect(hashHue(name), name).toBeLessThan(360);
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
test('the rail gives every panel its OWN hue, even when two hashes collide', () => {
|
|
300
|
+
// Fourteen buttons on a 36-slot wheel collide about nine times in ten
|
|
301
|
+
// (birthday bound) — measured, three right-rail icons shared one blue.
|
|
302
|
+
const ids = [
|
|
303
|
+
'context', 'files', 'search', 'git', 'wiki', 'terminal', 'user-browser',
|
|
304
|
+
'browser', 'usage', 'todo', 'plan', 'plugin:command-runner',
|
|
305
|
+
'plugin:git-forge', 'plugin:stats',
|
|
306
|
+
];
|
|
307
|
+
const hues = assignPanelHues(ids);
|
|
308
|
+
|
|
309
|
+
expect(hues.size).toBe(ids.length);
|
|
310
|
+
expect(new Set(hues.values()).size).toBe(ids.length);
|
|
311
|
+
});
|
|
312
|
+
|
|
313
|
+
test('the assignment does not depend on the catalog order', () => {
|
|
314
|
+
// Reordering a rail must not recolour it: the ids are sorted before probing.
|
|
315
|
+
const ids = ['b', 'a', 'c', 'plugin:x'];
|
|
316
|
+
expect([...assignPanelHues(ids)]).toEqual([...assignPanelHues([...ids].reverse())]);
|
|
317
|
+
});
|
|
318
|
+
|
|
319
|
+
test('an unassigned panel falls back to the plain hash', () => {
|
|
320
|
+
expect(assignPanelHues(['only']).get('only')).toBe(hashHue('only'));
|
|
321
|
+
});
|
|
322
|
+
|
|
323
|
+
test('an icon outside the table keeps a neutral default', () => {
|
|
324
|
+
expect(iconHue('NotAnIcon')).toBe(DEFAULT_ICON_HUE);
|
|
325
|
+
expect(iconHue('Trash2')).toBe(DEFAULT_ICON_HUE);
|
|
326
|
+
});
|
|
327
|
+
|
|
328
|
+
test('the rows name classes, one per hue', () => {
|
|
329
|
+
const classes = ICON_HUE_ROWS.map((row) => row.className);
|
|
330
|
+
expect(new Set(classes).size).toBe(classes.length);
|
|
331
|
+
expect(classes.every((className) => className.startsWith('lucide-'))).toBe(true);
|
|
332
|
+
});
|
|
333
|
+
});
|