@adea-ai/ui 0.148.0 → 0.149.1

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 (482) hide show
  1. package/dist/components/composites/about-dialog/about-dialog.js +2 -3
  2. package/dist/components/composites/about-dialog/index.js +1 -2
  3. package/dist/components/composites/accent-picker/accent-picker.js +2 -3
  4. package/dist/components/composites/accent-picker/index.js +1 -2
  5. package/dist/components/composites/account-menu/account-menu.js +3 -4
  6. package/dist/components/composites/account-menu/index.js +1 -2
  7. package/dist/components/composites/action-button/action-button.js +2 -3
  8. package/dist/components/composites/action-button/index.js +1 -2
  9. package/dist/components/composites/appearance-editor/accent-swatch-groups.js +1 -2
  10. package/dist/components/composites/appearance-editor/appearance-choices.js +2 -3
  11. package/dist/components/composites/appearance-editor/appearance-editor.js +5 -6
  12. package/dist/components/composites/appearance-editor/appearance-rows.d.ts.map +1 -1
  13. package/dist/components/composites/appearance-editor/appearance-rows.js +4 -4
  14. package/dist/components/composites/appearance-editor/appearance-rows.js.map +1 -1
  15. package/dist/components/composites/appearance-editor/font-settings-group.js +3 -4
  16. package/dist/components/composites/appearance-editor/font-settings-group.js.map +1 -1
  17. package/dist/components/composites/appearance-editor/index.js +2 -2
  18. package/dist/components/composites/appearance-editor/theme-preview.js +1 -2
  19. package/dist/components/composites/catalog-browser/catalog-browser-group.js +3 -4
  20. package/dist/components/composites/catalog-browser/catalog-browser.js +4 -5
  21. package/dist/components/composites/catalog-browser/catalog-detail.js +1 -2
  22. package/dist/components/composites/chain-of-thought/chain-of-thought.js +1 -2
  23. package/dist/components/composites/chain-of-thought/index.js +1 -2
  24. package/dist/components/composites/chat/chat.js +1 -2
  25. package/dist/components/composites/chat/index.js +1 -2
  26. package/dist/components/composites/checkpoint/checkpoint-model.js +1 -2
  27. package/dist/components/composites/checkpoint/checkpoint.js +4 -5
  28. package/dist/components/composites/checkpoint/index.js +1 -1
  29. package/dist/components/composites/confirmation/confirmation-model.js +1 -2
  30. package/dist/components/composites/confirmation/confirmation.js +1 -2
  31. package/dist/components/composites/confirmation/index.js +1 -1
  32. package/dist/components/composites/context/context-model.js +1 -2
  33. package/dist/components/composites/context/context.js +1 -2
  34. package/dist/components/composites/context/index.js +1 -1
  35. package/dist/components/composites/file-tree/build-file-tree.js +1 -2
  36. package/dist/components/composites/file-tree/file-tree.js +2 -3
  37. package/dist/components/composites/file-tree/index.js +1 -1
  38. package/dist/components/composites/help-center/help-center.js +3 -4
  39. package/dist/components/composites/help-center/index.js +1 -2
  40. package/dist/components/composites/icon-picker/icon-picker.js +1 -2
  41. package/dist/components/composites/icon-picker/image-data-url.js +1 -2
  42. package/dist/components/composites/icon-picker/index.js +1 -1
  43. package/dist/components/composites/icon-picker/shell-icons.js +1 -2
  44. package/dist/components/composites/inline-citation/citation.d.ts.map +1 -1
  45. package/dist/components/composites/inline-citation/citation.js +2 -3
  46. package/dist/components/composites/inline-citation/citation.js.map +1 -1
  47. package/dist/components/composites/inline-citation/index.js +1 -1
  48. package/dist/components/composites/inline-citation/inline-citation.js +2 -3
  49. package/dist/components/composites/list-row/index.js +1 -1
  50. package/dist/components/composites/list-row/list-row-control.js +1 -2
  51. package/dist/components/composites/list-row/list-row.js +3 -4
  52. package/dist/components/composites/message-scroller/index.js +1 -1
  53. package/dist/components/composites/message-scroller/message-scroller.js +1 -2
  54. package/dist/components/composites/message-scroller/scroll-anchor.js +1 -2
  55. package/dist/components/composites/model-selector/index.js +1 -1
  56. package/dist/components/composites/model-selector/model-selector.js +2 -3
  57. package/dist/components/composites/model-selector/model-selector.js.map +1 -1
  58. package/dist/components/composites/model-selector/models.js +1 -2
  59. package/dist/components/composites/plan/index.js +1 -2
  60. package/dist/components/composites/plan/plan.js +1 -2
  61. package/dist/components/composites/queue/index.js +1 -2
  62. package/dist/components/composites/queue/queue.js +1 -2
  63. package/dist/components/composites/reasoning/index.js +1 -2
  64. package/dist/components/composites/reasoning/reasoning.js +1 -2
  65. package/dist/components/composites/scene-controls/index.js +1 -2
  66. package/dist/components/composites/scene-controls/scene-controls.js +1 -2
  67. package/dist/components/composites/settings/index.js +1 -1
  68. package/dist/components/composites/settings/settings-layout.js +1 -2
  69. package/dist/components/composites/settings/settings-navigation.js +3 -4
  70. package/dist/components/composites/settings/settings.js +3 -4
  71. package/dist/components/composites/sources/index.js +1 -1
  72. package/dist/components/composites/sources/source.js +1 -2
  73. package/dist/components/composites/sources/sources.js +1 -2
  74. package/dist/components/composites/stack-trace/index.js +1 -1
  75. package/dist/components/composites/stack-trace/parse-stack-trace.js +1 -2
  76. package/dist/components/composites/stack-trace/stack-trace.js +3 -4
  77. package/dist/components/composites/stack-trace/stack-trace.js.map +1 -1
  78. package/dist/components/composites/stat/index.js +1 -2
  79. package/dist/components/composites/stat/stat.js +1 -2
  80. package/dist/components/composites/subagent/index.js +1 -2
  81. package/dist/components/composites/subagent/subagent.js +1 -2
  82. package/dist/components/composites/suggestion/index.js +1 -2
  83. package/dist/components/composites/suggestion/suggestion.js +1 -2
  84. package/dist/components/composites/task/index.js +1 -2
  85. package/dist/components/composites/task/task.js +2 -3
  86. package/dist/components/composites/terminal/ansi.js +1 -2
  87. package/dist/components/composites/terminal/index.js +1 -1
  88. package/dist/components/composites/terminal/terminal-model.js +1 -2
  89. package/dist/components/composites/terminal/terminal.js +2 -3
  90. package/dist/components/composites/test-results/index.js +1 -1
  91. package/dist/components/composites/test-results/test-results-model.js +1 -2
  92. package/dist/components/composites/test-results/test-results.js +2 -3
  93. package/dist/components/composites/tool/format-tool-value.js +1 -2
  94. package/dist/components/composites/tool/index.js +1 -1
  95. package/dist/components/composites/tool/tool.js +1 -2
  96. package/dist/components/composites/tree/index.js +1 -2
  97. package/dist/components/composites/tree/tree-navigation.js +1 -2
  98. package/dist/components/composites/tree/tree.js +1 -2
  99. package/dist/components/composites/update-dialog/channel-control.js +2 -3
  100. package/dist/components/composites/update-dialog/update-dialog.js +9 -7
  101. package/dist/components/composites/update-dialog/update-dialog.js.map +1 -1
  102. package/dist/components/composites/workspace-mark/index.js +1 -2
  103. package/dist/components/composites/workspace-mark/workspace-mark.d.ts.map +1 -1
  104. package/dist/components/composites/workspace-mark/workspace-mark.js +24 -16
  105. package/dist/components/composites/workspace-mark/workspace-mark.js.map +1 -1
  106. package/dist/components/composites/workspace-switcher/index.js +1 -1
  107. package/dist/components/composites/workspace-switcher/workspace-order.js +1 -2
  108. package/dist/components/composites/workspace-switcher/workspace-reorder-dialog.js +1 -2
  109. package/dist/components/composites/workspace-switcher/workspace-switcher.d.ts.map +1 -1
  110. package/dist/components/composites/workspace-switcher/workspace-switcher.js +28 -21
  111. package/dist/components/composites/workspace-switcher/workspace-switcher.js.map +1 -1
  112. package/dist/components/conversation/atomic/chat-composer.js +2 -3
  113. package/dist/components/conversation/atomic/index.js +1 -2
  114. package/dist/components/conversation/busy-send-button.js +1 -2
  115. package/dist/components/conversation/chat-composer.js +1 -2
  116. package/dist/components/conversation/composer-menu.js +1 -2
  117. package/dist/components/conversation/conversation-avatar.js +1 -2
  118. package/dist/components/conversation/conversation-pane.js +1 -2
  119. package/dist/components/conversation/conversation-surface.js +1 -2
  120. package/dist/components/conversation/ime-guard.js +1 -2
  121. package/dist/components/conversation/index.js +1 -1
  122. package/dist/components/conversation/internal/chat-composer-shell.js +5 -3
  123. package/dist/components/conversation/internal/chat-composer-shell.js.map +1 -1
  124. package/dist/components/conversation/message-composer.js +2 -3
  125. package/dist/components/conversation/message-row.js +1 -2
  126. package/dist/components/conversation/paste-preview.js +0 -1
  127. package/dist/components/conversation/paste-token-editor.js +1 -2
  128. package/dist/components/conversation/paste-tokens.js +1 -2
  129. package/dist/components/conversation/scroll-follow-core.js +0 -1
  130. package/dist/components/conversation/scroll-follow.js +1 -2
  131. package/dist/components/conversation/thread-panel.js +1 -2
  132. package/dist/components/conversation/transcript-composition.js +1 -2
  133. package/dist/components/conversation/transcript-folding.js +1 -2
  134. package/dist/components/conversation/transcript-grouping.js +1 -2
  135. package/dist/components/layout/app-shell/app-shell.js +1 -2
  136. package/dist/components/layout/app-shell/skip-link.js +1 -2
  137. package/dist/components/layout/contextual-sidebar/contextual-sidebar.js +1 -2
  138. package/dist/components/layout/contextual-sidebar/index.js +1 -1
  139. package/dist/components/layout/contextual-sidebar/mobile-contextual-sidebar.js +1 -2
  140. package/dist/components/layout/floating-preview/floating-preview.js +1 -2
  141. package/dist/components/layout/floating-preview/model.js +1 -2
  142. package/dist/components/layout/orbit-layout/index.js +1 -2
  143. package/dist/components/layout/orbit-layout/orbit-layout.js +1 -2
  144. package/dist/components/layout/page/index.js +1 -2
  145. package/dist/components/layout/page/page.js +1 -2
  146. package/dist/components/layout/panel/index.js +1 -2
  147. package/dist/components/layout/panel/panel.js +1 -2
  148. package/dist/components/layout/pixel-pane/index.js +1 -2
  149. package/dist/components/layout/pixel-pane/pixel-pane.js +1 -2
  150. package/dist/components/layout/pixel-resize-handle/index.js +1 -2
  151. package/dist/components/layout/pixel-resize-handle/pixel-resize-handle.js +1 -2
  152. package/dist/components/layout/shell-rail/index.js +1 -2
  153. package/dist/components/layout/shell-rail/shell-rail.js +2 -3
  154. package/dist/components/layout/shell-top-bar/index.js +1 -2
  155. package/dist/components/layout/shell-top-bar/shell-top-bar.js +1 -2
  156. package/dist/components/layout/side-rail/index.js +1 -1
  157. package/dist/components/layout/side-rail/side-rail-context.js +1 -2
  158. package/dist/components/layout/side-rail/side-rail.js +2 -3
  159. package/dist/components/layout/sidebar-nav/sidebar-nav-resize-handle.js +1 -2
  160. package/dist/components/layout/sidebar-nav/sidebar-nav.js +1 -2
  161. package/dist/components/layout/split-layout/drop.js +1 -2
  162. package/dist/components/layout/split-layout/geometry.js +1 -2
  163. package/dist/components/layout/split-layout/model.js +1 -2
  164. package/dist/components/layout/split-layout/resize-controller-core-retry.js +1 -2
  165. package/dist/components/layout/split-layout/resize-controller-core.js +1 -2
  166. package/dist/components/layout/split-layout/resize-controller-retry-2.js +1 -2
  167. package/dist/components/layout/split-layout/resize-controller-retry.js +1 -2
  168. package/dist/components/layout/split-layout/resize-controller.js +1 -2
  169. package/dist/components/layout/split-layout/split-layout.d.ts.map +1 -1
  170. package/dist/components/layout/split-layout/split-layout.js +31 -17
  171. package/dist/components/layout/split-layout/split-layout.js.map +1 -1
  172. package/dist/components/layout/split-layout/tree.js +1 -2
  173. package/dist/components/layout/status-bar/index.js +1 -2
  174. package/dist/components/layout/status-bar/status-bar.js +1 -2
  175. package/dist/components/layout/top-bar/index.js +1 -2
  176. package/dist/components/layout/top-bar/top-bar.js +1 -2
  177. package/dist/components/layout/virtual-window/index.js +1 -2
  178. package/dist/components/layout/virtual-window/virtual-window.js +1 -2
  179. package/dist/components/motion/presence.js +1 -2
  180. package/dist/components/theme/appearance-panel.js +4 -5
  181. package/dist/components/theme/index.js +2 -2
  182. package/dist/components/theme/lazy.js +4 -4
  183. package/dist/components/theme/script.js +1 -2
  184. package/dist/components/theme/theme-catalogue-source.js +1 -2
  185. package/dist/components/theme/theme-context.js +1 -2
  186. package/dist/components/theme/theme-document-core.js +3 -4
  187. package/dist/components/theme/theme-mode-toggle.js +2 -3
  188. package/dist/components/theme/theme-persistence.js +4 -5
  189. package/dist/components/theme/theme-picker.js +1 -2
  190. package/dist/components/theme/theme-provider-core.js +1 -2
  191. package/dist/components/theme/theme-provider-lazy.js +2 -3
  192. package/dist/components/theme/theme-provider-value.js +2 -3
  193. package/dist/components/theme/theme-provider.js +1 -2
  194. package/dist/components/theme/theme-script.js +4 -5
  195. package/dist/components/theme/theme-state-core.js +3 -4
  196. package/dist/components/theme/theme-toggle.js +1 -2
  197. package/dist/components/ui/accordion/accordion.js +1 -2
  198. package/dist/components/ui/accordion/index.js +1 -2
  199. package/dist/components/ui/alert/alert.js +2 -3
  200. package/dist/components/ui/alert/index.js +1 -2
  201. package/dist/components/ui/alert-dialog/alert-dialog.js +2 -3
  202. package/dist/components/ui/alert-dialog/index.js +1 -2
  203. package/dist/components/ui/annotation-surface/annotation-surface.js +1 -2
  204. package/dist/components/ui/annotation-surface/geometry.js +1 -2
  205. package/dist/components/ui/annotation-surface/index.js +1 -2
  206. package/dist/components/ui/aspect-ratio/aspect-ratio.js +1 -2
  207. package/dist/components/ui/aspect-ratio/index.js +1 -2
  208. package/dist/components/ui/attachment/attachment.js +1 -2
  209. package/dist/components/ui/attachment/index.js +1 -2
  210. package/dist/components/ui/avatar/avatar.js +1 -2
  211. package/dist/components/ui/avatar/index.js +1 -2
  212. package/dist/components/ui/badge/badge.js +2 -3
  213. package/dist/components/ui/badge/index.js +1 -2
  214. package/dist/components/ui/board/board.js +2 -3
  215. package/dist/components/ui/board/index.js +1 -2
  216. package/dist/components/ui/breadcrumb/breadcrumb.js +1 -2
  217. package/dist/components/ui/breadcrumb/index.js +1 -2
  218. package/dist/components/ui/bubble/bubble.js +1 -2
  219. package/dist/components/ui/bubble/index.js +1 -2
  220. package/dist/components/ui/button/button.js +2 -3
  221. package/dist/components/ui/button/index.js +1 -2
  222. package/dist/components/ui/button-group/button-group.js +1 -2
  223. package/dist/components/ui/button-group/index.js +1 -2
  224. package/dist/components/ui/calendar/calendar.js +1 -2
  225. package/dist/components/ui/calendar/index.js +1 -2
  226. package/dist/components/ui/callout/callout.js +2 -3
  227. package/dist/components/ui/callout/index.js +1 -2
  228. package/dist/components/ui/card/card.js +2 -3
  229. package/dist/components/ui/card/index.js +1 -2
  230. package/dist/components/ui/carousel/carousel.js +1 -2
  231. package/dist/components/ui/carousel/index.js +1 -2
  232. package/dist/components/ui/chart/chart-options.js +1 -2
  233. package/dist/components/ui/chart/chart.js +1 -2
  234. package/dist/components/ui/checkbox/checkbox.js +2 -3
  235. package/dist/components/ui/checkbox/index.js +1 -2
  236. package/dist/components/ui/code-block/code-block.js +2 -3
  237. package/dist/components/ui/code-block/index.js +1 -2
  238. package/dist/components/ui/collapsible/collapsible.js +1 -2
  239. package/dist/components/ui/collapsible/index.js +1 -2
  240. package/dist/components/ui/combobox/combobox.js +2 -3
  241. package/dist/components/ui/combobox/value-combobox.js +1 -2
  242. package/dist/components/ui/command/command.js +3 -4
  243. package/dist/components/ui/command/index.js +1 -2
  244. package/dist/components/ui/context-menu/context-menu.js +2 -3
  245. package/dist/components/ui/context-menu/index.js +1 -2
  246. package/dist/components/ui/detail-panel/detail-panel.js +2 -3
  247. package/dist/components/ui/detail-panel/index.js +1 -2
  248. package/dist/components/ui/dialog/dialog.d.ts.map +1 -1
  249. package/dist/components/ui/dialog/dialog.js +3 -3
  250. package/dist/components/ui/dialog/dialog.js.map +1 -1
  251. package/dist/components/ui/dialog/index.js +1 -2
  252. package/dist/components/ui/diff-block/diff-block.js +2 -3
  253. package/dist/components/ui/diff-block/index.js +1 -2
  254. package/dist/components/ui/drawer/drawer.js +1 -2
  255. package/dist/components/ui/drawer/index.js +1 -2
  256. package/dist/components/ui/dropdown-menu/dropdown-menu.js +2 -3
  257. package/dist/components/ui/dropdown-menu/index.js +1 -2
  258. package/dist/components/ui/empty/empty-state.js +3 -4
  259. package/dist/components/ui/empty/empty.js +1 -2
  260. package/dist/components/ui/entity-icon/entity-icon.js +2 -3
  261. package/dist/components/ui/entity-icon/index.js +1 -2
  262. package/dist/components/ui/field/field.js +3 -4
  263. package/dist/components/ui/field/number-field.js +1 -2
  264. package/dist/components/ui/hover-card/hover-card.js +2 -3
  265. package/dist/components/ui/hover-card/index.js +1 -2
  266. package/dist/components/ui/input/index.js +1 -1
  267. package/dist/components/ui/input/input-control.js +1 -2
  268. package/dist/components/ui/input/input.js +1 -2
  269. package/dist/components/ui/input-group/input-group.js +2 -3
  270. package/dist/components/ui/input-group/secret-input-group.js +2 -3
  271. package/dist/components/ui/input-otp/index.js +1 -2
  272. package/dist/components/ui/input-otp/input-otp.js +1 -2
  273. package/dist/components/ui/item/index.js +1 -2
  274. package/dist/components/ui/item/item.js +2 -3
  275. package/dist/components/ui/kbd/kbd.js +2 -3
  276. package/dist/components/ui/kbd/platform-modifier.js +1 -2
  277. package/dist/components/ui/label/index.js +1 -2
  278. package/dist/components/ui/label/label.js +1 -2
  279. package/dist/components/ui/marker/index.js +1 -2
  280. package/dist/components/ui/marker/marker.js +1 -2
  281. package/dist/components/ui/menubar/index.js +1 -2
  282. package/dist/components/ui/menubar/menubar.js +2 -3
  283. package/dist/components/ui/message/cite-ranges.js +1 -2
  284. package/dist/components/ui/message/index.js +1 -1
  285. package/dist/components/ui/message/message.js +1 -2
  286. package/dist/components/ui/message/parse-message-text.js +1 -2
  287. package/dist/components/ui/modal-dialog/index.js +1 -2
  288. package/dist/components/ui/modal-dialog/modal-dialog.js +1 -2
  289. package/dist/components/ui/native-select/index.js +1 -2
  290. package/dist/components/ui/native-select/native-select.js +2 -3
  291. package/dist/components/ui/navigation-menu/index.js +1 -2
  292. package/dist/components/ui/navigation-menu/navigation-menu.js +1 -2
  293. package/dist/components/ui/pagination/index.js +1 -2
  294. package/dist/components/ui/pagination/pagination.js +1 -2
  295. package/dist/components/ui/popover/index.js +1 -2
  296. package/dist/components/ui/popover/popover.js +2 -3
  297. package/dist/components/ui/progress/index.js +1 -2
  298. package/dist/components/ui/progress/progress.js +1 -2
  299. package/dist/components/ui/questionnaire/index.js +1 -2
  300. package/dist/components/ui/questionnaire/questionnaire.js +1 -2
  301. package/dist/components/ui/radio-group/index.js +1 -2
  302. package/dist/components/ui/radio-group/radio-group.js +2 -3
  303. package/dist/components/ui/resizable/index.js +1 -2
  304. package/dist/components/ui/resizable/resizable.js +1 -2
  305. package/dist/components/ui/scroll-area/index.js +1 -2
  306. package/dist/components/ui/scroll-area/scroll-area.js +1 -2
  307. package/dist/components/ui/select/index.js +1 -2
  308. package/dist/components/ui/select/select.js +2 -3
  309. package/dist/components/ui/separator/index.js +1 -2
  310. package/dist/components/ui/separator/separator.js +1 -2
  311. package/dist/components/ui/sheet/index.js +1 -2
  312. package/dist/components/ui/sheet/sheet.js +2 -3
  313. package/dist/components/ui/skeleton/index.js +1 -2
  314. package/dist/components/ui/skeleton/skeleton.js +1 -2
  315. package/dist/components/ui/slider/index.js +1 -2
  316. package/dist/components/ui/slider/slider.js +1 -2
  317. package/dist/components/ui/spinner/index.js +1 -2
  318. package/dist/components/ui/spinner/spinner.js +2 -3
  319. package/dist/components/ui/status-chip/index.js +1 -2
  320. package/dist/components/ui/status-chip/status-chip.js +2 -3
  321. package/dist/components/ui/switch/index.js +1 -2
  322. package/dist/components/ui/switch/switch.js +2 -3
  323. package/dist/components/ui/table/index.js +1 -2
  324. package/dist/components/ui/table/table.js +1 -2
  325. package/dist/components/ui/tabs/index.js +1 -2
  326. package/dist/components/ui/tabs/tabs.js +1 -2
  327. package/dist/components/ui/text-link/index.js +1 -2
  328. package/dist/components/ui/text-link/text-link.js +1 -2
  329. package/dist/components/ui/textarea/index.js +1 -2
  330. package/dist/components/ui/textarea/textarea.js +2 -3
  331. package/dist/components/ui/toast/index.js +1 -2
  332. package/dist/components/ui/toast/toast.js +1 -2
  333. package/dist/components/ui/toggle/index.js +1 -2
  334. package/dist/components/ui/toggle/toggle.js +2 -3
  335. package/dist/components/ui/toggle-group/index.js +1 -2
  336. package/dist/components/ui/toggle-group/toggle-group.js +1 -2
  337. package/dist/components/ui/tooltip/index.js +1 -2
  338. package/dist/components/ui/tooltip/tooltip.js +2 -3
  339. package/dist/components/ui/trace/index.js +1 -2
  340. package/dist/components/ui/trace/trace.js +1 -2
  341. package/dist/components/ui/typography/index.js +1 -2
  342. package/dist/components/ui/typography/typography.js +2 -3
  343. package/dist/index.js +11 -11
  344. package/dist/lib/accent-presets.js +1 -2
  345. package/dist/lib/accent-roles.js +1 -2
  346. package/dist/lib/appearance-font-settings.js +1 -2
  347. package/dist/lib/clipboard.js +1 -2
  348. package/dist/lib/cn-tables.generated.js +8 -9
  349. package/dist/lib/cn-tables.generated.js.map +1 -1
  350. package/dist/lib/download.js +1 -2
  351. package/dist/lib/font-catalog.js +0 -1
  352. package/dist/lib/font-zoom.js +1 -2
  353. package/dist/lib/form-field.js +1 -2
  354. package/dist/lib/keyed-rows.js +1 -2
  355. package/dist/lib/overlay.js +1 -2
  356. package/dist/lib/preference-store.js +1 -2
  357. package/dist/lib/safe-script.js +1 -2
  358. package/dist/lib/theme-accents.js +1 -2
  359. package/dist/lib/theme-catalogue.js +1 -2
  360. package/dist/lib/theme-css.js +1 -2
  361. package/dist/lib/theme-defaults.generated.js +1 -2
  362. package/dist/lib/theme-defaults.js +1 -2
  363. package/dist/lib/theme-engine-light.js +1 -2
  364. package/dist/lib/theme-engine.js +1 -2
  365. package/dist/lib/theme-projection.js +1 -2
  366. package/dist/lib/theme-records.js +1 -2
  367. package/dist/lib/theme-surface.js +1 -2
  368. package/dist/lib/themes.js +2 -3
  369. package/dist/lib/tokens.js +1 -2
  370. package/dist/lib/tooltip-focus-gate.js +1 -2
  371. package/dist/lib/utils.js +1 -2
  372. package/dist/lib/variants.js +1 -2
  373. package/dist/lib/version-notes.js +1 -2
  374. package/dist/lint.js +1 -2
  375. package/dist/r/about-dialog.json +1 -1
  376. package/dist/r/accordion.json +1 -1
  377. package/dist/r/account-menu.json +1 -1
  378. package/dist/r/alert.json +1 -1
  379. package/dist/r/appearance-editor.json +2 -2
  380. package/dist/r/attachment.json +1 -1
  381. package/dist/r/breadcrumb.json +1 -1
  382. package/dist/r/calendar.json +1 -1
  383. package/dist/r/carousel.json +1 -1
  384. package/dist/r/catalog-browser.json +1 -1
  385. package/dist/r/chain-of-thought.json +1 -1
  386. package/dist/r/chat.json +1 -1
  387. package/dist/r/checkbox.json +1 -1
  388. package/dist/r/checkpoint.json +1 -1
  389. package/dist/r/code-block.json +1 -1
  390. package/dist/r/combobox.json +1 -1
  391. package/dist/r/command.json +1 -1
  392. package/dist/r/confirmation.json +1 -1
  393. package/dist/r/context-menu.json +1 -1
  394. package/dist/r/context.json +1 -1
  395. package/dist/r/conversation.json +1 -1
  396. package/dist/r/detail-panel.json +1 -1
  397. package/dist/r/dialog.json +1 -1
  398. package/dist/r/dropdown-menu.json +1 -1
  399. package/dist/r/empty.json +1 -1
  400. package/dist/r/file-tree.json +1 -1
  401. package/dist/r/floating-preview.json +1 -1
  402. package/dist/r/help-center.json +1 -1
  403. package/dist/r/icon-picker.json +1 -1
  404. package/dist/r/inline-citation.json +1 -1
  405. package/dist/r/lib.json +2 -2
  406. package/dist/r/menubar.json +1 -1
  407. package/dist/r/message-scroller.json +1 -1
  408. package/dist/r/model-selector.json +1 -1
  409. package/dist/r/native-select.json +1 -1
  410. package/dist/r/navigation-menu.json +1 -1
  411. package/dist/r/pagination.json +1 -1
  412. package/dist/r/pixel-resize-handle.json +1 -1
  413. package/dist/r/plan.json +1 -1
  414. package/dist/r/questionnaire.json +1 -1
  415. package/dist/r/queue.json +1 -1
  416. package/dist/r/radio-group.json +1 -1
  417. package/dist/r/reasoning.json +1 -1
  418. package/dist/r/registry.json +70 -70
  419. package/dist/r/resizable.json +1 -1
  420. package/dist/r/scene-controls.json +1 -1
  421. package/dist/r/select.json +1 -1
  422. package/dist/r/settings.json +1 -1
  423. package/dist/r/sheet.json +1 -1
  424. package/dist/r/shell-rail.json +1 -1
  425. package/dist/r/sidebar-nav.json +1 -1
  426. package/dist/r/sources.json +1 -1
  427. package/dist/r/spinner.json +1 -1
  428. package/dist/r/split-layout.json +1 -1
  429. package/dist/r/src/components/composites/appearance-editor/appearance-rows.tsx +4 -5
  430. package/dist/r/src/components/composites/appearance-editor/font-settings-group.tsx +1 -1
  431. package/dist/r/src/components/composites/inline-citation/citation.ts +4 -1
  432. package/dist/r/src/components/composites/model-selector/model-selector.tsx +1 -1
  433. package/dist/r/src/components/composites/stack-trace/stack-trace.tsx +1 -1
  434. package/dist/r/src/components/composites/update-dialog/update-dialog.tsx +2 -2
  435. package/dist/r/src/components/composites/workspace-mark/workspace-mark.tsx +23 -12
  436. package/dist/r/src/components/composites/workspace-switcher/workspace-switcher.tsx +10 -5
  437. package/dist/r/src/components/conversation/internal/chat-composer-shell.tsx +2 -2
  438. package/dist/r/src/components/layout/split-layout/split-layout.tsx +44 -29
  439. package/dist/r/src/components/ui/dialog/dialog.tsx +1 -0
  440. package/dist/r/src/lib/cn-tables.generated.ts +7 -7
  441. package/dist/r/stack-trace.json +1 -1
  442. package/dist/r/stat.json +1 -1
  443. package/dist/r/subagent.json +1 -1
  444. package/dist/r/task.json +1 -1
  445. package/dist/r/terminal.json +1 -1
  446. package/dist/r/test-results.json +1 -1
  447. package/dist/r/theming.json +2 -2
  448. package/dist/r/toast.json +1 -1
  449. package/dist/r/tool.json +1 -1
  450. package/dist/r/top-bar.json +1 -1
  451. package/dist/r/trace.json +1 -1
  452. package/dist/r/tree.json +1 -1
  453. package/dist/r/update-dialog.json +1 -1
  454. package/dist/r/workspace-switcher.json +1 -1
  455. package/dist/vite/index.d.ts +2 -0
  456. package/dist/vite/index.d.ts.map +1 -0
  457. package/dist/vite/source-parser.d.ts +57 -0
  458. package/dist/vite/source-parser.d.ts.map +1 -0
  459. package/dist/vite/source-parser.js +247 -0
  460. package/dist/vite/source-parser.js.map +1 -0
  461. package/dist/vite/tailwind-sources.d.ts +111 -0
  462. package/dist/vite/tailwind-sources.d.ts.map +1 -0
  463. package/dist/vite/tailwind-sources.js +500 -0
  464. package/dist/vite/tailwind-sources.js.map +1 -0
  465. package/dist/vite.js +1 -0
  466. package/package.json +32 -19
  467. package/registry.json +70 -70
  468. package/src/components/composites/appearance-editor/appearance-rows.tsx +4 -5
  469. package/src/components/composites/appearance-editor/font-settings-group.tsx +1 -1
  470. package/src/components/composites/inline-citation/citation.ts +4 -1
  471. package/src/components/composites/model-selector/model-selector.tsx +1 -1
  472. package/src/components/composites/stack-trace/stack-trace.tsx +1 -1
  473. package/src/components/composites/update-dialog/update-dialog.tsx +2 -2
  474. package/src/components/composites/workspace-mark/workspace-mark.tsx +23 -12
  475. package/src/components/composites/workspace-switcher/workspace-switcher.tsx +10 -5
  476. package/src/components/conversation/internal/chat-composer-shell.tsx +2 -2
  477. package/src/components/layout/split-layout/split-layout.tsx +44 -29
  478. package/src/components/ui/dialog/dialog.tsx +1 -0
  479. package/src/lib/cn-tables.generated.ts +7 -7
  480. package/src/vite/index.ts +17 -0
  481. package/src/vite/source-parser.ts +358 -0
  482. package/src/vite/tailwind-sources.ts +754 -0
