@kabmo-labs/kabmo 0.18.0 → 0.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (219) hide show
  1. package/README.md +43 -13
  2. package/dist/client/index.html +3 -3
  3. package/dist/client/index.js +485 -484
  4. package/dist/client/static/js/index-0721wrkf.css +1 -0
  5. package/dist/client/static/js/{index-tc09dtca.js → index-zg32n2sk.js} +778 -777
  6. package/dist/client/static/{manifest-42r8wcmg.webmanifest → manifest-q6h8k9e0.webmanifest} +1 -1
  7. package/index.html +1 -1
  8. package/marketplace/plugins/command-runner/package.json +3 -2
  9. package/marketplace/plugins/git-forge/package.json +3 -2
  10. package/marketplace/plugins/session-info/package.json +3 -2
  11. package/marketplace/plugins/stats/package.json +3 -2
  12. package/package.json +3 -1
  13. package/public/manifest.webmanifest +1 -1
  14. package/src/client/components/auth/login-screen/index.tsx +2 -1
  15. package/src/client/components/common/ComposerPicker.tsx +1 -1
  16. package/src/client/components/common/FolderPicker.tsx +2 -2
  17. package/src/client/components/common/Modal.tsx +2 -2
  18. package/src/client/components/common/PWAInstallButton.tsx +2 -2
  19. package/src/client/components/common/ViewportSelector.tsx +1 -1
  20. package/src/client/components/common/anchored-menu/index.tsx +5 -1
  21. package/src/client/components/common/batch-selection/SelectionCheckbox.tsx +2 -1
  22. package/src/client/components/common/brand-wordmark/index.test.tsx +13 -2
  23. package/src/client/components/common/brand-wordmark/index.tsx +13 -2
  24. package/src/client/components/common/checkbox/style.test.ts +142 -0
  25. package/src/client/components/common/checkbox/style.ts +51 -0
  26. package/src/client/components/common/context-usage-button/index.tsx +2 -2
  27. package/src/client/components/common/file-icon/index.tsx +23 -9
  28. package/src/client/components/common/header-controls/MoreMenu.tsx +1 -1
  29. package/src/client/components/common/markdown-review/ReviewPopover.tsx +1 -1
  30. package/src/client/components/common/panel-mark/index.test.tsx +124 -0
  31. package/src/client/components/common/panel-mark/index.tsx +105 -0
  32. package/src/client/components/common/provider-icon/glyphs.test.ts +1 -1
  33. package/src/client/components/common/provider-icon/index.test.ts +14 -0
  34. package/src/client/components/common/provider-icon/index.tsx +4 -0
  35. package/src/client/components/common/provider-icon/resolve.test.ts +8 -7
  36. package/src/client/components/common/provider-icon/resolve.ts +16 -3
  37. package/src/client/components/common/session-actions-menu/index.tsx +1 -1
  38. package/src/client/components/common/toolbar-row/index.tsx +1 -1
  39. package/src/client/components/layout/ActivityBar.tsx +22 -3
  40. package/src/client/components/layout/LeftDock.tsx +9 -2
  41. package/src/client/components/layout/PanelVisibilityMenu.tsx +1 -1
  42. package/src/client/components/layout/WindowAura.tsx +27 -0
  43. package/src/client/components/layout/desktop-layout/LeftColumn.tsx +1 -1
  44. package/src/client/components/layout/desktop-layout/TopNavbar.tsx +2 -2
  45. package/src/client/components/layout/desktop-layout/WorkspacePanels.tsx +11 -2
  46. package/src/client/components/layout/desktop-layout/index.tsx +3 -1
  47. package/src/client/components/layout/session-sidebar/CategoryHeader.tsx +3 -3
  48. package/src/client/components/layout/session-sidebar/Header.tsx +1 -1
  49. package/src/client/components/layout/session-sidebar/OverflowMenu.tsx +1 -1
  50. package/src/client/components/layout/session-sidebar/Toolbar.tsx +1 -1
  51. package/src/client/components/layout/session-sidebar/about-modal/index.tsx +2 -2
  52. package/src/client/components/layout/session-sidebar/modern/ActionRow.tsx +1 -1
  53. package/src/client/components/layout/session-sidebar/modern/WorkspaceHeader.tsx +13 -5
  54. package/src/client/components/layout/session-sidebar/new-workspace-modal/index.tsx +2 -2
  55. package/src/client/components/layout/session-sidebar/scheduler-modal/TaskForm.tsx +2 -1
  56. package/src/client/components/layout/session-sidebar/scheduler-modal/index.tsx +2 -2
  57. package/src/client/components/mobile/LayoutWrapper.tsx +3 -1
  58. package/src/client/components/mobile/mobile-main-view/Header.tsx +2 -2
  59. package/src/client/components/mobile/mobile-session-sidebar/Header.tsx +1 -1
  60. package/src/client/components/mobile/mobile-session-sidebar/Toolbar.tsx +1 -1
  61. package/src/client/components/mobile/panel-chips.tsx +10 -2
  62. package/src/client/components/settings/Modal.tsx +4 -4
  63. package/src/client/components/settings/ProjectSelectorDropdown.tsx +2 -2
  64. package/src/client/components/settings/apply-side-effects.test.ts +30 -0
  65. package/src/client/components/settings/apply-side-effects.ts +14 -0
  66. package/src/client/components/settings/categories/AppearanceSettings.tsx +6 -0
  67. package/src/client/components/settings/categories/appearance-settings/EditorBlameSection.tsx +2 -1
  68. package/src/client/components/settings/categories/appearance-settings/EditorTypingSection.tsx +2 -1
  69. package/src/client/components/settings/categories/appearance-settings/IconStyleSection.tsx +144 -0
  70. package/src/client/components/settings/categories/appearance-settings/SurfaceStyleSection.test.tsx +120 -0
  71. package/src/client/components/settings/categories/appearance-settings/SurfaceStyleSection.tsx +180 -0
  72. package/src/client/components/settings/categories/mcp-settings/DetailPane.tsx +2 -1
  73. package/src/client/components/settings/categories/mcp-settings/ImportModal.tsx +2 -2
  74. package/src/client/components/settings/categories/omp-settings/OrderedChips.tsx +1 -1
  75. package/src/client/components/settings/categories/panel-plugins/AvailableList.tsx +1 -1
  76. package/src/client/components/settings/categories/panel-plugins/BuiltinList.tsx +21 -3
  77. package/src/client/components/settings/categories/panel-plugins/GitFreshness.test.tsx +46 -0
  78. package/src/client/components/settings/categories/panel-plugins/GitFreshness.tsx +1 -1
  79. package/src/client/components/settings/categories/panel-plugins/InstalledList.tsx +7 -9
  80. package/src/client/components/settings/categories/panel-plugins/PluginCard.test.tsx +149 -0
  81. package/src/client/components/settings/categories/panel-plugins/PluginCard.tsx +34 -7
  82. package/src/client/components/settings/categories/panel-plugins/PluginMark.test.ts +66 -2
  83. package/src/client/components/settings/categories/panel-plugins/PluginMark.tsx +47 -10
  84. package/src/client/components/settings/categories/panel-plugins/Section.tsx +7 -1
  85. package/src/client/components/settings/categories/panel-plugins/Toolbar.tsx +35 -2
  86. package/src/client/components/settings/categories/plugin-settings/DetailPane.tsx +2 -1
  87. package/src/client/components/settings/categories/plugin-settings/SettingsSection.tsx +2 -1
  88. package/src/client/components/settings/categories/project-settings/ModelDropdown.tsx +1 -1
  89. package/src/client/components/settings/categories/project-settings/WorktreeSettings.tsx +2 -1
  90. package/src/client/components/settings/categories/provider-settings/DeleteProviderModal.tsx +2 -2
  91. package/src/client/components/settings/categories/provider-settings/EntryAdvanced.tsx +3 -2
  92. package/src/client/components/settings/categories/provider-settings/LogoutProviderModal.tsx +2 -2
  93. package/src/client/components/settings/categories/skill-catalog/GitImportPanel.tsx +3 -2
  94. package/src/client/components/settings/categories/skill-settings/DetailHeader.tsx +2 -1
  95. package/src/client/components/settings/categories/token-usage-settings/Controls.tsx +1 -1
  96. package/src/client/components/workspace/btw-panel/TopicMenu.tsx +1 -1
  97. package/src/client/components/workspace/chat-timeline/AiMessageFooter.tsx +2 -2
  98. package/src/client/components/workspace/chat-timeline/NewChatModal.tsx +3 -3
  99. package/src/client/components/workspace/chat-timeline/UndoConfirmModal.tsx +2 -2
  100. package/src/client/components/workspace/chat-timeline/chat-input/AccessDropdown.tsx +1 -1
  101. package/src/client/components/workspace/chat-timeline/chat-input/GoalModal.tsx +4 -3
  102. package/src/client/components/workspace/chat-timeline/chat-input/ThinkingLevelDropdown.tsx +1 -1
  103. package/src/client/components/workspace/chat-timeline/chat-input/WaitingDependencyPicker.tsx +1 -1
  104. package/src/client/components/workspace/chat-timeline/plan-review/index.tsx +2 -2
  105. package/src/client/components/workspace/chat-timeline/target-picker/WorkspacePicker.tsx +1 -1
  106. package/src/client/components/workspace/chat-timeline/target-picker/WorktreePicker.tsx +1 -1
  107. package/src/client/components/workspace/chat-timeline/tool-renderers/extension-dialog/index.tsx +2 -6
  108. package/src/client/components/workspace/context-panel/CostBreakdownPopover.tsx +1 -1
  109. package/src/client/components/workspace/diff-panel/index.tsx +2 -2
  110. package/src/client/components/workspace/editor/PluginRail.tsx +1 -1
  111. package/src/client/components/workspace/editor/SaveDeletedFileModal.tsx +2 -2
  112. package/src/client/components/workspace/editor/TabContextMenu.tsx +1 -1
  113. package/src/client/components/workspace/editor/Tabs.tsx +1 -1
  114. package/src/client/components/workspace/file-explorer/ContextMenu.tsx +1 -1
  115. package/src/client/components/workspace/file-explorer/Modals.tsx +10 -10
  116. package/src/client/components/workspace/file-explorer/RootMenu.tsx +1 -1
  117. package/src/client/components/workspace/git-panel/BranchToolbar.test.tsx +130 -0
  118. package/src/client/components/workspace/git-panel/BranchToolbar.tsx +21 -11
  119. package/src/client/components/workspace/git-panel/CommitBox.tsx +2 -1
  120. package/src/client/components/workspace/git-panel/Modals.tsx +2 -2
  121. package/src/client/components/workspace/git-panel/StashSection.tsx +2 -1
  122. package/src/client/components/workspace/git-panel/branch-modal/DeleteDialog.tsx +2 -1
  123. package/src/client/components/workspace/git-panel/branch-modal/RenameDialog.tsx +2 -1
  124. package/src/client/components/workspace/git-panel/commit-modal/index.tsx +2 -2
  125. package/src/client/components/workspace/git-panel/index.tsx +7 -0
  126. package/src/client/components/workspace/model-dropdown/Panel.tsx +1 -1
  127. package/src/client/components/workspace/model-dropdown/SpecsTooltip.tsx +1 -1
  128. package/src/client/components/workspace/plugin-panel/catalog.tsx +7 -0
  129. package/src/client/components/workspace/plugin-panel/resolve.tsx +4 -0
  130. package/src/client/components/workspace/search-panel/Body.tsx +1 -1
  131. package/src/client/components/workspace/usage-panel/ProviderSelect.tsx +1 -1
  132. package/src/client/glass-sticky.test.ts +46 -0
  133. package/src/client/glass.css +795 -0
  134. package/src/client/glass.test.ts +306 -0
  135. package/src/client/hooks/ui/glass-support.ts +57 -0
  136. package/src/client/hooks/ui/icon-style.ts +59 -0
  137. package/src/client/hooks/ui/stuck-header.test.ts +213 -0
  138. package/src/client/hooks/ui/stuck-header.ts +122 -0
  139. package/src/client/hooks/ui/style-attributes.test.ts +120 -0
  140. package/src/client/hooks/ui/surface-style.ts +56 -0
  141. package/src/client/hooks/workspace/panel-hues.ts +23 -0
  142. package/src/client/hooks/workspace/panel-registry.ts +8 -4
  143. package/src/client/main.tsx +10 -0
  144. package/src/client/tailwind.css +264 -11
  145. package/src/server/lib/assets/shell-attributes.server.ts +80 -0
  146. package/src/server/lib/assets/shell-attributes.test.ts +86 -0
  147. package/src/server/lib/lifecycle/tls.test.ts +6 -1
  148. package/src/server/lib/omp/rpc/frame-fold-host.test-util.ts +1 -0
  149. package/src/server/lib/omp/rpc/frame-fold-signals.test.ts +2 -30
  150. package/src/server/lib/omp/rpc/frame-fold.test.ts +55 -0
  151. package/src/server/lib/omp/rpc/frame-fold.ts +4 -0
  152. package/src/server/lib/omp/rpc/manager.ts +2 -2
  153. package/src/server/lib/omp/rpc/process-helpers.ts +11 -0
  154. package/src/server/lib/omp/rpc/process.test.ts +106 -0
  155. package/src/server/lib/omp/rpc/process.ts +28 -4
  156. package/src/server/lib/omp/rpc/run-settle.server.ts +12 -0
  157. package/src/server/lib/omp/rpc/run-settle.test.ts +22 -0
  158. package/src/server/lib/omp/rpc/session-command-guards.ts +5 -0
  159. package/src/server/lib/omp/rpc/session-commands.test.ts +9 -1
  160. package/src/server/lib/omp/rpc/session-commands.ts +11 -0
  161. package/src/server/lib/omp/rpc/terminal-settle.ts +29 -7
  162. package/src/server/lib/panels/bundled-catalog.server.ts +1 -0
  163. package/src/server/lib/panels/git-update.server.test.ts +20 -0
  164. package/src/server/lib/panels/git-update.server.ts +20 -4
  165. package/src/server/lib/panels/manifest.test.ts +20 -0
  166. package/src/server/lib/panels/manifest.ts +12 -0
  167. package/src/server/lib/panels/scan.server.ts +4 -0
  168. package/src/server/lib/panels/sync.server.ts +9 -1
  169. package/src/server/lib/panels/update.server.test.ts +193 -0
  170. package/src/server/lib/panels/update.server.ts +210 -0
  171. package/src/server/lib/plugins/server-half.server.ts +42 -0
  172. package/src/server/lib/queue/delivery-dispatch.server.test.ts +48 -0
  173. package/src/server/lib/queue/delivery-harness.ts +8 -4
  174. package/src/server/lib/queue/delivery.server.test.ts +29 -0
  175. package/src/server/lib/queue/delivery.server.ts +39 -0
  176. package/src/server/lib/queue/store.server.test.ts +22 -2
  177. package/src/server/lib/queue/store.server.ts +33 -11
  178. package/src/server/lib/terminal/attach-replay.test.ts +26 -8
  179. package/src/server/plugins/ssr.ts +22 -5
  180. package/src/server/routes/panels/install-route.test.ts +238 -0
  181. package/src/server/routes/panels/install.ts +36 -64
  182. package/src/server/routes/panels/panel-routes.test-util.ts +6 -1
  183. package/src/server/routes/panels/routes.test.ts +1 -118
  184. package/src/shared/lib/icons/file-brand-color.ts +38 -0
  185. package/src/shared/lib/icons/icon-paint-css.test.ts +235 -0
  186. package/src/shared/lib/icons/icon-paint-css.ts +285 -0
  187. package/src/shared/lib/icons/icon-paint-panel.ts +109 -0
  188. package/src/shared/lib/icons/icon-tone.ts +166 -0
  189. package/src/shared/lib/icons/tint-hues.generated.ts +277 -0
  190. package/src/shared/lib/icons/tint.test.ts +333 -0
  191. package/src/shared/lib/icons/tint.ts +248 -0
  192. package/src/shared/lib/models/provider/brand-color.test.ts +116 -0
  193. package/src/shared/lib/models/provider/brand-color.ts +103 -0
  194. package/src/shared/lib/omp/rpc/frame.test.ts +65 -0
  195. package/src/shared/lib/omp/rpc/frame.ts +58 -3
  196. package/src/shared/lib/panels/update.test.ts +107 -0
  197. package/src/shared/lib/panels/update.ts +73 -0
  198. package/src/shared/lib/settings/defaults.ts +4 -0
  199. package/src/shared/lib/theme/catalog.test.ts +5 -4
  200. package/src/shared/lib/theme/catalog.ts +18 -3
  201. package/src/shared/lib/theme/color.ts +50 -0
  202. package/src/shared/lib/theme/glass-support.test.ts +38 -0
  203. package/src/shared/lib/theme/glass-support.ts +73 -0
  204. package/src/shared/lib/theme/icon-style.test.ts +74 -0
  205. package/src/shared/lib/theme/icon-style.ts +90 -0
  206. package/src/shared/lib/theme/legibility.ts +91 -0
  207. package/src/shared/lib/theme/palettes/dark-extended.ts +152 -0
  208. package/src/shared/lib/theme/palettes/light-extended.ts +157 -0
  209. package/src/shared/lib/theme/surface-style.test.ts +68 -0
  210. package/src/shared/lib/theme/surface-style.ts +91 -0
  211. package/src/shared/lib/theme/theme.test.ts +11 -7
  212. package/src/shared/lib/workspace/panel-hues.test.ts +68 -0
  213. package/src/shared/lib/workspace/panel-hues.ts +57 -0
  214. package/src/shared/types/panels-registry.ts +6 -0
  215. package/src/shared/types/panels.ts +14 -0
  216. package/src/shared/types/settings/state.ts +26 -0
  217. package/src/test-support/fake-omp-frames.ts +163 -0
  218. package/dist/client/static/js/index-hp75vsv9.css +0 -1
  219. /package/src/{client/components/common/file-icon/brand-paths.ts → shared/lib/icons/file-brand-paths.ts} +0 -0
