@adea-ai/ui 0.151.11 → 0.151.13

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 (982) hide show
  1. package/dist/NOTICE +3 -2
  2. package/dist/components/composites/about-dialog/about-dialog.d.ts.map +1 -1
  3. package/dist/components/composites/about-dialog/about-dialog.js +27 -48
  4. package/dist/components/composites/about-dialog/about-dialog.js.map +1 -1
  5. package/dist/components/composites/account-menu/account-menu.d.ts +2 -2
  6. package/dist/components/composites/account-menu/account-menu.d.ts.map +1 -1
  7. package/dist/components/composites/account-menu/account-menu.js +4 -22
  8. package/dist/components/composites/account-menu/account-menu.js.map +1 -1
  9. package/dist/components/composites/action-button/action-button.d.ts.map +1 -1
  10. package/dist/components/composites/action-button/action-button.js +2 -4
  11. package/dist/components/composites/action-button/action-button.js.map +1 -1
  12. package/dist/components/composites/appearance-editor/accent-swatch-groups.d.ts +1 -10
  13. package/dist/components/composites/appearance-editor/accent-swatch-groups.d.ts.map +1 -1
  14. package/dist/components/composites/appearance-editor/accent-swatch-groups.js +2 -1
  15. package/dist/components/composites/appearance-editor/accent-swatch-groups.js.map +1 -1
  16. package/dist/components/composites/appearance-editor/appearance-choices.d.ts.map +1 -1
  17. package/dist/components/composites/appearance-editor/appearance-choices.js +3 -2
  18. package/dist/components/composites/appearance-editor/appearance-choices.js.map +1 -1
  19. package/dist/components/composites/appearance-editor/appearance-editor.d.ts.map +1 -1
  20. package/dist/components/composites/appearance-editor/appearance-editor.js +1 -0
  21. package/dist/components/composites/appearance-editor/appearance-editor.js.map +1 -1
  22. package/dist/components/composites/appearance-editor/appearance-rows.d.ts.map +1 -1
  23. package/dist/components/composites/appearance-editor/appearance-rows.js +28 -53
  24. package/dist/components/composites/appearance-editor/appearance-rows.js.map +1 -1
  25. package/dist/components/composites/appearance-editor/font-settings-group.d.ts.map +1 -1
  26. package/dist/components/composites/appearance-editor/font-settings-group.js +7 -47
  27. package/dist/components/composites/appearance-editor/font-settings-group.js.map +1 -1
  28. package/dist/components/composites/appearance-editor/index.d.ts +1 -0
  29. package/dist/components/composites/appearance-editor/index.d.ts.map +1 -1
  30. package/dist/components/composites/appearance-editor/index.js +2 -1
  31. package/dist/components/composites/catalog-browser/catalog-browser.d.ts.map +1 -1
  32. package/dist/components/composites/catalog-browser/catalog-browser.js +8 -11
  33. package/dist/components/composites/catalog-browser/catalog-browser.js.map +1 -1
  34. package/dist/components/composites/chain-of-thought/chain-of-thought.d.ts +5 -4
  35. package/dist/components/composites/chain-of-thought/chain-of-thought.d.ts.map +1 -1
  36. package/dist/components/composites/chain-of-thought/chain-of-thought.js +5 -12
  37. package/dist/components/composites/chain-of-thought/chain-of-thought.js.map +1 -1
  38. package/dist/components/composites/chat/chat.d.ts +2 -2
  39. package/dist/components/composites/chat/chat.d.ts.map +1 -1
  40. package/dist/components/composites/chat/chat.js.map +1 -1
  41. package/dist/components/composites/checkpoint/checkpoint-model.js +1 -1
  42. package/dist/components/composites/checkpoint/checkpoint-model.js.map +1 -1
  43. package/dist/components/composites/checkpoint/checkpoint.js +3 -3
  44. package/dist/components/composites/checkpoint/checkpoint.js.map +1 -1
  45. package/dist/components/composites/confirmation/confirmation-model.d.ts +3 -12
  46. package/dist/components/composites/confirmation/confirmation-model.d.ts.map +1 -1
  47. package/dist/components/composites/confirmation/confirmation-model.js +5 -17
  48. package/dist/components/composites/confirmation/confirmation-model.js.map +1 -1
  49. package/dist/components/composites/confirmation/confirmation.js +1 -1
  50. package/dist/components/composites/confirmation/confirmation.js.map +1 -1
  51. package/dist/components/composites/context/context-model.js +1 -1
  52. package/dist/components/composites/context/context-model.js.map +1 -1
  53. package/dist/components/composites/file-tree/build-file-tree.d.ts +5 -12
  54. package/dist/components/composites/file-tree/build-file-tree.d.ts.map +1 -1
  55. package/dist/components/composites/file-tree/build-file-tree.js +26 -30
  56. package/dist/components/composites/file-tree/build-file-tree.js.map +1 -1
  57. package/dist/components/composites/file-tree/file-tree.d.ts +2 -2
  58. package/dist/components/composites/file-tree/file-tree.d.ts.map +1 -1
  59. package/dist/components/composites/file-tree/file-tree.js +4 -30
  60. package/dist/components/composites/file-tree/file-tree.js.map +1 -1
  61. package/dist/components/composites/file-tree/index.d.ts +2 -1
  62. package/dist/components/composites/file-tree/index.d.ts.map +1 -1
  63. package/dist/components/composites/file-tree/index.js +2 -1
  64. package/dist/components/composites/help-center/help-center.d.ts.map +1 -1
  65. package/dist/components/composites/help-center/help-center.js +9 -20
  66. package/dist/components/composites/help-center/help-center.js.map +1 -1
  67. package/dist/components/composites/icon-picker/icon-picker.d.ts.map +1 -1
  68. package/dist/components/composites/icon-picker/icon-picker.js +7 -11
  69. package/dist/components/composites/icon-picker/icon-picker.js.map +1 -1
  70. package/dist/components/composites/inline-citation/citation.d.ts.map +1 -1
  71. package/dist/components/composites/inline-citation/citation.js +2 -1
  72. package/dist/components/composites/inline-citation/citation.js.map +1 -1
  73. package/dist/components/composites/inline-citation/inline-citation.d.ts.map +1 -1
  74. package/dist/components/composites/inline-citation/inline-citation.js +2 -1
  75. package/dist/components/composites/inline-citation/inline-citation.js.map +1 -1
  76. package/dist/components/composites/message-scroller/message-scroller.d.ts +4 -5
  77. package/dist/components/composites/message-scroller/message-scroller.d.ts.map +1 -1
  78. package/dist/components/composites/message-scroller/message-scroller.js +19 -13
  79. package/dist/components/composites/message-scroller/message-scroller.js.map +1 -1
  80. package/dist/components/composites/message-scroller/scroll-anchor.d.ts +4 -3
  81. package/dist/components/composites/message-scroller/scroll-anchor.d.ts.map +1 -1
  82. package/dist/components/composites/message-scroller/scroll-anchor.js +5 -3
  83. package/dist/components/composites/message-scroller/scroll-anchor.js.map +1 -1
  84. package/dist/components/composites/model-selector/model-selector.d.ts.map +1 -1
  85. package/dist/components/composites/model-selector/model-selector.js +1 -1
  86. package/dist/components/composites/model-selector/model-selector.js.map +1 -1
  87. package/dist/components/composites/model-selector/models.js +1 -1
  88. package/dist/components/composites/model-selector/models.js.map +1 -1
  89. package/dist/components/composites/plan/plan.d.ts.map +1 -1
  90. package/dist/components/composites/plan/plan.js +2 -3
  91. package/dist/components/composites/plan/plan.js.map +1 -1
  92. package/dist/components/composites/queue/queue.d.ts +2 -2
  93. package/dist/components/composites/queue/queue.d.ts.map +1 -1
  94. package/dist/components/composites/queue/queue.js +57 -64
  95. package/dist/components/composites/queue/queue.js.map +1 -1
  96. package/dist/components/composites/reasoning/index.js +3 -1
  97. package/dist/components/composites/reasoning/reasoning.d.ts +2 -3
  98. package/dist/components/composites/reasoning/reasoning.d.ts.map +1 -1
  99. package/dist/components/composites/reasoning/reasoning.js +5 -20
  100. package/dist/components/composites/reasoning/reasoning.js.map +1 -1
  101. package/dist/components/composites/settings/settings-layout.d.ts.map +1 -1
  102. package/dist/components/composites/settings/settings-layout.js +3 -2
  103. package/dist/components/composites/settings/settings-layout.js.map +1 -1
  104. package/dist/components/composites/settings/settings-navigation.d.ts.map +1 -1
  105. package/dist/components/composites/settings/settings-navigation.js +1 -1
  106. package/dist/components/composites/settings/settings-navigation.js.map +1 -1
  107. package/dist/components/composites/sources/index.js +2 -1
  108. package/dist/components/composites/sources/source.d.ts +3 -8
  109. package/dist/components/composites/sources/source.d.ts.map +1 -1
  110. package/dist/components/composites/sources/source.js +5 -30
  111. package/dist/components/composites/sources/source.js.map +1 -1
  112. package/dist/components/composites/sources/sources.js +2 -1
  113. package/dist/components/composites/sources/sources.js.map +1 -1
  114. package/dist/components/composites/stack-trace/stack-trace.d.ts.map +1 -1
  115. package/dist/components/composites/stack-trace/stack-trace.js +3 -12
  116. package/dist/components/composites/stack-trace/stack-trace.js.map +1 -1
  117. package/dist/components/composites/subagent/subagent.d.ts +3 -1
  118. package/dist/components/composites/subagent/subagent.d.ts.map +1 -1
  119. package/dist/components/composites/subagent/subagent.js +5 -17
  120. package/dist/components/composites/subagent/subagent.js.map +1 -1
  121. package/dist/components/composites/suggestion/suggestion.d.ts.map +1 -1
  122. package/dist/components/composites/suggestion/suggestion.js +3 -2
  123. package/dist/components/composites/suggestion/suggestion.js.map +1 -1
  124. package/dist/components/composites/task/task.d.ts +2 -3
  125. package/dist/components/composites/task/task.d.ts.map +1 -1
  126. package/dist/components/composites/task/task.js +49 -109
  127. package/dist/components/composites/task/task.js.map +1 -1
  128. package/dist/components/composites/terminal/terminal-model.d.ts +1 -2
  129. package/dist/components/composites/terminal/terminal-model.d.ts.map +1 -1
  130. package/dist/components/composites/terminal/terminal-model.js +7 -1
  131. package/dist/components/composites/terminal/terminal-model.js.map +1 -1
  132. package/dist/components/composites/terminal/terminal.d.ts.map +1 -1
  133. package/dist/components/composites/terminal/terminal.js +3 -12
  134. package/dist/components/composites/terminal/terminal.js.map +1 -1
  135. package/dist/components/composites/test-results/test-results.d.ts.map +1 -1
  136. package/dist/components/composites/test-results/test-results.js +3 -12
  137. package/dist/components/composites/test-results/test-results.js.map +1 -1
  138. package/dist/components/composites/tool/tool.d.ts +0 -1
  139. package/dist/components/composites/tool/tool.d.ts.map +1 -1
  140. package/dist/components/composites/tool/tool.js +47 -41
  141. package/dist/components/composites/tool/tool.js.map +1 -1
  142. package/dist/components/composites/tree/tree-navigation.d.ts +6 -2
  143. package/dist/components/composites/tree/tree-navigation.d.ts.map +1 -1
  144. package/dist/components/composites/tree/tree-navigation.js +18 -1
  145. package/dist/components/composites/tree/tree-navigation.js.map +1 -1
  146. package/dist/components/composites/tree/tree.d.ts +6 -0
  147. package/dist/components/composites/tree/tree.d.ts.map +1 -1
  148. package/dist/components/composites/tree/tree.js +30 -4
  149. package/dist/components/composites/tree/tree.js.map +1 -1
  150. package/dist/components/composites/update-dialog/channel-control.d.ts.map +1 -1
  151. package/dist/components/composites/update-dialog/channel-control.js +7 -8
  152. package/dist/components/composites/update-dialog/channel-control.js.map +1 -1
  153. package/dist/components/composites/update-dialog/update-dialog.d.ts +2 -26
  154. package/dist/components/composites/update-dialog/update-dialog.d.ts.map +1 -1
  155. package/dist/components/composites/update-dialog/update-dialog.js +47 -125
  156. package/dist/components/composites/update-dialog/update-dialog.js.map +1 -1
  157. package/dist/components/composites/update-dialog/update-model.d.ts +65 -0
  158. package/dist/components/composites/update-dialog/update-model.d.ts.map +1 -0
  159. package/dist/components/composites/update-dialog/update-model.js +75 -0
  160. package/dist/components/composites/update-dialog/update-model.js.map +1 -0
  161. package/dist/components/composites/workspace-mark/workspace-mark.js.map +1 -1
  162. package/dist/components/composites/workspace-switcher/workspace-reorder-dialog.d.ts.map +1 -1
  163. package/dist/components/composites/workspace-switcher/workspace-reorder-dialog.js +3 -16
  164. package/dist/components/composites/workspace-switcher/workspace-reorder-dialog.js.map +1 -1
  165. package/dist/components/composites/workspace-switcher/workspace-switcher.d.ts.map +1 -1
  166. package/dist/components/composites/workspace-switcher/workspace-switcher.js +10 -14
  167. package/dist/components/composites/workspace-switcher/workspace-switcher.js.map +1 -1
  168. package/dist/components/conversation/busy-send-button.d.ts +3 -5
  169. package/dist/components/conversation/busy-send-button.d.ts.map +1 -1
  170. package/dist/components/conversation/busy-send-button.js +4 -15
  171. package/dist/components/conversation/busy-send-button.js.map +1 -1
  172. package/dist/components/conversation/chat-composer.d.ts +1 -1
  173. package/dist/components/conversation/chat-composer.d.ts.map +1 -1
  174. package/dist/components/conversation/chat-composer.js +1 -1
  175. package/dist/components/conversation/chat-composer.js.map +1 -1
  176. package/dist/components/conversation/composer-core.d.ts +35 -0
  177. package/dist/components/conversation/composer-core.d.ts.map +1 -0
  178. package/dist/components/conversation/composer-core.js +68 -0
  179. package/dist/components/conversation/composer-core.js.map +1 -0
  180. package/dist/components/conversation/composer-menu.d.ts +1 -1
  181. package/dist/components/conversation/composer-menu.d.ts.map +1 -1
  182. package/dist/components/conversation/composer-menu.js.map +1 -1
  183. package/dist/components/conversation/conversation-pane.d.ts +4 -1
  184. package/dist/components/conversation/conversation-pane.d.ts.map +1 -1
  185. package/dist/components/conversation/conversation-pane.js +4 -0
  186. package/dist/components/conversation/conversation-pane.js.map +1 -1
  187. package/dist/components/conversation/conversation-surface.d.ts +9 -6
  188. package/dist/components/conversation/conversation-surface.d.ts.map +1 -1
  189. package/dist/components/conversation/conversation-surface.js +7 -5
  190. package/dist/components/conversation/conversation-surface.js.map +1 -1
  191. package/dist/components/conversation/ime-guard.d.ts +1 -0
  192. package/dist/components/conversation/ime-guard.d.ts.map +1 -1
  193. package/dist/components/conversation/ime-guard.js +5 -0
  194. package/dist/components/conversation/ime-guard.js.map +1 -1
  195. package/dist/components/conversation/internal/chat-composer-shell.d.ts.map +1 -1
  196. package/dist/components/conversation/internal/chat-composer-shell.js +16 -50
  197. package/dist/components/conversation/internal/chat-composer-shell.js.map +1 -1
  198. package/dist/components/conversation/message-composer.d.ts +1 -3
  199. package/dist/components/conversation/message-composer.d.ts.map +1 -1
  200. package/dist/components/conversation/message-composer.js +15 -32
  201. package/dist/components/conversation/message-composer.js.map +1 -1
  202. package/dist/components/conversation/message-row.d.ts +10 -11
  203. package/dist/components/conversation/message-row.d.ts.map +1 -1
  204. package/dist/components/conversation/message-row.js +24 -49
  205. package/dist/components/conversation/message-row.js.map +1 -1
  206. package/dist/components/conversation/paste-token-editor.d.ts.map +1 -1
  207. package/dist/components/conversation/paste-token-editor.js +7 -17
  208. package/dist/components/conversation/paste-token-editor.js.map +1 -1
  209. package/dist/components/conversation/paste-tokens.d.ts +10 -1
  210. package/dist/components/conversation/paste-tokens.d.ts.map +1 -1
  211. package/dist/components/conversation/paste-tokens.js +26 -2
  212. package/dist/components/conversation/paste-tokens.js.map +1 -1
  213. package/dist/components/conversation/scroll-follow-core.d.ts +30 -79
  214. package/dist/components/conversation/scroll-follow-core.d.ts.map +1 -1
  215. package/dist/components/conversation/scroll-follow-core.js +65 -54
  216. package/dist/components/conversation/scroll-follow-core.js.map +1 -1
  217. package/dist/components/conversation/scroll-follow.d.ts +5 -1
  218. package/dist/components/conversation/scroll-follow.d.ts.map +1 -1
  219. package/dist/components/conversation/scroll-follow.js +27 -91
  220. package/dist/components/conversation/scroll-follow.js.map +1 -1
  221. package/dist/components/conversation/thread-panel.d.ts +0 -2
  222. package/dist/components/conversation/thread-panel.d.ts.map +1 -1
  223. package/dist/components/conversation/thread-panel.js.map +1 -1
  224. package/dist/components/conversation/transcript-composition.d.ts.map +1 -1
  225. package/dist/components/conversation/transcript-composition.js +4 -16
  226. package/dist/components/conversation/transcript-composition.js.map +1 -1
  227. package/dist/components/conversation/transcript-folding.d.ts +0 -1
  228. package/dist/components/conversation/transcript-folding.d.ts.map +1 -1
  229. package/dist/components/conversation/transcript-folding.js +1 -1
  230. package/dist/components/conversation/transcript-folding.js.map +1 -1
  231. package/dist/components/conversation/transcript-grouping.d.ts +8 -0
  232. package/dist/components/conversation/transcript-grouping.d.ts.map +1 -1
  233. package/dist/components/conversation/transcript-grouping.js +17 -3
  234. package/dist/components/conversation/transcript-grouping.js.map +1 -1
  235. package/dist/components/layout/contextual-sidebar/contextual-sidebar.d.ts +12 -0
  236. package/dist/components/layout/contextual-sidebar/contextual-sidebar.d.ts.map +1 -1
  237. package/dist/components/layout/contextual-sidebar/contextual-sidebar.js +53 -17
  238. package/dist/components/layout/contextual-sidebar/contextual-sidebar.js.map +1 -1
  239. package/dist/components/layout/contextual-sidebar/index.d.ts +1 -1
  240. package/dist/components/layout/contextual-sidebar/index.d.ts.map +1 -1
  241. package/dist/components/layout/contextual-sidebar/mobile-contextual-sidebar.js +1 -1
  242. package/dist/components/layout/contextual-sidebar/mobile-contextual-sidebar.js.map +1 -1
  243. package/dist/components/layout/floating-preview/index.js +2 -2
  244. package/dist/components/layout/floating-preview/model.d.ts +21 -55
  245. package/dist/components/layout/floating-preview/model.d.ts.map +1 -1
  246. package/dist/components/layout/floating-preview/model.js +33 -88
  247. package/dist/components/layout/floating-preview/model.js.map +1 -1
  248. package/dist/components/layout/pixel-resize-handle/pixel-resize-handle.d.ts.map +1 -1
  249. package/dist/components/layout/pixel-resize-handle/pixel-resize-handle.js +11 -5
  250. package/dist/components/layout/pixel-resize-handle/pixel-resize-handle.js.map +1 -1
  251. package/dist/components/layout/shell-top-bar/shell-top-bar.d.ts +18 -22
  252. package/dist/components/layout/shell-top-bar/shell-top-bar.d.ts.map +1 -1
  253. package/dist/components/layout/shell-top-bar/shell-top-bar.js +4 -2
  254. package/dist/components/layout/shell-top-bar/shell-top-bar.js.map +1 -1
  255. package/dist/components/layout/side-rail/side-rail-context.d.ts +0 -1
  256. package/dist/components/layout/side-rail/side-rail-context.d.ts.map +1 -1
  257. package/dist/components/layout/side-rail/side-rail-context.js +2 -8
  258. package/dist/components/layout/side-rail/side-rail-context.js.map +1 -1
  259. package/dist/components/layout/side-rail/side-rail.d.ts +0 -9
  260. package/dist/components/layout/side-rail/side-rail.d.ts.map +1 -1
  261. package/dist/components/layout/side-rail/side-rail.js +148 -128
  262. package/dist/components/layout/side-rail/side-rail.js.map +1 -1
  263. package/dist/components/layout/sidebar-nav/index.d.ts +2 -1
  264. package/dist/components/layout/sidebar-nav/index.d.ts.map +1 -1
  265. package/dist/components/layout/sidebar-nav/index.js +2 -1
  266. package/dist/components/layout/sidebar-nav/sidebar-nav-classes.d.ts +10 -0
  267. package/dist/components/layout/sidebar-nav/sidebar-nav-classes.d.ts.map +1 -0
  268. package/dist/components/layout/sidebar-nav/sidebar-nav-classes.js +18 -0
  269. package/dist/components/layout/sidebar-nav/sidebar-nav-classes.js.map +1 -0
  270. package/dist/components/layout/sidebar-nav/sidebar-nav-resize-handle.d.ts +1 -1
  271. package/dist/components/layout/sidebar-nav/sidebar-nav-resize-handle.d.ts.map +1 -1
  272. package/dist/components/layout/sidebar-nav/sidebar-nav-resize-handle.js.map +1 -1
  273. package/dist/components/layout/sidebar-nav/sidebar-nav.d.ts +5 -9
  274. package/dist/components/layout/sidebar-nav/sidebar-nav.d.ts.map +1 -1
  275. package/dist/components/layout/sidebar-nav/sidebar-nav.js +5 -23
  276. package/dist/components/layout/sidebar-nav/sidebar-nav.js.map +1 -1
  277. package/dist/components/layout/split-layout/geometry.d.ts.map +1 -1
  278. package/dist/components/layout/split-layout/geometry.js +2 -2
  279. package/dist/components/layout/split-layout/geometry.js.map +1 -1
  280. package/dist/components/layout/split-layout/index.js +2 -2
  281. package/dist/components/layout/split-layout/model.d.ts.map +1 -1
  282. package/dist/components/layout/split-layout/model.js +4 -4
  283. package/dist/components/layout/split-layout/model.js.map +1 -1
  284. package/dist/components/layout/split-layout/resize-controller-core-retry.d.ts +5 -0
  285. package/dist/components/layout/split-layout/resize-controller-core-retry.d.ts.map +1 -1
  286. package/dist/components/layout/split-layout/resize-controller-core-retry.js +17 -10
  287. package/dist/components/layout/split-layout/resize-controller-core-retry.js.map +1 -1
  288. package/dist/components/layout/split-layout/resize-controller-core.d.ts +5 -0
  289. package/dist/components/layout/split-layout/resize-controller-core.d.ts.map +1 -1
  290. package/dist/components/layout/split-layout/resize-controller-core.js +17 -10
  291. package/dist/components/layout/split-layout/resize-controller-core.js.map +1 -1
  292. package/dist/components/layout/split-layout/split-layout.d.ts.map +1 -1
  293. package/dist/components/layout/split-layout/split-layout.js +54 -47
  294. package/dist/components/layout/split-layout/split-layout.js.map +1 -1
  295. package/dist/components/layout/split-layout/tree.d.ts +2 -0
  296. package/dist/components/layout/split-layout/tree.d.ts.map +1 -1
  297. package/dist/components/layout/split-layout/tree.js +5 -1
  298. package/dist/components/layout/split-layout/tree.js.map +1 -1
  299. package/dist/components/layout/top-bar/top-bar.d.ts +2 -9
  300. package/dist/components/layout/top-bar/top-bar.d.ts.map +1 -1
  301. package/dist/components/layout/top-bar/top-bar.js +4 -8
  302. package/dist/components/layout/top-bar/top-bar.js.map +1 -1
  303. package/dist/components/layout/top-bar/window-chrome.d.ts +13 -0
  304. package/dist/components/layout/top-bar/window-chrome.d.ts.map +1 -0
  305. package/dist/components/layout/top-bar/window-chrome.js +12 -0
  306. package/dist/components/layout/top-bar/window-chrome.js.map +1 -0
  307. package/dist/components/motion/presence.d.ts +1 -1
  308. package/dist/components/motion/presence.d.ts.map +1 -1
  309. package/dist/components/motion/presence.js +1 -4
  310. package/dist/components/motion/presence.js.map +1 -1
  311. package/dist/components/theme/appearance-panel.d.ts +3 -1
  312. package/dist/components/theme/appearance-panel.d.ts.map +1 -1
  313. package/dist/components/theme/appearance-panel.js +17 -9
  314. package/dist/components/theme/appearance-panel.js.map +1 -1
  315. package/dist/components/theme/index.d.ts +1 -1
  316. package/dist/components/theme/index.d.ts.map +1 -1
  317. package/dist/components/theme/index.js +5 -4
  318. package/dist/components/theme/lazy.d.ts +31 -5
  319. package/dist/components/theme/lazy.d.ts.map +1 -1
  320. package/dist/components/theme/lazy.js +39 -6
  321. package/dist/components/theme/lazy.js.map +1 -0
  322. package/dist/components/theme/script-projection.d.ts +17 -0
  323. package/dist/components/theme/script-projection.d.ts.map +1 -0
  324. package/dist/components/theme/script-projection.js +17 -0
  325. package/dist/components/theme/script-projection.js.map +1 -0
  326. package/dist/components/theme/script.js +3 -1
  327. package/dist/components/theme/theme-api.d.ts +14 -0
  328. package/dist/components/theme/theme-api.d.ts.map +1 -0
  329. package/dist/components/theme/theme-catalogue-source.d.ts.map +1 -1
  330. package/dist/components/theme/theme-catalogue-source.js +3 -2
  331. package/dist/components/theme/theme-catalogue-source.js.map +1 -1
  332. package/dist/components/theme/theme-document.d.ts +112 -10
  333. package/dist/components/theme/theme-document.d.ts.map +1 -1
  334. package/dist/components/theme/{theme-document-core.js → theme-document.js} +20 -10
  335. package/dist/components/theme/theme-document.js.map +1 -0
  336. package/dist/components/theme/theme-mode-toggle.d.ts +1 -1
  337. package/dist/components/theme/theme-mode-toggle.d.ts.map +1 -1
  338. package/dist/components/theme/theme-mode-toggle.js.map +1 -1
  339. package/dist/components/theme/theme-persistence.d.ts +6 -5
  340. package/dist/components/theme/theme-persistence.d.ts.map +1 -1
  341. package/dist/components/theme/theme-persistence.js +48 -80
  342. package/dist/components/theme/theme-persistence.js.map +1 -1
  343. package/dist/components/theme/theme-picker.d.ts +1 -1
  344. package/dist/components/theme/theme-picker.d.ts.map +1 -1
  345. package/dist/components/theme/theme-picker.js.map +1 -1
  346. package/dist/components/theme/theme-provider-value.d.ts +16 -16
  347. package/dist/components/theme/theme-provider-value.d.ts.map +1 -1
  348. package/dist/components/theme/theme-provider-value.js +33 -42
  349. package/dist/components/theme/theme-provider-value.js.map +1 -1
  350. package/dist/components/theme/theme-provider.d.ts +3 -9
  351. package/dist/components/theme/theme-provider.d.ts.map +1 -1
  352. package/dist/components/theme/theme-provider.js +8 -7
  353. package/dist/components/theme/theme-provider.js.map +1 -1
  354. package/dist/components/theme/theme-script.d.ts +24 -25
  355. package/dist/components/theme/theme-script.d.ts.map +1 -1
  356. package/dist/components/theme/theme-script.js +45 -39
  357. package/dist/components/theme/theme-script.js.map +1 -1
  358. package/dist/components/theme/theme-state.d.ts +241 -9
  359. package/dist/components/theme/theme-state.d.ts.map +1 -1
  360. package/dist/components/theme/{theme-state-core.js → theme-state.js} +10 -11
  361. package/dist/components/theme/theme-state.js.map +1 -0
  362. package/dist/components/theme/theme-toggle.d.ts +1 -1
  363. package/dist/components/theme/theme-toggle.d.ts.map +1 -1
  364. package/dist/components/theme/theme-toggle.js.map +1 -1
  365. package/dist/components/theme/token-projection-options.d.ts +3 -0
  366. package/dist/components/theme/token-projection-options.d.ts.map +1 -0
  367. package/dist/components/theme/token-projection-options.js +9 -0
  368. package/dist/components/theme/token-projection-options.js.map +1 -0
  369. package/dist/components/theme/token-projection.d.ts +22 -0
  370. package/dist/components/theme/token-projection.d.ts.map +1 -0
  371. package/dist/components/theme/token-projection.js +1 -0
  372. package/dist/components/ui/alert-dialog/alert-dialog.d.ts +7 -5
  373. package/dist/components/ui/alert-dialog/alert-dialog.d.ts.map +1 -1
  374. package/dist/components/ui/alert-dialog/alert-dialog.js +40 -36
  375. package/dist/components/ui/alert-dialog/alert-dialog.js.map +1 -1
  376. package/dist/components/ui/attachment/attachment.d.ts.map +1 -1
  377. package/dist/components/ui/attachment/attachment.js +5 -16
  378. package/dist/components/ui/attachment/attachment.js.map +1 -1
  379. package/dist/components/ui/avatar/avatar.d.ts.map +1 -1
  380. package/dist/components/ui/avatar/avatar.js +5 -2
  381. package/dist/components/ui/avatar/avatar.js.map +1 -1
  382. package/dist/components/ui/board/board.d.ts +0 -3
  383. package/dist/components/ui/board/board.d.ts.map +1 -1
  384. package/dist/components/ui/board/board.js +3 -6
  385. package/dist/components/ui/board/board.js.map +1 -1
  386. package/dist/components/ui/button-group/button-group.d.ts +1 -1
  387. package/dist/components/ui/button-group/button-group.d.ts.map +1 -1
  388. package/dist/components/ui/button-group/button-group.js.map +1 -1
  389. package/dist/components/ui/chart/chart.d.ts +0 -3
  390. package/dist/components/ui/chart/chart.d.ts.map +1 -1
  391. package/dist/components/ui/chart/chart.js.map +1 -1
  392. package/dist/components/ui/code-block/code-block.d.ts +0 -2
  393. package/dist/components/ui/code-block/code-block.d.ts.map +1 -1
  394. package/dist/components/ui/code-block/code-block.js +8 -24
  395. package/dist/components/ui/code-block/code-block.js.map +1 -1
  396. package/dist/components/ui/command/command.d.ts.map +1 -1
  397. package/dist/components/ui/command/command.js +56 -48
  398. package/dist/components/ui/command/command.js.map +1 -1
  399. package/dist/components/ui/context-menu/context-menu.d.ts +8 -30
  400. package/dist/components/ui/context-menu/context-menu.d.ts.map +1 -1
  401. package/dist/components/ui/context-menu/context-menu.js +13 -121
  402. package/dist/components/ui/context-menu/context-menu.js.map +1 -1
  403. package/dist/components/ui/dialog/dialog-layer.d.ts +46 -0
  404. package/dist/components/ui/dialog/dialog-layer.d.ts.map +1 -0
  405. package/dist/components/ui/dialog/dialog-layer.js +169 -0
  406. package/dist/components/ui/dialog/dialog-layer.js.map +1 -0
  407. package/dist/components/ui/dialog/dialog.d.ts +20 -26
  408. package/dist/components/ui/dialog/dialog.d.ts.map +1 -1
  409. package/dist/components/ui/dialog/dialog.js +69 -187
  410. package/dist/components/ui/dialog/dialog.js.map +1 -1
  411. package/dist/components/ui/drawer/drawer.d.ts.map +1 -1
  412. package/dist/components/ui/drawer/drawer.js +5 -8
  413. package/dist/components/ui/drawer/drawer.js.map +1 -1
  414. package/dist/components/ui/dropdown-menu/dropdown-menu.d.ts +39 -53
  415. package/dist/components/ui/dropdown-menu/dropdown-menu.d.ts.map +1 -1
  416. package/dist/components/ui/dropdown-menu/dropdown-menu.js +135 -191
  417. package/dist/components/ui/dropdown-menu/dropdown-menu.js.map +1 -1
  418. package/dist/components/ui/dropdown-menu/menu-parts.d.ts +46 -0
  419. package/dist/components/ui/dropdown-menu/menu-parts.d.ts.map +1 -0
  420. package/dist/components/ui/dropdown-menu/menu-parts.js +176 -0
  421. package/dist/components/ui/dropdown-menu/menu-parts.js.map +1 -0
  422. package/dist/components/ui/field/field.js.map +1 -1
  423. package/dist/components/ui/field/number-field.js.map +1 -1
  424. package/dist/components/ui/hover-card/hover-card.d.ts +1 -2
  425. package/dist/components/ui/hover-card/hover-card.d.ts.map +1 -1
  426. package/dist/components/ui/hover-card/hover-card.js +4 -21
  427. package/dist/components/ui/hover-card/hover-card.js.map +1 -1
  428. package/dist/components/ui/menubar/menubar.d.ts +19 -33
  429. package/dist/components/ui/menubar/menubar.d.ts.map +1 -1
  430. package/dist/components/ui/menubar/menubar.js +21 -116
  431. package/dist/components/ui/menubar/menubar.js.map +1 -1
  432. package/dist/components/ui/message/index.js +2 -1
  433. package/dist/components/ui/message/message.d.ts +0 -1
  434. package/dist/components/ui/message/message.d.ts.map +1 -1
  435. package/dist/components/ui/message/message.js.map +1 -1
  436. package/dist/components/ui/message/parse-message-text.d.ts +20 -2
  437. package/dist/components/ui/message/parse-message-text.d.ts.map +1 -1
  438. package/dist/components/ui/message/parse-message-text.js +94 -28
  439. package/dist/components/ui/message/parse-message-text.js.map +1 -1
  440. package/dist/components/ui/modal-dialog/modal-dialog.d.ts +5 -12
  441. package/dist/components/ui/modal-dialog/modal-dialog.d.ts.map +1 -1
  442. package/dist/components/ui/modal-dialog/modal-dialog.js +61 -77
  443. package/dist/components/ui/modal-dialog/modal-dialog.js.map +1 -1
  444. package/dist/components/ui/navigation-menu/navigation-menu.d.ts +0 -1
  445. package/dist/components/ui/navigation-menu/navigation-menu.d.ts.map +1 -1
  446. package/dist/components/ui/navigation-menu/navigation-menu.js.map +1 -1
  447. package/dist/components/ui/popover/popover.d.ts +1 -3
  448. package/dist/components/ui/popover/popover.d.ts.map +1 -1
  449. package/dist/components/ui/popover/popover.js +1 -22
  450. package/dist/components/ui/popover/popover.js.map +1 -1
  451. package/dist/components/ui/resizable/resizable.d.ts.map +1 -1
  452. package/dist/components/ui/resizable/resizable.js +12 -6
  453. package/dist/components/ui/resizable/resizable.js.map +1 -1
  454. package/dist/components/ui/sheet/sheet.d.ts +4 -6
  455. package/dist/components/ui/sheet/sheet.d.ts.map +1 -1
  456. package/dist/components/ui/sheet/sheet.js +31 -32
  457. package/dist/components/ui/sheet/sheet.js.map +1 -1
  458. package/dist/components/ui/text-link/index.d.ts.map +1 -1
  459. package/dist/components/ui/toggle-group/toggle-group.d.ts +1 -1
  460. package/dist/components/ui/toggle-group/toggle-group.d.ts.map +1 -1
  461. package/dist/components/ui/toggle-group/toggle-group.js +2 -7
  462. package/dist/components/ui/toggle-group/toggle-group.js.map +1 -1
  463. package/dist/components/ui/tooltip/tooltip.d.ts +17 -1
  464. package/dist/components/ui/tooltip/tooltip.d.ts.map +1 -1
  465. package/dist/components/ui/tooltip/tooltip.js +40 -20
  466. package/dist/components/ui/tooltip/tooltip.js.map +1 -1
  467. package/dist/components/ui/trace/index.d.ts +1 -1
  468. package/dist/components/ui/trace/index.d.ts.map +1 -1
  469. package/dist/components/ui/trace/index.js +1 -1
  470. package/dist/components/ui/trace/trace.d.ts +44 -3
  471. package/dist/components/ui/trace/trace.d.ts.map +1 -1
  472. package/dist/components/ui/trace/trace.js +87 -15
  473. package/dist/components/ui/trace/trace.js.map +1 -1
  474. package/dist/index.js +34 -28
  475. package/dist/lib/accent-presets.d.ts +7 -4
  476. package/dist/lib/accent-presets.d.ts.map +1 -1
  477. package/dist/lib/accent-presets.js +10 -5
  478. package/dist/lib/accent-presets.js.map +1 -1
  479. package/dist/lib/accent-roles.d.ts +20 -1
  480. package/dist/lib/accent-roles.d.ts.map +1 -1
  481. package/dist/lib/accent-roles.js +34 -26
  482. package/dist/lib/accent-roles.js.map +1 -1
  483. package/dist/lib/appearance-font-settings.d.ts.map +1 -1
  484. package/dist/lib/appearance-font-settings.js +4 -4
  485. package/dist/lib/appearance-font-settings.js.map +1 -1
  486. package/dist/lib/async-action.d.ts +42 -0
  487. package/dist/lib/async-action.d.ts.map +1 -0
  488. package/dist/lib/async-action.js +61 -0
  489. package/dist/lib/async-action.js.map +1 -0
  490. package/dist/lib/breakpoints.d.ts +8 -0
  491. package/dist/lib/breakpoints.d.ts.map +1 -0
  492. package/dist/lib/breakpoints.js +11 -0
  493. package/dist/lib/breakpoints.js.map +1 -0
  494. package/dist/lib/bytes.d.ts +8 -0
  495. package/dist/lib/bytes.d.ts.map +1 -0
  496. package/dist/lib/bytes.js +20 -0
  497. package/dist/lib/bytes.js.map +1 -0
  498. package/dist/lib/clipboard.d.ts +13 -0
  499. package/dist/lib/clipboard.d.ts.map +1 -1
  500. package/dist/lib/clipboard.js +32 -1
  501. package/dist/lib/clipboard.js.map +1 -1
  502. package/dist/lib/events.d.ts +14 -0
  503. package/dist/lib/events.d.ts.map +1 -0
  504. package/dist/lib/events.js +16 -0
  505. package/dist/lib/events.js.map +1 -0
  506. package/dist/lib/external-link.d.ts +19 -0
  507. package/dist/lib/external-link.d.ts.map +1 -0
  508. package/dist/lib/external-link.js +27 -0
  509. package/dist/lib/external-link.js.map +1 -0
  510. package/dist/lib/font-catalog.d.ts +3 -6
  511. package/dist/lib/font-catalog.d.ts.map +1 -1
  512. package/dist/lib/font-catalog.js +16 -12
  513. package/dist/lib/font-catalog.js.map +1 -1
  514. package/dist/lib/font-zoom.d.ts +4 -4
  515. package/dist/lib/font-zoom.d.ts.map +1 -1
  516. package/dist/lib/font-zoom.js +9 -12
  517. package/dist/lib/font-zoom.js.map +1 -1
  518. package/dist/lib/overlay.d.ts +29 -1
  519. package/dist/lib/overlay.d.ts.map +1 -1
  520. package/dist/lib/overlay.js +32 -16
  521. package/dist/lib/overlay.js.map +1 -1
  522. package/dist/lib/preference-store.d.ts +13 -3
  523. package/dist/lib/preference-store.d.ts.map +1 -1
  524. package/dist/lib/preference-store.js +27 -37
  525. package/dist/lib/preference-store.js.map +1 -1
  526. package/dist/lib/resize-separator.d.ts +15 -0
  527. package/dist/lib/resize-separator.d.ts.map +1 -0
  528. package/dist/lib/resize-separator.js +23 -0
  529. package/dist/lib/resize-separator.js.map +1 -0
  530. package/dist/lib/safe-script.d.ts +19 -1
  531. package/dist/lib/safe-script.d.ts.map +1 -1
  532. package/dist/lib/safe-script.js +19 -1
  533. package/dist/lib/safe-script.js.map +1 -1
  534. package/dist/lib/scroll-geometry.d.ts +33 -0
  535. package/dist/lib/scroll-geometry.d.ts.map +1 -0
  536. package/dist/lib/scroll-geometry.js +48 -0
  537. package/dist/lib/scroll-geometry.js.map +1 -0
  538. package/dist/lib/text.d.ts +13 -0
  539. package/dist/lib/text.d.ts.map +1 -0
  540. package/dist/lib/text.js +30 -0
  541. package/dist/lib/text.js.map +1 -0
  542. package/dist/lib/theme-accents.d.ts +2 -0
  543. package/dist/lib/theme-accents.d.ts.map +1 -1
  544. package/dist/lib/theme-accents.js +2 -2
  545. package/dist/lib/theme-accents.js.map +1 -1
  546. package/dist/lib/theme-catalogue.d.ts.map +1 -1
  547. package/dist/lib/theme-catalogue.js +3 -4
  548. package/dist/lib/theme-catalogue.js.map +1 -1
  549. package/dist/lib/theme-css.d.ts +14 -1
  550. package/dist/lib/theme-css.d.ts.map +1 -1
  551. package/dist/lib/theme-css.js +25 -48
  552. package/dist/lib/theme-css.js.map +1 -1
  553. package/dist/lib/theme-defaults.d.ts +33 -5
  554. package/dist/lib/theme-defaults.d.ts.map +1 -1
  555. package/dist/lib/theme-defaults.generated.d.ts +1 -1
  556. package/dist/lib/theme-defaults.generated.d.ts.map +1 -1
  557. package/dist/lib/theme-defaults.generated.js.map +1 -1
  558. package/dist/lib/theme-defaults.js +59 -3
  559. package/dist/lib/theme-defaults.js.map +1 -1
  560. package/dist/lib/theme-engine-light.d.ts +6 -0
  561. package/dist/lib/theme-engine-light.d.ts.map +1 -1
  562. package/dist/lib/theme-engine-light.js +71 -57
  563. package/dist/lib/theme-engine-light.js.map +1 -1
  564. package/dist/lib/theme-engine.d.ts +20 -22
  565. package/dist/lib/theme-engine.d.ts.map +1 -1
  566. package/dist/lib/theme-engine.js +19 -6
  567. package/dist/lib/theme-engine.js.map +1 -1
  568. package/dist/lib/theme-records.d.ts +3 -3
  569. package/dist/lib/theme-records.d.ts.map +1 -1
  570. package/dist/lib/theme-records.js +20 -59
  571. package/dist/lib/theme-records.js.map +1 -1
  572. package/dist/lib/theme-types.d.ts +174 -0
  573. package/dist/lib/theme-types.d.ts.map +1 -0
  574. package/dist/lib/theme-types.js +105 -0
  575. package/dist/lib/theme-types.js.map +1 -0
  576. package/dist/lib/themes.d.ts +4 -159
  577. package/dist/lib/themes.d.ts.map +1 -1
  578. package/dist/lib/themes.js +14 -33
  579. package/dist/lib/themes.js.map +1 -1
  580. package/dist/lib/tokens.d.ts.map +1 -1
  581. package/dist/lib/tokens.js +0 -1
  582. package/dist/lib/tokens.js.map +1 -1
  583. package/dist/lib/url.d.ts +9 -0
  584. package/dist/lib/url.d.ts.map +1 -0
  585. package/dist/lib/url.js +24 -0
  586. package/dist/lib/url.js.map +1 -0
  587. package/dist/lib/version-notes.d.ts.map +1 -1
  588. package/dist/lib/version-notes.js +3 -10
  589. package/dist/lib/version-notes.js.map +1 -1
  590. package/dist/r/about-dialog.json +2 -1
  591. package/dist/r/action-button.json +2 -1
  592. package/dist/r/alert-dialog.json +1 -0
  593. package/dist/r/appearance-editor.json +1 -1
  594. package/dist/r/checkpoint.json +0 -2
  595. package/dist/r/code-block.json +1 -0
  596. package/dist/r/confirmation.json +0 -1
  597. package/dist/r/context-menu.json +2 -2
  598. package/dist/r/context.json +0 -1
  599. package/dist/r/conversation.json +6 -5
  600. package/dist/r/dialog.json +5 -0
  601. package/dist/r/drawer.json +0 -1
  602. package/dist/r/dropdown-menu.json +5 -0
  603. package/dist/r/lib.json +51 -1
  604. package/dist/r/menubar.json +2 -2
  605. package/dist/r/model-selector.json +0 -1
  606. package/dist/r/reasoning.json +2 -1
  607. package/dist/r/registry.json +120 -46
  608. package/dist/r/shell-top-bar.json +1 -0
  609. package/dist/r/sidebar-nav.json +5 -0
  610. package/dist/r/sources.json +2 -2
  611. package/dist/r/src/components/composites/about-dialog/about-dialog.tsx +22 -42
  612. package/dist/r/src/components/composites/account-menu/account-menu.tsx +9 -35
  613. package/dist/r/src/components/composites/action-button/action-button.tsx +5 -7
  614. package/dist/r/src/components/composites/appearance-editor/accent-swatch-groups.tsx +3 -11
  615. package/dist/r/src/components/composites/appearance-editor/appearance-choices.tsx +8 -5
  616. package/dist/r/src/components/composites/appearance-editor/appearance-editor.tsx +8 -6
  617. package/dist/r/src/components/composites/appearance-editor/appearance-rows.tsx +30 -82
  618. package/dist/r/src/components/composites/appearance-editor/font-settings-group.tsx +11 -77
  619. package/dist/r/src/components/composites/appearance-editor/index.ts +1 -0
  620. package/dist/r/src/components/composites/catalog-browser/catalog-browser.tsx +9 -13
  621. package/dist/r/src/components/composites/chain-of-thought/chain-of-thought.tsx +16 -18
  622. package/dist/r/src/components/composites/chat/chat.tsx +2 -2
  623. package/dist/r/src/components/composites/checkpoint/checkpoint-model.ts +3 -3
  624. package/dist/r/src/components/composites/checkpoint/checkpoint.tsx +3 -3
  625. package/dist/r/src/components/composites/confirmation/confirmation-model.ts +9 -17
  626. package/dist/r/src/components/composites/confirmation/confirmation.tsx +2 -2
  627. package/dist/r/src/components/composites/context/context-model.ts +1 -1
  628. package/dist/r/src/components/composites/file-tree/build-file-tree.ts +21 -39
  629. package/dist/r/src/components/composites/file-tree/file-tree.tsx +5 -58
  630. package/dist/r/src/components/composites/file-tree/index.ts +1 -1
  631. package/dist/r/src/components/composites/help-center/help-center.tsx +8 -21
  632. package/dist/r/src/components/composites/icon-picker/icon-picker.tsx +10 -11
  633. package/dist/r/src/components/composites/inline-citation/citation.ts +2 -1
  634. package/dist/r/src/components/composites/inline-citation/inline-citation.tsx +3 -2
  635. package/dist/r/src/components/composites/message-scroller/message-scroller.tsx +30 -30
  636. package/dist/r/src/components/composites/message-scroller/scroll-anchor.ts +5 -5
  637. package/dist/r/src/components/composites/model-selector/model-selector.tsx +3 -2
  638. package/dist/r/src/components/composites/model-selector/models.ts +1 -1
  639. package/dist/r/src/components/composites/plan/plan.tsx +1 -4
  640. package/dist/r/src/components/composites/queue/queue.tsx +8 -11
  641. package/dist/r/src/components/composites/reasoning/reasoning.tsx +5 -23
  642. package/dist/r/src/components/composites/settings/settings-layout.tsx +3 -2
  643. package/dist/r/src/components/composites/settings/settings-navigation.tsx +4 -1
  644. package/dist/r/src/components/composites/sources/source.ts +7 -53
  645. package/dist/r/src/components/composites/stack-trace/stack-trace.tsx +3 -12
  646. package/dist/r/src/components/composites/subagent/subagent.tsx +7 -17
  647. package/dist/r/src/components/composites/suggestion/suggestion.tsx +4 -3
  648. package/dist/r/src/components/composites/task/task.tsx +21 -64
  649. package/dist/r/src/components/composites/terminal/terminal-model.ts +4 -4
  650. package/dist/r/src/components/composites/terminal/terminal.tsx +3 -12
  651. package/dist/r/src/components/composites/test-results/test-results.tsx +3 -12
  652. package/dist/r/src/components/composites/tool/tool.tsx +34 -40
  653. package/dist/r/src/components/composites/tree/tree-navigation.ts +22 -2
  654. package/dist/r/src/components/composites/tree/tree.tsx +47 -3
  655. package/dist/r/src/components/composites/update-dialog/channel-control.tsx +10 -14
  656. package/dist/r/src/components/composites/update-dialog/update-dialog.tsx +66 -200
  657. package/dist/r/src/components/composites/update-dialog/update-model.ts +137 -0
  658. package/dist/r/src/components/composites/workspace-mark/workspace-mark.tsx +1 -1
  659. package/dist/r/src/components/composites/workspace-switcher/workspace-reorder-dialog.tsx +1 -18
  660. package/dist/r/src/components/composites/workspace-switcher/workspace-switcher.tsx +16 -19
  661. package/dist/r/src/components/conversation/busy-send-button.tsx +7 -34
  662. package/dist/r/src/components/conversation/chat-composer.tsx +1 -1
  663. package/dist/r/src/components/conversation/composer-core.ts +76 -0
  664. package/dist/r/src/components/conversation/composer-menu.tsx +1 -1
  665. package/dist/r/src/components/conversation/conversation-pane.tsx +4 -1
  666. package/dist/r/src/components/conversation/conversation-surface.tsx +23 -10
  667. package/dist/r/src/components/conversation/ime-guard.ts +6 -0
  668. package/dist/r/src/components/conversation/internal/chat-composer-shell.tsx +24 -65
  669. package/dist/r/src/components/conversation/message-composer.tsx +24 -54
  670. package/dist/r/src/components/conversation/message-row.tsx +33 -47
  671. package/dist/r/src/components/conversation/paste-token-editor.tsx +13 -16
  672. package/dist/r/src/components/conversation/paste-tokens.ts +36 -1
  673. package/dist/r/src/components/conversation/scroll-follow-core.ts +66 -137
  674. package/dist/r/src/components/conversation/scroll-follow.ts +26 -67
  675. package/dist/r/src/components/conversation/thread-panel.tsx +2 -4
  676. package/dist/r/src/components/conversation/transcript-composition.tsx +9 -33
  677. package/dist/r/src/components/conversation/transcript-folding.ts +2 -2
  678. package/dist/r/src/components/conversation/transcript-grouping.ts +18 -3
  679. package/dist/r/src/components/layout/contextual-sidebar/contextual-sidebar.tsx +80 -22
  680. package/dist/r/src/components/layout/contextual-sidebar/index.ts +1 -0
  681. package/dist/r/src/components/layout/contextual-sidebar/mobile-contextual-sidebar.tsx +1 -1
  682. package/dist/r/src/components/layout/floating-preview/model.ts +57 -195
  683. package/dist/r/src/components/layout/pixel-resize-handle/pixel-resize-handle.tsx +6 -12
  684. package/dist/r/src/components/layout/shell-top-bar/shell-top-bar.tsx +47 -54
  685. package/dist/r/src/components/layout/side-rail/side-rail-context.ts +1 -11
  686. package/dist/r/src/components/layout/side-rail/side-rail.tsx +95 -107
  687. package/dist/r/src/components/layout/sidebar-nav/index.ts +1 -2
  688. package/dist/r/src/components/layout/sidebar-nav/sidebar-nav-classes.ts +15 -0
  689. package/dist/r/src/components/layout/sidebar-nav/sidebar-nav-resize-handle.tsx +1 -4
  690. package/dist/r/src/components/layout/sidebar-nav/sidebar-nav.tsx +9 -27
  691. package/dist/r/src/components/layout/split-layout/geometry.ts +2 -9
  692. package/dist/r/src/components/layout/split-layout/model.ts +3 -6
  693. package/dist/r/src/components/layout/split-layout/resize-controller-core-retry.tsx +12 -6
  694. package/dist/r/src/components/layout/split-layout/resize-controller-core.tsx +12 -6
  695. package/dist/r/src/components/layout/split-layout/split-layout.tsx +46 -61
  696. package/dist/r/src/components/layout/split-layout/tree.ts +5 -0
  697. package/dist/r/src/components/layout/top-bar/top-bar.tsx +16 -38
  698. package/dist/r/src/components/layout/top-bar/window-chrome.ts +23 -0
  699. package/dist/r/src/components/motion/presence.tsx +1 -3
  700. package/dist/r/src/components/theme/appearance-panel.tsx +28 -19
  701. package/dist/r/src/components/theme/index.ts +1 -22
  702. package/dist/r/src/components/theme/lazy.ts +36 -26
  703. package/dist/r/src/components/theme/script-projection.ts +40 -0
  704. package/dist/r/src/components/theme/theme-api.ts +30 -0
  705. package/dist/r/src/components/theme/theme-catalogue-source.ts +3 -2
  706. package/dist/r/src/components/theme/theme-document.ts +248 -23
  707. package/dist/r/src/components/theme/theme-mode-toggle.tsx +1 -1
  708. package/dist/r/src/components/theme/theme-persistence.ts +74 -130
  709. package/dist/r/src/components/theme/theme-picker.tsx +2 -2
  710. package/dist/r/src/components/theme/theme-provider-value.ts +64 -69
  711. package/dist/r/src/components/theme/theme-provider.tsx +5 -24
  712. package/dist/r/src/components/theme/theme-script.ts +100 -47
  713. package/dist/r/src/components/theme/theme-state.ts +350 -10
  714. package/dist/r/src/components/theme/theme-toggle.tsx +1 -1
  715. package/dist/r/src/components/theme/token-projection-options.ts +14 -0
  716. package/dist/r/src/components/theme/token-projection.ts +37 -0
  717. package/dist/r/src/components/ui/alert-dialog/alert-dialog.tsx +43 -43
  718. package/dist/r/src/components/ui/attachment/attachment.tsx +4 -17
  719. package/dist/r/src/components/ui/avatar/avatar.tsx +3 -2
  720. package/dist/r/src/components/ui/board/board.tsx +4 -10
  721. package/dist/r/src/components/ui/button-group/button-group.tsx +1 -1
  722. package/dist/r/src/components/ui/chart/chart.tsx +0 -3
  723. package/dist/r/src/components/ui/code-block/code-block.tsx +7 -26
  724. package/dist/r/src/components/ui/command/command.tsx +43 -39
  725. package/dist/r/src/components/ui/context-menu/context-menu.tsx +18 -168
  726. package/dist/r/src/components/ui/dialog/dialog-layer.tsx +266 -0
  727. package/dist/r/src/components/ui/dialog/dialog.tsx +77 -271
  728. package/dist/r/src/components/ui/drawer/drawer.tsx +5 -23
  729. package/dist/r/src/components/ui/dropdown-menu/dropdown-menu.tsx +204 -226
  730. package/dist/r/src/components/ui/dropdown-menu/menu-parts.tsx +220 -0
  731. package/dist/r/src/components/ui/field/field.tsx +1 -1
  732. package/dist/r/src/components/ui/field/number-field.tsx +1 -1
  733. package/dist/r/src/components/ui/hover-card/hover-card.tsx +4 -11
  734. package/dist/r/src/components/ui/menubar/menubar.tsx +36 -169
  735. package/dist/r/src/components/ui/message/message.tsx +0 -1
  736. package/dist/r/src/components/ui/message/parse-message-text.ts +80 -32
  737. package/dist/r/src/components/ui/modal-dialog/modal-dialog.tsx +9 -39
  738. package/dist/r/src/components/ui/navigation-menu/navigation-menu.tsx +0 -1
  739. package/dist/r/src/components/ui/popover/popover.tsx +5 -11
  740. package/dist/r/src/components/ui/resizable/resizable.tsx +6 -16
  741. package/dist/r/src/components/ui/sheet/sheet.tsx +30 -42
  742. package/dist/r/src/components/ui/text-link/index.ts +0 -1
  743. package/dist/r/src/components/ui/toggle-group/toggle-group.tsx +3 -11
  744. package/dist/r/src/components/ui/tooltip/tooltip.tsx +47 -26
  745. package/dist/r/src/components/ui/trace/index.ts +7 -0
  746. package/dist/r/src/components/ui/trace/trace.tsx +100 -9
  747. package/dist/r/src/lib/accent-presets.ts +12 -8
  748. package/dist/r/src/lib/accent-roles.ts +43 -29
  749. package/dist/r/src/lib/appearance-font-settings.ts +5 -5
  750. package/dist/r/src/lib/async-action.ts +72 -0
  751. package/dist/r/src/lib/breakpoints.ts +7 -0
  752. package/dist/r/src/lib/bytes.ts +20 -0
  753. package/dist/r/src/lib/clipboard.ts +43 -0
  754. package/dist/r/src/lib/events.ts +17 -0
  755. package/dist/r/src/lib/external-link.ts +42 -0
  756. package/dist/r/src/lib/font-catalog.ts +4 -6
  757. package/dist/r/src/lib/font-zoom.ts +9 -14
  758. package/dist/r/src/lib/overlay.ts +55 -18
  759. package/dist/r/src/lib/preference-store.ts +36 -34
  760. package/dist/r/src/lib/resize-separator.ts +36 -0
  761. package/dist/r/src/lib/safe-script.ts +19 -1
  762. package/dist/r/src/lib/scroll-geometry.ts +69 -0
  763. package/dist/r/src/lib/text.ts +49 -0
  764. package/dist/r/src/lib/theme-accents.ts +1 -1
  765. package/dist/r/src/lib/theme-catalogue.ts +3 -4
  766. package/dist/r/src/lib/theme-css.ts +33 -54
  767. package/dist/r/src/lib/theme-defaults.generated.ts +1 -1
  768. package/dist/r/src/lib/theme-defaults.ts +55 -7
  769. package/dist/r/src/lib/theme-engine-light.ts +88 -72
  770. package/dist/r/src/lib/theme-engine.ts +29 -33
  771. package/dist/r/src/lib/theme-records.ts +33 -69
  772. package/dist/r/src/lib/theme-types.ts +199 -0
  773. package/dist/r/src/lib/themes.ts +33 -196
  774. package/dist/r/src/lib/tokens.ts +0 -1
  775. package/dist/r/src/lib/url.ts +25 -0
  776. package/dist/r/src/lib/version-notes.ts +3 -9
  777. package/dist/r/src/styles/theme-variants.css +32 -32
  778. package/dist/r/src/styles/theme.css +17 -13
  779. package/dist/r/subagent.json +0 -2
  780. package/dist/r/suggestion.json +0 -1
  781. package/dist/r/theming.json +21 -21
  782. package/dist/r/top-bar.json +5 -0
  783. package/dist/r/trace.json +1 -0
  784. package/dist/r/update-dialog.json +5 -0
  785. package/package.json +22 -8
  786. package/registry.json +120 -46
  787. package/src/components/composites/about-dialog/about-dialog.tsx +22 -42
  788. package/src/components/composites/account-menu/account-menu.tsx +9 -35
  789. package/src/components/composites/action-button/action-button.tsx +5 -7
  790. package/src/components/composites/appearance-editor/accent-swatch-groups.tsx +3 -11
  791. package/src/components/composites/appearance-editor/appearance-choices.tsx +8 -5
  792. package/src/components/composites/appearance-editor/appearance-editor.tsx +8 -6
  793. package/src/components/composites/appearance-editor/appearance-rows.tsx +30 -82
  794. package/src/components/composites/appearance-editor/font-settings-group.tsx +11 -77
  795. package/src/components/composites/appearance-editor/index.ts +1 -0
  796. package/src/components/composites/catalog-browser/catalog-browser.tsx +9 -13
  797. package/src/components/composites/chain-of-thought/chain-of-thought.tsx +16 -18
  798. package/src/components/composites/chat/chat.tsx +2 -2
  799. package/src/components/composites/checkpoint/checkpoint-model.ts +3 -3
  800. package/src/components/composites/checkpoint/checkpoint.tsx +3 -3
  801. package/src/components/composites/confirmation/confirmation-model.ts +9 -17
  802. package/src/components/composites/confirmation/confirmation.tsx +2 -2
  803. package/src/components/composites/context/context-model.ts +1 -1
  804. package/src/components/composites/file-tree/build-file-tree.ts +21 -39
  805. package/src/components/composites/file-tree/file-tree.tsx +5 -58
  806. package/src/components/composites/file-tree/index.ts +1 -1
  807. package/src/components/composites/help-center/help-center.tsx +8 -21
  808. package/src/components/composites/icon-picker/icon-picker.tsx +10 -11
  809. package/src/components/composites/inline-citation/citation.ts +2 -1
  810. package/src/components/composites/inline-citation/inline-citation.tsx +3 -2
  811. package/src/components/composites/message-scroller/message-scroller.tsx +30 -30
  812. package/src/components/composites/message-scroller/scroll-anchor.ts +5 -5
  813. package/src/components/composites/model-selector/model-selector.tsx +3 -2
  814. package/src/components/composites/model-selector/models.ts +1 -1
  815. package/src/components/composites/plan/plan.tsx +1 -4
  816. package/src/components/composites/queue/queue.tsx +8 -11
  817. package/src/components/composites/reasoning/reasoning.tsx +5 -23
  818. package/src/components/composites/settings/settings-layout.tsx +3 -2
  819. package/src/components/composites/settings/settings-navigation.tsx +4 -1
  820. package/src/components/composites/sources/source.ts +7 -53
  821. package/src/components/composites/stack-trace/stack-trace.tsx +3 -12
  822. package/src/components/composites/subagent/subagent.tsx +7 -17
  823. package/src/components/composites/suggestion/suggestion.tsx +4 -3
  824. package/src/components/composites/task/task.tsx +21 -64
  825. package/src/components/composites/terminal/terminal-model.ts +4 -4
  826. package/src/components/composites/terminal/terminal.tsx +3 -12
  827. package/src/components/composites/test-results/test-results.tsx +3 -12
  828. package/src/components/composites/tool/tool.tsx +34 -40
  829. package/src/components/composites/tree/tree-navigation.ts +22 -2
  830. package/src/components/composites/tree/tree.tsx +47 -3
  831. package/src/components/composites/update-dialog/channel-control.tsx +10 -14
  832. package/src/components/composites/update-dialog/update-dialog.tsx +66 -200
  833. package/src/components/composites/update-dialog/update-model.ts +137 -0
  834. package/src/components/composites/workspace-mark/workspace-mark.tsx +1 -1
  835. package/src/components/composites/workspace-switcher/workspace-reorder-dialog.tsx +1 -18
  836. package/src/components/composites/workspace-switcher/workspace-switcher.tsx +16 -19
  837. package/src/components/conversation/busy-send-button.tsx +7 -34
  838. package/src/components/conversation/chat-composer.tsx +1 -1
  839. package/src/components/conversation/composer-core.ts +76 -0
  840. package/src/components/conversation/composer-menu.tsx +1 -1
  841. package/src/components/conversation/conversation-pane.tsx +4 -1
  842. package/src/components/conversation/conversation-surface.tsx +23 -10
  843. package/src/components/conversation/ime-guard.ts +6 -0
  844. package/src/components/conversation/internal/chat-composer-shell.tsx +24 -65
  845. package/src/components/conversation/message-composer.tsx +24 -54
  846. package/src/components/conversation/message-row.tsx +33 -47
  847. package/src/components/conversation/paste-token-editor.tsx +13 -16
  848. package/src/components/conversation/paste-tokens.ts +36 -1
  849. package/src/components/conversation/scroll-follow-core.ts +66 -137
  850. package/src/components/conversation/scroll-follow.ts +26 -67
  851. package/src/components/conversation/thread-panel.tsx +2 -4
  852. package/src/components/conversation/transcript-composition.tsx +9 -33
  853. package/src/components/conversation/transcript-folding.ts +2 -2
  854. package/src/components/conversation/transcript-grouping.ts +18 -3
  855. package/src/components/layout/contextual-sidebar/contextual-sidebar.tsx +80 -22
  856. package/src/components/layout/contextual-sidebar/index.ts +1 -0
  857. package/src/components/layout/contextual-sidebar/mobile-contextual-sidebar.tsx +1 -1
  858. package/src/components/layout/floating-preview/model.ts +57 -195
  859. package/src/components/layout/pixel-resize-handle/pixel-resize-handle.tsx +6 -12
  860. package/src/components/layout/shell-top-bar/shell-top-bar.tsx +47 -54
  861. package/src/components/layout/side-rail/side-rail-context.ts +1 -11
  862. package/src/components/layout/side-rail/side-rail.tsx +95 -107
  863. package/src/components/layout/sidebar-nav/index.ts +1 -2
  864. package/src/components/layout/sidebar-nav/sidebar-nav-classes.ts +15 -0
  865. package/src/components/layout/sidebar-nav/sidebar-nav-resize-handle.tsx +1 -4
  866. package/src/components/layout/sidebar-nav/sidebar-nav.tsx +9 -27
  867. package/src/components/layout/split-layout/geometry.ts +2 -9
  868. package/src/components/layout/split-layout/model.ts +3 -6
  869. package/src/components/layout/split-layout/resize-controller-core-retry.tsx +12 -6
  870. package/src/components/layout/split-layout/resize-controller-core.tsx +12 -6
  871. package/src/components/layout/split-layout/split-layout.tsx +46 -61
  872. package/src/components/layout/split-layout/tree.ts +5 -0
  873. package/src/components/layout/top-bar/top-bar.tsx +16 -38
  874. package/src/components/layout/top-bar/window-chrome.ts +23 -0
  875. package/src/components/motion/presence.tsx +1 -3
  876. package/src/components/theme/appearance-panel.tsx +28 -19
  877. package/src/components/theme/index.ts +1 -22
  878. package/src/components/theme/lazy.ts +36 -26
  879. package/src/components/theme/script-projection.ts +40 -0
  880. package/src/components/theme/theme-api.ts +30 -0
  881. package/src/components/theme/theme-catalogue-source.ts +3 -2
  882. package/src/components/theme/theme-document.ts +248 -23
  883. package/src/components/theme/theme-mode-toggle.tsx +1 -1
  884. package/src/components/theme/theme-persistence.ts +74 -130
  885. package/src/components/theme/theme-picker.tsx +2 -2
  886. package/src/components/theme/theme-provider-value.ts +64 -69
  887. package/src/components/theme/theme-provider.tsx +5 -24
  888. package/src/components/theme/theme-script.ts +100 -47
  889. package/src/components/theme/theme-state.ts +350 -10
  890. package/src/components/theme/theme-toggle.tsx +1 -1
  891. package/src/components/theme/token-projection-options.ts +14 -0
  892. package/src/components/theme/token-projection.ts +37 -0
  893. package/src/components/ui/alert-dialog/alert-dialog.tsx +43 -43
  894. package/src/components/ui/attachment/attachment.tsx +4 -17
  895. package/src/components/ui/avatar/avatar.tsx +3 -2
  896. package/src/components/ui/board/board.tsx +4 -10
  897. package/src/components/ui/button-group/button-group.tsx +1 -1
  898. package/src/components/ui/chart/chart.tsx +0 -3
  899. package/src/components/ui/code-block/code-block.tsx +7 -26
  900. package/src/components/ui/command/command.tsx +43 -39
  901. package/src/components/ui/context-menu/context-menu.tsx +18 -168
  902. package/src/components/ui/dialog/dialog-layer.tsx +266 -0
  903. package/src/components/ui/dialog/dialog.tsx +77 -271
  904. package/src/components/ui/drawer/drawer.tsx +5 -23
  905. package/src/components/ui/dropdown-menu/dropdown-menu.tsx +204 -226
  906. package/src/components/ui/dropdown-menu/menu-parts.tsx +220 -0
  907. package/src/components/ui/field/field.tsx +1 -1
  908. package/src/components/ui/field/number-field.tsx +1 -1
  909. package/src/components/ui/hover-card/hover-card.tsx +4 -11
  910. package/src/components/ui/menubar/menubar.tsx +36 -169
  911. package/src/components/ui/message/message.tsx +0 -1
  912. package/src/components/ui/message/parse-message-text.ts +80 -32
  913. package/src/components/ui/modal-dialog/modal-dialog.tsx +9 -39
  914. package/src/components/ui/navigation-menu/navigation-menu.tsx +0 -1
  915. package/src/components/ui/popover/popover.tsx +5 -11
  916. package/src/components/ui/resizable/resizable.tsx +6 -16
  917. package/src/components/ui/sheet/sheet.tsx +30 -42
  918. package/src/components/ui/text-link/index.ts +0 -1
  919. package/src/components/ui/toggle-group/toggle-group.tsx +3 -11
  920. package/src/components/ui/tooltip/tooltip.tsx +47 -26
  921. package/src/components/ui/trace/index.ts +7 -0
  922. package/src/components/ui/trace/trace.tsx +100 -9
  923. package/src/lib/accent-presets.ts +12 -8
  924. package/src/lib/accent-roles.ts +43 -29
  925. package/src/lib/appearance-font-settings.ts +5 -5
  926. package/src/lib/async-action.ts +72 -0
  927. package/src/lib/breakpoints.ts +7 -0
  928. package/src/lib/bytes.ts +20 -0
  929. package/src/lib/clipboard.ts +43 -0
  930. package/src/lib/events.ts +17 -0
  931. package/src/lib/external-link.ts +42 -0
  932. package/src/lib/font-catalog.ts +4 -6
  933. package/src/lib/font-zoom.ts +9 -14
  934. package/src/lib/overlay.ts +55 -18
  935. package/src/lib/preference-store.ts +36 -34
  936. package/src/lib/resize-separator.ts +36 -0
  937. package/src/lib/safe-script.ts +19 -1
  938. package/src/lib/scroll-geometry.ts +69 -0
  939. package/src/lib/text.ts +49 -0
  940. package/src/lib/theme-accents.ts +1 -1
  941. package/src/lib/theme-catalogue.ts +3 -4
  942. package/src/lib/theme-css.ts +33 -54
  943. package/src/lib/theme-defaults.generated.ts +1 -1
  944. package/src/lib/theme-defaults.ts +55 -7
  945. package/src/lib/theme-engine-light.ts +88 -72
  946. package/src/lib/theme-engine.ts +29 -33
  947. package/src/lib/theme-records.ts +33 -69
  948. package/src/lib/theme-types.ts +199 -0
  949. package/src/lib/themes.ts +33 -196
  950. package/src/lib/tokens.ts +0 -1
  951. package/src/lib/url.ts +25 -0
  952. package/src/lib/version-notes.ts +3 -9
  953. package/src/styles/theme-variants.css +32 -32
  954. package/src/styles/theme.css +17 -13
  955. package/dist/components/conversation/paste-preview.d.ts +0 -11
  956. package/dist/components/conversation/paste-preview.d.ts.map +0 -1
  957. package/dist/components/conversation/paste-preview.js +0 -27
  958. package/dist/components/conversation/paste-preview.js.map +0 -1
  959. package/dist/components/theme/theme-document-core.d.ts +0 -123
  960. package/dist/components/theme/theme-document-core.d.ts.map +0 -1
  961. package/dist/components/theme/theme-document-core.js.map +0 -1
  962. package/dist/components/theme/theme-provider-core.d.ts +0 -19
  963. package/dist/components/theme/theme-provider-core.d.ts.map +0 -1
  964. package/dist/components/theme/theme-provider-core.js +0 -27
  965. package/dist/components/theme/theme-provider-core.js.map +0 -1
  966. package/dist/components/theme/theme-provider-lazy.d.ts +0 -28
  967. package/dist/components/theme/theme-provider-lazy.d.ts.map +0 -1
  968. package/dist/components/theme/theme-provider-lazy.js +0 -35
  969. package/dist/components/theme/theme-provider-lazy.js.map +0 -1
  970. package/dist/components/theme/theme-state-core.d.ts +0 -248
  971. package/dist/components/theme/theme-state-core.d.ts.map +0 -1
  972. package/dist/components/theme/theme-state-core.js.map +0 -1
  973. package/dist/r/src/components/conversation/paste-preview.ts +0 -35
  974. package/dist/r/src/components/theme/theme-document-core.ts +0 -262
  975. package/dist/r/src/components/theme/theme-provider-core.tsx +0 -40
  976. package/dist/r/src/components/theme/theme-provider-lazy.tsx +0 -34
  977. package/dist/r/src/components/theme/theme-state-core.ts +0 -364
  978. package/src/components/conversation/paste-preview.ts +0 -35
  979. package/src/components/theme/theme-document-core.ts +0 -262
  980. package/src/components/theme/theme-provider-core.tsx +0 -40
  981. package/src/components/theme/theme-provider-lazy.tsx +0 -34
  982. package/src/components/theme/theme-state-core.ts +0 -364