@@ -0,0 +1,754 @@
1
+ import {
2
+ existsSync,
3
+ mkdirSync,
4
+ readFileSync,
5
+ readdirSync,
6
+ realpathSync,
7
+ symlinkSync,
8
+ writeFileSync,
9
+ } from 'node:fs'
10
+ import { basename, dirname, extname, isAbsolute, relative, resolve, sep } from 'node:path'
11
+ import {
12
+ defaultExport,
13
+ directRuntimeExports,
14
+ runtimeReexports,
15
+ dynamicRuntimeImports,
16
+ hasRuntimeDeclaration,
17
+ parseSource,
18
+ type SyntaxNode,
19
+ selectNamespace,
20
+ staticRuntimeImports,
21
+ } from './source-parser'
22
+
23
+ import { normalizePath, type Plugin, type ResolvedConfig } from 'vite'
24
+
25
+ export type Selection =
26
+ | { kind: 'execute' | 'side-effect' | 'all' }
27
+ | { kind: 'named'; names: string[] }
28
+
29
+ interface RuntimeImport {
30
+ specifier: string
31
+ selection: Selection
32
+ }
33
+
34
+ interface ExportTarget {
35
+ file: string
36
+ selection: Selection
37
+ }
38
+
39
+ interface ParsedModule {
40
+ file: string
41
+ syntax: SyntaxNode
42
+ }
43
+
44
+ export interface SourceDiscoveryOptions {
45
+ entrypoint: string | string[]
46
+ repositoryRoot: string
47
+ uiPackageRoot: string
48
+ uiSourceRoot: string
49
+ /** Source roots of installed packages (such as the app framework) whose shared views render UI modules. */
50
+ sourcePackageRoots?: string[]
51
+ resolveId(specifier: string, importer: string): Promise<string | undefined>
52
+ /** Error-message prefix naming the consumer. */
53
+ label?: string
54
+ }
55
+
56
+ export interface SourceDirectiveOptions {
57
+ files: string[]
58
+ uiPackageRoot: string
59
+ stablePackagePath: string
60
+ stylesheetPath: string
61
+ label?: string
62
+ }
63
+
64
+ const defaultLabel = 'ui-tailwind-sources'
65
+
66
+ function modulePath(id: string): string {
67
+ const withoutQuery = id.split('?')[0] ?? id
68
+ const absolute = resolve(withoutQuery)
69
+ try {
70
+ return realpathSync(absolute)
71
+ } catch {
72
+ return absolute
73
+ }
74
+ }
75
+
76
+ function inside(path: string, root: string): boolean {
77
+ const pathFromRoot = relative(root, path)
78
+ return (
79
+ pathFromRoot === '' ||
80
+ (pathFromRoot !== '..' && !pathFromRoot.startsWith(`..${sep}`) && !isAbsolute(pathFromRoot))
81
+ )
82
+ }
83
+
84
+ function isWorkspaceSourceFile(
85
+ path: string,
86
+ repositoryRoot: string,
87
+ sourcePackageRoots: readonly string[] = []
88
+ ): boolean {
89
+ if (sourcePackageRoots.some((root) => inside(path, root))) return true
90
+ if (!inside(path, repositoryRoot)) return false
91
+ const segments = relative(repositoryRoot, path).split(sep)
92
+ return (
93
+ (segments[0] === 'apps' || segments[0] === 'packages') &&
94
+ segments.includes('src') &&
95
+ !segments.includes('node_modules')
96
+ )
97
+ }
98
+
99
+ function isCodeFile(path: string): boolean {
100
+ return ['.ts', '.tsx', '.mts', '.cts', '.js', '.jsx', '.mjs', '.cjs'].includes(extname(path))
101
+ }
102
+
103
+ function readModule(path: string, cache: Map<string, ParsedModule>): ParsedModule {
104
+ const file = modulePath(path)
105
+ const cached = cache.get(file)
106
+ if (cached) return cached
107
+ const source = readFileSync(file, 'utf8')
108
+ const parsed: ParsedModule = { file, syntax: parseSource(file, source) }
109
+ cache.set(file, parsed)
110
+ return parsed
111
+ }
112
+
113
+ function runtimeImports(parsed: ParsedModule, label: string): RuntimeImport[] {
114
+ const imports: RuntimeImport[] = []
115
+
116
+ for (const entry of staticRuntimeImports(parsed.syntax)) {
117
+ if (entry.kind === 'side-effect') {
118
+ imports.push({
119
+ specifier: entry.specifier,
120
+ selection: { kind: 'side-effect' },
121
+ })
122
+ continue
123
+ }
124
+ const namespace = entry.bindings.find((binding) => binding.imported === '*')
125
+ if (namespace) {
126
+ const selection = selectNamespace(parsed.syntax, namespace.local)
127
+ if (selection) imports.push({ specifier: entry.specifier, selection })
128
+ } else {
129
+ imports.push({
130
+ specifier: entry.specifier,
131
+ selection: {
132
+ kind: 'named',
133
+ names: [...new Set(entry.bindings.map((binding) => binding.imported))].toSorted(),
134
+ },
135
+ })
136
+ }
137
+ }
138
+
139
+ imports.push(...dynamicRuntimeImports(parsed.syntax, parsed.file, label))
140
+ return imports
141
+ }
142
+
143
+ function localRuntimeBinding(
144
+ file: string,
145
+ localName: string,
146
+ cache: Map<string, ParsedModule>
147
+ ): RuntimeImport | undefined {
148
+ const parsed = readModule(file, cache)
149
+ for (const entry of staticRuntimeImports(parsed.syntax)) {
150
+ const binding = entry.bindings.find((candidate) => candidate.local === localName)
151
+ if (binding)
152
+ return {
153
+ specifier: entry.specifier,
154
+ selection:
155
+ binding.imported === '*' ? { kind: 'all' } : { kind: 'named', names: [binding.imported] },
156
+ }
157
+ }
158
+ return undefined
159
+ }
160
+
161
+ function hasLocalRuntimeBinding(
162
+ file: string,
163
+ localName: string,
164
+ cache: Map<string, ParsedModule>
165
+ ): boolean {
166
+ return hasRuntimeDeclaration(readModule(file, cache).syntax, localName)
167
+ }
168
+
169
+ function modifierExport(file: string, name: string, cache: Map<string, ParsedModule>): boolean {
170
+ return directRuntimeExports(readModule(file, cache).syntax).includes(name)
171
+ }
172
+
173
+ export async function collectUiSourceFiles(options: SourceDiscoveryOptions): Promise<string[]> {
174
+ const label = options.label ?? defaultLabel
175
+ const repositoryRoot = realpathSync(options.repositoryRoot)
176
+ const uiSourceRoot = realpathSync(options.uiSourceRoot)
177
+ const sourcePackageRoots = (options.sourcePackageRoots ?? []).map((root) => realpathSync(root))
178
+ const entrypoints = (
179
+ Array.isArray(options.entrypoint) ? options.entrypoint : [options.entrypoint]
180
+ ).map((entrypoint) => realpathSync(entrypoint))
181
+ const cache = new Map<string, ParsedModule>()
182
+ const visited = new Set<string>()
183
+ const files = new Set<string>()
184
+ const publishedUiResolutions: string[] = []
185
+
186
+ const resolveImport = async (
187
+ specifier: string,
188
+ importer: string,
189
+ selection: Selection
190
+ ): Promise<void> => {
191
+ const importerIsUi = inside(importer, uiSourceRoot)
192
+ const isPublishedUiImport = specifier === '@adea-ai/ui' || specifier.startsWith('@adea-ai/ui/')
193
+ const resolved = await options.resolveId(specifier, importer)
194
+ if (isPublishedUiImport)
195
+ publishedUiResolutions.push(`${specifier} -> ${resolved ?? '(unresolved)'}`)
196
+ if (!resolved) {
197
+ if (isPublishedUiImport || importerIsUi)
198
+ throw new Error(
199
+ `[${label}] unable to resolve runtime import '${specifier}' from ${importer}`
200
+ )
201
+ return
202
+ }
203
+
204
+ const target = modulePath(resolved)
205
+ if (!isCodeFile(target)) return
206
+ if (isPublishedUiImport && !inside(target, uiSourceRoot)) {
207
+ throw new Error(`[${label}] '${specifier}' resolved outside published UI source: ${target}`)
208
+ }
209
+ if (
210
+ inside(target, uiSourceRoot) ||
211
+ isWorkspaceSourceFile(target, repositoryRoot, sourcePackageRoots)
212
+ ) {
213
+ await visit(target, selection)
214
+ return
215
+ }
216
+ }
217
+
218
+ const resolveExportTargets = async (
219
+ file: string,
220
+ name: string,
221
+ chain: Set<string>
222
+ ): Promise<ExportTarget[]> => {
223
+ const key = `${file}\0${name}`
224
+ if (chain.has(key)) return []
225
+ const nextChain = new Set(chain).add(key)
226
+ const parsed = readModule(file, cache)
227
+ const targets: ExportTarget[] = []
228
+
229
+ if (modifierExport(file, name, cache)) targets.push({ file, selection: { kind: 'execute' } })
230
+
231
+ for (const entry of runtimeReexports(parsed.syntax)) {
232
+ if (entry.kind === 'empty') continue
233
+ if (entry.kind === 'named' && !entry.source) {
234
+ if (entry.exported !== name) continue
235
+ const imported = localRuntimeBinding(file, entry.imported, cache)
236
+ if (imported) {
237
+ const resolved = await options.resolveId(imported.specifier, file)
238
+ if (resolved)
239
+ targets.push({
240
+ file: modulePath(resolved),
241
+ selection: imported.selection,
242
+ })
243
+ else if (inside(file, uiSourceRoot))
244
+ throw new Error(
245
+ `[${label}] unable to resolve local re-export '${imported.specifier}' from ${file}`
246
+ )
247
+ } else if (hasLocalRuntimeBinding(file, entry.imported, cache))
248
+ targets.push({ file, selection: { kind: 'execute' } })
249
+ continue
250
+ }
251
+ if (
252
+ !entry.source ||
253
+ (entry.kind !== 'star' && entry.exported !== name) ||
254
+ (entry.kind === 'star' && name === 'default')
255
+ )
256
+ continue
257
+ if (entry.source === 'lucide-solid') {
258
+ targets.push({ file, selection: { kind: 'execute' } })
259
+ continue
260
+ }
261
+ const resolved = await options.resolveId(entry.source, file)
262
+ if (!resolved) {
263
+ if (inside(file, uiSourceRoot) && entry.kind !== 'namespace')
264
+ throw new Error(`[${label}] unable to resolve re-export '${entry.source}' from ${file}`)
265
+ continue
266
+ }
267
+ if (entry.kind === 'star')
268
+ targets.push(...(await resolveExportTargets(modulePath(resolved), name, nextChain)))
269
+ else if (entry.kind === 'namespace')
270
+ targets.push({
271
+ file: modulePath(resolved),
272
+ selection: { kind: 'all' },
273
+ })
274
+ else
275
+ targets.push({
276
+ file: modulePath(resolved),
277
+ selection: { kind: 'named', names: [entry.imported] },
278
+ })
279
+ }
280
+ if (name === 'default') {
281
+ const entry = defaultExport(parsed.syntax)
282
+ if (entry?.kind === 'identifier') {
283
+ const imported = localRuntimeBinding(file, entry.name, cache)
284
+ if (imported) {
285
+ const resolved = await options.resolveId(imported.specifier, file)
286
+ if (resolved)
287
+ targets.push({
288
+ file: modulePath(resolved),
289
+ selection: imported.selection,
290
+ })
291
+ } else targets.push({ file, selection: { kind: 'execute' } })
292
+ } else if (entry) targets.push({ file, selection: { kind: 'execute' } })
293
+ }
294
+
295
+ return deduplicateTargets(targets)
296
+ }
297
+
298
+ const runtimeExportNames = async (file: string, chain: Set<string>): Promise<string[]> => {
299
+ if (chain.has(file)) return []
300
+ const nextChain = new Set(chain).add(file)
301
+ const parsed = readModule(file, cache)
302
+ const names = new Set(directRuntimeExports(parsed.syntax))
303
+ for (const entry of runtimeReexports(parsed.syntax)) {
304
+ if (!entry.source) {
305
+ if (entry.kind === 'named') names.add(entry.exported)
306
+ continue
307
+ }
308
+ if (entry.kind === 'star' && entry.source === 'lucide-solid') continue
309
+ const resolved = await options.resolveId(entry.source, file)
310
+ if (!resolved) {
311
+ if (inside(file, uiSourceRoot))
312
+ throw new Error(`[${label}] unable to resolve re-export '${entry.source}' from ${file}`)
313
+ continue
314
+ }
315
+ if (entry.kind === 'named' || entry.kind === 'namespace') names.add(entry.exported)
316
+ else if (entry.kind === 'star')
317
+ for (const name of await runtimeExportNames(modulePath(resolved), nextChain))
318
+ if (name !== 'default') names.add(name)
319
+ }
320
+ return [...names].toSorted()
321
+ }
322
+
323
+ const visit = async (path: string, selection: Selection): Promise<void> => {
324
+ const file = modulePath(path)
325
+ if (!isCodeFile(file)) return
326
+ if (
327
+ !inside(file, uiSourceRoot) &&
328
+ !isWorkspaceSourceFile(file, repositoryRoot, sourcePackageRoots)
329
+ )
330
+ return
331
+ const key = `${file}\0${selection.kind === 'named' ? selection.names.join(',') : selection.kind}`
332
+ if (visited.has(key)) return
333
+ visited.add(key)
334
+ const parsed = readModule(file, cache)
335
+ const isUiSource = inside(file, uiSourceRoot)
336
+ if (isUiSource) files.add(file)
337
+
338
+ const moduleImports = runtimeImports(parsed, label)
339
+ // Follow all runtime imports of every visited module. Even when a module
340
+ // is reached through a side-effect import, its own imports may execute
341
+ // setup code or register UI components needed by the consumer.
342
+ for (const dependency of moduleImports) {
343
+ await resolveImport(dependency.specifier, file, dependency.selection)
344
+ }
345
+
346
+ if (selection.kind === 'execute' || selection.kind === 'side-effect') return
347
+ const names =
348
+ selection.kind === 'named' ? selection.names : await runtimeExportNames(file, new Set())
349
+ for (const name of names) {
350
+ const targets = await resolveExportTargets(file, name, new Set())
351
+ if (!targets.length) {
352
+ throw new Error(`[${label}] unable to resolve runtime export '${name}' from ${file}`)
353
+ }
354
+ for (const target of targets) await visit(target.file, target.selection)
355
+ }
356
+ }
357
+
358
+ for (const entrypoint of entrypoints) await visit(entrypoint, { kind: 'execute' })
359
+ if (files.size === 0)
360
+ throw new Error(
361
+ `[${label}] the client import graph resolved no shared UI source files from ${entrypoints.join(', ')}; package imports: ${publishedUiResolutions.slice(0, 8).join('; ') || '(none)'}`
362
+ )
363
+ return [...files].toSorted()
364
+ }
365
+
366
+ function deduplicateTargets(targets: ExportTarget[]): ExportTarget[] {
367
+ const unique = new Map<string, ExportTarget>()
368
+ for (const target of targets) {
369
+ const key = `${target.file}\0${target.selection.kind === 'named' ? target.selection.names.join(',') : target.selection.kind}`
370
+ unique.set(key, target)
371
+ }
372
+ return [...unique.values()]
373
+ }
374
+
375
+ function filesBelow(directory: string): string[] {
376
+ return readdirSync(directory, { withFileTypes: true }).flatMap((entry) => {
377
+ const path = resolve(directory, entry.name)
378
+ if (entry.isDirectory()) return filesBelow(path)
379
+ return entry.isFile() ? [path] : []
380
+ })
381
+ }
382
+
383
+ /**
384
+ * Tailwind's scanner widens a file `@source` to that file's whole directory
385
+ * tree, so a reached `button/button.tsx` would also pull in an unused sibling
386
+ * (and a reached package-root barrel would pull in every component). Negate
387
+ * every file in those trees the import graph did not reach to keep discovery
388
+ * exact to the module.
389
+ */
390
+ export function formatUiSourceDirectives(options: SourceDirectiveOptions): string {
391
+ const label = options.label ?? defaultLabel
392
+ const packageRoot = realpathSync(options.uiPackageRoot)
393
+ const stylesheetDirectory = dirname(resolve(options.stylesheetPath))
394
+ const directive = (file: string, negated: boolean) => {
395
+ if (!inside(file, packageRoot))
396
+ throw new Error(`[${label}] source is outside published package: ${file}`)
397
+ const stableFile = resolve(options.stablePackagePath, relative(packageRoot, file))
398
+ const relativePath = relative(stylesheetDirectory, stableFile).replaceAll('\\', '/')
399
+ if (isAbsolute(relativePath))
400
+ throw new Error(`[${label}] generated source path is not portable: ${relativePath}`)
401
+ return `@source ${negated ? 'not ' : ''}'${relativePath}';`
402
+ }
403
+ const included = [...new Set(options.files.map((path) => realpathSync(path)))].toSorted()
404
+ const includedSet = new Set(included)
405
+ const scannedTrees = [...new Set(included.map((file) => dirname(file)))]
406
+ .toSorted()
407
+ .filter((directory, index, all) => !all.slice(0, index).some((root) => inside(directory, root)))
408
+ const excluded = scannedTrees
409
+ .flatMap((directory) => filesBelow(directory))
410
+ .filter((file) => !includedSet.has(file))
411
+ .toSorted()
412
+ return `${[
413
+ ...included.map((file) => directive(file, false)),
414
+ ...excluded.map((file) => directive(file, true)),
415
+ ].join('\n')}\n`
416
+ }
417
+
418
+ /**
419
+ * The rendered shared UI source modules (by package-relative path) that the
420
+ * generated directives do not cover. Ids may carry Vite query suffixes.
421
+ */
422
+ export function missingRenderedUiSources(
423
+ renderedIds: string[],
424
+ generatedFiles: string[],
425
+ uiRoot: string
426
+ ): string[] {
427
+ const uiSourceRoot = resolve(uiRoot, 'src')
428
+ const generated = new Set(generatedFiles.map((file) => modulePath(file)))
429
+ return [
430
+ ...new Set(
431
+ renderedIds
432
+ .map((id) => modulePath(id))
433
+ .filter((file) => isCodeFile(file) && inside(file, uiSourceRoot) && !generated.has(file))
434
+ .map((file) => relative(uiRoot, file).replaceAll('\\', '/'))
435
+ ),
436
+ ].toSorted()
437
+ }
438
+
439
+ function writeIfChanged(path: string, content: string) {
440
+ let current: string | undefined
441
+ try {
442
+ current = readFileSync(path, 'utf8')
443
+ } catch {
444
+ // The first invocation creates the ignored generated file.
445
+ }
446
+ if (current === content) return
447
+ mkdirSync(dirname(path), { recursive: true })
448
+ writeFileSync(path, content)
449
+ }
450
+
451
+ /**
452
+ * The framework package's published `src` directory holding `file`: the
453
+ * nearest `src` ancestor whose parent is the @adea-ai/app-framework package.
454
+ * Its views live in subdirectories (`src/views`) and import across `src`.
455
+ */
456
+ function frameworkSourceRoot(file: string): string {
457
+ for (
458
+ let directory = dirname(file);
459
+ dirname(directory) !== directory;
460
+ directory = dirname(directory)
461
+ ) {
462
+ if (basename(directory) !== 'src') continue
463
+ try {
464
+ const manifest = JSON.parse(readFileSync(resolve(directory, '../package.json'), 'utf8')) as {
465
+ name?: unknown
466
+ }
467
+ if (manifest.name === '@adea-ai/app-framework') return directory
468
+ } catch {
469
+ // Not the package root; keep walking up.
470
+ }
471
+ }
472
+ return dirname(file)
473
+ }
474
+
475
+ /**
476
+ * The framework's shared views (Help Center and friends) import shared UI
477
+ * modules from its published source, so its graph counts as the app's.
478
+ */
479
+ export async function frameworkSourceRoots(
480
+ resolveId: (specifier: string, importer: string) => Promise<string | undefined>,
481
+ entrypoint: string,
482
+ label = defaultLabel
483
+ ): Promise<string[]> {
484
+ const framework = await resolveId('@adea-ai/app-framework/app-help', entrypoint)
485
+ if (!framework) return []
486
+ const root = frameworkSourceRoot(realpathSync(modulePath(framework)))
487
+ if (basename(root) !== 'src')
488
+ throw new Error(
489
+ `[${label}] @adea-ai/app-framework resolved outside its published source: ${root}`
490
+ )
491
+ return [root]
492
+ }
493
+
494
+ export interface LinkedImport {
495
+ /** The shared UI source module that imports or re-exports the specifier. */
496
+ file: string
497
+ selection: Selection
498
+ }
499
+
500
+ export interface LinkedImportOptions {
501
+ entrypoint: string | string[]
502
+ repositoryRoot: string
503
+ uiSourceRoot: string
504
+ sourcePackageRoots?: string[]
505
+ /** The external package whose uses inside shared UI source are reported. */
506
+ specifier: string
507
+ resolveId(specifier: string, importer: string): Promise<string | undefined>
508
+ label?: string
509
+ }
510
+
511
+ /**
512
+ * Every use of `specifier` inside shared UI source the dev server links.
513
+ *
514
+ * Vite serves the published package as native ESM, so static imports and
515
+ * re-exports are linked even when the consumer selects one root-barrel name,
516
+ * unlike the selective walk the Tailwind sources come from. Literal dynamic
517
+ * imports are included without executing them, so a lazy feature cannot fail
518
+ * later on an import the check never saw.
519
+ */
520
+ export async function collectLinkedImports(options: LinkedImportOptions): Promise<LinkedImport[]> {
521
+ const label = options.label ?? defaultLabel
522
+ const repositoryRoot = realpathSync(options.repositoryRoot)
523
+ const uiSourceRoot = realpathSync(options.uiSourceRoot)
524
+ const sourcePackageRoots = (options.sourcePackageRoots ?? []).map((root) => realpathSync(root))
525
+ const entrypoints = (
526
+ Array.isArray(options.entrypoint) ? options.entrypoint : [options.entrypoint]
527
+ ).map((entrypoint) => realpathSync(entrypoint))
528
+ const cache = new Map<string, ParsedModule>()
529
+ const visited = new Set<string>()
530
+ const linked: LinkedImport[] = []
531
+ const reached = (file: string) =>
532
+ isCodeFile(file) &&
533
+ (inside(file, uiSourceRoot) || isWorkspaceSourceFile(file, repositoryRoot, sourcePackageRoots))
534
+
535
+ const visit = async (path: string): Promise<void> => {
536
+ const file = modulePath(path)
537
+ if (!reached(file) || visited.has(file)) return
538
+ visited.add(file)
539
+ const inUi = inside(file, uiSourceRoot)
540
+ const parsed = readModule(file, cache)
541
+ const record = (selection: Selection) => {
542
+ if (inUi) linked.push({ file, selection })
543
+ }
544
+ const follow = async (specifier: string, kind: string): Promise<void> => {
545
+ const resolved = await options.resolveId(specifier, file)
546
+ if (!resolved) {
547
+ if (inUi || specifier === '@adea-ai/ui' || specifier.startsWith('@adea-ai/ui/'))
548
+ throw new Error(`[${label}] unable to resolve ${kind} '${specifier}' from ${file}`)
549
+ return
550
+ }
551
+ await visit(resolved)
552
+ }
553
+
554
+ for (const dependency of runtimeImports(parsed, label)) {
555
+ if (dependency.specifier === options.specifier) record(dependency.selection)
556
+ else await follow(dependency.specifier, 'runtime import')
557
+ }
558
+ for (const entry of runtimeReexports(parsed.syntax)) {
559
+ if (!entry.source) continue
560
+ if (entry.source !== options.specifier) await follow(entry.source, 're-export')
561
+ else if (entry.kind === 'named') record({ kind: 'named', names: [entry.imported] })
562
+ else if (entry.kind === 'empty') record({ kind: 'named', names: [] })
563
+ else record({ kind: 'all' })
564
+ }
565
+ }
566
+
567
+ for (const entrypoint of entrypoints) await visit(entrypoint)
568
+ return linked
569
+ }
570
+
571
+ export interface GraphCheckContext {
572
+ command: ResolvedConfig['command']
573
+ repositoryRoot: string
574
+ /** The shared UI source modules the client graph reaches. */
575
+ files: string[]
576
+ /** Uses of an external package inside the shared UI source the dev server links. */
577
+ linkedImports(specifier: string): Promise<LinkedImport[]>
578
+ }
579
+
580
+ export interface TailwindSourcesOptions {
581
+ /** Names the plugin, its errors and the generated `<name>-ui-tailwind-sources` cache files. */
582
+ name: string
583
+ /** The Vite root of the consuming app. */
584
+ webRoot: string
585
+ /** Client entry modules, relative to `webRoot`. */
586
+ entrypoints: string[]
587
+ /** The stylesheet that imports the generated directives, relative to `webRoot`. */
588
+ styleEntry: string
589
+ /** The monorepo root whose `apps/*` and `packages/*` sources count as the app's. Defaults to `webRoot/../..`. */
590
+ repositoryRoot?: string
591
+ /** More paths the dev server watches, relative to `webRoot`. */
592
+ watch?: string[]
593
+ /** Runs after each generation, in dev and in builds, to enforce app-specific graph rules. */
594
+ check?(context: GraphCheckContext): void | Promise<void>
595
+ }
596
+
597
+ export interface UiSourcePaths {
598
+ entrypoints: string[]
599
+ repositoryRoot: string
600
+ stablePackagePath: string
601
+ stylesheetPath: string
602
+ manifestPath: string
603
+ styleEntry: string
604
+ }
605
+
606
+ // The generated directives live in the ignored Vite cache next to the stable
607
+ // package link they reference, so every path in them stays checkout-relative.
608
+ export function uiSourcePaths(options: TailwindSourcesOptions): UiSourcePaths {
609
+ const { webRoot, name } = options
610
+ return {
611
+ entrypoints: options.entrypoints.map((entrypoint) => resolve(webRoot, entrypoint)),
612
+ repositoryRoot: resolve(webRoot, options.repositoryRoot ?? '../..'),
613
+ stablePackagePath: resolve(webRoot, 'node_modules/@adea-ai/ui'),
614
+ stylesheetPath: resolve(webRoot, `node_modules/.cache/${name}-ui-tailwind-sources.css`),
615
+ manifestPath: resolve(webRoot, `node_modules/.cache/${name}-ui-tailwind-sources.json`),
616
+ styleEntry: resolve(webRoot, options.styleEntry),
617
+ }
618
+ }
619
+
620
+ type Resolver = (specifier: string, importer: string) => Promise<string | undefined>
621
+
622
+ function viteResolver(config: ResolvedConfig): Resolver {
623
+ const resolver = config.createResolver()
624
+ return (specifier, importer) => resolver(specifier, importer, false, false)
625
+ }
626
+
627
+ /**
628
+ * Generate Tailwind `@source` directives for exactly the published shared UI
629
+ * modules the app's client graph reaches (static, re-exported and literal lazy
630
+ * imports), instead of scanning every component the package ships. The client
631
+ * build then fails if Rolldown rendered a shared UI module the directives
632
+ * missed, so a discovery gap can never ship unstyled.
633
+ */
634
+ export function tailwindSources(options: TailwindSourcesOptions): Plugin {
635
+ const label = `${options.name}-ui-tailwind-sources`
636
+ const paths = uiSourcePaths(options)
637
+ let uiRoot = ''
638
+ let uiSourceRoot = ''
639
+ let sourcePackageRoots: string[] = []
640
+ let repositoryRoot = ''
641
+ let generatedFiles: string[] = []
642
+
643
+ const generate = async (resolveId: Resolver, config: ResolvedConfig): Promise<string[]> => {
644
+ const files = await collectUiSourceFiles({
645
+ entrypoint: paths.entrypoints,
646
+ repositoryRoot,
647
+ uiPackageRoot: uiRoot,
648
+ uiSourceRoot,
649
+ sourcePackageRoots,
650
+ resolveId,
651
+ label,
652
+ })
653
+ await options.check?.({
654
+ command: config.command,
655
+ repositoryRoot,
656
+ files,
657
+ linkedImports: (specifier) =>
658
+ collectLinkedImports({
659
+ entrypoint: paths.entrypoints,
660
+ repositoryRoot,
661
+ uiSourceRoot,
662
+ sourcePackageRoots,
663
+ specifier,
664
+ resolveId,
665
+ label,
666
+ }),
667
+ })
668
+ writeIfChanged(
669
+ paths.stylesheetPath,
670
+ formatUiSourceDirectives({
671
+ files,
672
+ uiPackageRoot: uiRoot,
673
+ stablePackagePath: paths.stablePackagePath,
674
+ stylesheetPath: paths.stylesheetPath,
675
+ label,
676
+ })
677
+ )
678
+ writeIfChanged(
679
+ paths.manifestPath,
680
+ `${JSON.stringify(packageRelativePaths(files, uiRoot), null, 2)}\n`
681
+ )
682
+ return files
683
+ }
684
+
685
+ return {
686
+ name: label,
687
+ enforce: 'pre',
688
+ async configResolved(config) {
689
+ repositoryRoot = realpathSync(paths.repositoryRoot)
690
+ const resolveId = viteResolver(config)
691
+ const entrypoint = paths.entrypoints[0]
692
+ if (!entrypoint) throw new Error(`[${label}] no client entrypoints`)
693
+ const manifest = await resolveId('@adea-ai/ui/package.json', entrypoint)
694
+ if (!manifest) throw new Error(`[${label}] unable to resolve @adea-ai/ui/package.json`)
695
+ uiRoot = realpathSync(dirname(modulePath(manifest)))
696
+ uiSourceRoot = realpathSync(resolve(uiRoot, 'src'))
697
+ sourcePackageRoots = await frameworkSourceRoots(resolveId, entrypoint, label)
698
+ // Bun links the package here; a hoisted install may not, while the
699
+ // generated directives reference the package through this stable path.
700
+ if (!existsSync(paths.stablePackagePath)) {
701
+ mkdirSync(dirname(paths.stablePackagePath), { recursive: true })
702
+ symlinkSync(uiRoot, paths.stablePackagePath, 'dir')
703
+ }
704
+ if (realpathSync(paths.stablePackagePath) !== uiRoot)
705
+ throw new Error(
706
+ `[${label}] stable package link ${paths.stablePackagePath} does not resolve to ${uiRoot}`
707
+ )
708
+ generatedFiles = await generate(resolveId, config)
709
+ },
710
+ configureServer(server) {
711
+ for (const path of options.watch ?? []) server.watcher.add(resolve(options.webRoot, path))
712
+ },
713
+ async handleHotUpdate({ file, modules, server }) {
714
+ if (!generatedFiles.length || !isCodeFile(file)) return
715
+ const previous = packageRelativePaths(generatedFiles, uiRoot).join('\n')
716
+ generatedFiles = await generate(viteResolver(server.config), server.config)
717
+ if (packageRelativePaths(generatedFiles, uiRoot).join('\n') === previous) return
718
+ // Keep lexical graph keys; aliased roots may use their physical path instead.
719
+ const styles =
720
+ server.moduleGraph.getModulesByFile(normalizePath(paths.styleEntry)) ??
721
+ server.moduleGraph.getModulesByFile(normalizePath(modulePath(paths.styleEntry)))
722
+ if (!styles) return
723
+ for (const module of styles) server.moduleGraph.invalidateModule(module)
724
+ // Returning only the stylesheet would drop the edited module from the
725
+ // update list, so keep the modules Vite already selected for the file.
726
+ return [...new Set([...modules, ...styles])]
727
+ },
728
+ generateBundle(_options, bundle) {
729
+ // Server bundles render shared UI the client never ships; Tailwind only
730
+ // styles the client.
731
+ const environment = (this as { environment?: { config: { consumer?: string } } }).environment
732
+ if (environment && environment.config.consumer !== 'client') return
733
+ const renderedIds: string[] = []
734
+ for (const output of Object.values(bundle)) {
735
+ if (output.type !== 'chunk') continue
736
+ for (const [id, module] of Object.entries(output.modules)) {
737
+ // Rolldown also records wholly tree-shaken modules with zero bytes.
738
+ if (module.renderedLength > 0) renderedIds.push(id)
739
+ }
740
+ }
741
+ if (!renderedIds.some((id) => inside(modulePath(id), uiSourceRoot)))
742
+ this.error(`[${label}] the bundle rendered no shared UI source modules`)
743
+ const missing = missingRenderedUiSources(renderedIds, generatedFiles, uiRoot)
744
+ if (missing.length)
745
+ this.error(
746
+ `[${label}] Tailwind source discovery missed rendered shared UI modules:\n${missing.map((path) => `- ${path}`).join('\n')}`
747
+ )
748
+ },
749
+ }
750
+ }
751
+
752
+ function packageRelativePaths(files: string[], uiRoot: string): string[] {
753
+ return files.map((file) => relative(uiRoot, file).replaceAll('\\', '/')).toSorted()
754
+ }