@kabmo-labs/kabmo 0.18.0 → 0.19.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 (191) hide show
  1. package/README.md +10 -7
  2. package/dist/client/index.html +1 -1
  3. package/dist/client/index.js +475 -474
  4. package/dist/client/static/js/{index-tc09dtca.js → index-fcee4c13.js} +766 -765
  5. package/dist/client/static/js/index-sxdw908m.css +1 -0
  6. package/marketplace/plugins/command-runner/package.json +3 -2
  7. package/marketplace/plugins/git-forge/package.json +3 -2
  8. package/marketplace/plugins/session-info/package.json +3 -2
  9. package/marketplace/plugins/stats/package.json +3 -2
  10. package/package.json +3 -1
  11. package/src/client/components/auth/login-screen/index.tsx +2 -1
  12. package/src/client/components/common/ComposerPicker.tsx +1 -1
  13. package/src/client/components/common/FolderPicker.tsx +2 -2
  14. package/src/client/components/common/Modal.tsx +2 -2
  15. package/src/client/components/common/PWAInstallButton.tsx +2 -2
  16. package/src/client/components/common/ViewportSelector.tsx +1 -1
  17. package/src/client/components/common/anchored-menu/index.tsx +5 -1
  18. package/src/client/components/common/batch-selection/SelectionCheckbox.tsx +2 -1
  19. package/src/client/components/common/brand-wordmark/index.test.tsx +13 -2
  20. package/src/client/components/common/brand-wordmark/index.tsx +13 -2
  21. package/src/client/components/common/checkbox/style.test.ts +139 -0
  22. package/src/client/components/common/checkbox/style.ts +51 -0
  23. package/src/client/components/common/context-usage-button/index.tsx +2 -2
  24. package/src/client/components/common/file-icon/index.tsx +23 -9
  25. package/src/client/components/common/header-controls/MoreMenu.tsx +1 -1
  26. package/src/client/components/common/markdown-review/ReviewPopover.tsx +1 -1
  27. package/src/client/components/common/panel-mark/index.tsx +97 -0
  28. package/src/client/components/common/provider-icon/glyphs.test.ts +1 -1
  29. package/src/client/components/common/provider-icon/index.test.ts +14 -0
  30. package/src/client/components/common/provider-icon/index.tsx +4 -0
  31. package/src/client/components/common/provider-icon/resolve.test.ts +8 -7
  32. package/src/client/components/common/provider-icon/resolve.ts +16 -3
  33. package/src/client/components/common/session-actions-menu/index.tsx +1 -1
  34. package/src/client/components/common/toolbar-row/index.tsx +1 -1
  35. package/src/client/components/layout/ActivityBar.tsx +22 -3
  36. package/src/client/components/layout/LeftDock.tsx +9 -2
  37. package/src/client/components/layout/PanelVisibilityMenu.tsx +1 -1
  38. package/src/client/components/layout/WindowAura.tsx +27 -0
  39. package/src/client/components/layout/desktop-layout/LeftColumn.tsx +1 -1
  40. package/src/client/components/layout/desktop-layout/TopNavbar.tsx +2 -2
  41. package/src/client/components/layout/desktop-layout/WorkspacePanels.tsx +11 -2
  42. package/src/client/components/layout/desktop-layout/index.tsx +3 -1
  43. package/src/client/components/layout/session-sidebar/CategoryHeader.tsx +3 -3
  44. package/src/client/components/layout/session-sidebar/Header.tsx +1 -1
  45. package/src/client/components/layout/session-sidebar/OverflowMenu.tsx +1 -1
  46. package/src/client/components/layout/session-sidebar/Toolbar.tsx +1 -1
  47. package/src/client/components/layout/session-sidebar/about-modal/index.tsx +2 -2
  48. package/src/client/components/layout/session-sidebar/modern/ActionRow.tsx +1 -1
  49. package/src/client/components/layout/session-sidebar/modern/WorkspaceHeader.tsx +13 -5
  50. package/src/client/components/layout/session-sidebar/new-workspace-modal/index.tsx +2 -2
  51. package/src/client/components/layout/session-sidebar/scheduler-modal/TaskForm.tsx +2 -1
  52. package/src/client/components/layout/session-sidebar/scheduler-modal/index.tsx +2 -2
  53. package/src/client/components/mobile/LayoutWrapper.tsx +3 -1
  54. package/src/client/components/mobile/mobile-main-view/Header.tsx +2 -2
  55. package/src/client/components/mobile/mobile-session-sidebar/Header.tsx +1 -1
  56. package/src/client/components/mobile/mobile-session-sidebar/Toolbar.tsx +1 -1
  57. package/src/client/components/mobile/panel-chips.tsx +10 -2
  58. package/src/client/components/settings/Modal.tsx +4 -4
  59. package/src/client/components/settings/ProjectSelectorDropdown.tsx +2 -2
  60. package/src/client/components/settings/apply-side-effects.test.ts +30 -0
  61. package/src/client/components/settings/apply-side-effects.ts +14 -0
  62. package/src/client/components/settings/categories/AppearanceSettings.tsx +6 -0
  63. package/src/client/components/settings/categories/appearance-settings/EditorBlameSection.tsx +2 -1
  64. package/src/client/components/settings/categories/appearance-settings/EditorTypingSection.tsx +2 -1
  65. package/src/client/components/settings/categories/appearance-settings/IconStyleSection.tsx +144 -0
  66. package/src/client/components/settings/categories/appearance-settings/SurfaceStyleSection.test.tsx +120 -0
  67. package/src/client/components/settings/categories/appearance-settings/SurfaceStyleSection.tsx +180 -0
  68. package/src/client/components/settings/categories/mcp-settings/DetailPane.tsx +2 -1
  69. package/src/client/components/settings/categories/mcp-settings/ImportModal.tsx +2 -2
  70. package/src/client/components/settings/categories/omp-settings/OrderedChips.tsx +1 -1
  71. package/src/client/components/settings/categories/panel-plugins/AvailableList.tsx +1 -1
  72. package/src/client/components/settings/categories/panel-plugins/BuiltinList.tsx +21 -3
  73. package/src/client/components/settings/categories/panel-plugins/PluginCard.tsx +1 -1
  74. package/src/client/components/settings/categories/panel-plugins/PluginMark.test.ts +51 -2
  75. package/src/client/components/settings/categories/panel-plugins/PluginMark.tsx +43 -10
  76. package/src/client/components/settings/categories/plugin-settings/DetailPane.tsx +2 -1
  77. package/src/client/components/settings/categories/plugin-settings/SettingsSection.tsx +2 -1
  78. package/src/client/components/settings/categories/project-settings/ModelDropdown.tsx +1 -1
  79. package/src/client/components/settings/categories/project-settings/WorktreeSettings.tsx +2 -1
  80. package/src/client/components/settings/categories/provider-settings/DeleteProviderModal.tsx +2 -2
  81. package/src/client/components/settings/categories/provider-settings/EntryAdvanced.tsx +3 -2
  82. package/src/client/components/settings/categories/provider-settings/LogoutProviderModal.tsx +2 -2
  83. package/src/client/components/settings/categories/skill-catalog/GitImportPanel.tsx +3 -2
  84. package/src/client/components/settings/categories/skill-settings/DetailHeader.tsx +2 -1
  85. package/src/client/components/settings/categories/token-usage-settings/Controls.tsx +1 -1
  86. package/src/client/components/workspace/btw-panel/TopicMenu.tsx +1 -1
  87. package/src/client/components/workspace/chat-timeline/AiMessageFooter.tsx +2 -2
  88. package/src/client/components/workspace/chat-timeline/NewChatModal.tsx +3 -3
  89. package/src/client/components/workspace/chat-timeline/UndoConfirmModal.tsx +2 -2
  90. package/src/client/components/workspace/chat-timeline/chat-input/AccessDropdown.tsx +1 -1
  91. package/src/client/components/workspace/chat-timeline/chat-input/GoalModal.tsx +4 -3
  92. package/src/client/components/workspace/chat-timeline/chat-input/ThinkingLevelDropdown.tsx +1 -1
  93. package/src/client/components/workspace/chat-timeline/chat-input/WaitingDependencyPicker.tsx +1 -1
  94. package/src/client/components/workspace/chat-timeline/plan-review/index.tsx +2 -2
  95. package/src/client/components/workspace/chat-timeline/target-picker/WorkspacePicker.tsx +1 -1
  96. package/src/client/components/workspace/chat-timeline/target-picker/WorktreePicker.tsx +1 -1
  97. package/src/client/components/workspace/chat-timeline/tool-renderers/extension-dialog/index.tsx +2 -6
  98. package/src/client/components/workspace/context-panel/CostBreakdownPopover.tsx +1 -1
  99. package/src/client/components/workspace/diff-panel/index.tsx +2 -2
  100. package/src/client/components/workspace/editor/PluginRail.tsx +1 -1
  101. package/src/client/components/workspace/editor/SaveDeletedFileModal.tsx +2 -2
  102. package/src/client/components/workspace/editor/TabContextMenu.tsx +1 -1
  103. package/src/client/components/workspace/editor/Tabs.tsx +1 -1
  104. package/src/client/components/workspace/file-explorer/ContextMenu.tsx +1 -1
  105. package/src/client/components/workspace/file-explorer/Modals.tsx +10 -10
  106. package/src/client/components/workspace/file-explorer/RootMenu.tsx +1 -1
  107. package/src/client/components/workspace/git-panel/BranchToolbar.test.tsx +130 -0
  108. package/src/client/components/workspace/git-panel/BranchToolbar.tsx +21 -11
  109. package/src/client/components/workspace/git-panel/CommitBox.tsx +2 -1
  110. package/src/client/components/workspace/git-panel/Modals.tsx +2 -2
  111. package/src/client/components/workspace/git-panel/StashSection.tsx +2 -1
  112. package/src/client/components/workspace/git-panel/branch-modal/DeleteDialog.tsx +2 -1
  113. package/src/client/components/workspace/git-panel/branch-modal/RenameDialog.tsx +2 -1
  114. package/src/client/components/workspace/git-panel/commit-modal/index.tsx +2 -2
  115. package/src/client/components/workspace/git-panel/index.tsx +7 -0
  116. package/src/client/components/workspace/model-dropdown/Panel.tsx +1 -1
  117. package/src/client/components/workspace/model-dropdown/SpecsTooltip.tsx +1 -1
  118. package/src/client/components/workspace/plugin-panel/catalog.tsx +7 -0
  119. package/src/client/components/workspace/plugin-panel/resolve.tsx +4 -0
  120. package/src/client/components/workspace/search-panel/Body.tsx +1 -1
  121. package/src/client/components/workspace/usage-panel/ProviderSelect.tsx +1 -1
  122. package/src/client/glass.css +785 -0
  123. package/src/client/glass.test.ts +346 -0
  124. package/src/client/hooks/ui/glass-support.ts +57 -0
  125. package/src/client/hooks/ui/icon-style.ts +59 -0
  126. package/src/client/hooks/ui/stuck-header.test.ts +188 -0
  127. package/src/client/hooks/ui/stuck-header.ts +91 -0
  128. package/src/client/hooks/ui/style-attributes.test.ts +120 -0
  129. package/src/client/hooks/ui/surface-style.ts +56 -0
  130. package/src/client/hooks/workspace/panel-hues.ts +23 -0
  131. package/src/client/main.tsx +10 -0
  132. package/src/client/tailwind.css +264 -11
  133. package/src/server/lib/assets/shell-attributes.server.ts +80 -0
  134. package/src/server/lib/assets/shell-attributes.test.ts +86 -0
  135. package/src/server/lib/omp/rpc/frame-fold-host.test-util.ts +1 -0
  136. package/src/server/lib/omp/rpc/frame-fold-signals.test.ts +2 -30
  137. package/src/server/lib/omp/rpc/frame-fold.test.ts +55 -0
  138. package/src/server/lib/omp/rpc/frame-fold.ts +4 -0
  139. package/src/server/lib/omp/rpc/manager.ts +2 -2
  140. package/src/server/lib/omp/rpc/process-helpers.ts +11 -0
  141. package/src/server/lib/omp/rpc/process.test.ts +106 -0
  142. package/src/server/lib/omp/rpc/process.ts +28 -4
  143. package/src/server/lib/omp/rpc/run-settle.server.ts +12 -0
  144. package/src/server/lib/omp/rpc/run-settle.test.ts +22 -0
  145. package/src/server/lib/omp/rpc/session-command-guards.ts +5 -0
  146. package/src/server/lib/omp/rpc/session-commands.test.ts +9 -1
  147. package/src/server/lib/omp/rpc/session-commands.ts +11 -0
  148. package/src/server/lib/omp/rpc/terminal-settle.ts +29 -7
  149. package/src/server/lib/panels/bundled-catalog.server.ts +1 -0
  150. package/src/server/lib/panels/manifest.test.ts +20 -0
  151. package/src/server/lib/panels/manifest.ts +12 -0
  152. package/src/server/lib/panels/scan.server.ts +4 -0
  153. package/src/server/lib/queue/delivery-dispatch.server.test.ts +48 -0
  154. package/src/server/lib/queue/delivery-harness.ts +8 -4
  155. package/src/server/lib/queue/delivery.server.test.ts +29 -0
  156. package/src/server/lib/queue/delivery.server.ts +39 -0
  157. package/src/server/lib/queue/store.server.test.ts +22 -2
  158. package/src/server/lib/queue/store.server.ts +33 -11
  159. package/src/server/plugins/ssr.ts +22 -5
  160. package/src/shared/lib/icons/file-brand-color.ts +38 -0
  161. package/src/shared/lib/icons/icon-paint-css.test.ts +234 -0
  162. package/src/shared/lib/icons/icon-paint-css.ts +284 -0
  163. package/src/shared/lib/icons/icon-paint-panel.ts +100 -0
  164. package/src/shared/lib/icons/tint-hues.generated.ts +230 -0
  165. package/src/shared/lib/icons/tint.test.ts +273 -0
  166. package/src/shared/lib/icons/tint.ts +219 -0
  167. package/src/shared/lib/models/provider/brand-color.test.ts +116 -0
  168. package/src/shared/lib/models/provider/brand-color.ts +103 -0
  169. package/src/shared/lib/omp/rpc/frame.test.ts +65 -0
  170. package/src/shared/lib/omp/rpc/frame.ts +58 -3
  171. package/src/shared/lib/settings/defaults.ts +4 -0
  172. package/src/shared/lib/theme/catalog.test.ts +5 -4
  173. package/src/shared/lib/theme/catalog.ts +18 -3
  174. package/src/shared/lib/theme/glass-support.test.ts +38 -0
  175. package/src/shared/lib/theme/glass-support.ts +73 -0
  176. package/src/shared/lib/theme/icon-style.test.ts +74 -0
  177. package/src/shared/lib/theme/icon-style.ts +90 -0
  178. package/src/shared/lib/theme/legibility.ts +91 -0
  179. package/src/shared/lib/theme/palettes/dark-extended.ts +152 -0
  180. package/src/shared/lib/theme/palettes/light-extended.ts +157 -0
  181. package/src/shared/lib/theme/surface-style.test.ts +68 -0
  182. package/src/shared/lib/theme/surface-style.ts +91 -0
  183. package/src/shared/lib/theme/theme.test.ts +11 -7
  184. package/src/shared/lib/workspace/panel-hues.test.ts +68 -0
  185. package/src/shared/lib/workspace/panel-hues.ts +57 -0
  186. package/src/shared/types/panels-registry.ts +6 -0
  187. package/src/shared/types/panels.ts +14 -0
  188. package/src/shared/types/settings/state.ts +26 -0
  189. package/src/test-support/fake-omp-frames.ts +163 -0
  190. package/dist/client/static/js/index-hp75vsv9.css +0 -1
  191. /package/src/{client/components/common/file-icon/brand-paths.ts → shared/lib/icons/file-brand-paths.ts} +0 -0
