@kabmo-labs/kabmo 0.21.0 → 0.22.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.
Files changed (295) hide show
  1. package/README.md +7 -2
  2. package/dist/client/index.html +9 -8
  3. package/dist/client/index.js +334 -334
  4. package/dist/client/static/js/{index-zg32n2sk.js → index-297dck9a.js} +784 -791
  5. package/dist/client/static/js/index-7ppta1pb.css +1 -0
  6. package/extensions/kabmo-modes/commands.ts +17 -3
  7. package/extensions/kabmo-modes/goal-start.ts +101 -0
  8. package/extensions/kabmo-modes/goal.test.ts +80 -5
  9. package/extensions/kabmo-modes/goal.ts +13 -38
  10. package/extensions/kabmo-modes/prompts.test.ts +12 -0
  11. package/extensions/kabmo-modes/prompts.ts +9 -2
  12. package/index.html +8 -7
  13. package/package.json +2 -2
  14. package/src/cli/lib/args.js +9 -0
  15. package/src/cli/lib/args.test.js +26 -0
  16. package/src/cli/lib/commands/doctor.js +153 -0
  17. package/src/cli/lib/commands/doctor.test.js +139 -0
  18. package/src/cli/lib/commands/serve.js +23 -10
  19. package/src/cli/lib/commands/status.js +22 -3
  20. package/src/cli/lib/omp-setup.js +131 -0
  21. package/src/cli/lib/omp-setup.test.js +115 -0
  22. package/src/cli/main.js +1 -1
  23. package/src/client/components/common/DemoDataBadge.tsx +52 -0
  24. package/src/client/components/common/FolderPicker.tsx +2 -2
  25. package/src/client/components/common/Modal.tsx +15 -1
  26. package/src/client/components/common/code-surface/blame-panel.ts +1 -1
  27. package/src/client/components/common/context-usage-button/index.test.tsx +1 -1
  28. package/src/client/components/common/context-usage-button/index.tsx +4 -4
  29. package/src/client/components/common/demo-data-badge.test.tsx +58 -0
  30. package/src/client/components/common/diagram-viewer/index.tsx +2 -2
  31. package/src/client/components/common/editor-view-buttons/index.tsx +2 -2
  32. package/src/client/components/common/header-controls/MoreMenu.tsx +1 -1
  33. package/src/client/components/common/header-controls/index.tsx +4 -1
  34. package/src/client/components/common/markdown-review/ReviewPopover.tsx +2 -2
  35. package/src/client/components/common/markdown-review/ReviewSummary.tsx +1 -1
  36. package/src/client/components/common/panel-mark/index.tsx +2 -1
  37. package/src/client/components/common/server-control/Panel.tsx +3 -3
  38. package/src/client/components/common/server-control/index.tsx +1 -1
  39. package/src/client/components/common/shell-update-button/Modal.tsx +1 -1
  40. package/src/client/components/common/todo-row/index.tsx +1 -1
  41. package/src/client/components/layout/ActivityBar.tsx +4 -0
  42. package/src/client/components/layout/ShellNotice.tsx +33 -0
  43. package/src/client/components/layout/desktop-layout/index.tsx +14 -16
  44. package/src/client/components/layout/desktop-layout/resizer/index.tsx +14 -1
  45. package/src/client/components/layout/session-sidebar/CategoryHeader.tsx +2 -1
  46. package/src/client/components/layout/session-sidebar/ClassicView.tsx +5 -1
  47. package/src/client/components/layout/session-sidebar/SessionList.tsx +1 -1
  48. package/src/client/components/layout/session-sidebar/SessionListNotice.tsx +56 -0
  49. package/src/client/components/layout/session-sidebar/SessionsView.tsx +2 -0
  50. package/src/client/components/layout/session-sidebar/about-modal/UpdateSection.tsx +1 -1
  51. package/src/client/components/layout/session-sidebar/about-modal/index.tsx +12 -1
  52. package/src/client/components/layout/session-sidebar/modern/WorkspaceHeader.tsx +2 -1
  53. package/src/client/components/layout/session-sidebar/modern/index.tsx +6 -2
  54. package/src/client/components/layout/session-sidebar/new-workspace-modal/CloneField.tsx +1 -1
  55. package/src/client/components/layout/session-sidebar/new-workspace-modal/index.tsx +2 -2
  56. package/src/client/components/layout/session-sidebar/scheduler-modal/TaskForm.tsx +1 -1
  57. package/src/client/components/layout/session-sidebar/scheduler-modal/TaskList.tsx +3 -3
  58. package/src/client/components/layout/session-sidebar/scheduler-modal/index.tsx +1 -1
  59. package/src/client/components/layout/session-sidebar/session-list-states.test.tsx +150 -0
  60. package/src/client/components/layout/session-sidebar/variant-props.ts +6 -0
  61. package/src/client/components/mobile/LayoutWrapper.tsx +20 -30
  62. package/src/client/components/mobile/MainView.tsx +5 -2
  63. package/src/client/components/mobile/RightSidebar.tsx +1 -1
  64. package/src/client/components/mobile/SessionSidebar.tsx +3 -0
  65. package/src/client/components/mobile/mobile-main-view/Header.tsx +2 -2
  66. package/src/client/components/mobile/mobile-session-sidebar/ClassicDrawer.tsx +7 -1
  67. package/src/client/components/mobile/mobile-session-sidebar/Toolbar.tsx +1 -1
  68. package/src/client/components/settings/Modal.tsx +15 -1
  69. package/src/client/components/settings/ProjectSelectorDropdown.tsx +1 -1
  70. package/src/client/components/settings/Sidebar.tsx +2 -2
  71. package/src/client/components/settings/categories/OmpSettings.tsx +1 -1
  72. package/src/client/components/settings/categories/TokenUsageSettings.tsx +1 -1
  73. package/src/client/components/settings/categories/agent-settings/DetailPane.tsx +3 -3
  74. package/src/client/components/settings/categories/appearance-settings/EditorFontSection.tsx +1 -1
  75. package/src/client/components/settings/categories/appearance-settings/EditorThemeSection.tsx +2 -2
  76. package/src/client/components/settings/categories/appearance-settings/IconStyleSection.tsx +5 -5
  77. package/src/client/components/settings/categories/appearance-settings/SidebarStyleSection.tsx +1 -1
  78. package/src/client/components/settings/categories/appearance-settings/SurfaceStyleSection.tsx +1 -1
  79. package/src/client/components/settings/categories/appearance-settings/ThemeCard.tsx +1 -1
  80. package/src/client/components/settings/categories/chat-settings/ComposerStyleSection.tsx +1 -1
  81. package/src/client/components/settings/categories/chat-settings/GoalSection.tsx +1 -1
  82. package/src/client/components/settings/categories/command-settings/DetailPane.tsx +2 -2
  83. package/src/client/components/settings/categories/omp-settings/ConfigTabs.tsx +5 -5
  84. package/src/client/components/settings/categories/omp-settings/EngineHeader.tsx +3 -3
  85. package/src/client/components/settings/categories/omp-settings/RoleRow.tsx +2 -2
  86. package/src/client/components/settings/categories/panel-plugins/LeftDockSettings.tsx +1 -1
  87. package/src/client/components/settings/categories/panel-plugins/PluginCard.tsx +1 -1
  88. package/src/client/components/settings/categories/panel-plugins/PluginMark.tsx +4 -3
  89. package/src/client/components/settings/categories/plugin-settings/SidebarList.tsx +2 -2
  90. package/src/client/components/settings/categories/project-settings/AddProjectModal.tsx +1 -1
  91. package/src/client/components/settings/categories/project-settings/NameInput.tsx +1 -1
  92. package/src/client/components/settings/categories/project-settings/PathField.tsx +1 -1
  93. package/src/client/components/settings/categories/provider-settings/AddModelModal.tsx +3 -3
  94. package/src/client/components/settings/categories/provider-settings/AddProviderModal.tsx +1 -1
  95. package/src/client/components/settings/categories/provider-settings/AuthSection.tsx +2 -2
  96. package/src/client/components/settings/categories/provider-settings/DeleteProviderModal.tsx +1 -1
  97. package/src/client/components/settings/categories/provider-settings/EntryAdvanced.tsx +4 -4
  98. package/src/client/components/settings/categories/provider-settings/EntryModal.tsx +2 -2
  99. package/src/client/components/settings/categories/provider-settings/LoginModal.tsx +1 -1
  100. package/src/client/components/settings/categories/provider-settings/ModelCapabilitiesModal.tsx +1 -1
  101. package/src/client/components/settings/categories/provider-settings/ModelsList.tsx +2 -2
  102. package/src/client/components/settings/categories/provider-settings/PriceFields.tsx +1 -1
  103. package/src/client/components/settings/categories/token-usage-settings/Breakdown.tsx +4 -4
  104. package/src/client/components/settings/categories/token-usage-settings/Chart.tsx +2 -2
  105. package/src/client/components/settings/categories/token-usage-settings/Controls.tsx +1 -1
  106. package/src/client/components/settings/categories/token-usage-settings/MetricsGrid.tsx +1 -1
  107. package/src/client/components/settings/categories/usage-settings/KenariCard.tsx +5 -5
  108. package/src/client/components/workspace/browser-panel/AddressBar.tsx +1 -1
  109. package/src/client/components/workspace/browser-panel/Screencast.tsx +6 -6
  110. package/src/client/components/workspace/browser-panel/TabStrip.tsx +1 -1
  111. package/src/client/components/workspace/browser-panel/index.tsx +1 -1
  112. package/src/client/components/workspace/browser-toolbar/index.tsx +5 -5
  113. package/src/client/components/workspace/chat-timeline/AttachmentChips.tsx +1 -1
  114. package/src/client/components/workspace/chat-timeline/GeneratingIndicator.tsx +13 -26
  115. package/src/client/components/workspace/chat-timeline/GoalNotice.tsx +2 -2
  116. package/src/client/components/workspace/chat-timeline/MessageItem.tsx +1 -1
  117. package/src/client/components/workspace/chat-timeline/MinimapShortcuts.tsx +1 -1
  118. package/src/client/components/workspace/chat-timeline/QueueList.tsx +1 -1
  119. package/src/client/components/workspace/chat-timeline/SubagentView.tsx +1 -1
  120. package/src/client/components/workspace/chat-timeline/SystemNotice.tsx +5 -5
  121. package/src/client/components/workspace/chat-timeline/TaskResultContent.tsx +2 -2
  122. package/src/client/components/workspace/chat-timeline/ThinkingSection.tsx +4 -4
  123. package/src/client/components/workspace/chat-timeline/ToolCallingSection.tsx +1 -1
  124. package/src/client/components/workspace/chat-timeline/chat-input/AccessDropdown.tsx +1 -1
  125. package/src/client/components/workspace/chat-timeline/chat-input/ArmedGoalStrip.tsx +71 -0
  126. package/src/client/components/workspace/chat-timeline/chat-input/AttachmentToolbar.tsx +4 -3
  127. package/src/client/components/workspace/chat-timeline/chat-input/GoalBanner.test.ts +1 -1
  128. package/src/client/components/workspace/chat-timeline/chat-input/GoalBanner.tsx +3 -3
  129. package/src/client/components/workspace/chat-timeline/chat-input/GoalModal.test.ts +176 -0
  130. package/src/client/components/workspace/chat-timeline/chat-input/GoalModal.tsx +70 -81
  131. package/src/client/components/workspace/chat-timeline/chat-input/GoalSurfaces.tsx +10 -1
  132. package/src/client/components/workspace/chat-timeline/chat-input/ModeToggles.test.ts +20 -0
  133. package/src/client/components/workspace/chat-timeline/chat-input/ModeToggles.tsx +13 -7
  134. package/src/client/components/workspace/chat-timeline/chat-input/ThinkingLevelDropdown.tsx +1 -1
  135. package/src/client/components/workspace/chat-timeline/chat-input/Toolbar.test.ts +65 -3
  136. package/src/client/components/workspace/chat-timeline/chat-input/Toolbar.tsx +69 -19
  137. package/src/client/components/workspace/chat-timeline/chat-input/WaitingDependencyPicker.tsx +2 -2
  138. package/src/client/components/workspace/chat-timeline/chat-input/composer-portal.test.tsx +174 -0
  139. package/src/client/components/workspace/chat-timeline/chat-input/goal-modal-parts.tsx +80 -0
  140. package/src/client/components/workspace/chat-timeline/chat-input/modes-props.ts +15 -3
  141. package/src/client/components/workspace/chat-timeline/chat-input/styles.test.tsx +3 -1
  142. package/src/client/components/workspace/chat-timeline/plan-review/index.tsx +1 -1
  143. package/src/client/components/workspace/chat-timeline/target-picker/WorkspacePicker.tsx +1 -1
  144. package/src/client/components/workspace/chat-timeline/target-picker/WorktreePicker.tsx +1 -1
  145. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/FrameControl.tsx +1 -1
  146. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/OptionRow.tsx +1 -1
  147. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/OrphanAsks.tsx +1 -1
  148. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/QuestionBlock.tsx +2 -2
  149. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/QuestionCard.tsx +4 -4
  150. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/index.tsx +2 -2
  151. package/src/client/components/workspace/chat-timeline/tool-renderers/extension-dialog/Header.tsx +1 -1
  152. package/src/client/components/workspace/chat-timeline/tool-renderers/extension-dialog/SelectBody.tsx +1 -1
  153. package/src/client/components/workspace/chat-timeline/tool-renderers/hashline-patch/index.tsx +4 -4
  154. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/AstEdit.tsx +6 -6
  155. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Bash.tsx +13 -13
  156. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Checkpoint.tsx +1 -1
  157. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/ContextNotes.tsx +2 -2
  158. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Debug.tsx +3 -3
  159. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Edit.tsx +9 -9
  160. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Eval.tsx +10 -10
  161. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/FileMatches.tsx +1 -1
  162. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Goal.tsx +5 -5
  163. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/GoalRecord.tsx +5 -5
  164. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Lsp.tsx +6 -6
  165. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/ManageSkill.tsx +5 -5
  166. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Mcp.tsx +2 -2
  167. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Memory.tsx +3 -3
  168. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Proc.tsx +15 -15
  169. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Read.tsx +2 -2
  170. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Resolve.tsx +4 -4
  171. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/SearchFs.tsx +2 -2
  172. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/SearchTool.tsx +1 -1
  173. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/SecurityScan.tsx +4 -4
  174. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/TaskResult.tsx +7 -7
  175. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Think.tsx +2 -2
  176. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Todo.tsx +2 -2
  177. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Wait.missing.test.ts +4 -2
  178. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Wait.tsx +17 -17
  179. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/WebSearch.tsx +3 -3
  180. package/src/client/components/workspace/chat-timeline/tool-renderers/shared/ArtifactChip.tsx +1 -1
  181. package/src/client/components/workspace/chat-timeline/tool-renderers/shared/EnvelopeHeader.tsx +2 -2
  182. package/src/client/components/workspace/chat-timeline/tool-renderers/shared/ExcerptCode.tsx +3 -3
  183. package/src/client/components/workspace/chat-timeline/tool-renderers/shared/FallbackOutput.tsx +3 -3
  184. package/src/client/components/workspace/chat-timeline/tool-renderers/shared/JsonCodeBlock.tsx +3 -3
  185. package/src/client/components/workspace/chat-timeline/tool-renderers/shared/OutputWindow.tsx +2 -2
  186. package/src/client/components/workspace/chat-timeline/tool-renderers/shared/ToolBody.tsx +2 -2
  187. package/src/client/components/workspace/chat-timeline/tool-renderers/shared/ToolFactChips.tsx +2 -2
  188. package/src/client/components/workspace/chat-timeline/tool-renderers/shared/ToolPanelHeader.tsx +1 -1
  189. package/src/client/components/workspace/chat-timeline/tool-renderers/styles/Minimal.tsx +1 -1
  190. package/src/client/components/workspace/context-panel/RawJsonViewer.tsx +2 -2
  191. package/src/client/components/workspace/context-panel/StatsGrid.tsx +1 -1
  192. package/src/client/components/workspace/context-panel/index.tsx +1 -1
  193. package/src/client/components/workspace/diff-panel/ConflictBanner.tsx +1 -1
  194. package/src/client/components/workspace/editor/EmptyEditor.tsx +1 -1
  195. package/src/client/components/workspace/editor/FindWidget.tsx +1 -1
  196. package/src/client/components/workspace/editor/Tabs.tsx +1 -1
  197. package/src/client/components/workspace/editor/Toolbar.tsx +1 -1
  198. package/src/client/components/workspace/file-explorer/OutlineSection.tsx +2 -2
  199. package/src/client/components/workspace/file-explorer/RowLabel.tsx +1 -1
  200. package/src/client/components/workspace/file-explorer/index.tsx +1 -1
  201. package/src/client/components/workspace/git-panel/BranchToolbar.tsx +2 -2
  202. package/src/client/components/workspace/git-panel/ChangesList.tsx +3 -3
  203. package/src/client/components/workspace/git-panel/ConflictItem.tsx +3 -3
  204. package/src/client/components/workspace/git-panel/FileItem.tsx +2 -2
  205. package/src/client/components/workspace/git-panel/StashSection.tsx +5 -5
  206. package/src/client/components/workspace/git-panel/TreeItem.tsx +2 -2
  207. package/src/client/components/workspace/git-panel/branch-modal/BranchRow.tsx +4 -4
  208. package/src/client/components/workspace/git-panel/branch-modal/DeleteDialog.tsx +2 -2
  209. package/src/client/components/workspace/git-panel/index.tsx +1 -1
  210. package/src/client/components/workspace/model-dropdown/Item.tsx +3 -3
  211. package/src/client/components/workspace/model-dropdown/Section.tsx +1 -1
  212. package/src/client/components/workspace/model-dropdown/index.tsx +3 -3
  213. package/src/client/components/workspace/plan-panel/index.tsx +2 -2
  214. package/src/client/components/workspace/repo-picker/Modal.tsx +1 -1
  215. package/src/client/components/workspace/repo-picker/Row.tsx +6 -6
  216. package/src/client/components/workspace/search-panel/Body.tsx +2 -2
  217. package/src/client/components/workspace/search-panel/Results.tsx +1 -1
  218. package/src/client/components/workspace/search-panel/index.tsx +1 -1
  219. package/src/client/components/workspace/terminal-panel/index.tsx +1 -1
  220. package/src/client/components/workspace/todo-panel/PhaseGroup.tsx +1 -1
  221. package/src/client/components/workspace/todo-panel/index.tsx +2 -2
  222. package/src/client/components/workspace/user-browser-panel/AddressBar.tsx +5 -5
  223. package/src/client/components/workspace/user-browser-panel/AnnotateBar.test.tsx +13 -13
  224. package/src/client/components/workspace/user-browser-panel/AnnotateBar.tsx +4 -4
  225. package/src/client/components/workspace/user-browser-panel/AnnotateLayer.tsx +1 -1
  226. package/src/client/components/workspace/user-browser-panel/AnnotateTarget.tsx +7 -7
  227. package/src/client/components/workspace/user-browser-panel/Frame.tsx +1 -1
  228. package/src/client/components/workspace/wiki-panel/Nav.tsx +1 -1
  229. package/src/client/components/workspace/wiki-panel/index.tsx +2 -2
  230. package/src/client/glass.css +50 -0
  231. package/src/client/glass.test.ts +68 -24
  232. package/src/client/hooks/chat/composer/browser-context.test.ts +6 -6
  233. package/src/client/hooks/chat/composer/use-draft.test.ts +2 -2
  234. package/src/client/hooks/chat/omp/prompt-send.test.ts +36 -0
  235. package/src/client/hooks/chat/omp/prompt-send.ts +24 -18
  236. package/src/client/hooks/chat/omp/session-list.tsx +24 -70
  237. package/src/client/hooks/chat/omp/session-merges.ts +89 -0
  238. package/src/client/hooks/chat/omp/session-sidebar-controller.ts +4 -1
  239. package/src/client/hooks/chat/timeline/armed-goal-send.test.ts +168 -0
  240. package/src/client/hooks/chat/timeline/armed-goal.test.ts +178 -0
  241. package/src/client/hooks/chat/timeline/goal-command.ts +57 -27
  242. package/src/client/hooks/chat/timeline/index.ts +7 -4
  243. package/src/client/hooks/chat/timeline/mode-post.ts +46 -0
  244. package/src/client/hooks/chat/timeline/modes-contract.ts +94 -0
  245. package/src/client/hooks/chat/timeline/modes.ts +60 -95
  246. package/src/client/hooks/chat/timeline/send-props.ts +97 -0
  247. package/src/client/hooks/chat/timeline/send-steer.test.ts +6 -0
  248. package/src/client/hooks/chat/timeline/send.test-util.ts +55 -8
  249. package/src/client/hooks/chat/timeline/send.test.ts +17 -1
  250. package/src/client/hooks/chat/timeline/send.ts +64 -72
  251. package/src/client/hooks/ui/dialog-behaviour.ts +143 -0
  252. package/src/client/hooks/ui/theme.ts +17 -0
  253. package/src/client/hooks/workspace/copy-tab-path.ts +23 -0
  254. package/src/client/hooks/workspace/mobile-back.ts +71 -0
  255. package/src/client/palette-class.test.ts +93 -0
  256. package/src/client/tailwind-contrast.test.ts +194 -0
  257. package/src/client/tailwind.css +327 -8
  258. package/src/server/lib/assets/theme-shell.server.ts +4 -10
  259. package/src/server/lib/omp/config/provider-seeds.test.ts +39 -1
  260. package/src/server/lib/omp/config/provider-seeds.ts +32 -3
  261. package/src/server/lib/omp/config/provider-vision-compat.test.ts +140 -0
  262. package/src/server/lib/omp/core/host-resolution.test.ts +1 -55
  263. package/src/server/lib/omp/core/install-hint.test.ts +48 -0
  264. package/src/server/lib/omp/core/install-hint.ts +64 -0
  265. package/src/server/lib/omp/core/startup.test.ts +125 -0
  266. package/src/server/lib/omp/core/startup.ts +5 -1
  267. package/src/server/lib/omp/mode/request.ts +14 -6
  268. package/src/server/plugins/ssr.ts +2 -1
  269. package/src/shared/lib/browser/annotate.test.ts +22 -22
  270. package/src/shared/lib/browser/annotate.ts +14 -14
  271. package/src/shared/lib/browser/page-context.ts +6 -6
  272. package/src/shared/lib/icons/icon-paint-authority.test.ts +86 -0
  273. package/src/shared/lib/icons/icon-paint-authority.ts +94 -0
  274. package/src/shared/lib/icons/icon-paint-css.test.ts +139 -25
  275. package/src/shared/lib/icons/icon-paint-css.ts +76 -50
  276. package/src/shared/lib/icons/icon-paint-panel.ts +15 -18
  277. package/src/shared/lib/icons/icon-paint-weight.ts +142 -0
  278. package/src/shared/lib/icons/icon-tone.ts +58 -13
  279. package/src/shared/lib/icons/tint-hues.generated.ts +51 -6
  280. package/src/shared/lib/icons/tint-tones.test.ts +257 -0
  281. package/src/shared/lib/icons/tint.test.ts +3 -211
  282. package/src/shared/lib/icons/tint.ts +23 -25
  283. package/src/shared/lib/omp/mode/actions.ts +40 -0
  284. package/src/shared/lib/omp/mode/types.ts +12 -0
  285. package/src/shared/lib/theme/css.ts +21 -0
  286. package/src/shared/lib/theme/first-frame.ts +38 -0
  287. package/src/shared/lib/theme/ink-scale.test.ts +151 -0
  288. package/src/shared/lib/theme/ink-scale.ts +103 -0
  289. package/src/shared/lib/theme/shell-palette.test.ts +22 -5
  290. package/src/shared/lib/theme/shell-palette.ts +9 -4
  291. package/src/shared/lib/theme/theme.test.ts +28 -3
  292. package/src/shared/lib/workspace/project-accent.test.ts +33 -1
  293. package/src/shared/lib/workspace/project-accent.ts +23 -0
  294. package/src/shared/types/omp/agent.ts +24 -9
  295. package/dist/client/static/js/index-0721wrkf.css +0 -1
