@adea-ai/ui 0.152.3 → 0.153.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 (892) hide show
  1. package/README.md +469 -580
  2. package/dist/components/composites/account-menu/account-menu.d.ts +5 -0
  3. package/dist/components/composites/account-menu/account-menu.d.ts.map +1 -1
  4. package/dist/components/composites/account-menu/account-menu.js +37 -13
  5. package/dist/components/composites/account-menu/account-menu.js.map +1 -1
  6. package/dist/components/composites/action-button/action-button.d.ts +2 -1
  7. package/dist/components/composites/action-button/action-button.d.ts.map +1 -1
  8. package/dist/components/composites/action-button/action-button.js +92 -66
  9. package/dist/components/composites/action-button/action-button.js.map +1 -1
  10. package/dist/components/composites/appearance-editor/accent-swatch-groups.d.ts +3 -3
  11. package/dist/components/composites/appearance-editor/accent-swatch-groups.js +1 -1
  12. package/dist/components/composites/appearance-editor/accent-swatch-groups.js.map +1 -1
  13. package/dist/components/composites/appearance-editor/appearance-choices.d.ts +1 -1
  14. package/dist/components/composites/appearance-editor/appearance-choices.js +1 -1
  15. package/dist/components/composites/appearance-editor/appearance-choices.js.map +1 -1
  16. package/dist/components/composites/appearance-editor/appearance-editor.d.ts.map +1 -1
  17. package/dist/components/composites/appearance-editor/appearance-editor.js +57 -57
  18. package/dist/components/composites/appearance-editor/appearance-editor.js.map +1 -1
  19. package/dist/components/composites/appearance-editor/appearance-rows.d.ts.map +1 -1
  20. package/dist/components/composites/appearance-editor/appearance-rows.js +9 -9
  21. package/dist/components/composites/appearance-editor/appearance-rows.js.map +1 -1
  22. package/dist/components/composites/appearance-editor/appearance-types.d.ts +7 -7
  23. package/dist/components/composites/appearance-editor/theme-preview.d.ts +1 -1
  24. package/dist/components/composites/appearance-editor/theme-preview.js +1 -1
  25. package/dist/components/composites/appearance-editor/theme-preview.js.map +1 -1
  26. package/dist/components/composites/catalog-browser/catalog-browser.d.ts.map +1 -1
  27. package/dist/components/composites/catalog-browser/catalog-browser.js +6 -10
  28. package/dist/components/composites/catalog-browser/catalog-browser.js.map +1 -1
  29. package/dist/components/composites/catalog-browser/catalog-detail.d.ts.map +1 -1
  30. package/dist/components/composites/catalog-browser/catalog-detail.js +36 -36
  31. package/dist/components/composites/catalog-browser/catalog-detail.js.map +1 -1
  32. package/dist/components/composites/chain-of-thought/chain-of-thought.d.ts +4 -4
  33. package/dist/components/composites/chain-of-thought/chain-of-thought.js.map +1 -1
  34. package/dist/components/composites/chat/chat.d.ts.map +1 -1
  35. package/dist/components/composites/chat/chat.js +33 -37
  36. package/dist/components/composites/chat/chat.js.map +1 -1
  37. package/dist/components/composites/checkpoint/checkpoint-model.d.ts +3 -3
  38. package/dist/components/composites/checkpoint/checkpoint-model.js +2 -2
  39. package/dist/components/composites/checkpoint/checkpoint-model.js.map +1 -1
  40. package/dist/components/composites/checkpoint/checkpoint.d.ts +2 -2
  41. package/dist/components/composites/checkpoint/checkpoint.js.map +1 -1
  42. package/dist/components/composites/confirmation/confirmation.d.ts.map +1 -1
  43. package/dist/components/composites/confirmation/confirmation.js +1 -1
  44. package/dist/components/composites/confirmation/confirmation.js.map +1 -1
  45. package/dist/components/composites/context/context.d.ts +2 -2
  46. package/dist/components/composites/context/context.js.map +1 -1
  47. package/dist/components/composites/file-tree/build-file-tree.d.ts +1 -1
  48. package/dist/components/composites/file-tree/build-file-tree.js +1 -1
  49. package/dist/components/composites/file-tree/build-file-tree.js.map +1 -1
  50. package/dist/components/composites/file-tree/file-tree.d.ts.map +1 -1
  51. package/dist/components/composites/file-tree/file-tree.js +7 -3
  52. package/dist/components/composites/file-tree/file-tree.js.map +1 -1
  53. package/dist/components/composites/icon-picker/icon-picker.js +1 -3
  54. package/dist/components/composites/icon-picker/icon-picker.js.map +1 -1
  55. package/dist/components/composites/inline-citation/citation.d.ts +1 -1
  56. package/dist/components/composites/inline-citation/citation.js +1 -1
  57. package/dist/components/composites/inline-citation/citation.js.map +1 -1
  58. package/dist/components/composites/inline-citation/inline-citation.d.ts +2 -2
  59. package/dist/components/composites/inline-citation/inline-citation.js.map +1 -1
  60. package/dist/components/composites/list-row/list-row-control.d.ts.map +1 -1
  61. package/dist/components/composites/list-row/list-row-control.js +22 -22
  62. package/dist/components/composites/list-row/list-row-control.js.map +1 -1
  63. package/dist/components/composites/list-row/list-row.d.ts +5 -0
  64. package/dist/components/composites/list-row/list-row.d.ts.map +1 -1
  65. package/dist/components/composites/list-row/list-row.js +75 -83
  66. package/dist/components/composites/list-row/list-row.js.map +1 -1
  67. package/dist/components/composites/message-scroller/message-scroller.d.ts +1 -1
  68. package/dist/components/composites/message-scroller/message-scroller.js.map +1 -1
  69. package/dist/components/composites/model-selector/model-selector.d.ts +4 -4
  70. package/dist/components/composites/model-selector/model-selector.js.map +1 -1
  71. package/dist/components/composites/model-selector/models.d.ts +2 -2
  72. package/dist/components/composites/model-selector/models.js +1 -1
  73. package/dist/components/composites/model-selector/models.js.map +1 -1
  74. package/dist/components/composites/plan/plan.d.ts.map +1 -1
  75. package/dist/components/composites/plan/plan.js +17 -15
  76. package/dist/components/composites/plan/plan.js.map +1 -1
  77. package/dist/components/composites/queue/queue.d.ts.map +1 -1
  78. package/dist/components/composites/queue/queue.js +5 -7
  79. package/dist/components/composites/queue/queue.js.map +1 -1
  80. package/dist/components/composites/reasoning/reasoning.d.ts +4 -4
  81. package/dist/components/composites/reasoning/reasoning.js +4 -4
  82. package/dist/components/composites/reasoning/reasoning.js.map +1 -1
  83. package/dist/components/composites/settings/settings-navigation.d.ts.map +1 -1
  84. package/dist/components/composites/settings/settings-navigation.js +63 -14
  85. package/dist/components/composites/settings/settings-navigation.js.map +1 -1
  86. package/dist/components/composites/settings/settings.d.ts.map +1 -1
  87. package/dist/components/composites/settings/settings.js +32 -32
  88. package/dist/components/composites/settings/settings.js.map +1 -1
  89. package/dist/components/composites/sources/source.d.ts +1 -1
  90. package/dist/components/composites/sources/source.js.map +1 -1
  91. package/dist/components/composites/sources/sources.d.ts +2 -2
  92. package/dist/components/composites/sources/sources.js.map +1 -1
  93. package/dist/components/composites/stack-trace/parse-stack-trace.d.ts +3 -3
  94. package/dist/components/composites/stack-trace/parse-stack-trace.js +4 -4
  95. package/dist/components/composites/stack-trace/parse-stack-trace.js.map +1 -1
  96. package/dist/components/composites/stack-trace/stack-trace.d.ts +3 -3
  97. package/dist/components/composites/stack-trace/stack-trace.js.map +1 -1
  98. package/dist/components/composites/stat/stat.d.ts.map +1 -1
  99. package/dist/components/composites/stat/stat.js +14 -16
  100. package/dist/components/composites/stat/stat.js.map +1 -1
  101. package/dist/components/composites/subagent/subagent.d.ts.map +1 -1
  102. package/dist/components/composites/subagent/subagent.js +6 -4
  103. package/dist/components/composites/subagent/subagent.js.map +1 -1
  104. package/dist/components/composites/task/task.d.ts +1 -1
  105. package/dist/components/composites/task/task.js.map +1 -1
  106. package/dist/components/composites/terminal/ansi.d.ts +3 -3
  107. package/dist/components/composites/terminal/ansi.js.map +1 -1
  108. package/dist/components/composites/terminal/terminal-model.d.ts +3 -3
  109. package/dist/components/composites/terminal/terminal-model.d.ts.map +1 -1
  110. package/dist/components/composites/terminal/terminal-model.js +1 -1
  111. package/dist/components/composites/terminal/terminal-model.js.map +1 -1
  112. package/dist/components/composites/terminal/terminal.d.ts.map +1 -1
  113. package/dist/components/composites/terminal/terminal.js +24 -11
  114. package/dist/components/composites/terminal/terminal.js.map +1 -1
  115. package/dist/components/composites/test-results/test-results-model.d.ts +4 -4
  116. package/dist/components/composites/test-results/test-results-model.js +2 -2
  117. package/dist/components/composites/test-results/test-results-model.js.map +1 -1
  118. package/dist/components/composites/test-results/test-results.d.ts +1 -1
  119. package/dist/components/composites/test-results/test-results.js.map +1 -1
  120. package/dist/components/composites/tool/tool.d.ts +4 -4
  121. package/dist/components/composites/tool/tool.js.map +1 -1
  122. package/dist/components/composites/tree/tree.d.ts +1 -1
  123. package/dist/components/composites/tree/tree.d.ts.map +1 -1
  124. package/dist/components/composites/tree/tree.js +25 -18
  125. package/dist/components/composites/tree/tree.js.map +1 -1
  126. package/dist/components/composites/update-dialog/channel-control.d.ts +10 -4
  127. package/dist/components/composites/update-dialog/channel-control.d.ts.map +1 -1
  128. package/dist/components/composites/update-dialog/channel-control.js +14 -19
  129. package/dist/components/composites/update-dialog/channel-control.js.map +1 -1
  130. package/dist/components/composites/update-dialog/index.d.ts +1 -1
  131. package/dist/components/composites/update-dialog/index.d.ts.map +1 -1
  132. package/dist/components/composites/update-dialog/update-dialog.js +4 -5
  133. package/dist/components/composites/update-dialog/update-dialog.js.map +1 -1
  134. package/dist/components/composites/workspace-mark/workspace-mark.d.ts.map +1 -1
  135. package/dist/components/composites/workspace-mark/workspace-mark.js +19 -20
  136. package/dist/components/composites/workspace-mark/workspace-mark.js.map +1 -1
  137. package/dist/components/conversation/busy-send-button.d.ts.map +1 -1
  138. package/dist/components/conversation/busy-send-button.js +18 -20
  139. package/dist/components/conversation/busy-send-button.js.map +1 -1
  140. package/dist/components/conversation/composer-menu.d.ts +3 -3
  141. package/dist/components/conversation/composer-menu.js +3 -3
  142. package/dist/components/conversation/composer-menu.js.map +1 -1
  143. package/dist/components/conversation/conversation-avatar.js +2 -4
  144. package/dist/components/conversation/conversation-avatar.js.map +1 -1
  145. package/dist/components/conversation/conversation-pane.d.ts.map +1 -1
  146. package/dist/components/conversation/conversation-pane.js +6 -5
  147. package/dist/components/conversation/conversation-pane.js.map +1 -1
  148. package/dist/components/conversation/conversation-surface.js +3 -7
  149. package/dist/components/conversation/conversation-surface.js.map +1 -1
  150. package/dist/components/conversation/internal/chat-composer-shell.d.ts.map +1 -1
  151. package/dist/components/conversation/internal/chat-composer-shell.js +76 -76
  152. package/dist/components/conversation/internal/chat-composer-shell.js.map +1 -1
  153. package/dist/components/conversation/message-composer.d.ts.map +1 -1
  154. package/dist/components/conversation/message-composer.js +32 -38
  155. package/dist/components/conversation/message-composer.js.map +1 -1
  156. package/dist/components/conversation/message-row.d.ts.map +1 -1
  157. package/dist/components/conversation/message-row.js +79 -73
  158. package/dist/components/conversation/message-row.js.map +1 -1
  159. package/dist/components/conversation/scroll-follow-core.d.ts +7 -7
  160. package/dist/components/conversation/scroll-follow-core.js +4 -4
  161. package/dist/components/conversation/scroll-follow-core.js.map +1 -1
  162. package/dist/components/conversation/scroll-follow.d.ts.map +1 -1
  163. package/dist/components/conversation/scroll-follow.js +19 -4
  164. package/dist/components/conversation/scroll-follow.js.map +1 -1
  165. package/dist/components/conversation/thread-panel.d.ts.map +1 -1
  166. package/dist/components/conversation/thread-panel.js +23 -23
  167. package/dist/components/conversation/thread-panel.js.map +1 -1
  168. package/dist/components/conversation/transcript-composition.d.ts.map +1 -1
  169. package/dist/components/conversation/transcript-composition.js +2 -2
  170. package/dist/components/conversation/transcript-composition.js.map +1 -1
  171. package/dist/components/layout/app-shell/app-shell.d.ts +1 -1
  172. package/dist/components/layout/app-shell/app-shell.js +1 -1
  173. package/dist/components/layout/app-shell/app-shell.js.map +1 -1
  174. package/dist/components/layout/app-shell/skip-link.d.ts.map +1 -1
  175. package/dist/components/layout/app-shell/skip-link.js +4 -6
  176. package/dist/components/layout/app-shell/skip-link.js.map +1 -1
  177. package/dist/components/layout/page/page.d.ts.map +1 -1
  178. package/dist/components/layout/page/page.js +17 -17
  179. package/dist/components/layout/page/page.js.map +1 -1
  180. package/dist/components/layout/panel/panel.js +2 -4
  181. package/dist/components/layout/panel/panel.js.map +1 -1
  182. package/dist/components/layout/pixel-resize-handle/pixel-resize-handle.d.ts.map +1 -1
  183. package/dist/components/layout/pixel-resize-handle/pixel-resize-handle.js +16 -1
  184. package/dist/components/layout/pixel-resize-handle/pixel-resize-handle.js.map +1 -1
  185. package/dist/components/layout/side-rail/side-rail-context.d.ts +1 -1
  186. package/dist/components/layout/side-rail/side-rail-context.js.map +1 -1
  187. package/dist/components/layout/side-rail/side-rail.d.ts.map +1 -1
  188. package/dist/components/layout/side-rail/side-rail.js +35 -34
  189. package/dist/components/layout/side-rail/side-rail.js.map +1 -1
  190. package/dist/components/layout/sidebar-nav/sidebar-nav.d.ts.map +1 -1
  191. package/dist/components/layout/sidebar-nav/sidebar-nav.js +23 -23
  192. package/dist/components/layout/sidebar-nav/sidebar-nav.js.map +1 -1
  193. package/dist/components/layout/split-layout/resize-controller-core-retry.d.ts.map +1 -1
  194. package/dist/components/layout/split-layout/resize-controller-core-retry.js +25 -7
  195. package/dist/components/layout/split-layout/resize-controller-core-retry.js.map +1 -1
  196. package/dist/components/layout/split-layout/resize-controller-core.d.ts.map +1 -1
  197. package/dist/components/layout/split-layout/resize-controller-core.js +25 -7
  198. package/dist/components/layout/split-layout/resize-controller-core.js.map +1 -1
  199. package/dist/components/layout/split-layout/split-layout.d.ts.map +1 -1
  200. package/dist/components/layout/split-layout/split-layout.js +2 -2
  201. package/dist/components/layout/split-layout/split-layout.js.map +1 -1
  202. package/dist/components/layout/status-bar/status-bar.d.ts +1 -1
  203. package/dist/components/layout/status-bar/status-bar.js +1 -1
  204. package/dist/components/layout/status-bar/status-bar.js.map +1 -1
  205. package/dist/components/layout/top-bar/top-bar.d.ts.map +1 -1
  206. package/dist/components/layout/top-bar/top-bar.js +7 -7
  207. package/dist/components/layout/top-bar/top-bar.js.map +1 -1
  208. package/dist/components/motion/presence.d.ts +2 -2
  209. package/dist/components/motion/presence.js.map +1 -1
  210. package/dist/components/theme/appearance-panel.d.ts +5 -5
  211. package/dist/components/theme/appearance-panel.js.map +1 -1
  212. package/dist/components/theme/lazy.d.ts +1 -1
  213. package/dist/components/theme/lazy.js.map +1 -1
  214. package/dist/components/theme/theme-catalogue-source.d.ts +2 -2
  215. package/dist/components/theme/theme-catalogue-source.js +2 -2
  216. package/dist/components/theme/theme-catalogue-source.js.map +1 -1
  217. package/dist/components/theme/theme-context.d.ts +2 -2
  218. package/dist/components/theme/theme-context.js +3 -3
  219. package/dist/components/theme/theme-context.js.map +1 -1
  220. package/dist/components/theme/theme-document.d.ts.map +1 -1
  221. package/dist/components/theme/theme-document.js +14 -9
  222. package/dist/components/theme/theme-document.js.map +1 -1
  223. package/dist/components/theme/theme-picker.d.ts +5 -5
  224. package/dist/components/theme/theme-picker.js.map +1 -1
  225. package/dist/components/theme/theme-provider-value.d.ts +0 -6
  226. package/dist/components/theme/theme-provider-value.d.ts.map +1 -1
  227. package/dist/components/theme/theme-provider-value.js +9 -3
  228. package/dist/components/theme/theme-provider-value.js.map +1 -1
  229. package/dist/components/theme/theme-script.d.ts +14 -0
  230. package/dist/components/theme/theme-script.d.ts.map +1 -1
  231. package/dist/components/theme/theme-script.js +1 -0
  232. package/dist/components/theme/theme-script.js.map +1 -1
  233. package/dist/components/theme/theme-state.d.ts +7 -7
  234. package/dist/components/theme/theme-state.js.map +1 -1
  235. package/dist/components/theme/theme-toggle.d.ts +1 -1
  236. package/dist/components/theme/theme-toggle.js.map +1 -1
  237. package/dist/components/ui/alert/alert.d.ts.map +1 -1
  238. package/dist/components/ui/alert/alert.js +4 -3
  239. package/dist/components/ui/alert/alert.js.map +1 -1
  240. package/dist/components/ui/alert-dialog/alert-dialog.d.ts +1 -1
  241. package/dist/components/ui/alert-dialog/alert-dialog.js +3 -3
  242. package/dist/components/ui/alert-dialog/alert-dialog.js.map +1 -1
  243. package/dist/components/ui/badge/badge.d.ts +1 -1
  244. package/dist/components/ui/badge/badge.js +2 -2
  245. package/dist/components/ui/badge/badge.js.map +1 -1
  246. package/dist/components/ui/board/board.d.ts.map +1 -1
  247. package/dist/components/ui/board/board.js +10 -6
  248. package/dist/components/ui/board/board.js.map +1 -1
  249. package/dist/components/ui/bubble/bubble.d.ts.map +1 -1
  250. package/dist/components/ui/bubble/bubble.js +6 -4
  251. package/dist/components/ui/bubble/bubble.js.map +1 -1
  252. package/dist/components/ui/button/button.js +2 -2
  253. package/dist/components/ui/button/button.js.map +1 -1
  254. package/dist/components/ui/button-group/button-group.d.ts +1 -1
  255. package/dist/components/ui/button-group/button-group.js +1 -1
  256. package/dist/components/ui/button-group/button-group.js.map +1 -1
  257. package/dist/components/ui/calendar/calendar.js +6 -6
  258. package/dist/components/ui/calendar/calendar.js.map +1 -1
  259. package/dist/components/ui/callout/callout.d.ts +4 -4
  260. package/dist/components/ui/callout/callout.js +4 -4
  261. package/dist/components/ui/callout/callout.js.map +1 -1
  262. package/dist/components/ui/card/card.d.ts +2 -2
  263. package/dist/components/ui/card/card.js +2 -2
  264. package/dist/components/ui/card/card.js.map +1 -1
  265. package/dist/components/ui/carousel/carousel.d.ts +4 -4
  266. package/dist/components/ui/carousel/carousel.d.ts.map +1 -1
  267. package/dist/components/ui/carousel/carousel.js.map +1 -1
  268. package/dist/components/ui/chart/chart-options.d.ts +7 -7
  269. package/dist/components/ui/chart/chart-options.js +9 -9
  270. package/dist/components/ui/chart/chart-options.js.map +1 -1
  271. package/dist/components/ui/chart/chart.d.ts.map +1 -1
  272. package/dist/components/ui/chart/chart.js +16 -7
  273. package/dist/components/ui/chart/chart.js.map +1 -1
  274. package/dist/components/ui/checkbox/checkbox.d.ts.map +1 -1
  275. package/dist/components/ui/checkbox/checkbox.js +8 -6
  276. package/dist/components/ui/checkbox/checkbox.js.map +1 -1
  277. package/dist/components/ui/code-block/code-block.d.ts.map +1 -1
  278. package/dist/components/ui/code-block/code-block.js +8 -6
  279. package/dist/components/ui/code-block/code-block.js.map +1 -1
  280. package/dist/components/ui/command/command.d.ts +4 -4
  281. package/dist/components/ui/command/command.js +4 -4
  282. package/dist/components/ui/command/command.js.map +1 -1
  283. package/dist/components/ui/context-menu/context-menu.d.ts +1 -1
  284. package/dist/components/ui/context-menu/context-menu.js.map +1 -1
  285. package/dist/components/ui/detail-panel/detail-panel.d.ts.map +1 -1
  286. package/dist/components/ui/detail-panel/detail-panel.js +13 -13
  287. package/dist/components/ui/detail-panel/detail-panel.js.map +1 -1
  288. package/dist/components/ui/dialog/dialog-layer.d.ts +0 -4
  289. package/dist/components/ui/dialog/dialog-layer.d.ts.map +1 -1
  290. package/dist/components/ui/dialog/dialog-layer.js +17 -1
  291. package/dist/components/ui/dialog/dialog-layer.js.map +1 -1
  292. package/dist/components/ui/dialog/dialog.d.ts.map +1 -1
  293. package/dist/components/ui/dialog/dialog.js +4 -3
  294. package/dist/components/ui/dialog/dialog.js.map +1 -1
  295. package/dist/components/ui/diff-block/diff-block.d.ts +6 -6
  296. package/dist/components/ui/diff-block/diff-block.js +3 -3
  297. package/dist/components/ui/diff-block/diff-block.js.map +1 -1
  298. package/dist/components/ui/drawer/drawer.d.ts +3 -3
  299. package/dist/components/ui/drawer/drawer.js +2 -2
  300. package/dist/components/ui/drawer/drawer.js.map +1 -1
  301. package/dist/components/ui/dropdown-menu/dropdown-menu.d.ts +5 -5
  302. package/dist/components/ui/dropdown-menu/dropdown-menu.js +3 -3
  303. package/dist/components/ui/dropdown-menu/dropdown-menu.js.map +1 -1
  304. package/dist/components/ui/dropdown-menu/menu-parts.d.ts +3 -3
  305. package/dist/components/ui/dropdown-menu/menu-parts.js +1 -1
  306. package/dist/components/ui/dropdown-menu/menu-parts.js.map +1 -1
  307. package/dist/components/ui/empty/empty-state.d.ts.map +1 -1
  308. package/dist/components/ui/empty/empty-state.js +33 -36
  309. package/dist/components/ui/empty/empty-state.js.map +1 -1
  310. package/dist/components/ui/empty/empty.d.ts +1 -1
  311. package/dist/components/ui/empty/empty.js +1 -1
  312. package/dist/components/ui/empty/empty.js.map +1 -1
  313. package/dist/components/ui/entity-icon/entity-icon.d.ts.map +1 -1
  314. package/dist/components/ui/entity-icon/entity-icon.js +7 -7
  315. package/dist/components/ui/entity-icon/entity-icon.js.map +1 -1
  316. package/dist/components/ui/field/field.d.ts.map +1 -1
  317. package/dist/components/ui/field/field.js +15 -15
  318. package/dist/components/ui/field/field.js.map +1 -1
  319. package/dist/components/ui/field/number-field.d.ts +1 -1
  320. package/dist/components/ui/field/number-field.js +1 -1
  321. package/dist/components/ui/field/number-field.js.map +1 -1
  322. package/dist/components/ui/hover-card/hover-card.d.ts +1 -1
  323. package/dist/components/ui/hover-card/hover-card.js.map +1 -1
  324. package/dist/components/ui/input-group/input-group.d.ts +1 -1
  325. package/dist/components/ui/input-group/input-group.js.map +1 -1
  326. package/dist/components/ui/input-otp/input-otp.d.ts +1 -1
  327. package/dist/components/ui/input-otp/input-otp.js.map +1 -1
  328. package/dist/components/ui/item/item.d.ts.map +1 -1
  329. package/dist/components/ui/item/item.js +26 -26
  330. package/dist/components/ui/item/item.js.map +1 -1
  331. package/dist/components/ui/kbd/kbd.d.ts +2 -2
  332. package/dist/components/ui/kbd/kbd.js +2 -2
  333. package/dist/components/ui/kbd/kbd.js.map +1 -1
  334. package/dist/components/ui/kbd/platform-modifier.d.ts +3 -3
  335. package/dist/components/ui/kbd/platform-modifier.js +3 -3
  336. package/dist/components/ui/kbd/platform-modifier.js.map +1 -1
  337. package/dist/components/ui/label/label.d.ts +1 -1
  338. package/dist/components/ui/label/label.js +1 -1
  339. package/dist/components/ui/label/label.js.map +1 -1
  340. package/dist/components/ui/marker/marker.d.ts.map +1 -1
  341. package/dist/components/ui/marker/marker.js +17 -19
  342. package/dist/components/ui/marker/marker.js.map +1 -1
  343. package/dist/components/ui/menubar/menubar.d.ts +2 -2
  344. package/dist/components/ui/menubar/menubar.js +1 -1
  345. package/dist/components/ui/menubar/menubar.js.map +1 -1
  346. package/dist/components/ui/message/message.d.ts.map +1 -1
  347. package/dist/components/ui/message/message.js +16 -18
  348. package/dist/components/ui/message/message.js.map +1 -1
  349. package/dist/components/ui/modal-dialog/modal-dialog.d.ts.map +1 -1
  350. package/dist/components/ui/modal-dialog/modal-dialog.js +7 -11
  351. package/dist/components/ui/modal-dialog/modal-dialog.js.map +1 -1
  352. package/dist/components/ui/native-select/native-select.d.ts +1 -1
  353. package/dist/components/ui/native-select/native-select.js.map +1 -1
  354. package/dist/components/ui/navigation-menu/navigation-menu.d.ts.map +1 -1
  355. package/dist/components/ui/navigation-menu/navigation-menu.js +5 -4
  356. package/dist/components/ui/navigation-menu/navigation-menu.js.map +1 -1
  357. package/dist/components/ui/pagination/pagination.js +2 -4
  358. package/dist/components/ui/pagination/pagination.js.map +1 -1
  359. package/dist/components/ui/popover/popover.d.ts.map +1 -1
  360. package/dist/components/ui/popover/popover.js +11 -4
  361. package/dist/components/ui/popover/popover.js.map +1 -1
  362. package/dist/components/ui/progress/progress.d.ts.map +1 -1
  363. package/dist/components/ui/progress/progress.js +6 -8
  364. package/dist/components/ui/progress/progress.js.map +1 -1
  365. package/dist/components/ui/questionnaire/questionnaire.d.ts.map +1 -1
  366. package/dist/components/ui/questionnaire/questionnaire.js +73 -73
  367. package/dist/components/ui/questionnaire/questionnaire.js.map +1 -1
  368. package/dist/components/ui/radio-group/radio-group.d.ts.map +1 -1
  369. package/dist/components/ui/radio-group/radio-group.js +12 -6
  370. package/dist/components/ui/radio-group/radio-group.js.map +1 -1
  371. package/dist/components/ui/resizable/resizable.d.ts +2 -2
  372. package/dist/components/ui/resizable/resizable.js +3 -3
  373. package/dist/components/ui/resizable/resizable.js.map +1 -1
  374. package/dist/components/ui/select/select.d.ts +3 -3
  375. package/dist/components/ui/select/select.js +1 -1
  376. package/dist/components/ui/select/select.js.map +1 -1
  377. package/dist/components/ui/sheet/sheet.d.ts.map +1 -1
  378. package/dist/components/ui/sheet/sheet.js +4 -3
  379. package/dist/components/ui/sheet/sheet.js.map +1 -1
  380. package/dist/components/ui/skeleton/skeleton.d.ts +1 -1
  381. package/dist/components/ui/skeleton/skeleton.js +1 -1
  382. package/dist/components/ui/skeleton/skeleton.js.map +1 -1
  383. package/dist/components/ui/slider/slider.d.ts +1 -1
  384. package/dist/components/ui/slider/slider.js.map +1 -1
  385. package/dist/components/ui/spinner/spinner.d.ts +1 -1
  386. package/dist/components/ui/spinner/spinner.js +1 -1
  387. package/dist/components/ui/spinner/spinner.js.map +1 -1
  388. package/dist/components/ui/status-chip/status-chip.d.ts +13 -13
  389. package/dist/components/ui/status-chip/status-chip.d.ts.map +1 -1
  390. package/dist/components/ui/status-chip/status-chip.js +11 -11
  391. package/dist/components/ui/status-chip/status-chip.js.map +1 -1
  392. package/dist/components/ui/switch/switch.d.ts.map +1 -1
  393. package/dist/components/ui/switch/switch.js +8 -6
  394. package/dist/components/ui/switch/switch.js.map +1 -1
  395. package/dist/components/ui/tabs/tabs.d.ts +4 -4
  396. package/dist/components/ui/tabs/tabs.js +4 -4
  397. package/dist/components/ui/tabs/tabs.js.map +1 -1
  398. package/dist/components/ui/textarea/textarea.d.ts +1 -1
  399. package/dist/components/ui/textarea/textarea.js +1 -1
  400. package/dist/components/ui/textarea/textarea.js.map +1 -1
  401. package/dist/components/ui/toast/toast.d.ts.map +1 -1
  402. package/dist/components/ui/toast/toast.js +13 -15
  403. package/dist/components/ui/toast/toast.js.map +1 -1
  404. package/dist/components/ui/toggle/toggle.d.ts +1 -1
  405. package/dist/components/ui/toggle/toggle.js +1 -1
  406. package/dist/components/ui/toggle/toggle.js.map +1 -1
  407. package/dist/components/ui/tooltip/deferred-tooltip.d.ts +51 -0
  408. package/dist/components/ui/tooltip/deferred-tooltip.d.ts.map +1 -0
  409. package/dist/components/ui/tooltip/deferred-tooltip.js +103 -0
  410. package/dist/components/ui/tooltip/deferred-tooltip.js.map +1 -0
  411. package/dist/components/ui/tooltip/index.d.ts +1 -0
  412. package/dist/components/ui/tooltip/index.d.ts.map +1 -1
  413. package/dist/components/ui/tooltip/index.js +3 -1
  414. package/dist/components/ui/tooltip/tooltip.d.ts.map +1 -1
  415. package/dist/components/ui/tooltip/tooltip.js +6 -5
  416. package/dist/components/ui/tooltip/tooltip.js.map +1 -1
  417. package/dist/components/ui/trace/trace.d.ts.map +1 -1
  418. package/dist/components/ui/trace/trace.js +17 -17
  419. package/dist/components/ui/trace/trace.js.map +1 -1
  420. package/dist/components/ui/typography/typography.d.ts +3 -3
  421. package/dist/components/ui/typography/typography.js +5 -5
  422. package/dist/components/ui/typography/typography.js.map +1 -1
  423. package/dist/index.d.ts +1 -0
  424. package/dist/index.d.ts.map +1 -1
  425. package/dist/index.js +5 -3
  426. package/dist/lib/accent-presets.d.ts +1 -1
  427. package/dist/lib/accent-presets.js.map +1 -1
  428. package/dist/lib/accent-roles.d.ts +2 -2
  429. package/dist/lib/accent-roles.js +2 -2
  430. package/dist/lib/accent-roles.js.map +1 -1
  431. package/dist/lib/appearance-font-settings.d.ts.map +1 -1
  432. package/dist/lib/appearance-font-settings.js +15 -7
  433. package/dist/lib/appearance-font-settings.js.map +1 -1
  434. package/dist/lib/create-poll.d.ts +39 -0
  435. package/dist/lib/create-poll.d.ts.map +1 -0
  436. package/dist/lib/create-poll.js +116 -0
  437. package/dist/lib/create-poll.js.map +1 -0
  438. package/dist/lib/font-zoom.d.ts +1 -1
  439. package/dist/lib/font-zoom.js +1 -1
  440. package/dist/lib/font-zoom.js.map +1 -1
  441. package/dist/lib/keyed-rows.d.ts +2 -1
  442. package/dist/lib/keyed-rows.d.ts.map +1 -1
  443. package/dist/lib/keyed-rows.js +3 -2
  444. package/dist/lib/keyed-rows.js.map +1 -1
  445. package/dist/lib/overlay.d.ts +5 -5
  446. package/dist/lib/overlay.js +5 -5
  447. package/dist/lib/overlay.js.map +1 -1
  448. package/dist/lib/preference-store.d.ts +2 -2
  449. package/dist/lib/preference-store.js +2 -2
  450. package/dist/lib/preference-store.js.map +1 -1
  451. package/dist/lib/safe-script.d.ts +2 -2
  452. package/dist/lib/safe-script.js +2 -2
  453. package/dist/lib/safe-script.js.map +1 -1
  454. package/dist/lib/scroll-geometry.d.ts +1 -1
  455. package/dist/lib/scroll-geometry.js +1 -1
  456. package/dist/lib/scroll-geometry.js.map +1 -1
  457. package/dist/lib/text.d.ts +1 -1
  458. package/dist/lib/text.js +1 -1
  459. package/dist/lib/text.js.map +1 -1
  460. package/dist/lib/theme-accents.js +3 -3
  461. package/dist/lib/theme-accents.js.map +1 -1
  462. package/dist/lib/theme-css.js.map +1 -1
  463. package/dist/lib/theme-defaults.d.ts +4 -4
  464. package/dist/lib/theme-defaults.js +4 -4
  465. package/dist/lib/theme-defaults.js.map +1 -1
  466. package/dist/lib/theme-engine-light.js.map +1 -1
  467. package/dist/lib/theme-engine.d.ts +2 -2
  468. package/dist/lib/theme-engine.js +2 -2
  469. package/dist/lib/theme-engine.js.map +1 -1
  470. package/dist/lib/theme-projection.d.ts +1 -1
  471. package/dist/lib/theme-projection.js +2 -2
  472. package/dist/lib/theme-projection.js.map +1 -1
  473. package/dist/lib/theme-records.d.ts +2 -2
  474. package/dist/lib/theme-records.js +2 -2
  475. package/dist/lib/theme-records.js.map +1 -1
  476. package/dist/lib/theme-types.d.ts +1 -1
  477. package/dist/lib/theme-types.js.map +1 -1
  478. package/dist/lib/themes.d.ts +13 -13
  479. package/dist/lib/themes.js +13 -13
  480. package/dist/lib/themes.js.map +1 -1
  481. package/dist/lib/tokens.d.ts +2 -2
  482. package/dist/lib/tokens.js +1 -1
  483. package/dist/lib/tokens.js.map +1 -1
  484. package/dist/lib/tooltip-focus-gate.d.ts +2 -2
  485. package/dist/lib/tooltip-focus-gate.js +2 -2
  486. package/dist/lib/tooltip-focus-gate.js.map +1 -1
  487. package/dist/lib/utils.d.ts +1 -1
  488. package/dist/lib/utils.js +1 -1
  489. package/dist/lib/utils.js.map +1 -1
  490. package/dist/lib/variants.d.ts +4 -4
  491. package/dist/lib/variants.js +1 -1
  492. package/dist/lib/variants.js.map +1 -1
  493. package/dist/lib/version-notes.d.ts +4 -4
  494. package/dist/lib/version-notes.js +4 -4
  495. package/dist/lib/version-notes.js.map +1 -1
  496. package/dist/lint.js.map +1 -1
  497. package/dist/r/account-menu.json +1 -0
  498. package/dist/r/lib.json +5 -0
  499. package/dist/r/registry.json +11 -0
  500. package/dist/r/src/components/composites/account-menu/account-menu.tsx +22 -2
  501. package/dist/r/src/components/composites/action-button/action-button.tsx +124 -78
  502. package/dist/r/src/components/composites/appearance-editor/accent-swatch-groups.tsx +3 -3
  503. package/dist/r/src/components/composites/appearance-editor/appearance-choices.tsx +3 -3
  504. package/dist/r/src/components/composites/appearance-editor/appearance-editor.tsx +15 -9
  505. package/dist/r/src/components/composites/appearance-editor/appearance-rows.tsx +3 -1
  506. package/dist/r/src/components/composites/appearance-editor/appearance-types.ts +7 -7
  507. package/dist/r/src/components/composites/appearance-editor/theme-preview.tsx +1 -1
  508. package/dist/r/src/components/composites/catalog-browser/catalog-browser.tsx +6 -2
  509. package/dist/r/src/components/composites/catalog-browser/catalog-detail.tsx +15 -6
  510. package/dist/r/src/components/composites/chain-of-thought/chain-of-thought.tsx +4 -4
  511. package/dist/r/src/components/composites/chat/chat.tsx +15 -9
  512. package/dist/r/src/components/composites/checkpoint/checkpoint-model.ts +3 -3
  513. package/dist/r/src/components/composites/checkpoint/checkpoint.tsx +2 -2
  514. package/dist/r/src/components/composites/confirmation/confirmation.tsx +8 -4
  515. package/dist/r/src/components/composites/context/context.tsx +2 -2
  516. package/dist/r/src/components/composites/file-tree/build-file-tree.ts +1 -1
  517. package/dist/r/src/components/composites/file-tree/file-tree.tsx +16 -2
  518. package/dist/r/src/components/composites/icon-picker/icon-picker.tsx +1 -1
  519. package/dist/r/src/components/composites/inline-citation/citation.ts +1 -1
  520. package/dist/r/src/components/composites/inline-citation/inline-citation.tsx +2 -2
  521. package/dist/r/src/components/composites/list-row/list-row-control.tsx +31 -22
  522. package/dist/r/src/components/composites/list-row/list-row.tsx +69 -73
  523. package/dist/r/src/components/composites/message-scroller/message-scroller.tsx +1 -1
  524. package/dist/r/src/components/composites/model-selector/model-selector.tsx +4 -4
  525. package/dist/r/src/components/composites/model-selector/models.ts +2 -2
  526. package/dist/r/src/components/composites/plan/plan.tsx +19 -11
  527. package/dist/r/src/components/composites/queue/queue.tsx +5 -3
  528. package/dist/r/src/components/composites/reasoning/reasoning.tsx +4 -4
  529. package/dist/r/src/components/composites/settings/settings-navigation.tsx +57 -17
  530. package/dist/r/src/components/composites/settings/settings.tsx +14 -6
  531. package/dist/r/src/components/composites/sources/source.ts +1 -1
  532. package/dist/r/src/components/composites/sources/sources.tsx +2 -2
  533. package/dist/r/src/components/composites/stack-trace/parse-stack-trace.ts +7 -7
  534. package/dist/r/src/components/composites/stack-trace/stack-trace.tsx +3 -3
  535. package/dist/r/src/components/composites/stat/stat.tsx +20 -16
  536. package/dist/r/src/components/composites/subagent/subagent.tsx +6 -4
  537. package/dist/r/src/components/composites/task/task.tsx +1 -1
  538. package/dist/r/src/components/composites/terminal/ansi.ts +3 -3
  539. package/dist/r/src/components/composites/terminal/terminal-model.ts +3 -3
  540. package/dist/r/src/components/composites/terminal/terminal.tsx +24 -12
  541. package/dist/r/src/components/composites/test-results/test-results-model.ts +4 -4
  542. package/dist/r/src/components/composites/test-results/test-results.tsx +1 -1
  543. package/dist/r/src/components/composites/tool/tool.tsx +4 -4
  544. package/dist/r/src/components/composites/tree/tree.tsx +31 -15
  545. package/dist/r/src/components/composites/update-dialog/channel-control.tsx +17 -8
  546. package/dist/r/src/components/composites/update-dialog/index.ts +1 -0
  547. package/dist/r/src/components/composites/update-dialog/update-dialog.tsx +7 -7
  548. package/dist/r/src/components/composites/workspace-mark/workspace-mark.tsx +15 -12
  549. package/dist/r/src/components/conversation/busy-send-button.tsx +6 -2
  550. package/dist/r/src/components/conversation/composer-menu.tsx +3 -3
  551. package/dist/r/src/components/conversation/conversation-avatar.tsx +1 -1
  552. package/dist/r/src/components/conversation/conversation-pane.tsx +8 -5
  553. package/dist/r/src/components/conversation/conversation-surface.tsx +2 -2
  554. package/dist/r/src/components/conversation/internal/chat-composer-shell.tsx +18 -12
  555. package/dist/r/src/components/conversation/message-composer.tsx +4 -6
  556. package/dist/r/src/components/conversation/message-row.tsx +34 -26
  557. package/dist/r/src/components/conversation/scroll-follow-core.ts +8 -8
  558. package/dist/r/src/components/conversation/scroll-follow.ts +24 -8
  559. package/dist/r/src/components/conversation/thread-panel.tsx +7 -3
  560. package/dist/r/src/components/conversation/transcript-composition.tsx +4 -2
  561. package/dist/r/src/components/layout/app-shell/app-shell.tsx +1 -1
  562. package/dist/r/src/components/layout/app-shell/skip-link.tsx +3 -2
  563. package/dist/r/src/components/layout/page/page.tsx +15 -11
  564. package/dist/r/src/components/layout/panel/panel.tsx +1 -1
  565. package/dist/r/src/components/layout/pixel-resize-handle/pixel-resize-handle.tsx +21 -1
  566. package/dist/r/src/components/layout/side-rail/side-rail-context.ts +1 -1
  567. package/dist/r/src/components/layout/side-rail/side-rail.tsx +38 -22
  568. package/dist/r/src/components/layout/sidebar-nav/sidebar-nav.tsx +22 -16
  569. package/dist/r/src/components/layout/split-layout/resize-controller-core-retry.tsx +25 -7
  570. package/dist/r/src/components/layout/split-layout/resize-controller-core.tsx +25 -7
  571. package/dist/r/src/components/layout/split-layout/split-layout.tsx +6 -2
  572. package/dist/r/src/components/layout/status-bar/status-bar.tsx +1 -1
  573. package/dist/r/src/components/layout/top-bar/top-bar.tsx +8 -6
  574. package/dist/r/src/components/motion/presence.tsx +2 -2
  575. package/dist/r/src/components/theme/appearance-panel.tsx +5 -5
  576. package/dist/r/src/components/theme/lazy.ts +1 -1
  577. package/dist/r/src/components/theme/theme-catalogue-source.ts +2 -2
  578. package/dist/r/src/components/theme/theme-context.ts +3 -3
  579. package/dist/r/src/components/theme/theme-document.ts +22 -11
  580. package/dist/r/src/components/theme/theme-picker.tsx +5 -5
  581. package/dist/r/src/components/theme/theme-provider-value.ts +15 -3
  582. package/dist/r/src/components/theme/theme-script.ts +20 -0
  583. package/dist/r/src/components/theme/theme-state.ts +7 -7
  584. package/dist/r/src/components/theme/theme-toggle.tsx +1 -1
  585. package/dist/r/src/components/ui/alert/alert.tsx +4 -3
  586. package/dist/r/src/components/ui/alert-dialog/alert-dialog.tsx +4 -4
  587. package/dist/r/src/components/ui/badge/badge.tsx +2 -2
  588. package/dist/r/src/components/ui/board/board.tsx +17 -5
  589. package/dist/r/src/components/ui/bubble/bubble.tsx +6 -4
  590. package/dist/r/src/components/ui/button/button.tsx +2 -2
  591. package/dist/r/src/components/ui/button-group/button-group.tsx +1 -1
  592. package/dist/r/src/components/ui/calendar/calendar.tsx +2 -2
  593. package/dist/r/src/components/ui/callout/callout.tsx +4 -4
  594. package/dist/r/src/components/ui/card/card.tsx +2 -2
  595. package/dist/r/src/components/ui/carousel/carousel.tsx +6 -6
  596. package/dist/r/src/components/ui/chart/chart-options.ts +9 -9
  597. package/dist/r/src/components/ui/chart/chart.tsx +14 -1
  598. package/dist/r/src/components/ui/checkbox/checkbox.tsx +9 -6
  599. package/dist/r/src/components/ui/code-block/code-block.tsx +14 -7
  600. package/dist/r/src/components/ui/command/command.tsx +7 -7
  601. package/dist/r/src/components/ui/context-menu/context-menu.tsx +1 -1
  602. package/dist/r/src/components/ui/detail-panel/detail-panel.tsx +5 -3
  603. package/dist/r/src/components/ui/dialog/dialog-layer.tsx +27 -1
  604. package/dist/r/src/components/ui/dialog/dialog.tsx +4 -3
  605. package/dist/r/src/components/ui/diff-block/diff-block.tsx +6 -6
  606. package/dist/r/src/components/ui/drawer/drawer.tsx +3 -3
  607. package/dist/r/src/components/ui/dropdown-menu/dropdown-menu.tsx +6 -6
  608. package/dist/r/src/components/ui/dropdown-menu/menu-parts.tsx +5 -5
  609. package/dist/r/src/components/ui/empty/empty-state.tsx +23 -18
  610. package/dist/r/src/components/ui/empty/empty.tsx +1 -1
  611. package/dist/r/src/components/ui/entity-icon/entity-icon.tsx +5 -1
  612. package/dist/r/src/components/ui/field/field.tsx +15 -7
  613. package/dist/r/src/components/ui/field/number-field.tsx +1 -1
  614. package/dist/r/src/components/ui/hover-card/hover-card.tsx +1 -1
  615. package/dist/r/src/components/ui/input-group/input-group.tsx +1 -1
  616. package/dist/r/src/components/ui/input-otp/input-otp.tsx +1 -1
  617. package/dist/r/src/components/ui/item/item.tsx +24 -18
  618. package/dist/r/src/components/ui/kbd/kbd.tsx +2 -2
  619. package/dist/r/src/components/ui/kbd/platform-modifier.ts +3 -3
  620. package/dist/r/src/components/ui/label/label.tsx +1 -1
  621. package/dist/r/src/components/ui/marker/marker.tsx +9 -5
  622. package/dist/r/src/components/ui/menubar/menubar.tsx +2 -2
  623. package/dist/r/src/components/ui/message/message.tsx +14 -13
  624. package/dist/r/src/components/ui/modal-dialog/modal-dialog.tsx +9 -5
  625. package/dist/r/src/components/ui/native-select/native-select.tsx +1 -1
  626. package/dist/r/src/components/ui/navigation-menu/navigation-menu.tsx +5 -4
  627. package/dist/r/src/components/ui/pagination/pagination.tsx +1 -1
  628. package/dist/r/src/components/ui/popover/popover.tsx +4 -2
  629. package/dist/r/src/components/ui/progress/progress.tsx +5 -3
  630. package/dist/r/src/components/ui/questionnaire/questionnaire.tsx +10 -5
  631. package/dist/r/src/components/ui/radio-group/radio-group.tsx +9 -6
  632. package/dist/r/src/components/ui/resizable/resizable.tsx +5 -5
  633. package/dist/r/src/components/ui/select/select.tsx +4 -4
  634. package/dist/r/src/components/ui/sheet/sheet.tsx +4 -3
  635. package/dist/r/src/components/ui/skeleton/skeleton.tsx +1 -1
  636. package/dist/r/src/components/ui/slider/slider.tsx +1 -1
  637. package/dist/r/src/components/ui/spinner/spinner.tsx +1 -1
  638. package/dist/r/src/components/ui/status-chip/status-chip.tsx +13 -13
  639. package/dist/r/src/components/ui/switch/switch.tsx +9 -6
  640. package/dist/r/src/components/ui/tabs/tabs.tsx +4 -4
  641. package/dist/r/src/components/ui/textarea/textarea.tsx +1 -1
  642. package/dist/r/src/components/ui/toast/toast.tsx +6 -4
  643. package/dist/r/src/components/ui/toggle/toggle.tsx +1 -1
  644. package/dist/r/src/components/ui/tooltip/deferred-tooltip.tsx +131 -0
  645. package/dist/r/src/components/ui/tooltip/index.ts +1 -0
  646. package/dist/r/src/components/ui/tooltip/tooltip.tsx +6 -4
  647. package/dist/r/src/components/ui/trace/trace.tsx +13 -9
  648. package/dist/r/src/components/ui/typography/typography.tsx +5 -5
  649. package/dist/r/src/lib/accent-presets.ts +1 -1
  650. package/dist/r/src/lib/accent-roles.ts +2 -2
  651. package/dist/r/src/lib/appearance-font-settings.ts +18 -7
  652. package/dist/r/src/lib/create-poll.ts +150 -0
  653. package/dist/r/src/lib/font-zoom.ts +3 -3
  654. package/dist/r/src/lib/keyed-rows.ts +3 -2
  655. package/dist/r/src/lib/overlay.ts +5 -5
  656. package/dist/r/src/lib/preference-store.ts +2 -2
  657. package/dist/r/src/lib/safe-script.ts +2 -2
  658. package/dist/r/src/lib/scroll-geometry.ts +1 -1
  659. package/dist/r/src/lib/text.ts +1 -1
  660. package/dist/r/src/lib/theme-accents.ts +3 -3
  661. package/dist/r/src/lib/theme-css.ts +2 -2
  662. package/dist/r/src/lib/theme-defaults.ts +4 -4
  663. package/dist/r/src/lib/theme-engine-light.ts +2 -2
  664. package/dist/r/src/lib/theme-engine.ts +2 -2
  665. package/dist/r/src/lib/theme-projection.ts +2 -2
  666. package/dist/r/src/lib/theme-records.ts +2 -2
  667. package/dist/r/src/lib/theme-types.ts +1 -1
  668. package/dist/r/src/lib/themes.ts +14 -14
  669. package/dist/r/src/lib/tokens.ts +2 -2
  670. package/dist/r/src/lib/tooltip-focus-gate.ts +11 -11
  671. package/dist/r/src/lib/utils.ts +1 -1
  672. package/dist/r/src/lib/variants.ts +4 -4
  673. package/dist/r/src/lib/version-notes.ts +4 -4
  674. package/dist/r/src/styles/base.css +12 -43
  675. package/dist/r/src/styles/fonts.css +1 -1
  676. package/dist/r/src/styles/theme.css +35 -35
  677. package/dist/r/tooltip.json +5 -0
  678. package/package.json +2 -1
  679. package/registry.json +11 -0
  680. package/src/components/composites/account-menu/account-menu.tsx +22 -2
  681. package/src/components/composites/action-button/action-button.tsx +124 -78
  682. package/src/components/composites/appearance-editor/accent-swatch-groups.tsx +3 -3
  683. package/src/components/composites/appearance-editor/appearance-choices.tsx +3 -3
  684. package/src/components/composites/appearance-editor/appearance-editor.tsx +15 -9
  685. package/src/components/composites/appearance-editor/appearance-rows.tsx +3 -1
  686. package/src/components/composites/appearance-editor/appearance-types.ts +7 -7
  687. package/src/components/composites/appearance-editor/theme-preview.tsx +1 -1
  688. package/src/components/composites/catalog-browser/catalog-browser.tsx +6 -2
  689. package/src/components/composites/catalog-browser/catalog-detail.tsx +15 -6
  690. package/src/components/composites/chain-of-thought/chain-of-thought.tsx +4 -4
  691. package/src/components/composites/chat/chat.tsx +15 -9
  692. package/src/components/composites/checkpoint/checkpoint-model.ts +3 -3
  693. package/src/components/composites/checkpoint/checkpoint.tsx +2 -2
  694. package/src/components/composites/confirmation/confirmation.tsx +8 -4
  695. package/src/components/composites/context/context.tsx +2 -2
  696. package/src/components/composites/file-tree/build-file-tree.ts +1 -1
  697. package/src/components/composites/file-tree/file-tree.tsx +16 -2
  698. package/src/components/composites/icon-picker/icon-picker.tsx +1 -1
  699. package/src/components/composites/inline-citation/citation.ts +1 -1
  700. package/src/components/composites/inline-citation/inline-citation.tsx +2 -2
  701. package/src/components/composites/list-row/list-row-control.tsx +31 -22
  702. package/src/components/composites/list-row/list-row.tsx +69 -73
  703. package/src/components/composites/message-scroller/message-scroller.tsx +1 -1
  704. package/src/components/composites/model-selector/model-selector.tsx +4 -4
  705. package/src/components/composites/model-selector/models.ts +2 -2
  706. package/src/components/composites/plan/plan.tsx +19 -11
  707. package/src/components/composites/queue/queue.tsx +5 -3
  708. package/src/components/composites/reasoning/reasoning.tsx +4 -4
  709. package/src/components/composites/settings/settings-navigation.tsx +57 -17
  710. package/src/components/composites/settings/settings.tsx +14 -6
  711. package/src/components/composites/sources/source.ts +1 -1
  712. package/src/components/composites/sources/sources.tsx +2 -2
  713. package/src/components/composites/stack-trace/parse-stack-trace.ts +7 -7
  714. package/src/components/composites/stack-trace/stack-trace.tsx +3 -3
  715. package/src/components/composites/stat/stat.tsx +20 -16
  716. package/src/components/composites/subagent/subagent.tsx +6 -4
  717. package/src/components/composites/task/task.tsx +1 -1
  718. package/src/components/composites/terminal/ansi.ts +3 -3
  719. package/src/components/composites/terminal/terminal-model.ts +3 -3
  720. package/src/components/composites/terminal/terminal.tsx +24 -12
  721. package/src/components/composites/test-results/test-results-model.ts +4 -4
  722. package/src/components/composites/test-results/test-results.tsx +1 -1
  723. package/src/components/composites/tool/tool.tsx +4 -4
  724. package/src/components/composites/tree/tree.tsx +31 -15
  725. package/src/components/composites/update-dialog/channel-control.tsx +17 -8
  726. package/src/components/composites/update-dialog/index.ts +1 -0
  727. package/src/components/composites/update-dialog/update-dialog.tsx +7 -7
  728. package/src/components/composites/workspace-mark/workspace-mark.tsx +15 -12
  729. package/src/components/conversation/busy-send-button.tsx +6 -2
  730. package/src/components/conversation/composer-menu.tsx +3 -3
  731. package/src/components/conversation/conversation-avatar.tsx +1 -1
  732. package/src/components/conversation/conversation-pane.tsx +8 -5
  733. package/src/components/conversation/conversation-surface.tsx +2 -2
  734. package/src/components/conversation/internal/chat-composer-shell.tsx +18 -12
  735. package/src/components/conversation/message-composer.tsx +4 -6
  736. package/src/components/conversation/message-row.tsx +34 -26
  737. package/src/components/conversation/scroll-follow-core.ts +8 -8
  738. package/src/components/conversation/scroll-follow.ts +24 -8
  739. package/src/components/conversation/thread-panel.tsx +7 -3
  740. package/src/components/conversation/transcript-composition.tsx +4 -2
  741. package/src/components/layout/app-shell/app-shell.tsx +1 -1
  742. package/src/components/layout/app-shell/skip-link.tsx +3 -2
  743. package/src/components/layout/page/page.tsx +15 -11
  744. package/src/components/layout/panel/panel.tsx +1 -1
  745. package/src/components/layout/pixel-resize-handle/pixel-resize-handle.tsx +21 -1
  746. package/src/components/layout/side-rail/side-rail-context.ts +1 -1
  747. package/src/components/layout/side-rail/side-rail.tsx +38 -22
  748. package/src/components/layout/sidebar-nav/sidebar-nav.tsx +22 -16
  749. package/src/components/layout/split-layout/resize-controller-core-retry.tsx +25 -7
  750. package/src/components/layout/split-layout/resize-controller-core.tsx +25 -7
  751. package/src/components/layout/split-layout/split-layout.tsx +6 -2
  752. package/src/components/layout/status-bar/status-bar.tsx +1 -1
  753. package/src/components/layout/top-bar/top-bar.tsx +8 -6
  754. package/src/components/motion/presence.tsx +2 -2
  755. package/src/components/theme/appearance-panel.tsx +5 -5
  756. package/src/components/theme/lazy.ts +1 -1
  757. package/src/components/theme/theme-catalogue-source.ts +2 -2
  758. package/src/components/theme/theme-context.ts +3 -3
  759. package/src/components/theme/theme-document.ts +22 -11
  760. package/src/components/theme/theme-picker.tsx +5 -5
  761. package/src/components/theme/theme-provider-value.ts +15 -3
  762. package/src/components/theme/theme-script.ts +20 -0
  763. package/src/components/theme/theme-state.ts +7 -7
  764. package/src/components/theme/theme-toggle.tsx +1 -1
  765. package/src/components/ui/alert/alert.tsx +4 -3
  766. package/src/components/ui/alert-dialog/alert-dialog.tsx +4 -4
  767. package/src/components/ui/badge/badge.tsx +2 -2
  768. package/src/components/ui/board/board.tsx +17 -5
  769. package/src/components/ui/bubble/bubble.tsx +6 -4
  770. package/src/components/ui/button/button.tsx +2 -2
  771. package/src/components/ui/button-group/button-group.tsx +1 -1
  772. package/src/components/ui/calendar/calendar.tsx +2 -2
  773. package/src/components/ui/callout/callout.tsx +4 -4
  774. package/src/components/ui/card/card.tsx +2 -2
  775. package/src/components/ui/carousel/carousel.tsx +6 -6
  776. package/src/components/ui/chart/chart-options.ts +9 -9
  777. package/src/components/ui/chart/chart.tsx +14 -1
  778. package/src/components/ui/checkbox/checkbox.tsx +9 -6
  779. package/src/components/ui/code-block/code-block.tsx +14 -7
  780. package/src/components/ui/command/command.tsx +7 -7
  781. package/src/components/ui/context-menu/context-menu.tsx +1 -1
  782. package/src/components/ui/detail-panel/detail-panel.tsx +5 -3
  783. package/src/components/ui/dialog/dialog-layer.tsx +27 -1
  784. package/src/components/ui/dialog/dialog.tsx +4 -3
  785. package/src/components/ui/diff-block/diff-block.tsx +6 -6
  786. package/src/components/ui/drawer/drawer.tsx +3 -3
  787. package/src/components/ui/dropdown-menu/dropdown-menu.tsx +6 -6
  788. package/src/components/ui/dropdown-menu/menu-parts.tsx +5 -5
  789. package/src/components/ui/empty/empty-state.tsx +23 -18
  790. package/src/components/ui/empty/empty.tsx +1 -1
  791. package/src/components/ui/entity-icon/entity-icon.tsx +5 -1
  792. package/src/components/ui/field/field.tsx +15 -7
  793. package/src/components/ui/field/number-field.tsx +1 -1
  794. package/src/components/ui/hover-card/hover-card.tsx +1 -1
  795. package/src/components/ui/input-group/input-group.tsx +1 -1
  796. package/src/components/ui/input-otp/input-otp.tsx +1 -1
  797. package/src/components/ui/item/item.tsx +24 -18
  798. package/src/components/ui/kbd/kbd.tsx +2 -2
  799. package/src/components/ui/kbd/platform-modifier.ts +3 -3
  800. package/src/components/ui/label/label.tsx +1 -1
  801. package/src/components/ui/marker/marker.tsx +9 -5
  802. package/src/components/ui/menubar/menubar.tsx +2 -2
  803. package/src/components/ui/message/message.tsx +14 -13
  804. package/src/components/ui/modal-dialog/modal-dialog.tsx +9 -5
  805. package/src/components/ui/native-select/native-select.tsx +1 -1
  806. package/src/components/ui/navigation-menu/navigation-menu.tsx +5 -4
  807. package/src/components/ui/pagination/pagination.tsx +1 -1
  808. package/src/components/ui/popover/popover.tsx +4 -2
  809. package/src/components/ui/progress/progress.tsx +5 -3
  810. package/src/components/ui/questionnaire/questionnaire.tsx +10 -5
  811. package/src/components/ui/radio-group/radio-group.tsx +9 -6
  812. package/src/components/ui/resizable/resizable.tsx +5 -5
  813. package/src/components/ui/select/select.tsx +4 -4
  814. package/src/components/ui/sheet/sheet.tsx +4 -3
  815. package/src/components/ui/skeleton/skeleton.tsx +1 -1
  816. package/src/components/ui/slider/slider.tsx +1 -1
  817. package/src/components/ui/spinner/spinner.tsx +1 -1
  818. package/src/components/ui/status-chip/status-chip.tsx +13 -13
  819. package/src/components/ui/switch/switch.tsx +9 -6
  820. package/src/components/ui/tabs/tabs.tsx +4 -4
  821. package/src/components/ui/textarea/textarea.tsx +1 -1
  822. package/src/components/ui/toast/toast.tsx +6 -4
  823. package/src/components/ui/toggle/toggle.tsx +1 -1
  824. package/src/components/ui/tooltip/deferred-tooltip.tsx +131 -0
  825. package/src/components/ui/tooltip/index.ts +1 -0
  826. package/src/components/ui/tooltip/tooltip.tsx +6 -4
  827. package/src/components/ui/trace/trace.tsx +13 -9
  828. package/src/components/ui/typography/typography.tsx +5 -5
  829. package/src/index.ts +1 -0
  830. package/src/lib/accent-presets.ts +1 -1
  831. package/src/lib/accent-roles.ts +2 -2
  832. package/src/lib/appearance-font-settings.ts +18 -7
  833. package/src/lib/create-poll.ts +150 -0
  834. package/src/lib/font-zoom.ts +3 -3
  835. package/src/lib/keyed-rows.ts +3 -2
  836. package/src/lib/overlay.ts +5 -5
  837. package/src/lib/preference-store.ts +2 -2
  838. package/src/lib/safe-script.ts +2 -2
  839. package/src/lib/scroll-geometry.ts +1 -1
  840. package/src/lib/text.ts +1 -1
  841. package/src/lib/theme-accents.ts +3 -3
  842. package/src/lib/theme-css.ts +2 -2
  843. package/src/lib/theme-defaults.ts +4 -4
  844. package/src/lib/theme-engine-light.ts +2 -2
  845. package/src/lib/theme-engine.ts +2 -2
  846. package/src/lib/theme-projection.ts +2 -2
  847. package/src/lib/theme-records.ts +2 -2
  848. package/src/lib/theme-types.ts +1 -1
  849. package/src/lib/themes.ts +14 -14
  850. package/src/lib/tokens.ts +2 -2
  851. package/src/lib/tooltip-focus-gate.ts +11 -11
  852. package/src/lib/utils.ts +1 -1
  853. package/src/lib/variants.ts +4 -4
  854. package/src/lib/version-notes.ts +4 -4
  855. package/src/lint/index.ts +1 -1
  856. package/src/styles/base.css +12 -43
  857. package/src/styles/fonts.css +1 -1
  858. package/src/styles/theme.css +35 -35
  859. package/src/styles/themes/aardvark-blue.css +98 -0
  860. package/src/styles/themes/aardvark-ink.css +98 -0
  861. package/src/styles/themes/adea-dark-colorblind.css +98 -0
  862. package/src/styles/themes/adea-dark-high-contrast.css +98 -0
  863. package/src/styles/themes/adea-dark.css +47 -0
  864. package/src/styles/themes/adea-light-colorblind.css +141 -0
  865. package/src/styles/themes/adea-light-high-contrast.css +141 -0
  866. package/src/styles/themes/adea-light.css +47 -0
  867. package/src/styles/themes/ayu-light.css +141 -0
  868. package/src/styles/themes/ayu-mirage.css +98 -0
  869. package/src/styles/themes/ayu.css +98 -0
  870. package/src/styles/themes/catppuccin-frappe.css +98 -0
  871. package/src/styles/themes/catppuccin-latte.css +141 -0
  872. package/src/styles/themes/catppuccin-macchiato.css +98 -0
  873. package/src/styles/themes/catppuccin-mocha.css +98 -0
  874. package/src/styles/themes/dracula.css +98 -0
  875. package/src/styles/themes/everforest-dark.css +98 -0
  876. package/src/styles/themes/everforest-light.css +141 -0
  877. package/src/styles/themes/gruvbox-dark.css +98 -0
  878. package/src/styles/themes/gruvbox-light.css +141 -0
  879. package/src/styles/themes/kanagawa.css +98 -0
  880. package/src/styles/themes/monokai.css +98 -0
  881. package/src/styles/themes/nord-light.css +141 -0
  882. package/src/styles/themes/nord.css +98 -0
  883. package/src/styles/themes/one-dark.css +98 -0
  884. package/src/styles/themes/rosepine-dawn.css +141 -0
  885. package/src/styles/themes/rosepine-moon.css +98 -0
  886. package/src/styles/themes/rosepine.css +98 -0
  887. package/src/styles/themes/solarized-dark.css +98 -0
  888. package/src/styles/themes/solarized-light.css +141 -0
  889. package/src/styles/themes/tokyonight-day.css +141 -0
  890. package/src/styles/themes/tokyonight-night.css +98 -0
  891. package/src/styles/themes/tokyonight-storm.css +98 -0
  892. package/src/styles/themes/vesper.css +98 -0