@@ -16,6 +16,7 @@
16
16
  * screen. The event fires only when a value actually moved.
17
17
  */
18
18
 
19
+ import { CHECKBOX_CLASS } from '@/client/components/common/checkbox/style';
19
20
  import { readKabmoSetting, writeKabmoSettings } from '@/shared/lib/settings/client';
20
21
  import type { SettingsState } from '@/shared/types';
21
22
  import {
@@ -52,7 +53,7 @@ function Toggle({
52
53
  checked={checked}
53
54
  onChange={(event) => onChange(event.currentTarget.checked)}
54
55
  aria-label={label}
55
- className="mt-0.5 accent-ink flex-shrink-0"
56
+ className={`${CHECKBOX_CLASS} mt-0.5 accent-ink flex-shrink-0`}
56
57
  />
57
58
  </label>
58
59
  );
@@ -0,0 +1,144 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * Settings → Appearance → Layout → Icons.
8
+ *
9
+ * The card has to answer the question the setting actually raises — "what
10
+ * changes when I pick full colour?" — and the answer now covers three families,
11
+ * so both miniatures draw the same SAMPLE of all three: two functional glyphs
12
+ * (one signal, one neutral), one provider mark and one file-type mark. A preview
13
+ * that showed only logos would under-sell the setting; one that showed only
14
+ * glyphs would hide the part users notice most.
15
+ *
16
+ * The previews are FIXED per card rather than rendered through the live
17
+ * components: those paint from the document attribute, so both cards would show
18
+ * the user's current choice and neither would preview its own. The colour values
19
+ * come from the SAME tables and formula the stylesheet uses (`ICON_TINT_TOKENS`,
20
+ * `iconHueColor`, `BRAND_COLORS`, `FILE_BRAND_COLORS`), so a preview cannot
21
+ * promise a look the shell does not ship.
22
+ */
23
+
24
+ import { Check, Trash2, Sparkles } from 'lucide-preact';
25
+ import type { ComponentType } from 'preact/compat';
26
+ import type { SettingsState } from '@/shared/types';
27
+ import {
28
+ ICON_STYLES,
29
+ ICON_STYLE_COPY,
30
+ resolveIconStyle,
31
+ type IconStyle,
32
+ } from '@/shared/lib/theme/icon-style';
33
+ import { BRAND_COLORS } from '@/shared/lib/models/provider/brand-color';
34
+ import { FILE_BRAND_COLORS } from '@/shared/lib/icons/file-brand-color';
35
+ import { ICON_TINT_TOKENS, iconHue, iconHueColor, iconTintRole } from '@/shared/lib/icons/tint';
36
+
37
+ interface IconStyleSectionProps {
38
+ settings: SettingsState;
39
+ onUpdate: (updater: Partial<SettingsState> | ((previous: SettingsState) => SettingsState)) => void;
40
+ }
41
+
42
+ /** One functional glyph, painted the way the chosen mode would paint it. */
43
+ function GlyphSample({ name, Icon, colored }: { name: string; Icon: typeof Check; colored: boolean }) {
44
+ const role = iconTintRole(name);
45
+ // The role wins over the hue, exactly as the stylesheet orders its rules.
46
+ // Same formula as the stylesheet's light paint, through the same helper: the
47
+ // sample reads the hue table and the ONE saturation/lightness pair.
48
+ const color = !colored
49
+ ? undefined
50
+ : role
51
+ ? ICON_TINT_TOKENS[role]
52
+ : iconHueColor(iconHue(name), 'light');
53
+ return <Icon size={13} strokeWidth={2} style={color ? { color } : undefined} aria-hidden="true" />;
54
+ }
55
+
56
+ /** A brand mark as a dot on a plate, in the mode's paint. */
57
+ function BrandSample({ name, base, colored }: { name: string; base: string; colored: boolean }) {
58
+ const color = colored ? base : undefined;
59
+ return (
60
+ <span
61
+ className="flex h-5 w-5 items-center justify-center rounded-[5px] border border-ink/10"
62
+ style={color ? { backgroundColor: `${color}22`, color } : undefined}
63
+ title={name}
64
+ aria-hidden="true"
65
+ >
66
+ <span
67
+ className={`block h-2 w-2 rounded-full ${colored ? '' : 'bg-ink/60'}`}
68
+ style={color ? { backgroundColor: color } : undefined}
69
+ />
70
+ </span>
71
+ );
72
+ }
73
+
74
+ function Miniature({ colored }: { colored: boolean }) {
75
+ return (
76
+ <span className="flex h-full items-center gap-1.5 rounded-md border border-ink/10 bg-canvas/60 px-2">
77
+ <GlyphSample name="Trash2" Icon={Trash2} colored={colored} />
78
+ <GlyphSample name="Check" Icon={Check} colored={colored} />
79
+ <GlyphSample name="Sparkles" Icon={Sparkles} colored={colored} />
80
+ <span className="mx-0.5 h-4 w-px bg-ink/10" />
81
+ <BrandSample name="claude" base={BRAND_COLORS.claude.light} colored={colored} />
82
+ <BrandSample name="Typescript" base={FILE_BRAND_COLORS.Typescript.light} colored={colored} />
83
+ </span>
84
+ );
85
+ }
86
+
87
+ const MINIATURES: Record<IconStyle, ComponentType> = {
88
+ monochrome: () => <Miniature colored={false} />,
89
+ color: () => <Miniature colored />,
90
+ };
91
+
92
+ export function IconStyleSection({ settings, onUpdate }: IconStyleSectionProps) {
93
+ const selected = resolveIconStyle(settings.iconStyle);
94
+
95
+ return (
96
+ <section className="space-y-3">
97
+ <div>
98
+ <h4 className="text-xs font-semibold text-ink">Icons</h4>
99
+ <p className="mt-0.5 text-[11px] text-ink/50">
100
+ Every icon: toolbar and panel glyphs, provider logos and file-type marks. Full colour
101
+ gives each glyph its own hue and keeps the palette’s red, green, amber and blue for
102
+ signals; a colour that would disappear on the active theme falls back to the ink. A
103
+ control that sets its own colour keeps it.
104
+ </p>
105
+ </div>
106
+
107
+ <div className="grid grid-cols-1 gap-2.5 sm:grid-cols-2" role="group" aria-label="Icon style">
108
+ {ICON_STYLES.map((style) => {
109
+ const copy = ICON_STYLE_COPY[style];
110
+ const isSelected = style === selected;
111
+ const MiniatureView = MINIATURES[style];
112
+ return (
113
+ <button
114
+ key={style}
115
+ type="button"
116
+ onClick={() => onUpdate({ iconStyle: style })}
117
+ aria-pressed={isSelected}
118
+ aria-label={`${copy.label} icons — ${copy.description}`}
119
+ className={`flex flex-col gap-2 rounded-xl border p-2.5 text-left transition-colors cursor-pointer ${
120
+ isSelected
121
+ ? 'border-ink/40 bg-ink/5'
122
+ : 'border-ink/15 bg-paper hover:border-ink/30 hover:bg-ink/5'
123
+ }`}
124
+ >
125
+ <span className="block h-[42px]">
126
+ <MiniatureView />
127
+ </span>
128
+ <span className="flex items-center gap-1.5">
129
+ <span className="text-xs font-semibold text-ink">{copy.label}</span>
130
+ <span className="font-mono text-[10px] text-ink/40">{copy.caption}</span>
131
+ {isSelected && (
132
+ <span className="ml-auto rounded-full bg-ink px-1.5 py-[1px] text-[9px] font-semibold text-paper">
133
+ active
134
+ </span>
135
+ )}
136
+ </span>
137
+ <span className="text-[11px] leading-relaxed text-ink/60">{copy.description}</span>
138
+ </button>
139
+ );
140
+ })}
141
+ </div>
142
+ </section>
143
+ );
144
+ }
@@ -0,0 +1,120 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * "Surfaces" — the two material cards, and the reason the frost is missing when
8
+ * it is.
9
+ *
10
+ * The notice is the point of this file. `glass.css` silently hands back opaque
11
+ * panels on an engine without `backdrop-filter` and under
12
+ * `prefers-reduced-transparency`, and a CSS fallback cannot say why — so a
13
+ * window whose setting reads `glass` and whose material is `classic` is
14
+ * indistinguishable from a broken setting on that device (measured: Chromium
15
+ * supports both, so the notice correctly renders nothing there; the copy paths
16
+ * are what is pinned here).
17
+ */
18
+
19
+ import { afterAll, afterEach, beforeAll, describe, expect, test } from 'bun:test';
20
+ import { Window } from 'happy-dom';
21
+ import { h, render } from 'preact';
22
+ import { act } from 'preact/test-utils';
23
+
24
+ import { SurfaceStyleSection } from '@/client/components/settings/categories/appearance-settings/SurfaceStyleSection';
25
+ import { GLASS_LIMIT_COPY } from '@/shared/lib/theme/glass-support';
26
+ import { installDomGlobals, restoreDomGlobals } from '@/test-support/pristine-globals';
27
+ import type { SettingsState } from '@/shared/types';
28
+
29
+ let container: HTMLElement;
30
+ let backdropFilter = true;
31
+ let reducedTransparency = false;
32
+
33
+ /**
34
+ * `CSS` is the one browser global the hook reads that `installDomGlobals` does not
35
+ * install (it lists constructors, and `CSS.supports` is a namespace object), so
36
+ * this file states it explicitly and removes it again.
37
+ */
38
+ const realCss = globalThis.CSS;
39
+
40
+ beforeAll(() => {
41
+ installDomGlobals(new Window({ url: 'http://localhost' }));
42
+ // The probe asks the platform; here the platform is a stub, so each case can
43
+ // state what an engine/OS would answer.
44
+ globalThis.CSS = {
45
+ supports: (property: string) =>
46
+ property === 'backdrop-filter' || property === '-webkit-backdrop-filter'
47
+ ? backdropFilter
48
+ : window.CSS.supports(property),
49
+ } as unknown as typeof CSS;
50
+ window.matchMedia = ((query: string) => ({
51
+ matches: query.includes('prefers-reduced-transparency') ? reducedTransparency : false,
52
+ media: query,
53
+ onchange: null,
54
+ addEventListener: () => {},
55
+ removeEventListener: () => {},
56
+ addListener: () => {},
57
+ removeListener: () => {},
58
+ dispatchEvent: () => false,
59
+ })) as unknown as typeof window.matchMedia;
60
+ });
61
+
62
+ afterEach(() => {
63
+ if (container) render(null, container);
64
+ container?.remove();
65
+ backdropFilter = true;
66
+ reducedTransparency = false;
67
+ });
68
+
69
+ afterAll(() => {
70
+ if (realCss === undefined) delete (globalThis as { CSS?: unknown }).CSS;
71
+ else globalThis.CSS = realCss;
72
+ restoreDomGlobals();
73
+ });
74
+
75
+ function mount(surfaceStyle: SettingsState['surfaceStyle']): HTMLElement {
76
+ container = document.body.appendChild(document.createElement('div'));
77
+ act(() =>
78
+ render(
79
+ h(SurfaceStyleSection, {
80
+ settings: { surfaceStyle } as SettingsState,
81
+ onUpdate: () => {},
82
+ }),
83
+ container,
84
+ ),
85
+ );
86
+ return container;
87
+ }
88
+
89
+ describe('surface style section', () => {
90
+ test('a supported engine on glass shows no notice', () => {
91
+ const el = mount('glass');
92
+ expect(el.querySelector('[aria-live="polite"]')).toBeNull();
93
+ });
94
+
95
+ test('an engine without backdrop blur says so instead of pretending', () => {
96
+ backdropFilter = false;
97
+ const el = mount('glass');
98
+ const notice = el.querySelector('[aria-live="polite"]');
99
+ expect(notice?.textContent).toContain(GLASS_LIMIT_COPY['no-backdrop-filter']);
100
+ });
101
+
102
+ test('the system asking for less transparency is named, and glass is still the choice', () => {
103
+ reducedTransparency = true;
104
+ const el = mount('glass');
105
+ expect(el.querySelector('[aria-live="polite"]')?.textContent).toContain(
106
+ GLASS_LIMIT_COPY['reduced-transparency'],
107
+ );
108
+ // The cards still work: the limit is a REPORT, not a disabled control — the
109
+ // stored choice is the user's, and it takes effect again the moment the OS
110
+ // setting changes.
111
+ expect(el.querySelector('[aria-pressed="true"]')?.textContent).toContain('Glass');
112
+ });
113
+
114
+ test('classic never carries the notice, because it has nothing to explain', () => {
115
+ backdropFilter = false;
116
+ reducedTransparency = true;
117
+ const el = mount('classic');
118
+ expect(el.querySelector('[aria-live="polite"]')).toBeNull();
119
+ });
120
+ });
@@ -0,0 +1,180 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * Settings → Appearance → Surfaces.
8
+ *
9
+ * Two cards, each drawn as a MINIATURE of the material rather than an icon: the
10
+ * difference between an opaque panel and a frosted one is the only thing the
11
+ * setting decides, so the card has to show that difference where it happens —
12
+ * a chrome bar over a tinted ground, with the same rows inside.
13
+ *
14
+ * The miniature is built from the SAME tokens the product uses (`--glass-*` and
15
+ * the palette's `text-ink/*`), never from a hex, so a card cannot promise a
16
+ * look the shell does not ship.
17
+ *
18
+ * The cards are `aria-pressed` buttons rather than radios: there is no submit,
19
+ * the choice applies on click, and `applySettingsSideEffects` is what writes the
20
+ * document attribute — this file never touches the DOM itself, so the live
21
+ * apply and the persisted copy cannot disagree.
22
+ */
23
+
24
+ import type { ComponentType } from 'preact/compat';
25
+ import type { SettingsState } from '@/shared/types';
26
+ import {
27
+ SURFACE_STYLES,
28
+ SURFACE_STYLE_COPY,
29
+ resolveSurfaceStyle,
30
+ type SurfaceStyle,
31
+ } from '@/shared/lib/theme/surface-style';
32
+ import { GLASS_LIMIT_COPY } from '@/shared/lib/theme/glass-support';
33
+ import { useGlassLimits } from '@/client/hooks/ui/glass-support';
34
+
35
+ interface SurfaceStyleSectionProps {
36
+ settings: SettingsState;
37
+ onUpdate: (updater: Partial<SettingsState> | ((previous: SettingsState) => SettingsState)) => void;
38
+ }
39
+
40
+ /** The rows both miniatures share, so the ONLY difference is the material. */
41
+ function MiniRows() {
42
+ return (
43
+ <span className="flex h-full flex-col gap-1 p-1">
44
+ <span className="flex items-center gap-1">
45
+ <span className="h-[3px] w-[38%] rounded-full bg-ink/40" />
46
+ <span className="ml-auto h-[6px] w-[10%] rounded-[2px] border border-ink/20" />
47
+ </span>
48
+ <span className="h-[2px] w-full rounded-full bg-ink/15" />
49
+ <span className="flex items-center gap-1">
50
+ <span className="h-[3px] w-[52%] rounded-full bg-ink/30" />
51
+ <span className="h-[3px] w-[18%] rounded-full bg-ink/15" />
52
+ </span>
53
+ <span className="flex items-center gap-1">
54
+ <span className="h-[3px] w-[44%] rounded-full bg-ink/30" />
55
+ <span className="h-[3px] w-[22%] rounded-full bg-ink/15" />
56
+ </span>
57
+ </span>
58
+ );
59
+ }
60
+
61
+ /** Opaque panels on the palette canvas. */
62
+ function ClassicMiniature() {
63
+ return (
64
+ <span className="block h-full rounded-md border border-ink/15 bg-paper" aria-hidden="true">
65
+ <span className="block h-[13px] rounded-t-[5px] border-b border-ink/10 bg-paper">
66
+ <span className="mx-1 mt-[4px] block h-[3px] w-[40%] rounded-full bg-ink/35" />
67
+ </span>
68
+ <MiniRows />
69
+ </span>
70
+ );
71
+ }
72
+
73
+ /**
74
+ * One frosted plane over a tinted glow.
75
+ *
76
+ * The glow is drawn INSIDE the card's box on purpose: a full-screen app has no
77
+ * outside for the aura to bleed into, which is why the real plane keeps its
78
+ * blobs under its own edge instead of around it.
79
+ */
80
+ function GlassMiniature() {
81
+ return (
82
+ <span className="relative block h-full overflow-hidden rounded-md border border-ink/15 bg-canvas" aria-hidden="true">
83
+ <span className="pointer-events-none absolute inset-0">
84
+ <span className="absolute -left-2 top-2 h-[70%] w-[55%] rounded-full bg-info/40 blur-md" />
85
+ <span className="absolute -right-2 -top-2 h-[60%] w-[50%] rounded-full bg-meta/35 blur-md" />
86
+ <span className="absolute -bottom-2 right-3 h-[45%] w-[45%] rounded-full bg-success/30 blur-md" />
87
+ </span>
88
+ <span className="relative block h-[13px] border-b border-ink/10 bg-paper/40">
89
+ <span className="mx-1 mt-[4px] block h-[3px] w-[40%] rounded-full bg-ink/40" />
90
+ </span>
91
+ <span className="relative block h-[calc(100%-13px)] bg-paper/50">
92
+ <MiniRows />
93
+ </span>
94
+ </span>
95
+ );
96
+ }
97
+
98
+ const MINIATURES: Record<SurfaceStyle, ComponentType> = {
99
+ classic: ClassicMiniature,
100
+ glass: GlassMiniature,
101
+ };
102
+
103
+ /**
104
+ * Why the frost is missing, when it is.
105
+ *
106
+ * `glass.css` falls back to opaque panels on an engine without `backdrop-filter`
107
+ * and under `prefers-reduced-transparency`, and a CSS fallback cannot say why —
108
+ * so a window that reports `glass` and looks `classic` is indistinguishable from
109
+ * a broken setting. This is the one surface that can name it, in the place the
110
+ * choice was made, and it names every reason that applies.
111
+ */
112
+ function GlassLimits() {
113
+ const limits = useGlassLimits();
114
+ if (limits.length === 0) return null;
115
+ return (
116
+ <ul className="space-y-1 rounded-lg border border-ink/15 bg-ink/[0.03] p-2.5" aria-live="polite">
117
+ {limits.map((limit) => (
118
+ <li key={limit} className="flex gap-1.5 text-[11px] leading-relaxed text-ink/60">
119
+ <span aria-hidden="true" className="mt-[5px] h-1 w-1 shrink-0 rounded-full bg-ink/40" />
120
+ <span>{GLASS_LIMIT_COPY[limit]}</span>
121
+ </li>
122
+ ))}
123
+ </ul>
124
+ );
125
+ }
126
+
127
+ export function SurfaceStyleSection({ settings, onUpdate }: SurfaceStyleSectionProps) {
128
+ const selected = resolveSurfaceStyle(settings.surfaceStyle);
129
+
130
+ return (
131
+ <section className="space-y-3">
132
+ <div>
133
+ <h4 className="text-xs font-semibold text-ink">Surfaces</h4>
134
+ <p className="mt-0.5 text-[11px] text-ink/50">
135
+ What the windows are made of. Both styles draw the same panels, rows and dialogs;
136
+ the frost is one blur pass per window, and it follows the palette — there is no
137
+ separate glass colour to tune.
138
+ </p>
139
+ </div>
140
+
141
+ <div className="grid grid-cols-1 gap-2.5 sm:grid-cols-2" role="group" aria-label="Surface style">
142
+ {SURFACE_STYLES.map((style) => {
143
+ const copy = SURFACE_STYLE_COPY[style];
144
+ const isSelected = style === selected;
145
+ const Miniature = MINIATURES[style];
146
+ return (
147
+ <button
148
+ key={style}
149
+ type="button"
150
+ onClick={() => onUpdate({ surfaceStyle: style })}
151
+ aria-pressed={isSelected}
152
+ aria-label={`${copy.label} surfaces — ${copy.description}`}
153
+ className={`flex flex-col gap-2 rounded-xl border p-2.5 text-left transition-colors cursor-pointer ${
154
+ isSelected
155
+ ? 'border-ink/40 bg-ink/5'
156
+ : 'border-ink/15 bg-paper hover:border-ink/30 hover:bg-ink/5'
157
+ }`}
158
+ >
159
+ <span className="block h-[78px]">
160
+ <Miniature />
161
+ </span>
162
+ <span className="flex items-center gap-1.5">
163
+ <span className="text-xs font-semibold text-ink">{copy.label}</span>
164
+ <span className="font-mono text-[10px] text-ink/40">{copy.caption}</span>
165
+ {isSelected && (
166
+ <span className="ml-auto rounded-full bg-ink px-1.5 py-[1px] text-[9px] font-semibold text-paper">
167
+ active
168
+ </span>
169
+ )}
170
+ </span>
171
+ <span className="text-[11px] leading-relaxed text-ink/60">{copy.description}</span>
172
+ </button>
173
+ );
174
+ })}
175
+ </div>
176
+
177
+ {selected === 'glass' && <GlassLimits />}
178
+ </section>
179
+ );
180
+ }
@@ -1,3 +1,4 @@
1
+ import { CHECKBOX_CLASS } from '@/client/components/common/checkbox/style';
1
2
  import { useEffect, useState } from 'preact/hooks';
2
3
  import type { FormEvent, FunctionComponent } from 'preact/compat';
3
4
  import { AlertCircle, Check, Code, Globe, Loader2, Save, Terminal, Trash2 } from 'lucide-preact';
@@ -162,7 +163,7 @@ export const McpDetailPane: FunctionComponent<McpDetailPaneProps> = ({
162
163
  id="enable-mcp"
163
164
  checked={formData.enabled}
164
165
  onChange={(e) => setFormData({ ...formData, enabled: e.currentTarget.checked })}
165
- className="w-4 h-4 rounded border-ink/30 text-ink focus:ring-0 cursor-pointer"
166
+ className={`${CHECKBOX_CLASS} w-4 h-4 cursor-pointer`}
166
167
  />
167
168
  <label htmlFor="enable-mcp" className="text-xs font-medium text-ink cursor-pointer select-none">
168
169
  Enable Server
@@ -110,8 +110,8 @@ export const McpImportModal: FunctionComponent<McpImportModalProps> = ({
110
110
  };
111
111
 
112
112
  return (
113
- <div className="fixed inset-0 bg-ink/40 backdrop-blur-[2px] z-50 flex items-center justify-center p-4 animate-in fade-in duration-150">
114
- <div className="w-full max-w-lg rounded-lg border border-ink/20 bg-paper text-ink p-5 shadow-2xl space-y-4 max-h-full overflow-y-auto scrollbar-overlay-container">
113
+ <div className="fixed inset-0 modal-scrim backdrop-blur-[2px] z-50 flex items-center justify-center p-4 animate-in fade-in duration-150">
114
+ <div className="glass-overlay w-full max-w-lg rounded-lg border border-ink/20 bg-paper text-ink p-5 shadow-2xl space-y-4 max-h-full overflow-y-auto scrollbar-overlay-container">
115
115
  <div className="flex items-center justify-between pb-3 border-b border-ink/10">
116
116
  <div className="flex items-center gap-2">
117
117
  <Code className="w-4 h-4 text-ink/70" />
@@ -97,7 +97,7 @@ export function OrderedChips({ options, value, saving, onCommit }: OrderedChipsP
97
97
  <Plus size={10} /> add
98
98
  </button>
99
99
  {open && remaining.length > 0 && (
100
- <div className="absolute right-0 top-full z-20 mt-1 max-h-44 w-48 overflow-auto rounded-md border border-ink/15 bg-paper p-1 shadow-lg">
100
+ <div className="glass-popover absolute right-0 top-full z-20 mt-1 max-h-44 w-48 overflow-auto rounded-md border border-ink/15 bg-paper p-1 shadow-lg">
101
101
  {remaining.map((option) => (
102
102
  <button
103
103
  key={option.value}
@@ -69,7 +69,7 @@ export function AvailableList({ entries, busy, onInstall, onInstallUrl }: Availa
69
69
  className="flex flex-col gap-2 border border-ink/10 rounded-lg p-3 bg-paper hover:border-ink/20 transition-colors"
70
70
  >
71
71
  <div className="flex items-start gap-2.5">
72
- <PluginMark name={entry.name} iconUrl={entry.iconUrl} />
72
+ <PluginMark name={entry.name} iconUrl={entry.iconUrl} color={entry.color} />
73
73
  <div className="min-w-0 flex-1">
74
74
  <div className="text-xs font-medium text-ink truncate" title={entry.name}>
75
75
  {entry.name}
@@ -1,5 +1,7 @@
1
1
  import { Loader2 } from 'lucide-preact';
2
2
  import { BUILTIN_PANELS } from '@/client/components/workspace/panels/builtin';
3
+ import { PanelMark } from '@/client/components/common/panel-mark';
4
+ import { PANEL_MARK_SIZE } from '@/shared/lib/workspace/right-panels';
3
5
 
4
6
  interface BuiltinListProps {
5
7
  /** Every panel id switched off — a bare view id, or `plugin:<id>`. */
@@ -55,9 +57,25 @@ export function BuiltinList({ disabled, busy, onSetEnabled }: BuiltinListProps)
55
57
  enabled ? 'bg-paper' : 'bg-ink/[0.02]'
56
58
  }`}
57
59
  >
58
- <span className={enabled ? 'text-ink/70 flex-shrink-0' : 'text-ink/30 flex-shrink-0'}>
59
- {panel.icon}
60
- </span>
60
+ {/* The SAME mark the rail and the phone's chip strip draw, from
61
+ the same hue map: this row used to render the bare glyph and
62
+ therefore took the GLYPH's colour (`lucide-files` → 320°) while
63
+ the rail drew the PANEL's (`files` → 0°).
64
+
65
+ The off state is stated the way the rail states it — the ink
66
+ weight for the monochrome mode, `data-idle` for the colour
67
+ mode, which dims by LUMINANCE and keeps the chroma. `opacity`
68
+ here would have washed the hue out, the exact "kusem" the rail
69
+ stopped doing. */}
70
+ <PanelMark
71
+ className={`flex-shrink-0 ${enabled ? 'text-ink/70' : 'text-ink/30'}`}
72
+ panelId={panel.id}
73
+ builtin
74
+ icon={panel.icon}
75
+ name={panel.title}
76
+ size={PANEL_MARK_SIZE}
77
+ idle={!enabled}
78
+ />
61
79
  <span className="min-w-0 flex-1">
62
80
  <span className={`block text-xs truncate ${enabled ? 'text-ink' : 'text-ink/45'}`} title={panel.title}>
63
81
  {panel.title}
@@ -95,7 +95,7 @@ export function PluginCard({
95
95
  >
96
96
  <header className="flex items-start gap-2.5">
97
97
  <div className={plugin.enabled ? '' : 'opacity-50'}>
98
- <PluginMark name={plugin.name} iconUrl={iconUrl} />
98
+ <PluginMark name={plugin.name} iconUrl={iconUrl} color={plugin.color} />
99
99
  </div>
100
100
  <div className="min-w-0 flex-1">
101
101
  <div className="flex items-center gap-1.5 min-w-0">
@@ -74,8 +74,11 @@ describe('PluginMark', () => {
74
74
  expect(el.querySelector('img')).toBeNull();
75
75
  expect(span?.style.width).toBe('16px');
76
76
  expect(span?.style.height).toBe('16px');
77
- // Serialized lowercased by the engine (verified in Chrome and happy-dom).
78
- expect(span?.style.backgroundColor).toBe('currentcolor');
77
+ // The paint is a VARIABLE, so the mode decides it: monochrome leaves
78
+ // `--plugin-color` undefined and the mark keeps the ink it always used.
79
+ expect(span?.style.backgroundColor).toBe('var(--plugin-color, currentColor)');
80
+ expect(span?.getAttribute('data-plugin-mark')).toBe('');
81
+ expect(span?.style.getPropertyValue('--icon-hue')).not.toBe('');
79
82
  // The extension is read off the PATH; the registry's URL carries a `?v=` hash.
80
83
  expect(span?.style.maskImage).toContain('/api/panels/icon/demo/icon.svg?v=abc');
81
84
  expect(span?.style.maskSize).toBe('contain');
@@ -109,6 +112,52 @@ describe('PluginMark', () => {
109
112
  expect(el.querySelector('span')).toBeNull();
110
113
  });
111
114
 
115
+ test('a plugin mark carries its own hue, stable across renders', () => {
116
+ const first = paint(h(PluginMark, { name: 'Demo Plugin', iconUrl: '/api/panels/icon/demo/icon.svg' }))
117
+ .querySelector('span');
118
+ const hue = first?.style.getPropertyValue('--icon-hue');
119
+ render(null, container);
120
+ const second = paint(h(PluginMark, { name: 'Demo Plugin', iconUrl: '/api/panels/icon/demo/icon.svg' }))
121
+ .querySelector('span');
122
+
123
+ expect(hue).toMatch(/^\d+$/);
124
+ expect(second?.style.getPropertyValue('--icon-hue')).toBe(hue);
125
+ expect(paint(h(PluginMark, { name: 'Another Plugin' })).querySelector('span')?.style.getPropertyValue('--icon-hue')).not.toBe(hue);
126
+ });
127
+
128
+ test('the initials fallback takes the same colour hook as a vector mark', () => {
129
+ const badge = paint(h(PluginMark, { name: 'Session Info' })).querySelector('span');
130
+
131
+ expect(badge?.getAttribute('data-plugin-mark')).toBe('');
132
+ // 45% of the palette ink is what `text-ink/45` meant, restated as a value so
133
+ // the colour mode can replace it without a second class.
134
+ expect(badge?.style.color).toBe('var(--plugin-color, color-mix(in srgb, var(--theme-ink) 45%, transparent))');
135
+ });
136
+
137
+ test('a declared colour rides as a clamped pair, so the mode still gates it', () => {
138
+ // The manifest's `color` is the plugin's own brand. It is set as custom
139
+ // properties rather than as a colour, because `monochrome` must still paint
140
+ // the palette ink — the stylesheet reads them only under
141
+ // `[data-icon-style="color"]`. Two values, because `#34d399` is 1.9:1 on
142
+ // white paper and 7:1 on dark: `legiblePair` derives the light one.
143
+ const el = paint(h(PluginMark, { name: 'Demo', iconUrl: '/api/panels/icon/demo/icon.svg', color: '#34d399' }));
144
+ const span = el.querySelector('span');
145
+ const light = span?.style.getPropertyValue('--plugin-declared-light') ?? '';
146
+
147
+ expect(light).toMatch(/^#[0-9a-f]{6}$/);
148
+ expect(light).not.toBe('#34d399');
149
+ expect(span?.style.getPropertyValue('--plugin-declared-dark')).toBe('#34d399');
150
+ expect(span?.style.backgroundColor).toBe('var(--plugin-color, currentColor)');
151
+ });
152
+
153
+ test('no declared colour leaves both variables unset, so the hue applies', () => {
154
+ const span = paint(h(PluginMark, { name: 'Demo' })).querySelector('span');
155
+
156
+ expect(span?.style.getPropertyValue('--plugin-declared-light')).toBe('');
157
+ expect(span?.style.getPropertyValue('--plugin-declared-dark')).toBe('');
158
+ expect(span?.style.getPropertyValue('--icon-hue')).not.toBe('');
159
+ });
160
+
112
161
  test('falls back to the plugin initials when no icon is declared', () => {
113
162
  const el = paint(h(PluginMark, { name: 'Session Info', size: 16 }));
114
163