@asanchez-sa/abby 0.0.0-stage → 0.1.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 (391) hide show
  1. package/README.md +245 -2
  2. package/dist/_virtual/_rolldown/runtime.js +26 -0
  3. package/dist/agents/approvals.d.ts +46 -0
  4. package/dist/agents/approvals.js +58 -0
  5. package/dist/agents/changes.d.ts +21 -0
  6. package/dist/agents/changes.js +21 -0
  7. package/dist/agents/hooks.d.ts +20 -0
  8. package/dist/agents/hooks.js +58 -0
  9. package/dist/agents/index.d.ts +11 -0
  10. package/dist/agents/index.js +9 -0
  11. package/dist/agents/run-tool.d.ts +44 -0
  12. package/dist/agents/run-tool.js +79 -0
  13. package/dist/agents/ui-sdk.d.ts +5 -0
  14. package/dist/agents/ui-sdk.js +3 -0
  15. package/dist/behaviors/canvas/index.d.ts +2 -0
  16. package/dist/behaviors/canvas/index.js +1 -0
  17. package/dist/behaviors/canvas/ui-sdk.d.ts +2 -0
  18. package/dist/behaviors/canvas/ui-sdk.js +1 -0
  19. package/dist/behaviors/drag-and-drop/index.d.ts +2 -0
  20. package/dist/behaviors/drag-and-drop/index.js +1 -0
  21. package/dist/behaviors/drag-and-drop/ui-sdk.d.ts +2 -0
  22. package/dist/behaviors/drag-and-drop/ui-sdk.js +1 -0
  23. package/dist/behaviors/dragging/index.d.ts +2 -0
  24. package/dist/behaviors/dragging/index.js +1 -0
  25. package/dist/behaviors/dragging/ui-sdk.d.ts +2 -0
  26. package/dist/behaviors/dragging/ui-sdk.js +1 -0
  27. package/dist/behaviors/focus/index.d.ts +2 -0
  28. package/dist/behaviors/focus/index.js +1 -0
  29. package/dist/behaviors/focus/ui-sdk.d.ts +2 -0
  30. package/dist/behaviors/focus/ui-sdk.js +1 -0
  31. package/dist/behaviors/lists/index.d.ts +3 -0
  32. package/dist/behaviors/lists/index.js +3 -0
  33. package/dist/behaviors/lists/ui-sdk.d.ts +3 -0
  34. package/dist/behaviors/lists/ui-sdk.js +3 -0
  35. package/dist/behaviors/popups/index.d.ts +3 -0
  36. package/dist/behaviors/popups/index.js +3 -0
  37. package/dist/behaviors/popups/ui-sdk.d.ts +3 -0
  38. package/dist/behaviors/popups/ui-sdk.js +3 -0
  39. package/dist/behaviors/preferences/index.d.ts +3 -0
  40. package/dist/behaviors/preferences/index.js +3 -0
  41. package/dist/behaviors/preferences/ui-sdk.d.ts +3 -0
  42. package/dist/behaviors/preferences/ui-sdk.js +3 -0
  43. package/dist/behaviors/selection/index.d.ts +3 -0
  44. package/dist/behaviors/selection/index.js +3 -0
  45. package/dist/behaviors/selection/indicator.d.ts +13 -0
  46. package/dist/behaviors/selection/indicator.js +20 -0
  47. package/dist/behaviors/selection/ui-sdk.d.ts +2 -0
  48. package/dist/behaviors/selection/ui-sdk.js +1 -0
  49. package/dist/behaviors/transitions/index.d.ts +3 -0
  50. package/dist/behaviors/transitions/index.js +3 -0
  51. package/dist/behaviors/transitions/ui-sdk.d.ts +3 -0
  52. package/dist/behaviors/transitions/ui-sdk.js +3 -0
  53. package/dist/behaviors/trees/index.d.ts +2 -0
  54. package/dist/behaviors/trees/index.js +1 -0
  55. package/dist/behaviors/trees/ui-sdk.d.ts +2 -0
  56. package/dist/behaviors/trees/ui-sdk.js +1 -0
  57. package/dist/components/accordion/accordion.d.ts +13 -0
  58. package/dist/components/accordion/accordion.js +165 -0
  59. package/dist/components/alert/alert.d.ts +13 -0
  60. package/dist/components/alert/alert.js +131 -0
  61. package/dist/components/alert-dialog/alert-dialog.d.ts +15 -0
  62. package/dist/components/alert-dialog/alert-dialog.js +257 -0
  63. package/dist/components/aspect-ratio/aspect-ratio.d.ts +7 -0
  64. package/dist/components/aspect-ratio/aspect-ratio.js +57 -0
  65. package/dist/components/attachment/attachment.d.ts +48 -0
  66. package/dist/components/attachment/attachment.js +372 -0
  67. package/dist/components/autocomplete/autocomplete.d.ts +32 -0
  68. package/dist/components/autocomplete/autocomplete.js +466 -0
  69. package/dist/components/avatar/avatar.d.ts +6 -0
  70. package/dist/components/avatar/avatar.js +100 -0
  71. package/dist/components/avatar-group/avatar-group.d.ts +9 -0
  72. package/dist/components/avatar-group/avatar-group.js +75 -0
  73. package/dist/components/badge/badge.d.ts +15 -0
  74. package/dist/components/badge/badge.js +31 -0
  75. package/dist/components/breadcrumb/breadcrumb.d.ts +24 -0
  76. package/dist/components/breadcrumb/breadcrumb.js +279 -0
  77. package/dist/components/bubble/bubble.d.ts +26 -0
  78. package/dist/components/bubble/bubble.js +173 -0
  79. package/dist/components/button/button.d.ts +18 -0
  80. package/dist/components/button/button.js +91 -0
  81. package/dist/components/button-group/button-group.d.ts +15 -0
  82. package/dist/components/button-group/button-group.js +71 -0
  83. package/dist/components/calendar/calendar.d.ts +29 -0
  84. package/dist/components/calendar/calendar.js +453 -0
  85. package/dist/components/card/card.d.ts +14 -0
  86. package/dist/components/card/card.js +213 -0
  87. package/dist/components/carousel/carousel.d.ts +16 -0
  88. package/dist/components/carousel/carousel.js +364 -0
  89. package/dist/components/chain-of-thought/chain-of-thought.d.ts +72 -0
  90. package/dist/components/chain-of-thought/chain-of-thought.js +491 -0
  91. package/dist/components/chat/chat.d.ts +48 -0
  92. package/dist/components/chat/chat.js +207 -0
  93. package/dist/components/checkbox/checkbox.d.ts +10 -0
  94. package/dist/components/checkbox/checkbox.js +118 -0
  95. package/dist/components/checkpoint/checkpoint.d.ts +24 -0
  96. package/dist/components/checkpoint/checkpoint.js +178 -0
  97. package/dist/components/choice-cards/choice-cards.d.ts +38 -0
  98. package/dist/components/choice-cards/choice-cards.js +255 -0
  99. package/dist/components/code-block/code-block.d.ts +58 -0
  100. package/dist/components/code-block/code-block.js +506 -0
  101. package/dist/components/code-block/highlighter.js +96 -0
  102. package/dist/components/code-block/use-highlighted-code.d.ts +11 -0
  103. package/dist/components/code-block/use-highlighted-code.js +54 -0
  104. package/dist/components/collapsible/collapsible.d.ts +10 -0
  105. package/dist/components/collapsible/collapsible.js +92 -0
  106. package/dist/components/color-picker/color-picker.d.ts +17 -0
  107. package/dist/components/color-picker/color-picker.js +395 -0
  108. package/dist/components/combobox/combobox.d.ts +54 -0
  109. package/dist/components/combobox/combobox.js +683 -0
  110. package/dist/components/command/command.d.ts +23 -0
  111. package/dist/components/command/command.js +373 -0
  112. package/dist/components/command-dock/command-dock.d.ts +118 -0
  113. package/dist/components/command-dock/command-dock.js +944 -0
  114. package/dist/components/confirmation/confirmation.d.ts +58 -0
  115. package/dist/components/confirmation/confirmation.js +181 -0
  116. package/dist/components/context/context.d.ts +82 -0
  117. package/dist/components/context/context.js +490 -0
  118. package/dist/components/date-input/date-input.d.ts +16 -0
  119. package/dist/components/date-input/date-input.js +89 -0
  120. package/dist/components/date-picker/date-picker.d.ts +28 -0
  121. package/dist/components/date-picker/date-picker.js +361 -0
  122. package/dist/components/dialog/dialog.d.ts +14 -0
  123. package/dist/components/dialog/dialog.js +261 -0
  124. package/dist/components/drawer/drawer.d.ts +16 -0
  125. package/dist/components/drawer/drawer.js +309 -0
  126. package/dist/components/empty/empty.d.ts +18 -0
  127. package/dist/components/empty/empty.js +192 -0
  128. package/dist/components/field/field.d.ts +15 -0
  129. package/dist/components/field/field.js +261 -0
  130. package/dist/components/file-input/file-input.d.ts +12 -0
  131. package/dist/components/file-input/file-input.js +216 -0
  132. package/dist/components/file-tree/file-tree.d.ts +45 -0
  133. package/dist/components/file-tree/file-tree.js +283 -0
  134. package/dist/components/hover-card/hover-card.d.ts +10 -0
  135. package/dist/components/hover-card/hover-card.js +118 -0
  136. package/dist/components/icon/icon.d.ts +14 -0
  137. package/dist/components/icon/icon.js +60 -0
  138. package/dist/components/image-cropper/image-cropper.d.ts +15 -0
  139. package/dist/components/image-cropper/image-cropper.js +334 -0
  140. package/dist/components/inline-citation/inline-citation.d.ts +46 -0
  141. package/dist/components/inline-citation/inline-citation.js +269 -0
  142. package/dist/components/input/input.d.ts +9 -0
  143. package/dist/components/input/input.js +43 -0
  144. package/dist/components/input-group/input-group.d.ts +42 -0
  145. package/dist/components/input-group/input-group.js +192 -0
  146. package/dist/components/item/item.d.ts +32 -0
  147. package/dist/components/item/item.js +394 -0
  148. package/dist/components/kbd/kbd.d.ts +9 -0
  149. package/dist/components/kbd/kbd.js +75 -0
  150. package/dist/components/label/label.d.ts +6 -0
  151. package/dist/components/label/label.js +40 -0
  152. package/dist/components/link/link.d.ts +21 -0
  153. package/dist/components/link/link.js +126 -0
  154. package/dist/components/listbox/listbox.d.ts +20 -0
  155. package/dist/components/listbox/listbox.js +199 -0
  156. package/dist/components/marker/marker.d.ts +11 -0
  157. package/dist/components/marker/marker.js +88 -0
  158. package/dist/components/menu/menu.d.ts +38 -0
  159. package/dist/components/menu/menu.js +553 -0
  160. package/dist/components/menubar/menubar.d.ts +9 -0
  161. package/dist/components/menubar/menubar.js +47 -0
  162. package/dist/components/message/message.d.ts +44 -0
  163. package/dist/components/message/message.js +328 -0
  164. package/dist/components/message-scroller/message-scroller.d.ts +111 -0
  165. package/dist/components/message-scroller/message-scroller.js +957 -0
  166. package/dist/components/meter/meter.d.ts +8 -0
  167. package/dist/components/meter/meter.js +162 -0
  168. package/dist/components/model-selector/model-selector.d.ts +155 -0
  169. package/dist/components/model-selector/model-selector.js +905 -0
  170. package/dist/components/native-select/native-select.d.ts +27 -0
  171. package/dist/components/native-select/native-select.js +226 -0
  172. package/dist/components/navigation-menu/navigation-menu.d.ts +29 -0
  173. package/dist/components/navigation-menu/navigation-menu.js +318 -0
  174. package/dist/components/not-label.js +9 -0
  175. package/dist/components/note-editor/blocks.d.ts +22 -0
  176. package/dist/components/note-editor/blocks.js +245 -0
  177. package/dist/components/note-editor/diff.d.ts +19 -0
  178. package/dist/components/note-editor/diff.js +64 -0
  179. package/dist/components/note-editor/editor.js +249 -0
  180. package/dist/components/note-editor/note-editor.d.ts +109 -0
  181. package/dist/components/note-editor/note-editor.js +954 -0
  182. package/dist/components/note-editor/parts/comments.d.ts +24 -0
  183. package/dist/components/note-editor/parts/comments.js +337 -0
  184. package/dist/components/note-editor/parts/header.d.ts +25 -0
  185. package/dist/components/note-editor/parts/header.js +263 -0
  186. package/dist/components/note-editor/parts/history.d.ts +56 -0
  187. package/dist/components/note-editor/parts/history.js +409 -0
  188. package/dist/components/note-editor/parts/presence.d.ts +31 -0
  189. package/dist/components/note-editor/parts/presence.js +140 -0
  190. package/dist/components/note-editor/parts/suggestions.d.ts +45 -0
  191. package/dist/components/note-editor/parts/suggestions.js +316 -0
  192. package/dist/components/note-editor/parts/toolbar.d.ts +38 -0
  193. package/dist/components/note-editor/parts/toolbar.js +687 -0
  194. package/dist/components/note-editor/people.d.ts +84 -0
  195. package/dist/components/note-editor/people.js +276 -0
  196. package/dist/components/note-editor/person.d.ts +11 -0
  197. package/dist/components/note-editor/person.js +15 -0
  198. package/dist/components/note-place/note-place.d.ts +42 -0
  199. package/dist/components/note-place/note-place.js +256 -0
  200. package/dist/components/note-status/note-status.d.ts +59 -0
  201. package/dist/components/note-status/note-status.js +380 -0
  202. package/dist/components/number-input/number-input.d.ts +12 -0
  203. package/dist/components/number-input/number-input.js +252 -0
  204. package/dist/components/otp-input/otp-input.d.ts +12 -0
  205. package/dist/components/otp-input/otp-input.js +136 -0
  206. package/dist/components/pagination/pagination.d.ts +23 -0
  207. package/dist/components/pagination/pagination.js +218 -0
  208. package/dist/components/password-input/password-input.d.ts +11 -0
  209. package/dist/components/password-input/password-input.js +117 -0
  210. package/dist/components/plan/plan.d.ts +51 -0
  211. package/dist/components/plan/plan.js +320 -0
  212. package/dist/components/popover/popover.d.ts +16 -0
  213. package/dist/components/popover/popover.js +268 -0
  214. package/dist/components/preferences/preferences.d.ts +5 -0
  215. package/dist/components/preferences/preferences.js +18 -0
  216. package/dist/components/progress/progress.d.ts +8 -0
  217. package/dist/components/progress/progress.js +162 -0
  218. package/dist/components/prompt-input/prompt-input.d.ts +247 -0
  219. package/dist/components/prompt-input/prompt-input.js +1367 -0
  220. package/dist/components/questionnaire/questionnaire.d.ts +174 -0
  221. package/dist/components/questionnaire/questionnaire.js +1628 -0
  222. package/dist/components/queue/queue.d.ts +82 -0
  223. package/dist/components/queue/queue.js +471 -0
  224. package/dist/components/radio/radio.d.ts +7 -0
  225. package/dist/components/radio/radio.js +101 -0
  226. package/dist/components/rating/rating.d.ts +10 -0
  227. package/dist/components/rating/rating.js +95 -0
  228. package/dist/components/reasoning/reasoning.d.ts +50 -0
  229. package/dist/components/reasoning/reasoning.js +233 -0
  230. package/dist/components/resizable/resizable.d.ts +6 -0
  231. package/dist/components/resizable/resizable.js +100 -0
  232. package/dist/components/scroll-area/scroll-area.d.ts +17 -0
  233. package/dist/components/scroll-area/scroll-area.js +211 -0
  234. package/dist/components/segmented-control/segmented-control.d.ts +16 -0
  235. package/dist/components/segmented-control/segmented-control.js +142 -0
  236. package/dist/components/select/select.d.ts +43 -0
  237. package/dist/components/select/select.js +577 -0
  238. package/dist/components/separator/separator.d.ts +4 -0
  239. package/dist/components/separator/separator.js +38 -0
  240. package/dist/components/sheet/sheet.d.ts +24 -0
  241. package/dist/components/sheet/sheet.js +330 -0
  242. package/dist/components/sidebar/sidebar.d.ts +138 -0
  243. package/dist/components/sidebar/sidebar.js +1374 -0
  244. package/dist/components/skeleton/skeleton.d.ts +4 -0
  245. package/dist/components/skeleton/skeleton.js +40 -0
  246. package/dist/components/slider/slider.d.ts +9 -0
  247. package/dist/components/slider/slider.js +193 -0
  248. package/dist/components/sources/sources.d.ts +35 -0
  249. package/dist/components/sources/sources.js +209 -0
  250. package/dist/components/spinner/spinner.d.ts +11 -0
  251. package/dist/components/spinner/spinner.js +59 -0
  252. package/dist/components/stack-trace/parse-stack-trace.d.ts +21 -0
  253. package/dist/components/stack-trace/parse-stack-trace.js +61 -0
  254. package/dist/components/stack-trace/stack-trace.d.ts +79 -0
  255. package/dist/components/stack-trace/stack-trace.js +434 -0
  256. package/dist/components/subagent/subagent.d.ts +71 -0
  257. package/dist/components/subagent/subagent.js +450 -0
  258. package/dist/components/suggestion/suggestion.d.ts +21 -0
  259. package/dist/components/suggestion/suggestion.js +130 -0
  260. package/dist/components/switch/switch.d.ts +6 -0
  261. package/dist/components/switch/switch.js +70 -0
  262. package/dist/components/table/table.d.ts +19 -0
  263. package/dist/components/table/table.js +284 -0
  264. package/dist/components/table-of-contents/spy.js +84 -0
  265. package/dist/components/table-of-contents/table-of-contents.d.ts +92 -0
  266. package/dist/components/table-of-contents/table-of-contents.js +787 -0
  267. package/dist/components/tabs/tabs.d.ts +25 -0
  268. package/dist/components/tabs/tabs.js +273 -0
  269. package/dist/components/task/task.d.ts +40 -0
  270. package/dist/components/task/task.js +262 -0
  271. package/dist/components/terminal/terminal.d.ts +82 -0
  272. package/dist/components/terminal/terminal.js +457 -0
  273. package/dist/components/test-results/test-results.d.ts +127 -0
  274. package/dist/components/test-results/test-results.js +687 -0
  275. package/dist/components/textarea/textarea.d.ts +8 -0
  276. package/dist/components/textarea/textarea.js +43 -0
  277. package/dist/components/time-input/time-input.d.ts +7 -0
  278. package/dist/components/time-input/time-input.js +82 -0
  279. package/dist/components/timeline/timeline.d.ts +19 -0
  280. package/dist/components/timeline/timeline.js +247 -0
  281. package/dist/components/toast/toast.d.ts +12 -0
  282. package/dist/components/toast/toast.js +285 -0
  283. package/dist/components/toggle/toggle.d.ts +15 -0
  284. package/dist/components/toggle/toggle.js +137 -0
  285. package/dist/components/token-input/token-input.d.ts +7 -0
  286. package/dist/components/token-input/token-input.js +117 -0
  287. package/dist/components/tool/tool.d.ts +66 -0
  288. package/dist/components/tool/tool.js +413 -0
  289. package/dist/components/toolbar/toolbar.d.ts +91 -0
  290. package/dist/components/toolbar/toolbar.js +655 -0
  291. package/dist/components/tooltip/tooltip.d.ts +8 -0
  292. package/dist/components/tooltip/tooltip.js +97 -0
  293. package/dist/components/trace/trace.d.ts +31 -0
  294. package/dist/components/trace/trace.js +309 -0
  295. package/dist/components/tree/tree.d.ts +13 -0
  296. package/dist/components/tree/tree.js +258 -0
  297. package/dist/components/trigger-menu/trigger-menu.d.ts +30 -0
  298. package/dist/components/trigger-menu/trigger-menu.js +352 -0
  299. package/dist/components/usage/usage.d.ts +132 -0
  300. package/dist/components/usage/usage.js +1368 -0
  301. package/dist/components/waterfall/waterfall.d.ts +20 -0
  302. package/dist/components/waterfall/waterfall.js +360 -0
  303. package/dist/components/week-strip/week-strip.d.ts +177 -0
  304. package/dist/components/week-strip/week-strip.js +1081 -0
  305. package/dist/core/index.d.ts +7 -0
  306. package/dist/core/index.js +27 -0
  307. package/dist/core/ui-sdk.d.ts +3 -0
  308. package/dist/core/ui-sdk.js +3 -0
  309. package/dist/core/use-primitive-state.d.ts +14 -0
  310. package/dist/core/use-primitive-state.js +25 -0
  311. package/dist/styles/LICENSE-shadcn.md +21 -0
  312. package/dist/styles/color-scheme.css +32 -0
  313. package/dist/styles/components.css +303 -0
  314. package/dist/styles/index.css +41 -0
  315. package/dist/styles/tokens.css +474 -0
  316. package/dist/styles/typeset/shadcn.css +506 -0
  317. package/dist/styles/typeset.css +70 -0
  318. package/dist/styles/utilities.css +555 -0
  319. package/dist/tools/observe/index.d.ts +2 -0
  320. package/dist/tools/observe/index.js +3 -0
  321. package/dist/tools/observe/ui-sdk.d.ts +1 -0
  322. package/dist/tools/observe/ui-sdk.js +2 -0
  323. package/dist/tools/testing/check-agent.d.ts +28 -0
  324. package/dist/tools/testing/check-agent.js +42 -0
  325. package/dist/tools/testing/index.d.ts +4 -0
  326. package/dist/tools/testing/index.js +4 -0
  327. package/dist/tools/testing/ui-sdk.d.ts +1 -0
  328. package/dist/tools/testing/ui-sdk.js +2 -0
  329. package/dist/utilities/cn/index.d.ts +12 -0
  330. package/dist/utilities/cn/index.js +47 -0
  331. package/dist/utilities/color/index.d.ts +2 -0
  332. package/dist/utilities/color/index.js +3 -0
  333. package/dist/utilities/color/ui-sdk.d.ts +1 -0
  334. package/dist/utilities/color/ui-sdk.js +2 -0
  335. package/dist/utilities/date/index.d.ts +2 -0
  336. package/dist/utilities/date/index.js +6 -0
  337. package/dist/utilities/date/ui-sdk.d.ts +1 -0
  338. package/dist/utilities/date/ui-sdk.js +2 -0
  339. package/dist/utilities/image/index.d.ts +2 -0
  340. package/dist/utilities/image/index.js +3 -0
  341. package/dist/utilities/image/ui-sdk.d.ts +1 -0
  342. package/dist/utilities/image/ui-sdk.js +2 -0
  343. package/dist/utilities/mobile/index.d.ts +2 -0
  344. package/dist/utilities/mobile/index.js +1 -0
  345. package/dist/utilities/mobile/ui-sdk.d.ts +2 -0
  346. package/dist/utilities/mobile/ui-sdk.js +1 -0
  347. package/dist/utilities/number/index.d.ts +2 -0
  348. package/dist/utilities/number/index.js +3 -0
  349. package/dist/utilities/number/ui-sdk.d.ts +1 -0
  350. package/dist/utilities/number/ui-sdk.js +2 -0
  351. package/dist/utilities/platform/index.d.ts +3 -0
  352. package/dist/utilities/platform/index.js +14 -0
  353. package/dist/utilities/platform/ui-sdk.d.ts +3 -0
  354. package/dist/utilities/platform/ui-sdk.js +3 -0
  355. package/dist/utilities/storage/index.d.ts +2 -0
  356. package/dist/utilities/storage/index.js +1 -0
  357. package/dist/utilities/storage/ui-sdk.d.ts +2 -0
  358. package/dist/utilities/storage/ui-sdk.js +1 -0
  359. package/dist/utilities/text/index.d.ts +3 -0
  360. package/dist/utilities/text/index.js +3 -0
  361. package/dist/utilities/text/ui-sdk.d.ts +3 -0
  362. package/dist/utilities/text/ui-sdk.js +3 -0
  363. package/package.json +192 -4
  364. package/skills/agent-ready-ui/SKILL.md +229 -0
  365. package/skills/blocks/SKILL.md +262 -0
  366. package/skills/compose-screens/SKILL.md +354 -0
  367. package/skills/note-editor/SKILL.md +493 -0
  368. package/skills/note-status/SKILL.md +295 -0
  369. package/skills/setup/SKILL.md +136 -0
  370. package/skills/theming/SKILL.md +216 -0
  371. package/src/blocks/notes/adapters.ts +77 -0
  372. package/src/blocks/notes/data.ts +508 -0
  373. package/src/blocks/notes/notes-block.tsx +244 -0
  374. package/src/blocks/notes/parts/home.tsx +219 -0
  375. package/src/blocks/notes/parts/no-access.tsx +84 -0
  376. package/src/blocks/notes/parts/note-screen.tsx +412 -0
  377. package/src/blocks/notes/parts/notes-sidebar.tsx +277 -0
  378. package/src/blocks/notes/parts/panels.tsx +393 -0
  379. package/src/blocks/notes/parts/place.ts +15 -0
  380. package/src/blocks/notes/parts/review-dialog.tsx +159 -0
  381. package/src/blocks/notes/parts/share.tsx +172 -0
  382. package/src/blocks/notes/texts.ts +135 -0
  383. package/src/blocks/shell/adapters.ts +69 -0
  384. package/src/blocks/shell/data.ts +281 -0
  385. package/src/blocks/shell/parts/compose.tsx +292 -0
  386. package/src/blocks/shell/parts/home.tsx +203 -0
  387. package/src/blocks/shell/parts/marks.tsx +144 -0
  388. package/src/blocks/shell/parts/rail.tsx +166 -0
  389. package/src/blocks/shell/parts/rooms-column.tsx +326 -0
  390. package/src/blocks/shell/shell-block.tsx +210 -0
  391. package/src/blocks/shell/texts.ts +80 -0