@@ -47,6 +47,7 @@
47
47
  */
48
48
 
49
49
  import { useRef, useState } from 'preact/hooks';
50
+ import { useStuckHeader } from '@/client/hooks/ui/stuck-header';
50
51
  import type { ReactNode } from 'preact/compat';
51
52
  import { ChevronDown, ChevronRight, MoreHorizontal, Pin, Plus } from 'lucide-preact';
52
53
  import { AnchoredMenu } from '@/client/components/common/anchored-menu';
@@ -96,11 +97,18 @@ export function WorkspaceHeader({
96
97
  // it, so a rectangle read on every render would drag the panel along with the
97
98
  // rows instead of leaving it where the click put it.
98
99
  const [anchor, setAnchor] = useState<AnchorRect | null>(null);
100
+ // A surface only while PINNED: at rest the header is the first line of the
101
+ // list and any fill is a band across a uniform sidebar. Once rows slide under
102
+ // it, it needs a field of its own — that is the state `data-stuck` marks.
103
+ const headerRef = useRef<HTMLDivElement>(null);
104
+ const stuck = useStuckHeader(headerRef);
99
105
 
100
106
  return (
101
107
  <div
108
+ ref={headerRef}
109
+ data-stuck={stuck ? '' : undefined}
102
110
  className={`group/ws sticky top-0 z-10 -mx-1 flex items-center gap-1 rounded-md px-1 text-xs font-semibold text-ink ${
103
- touch ? 'h-8 bg-canvas' : 'h-[26px] bg-paper'
111
+ touch ? 'h-8 bg-canvas glass-sticky' : 'h-[26px] bg-paper glass-sticky'
104
112
  }`}
105
113
  >
106
114
  <button
@@ -128,12 +136,12 @@ export function WorkspaceHeader({
128
136
  referrerPolicy="no-referrer"
129
137
  />
130
138
  ) : (
131
- <ProjectIcon size={15} className="text-ink/70" style={{ color: accent }} />
139
+ <ProjectIcon size={15} className="project-accent-mark text-ink/70" style={accent ? { '--project-accent': accent } : undefined} />
132
140
  )}
133
141
  </span>
134
142
  )}
135
143
 
136
- <span className="truncate text-[13px] font-semibold tracking-tight">{folder.name}</span>
144
+ <span className="glass-sticky-label truncate text-[13px] font-semibold tracking-tight">{folder.name}</span>
137
145
  {folder.isPinned && <Pin size={10} className="shrink-0 text-ink/45" />}
138
146
 
139
147
  {/* The accent as a dot: the icon column keeps the chevron's slot, so the
@@ -142,7 +150,7 @@ export function WorkspaceHeader({
142
150
  <span aria-hidden="true" className="h-1.5 w-1.5 shrink-0 rounded-full" style={{ backgroundColor: accent }} />
143
151
  )}
144
152
 
145
- <span className="shrink-0 font-mono text-[10px] font-normal tabular-nums text-ink/35">{sessionCount}</span>
153
+ <span className="glass-sticky-label shrink-0 font-mono text-[10px] font-normal tabular-nums text-ink/35">{sessionCount}</span>
146
154
 
147
155
  <span className="ml-auto shrink-0 text-ink/40">
148
156
  {isOpen ? <ChevronDown size={touch ? 14 : 12} /> : <ChevronRight size={touch ? 14 : 12} />}
@@ -198,7 +206,7 @@ export function WorkspaceHeader({
198
206
  anchor={showMenu && menu ? anchor : null}
199
207
  align="end"
200
208
  ariaLabel={`Options for ${folder.name}`}
201
- className="w-44 rounded-md border border-ink/15 bg-paper py-1 text-xs shadow-lg"
209
+ className="glass-popover w-44 rounded-md border border-ink/15 bg-paper py-1 text-xs shadow-lg"
202
210
  onClose={onCloseMenu}
203
211
  >
204
212
  {menu}
@@ -136,8 +136,8 @@ function NewWorkspaceForm({
136
136
  };
137
137
 
138
138
  return (
139
- <div className="fixed inset-0 bg-ink/20 z-50 flex items-center justify-center p-4">
140
- <div className="bg-paper border border-ink/10 rounded-lg shadow-xl w-[30rem] max-w-full max-h-full overflow-y-auto flex flex-col">
139
+ <div className="fixed inset-0 modal-scrim z-50 flex items-center justify-center p-4">
140
+ <div className="glass-overlay bg-paper border border-ink/10 rounded-lg shadow-xl w-[30rem] max-w-full max-h-full overflow-y-auto flex flex-col">
141
141
  <div className="flex justify-between items-center px-4 pt-4 pb-2 border-b border-ink/10">
142
142
  <h3 className="font-semibold text-sm">New Workspace</h3>
143
143
  <button
@@ -13,6 +13,7 @@
13
13
  * refuses.
14
14
  */
15
15
 
16
+ import { CHECKBOX_CLASS } from '@/client/components/common/checkbox/style';
16
17
  import { useEffect, useState } from 'preact/hooks';
17
18
  import { Loader2 } from 'lucide-preact';
18
19
  import { validateSchedule } from '@/shared/lib/schedule/parse';
@@ -185,7 +186,7 @@ export function TaskForm({
185
186
  checked={useActiveSession}
186
187
  disabled={!activeSessionId}
187
188
  onChange={(e) => setUseActiveSession(e.currentTarget.checked)}
188
- className="accent-ink"
189
+ className={`${CHECKBOX_CLASS} accent-ink`}
189
190
  />
190
191
  <span>Resume the open session each run</span>
191
192
  </label>
@@ -127,14 +127,14 @@ export function SchedulerModal({
127
127
 
128
128
  return (
129
129
  <div
130
- className="fixed inset-0 bg-ink/30 backdrop-blur-[2px] z-50 flex items-center justify-center p-4"
130
+ className="fixed inset-0 modal-scrim backdrop-blur-[2px] z-50 flex items-center justify-center p-4"
131
131
  onClick={busy ? undefined : onClose}
132
132
  role="dialog"
133
133
  aria-modal="true"
134
134
  aria-label="Scheduled tasks"
135
135
  >
136
136
  <div
137
- className="bg-paper border border-ink/15 rounded-xl shadow-2xl w-[min(94vw,640px)] max-h-[88vh] flex flex-col overflow-hidden text-ink"
137
+ className="glass-overlay bg-paper border border-ink/15 rounded-xl shadow-2xl w-[min(94vw,640px)] max-h-[88vh] flex flex-col overflow-hidden text-ink"
138
138
  onClick={(e) => e.stopPropagation()}
139
139
  >
140
140
  <div className="flex items-center justify-between px-4 py-3 border-b border-ink/10">
@@ -4,6 +4,7 @@ import { useKabmoEvent } from '@/client/hooks/ui/window-event';
4
4
  import { registerBackHandler } from '@/client/lib/native/back';
5
5
  import type { SettingsCategoryId } from '@/shared/types';
6
6
  import { MobileMainView } from '@/client/components/mobile/MainView';
7
+ import { WindowAura } from '@/client/components/layout/WindowAura';
7
8
  import { MobileSessionSidebar } from '@/client/components/mobile/SessionSidebar';
8
9
  import { MobileRightSidebar } from '@/client/components/mobile/RightSidebar';
9
10
  import { MobileFullEditor } from '@/client/components/mobile/mobile-right-sidebar/FullEditor';
@@ -242,8 +243,9 @@ export function MobileLayoutWrapper({ onDesktopToggle, appSettings = {} }: Mobil
242
243
  return (
243
244
  <div
244
245
  data-testid="app-root"
245
- className="flex flex-col h-dvh w-screen overflow-hidden bg-canvas text-ink font-sans selection:bg-ink selection:text-canvas relative"
246
+ className="app-window flex flex-col h-dvh w-screen overflow-hidden bg-canvas text-ink font-sans selection:bg-ink selection:text-canvas relative"
246
247
  >
248
+ <WindowAura />
247
249
  {/* The plugin system's boot, on the PHONE too. It is mounted at the top of
248
250
  the workspace on the desktop (`desktop-layout/index.tsx`), and without
249
251
  it here a phone had no plugin CONTEXT (so `usePanelInfo()` answered
@@ -138,7 +138,7 @@ export function MobileHeader({
138
138
  into the `⋯` menu (`HeaderControls`), which is what pays for the
139
139
  wordmark plus the slash beside it. */}
140
140
  <span className="relative font-bold text-sm tracking-tight flex items-center flex-shrink-0">
141
- <BrandWordmark />
141
+ <BrandWordmark glow />
142
142
  <span className="absolute -top-0.5 -right-1.5 flex">
143
143
  <StreamStatusDot status={streamStatus} />
144
144
  </span>
@@ -181,7 +181,7 @@ export function MobileHeader({
181
181
  to state them separately and drifted. */}
182
182
  {showSessionPicker && (
183
183
  <div
184
- className="fixed z-50 bg-paper border border-ink/15 rounded-xl shadow-lg p-2 text-xs"
184
+ className="glass-popover fixed z-50 bg-paper border border-ink/15 rounded-xl shadow-lg p-2 text-xs"
185
185
  style={mobileOverlayStyle()}
186
186
  >
187
187
  <button
@@ -46,7 +46,7 @@ export function MobileSessionHeader({ onClose, viewLabel = 'Sessions' }: { onClo
46
46
  >
47
47
  <div className="flex items-center space-x-2.5 titlebar-no-drag min-w-0">
48
48
  <span className="font-bold text-sm tracking-tight flex items-center flex-shrink-0">
49
- <BrandWordmark className="text-[16px]" />
49
+ <BrandWordmark className="text-[16px]" glow />
50
50
  </span>
51
51
  <span className="text-ink/25 text-xs select-none flex-shrink-0">/</span>
52
52
  <span className="text-[11px] font-semibold text-ink/60 uppercase tracking-wider font-mono truncate">{viewLabel}</span>
@@ -229,7 +229,7 @@ export function MobileSessionToolbar({
229
229
  </button>
230
230
 
231
231
  {optionsOpen && (
232
- <div className="absolute right-0 top-full mt-2 w-52 bg-paper border border-ink/15 rounded-xl shadow-xl z-50 p-2 text-xs">
232
+ <div className="glass-popover absolute right-0 top-full mt-2 w-52 bg-paper border border-ink/15 rounded-xl shadow-xl z-50 p-2 text-xs">
233
233
  <SortMenu variant="mobile" sortOption={sortOption} onSortChange={onSortChange} />
234
234
  </div>
235
235
  )}
@@ -31,7 +31,7 @@
31
31
 
32
32
  import { useCallback, useEffect, useLayoutEffect, useRef } from 'preact/hooks';
33
33
  import type { ResolvedPanel } from '@/client/components/workspace/plugin-panel/catalog';
34
- import { PluginMark } from '@/client/components/settings/categories/panel-plugins/PluginMark';
34
+ import { PanelMark } from '@/client/components/common/panel-mark';
35
35
  import { PANEL_MARK_SIZE } from '@/shared/lib/workspace/right-panels';
36
36
  import { scrollLeftForReveal } from '@/shared/lib/ui/scroll-reveal';
37
37
 
@@ -140,7 +140,15 @@ export function PanelChips({ panels, activeId, onSelect, hasGitChanges = false }
140
140
  }`}
141
141
  title={panel.title}
142
142
  >
143
- {panel.builtin ? panel.icon : <PluginMark name={panel.name} iconUrl={panel.iconUrl} size={PANEL_MARK_SIZE} />}
143
+ <PanelMark
144
+ panelId={panel.id}
145
+ builtin={panel.builtin}
146
+ icon={panel.builtin ? panel.icon : undefined}
147
+ name={panel.builtin ? panel.label : panel.name}
148
+ {...(panel.iconUrl ? { iconUrl: panel.iconUrl } : {})}
149
+ {...(panel.color ? { color: panel.color } : {})}
150
+ size={PANEL_MARK_SIZE}
151
+ />
144
152
  {active && (
145
153
  <span className={panel.id === 'git' ? 'tracking-wide' : undefined}>{panel.label}</span>
146
154
  )}
@@ -189,11 +189,11 @@ export function SettingsModal({
189
189
 
190
190
  return (
191
191
  <div
192
- className="fixed inset-0 bg-ink/40 backdrop-blur-[2px] z-50 flex items-center justify-center p-0 md:p-6 animate-in fade-in duration-150"
192
+ className="fixed inset-0 modal-scrim backdrop-blur-[2px] z-50 flex items-center justify-center p-0 md:p-6 animate-in fade-in duration-150"
193
193
  onClick={onClose}
194
194
  >
195
195
  <div
196
- className="relative bg-paper border border-ink/15 md:rounded-2xl shadow-2xl w-full h-full md:max-w-5xl lg:max-w-6xl xl:max-w-[1280px] md:h-[min(90vh,900px)] md:max-h-[92vh] flex flex-col md:flex-row overflow-hidden text-ink"
196
+ className="glass-overlay relative bg-paper border border-ink/15 md:rounded-2xl shadow-2xl w-full h-full md:max-w-5xl lg:max-w-6xl xl:max-w-[1280px] md:h-[min(90vh,900px)] md:max-h-[92vh] flex flex-col md:flex-row overflow-hidden text-ink"
197
197
  onClick={(e) => e.stopPropagation()}
198
198
  >
199
199
  {/* DESKTOP VIEW: 2-Column Split */}
@@ -212,13 +212,13 @@ export function SettingsModal({
212
212
  </div>
213
213
 
214
214
  {/* DESKTOP & MOBILE DETAIL VIEW */}
215
- <div className={`flex-1 flex-col h-full bg-paper overflow-hidden ${isMobileDrilled ? 'flex' : 'hidden md:flex'}`}>
215
+ <div className={`flex-1 flex-col h-full overflow-hidden ${isMobileDrilled ? 'flex' : 'hidden md:flex'}`}>
216
216
  {/* Header Bar. The height and padding carry the safe-area insets on a
217
217
  phone: the modal is full-screen below `md`, so without them the
218
218
  back button and the title sit under the status bar / notch, the
219
219
  same way the mobile chrome (header, editor, diff) already avoids. */}
220
220
  <div
221
- className="px-6 border-b border-ink/10 flex items-center justify-between flex-shrink-0 bg-paper"
221
+ className="px-6 border-b border-ink/10 flex items-center justify-between flex-shrink-0"
222
222
  style={{
223
223
  height: 'calc(4rem + env(safe-area-inset-top, 0px))',
224
224
  paddingTop: 'env(safe-area-inset-top, 0px)',
@@ -125,7 +125,7 @@ export const ProjectSelectorDropdown: FunctionComponent<ProjectSelectorDropdownP
125
125
  {isOpen && (
126
126
  <>
127
127
  <div className="fixed inset-0 z-20" onClick={() => setIsOpen(false)} />
128
- <div className="absolute left-2.5 right-2.5 top-12 z-30 bg-paper border border-ink/15 rounded-lg shadow-lg py-1 animate-in fade-in zoom-in-95 duration-100">
128
+ <div className="glass-popover absolute left-2.5 right-2.5 top-12 z-30 bg-paper border border-ink/15 rounded-lg shadow-lg py-1 animate-in fade-in zoom-in-95 duration-100">
129
129
  {optionButtons}
130
130
  </div>
131
131
  </>
@@ -149,7 +149,7 @@ export const ProjectSelectorDropdown: FunctionComponent<ProjectSelectorDropdownP
149
149
  </button>
150
150
 
151
151
  {isOpen && (
152
- <div className="absolute top-12 left-3 right-3 bg-paper border border-ink/20 rounded-lg shadow-lg z-30 py-1 divide-y divide-ink/5 animate-in fade-in zoom-in-95 duration-100">
152
+ <div className="glass-popover absolute top-12 left-3 right-3 bg-paper border border-ink/20 rounded-lg shadow-lg z-30 py-1 divide-y divide-ink/5 animate-in fade-in zoom-in-95 duration-100">
153
153
  {optionButtons}
154
154
  </div>
155
155
  )}
@@ -88,6 +88,36 @@ describe('applySettingsSideEffects', () => {
88
88
  expect(events).toEqual([]);
89
89
  });
90
90
 
91
+ test('the surface material is written to the document, and only when it moves', () => {
92
+ installDom();
93
+ const root = globalThis.document.documentElement;
94
+
95
+ applySettingsSideEffects(state(), state({ surfaceStyle: 'glass' }));
96
+ expect(root.getAttribute('data-surface')).toBe('glass');
97
+
98
+ // Same value again: the attribute must survive an unrelated re-render
99
+ // untouched (the writer removes the default, so a stray call would clear it).
100
+ applySettingsSideEffects(state({ surfaceStyle: 'glass' }), state({ surfaceStyle: 'glass', goalDefaultBudget: 1 }));
101
+ expect(root.getAttribute('data-surface')).toBe('glass');
102
+
103
+ applySettingsSideEffects(state({ surfaceStyle: 'glass' }), state({ surfaceStyle: 'classic' }));
104
+ expect(root.hasAttribute('data-surface')).toBe(false);
105
+ });
106
+
107
+ test('the brand-mark style is written to the document, and only when it moves', () => {
108
+ installDom();
109
+ const root = globalThis.document.documentElement;
110
+
111
+ applySettingsSideEffects(state(), state({ iconStyle: 'color' }));
112
+ expect(root.getAttribute('data-icon-style')).toBe('color');
113
+
114
+ applySettingsSideEffects(state({ iconStyle: 'color' }), state({ iconStyle: 'color', goalDefaultBudget: 1 }));
115
+ expect(root.getAttribute('data-icon-style')).toBe('color');
116
+
117
+ applySettingsSideEffects(state({ iconStyle: 'color' }), state({ iconStyle: 'monochrome' }));
118
+ expect(root.hasAttribute('data-icon-style')).toBe(false);
119
+ });
120
+
91
121
  test('the editor font still announces when it moves', () => {
92
122
  const win = installDom();
93
123
  const seen: unknown[] = [];
@@ -33,6 +33,8 @@ import { applyChatWidthMode } from '@/client/hooks/chat/timeline/width-mode';
33
33
  import { applyToolRenderMode } from '@/client/hooks/chat/timeline/tool-render-mode';
34
34
  import { applySidebarStyle } from '@/client/hooks/workspace/sidebar-style';
35
35
  import { applyComposerStyle } from '@/client/hooks/chat/composer/style';
36
+ import { applySurfaceStyle } from '@/client/hooks/ui/surface-style';
37
+ import { applyIconStyle } from '@/client/hooks/ui/icon-style';
36
38
  import { EDITOR_FONT_CHANGED_EVENT } from '@/client/hooks/editor/font';
37
39
  import { EDITOR_THEME_CHANGED_EVENT } from '@/client/hooks/editor/theme';
38
40
 
@@ -87,4 +89,16 @@ export function applySettingsSideEffects(previous: SettingsState, next: Settings
87
89
  if (next.composerStyle !== previous.composerStyle) {
88
90
  applyComposerStyle(next.composerStyle);
89
91
  }
92
+
93
+ // The surface material and the brand-mark paint are CSS-only: one attribute
94
+ // each on `<html>`, which every rule already keys on. Written here so the
95
+ // panels behind the modal repaint on the click, and so the next render cannot
96
+ // show a style the document does not carry.
97
+ if (next.surfaceStyle !== previous.surfaceStyle) {
98
+ applySurfaceStyle(next.surfaceStyle);
99
+ }
100
+
101
+ if (next.iconStyle !== previous.iconStyle) {
102
+ applyIconStyle(next.iconStyle);
103
+ }
90
104
  }
@@ -3,6 +3,8 @@ import type { SettingsState } from '@/shared/types';
3
3
  import { resolveThemeId } from '@/shared/lib/theme/catalog';
4
4
  import { ThemeGrid } from '@/client/components/settings/categories/appearance-settings/ThemeGrid';
5
5
  import { SidebarStyleSection } from '@/client/components/settings/categories/appearance-settings/SidebarStyleSection';
6
+ import { SurfaceStyleSection } from '@/client/components/settings/categories/appearance-settings/SurfaceStyleSection';
7
+ import { IconStyleSection } from '@/client/components/settings/categories/appearance-settings/IconStyleSection';
6
8
  import { EditorFontSection } from '@/client/components/settings/categories/appearance-settings/EditorFontSection';
7
9
  import { EditorThemeSection } from '@/client/components/settings/categories/appearance-settings/EditorThemeSection';
8
10
  import { EditorIndentSection } from '@/client/components/settings/categories/appearance-settings/EditorIndentSection';
@@ -36,6 +38,10 @@ export function AppearanceSettings({ settings, onUpdate }: AppearanceSettingsPro
36
38
  </div>
37
39
 
38
40
  <SidebarStyleSection settings={settings} onUpdate={onUpdate} />
41
+
42
+ <SurfaceStyleSection settings={settings} onUpdate={onUpdate} />
43
+
44
+ <IconStyleSection settings={settings} onUpdate={onUpdate} />
39
45
  </section>
40
46
 
41
47
  <EditorFontSection settings={settings} onUpdate={onUpdate} />
@@ -17,6 +17,7 @@
17
17
  * read once would never arrive. The event fires only when a value moved.
18
18
  */
19
19
 
20
+ import { CHECKBOX_CLASS } from '@/client/components/common/checkbox/style';
20
21
  import { readKabmoSetting, writeKabmoSettings } from '@/shared/lib/settings/client';
21
22
  import type { SettingsState } from '@/shared/types';
22
23
  import {
@@ -52,7 +53,7 @@ function Toggle({
52
53
  type="checkbox"
53
54
  checked={checked}
54
55
  onChange={(event) => onChange((event.target as HTMLInputElement).checked)}
55
- className="mt-0.5 shrink-0 accent-ink"
56
+ className={`${CHECKBOX_CLASS} mt-0.5 shrink-0 accent-ink`}
56
57
  />
57
58
  </label>
58
59
  );
@@ -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
+ });