@oxy.so/bloom 23.8.1 → 23.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (573) hide show
  1. package/docs/bloom-language-classnames.mdx +11 -11
  2. package/docs/bloom-language-codemod.mdx +30 -5
  3. package/docs/bloom-language-for-agents.mdx +1 -1
  4. package/docs/bloom-language-modifiers.mdx +222 -77
  5. package/docs/bloom-language-nodes.mdx +43 -21
  6. package/docs/bloom-language-tokens.mdx +69 -14
  7. package/docs/bloom-language.mdx +148 -46
  8. package/docs/design-tokens.mdx +12 -2
  9. package/docs/no-nativewind.mdx +5 -4
  10. package/docs/task-catalog.json +1 -1
  11. package/docs/task-catalog.mdx +1 -1
  12. package/docs/theme.mdx +22 -6
  13. package/lib/commonjs/accordion/Accordion.js +12 -12
  14. package/lib/commonjs/accordion/Accordion.js.map +1 -1
  15. package/lib/commonjs/accordion/Accordion.web.js +8 -8
  16. package/lib/commonjs/accordion/Accordion.web.js.map +1 -1
  17. package/lib/commonjs/agent-creator/AgentCreatorSection.js +8 -10
  18. package/lib/commonjs/agent-creator/AgentCreatorSection.js.map +1 -1
  19. package/lib/commonjs/agent-creator/EmotionPicker.js +3 -5
  20. package/lib/commonjs/agent-creator/EmotionPicker.js.map +1 -1
  21. package/lib/commonjs/agent-log/AgentLog.js +131 -174
  22. package/lib/commonjs/agent-log/AgentLog.js.map +1 -1
  23. package/lib/commonjs/agent-reply/AgentProfile.js +6 -9
  24. package/lib/commonjs/agent-reply/AgentProfile.js.map +1 -1
  25. package/lib/commonjs/agent-thinking/AgentThinking.js +8 -7
  26. package/lib/commonjs/agent-thinking/AgentThinking.js.map +1 -1
  27. package/lib/commonjs/agent-thinking/ThinkingReasoning.js +8 -8
  28. package/lib/commonjs/agent-thinking/ThinkingReasoning.js.map +1 -1
  29. package/lib/commonjs/app-shell/AppShell.js +5 -7
  30. package/lib/commonjs/app-shell/AppShell.js.map +1 -1
  31. package/lib/commonjs/app-shell/AppShellEngine.js +72 -28
  32. package/lib/commonjs/app-shell/AppShellEngine.js.map +1 -1
  33. package/lib/commonjs/app-shell/AppShellPanelLayout.js +3 -3
  34. package/lib/commonjs/app-shell/AppShellPanelLayout.js.map +1 -1
  35. package/lib/commonjs/app-shell/NotificationBell.js +9 -9
  36. package/lib/commonjs/app-shell/NotificationBell.js.map +1 -1
  37. package/lib/commonjs/app-shell/PanelReorderHandle.js +4 -6
  38. package/lib/commonjs/app-shell/PanelReorderHandle.js.map +1 -1
  39. package/lib/commonjs/avatar-group/AvatarGroupBase.js +7 -7
  40. package/lib/commonjs/avatar-group/AvatarGroupBase.js.map +1 -1
  41. package/lib/commonjs/chat-list/ChatSearchResultsBase.js +4 -4
  42. package/lib/commonjs/chat-list/ChatSearchResultsBase.js.map +1 -1
  43. package/lib/commonjs/choice-list/ChoiceList.js +5 -5
  44. package/lib/commonjs/choice-list/ChoiceList.js.map +1 -1
  45. package/lib/commonjs/color-swatch-picker/ColorSwatchPicker.js +7 -7
  46. package/lib/commonjs/color-swatch-picker/ColorSwatchPicker.js.map +1 -1
  47. package/lib/commonjs/connection-dots/ConnectionDots.js +4 -4
  48. package/lib/commonjs/connection-dots/ConnectionDots.js.map +1 -1
  49. package/lib/commonjs/connection-dots/ConnectionDots.web.js +4 -4
  50. package/lib/commonjs/connection-dots/ConnectionDots.web.js.map +1 -1
  51. package/lib/commonjs/cover-header/CoverHeader.js +3 -3
  52. package/lib/commonjs/cover-header/CoverHeader.js.map +1 -1
  53. package/lib/commonjs/data-table/DataTableSelect.js +8 -8
  54. package/lib/commonjs/data-table/DataTableSelect.js.map +1 -1
  55. package/lib/commonjs/design-tokens/theme.css +1 -0
  56. package/lib/commonjs/design-tokens/tokens.json +390 -0
  57. package/lib/commonjs/dialog/DialogContent.js +5 -4
  58. package/lib/commonjs/dialog/DialogContent.js.map +1 -1
  59. package/lib/commonjs/dialog/DialogHeader.js +6 -5
  60. package/lib/commonjs/dialog/DialogHeader.js.map +1 -1
  61. package/lib/commonjs/dialog/SheetShell.js +5 -4
  62. package/lib/commonjs/dialog/SheetShell.js.map +1 -1
  63. package/lib/commonjs/expandable-text/ExpandableText.js +3 -3
  64. package/lib/commonjs/expandable-text/ExpandableText.js.map +1 -1
  65. package/lib/commonjs/floating/lens/lens-cover.js +56 -0
  66. package/lib/commonjs/floating/lens/lens-cover.js.map +1 -0
  67. package/lib/commonjs/floating/lens/native-lens.js.map +1 -1
  68. package/lib/commonjs/grouped-section/GroupedSection.js +16 -15
  69. package/lib/commonjs/grouped-section/GroupedSection.js.map +1 -1
  70. package/lib/commonjs/home-search/BudgetPicker.js +8 -8
  71. package/lib/commonjs/home-search/BudgetPicker.js.map +1 -1
  72. package/lib/commonjs/home-search/MoveInPicker.js +7 -7
  73. package/lib/commonjs/home-search/MoveInPicker.js.map +1 -1
  74. package/lib/commonjs/icon-circle/IconCircle.js +14 -16
  75. package/lib/commonjs/icon-circle/IconCircle.js.map +1 -1
  76. package/lib/commonjs/icons/shared.js +3 -5
  77. package/lib/commonjs/icons/shared.js.map +1 -1
  78. package/lib/commonjs/kbd/Kbd.js +8 -8
  79. package/lib/commonjs/kbd/Kbd.js.map +1 -1
  80. package/lib/commonjs/layout/ResizeHandle.js +6 -5
  81. package/lib/commonjs/layout/ResizeHandle.js.map +1 -1
  82. package/lib/commonjs/link-preview/LinkPreviewCard.js +24 -26
  83. package/lib/commonjs/link-preview/LinkPreviewCard.js.map +1 -1
  84. package/lib/commonjs/list/ListBase.js +3 -3
  85. package/lib/commonjs/list/ListBase.js.map +1 -1
  86. package/lib/commonjs/list/ListPerson.js +3 -3
  87. package/lib/commonjs/list/ListPerson.js.map +1 -1
  88. package/lib/commonjs/listing-editor/ListingPreviewPane.js +30 -30
  89. package/lib/commonjs/listing-editor/ListingPreviewPane.js.map +1 -1
  90. package/lib/commonjs/markdown/InlineMarkdown.js +9 -11
  91. package/lib/commonjs/markdown/InlineMarkdown.js.map +1 -1
  92. package/lib/commonjs/markdown/MarkdownBlocks.js +35 -43
  93. package/lib/commonjs/markdown/MarkdownBlocks.js.map +1 -1
  94. package/lib/commonjs/multi-agent-chat/MultiAgentChatBase.js +5 -8
  95. package/lib/commonjs/multi-agent-chat/MultiAgentChatBase.js.map +1 -1
  96. package/lib/commonjs/multi-agent-chat/SelectedAgentPreview.js +9 -11
  97. package/lib/commonjs/multi-agent-chat/SelectedAgentPreview.js.map +1 -1
  98. package/lib/commonjs/notifications/NotificationPermissionSheet.js +3 -5
  99. package/lib/commonjs/notifications/NotificationPermissionSheet.js.map +1 -1
  100. package/lib/commonjs/notifications/NotificationsScreen.js +21 -27
  101. package/lib/commonjs/notifications/NotificationsScreen.js.map +1 -1
  102. package/lib/commonjs/overlay/OverlayInertBoundary.js +33 -12
  103. package/lib/commonjs/overlay/OverlayInertBoundary.js.map +1 -1
  104. package/lib/commonjs/page-header/PageHeaderTitleInput.js +20 -20
  105. package/lib/commonjs/page-header/PageHeaderTitleInput.js.map +1 -1
  106. package/lib/commonjs/panel-routing/expo-router/StackScene.js +42 -24
  107. package/lib/commonjs/panel-routing/expo-router/StackScene.js.map +1 -1
  108. package/lib/commonjs/phone-input/CountryCodeSelect.js +4 -4
  109. package/lib/commonjs/phone-input/CountryCodeSelect.js.map +1 -1
  110. package/lib/commonjs/project-board/MemberAvatars.js +7 -9
  111. package/lib/commonjs/project-board/MemberAvatars.js.map +1 -1
  112. package/lib/commonjs/project-board/ProjectBoardBase.js +3 -6
  113. package/lib/commonjs/project-board/ProjectBoardBase.js.map +1 -1
  114. package/lib/commonjs/project-board/ProjectBoardCanvas.js +2 -2
  115. package/lib/commonjs/project-board/ProjectBoardCanvas.js.map +1 -1
  116. package/lib/commonjs/project-board/styles.js +2 -5
  117. package/lib/commonjs/project-board/styles.js.map +1 -1
  118. package/lib/commonjs/radio/RadioSwatch.js +5 -5
  119. package/lib/commonjs/radio/RadioSwatch.js.map +1 -1
  120. package/lib/commonjs/rating/Rating.js +7 -7
  121. package/lib/commonjs/rating/Rating.js.map +1 -1
  122. package/lib/commonjs/rating/RatingBar.js +8 -8
  123. package/lib/commonjs/rating/RatingBar.js.map +1 -1
  124. package/lib/commonjs/rating/RatingBar.web.js +5 -5
  125. package/lib/commonjs/rating/RatingBar.web.js.map +1 -1
  126. package/lib/commonjs/rating/RatingInput.js +9 -9
  127. package/lib/commonjs/rating/RatingInput.js.map +1 -1
  128. package/lib/commonjs/rating/RatingSummary.js +6 -6
  129. package/lib/commonjs/rating/RatingSummary.js.map +1 -1
  130. package/lib/commonjs/row-actions/RowActions.js +5 -5
  131. package/lib/commonjs/row-actions/RowActions.js.map +1 -1
  132. package/lib/commonjs/select/Select.js +5 -5
  133. package/lib/commonjs/select/Select.js.map +1 -1
  134. package/lib/commonjs/skeleton/Skeleton.js +22 -30
  135. package/lib/commonjs/skeleton/Skeleton.js.map +1 -1
  136. package/lib/commonjs/stay-filters/AvailabilityFilter.js +3 -3
  137. package/lib/commonjs/stay-filters/AvailabilityFilter.js.map +1 -1
  138. package/lib/commonjs/stay-filters/CountFilter.js +3 -3
  139. package/lib/commonjs/stay-filters/CountFilter.js.map +1 -1
  140. package/lib/commonjs/stay-filters/FilterFooter.js +7 -7
  141. package/lib/commonjs/stay-filters/FilterFooter.js.map +1 -1
  142. package/lib/commonjs/stay-filters/FilterSection.js +12 -12
  143. package/lib/commonjs/stay-filters/FilterSection.js.map +1 -1
  144. package/lib/commonjs/stay-filters/SwitchFilterRow.js +9 -9
  145. package/lib/commonjs/stay-filters/SwitchFilterRow.js.map +1 -1
  146. package/lib/commonjs/stay-search/GuestPicker.js +5 -5
  147. package/lib/commonjs/stay-search/GuestPicker.js.map +1 -1
  148. package/lib/commonjs/stepper/Stepper.js +11 -10
  149. package/lib/commonjs/stepper/Stepper.js.map +1 -1
  150. package/lib/commonjs/stepper/StepperRow.js +12 -12
  151. package/lib/commonjs/stepper/StepperRow.js.map +1 -1
  152. package/lib/commonjs/subscription-plans/SubscriptionPlans.js +10 -10
  153. package/lib/commonjs/subscription-plans/SubscriptionPlans.js.map +1 -1
  154. package/lib/commonjs/subscription-plans/SubscriptionPrice.js +5 -5
  155. package/lib/commonjs/subscription-plans/SubscriptionPrice.js.map +1 -1
  156. package/lib/commonjs/task-list/TaskList.js +14 -15
  157. package/lib/commonjs/task-list/TaskList.js.map +1 -1
  158. package/lib/commonjs/theme/BloomThemeProvider.js +207 -223
  159. package/lib/commonjs/theme/BloomThemeProvider.js.map +1 -1
  160. package/lib/commonjs/theme/build-theme-from-seed.js +1 -1
  161. package/lib/commonjs/theme/build-theme.js +39 -9
  162. package/lib/commonjs/theme/build-theme.js.map +1 -1
  163. package/lib/commonjs/theme/canonical-tokens.js +40 -0
  164. package/lib/commonjs/theme/canonical-tokens.js.map +1 -0
  165. package/lib/commonjs/theme/color-policy.js +3 -0
  166. package/lib/commonjs/theme/color-policy.js.map +1 -1
  167. package/lib/commonjs/theme/color-scope/resolve-scope.js +48 -5
  168. package/lib/commonjs/theme/color-scope/resolve-scope.js.map +1 -1
  169. package/lib/commonjs/theme/color-scope/use-scope.js +1 -5
  170. package/lib/commonjs/theme/color-scope/use-scope.js.map +1 -1
  171. package/lib/commonjs/theme/color-tokens.js +32 -10
  172. package/lib/commonjs/theme/color-tokens.js.map +1 -1
  173. package/lib/commonjs/theme/color-utils.js +4 -0
  174. package/lib/commonjs/theme/color-utils.js.map +1 -1
  175. package/lib/commonjs/theme/default-token-vars.js +92 -0
  176. package/lib/commonjs/theme/default-token-vars.js.map +1 -0
  177. package/lib/commonjs/theme/index.js +6 -0
  178. package/lib/commonjs/theme/index.js.map +1 -1
  179. package/lib/commonjs/theme/index.web.js +6 -0
  180. package/lib/commonjs/theme/index.web.js.map +1 -1
  181. package/lib/commonjs/theme/prepaint-palettes.js +1 -5
  182. package/lib/commonjs/theme/prepaint-palettes.js.map +1 -1
  183. package/lib/commonjs/theme/token-registry.js +7 -28
  184. package/lib/commonjs/theme/token-registry.js.map +1 -1
  185. package/lib/commonjs/theme/use-theme-paint.js +28 -0
  186. package/lib/commonjs/theme/use-theme-paint.js.map +1 -1
  187. package/lib/commonjs/typography/Typography.js +27 -27
  188. package/lib/commonjs/typography/Typography.js.map +1 -1
  189. package/lib/commonjs/web-search/WebSearch.js +18 -19
  190. package/lib/commonjs/web-search/WebSearch.js.map +1 -1
  191. package/lib/commonjs/wizard/WizardFooterBase.js +10 -10
  192. package/lib/commonjs/wizard/WizardFooterBase.js.map +1 -1
  193. package/lib/commonjs/wizard/WizardProgress.js +5 -5
  194. package/lib/commonjs/wizard/WizardProgress.js.map +1 -1
  195. package/lib/module/accordion/Accordion.js +12 -12
  196. package/lib/module/accordion/Accordion.js.map +1 -1
  197. package/lib/module/accordion/Accordion.web.js +8 -8
  198. package/lib/module/accordion/Accordion.web.js.map +1 -1
  199. package/lib/module/agent-creator/AgentCreatorSection.js +8 -10
  200. package/lib/module/agent-creator/AgentCreatorSection.js.map +1 -1
  201. package/lib/module/agent-creator/EmotionPicker.js +3 -5
  202. package/lib/module/agent-creator/EmotionPicker.js.map +1 -1
  203. package/lib/module/agent-log/AgentLog.js +131 -174
  204. package/lib/module/agent-log/AgentLog.js.map +1 -1
  205. package/lib/module/agent-reply/AgentProfile.js +7 -10
  206. package/lib/module/agent-reply/AgentProfile.js.map +1 -1
  207. package/lib/module/agent-thinking/AgentThinking.js +8 -7
  208. package/lib/module/agent-thinking/AgentThinking.js.map +1 -1
  209. package/lib/module/agent-thinking/ThinkingReasoning.js +8 -8
  210. package/lib/module/agent-thinking/ThinkingReasoning.js.map +1 -1
  211. package/lib/module/app-shell/AppShell.js +5 -7
  212. package/lib/module/app-shell/AppShell.js.map +1 -1
  213. package/lib/module/app-shell/AppShellEngine.js +73 -29
  214. package/lib/module/app-shell/AppShellEngine.js.map +1 -1
  215. package/lib/module/app-shell/AppShellPanelLayout.js +3 -3
  216. package/lib/module/app-shell/AppShellPanelLayout.js.map +1 -1
  217. package/lib/module/app-shell/NotificationBell.js +9 -9
  218. package/lib/module/app-shell/NotificationBell.js.map +1 -1
  219. package/lib/module/app-shell/PanelReorderHandle.js +4 -6
  220. package/lib/module/app-shell/PanelReorderHandle.js.map +1 -1
  221. package/lib/module/avatar-group/AvatarGroupBase.js +7 -7
  222. package/lib/module/avatar-group/AvatarGroupBase.js.map +1 -1
  223. package/lib/module/chat-list/ChatSearchResultsBase.js +4 -4
  224. package/lib/module/chat-list/ChatSearchResultsBase.js.map +1 -1
  225. package/lib/module/choice-list/ChoiceList.js +5 -5
  226. package/lib/module/choice-list/ChoiceList.js.map +1 -1
  227. package/lib/module/color-swatch-picker/ColorSwatchPicker.js +7 -7
  228. package/lib/module/color-swatch-picker/ColorSwatchPicker.js.map +1 -1
  229. package/lib/module/connection-dots/ConnectionDots.js +4 -4
  230. package/lib/module/connection-dots/ConnectionDots.js.map +1 -1
  231. package/lib/module/connection-dots/ConnectionDots.web.js +4 -4
  232. package/lib/module/connection-dots/ConnectionDots.web.js.map +1 -1
  233. package/lib/module/cover-header/CoverHeader.js +3 -3
  234. package/lib/module/cover-header/CoverHeader.js.map +1 -1
  235. package/lib/module/data-table/DataTableSelect.js +8 -8
  236. package/lib/module/data-table/DataTableSelect.js.map +1 -1
  237. package/lib/module/design-tokens/theme.css +1 -0
  238. package/lib/module/design-tokens/tokens.json +390 -0
  239. package/lib/module/dialog/DialogContent.js +5 -4
  240. package/lib/module/dialog/DialogContent.js.map +1 -1
  241. package/lib/module/dialog/DialogHeader.js +6 -5
  242. package/lib/module/dialog/DialogHeader.js.map +1 -1
  243. package/lib/module/dialog/SheetShell.js +5 -4
  244. package/lib/module/dialog/SheetShell.js.map +1 -1
  245. package/lib/module/expandable-text/ExpandableText.js +3 -3
  246. package/lib/module/expandable-text/ExpandableText.js.map +1 -1
  247. package/lib/module/floating/lens/lens-cover.js +51 -0
  248. package/lib/module/floating/lens/lens-cover.js.map +1 -0
  249. package/lib/module/floating/lens/native-lens.js.map +1 -1
  250. package/lib/module/grouped-section/GroupedSection.js +16 -15
  251. package/lib/module/grouped-section/GroupedSection.js.map +1 -1
  252. package/lib/module/home-search/BudgetPicker.js +8 -8
  253. package/lib/module/home-search/BudgetPicker.js.map +1 -1
  254. package/lib/module/home-search/MoveInPicker.js +7 -7
  255. package/lib/module/home-search/MoveInPicker.js.map +1 -1
  256. package/lib/module/icon-circle/IconCircle.js +14 -16
  257. package/lib/module/icon-circle/IconCircle.js.map +1 -1
  258. package/lib/module/icons/shared.js +3 -5
  259. package/lib/module/icons/shared.js.map +1 -1
  260. package/lib/module/kbd/Kbd.js +8 -8
  261. package/lib/module/kbd/Kbd.js.map +1 -1
  262. package/lib/module/layout/ResizeHandle.js +6 -5
  263. package/lib/module/layout/ResizeHandle.js.map +1 -1
  264. package/lib/module/link-preview/LinkPreviewCard.js +24 -26
  265. package/lib/module/link-preview/LinkPreviewCard.js.map +1 -1
  266. package/lib/module/list/ListBase.js +3 -3
  267. package/lib/module/list/ListBase.js.map +1 -1
  268. package/lib/module/list/ListPerson.js +3 -3
  269. package/lib/module/list/ListPerson.js.map +1 -1
  270. package/lib/module/listing-editor/ListingPreviewPane.js +30 -30
  271. package/lib/module/listing-editor/ListingPreviewPane.js.map +1 -1
  272. package/lib/module/markdown/InlineMarkdown.js +9 -11
  273. package/lib/module/markdown/InlineMarkdown.js.map +1 -1
  274. package/lib/module/markdown/MarkdownBlocks.js +35 -43
  275. package/lib/module/markdown/MarkdownBlocks.js.map +1 -1
  276. package/lib/module/multi-agent-chat/MultiAgentChatBase.js +6 -9
  277. package/lib/module/multi-agent-chat/MultiAgentChatBase.js.map +1 -1
  278. package/lib/module/multi-agent-chat/SelectedAgentPreview.js +9 -11
  279. package/lib/module/multi-agent-chat/SelectedAgentPreview.js.map +1 -1
  280. package/lib/module/notifications/NotificationPermissionSheet.js +3 -5
  281. package/lib/module/notifications/NotificationPermissionSheet.js.map +1 -1
  282. package/lib/module/notifications/NotificationsScreen.js +21 -27
  283. package/lib/module/notifications/NotificationsScreen.js.map +1 -1
  284. package/lib/module/overlay/OverlayInertBoundary.js +33 -12
  285. package/lib/module/overlay/OverlayInertBoundary.js.map +1 -1
  286. package/lib/module/page-header/PageHeaderTitleInput.js +20 -20
  287. package/lib/module/page-header/PageHeaderTitleInput.js.map +1 -1
  288. package/lib/module/panel-routing/expo-router/StackScene.js +42 -24
  289. package/lib/module/panel-routing/expo-router/StackScene.js.map +1 -1
  290. package/lib/module/phone-input/CountryCodeSelect.js +4 -4
  291. package/lib/module/phone-input/CountryCodeSelect.js.map +1 -1
  292. package/lib/module/project-board/MemberAvatars.js +7 -9
  293. package/lib/module/project-board/MemberAvatars.js.map +1 -1
  294. package/lib/module/project-board/ProjectBoardBase.js +4 -7
  295. package/lib/module/project-board/ProjectBoardBase.js.map +1 -1
  296. package/lib/module/project-board/ProjectBoardCanvas.js +2 -2
  297. package/lib/module/project-board/ProjectBoardCanvas.js.map +1 -1
  298. package/lib/module/project-board/styles.js +3 -6
  299. package/lib/module/project-board/styles.js.map +1 -1
  300. package/lib/module/radio/RadioSwatch.js +5 -5
  301. package/lib/module/radio/RadioSwatch.js.map +1 -1
  302. package/lib/module/rating/Rating.js +7 -7
  303. package/lib/module/rating/Rating.js.map +1 -1
  304. package/lib/module/rating/RatingBar.js +8 -8
  305. package/lib/module/rating/RatingBar.js.map +1 -1
  306. package/lib/module/rating/RatingBar.web.js +5 -5
  307. package/lib/module/rating/RatingBar.web.js.map +1 -1
  308. package/lib/module/rating/RatingInput.js +9 -9
  309. package/lib/module/rating/RatingInput.js.map +1 -1
  310. package/lib/module/rating/RatingSummary.js +6 -6
  311. package/lib/module/rating/RatingSummary.js.map +1 -1
  312. package/lib/module/row-actions/RowActions.js +5 -5
  313. package/lib/module/row-actions/RowActions.js.map +1 -1
  314. package/lib/module/select/Select.js +5 -5
  315. package/lib/module/select/Select.js.map +1 -1
  316. package/lib/module/skeleton/Skeleton.js +22 -30
  317. package/lib/module/skeleton/Skeleton.js.map +1 -1
  318. package/lib/module/stay-filters/AvailabilityFilter.js +3 -3
  319. package/lib/module/stay-filters/AvailabilityFilter.js.map +1 -1
  320. package/lib/module/stay-filters/CountFilter.js +3 -3
  321. package/lib/module/stay-filters/CountFilter.js.map +1 -1
  322. package/lib/module/stay-filters/FilterFooter.js +7 -7
  323. package/lib/module/stay-filters/FilterFooter.js.map +1 -1
  324. package/lib/module/stay-filters/FilterSection.js +12 -12
  325. package/lib/module/stay-filters/FilterSection.js.map +1 -1
  326. package/lib/module/stay-filters/SwitchFilterRow.js +9 -9
  327. package/lib/module/stay-filters/SwitchFilterRow.js.map +1 -1
  328. package/lib/module/stay-search/GuestPicker.js +5 -5
  329. package/lib/module/stay-search/GuestPicker.js.map +1 -1
  330. package/lib/module/stepper/Stepper.js +11 -10
  331. package/lib/module/stepper/Stepper.js.map +1 -1
  332. package/lib/module/stepper/StepperRow.js +12 -12
  333. package/lib/module/stepper/StepperRow.js.map +1 -1
  334. package/lib/module/subscription-plans/SubscriptionPlans.js +10 -10
  335. package/lib/module/subscription-plans/SubscriptionPlans.js.map +1 -1
  336. package/lib/module/subscription-plans/SubscriptionPrice.js +5 -5
  337. package/lib/module/subscription-plans/SubscriptionPrice.js.map +1 -1
  338. package/lib/module/task-list/TaskList.js +14 -15
  339. package/lib/module/task-list/TaskList.js.map +1 -1
  340. package/lib/module/theme/BloomThemeProvider.js +208 -224
  341. package/lib/module/theme/BloomThemeProvider.js.map +1 -1
  342. package/lib/module/theme/build-theme-from-seed.js +1 -1
  343. package/lib/module/theme/build-theme.js +38 -9
  344. package/lib/module/theme/build-theme.js.map +1 -1
  345. package/lib/module/theme/canonical-tokens.js +36 -0
  346. package/lib/module/theme/canonical-tokens.js.map +1 -0
  347. package/lib/module/theme/color-policy.js +3 -0
  348. package/lib/module/theme/color-policy.js.map +1 -1
  349. package/lib/module/theme/color-scope/resolve-scope.js +46 -5
  350. package/lib/module/theme/color-scope/resolve-scope.js.map +1 -1
  351. package/lib/module/theme/color-scope/use-scope.js +2 -6
  352. package/lib/module/theme/color-scope/use-scope.js.map +1 -1
  353. package/lib/module/theme/color-tokens.js +30 -8
  354. package/lib/module/theme/color-tokens.js.map +1 -1
  355. package/lib/module/theme/color-utils.js +4 -0
  356. package/lib/module/theme/color-utils.js.map +1 -1
  357. package/lib/module/theme/default-token-vars.js +88 -0
  358. package/lib/module/theme/default-token-vars.js.map +1 -0
  359. package/lib/module/theme/index.js +1 -1
  360. package/lib/module/theme/index.js.map +1 -1
  361. package/lib/module/theme/index.web.js +1 -1
  362. package/lib/module/theme/index.web.js.map +1 -1
  363. package/lib/module/theme/prepaint-palettes.js +2 -6
  364. package/lib/module/theme/prepaint-palettes.js.map +1 -1
  365. package/lib/module/theme/token-registry.js +1 -27
  366. package/lib/module/theme/token-registry.js.map +1 -1
  367. package/lib/module/theme/use-theme-paint.js +30 -3
  368. package/lib/module/theme/use-theme-paint.js.map +1 -1
  369. package/lib/module/typography/Typography.js +27 -27
  370. package/lib/module/typography/Typography.js.map +1 -1
  371. package/lib/module/web-search/WebSearch.js +18 -19
  372. package/lib/module/web-search/WebSearch.js.map +1 -1
  373. package/lib/module/wizard/WizardFooterBase.js +10 -10
  374. package/lib/module/wizard/WizardFooterBase.js.map +1 -1
  375. package/lib/module/wizard/WizardProgress.js +5 -5
  376. package/lib/module/wizard/WizardProgress.js.map +1 -1
  377. package/lib/typescript/commonjs/agent-creator/AgentCreatorSection.d.ts.map +1 -1
  378. package/lib/typescript/commonjs/agent-log/AgentLog.d.ts.map +1 -1
  379. package/lib/typescript/commonjs/agent-reply/AgentProfile.d.ts.map +1 -1
  380. package/lib/typescript/commonjs/agent-thinking/AgentThinking.d.ts.map +1 -1
  381. package/lib/typescript/commonjs/app-shell/AppShellEngine.d.ts.map +1 -1
  382. package/lib/typescript/commonjs/dialog/DialogContent.d.ts.map +1 -1
  383. package/lib/typescript/commonjs/dialog/DialogHeader.d.ts.map +1 -1
  384. package/lib/typescript/commonjs/dialog/SheetShell.d.ts.map +1 -1
  385. package/lib/typescript/commonjs/floating/lens/lens-cover.d.ts +15 -0
  386. package/lib/typescript/commonjs/floating/lens/lens-cover.d.ts.map +1 -0
  387. package/lib/typescript/commonjs/floating/lens/native-lens.d.ts +6 -0
  388. package/lib/typescript/commonjs/floating/lens/native-lens.d.ts.map +1 -1
  389. package/lib/typescript/commonjs/grouped-section/GroupedSection.d.ts.map +1 -1
  390. package/lib/typescript/commonjs/layout/ResizeHandle.d.ts.map +1 -1
  391. package/lib/typescript/commonjs/list/ListBase.d.ts.map +1 -1
  392. package/lib/typescript/commonjs/multi-agent-chat/MultiAgentChatBase.d.ts.map +1 -1
  393. package/lib/typescript/commonjs/overlay/OverlayInertBoundary.d.ts.map +1 -1
  394. package/lib/typescript/commonjs/panel-routing/expo-router/StackScene.d.ts +3 -1
  395. package/lib/typescript/commonjs/panel-routing/expo-router/StackScene.d.ts.map +1 -1
  396. package/lib/typescript/commonjs/project-board/ProjectBoardBase.d.ts.map +1 -1
  397. package/lib/typescript/commonjs/project-board/styles.d.ts.map +1 -1
  398. package/lib/typescript/commonjs/stay-search/GuestPicker.d.ts.map +1 -1
  399. package/lib/typescript/commonjs/stepper/Stepper.d.ts.map +1 -1
  400. package/lib/typescript/commonjs/task-list/TaskList.d.ts +3 -3
  401. package/lib/typescript/commonjs/task-list/TaskList.d.ts.map +1 -1
  402. package/lib/typescript/commonjs/theme/BloomThemeProvider.d.ts.map +1 -1
  403. package/lib/typescript/commonjs/theme/build-theme.d.ts +9 -0
  404. package/lib/typescript/commonjs/theme/build-theme.d.ts.map +1 -1
  405. package/lib/typescript/commonjs/theme/canonical-tokens.d.ts +20 -0
  406. package/lib/typescript/commonjs/theme/canonical-tokens.d.ts.map +1 -0
  407. package/lib/typescript/commonjs/theme/color-policy.d.ts.map +1 -1
  408. package/lib/typescript/commonjs/theme/color-scope/resolve-scope.d.ts +58 -0
  409. package/lib/typescript/commonjs/theme/color-scope/resolve-scope.d.ts.map +1 -1
  410. package/lib/typescript/commonjs/theme/color-scope/use-scope.d.ts.map +1 -1
  411. package/lib/typescript/commonjs/theme/color-tokens.d.ts +5 -2
  412. package/lib/typescript/commonjs/theme/color-tokens.d.ts.map +1 -1
  413. package/lib/typescript/commonjs/theme/color-utils.d.ts +3 -0
  414. package/lib/typescript/commonjs/theme/color-utils.d.ts.map +1 -1
  415. package/lib/typescript/commonjs/theme/default-token-vars.d.ts +11 -0
  416. package/lib/typescript/commonjs/theme/default-token-vars.d.ts.map +1 -0
  417. package/lib/typescript/commonjs/theme/index.d.ts +1 -1
  418. package/lib/typescript/commonjs/theme/index.d.ts.map +1 -1
  419. package/lib/typescript/commonjs/theme/index.web.d.ts +1 -1
  420. package/lib/typescript/commonjs/theme/index.web.d.ts.map +1 -1
  421. package/lib/typescript/commonjs/theme/prepaint-palettes.d.ts.map +1 -1
  422. package/lib/typescript/commonjs/theme/token-registry.d.ts +1 -16
  423. package/lib/typescript/commonjs/theme/token-registry.d.ts.map +1 -1
  424. package/lib/typescript/commonjs/theme/use-theme-paint.d.ts +11 -0
  425. package/lib/typescript/commonjs/theme/use-theme-paint.d.ts.map +1 -1
  426. package/lib/typescript/commonjs/web-search/WebSearch.d.ts +3 -3
  427. package/lib/typescript/commonjs/web-search/WebSearch.d.ts.map +1 -1
  428. package/lib/typescript/module/agent-creator/AgentCreatorSection.d.ts.map +1 -1
  429. package/lib/typescript/module/agent-log/AgentLog.d.ts.map +1 -1
  430. package/lib/typescript/module/agent-reply/AgentProfile.d.ts.map +1 -1
  431. package/lib/typescript/module/agent-thinking/AgentThinking.d.ts.map +1 -1
  432. package/lib/typescript/module/app-shell/AppShellEngine.d.ts.map +1 -1
  433. package/lib/typescript/module/dialog/DialogContent.d.ts.map +1 -1
  434. package/lib/typescript/module/dialog/DialogHeader.d.ts.map +1 -1
  435. package/lib/typescript/module/dialog/SheetShell.d.ts.map +1 -1
  436. package/lib/typescript/module/floating/lens/lens-cover.d.ts +15 -0
  437. package/lib/typescript/module/floating/lens/lens-cover.d.ts.map +1 -0
  438. package/lib/typescript/module/floating/lens/native-lens.d.ts +6 -0
  439. package/lib/typescript/module/floating/lens/native-lens.d.ts.map +1 -1
  440. package/lib/typescript/module/grouped-section/GroupedSection.d.ts.map +1 -1
  441. package/lib/typescript/module/layout/ResizeHandle.d.ts.map +1 -1
  442. package/lib/typescript/module/list/ListBase.d.ts.map +1 -1
  443. package/lib/typescript/module/multi-agent-chat/MultiAgentChatBase.d.ts.map +1 -1
  444. package/lib/typescript/module/overlay/OverlayInertBoundary.d.ts.map +1 -1
  445. package/lib/typescript/module/panel-routing/expo-router/StackScene.d.ts +3 -1
  446. package/lib/typescript/module/panel-routing/expo-router/StackScene.d.ts.map +1 -1
  447. package/lib/typescript/module/project-board/ProjectBoardBase.d.ts.map +1 -1
  448. package/lib/typescript/module/project-board/styles.d.ts.map +1 -1
  449. package/lib/typescript/module/stay-search/GuestPicker.d.ts.map +1 -1
  450. package/lib/typescript/module/stepper/Stepper.d.ts.map +1 -1
  451. package/lib/typescript/module/task-list/TaskList.d.ts +3 -3
  452. package/lib/typescript/module/task-list/TaskList.d.ts.map +1 -1
  453. package/lib/typescript/module/theme/BloomThemeProvider.d.ts.map +1 -1
  454. package/lib/typescript/module/theme/build-theme.d.ts +9 -0
  455. package/lib/typescript/module/theme/build-theme.d.ts.map +1 -1
  456. package/lib/typescript/module/theme/canonical-tokens.d.ts +20 -0
  457. package/lib/typescript/module/theme/canonical-tokens.d.ts.map +1 -0
  458. package/lib/typescript/module/theme/color-policy.d.ts.map +1 -1
  459. package/lib/typescript/module/theme/color-scope/resolve-scope.d.ts +58 -0
  460. package/lib/typescript/module/theme/color-scope/resolve-scope.d.ts.map +1 -1
  461. package/lib/typescript/module/theme/color-scope/use-scope.d.ts.map +1 -1
  462. package/lib/typescript/module/theme/color-tokens.d.ts +5 -2
  463. package/lib/typescript/module/theme/color-tokens.d.ts.map +1 -1
  464. package/lib/typescript/module/theme/color-utils.d.ts +3 -0
  465. package/lib/typescript/module/theme/color-utils.d.ts.map +1 -1
  466. package/lib/typescript/module/theme/default-token-vars.d.ts +11 -0
  467. package/lib/typescript/module/theme/default-token-vars.d.ts.map +1 -0
  468. package/lib/typescript/module/theme/index.d.ts +1 -1
  469. package/lib/typescript/module/theme/index.d.ts.map +1 -1
  470. package/lib/typescript/module/theme/index.web.d.ts +1 -1
  471. package/lib/typescript/module/theme/index.web.d.ts.map +1 -1
  472. package/lib/typescript/module/theme/prepaint-palettes.d.ts.map +1 -1
  473. package/lib/typescript/module/theme/token-registry.d.ts +1 -16
  474. package/lib/typescript/module/theme/token-registry.d.ts.map +1 -1
  475. package/lib/typescript/module/theme/use-theme-paint.d.ts +11 -0
  476. package/lib/typescript/module/theme/use-theme-paint.d.ts.map +1 -1
  477. package/lib/typescript/module/web-search/WebSearch.d.ts +3 -3
  478. package/lib/typescript/module/web-search/WebSearch.d.ts.map +1 -1
  479. package/package.json +2 -1
  480. package/src/accordion/Accordion.tsx +6 -6
  481. package/src/accordion/Accordion.web.tsx +6 -6
  482. package/src/agent-creator/AgentCreatorSection.tsx +4 -6
  483. package/src/agent-creator/EmotionPicker.tsx +3 -3
  484. package/src/agent-log/AgentLog.tsx +8 -21
  485. package/src/agent-reply/AgentProfile.tsx +4 -5
  486. package/src/agent-thinking/AgentThinking.tsx +4 -3
  487. package/src/agent-thinking/ThinkingReasoning.tsx +4 -4
  488. package/src/app-shell/AppShell.tsx +3 -3
  489. package/src/app-shell/AppShellEngine.tsx +67 -19
  490. package/src/app-shell/AppShellPanelLayout.tsx +3 -3
  491. package/src/app-shell/NotificationBell.tsx +6 -6
  492. package/src/app-shell/PanelReorderHandle.tsx +4 -4
  493. package/src/avatar-group/AvatarGroupBase.tsx +6 -6
  494. package/src/chat-list/ChatSearchResultsBase.tsx +4 -4
  495. package/src/choice-list/ChoiceList.tsx +3 -3
  496. package/src/color-swatch-picker/ColorSwatchPicker.tsx +4 -4
  497. package/src/connection-dots/ConnectionDots.tsx +4 -4
  498. package/src/connection-dots/ConnectionDots.web.tsx +4 -4
  499. package/src/cover-header/CoverHeader.tsx +3 -3
  500. package/src/data-table/DataTableSelect.tsx +4 -4
  501. package/src/design-tokens/theme.css +1 -0
  502. package/src/design-tokens/tokens.json +390 -0
  503. package/src/dialog/DialogContent.tsx +3 -2
  504. package/src/dialog/DialogHeader.tsx +6 -5
  505. package/src/dialog/SheetShell.tsx +3 -2
  506. package/src/expandable-text/ExpandableText.tsx +3 -3
  507. package/src/floating/lens/lens-cover.tsx +29 -0
  508. package/src/floating/lens/native-lens.ts +2 -0
  509. package/src/grouped-section/GroupedSection.tsx +7 -6
  510. package/src/home-search/BudgetPicker.tsx +4 -4
  511. package/src/home-search/MoveInPicker.tsx +3 -3
  512. package/src/icon-circle/IconCircle.tsx +5 -5
  513. package/src/icons/shared.tsx +3 -3
  514. package/src/kbd/Kbd.tsx +4 -4
  515. package/src/layout/ResizeHandle.tsx +7 -5
  516. package/src/link-preview/LinkPreviewCard.tsx +7 -7
  517. package/src/list/ListBase.tsx +3 -6
  518. package/src/list/ListPerson.tsx +3 -3
  519. package/src/listing-editor/ListingPreviewPane.tsx +13 -13
  520. package/src/markdown/InlineMarkdown.tsx +3 -3
  521. package/src/markdown/MarkdownBlocks.tsx +14 -14
  522. package/src/multi-agent-chat/MultiAgentChatBase.tsx +6 -9
  523. package/src/multi-agent-chat/SelectedAgentPreview.tsx +4 -4
  524. package/src/notifications/NotificationPermissionSheet.tsx +3 -3
  525. package/src/notifications/NotificationsScreen.tsx +9 -9
  526. package/src/overlay/OverlayInertBoundary.tsx +10 -1
  527. package/src/page-header/PageHeaderTitleInput.tsx +4 -4
  528. package/src/panel-routing/expo-router/StackScene.tsx +7 -2
  529. package/src/phone-input/CountryCodeSelect.tsx +4 -4
  530. package/src/project-board/MemberAvatars.tsx +3 -3
  531. package/src/project-board/ProjectBoardBase.tsx +4 -5
  532. package/src/project-board/ProjectBoardCanvas.tsx +2 -2
  533. package/src/project-board/styles.ts +3 -4
  534. package/src/radio/RadioSwatch.tsx +3 -3
  535. package/src/rating/Rating.tsx +5 -5
  536. package/src/rating/RatingBar.tsx +4 -4
  537. package/src/rating/RatingBar.web.tsx +3 -3
  538. package/src/rating/RatingInput.tsx +5 -5
  539. package/src/rating/RatingSummary.tsx +4 -4
  540. package/src/row-actions/RowActions.tsx +3 -3
  541. package/src/select/Select.tsx +3 -3
  542. package/src/skeleton/Skeleton.tsx +9 -9
  543. package/src/stay-filters/AvailabilityFilter.tsx +3 -3
  544. package/src/stay-filters/CountFilter.tsx +3 -3
  545. package/src/stay-filters/FilterFooter.tsx +4 -4
  546. package/src/stay-filters/FilterSection.tsx +5 -5
  547. package/src/stay-filters/SwitchFilterRow.tsx +4 -4
  548. package/src/stay-search/GuestPicker.tsx +3 -6
  549. package/src/stepper/Stepper.tsx +6 -5
  550. package/src/stepper/StepperRow.tsx +5 -5
  551. package/src/subscription-plans/SubscriptionPlans.tsx +6 -6
  552. package/src/subscription-plans/SubscriptionPrice.tsx +3 -3
  553. package/src/task-list/TaskList.tsx +14 -16
  554. package/src/theme/BloomThemeProvider.tsx +33 -33
  555. package/src/theme/__tests__/__fixtures__/golden-resolved-tokens.json +134 -0
  556. package/src/theme/build-theme-from-seed.ts +1 -1
  557. package/src/theme/build-theme.ts +52 -11
  558. package/src/theme/canonical-tokens.ts +108 -0
  559. package/src/theme/color-policy.ts +3 -0
  560. package/src/theme/color-scope/resolve-scope.ts +47 -8
  561. package/src/theme/color-scope/use-scope.ts +2 -6
  562. package/src/theme/color-tokens.ts +7 -7
  563. package/src/theme/color-utils.ts +4 -0
  564. package/src/theme/default-token-vars.ts +86 -0
  565. package/src/theme/index.ts +1 -1
  566. package/src/theme/index.web.ts +1 -1
  567. package/src/theme/prepaint-palettes.ts +2 -3
  568. package/src/theme/token-registry.ts +1 -101
  569. package/src/theme/use-theme-paint.ts +26 -3
  570. package/src/typography/Typography.tsx +12 -12
  571. package/src/web-search/WebSearch.tsx +16 -18
  572. package/src/wizard/WizardFooterBase.tsx +5 -5
  573. package/src/wizard/WizardProgress.tsx +5 -5