@@ -1,26 +1,39 @@
1
+ import { assertThemeTokenProjectionConfig } from "./token-projection-options.js";
1
2
  import { fontZoomShortcut } from "../../lib/font-zoom.js";
3
+ import "../../lib/theme-defaults.js";
2
4
  import { REDUCED_TRANSPARENCY_QUERY, resolveSurfaceState } from "../../lib/theme-surface.js";
3
- import { CatalogueRequired, needsCatalogue } from "../../lib/theme-engine.js";
4
- import { applyThemeToRootWith, applyWithoutTransitions } from "./theme-document-core.js";
5
+ import { needsCatalogue, pairNeedsData } from "../../lib/theme-engine.js";
6
+ import { themeContext } from "./theme-context.js";
7
+ import { applyThemeToRoot, applyWithoutTransitions } from "./theme-document.js";
5
8
  import { localStoragePersistence, readPersisted, writePersisted } from "./theme-persistence.js";
6
- import { accentRolesForStateWith, initialThemeSelection, mergeRegistry, mergeThemeSelection, resolveTerminalVariant, resolveThemeState, zoomedFontSettings } from "./theme-state-core.js";
7
- import { createEffect, createMemo, createSignal, onCleanup, splitProps, untrack } from "solid-js";
9
+ import { accentRolesForState, initialThemeSelection, mergeRegistry, mergeThemeSelection, resolveTerminalVariant, resolveThemeState, zoomedFontSettings } from "./theme-state.js";
10
+ import { createComponent, createEffect, createMemo, createSignal, onCleanup, splitProps, untrack } from "solid-js";
8
11
  // src/components/theme/theme-provider-value.ts