@@ -0,0 +1,506 @@
1
+ "use client";
2
+ import { cn, cnState, cva } from "../../utilities/cn/index.js";
3
+ import { Button } from "../button/button.js";
4
+ import { Icon } from "../icon/icon.js";
5
+ import { useHighlightedCode } from "./use-highlighted-code.js";
6
+ import { c } from "react/compiler-runtime";
7
+ import { useEffect, useState } from "react";
8
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
9
+ import { Copy01Icon, Tick02Icon } from "@hugeicons/core-free-icons";
10
+ // src/components/code-block/code-block.tsx
11
+ const codeBlockVariants = cva("group/code-block relative flex w-full min-w-0 flex-col overflow-hidden rounded-xl border text-sm focus-outline data-[size=sm]:text-xs has-[>[data-slot=code-block-content]:focus-visible]:focus-mark", {
12
+ variants: { variant: {
13
+ default: "border-border bg-card text-card-foreground",
14
+ destructive: "border-destructive/30 bg-card text-destructive"
15
+ } },
16
+ defaultVariants: { variant: "default" }
17
+ });
18
+ function CodeBlock(t0) {
19
+ const $ = c(13);
20
+ let className;
21
+ let props;
22
+ let t1;
23
+ let variant;
24
+ if ($[0] !== t0) {
25
+ ({className, variant, size: t1, ...props} = t0);
26
+ $[0] = t0;
27
+ $[1] = className;
28
+ $[2] = props;
29
+ $[3] = t1;
30
+ $[4] = variant;
31
+ } else {
32
+ className = $[1];
33
+ props = $[2];
34
+ t1 = $[3];
35
+ variant = $[4];
36
+ }
37
+ const size = t1 === void 0 ? "default" : t1;
38
+ const t2 = variant ?? "default";
39
+ let t3;
40
+ if ($[5] !== className || $[6] !== variant) {
41
+ t3 = cn(codeBlockVariants({ variant }), className);
42
+ $[5] = className;
43
+ $[6] = variant;
44
+ $[7] = t3;
45
+ } else t3 = $[7];
46
+ let t4;
47
+ if ($[8] !== props || $[9] !== size || $[10] !== t2 || $[11] !== t3) {
48
+ t4 = /* @__PURE__ */ jsx("div", {
49
+ "data-slot": "code-block",
50
+ "data-variant": t2,
51
+ "data-size": size,
52
+ className: t3,
53
+ ...props
54
+ });
55
+ $[8] = props;
56
+ $[9] = size;
57
+ $[10] = t2;
58
+ $[11] = t3;
59
+ $[12] = t4;
60
+ } else t4 = $[12];
61
+ return t4;
62
+ }
63
+ /** A row above the content for a title and actions. */
64
+ function CodeBlockHeader(t0) {
65
+ const $ = c(8);
66
+ let className;
67
+ let props;
68
+ if ($[0] !== t0) {
69
+ ({className, ...props} = t0);
70
+ $[0] = t0;
71
+ $[1] = className;
72
+ $[2] = props;
73
+ } else {
74
+ className = $[1];
75
+ props = $[2];
76
+ }
77
+ let t1;
78
+ if ($[3] !== className) {
79
+ t1 = cn("flex min-w-0 shrink-0 items-center gap-2 px-3 pt-3 text-muted-foreground group-data-[size=sm]/code-block:px-2.5 group-data-[size=sm]/code-block:pt-2.5 group-data-[variant=destructive]/code-block:text-destructive *:has-[>[data-slot=code-block-title]]:min-w-0", className);
80
+ $[3] = className;
81
+ $[4] = t1;
82
+ } else t1 = $[4];
83
+ let t2;
84
+ if ($[5] !== props || $[6] !== t1) {
85
+ t2 = /* @__PURE__ */ jsx("div", {
86
+ "data-slot": "code-block-header",
87
+ className: t1,
88
+ ...props
89
+ });
90
+ $[5] = props;
91
+ $[6] = t1;
92
+ $[7] = t2;
93
+ } else t2 = $[7];
94
+ return t2;
95
+ }
96
+ /** A filename or a label, with an optional icon. It truncates. */
97
+ function CodeBlockTitle(t0) {
98
+ const $ = c(8);
99
+ let className;
100
+ let props;
101
+ if ($[0] !== t0) {
102
+ ({className, ...props} = t0);
103
+ $[0] = t0;
104
+ $[1] = className;
105
+ $[2] = props;
106
+ } else {
107
+ className = $[1];
108
+ props = $[2];
109
+ }
110
+ let t1;
111
+ if ($[3] !== className) {
112
+ t1 = cn("min-w-0 truncate font-sans text-sm font-medium text-foreground group-data-[size=sm]/code-block:text-xs group-data-[variant=destructive]/code-block:text-destructive [&_svg]:pointer-events-none [&_svg]:inline-block [&_svg]:size-3.5 [&_svg]:align-middle *:[svg]:me-1.5", className);
113
+ $[3] = className;
114
+ $[4] = t1;
115
+ } else t1 = $[4];
116
+ let t2;
117
+ if ($[5] !== props || $[6] !== t1) {
118
+ t2 = /* @__PURE__ */ jsx("div", {
119
+ "data-slot": "code-block-title",
120
+ className: t1,
121
+ ...props
122
+ });
123
+ $[5] = props;
124
+ $[6] = t1;
125
+ $[7] = t2;
126
+ } else t2 = $[7];
127
+ return t2;
128
+ }
129
+ /**
130
+ * Buttons at the end of the header. As a direct child of `CodeBlock` it floats
131
+ * at the top end, and shows on hover, on focus and on touch screens.
132
+ */
133
+ function CodeBlockActions(t0) {
134
+ const $ = c(8);
135
+ let className;
136
+ let props;
137
+ if ($[0] !== t0) {
138
+ ({className, ...props} = t0);
139
+ $[0] = t0;
140
+ $[1] = className;
141
+ $[2] = props;
142
+ } else {
143
+ className = $[1];
144
+ props = $[2];
145
+ }
146
+ let t1;
147
+ if ($[3] !== className) {
148
+ t1 = cn("-my-1 ms-auto -me-1.5 flex shrink-0 items-center gap-1 [[data-slot=code-block]>&]:absolute [[data-slot=code-block]>&]:end-2 [[data-slot=code-block]>&]:top-2 [[data-slot=code-block]>&]:z-10 [[data-slot=code-block]>&]:m-0 [[data-slot=code-block]>&]:opacity-0 [[data-slot=code-block]>&]:transition-opacity [[data-slot=code-block]>&]:group-focus-within/code-block:opacity-100 [[data-slot=code-block]>&]:group-hover/code-block:opacity-100 group-data-[size=sm]/code-block:[[data-slot=code-block]>&]:end-1.5 group-data-[size=sm]/code-block:[[data-slot=code-block]>&]:top-1.5 [[data-slot=code-block]>&]:pointer-coarse:opacity-100 [[data-slot=code-block]>&]:*:[button]:bg-background [[data-slot=code-block]>&]:*:[button]:ring-1 [[data-slot=code-block]>&]:*:[button]:ring-foreground/10", className);
149
+ $[3] = className;
150
+ $[4] = t1;
151
+ } else t1 = $[4];
152
+ let t2;
153
+ if ($[5] !== props || $[6] !== t1) {
154
+ t2 = /* @__PURE__ */ jsx("div", {
155
+ "data-slot": "code-block-actions",
156
+ className: t1,
157
+ ...props
158
+ });
159
+ $[5] = props;
160
+ $[6] = t1;
161
+ $[7] = t2;
162
+ } else t2 = $[7];
163
+ return t2;
164
+ }
165
+ /** The icon of a button in `CodeBlockActions`, next to `size="icon-xs"`. */
166
+ const codeBlockActionClasses = "[&_svg]:size-3.5";
167
+ /**
168
+ * A ghost icon button that copies `value`. Its name is `aria-label`, "Copy" by
169
+ * default; it stays the same after a copy, so an agent finds the button by one
170
+ * name, and a live region announces `copiedLabel`.
171
+ */
172
+ function CodeBlockCopyButton(t0) {
173
+ const $ = c(35);
174
+ let children;
175
+ let className;
176
+ let onClick;
177
+ let props;
178
+ let t1;
179
+ let t2;
180
+ let t3;
181
+ let t4;
182
+ let value;
183
+ if ($[0] !== t0) {
184
+ ({value, copiedLabel: t1, variant: t2, size: t3, className, onClick, children, "aria-label": t4, ...props} = t0);
185
+ $[0] = t0;
186
+ $[1] = children;
187
+ $[2] = className;
188
+ $[3] = onClick;
189
+ $[4] = props;
190
+ $[5] = t1;
191
+ $[6] = t2;
192
+ $[7] = t3;
193
+ $[8] = t4;
194
+ $[9] = value;
195
+ } else {
196
+ children = $[1];
197
+ className = $[2];
198
+ onClick = $[3];
199
+ props = $[4];
200
+ t1 = $[5];
201
+ t2 = $[6];
202
+ t3 = $[7];
203
+ t4 = $[8];
204
+ value = $[9];
205
+ }
206
+ const copiedLabel = t1 === void 0 ? "Copied" : t1;
207
+ const variant = t2 === void 0 ? "ghost" : t2;
208
+ const size = t3 === void 0 ? "icon-xs" : t3;
209
+ const label = t4 === void 0 ? "Copy" : t4;
210
+ const [copied, setCopied] = useState(false);
211
+ let t5;
212
+ let t6;
213
+ if ($[10] !== copied) {
214
+ t5 = () => {
215
+ if (!copied) return;
216
+ const timeout = setTimeout(() => setCopied(false), 2e3);
217
+ return () => clearTimeout(timeout);
218
+ };
219
+ t6 = [copied];
220
+ $[10] = copied;
221
+ $[11] = t5;
222
+ $[12] = t6;
223
+ } else {
224
+ t5 = $[11];
225
+ t6 = $[12];
226
+ }
227
+ useEffect(t5, t6);
228
+ const t7 = copied || void 0;
229
+ let t8;
230
+ if ($[13] !== className) {
231
+ t8 = cnState(codeBlockActionClasses, className);
232
+ $[13] = className;
233
+ $[14] = t8;
234
+ } else t8 = $[14];
235
+ let t9;
236
+ if ($[15] !== onClick || $[16] !== value) {
237
+ t9 = (event, details) => {
238
+ navigator.clipboard.writeText(value).then(() => setCopied(true)).catch(_temp);
239
+ return onClick?.(event, details);
240
+ };
241
+ $[15] = onClick;
242
+ $[16] = value;
243
+ $[17] = t9;
244
+ } else t9 = $[17];
245
+ let t10;
246
+ if ($[18] !== children || $[19] !== copied) {
247
+ t10 = children ?? /* @__PURE__ */ jsx(Icon, { icon: copied ? Tick02Icon : Copy01Icon });
248
+ $[18] = children;
249
+ $[19] = copied;
250
+ $[20] = t10;
251
+ } else t10 = $[20];
252
+ let t11;
253
+ if ($[21] !== label || $[22] !== props || $[23] !== size || $[24] !== t10 || $[25] !== t7 || $[26] !== t8 || $[27] !== t9 || $[28] !== variant) {
254
+ t11 = /* @__PURE__ */ jsx(Button, {
255
+ "data-slot": "code-block-copy-button",
256
+ "data-copied": t7,
257
+ variant,
258
+ size,
259
+ "aria-label": label,
260
+ className: t8,
261
+ onClick: t9,
262
+ ...props,
263
+ children: t10
264
+ });
265
+ $[21] = label;
266
+ $[22] = props;
267
+ $[23] = size;
268
+ $[24] = t10;
269
+ $[25] = t7;
270
+ $[26] = t8;
271
+ $[27] = t9;
272
+ $[28] = variant;
273
+ $[29] = t11;
274
+ } else t11 = $[29];
275
+ const t12 = copied ? copiedLabel : "";
276
+ let t13;
277
+ if ($[30] !== t12) {
278
+ t13 = /* @__PURE__ */ jsx("span", {
279
+ "aria-live": "polite",
280
+ className: "sr-only",
281
+ children: t12
282
+ });
283
+ $[30] = t12;
284
+ $[31] = t13;
285
+ } else t13 = $[31];
286
+ let t14;
287
+ if ($[32] !== t11 || $[33] !== t13) {
288
+ t14 = /* @__PURE__ */ jsxs(Fragment$1, { children: [t11, t13] });
289
+ $[32] = t11;
290
+ $[33] = t13;
291
+ $[34] = t14;
292
+ } else t14 = $[34];
293
+ return t14;
294
+ }
295
+ function _temp() {}
296
+ /**
297
+ * The `pre` that scrolls or wraps. It takes a string or a list of
298
+ * `CodeBlockLine`. It is a tab stop so the keyboard can scroll it, named by
299
+ * `aria-label`, "Code" by default; `tabIndex={-1}` removes the stop.
300
+ */
301
+ function CodeBlockContent(t0) {
302
+ const $ = c(29);
303
+ let children;
304
+ let className;
305
+ let labelledBy;
306
+ let props;
307
+ let style;
308
+ let t1;
309
+ let t2;
310
+ let t3;
311
+ let t4;
312
+ if ($[0] !== t0) {
313
+ ({className, children, style, wrap: t1, lineNumbers: t2, startLine: t3, "aria-label": t4, "aria-labelledby": labelledBy, ...props} = t0);
314
+ $[0] = t0;
315
+ $[1] = children;
316
+ $[2] = className;
317
+ $[3] = labelledBy;
318
+ $[4] = props;
319
+ $[5] = style;
320
+ $[6] = t1;
321
+ $[7] = t2;
322
+ $[8] = t3;
323
+ $[9] = t4;
324
+ } else {
325
+ children = $[1];
326
+ className = $[2];
327
+ labelledBy = $[3];
328
+ props = $[4];
329
+ style = $[5];
330
+ t1 = $[6];
331
+ t2 = $[7];
332
+ t3 = $[8];
333
+ t4 = $[9];
334
+ }
335
+ const wrap = t1 === void 0 ? false : t1;
336
+ const lineNumbers = t2 === void 0 ? false : t2;
337
+ const startLine = t3 === void 0 ? 1 : t3;
338
+ const label = t4 === void 0 ? "Code" : t4;
339
+ const t5 = wrap || void 0;
340
+ const t6 = lineNumbers || void 0;
341
+ const t7 = labelledBy ? void 0 : label;
342
+ const t8 = `line ${startLine - 1}`;
343
+ let t9;
344
+ if ($[10] !== style || $[11] !== t8) {
345
+ t9 = {
346
+ counterReset: t8,
347
+ ...style
348
+ };
349
+ $[10] = style;
350
+ $[11] = t8;
351
+ $[12] = t9;
352
+ } else t9 = $[12];
353
+ let t10;
354
+ if ($[13] !== className) {
355
+ t10 = cn("m-0 min-h-0 min-w-0 scroll-fade-x overflow-auto px-3 py-3 text-start font-mono leading-relaxed outline-none [scrollbar-width:thin] group-has-data-[slot=code-block-footer]/code-block:pb-2 group-has-data-[slot=code-block-header]/code-block:pt-2 group-data-[size=sm]/code-block:px-2.5 group-data-[size=sm]/code-block:py-2.5 group-data-[size=sm]/code-block:group-has-data-[slot=code-block-header]/code-block:pt-1.5 data-wrap:scroll-fade-y data-wrap:wrap-break-word data-wrap:whitespace-pre-wrap", className);
356
+ $[13] = className;
357
+ $[14] = t10;
358
+ } else t10 = $[14];
359
+ let t11;
360
+ if ($[15] !== children || $[16] !== lineNumbers) {
361
+ t11 = lineNumbers && typeof children === "string" ? children.replace(/\n$/, "").split("\n").map(_temp2) : children;
362
+ $[15] = children;
363
+ $[16] = lineNumbers;
364
+ $[17] = t11;
365
+ } else t11 = $[17];
366
+ let t12;
367
+ if ($[18] !== t11) {
368
+ t12 = /* @__PURE__ */ jsx("code", {
369
+ "data-slot": "code-block-code",
370
+ className: "grid min-h-lh min-w-max content-start in-data-numbered:grid-cols-[auto_1fr] in-data-wrap:min-w-0",
371
+ children: t11
372
+ });
373
+ $[18] = t11;
374
+ $[19] = t12;
375
+ } else t12 = $[19];
376
+ let t13;
377
+ if ($[20] !== labelledBy || $[21] !== props || $[22] !== t10 || $[23] !== t12 || $[24] !== t5 || $[25] !== t6 || $[26] !== t7 || $[27] !== t9) {
378
+ t13 = /* @__PURE__ */ jsx("pre", {
379
+ "data-slot": "code-block-content",
380
+ "data-wrap": t5,
381
+ "data-numbered": t6,
382
+ dir: "ltr",
383
+ role: "group",
384
+ "aria-label": t7,
385
+ "aria-labelledby": labelledBy,
386
+ tabIndex: 0,
387
+ style: t9,
388
+ className: t10,
389
+ ...props,
390
+ children: t12
391
+ });
392
+ $[20] = labelledBy;
393
+ $[21] = props;
394
+ $[22] = t10;
395
+ $[23] = t12;
396
+ $[24] = t5;
397
+ $[25] = t6;
398
+ $[26] = t7;
399
+ $[27] = t9;
400
+ $[28] = t13;
401
+ } else t13 = $[28];
402
+ return t13;
403
+ }
404
+ function _temp2(line, index) {
405
+ return /* @__PURE__ */ jsx(CodeBlockLine, { children: line }, index);
406
+ }
407
+ const codeBlockLineVariants = cva("relative -mx-3 block min-h-lh px-3 group-data-[size=sm]/code-block:-mx-2.5 group-data-[size=sm]/code-block:px-2.5 before:min-w-6 before:text-end before:text-muted-foreground after:absolute after:start-1 after:top-0 after:text-muted-foreground after:select-none in-data-numbered:col-span-2 in-data-numbered:grid in-data-numbered:grid-cols-subgrid in-data-numbered:gap-x-3 in-data-numbered:[counter-increment:line] in-data-numbered:before:content-[counter(line)] in-data-numbered:before:select-none in-data-numbered:supports-[content:counter(line)_/_'']:before:content-[counter(line)_/_'']", {
408
+ variants: { variant: {
409
+ default: "",
410
+ added: "bg-muted after:content-['+']",
411
+ removed: "bg-destructive/10 after:text-destructive after:content-['−']",
412
+ highlighted: "bg-muted"
413
+ } },
414
+ defaultVariants: { variant: "default" }
415
+ });
416
+ /** One line of code. `added` and `removed` draw a diff marker, `highlighted` a tint. */
417
+ function CodeBlockLine(t0) {
418
+ const $ = c(15);
419
+ let children;
420
+ let className;
421
+ let props;
422
+ let variant;
423
+ if ($[0] !== t0) {
424
+ ({className, variant, children, ...props} = t0);
425
+ $[0] = t0;
426
+ $[1] = children;
427
+ $[2] = className;
428
+ $[3] = props;
429
+ $[4] = variant;
430
+ } else {
431
+ children = $[1];
432
+ className = $[2];
433
+ props = $[3];
434
+ variant = $[4];
435
+ }
436
+ const empty = children === void 0 || children === null || children === "" || Array.isArray(children) && children.length === 0;
437
+ const t1 = variant ?? "default";
438
+ let t2;
439
+ if ($[5] !== className || $[6] !== variant) {
440
+ t2 = cn(codeBlockLineVariants({ variant }), className);
441
+ $[5] = className;
442
+ $[6] = variant;
443
+ $[7] = t2;
444
+ } else t2 = $[7];
445
+ const t3 = empty ? "\n" : children;
446
+ let t4;
447
+ if ($[8] !== t3) {
448
+ t4 = /* @__PURE__ */ jsx("span", {
449
+ "data-slot": "code-block-line-content",
450
+ className: "min-w-0",
451
+ children: t3
452
+ });
453
+ $[8] = t3;
454
+ $[9] = t4;
455
+ } else t4 = $[9];
456
+ let t5;
457
+ if ($[10] !== props || $[11] !== t1 || $[12] !== t2 || $[13] !== t4) {
458
+ t5 = /* @__PURE__ */ jsx("span", {
459
+ "data-slot": "code-block-line",
460
+ "data-variant": t1,
461
+ className: t2,
462
+ ...props,
463
+ children: t4
464
+ });
465
+ $[10] = props;
466
+ $[11] = t1;
467
+ $[12] = t2;
468
+ $[13] = t4;
469
+ $[14] = t5;
470
+ } else t5 = $[14];
471
+ return t5;
472
+ }
473
+ /** A row below the content, such as for a Show More button. */
474
+ function CodeBlockFooter(t0) {
475
+ const $ = c(8);
476
+ let className;
477
+ let props;
478
+ if ($[0] !== t0) {
479
+ ({className, ...props} = t0);
480
+ $[0] = t0;
481
+ $[1] = className;
482
+ $[2] = props;
483
+ } else {
484
+ className = $[1];
485
+ props = $[2];
486
+ }
487
+ let t1;
488
+ if ($[3] !== className) {
489
+ t1 = cn("flex min-w-0 shrink-0 items-center gap-2 px-3 pb-3 text-muted-foreground group-data-[size=sm]/code-block:px-2.5 group-data-[size=sm]/code-block:pb-2.5", className);
490
+ $[3] = className;
491
+ $[4] = t1;
492
+ } else t1 = $[4];
493
+ let t2;
494
+ if ($[5] !== props || $[6] !== t1) {
495
+ t2 = /* @__PURE__ */ jsx("div", {
496
+ "data-slot": "code-block-footer",
497
+ className: t1,
498
+ ...props
499
+ });
500
+ $[5] = props;
501
+ $[6] = t1;
502
+ $[7] = t2;
503
+ } else t2 = $[7];
504
+ return t2;
505
+ }
506
+ export { CodeBlock, CodeBlockActions, CodeBlockContent, CodeBlockCopyButton, CodeBlockFooter, CodeBlockHeader, CodeBlockLine, CodeBlockTitle, codeBlockActionClasses, codeBlockLineVariants, codeBlockVariants, useHighlightedCode };
@@ -0,0 +1,96 @@
1
+ import { createElement } from "react";
2
+ import { createHighlighterCore } from "shiki/core";
3
+ import { createJavaScriptRegexEngine } from "shiki/engine/javascript";
4
+ // src/components/code-block/highlighter.ts
5
+ const languages = {
6
+ bash: () => import("shiki/langs/shellscript.mjs"),
7
+ css: () => import("shiki/langs/css.mjs"),
8
+ diff: () => import("shiki/langs/diff.mjs"),
9
+ html: () => import("shiki/langs/html.mjs"),
10
+ javascript: () => import("shiki/langs/javascript.mjs"),
11
+ json: () => import("shiki/langs/json.mjs"),
12
+ jsx: () => import("shiki/langs/jsx.mjs"),
13
+ markdown: () => import("shiki/langs/markdown.mjs"),
14
+ python: () => import("shiki/langs/python.mjs"),
15
+ sql: () => import("shiki/langs/sql.mjs"),
16
+ tsx: () => import("shiki/langs/tsx.mjs"),
17
+ typescript: () => import("shiki/langs/typescript.mjs"),
18
+ yaml: () => import("shiki/langs/yaml.mjs")
19
+ };
20
+ const aliases = {
21
+ js: "javascript",
22
+ md: "markdown",
23
+ py: "python",
24
+ sh: "bash",
25
+ shell: "bash",
26
+ shellscript: "bash",
27
+ ts: "typescript",
28
+ yml: "yaml",
29
+ zsh: "bash"
30
+ };
31
+ let highlighter;
32
+ function getHighlighter() {
33
+ highlighter ??= createHighlighterCore({
34
+ themes: [import("shiki/themes/github-light.mjs"), import("shiki/themes/github-dark.mjs")],
35
+ langs: [],
36
+ engine: createJavaScriptRegexEngine({ forgiving: true })
37
+ });
38
+ return highlighter;
39
+ }
40
+ function getLanguage(language) {
41
+ const name = language.toLowerCase();
42
+ if (name === "ansi") return name;
43
+ if (name in languages) return name;
44
+ return aliases[name] ?? null;
45
+ }
46
+ const tokenClasses = "[color:light-dark(oklch(from_var(--shiki-light)_min(l,0.48)_c_h_/_1),oklch(from_var(--shiki-dark)_max(l,0.72)_c_h_/_1))]";
47
+ const dim = /^#[\da-f]{6}80$/i;
48
+ function renderToken(content, style = {}, key) {
49
+ if (dim.test(style["--shiki-light"] ?? "")) return createElement("span", {
50
+ key,
51
+ className: "text-muted-foreground"
52
+ }, content);
53
+ return createElement("span", {
54
+ key,
55
+ className: tokenClasses,
56
+ style: {
57
+ "--shiki-light": style["--shiki-light"],
58
+ "--shiki-dark": style["--shiki-dark"],
59
+ fontStyle: style["--shiki-light-font-style"],
60
+ fontWeight: style["--shiki-light-font-weight"],
61
+ textDecoration: style["--shiki-light-text-decoration"]
62
+ }
63
+ }, content);
64
+ }
65
+ /**
66
+ * Loads a language and returns a highlighter for it, or null for a language
67
+ * that is not listed.
68
+ */
69
+ async function loadHighlighter(language) {
70
+ const lang = getLanguage(language);
71
+ if (!lang) return null;
72
+ const shiki = await getHighlighter();
73
+ if (lang !== "ansi" && !shiki.getLoadedLanguages().includes(lang)) await shiki.loadLanguage(languages[lang]);
74
+ return {
75
+ /**
76
+ * Returns one React node per line, and the grammar state after the last
77
+ * line. Pass that state back to continue where the code left off.
78
+ */
79
+ highlight(code, state) {
80
+ const tokenize = (text) => shiki.codeToTokens(text, {
81
+ lang,
82
+ themes: {
83
+ light: "github-light",
84
+ dark: "github-dark"
85
+ },
86
+ defaultColor: false,
87
+ grammarState: state
88
+ }).tokens;
89
+ const tokens = lang === "ansi" ? code.split("\n").flatMap((line) => tokenize(line)) : tokenize(code);
90
+ return {
91
+ lines: tokens.map((line) => line.map((token, index) => renderToken(token.content, token.htmlStyle, index))),
92
+ state: lang === "ansi" ? void 0 : shiki.getLastGrammarState(tokens)
93
+ };
94
+ } };
95
+ }
96
+ export { loadHighlighter };
@@ -0,0 +1,11 @@
1
+ import { ReactNode } from "react";
2
+ /**
3
+ * Highlights `value` and returns one React node per line, for `CodeBlockLine`.
4
+ * It returns the plain lines on the server, until Shiki has loaded, and for a
5
+ * language that is not listed in `highlighter.ts`. `"ansi"` renders the colors
6
+ * of terminal output.
7
+ *
8
+ * Shiki is imported the first time a block calls this, so a page that never
9
+ * highlights doesn't load it.
10
+ */
11
+ export declare function useHighlightedCode(value: string, language: string): ReactNode[];
@@ -0,0 +1,54 @@
1
+ import { useEffect, useState } from "react";
2
+ // src/components/code-block/use-highlighted-code.ts
3
+ /**
4
+ * Highlights `value` and returns one React node per line, for `CodeBlockLine`.
5
+ * It returns the plain lines on the server, until Shiki has loaded, and for a
6
+ * language that is not listed in `highlighter.ts`. `"ansi"` renders the colors
7
+ * of terminal output.
8
+ *
9
+ * Shiki is imported the first time a block calls this, so a page that never
10
+ * highlights doesn't load it.
11
+ */
12
+ function useHighlightedCode(value, language) {
13
+ const code = value.endsWith("\n") ? value.slice(0, -1) : value;
14
+ const [loaded, setLoaded] = useState(null);
15
+ const highlighter = loaded?.language === language ? loaded.highlighter : null;
16
+ useEffect(() => {
17
+ let cancelled = false;
18
+ import("./highlighter.js").then(({ loadHighlighter }) => loadHighlighter(language)).then((next) => {
19
+ if (!cancelled) setLoaded({
20
+ language,
21
+ highlighter: next
22
+ });
23
+ }).catch(() => {});
24
+ return () => {
25
+ cancelled = true;
26
+ };
27
+ }, [language]);
28
+ const [done, setDone] = useState({
29
+ highlighter: null,
30
+ text: "",
31
+ lines: []
32
+ });
33
+ let next_0 = done;
34
+ if (next_0.highlighter !== highlighter || !code.startsWith(next_0.text)) next_0 = {
35
+ highlighter,
36
+ text: "",
37
+ lines: []
38
+ };
39
+ const end = code.lastIndexOf("\n") + 1;
40
+ if (highlighter && end > next_0.text.length) {
41
+ const result = highlighter.highlight(code.slice(next_0.text.length, end - 1), next_0.state);
42
+ next_0 = {
43
+ highlighter,
44
+ text: code.slice(0, end),
45
+ lines: [...next_0.lines, ...result.lines],
46
+ state: result.state
47
+ };
48
+ }
49
+ if (next_0 !== done && (next_0.highlighter !== done.highlighter || next_0.text !== done.text)) setDone(next_0);
50
+ if (!highlighter) return code.split("\n");
51
+ const tail = highlighter.highlight(code.slice(end), next_0.state).lines[0];
52
+ return [...next_0.lines, tail];
53
+ }
54
+ export { useHighlightedCode };
@@ -0,0 +1,10 @@
1
+ import { ButtonLook } from "../button/button.js";
2
+ import { ComponentProps } from "react";
3
+ import { Collapsible as Collapsible$1, CollapsibleController, CollapsiblePanel as CollapsiblePanel$1, CollapsibleTrigger as CollapsibleTrigger$1, createCollapsibleController } from "@ui-sdk/react/collapsible";
4
+ type CollapsibleProps = ComponentProps<typeof Collapsible$1>;
5
+ declare function Collapsible(props: CollapsibleProps): import("react").JSX.Element;
6
+ type CollapsibleTriggerProps = ComponentProps<typeof CollapsibleTrigger$1> & ButtonLook;
7
+ /** Unstyled but for its focus ring. Give it a `variant` or a `size` to look like a button. */
8
+ declare function CollapsibleTrigger({ variant, size, className, ...props }: CollapsibleTriggerProps): import("react").JSX.Element;
9
+ declare function CollapsiblePanel({ className, ...props }: ComponentProps<typeof CollapsiblePanel$1>): import("react").JSX.Element;
10
+ export { Collapsible, type CollapsibleController, CollapsiblePanel, type CollapsibleProps, CollapsibleTrigger, type CollapsibleTriggerProps, createCollapsibleController };