@@ -71,7 +71,7 @@ function buildSeedThemeValues(
71
71
  // The same ONE quiet-text colour `build-theme.ts` resolves — see the long
72
72
  // note there. The parity suite walks every preset through both paths, so a
73
73
  // change on one side that is not made on the other goes red.
74
- textTertiary: g('muted-foreground'),
74
+ textTertiary: g('faint-foreground'),
75
75
 
76
76
  border: g('border'),
77
77
  borderLight: g('input'),
@@ -3,7 +3,10 @@ import { Platform } from 'react-native';
3
3
  import { APP_COLOR_PRESETS, type AppColorName } from './color-presets';
4
4
  import { generateRoleColors, type RoleColors } from './color-engine';
5
5
  import type { ExplicitAccents } from './preset-vars';
6
- import { getAdaptiveColors } from './adaptive-colors';
6
+ import { type AdaptiveColors, getAdaptiveColors } from './adaptive-colors';
7
+ import type { ScopePalette } from './color-scope/context';
8
+ import { withFieldColors } from './color-scope/resolve-scope';
9
+ import { buildScopeVars } from './color-scope/style-builder';
7
10
  import { getResolvedTokens } from './token-registry';
8
11
  import { THEME_GRADIENTS } from './gradients';
9
12
  import type { Theme } from './types';
@@ -78,7 +81,11 @@ function buildColorsFromPreset(
78
81
  // asked for against the fill it lands on, which is what
79
82
  // `styles/surface-levels.ts` `surfaceTextOn()` returns and what every family
80
83
  // that wants a caption grey now calls.
81
- textTertiary: g('muted-foreground'),
84
+ //
85
+ // It has a token of its own, `--faint-foreground`, which the policy holds at
86
+ // `--muted-foreground`'s colour: in an adaptive theme the platform answers
87
+ // it with its own tertiary label, and that token carries it.
88
+ textTertiary: g('faint-foreground'),
82
89
 
83
90
  border: g('border'),
84
91
  borderLight: g('input'),
@@ -165,20 +172,18 @@ function buildColorsFromPreset(
165
172
  };
166
173
  }
167
174
 
168
- /**
169
- * Build a `Theme` from a color preset and a resolved light/dark mode.
170
- *
171
- * When `isAdaptive` is true and the platform exposes adaptive (Material You /
172
- * iOS dynamic) colors, those override the preset-derived palette.
173
- */
174
- export function buildTheme(
175
+ /** The platform's palette (Material You, iOS dynamic) when the theme is adaptive: none on the web. */
176
+ function platformColors(isAdaptive: boolean): AdaptiveColors | null {
177
+ return isAdaptive && Platform.OS !== 'web' ? getAdaptiveColors() : null;
178
+ }
179
+
180
+ function themeOf(
175
181
  preset: AppColorName,
176
182
  resolved: 'light' | 'dark',
177
- isAdaptive: boolean = false,
183
+ adaptive: AdaptiveColors | null,
178
184
  accents?: ExplicitAccents,
179
185
  ): Theme {
180
186
  const { colors: base, chartColors } = buildColorsFromPreset(preset, resolved, accents);
181
- const adaptive = isAdaptive && Platform.OS !== 'web' ? getAdaptiveColors() : undefined;
182
187
  // The platform palette OVERLAYS the preset one rather than replacing it. Every
183
188
  // field the platform answers still wins, byte for byte; the tinted status
184
189
  // members — which Material You and iOS dynamic have no role for at all — fall
@@ -194,3 +199,39 @@ export function buildTheme(
194
199
  isLight: resolved === 'light',
195
200
  };
196
201
  }
202
+
203
+ /**
204
+ * Build a `Theme` from a color preset and a resolved light/dark mode.
205
+ *
206
+ * When `isAdaptive` is true and the platform exposes adaptive (Material You /
207
+ * iOS dynamic) colors, those override the preset-derived palette.
208
+ */
209
+ export function buildTheme(
210
+ preset: AppColorName,
211
+ resolved: 'light' | 'dark',
212
+ isAdaptive: boolean = false,
213
+ accents?: ExplicitAccents,
214
+ ): Theme {
215
+ return themeOf(preset, resolved, platformColors(isAdaptive), accents);
216
+ }
217
+
218
+ /**
219
+ * A preset's one resolved palette: the theme `useTheme()` reads and the token
220
+ * record `useColorTokens()` reads. In an adaptive theme on Android and iOS the
221
+ * platform's colours overlay both, each token taking the colour of the
222
+ * `theme.colors` field it feeds (`COLOR_FIELDS`), so the two readers never
223
+ * disagree in any mode.
224
+ */
225
+ export function buildPresetPalette(
226
+ preset: AppColorName,
227
+ resolved: 'light' | 'dark',
228
+ isAdaptive: boolean = false,
229
+ accents?: ExplicitAccents,
230
+ ): ScopePalette {
231
+ const adaptive = platformColors(isAdaptive);
232
+ const vars = buildScopeVars(preset, resolved, accents);
233
+ return {
234
+ theme: themeOf(preset, resolved, adaptive, accents),
235
+ vars: adaptive ? withFieldColors(vars, adaptive) : vars,
236
+ };
237
+ }
@@ -0,0 +1,108 @@
1
+ /**
2
+ * The canonical set of Bloom theme token names — WITHOUT the leading `--`.
3
+ *
4
+ * This is the single source of truth for which tokens a preset produces. It
5
+ * covers exactly the keys returned by `getPresetVars(name, mode)` (the base
6
+ * shadcn palette plus the synthesized extended tokens: card/chart/content-area/
7
+ * sidebar-*). The list is intentionally hand-maintained and verified by
8
+ * `token-registry.test.ts` against the live `getPresetVars('oxy', 'light')`
9
+ * output, so any drift in the preset shape fails CI.
10
+ *
11
+ * Order mirrors `getPresetVars`'s insertion order: base tokens first (in the
12
+ * order they appear in the preset data), then the synthesized extended tokens.
13
+ *
14
+ * It imports nothing, so a reader of the names (`useColorTokens`) does not pull
15
+ * in the colour engine; `token-registry` re-exports it.
16
+ */
17
+ export const CANONICAL_TOKENS = [
18
+ 'background',
19
+ 'foreground',
20
+ 'surface',
21
+ 'surface-foreground',
22
+ 'popover',
23
+ 'popover-foreground',
24
+ 'primary',
25
+ 'primary-foreground',
26
+ 'secondary',
27
+ 'secondary-foreground',
28
+ 'tertiary',
29
+ 'tertiary-foreground',
30
+ 'muted',
31
+ 'muted-foreground',
32
+ // The tertiary text: `theme.colors.textTertiary`. Every preset holds it at
33
+ // `muted-foreground` (one legible quiet text, `build-theme.ts`); in an adaptive
34
+ // theme the platform answers it with its own tertiary label.
35
+ 'faint-foreground',
36
+ 'accent',
37
+ 'accent-foreground',
38
+ 'destructive',
39
+ 'border',
40
+ 'input',
41
+ 'ring',
42
+ 'sidebar',
43
+ 'card',
44
+ 'card-foreground',
45
+ 'chart-1',
46
+ 'chart-2',
47
+ 'chart-3',
48
+ 'chart-4',
49
+ 'chart-5',
50
+ 'chart-6',
51
+ 'chart-7',
52
+ 'chart-8',
53
+ 'chart-9',
54
+ 'chart-1-active',
55
+ 'chart-2-active',
56
+ 'chart-3-active',
57
+ 'chart-4-active',
58
+ 'chart-5-active',
59
+ 'chart-6-active',
60
+ 'chart-7-active',
61
+ 'chart-8-active',
62
+ 'chart-9-active',
63
+ 'content-area',
64
+ 'sidebar-foreground',
65
+ 'sidebar-primary',
66
+ 'sidebar-primary-foreground',
67
+ 'sidebar-accent',
68
+ 'sidebar-accent-foreground',
69
+ 'sidebar-border',
70
+ 'sidebar-ring',
71
+
72
+ // --- the accent families ---
73
+ // Each accent is a FAMILY, not a colour: a fill, the label that is legible on
74
+ // it, a `-text` form for a mark on the page, and a `-subtle` translucent tint
75
+ // for the surface behind one. A single value can only ever be a fill, which is
76
+ // why consumers hand-rolled the rest with hex-alpha arithmetic.
77
+ 'primary-text',
78
+ 'vivid',
79
+ 'vivid-foreground',
80
+ 'primary-subtle',
81
+ 'secondary-text',
82
+ 'secondary-subtle',
83
+ 'tertiary-text',
84
+ 'tertiary-subtle',
85
+
86
+ // --- semantic status, themed per mode ---
87
+ // Replaces four frozen hexes that all FAILED AA under white text (warning at
88
+ // 2.15, success 2.54, info 3.68, error 3.76) and had no subtle or text member.
89
+ 'success',
90
+ 'success-foreground',
91
+ 'success-text',
92
+ 'success-subtle',
93
+ 'error',
94
+ 'error-foreground',
95
+ 'error-text',
96
+ 'error-subtle',
97
+ 'warning',
98
+ 'warning-foreground',
99
+ 'warning-text',
100
+ 'warning-subtle',
101
+ 'info',
102
+ 'info-foreground',
103
+ 'info-text',
104
+ 'info-subtle',
105
+ ] as const;
106
+
107
+ /** A canonical token name (no leading `--`). */
108
+ export type CanonicalToken = (typeof CANONICAL_TOKENS)[number];
@@ -603,6 +603,9 @@ export function buildPolicyTokens(
603
603
  '--popover-foreground': monochrome ? roles.onSurface : foreground,
604
604
  '--sidebar-foreground': monochrome ? roles.onSurface : foreground,
605
605
  '--muted-foreground': monochrome ? roles.onSurfaceVariant : mutedForeground,
606
+ // The tertiary text is the quiet text: a fixed third grey is measured on one
607
+ // surface and lands on all of them (`build-theme.ts`, `textTertiary`).
608
+ '--faint-foreground': monochrome ? roles.onSurfaceVariant : mutedForeground,
606
609
  '--border': monochrome ? roles.outlineVariant : boundary,
607
610
  '--input': monochrome ? roles.outlineVariant : boundary,
608
611
  '--sidebar-border': monochrome ? roles.outlineVariant : boundary,
@@ -6,13 +6,18 @@ import type { ScopePalette } from './context';
6
6
  import { withScopeAliases } from './seed-scope';
7
7
  import type { BloomColorScopeTokens } from './types';
8
8
 
9
- /** All JS aliases of an exact canonical override share the same supplied value. */
10
- const COLOR_FIELDS = {
9
+ /**
10
+ * The `theme.colors` fields each canonical token feeds. The first is the
11
+ * token's own field, the one `buildTheme` reads from it (`--muted-foreground`
12
+ * is `textSecondary`); the rest are aliases an exact override also sets.
13
+ */
14
+ export const COLOR_FIELDS = {
11
15
  background: ['background', 'primaryDark'],
12
16
  foreground: ['text'],
13
17
  surface: ['backgroundSecondary', 'primaryLight'],
14
18
  popover: ['backgroundTertiary'],
15
- 'muted-foreground': ['textSecondary', 'textTertiary', 'icon'],
19
+ 'muted-foreground': ['textSecondary', 'icon'],
20
+ 'faint-foreground': ['textTertiary'],
16
21
  border: ['border'],
17
22
  input: ['borderLight'],
18
23
  primary: ['primary', 'tint', 'iconActive'],
@@ -50,7 +55,43 @@ const COLOR_FIELDS = {
50
55
  destructive: ['destructive'],
51
56
  'surface-foreground': ['surfaceForeground'],
52
57
  accent: ['accent'],
53
- } satisfies Partial<Record<CanonicalToken, readonly (keyof ThemeColors)[]>>;
58
+ } satisfies Partial<Record<CanonicalToken, readonly [keyof ThemeColors, ...(keyof ThemeColors)[]]>>;
59
+
60
+ /** A token record without its `--color-*` aliases, rebuilt after its tokens change. */
61
+ function withoutAliases(vars: Record<string, string>): Record<string, string> {
62
+ return Object.fromEntries(Object.entries(vars).filter(([name]) => !name.startsWith('--color-')));
63
+ }
64
+
65
+ /**
66
+ * A token record whose tokens take the colours `colors` holds, each the colour
67
+ * of the token's own field (`COLOR_FIELDS`), with the aliases rebuilt. The
68
+ * provider's record in an adaptive theme, so `useColorTokens()` paints the
69
+ * platform's colours exactly where `useTheme().colors` holds them.
70
+ */
71
+ export function withFieldColors(
72
+ vars: Record<string, string>,
73
+ colors: Partial<ThemeColors>,
74
+ ): Record<string, string> {
75
+ const next = withoutAliases(vars);
76
+ for (const [name, [field]] of Object.entries(COLOR_FIELDS)) {
77
+ const value = colors[field];
78
+ if (value !== undefined) next[`--${name}`] = value;
79
+ }
80
+ return withScopeAliases(next);
81
+ }
82
+
83
+ /**
84
+ * The tertiary text follows an exact `muted-foreground`, unless the scope names
85
+ * `faint-foreground` too. Every preset holds the two at one colour (the one
86
+ * legible quiet text), so a scope that sets its quiet text on its own fill
87
+ * keeps its tertiary text legible there, as it did before the token existed,
88
+ * instead of painting the preset's grey on a fill it was never measured on.
89
+ */
90
+ function withFaintText(overrides: BloomColorScopeTokens): BloomColorScopeTokens {
91
+ const muted = overrides['muted-foreground'];
92
+ if (muted === undefined || overrides['faint-foreground'] !== undefined) return overrides;
93
+ return { ...overrides, 'faint-foreground': muted };
94
+ }
54
95
 
55
96
  /** Preserve unspecified roles; rebuild the full CSS alias layer after exact overrides. */
56
97
  export function applyScopeTokens(
@@ -61,7 +102,7 @@ export function applyScopeTokens(
61
102
  const vars = { ...base.vars };
62
103
  const colors = { ...base.theme.colors };
63
104
  let changedCharts = false;
64
- for (const [name, value] of Object.entries(overrides)) {
105
+ for (const [name, value] of Object.entries(withFaintText(overrides))) {
65
106
  if (value === undefined) continue;
66
107
  if (!(CANONICAL_TOKENS as readonly string[]).includes(name)) {
67
108
  throw new Error(`BloomColorScope: unknown canonical token "${name}".`);
@@ -75,9 +116,7 @@ export function applyScopeTokens(
75
116
  if (name.startsWith('chart-')) changedCharts = true;
76
117
  }
77
118
  return {
78
- vars: withScopeAliases(
79
- Object.fromEntries(Object.entries(vars).filter(([name]) => !name.startsWith('--color-'))),
80
- ),
119
+ vars: withScopeAliases(withoutAliases(vars)),
81
120
  theme: {
82
121
  ...base.theme,
83
122
  colors,
@@ -1,11 +1,10 @@
1
1
  import { useContext, useMemo } from 'react';
2
2
  import { BloomThemeContext } from '../BloomThemeProvider';
3
- import { buildTheme } from '../build-theme';
3
+ import { buildPresetPalette } from '../build-theme';
4
4
  import { buildThemeFromSeed } from '../build-theme-from-seed';
5
5
  import { buildSeedScopeVars } from './seed-scope';
6
6
  import type { AppColorName } from '../color-presets';
7
7
  import { ThemeScopeContext, type ScopePalette, type ScopeState } from './context';
8
- import { buildScopeVars } from './style-builder';
9
8
  import { applyScopeTokens } from './resolve-scope';
10
9
  import type { BloomColorScopeTokens } from './types';
11
10
 
@@ -44,10 +43,7 @@ export function useScope(
44
43
  vars: buildSeedScopeVars({ seed, mode: resolved }),
45
44
  }
46
45
  : colorPreset !== undefined || !inherited
47
- ? {
48
- theme: buildTheme(colorPreset ?? preset, resolved),
49
- vars: buildScopeVars(colorPreset ?? preset, resolved),
50
- }
46
+ ? buildPresetPalette(colorPreset ?? preset, resolved)
51
47
  : (inherited.resolvePreset?.(preset, resolved) ?? inherited.resolveMode(resolved));
52
48
  const palette = applyScopeTokens(base, tokens);
53
49
  palettes.set(key, palette);
@@ -2,9 +2,9 @@ import { useContext } from 'react';
2
2
  import { StyleSheet } from 'react-native';
3
3
  import { IS_WEB } from '../styles/platform';
4
4
  import { ThemeScopeContext } from './color-scope/context';
5
- import { buildScopeVars } from './color-scope/style-builder';
6
5
  import { parseRgba } from './color-utils';
7
- import { CANONICAL_TOKENS, type CanonicalToken } from './token-registry';
6
+ import { DEFAULT_TOKEN_VARS } from './default-token-vars';
7
+ import { CANONICAL_TOKENS, type CanonicalToken } from './canonical-tokens';
8
8
 
9
9
  /** `primary-foreground` → `primaryForeground`, `chart-1-active` → `chart1Active`. */
10
10
  type Camel<S extends string> = S extends `${infer Head}-${infer Tail}`
@@ -47,22 +47,22 @@ function tokensOf(vars: Record<string, string>): ColorTokens {
47
47
  return tokens;
48
48
  }
49
49
 
50
- let fallbackVars: Record<string, string> | undefined;
51
-
52
50
  /**
53
51
  * The colour tokens of the theme or colour scope a component is drawn in.
54
52
  *
55
53
  * Native reads the nearest scope's token record (the provider's, a
56
54
  * `BloomColorScope`'s, a `BloomSeedScope`'s, or the one a portal bridge
57
55
  * carries): the same values the theme publishes, in an adaptive theme as well.
58
- * The web returns the CSS variables, which the cascade resolves.
56
+ * Outside any provider it reads Bloom's default palette (`oxy`, light), from a
57
+ * generated table (`default-token-vars.ts`), so a component that paints
58
+ * through the tokens does not import the colour engine. The web returns the
59
+ * CSS variables, which the cascade resolves.
59
60
  */
60
61
  export function useColorTokens(): ColorTokens {
61
62
  const scope = useContext(ThemeScopeContext);
62
63
  if (IS_WEB) return WEB_TOKENS;
63
64
  if (scope) return tokensOf(scope.vars);
64
- fallbackVars ??= buildScopeVars('oxy', 'light');
65
- return tokensOf(fallbackVars);
65
+ return tokensOf(DEFAULT_TOKEN_VARS);
66
66
  }
67
67
 
68
68
  /**
@@ -36,8 +36,12 @@ export interface RgbaChannels extends RgbChannels {
36
36
  * resolve to `rgba(r, g, b, 0.13)` in light and `0.24` in dark, so anything
37
37
  * compositing onto a tint has to know it is compositing onto something
38
38
  * translucent — dropping the alpha silently turns a tint into an opaque fill.
39
+ *
40
+ * A platform colour (iOS dynamic, Material You: a `PlatformColor` object in an
41
+ * adaptive theme) is not a string and yields `null` as well.
39
42
  */
40
43
  export function parseRgba(color: string): RgbaChannels | null {
44
+ if (typeof color !== 'string') return null;
41
45
  const trimmed = color.trim();
42
46
  if (trimmed.startsWith('#')) {
43
47
  let hex = trimmed.slice(1);
@@ -0,0 +1,86 @@
1
+ /**
2
+ * AUTO-GENERATED by scripts/generate-default-token-vars.ts — DO NOT EDIT.
3
+ * Re-run `bun run generate:default-token-vars` after changing the oxy preset or
4
+ * the colour policy; default-token-vars.test.ts fails until then.
5
+ *
6
+ * Bloom's default palette (`oxy`, light): every canonical token's value, as
7
+ * `buildScopeVars('oxy', 'light')` resolves it.
8
+ */
9
+ import type { CanonicalToken } from './canonical-tokens';
10
+
11
+ export const DEFAULT_TOKEN_VARS: Readonly<Record<`--${CanonicalToken}`, string>> = {
12
+ '--background': 'rgb(247 235 240)',
13
+ '--foreground': 'rgb(42 17 50)',
14
+ '--surface': 'rgb(241 221 233)',
15
+ '--surface-foreground': 'rgb(42 17 50)',
16
+ '--popover': 'rgb(237 206 228)',
17
+ '--popover-foreground': 'rgb(42 17 50)',
18
+ '--primary': 'rgb(148 34 174)',
19
+ '--primary-foreground': 'rgb(255 238 252)',
20
+ '--secondary': 'rgb(143 57 135)',
21
+ '--secondary-foreground': 'rgb(255 238 248)',
22
+ '--tertiary': 'rgb(160 57 43)',
23
+ '--tertiary-foreground': 'rgb(255 239 237)',
24
+ '--muted': 'rgb(231 193 221)',
25
+ '--muted-foreground': 'rgb(89 60 96)',
26
+ '--faint-foreground': 'rgb(89 60 96)',
27
+ '--accent': 'rgb(231 193 221)',
28
+ '--accent-foreground': 'rgb(89 60 96)',
29
+ '--destructive': 'rgb(186 26 26)',
30
+ '--border': 'rgb(201 165 207)',
31
+ '--input': 'rgb(201 165 207)',
32
+ '--ring': 'rgb(148 34 174)',
33
+ '--sidebar': 'rgb(241 221 233)',
34
+ '--card': 'rgb(255 247 249)',
35
+ '--card-foreground': 'rgb(42 17 50)',
36
+ '--chart-1': 'rgb(159 81 184)',
37
+ '--chart-2': 'rgb(192 78 43)',
38
+ '--chart-3': 'rgb(123 116 0)',
39
+ '--chart-4': 'rgb(0 129 109)',
40
+ '--chart-5': 'rgb(0 118 190)',
41
+ '--chart-6': 'rgb(189 72 120)',
42
+ '--chart-7': 'rgb(160 101 0)',
43
+ '--chart-8': 'rgb(45 131 38)',
44
+ '--chart-9': 'rgb(0 125 145)',
45
+ '--chart-1-active': 'rgb(137 60 162)',
46
+ '--chart-2-active': 'rgb(165 59 25)',
47
+ '--chart-3-active': 'rgb(102 96 0)',
48
+ '--chart-4-active': 'rgb(0 107 90)',
49
+ '--chart-5-active': 'rgb(0 98 159)',
50
+ '--chart-6-active': 'rgb(164 52 100)',
51
+ '--chart-7-active': 'rgb(133 84 0)',
52
+ '--chart-8-active': 'rgb(19 110 17)',
53
+ '--chart-9-active': 'rgb(0 104 120)',
54
+ '--content-area': 'rgb(255 239 253)',
55
+ '--sidebar-foreground': 'rgb(42 17 50)',
56
+ '--sidebar-primary': 'rgb(148 34 174)',
57
+ '--sidebar-primary-foreground': 'rgb(255 238 252)',
58
+ '--sidebar-accent': 'rgb(255 189 241)',
59
+ '--sidebar-accent-foreground': 'rgb(119 35 113)',
60
+ '--sidebar-border': 'rgb(201 165 207)',
61
+ '--sidebar-ring': 'rgb(148 34 174)',
62
+ '--primary-text': 'rgb(156 0 200)',
63
+ '--vivid': 'rgb(196 110 222)',
64
+ '--vivid-foreground': 'rgb(0 0 0)',
65
+ '--primary-subtle': 'rgba(213, 86, 255, 0.13)',
66
+ '--secondary-text': 'rgb(150 56 142)',
67
+ '--secondary-subtle': 'rgba(255, 5, 248, 0.13)',
68
+ '--tertiary-text': 'rgb(167 57 42)',
69
+ '--tertiary-subtle': 'rgba(255, 85, 64, 0.13)',
70
+ '--success': 'rgb(0 121 82)',
71
+ '--success-foreground': 'rgb(255 255 255)',
72
+ '--success-text': 'rgb(0 108 73)',
73
+ '--success-subtle': 'rgba(16, 185, 129, 0.13)',
74
+ '--error': 'rgb(191 31 39)',
75
+ '--error-foreground': 'rgb(255 255 255)',
76
+ '--error-text': 'rgb(167 55 53)',
77
+ '--error-subtle': 'rgba(239, 68, 68, 0.13)',
78
+ '--warning': 'rgb(148 93 0)',
79
+ '--warning-foreground': 'rgb(255 255 255)',
80
+ '--warning-text': 'rgb(133 83 0)',
81
+ '--warning-subtle': 'rgba(245, 158, 11, 0.13)',
82
+ '--info': 'rgb(0 100 213)',
83
+ '--info-foreground': 'rgb(255 255 255)',
84
+ '--info-text': 'rgb(1 90 194)',
85
+ '--info-subtle': 'rgba(59, 130, 246, 0.13)',
86
+ };
@@ -101,7 +101,7 @@ export type {
101
101
  } from './persistence';
102
102
  export { createBloomThemeStorage, webLocalStorage } from './persistence';
103
103
 
104
- export { useThemePaint } from './use-theme-paint';
104
+ export { readThemePaint, useThemePaint } from './use-theme-paint';
105
105
  export { createTokenStyles, tokenAlpha, useColorTokens } from './color-tokens';
106
106
  export { ColorScopeLayerContext } from './color-scope/layer';
107
107
  export type { ColorScopeLayer } from './color-scope/layer';
@@ -106,7 +106,7 @@ export type {
106
106
  } from './persistence';
107
107
  export { createBloomThemeStorage, webLocalStorage } from './persistence';
108
108
 
109
- export { useThemePaint } from './use-theme-paint';
109
+ export { readThemePaint, useThemePaint } from './use-theme-paint';
110
110
  export { createTokenStyles, tokenAlpha, useColorTokens } from './color-tokens';
111
111
  export { ColorScopeLayerContext } from './color-scope/layer';
112
112
  export type { ColorScopeLayer } from './color-scope/layer';
@@ -1,5 +1,4 @@
1
- import { buildTheme } from './build-theme';
2
- import { buildScopeVars } from './color-scope/style-builder';
1
+ import { buildPresetPalette } from './build-theme';
3
2
  import type { ScopePalette } from './color-scope/context';
4
3
  import type { AppColorName } from './color-presets';
5
4
 
@@ -11,7 +10,7 @@ export function getPrepaintPalette(preset: AppColorName, mode: 'light' | 'dark')
11
10
  const key = `${preset}/${mode}`;
12
11
  let palette = palettes.get(key);
13
12
  if (!palette) {
14
- palette = { theme: buildTheme(preset, mode), vars: buildScopeVars(preset, mode) };
13
+ palette = buildPresetPalette(preset, mode);
15
14
  palettes.set(key, palette);
16
15
  }
17
16
  return palette;
@@ -1,107 +1,7 @@
1
1
  import { APP_COLOR_NAMES, type AppColorName } from './color-presets';
2
2
  import { getPresetVars, type ExplicitAccents } from './preset-vars';
3
3
 
4
- /**
5
- * The canonical set of Bloom theme token names — WITHOUT the leading `--`.
6
- *
7
- * This is the single source of truth for which tokens a preset produces. It
8
- * covers exactly the keys returned by `getPresetVars(name, mode)` (the base
9
- * shadcn palette plus the synthesized extended tokens: card/chart/content-area/
10
- * sidebar-*). The list is intentionally hand-maintained and verified by
11
- * `token-registry.test.ts` against the live `getPresetVars('oxy', 'light')`
12
- * output, so any drift in the preset shape fails CI.
13
- *
14
- * Order mirrors `getPresetVars`'s insertion order: base tokens first (in the
15
- * order they appear in the preset data), then the synthesized extended tokens.
16
- */
17
- export const CANONICAL_TOKENS = [
18
- 'background',
19
- 'foreground',
20
- 'surface',
21
- 'surface-foreground',
22
- 'popover',
23
- 'popover-foreground',
24
- 'primary',
25
- 'primary-foreground',
26
- 'secondary',
27
- 'secondary-foreground',
28
- 'tertiary',
29
- 'tertiary-foreground',
30
- 'muted',
31
- 'muted-foreground',
32
- 'accent',
33
- 'accent-foreground',
34
- 'destructive',
35
- 'border',
36
- 'input',
37
- 'ring',
38
- 'sidebar',
39
- 'card',
40
- 'card-foreground',
41
- 'chart-1',
42
- 'chart-2',
43
- 'chart-3',
44
- 'chart-4',
45
- 'chart-5',
46
- 'chart-6',
47
- 'chart-7',
48
- 'chart-8',
49
- 'chart-9',
50
- 'chart-1-active',
51
- 'chart-2-active',
52
- 'chart-3-active',
53
- 'chart-4-active',
54
- 'chart-5-active',
55
- 'chart-6-active',
56
- 'chart-7-active',
57
- 'chart-8-active',
58
- 'chart-9-active',
59
- 'content-area',
60
- 'sidebar-foreground',
61
- 'sidebar-primary',
62
- 'sidebar-primary-foreground',
63
- 'sidebar-accent',
64
- 'sidebar-accent-foreground',
65
- 'sidebar-border',
66
- 'sidebar-ring',
67
-
68
- // --- the accent families ---
69
- // Each accent is a FAMILY, not a colour: a fill, the label that is legible on
70
- // it, a `-text` form for a mark on the page, and a `-subtle` translucent tint
71
- // for the surface behind one. A single value can only ever be a fill, which is
72
- // why consumers hand-rolled the rest with hex-alpha arithmetic.
73
- 'primary-text',
74
- 'vivid',
75
- 'vivid-foreground',
76
- 'primary-subtle',
77
- 'secondary-text',
78
- 'secondary-subtle',
79
- 'tertiary-text',
80
- 'tertiary-subtle',
81
-
82
- // --- semantic status, themed per mode ---
83
- // Replaces four frozen hexes that all FAILED AA under white text (warning at
84
- // 2.15, success 2.54, info 3.68, error 3.76) and had no subtle or text member.
85
- 'success',
86
- 'success-foreground',
87
- 'success-text',
88
- 'success-subtle',
89
- 'error',
90
- 'error-foreground',
91
- 'error-text',
92
- 'error-subtle',
93
- 'warning',
94
- 'warning-foreground',
95
- 'warning-text',
96
- 'warning-subtle',
97
- 'info',
98
- 'info-foreground',
99
- 'info-text',
100
- 'info-subtle',
101
- ] as const;
102
-
103
- /** A canonical token name (no leading `--`). */
104
- export type CanonicalToken = (typeof CANONICAL_TOKENS)[number];
4
+ export { CANONICAL_TOKENS, type CanonicalToken } from './canonical-tokens';
105
5
 
106
6
  /**
107
7
  * Matches a shadcn-style raw HSL triple — `H S% L%`, optionally with an alpha
@@ -1,10 +1,11 @@
1
- import { createElement, type DependencyList, useContext, useId, useMemo } from 'react';
1
+ import { createElement, type DependencyList, use, useContext, useId, useMemo } from 'react';
2
2
  import { Platform } from 'react-native';
3
+ import { BloomThemeContext } from './BloomThemeProvider';
3
4
  import { useTheme } from './use-theme';
4
5
  import { ThemeScopeContext } from './color-scope/context';
5
- import { usePrepaintThemeConfig } from './prepaint/context';
6
+ import { PrepaintThemeContext, usePrepaintThemeConfig } from './prepaint/context';
6
7
  import { usePaintColors } from './prepaint/use-paint-colors';
7
- import { themePaintRecipe, themePaintCss, presetPaintCss } from './paint';
8
+ import { themePaintColors, themePaintRecipe, themePaintCss, presetPaintCss } from './paint';
8
9
  import { APP_COLOR_NAMES, type AppColorName } from './color-presets';
9
10
  import { ServerStyleSheetFactory } from '../styles/ServerStyleSheetFactory';
10
11
  import type { Theme, ThemeColors } from './types';
@@ -92,3 +93,25 @@ export function useThemePaint(): ThemeColors {
92
93
  if (!paint) throw new Error('useThemePaint must be used within a <BloomThemeProvider>');
93
94
  return paint;
94
95
  }
96
+
97
+ const paints = new WeakMap<ThemeColors, ThemeColors>();
98
+
99
+ /**
100
+ * `useTheme()` and `useThemePaint()` in one read, through React's `use`: not a
101
+ * hook, so a renderer that draws from a tree it builds (the Bloom language's
102
+ * roots and `view()` bodies) reads the theme only when that tree paints from
103
+ * it. Called during render, as a hook is. One context read natively, two on
104
+ * the web (the theme and its prepaint).
105
+ */
106
+ export function readThemePaint(): { readonly theme: Theme; readonly paint: ThemeColors } {
107
+ const theme = use(BloomThemeContext)?.theme;
108
+ if (!theme) throw new Error('useTheme must be used within a <BloomThemeProvider>');
109
+ if (Platform.OS !== 'web' || use(PrepaintThemeContext) === undefined)
110
+ return { theme, paint: theme.colors };
111
+ let paint = paints.get(theme.colors);
112
+ if (paint === undefined) {
113
+ paint = themePaintColors(theme.colors);
114
+ paints.set(theme.colors, paint);
115
+ }
116
+ return { theme, paint };
117
+ }