9
12
  /** The operating system's Reduce Transparency query, where there is a window to ask. */
10
13
  function reducedTransparencyMedia() {
11
14
  return typeof window !== "undefined" && typeof window.matchMedia === "function" ? window.matchMedia(REDUCED_TRANSPARENCY_QUERY) : void 0;
12
15
  }
13
16
  /**
17
+ * The provider, parameterised by where its catalogue comes from: the eager
18
+ * `ThemeProvider` passes the whole catalogue, the lazy one a source that loads it.
19
+ * Nothing here imports catalogue code or data, which is what lets the lazy entry keep
20
+ * them out of a consumer's start-up chunk.
21
+ */
22
+ function ThemeProviderWith(props) {
23
+ const value = createThemeContextValue(props);
24
+ return createComponent(themeContext().Provider, {
25
+ value,
26
+ get children() {
27
+ return props.children;
28
+ }
29
+ });
30
+ }
31
+ /**
14
32
  * Everything the provider is, as a value: the context object, with its effects and
15
33
  * listeners created in the caller's reactive scope.
16
- *
17
- * Parameterised by where its catalogue comes from: `ThemeProvider`
18
- * (`theme-provider.tsx`) and the lazy `ThemeProvider` (`theme-provider-lazy.tsx`) wrap
19
- * this with a source. It imports no catalogue code or data, which is what lets the lazy
20
- * one keep them out of a consumer's start-up chunk. It is not JSX so that the unit lane,
21
- * which has no Solid compiler, can drive it directly.
22
34
  */
