@kabmo-labs/kabmo 0.21.1 → 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.
- package/README.md +7 -2
- package/dist/client/index.html +9 -8
- package/dist/client/index.js +334 -334
- package/dist/client/static/js/{index-thwqf24c.js → index-297dck9a.js} +784 -791
- package/dist/client/static/js/index-7ppta1pb.css +1 -0
- package/extensions/kabmo-modes/commands.ts +17 -3
- package/extensions/kabmo-modes/goal-start.ts +101 -0
- package/extensions/kabmo-modes/goal.test.ts +80 -5
- package/extensions/kabmo-modes/goal.ts +13 -38
- package/extensions/kabmo-modes/prompts.test.ts +12 -0
- package/extensions/kabmo-modes/prompts.ts +9 -2
- package/index.html +8 -7
- package/package.json +2 -2
- package/src/cli/lib/args.js +9 -0
- package/src/cli/lib/args.test.js +26 -0
- package/src/cli/lib/commands/doctor.js +153 -0
- package/src/cli/lib/commands/doctor.test.js +139 -0
- package/src/cli/lib/commands/serve.js +23 -10
- package/src/cli/lib/commands/status.js +22 -3
- package/src/cli/lib/omp-setup.js +131 -0
- package/src/cli/lib/omp-setup.test.js +115 -0
- package/src/cli/main.js +1 -1
- package/src/client/components/common/DemoDataBadge.tsx +52 -0
- package/src/client/components/common/FolderPicker.tsx +2 -2
- package/src/client/components/common/Modal.tsx +15 -1
- package/src/client/components/common/code-surface/blame-panel.ts +1 -1
- package/src/client/components/common/context-usage-button/index.test.tsx +1 -1
- package/src/client/components/common/context-usage-button/index.tsx +4 -4
- package/src/client/components/common/demo-data-badge.test.tsx +58 -0
- package/src/client/components/common/diagram-viewer/index.tsx +2 -2
- package/src/client/components/common/editor-view-buttons/index.tsx +2 -2
- package/src/client/components/common/header-controls/MoreMenu.tsx +1 -1
- package/src/client/components/common/header-controls/index.tsx +4 -1
- package/src/client/components/common/markdown-review/ReviewPopover.tsx +2 -2
- package/src/client/components/common/markdown-review/ReviewSummary.tsx +1 -1
- package/src/client/components/common/panel-mark/index.tsx +2 -1
- package/src/client/components/common/server-control/Panel.tsx +3 -3
- package/src/client/components/common/server-control/index.tsx +1 -1
- package/src/client/components/common/shell-update-button/Modal.tsx +1 -1
- package/src/client/components/common/todo-row/index.tsx +1 -1
- package/src/client/components/layout/ActivityBar.tsx +4 -0
- package/src/client/components/layout/ShellNotice.tsx +33 -0
- package/src/client/components/layout/desktop-layout/index.tsx +14 -16
- package/src/client/components/layout/desktop-layout/resizer/index.tsx +14 -1
- package/src/client/components/layout/session-sidebar/CategoryHeader.tsx +2 -1
- package/src/client/components/layout/session-sidebar/ClassicView.tsx +5 -1
- package/src/client/components/layout/session-sidebar/SessionList.tsx +1 -1
- package/src/client/components/layout/session-sidebar/SessionListNotice.tsx +56 -0
- package/src/client/components/layout/session-sidebar/SessionsView.tsx +2 -0
- package/src/client/components/layout/session-sidebar/about-modal/UpdateSection.tsx +1 -1
- package/src/client/components/layout/session-sidebar/about-modal/index.tsx +12 -1
- package/src/client/components/layout/session-sidebar/modern/WorkspaceHeader.tsx +2 -1
- package/src/client/components/layout/session-sidebar/modern/index.tsx +6 -2
- package/src/client/components/layout/session-sidebar/new-workspace-modal/CloneField.tsx +1 -1
- 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 +1 -1
- package/src/client/components/layout/session-sidebar/scheduler-modal/TaskList.tsx +3 -3
- package/src/client/components/layout/session-sidebar/scheduler-modal/index.tsx +1 -1
- package/src/client/components/layout/session-sidebar/session-list-states.test.tsx +150 -0
- package/src/client/components/layout/session-sidebar/variant-props.ts +6 -0
- package/src/client/components/mobile/LayoutWrapper.tsx +20 -30
- package/src/client/components/mobile/MainView.tsx +5 -2
- package/src/client/components/mobile/RightSidebar.tsx +1 -1
- package/src/client/components/mobile/SessionSidebar.tsx +3 -0
- package/src/client/components/mobile/mobile-main-view/Header.tsx +2 -2
- package/src/client/components/mobile/mobile-session-sidebar/ClassicDrawer.tsx +7 -1
- package/src/client/components/mobile/mobile-session-sidebar/Toolbar.tsx +1 -1
- package/src/client/components/settings/Modal.tsx +15 -1
- package/src/client/components/settings/ProjectSelectorDropdown.tsx +1 -1
- package/src/client/components/settings/Sidebar.tsx +2 -2
- package/src/client/components/settings/categories/OmpSettings.tsx +1 -1
- package/src/client/components/settings/categories/TokenUsageSettings.tsx +1 -1
- package/src/client/components/settings/categories/agent-settings/DetailPane.tsx +3 -3
- package/src/client/components/settings/categories/appearance-settings/EditorFontSection.tsx +1 -1
- package/src/client/components/settings/categories/appearance-settings/EditorThemeSection.tsx +2 -2
- package/src/client/components/settings/categories/appearance-settings/IconStyleSection.tsx +5 -5
- package/src/client/components/settings/categories/appearance-settings/SidebarStyleSection.tsx +1 -1
- package/src/client/components/settings/categories/appearance-settings/SurfaceStyleSection.tsx +1 -1
- package/src/client/components/settings/categories/appearance-settings/ThemeCard.tsx +1 -1
- package/src/client/components/settings/categories/chat-settings/ComposerStyleSection.tsx +1 -1
- package/src/client/components/settings/categories/chat-settings/GoalSection.tsx +1 -1
- package/src/client/components/settings/categories/command-settings/DetailPane.tsx +2 -2
- package/src/client/components/settings/categories/omp-settings/ConfigTabs.tsx +5 -5
- package/src/client/components/settings/categories/omp-settings/EngineHeader.tsx +3 -3
- package/src/client/components/settings/categories/omp-settings/RoleRow.tsx +2 -2
- package/src/client/components/settings/categories/panel-plugins/LeftDockSettings.tsx +1 -1
- package/src/client/components/settings/categories/panel-plugins/PluginCard.tsx +1 -1
- package/src/client/components/settings/categories/panel-plugins/PluginMark.tsx +4 -3
- package/src/client/components/settings/categories/plugin-settings/SidebarList.tsx +2 -2
- package/src/client/components/settings/categories/project-settings/AddProjectModal.tsx +1 -1
- package/src/client/components/settings/categories/project-settings/NameInput.tsx +1 -1
- package/src/client/components/settings/categories/project-settings/PathField.tsx +1 -1
- package/src/client/components/settings/categories/provider-settings/AddModelModal.tsx +3 -3
- package/src/client/components/settings/categories/provider-settings/AddProviderModal.tsx +1 -1
- package/src/client/components/settings/categories/provider-settings/AuthSection.tsx +2 -2
- package/src/client/components/settings/categories/provider-settings/DeleteProviderModal.tsx +1 -1
- package/src/client/components/settings/categories/provider-settings/EntryAdvanced.tsx +4 -4
- package/src/client/components/settings/categories/provider-settings/EntryModal.tsx +2 -2
- package/src/client/components/settings/categories/provider-settings/LoginModal.tsx +1 -1
- package/src/client/components/settings/categories/provider-settings/ModelCapabilitiesModal.tsx +1 -1
- package/src/client/components/settings/categories/provider-settings/ModelsList.tsx +2 -2
- package/src/client/components/settings/categories/provider-settings/PriceFields.tsx +1 -1
- package/src/client/components/settings/categories/token-usage-settings/Breakdown.tsx +4 -4
- package/src/client/components/settings/categories/token-usage-settings/Chart.tsx +2 -2
- package/src/client/components/settings/categories/token-usage-settings/Controls.tsx +1 -1
- package/src/client/components/settings/categories/token-usage-settings/MetricsGrid.tsx +1 -1
- package/src/client/components/settings/categories/usage-settings/KenariCard.tsx +5 -5
- package/src/client/components/workspace/browser-panel/AddressBar.tsx +1 -1
- package/src/client/components/workspace/browser-panel/Screencast.tsx +6 -6
- package/src/client/components/workspace/browser-panel/TabStrip.tsx +1 -1
- package/src/client/components/workspace/browser-panel/index.tsx +1 -1
- package/src/client/components/workspace/browser-toolbar/index.tsx +5 -5
- package/src/client/components/workspace/chat-timeline/AttachmentChips.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/GeneratingIndicator.tsx +13 -26
- package/src/client/components/workspace/chat-timeline/GoalNotice.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/MessageItem.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/MinimapShortcuts.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/QueueList.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/SubagentView.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/SystemNotice.tsx +5 -5
- package/src/client/components/workspace/chat-timeline/TaskResultContent.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/ThinkingSection.tsx +4 -4
- package/src/client/components/workspace/chat-timeline/ToolCallingSection.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/chat-input/AccessDropdown.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/chat-input/ArmedGoalStrip.tsx +71 -0
- package/src/client/components/workspace/chat-timeline/chat-input/AttachmentToolbar.tsx +4 -3
- package/src/client/components/workspace/chat-timeline/chat-input/GoalBanner.test.ts +1 -1
- package/src/client/components/workspace/chat-timeline/chat-input/GoalBanner.tsx +3 -3
- package/src/client/components/workspace/chat-timeline/chat-input/GoalModal.test.ts +176 -0
- package/src/client/components/workspace/chat-timeline/chat-input/GoalModal.tsx +70 -81
- package/src/client/components/workspace/chat-timeline/chat-input/GoalSurfaces.tsx +10 -1
- package/src/client/components/workspace/chat-timeline/chat-input/ModeToggles.test.ts +20 -0
- package/src/client/components/workspace/chat-timeline/chat-input/ModeToggles.tsx +13 -7
- package/src/client/components/workspace/chat-timeline/chat-input/ThinkingLevelDropdown.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/chat-input/Toolbar.test.ts +65 -3
- package/src/client/components/workspace/chat-timeline/chat-input/Toolbar.tsx +69 -19
- package/src/client/components/workspace/chat-timeline/chat-input/WaitingDependencyPicker.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/chat-input/composer-portal.test.tsx +174 -0
- package/src/client/components/workspace/chat-timeline/chat-input/goal-modal-parts.tsx +80 -0
- package/src/client/components/workspace/chat-timeline/chat-input/modes-props.ts +15 -3
- package/src/client/components/workspace/chat-timeline/chat-input/styles.test.tsx +3 -1
- package/src/client/components/workspace/chat-timeline/plan-review/index.tsx +1 -1
- 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/ask-panel/FrameControl.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/OptionRow.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/OrphanAsks.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/QuestionBlock.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/QuestionCard.tsx +4 -4
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/index.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/tool-renderers/extension-dialog/Header.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/extension-dialog/SelectBody.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/hashline-patch/index.tsx +4 -4
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/AstEdit.tsx +6 -6
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Bash.tsx +13 -13
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Checkpoint.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/ContextNotes.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Debug.tsx +3 -3
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Edit.tsx +9 -9
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Eval.tsx +10 -10
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/FileMatches.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Goal.tsx +5 -5
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/GoalRecord.tsx +5 -5
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Lsp.tsx +6 -6
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/ManageSkill.tsx +5 -5
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Mcp.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Memory.tsx +3 -3
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Proc.tsx +15 -15
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Read.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Resolve.tsx +4 -4
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/SearchFs.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/SearchTool.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/SecurityScan.tsx +4 -4
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/TaskResult.tsx +7 -7
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Think.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Todo.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Wait.missing.test.ts +4 -2
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Wait.tsx +17 -17
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/WebSearch.tsx +3 -3
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/ArtifactChip.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/EnvelopeHeader.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/ExcerptCode.tsx +3 -3
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/FallbackOutput.tsx +3 -3
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/JsonCodeBlock.tsx +3 -3
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/OutputWindow.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/ToolBody.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/ToolFactChips.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/ToolPanelHeader.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/styles/Minimal.tsx +1 -1
- package/src/client/components/workspace/context-panel/RawJsonViewer.tsx +2 -2
- package/src/client/components/workspace/context-panel/StatsGrid.tsx +1 -1
- package/src/client/components/workspace/context-panel/index.tsx +1 -1
- package/src/client/components/workspace/diff-panel/ConflictBanner.tsx +1 -1
- package/src/client/components/workspace/editor/EmptyEditor.tsx +1 -1
- package/src/client/components/workspace/editor/FindWidget.tsx +1 -1
- package/src/client/components/workspace/editor/Tabs.tsx +1 -1
- package/src/client/components/workspace/editor/Toolbar.tsx +1 -1
- package/src/client/components/workspace/file-explorer/OutlineSection.tsx +2 -2
- package/src/client/components/workspace/file-explorer/RowLabel.tsx +1 -1
- package/src/client/components/workspace/file-explorer/index.tsx +1 -1
- package/src/client/components/workspace/git-panel/BranchToolbar.tsx +2 -2
- package/src/client/components/workspace/git-panel/ChangesList.tsx +3 -3
- package/src/client/components/workspace/git-panel/ConflictItem.tsx +3 -3
- package/src/client/components/workspace/git-panel/FileItem.tsx +2 -2
- package/src/client/components/workspace/git-panel/StashSection.tsx +5 -5
- package/src/client/components/workspace/git-panel/TreeItem.tsx +2 -2
- package/src/client/components/workspace/git-panel/branch-modal/BranchRow.tsx +4 -4
- package/src/client/components/workspace/git-panel/branch-modal/DeleteDialog.tsx +2 -2
- package/src/client/components/workspace/git-panel/index.tsx +1 -1
- package/src/client/components/workspace/model-dropdown/Item.tsx +3 -3
- package/src/client/components/workspace/model-dropdown/Section.tsx +1 -1
- package/src/client/components/workspace/model-dropdown/index.tsx +3 -3
- package/src/client/components/workspace/plan-panel/index.tsx +2 -2
- package/src/client/components/workspace/repo-picker/Modal.tsx +1 -1
- package/src/client/components/workspace/repo-picker/Row.tsx +6 -6
- package/src/client/components/workspace/search-panel/Body.tsx +2 -2
- package/src/client/components/workspace/search-panel/Results.tsx +1 -1
- package/src/client/components/workspace/search-panel/index.tsx +1 -1
- package/src/client/components/workspace/terminal-panel/index.tsx +1 -1
- package/src/client/components/workspace/todo-panel/PhaseGroup.tsx +1 -1
- package/src/client/components/workspace/todo-panel/index.tsx +2 -2
- package/src/client/components/workspace/user-browser-panel/AddressBar.tsx +5 -5
- package/src/client/components/workspace/user-browser-panel/AnnotateBar.test.tsx +13 -13
- package/src/client/components/workspace/user-browser-panel/AnnotateBar.tsx +4 -4
- package/src/client/components/workspace/user-browser-panel/AnnotateLayer.tsx +1 -1
- package/src/client/components/workspace/user-browser-panel/AnnotateTarget.tsx +7 -7
- package/src/client/components/workspace/user-browser-panel/Frame.tsx +1 -1
- package/src/client/components/workspace/wiki-panel/Nav.tsx +1 -1
- package/src/client/components/workspace/wiki-panel/index.tsx +2 -2
- package/src/client/glass.css +50 -0
- package/src/client/glass.test.ts +68 -24
- package/src/client/hooks/chat/composer/browser-context.test.ts +6 -6
- package/src/client/hooks/chat/composer/use-draft.test.ts +2 -2
- package/src/client/hooks/chat/omp/prompt-send.test.ts +36 -0
- package/src/client/hooks/chat/omp/prompt-send.ts +24 -18
- package/src/client/hooks/chat/omp/session-list.tsx +24 -70
- package/src/client/hooks/chat/omp/session-merges.ts +89 -0
- package/src/client/hooks/chat/omp/session-sidebar-controller.ts +4 -1
- package/src/client/hooks/chat/timeline/armed-goal-send.test.ts +168 -0
- package/src/client/hooks/chat/timeline/armed-goal.test.ts +178 -0
- package/src/client/hooks/chat/timeline/goal-command.ts +57 -27
- package/src/client/hooks/chat/timeline/index.ts +7 -4
- package/src/client/hooks/chat/timeline/mode-post.ts +46 -0
- package/src/client/hooks/chat/timeline/modes-contract.ts +94 -0
- package/src/client/hooks/chat/timeline/modes.ts +60 -95
- package/src/client/hooks/chat/timeline/send-props.ts +97 -0
- package/src/client/hooks/chat/timeline/send-steer.test.ts +6 -0
- package/src/client/hooks/chat/timeline/send.test-util.ts +55 -8
- package/src/client/hooks/chat/timeline/send.test.ts +17 -1
- package/src/client/hooks/chat/timeline/send.ts +64 -72
- package/src/client/hooks/ui/dialog-behaviour.ts +143 -0
- package/src/client/hooks/ui/theme.ts +17 -0
- package/src/client/hooks/workspace/copy-tab-path.ts +23 -0
- package/src/client/hooks/workspace/mobile-back.ts +71 -0
- package/src/client/palette-class.test.ts +93 -0
- package/src/client/tailwind-contrast.test.ts +194 -0
- package/src/client/tailwind.css +327 -8
- package/src/server/lib/assets/theme-shell.server.ts +4 -10
- package/src/server/lib/omp/config/provider-seeds.test.ts +39 -1
- package/src/server/lib/omp/config/provider-seeds.ts +32 -3
- package/src/server/lib/omp/config/provider-vision-compat.test.ts +140 -0
- package/src/server/lib/omp/core/host-resolution.test.ts +1 -55
- package/src/server/lib/omp/core/install-hint.test.ts +48 -0
- package/src/server/lib/omp/core/install-hint.ts +64 -0
- package/src/server/lib/omp/core/startup.test.ts +125 -0
- package/src/server/lib/omp/core/startup.ts +5 -1
- package/src/server/lib/omp/mode/request.ts +14 -6
- package/src/server/plugins/ssr.ts +2 -1
- package/src/shared/lib/browser/annotate.test.ts +22 -22
- package/src/shared/lib/browser/annotate.ts +14 -14
- package/src/shared/lib/browser/page-context.ts +6 -6
- package/src/shared/lib/icons/icon-paint-authority.test.ts +86 -0
- package/src/shared/lib/icons/icon-paint-authority.ts +94 -0
- package/src/shared/lib/icons/icon-paint-css.test.ts +44 -8
- package/src/shared/lib/icons/icon-paint-css.ts +18 -1
- package/src/shared/lib/icons/icon-paint-panel.ts +15 -18
- package/src/shared/lib/icons/icon-paint-weight.ts +20 -1
- package/src/shared/lib/icons/icon-tone.ts +58 -13
- package/src/shared/lib/icons/tint-hues.generated.ts +51 -6
- package/src/shared/lib/icons/tint-tones.test.ts +257 -0
- package/src/shared/lib/icons/tint.test.ts +3 -211
- package/src/shared/lib/icons/tint.ts +23 -25
- package/src/shared/lib/omp/mode/actions.ts +40 -0
- package/src/shared/lib/omp/mode/types.ts +12 -0
- package/src/shared/lib/theme/css.ts +21 -0
- package/src/shared/lib/theme/first-frame.ts +38 -0
- package/src/shared/lib/theme/ink-scale.test.ts +151 -0
- package/src/shared/lib/theme/ink-scale.ts +103 -0
- package/src/shared/lib/theme/shell-palette.test.ts +22 -5
- package/src/shared/lib/theme/shell-palette.ts +9 -4
- package/src/shared/lib/theme/theme.test.ts +28 -3
- package/src/shared/lib/workspace/project-accent.test.ts +33 -1
- package/src/shared/lib/workspace/project-accent.ts +23 -0
- package/src/shared/types/omp/agent.ts +24 -9
- package/dist/client/static/js/index-0721wrkf.css +0 -1
|
@@ -81,14 +81,14 @@ describe('isUsableShape', () => {
|
|
|
81
81
|
describe('describeShape', () => {
|
|
82
82
|
test('a box states the region in percent AND the pixel size the panel size makes resolvable', () => {
|
|
83
83
|
expect(describeShape(shape({ note: 'total harga terpotong' }), 1, PANEL))
|
|
84
|
-
.toBe('1.
|
|
84
|
+
.toBe('1. box left 10.0%, top 20.0%, width 20.0%, height 15.0% (205×115 px): total harga terpotong');
|
|
85
85
|
});
|
|
86
86
|
|
|
87
87
|
test('a pin states one point, an arrow states where it points', () => {
|
|
88
88
|
expect(describeShape(shape({ tool: 'pin', note: 'badge salah' }), 2, PANEL))
|
|
89
|
-
.toBe('2.
|
|
89
|
+
.toBe('2. pin at (10.0%, 20.0%) (102×154 px): badge salah');
|
|
90
90
|
expect(describeShape(shape({ tool: 'arrow', end: { x: 0.72, y: 0.185 } }), 3, PANEL))
|
|
91
|
-
.toBe('3.
|
|
91
|
+
.toBe('3. arrow (10.0%, 20.0%) → (72.0%, 18.5%)');
|
|
92
92
|
});
|
|
93
93
|
|
|
94
94
|
test('a mark with no note ends at the geometry, with no dangling separator', () => {
|
|
@@ -104,8 +104,8 @@ describe('describeAnnotations', () => {
|
|
|
104
104
|
shape({ id: 'c', tool: 'pin', start: { x: 0.9, y: 0.1 }, end: { x: 0.9, y: 0.1 }, note: 'tiga' }),
|
|
105
105
|
], PANEL);
|
|
106
106
|
expect(lines).toHaveLength(2);
|
|
107
|
-
expect(lines[0]?.startsWith('1.
|
|
108
|
-
expect(lines[1]?.startsWith('2.
|
|
107
|
+
expect(lines[0]?.startsWith('1. box')).toBe(true);
|
|
108
|
+
expect(lines[1]?.startsWith('2. pin')).toBe(true);
|
|
109
109
|
});
|
|
110
110
|
});
|
|
111
111
|
|
|
@@ -150,10 +150,10 @@ describe('readAnnotatePanel', () => {
|
|
|
150
150
|
describe('formatPageContextBlock', () => {
|
|
151
151
|
test('a page with no marks keeps the shape the panel has always produced', () => {
|
|
152
152
|
expect(formatPageContextBlock({ url: 'https://a.test/x', title: 'A' })).toBe([
|
|
153
|
-
'[
|
|
153
|
+
'[Browser page context]',
|
|
154
154
|
'URL: https://a.test/x',
|
|
155
|
-
'
|
|
156
|
-
'(
|
|
155
|
+
'Title: A',
|
|
156
|
+
'(Continue from this page.)',
|
|
157
157
|
].join('\n'));
|
|
158
158
|
});
|
|
159
159
|
|
|
@@ -164,8 +164,8 @@ describe('formatPageContextBlock', () => {
|
|
|
164
164
|
annotations: [shape({ note: 'tombol Bayar nonaktif' })],
|
|
165
165
|
});
|
|
166
166
|
expect(block).toContain('Panel: laptop 1024×768 px @100%');
|
|
167
|
-
expect(block).toContain('
|
|
168
|
-
expect(block).toContain('
|
|
167
|
+
expect(block).toContain('Annotations (1):\n1. box');
|
|
168
|
+
expect(block).toContain('Only the user can see this page');
|
|
169
169
|
});
|
|
170
170
|
|
|
171
171
|
test('a panel size with only unusable marks sends no annotation section at all', () => {
|
|
@@ -174,23 +174,23 @@ describe('formatPageContextBlock', () => {
|
|
|
174
174
|
panel: { width: 100, height: 100, viewportMode: 'responsive', zoom: 100 },
|
|
175
175
|
annotations: [shape({ start: { x: 0.4, y: 0.4 }, end: { x: 0.4, y: 0.4 } })],
|
|
176
176
|
});
|
|
177
|
-
expect(block).not.toContain('
|
|
177
|
+
expect(block).not.toContain('Annotations');
|
|
178
178
|
});
|
|
179
179
|
});
|
|
180
180
|
|
|
181
181
|
describe('appendPageContext', () => {
|
|
182
182
|
test('a blank draft receives the block alone', () => {
|
|
183
|
-
expect(appendPageContext('', { url: 'https://a.test' }).startsWith('[
|
|
183
|
+
expect(appendPageContext('', { url: 'https://a.test' }).startsWith('[Browser page context]')).toBe(true);
|
|
184
184
|
});
|
|
185
185
|
|
|
186
186
|
test('existing text is separated by exactly one blank line', () => {
|
|
187
187
|
expect(appendPageContext('halo', { url: 'https://a.test' })).toBe(
|
|
188
|
-
'halo\n\n[
|
|
188
|
+
'halo\n\n[Browser page context]\nURL: https://a.test\n(Continue from this page.)',
|
|
189
189
|
);
|
|
190
190
|
});
|
|
191
191
|
|
|
192
192
|
test('a draft already ending in a blank line does not gain a third', () => {
|
|
193
|
-
expect(appendPageContext('halo\n\n', { url: 'https://a.test' })).toContain('halo\n\n[
|
|
193
|
+
expect(appendPageContext('halo\n\n', { url: 'https://a.test' })).toContain('halo\n\n[Browser');
|
|
194
194
|
expect(appendPageContext('halo\n\n', { url: 'https://a.test' })).not.toContain('halo\n\n\n');
|
|
195
195
|
});
|
|
196
196
|
});
|
|
@@ -198,12 +198,12 @@ describe('appendPageContext', () => {
|
|
|
198
198
|
describe('label on a mark', () => {
|
|
199
199
|
test('a named region leads the line, so the agent knows WHAT before WHERE', () => {
|
|
200
200
|
expect(describeShape(shape({ label: 'Ringkasan pesanan', note: 'total terpotong' }), 1, PANEL))
|
|
201
|
-
.toBe('1.
|
|
201
|
+
.toBe('1. part "Ringkasan pesanan": box left 10.0%, top 20.0%, width 20.0%, height 15.0% (205×115 px): total terpotong');
|
|
202
202
|
});
|
|
203
203
|
|
|
204
204
|
test('an unnamed mark keeps exactly the line it produced before labels existed', () => {
|
|
205
205
|
expect(describeShape(shape(), 1, PANEL))
|
|
206
|
-
.toBe('1.
|
|
206
|
+
.toBe('1. box left 10.0%, top 20.0%, width 20.0%, height 15.0% (205×115 px)');
|
|
207
207
|
});
|
|
208
208
|
|
|
209
209
|
test('a label alone makes a zero-size mark worth sending', () => {
|
|
@@ -225,11 +225,11 @@ describe('element on a mark', () => {
|
|
|
225
225
|
|
|
226
226
|
test('a readable element adds its path, state and text after the geometry', () => {
|
|
227
227
|
const line = describeShape(shape({ element: select }), 1, PANEL);
|
|
228
|
-
expect(line).toContain('[
|
|
228
|
+
expect(line).toContain('[element: section[aria-label="Ringkasan"] > form > select#prov');
|
|
229
229
|
expect(line).toContain('nilai "Jawa Barat", 5 opsi');
|
|
230
|
-
expect(line).toContain('
|
|
230
|
+
expect(line).toContain('text "Provinsi"');
|
|
231
231
|
// The note still ends the line, after the element facts.
|
|
232
|
-
expect(line.endsWith('px) [
|
|
232
|
+
expect(line.endsWith('px) [element:')).toBe(false);
|
|
233
233
|
});
|
|
234
234
|
|
|
235
235
|
test('an unreadable mark says nothing about elements rather than printing an empty one', () => {
|
|
@@ -273,11 +273,11 @@ describe('viewport resolution hint', () => {
|
|
|
273
273
|
|
|
274
274
|
test('the block states the viewport the coordinates are fractions of', () => {
|
|
275
275
|
const block = formatPageContextBlock(base);
|
|
276
|
-
expect(block).toContain('
|
|
277
|
-
expect(block).toContain('
|
|
276
|
+
expect(block).toContain('Coordinates are relative to a 276×620 px viewport');
|
|
277
|
+
expect(block).toContain('look for the element at that point');
|
|
278
278
|
});
|
|
279
279
|
|
|
280
280
|
test('the hint belongs to an annotated page, not to a plain one', () => {
|
|
281
|
-
expect(formatPageContextBlock({ url: 'https://a.test' })).not.toContain('
|
|
281
|
+
expect(formatPageContextBlock({ url: 'https://a.test' })).not.toContain('Coordinates are relative');
|
|
282
282
|
});
|
|
283
283
|
});
|
|
@@ -69,9 +69,9 @@ export function isUsableShape(shape: Pick<AnnotateShape, 'start' | 'end' | 'note
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
export const ANNOTATE_TOOL_LABEL: Record<AnnotateTool, string> = {
|
|
72
|
-
box: '
|
|
73
|
-
pin: '
|
|
74
|
-
arrow: '
|
|
72
|
+
box: 'box',
|
|
73
|
+
pin: 'pin',
|
|
74
|
+
arrow: 'arrow',
|
|
75
75
|
};
|
|
76
76
|
|
|
77
77
|
/**
|
|
@@ -85,19 +85,19 @@ export const ANNOTATE_TOOL_LABEL: Record<AnnotateTool, string> = {
|
|
|
85
85
|
export const ANNOTATE_LABEL_SUGGESTIONS = [
|
|
86
86
|
'header',
|
|
87
87
|
'nav',
|
|
88
|
-
'
|
|
88
|
+
'content',
|
|
89
89
|
'form',
|
|
90
|
-
'
|
|
91
|
-
'
|
|
90
|
+
'table',
|
|
91
|
+
'list',
|
|
92
92
|
'modal',
|
|
93
93
|
'sidebar',
|
|
94
94
|
'footer',
|
|
95
95
|
] as const;
|
|
96
96
|
|
|
97
|
-
/** `
|
|
97
|
+
/** `part "Checkout summary": ` for a named mark, nothing for an unnamed one. */
|
|
98
98
|
function labelPrefix(label: string | undefined): string {
|
|
99
99
|
const name = label?.trim();
|
|
100
|
-
return name ? `
|
|
100
|
+
return name ? `part "${name}": ` : '';
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
/** What the mark sits on, when the frame was readable. */
|
|
@@ -106,8 +106,8 @@ function elementSuffix(element: AnnotateShape['element']): string {
|
|
|
106
106
|
const facts = [element.path];
|
|
107
107
|
if (element.role) facts.push(`role ${element.role}`);
|
|
108
108
|
if (element.state) facts.push(element.state);
|
|
109
|
-
if (element.text) facts.push(`
|
|
110
|
-
return ` [
|
|
109
|
+
if (element.text) facts.push(`text "${element.text}"`);
|
|
110
|
+
return ` [element: ${facts.join(' · ')}]`;
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
/** `12.0%` — one decimal, which is precise enough to re-find a spot by hand. */
|
|
@@ -137,18 +137,18 @@ export function describeShape(
|
|
|
137
137
|
const tool = ANNOTATE_TOOL_LABEL[shape.tool];
|
|
138
138
|
const head = `${index}. ${labelPrefix(shape.label)}${tool}`;
|
|
139
139
|
const note = shape.note.trim();
|
|
140
|
-
const tail = note.length > 0 ?
|
|
140
|
+
const tail = note.length > 0 ? `: ${note}` : '';
|
|
141
141
|
const element = elementSuffix(shape.element);
|
|
142
142
|
|
|
143
|
-
if (shape.tool === 'pin') return `${head}
|
|
143
|
+
if (shape.tool === 'pin') return `${head} at ${where} ${spot}${element}${tail}`;
|
|
144
144
|
if (shape.tool === 'arrow') {
|
|
145
145
|
const to = `(${percent(shape.end.x)}, ${percent(shape.end.y)})`;
|
|
146
146
|
return `${head} ${where} → ${to}${element}${tail}`;
|
|
147
147
|
}
|
|
148
148
|
const region = shapeRegion(shape);
|
|
149
|
-
const size = `
|
|
149
|
+
const size = `width ${percent(region.width)}, height ${percent(region.height)}`;
|
|
150
150
|
const pixels = `(${px(region.width, panel.width)}×${px(region.height, panel.height)} px)`;
|
|
151
|
-
return `${head}
|
|
151
|
+
return `${head} left ${percent(region.x)}, top ${percent(region.y)}, ${size} ${pixels}${element}${tail}`;
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
/** Every usable mark, described and numbered from 1 in draw order. */
|
|
@@ -36,8 +36,8 @@ export function emitBrowserPageContext(detail: BrowserPageContext): void {
|
|
|
36
36
|
* so the agent knows to open the URL itself before acting.
|
|
37
37
|
*/
|
|
38
38
|
export function formatPageContextBlock(detail: BrowserPageContext): string {
|
|
39
|
-
const lines = ['[
|
|
40
|
-
if (detail.title) lines.push(`
|
|
39
|
+
const lines = ['[Browser page context]', `URL: ${detail.url}`];
|
|
40
|
+
if (detail.title) lines.push(`Title: ${detail.title}`);
|
|
41
41
|
|
|
42
42
|
const panel = detail.panel;
|
|
43
43
|
const description = detail.annotations && panel
|
|
@@ -47,17 +47,17 @@ export function formatPageContextBlock(detail: BrowserPageContext): string {
|
|
|
47
47
|
lines.push(`Panel: ${panel.viewportMode} ${Math.round(panel.width)}×${Math.round(panel.height)} px @${panel.zoom}%`);
|
|
48
48
|
}
|
|
49
49
|
if (description.length > 0 && panel) {
|
|
50
|
-
lines.push(`
|
|
51
|
-
lines.push('
|
|
50
|
+
lines.push(`Annotations (${description.length}):`, ...description);
|
|
51
|
+
lines.push('Only the user can see this page: open the URL above yourself before changing anything.');
|
|
52
52
|
// The coordinates are fractions of the panel the user was looking at, not
|
|
53
53
|
// of whatever viewport the agent opens. Saying so is what lets the agent
|
|
54
54
|
// resolve them (`elementFromPoint` at the same box, or scaled) instead of
|
|
55
55
|
// treating a percentage as an absolute position.
|
|
56
56
|
lines.push(
|
|
57
|
-
`
|
|
57
|
+
`Coordinates are relative to a ${Math.round(panel.width)}×${Math.round(panel.height)} px viewport; open the page at that size and look for the element at that point.`,
|
|
58
58
|
);
|
|
59
59
|
}
|
|
60
|
-
lines.push('(
|
|
60
|
+
lines.push('(Continue from this page.)');
|
|
61
61
|
return lines.join('\n');
|
|
62
62
|
}
|
|
63
63
|
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Where a call site outranks the icon colour mode.
|
|
8
|
+
*
|
|
9
|
+
* Two rules, and both are a measured defect rather than a preference:
|
|
10
|
+
*
|
|
11
|
+
* - **An author's signal class.** Twenty-two glyphs carried `text-error`,
|
|
12
|
+
* `text-success`, `text-warning` or `text-info` to say what they MEANT, and
|
|
13
|
+
* the mode repainted every one with its hashed hue — it discarded the only
|
|
14
|
+
* colour information the call site had.
|
|
15
|
+
* - **A solid signal fill.** `bg-error text-canvas` is a filled destructive
|
|
16
|
+
* button, and the glyph was painted in the same red as its own fill: 1.00:1.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import { describe, expect, test } from 'bun:test';
|
|
20
|
+
import { iconPaintStyleSheet } from '@/shared/lib/icons/icon-paint-css';
|
|
21
|
+
|
|
22
|
+
const css = iconPaintStyleSheet();
|
|
23
|
+
|
|
24
|
+
describe('an author class is authority', () => {
|
|
25
|
+
test('every signal class a glyph can carry resolves to its palette token', () => {
|
|
26
|
+
// The mode paints by hue, and a hue is only the answer to "this icon said
|
|
27
|
+
// nothing". Twenty-two call sites say something — a `LogOut` on a destructive
|
|
28
|
+
// provider action, a `Play` on a successful eval, an `Info` on a reconnect —
|
|
29
|
+
// and every one of them was repainted with its hashed hue the moment the
|
|
30
|
+
// setting was turned on.
|
|
31
|
+
for (const [token, value] of [
|
|
32
|
+
['text-error', 'var(--theme-error)'],
|
|
33
|
+
['text-success', 'var(--theme-success)'],
|
|
34
|
+
['text-warning', 'var(--theme-warning)'],
|
|
35
|
+
['text-info', 'var(--theme-info)'],
|
|
36
|
+
['text-meta', 'var(--theme-meta)'],
|
|
37
|
+
] as const) {
|
|
38
|
+
expect(css).toContain(`:where([data-icon-style="color"]) :where(svg[class~="${token}"]) { --icon-color: ${value}; }`);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
test('the slashed form is the same statement at a weight', () => {
|
|
43
|
+
// `text-error/60` is six live call sites; without a rule for the slashed
|
|
44
|
+
// token the icon falls back to the hue while the class says otherwise.
|
|
45
|
+
expect(css).toContain(
|
|
46
|
+
':where([data-icon-style="color"]) :where(svg[class~="text-error/60"]) { --icon-color: oklch(from var(--theme-error) l calc(c * 0.6) h); }',
|
|
47
|
+
);
|
|
48
|
+
// A weight scales chroma and leaves lightness — the same rule the ink
|
|
49
|
+
// weights obey, so a muted signal does not go dark.
|
|
50
|
+
const slashed = css.split('\n').filter((line) => /class~="text-(error|success|warning|info|meta)\/\d+"/.test(line));
|
|
51
|
+
expect(slashed.length).toBeGreaterThan(0);
|
|
52
|
+
for (const line of slashed) expect(line, line.slice(0, 80)).toContain('oklch(from');
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
test('a token matches one class WORD, never a substring', () => {
|
|
56
|
+
// `[class*=…]` would also fire on `group-hover:text-error`, painting the
|
|
57
|
+
// resting glyph red — the defect the ink weights were fixed for.
|
|
58
|
+
const authorRules = css.split('\n').filter((line) => line.includes('svg[class~="text-'));
|
|
59
|
+
expect(authorRules.length).toBeGreaterThan(0);
|
|
60
|
+
for (const line of authorRules) expect(line, line.slice(0, 80)).toContain('[class~="');
|
|
61
|
+
expect(css).not.toContain('svg[class*="text-');
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
describe('a solid signal fill owns its foreground', () => {
|
|
66
|
+
test('an icon on bg-error/success/warning/info takes the inherited colour', () => {
|
|
67
|
+
// `bg-error text-canvas` is a filled destructive button — Delete, Close, the
|
|
68
|
+
// mobile save — and the glyph was painted in the SAME red as its fill:
|
|
69
|
+
// measured in the running console, `Trash2` computed rgb(200,50,30) on
|
|
70
|
+
// rgb(200,50,30), 1.00:1, a blank square where a bin should be.
|
|
71
|
+
expect(css).toContain(
|
|
72
|
+
'[data-icon-style="color"] :where([class~="bg-error"], [class~="bg-success"], [class~="bg-warning"], [class~="bg-info"]) svg.lucide { color: currentColor; }',
|
|
73
|
+
);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
test('a TINTED signal chip keeps its hue', () => {
|
|
77
|
+
// `bg-error/10` is a different class token, so the rule above cannot catch a
|
|
78
|
+
// chip that merely borrows the signal as a wash.
|
|
79
|
+
expect(css).not.toContain('[class*="bg-error');
|
|
80
|
+
expect(css).not.toContain('bg-error/');
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
test('a plugin mark on the fill takes it too', () => {
|
|
84
|
+
expect(css).toContain(':where([class~="bg-error"], [class~="bg-success"]');
|
|
85
|
+
});
|
|
86
|
+
});
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The two surfaces where the call site OUTRANKS the colour mode.
|
|
8
|
+
*
|
|
9
|
+
* Split out of `icon-paint-css.ts` so both files stay readable, not because the
|
|
10
|
+
* rules are independent: they are one of the families that sheet concatenates.
|
|
11
|
+
*
|
|
12
|
+
* The mode's contract is "paint an icon that said nothing". Both rules here take
|
|
13
|
+
* an icon that DID say something and give it the value it asked for — one by
|
|
14
|
+
* name (`text-error`), one by the surface it sits on (a solid signal fill). They
|
|
15
|
+
* are the only rules in the sheet whose job is to STOP the generated hue.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* The weights an author's signal class actually uses (`text-error/60`,
|
|
20
|
+
* `text-success/90`, …). Measured over `src/client/**`: 29 slashed call sites,
|
|
21
|
+
* every one of them in this set. A step not listed here falls back to the hue,
|
|
22
|
+
* which is the old behaviour for a class this build has never seen.
|
|
23
|
+
*/
|
|
24
|
+
const AUTHOR_COLOUR_STEPS = [60, 70, 80, 90] as const;
|
|
25
|
+
|
|
26
|
+
/** The signal classes a call site may write, and the token each one means. */
|
|
27
|
+
const AUTHOR_COLOURS: ReadonlyArray<readonly [string, string]> = [
|
|
28
|
+
['text-error', 'var(--theme-error)'],
|
|
29
|
+
['text-success', 'var(--theme-success)'],
|
|
30
|
+
['text-warning', 'var(--theme-warning)'],
|
|
31
|
+
['text-info', 'var(--theme-info)'],
|
|
32
|
+
['text-meta', 'var(--theme-meta)'],
|
|
33
|
+
];
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* An AUTHOR's colour on a glyph is a decision, not a default to overwrite.
|
|
37
|
+
*
|
|
38
|
+
* The mode paints by hue, and a hue is only ever the answer to "this icon said
|
|
39
|
+
* nothing". Twenty-two call sites say something: a `LogOut` on a destructive
|
|
40
|
+
* provider action is `text-error`, a `Play` on a successful eval is
|
|
41
|
+
* `text-success`, an `Info` about a reconnect is `text-info`. Every one of them
|
|
42
|
+
* was silently repainted with its hashed hue the moment the setting was turned
|
|
43
|
+
* on, so the mode DISCARDED the only colour information the call site had.
|
|
44
|
+
*
|
|
45
|
+
* `--icon-color`, not `color`: the value then flows through the same paint and
|
|
46
|
+
* weight rules as every other source, so a slashed mute and the hover variants
|
|
47
|
+
* keep working instead of being frozen at full strength.
|
|
48
|
+
*
|
|
49
|
+
* `[class~=…]`, never `[class*=…]`: a substring match also fires on the VARIANT
|
|
50
|
+
* token, so `group-hover:text-error` would paint the resting icon red — the
|
|
51
|
+
* defect `icon-paint-weight.ts` documents for the ink weights.
|
|
52
|
+
*/
|
|
53
|
+
export function authorColourRules(): string[] {
|
|
54
|
+
const rules: string[] = [];
|
|
55
|
+
for (const [token, value] of AUTHOR_COLOURS) {
|
|
56
|
+
rules.push(`:where([data-icon-style="color"]) :where(svg[class~="${token}"]) { --icon-color: ${value}; }`);
|
|
57
|
+
// The SLASHED form is the same statement at a weight, so it has to resolve
|
|
58
|
+
// `--icon-color` too, or the icon falls back to the hue while the class says
|
|
59
|
+
// otherwise. The formula is the one `inkWeightRules` uses: scale chroma,
|
|
60
|
+
// never lightness.
|
|
61
|
+
for (const step of AUTHOR_COLOUR_STEPS) {
|
|
62
|
+
rules.push(
|
|
63
|
+
`:where([data-icon-style="color"]) :where(svg[class~="${token}/${step}"]) { --icon-color: oklch(from ${value} l calc(c * ${step / 100}) h); }`,
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return rules;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Inside a SOLID signal fill, the glyph takes the surface's own foreground.
|
|
72
|
+
*
|
|
73
|
+
* `bg-error text-canvas` is a filled destructive button — Delete, Close, the
|
|
74
|
+
* mobile save-and-recreate — and the colour mode painted the glyph in the same
|
|
75
|
+
* red as the fill it sits on: measured in the running console, `Trash2` on the
|
|
76
|
+
* Delete button computed `rgb(200, 50, 30)` on `rgb(200, 50, 30)`, **1.00:1**,
|
|
77
|
+
* a white space where a bin should be. A hue is tuned for paper; a signal fill
|
|
78
|
+
* is the signal used as paper, so the surface's declared foreground is the only
|
|
79
|
+
* value that is right on it — exactly the argument `invertedSurfaceRules` makes
|
|
80
|
+
* for `bg-ink`.
|
|
81
|
+
*
|
|
82
|
+
* `[class~="bg-error"]` matches the SOLID class only: Tailwind spells a tinted
|
|
83
|
+
* one `bg-error/10`, a different token, so a tinted chip keeps its hue. Stated
|
|
84
|
+
* after `paintRules` at the same (0,2,1) so it wins on order.
|
|
85
|
+
*/
|
|
86
|
+
export function solidSignalFillRules(): string[] {
|
|
87
|
+
const scope = ['bg-error', 'bg-success', 'bg-warning', 'bg-info']
|
|
88
|
+
.map((token) => `[class~="${token}"]`)
|
|
89
|
+
.join(', ');
|
|
90
|
+
return [
|
|
91
|
+
`[data-icon-style="color"] :where(${scope}) svg.lucide { color: currentColor; }`,
|
|
92
|
+
`:where([data-icon-style="color"]) :where(${scope}) :where([data-plugin-mark]) { --plugin-color: currentColor; }`,
|
|
93
|
+
];
|
|
94
|
+
}
|
|
@@ -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('));
|
|
@@ -97,7 +102,12 @@ describe('the icon paint stylesheet', () => {
|
|
|
97
102
|
// VARIANT token — `text-ink/50 group-hover:text-ink/80` matched both, so the
|
|
98
103
|
// resting icon was painted at its hover weight (measured on the composer's
|
|
99
104
|
// target picker, `Folder` computed the `/80` paint while not hovered).
|
|
100
|
-
|
|
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); }');
|
|
101
111
|
expect(css).toContain('[data-icon-style="color"] svg.lucide:not(.project-accent-mark)[class~="text-ink"] { --icon-paint: var(--icon-color); }');
|
|
102
112
|
expect(css).not.toContain('[class*="text-ink/');
|
|
103
113
|
// Never toward transparency: a hue at 40% alpha is 1.56:1 against its
|
|
@@ -108,6 +118,24 @@ describe('the icon paint stylesheet', () => {
|
|
|
108
118
|
expect(muted).not.toContain('var(--theme-ink)');
|
|
109
119
|
});
|
|
110
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);
|
|
137
|
+
});
|
|
138
|
+
|
|
111
139
|
test('the project accent survives the dark ink weights', () => {
|
|
112
140
|
// Each folder mark carries the user's OWN colour as `--project-accent`, and
|
|
113
141
|
// the call sites also write `text-ink/70`. The dark weight selector is
|
|
@@ -146,7 +174,7 @@ describe('the icon paint stylesheet', () => {
|
|
|
146
174
|
|
|
147
175
|
test('the base hue rule states --icon-color, per variant, and one rule paints it', () => {
|
|
148
176
|
expect(css).toContain(':where(svg.lucide) { --icon-color: var(--icon-tone, hsl(var(--icon-hue,');
|
|
149
|
-
expect(css).toContain(':where([data-icon-style="color"][data-theme-variant="dark"]) :where(svg.lucide) { --icon-color: 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,');
|
|
150
178
|
// ONE `color:` statement, derived from the two custom properties. Stating it
|
|
151
179
|
// per source instead made the weight rules fight them on specificity, and a
|
|
152
180
|
// signal token could be overwritten by winning that race.
|
|
@@ -155,7 +183,11 @@ describe('the icon paint stylesheet', () => {
|
|
|
155
183
|
|
|
156
184
|
test('one hue statement per generated row', () => {
|
|
157
185
|
for (const { className, hue } of ICON_HUE_ROWS) {
|
|
158
|
-
|
|
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
|
+
);
|
|
159
191
|
}
|
|
160
192
|
});
|
|
161
193
|
|
|
@@ -208,9 +240,13 @@ describe('the icon paint stylesheet', () => {
|
|
|
208
240
|
// measured 95 → 62 on a 64px glyph, which is the "kusem" report. A brightness
|
|
209
241
|
// shift moves luminance only; the two variants shift opposite ways because
|
|
210
242
|
// "recede" is darker on ink and lighter on paper.
|
|
211
|
-
|
|
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); }');
|
|
212
248
|
expect(css).toContain(
|
|
213
|
-
'[data-icon-style="color"][data-theme-variant="dark"] [data-panel-mark][data-idle]:not([data-declared]) { filter: brightness(0.
|
|
249
|
+
'[data-icon-style="color"][data-theme-variant="dark"] [data-panel-mark][data-idle]:not([data-declared]) { filter: brightness(0.75) saturate(1.4); }',
|
|
214
250
|
);
|
|
215
251
|
// And the state must not be stated twice: an opacity left behind would
|
|
216
252
|
// desaturate exactly what the filter restored.
|
|
@@ -245,9 +281,9 @@ describe('the icon paint stylesheet', () => {
|
|
|
245
281
|
// hashed hue is only the fallback — the order inside the `var()` chain is the
|
|
246
282
|
// contract, so it is pinned literally.
|
|
247
283
|
expect(css).toContain('--plugin-color: var(--plugin-declared-light, var(--icon-tone, hsl(var(--icon-hue');
|
|
248
|
-
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');
|
|
249
285
|
expect(css).toContain('color: var(--panel-color-light, var(--panel-tone, hsl(var(--panel-hue, var(--icon-hue,');
|
|
250
|
-
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,');
|
|
251
287
|
});
|
|
252
288
|
|
|
253
289
|
test('the string is cached, not rebuilt per call', () => {
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
import { BRAND_COLORS } from '@/shared/lib/models/provider/brand-color';
|
|
49
49
|
import { panelMarkRules } from '@/shared/lib/icons/icon-paint-panel';
|
|
50
50
|
import { inkWeightRules } from '@/shared/lib/icons/icon-paint-weight';
|
|
51
|
+
import { authorColourRules, solidSignalFillRules } from '@/shared/lib/icons/icon-paint-authority';
|
|
51
52
|
import { FILE_BRAND_COLORS } from '@/shared/lib/icons/file-brand-color';
|
|
52
53
|
import {
|
|
53
54
|
DEFAULT_ICON_HUE,
|
|
@@ -81,7 +82,12 @@ function hueRules(): string[] {
|
|
|
81
82
|
`:where([data-icon-style="color"][data-theme-variant="dark"]) :where(svg.lucide) { --icon-color: ${iconHuePaint('dark')}; }`,
|
|
82
83
|
];
|
|
83
84
|
for (const { className, hue } of ICON_HUE_ROWS) {
|
|
84
|
-
|
|
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
|
+
);
|
|
85
91
|
}
|
|
86
92
|
return rules;
|
|
87
93
|
}
|
|
@@ -196,7 +202,14 @@ function toolCardRules(): string[] {
|
|
|
196
202
|
*/
|
|
197
203
|
function projectAccentRules(): string[] {
|
|
198
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.
|
|
199
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)); }',
|
|
200
213
|
];
|
|
201
214
|
}
|
|
202
215
|
|
|
@@ -270,6 +283,9 @@ export function iconPaintStyleSheet(): string {
|
|
|
270
283
|
'@layer utilities {',
|
|
271
284
|
...hueRules(),
|
|
272
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(),
|
|
273
289
|
...pluginMarkRules(),
|
|
274
290
|
// Every `--icon-color` source is stated above this line; the paint and the
|
|
275
291
|
// weight that SCALES it are stated below, in that order.
|
|
@@ -279,6 +295,7 @@ export function iconPaintStyleSheet(): string {
|
|
|
279
295
|
// Last: same specificity as everything above, so order is what makes an
|
|
280
296
|
// inverted surface win over the paper-tuned paint.
|
|
281
297
|
...invertedSurfaceRules(),
|
|
298
|
+
...solidSignalFillRules(),
|
|
282
299
|
...projectAccentRules(),
|
|
283
300
|
...monochromeRules(),
|
|
284
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
|
-
//
|
|
38
|
-
// panel's hue is assigned at runtime, so
|
|
39
|
-
//
|
|
40
|
-
|
|
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
|
|
82
|
-
//
|
|
83
|
-
//
|
|
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
|
-
//
|
|
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.
|
|
107
|
-
'[data-icon-style="color"][data-theme-variant="dark"] [data-panel-mark][data-idle]:not([data-declared]) { filter: brightness(0.
|
|
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
|
}
|