@@ -18,6 +18,11 @@
18
18
  * would tint icons for a user who chose monochrome.
19
19
  * - **Signal rows come after the hue rows**, so `--icon-hue` cannot shadow a
20
20
  * palette signal on the same element.
21
+ * - **An author's class and a solid signal fill are AUTHORITY, not defaults.**
22
+ * The mode paints what an icon did not say; a call site that wrote
23
+ * `text-error` or wrapped the glyph in `bg-error text-canvas` has said
24
+ * something, and both used to be discarded — measured, 22 glyphs lost their
25
+ * signal colour and a trash can rendered at 1.00:1 on its own fill.
21
26
  */
22
27
 
23
28
  import { describe, expect, test } from 'bun:test';
@@ -28,7 +33,7 @@ import {
28
33
  import { BRAND_COLORS } from '@/shared/lib/models/provider/brand-color';
29
34
  import { FILE_BRAND_COLORS } from '@/shared/lib/icons/file-brand-color';
30
35
  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';
36
+ import { ICON_TONES, ICON_TONES_DARK } from '@/shared/lib/icons/tint-hues.generated';
32
37
 
33
38
  const css = iconPaintStyleSheet();
34
39
  const rules = css.split('\n').filter((line) => line.startsWith(':where('));
@@ -83,31 +88,66 @@ describe('the icon paint stylesheet', () => {
83
88
  expect(css).toContain('[data-tool-row] [data-plugin-mark] { --plugin-color: var(--theme-ink); }');
84
89
  });
85
90
 
86
- test('a muted ink icon takes its hue, muted toward the ink rather than faded out', () => {
91
+ test('a muted ink icon keeps its hue and only loses CHROMA', () => {
87
92
  // `text-ink/60` is a WEIGHT. It is (0,1,0) and the hue rules are (0,0,0), so
88
93
  // the mute won and every muted icon stayed ink in the colour mode — the
89
94
  // 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.
95
+ //
96
+ // The weight multiplies CHROMA and leaves LIGHTNESS alone. Mixing toward the
97
+ // ink also darkens, which is the opposite of a mute: measured, a muted
98
+ // settings icon read 7.48:1 where the active one read 3.96:1 and the
99
+ // monochrome ink it replaced read 4.74:1 — darker than both, which is the
100
+ // "masih kusam di light mode" report.
101
+ // `[class~=…]`, never `[class*=…]`: a substring match also fires on the
102
+ // VARIANT token — `text-ink/50 group-hover:text-ink/80` matched both, so the
103
+ // resting icon was painted at its hover weight (measured on the composer's
104
+ // target picker, `Folder` computed the `/80` paint while not hovered).
105
+ // The weight keeps a CHROMA FLOOR: `FLOOR + (1 - FLOOR) * step`, so `/60`
106
+ // paints 0.78 of the tone rather than 0.6 and `/40` paints 0.67 rather than
107
+ // 0.4. A straight `c * step` is what left 169 of 1139 coloured glyphs under
108
+ // chroma 0.08 — greyer than the ink they replaced.
109
+ expect(css).toContain('[data-icon-style="color"] svg.lucide:not(.project-accent-mark)[class~="text-ink/60"] { --icon-paint: oklch(from var(--icon-color) l calc(c * 0.780) h); }');
110
+ expect(css).toContain('[data-icon-style="color"] svg.lucide:not(.project-accent-mark)[class~="text-ink/40"] { --icon-paint: oklch(from var(--icon-color) l calc(c * 0.670) h); }');
111
+ expect(css).toContain('[data-icon-style="color"] svg.lucide:not(.project-accent-mark)[class~="text-ink"] { --icon-paint: var(--icon-color); }');
112
+ expect(css).not.toContain('[class*="text-ink/');
113
+ // Never toward transparency: a hue at 40% alpha is 1.56:1 against its
114
+ // surface, worse than the `text-ink/40` it replaces.
94
115
  const muted = css.split('\n').find((line) => line.includes('text-ink/40"')) ?? '';
95
- expect(muted).toContain('var(--theme-ink)');
116
+ expect(muted).toContain('oklch(from');
96
117
  expect(muted).not.toContain('transparent');
118
+ expect(muted).not.toContain('var(--theme-ink)');
119
+ });
120
+
121
+ test('the weight ramp is monotonic and floored, so a mute keeps its colour', () => {
122
+ // Two properties, and the ramp fails differently without each: MONOTONIC, or
123
+ // a quieter icon is not quieter; FLOORED, or the quietest steps read grey.
124
+ const scaleOf = (step: number) => {
125
+ const rule = css.split('\n').find((line) => line.includes(`[class~="text-ink/${step}"]`)) ?? '';
126
+ return Number(/calc\(c \* ([\d.]+)\)/.exec(rule)?.[1] ?? '0');
127
+ };
128
+ let previous = 0;
129
+ for (const step of [20, 30, 40, 50, 60, 70, 80, 90]) {
130
+ const scale = scaleOf(step);
131
+ expect(scale, `/ ${step}`).toBeGreaterThan(previous);
132
+ previous = scale;
133
+ }
134
+ // Mirrors `WEIGHT_CHROMA_FLOOR = 0.45`: the lightest mute keeps 0.56.
135
+ expect(scaleOf(20)).toBeGreaterThanOrEqual(0.55);
136
+ expect(scaleOf(90)).toBeLessThanOrEqual(1);
97
137
  });
98
138
 
99
139
  test('the project accent survives the dark ink weights', () => {
100
140
  // Each folder mark carries the user's OWN colour as `--project-accent`, and
101
141
  // 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"]`
142
+ // `[data-icon-style="color"][data-theme-variant="dark"] svg.lucide[class~="text-ink/70"]`
103
143
  // = (0,4,1) — one ELEMENT above
104
144
  // `:root[data-icon-style="color"] .project-accent-mark` = (0,4,0) — so on a
105
145
  // dark theme every folder icon came out the same hue and light looked fine.
106
146
  // "A weight does not apply to the user's own colour" is the fix; out-specifying
107
147
  // 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"]');
148
+ expect(css).toContain('[data-icon-style="color"] svg.lucide:not(.project-accent-mark)[class~="text-ink/70"]');
109
149
  expect(css).toContain(
110
- '[data-icon-style="color"][data-theme-variant="dark"] svg.lucide:not(.project-accent-mark)[class*="text-ink/70"]',
150
+ '[data-icon-style="color"][data-theme-variant="dark"] svg.lucide:not(.project-accent-mark)[class~="text-ink/70"]',
111
151
  );
112
152
  expect(css).toContain(':root[data-icon-style="color"] .project-accent-mark { color: var(--project-accent); }');
113
153
  // Every weight rule, not just the one probed by hand: a single step that
@@ -132,21 +172,29 @@ describe('the icon paint stylesheet', () => {
132
172
  }
133
173
  });
134
174
 
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,');
175
+ test('the base hue rule states --icon-color, per variant, and one rule paints it', () => {
176
+ expect(css).toContain(':where(svg.lucide) { --icon-color: var(--icon-tone, hsl(var(--icon-hue,');
177
+ expect(css).toContain(':where([data-icon-style="color"][data-theme-variant="dark"]) :where(svg.lucide) { --icon-color: var(--icon-tone-dark, hsl(var(--icon-hue,');
178
+ // ONE `color:` statement, derived from the two custom properties. Stating it
179
+ // per source instead made the weight rules fight them on specificity, and a
180
+ // signal token could be overwritten by winning that race.
181
+ expect(css).toContain('[data-icon-style="color"] :is(svg.lucide, svg[data-provider], svg[data-file-brand]) { --icon-paint: var(--icon-color); color: var(--icon-paint); }');
138
182
  });
139
183
 
140
184
  test('one hue statement per generated row', () => {
141
185
  for (const { className, hue } of ICON_HUE_ROWS) {
142
- expect(css).toContain(`:where(svg.${className}) { --icon-hue: ${hue}; --icon-tone: ${ICON_TONES[hue]}; }`);
186
+ // BOTH variants on one row: stamping only the light tone is what left
187
+ // dark on a single `hsl()` pair for every hue.
188
+ expect(css).toContain(
189
+ `:where(svg.${className}) { --icon-hue: ${hue}; --icon-tone: ${ICON_TONES[hue]}; --icon-tone-dark: ${ICON_TONES_DARK[hue]}; }`,
190
+ );
143
191
  }
144
192
  });
145
193
 
146
194
  test('every signal row paints its palette token, after the hue rows', () => {
147
195
  const hueIndex = css.indexOf('--icon-hue');
148
196
  for (const { className, role } of ICON_TINT_ROWS) {
149
- const needle = `:where(svg.${className}) { color: ${ICON_TINT_TOKENS[role]}; }`;
197
+ const needle = `:where(svg.${className}) { --icon-color: ${ICON_TINT_TOKENS[role]}; }`;
150
198
  expect(css).toContain(needle);
151
199
  expect(css.indexOf(needle), `${className} must follow the hue rules`).toBeGreaterThan(hueIndex);
152
200
  }
@@ -155,16 +203,16 @@ describe('the icon paint stylesheet', () => {
155
203
  test('every provider row paints both variants', () => {
156
204
  for (const [name, entry] of Object.entries(BRAND_COLORS)) {
157
205
  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)'}; }`);
206
+ expect(css).toContain(`:where(${selector}) { --icon-color: ${entry.light}; }`);
207
+ expect(css).toContain(`--icon-color: ${entry.dark ?? 'var(--theme-ink)'}; }`);
160
208
  }
161
209
  });
162
210
 
163
211
  test('every file-brand row paints both variants', () => {
164
212
  for (const [name, entry] of Object.entries(FILE_BRAND_COLORS)) {
165
213
  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)'}; }`);
214
+ expect(css).toContain(`:where(${selector}) { --icon-color: ${entry.light}; }`);
215
+ expect(css).toContain(`--icon-color: ${entry.dark ?? 'var(--theme-ink)'}; }`);
168
216
  }
169
217
  });
170
218
 
@@ -192,9 +240,13 @@ describe('the icon paint stylesheet', () => {
192
240
  // measured 95 → 62 on a 64px glyph, which is the "kusem" report. A brightness
193
241
  // shift moves luminance only; the two variants shift opposite ways because
194
242
  // "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); }');
243
+ // Both factors are measured against the floor, not picked: with the solved
244
+ // light tone at 3.30:1 mean, `1.08` walked the idle mark down to 2.88 mean
245
+ // with 35 of 36 hues UNDER 3:1; `1.02` holds 3.18 with none. Dark's `0.62`
246
+ // read 2.86 mean and `0.75` reads 4.00 with none.
247
+ expect(css).toContain('[data-icon-style="color"] [data-panel-mark][data-idle]:not([data-declared]) { filter: brightness(1.02) saturate(1.1); }');
196
248
  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); }',
249
+ '[data-icon-style="color"][data-theme-variant="dark"] [data-panel-mark][data-idle]:not([data-declared]) { filter: brightness(0.75) saturate(1.4); }',
198
250
  );
199
251
  // And the state must not be stated twice: an opacity left behind would
200
252
  // desaturate exactly what the filter restored.
@@ -213,10 +265,15 @@ describe('the icon paint stylesheet', () => {
213
265
  // mid-tone ink (`#586e75`, `#93a1a1`), where no hue at any lightness clears
214
266
  // 3:1. The surface already declares `text-canvas`/`text-paper`, and the
215
267
  // 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; }');
268
+ // (0,2,1) with an explicit `color`, not `:where()`: it has to TIE with the
269
+ // paint rule and win on order, and it cannot feed `currentColor` back into
270
+ // `--icon-color` — that is a cycle on the property computing `color`.
271
+ expect(css).toContain('[data-icon-style="color"] .bg-ink svg.lucide { color: currentColor; }');
217
272
  expect(css).toContain(':where([data-icon-style="color"]) :where(.bg-ink) :where([data-plugin-mark]) { --plugin-color: currentColor; }');
218
273
  // 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'));
274
+ expect(css.indexOf('.bg-ink svg.lucide { color: currentColor; }')).toBeGreaterThan(
275
+ css.indexOf('[data-icon-style="color"] :is(svg.lucide, svg[data-provider]'),
276
+ );
220
277
  });
221
278
 
222
279
  test('a plugin manifest colour wins over the hashed hue', () => {
@@ -224,12 +281,69 @@ describe('the icon paint stylesheet', () => {
224
281
  // hashed hue is only the fallback — the order inside the `var()` chain is the
225
282
  // contract, so it is pinned literally.
226
283
  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');
284
+ expect(css).toContain('--plugin-color: var(--plugin-declared-dark, var(--icon-tone-dark, hsl(var(--icon-hue');
228
285
  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,');
286
+ expect(css).toContain('color: var(--panel-color-dark, var(--panel-tone-dark, hsl(var(--panel-hue, var(--icon-hue,');
230
287
  });
231
288
 
232
289
  test('the string is cached, not rebuilt per call', () => {
233
290
  expect(iconPaintStyleSheet()).toBe(css);
234
291
  });
235
292
  });
293
+
294
+ describe('the ink weight selectors', () => {
295
+ // Only the rules that read a WEIGHT: the paint rule also sets `--icon-paint`
296
+ // (from `--icon-color`, unconditionally), and it is not a weight.
297
+ const weightRules = css.split('\n').filter((line) => line.includes('--icon-paint:') && line.includes('text-ink'));
298
+
299
+ test('a weight matches one class TOKEN, never a substring', () => {
300
+ // `[class*=…]` also fires on the VARIANT token: `text-ink/50
301
+ // group-hover:text-ink/80` matched both `/50` and `/80`, so the resting icon
302
+ // was painted at its HOVER weight — measured on the composer's target
303
+ // picker, `Folder` computed the `/80` paint while the pointer was elsewhere.
304
+ expect(weightRules.length).toBeGreaterThan(0);
305
+ for (const rule of weightRules) {
306
+ expect(rule, rule.slice(0, 90)).toContain('[class~="');
307
+ expect(rule, rule.slice(0, 90)).not.toContain('[class*="text-ink');
308
+ }
309
+ });
310
+
311
+ test('a hover weight is stated as a pseudo-class, in the right DOM order', () => {
312
+ // Two independent failures live here. ORDER: `.group` is an ancestor while
313
+ // `[data-icon-style]` sits on `<html>`, so `.group:hover` has to come AFTER
314
+ // the mode gate — written before it, the selector demands a descendant that
315
+ // carries the attribute and never matches (measured: `group-hover` had no
316
+ // effect at all). SPECIFICITY: the variant must outrank the resting rule, so
317
+ // an icon that is muted at rest and bright on hover really does brighten.
318
+ const groupRule = weightRules.find((line) => line.includes('[class~="group-hover:text-ink/80"]')) ?? '';
319
+ expect(groupRule).toMatch(/^\[data-icon-style="color"\] \.group:hover svg\.lucide/);
320
+
321
+ const hoverRule = weightRules.find((line) => line.includes('[class~="hover:text-ink/70"]')) ?? '';
322
+ expect(hoverRule).toMatch(/^\[data-icon-style="color"\] svg\.lucide.*\]:hover \{/);
323
+
324
+ // The resting rule for the same class must exist too, or the selector is a
325
+ // hover-only paint and the icon changes colour the moment the pointer moves.
326
+ expect(weightRules.some((line) => line.includes('[class~="text-ink/50"]') && !line.includes('hover'))).toBe(true);
327
+ });
328
+
329
+ test('the weight scales chroma, and never mixes toward the ink', () => {
330
+ // Mixing toward `var(--theme-ink)` desaturates AND darkens, and darkening is
331
+ // the opposite of a mute: a muted settings icon measured 7.48:1 where the
332
+ // active one read 3.96:1. Multiplying chroma leaves the solved lightness —
333
+ // and therefore the legibility — alone.
334
+ const stepped = weightRules.filter((line) => /text-ink\/\d+"\]/.test(line));
335
+ expect(stepped.length).toBeGreaterThan(0);
336
+ for (const rule of stepped) {
337
+ expect(rule, rule.slice(0, 90)).toContain('oklch(from var(--icon-color) l calc(c *');
338
+ expect(rule, rule.slice(0, 90)).not.toContain('var(--theme-ink)');
339
+ expect(rule, rule.slice(0, 90)).not.toContain('color-mix(');
340
+ }
341
+ });
342
+
343
+ test('every weight is gated on the colour mode and skips the project accent', () => {
344
+ for (const rule of weightRules) {
345
+ expect(rule.startsWith('[data-icon-style="color"]'), rule.slice(0, 80)).toBe(true);
346
+ expect(rule, rule.slice(0, 80)).toContain(':not(.project-accent-mark)');
347
+ }
348
+ });
349
+ });
@@ -47,6 +47,8 @@
47
47
 
48
48
  import { BRAND_COLORS } from '@/shared/lib/models/provider/brand-color';
49
49
  import { panelMarkRules } from '@/shared/lib/icons/icon-paint-panel';
50
+ import { inkWeightRules } from '@/shared/lib/icons/icon-paint-weight';
51
+ import { authorColourRules, solidSignalFillRules } from '@/shared/lib/icons/icon-paint-authority';
50
52
  import { FILE_BRAND_COLORS } from '@/shared/lib/icons/file-brand-color';
51
53
  import {
52
54
  DEFAULT_ICON_HUE,
@@ -63,23 +65,69 @@ export const ICON_PAINT_STYLE_ELEMENT_ID = 'omp-icon-paint';
63
65
  /** Both rules for one brand, since a brand colour has two values. */
64
66
  function brandRules(selector: string, light: string, dark: string | null): string[] {
65
67
  return [
66
- `:where([data-icon-style="color"]) :where(${selector}) { color: ${light}; }`,
67
- `:where([data-icon-style="color"][data-theme-variant="dark"]) :where(${selector}) { color: ${dark ?? 'var(--theme-ink)'}; }`,
68
+ `:where([data-icon-style="color"]) :where(${selector}) { --icon-color: ${light}; }`,
69
+ `:where([data-icon-style="color"][data-theme-variant="dark"]) :where(${selector}) { --icon-color: ${dark ?? 'var(--theme-ink)'}; }`,
68
70
  ];
69
71
  }
70
72
 
71
73
  /** The hue a functional glyph is painted with, per variant. */
72
74
  function hueRules(): string[] {
73
75
  const rules = [
74
- `:where([data-icon-style="color"]) :where(svg.lucide) { color: ${iconHuePaint('light')}; }`,
75
- `:where([data-icon-style="color"][data-theme-variant="dark"]) :where(svg.lucide) { color: ${iconHuePaint('dark')}; }`,
76
+ // `--icon-paint`, not `color`: WHICH colour an icon is and HOW LOUD it is are
77
+ // two decisions, and stating them as one `color` makes them compete on
78
+ // specificity. The weight rules below multiply the chroma of whatever this
79
+ // resolves to, so they cannot overwrite a signal token by winning a cascade
80
+ // race (which is exactly what they did — see `inkWeightRules`).
81
+ `:where([data-icon-style="color"]) :where(svg.lucide) { --icon-color: ${iconHuePaint('light')}; }`,
82
+ `:where([data-icon-style="color"][data-theme-variant="dark"]) :where(svg.lucide) { --icon-color: ${iconHuePaint('dark')}; }`,
76
83
  ];
77
84
  for (const { className, hue } of ICON_HUE_ROWS) {
78
- rules.push(`:where([data-icon-style="color"]) :where(svg.${className}) { --icon-hue: ${hue}; --icon-tone: ${iconTone(hue)}; }`);
85
+ // BOTH variants on one element, so the variant rule below only has to pick
86
+ // between two custom properties. Stamping `--icon-tone` alone is what left
87
+ // dark on a single `hsl()` pair for every hue.
88
+ rules.push(
89
+ `:where([data-icon-style="color"]) :where(svg.${className}) { --icon-hue: ${hue}; --icon-tone: ${iconTone(hue, 'light')}; --icon-tone-dark: ${iconTone(hue, 'dark')}; }`,
90
+ );
79
91
  }
80
92
  return rules;
81
93
  }
82
94
 
95
+ /**
96
+ * The paint itself. Stated ONCE, after the sources above, so every rule that
97
+ * decides a colour only has to set `--icon-color`.
98
+ *
99
+ * `color` rather than a second fallback inside each source: it is the one
100
+ * property a caller can also set (`text-ink/60`), and this block is gated, so an
101
+ * icon outside the colour mode keeps the author's class.
102
+ *
103
+ * **The selector covers all three icon families, not just `.lucide`.** Provider
104
+ * and file-type marks are their own `<svg>` and carry no `lucide` class, so a
105
+ * `.lucide`-only paint rule left them inheriting their parent's text colour —
106
+ * measured, a brand mark computed `oklab(0.523 -0.022 -0.018 / 0.8)` (its row's
107
+ * muted ink) while its `--icon-color` held the brand hex. `:is()` costs nothing:
108
+ * each argument is (0,1,1), so the whole selector stays (0,2,1) and still beats
109
+ * a single utility.
110
+ */
111
+ function paintRules(): string[] {
112
+ return [
113
+ // `--icon-paint` is derived from `--icon-color`, which every source above
114
+ // sets. The indirection is what lets a WEIGHT rule (see `inkWeightRules`)
115
+ // transform the colour without knowing which source produced it — a signal
116
+ // token, a solved tone, a brand hex or a panel's own colour all flow through
117
+ // the same two lines.
118
+ //
119
+ // NOT `:where()` on this one, unlike every other rule in the sheet. The
120
+ // subject is the `color` property, which the call sites also set — a utility
121
+ // like `text-ink/60` is (0,1,0) — so a zero-specificity statement lost the
122
+ // mode entirely and every muted icon stayed monochrome ink (measured in the
123
+ // settings modal: `--icon-paint` computed to the tone, and `color` still
124
+ // resolved to `oklab(… / 0.6)`). (0,2,1) beats a single utility, and the
125
+ // rules that must still override it — a panel mark, a tool card, an inverted
126
+ // surface, the project accent — are stated after this one with more weight.
127
+ `[data-icon-style="color"] :is(svg.lucide, svg[data-provider], svg[data-file-brand]) { --icon-paint: var(--icon-color); color: var(--icon-paint); }`,
128
+ ];
129
+ }
130
+
83
131
  /**
84
132
  * MONOCHROME: an icon takes the ink of the text beside it.
85
133
  *
@@ -154,7 +202,14 @@ function toolCardRules(): string[] {
154
202
  */
155
203
  function projectAccentRules(): string[] {
156
204
  return [
205
+ // The pair, not one value: every shipped preset is chosen to look good as a
206
+ // SWATCH, and measured as a glyph nine of them fall below the 3:1 floor on
207
+ // light paper — `#a3e635` reads 1.15:1, `#fbbf24` 1.27:1. The component
208
+ // derives both values through `legiblePair`, the same rule every brand mark
209
+ // uses, so the icon is the user's colour at a legal lightness while the
210
+ // swatch keeps the exact hex they picked.
157
211
  ':root[data-icon-style="color"] .project-accent-mark { color: var(--project-accent); }',
212
+ ':root[data-icon-style="color"][data-theme-variant="dark"] .project-accent-mark { color: var(--project-accent-dark, var(--project-accent)); }',
158
213
  ];
159
214
  }
160
215
 
@@ -183,7 +238,12 @@ function projectAccentRules(): string[] {
183
238
  */
184
239
  function invertedSurfaceRules(): string[] {
185
240
  return [
186
- ':where([data-icon-style="color"]) :where(.bg-ink) :where(svg.lucide) { color: currentColor; }',
241
+ // Stated at (0,2,1) to TIE with `paintRules` and win on order — `:where()`
242
+ // would be (0,0,0) and lose to it, which is the whole reason this rule
243
+ // exists. It sets `color` directly rather than `--icon-color`, because
244
+ // `currentColor` resolves FROM `color`: feeding it back into the property
245
+ // that computes `color` is a cycle the browser drops.
246
+ '[data-icon-style="color"] .bg-ink svg.lucide { color: currentColor; }',
187
247
  ':where([data-icon-style="color"]) :where(.bg-ink) :where([data-plugin-mark]) { --plugin-color: currentColor; }',
188
248
  ];
189
249
  }
@@ -203,52 +263,11 @@ function pluginMarkRules(): string[] {
203
263
  ];
204
264
  }
205
265
 
206
- /**
207
- * `text-ink/60` is a WEIGHT, not a colour choice.
208
- *
209
- * The settings sidebar, the composer toolbar and a few hundred other call sites
210
- * write `text-ink/40`-`/80` to mute an icon. That is "the ink, quieter" — the
211
- * caller did not pick a colour — but a utility class is (0,1,0) and the hue
212
- * rules are `:where()` (0,0,0), so the mute won and every muted icon stayed ink
213
- * in the colour mode ("icon di setting modal kenapa gk full color").
214
- *
215
- * The mute is reproduced by mixing toward the INK, not toward transparency. Two
216
- * reasons, both measured. Transparency is the wrong lever for a graphic: a hue at
217
- * 40% alpha is 1.56:1 (light) / 1.77:1 (dark) against its surface, while the
218
- * `text-ink/40` it replaces was already only 1.71 / 2.05 — so the colour mode
219
- * would have made every muted icon less legible than before. Mixing toward the
220
- * ink instead keeps the same "mostly ink, quieter" reading AND lands at 3.89:1
221
- * worst case across every palette (`hue 80% + ink 20%`), 4.65:1 at the muted end.
222
- *
223
- * Specificity `svg.lucide[class*=…]` (0,2,1) beats the utility (0,1,0) on its
224
- * own; the `!` is not needed and is not used anywhere in this sheet.
225
- */
226
- function inkWeightRules(): string[] {
227
- const steps = [25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90];
228
- const rules: string[] = [];
229
- for (const variant of ['light', 'dark'] as const) {
230
- const gate = variant === 'dark'
231
- ? '[data-icon-style="color"][data-theme-variant="dark"]'
232
- : '[data-icon-style="color"]';
233
- const paint = iconHuePaint(variant);
234
- // The un-suffixed `text-ink` is the full-strength ink.
235
- rules.push(`${gate} svg.lucide:not(.project-accent-mark)[class~="text-ink"] { color: ${paint}; }`);
236
- for (const step of steps) {
237
- // `NN%` of hue over the ink: the caller's mute survives as "mostly ink",
238
- // and the hue is what the mode added.
239
- rules.push(
240
- `${gate} svg.lucide:not(.project-accent-mark)[class*="text-ink/${step}"] { color: color-mix(in srgb, ${paint} ${step}%, var(--theme-ink)); }`,
241
- );
242
- }
243
- }
244
- return rules;
245
- }
246
-
247
266
  /** The signal colours, which beat the hue because they are stated after it. */
248
267
  function signalRules(): string[] {
249
268
  return ICON_TINT_ROWS.map(
250
269
  ({ className, role }) =>
251
- `:where([data-icon-style="color"]) :where(svg.${className}) { color: ${ICON_TINT_TOKENS[role]}; }`,
270
+ `:where([data-icon-style="color"]) :where(svg.${className}) { --icon-color: ${ICON_TINT_TOKENS[role]}; }`,
252
271
  );
253
272
  }
254
273
 
@@ -263,13 +282,20 @@ export function iconPaintStyleSheet(): string {
263
282
  '@layer theme, base, components, utilities;',
264
283
  '@layer utilities {',
265
284
  ...hueRules(),
266
- ...inkWeightRules(),
267
- ...panelMarkRules(),
268
285
  ...signalRules(),
286
+ // An author's own signal class is a decision, so it is stated after the
287
+ // table that would otherwise guess one for the same glyph.
288
+ ...authorColourRules(),
269
289
  ...pluginMarkRules(),
290
+ // Every `--icon-color` source is stated above this line; the paint and the
291
+ // weight that SCALES it are stated below, in that order.
292
+ ...paintRules(),
293
+ ...inkWeightRules(),
294
+ ...panelMarkRules(),
270
295
  // Last: same specificity as everything above, so order is what makes an
271
296
  // inverted surface win over the paper-tuned paint.
272
297
  ...invertedSurfaceRules(),
298
+ ...solidSignalFillRules(),
273
299
  ...projectAccentRules(),
274
300
  ...monochromeRules(),
275
301
  ...toolCardRules(),
@@ -34,10 +34,11 @@ import { DEFAULT_ICON_HUE, ICON_HUE_PAINT } from '@/shared/lib/icons/tint';
34
34
  function panelPaint(variant: 'light' | 'dark'): string {
35
35
  const { saturation, lightness } = ICON_HUE_PAINT[variant];
36
36
  const hsl = `hsl(var(--panel-hue, var(--icon-hue, ${DEFAULT_ICON_HUE})) ${saturation}% ${lightness}%)`;
37
- // Light reads `--panel-tone`, the same solved table the glyph rows use: a
38
- // panel's hue is assigned at runtime, so the tone is stamped by `PanelMark`
39
- // rather than generated per row. Dark keeps the single `hsl()` pair.
40
- const toned = variant === 'light' ? `var(--panel-tone, ${hsl})` : hsl;
37
+ // Both variants read a `--panel-tone*` stamped by `PanelMark` from the solved
38
+ // table: a panel's hue is assigned at runtime, so it cannot be a generated CSS
39
+ // row, and an unsolved `hsl()` on the dark side is the lightness spread this
40
+ // mode was fixed by removing.
41
+ const toned = variant === 'light' ? `var(--panel-tone, ${hsl})` : `var(--panel-tone-dark, ${hsl})`;
41
42
  return `var(--panel-color-${variant}, ${toned})`;
42
43
  }
43
44
 
@@ -78,20 +79,16 @@ export function panelMarkRules(): string[] {
78
79
  // **62** when idle, and the rail read as washed-out pastels — "warna icon di
79
80
  // activity panel kanan / kiri kok agak kusem". A `brightness()` shift plus
80
81
  // the `saturate()` that pays back what the multiply costs keeps the colour
81
- // and moves only the luminance: the same glyph measures **94** chroma at
82
- // contrast 3.07 instead of 62 at 2.94, i.e. the SAME quietness with the
83
- // colour restored.
82
+ // and moves only the luminance — but it must not walk the mark UNDER the
83
+ // floor, and it did: with the solved light tone sitting at 3.30:1 mean,
84
+ // `brightness(1.08)` dropped the idle mark to **2.88:1 mean, 35 of 36 hues
85
+ // below 3:1**. Measured over the same tones, `1.02` holds 3.18 mean with
86
+ // every hue clear, so that is the light factor now.
84
87
  //
85
88
  // The two variants shift in opposite directions because "recede" does: on ink
86
- // an idle icon is DARKER, on paper it is LIGHTER.
87
- //
88
- // Light's factor is `1.08 saturate(1.1)`, NOT the `1.25` the darker paint
89
- // needed. The light tone is now a solved hex sitting AT the contrast floor
90
- // (3.15 mean 3.30, `icon-tone.ts`), where the old pair had 6.11 of headroom to
91
- // spend — so the old factor walked every idle mark down to 2.23:1 and the rail
92
- // went dim rather than quiet. Re-measured over the shipped tones: `1.08/1.1`
93
- // reads 2.79:1 mean, still a visible step down, and holds chroma at 111% of
94
- // the active mark (the `saturate()` is what pays for the multiply).
89
+ // an idle icon is DARKER, on paper it is LIGHTER. Dark has 6.97:1 of headroom
90
+ // and spends more of it: `0.62` read 2.86 mean (20 hues below the floor)
91
+ // while `0.75` reads 4.00 with none.
95
92
  //
96
93
  // A DECLARED brand colour is NOT dimmed. The settings card draws the same
97
94
  // plugin at full strength, so dimming this copy made one brand two colours
@@ -103,7 +100,7 @@ export function panelMarkRules(): string[] {
103
100
  // `[data-declared]` is stamped from `panel.color` — a property, not a
104
101
  // class-name or inline-style guess, so this cannot drift when the mark
105
102
  // changes how it carries its colour.
106
- '[data-icon-style="color"] [data-panel-mark][data-idle]:not([data-declared]) { filter: brightness(1.08) saturate(1.1); }',
107
- '[data-icon-style="color"][data-theme-variant="dark"] [data-panel-mark][data-idle]:not([data-declared]) { filter: brightness(0.62) saturate(1.4); }',
103
+ '[data-icon-style="color"] [data-panel-mark][data-idle]:not([data-declared]) { filter: brightness(1.02) saturate(1.1); }',
104
+ '[data-icon-style="color"][data-theme-variant="dark"] [data-panel-mark][data-idle]:not([data-declared]) { filter: brightness(0.75) saturate(1.4); }',
108
105
  ];
109
106
  }