23
35
  function createThemeContextValue(props) {
36
+ assertThemeTokenProjectionConfig(props.tokenProjection);
24
37
  const [local] = splitProps(props, [
25
38
  "catalogue",
26
39
  "storageKey",
@@ -29,6 +42,7 @@ function createThemeContextValue(props) {
29
42
  "persistence",
30
43
  "themes",
31
44
  "transformTokens",
45
+ "tokenProjection",
32
46
  "disableTransitionOnChange",
33
47
  "accentContrastFloor",
34
48
  "surface",
@@ -64,6 +78,7 @@ function createThemeContextValue(props) {
64
78
  return preview ? mergeThemeSelection(selection(), preview) : selection();
65
79
  });
66
80
  const shown = createMemo(() => draft() ? resolveThemeState(shownSelection(), systemAppearance(), registry()) : committed());
81
+ const shownAppearance = createMemo(() => shown().appearance);
67
82
  const surfaceOn = (candidate) => local.surface === true || typeof local.surface === "object" || candidate.surface !== void 0;
68
83
  const nativeTranslucency = () => {
69
84
  const capability = typeof local.surface === "object" ? local.surface.nativeTranslucency : false;
@@ -103,18 +118,16 @@ function createThemeContextValue(props) {
103
118
  terminalVariant: resolveTerminalVariant(shownSelection().terminalThemeId, registry()),
104
119
  surface: axisOn() ? surfaceStateOf(shownSelection()) : void 0
105
120
  };
121
+ const projectionOptions = local.tokenProjection ? { tokenProjection: local.tokenProjection } : {};
106
122
  const options = {
107
123
  transformTokens: local.transformTokens,
124
+ ...projectionOptions,
108
125
  accentContrastFloor: local.accentContrastFloor,
109
126
  palette: local.palette,
110
127
  editorRoles: local.editorRoles
111
128
  };
112
129
  const apply = () => {
113
- try {
114
- written = applyThemeToRootWith(current, document.documentElement, state, options, written);
115
- } catch (error) {
116
- if (!(error instanceof CatalogueRequired)) throw error;
117
- }
130
+ written = applyThemeToRoot(current, document.documentElement, state, options, written);
118
131
  };
119
132
  if (local.disableTransitionOnChange) {
120
133
  restoreTransitions?.();
@@ -122,14 +135,7 @@ function createThemeContextValue(props) {
122
135
  } else apply();
123
136
  });
124
137
  onCleanup(() => restoreTransitions?.());
125
- const themeAccents = createMemo(() => {
126
- try {
127
- return engine().themeAccentsFor(selection().lightThemeId, selection().darkThemeId);
128
- } catch (error) {
129
- if (!(error instanceof CatalogueRequired)) throw error;
130
- return [];
131
- }
132
- });
138
+ const themeAccents = createMemo(() => !source().loaded() && pairNeedsData(selection()) ? [] : engine().themeAccentsFor(selection().lightThemeId, selection().darkThemeId));
133
139
  const zoomFonts = (intent) => value.setSelection({ fonts: zoomedFontSettings(selection(), intent) });
134
140
  const onKeyDown = (event) => {
135
141
  if (event.defaultPrevented) return;
@@ -146,6 +152,7 @@ function createThemeContextValue(props) {
146
152
  const value = {
147
153
  selection,
148
154
  resolvedAppearance,
155
+ shownAppearance,
149
156
  variant,
150
157
  get themes() {
151
158
  return engine().builtinThemes;
@@ -157,28 +164,12 @@ function createThemeContextValue(props) {
157
164
  },
158
165
  previewing: () => draft() !== void 0,
159
166
  accentRolesFor(accent, variantId) {
160
- const current = engine();
161
- const state = {
167
+ return accentRolesForState(engine(), accent, variantId, {
162
168
  selection: selection(),
163
169
  variant: variant(),
164
170
  registry: registry(),
165
171
  accentContrastFloor: local.accentContrastFloor
166
- };
167
- try {
168
- return accentRolesForStateWith(current, accent, variantId, state);
169
- } catch (error) {
170
- if (!(error instanceof CatalogueRequired)) throw error;
171
- source().load();
172
- try {
173
- return accentRolesForStateWith({ accentRolesForSelection: (id, appearance, pair, options) => current.accentRolesForSelection(id, appearance, pair, {
174
- ...options,
175
- variantId: void 0
176
- }) }, accent, variantId, state);
177
- } catch (inner) {
178
- if (!(inner instanceof CatalogueRequired)) throw inner;
179
- return;
180
- }
181
- }
172
+ });
182
173
  },
183
174
  catalogueReady: () => source().loaded(),
184
175
  loadCatalogue: () => source().load(),
@@ -194,6 +185,6 @@ function createThemeContextValue(props) {
194
185
  };
195
186
  return value;
196
187
  }
197
- export { createThemeContextValue };
188
+ export { ThemeProviderWith, createThemeContextValue };
198
189
 
199
190
  //# sourceMappingURL=theme-provider-value.js.map
@@ -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 { createEffect, createMemo, createSignal, onCleanup, splitProps, untrack } from 'solid-js'\nimport { fontZoomShortcut, type FontZoomIntent } from '#lib/font-zoom'\nimport { REDUCED_TRANSPARENCY_QUERY, resolveSurfaceState } from '#lib/theme-surface'\nimport { CatalogueRequired, needsCatalogue, type ThemeEngine } from '#lib/theme-engine'\nimport type { EditorRolesMode, ThemeAppearance, ThemeVariant } from '#lib/themes'\nimport { applyThemeToRootWith, applyWithoutTransitions } from './theme-document-core'\nimport {\n localStoragePersistence,\n readPersisted,\n writePersisted,\n type ThemePersistence,\n} from './theme-persistence'\nimport {\n accentRolesForStateWith,\n initialThemeSelection,\n mergeRegistry,\n mergeThemeSelection,\n resolveTerminalVariant,\n resolveThemeState,\n zoomedFontSettings,\n type ThemeContextValue,\n type ThemeSelection,\n} from './theme-state-core'\n\n/**\n * ThemeProvider.\n *\n * Owns the appearance preference and applies it to the document. One provider near\n * the root; everything below reads it.\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 * This component 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`. Each is plain code a test can call,\n * which is the reason none of it is inlined here.\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}\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 * Everything the provider is, as a value: the context object, with its effects and\n * listeners created in the caller's reactive scope.\n *\n * Parameterised by where its catalogue comes from: `ThemeProvider`\n * (`theme-provider.tsx`) and the lazy `ThemeProvider` (`theme-provider-lazy.tsx`) wrap\n * this with a source. It imports no catalogue code or data, which is what lets the lazy\n * one keep them out of a consumer's start-up chunk. It is not JSX so that the unit lane,\n * which has no Solid compiler, can drive it directly.\n */\nexport function createThemeContextValue(\n props: ThemeProviderProps & { catalogue: ThemeCatalogueSource }\n): ThemeContextValue {\n const [local] = splitProps(props, [\n 'catalogue',\n 'storageKey',\n 'initial',\n 'selection',\n 'persistence',\n 'themes',\n 'transformTokens',\n 'disableTransitionOnChange',\n 'accentContrastFloor',\n 'surface',\n 'palette',\n 'editorRoles',\n 'fontZoom',\n ])\n const storageKey = () => local.storageKey ?? 'adea-appearance'\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\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 // The catalogue questions the selection asks. A selection that names a catalogue theme\n // beyond the shipped default pair cannot be answered, painted or previewed until the\n // whole catalogue has loaded; asking for it is the only side effect.\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 options = {\n transformTokens: local.transformTokens,\n accentContrastFloor: local.accentContrastFloor,\n palette: local.palette,\n editorRoles: local.editorRoles,\n }\n const apply = () => {\n try {\n written = applyThemeToRootWith(current, document.documentElement, state, options, written)\n } catch (error) {\n // The catalogue failed to load and the selection needs it: leave the document\n // as it is rather than half-painting it.\n if (!(error instanceof CatalogueRequired)) throw error\n }\n }\n if (local.disableTransitionOnChange) {\n restoreTransitions?.()\n restoreTransitions = applyWithoutTransitions(document, apply)\n } else {\n apply()\n }\n })\n onCleanup(() => restoreTransitions?.())\n\n const themeAccents = createMemo(() => {\n try {\n return engine().themeAccentsFor(selection().lightThemeId, selection().darkThemeId)\n } catch (error) {\n if (!(error instanceof CatalogueRequired)) throw error\n return []\n }\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 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 const current = engine()\n const state = {\n selection: selection(),\n variant: variant(),\n registry: registry(),\n accentContrastFloor: local.accentContrastFloor,\n }\n try {\n return accentRolesForStateWith(current, accent, variantId, state)\n } catch (error) {\n if (!(error instanceof CatalogueRequired)) throw error\n // Needs the whole catalogue to measure the tint exactly. Ask for it, and answer\n // meanwhile without the theme's record: the same four colours, the appearance's\n // own tint strength. Reading `engine()` above re-runs a reactive caller on arrival.\n void source().load()\n try {\n return accentRolesForStateWith(\n {\n accentRolesForSelection: (id, appearance, pair, options) =>\n current.accentRolesForSelection(id, appearance, pair, {\n ...options,\n variantId: undefined,\n }),\n },\n accent,\n variantId,\n state\n )\n } catch (inner) {\n if (!(inner instanceof CatalogueRequired)) throw inner\n return undefined\n }\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 // The committed selection is now what should be showing.\n setDraft(undefined)\n writePersisted(persistence, next)\n },\n }\n\n return value\n}\n"],"mappings":";;;;;;;;;AAsLA,SAAS,2BAAuD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wB,iBAAiB,CAAC,EAAE,WAAW;EACvD,gCAAgC,iBAAiB,CAAC,EAAE,4BAA4B;EAChF;EACA,aAAa,OAAO;GAClB,MAAM,OAAO,oBAAoB,UAAU,GAAG,KAAK;GACnD,kBAAkB,IAAI;GAEtB,SAAS,KAAA,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 */\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,OAAO,OAAO,eAAe,aACjE,OAAO,WAAW,0BAA0B,IAC5C,KAAA;AACN;;;;;;;AAQA,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,MAAM,cAAc,iBAClB,OAAO,MAAM,WAAW,aAAa,MAAM,OAAO,IAAK,MAAM,UAAU,CAAC,CAC1E;CACA,MAAM,eAAe,MAAM;CAC3B,MAAM,eAAe,OAAO,CAAC,CAAC,OAAO;CACrC,MAAM,WAAW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C,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,OAAO,oBAAoB,UAAU,GAAG,KAAK;GACnD,kBAAkB,IAAI;GACtB,SAAS,KAAA,CAAS;GAClB,eAAe,aAAa,IAAI;EAClC;CACF;CAEA,OAAO;AACT"}
@@ -1,17 +1,11 @@
1
- import { type ThemeProviderProps } from './theme-provider-core';
2
- export { useOptionalTheme, useTheme } from './theme-context';
3
- export { createVersionedPersistence, localStoragePersistence, type ThemePersistence, type ThemeStorageSchema, type VersionedCodec, type VersionedPersistenceOptions, } from './theme-persistence';
4
- export type { ThemeSurface } from '#lib/theme-surface';
5
- export type { EditorRolesMode } from '#lib/themes';
6
- export type { ThemeProviderProps } from './theme-provider-core';
7
- export { inlineScriptLiteral, themeScript, type ThemeScriptOptions } from './theme-script';
8
- export { defaultThemeSelection, resolvedDensity, type ThemeContextValue, type ThemeDensity, type ThemeSelection, } from './theme-state-core';
1
+ import { type ThemeProviderProps } from './theme-provider-value';
2
+ export * from './theme-api';
9
3
  /**
10
4
  * ThemeProvider.
11
5
  *
12
6
  * Owns the appearance preference and applies it to the document. One provider near
13
7
  * the root; everything below reads it. See {@link ThemeProviderProps} for the
14
- * options, and `ThemeProviderCore` for how a selection is resolved and applied.
8
+ * options.
15
9
  *
16
10
  * This provider imports the whole theme catalogue (about 129 KB raw, 34 KB gzipped)
17
11
  * so that `useTheme().themes` is a complete array on the first render. A host that
@@ -1 +1 @@
1
- {"version":3,"file":"theme-provider.d.ts","sourceRoot":"","sources":["../../../src/components/theme/theme-provider.tsx"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,kBAAkB,EACxB,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAC5D,OAAO,EACL,0BAA0B,EAC1B,uBAAuB,EACvB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,2BAA2B,GACjC,MAAM,qBAAqB,CAAA;AAC5B,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACtD,YAAY,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAClD,YAAY,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAC/D,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,KAAK,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAC1F,OAAO,EACL,qBAAqB,EACrB,eAAe,EACf,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,cAAc,GACpB,MAAM,oBAAoB,CAAA;AAU3B;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,kCAEtD"}
1
+ {"version":3,"file":"theme-provider.d.ts","sourceRoot":"","sources":["../../../src/components/theme/theme-provider.tsx"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,kBAAkB,EACxB,MAAM,wBAAwB,CAAA;AAE/B,cAAc,aAAa,CAAA;AAU3B;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,kCAEtD"}
@@ -1,9 +1,10 @@
1
- import { catalogueThemeEngine } from "../../lib/theme-catalogue.js";
1
+ import { safeScriptStringLiteral } from "../../lib/safe-script.js";
2
2
  import { useOptionalTheme, useTheme } from "./theme-context.js";
3
- import { defaultThemeSelection, resolvedDensity } from "./theme-state-core.js";
3
+ import { catalogueThemeEngine } from "../../lib/theme-catalogue.js";
4
+ import { defaultThemeSelection, resolvedDensity } from "./theme-state.js";
4
5
  import { createVersionedPersistence, localStoragePersistence } from "./theme-persistence.js";
5
- import { inlineScriptLiteral, themeScript } from "./theme-script.js";
6
- import { ThemeProviderCore } from "./theme-provider-core.js";
6
+ import { ThemeProviderWith } from "./theme-provider-value.js";
7
+ import { themeScript } from "./theme-script.js";
7
8
  import { createComponent, mergeProps } from "solid-js/web";
8
9
  // src/components/theme/theme-provider.tsx
9
10
  /** The whole catalogue, already imported: nothing to load, nothing to wait for. */
@@ -18,7 +19,7 @@ var eagerCatalogue = {
18
19
  *
19
20
  * Owns the appearance preference and applies it to the document. One provider near
20
21
  * the root; everything below reads it. See {@link ThemeProviderProps} for the
21
- * options, and `ThemeProviderCore` for how a selection is resolved and applied.
22
+ * options.
22
23
  *
23
24
  * This provider imports the whole theme catalogue (about 129 KB raw, 34 KB gzipped)
24
25
  * so that `useTheme().themes` is a complete array on the first render. A host that
@@ -27,8 +28,8 @@ var eagerCatalogue = {
27
28
  * from `@adea-ai/ui/components/theme/lazy` instead; the props are the same.
28
29
  */
29
30
  function ThemeProvider(props) {
30
- return createComponent(ThemeProviderCore, mergeProps(props, { catalogue: eagerCatalogue }));
31
+ return createComponent(ThemeProviderWith, mergeProps(props, { catalogue: eagerCatalogue }));
31
32
  }
32
- export { ThemeProvider, createVersionedPersistence, defaultThemeSelection, inlineScriptLiteral, localStoragePersistence, resolvedDensity, themeScript, useOptionalTheme, useTheme };
33
+ export { ThemeProvider, createVersionedPersistence, defaultThemeSelection, safeScriptStringLiteral as inlineScriptLiteral, localStoragePersistence, resolvedDensity, themeScript, useOptionalTheme, useTheme };
33
34
 
34
35
  //# sourceMappingURL=theme-provider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"theme-provider.js","names":["catalogueThemeEngine","ThemeProviderCore","ThemeCatalogueSource","ThemeProviderProps","useOptionalTheme","useTheme","createVersionedPersistence","localStoragePersistence","ThemePersistence","ThemeStorageSchema","VersionedCodec","VersionedPersistenceOptions","ThemeSurface","EditorRolesMode","inlineScriptLiteral","themeScript","ThemeScriptOptions","defaultThemeSelection","resolvedDensity","ThemeContextValue","ThemeDensity","ThemeSelection","eagerCatalogue","engine","loaded","failed","load","Promise","resolve","ThemeProvider","props","_$createComponent","_$mergeProps","catalogue","_$createComponent","_$mergeProps"],"sources":["../../../src/components/theme/theme-provider.tsx"],"sourcesContent":["import { catalogueThemeEngine } from '#lib/theme-catalogue'\nimport {\n ThemeProviderCore,\n type ThemeCatalogueSource,\n type ThemeProviderProps,\n} from './theme-provider-core'\n\nexport { useOptionalTheme, useTheme } from './theme-context'\nexport {\n createVersionedPersistence,\n localStoragePersistence,\n type ThemePersistence,\n type ThemeStorageSchema,\n type VersionedCodec,\n type VersionedPersistenceOptions,\n} from './theme-persistence'\nexport type { ThemeSurface } from '#lib/theme-surface'\nexport type { EditorRolesMode } from '#lib/themes'\nexport type { ThemeProviderProps } from './theme-provider-core'\nexport { inlineScriptLiteral, themeScript, type ThemeScriptOptions } from './theme-script'\nexport {\n defaultThemeSelection,\n resolvedDensity,\n type ThemeContextValue,\n type ThemeDensity,\n type ThemeSelection,\n} from './theme-state-core'\n\n/** The whole catalogue, already imported: nothing to load, nothing to wait for. */\nconst eagerCatalogue: ThemeCatalogueSource = {\n engine: () => catalogueThemeEngine,\n loaded: () => true,\n failed: () => false,\n load: () => Promise.resolve(),\n}\n\n/**\n * ThemeProvider.\n *\n * Owns the appearance preference and applies it to the document. One provider near\n * the root; everything below reads it. See {@link ThemeProviderProps} for the\n * options, and `ThemeProviderCore` for how a selection is resolved and applied.\n *\n * This provider imports the whole theme catalogue (about 129 KB raw, 34 KB gzipped)\n * so that `useTheme().themes` is a complete array on the first render. A host that\n * paints its theme from a stylesheet (`palette=\"stylesheet\"`), keeps the default\n * pair, and wants the catalogue out of its start-up chunk imports the lazy provider\n * from `@adea-ai/ui/components/theme/lazy` instead; the props are the same.\n */\nexport function ThemeProvider(props: ThemeProviderProps) {\n return <ThemeProviderCore {...props} catalogue={eagerCatalogue} />\n}\n"],"mappings":";;;;;;;;;AA6BA,IAAMsB,iBAAuC;CAC3CC,cAAcvB;CACdwB,cAAc;CACdC,cAAc;CACdC,YAAYC,QAAQC,QAAQ;AAC9B;;;;;;;;;;;;;;AAeA,SAAgBC,cAAcC,OAA2B;CACvD,OAAAC,gBAAQ9B,mBAAiB+B,WAAKF,OAAK,EAAEG,WAAWX,eAAc,CAAA,CAAA;AAChE"}
1
+ {"version":3,"file":"theme-provider.js","names":["catalogueThemeEngine","ThemeProviderWith","ThemeCatalogueSource","ThemeProviderProps","eagerCatalogue","engine","loaded","failed","load","Promise","resolve","ThemeProvider","props","_$createComponent","_$mergeProps","catalogue","_$createComponent","_$mergeProps"],"sources":["../../../src/components/theme/theme-provider.tsx"],"sourcesContent":["import { catalogueThemeEngine } from '#lib/theme-catalogue'\nimport {\n ThemeProviderWith,\n type ThemeCatalogueSource,\n type ThemeProviderProps,\n} from './theme-provider-value'\n\nexport * from './theme-api'\n\n/** The whole catalogue, already imported: nothing to load, nothing to wait for. */\nconst eagerCatalogue: ThemeCatalogueSource = {\n engine: () => catalogueThemeEngine,\n loaded: () => true,\n failed: () => false,\n load: () => Promise.resolve(),\n}\n\n/**\n * ThemeProvider.\n *\n * Owns the appearance preference and applies it to the document. One provider near\n * the root; everything below reads it. See {@link ThemeProviderProps} for the\n * options.\n *\n * This provider imports the whole theme catalogue (about 129 KB raw, 34 KB gzipped)\n * so that `useTheme().themes` is a complete array on the first render. A host that\n * paints its theme from a stylesheet (`palette=\"stylesheet\"`), keeps the default\n * pair, and wants the catalogue out of its start-up chunk imports the lazy provider\n * from `@adea-ai/ui/components/theme/lazy` instead; the props are the same.\n */\nexport function ThemeProvider(props: ThemeProviderProps) {\n return <ThemeProviderWith {...props} catalogue={eagerCatalogue} />\n}\n"],"mappings":";;;;;;;;;;AAUA,IAAMI,iBAAuC;CAC3CC,cAAcL;CACdM,cAAc;CACdC,cAAc;CACdC,YAAYC,QAAQC,QAAQ;AAC9B;;;;;;;;;;;;;;AAeA,SAAgBC,cAAcC,OAA2B;CACvD,OAAAC,gBAAQZ,mBAAiBa,WAAKF,OAAK,EAAEG,WAAWX,eAAc,CAAA,CAAA;AAChE"}
@@ -1,23 +1,13 @@
1
+ import type { ThemeTokenProjection } from '@adea-ai/themes/theme-token-projection';
1
2
  import type { ThemeStorageSchema } from './theme-persistence';
2
- /**
3
- * A string as a JavaScript literal that is also safe inside an inline `<script>`.
4
- *
5
- * `JSON.stringify` produces a correct JavaScript literal, and it is **not** safe
6
- * here: it leaves `<` and `>` alone, so a value containing `</script>` ends the tag
7
- * early and everything after it is parsed as HTML. That is the classic inline-script
8
- * injection, and it is a real one even though the value is a developer-supplied prop
9
- * rather than user input — a prop can come from configuration, and a key that happens
10
- * to contain a closing tag should not be able to execute.
11
- *
12
- * The escape is also correct JavaScript: `\u003c` is `<` to the parser, so the value
13
- * is byte-identical at runtime and inert to the HTML tokenizer. `\u2028` and `\u2029`
14
- * are escaped for the neighbouring reason — they are legal inside a JSON string and
15
- * were, before ES2019, line terminators to a JavaScript parser.
16
- *
17
- * CodeQL flags the unescaped form as `js/bad-code-sanitization`, which is how this
18
- * was found; `tests/theme-script.test.ts` pins it so it cannot come back.
19
- */
20
- export declare function inlineScriptLiteral(value: string): string;
3
+ export { safeScriptStringLiteral as inlineScriptLiteral } from '#lib/safe-script';
4
+ /** A stored-record path that can supply an absent projection source token. */
5
+ export type ThemeTokenProjectionFallback = Readonly<{
6
+ /** The CSS custom property to fill only when the stored token map omits it. */
7
+ token: string;
8
+ /** Own-property path from the stored library record to a string value. */
9
+ path: readonly string[];
10
+ }>;
21
11
  /**
22
12
  * Options for the host-shaped no-flash script: the document's {@link ThemeStorageSchema}
23
13
  * plus what the script paints from it.
@@ -40,10 +30,10 @@ export type ThemeScriptOptions = ThemeStorageSchema & {
40
30
  */
41
31
  surface?: boolean;
42
32
  /**
43
- * Match the provider's `palette` prop. The attributes written are the same either
44
- * way: a catalogue variant's palette is the host stylesheet's job (`stylesheet`) or
45
- * the provider's, at mount (`inline`), and a stored theme's own tokens are written
46
- * inline in both.
33
+ * Accepted so a host can pass the provider's `palette` prop through; the script is
34
+ * the same either way. A catalogue variant's palette is the host stylesheet's job
35
+ * (`stylesheet`) or the provider's, at mount (`inline`), and a stored theme's own
36
+ * tokens are written inline in both.
47
37
  */
48
38
  palette?: 'inline' | 'stylesheet';
49
39
  /** The only `version` of the library document read. Default `1`. */
@@ -92,9 +82,18 @@ export type ThemeScriptOptions = ThemeStorageSchema & {
92
82
  * The script reads values out of `localStorage` and writes them to `dataset` and
93
83
  * `style`, which are *property* assignments rather than code: a stored id, accent or
94
84
  * token can set an attribute and cannot execute. The values that reach the source as
95
- * text (keys, ids, the default accent) go through {@link inlineScriptLiteral} for the
96
- * reason documented there.
85
+ * text (keys, ids, the default accent) go through `inlineScriptLiteral`
86
+ * (`safeScriptStringLiteral`) for the reason documented there.
87
+ *
88
+ * The script cannot import the policy it applies, so it carries the policy's tables
89
+ * instead: the catalogue ids, the default pair, the preset ids, the custom-accent
90
+ * grammar, the theme-accent prefix and the surface outcomes, all read from the modules
91
+ * the provider uses.
97
92
  */
98
93
  export declare function themeScript(storageKey?: string): string;
99
94
  export declare function themeScript(options: ThemeScriptOptions): string;
95
+ /** Internal hook for the opt-in script entry, which supplies its generated browser bundle. */
96
+ export declare function themeScriptWithProjection(options: ThemeScriptOptions & {
97
+ tokenProjectionFallbacks?: readonly ThemeTokenProjectionFallback[];
98
+ }, tokenProjection: ThemeTokenProjection, projectionBundle: string, projectionFallbackScript: string): string;
100
99
  //# sourceMappingURL=theme-script.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"theme-script.d.ts","sourceRoot":"","sources":["../../../src/components/theme/theme-script.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAE7D;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,wBAAgB,WAAW,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;AACxD,wBAAgB,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,MAAM,CAAA"}
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,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"}
@@ -1,57 +1,63 @@
1
- import { fontSettingsBootstrapScript } from "../../lib/appearance-font-settings.js";
2
- import { isCustomAccent } from "../../lib/accent-roles.js";
3
1
  import { THEME_INDEX } from "../../lib/theme-defaults.generated.js";
2
+ import { fontSettingsBootstrapScript } from "../../lib/appearance-font-settings.js";
3
+ import { CUSTOM_ACCENT_PATTERN, isCustomAccent } from "../../lib/accent-roles.js";
4
+ import { accents } from "../../lib/accent-presets.js";
4
5
  import { safeScriptStringLiteral } from "../../lib/safe-script.js";
5
- import { REDUCED_TRANSPARENCY_QUERY, surfaceAlpha } from "../../lib/theme-surface.js";
6
- import { accentPresets } from "../../lib/accent-presets.js";
7
- import { defaultDarkThemeId, defaultLightThemeId } from "../../lib/theme-defaults.js";
6
+ import { THEME_ACCENT_PREFIX } from "../../lib/theme-accents.js";
7
+ import { DEFAULT_THEME_STORAGE_KEY, defaultThemeIdFor } from "../../lib/theme-defaults.js";
8
+ import { REDUCED_TRANSPARENCY_QUERY, resolveSurface, surfaceAlpha, themeSurfaces } from "../../lib/theme-surface.js";
8
9
  // src/components/theme/theme-script.ts
9
- /**
10
- * A string as a JavaScript literal that is also safe inside an inline `<script>`.
11
- *
12
- * `JSON.stringify` produces a correct JavaScript literal, and it is **not** safe
13
- * here: it leaves `<` and `>` alone, so a value containing `<\/script>` ends the tag
14
- * early and everything after it is parsed as HTML. That is the classic inline-script
15
- * injection, and it is a real one even though the value is a developer-supplied prop
16
- * rather than user input — a prop can come from configuration, and a key that happens
17
- * to contain a closing tag should not be able to execute.
18
- *
19
- * The escape is also correct JavaScript: `\u003c` is `<` to the parser, so the value
20
- * is byte-identical at runtime and inert to the HTML tokenizer. `\u2028` and `\u2029`
21
- * are escaped for the neighbouring reason — they are legal inside a JSON string and
22
- * were, before ES2019, line terminators to a JavaScript parser.
23
- *
24
- * CodeQL flags the unescaped form as `js/bad-code-sanitization`, which is how this
25
- * was found; `tests/theme-script.test.ts` pins it so it cannot come back.
26
- */
27
- function inlineScriptLiteral(value) {
28
- return safeScriptStringLiteral(value);
29
- }
30
- function themeScript(input = "adea-appearance") {
10
+ function themeScript(input = DEFAULT_THEME_STORAGE_KEY) {
31
11
  if (typeof input === "string") return stringFormScript(input);
32
12
  return optionsFormScript(input);
33
13
  }
14
+ /** Internal hook for the opt-in script entry, which supplies its generated browser bundle. */
15
+ function themeScriptWithProjection(options, tokenProjection, projectionBundle, projectionFallbackScript) {
16
+ return optionsFormScript(options, tokenProjection, projectionBundle, projectionFallbackScript, options.tokenProjectionFallbacks);
17
+ }
34
18
  function stringFormScript(storageKey) {
35
- return `${`(function(){try{var s=localStorage.getItem(${inlineScriptLiteral(storageKey)});var p=s?JSON.parse(s):{};var a=p.appearance||'system';var d=a==='dark'||(a==='system'&&window.matchMedia('(prefers-color-scheme: dark)').matches);var r=document.documentElement;if(d)r.classList.add('dark');r.style.colorScheme=d?'dark':'light';if(p.accent&&p.accent!=='theme')r.dataset.accent=p.accent;if(p.density==='compact')r.dataset.density='compact';}catch(e){}})();`}${fontSettingsBootstrapScript(storageKey)}`;
19
+ return `${`(function(){try{var s=localStorage.getItem(${safeScriptStringLiteral(storageKey)});var p=s?JSON.parse(s):{};var a=p.appearance||'system';var d=a==='dark'||(a==='system'&&window.matchMedia('(prefers-color-scheme: dark)').matches);var r=document.documentElement;if(d)r.classList.add('dark');r.style.colorScheme=d?'dark':'light';if(p.accent&&p.accent!=='theme')r.dataset.accent=p.accent;if(p.density==='compact')r.dataset.density='compact';}catch(e){}})();`}${fontSettingsBootstrapScript(storageKey)}`;
20
+ }
21
+ /** What the surface axis paints before the provider knows the host's capability. */
22
+ function bootSurfaces() {
23
+ const environment = {
24
+ osReducedTransparency: false,
25
+ userReducedTransparency: false,
26
+ nativeTranslucency: false
27
+ };
28
+ return {
29
+ preferred: Object.fromEntries(themeSurfaces.map((surface) => [surface, resolveSurface(surface, environment)])),
30
+ reduced: resolveSurface("opaque", {
31
+ ...environment,
32
+ osReducedTransparency: true
33
+ })
34
+ };
36
35
  }
37
- var literal = safeScriptStringLiteral;
38
- function optionsFormScript(options) {
36
+ function optionsFormScript(options, projection, projectionBundle, projectionFallbackScript = "", projectionFallbacks) {
39
37
  const field = options.appearanceField ?? "appearance";
40
38
  const versionGuard = options.version === void 0 ? "" : `&&x.version===${Number(options.version)}`;
41
- const presets = accentPresets.filter((preset) => preset.id !== "theme").map((preset) => literal(preset.id));
39
+ const presets = accents.map((preset) => safeScriptStringLiteral(preset.id));
42
40
  const defaultAccent = options.defaultAccent === void 0 ? "" : isCustomAccent(options.defaultAccent) ? "custom" : options.defaultAccent;
41
+ const canProjectTokens = options.libraryKey !== void 0 && projection && projection.length > 0 && projectionBundle !== void 0;
42
+ const hasProjectionFallbacks = canProjectTokens && !!projectionFallbacks?.length;
43
+ const tokenProjection = canProjectTokens ? `var projectTokens=${projectionBundle};var tokenProjection=JSON.parse(${safeScriptStringLiteral(JSON.stringify(projection))});${hasProjectionFallbacks ? `var tokenProjectionFallbacks=JSON.parse(${safeScriptStringLiteral(JSON.stringify(projectionFallbacks))});` : ""}` : "";
44
+ const projectionFallbackCode = hasProjectionFallbacks ? projectionFallbackScript : "";
43
45
  const parts = [];
44
- parts.push(`(function(){try{`, `var r=document.documentElement,s=r.style;`, `var q=function(m){try{return window.matchMedia(m).matches}catch(e){return false}};`, `var get=function(k){try{return localStorage.getItem(k)}catch(e){return null}};`, `var raw=get(${literal(options.key)}),doc=null,legacy=null;`, `if(raw!==null){try{var x=JSON.parse(raw);if(x&&typeof x==='object'&&!Array.isArray(x)${versionGuard})doc=x}catch(e){}}`);
45
- if (options.legacyAppearanceKey !== void 0) parts.push(`else legacy=get(${literal(options.legacyAppearanceKey)});`);
46
- parts.push(`var m=doc?doc[${literal(field)}]:legacy;`, `var mode=m==='light'||m==='dark'?m:'system';`, `var dark=mode==='dark'||(mode==='system'&&q('(prefers-color-scheme: dark)'));`, `var fallback=dark?${literal(defaultDarkThemeId)}:${literal(defaultLightThemeId)};`, `var want=doc?(dark?doc.darkThemeId:doc.lightThemeId):null;`, `if(typeof want!=='string')want=fallback;`, `var ids=[${THEME_INDEX.map(([id]) => literal(id)).join(",")}];`, `var id=ids.indexOf(want)!==-1?want:null,tokens=null;`);
47
- if (options.libraryKey !== void 0) parts.push(`if(id===null){try{var lib=JSON.parse(get(${literal(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;break}}}}catch(e){}}`);
46
+ parts.push(`(function(){try{`, `var r=document.documentElement,s=r.style;`, `var q=function(m){try{return window.matchMedia(m).matches}catch(e){return false}};`, `var get=function(k){try{return localStorage.getItem(k)}catch(e){return null}};`, `var raw=get(${safeScriptStringLiteral(options.key)}),doc=null,legacy=null;`, `if(raw!==null){try{var x=JSON.parse(raw);if(x&&typeof x==='object'&&!Array.isArray(x)${versionGuard})doc=x}catch(e){}}`);
47
+ if (options.legacyAppearanceKey !== void 0) parts.push(`else legacy=get(${safeScriptStringLiteral(options.legacyAppearanceKey)});`);
48
+ parts.push(`var m=doc?doc[${safeScriptStringLiteral(field)}]:legacy;`, `var mode=m==='light'||m==='dark'?m:'system';`, `var dark=mode==='dark'||(mode==='system'&&q('(prefers-color-scheme: dark)'));`, `var fallback=dark?${safeScriptStringLiteral(defaultThemeIdFor("dark"))}:${safeScriptStringLiteral(defaultThemeIdFor("light"))};`, `var want=doc?(dark?doc.darkThemeId:doc.lightThemeId):null;`, `if(typeof want!=='string')want=fallback;`, `var ids=[${THEME_INDEX.map(([id]) => safeScriptStringLiteral(id)).join(",")}];`, `var id=ids.indexOf(want)!==-1?want:null,tokens=null${hasProjectionFallbacks ? ",storedTheme=null" : ""};`);
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
+ if (options.libraryKey !== void 0 && tokenProjection) parts.push(tokenProjection);
48
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';`);
49
- if (options.libraryKey !== void 0) parts.push(`if(tokens){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])}}`);
50
- parts.push(`var a=doc&&typeof doc.accent==='string'?doc.accent:'';`, `var accent=[${presets.join(",")}].indexOf(a)!==-1?a:/^#[0-9a-fA-F]{6}$/.test(a)?'custom':a.slice(0,5)==='ansi-'?'':${literal(defaultAccent)};`, `if(accent)r.dataset.accent=accent;`, `if(doc&&doc.density==='compact')r.dataset.density='compact';`);
51
- if (options.surface) parts.push(`var reduce=q(${literal(REDUCED_TRANSPARENCY_QUERY)})||!!(doc&&doc.reduceTransparency===true);`, `var surface=reduce?'opaque':doc&&(doc.surface==='frosted'||doc.surface==='translucent')?'frosted':'opaque';`, `r.dataset.surface=surface;`, `r.dataset.reduceTransparency=reduce?'true':'false';`, `s.setProperty('--surface-alpha',${JSON.stringify(surfaceAlpha)}[surface]);`);
52
+ 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
+ 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
+ if (options.surface) {
55
+ const surfaces = bootSurfaces();
56
+ parts.push(`var reduce=q(${safeScriptStringLiteral(REDUCED_TRANSPARENCY_QUERY)})||!!(doc&&doc.reduceTransparency===true);`, `var surfaces=${JSON.stringify(surfaces.preferred)};`, `var surface=reduce?${safeScriptStringLiteral(surfaces.reduced)}:doc&&typeof doc.surface==='string'&&Object.prototype.hasOwnProperty.call(surfaces,doc.surface)?surfaces[doc.surface]:surfaces.opaque;`, `r.dataset.surface=surface;`, `r.dataset.reduceTransparency=reduce?'true':'false';`, `s.setProperty('--surface-alpha',${JSON.stringify(surfaceAlpha)}[surface]);`);
57
+ }
52
58
  parts.push(`}catch(e){}})();`);
53
59
  return `${parts.join("")}${fontSettingsBootstrapScript(options.key, options.version)}`;
54
60
  }
55
- export { inlineScriptLiteral, themeScript };
61
+ export { safeScriptStringLiteral as inlineScriptLiteral, themeScript, themeScriptWithProjection };
56
62
 
57
63
  //# sourceMappingURL=theme-script.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"theme-script.js","names":[],"sources":["../../../src/components/theme/theme-script.ts"],"sourcesContent":["/*\n * Copyright (c) 2026 Wing\n * Licensed under the MIT License.\n *\n * The options form is rewritten from Adea's accepted port of Zeron's preference\n * store (`appearanceThemeScript` in `packages/ui/src/components/appearance.ts`,\n * https://github.com/zeronsh/zeron) so the boot script reads the document the shared\n * persistence writes. See NOTICE.\n */\nimport { fontSettingsBootstrapScript } from '#lib/appearance-font-settings'\nimport { isCustomAccent } from '#lib/accent-roles'\nimport { safeScriptStringLiteral } from '#lib/safe-script'\nimport { REDUCED_TRANSPARENCY_QUERY, surfaceAlpha } from '#lib/theme-surface'\nimport { accentPresets } from '#lib/accent-presets'\nimport { THEME_INDEX, defaultDarkThemeId, defaultLightThemeId } from '#lib/theme-defaults'\nimport type { ThemeStorageSchema } from './theme-persistence'\n\n/**\n * A string as a JavaScript literal that is also safe inside an inline `<script>`.\n *\n * `JSON.stringify` produces a correct JavaScript literal, and it is **not** safe\n * here: it leaves `<` and `>` alone, so a value containing `</script>` ends the tag\n * early and everything after it is parsed as HTML. That is the classic inline-script\n * injection, and it is a real one even though the value is a developer-supplied prop\n * rather than user input — a prop can come from configuration, and a key that happens\n * to contain a closing tag should not be able to execute.\n *\n * The escape is also correct JavaScript: `\\u003c` is `<` to the parser, so the value\n * is byte-identical at runtime and inert to the HTML tokenizer. `\\u2028` and `\\u2029`\n * are escaped for the neighbouring reason — they are legal inside a JSON string and\n * were, before ES2019, line terminators to a JavaScript parser.\n *\n * CodeQL flags the unescaped form as `js/bad-code-sanitization`, which is how this\n * was found; `tests/theme-script.test.ts` pins it so it cannot come back.\n */\nexport function inlineScriptLiteral(value: string): string {\n return safeScriptStringLiteral(value)\n}\n\n/**\n * Options for the host-shaped no-flash script: the document's {@link ThemeStorageSchema}\n * plus what the script paints from it.\n */\nexport type ThemeScriptOptions = ThemeStorageSchema & {\n /**\n * The accent painted when the document has none, an unrecognised one, or the\n * legacy `theme` spelling — the host's default (adea: `violet`). Without it those\n * cases paint no `data-accent`, which is what the provider writes for `theme`.\n * Setting it means the `[data-accent]` block of the default preset paints on the\n * first frame instead of after hydration.\n */\n defaultAccent?: string\n /**\n * Also resolve the surface axis (`data-surface`, `data-reduce-transparency`,\n * `--surface-alpha`) from the document and the operating system's Reduce\n * Transparency setting. A `translucent` preference resolves to `frosted`: the\n * host's translucency capability is not known until the provider mounts, and the\n * provider re-resolves it then. Match the provider's `surface` prop.\n */\n surface?: boolean\n /**\n * Match the provider's `palette` prop. The attributes written are the same either\n * way: a catalogue variant's palette is the host stylesheet's job (`stylesheet`) or\n * the provider's, at mount (`inline`), and a stored theme's own tokens are written\n * inline in both.\n */\n palette?: 'inline' | 'stylesheet'\n /** The only `version` of the library document read. Default `1`. */\n libraryVersion?: number\n}\n\n/**\n * The no-flash script.\n *\n * Rendered inline in `<head>` before any stylesheet that matters. Without it a dark\n * preference paints the light theme first and then swaps, which is the flash every\n * themed application has to solve and the one thing a provider cannot do from\n * inside the body.\n *\n * ## The string form\n *\n * `themeScript('key')` serves a provider that stores an unversioned\n * `localStorage[key]` document. Deliberately tiny and dependency-free: it reads the\n * stored preference, resolves `system`, and sets the class. It does not apply the\n * variant's roles — the default theme in `theme.css` covers the first paint, and the\n * provider writes the rest on mount. Its output is a compatibility surface (a\n * consumer may have it in a snapshot), so it does not change.\n *\n * ## The options form\n *\n * `themeScript({ key, ... })` serves a host with a versioned document (see\n * `createVersionedPersistence`) and writes what the provider will write, so mounting\n * repaints nothing:\n *\n * - `class=\"dark\"`, `color-scheme`, `data-theme`, `data-appearance` and, for a\n * compact document, `data-density`;\n * - `data-accent`: a preset id as stored, `custom` for a `#rrggbb` (never the hex\n * itself, which is the worst possible attribute content), `defaultAccent` when the\n * document has none, nothing for a theme-derived `ansi-*` accent (it has no\n * stylesheet block; the provider paints it inline);\n * - the theme: the stored id when the catalogue or the stored library holds it, else\n * the default of the resolved appearance, exactly as the provider resolves it. A\n * library theme's own tokens are written inline, so an imported theme paints on the\n * first frame;\n * - the surface axis, when `surface` is set;\n * - the font settings, guarded to the document's `version`.\n *\n * The document's `version`, when the schema names one, must match exactly. The legacy\n * key is read only while the main key is absent: an unreadable main document is not\n * \"no preference\", so it does not resurrect an older value.\n *\n * The script reads values out of `localStorage` and writes them to `dataset` and\n * `style`, which are *property* assignments rather than code: a stored id, accent or\n * token can set an attribute and cannot execute. The values that reach the source as\n * text (keys, ids, the default accent) go through {@link inlineScriptLiteral} for the\n * reason documented there.\n */\nexport function themeScript(storageKey?: string): string\nexport function themeScript(options: ThemeScriptOptions): string\nexport function themeScript(input: string | ThemeScriptOptions = 'adea-appearance'): string {\n if (typeof input === 'string') return stringFormScript(input)\n return optionsFormScript(input)\n}\n\nfunction stringFormScript(storageKey: string): string {\n const script = `(function(){try{var s=localStorage.getItem(${inlineScriptLiteral(storageKey)});var p=s?JSON.parse(s):{};var a=p.appearance||'system';var d=a==='dark'||(a==='system'&&window.matchMedia('(prefers-color-scheme: dark)').matches);var r=document.documentElement;if(d)r.classList.add('dark');r.style.colorScheme=d?'dark':'light';if(p.accent&&p.accent!=='theme')r.dataset.accent=p.accent;if(p.density==='compact')r.dataset.density='compact';}catch(e){}})();`\n return `${script}${fontSettingsBootstrapScript(storageKey)}`\n}\n\nconst literal = safeScriptStringLiteral\n\nfunction optionsFormScript(options: ThemeScriptOptions): string {\n const field = options.appearanceField ?? 'appearance'\n const versionGuard =\n options.version === undefined ? '' : `&&x.version===${Number(options.version)}`\n const presets = accentPresets\n .filter((preset) => preset.id !== 'theme')\n .map((preset) => literal(preset.id))\n const defaultAccent =\n options.defaultAccent === undefined\n ? ''\n : isCustomAccent(options.defaultAccent)\n ? 'custom'\n : options.defaultAccent\n\n const parts: string[] = []\n parts.push(\n `(function(){try{`,\n `var r=document.documentElement,s=r.style;`,\n `var q=function(m){try{return window.matchMedia(m).matches}catch(e){return false}};`,\n `var get=function(k){try{return localStorage.getItem(k)}catch(e){return null}};`,\n // The main document. `raw !== null` rather than truthiness: an empty string is a\n // stored (corrupt) value, so it does not fall through to the legacy key.\n `var raw=get(${literal(options.key)}),doc=null,legacy=null;`,\n `if(raw!==null){try{var x=JSON.parse(raw);if(x&&typeof x==='object'&&!Array.isArray(x)${versionGuard})doc=x}catch(e){}}`\n )\n if (options.legacyAppearanceKey !== undefined) {\n parts.push(`else legacy=get(${literal(options.legacyAppearanceKey)});`)\n }\n parts.push(\n `var m=doc?doc[${literal(field)}]:legacy;`,\n `var mode=m==='light'||m==='dark'?m:'system';`,\n `var dark=mode==='dark'||(mode==='system'&&q('(prefers-color-scheme: dark)'));`,\n `var fallback=dark?${literal(defaultDarkThemeId)}:${literal(defaultLightThemeId)};`,\n `var want=doc?(dark?doc.darkThemeId:doc.lightThemeId):null;`,\n `if(typeof want!=='string')want=fallback;`,\n `var ids=[${THEME_INDEX.map(([id]) => literal(id)).join(',')}];`,\n `var id=ids.indexOf(want)!==-1?want:null,tokens=null;`\n )\n if (options.libraryKey !== undefined) {\n parts.push(\n `if(id===null){try{var lib=JSON.parse(get(${literal(options.libraryKey)})||'null');`,\n `if(lib&&typeof lib==='object'&&lib.version===${Number(options.libraryVersion ?? 1)}&&Array.isArray(lib.themes)){`,\n `for(var i=0;i!==lib.themes.length;i++){var t=lib.themes[i];`,\n `if(t&&t.id===want&&t.flatTokens&&typeof t.flatTokens==='object'){id=want;tokens=t.flatTokens;break}}}}catch(e){}}`\n )\n }\n parts.push(\n `if(id===null)id=fallback;`,\n `r.classList.toggle('dark',dark);`,\n `s.colorScheme=dark?'dark':'light';`,\n `r.dataset.theme=id;`,\n `r.dataset.appearance=dark?'dark':'light';`\n )\n if (options.libraryKey !== undefined) {\n parts.push(\n `if(tokens){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])}}`\n )\n }\n parts.push(\n `var a=doc&&typeof doc.accent==='string'?doc.accent:'';`,\n `var accent=[${presets.join(',')}].indexOf(a)!==-1?a:/^#[0-9a-fA-F]{6}$/.test(a)?'custom':a.slice(0,5)==='ansi-'?'':${literal(defaultAccent)};`,\n `if(accent)r.dataset.accent=accent;`,\n `if(doc&&doc.density==='compact')r.dataset.density='compact';`\n )\n if (options.surface) {\n parts.push(\n // Reduce Transparency forces the opaque surface; a translucent request resolves\n // to frosted because the host's capability is unknown before the provider mounts.\n `var reduce=q(${literal(REDUCED_TRANSPARENCY_QUERY)})||!!(doc&&doc.reduceTransparency===true);`,\n `var surface=reduce?'opaque':doc&&(doc.surface==='frosted'||doc.surface==='translucent')?'frosted':'opaque';`,\n `r.dataset.surface=surface;`,\n `r.dataset.reduceTransparency=reduce?'true':'false';`,\n `s.setProperty('--surface-alpha',${JSON.stringify(surfaceAlpha)}[surface]);`\n )\n }\n parts.push(`}catch(e){}})();`)\n\n return `${parts.join('')}${fontSettingsBootstrapScript(options.key, options.version)}`\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,SAAgB,oBAAoB,OAAuB;CACzD,OAAO,wBAAwB,KAAK;AACtC;AAkFA,SAAgB,YAAY,QAAqC,mBAA2B;CAC1F,IAAI,OAAO,UAAU,UAAU,OAAO,iBAAiB,KAAK;CAC5D,OAAO,kBAAkB,KAAK;AAChC;AAEA,SAAS,iBAAiB,YAA4B;CAEpD,OAAO,GAAG,8CADmD,oBAAoB,UAAU,EAAE,wXAC1E,4BAA4B,UAAU;AAC3D;AAEA,IAAM,UAAU;AAEhB,SAAS,kBAAkB,SAAqC;CAC9D,MAAM,QAAQ,QAA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MAAM,KAAK,kBAAkB;CAE7B,OAAO,GAAG,MAAM,KAAK,EAAE,IAAI,4BAA4B,QAAQ,KAAK,QAAQ,OAAO;AACrF"}
1
+ {"version":3,"file":"theme-script.js","names":["literal"],"sources":["../../../src/components/theme/theme-script.ts"],"sourcesContent":["/*\n * Copyright (c) 2026 Wing\n * Licensed under the MIT License.\n *\n * The options form is rewritten from Adea's accepted port of Zeron's preference\n * store (`appearanceThemeScript` in `packages/ui/src/components/appearance.ts`,\n * https://github.com/zeronsh/zeron) so the boot script reads the document the shared\n * persistence writes. See NOTICE.\n */\nimport { fontSettingsBootstrapScript } from '#lib/appearance-font-settings'\nimport { CUSTOM_ACCENT_PATTERN, isCustomAccent } from '#lib/accent-roles'\nimport { accents } from '#lib/accent-presets'\nimport { safeScriptStringLiteral as literal } from '#lib/safe-script'\nimport { THEME_ACCENT_PREFIX } from '#lib/theme-accents'\nimport { DEFAULT_THEME_STORAGE_KEY, THEME_INDEX, defaultThemeIdFor } from '#lib/theme-defaults'\nimport {\n REDUCED_TRANSPARENCY_QUERY,\n resolveSurface,\n surfaceAlpha,\n themeSurfaces,\n type SurfaceEnvironment,\n} from '#lib/theme-surface'\nimport type { ThemeTokenProjection } from '@adea-ai/themes/theme-token-projection'\nimport type { ThemeStorageSchema } from './theme-persistence'\n\nexport { safeScriptStringLiteral as inlineScriptLiteral } from '#lib/safe-script'\n\n/** A stored-record path that can supply an absent projection source token. */\nexport type ThemeTokenProjectionFallback = Readonly<{\n /** The CSS custom property to fill only when the stored token map omits it. */\n token: string\n /** Own-property path from the stored library record to a string value. */\n path: readonly string[]\n}>\n\n/**\n * Options for the host-shaped no-flash script: the document's {@link ThemeStorageSchema}\n * plus what the script paints from it.\n */\nexport type ThemeScriptOptions = ThemeStorageSchema & {\n /**\n * The accent painted when the document has none, an unrecognised one, or the\n * legacy `theme` spelling — the host's default (adea: `violet`). Without it those\n * cases paint no `data-accent`, which is what the provider writes for `theme`.\n * Setting it means the `[data-accent]` block of the default preset paints on the\n * first frame instead of after hydration.\n */\n defaultAccent?: string\n /**\n * Also resolve the surface axis (`data-surface`, `data-reduce-transparency`,\n * `--surface-alpha`) from the document and the operating system's Reduce\n * Transparency setting. A `translucent` preference resolves to `frosted`: the\n * host's translucency capability is not known until the provider mounts, and the\n * provider re-resolves it then. Match the provider's `surface` prop.\n */\n surface?: boolean\n /**\n * Accepted so a host can pass the provider's `palette` prop through; the script is\n * the same either way. A catalogue variant's palette is the host stylesheet's job\n * (`stylesheet`) or the provider's, at mount (`inline`), and a stored theme's own\n * tokens are written inline in both.\n */\n palette?: 'inline' | 'stylesheet'\n /** The only `version` of the library document read. Default `1`. */\n libraryVersion?: number\n}\n\n/**\n * The no-flash script.\n *\n * Rendered inline in `<head>` before any stylesheet that matters. Without it a dark\n * preference paints the light theme first and then swaps, which is the flash every\n * themed application has to solve and the one thing a provider cannot do from\n * inside the body.\n *\n * ## The string form\n *\n * `themeScript('key')` serves a provider that stores an unversioned\n * `localStorage[key]` document. Deliberately tiny and dependency-free: it reads the\n * stored preference, resolves `system`, and sets the class. It does not apply the\n * variant's roles — the default theme in `theme.css` covers the first paint, and the\n * provider writes the rest on mount. Its output is a compatibility surface (a\n * consumer may have it in a snapshot), so it does not change.\n *\n * ## The options form\n *\n * `themeScript({ key, ... })` serves a host with a versioned document (see\n * `createVersionedPersistence`) and writes what the provider will write, so mounting\n * repaints nothing:\n *\n * - `class=\"dark\"`, `color-scheme`, `data-theme`, `data-appearance` and, for a\n * compact document, `data-density`;\n * - `data-accent`: a preset id as stored, `custom` for a `#rrggbb` (never the hex\n * itself, which is the worst possible attribute content), `defaultAccent` when the\n * document has none, nothing for a theme-derived `ansi-*` accent (it has no\n * stylesheet block; the provider paints it inline);\n * - the theme: the stored id when the catalogue or the stored library holds it, else\n * the default of the resolved appearance, exactly as the provider resolves it. A\n * library theme's own tokens are written inline, so an imported theme paints on the\n * first frame;\n * - the surface axis, when `surface` is set;\n * - the font settings, guarded to the document's `version`.\n *\n * The document's `version`, when the schema names one, must match exactly. The legacy\n * key is read only while the main key is absent: an unreadable main document is not\n * \"no preference\", so it does not resurrect an older value.\n *\n * The script reads values out of `localStorage` and writes them to `dataset` and\n * `style`, which are *property* assignments rather than code: a stored id, accent or\n * token can set an attribute and cannot execute. The values that reach the source as\n * text (keys, ids, the default accent) go through `inlineScriptLiteral`\n * (`safeScriptStringLiteral`) for the reason documented there.\n *\n * The script cannot import the policy it applies, so it carries the policy's tables\n * instead: the catalogue ids, the default pair, the preset ids, the custom-accent\n * grammar, the theme-accent prefix and the surface outcomes, all read from the modules\n * the provider uses.\n */\nexport function themeScript(storageKey?: string): string\nexport function themeScript(options: ThemeScriptOptions): string\nexport function themeScript(\n input: string | ThemeScriptOptions = DEFAULT_THEME_STORAGE_KEY\n): string {\n if (typeof input === 'string') return stringFormScript(input)\n return optionsFormScript(input)\n}\n\n/** Internal hook for the opt-in script entry, which supplies its generated browser bundle. */\nexport function themeScriptWithProjection(\n options: ThemeScriptOptions & {\n tokenProjectionFallbacks?: readonly ThemeTokenProjectionFallback[]\n },\n tokenProjection: ThemeTokenProjection,\n projectionBundle: string,\n projectionFallbackScript: string\n): string {\n return optionsFormScript(\n options,\n tokenProjection,\n projectionBundle,\n projectionFallbackScript,\n options.tokenProjectionFallbacks\n )\n}\n\nfunction stringFormScript(storageKey: string): string {\n const script = `(function(){try{var s=localStorage.getItem(${literal(storageKey)});var p=s?JSON.parse(s):{};var a=p.appearance||'system';var d=a==='dark'||(a==='system'&&window.matchMedia('(prefers-color-scheme: dark)').matches);var r=document.documentElement;if(d)r.classList.add('dark');r.style.colorScheme=d?'dark':'light';if(p.accent&&p.accent!=='theme')r.dataset.accent=p.accent;if(p.density==='compact')r.dataset.density='compact';}catch(e){}})();`\n return `${script}${fontSettingsBootstrapScript(storageKey)}`\n}\n\n/** What the surface axis paints before the provider knows the host's capability. */\nfunction bootSurfaces(): { preferred: Record<string, string>; reduced: string } {\n const environment: SurfaceEnvironment = {\n osReducedTransparency: false,\n userReducedTransparency: false,\n nativeTranslucency: false,\n }\n return {\n preferred: Object.fromEntries(\n themeSurfaces.map((surface) => [surface, resolveSurface(surface, environment)])\n ),\n reduced: resolveSurface('opaque', { ...environment, osReducedTransparency: true }),\n }\n}\n\nfunction optionsFormScript(\n options: ThemeScriptOptions,\n projection?: ThemeTokenProjection,\n projectionBundle?: string,\n projectionFallbackScript = '',\n projectionFallbacks?: readonly ThemeTokenProjectionFallback[]\n): string {\n const field = options.appearanceField ?? 'appearance'\n const versionGuard =\n options.version === undefined ? '' : `&&x.version===${Number(options.version)}`\n const presets = accents.map((preset) => literal(preset.id))\n const defaultAccent =\n options.defaultAccent === undefined\n ? ''\n : isCustomAccent(options.defaultAccent)\n ? 'custom'\n : options.defaultAccent\n const canProjectTokens =\n options.libraryKey !== undefined &&\n projection &&\n projection.length > 0 &&\n projectionBundle !== undefined\n const hasProjectionFallbacks = canProjectTokens && !!projectionFallbacks?.length\n const tokenProjection = canProjectTokens\n ? `var projectTokens=${projectionBundle};var tokenProjection=JSON.parse(${literal(JSON.stringify(projection))});${\n hasProjectionFallbacks\n ? `var tokenProjectionFallbacks=JSON.parse(${literal(JSON.stringify(projectionFallbacks))});`\n : ''\n }`\n : ''\n const projectionFallbackCode = hasProjectionFallbacks ? projectionFallbackScript : ''\n\n const parts: string[] = []\n parts.push(\n `(function(){try{`,\n `var r=document.documentElement,s=r.style;`,\n `var q=function(m){try{return window.matchMedia(m).matches}catch(e){return false}};`,\n `var get=function(k){try{return localStorage.getItem(k)}catch(e){return null}};`,\n // The main document. `raw !== null` rather than truthiness: an empty string is a\n // stored (corrupt) value, so it does not fall through to the legacy key.\n `var raw=get(${literal(options.key)}),doc=null,legacy=null;`,\n `if(raw!==null){try{var x=JSON.parse(raw);if(x&&typeof x==='object'&&!Array.isArray(x)${versionGuard})doc=x}catch(e){}}`\n )\n if (options.legacyAppearanceKey !== undefined) {\n parts.push(`else legacy=get(${literal(options.legacyAppearanceKey)});`)\n }\n parts.push(\n `var m=doc?doc[${literal(field)}]:legacy;`,\n `var mode=m==='light'||m==='dark'?m:'system';`,\n `var dark=mode==='dark'||(mode==='system'&&q('(prefers-color-scheme: dark)'));`,\n `var fallback=dark?${literal(defaultThemeIdFor('dark'))}:${literal(defaultThemeIdFor('light'))};`,\n `var want=doc?(dark?doc.darkThemeId:doc.lightThemeId):null;`,\n `if(typeof want!=='string')want=fallback;`,\n `var ids=[${THEME_INDEX.map(([id]) => literal(id)).join(',')}];`,\n `var id=ids.indexOf(want)!==-1?want:null,tokens=null${hasProjectionFallbacks ? ',storedTheme=null' : ''};`\n )\n if (options.libraryKey !== undefined) {\n parts.push(\n `if(id===null){try{var lib=JSON.parse(get(${literal(options.libraryKey)})||'null');`,\n `if(lib&&typeof lib==='object'&&lib.version===${Number(options.libraryVersion ?? 1)}&&Array.isArray(lib.themes)){`,\n `for(var i=0;i!==lib.themes.length;i++){var t=lib.themes[i];`,\n `if(t&&t.id===want&&t.flatTokens&&typeof t.flatTokens==='object'){id=want;tokens=t.flatTokens;${hasProjectionFallbacks ? 'storedTheme=t;' : ''}break}}}}catch(e){}}`\n )\n }\n if (options.libraryKey !== undefined && tokenProjection) parts.push(tokenProjection)\n parts.push(\n `if(id===null)id=fallback;`,\n `r.classList.toggle('dark',dark);`,\n `s.colorScheme=dark?'dark':'light';`,\n `r.dataset.theme=id;`,\n `r.dataset.appearance=dark?'dark':'light';`\n )\n if (options.libraryKey !== undefined) {\n parts.push(\n `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])}}`\n )\n }\n parts.push(\n `var a=doc&&typeof doc.accent==='string'?doc.accent:'';`,\n `var accent=[${presets.join(',')}].indexOf(a)!==-1?a:${CUSTOM_ACCENT_PATTERN}.test(a)?'custom':a.slice(0,${THEME_ACCENT_PREFIX.length})===${literal(THEME_ACCENT_PREFIX)}?'':${literal(defaultAccent)};`,\n `if(accent)r.dataset.accent=accent;`,\n `if(doc&&doc.density==='compact')r.dataset.density='compact';`\n )\n if (options.surface) {\n const surfaces = bootSurfaces()\n parts.push(\n `var reduce=q(${literal(REDUCED_TRANSPARENCY_QUERY)})||!!(doc&&doc.reduceTransparency===true);`,\n `var surfaces=${JSON.stringify(surfaces.preferred)};`,\n `var surface=reduce?${literal(surfaces.reduced)}:doc&&typeof doc.surface==='string'&&Object.prototype.hasOwnProperty.call(surfaces,doc.surface)?surfaces[doc.surface]:surfaces.opaque;`,\n `r.dataset.surface=surface;`,\n `r.dataset.reduceTransparency=reduce?'true':'false';`,\n `s.setProperty('--surface-alpha',${JSON.stringify(surfaceAlpha)}[surface]);`\n )\n }\n parts.push(`}catch(e){}})();`)\n\n return `${parts.join('')}${fontSettingsBootstrapScript(options.key, options.version)}`\n}\n"],"mappings":";;;;;;;;;AAwHA,SAAgB,YACd,QAAqC,2BAC7B;CACR,IAAI,OAAO,UAAU,UAAU,OAAO,iBAAiB,KAAK;CAC5D,OAAO,kBAAkB,KAAK;AAChC;;AAGA,SAAgB,0BACd,SAGA,iBACA,kBACA,0BACQ;CACR,OAAO,kBACL,SACA,iBACA,kBACA,0BACA,QAAQ,wBACV;AACF;AAEA,SAAS,iBAAiB,YAA4B;CAEpD,OAAO,GAAG,8CADmDA,wBAAQ,UAAU,EAAE,wXAC9D,4BAA4B,UAAU;AAC3D;;AAGA,SAAS,eAAuE;CAC9E,MAAM,cAAkC;EACtC,uBAAuB;EACvB,yBAAyB;EACzB,oBAAoB;CACtB;CACA,OAAO;EACL,WAAW,OAAO,YAChB,cAAc,KAAK,YAAY,CAAC,SAAS,eAAe,SAAS,WAAW,CAAC,CAAC,CAChF;EACA,SAAS,eAAe,UAAU;GAAE,GAAG;GAAa,uBAAuB;EAAK,CAAC;CACnF;AACF;AAEA,SAAS,kBACP,SACA,YACA,kBACA,2BAA2B,IAC3B,qBACQ;CAC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