@@ -1 +1 @@
1
- {"version":3,"file":"theme-catalogue-source.js","names":[],"sources":["../../../src/components/theme/theme-catalogue-source.ts"],"sourcesContent":["import { createSignal } from 'solid-js'\nimport type { ThemeEngine } from '#lib/theme-engine'\nimport { createLightThemeEngine } from '#lib/theme-engine-light'\nimport type { ThemeCatalogueSource } from './theme-provider-value'\n\n/**\n * The full catalogue engine once something has asked for it, shared by every lazy\n * provider and every caller of {@link loadThemeCatalogue} in the page. A provider\n * created after the load starts with it already in hand.\n */\nlet loadedEngine: ThemeEngine | undefined\nlet loading: Promise<ThemeEngine> | undefined\n\n/**\n * Load the whole theme catalogue (about 129 KB raw, 34 KB gzipped) and resolve to the\n * engine backed by it. Idempotent: every call shares one import, and a failed import is\n * forgotten so the next call retries.\n *\n * The lazy provider calls this itself the moment a selection needs a theme beyond the\n * default pair. Call it earlier — when a settings page mounts, or on hover of its\n * entry — to have the picker ready by the time it opens.\n */\nexport function loadThemeCatalogue(): Promise<ThemeEngine> {\n if (loadedEngine) return Promise.resolve(loadedEngine)\n loading ??= import('#lib/theme-catalogue').then(\n (module) => {\n loadedEngine = module.catalogueThemeEngine\n return loadedEngine\n },\n (error: unknown) => {\n loading = undefined\n throw error\n }\n )\n return loading\n}\n\n/** A catalogue source for one provider: the shipped defaults until the load resolves. */\nexport function createLazyCatalogue(): ThemeCatalogueSource {\n const [full, setFull] = createSignal<ThemeEngine | undefined>(loadedEngine)\n const [failed, setFailed] = createSignal(false)\n const load = () =>\n loadThemeCatalogue().then(\n (loaded) => {\n setFailed(false)\n setFull(() => loaded)\n },\n () => {\n // The theme the stylesheet painted stays; the next request retries.\n setFailed(true)\n }\n )\n const shipped = createLightThemeEngine(() => void load())\n return {\n engine: () => full() ?? shipped,\n loaded: () => full() !== undefined,\n failed,\n load,\n }\n}\n"],"mappings":";;;;;;;;AAUA,IAAI;AACJ,IAAI;;;;;;;;;;AAWJ,SAAgB,qBAA2C;CACzD,IAAI,cAAc,OAAO,QAAQ,QAAQ,YAAY;CACrD,YAAY,OAAO,+BAAuB,CAAC,MACxC,WAAW;EACV,eAAe,OAAO;EACtB,OAAO;CACT,IACC,UAAmB;EAClB,UAAU,KAAA;EACV,MAAM;CACR,CACF;CACA,OAAO;AACT;;AAGA,SAAgB,sBAA4C;CAC1D,MAAM,CAAC,MAAM,WAAW,aAAsC,YAAY;CAC1E,MAAM,CAAC,QAAQ,aAAa,aAAa,KAAK;CAC9C,MAAM,aACJ,mBAAmB,CAAC,CAAC,MAClB,WAAW;EACV,UAAU,KAAK;EACf,cAAc,MAAM;CACtB,SACM;EAEJ,UAAU,IAAI;CAChB,CACF;CACF,MAAM,UAAU,6BAA6B,KAAK,KAAK,CAAC;CACxD,OAAO;EACL,cAAc,KAAK,KAAK;EACxB,cAAc,KAAK,MAAM,KAAA;EACzB;EACA;CACF;AACF"}
1
+ {"version":3,"file":"theme-catalogue-source.js","names":[],"sources":["../../../src/components/theme/theme-catalogue-source.ts"],"sourcesContent":["import { createSignal } from 'solid-js'\nimport type { ThemeEngine } from '#lib/theme-engine'\nimport { createLightThemeEngine } from '#lib/theme-engine-light'\nimport type { ThemeCatalogueSource } from './theme-provider-value'\n\n/**\n * The full catalogue engine once something has asked for it, shared by every lazy\n * provider and every caller of {@link loadThemeCatalogue} in the page. A provider\n * created after the load starts with it already in hand.\n */\nlet loadedEngine: ThemeEngine | undefined\nlet loading: Promise<ThemeEngine> | undefined\n\n/**\n * Load the whole theme catalogue (about 129 KB raw, 34 KB gzipped) and resolve to the\n * engine backed by it. Idempotent: every call shares one import, and a failed import is\n * forgotten so the next call retries.\n *\n * The lazy provider calls this itself the moment a selection needs a theme beyond the\n * default pair. Call it earlier, when a settings page mounts, or on hover of its\n * entry, to have the picker ready by the time it opens.\n */\nexport function loadThemeCatalogue(): Promise<ThemeEngine> {\n if (loadedEngine) return Promise.resolve(loadedEngine)\n loading ??= import('#lib/theme-catalogue').then(\n (module) => {\n loadedEngine = module.catalogueThemeEngine\n return loadedEngine\n },\n (error: unknown) => {\n loading = undefined\n throw error\n }\n )\n return loading\n}\n\n/** A catalogue source for one provider: the shipped defaults until the load resolves. */\nexport function createLazyCatalogue(): ThemeCatalogueSource {\n const [full, setFull] = createSignal<ThemeEngine | undefined>(loadedEngine)\n const [failed, setFailed] = createSignal(false)\n const load = () =>\n loadThemeCatalogue().then(\n (loaded) => {\n setFailed(false)\n setFull(() => loaded)\n },\n () => {\n // The theme the stylesheet painted stays; the next request retries.\n setFailed(true)\n }\n )\n const shipped = createLightThemeEngine(() => void load())\n return {\n engine: () => full() ?? shipped,\n loaded: () => full() !== undefined,\n failed,\n load,\n }\n}\n"],"mappings":";;;;;;;;AAUA,IAAI;AACJ,IAAI;;;;;;;;;;AAWJ,SAAgB,qBAA2C;CACzD,IAAI,cAAc,OAAO,QAAQ,QAAQ,YAAY;CACrD,YAAY,OAAO,+BAAuB,CAAC,MACxC,WAAW;EACV,eAAe,OAAO;EACtB,OAAO;CACT,IACC,UAAmB;EAClB,UAAU,KAAA;EACV,MAAM;CACR,CACF;CACA,OAAO;AACT;;AAGA,SAAgB,sBAA4C;CAC1D,MAAM,CAAC,MAAM,WAAW,aAAsC,YAAY;CAC1E,MAAM,CAAC,QAAQ,aAAa,aAAa,KAAK;CAC9C,MAAM,aACJ,mBAAmB,CAAC,CAAC,MAClB,WAAW;EACV,UAAU,KAAK;EACf,cAAc,MAAM;CACtB,SACM;EAEJ,UAAU,IAAI;CAChB,CACF;CACF,MAAM,UAAU,6BAA6B,KAAK,KAAK,CAAC;CACxD,OAAO;EACL,cAAc,KAAK,KAAK;EACxB,cAAc,KAAK,MAAM,KAAA;EACzB;EACA;CACF;AACF"}
@@ -5,8 +5,8 @@ export declare function useTheme(): ThemeContextValue;
5
5
  /**
6
6
  * The theme context, or `undefined` outside a `ThemeProvider`.
7
7
  *
8
- * For a component that can run both ways — a shared control rendered in a harness,
9
- * a story, or a host that has not mounted a provider — and would rather degrade
8
+ * For a component that can run both ways, a shared control rendered in a harness,
9
+ * a story, or a host that has not mounted a provider, and would rather degrade
10
10
  * than throw.
11
11
  */
12
12
  export declare function useOptionalTheme(): ThemeContextValue | undefined;
@@ -4,7 +4,7 @@ import { createContext, useContext } from "solid-js";
4
4
  * Where the context object lives: on the global, under a registered symbol.
5
5
  *
6
6
  * A context is an object identity, and a bundle can legitimately load this module
7
- * twice — a dev graph where a relative import and a package subpath are distinct
7
+ * twice, a dev graph where a relative import and a package subpath are distinct
8
8
  * module records, or two copies of the package at different versions. Each copy
9
9
  * would then call `createContext` and own its own object; a provider from one and a
10
10
  * `useOptionalTheme()` from the other would never meet, and the second would return
@@ -28,8 +28,8 @@ function useTheme() {
28
28
  /**
29
29
  * The theme context, or `undefined` outside a `ThemeProvider`.
30
30
  *
31
- * For a component that can run both ways — a shared control rendered in a harness,
32
- * a story, or a host that has not mounted a provider — and would rather degrade
31
+ * For a component that can run both ways, a shared control rendered in a harness,
32
+ * a story, or a host that has not mounted a provider, and would rather degrade
33
33
  * than throw.
34
34
  */
35
35
  function useOptionalTheme() {
@@ -1 +1 @@
1
- {"version":3,"file":"theme-context.js","names":[],"sources":["../../../src/components/theme/theme-context.ts"],"sourcesContent":["import { createContext, useContext, type Context } from 'solid-js'\nimport type { ThemeContextValue } from './theme-state'\n\n/**\n * Where the context object lives: on the global, under a registered symbol.\n *\n * A context is an object identity, and a bundle can legitimately load this module\n * twice — a dev graph where a relative import and a package subpath are distinct\n * module records, or two copies of the package at different versions. Each copy\n * would then call `createContext` and own its own object; a provider from one and a\n * `useOptionalTheme()` from the other would never meet, and the second would return\n * `undefined` as though no provider were mounted. `Symbol.for` is shared across\n * every copy in a realm, so they all find the one context the first created.\n *\n * Both copies must agree on its shape. The context value only ever grows, which is\n * why a newer provider under an older reader is safe and the reverse is a missing\n * member, not a mismatch.\n */\nconst CONTEXT_KEY = Symbol.for('adea.ui.theme')\n\ntype ContextHost = { [CONTEXT_KEY]?: Context<ThemeContextValue | undefined> }\n\nexport function themeContext(): Context<ThemeContextValue | undefined> {\n const host = globalThis as ContextHost\n return (host[CONTEXT_KEY] ??= createContext<ThemeContextValue>())\n}\n\nexport function useTheme(): ThemeContextValue {\n const value = useContext(themeContext())\n if (!value) throw new Error('useTheme must be called inside a <ThemeProvider>.')\n return value\n}\n\n/**\n * The theme context, or `undefined` outside a `ThemeProvider`.\n *\n * For a component that can run both ways — a shared control rendered in a harness,\n * a story, or a host that has not mounted a provider — and would rather degrade\n * than throw.\n */\nexport function useOptionalTheme(): ThemeContextValue | undefined {\n return useContext(themeContext())\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAkBA,IAAM,cAAc,OAAO,IAAI,eAAe;AAI9C,SAAgB,eAAuD;CACrE,MAAM,OAAO;CACb,OAAQ,KAAK,iBAAiB,cAAiC;AACjE;AAEA,SAAgB,WAA8B;CAC5C,MAAM,QAAQ,WAAW,aAAa,CAAC;CACvC,IAAI,CAAC,OAAO,MAAM,IAAI,MAAM,mDAAmD;CAC/E,OAAO;AACT;;;;;;;;AASA,SAAgB,mBAAkD;CAChE,OAAO,WAAW,aAAa,CAAC;AAClC"}
1
+ {"version":3,"file":"theme-context.js","names":[],"sources":["../../../src/components/theme/theme-context.ts"],"sourcesContent":["import { createContext, useContext, type Context } from 'solid-js'\nimport type { ThemeContextValue } from './theme-state'\n\n/**\n * Where the context object lives: on the global, under a registered symbol.\n *\n * A context is an object identity, and a bundle can legitimately load this module\n * twice, a dev graph where a relative import and a package subpath are distinct\n * module records, or two copies of the package at different versions. Each copy\n * would then call `createContext` and own its own object; a provider from one and a\n * `useOptionalTheme()` from the other would never meet, and the second would return\n * `undefined` as though no provider were mounted. `Symbol.for` is shared across\n * every copy in a realm, so they all find the one context the first created.\n *\n * Both copies must agree on its shape. The context value only ever grows, which is\n * why a newer provider under an older reader is safe and the reverse is a missing\n * member, not a mismatch.\n */\nconst CONTEXT_KEY = Symbol.for('adea.ui.theme')\n\ntype ContextHost = { [CONTEXT_KEY]?: Context<ThemeContextValue | undefined> }\n\nexport function themeContext(): Context<ThemeContextValue | undefined> {\n const host = globalThis as ContextHost\n return (host[CONTEXT_KEY] ??= createContext<ThemeContextValue>())\n}\n\nexport function useTheme(): ThemeContextValue {\n const value = useContext(themeContext())\n if (!value) throw new Error('useTheme must be called inside a <ThemeProvider>.')\n return value\n}\n\n/**\n * The theme context, or `undefined` outside a `ThemeProvider`.\n *\n * For a component that can run both ways, a shared control rendered in a harness,\n * a story, or a host that has not mounted a provider, and would rather degrade\n * than throw.\n */\nexport function useOptionalTheme(): ThemeContextValue | undefined {\n return useContext(themeContext())\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAkBA,IAAM,cAAc,OAAO,IAAI,eAAe;AAI9C,SAAgB,eAAuD;CACrE,MAAM,OAAO;CACb,OAAQ,KAAK,iBAAiB,cAAiC;AACjE;AAEA,SAAgB,WAA8B;CAC5C,MAAM,QAAQ,WAAW,aAAa,CAAC;CACvC,IAAI,CAAC,OAAO,MAAM,IAAI,MAAM,mDAAmD;CAC/E,OAAO;AACT;;;;;;;;AASA,SAAgB,mBAAkD;CAChE,OAAO,WAAW,aAAa,CAAC;AAClC"}
@@ -1 +1 @@
1
- {"version":3,"file":"theme-document.d.ts","sourceRoot":"","sources":["../../../src/components/theme/theme-document.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAA;AAErE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAEtF,OAAO,EAAgB,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACpE,OAAO,EAAmB,KAAK,cAAc,EAAE,MAAM,eAAe,CAAA;AAEpE;;;;;;GAMG;AACH,MAAM,MAAM,SAAS,GAAG,IAAI,CAC1B,WAAW,EACX,WAAW,GAAG,SAAS,GAAG,OAAO,GAAG,iBAAiB,GAAG,cAAc,CACvE,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,mFAAmF;IACnF,SAAS,EAAE,cAAc,CAAA;IACzB,UAAU,EAAE,eAAe,CAAA;IAC3B,OAAO,EAAE,YAAY,CAAA;IACrB;;;OAGG;IACH,eAAe,CAAC,EAAE,YAAY,CAAA;IAC9B;;;OAGG;IACH,OAAO,CAAC,EAAE,YAAY,CAAA;CACvB,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC;;;;OAIG;IACH,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC5E;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B;;;;;;;;;;OAUG;IACH,OAAO,CAAC,EAAE,QAAQ,GAAG,YAAY,CAAA;IACjC;;;;;;;;;OASG;IACH,WAAW,CAAC,EAAE,eAAe,C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,WAAW,EACnB,IAAI,EAAE,SAAS,EACf,KAAK,EAAE,kBAAkB,EACzB,OAAO,GAAE,oBAAyB,EAClC,QAAQ,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,GAC7B,WAAW,CAAC,MAAM,CAAC,CAmDrB;AAOD,gEAAgE;AAChE,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE;QAAE,WAAW,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAA;KAAE,CAAA;IAC7C,aAAa,CAAC,GAAG,EAAE,OAAO,GAAG;QAC3B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;QAC1B,YAAY,CAAC,EAAE,MAAM,CAAA;QACrB,MAAM,IAAI,IAAI,CAAA;KACf,CAAA;CACF,CAAA;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,kBAAkB,EACvB,KAAK,EAAE,MAAM,IAAI,EACjB,QAAQ,GAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,KAAK,IAAsB,GACzD,MAAM,IAAI,CAqBZ"}
@@ -61,28 +61,33 @@ function themeDocumentTokens(engine, state, options = {}) {
61
61
  */
62
62
  function applyThemeToRoot(engine, root, state, options = {}, previous) {
63
63
  const { tokens, accented } = themeDocumentTokens(engine, state, options);
64
- for (const [name, value] of Object.entries(tokens)) root.style.setProperty(name, value);
64
+ for (const [name, value] of Object.entries(tokens)) if (root.style.getPropertyValue(name) !== value) root.style.setProperty(name, value);
65
65
  if (previous) {
66
66
  for (const name of previous) if (!(name in tokens)) root.style.removeProperty(name);
67
67
  }
68
68
  root.classList.toggle("dark", state.appearance === "dark");
69
- root.dataset["theme"] = state.variant.id;
70
- root.dataset["appearance"] = state.appearance;
71
- root.style.colorScheme = state.appearance;
69
+ setData(root, "theme", state.variant.id);
70
+ setData(root, "appearance", state.appearance);
71
+ if (root.style.colorScheme !== state.appearance) root.style.colorScheme = state.appearance;
72
72
  if (!accented) root.removeAttribute("data-accent");
73
- else root.dataset["accent"] = isCustomAccent(state.selection.accent) ? "custom" : state.selection.accent;
73
+ else setData(root, "accent", isCustomAccent(state.selection.accent) ? "custom" : state.selection.accent);
74
74
  if (state.surface) {
75
- root.dataset["surface"] = state.surface.surface;
76
- root.dataset["reduceTransparency"] = state.surface.reduceTransparencyActive ? "true" : "false";
75
+ setData(root, "surface", state.surface.surface);
76
+ setData(root, "reduceTransparency", state.surface.reduceTransparencyActive ? "true" : "false");
77
77
  } else {
78
78
  root.removeAttribute("data-surface");
79
79
  root.removeAttribute("data-reduce-transparency");
80
80
  }
81
81
  applyAppearanceFontSettings(root, normalizeAppearanceEditorFontSettings(state.selection.fonts, state.selection.font).settings);
82
- if (resolvedDensity(state.selection) === "comfortable") root.removeAttribute("data-density");
83
- else root.dataset["density"] = resolvedDensity(state.selection);
82
+ const density = resolvedDensity(state.selection);
83
+ if (density === "comfortable") root.removeAttribute("data-density");
84
+ else setData(root, "density", density);
84
85
  return new Set(Object.keys(tokens));
85
86
  }
87
+ /** Rewriting an attribute with its own value still queues a mutation and a style check. */
88
+ function setData(root, key, value) {
89
+ if (root.dataset[key] !== value) root.dataset[key] = value;
90
+ }
86
91
  /**
87
92
  * Run `apply` with every CSS transition switched off for the frame that carries
88
93
  * it, so a theme switch cannot animate page-wide.
@@ -1 +1 @@
1
- {"version":3,"file":"theme-document.js","names":[],"sources":["../../../src/components/theme/theme-document.ts"],"sourcesContent":["import {\n applyAppearanceFontSettings,\n normalizeAppearanceEditorFontSettings,\n} from '#lib/appearance-font-settings'\nimport { terminalCssVariables } from '#lib/theme-css'\nimport type { ThemeTokenProjectionOptions } from './token-projection'\nimport { assertThemeTokenProjectionConfig } from './token-projection-options'\nimport type { ThemeEngine } from '#lib/theme-engine'\nimport type { EditorRolesMode, ThemeAppearance, ThemeVariant } from '#lib/theme-types'\nimport { isCustomAccent } from '#lib/accent-roles'\nimport { surfaceAlpha, type SurfaceState } from '#lib/theme-surface'\nimport { resolvedDensity, type ThemeSelection } from './theme-state'\n\n/**\n * The document half of the theme provider: the single writer of `<html>`.\n *\n * Written against the few members of an element it uses, so the rules can be tested\n * on a stand-in. Every question the catalogue answers goes through the\n * {@link ThemeEngine} it is given, so it imports no catalogue code or data.\n */\nexport type ThemeRoot = Pick<\n HTMLElement,\n 'classList' | 'dataset' | 'style' | 'removeAttribute' | 'setAttribute'\n>\n\nexport type ThemeDocumentState = {\n /** What the document shows: the committed selection, or a preview laid over it. */\n selection: ThemeSelection\n appearance: ThemeAppearance\n variant: ThemeVariant\n /**\n * The variant whose terminal palette is pinned over the interface variant's.\n * Absent, the terminal follows the interface theme.\n */\n terminalVariant?: ThemeVariant\n /**\n * The resolved surface axis. Absent, the axis is off: no attribute and no\n * `--surface-alpha` is written, and any this writer wrote before is removed.\n */\n surface?: SurfaceState\n}\n\nexport type ThemeDocumentOptions = {\n /**\n * Rewrites the custom properties just before they are written: the variant's\n * roles with the accent laid over them. It sees every property of the pass and\n * must return the full map; a name it drops is not written.\n */\n transformTokens?: (tokens: Record<string, string>) => Record<string, string>\n /**\n * The contrast an accent is held to against the variant's background. Absent, a\n * preset is painted verbatim (the catalogue measured it for its own themes) and\n * only a custom `#rrggbb` is held to the default floor of 3:1.\n */\n accentContrastFloor?: number\n /**\n * Where a catalogue variant's palette comes from. `inline` (the default) writes\n * every role onto the root. `stylesheet` writes none for a catalogue variant,\n * because the host loads a stylesheet that carries a `[data-theme]` block for it;\n * a variant the catalogue does not hold (a host's imported theme) is still written\n * inline, since no stylesheet can know it. The accent, the terminal pin, the\n * surface alpha and the fonts are written the same in both.\n *\n * Switching from an imported variant back to a catalogue one removes what the\n * imported one wrote, so nothing inline outlives it to beat the stylesheet.\n */\n palette?: 'inline' | 'stylesheet'\n /**\n * The `--editor-*` projection. `syntax` (the default) is the catalogue's quiet\n * syntax roles, which is what `theme-variants.css` carries; `floor` holds every\n * editor role to 4.5:1 on the canvas, as hex.\n *\n * With `palette: 'stylesheet'`, `floor` is the one palette write a catalogue\n * variant still gets: the stylesheet is generated for the default projection, so\n * the sixteen `--editor-*` properties are written inline over it. The rest of the\n * palette stays in the stylesheet.\n */\n editorRoles?: EditorRolesMode\n} & ThemeTokenProjectionOptions\n\n/**\n * What a catalogue variant still writes inline when its palette is the stylesheet's:\n * nothing, unless the editor projection is not the one the stylesheet was generated\n * for.\n */\nfunction stylesheetOverrides(\n engine: ThemeEngine,\n variant: ThemeVariant,\n editorRoles: EditorRolesMode | undefined\n): Record<string, string> {\n if (editorRoles !== 'floor') return {}\n return Object.fromEntries(\n Object.entries(engine.themeCssVariables(variant, { editor: 'floor' })).filter(([name]) =>\n name.startsWith('--editor-')\n )\n )\n}\n\n/**\n * The custom properties a state paints: the variant's roles, an optional projection\n * from the raw host map, the accent, the pinned terminal palette, the surface alpha,\n * then `transformTokens`.\n *\n * The accent is applied *here* rather than left to the `[data-accent]` blocks in\n * `theme.css`, because the properties are written inline and an inline declaration\n * outranks every stylesheet selector however specific it is. The blocks still exist\n * and are still correct — they are what styles the window before this runs — but\n * they cannot win from here, so leaving the accent to them meant the attribute was\n * set, the rules were present, and nothing changed on screen.\n */\nexport function themeDocumentTokens(\n engine: ThemeEngine,\n state: ThemeDocumentState,\n options: ThemeDocumentOptions = {}\n): { tokens: Record<string, string>; accented: boolean } {\n assertThemeTokenProjectionConfig(options.tokenProjection)\n const fromStylesheet =\n options.palette === 'stylesheet' && engine.isCatalogueVariant(state.variant)\n const properties = fromStylesheet\n ? stylesheetOverrides(engine, state.variant, options.editorRoles)\n : { ...engine.themeCssVariables(state.variant, { editor: options.editorRoles }) }\n if (options.tokenProjection && !engine.isCatalogueVariant(state.variant)) {\n const rawTokens = state.variant.tokens ?? {}\n const projected = options.tokenProjection.project(rawTokens, options.tokenProjection.rules)\n for (const rule of options.tokenProjection.rules) {\n if (!rule || typeof rule.target !== 'string') continue\n if (Object.hasOwn(projected, rule.target)) {\n properties[rule.target] = projected[rule.target]!\n }\n }\n }\n const accent = engine.accentVariables(state.selection.accent, state.appearance, state.selection, {\n background: state.variant.colors.background,\n floor: options.accentContrastFloor,\n variantId: state.variant.id,\n })\n if (accent) Object.assign(properties, accent)\n // Written after the variant and the accent, so it wins over the interface\n // variant's own terminal ramp (and over the stylesheet's, which it outranks as an\n // inline declaration). Dropping the pin needs no removal of its own: the ramp is\n // then rewritten by the variant, or swept back to the stylesheet.\n if (state.terminalVariant) Object.assign(properties, terminalCssVariables(state.terminalVariant))\n if (state.surface) properties['--surface-alpha'] = surfaceAlpha[state.surface.surface]\n return {\n tokens: options.transformTokens ? options.transformTokens(properties) : properties,\n accented: accent !== undefined,\n }\n}\n\n/**\n * Write a state onto a root and report which custom properties it owns.\n *\n * Pass the previous call's return as `previous` and any palette property that pass\n * wrote and this one does not is removed. For the catalogue the two sets are the\n * same, so nothing is ever removed; it matters for a host variant that carries\n * `tokens` the catalogue does not, which would otherwise stay inline, beating the\n * stylesheet, after the user switched away from it.\n */\nexport function applyThemeToRoot(\n engine: ThemeEngine,\n root: ThemeRoot,\n state: ThemeDocumentState,\n options: ThemeDocumentOptions = {},\n previous?: ReadonlySet<string>\n): ReadonlySet<string> {\n const { tokens, accented } = themeDocumentTokens(engine, state, options)\n\n for (const [name, value] of Object.entries(tokens)) {\n root.style.setProperty(name, value)\n }\n if (previous) {\n for (const name of previous) {\n if (!(name in tokens)) root.style.removeProperty(name)\n }\n }\n\n root.classList.toggle('dark', state.appearance === 'dark')\n root.dataset['theme'] = state.variant.id\n root.dataset['appearance'] = state.appearance\n root.style.colorScheme = state.appearance\n\n // A custom colour has no stylesheet block to select, and its value is the\n // attribute's worst possible content, so it is reported as `custom`.\n if (!accented) root.removeAttribute('data-accent')\n else\n root.dataset['accent'] = isCustomAccent(state.selection.accent)\n ? 'custom'\n : state.selection.accent\n\n // The surface axis is opt-in, so its absence removes rather than defaults: a host\n // that never enables it keeps an `<html>` with neither attribute, and one that\n // turns it off leaves nothing behind. (`--surface-alpha` is swept with the tokens.)\n if (state.surface) {\n root.dataset['surface'] = state.surface.surface\n root.dataset['reduceTransparency'] = state.surface.reduceTransparencyActive ? 'true' : 'false'\n } else {\n root.removeAttribute('data-surface')\n root.removeAttribute('data-reduce-transparency')\n }\n\n applyAppearanceFontSettings(\n root,\n normalizeAppearanceEditorFontSettings(state.selection.fonts, state.selection.font).settings\n )\n\n if (resolvedDensity(state.selection) === 'comfortable') root.removeAttribute('data-density')\n else root.dataset['density'] = resolvedDensity(state.selection)\n\n return new Set(Object.keys(tokens))\n}\n\n/** What {@link applyWithoutTransitions} needs of a document. */\nexport type TransitionDocument = {\n head: { appendChild(node: unknown): unknown }\n createElement(tag: 'style'): {\n textContent: string | null\n offsetHeight?: number\n remove(): void\n }\n}\n\n/**\n * Run `apply` with every CSS transition switched off for the frame that carries\n * it, so a theme switch cannot animate page-wide.\n *\n * Without this, flipping the custom properties on `<html>` starts a transition on\n * every element that declares one, and each fades from the old palette to the new\n * over its own duration: a theme change that looks like a rendering fault. The\n * rule is removed two frames later, after the browser has committed the new styles\n * with transitions off, and `restore` runs it early (the provider calls it when it\n * is disposed mid-switch).\n *\n * `schedule` is the frame source; it defaults to `requestAnimationFrame` and falls\n * back to running at once where there is none, which leaves transitions on rather\n * than off.\n */\nexport function applyWithoutTransitions(\n doc: TransitionDocument,\n apply: () => void,\n schedule: (callback: () => void) => void = defaultSchedule\n): () => void {\n const style = doc.createElement('style')\n style.textContent = '*{transition:none !important}'\n doc.head.appendChild(style)\n // Reading a layout property forces the browser to commit the rule before the\n // properties change; without it the two can be batched into one style recalc.\n void style.offsetHeight\n let removed = false\n const restore = () => {\n if (removed) return\n removed = true\n style.remove()\n }\n try {\n apply()\n } catch (error) {\n restore()\n throw error\n }\n schedule(() => schedule(restore))\n return restore\n}\n\nfunction defaultSchedule(callback: () => void): void {\n if (typeof requestAnimationFrame === 'function') requestAnimationFrame(callback)\n else callback()\n}\n"],"mappings":";;;;;;;;;;;;AAqFA,SAAS,oBACP,QACA,SACA,aACwB;CACxB,IAAI,gBAAgB,SAAS,OAAO,CAAC;C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CACd,MAAM,gBAAgB;EACpB,IAAI,SAAS;EACb,UAAU;EACV,MAAM,OAAO;CACf;CACA,IAAI;EACF,MAAM;CACR,SAAS,OAAO;EACd,QAAQ;EACR,MAAM;CACR;CACA,eAAe,SAAS,OAAO,CAAC;CAChC,OAAO;AACT;AAEA,SAAS,gBAAgB,UAA4B;CACnD,IAAI,OAAO,0BAA0B,YAAY,sBAAsB,QAAQ;MAC1E,SAAS;AAChB"}
1
+ {"version":3,"file":"theme-document.js","names":[],"sources":["../../../src/components/theme/theme-document.ts"],"sourcesContent":["import {\n applyAppearanceFontSettings,\n normalizeAppearanceEditorFontSettings,\n} from '#lib/appearance-font-settings'\nimport { terminalCssVariables } from '#lib/theme-css'\nimport type { ThemeTokenProjectionOptions } from './token-projection'\nimport { assertThemeTokenProjectionConfig } from './token-projection-options'\nimport type { ThemeEngine } from '#lib/theme-engine'\nimport type { EditorRolesMode, ThemeAppearance, ThemeVariant } from '#lib/theme-types'\nimport { isCustomAccent } from '#lib/accent-roles'\nimport { surfaceAlpha, type SurfaceState } from '#lib/theme-surface'\nimport { resolvedDensity, type ThemeSelection } from './theme-state'\n\n/**\n * The document half of the theme provider: the single writer of `<html>`.\n *\n * Written against the few members of an element it uses, so the rules can be tested\n * on a stand-in. Every question the catalogue answers goes through the\n * {@link ThemeEngine} it is given, so it imports no catalogue code or data.\n */\nexport type ThemeRoot = Pick<\n HTMLElement,\n 'classList' | 'dataset' | 'style' | 'removeAttribute' | 'setAttribute'\n>\n\nexport type ThemeDocumentState = {\n /** What the document shows: the committed selection, or a preview laid over it. */\n selection: ThemeSelection\n appearance: ThemeAppearance\n variant: ThemeVariant\n /**\n * The variant whose terminal palette is pinned over the interface variant's.\n * Absent, the terminal follows the interface theme.\n */\n terminalVariant?: ThemeVariant\n /**\n * The resolved surface axis. Absent, the axis is off: no attribute and no\n * `--surface-alpha` is written, and any this writer wrote before is removed.\n */\n surface?: SurfaceState\n}\n\nexport type ThemeDocumentOptions = {\n /**\n * Rewrites the custom properties just before they are written: the variant's\n * roles with the accent laid over them. It sees every property of the pass and\n * must return the full map; a name it drops is not written.\n */\n transformTokens?: (tokens: Record<string, string>) => Record<string, string>\n /**\n * The contrast an accent is held to against the variant's background. Absent, a\n * preset is painted verbatim (the catalogue measured it for its own themes) and\n * only a custom `#rrggbb` is held to the default floor of 3:1.\n */\n accentContrastFloor?: number\n /**\n * Where a catalogue variant's palette comes from. `inline` (the default) writes\n * every role onto the root. `stylesheet` writes none for a catalogue variant,\n * because the host loads a stylesheet that carries a `[data-theme]` block for it;\n * a variant the catalogue does not hold (a host's imported theme) is still written\n * inline, since no stylesheet can know it. The accent, the terminal pin, the\n * surface alpha and the fonts are written the same in both.\n *\n * Switching from an imported variant back to a catalogue one removes what the\n * imported one wrote, so nothing inline outlives it to beat the stylesheet.\n */\n palette?: 'inline' | 'stylesheet'\n /**\n * The `--editor-*` projection. `syntax` (the default) is the catalogue's quiet\n * syntax roles, which is what `theme-variants.css` carries; `floor` holds every\n * editor role to 4.5:1 on the canvas, as hex.\n *\n * With `palette: 'stylesheet'`, `floor` is the one palette write a catalogue\n * variant still gets: the stylesheet is generated for the default projection, so\n * the sixteen `--editor-*` properties are written inline over it. The rest of the\n * palette stays in the stylesheet.\n */\n editorRoles?: EditorRolesMode\n} & ThemeTokenProjectionOptions\n\n/**\n * What a catalogue variant still writes inline when its palette is the stylesheet's:\n * nothing, unless the editor projection is not the one the stylesheet was generated\n * for.\n */\nfunction stylesheetOverrides(\n engine: ThemeEngine,\n variant: ThemeVariant,\n editorRoles: EditorRolesMode | undefined\n): Record<string, string> {\n if (editorRoles !== 'floor') return {}\n return Object.fromEntries(\n Object.entries(engine.themeCssVariables(variant, { editor: 'floor' })).filter(([name]) =>\n name.startsWith('--editor-')\n )\n )\n}\n\n/**\n * The custom properties a state paints: the variant's roles, an optional projection\n * from the raw host map, the accent, the pinned terminal palette, the surface alpha,\n * then `transformTokens`.\n *\n * The accent is applied *here* rather than left to the `[data-accent]` blocks in\n * `theme.css`, because the properties are written inline and an inline declaration\n * outranks every stylesheet selector however specific it is. The blocks still exist\n * and are still correct — they are what styles the window before this runs — but\n * they cannot win from here, so leaving the accent to them meant the attribute was\n * set, the rules were present, and nothing changed on screen.\n */\nexport function themeDocumentTokens(\n engine: ThemeEngine,\n state: ThemeDocumentState,\n options: ThemeDocumentOptions = {}\n): { tokens: Record<string, string>; accented: boolean } {\n assertThemeTokenProjectionConfig(options.tokenProjection)\n const fromStylesheet =\n options.palette === 'stylesheet' && engine.isCatalogueVariant(state.variant)\n const properties = fromStylesheet\n ? stylesheetOverrides(engine, state.variant, options.editorRoles)\n : { ...engine.themeCssVariables(state.variant, { editor: options.editorRoles }) }\n if (options.tokenProjection && !engine.isCatalogueVariant(state.variant)) {\n const rawTokens = state.variant.tokens ?? {}\n const projected = options.tokenProjection.project(rawTokens, options.tokenProjection.rules)\n for (const rule of options.tokenProjection.rules) {\n if (!rule || typeof rule.target !== 'string') continue\n if (Object.hasOwn(projected, rule.target)) {\n properties[rule.target] = projected[rule.target]!\n }\n }\n }\n const accent = engine.accentVariables(state.selection.accent, state.appearance, state.selection, {\n background: state.variant.colors.background,\n floor: options.accentContrastFloor,\n variantId: state.variant.id,\n })\n if (accent) Object.assign(properties, accent)\n // Written after the variant and the accent, so it wins over the interface\n // variant's own terminal ramp (and over the stylesheet's, which it outranks as an\n // inline declaration). Dropping the pin needs no removal of its own: the ramp is\n // then rewritten by the variant, or swept back to the stylesheet.\n if (state.terminalVariant) Object.assign(properties, terminalCssVariables(state.terminalVariant))\n if (state.surface) properties['--surface-alpha'] = surfaceAlpha[state.surface.surface]\n return {\n tokens: options.transformTokens ? options.transformTokens(properties) : properties,\n accented: accent !== undefined,\n }\n}\n\n/**\n * Write a state onto a root and report which custom properties it owns.\n *\n * Pass the previous call's return as `previous` and any palette property that pass\n * wrote and this one does not is removed. For the catalogue the two sets are the\n * same, so nothing is ever removed; it matters for a host variant that carries\n * `tokens` the catalogue does not, which would otherwise stay inline, beating the\n * stylesheet, after the user switched away from it.\n */\nexport function applyThemeToRoot(\n engine: ThemeEngine,\n root: ThemeRoot,\n state: ThemeDocumentState,\n options: ThemeDocumentOptions = {},\n previous?: ReadonlySet<string>\n): ReadonlySet<string> {\n const { tokens, accented } = themeDocumentTokens(engine, state, options)\n\n // Every pass recomputes the whole token set (an accent or font step included);\n // only the values that changed are written, so an unchanged palette does not\n // dirty the document's style. Custom property values read back as written.\n for (const [name, value] of Object.entries(tokens)) {\n if (root.style.getPropertyValue(name) !== value) root.style.setProperty(name, value)\n }\n if (previous) {\n for (const name of previous) {\n if (!(name in tokens)) root.style.removeProperty(name)\n }\n }\n\n root.classList.toggle('dark', state.appearance === 'dark')\n setData(root, 'theme', state.variant.id)\n setData(root, 'appearance', state.appearance)\n if (root.style.colorScheme !== state.appearance) root.style.colorScheme = state.appearance\n\n // A custom colour has no stylesheet block to select, and its value is the\n // attribute's worst possible content, so it is reported as `custom`.\n if (!accented) root.removeAttribute('data-accent')\n else\n setData(\n root,\n 'accent',\n isCustomAccent(state.selection.accent) ? 'custom' : state.selection.accent\n )\n\n // The surface axis is opt-in, so its absence removes rather than defaults: a host\n // that never enables it keeps an `<html>` with neither attribute, and one that\n // turns it off leaves nothing behind. (`--surface-alpha` is swept with the tokens.)\n if (state.surface) {\n setData(root, 'surface', state.surface.surface)\n setData(root, 'reduceTransparency', state.surface.reduceTransparencyActive ? 'true' : 'false')\n } else {\n root.removeAttribute('data-surface')\n root.removeAttribute('data-reduce-transparency')\n }\n\n applyAppearanceFontSettings(\n root,\n normalizeAppearanceEditorFontSettings(state.selection.fonts, state.selection.font).settings\n )\n\n const density = resolvedDensity(state.selection)\n if (density === 'comfortable') root.removeAttribute('data-density')\n else setData(root, 'density', density)\n\n return new Set(Object.keys(tokens))\n}\n\n/** Rewriting an attribute with its own value still queues a mutation and a style check. */\nfunction setData(root: ThemeRoot, key: string, value: string) {\n if (root.dataset[key] !== value) root.dataset[key] = value\n}\n\n/** What {@link applyWithoutTransitions} needs of a document. */\nexport type TransitionDocument = {\n head: { appendChild(node: unknown): unknown }\n createElement(tag: 'style'): {\n textContent: string | null\n offsetHeight?: number\n remove(): void\n }\n}\n\n/**\n * Run `apply` with every CSS transition switched off for the frame that carries\n * it, so a theme switch cannot animate page-wide.\n *\n * Without this, flipping the custom properties on `<html>` starts a transition on\n * every element that declares one, and each fades from the old palette to the new\n * over its own duration: a theme change that looks like a rendering fault. The\n * rule is removed two frames later, after the browser has committed the new styles\n * with transitions off, and `restore` runs it early (the provider calls it when it\n * is disposed mid-switch).\n *\n * `schedule` is the frame source; it defaults to `requestAnimationFrame` and falls\n * back to running at once where there is none, which leaves transitions on rather\n * than off.\n */\nexport function applyWithoutTransitions(\n doc: TransitionDocument,\n apply: () => void,\n schedule: (callback: () => void) => void = defaultSchedule\n): () => void {\n const style = doc.createElement('style')\n style.textContent = '*{transition:none !important}'\n doc.head.appendChild(style)\n // Reading a layout property forces the browser to commit the rule before the\n // properties change; without it the two can be batched into one style recalc.\n void style.offsetHeight\n let removed = false\n const restore = () => {\n if (removed) return\n removed = true\n style.remove()\n }\n try {\n apply()\n } catch (error) {\n restore()\n throw error\n }\n schedule(() => schedule(restore))\n return restore\n}\n\nfunction defaultSchedule(callback: () => void): void {\n if (typeof requestAnimationFrame === 'function') requestAnimationFrame(callback)\n else callback()\n}\n"],"mappings":";;;;;;;;;;;;AAqFA,SAAS,oBACP,QACA,SACA,aACwB;CACxB,IAAI,gBAAgB,SAAS,OAAO,CAAC;CACrC,OAAO,OAAO,YACZ,OAAO,QAAQ,OAAO,kBAAkB,SAAS,EAAE,QAAQ,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,UAC9E,KAAK,WAAW,WAAW,CAC7B,CACF;AACF;;;;;;;;;;;;;AAcA,SAAgB,oBACd,QACA,OACA,UAAgC,CAAC,GACsB;CACvD,iCAAiC,QAAQ,eAAe;CAGxD,MAAM,aADJ,QAAQ,YAAY,gBAAgB,OAAO,mBAAmB,MAAM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CACR,SAAS,OAAO;EACd,QAAQ;EACR,MAAM;CACR;CACA,eAAe,SAAS,OAAO,CAAC;CAChC,OAAO;AACT;AAEA,SAAS,gBAAgB,UAA4B;CACnD,IAAI,OAAO,0BAA0B,YAAY,sBAAsB,QAAQ;MAC1E,SAAS;AAChB"}
@@ -8,7 +8,7 @@ import type { ThemeVariant } from '#lib/theme-types';
8
8
  * apart at a glance and to recognise the one you want without applying it.
9
9
  *
10
10
  * A swatch is **read from the variant object**, not from a stylesheet, so a picker
11
- * can show a theme that is not currently applied — which is the whole point of a
11
+ * can show a theme that is not currently applied, which is the whole point of a
12
12
  * picker. That is also why the catalogue is data rather than CSS.
13
13
  */
14
14
  export type ThemeSwatchProps = ComponentProps<'span'> & {
@@ -23,8 +23,8 @@ export declare function ThemeSwatch(props: ThemeSwatchProps): import("solid-js")
23
23
  * A miniature of the interface, painted in a theme's own colours: a rail, a panel,
24
24
  * a heading, body text, a primary button and a destructive one.
25
25
  *
26
- * The point is that a colour strip cannot answer the question a user actually has —
27
- * "would I want to look at this all day?" — and a real preview can. It is drawn
26
+ * The point is that a colour strip cannot answer the question a user actually has,
27
+ * "would I want to look at this all day?", and a real preview can. It is drawn
28
28
  * with inline colours from the variant rather than by applying the theme, so a list
29
29
  * of twenty previews costs one object read each instead of twenty theme swaps.
30
30
  */
@@ -37,8 +37,8 @@ export declare function ThemePreview(props: ThemePreviewProps): import("solid-js
37
37
  /**
38
38
  * ThemePicker.
39
39
  *
40
- * The catalogue as a selectable grid. One appearance at a time — a light picker
41
- * lists light themes and a dark picker lists dark ones — because choosing a dark
40
+ * The catalogue as a selectable grid. One appearance at a time, a light picker
41
+ * lists light themes and a dark picker lists dark ones, because choosing a dark
42
42
  * theme while looking at a light interface is a choice nobody can evaluate.
43
43
  *
44
44
  * `onSelect` rather than an internal signal: the selection belongs to the
@@ -1 +1 @@
1
- {"version":3,"file":"theme-picker.js","names":["For","Show","splitProps","cn","Button","theme","size","swatchSizes","sm","md","lg","ThemeSwatch","props","local","rest","colors","_el$","_tmpl$","_$spread","_$mergeProps","class","_$insert","_$createComponent","each","background","card","primary","accent","destructiveAction","children","color","_el$2","_tmpl$2","_$setStyleProperty","_$effect","_$className","selected","ThemePreview","c","_el$3","_tmpl$3","firstChild","_el$5","_el$6","_el$7","nextSibling","_el$8","_el$0","_el$1","_el$10","_el$12","_el$13","_el$14","style","_p$","_v$","sidebar","_v$2","sidebarBorder","_v$3","_v$4","sidebarAccent","_v$5","_v$6","foreground","_v$7","mutedForeground","_v$8","_v$9","_v$0","_v$1","secondary","e","t","a","o","i","n","s","h","r","d","l","undefined","themes","selectedId","onThemeSelect","ThemePicker","_el$15","_tmpl$4","as","type","variant","role","id","familyLabel","label","onClick","_el$16","_tmpl$6","_el$17","when","family","_el$18","_tmpl$5"],"sources":["../../../src/components/theme/theme-picker.tsx"],"sourcesContent":["import type { ComponentProps } from 'solid-js'\nimport { For, Show, splitProps } from 'solid-js'\nimport { cn } from '#lib/utils'\nimport type { ThemeVariant } from '#lib/theme-types'\nimport { Button } from '../ui/button'\n\n/**\n * ThemeSwatch.\n *\n * The colours of a theme, as a small readable strip: the canvas, a card, the\n * primary, an accent and the destructive fill. Enough to tell two dark themes\n * apart at a glance and to recognise the one you want without applying it.\n *\n * A swatch is **read from the variant object**, not from a stylesheet, so a picker\n * can show a theme that is not currently applied — which is the whole point of a\n * picker. That is also why the catalogue is data rather than CSS.\n */\nexport type ThemeSwatchProps = ComponentProps<'span'> & {\n theme: ThemeVariant\n /** Draw the swatch at the given size. */\n size?: 'sm' | 'md' | 'lg'\n}\n\nconst swatchSizes = {\n sm: 'h-4 w-4',\n md: 'h-6 w-6',\n lg: 'h-8 w-8',\n} as const\n\nexport function ThemeSwatch(props: ThemeSwatchProps) {\n const [local, rest] = splitProps(props, ['class', 'theme', 'size'])\n const colors = () => local.theme.colors\n\n return (\n <span\n data-slot=\"theme-swatch\"\n aria-hidden=\"true\"\n class={cn(\n 'border-border inline-flex shrink-0 overflow-hidden rounded-md border',\n local.class\n )}\n {...rest}\n >\n <For\n each={[\n colors().background,\n colors().card,\n colors().primary,\n colors().accent,\n colors().destructiveAction,\n ]}\n >\n {(color) => (\n <span\n class={cn('block', swatchSizes[local.size ?? 'md'])}\n style={{ 'background-color': color }}\n />\n )}\n </For>\n </span>\n )\n}\n\n/**\n * ThemePreview.\n *\n * A miniature of the interface, painted in a theme's own colours: a rail, a panel,\n * a heading, body text, a primary button and a destructive one.\n *\n * The point is that a colour strip cannot answer the question a user actually has —\n * \"would I want to look at this all day?\" — and a real preview can. It is drawn\n * with inline colours from the variant rather than by applying the theme, so a list\n * of twenty previews costs one object read each instead of twenty theme swaps.\n */\nexport type ThemePreviewProps = ComponentProps<'div'> & {\n theme: ThemeVariant\n /** Highlight the preview as the current selection. */\n selected?: boolean\n}\n\nexport function ThemePreview(props: ThemePreviewProps) {\n const [local, rest] = splitProps(props, ['class', 'theme', 'selected'])\n const c = () => local.theme.colors\n\n return (\n <div\n data-slot=\"theme-preview\"\n class={cn(\n 'w-44 overflow-hidden rounded-lg border shadow-xs',\n local.selected ? 'border-primary ring-3 ring-primary-subtle' : 'border-border',\n local.class\n )}\n style={{ 'background-color': c().background }}\n {...rest}\n >\n <div class=\"flex h-24\">\n {/* A rail and a panel: the two surfaces a user spends the day looking at. */}\n <div\n class=\"theme-preview-edge flex w-6 flex-col items-center gap-1.5 border-e py-2\"\n style={{ 'background-color': c().sidebar, '--preview-edge': c().sidebarBorder }}\n >\n <span class=\"size-2.5 rounded-sm\" style={{ 'background-color': c().primary }} />\n <span class=\"size-2.5 rounded-sm\" style={{ 'background-color': c().sidebarAccent }} />\n <span class=\"size-2.5 rounded-sm\" style={{ 'background-color': c().sidebarAccent }} />\n </div>\n <div class=\"flex flex-1 flex-col gap-1.5 p-2\">\n <div class=\"h-1.5 w-14 rounded-full\" style={{ 'background-color': c().foreground }} />\n <div class=\"h-1 w-20 rounded-full\" style={{ 'background-color': c().mutedForeground }} />\n <div class=\"h-1 w-16 rounded-full\" style={{ 'background-color': c().mutedForeground }} />\n <div class=\"mt-auto flex items-center gap-1\">\n <span class=\"h-3 w-9 rounded-sm\" style={{ 'background-color': c().primary }} />\n <span\n class=\"h-3 w-6 rounded-sm\"\n style={{ 'background-color': c().destructiveAction }}\n />\n <span class=\"h-3 w-6 rounded-sm\" style={{ 'background-color': c().secondary }} />\n </div>\n </div>\n </div>\n </div>\n )\n}\n\n/**\n * ThemePicker.\n *\n * The catalogue as a selectable grid. One appearance at a time — a light picker\n * lists light themes and a dark picker lists dark ones — because choosing a dark\n * theme while looking at a light interface is a choice nobody can evaluate.\n *\n * `onSelect` rather than an internal signal: the selection belongs to the\n * preference the provider owns, and a picker that kept its own copy could disagree\n * with what is applied.\n */\nexport type ThemePickerProps = ComponentProps<'div'> & {\n themes: readonly ThemeVariant[]\n selectedId: string\n onThemeSelect: (theme: ThemeVariant) => void\n}\n\nexport function ThemePicker(props: ThemePickerProps) {\n const [local, rest] = splitProps(props, ['class', 'themes', 'selectedId', 'onThemeSelect'])\n\n return (\n <div\n data-slot=\"theme-picker\"\n role=\"radiogroup\"\n aria-label=\"Theme\"\n class={cn('flex flex-wrap gap-3', local.class)}\n {...rest}\n >\n <For each={local.themes}>\n {(theme) => (\n <Button\n as=\"button\"\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n role=\"radio\"\n aria-checked={local.selectedId === theme.id}\n aria-label={`${theme.familyLabel} ${theme.label}`}\n // `justify-start`: the options in a wrapped row stretch to its tallest\n // member, and an option whose label has a second line (the family)\n // is that member. Centred, every shorter option's preview dropped below\n // its neighbours'; pinned to the top, the previews share one line.\n class=\"h-auto flex-col justify-start gap-1.5 p-0 hover:bg-transparent\"\n onClick={() => local.onThemeSelect(theme)}\n >\n <ThemePreview theme={theme} selected={local.selectedId === theme.id} />\n <span class=\"flex flex-col items-center\">\n <span class=\"text-xs font-medium\">{theme.label}</span>\n <Show when={theme.family !== 'adea'}>\n <span class=\"text-muted-foreground text-2xs\">{theme.familyLabel}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F,MAAMyF;IAAE;IAAA,KAAA,gBAAA;KAAA,OAC/B,GAAGzF,MAAM0F,YAAW,GAAI1F,MAAM2F;IAAO;IAAA,SAAA;IAMjDC,eAAepF,MAAMyE,cAAcjF,KAAK;IAAC,IAAAwB,WAAA;KAAA,OAAA,CAAAP,gBAExCe,cAAY;MAAQhC;MAAK,IAAE+B,WAAQ;OAAA,OAAEvB,MAAMwE,eAAehF,MAAMyF;MAAE;KAAA,CAAA,UAAA;MAAA,IAAAI,SAAAC,QAAA,GAAAC,SAAAF,OAAAzD;MAAApB,OAAA+E,cAE9B/F,MAAM2F,KAAK;MAAA3E,OAAA6E,QAAA5E,gBAC7CrB,MAAI;OAAA,IAACoG,OAAI;QAAA,OAAEhG,MAAMiG,WAAW;OAAM;OAAA,IAAAzE,WAAA;QAAA,IAAA0E,SAAAC,QAAA;QAAAnF,OAAAkF,cACalG,MAAM0F,WAAW;QAAA,OAAAQ;OAAA;MAAA,CAAA,GAAA,IAAA;MAAA,OAAAL;KAAA,EAAA,CAAA,CAAA;IAAA;GAAA,CAAA;EAItE,CAAA,CAAA;EAAA,OAAAV;CAAA,EAAA,CAAA;AAIT"}
1
+ {"version":3,"file":"theme-picker.js","names":["For","Show","splitProps","cn","Button","theme","size","swatchSizes","sm","md","lg","ThemeSwatch","props","local","rest","colors","_el$","_tmpl$","_$spread","_$mergeProps","class","_$insert","_$createComponent","each","background","card","primary","accent","destructiveAction","children","color","_el$2","_tmpl$2","_$setStyleProperty","_$effect","_$className","selected","ThemePreview","c","_el$3","_tmpl$3","firstChild","_el$5","_el$6","_el$7","nextSibling","_el$8","_el$0","_el$1","_el$10","_el$12","_el$13","_el$14","style","_p$","_v$","sidebar","_v$2","sidebarBorder","_v$3","_v$4","sidebarAccent","_v$5","_v$6","foreground","_v$7","mutedForeground","_v$8","_v$9","_v$0","_v$1","secondary","e","t","a","o","i","n","s","h","r","d","l","undefined","themes","selectedId","onThemeSelect","ThemePicker","_el$15","_tmpl$4","as","type","variant","role","id","familyLabel","label","onClick","_el$16","_tmpl$6","_el$17","when","family","_el$18","_tmpl$5"],"sources":["../../../src/components/theme/theme-picker.tsx"],"sourcesContent":["import type { ComponentProps } from 'solid-js'\nimport { For, Show, splitProps } from 'solid-js'\nimport { cn } from '#lib/utils'\nimport type { ThemeVariant } from '#lib/theme-types'\nimport { Button } from '../ui/button'\n\n/**\n * ThemeSwatch.\n *\n * The colours of a theme, as a small readable strip: the canvas, a card, the\n * primary, an accent and the destructive fill. Enough to tell two dark themes\n * apart at a glance and to recognise the one you want without applying it.\n *\n * A swatch is **read from the variant object**, not from a stylesheet, so a picker\n * can show a theme that is not currently applied, which is the whole point of a\n * picker. That is also why the catalogue is data rather than CSS.\n */\nexport type ThemeSwatchProps = ComponentProps<'span'> & {\n theme: ThemeVariant\n /** Draw the swatch at the given size. */\n size?: 'sm' | 'md' | 'lg'\n}\n\nconst swatchSizes = {\n sm: 'h-4 w-4',\n md: 'h-6 w-6',\n lg: 'h-8 w-8',\n} as const\n\nexport function ThemeSwatch(props: ThemeSwatchProps) {\n const [local, rest] = splitProps(props, ['class', 'theme', 'size'])\n const colors = () => local.theme.colors\n\n return (\n <span\n data-slot=\"theme-swatch\"\n aria-hidden=\"true\"\n class={cn(\n 'border-border inline-flex shrink-0 overflow-hidden rounded-md border',\n local.class\n )}\n {...rest}\n >\n <For\n each={[\n colors().background,\n colors().card,\n colors().primary,\n colors().accent,\n colors().destructiveAction,\n ]}\n >\n {(color) => (\n <span\n class={cn('block', swatchSizes[local.size ?? 'md'])}\n style={{ 'background-color': color }}\n />\n )}\n </For>\n </span>\n )\n}\n\n/**\n * ThemePreview.\n *\n * A miniature of the interface, painted in a theme's own colours: a rail, a panel,\n * a heading, body text, a primary button and a destructive one.\n *\n * The point is that a colour strip cannot answer the question a user actually has,\n * \"would I want to look at this all day?\", and a real preview can. It is drawn\n * with inline colours from the variant rather than by applying the theme, so a list\n * of twenty previews costs one object read each instead of twenty theme swaps.\n */\nexport type ThemePreviewProps = ComponentProps<'div'> & {\n theme: ThemeVariant\n /** Highlight the preview as the current selection. */\n selected?: boolean\n}\n\nexport function ThemePreview(props: ThemePreviewProps) {\n const [local, rest] = splitProps(props, ['class', 'theme', 'selected'])\n const c = () => local.theme.colors\n\n return (\n <div\n data-slot=\"theme-preview\"\n class={cn(\n 'w-44 overflow-hidden rounded-lg border shadow-xs',\n local.selected ? 'border-primary ring-3 ring-primary-subtle' : 'border-border',\n local.class\n )}\n style={{ 'background-color': c().background }}\n {...rest}\n >\n <div class=\"flex h-24\">\n {/* A rail and a panel: the two surfaces a user spends the day looking at. */}\n <div\n class=\"theme-preview-edge flex w-6 flex-col items-center gap-1.5 border-e py-2\"\n style={{ 'background-color': c().sidebar, '--preview-edge': c().sidebarBorder }}\n >\n <span class=\"size-2.5 rounded-sm\" style={{ 'background-color': c().primary }} />\n <span class=\"size-2.5 rounded-sm\" style={{ 'background-color': c().sidebarAccent }} />\n <span class=\"size-2.5 rounded-sm\" style={{ 'background-color': c().sidebarAccent }} />\n </div>\n <div class=\"flex flex-1 flex-col gap-1.5 p-2\">\n <div class=\"h-1.5 w-14 rounded-full\" style={{ 'background-color': c().foreground }} />\n <div class=\"h-1 w-20 rounded-full\" style={{ 'background-color': c().mutedForeground }} />\n <div class=\"h-1 w-16 rounded-full\" style={{ 'background-color': c().mutedForeground }} />\n <div class=\"mt-auto flex items-center gap-1\">\n <span class=\"h-3 w-9 rounded-sm\" style={{ 'background-color': c().primary }} />\n <span\n class=\"h-3 w-6 rounded-sm\"\n style={{ 'background-color': c().destructiveAction }}\n />\n <span class=\"h-3 w-6 rounded-sm\" style={{ 'background-color': c().secondary }} />\n </div>\n </div>\n </div>\n </div>\n )\n}\n\n/**\n * ThemePicker.\n *\n * The catalogue as a selectable grid. One appearance at a time, a light picker\n * lists light themes and a dark picker lists dark ones, because choosing a dark\n * theme while looking at a light interface is a choice nobody can evaluate.\n *\n * `onSelect` rather than an internal signal: the selection belongs to the\n * preference the provider owns, and a picker that kept its own copy could disagree\n * with what is applied.\n */\nexport type ThemePickerProps = ComponentProps<'div'> & {\n themes: readonly ThemeVariant[]\n selectedId: string\n onThemeSelect: (theme: ThemeVariant) => void\n}\n\nexport function ThemePicker(props: ThemePickerProps) {\n const [local, rest] = splitProps(props, ['class', 'themes', 'selectedId', 'onThemeSelect'])\n\n return (\n <div\n data-slot=\"theme-picker\"\n role=\"radiogroup\"\n aria-label=\"Theme\"\n class={cn('flex flex-wrap gap-3', local.class)}\n {...rest}\n >\n <For each={local.themes}>\n {(theme) => (\n <Button\n as=\"button\"\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n role=\"radio\"\n aria-checked={local.selectedId === theme.id}\n aria-label={`${theme.familyLabel} ${theme.label}`}\n // `justify-start`: the options in a wrapped row stretch to its tallest\n // member, and an option whose label has a second line (the family)\n // is that member. Centred, every shorter option's preview dropped below\n // its neighbours'; pinned to the top, the previews share one line.\n class=\"h-auto flex-col justify-start gap-1.5 p-0 hover:bg-transparent\"\n onClick={() => local.onThemeSelect(theme)}\n >\n <ThemePreview theme={theme} selected={local.selectedId === theme.id} />\n <span class=\"flex flex-col items-center\">\n <span class=\"text-xs font-medium\">{theme.label}</span>\n <Show when={theme.family !== 'adea'}>\n <span class=\"text-muted-foreground text-2xs\">{theme.familyLabel}</span>\n </Show>\n </span>\n </Button>\n )}\n </For>\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;AAuBA,IAAMO,cAAc;CAClBC,IAAI;CACJC,IAAI;CACJC,IAAI;AACN;AAEA,SAAgBC,YAAYC,OAAyB;CACnD,MAAM,CAACC,OAAOC,QAAQZ,WAAWU,OAAO;EAAC;EAAS;EAAS;CAAM,CAAC;CAClE,MAAMG,eAAeF,MAAMR,MAAMU;CAEjC,cAAA;EAAA,IAAAC,OAAAC,OAAA;EAAAC,OAAAF,MAAAG,WAAA,EAAA,KAAA,WAAA;GAAA,OAIWhB,GACL,wEACAU,MAAMO,KACR;EAAC,EAAA,GACGN,IAAI,GAAA,OA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ACoG,OAAI;QAAA,OAAEhG,MAAMiG,WAAW;OAAM;OAAA,IAAAzE,WAAA;QAAA,IAAA0E,SAAAC,QAAA;QAAAnF,OAAAkF,cACalG,MAAM0F,WAAW;QAAA,OAAAQ;OAAA;MAAA,CAAA,GAAA,IAAA;MAAA,OAAAL;KAAA,EAAA,CAAA,CAAA;IAAA;GAAA,CAAA;EAItE,CAAA,CAAA;EAAA,OAAAV;CAAA,EAAA,CAAA;AAIT"}
@@ -156,12 +156,6 @@ export type ThemeCatalogueSource = {
156
156
  /** Start loading the full catalogue (idempotent). Resolves when `loaded()` is true. */
157
157
  load: () => Promise<void>;
158
158
  };
159
- /**
160
- * The provider, parameterised by where its catalogue comes from: the eager
161
- * `ThemeProvider` passes the whole catalogue, the lazy one a source that loads it.
162
- * Nothing here imports catalogue code or data, which is what lets the lazy entry keep
163
- * them out of a consumer's start-up chunk.
164
- */
165
159
  export declare function ThemeProviderWith(props: ThemeProviderProps & {
166
160
  catalogue: ThemeCatalogueSource;
167
161
  }): JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"theme-provider-value.d.ts","sourceRoot":"","sources":["../../../src/components/theme/theme-provider-value.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAUnC,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAA;AAKrE,OAAO,EAAiC,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAA;AACnF,OAAO,KAAK,EAAE,eAAe,EAAmB,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAGtF,OAAO,EAIL,KAAK,gBAAgB,EACtB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAQL,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACpB,MAAM,eAAe,CAAA;AAEtB;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,CAAC,EAAE,GAAG,CAAC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AAC,IAAI,CAAC,CAAA;CAC1B,CAAA;AASD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,kBAAkB,GAAG;IAAE,SAAS,EAAE,oBAAoB,CAAA;CAAE,GAC9D,GAAG,CAAC,OAAO,CAQb;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,kBAAkB,GAAG;IAAE,SAAS,EAAE,oBAAoB,CAAA;CAAE,GAC9D,iBAAiB,CA2NnB"}
1
+ {"version":3,"file":"theme-provider-value.d.ts","sourceRoot":"","sources":["../../../src/components/theme/theme-provider-value.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAUnC,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAA;AAKrE,OAAO,EAAiC,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAA;AACnF,OAAO,KAAK,EAAE,eAAe,EAAmB,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAGtF,OAAO,EAIL,KAAK,gBAAgB,EACtB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAQL,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACpB,MAAM,eAAe,CAAA;AAEtB;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IACtB,mEAAmE;IACnE,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,wDAAwD;IACxD,OAAO,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAA;IACjC;;;;;;;;;;;OAWG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAA;IACnC;;;;;OAKG;IACH,WAAW,CAAC,EAAE,gBAAgB,CAAA;IAC9B;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,SAAS,YAAY,EAAE,GAAG,CAAC,MAAM,SA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here imports catalogue code or data, which is what lets the lazy entry keep
20
20
  * them out of a consumer's start-up chunk.
21
21
  */
22
+ /** Selections are small plain records built in one key order, so this is exact. */
23
+ function sameThemeSelection(a, b) {
24
+ return a === b || JSON.stringify(a) === JSON.stringify(b);
25
+ }
22
26
  function ThemeProviderWith(props) {
23
27
  const value = createThemeContextValue(props);
24
28
  return createComponent(themeContext().Provider, {
@@ -56,7 +60,7 @@ function createThemeContextValue(props) {
56
60
  const source = () => local.catalogue;
57
61
  const engine = () => source().engine();
58
62
  const registry = createMemo(() => mergeRegistry(engine().builtinThemes, extraThemes()));
59
- const [selection, setSelectionState] = createSignal(initialThemeSelection(readPersisted(persistence), local.initial));
63
+ const [selection, setSelectionState] = createSignal(initialThemeSelection(readPersisted(persistence), local.initial), { equals: sameThemeSelection });
60
64
  createEffect(() => {
61
65
  const incoming = local.selection;
62
66
  if (incoming) setSelectionState((current) => mergeThemeSelection(current, incoming));
@@ -177,9 +181,11 @@ function createThemeContextValue(props) {
177
181
  reduceTransparencyActive: () => committedSurface()?.reduceTransparencyActive ?? false,
178
182
  zoomFonts,
179
183
  setSelection(patch) {
180
- const next = mergeThemeSelection(selection(), patch);
181
- setSelectionState(next);
184
+ const current = selection();
185
+ const next = mergeThemeSelection(current, patch);
182
186
  setDraft(void 0);
187
+ if (sameThemeSelection(current, next)) return;
188
+ setSelectionState(next);
183
189
  writePersisted(persistence, next);
184
190
  }
185
191
  };
@@ -1 +1 @@
1
- {"version":3,"file":"theme-provider-value.js","names":[],"sources":["../../../src/components/theme/theme-provider-value.ts"],"sourcesContent":["import type { JSX } from 'solid-js'\nimport {\n createComponent,\n createEffect,\n createMemo,\n createSignal,\n onCleanup,\n splitProps,\n untrack,\n} from 'solid-js'\nimport type { ThemeTokenProjectionOptions } from './token-projection'\nimport { assertThemeTokenProjectionConfig } from './token-projection-options'\nimport { fontZoomShortcut, type FontZoomIntent } from '#lib/font-zoom'\nimport { DEFAULT_THEME_STORAGE_KEY } from '#lib/theme-defaults'\nimport { REDUCED_TRANSPARENCY_QUERY, resolveSurfaceState } from '#lib/theme-surface'\nimport { needsCatalogue, pairNeedsData, type ThemeEngine } from '#lib/theme-engine'\nimport type { EditorRolesMode, ThemeAppearance, ThemeVariant } from '#lib/theme-types'\nimport { themeContext } from './theme-context'\nimport { applyThemeToRoot, applyWithoutTransitions } from './theme-document'\nimport {\n localStoragePersistence,\n readPersisted,\n writePersisted,\n type ThemePersistence,\n} from './theme-persistence'\nimport {\n accentRolesForState,\n initialThemeSelection,\n mergeRegistry,\n mergeThemeSelection,\n resolveTerminalVariant,\n resolveThemeState,\n zoomedFontSettings,\n type ThemeContextValue,\n type ThemeSelection,\n} from './theme-state'\n\n/**\n * The props both `ThemeProvider`s take.\n *\n * ## What a preference is\n *\n * Four independent choices (`ThemeSelection`), and keeping them independent is the\n * point: appearance, a theme per appearance, an accent and fonts. They compose: a\n * user who wants Nord with a violet accent and the system font should not need\n * someone to author that combination.\n *\n * ## Where the rules live\n *\n * The provider is wiring. What a selection merges to and resolves to is\n * `theme-state.ts`; what lands on `<html>` is `theme-document.ts`; where the\n * preference is kept is `theme-persistence.ts`.\n *\n * ## Why the variants are applied as inline properties\n *\n * The catalogue is data, and a theme is applied by writing its roles onto\n * `<html>` as custom properties. That is what makes an imported palette work\n * without a hand-written `[data-theme]` block per theme, and it is why a settings\n * UI can show a preview by reading the same object rather than by loading a\n * stylesheet. `theme.css` keeps the default theme's values so the first paint is\n * correct before any script runs.\n */\nexport type ThemeProviderProps = {\n children?: JSX.Element\n /** Where the preference is persisted. Distinct per application. */\n storageKey?: string\n /** Start from this instead of the stored preference. */\n initial?: Partial<ThemeSelection>\n /**\n * The selection, owned by the caller.\n *\n * For a consumer that keeps the state itself — a settings store, or a workshop\n * whose selection lives in Storybook globals — rather than handing it to this\n * provider's signal. Each change lands here and the document follows; nothing is\n * written to the store, because the caller is the one who persists. A picker\n * below the provider still works, and its change is the caller's to read back.\n *\n * Absent, the provider is the whole owner: it reads `storageKey` on mount,\n * seeds from `initial`, and persists every `setSelection`.\n */\n selection?: Partial<ThemeSelection>\n /**\n * Where the preference is kept, in place of `localStorage` under `storageKey`.\n *\n * Read once when the provider is created, so changing the prop later does not\n * move the store. `storageKey` is ignored when this is given.\n */\n persistence?: ThemePersistence\n /**\n * Variants the host adds to the built-in catalogue — themes a user imported.\n *\n * A function is read inside the provider's reactive scope, so one that reads a\n * signal keeps the picker and the document current when the set changes. A\n * stored id that names no variant, built in or added, paints the default of its\n * appearance and stays in the selection untouched.\n */\n themes?: readonly ThemeVariant[] | (() => readonly ThemeVariant[])\n /**\n * Rewrites the custom properties of each pass before they are written to\n * `<html>`: the variant's roles with the accent over them. `tokensAsHex` from\n * `lib/themes` is the one the system ships.\n */\n transformTokens?: (tokens: Record<string, string>) => Record<string, string>\n /**\n * Switch CSS transitions off for the frame that carries a change, so a theme\n * switch cannot animate the whole page. Off by default: it adds a `<style>`\n * element to `<head>` for two frames on every change.\n */\n disableTransitionOnChange?: boolean\n /**\n * The contrast ratio an accent is held to against the variant's background,\n * repaired to the nearest passing colour when it falls short. Absent, presets\n * are painted verbatim — the catalogue measured them for its own themes — and\n * only a custom `#rrggbb` is held to 3:1. A host that adds themes the catalogue\n * never measured passes 3 to hold the presets to it as well; for the catalogue's\n * own themes the floor changes no preset.\n */\n accentContrastFloor?: number\n /**\n * Turns the surface axis on: `selection.surface` and `selection.reduceTransparency`\n * are resolved against the operating system's Reduce Transparency setting and the\n * host's capability, and `data-surface`, `data-reduce-transparency` and\n * `--surface-alpha` are written to `<html>` (the frost rule in `theme.css` reads\n * them). Off by default: a provider that never opts in writes none of them, adds no\n * media-query listener, and stores nothing new.\n *\n * An object also states the host's capability. `nativeTranslucency` is whether the\n * window can render the OS's own translucency; without it a `translucent`\n * preference paints the tokenized `frosted` surface instead of pretending to\n * vibrancy. A function is read inside the provider's reactive scope, for a\n * capability that is learned after mount.\n *\n * A selection that already carries a `surface` turns the axis on for itself, so a\n * host that stores the field gets the same document without the prop.\n */\n surface?: boolean | { nativeTranslucency?: boolean | (() => boolean) }\n /**\n * Where a catalogue variant's palette comes from. `inline` (the default) writes\n * every role onto `<html>`. `stylesheet` leaves a catalogue variant to the host's\n * `[data-theme]` stylesheet and writes inline only what no stylesheet can know: a\n * host's own `themes`, the accent, the pinned terminal palette, the surface alpha\n * and the fonts. Switching from a host variant back to a catalogue one removes the\n * properties the host variant wrote.\n */\n palette?: 'inline' | 'stylesheet'\n /**\n * The projection behind the `--editor-*` ramp. `syntax` (the default) is the\n * catalogue's quiet syntax roles, a comment among them deliberately below\n * body-text contrast. `floor` holds all sixteen roles to 4.5:1 on the canvas, as\n * hex, for a host that renders code as content (a diff, a file view) rather than\n * as decoration.\n *\n * Applies to catalogue variants; a host's own `themes` keep their `editor` and\n * their `tokens`. With `palette=\"stylesheet\"` it is the one palette property a\n * catalogue variant still writes inline, because `theme-variants.css` is generated\n * for `syntax`. Absent, nothing changes.\n */\n editorRoles?: EditorRolesMode\n /**\n * Bind the platform zoom chords (Cmd or Ctrl with `=`, `+`, `-`, `0`) to the three\n * text sizes instead of the browser's page zoom: stepping them together is zoom\n * inside the persisted type system. Off by default: it adds a capturing `keydown`\n * listener to `window`, and an event already handled elsewhere is left alone.\n * `zoomFonts` on the context does the same from a menu or a host's own binding.\n */\n fontZoom?: boolean\n} & ThemeTokenProjectionOptions\n\n/**\n * Where the provider's catalogue questions are answered, and whether the whole\n * catalogue is available yet.\n *\n * The eager provider's source is the full catalogue and is always loaded. The lazy\n * provider's source starts on the default pair that ships with it and swaps to the\n * full catalogue when {@link ThemeCatalogueSource.load} resolves. Both read the same\n * way in the provider: `engine()` is reactive, so everything derived from it follows\n * the swap.\n */\nexport type ThemeCatalogueSource = {\n /** The engine answering catalogue questions now. Changes once, when loading completes. */\n engine: () => ThemeEngine\n /** True when `engine()` is the full catalogue. */\n loaded: () => boolean\n /** True when loading failed; the provider then paints what it can without the rest. */\n failed: () => boolean\n /** Start loading the full catalogue (idempotent). Resolves when `loaded()` is true. */\n load: () => Promise<void>\n}\n\n/** The operating system's Reduce Transparency query, where there is a window to ask. */\nfunction reducedTransparencyMedia(): MediaQueryList | undefined {\n return typeof window !== 'undefined' && typeof window.matchMedia === 'function'\n ? window.matchMedia(REDUCED_TRANSPARENCY_QUERY)\n : undefined\n}\n\n/**\n * The provider, parameterised by where its catalogue comes from: the eager\n * `ThemeProvider` passes the whole catalogue, the lazy one a source that loads it.\n * Nothing here imports catalogue code or data, which is what lets the lazy entry keep\n * them out of a consumer's start-up chunk.\n */\nexport function ThemeProviderWith(\n props: ThemeProviderProps & { catalogue: ThemeCatalogueSource }\n): JSX.Element {\n const value = createThemeContextValue(props)\n return createComponent(themeContext().Provider, {\n value,\n get children() {\n return props.children\n },\n })\n}\n\n/**\n * Everything the provider is, as a value: the context object, with its effects and\n * listeners created in the caller's reactive scope.\n */\nexport function createThemeContextValue(\n props: ThemeProviderProps & { catalogue: ThemeCatalogueSource }\n): ThemeContextValue {\n assertThemeTokenProjectionConfig(props.tokenProjection)\n const [local] = splitProps(props, [\n 'catalogue',\n 'storageKey',\n 'initial',\n 'selection',\n 'persistence',\n 'themes',\n 'transformTokens',\n 'tokenProjection',\n 'disableTransitionOnChange',\n 'accentContrastFloor',\n 'surface',\n 'palette',\n 'editorRoles',\n 'fontZoom',\n ])\n const storageKey = () => local.storageKey ?? DEFAULT_THEME_STORAGE_KEY\n const persistence = local.persistence ?? localStoragePersistence(storageKey)\n\n // Read before the first resolution and before the store is, so a persistence whose\n // answer depends on the extras (an id it only accepts if the theme exists) sees\n // them.\n const extraThemes = createMemo(() =>\n typeof local.themes === 'function' ? local.themes() : (local.themes ?? [])\n )\n const source = () => local.catalogue\n const engine = () => source().engine()\n const registry = createMemo(() => mergeRegistry(engine().builtinThemes, extraThemes()))\n\n const [selection, setSelectionState] = createSignal<ThemeSelection>(\n initialThemeSelection(readPersisted(persistence), local.initial)\n )\n\n // The controlled half of the contract. A patch from the owner replaces the\n // matching axes; the stored preference is untouched, since the owner is the one\n // that persists. Reading `local.selection` — a prop getter, not a destructured\n // value — is what keeps this subscribed for the provider's lifetime.\n createEffect(() => {\n const incoming = local.selection\n if (incoming) setSelectionState((current) => mergeThemeSelection(current, incoming))\n })\n\n const [systemAppearance, setSystemAppearance] = createSignal<ThemeAppearance>('light')\n\n if (typeof window !== 'undefined' && typeof window.matchMedia === 'function') {\n const query = window.matchMedia('(prefers-color-scheme: dark)')\n setSystemAppearance(query.matches ? 'dark' : 'light')\n const onChange = (event: MediaQueryListEvent) =>\n setSystemAppearance(event.matches ? 'dark' : 'light')\n query.addEventListener('change', onChange)\n onCleanup(() => query.removeEventListener('change', onChange))\n }\n\n // What the stored preference resolves to. `selection()`, `variant()` and\n // `resolvedAppearance()` answer from this and never from a preview, so a picker\n // that previews a draft still reads back what is committed.\n const committed = createMemo(() => resolveThemeState(selection(), systemAppearance(), registry()))\n const resolvedAppearance = createMemo<ThemeAppearance>(() => committed().appearance)\n const variant = createMemo<ThemeVariant>(() => committed().variant)\n\n const [draft, setDraft] = createSignal<Partial<ThemeSelection> | undefined>()\n const shownSelection = createMemo(() => {\n const preview = draft()\n return preview ? mergeThemeSelection(selection(), preview) : selection()\n })\n const shown = createMemo(() =>\n draft() ? resolveThemeState(shownSelection(), systemAppearance(), registry()) : committed()\n )\n const shownAppearance = createMemo<ThemeAppearance>(() => shown().appearance)\n\n // The surface axis. Off, none of this reads the operating system: the media query\n // is subscribed only while the axis is on, so a provider that never opts in adds no\n // listener and no repaint.\n const surfaceOn = (candidate: ThemeSelection) =>\n local.surface === true || typeof local.surface === 'object' || candidate.surface !== undefined\n const nativeTranslucency = () => {\n const capability = typeof local.surface === 'object' ? local.surface.nativeTranslucency : false\n return (typeof capability === 'function' ? capability() : capability) === true\n }\n const [osReducedTransparency, setOsReducedTransparency] = createSignal(\n surfaceOn(untrack(shownSelection)) ? (reducedTransparencyMedia()?.matches ?? false) : false\n )\n const axisOn = createMemo(() => surfaceOn(shownSelection()))\n createEffect(() => {\n const query = axisOn() ? reducedTransparencyMedia() : undefined\n setOsReducedTransparency(query?.matches ?? false)\n if (!query) return\n const onChange = (event: MediaQueryListEvent) => setOsReducedTransparency(event.matches)\n query.addEventListener('change', onChange)\n onCleanup(() => query.removeEventListener('change', onChange))\n })\n const surfaceStateOf = (candidate: ThemeSelection) =>\n resolveSurfaceState(candidate.surface, {\n osReducedTransparency: osReducedTransparency(),\n userReducedTransparency: candidate.reduceTransparency === true,\n nativeTranslucency: nativeTranslucency(),\n })\n const committedSurface = createMemo(() =>\n surfaceOn(selection()) ? surfaceStateOf(selection()) : undefined\n )\n\n // A selection that names a catalogue theme beyond the shipped default pair cannot be\n // painted or previewed until the whole catalogue has loaded. Once a load has failed\n // the provider paints what the shipped data can.\n const waitingFor = (candidate: ThemeSelection, appearance: ThemeAppearance) =>\n !source().loaded() && !source().failed() && needsCatalogue(candidate, appearance)\n createEffect(() => {\n if (\n needsCatalogue(selection(), committed().appearance) ||\n needsCatalogue(shownSelection(), shown().appearance)\n )\n void source().load()\n })\n\n let written: ReadonlySet<string> | undefined\n let restoreTransitions: (() => void) | undefined\n createEffect(() => {\n if (typeof document === 'undefined') return\n const current = engine()\n const display = shown()\n // Until the catalogue arrives the document keeps what is already on it — the\n // stylesheet's theme, set before first paint by `themeScript` — instead of\n // flashing the default for a theme that is only not loaded yet.\n if (waitingFor(shownSelection(), display.appearance)) return\n const state = {\n selection: shownSelection(),\n appearance: display.appearance,\n variant: display.variant,\n terminalVariant: resolveTerminalVariant(shownSelection().terminalThemeId, registry()),\n surface: axisOn() ? surfaceStateOf(shownSelection()) : undefined,\n }\n const projectionOptions = local.tokenProjection\n ? { tokenProjection: local.tokenProjection }\n : {}\n const options = {\n transformTokens: local.transformTokens,\n ...projectionOptions,\n accentContrastFloor: local.accentContrastFloor,\n palette: local.palette,\n editorRoles: local.editorRoles,\n }\n const apply = () => {\n written = applyThemeToRoot(current, document.documentElement, state, options, written)\n }\n if (local.disableTransitionOnChange) {\n restoreTransitions?.()\n restoreTransitions = applyWithoutTransitions(document, apply)\n } else {\n apply()\n }\n })\n onCleanup(() => restoreTransitions?.())\n\n // A pair beyond the defaults offers its accents once the catalogue is here; reading\n // them is not a reason to load it.\n const themeAccents = createMemo(() =>\n !source().loaded() && pairNeedsData(selection())\n ? []\n : engine().themeAccentsFor(selection().lightThemeId, selection().darkThemeId)\n )\n\n const zoomFonts = (intent: FontZoomIntent) =>\n value.setSelection({ fonts: zoomedFontSettings(selection(), intent) })\n\n // The platform zoom chords drive the three text sizes, captured like the other\n // global chords; an event something else already handled never double-steps.\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.defaultPrevented) return\n const intent = fontZoomShortcut(event)\n if (!intent) return\n event.preventDefault()\n zoomFonts(intent)\n }\n createEffect(() => {\n if (!local.fontZoom || typeof window === 'undefined') return\n window.addEventListener('keydown', onKeyDown, { capture: true })\n onCleanup(() => window.removeEventListener('keydown', onKeyDown, { capture: true }))\n })\n\n const value: ThemeContextValue = {\n selection,\n resolvedAppearance,\n shownAppearance,\n variant,\n get themes() {\n return engine().builtinThemes\n },\n themeAccents,\n allThemes: registry,\n preview(next) {\n setDraft(next ? { ...next } : undefined)\n },\n previewing: () => draft() !== undefined,\n accentRolesFor(accent, variantId) {\n // Before the catalogue arrives the light engine answers provisionally and asks\n // for it; reading `engine()` re-runs a reactive caller on arrival.\n return accentRolesForState(engine(), accent, variantId, {\n selection: selection(),\n variant: variant(),\n registry: registry(),\n accentContrastFloor: local.accentContrastFloor,\n })\n },\n catalogueReady: () => source().loaded(),\n loadCatalogue: () => source().load(),\n effectiveSurface: () => committedSurface()?.surface ?? 'opaque',\n reduceTransparencyActive: () => committedSurface()?.reduceTransparencyActive ?? false,\n zoomFonts,\n setSelection(patch) {\n const next = mergeThemeSelection(selection(), patch)\n setSelectionState(next)\n setDraft(undefined)\n writePersisted(persistence, next)\n },\n }\n\n return value\n}\n"],"mappings":";;;;;;;;;;;;AA8LA,SAAS,2BAAuD;CAC9D,OAAO,OAAO,WAAW,eAAe,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CAAS;GAClB,eAAe,aAAa,IAAI;EAClC;CACF;CAEA,OAAO;AACT"}
1
+ {"version":3,"file":"theme-provider-value.js","names":[],"sources":["../../../src/components/theme/theme-provider-value.ts"],"sourcesContent":["import type { JSX } from 'solid-js'\nimport {\n createComponent,\n createEffect,\n createMemo,\n createSignal,\n onCleanup,\n splitProps,\n untrack,\n} from 'solid-js'\nimport type { ThemeTokenProjectionOptions } from './token-projection'\nimport { assertThemeTokenProjectionConfig } from './token-projection-options'\nimport { fontZoomShortcut, type FontZoomIntent } from '#lib/font-zoom'\nimport { DEFAULT_THEME_STORAGE_KEY } from '#lib/theme-defaults'\nimport { REDUCED_TRANSPARENCY_QUERY, resolveSurfaceState } from '#lib/theme-surface'\nimport { needsCatalogue, pairNeedsData, type ThemeEngine } from '#lib/theme-engine'\nimport type { EditorRolesMode, ThemeAppearance, ThemeVariant } from '#lib/theme-types'\nimport { themeContext } from './theme-context'\nimport { applyThemeToRoot, applyWithoutTransitions } from './theme-document'\nimport {\n localStoragePersistence,\n readPersisted,\n writePersisted,\n type ThemePersistence,\n} from './theme-persistence'\nimport {\n accentRolesForState,\n initialThemeSelection,\n mergeRegistry,\n mergeThemeSelection,\n resolveTerminalVariant,\n resolveThemeState,\n zoomedFontSettings,\n type ThemeContextValue,\n type ThemeSelection,\n} from './theme-state'\n\n/**\n * The props both `ThemeProvider`s take.\n *\n * ## What a preference is\n *\n * Four independent choices (`ThemeSelection`), and keeping them independent is the\n * point: appearance, a theme per appearance, an accent and fonts. They compose: a\n * user who wants Nord with a violet accent and the system font should not need\n * someone to author that combination.\n *\n * ## Where the rules live\n *\n * The provider is wiring. What a selection merges to and resolves to is\n * `theme-state.ts`; what lands on `<html>` is `theme-document.ts`; where the\n * preference is kept is `theme-persistence.ts`.\n *\n * ## Why the variants are applied as inline properties\n *\n * The catalogue is data, and a theme is applied by writing its roles onto\n * `<html>` as custom properties. That is what makes an imported palette work\n * without a hand-written `[data-theme]` block per theme, and it is why a settings\n * UI can show a preview by reading the same object rather than by loading a\n * stylesheet. `theme.css` keeps the default theme's values so the first paint is\n * correct before any script runs.\n */\nexport type ThemeProviderProps = {\n children?: JSX.Element\n /** Where the preference is persisted. Distinct per application. */\n storageKey?: string\n /** Start from this instead of the stored preference. */\n initial?: Partial<ThemeSelection>\n /**\n * The selection, owned by the caller.\n *\n * For a consumer that keeps the state itself — a settings store, or a workshop\n * whose selection lives in Storybook globals — rather than handing it to this\n * provider's signal. Each change lands here and the document follows; nothing is\n * written to the store, because the caller is the one who persists. A picker\n * below the provider still works, and its change is the caller's to read back.\n *\n * Absent, the provider is the whole owner: it reads `storageKey` on mount,\n * seeds from `initial`, and persists every `setSelection`.\n */\n selection?: Partial<ThemeSelection>\n /**\n * Where the preference is kept, in place of `localStorage` under `storageKey`.\n *\n * Read once when the provider is created, so changing the prop later does not\n * move the store. `storageKey` is ignored when this is given.\n */\n persistence?: ThemePersistence\n /**\n * Variants the host adds to the built-in catalogue — themes a user imported.\n *\n * A function is read inside the provider's reactive scope, so one that reads a\n * signal keeps the picker and the document current when the set changes. A\n * stored id that names no variant, built in or added, paints the default of its\n * appearance and stays in the selection untouched.\n */\n themes?: readonly ThemeVariant[] | (() => readonly ThemeVariant[])\n /**\n * Rewrites the custom properties of each pass before they are written to\n * `<html>`: the variant's roles with the accent over them. `tokensAsHex` from\n * `lib/themes` is the one the system ships.\n */\n transformTokens?: (tokens: Record<string, string>) => Record<string, string>\n /**\n * Switch CSS transitions off for the frame that carries a change, so a theme\n * switch cannot animate the whole page. Off by default: it adds a `<style>`\n * element to `<head>` for two frames on every change.\n */\n disableTransitionOnChange?: boolean\n /**\n * The contrast ratio an accent is held to against the variant's background,\n * repaired to the nearest passing colour when it falls short. Absent, presets\n * are painted verbatim — the catalogue measured them for its own themes — and\n * only a custom `#rrggbb` is held to 3:1. A host that adds themes the catalogue\n * never measured passes 3 to hold the presets to it as well; for the catalogue's\n * own themes the floor changes no preset.\n */\n accentContrastFloor?: number\n /**\n * Turns the surface axis on: `selection.surface` and `selection.reduceTransparency`\n * are resolved against the operating system's Reduce Transparency setting and the\n * host's capability, and `data-surface`, `data-reduce-transparency` and\n * `--surface-alpha` are written to `<html>` (the frost rule in `theme.css` reads\n * them). Off by default: a provider that never opts in writes none of them, adds no\n * media-query listener, and stores nothing new.\n *\n * An object also states the host's capability. `nativeTranslucency` is whether the\n * window can render the OS's own translucency; without it a `translucent`\n * preference paints the tokenized `frosted` surface instead of pretending to\n * vibrancy. A function is read inside the provider's reactive scope, for a\n * capability that is learned after mount.\n *\n * A selection that already carries a `surface` turns the axis on for itself, so a\n * host that stores the field gets the same document without the prop.\n */\n surface?: boolean | { nativeTranslucency?: boolean | (() => boolean) }\n /**\n * Where a catalogue variant's palette comes from. `inline` (the default) writes\n * every role onto `<html>`. `stylesheet` leaves a catalogue variant to the host's\n * `[data-theme]` stylesheet and writes inline only what no stylesheet can know: a\n * host's own `themes`, the accent, the pinned terminal palette, the surface alpha\n * and the fonts. Switching from a host variant back to a catalogue one removes the\n * properties the host variant wrote.\n */\n palette?: 'inline' | 'stylesheet'\n /**\n * The projection behind the `--editor-*` ramp. `syntax` (the default) is the\n * catalogue's quiet syntax roles, a comment among them deliberately below\n * body-text contrast. `floor` holds all sixteen roles to 4.5:1 on the canvas, as\n * hex, for a host that renders code as content (a diff, a file view) rather than\n * as decoration.\n *\n * Applies to catalogue variants; a host's own `themes` keep their `editor` and\n * their `tokens`. With `palette=\"stylesheet\"` it is the one palette property a\n * catalogue variant still writes inline, because `theme-variants.css` is generated\n * for `syntax`. Absent, nothing changes.\n */\n editorRoles?: EditorRolesMode\n /**\n * Bind the platform zoom chords (Cmd or Ctrl with `=`, `+`, `-`, `0`) to the three\n * text sizes instead of the browser's page zoom: stepping them together is zoom\n * inside the persisted type system. Off by default: it adds a capturing `keydown`\n * listener to `window`, and an event already handled elsewhere is left alone.\n * `zoomFonts` on the context does the same from a menu or a host's own binding.\n */\n fontZoom?: boolean\n} & ThemeTokenProjectionOptions\n\n/**\n * Where the provider's catalogue questions are answered, and whether the whole\n * catalogue is available yet.\n *\n * The eager provider's source is the full catalogue and is always loaded. The lazy\n * provider's source starts on the default pair that ships with it and swaps to the\n * full catalogue when {@link ThemeCatalogueSource.load} resolves. Both read the same\n * way in the provider: `engine()` is reactive, so everything derived from it follows\n * the swap.\n */\nexport type ThemeCatalogueSource = {\n /** The engine answering catalogue questions now. Changes once, when loading completes. */\n engine: () => ThemeEngine\n /** True when `engine()` is the full catalogue. */\n loaded: () => boolean\n /** True when loading failed; the provider then paints what it can without the rest. */\n failed: () => boolean\n /** Start loading the full catalogue (idempotent). Resolves when `loaded()` is true. */\n load: () => Promise<void>\n}\n\n/** The operating system's Reduce Transparency query, where there is a window to ask. */\nfunction reducedTransparencyMedia(): MediaQueryList | undefined {\n return typeof window !== 'undefined' && typeof window.matchMedia === 'function'\n ? window.matchMedia(REDUCED_TRANSPARENCY_QUERY)\n : undefined\n}\n\n/**\n * The provider, parameterised by where its catalogue comes from: the eager\n * `ThemeProvider` passes the whole catalogue, the lazy one a source that loads it.\n * Nothing here imports catalogue code or data, which is what lets the lazy entry keep\n * them out of a consumer's start-up chunk.\n */\n\n/** Selections are small plain records built in one key order, so this is exact. */\nfunction sameThemeSelection(a: ThemeSelection, b: ThemeSelection) {\n return a === b || JSON.stringify(a) === JSON.stringify(b)\n}\n\nexport function ThemeProviderWith(\n props: ThemeProviderProps & { catalogue: ThemeCatalogueSource }\n): JSX.Element {\n const value = createThemeContextValue(props)\n return createComponent(themeContext().Provider, {\n value,\n get children() {\n return props.children\n },\n })\n}\n\n/**\n * Everything the provider is, as a value: the context object, with its effects and\n * listeners created in the caller's reactive scope.\n */\nexport function createThemeContextValue(\n props: ThemeProviderProps & { catalogue: ThemeCatalogueSource }\n): ThemeContextValue {\n assertThemeTokenProjectionConfig(props.tokenProjection)\n const [local] = splitProps(props, [\n 'catalogue',\n 'storageKey',\n 'initial',\n 'selection',\n 'persistence',\n 'themes',\n 'transformTokens',\n 'tokenProjection',\n 'disableTransitionOnChange',\n 'accentContrastFloor',\n 'surface',\n 'palette',\n 'editorRoles',\n 'fontZoom',\n ])\n const storageKey = () => local.storageKey ?? DEFAULT_THEME_STORAGE_KEY\n const persistence = local.persistence ?? localStoragePersistence(storageKey)\n\n // Read before the first resolution and before the store is, so a persistence whose\n // answer depends on the extras (an id it only accepts if the theme exists) sees\n // them.\n const extraThemes = createMemo(() =>\n typeof local.themes === 'function' ? local.themes() : (local.themes ?? [])\n )\n const source = () => local.catalogue\n const engine = () => source().engine()\n const registry = createMemo(() => mergeRegistry(engine().builtinThemes, extraThemes()))\n\n // A patch that changes nothing (pressing the current toggle again, a font step\n // that clamps) leaves the signal alone, so the document pass and the store write\n // that follow every change do not run for it.\n const [selection, setSelectionState] = createSignal<ThemeSelection>(\n initialThemeSelection(readPersisted(persistence), local.initial),\n { equals: sameThemeSelection }\n )\n\n // The controlled half of the contract. A patch from the owner replaces the\n // matching axes; the stored preference is untouched, since the owner is the one\n // that persists. Reading `local.selection` — a prop getter, not a destructured\n // value — is what keeps this subscribed for the provider's lifetime.\n createEffect(() => {\n const incoming = local.selection\n if (incoming) setSelectionState((current) => mergeThemeSelection(current, incoming))\n })\n\n const [systemAppearance, setSystemAppearance] = createSignal<ThemeAppearance>('light')\n\n if (typeof window !== 'undefined' && typeof window.matchMedia === 'function') {\n const query = window.matchMedia('(prefers-color-scheme: dark)')\n setSystemAppearance(query.matches ? 'dark' : 'light')\n const onChange = (event: MediaQueryListEvent) =>\n setSystemAppearance(event.matches ? 'dark' : 'light')\n query.addEventListener('change', onChange)\n onCleanup(() => query.removeEventListener('change', onChange))\n }\n\n // What the stored preference resolves to. `selection()`, `variant()` and\n // `resolvedAppearance()` answer from this and never from a preview, so a picker\n // that previews a draft still reads back what is committed.\n const committed = createMemo(() => resolveThemeState(selection(), systemAppearance(), registry()))\n const resolvedAppearance = createMemo<ThemeAppearance>(() => committed().appearance)\n const variant = createMemo<ThemeVariant>(() => committed().variant)\n\n const [draft, setDraft] = createSignal<Partial<ThemeSelection> | undefined>()\n const shownSelection = createMemo(() => {\n const preview = draft()\n return preview ? mergeThemeSelection(selection(), preview) : selection()\n })\n const shown = createMemo(() =>\n draft() ? resolveThemeState(shownSelection(), systemAppearance(), registry()) : committed()\n )\n const shownAppearance = createMemo<ThemeAppearance>(() => shown().appearance)\n\n // The surface axis. Off, none of this reads the operating system: the media query\n // is subscribed only while the axis is on, so a provider that never opts in adds no\n // listener and no repaint.\n const surfaceOn = (candidate: ThemeSelection) =>\n local.surface === true || typeof local.surface === 'object' || candidate.surface !== undefined\n const nativeTranslucency = () => {\n const capability = typeof local.surface === 'object' ? local.surface.nativeTranslucency : false\n return (typeof capability === 'function' ? capability() : capability) === true\n }\n const [osReducedTransparency, setOsReducedTransparency] = createSignal(\n surfaceOn(untrack(shownSelection)) ? (reducedTransparencyMedia()?.matches ?? false) : false\n )\n const axisOn = createMemo(() => surfaceOn(shownSelection()))\n createEffect(() => {\n const query = axisOn() ? reducedTransparencyMedia() : undefined\n setOsReducedTransparency(query?.matches ?? false)\n if (!query) return\n const onChange = (event: MediaQueryListEvent) => setOsReducedTransparency(event.matches)\n query.addEventListener('change', onChange)\n onCleanup(() => query.removeEventListener('change', onChange))\n })\n const surfaceStateOf = (candidate: ThemeSelection) =>\n resolveSurfaceState(candidate.surface, {\n osReducedTransparency: osReducedTransparency(),\n userReducedTransparency: candidate.reduceTransparency === true,\n nativeTranslucency: nativeTranslucency(),\n })\n const committedSurface = createMemo(() =>\n surfaceOn(selection()) ? surfaceStateOf(selection()) : undefined\n )\n\n // A selection that names a catalogue theme beyond the shipped default pair cannot be\n // painted or previewed until the whole catalogue has loaded. Once a load has failed\n // the provider paints what the shipped data can.\n const waitingFor = (candidate: ThemeSelection, appearance: ThemeAppearance) =>\n !source().loaded() && !source().failed() && needsCatalogue(candidate, appearance)\n createEffect(() => {\n if (\n needsCatalogue(selection(), committed().appearance) ||\n needsCatalogue(shownSelection(), shown().appearance)\n )\n void source().load()\n })\n\n let written: ReadonlySet<string> | undefined\n let restoreTransitions: (() => void) | undefined\n createEffect(() => {\n if (typeof document === 'undefined') return\n const current = engine()\n const display = shown()\n // Until the catalogue arrives the document keeps what is already on it — the\n // stylesheet's theme, set before first paint by `themeScript` — instead of\n // flashing the default for a theme that is only not loaded yet.\n if (waitingFor(shownSelection(), display.appearance)) return\n const state = {\n selection: shownSelection(),\n appearance: display.appearance,\n variant: display.variant,\n terminalVariant: resolveTerminalVariant(shownSelection().terminalThemeId, registry()),\n surface: axisOn() ? surfaceStateOf(shownSelection()) : undefined,\n }\n const projectionOptions = local.tokenProjection\n ? { tokenProjection: local.tokenProjection }\n : {}\n const options = {\n transformTokens: local.transformTokens,\n ...projectionOptions,\n accentContrastFloor: local.accentContrastFloor,\n palette: local.palette,\n editorRoles: local.editorRoles,\n }\n const apply = () => {\n written = applyThemeToRoot(current, document.documentElement, state, options, written)\n }\n if (local.disableTransitionOnChange) {\n restoreTransitions?.()\n restoreTransitions = applyWithoutTransitions(document, apply)\n } else {\n apply()\n }\n })\n onCleanup(() => restoreTransitions?.())\n\n // A pair beyond the defaults offers its accents once the catalogue is here; reading\n // them is not a reason to load it.\n const themeAccents = createMemo(() =>\n !source().loaded() && pairNeedsData(selection())\n ? []\n : engine().themeAccentsFor(selection().lightThemeId, selection().darkThemeId)\n )\n\n const zoomFonts = (intent: FontZoomIntent) =>\n value.setSelection({ fonts: zoomedFontSettings(selection(), intent) })\n\n // The platform zoom chords drive the three text sizes, captured like the other\n // global chords; an event something else already handled never double-steps.\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.defaultPrevented) return\n const intent = fontZoomShortcut(event)\n if (!intent) return\n event.preventDefault()\n zoomFonts(intent)\n }\n createEffect(() => {\n if (!local.fontZoom || typeof window === 'undefined') return\n window.addEventListener('keydown', onKeyDown, { capture: true })\n onCleanup(() => window.removeEventListener('keydown', onKeyDown, { capture: true }))\n })\n\n const value: ThemeContextValue = {\n selection,\n resolvedAppearance,\n shownAppearance,\n variant,\n get themes() {\n return engine().builtinThemes\n },\n themeAccents,\n allThemes: registry,\n preview(next) {\n setDraft(next ? { ...next } : undefined)\n },\n previewing: () => draft() !== undefined,\n accentRolesFor(accent, variantId) {\n // Before the catalogue arrives the light engine answers provisionally and asks\n // for it; reading `engine()` re-runs a reactive caller on arrival.\n return accentRolesForState(engine(), accent, variantId, {\n selection: selection(),\n variant: variant(),\n registry: registry(),\n accentContrastFloor: local.accentContrastFloor,\n })\n },\n catalogueReady: () => source().loaded(),\n loadCatalogue: () => source().load(),\n effectiveSurface: () => committedSurface()?.surface ?? 'opaque',\n reduceTransparencyActive: () => committedSurface()?.reduceTransparencyActive ?? false,\n zoomFonts,\n setSelection(patch) {\n const current = selection()\n const next = mergeThemeSelection(current, patch)\n setDraft(undefined)\n if (sameThemeSelection(current, next)) return\n setSelectionState(next)\n writePersisted(persistence, next)\n },\n }\n\n return value\n}\n"],"mappings":";;;;;;;;;;;;AA8LA,SAAS,2BAAuD;CAC9D,OAAO,OAAO,WAAW,eAAe,OAAO,OAAO,eAAe,aACjE,OAAO,WAAW,0BAA0B,IAC5C,KAAA;AACN;;;;;;;;AAUA,SAAS,mBAAmB,GAAmB,GAAmB;CAChE,OAAO,MAAM,KAAK,KAAK,UAAU,CAAC,MAAM,KAAK,UAAU,CAAC;AAC1D;AAEA,SAAgB,kBACd,OACa;CACb,MAAM,QAAQ,wBAAwB,KAAK;CAC3C,OAAO,gBAAgB,aAAa,CAAC,CAAC,UAAU;EAC9C;EACA,IAAI,WAAW;GACb,OAAO,MAAM;EACf;CACF,CAAC;AACH;;;;;AAMA,SAAgB,wBACd,OACmB;CACnB,iCAAiC,MAAM,eAAe;CACtD,MAAM,CAAC,SAAS,WAAW,OAAO;EAChC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CACD,MAAM,mBAAmB,MAAM,cAAA;CAC/B,MAAM,cAAc,MAAM,eAAe,wBAAwB,UAAU;CAK3E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iB,WAAW,WAAW,EAAE,SAAS,KAAK,CAAC;EAC/D,gBAAgB,OAAO,oBAAoB,WAAW,WAAW,EAAE,SAAS,KAAK,CAAC,CAAC;CACrF,CAAC;CAED,MAAM,QAA2B;EAC/B;EACA;EACA;EACA;EACA,IAAI,SAAS;GACX,OAAO,OAAO,CAAC,CAAC;EAClB;EACA;EACA,WAAW;EACX,QAAQ,MAAM;GACZ,SAAS,OAAO,EAAE,GAAG,KAAK,IAAI,KAAA,CAAS;EACzC;EACA,kBAAkB,MAAM,MAAM,KAAA;EAC9B,eAAe,QAAQ,WAAW;GAGhC,OAAO,oBAAoB,OAAO,GAAG,QAAQ,WAAW;IACtD,WAAW,UAAU;IACrB,SAAS,QAAQ;IACjB,UAAU,SAAS;IACnB,qBAAqB,MAAM;GAC7B,CAAC;EACH;EACA,sBAAsB,OAAO,CAAC,CAAC,OAAO;EACtC,qBAAqB,OAAO,CAAC,CAAC,KAAK;EACnC,wBAAwB,iBAAiB,CAAC,EAAE,WAAW;EACvD,gCAAgC,iBAAiB,CAAC,EAAE,4BAA4B;EAChF;EACA,aAAa,OAAO;GAClB,MAAM,UAAU,UAAU;GAC1B,MAAM,OAAO,oBAAoB,SAAS,KAAK;GAC/C,SAAS,KAAA,CAAS;GAClB,IAAI,mBAAmB,SAAS,IAAI,GAAG;GACvC,kBAAkB,IAAI;GACtB,eAAe,aAAa,IAAI;EAClC;CACF;CAEA,OAAO;AACT"}
@@ -38,6 +38,20 @@ export type ThemeScriptOptions = ThemeStorageSchema & {
38
38
  palette?: 'inline' | 'stylesheet';
39
39
  /** The only `version` of the library document read. Default `1`. */
40
40
  libraryVersion?: number;
41
+ /**
42
+ * Load only the resolved catalogue theme's stylesheet instead of bundling
43
+ * `theme-variants.css`: a URL template with `{id}` where the theme id goes, for
44
+ * the files the package ships as `@adea-ai/ui/themes/<id>.css` (copied to where
45
+ * the host serves them). The script adds one `<link rel="stylesheet"
46
+ * blocking="render">` to `<head>`, so the first frame still waits for the palette
47
+ * it chose and no other theme's rules are fetched or parsed. A theme read from
48
+ * the stored library is written inline as before and loads no sheet.
49
+ *
50
+ * Pair it with `palette="inline"` on the provider: the sheet covers the first
51
+ * paint, and the provider writes the same values when it mounts, so a later
52
+ * switch needs no sheet.
53
+ */
54
+ stylesheetHref?: string;
41
55
  };
42
56
  /**
43
57
  * The no-flash script.
@@ -1 +1 @@
1
- {"version":3,"file":"theme-script.d.ts","sourceRoot":"","sources":["../../../src/components/theme/theme-script.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAA;AAClF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAE7D,OAAO,EAAE,uBAAuB,IAAI,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AAEjF,8EAA8E;AAC9E,MAAM,MAAM,4BAA4B,GAAG,QAAQ,CAAC;IAClD,+EAA+E;IAC/E,KAAK,EAAE,MAAM,CAAA;IACb,0EAA0E;IAC1E,IAAI,EAAE,SAAS,MAAM,EAAE,CAAA;CACxB,CAAC,CAAA;AAEF;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG,kBAAkB,GAAG;IACpD;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,QAAQ,GAAG,YAAY,CAAA;IACjC,oEAAoE;IACpE,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,wBAAgB,WAAW,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;AACxD,wBAAgB,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,MAAM,CAAA;AAQhE,8FAA8F;AAC9F,wBAAgB,yBAAyB,CACvC,OAA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ACvC,OAAO,EAAE,kBAAkB,GAAG;IAC5B,wBAAwB,CAAC,EAAE,SAAS,4BAA4B,EAAE,CAAA;CACnE,EACD,eAAe,EAAE,oBAAoB,EACrC,gBAAgB,EAAE,MAAM,EACxB,wBAAwB,EAAE,MAAM,GAC/B,MAAM,CAQR"}
@@ -49,6 +49,7 @@ function optionsFormScript(options, projection, projectionBundle, projectionFall
49
49
  if (options.libraryKey !== void 0) parts.push(`if(id===null){try{var lib=JSON.parse(get(${safeScriptStringLiteral(options.libraryKey)})||'null');`, `if(lib&&typeof lib==='object'&&lib.version===${Number(options.libraryVersion ?? 1)}&&Array.isArray(lib.themes)){`, `for(var i=0;i!==lib.themes.length;i++){var t=lib.themes[i];`, `if(t&&t.id===want&&t.flatTokens&&typeof t.flatTokens==='object'){id=want;tokens=t.flatTokens;${hasProjectionFallbacks ? "storedTheme=t;" : ""}break}}}}catch(e){}}`);
50
50
  if (options.libraryKey !== void 0 && tokenProjection) parts.push(tokenProjection);
51
51
  parts.push(`if(id===null)id=fallback;`, `r.classList.toggle('dark',dark);`, `s.colorScheme=dark?'dark':'light';`, `r.dataset.theme=id;`, `r.dataset.appearance=dark?'dark':'light';`);
52
+ if (options.stylesheetHref !== void 0) parts.push(`if(!tokens&&ids.indexOf(id)!==-1){var l=document.createElement('link');l.rel='stylesheet';l.setAttribute('blocking','render');l.setAttribute('data-theme-stylesheet',id);l.href=${safeScriptStringLiteral(options.stylesheetHref)}.split('{id}').join(id);(document.head||r).appendChild(l)}`);
52
53
  if (options.libraryKey !== void 0) parts.push(`if(tokens){if(typeof projectTokens==='function'){${projectionFallbackCode}tokens=projectTokens(tokens,tokenProjection)}for(var n in tokens){if(Object.prototype.hasOwnProperty.call(tokens,n)&&n.slice(0,2)==='--'&&typeof tokens[n]==='string')s.setProperty(n,tokens[n])}}`);
53
54
  parts.push(`var a=doc&&typeof doc.accent==='string'?doc.accent:'';`, `var accent=[${presets.join(",")}].indexOf(a)!==-1?a:${CUSTOM_ACCENT_PATTERN}.test(a)?'custom':a.slice(0,${THEME_ACCENT_PREFIX.length})===${safeScriptStringLiteral(THEME_ACCENT_PREFIX)}?'':${safeScriptStringLiteral(defaultAccent)};`, `if(accent)r.dataset.accent=accent;`, `if(doc&&doc.density==='compact')r.dataset.density='compact';`);
54
55
  if (options.surface) {