@adea-ai/ui 0.152.1 → 0.152.3

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 (271) hide show
  1. package/dist/components/composites/about-dialog/about-dialog.js +2 -2
  2. package/dist/components/composites/about-dialog/about-dialog.js.map +1 -1
  3. package/dist/components/composites/accent-picker/accent-picker.js.map +1 -1
  4. package/dist/components/composites/accent-picker/custom-color-popover.js.map +1 -1
  5. package/dist/components/composites/account-menu/account-menu.js.map +1 -1
  6. package/dist/components/composites/action-button/action-button.js.map +1 -1
  7. package/dist/components/composites/appearance-editor/accent-swatch-groups.js.map +1 -1
  8. package/dist/components/composites/appearance-editor/appearance-choices.js.map +1 -1
  9. package/dist/components/composites/appearance-editor/appearance-editor.js +3 -3
  10. package/dist/components/composites/appearance-editor/appearance-editor.js.map +1 -1
  11. package/dist/components/composites/appearance-editor/appearance-rows.js.map +1 -1
  12. package/dist/components/composites/appearance-editor/font-settings-group.js.map +1 -1
  13. package/dist/components/composites/appearance-editor/theme-preview.js.map +1 -1
  14. package/dist/components/composites/catalog-browser/catalog-browser-group.js.map +1 -1
  15. package/dist/components/composites/catalog-browser/catalog-browser.js.map +1 -1
  16. package/dist/components/composites/catalog-browser/catalog-detail.js.map +1 -1
  17. package/dist/components/composites/chain-of-thought/chain-of-thought.js.map +1 -1
  18. package/dist/components/composites/chat/chat.js.map +1 -1
  19. package/dist/components/composites/checkpoint/checkpoint.js.map +1 -1
  20. package/dist/components/composites/confirmation/confirmation.js.map +1 -1
  21. package/dist/components/composites/context/context.js.map +1 -1
  22. package/dist/components/composites/file-tree/file-tree.js.map +1 -1
  23. package/dist/components/composites/help-center/help-center.js.map +1 -1
  24. package/dist/components/composites/icon-picker/icon-picker.js.map +1 -1
  25. package/dist/components/composites/inline-citation/inline-citation.js.map +1 -1
  26. package/dist/components/composites/list-row/list-row-control.js.map +1 -1
  27. package/dist/components/composites/list-row/list-row.js.map +1 -1
  28. package/dist/components/composites/message-scroller/message-scroller.js.map +1 -1
  29. package/dist/components/composites/model-selector/model-selector.js +3 -0
  30. package/dist/components/composites/model-selector/model-selector.js.map +1 -1
  31. package/dist/components/composites/plan/plan.js.map +1 -1
  32. package/dist/components/composites/queue/queue.js.map +1 -1
  33. package/dist/components/composites/reasoning/reasoning.js.map +1 -1
  34. package/dist/components/composites/scene-controls/scene-controls.js.map +1 -1
  35. package/dist/components/composites/settings/settings-layout.js.map +1 -1
  36. package/dist/components/composites/settings/settings-navigation.js.map +1 -1
  37. package/dist/components/composites/settings/settings.js.map +1 -1
  38. package/dist/components/composites/sources/sources.js.map +1 -1
  39. package/dist/components/composites/stack-trace/stack-trace.js.map +1 -1
  40. package/dist/components/composites/stat/stat.js.map +1 -1
  41. package/dist/components/composites/subagent/subagent.js.map +1 -1
  42. package/dist/components/composites/suggestion/suggestion.js.map +1 -1
  43. package/dist/components/composites/task/task.js.map +1 -1
  44. package/dist/components/composites/terminal/terminal.js +1 -1
  45. package/dist/components/composites/terminal/terminal.js.map +1 -1
  46. package/dist/components/composites/test-results/test-results.js.map +1 -1
  47. package/dist/components/composites/tool/tool.js.map +1 -1
  48. package/dist/components/composites/tree/tree.js.map +1 -1
  49. package/dist/components/composites/update-dialog/channel-control.js +3 -3
  50. package/dist/components/composites/update-dialog/channel-control.js.map +1 -1
  51. package/dist/components/composites/update-dialog/update-dialog.d.ts.map +1 -1
  52. package/dist/components/composites/update-dialog/update-dialog.js +3 -3
  53. package/dist/components/composites/update-dialog/update-dialog.js.map +1 -1
  54. package/dist/components/composites/workspace-mark/workspace-mark.js.map +1 -1
  55. package/dist/components/composites/workspace-switcher/workspace-reorder-dialog.js.map +1 -1
  56. package/dist/components/composites/workspace-switcher/workspace-switcher.js.map +1 -1
  57. package/dist/components/conversation/atomic/chat-composer.js.map +1 -1
  58. package/dist/components/conversation/busy-send-button.js.map +1 -1
  59. package/dist/components/conversation/chat-composer.js.map +1 -1
  60. package/dist/components/conversation/composer-menu.js.map +1 -1
  61. package/dist/components/conversation/conversation-avatar.js.map +1 -1
  62. package/dist/components/conversation/conversation-pane.js.map +1 -1
  63. package/dist/components/conversation/conversation-surface.js.map +1 -1
  64. package/dist/components/conversation/internal/chat-composer-shell.js +1 -1
  65. package/dist/components/conversation/internal/chat-composer-shell.js.map +1 -1
  66. package/dist/components/conversation/message-composer.d.ts.map +1 -1
  67. package/dist/components/conversation/message-composer.js +1 -1
  68. package/dist/components/conversation/message-composer.js.map +1 -1
  69. package/dist/components/conversation/message-row.js.map +1 -1
  70. package/dist/components/conversation/paste-token-editor.js.map +1 -1
  71. package/dist/components/conversation/thread-panel.js.map +1 -1
  72. package/dist/components/conversation/transcript-composition.js.map +1 -1
  73. package/dist/components/layout/app-shell/app-shell.js.map +1 -1
  74. package/dist/components/layout/app-shell/skip-link.js.map +1 -1
  75. package/dist/components/layout/contextual-sidebar/contextual-sidebar.js.map +1 -1
  76. package/dist/components/layout/contextual-sidebar/mobile-contextual-sidebar.js.map +1 -1
  77. package/dist/components/layout/floating-preview/floating-preview.js.map +1 -1
  78. package/dist/components/layout/orbit-layout/orbit-layout.js.map +1 -1
  79. package/dist/components/layout/page/page.js.map +1 -1
  80. package/dist/components/layout/panel/panel.js.map +1 -1
  81. package/dist/components/layout/pixel-pane/pixel-pane.js.map +1 -1
  82. package/dist/components/layout/pixel-resize-handle/pixel-resize-handle.js.map +1 -1
  83. package/dist/components/layout/shell-rail/shell-rail.js.map +1 -1
  84. package/dist/components/layout/shell-top-bar/shell-top-bar.js.map +1 -1
  85. package/dist/components/layout/side-rail/side-rail.js.map +1 -1
  86. package/dist/components/layout/sidebar-nav/sidebar-nav-resize-handle.js.map +1 -1
  87. package/dist/components/layout/sidebar-nav/sidebar-nav.js.map +1 -1
  88. package/dist/components/layout/split-layout/resize-controller-core-retry.js.map +1 -1
  89. package/dist/components/layout/split-layout/resize-controller-core.js.map +1 -1
  90. package/dist/components/layout/split-layout/split-layout.js +1 -1
  91. package/dist/components/layout/split-layout/split-layout.js.map +1 -1
  92. package/dist/components/layout/status-bar/status-bar.js.map +1 -1
  93. package/dist/components/layout/top-bar/top-bar.js.map +1 -1
  94. package/dist/components/layout/virtual-window/virtual-window.js.map +1 -1
  95. package/dist/components/motion/presence.js.map +1 -1
  96. package/dist/components/theme/appearance-panel.d.ts.map +1 -1
  97. package/dist/components/theme/appearance-panel.js +1 -1
  98. package/dist/components/theme/appearance-panel.js.map +1 -1
  99. package/dist/components/theme/theme-mode-toggle.js.map +1 -1
  100. package/dist/components/theme/theme-picker.js.map +1 -1
  101. package/dist/components/theme/theme-provider.js.map +1 -1
  102. package/dist/components/theme/theme-toggle.js.map +1 -1
  103. package/dist/components/ui/accordion/accordion.js.map +1 -1
  104. package/dist/components/ui/alert/alert.js.map +1 -1
  105. package/dist/components/ui/alert-dialog/alert-dialog.js.map +1 -1
  106. package/dist/components/ui/annotation-surface/annotation-surface.js.map +1 -1
  107. package/dist/components/ui/aspect-ratio/aspect-ratio.js.map +1 -1
  108. package/dist/components/ui/attachment/attachment.js.map +1 -1
  109. package/dist/components/ui/avatar/avatar.js.map +1 -1
  110. package/dist/components/ui/badge/badge.js.map +1 -1
  111. package/dist/components/ui/board/board.js.map +1 -1
  112. package/dist/components/ui/breadcrumb/breadcrumb.js.map +1 -1
  113. package/dist/components/ui/bubble/bubble.js.map +1 -1
  114. package/dist/components/ui/button/button.js.map +1 -1
  115. package/dist/components/ui/button-group/button-group.js.map +1 -1
  116. package/dist/components/ui/calendar/calendar.js.map +1 -1
  117. package/dist/components/ui/callout/callout.js.map +1 -1
  118. package/dist/components/ui/card/card.js.map +1 -1
  119. package/dist/components/ui/carousel/carousel.js.map +1 -1
  120. package/dist/components/ui/chart/chart.js.map +1 -1
  121. package/dist/components/ui/checkbox/checkbox.js.map +1 -1
  122. package/dist/components/ui/code-block/code-block.js.map +1 -1
  123. package/dist/components/ui/collapsible/collapsible.js.map +1 -1
  124. package/dist/components/ui/combobox/combobox.js.map +1 -1
  125. package/dist/components/ui/combobox/value-combobox.js.map +1 -1
  126. package/dist/components/ui/command/command.js.map +1 -1
  127. package/dist/components/ui/context-menu/context-menu.js.map +1 -1
  128. package/dist/components/ui/detail-panel/detail-panel.js.map +1 -1
  129. package/dist/components/ui/dialog/dialog-layer.js.map +1 -1
  130. package/dist/components/ui/dialog/dialog.js.map +1 -1
  131. package/dist/components/ui/diff-block/diff-block.js.map +1 -1
  132. package/dist/components/ui/drawer/drawer.js.map +1 -1
  133. package/dist/components/ui/dropdown-menu/dropdown-menu.js.map +1 -1
  134. package/dist/components/ui/dropdown-menu/menu-parts.js.map +1 -1
  135. package/dist/components/ui/empty/empty-state.js.map +1 -1
  136. package/dist/components/ui/empty/empty.js.map +1 -1
  137. package/dist/components/ui/entity-icon/entity-icon.js.map +1 -1
  138. package/dist/components/ui/field/field.js.map +1 -1
  139. package/dist/components/ui/field/number-field.js.map +1 -1
  140. package/dist/components/ui/hover-card/hover-card.js.map +1 -1
  141. package/dist/components/ui/input/input-control.js.map +1 -1
  142. package/dist/components/ui/input/input.js.map +1 -1
  143. package/dist/components/ui/input-group/input-group.js.map +1 -1
  144. package/dist/components/ui/input-group/secret-input-group.js.map +1 -1
  145. package/dist/components/ui/input-otp/input-otp.js.map +1 -1
  146. package/dist/components/ui/item/item.js.map +1 -1
  147. package/dist/components/ui/kbd/kbd.js.map +1 -1
  148. package/dist/components/ui/label/label.js.map +1 -1
  149. package/dist/components/ui/marker/marker.js.map +1 -1
  150. package/dist/components/ui/menubar/menubar.js.map +1 -1
  151. package/dist/components/ui/message/message.js.map +1 -1
  152. package/dist/components/ui/modal-dialog/modal-dialog.js.map +1 -1
  153. package/dist/components/ui/native-select/native-select.js.map +1 -1
  154. package/dist/components/ui/navigation-menu/navigation-menu.js.map +1 -1
  155. package/dist/components/ui/pagination/pagination.js.map +1 -1
  156. package/dist/components/ui/popover/popover.js.map +1 -1
  157. package/dist/components/ui/progress/progress.js.map +1 -1
  158. package/dist/components/ui/questionnaire/questionnaire.js.map +1 -1
  159. package/dist/components/ui/radio-group/radio-group.js.map +1 -1
  160. package/dist/components/ui/resizable/resizable.js.map +1 -1
  161. package/dist/components/ui/scroll-area/scroll-area.js.map +1 -1
  162. package/dist/components/ui/select/select.js.map +1 -1
  163. package/dist/components/ui/separator/separator.js.map +1 -1
  164. package/dist/components/ui/sheet/sheet.js.map +1 -1
  165. package/dist/components/ui/skeleton/skeleton.js.map +1 -1
  166. package/dist/components/ui/slider/slider.js.map +1 -1
  167. package/dist/components/ui/spinner/spinner.js.map +1 -1
  168. package/dist/components/ui/status-chip/status-chip.js.map +1 -1
  169. package/dist/components/ui/switch/switch.js.map +1 -1
  170. package/dist/components/ui/table/table.js.map +1 -1
  171. package/dist/components/ui/tabs/tabs.js.map +1 -1
  172. package/dist/components/ui/text-link/text-link.js.map +1 -1
  173. package/dist/components/ui/textarea/textarea.js.map +1 -1
  174. package/dist/components/ui/toast/toast.js.map +1 -1
  175. package/dist/components/ui/toggle/toggle.js.map +1 -1
  176. package/dist/components/ui/toggle-group/toggle-group.js.map +1 -1
  177. package/dist/components/ui/tooltip/tooltip.js.map +1 -1
  178. package/dist/components/ui/trace/trace.js.map +1 -1
  179. package/dist/components/ui/typography/typography.js.map +1 -1
  180. package/dist/r/about-dialog.json +1 -1
  181. package/dist/r/accordion.json +1 -1
  182. package/dist/r/account-menu.json +1 -1
  183. package/dist/r/alert.json +1 -1
  184. package/dist/r/appearance-editor.json +1 -1
  185. package/dist/r/attachment.json +1 -1
  186. package/dist/r/breadcrumb.json +1 -1
  187. package/dist/r/calendar.json +1 -1
  188. package/dist/r/carousel.json +1 -1
  189. package/dist/r/catalog-browser.json +1 -1
  190. package/dist/r/chain-of-thought.json +1 -1
  191. package/dist/r/chat.json +1 -1
  192. package/dist/r/checkbox.json +1 -1
  193. package/dist/r/checkpoint.json +1 -1
  194. package/dist/r/code-block.json +1 -1
  195. package/dist/r/combobox.json +1 -1
  196. package/dist/r/command.json +1 -1
  197. package/dist/r/confirmation.json +1 -1
  198. package/dist/r/context.json +1 -1
  199. package/dist/r/conversation.json +1 -1
  200. package/dist/r/detail-panel.json +1 -1
  201. package/dist/r/dialog.json +1 -1
  202. package/dist/r/dropdown-menu.json +1 -1
  203. package/dist/r/empty.json +1 -1
  204. package/dist/r/file-tree.json +1 -1
  205. package/dist/r/floating-preview.json +1 -1
  206. package/dist/r/help-center.json +1 -1
  207. package/dist/r/icon-picker.json +1 -1
  208. package/dist/r/inline-citation.json +1 -1
  209. package/dist/r/lib.json +1 -1
  210. package/dist/r/message-scroller.json +1 -1
  211. package/dist/r/model-selector.json +1 -1
  212. package/dist/r/native-select.json +1 -1
  213. package/dist/r/navigation-menu.json +1 -1
  214. package/dist/r/pagination.json +1 -1
  215. package/dist/r/pixel-resize-handle.json +1 -1
  216. package/dist/r/plan.json +1 -1
  217. package/dist/r/questionnaire.json +1 -1
  218. package/dist/r/queue.json +1 -1
  219. package/dist/r/radio-group.json +1 -1
  220. package/dist/r/reasoning.json +1 -1
  221. package/dist/r/registry.json +65 -65
  222. package/dist/r/resizable.json +1 -1
  223. package/dist/r/scene-controls.json +1 -1
  224. package/dist/r/select.json +1 -1
  225. package/dist/r/settings.json +1 -1
  226. package/dist/r/sheet.json +1 -1
  227. package/dist/r/shell-rail.json +1 -1
  228. package/dist/r/sidebar-nav.json +1 -1
  229. package/dist/r/sources.json +1 -1
  230. package/dist/r/spinner.json +1 -1
  231. package/dist/r/split-layout.json +1 -1
  232. package/dist/r/src/components/composites/about-dialog/about-dialog.tsx +2 -2
  233. package/dist/r/src/components/composites/appearance-editor/appearance-editor.tsx +4 -4
  234. package/dist/r/src/components/composites/model-selector/model-selector.tsx +4 -1
  235. package/dist/r/src/components/composites/terminal/terminal.tsx +2 -2
  236. package/dist/r/src/components/composites/update-dialog/channel-control.tsx +3 -3
  237. package/dist/r/src/components/composites/update-dialog/update-dialog.tsx +3 -5
  238. package/dist/r/src/components/conversation/internal/chat-composer-shell.tsx +1 -1
  239. package/dist/r/src/components/conversation/message-composer.tsx +1 -2
  240. package/dist/r/src/components/layout/split-layout/split-layout.tsx +1 -1
  241. package/dist/r/src/components/theme/appearance-panel.tsx +2 -4
  242. package/dist/r/stack-trace.json +1 -1
  243. package/dist/r/stat.json +1 -1
  244. package/dist/r/subagent.json +1 -1
  245. package/dist/r/task.json +1 -1
  246. package/dist/r/terminal.json +1 -1
  247. package/dist/r/test-results.json +1 -1
  248. package/dist/r/theming.json +1 -1
  249. package/dist/r/toast.json +1 -1
  250. package/dist/r/tool.json +1 -1
  251. package/dist/r/top-bar.json +1 -1
  252. package/dist/r/trace.json +1 -1
  253. package/dist/r/tree.json +1 -1
  254. package/dist/r/update-dialog.json +1 -1
  255. package/dist/r/workspace-switcher.json +1 -1
  256. package/dist/vite/tailwind-sources.d.ts.map +1 -1
  257. package/dist/vite/tailwind-sources.js +49 -9
  258. package/dist/vite/tailwind-sources.js.map +1 -1
  259. package/package.json +11 -11
  260. package/registry.json +65 -65
  261. package/src/components/composites/about-dialog/about-dialog.tsx +2 -2
  262. package/src/components/composites/appearance-editor/appearance-editor.tsx +4 -4
  263. package/src/components/composites/model-selector/model-selector.tsx +4 -1
  264. package/src/components/composites/terminal/terminal.tsx +2 -2
  265. package/src/components/composites/update-dialog/channel-control.tsx +3 -3
  266. package/src/components/composites/update-dialog/update-dialog.tsx +3 -5
  267. package/src/components/conversation/internal/chat-composer-shell.tsx +1 -1
  268. package/src/components/conversation/message-composer.tsx +1 -2
  269. package/src/components/layout/split-layout/split-layout.tsx +1 -1
  270. package/src/components/theme/appearance-panel.tsx +2 -4
  271. package/src/vite/tailwind-sources.ts +67 -7
@@ -1 +1 @@
1
- {"version":3,"file":"catalog-browser.js","names":["createEffect","createMemo","createSignal","For","onCleanup","Show","ArrowLeft","Blocks","Search","MD_BREAKPOINT","keyedRows","Button","Empty","EmptyContent","EmptyDescription","EmptyHeader","EmptyMedia","EmptyTitle","InputGroup","InputGroupAddon","InputGroupInput","Tabs","TabsContent","TabsList","TabsTrigger","ScrollArea","cn","CatalogBrowserGroup","CatalogLoadingState","CatalogBrowserProps","WIDE_QUERY","CatalogBrowser","props","Value","expandedGroups","setExpandedGroups","ReadonlySet","Set","returnKey","setReturnKey","lastSelectedId","setLastSelectedId","rowRefs","Map","HTMLButtonElement","searchInput","HTMLInputElement","backButton","selectedTab","tabs","find","tab","id","supplemental","kind","selected","selectedId","entries","entry","undefined","groupRows","groups","group","wide","setWide","window","matchMedia","matches","updateWide","event","MediaQueryListEvent","query","addEventListener","removeEventListener","open","selectedEntry","previous","focus","key","row","get","isConnected","registerRow","element","set","delete","selectEntry","value","onSelect","toggleGroup","current","next","has","add","previewCount","countLabel","status","loadingLabel","resultLabel","resultCount","supplementalContent","renderSupplementalView","_el$","_tmpl$","_$insert","_$createComponent","when","fallback","onChange","onTabChange","children","aria-label","tabsLabel","each","label","installError","message","_el$5","_tmpl$4","_el$2","_tmpl$2","_el$3","firstChild","filterControl","ref","type","searchLabel","placeholder","searchPlaceholder","onInput","onQueryChange","currentTarget","role","resultsRegionLabel","orientation","catalogError","variant","title","description","catalogErrorAction","emptyState","emptyStateAction","_el$4","_tmpl$3","item","expanded","disabled","interactionDisabled","installedLabel","showMoreLabel","showLessLabel","renderIcon","onRef","onToggle","notices","notice","_el$6","_tmpl$5","_$effect","_$setAttribute","_el$7","_tmpl$6","size","onClick","onBack","_$memo","backLabel","detailRegionLabel","renderDetail","_$className","class","_$createComponent","_$setAttribute","_$memo","_$className"],"sources":["../../../../src/components/composites/catalog-browser/catalog-browser.tsx"],"sourcesContent":["import { createEffect, createMemo, createSignal, For, onCleanup, Show } from 'solid-js'\nimport { ArrowLeft, Blocks, Search } from 'lucide-solid'\nimport { MD_BREAKPOINT } from '#lib/breakpoints'\nimport { keyedRows } from '#lib/keyed-rows'\nimport { Button } from '../../ui/button'\nimport {\n Empty,\n EmptyContent,\n EmptyDescription,\n EmptyHeader,\n EmptyMedia,\n EmptyTitle,\n} from '../../ui/empty'\nimport { InputGroup, InputGroupAddon, InputGroupInput } from '../../ui/input-group'\nimport { Tabs, TabsContent, TabsList, TabsTrigger } from '../../ui/tabs'\nimport { ScrollArea } from '../../ui/scroll-area'\nimport { cn } from '#lib/utils'\nimport { CatalogBrowserGroup, CatalogLoadingState } from './catalog-browser-group'\nimport type { CatalogBrowserProps } from './catalog-types'\n\nconst WIDE_QUERY = `(min-width: ${MD_BREAKPOINT})`\n\nexport function CatalogBrowser<Value>(props: CatalogBrowserProps<Value>) {\n const [expandedGroups, setExpandedGroups] = createSignal<ReadonlySet<string>>(new Set())\n const [returnKey, setReturnKey] = createSignal<string>()\n const [lastSelectedId, setLastSelectedId] = createSignal<string>()\n const rowRefs = new Map<string, HTMLButtonElement>()\n let searchInput: HTMLInputElement | undefined\n let backButton: HTMLButtonElement | undefined\n\n const selectedTab = createMemo(() => props.tabs.find((tab) => tab.id === props.tab))\n const supplemental = () => selectedTab()?.kind === 'supplemental'\n const selected = createMemo(() => {\n const id = props.selectedId\n return id && !supplemental() ? props.entries.find((entry) => entry.id === id) : undefined\n })\n const groupRows = keyedRows(\n () => props.groups,\n (group) => group.id\n )\n const [wide, setWide] = createSignal(\n typeof window === 'undefined' || window.matchMedia(WIDE_QUERY).matches\n )\n const updateWide = (event: MediaQueryListEvent) => setWide(event.matches)\n\n createEffect(() => {\n if (typeof window === 'undefined') return\n const query = window.matchMedia(WIDE_QUERY)\n query.addEventListener('change', updateWide)\n onCleanup(() => query.removeEventListener('change', updateWide))\n })\n\n createEffect(() => {\n const open = props.open\n const selectedId = props.selectedId\n const selectedEntry = selected()\n if (!open) {\n setExpandedGroups(new Set<string>())\n setLastSelectedId(undefined)\n setReturnKey(undefined)\n return\n }\n if (selectedId && selectedEntry) {\n const previous = lastSelectedId()\n setLastSelectedId(selectedId)\n if (selectedId !== previous) backButton?.focus()\n return\n }\n const previous = lastSelectedId()\n if (!previous) return\n const key = returnKey()\n setLastSelectedId(undefined)\n setReturnKey(undefined)\n const row = key ? rowRefs.get(key) : undefined\n if (row?.isConnected) row.focus()\n else searchInput?.focus()\n })\n\n const registerRow = (key: string, element: HTMLButtonElement | undefined) => {\n if (element) rowRefs.set(key, element)\n else rowRefs.delete(key)\n }\n const selectEntry = (key: string, value: Value) => {\n setReturnKey(key)\n props.onSelect(value)\n }\n const toggleGroup = (id: string) => {\n setExpandedGroups((current) => {\n const next = new Set(current)\n if (next.has(id)) next.delete(id)\n else next.add(id)\n return next\n })\n }\n const previewCount = () => (wide() ? 6 : 3)\n const countLabel = () =>\n props.status === 'loading' ? props.loadingLabel : props.resultLabel(props.resultCount)\n const supplementalContent = () => props.renderSupplementalView?.(props.tab)\n\n return (\n <div class={cn('flex min-h-0 min-w-0 flex-1 flex-col', props.class)}>\n <Show\n when={selected()}\n fallback={\n <Tabs\n class=\"flex min-h-0 min-w-0 flex-1 flex-col gap-0\"\n value={props.tab}\n onChange={(value) => value && props.onTabChange(value)}\n >\n <TabsList aria-label={props.tabsLabel} class=\"ms-auto max-w-full flex-wrap px-4 pt-2\">\n <For each={props.tabs}>\n {(tab) => <TabsTrigger value={tab.id}>{tab.label}</TabsTrigger>}\n </For>\n </TabsList>\n <TabsContent value={props.tab} class=\"flex min-h-0 min-w-0 flex-1 flex-col gap-3\">\n <Show\n when={supplemental()}\n fallback={\n <>\n <Show when={props.installError}>\n {(message) => (\n <p class=\"text-destructive px-4 pt-2 text-sm\" role=\"alert\">\n {message()}\n </p>\n )}\n </Show>\n <div class=\"flex min-w-0 shrink-0 flex-wrap items-center gap-2 px-4 pt-2\">\n {props.filterControl}\n <InputGroup class=\"min-w-0 flex-1 sm:max-w-md\">\n <InputGroupAddon class=\"text-primary\">\n <Search aria-hidden=\"true\" />\n </InputGroupAddon>\n <InputGroupInput\n ref={(element) => (searchInput = element)}\n type=\"search\"\n aria-label={props.searchLabel}\n placeholder={props.searchPlaceholder}\n value={props.query}\n onInput={(event) => props.onQueryChange(event.currentTarget.value)}\n />\n </InputGroup>\n <span\n class=\"text-primary ms-auto text-sm font-medium tabular-nums\"\n role=\"status\"\n >\n {countLabel()}\n </span>\n </div>\n <ScrollArea\n role=\"region\"\n aria-label={props.resultsRegionLabel}\n orientation=\"vertical\"\n class=\"flex min-h-0 min-w-0 flex-1 flex-col gap-5 px-4 pb-4\"\n >\n <Show when={props.status === 'error'}>\n <Empty\n class=\"min-h-0 min-w-0 flex-1\"\n role={props.catalogError.role ?? 'alert'}\n >\n <EmptyHeader>\n <EmptyMedia variant=\"icon\">\n <Blocks aria-hidden=\"true\" />\n </EmptyMedia>\n <EmptyTitle>{props.catalogError.title}</EmptyTitle>\n <EmptyDescription>{props.catalogError.description}</EmptyDescription>\n </EmptyHeader>\n <Show when={props.catalogErrorAction}>\n <EmptyContent>{props.catalogErrorAction}</EmptyContent>\n </Show>\n </Empty>\n </Show>\n <Show when={props.status === 'loading'}>\n <CatalogLoadingState label={props.loadingLabel} />\n </Show>\n <Show when={props.status === 'ready'}>\n <Show\n when={props.resultCount > 0}\n fallback={\n <Empty class=\"min-h-0 min-w-0 flex-1\" role=\"status\">\n <EmptyHeader>\n <EmptyMedia variant=\"icon\">\n <Blocks aria-hidden=\"true\" />\n </EmptyMedia>\n <EmptyTitle>{props.emptyState.title}</EmptyTitle>\n <EmptyDescription>{props.emptyState.description}</EmptyDescription>\n </EmptyHeader>\n <Show when={props.emptyStateAction}>\n <EmptyContent>{props.emptyStateAction}</EmptyContent>\n </Show>\n </Empty>\n }\n >\n <div class=\"grid min-w-0 gap-5\">\n <For each={groupRows()}>\n {(row) => (\n <CatalogBrowserGroup\n group={row.item()}\n expanded={expandedGroups().has(row.item().id)}\n previewCount={previewCount()}\n disabled={props.interactionDisabled ?? false}\n installedLabel={props.installedLabel}\n showMoreLabel={props.showMoreLabel}\n showLessLabel={props.showLessLabel}\n renderIcon={props.renderIcon}\n onSelect={(entry, key) => selectEntry(key, entry.value)}\n onRef={registerRow}\n onToggle={toggleGroup}\n />\n )}\n </For>\n </div>\n </Show>\n </Show>\n <For each={props.notices ?? []}>\n {(notice) => (\n <p class=\"text-muted-foreground text-sm\" role={notice.role}>\n {notice.message}\n </p>\n )}\n </For>\n </ScrollArea>\n </>\n }\n >\n {supplementalContent()}\n </Show>\n </TabsContent>\n </Tabs>\n }\n >\n {(entry) => (\n <div class=\"flex min-h-0 min-w-0 flex-1 flex-col gap-3\" data-catalog-browser-detail>\n <Button\n ref={(element) => (backButton = element)}\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => props.onBack()}\n class=\"mx-4 mt-2 self-start\"\n >\n <ArrowLeft data-icon=\"inline-start\" aria-hidden=\"true\" />\n {props.backLabel}\n </Button>\n <ScrollArea\n role=\"region\"\n aria-label={props.detailRegionLabel}\n orientation=\"vertical\"\n class=\"min-h-0 min-w-0 flex-1 px-4 pb-4\"\n >\n {props.renderDetail(entry().value)}\n </ScrollArea>\n </div>\n )}\n </Show>\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAoBA,IAAM8B,aAAa,eAAerB,cAAa;AAE/C,SAAgBsB,eAAsBC,OAAmC;CACvE,MAAM,CAACE,gBAAgBC,qBAAqBjC,6BAAkC,IAAImC,IAAI,CAAC;CACvF,MAAM,CAACC,WAAWC,gBAAgBrC,aAAqB;CACvD,MAAM,CAACsC,gBAAgBC,qBAAqBvC,aAAqB;CACjE,MAAMwC,0BAAU,IAAIC,IAA+B;CACnD,IAAIE;CACJ,IAAIE;CAEJ,MAAMC,cAAc/C,iBAAiB+B,MAAMiB,KAAKC,MAAMC,QAAQA,IAAIC,OAAOpB,MAAMmB,GAAG,CAAC;CACnF,MAAME,qBAAqBL,YAAY,CAAC,EAAEM,SAAS;CACnD,MAAMC,WAAWtD,iBAAiB;EAChC,MAAMmD,KAAKpB,MAAMwB;EACjB,OAAOJ,MAAM,CAACC,aAAa,IAAIrB,MAAMyB,QAAQP,MAAMQ,UAAUA,MAAMN,OAAOA,EAAE,IAAIO,KAAAA;CAClF,CAAC;CACD,MAAMC,YAAYlD,gBACVsB,MAAM6B,SACXC,UAAUA,MAAMV,EACnB;CACA,MAAM,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AW;KAAA,SAAA;KAAA,IAAAxB,WAAA;MAAA,OAGV9E,MAAMwI,aAAa9G,MAAM,CAAC,CAAC6B,KAAK;KAAC;IAAA,CAAA,GAAA,IAAA;IAAA,OAAAyE;GAAA,EAAA,CAAA;EAGvC,CAAA,CAAA;EAAAF,aAAAW,UAAAnE,MAvJO5E,GAAG,wCAAwCM,MAAM0I,KAAK,CAAC,CAAA;EAAA,OAAApE;CAAA,EAAA,CAAA;AA2JvE"}
1
+ {"version":3,"file":"catalog-browser.js","names":["createEffect","createMemo","createSignal","For","onCleanup","Show","ArrowLeft","Blocks","Search","MD_BREAKPOINT","keyedRows","Button","Empty","EmptyContent","EmptyDescription","EmptyHeader","EmptyMedia","EmptyTitle","InputGroup","InputGroupAddon","InputGroupInput","Tabs","TabsContent","TabsList","TabsTrigger","ScrollArea","cn","CatalogBrowserGroup","CatalogLoadingState","WIDE_QUERY","CatalogBrowser","props","expandedGroups","setExpandedGroups","Set","returnKey","setReturnKey","lastSelectedId","setLastSelectedId","rowRefs","Map","searchInput","backButton","selectedTab","tabs","find","tab","id","supplemental","kind","selected","selectedId","entries","entry","undefined","groupRows","groups","group","wide","setWide","window","matchMedia","matches","updateWide","event","query","addEventListener","removeEventListener","open","selectedEntry","previous","focus","key","row","get","isConnected","registerRow","element","set","delete","selectEntry","value","onSelect","toggleGroup","current","next","has","add","previewCount","countLabel","status","loadingLabel","resultLabel","resultCount","supplementalContent","renderSupplementalView","_el$","_tmpl$","_$insert","_$createComponent","when","fallback","onChange","onTabChange","children","tabsLabel","each","label","installError","message","_el$5","_tmpl$4","_el$2","_tmpl$2","_el$3","firstChild","filterControl","ref","type","searchLabel","placeholder","searchPlaceholder","onInput","onQueryChange","currentTarget","role","resultsRegionLabel","orientation","catalogError","variant","title","description","catalogErrorAction","emptyState","emptyStateAction","_el$4","_tmpl$3","item","expanded","disabled","interactionDisabled","installedLabel","showMoreLabel","showLessLabel","renderIcon","onRef","onToggle","notices","notice","_el$6","_tmpl$5","_$effect","_$setAttribute","_el$7","_tmpl$6","size","onClick","onBack","_$memo","backLabel","detailRegionLabel","renderDetail","_$className","class"],"sources":["../../../../src/components/composites/catalog-browser/catalog-browser.tsx"],"sourcesContent":["import { createEffect, createMemo, createSignal, For, onCleanup, Show } from 'solid-js'\nimport { ArrowLeft, Blocks, Search } from 'lucide-solid'\nimport { MD_BREAKPOINT } from '#lib/breakpoints'\nimport { keyedRows } from '#lib/keyed-rows'\nimport { Button } from '../../ui/button'\nimport {\n Empty,\n EmptyContent,\n EmptyDescription,\n EmptyHeader,\n EmptyMedia,\n EmptyTitle,\n} from '../../ui/empty'\nimport { InputGroup, InputGroupAddon, InputGroupInput } from '../../ui/input-group'\nimport { Tabs, TabsContent, TabsList, TabsTrigger } from '../../ui/tabs'\nimport { ScrollArea } from '../../ui/scroll-area'\nimport { cn } from '#lib/utils'\nimport { CatalogBrowserGroup, CatalogLoadingState } from './catalog-browser-group'\nimport type { CatalogBrowserProps } from './catalog-types'\n\nconst WIDE_QUERY = `(min-width: ${MD_BREAKPOINT})`\n\nexport function CatalogBrowser<Value>(props: CatalogBrowserProps<Value>) {\n const [expandedGroups, setExpandedGroups] = createSignal<ReadonlySet<string>>(new Set())\n const [returnKey, setReturnKey] = createSignal<string>()\n const [lastSelectedId, setLastSelectedId] = createSignal<string>()\n const rowRefs = new Map<string, HTMLButtonElement>()\n let searchInput: HTMLInputElement | undefined\n let backButton: HTMLButtonElement | undefined\n\n const selectedTab = createMemo(() => props.tabs.find((tab) => tab.id === props.tab))\n const supplemental = () => selectedTab()?.kind === 'supplemental'\n const selected = createMemo(() => {\n const id = props.selectedId\n return id && !supplemental() ? props.entries.find((entry) => entry.id === id) : undefined\n })\n const groupRows = keyedRows(\n () => props.groups,\n (group) => group.id\n )\n const [wide, setWide] = createSignal(\n typeof window === 'undefined' || window.matchMedia(WIDE_QUERY).matches\n )\n const updateWide = (event: MediaQueryListEvent) => setWide(event.matches)\n\n createEffect(() => {\n if (typeof window === 'undefined') return\n const query = window.matchMedia(WIDE_QUERY)\n query.addEventListener('change', updateWide)\n onCleanup(() => query.removeEventListener('change', updateWide))\n })\n\n createEffect(() => {\n const open = props.open\n const selectedId = props.selectedId\n const selectedEntry = selected()\n if (!open) {\n setExpandedGroups(new Set<string>())\n setLastSelectedId(undefined)\n setReturnKey(undefined)\n return\n }\n if (selectedId && selectedEntry) {\n const previous = lastSelectedId()\n setLastSelectedId(selectedId)\n if (selectedId !== previous) backButton?.focus()\n return\n }\n const previous = lastSelectedId()\n if (!previous) return\n const key = returnKey()\n setLastSelectedId(undefined)\n setReturnKey(undefined)\n const row = key ? rowRefs.get(key) : undefined\n if (row?.isConnected) row.focus()\n else searchInput?.focus()\n })\n\n const registerRow = (key: string, element: HTMLButtonElement | undefined) => {\n if (element) rowRefs.set(key, element)\n else rowRefs.delete(key)\n }\n const selectEntry = (key: string, value: Value) => {\n setReturnKey(key)\n props.onSelect(value)\n }\n const toggleGroup = (id: string) => {\n setExpandedGroups((current) => {\n const next = new Set(current)\n if (next.has(id)) next.delete(id)\n else next.add(id)\n return next\n })\n }\n const previewCount = () => (wide() ? 6 : 3)\n const countLabel = () =>\n props.status === 'loading' ? props.loadingLabel : props.resultLabel(props.resultCount)\n const supplementalContent = () => props.renderSupplementalView?.(props.tab)\n\n return (\n <div class={cn('flex min-h-0 min-w-0 flex-1 flex-col', props.class)}>\n <Show\n when={selected()}\n fallback={\n <Tabs\n class=\"flex min-h-0 min-w-0 flex-1 flex-col gap-0\"\n value={props.tab}\n onChange={(value) => value && props.onTabChange(value)}\n >\n <TabsList aria-label={props.tabsLabel} class=\"ms-auto max-w-full flex-wrap px-4 pt-2\">\n <For each={props.tabs}>\n {(tab) => <TabsTrigger value={tab.id}>{tab.label}</TabsTrigger>}\n </For>\n </TabsList>\n <TabsContent value={props.tab} class=\"flex min-h-0 min-w-0 flex-1 flex-col gap-3\">\n <Show\n when={supplemental()}\n fallback={\n <>\n <Show when={props.installError}>\n {(message) => (\n <p class=\"text-destructive px-4 pt-2 text-sm\" role=\"alert\">\n {message()}\n </p>\n )}\n </Show>\n <div class=\"flex min-w-0 shrink-0 flex-wrap items-center gap-2 px-4 pt-2\">\n {props.filterControl}\n <InputGroup class=\"min-w-0 flex-1 sm:max-w-md\">\n <InputGroupAddon class=\"text-primary\">\n <Search aria-hidden=\"true\" />\n </InputGroupAddon>\n <InputGroupInput\n ref={(element) => (searchInput = element)}\n type=\"search\"\n aria-label={props.searchLabel}\n placeholder={props.searchPlaceholder}\n value={props.query}\n onInput={(event) => props.onQueryChange(event.currentTarget.value)}\n />\n </InputGroup>\n <span\n class=\"text-primary ms-auto text-sm font-medium tabular-nums\"\n role=\"status\"\n >\n {countLabel()}\n </span>\n </div>\n <ScrollArea\n role=\"region\"\n aria-label={props.resultsRegionLabel}\n orientation=\"vertical\"\n class=\"flex min-h-0 min-w-0 flex-1 flex-col gap-5 px-4 pb-4\"\n >\n <Show when={props.status === 'error'}>\n <Empty\n class=\"min-h-0 min-w-0 flex-1\"\n role={props.catalogError.role ?? 'alert'}\n >\n <EmptyHeader>\n <EmptyMedia variant=\"icon\">\n <Blocks aria-hidden=\"true\" />\n </EmptyMedia>\n <EmptyTitle>{props.catalogError.title}</EmptyTitle>\n <EmptyDescription>{props.catalogError.description}</EmptyDescription>\n </EmptyHeader>\n <Show when={props.catalogErrorAction}>\n <EmptyContent>{props.catalogErrorAction}</EmptyContent>\n </Show>\n </Empty>\n </Show>\n <Show when={props.status === 'loading'}>\n <CatalogLoadingState label={props.loadingLabel} />\n </Show>\n <Show when={props.status === 'ready'}>\n <Show\n when={props.resultCount > 0}\n fallback={\n <Empty class=\"min-h-0 min-w-0 flex-1\" role=\"status\">\n <EmptyHeader>\n <EmptyMedia variant=\"icon\">\n <Blocks aria-hidden=\"true\" />\n </EmptyMedia>\n <EmptyTitle>{props.emptyState.title}</EmptyTitle>\n <EmptyDescription>{props.emptyState.description}</EmptyDescription>\n </EmptyHeader>\n <Show when={props.emptyStateAction}>\n <EmptyContent>{props.emptyStateAction}</EmptyContent>\n </Show>\n </Empty>\n }\n >\n <div class=\"grid min-w-0 gap-5\">\n <For each={groupRows()}>\n {(row) => (\n <CatalogBrowserGroup\n group={row.item()}\n expanded={expandedGroups().has(row.item().id)}\n previewCount={previewCount()}\n disabled={props.interactionDisabled ?? false}\n installedLabel={props.installedLabel}\n showMoreLabel={props.showMoreLabel}\n showLessLabel={props.showLessLabel}\n renderIcon={props.renderIcon}\n onSelect={(entry, key) => selectEntry(key, entry.value)}\n onRef={registerRow}\n onToggle={toggleGroup}\n />\n )}\n </For>\n </div>\n </Show>\n </Show>\n <For each={props.notices ?? []}>\n {(notice) => (\n <p class=\"text-muted-foreground text-sm\" role={notice.role}>\n {notice.message}\n </p>\n )}\n </For>\n </ScrollArea>\n </>\n }\n >\n {supplementalContent()}\n </Show>\n </TabsContent>\n </Tabs>\n }\n >\n {(entry) => (\n <div class=\"flex min-h-0 min-w-0 flex-1 flex-col gap-3\" data-catalog-browser-detail>\n <Button\n ref={(element) => (backButton = element)}\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => props.onBack()}\n class=\"mx-4 mt-2 self-start\"\n >\n <ArrowLeft data-icon=\"inline-start\" aria-hidden=\"true\" />\n {props.backLabel}\n </Button>\n <ScrollArea\n role=\"region\"\n aria-label={props.detailRegionLabel}\n orientation=\"vertical\"\n class=\"min-h-0 min-w-0 flex-1 px-4 pb-4\"\n >\n {props.renderDetail(entry().value)}\n </ScrollArea>\n </div>\n )}\n </Show>\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAoBA,IAAM6B,aAAa,eAAepB,cAAa;AAE/C,SAAgBqB,eAAsBC,OAAmC;CACvE,MAAM,CAACC,gBAAgBC,qBAAqB/B,6BAAkC,IAAIgC,IAAI,CAAC;CACvF,MAAM,CAACC,WAAWC,gBAAgBlC,aAAqB;CACvD,MAAM,CAACmC,gBAAgBC,qBAAqBpC,aAAqB;CACjE,MAAMqC,0BAAU,IAAIC,IAA+B;C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,OAAAuD,OAAAtD,gBAEFxF,QAAM;KAAA0G,MACCxC,YAAanC,aAAamC;KAChCoD,SAAO;KACP0B,MAAI;KACJC,eAAe7H,MAAM8H,OAAO;KAAC,SAAA;KAAA,IAAArD,WAAA;MAAA,OAAA,CAAAL,gBAG5B7F,WAAS;OAAA,aAAA;OAAA,eAAA;MAAA,CAAA,GAAAwJ,WACT/H,MAAMgI,SAAS,CAAA;KAAA;IAAA,CAAA,GAAA,IAAA;IAAA7D,OAAAuD,OAAAtD,gBAEjB1E,YAAU;KACToG,MAAI;KAAA,KAAA,gBAAA;MAAA,OACQ9F,MAAMiI;KAAiB;KACnCjC,aAAW;KAAA,SAAA;KAAA,IAAAvB,WAAA;MAAA,OAGVzE,MAAMkI,aAAa5G,MAAM,CAAC,CAAC4B,KAAK;KAAC;IAAA,CAAA,GAAA,IAAA;IAAA,OAAAwE;GAAA,EAAA,CAAA;EAGvC,CAAA,CAAA;EAAAF,aAAAW,UAAAlE,MAvJOtE,GAAG,wCAAwCK,MAAMoI,KAAK,CAAC,CAAA;EAAA,OAAAnE;CAAA,EAAA,CAAA;AA2JvE"}
@@ -1 +1 @@
1
- {"version":3,"file":"catalog-detail.js","names":["createContext","createUniqueId","Show","useContext","JSX","Badge","cva","SectionsLayout","SectionsLayoutContext","sectionsVariants","variants","layout","stacked","columns","sectionVariants","CatalogDetail","props","title","description","category","publisher","publishedByLabel","leading","Element","eyebrow","badges","action","status","sectionsLayout","children","_el$","_tmpl$4","_el$2","firstChild","_el$4","_el$5","_el$6","nextSibling","_el$7","_el$8","_$insert","_$createComponent","when","_el$3","_tmpl$","variant","_el$9","_tmpl$2","Provider","value","_el$0","_tmpl$3","_$effect","_p$","_v$","_v$2","e","_$setAttribute","t","_$className","undefined","CatalogDetailSection","headingId","_el$1","_tmpl$5","_el$10","_el$11","_$createComponent","_$setAttribute","_$className"],"sources":["../../../../src/components/composites/catalog-browser/catalog-detail.tsx"],"sourcesContent":["import { createContext, createUniqueId, Show, useContext, type JSX } from 'solid-js'\nimport { Badge } from '../../ui/badge'\nimport { cva } from 'class-variance-authority'\n\ntype SectionsLayout = 'stacked' | 'columns'\nconst SectionsLayoutContext = createContext<() => SectionsLayout>((): SectionsLayout => 'stacked')\nconst sectionsVariants = cva('grid min-w-0', {\n variants: {\n layout: {\n stacked: 'gap-2',\n columns:\n 'gap-4 rounded-xl border border-border p-3 md:auto-cols-fr md:grid-flow-col md:gap-0',\n },\n },\n})\nconst sectionVariants = cva('grid min-w-0 content-start gap-1.5 wrap-anywhere', {\n variants: {\n layout: {\n stacked: 'rounded-xl border border-border p-3',\n columns:\n 'md:border-s md:border-border md:px-3 md:first:border-s-0 md:first:ps-0 md:last:pe-0',\n },\n },\n})\n\n/** Shared item summary and action frame for catalog-owned detail content. */\nexport function CatalogDetail(props: {\n title: string\n description: string\n category: string\n publisher: string\n publishedByLabel: (publisher: string) => string\n leading?: JSX.Element\n eyebrow?: string\n badges?: JSX.Element\n action?: JSX.Element\n status?: JSX.Element\n /** Groups related fields in one padded card; stacks them on narrow screens. */\n sectionsLayout?: SectionsLayout\n children?: JSX.Element\n}) {\n return (\n <article class=\"grid min-w-0 gap-2\" data-catalog-detail>\n <div\n data-catalog-detail-header\n class=\"flex min-w-0 flex-wrap items-start gap-3 rounded-xl border border-border p-3 sm:flex-nowrap\"\n >\n <Show when={props.leading}>\n <span class=\"shrink-0\">{props.leading}</span>\n </Show>\n <div data-catalog-detail-identity class=\"grid min-w-0 flex-1 gap-1 wrap-anywhere\">\n <div class=\"flex min-w-0 flex-wrap items-center gap-1.5\">\n <Show when={props.eyebrow}>\n <Badge variant=\"outline\">{props.eyebrow}</Badge>\n </Show>\n <Badge variant=\"secondary\">{props.category}</Badge>\n {props.badges}\n </div>\n <h2 class=\"text-base leading-tight font-semibold tracking-tight\">{props.title}</h2>\n <p class=\"text-muted-foreground text-sm\">{props.description}</p>\n <p class=\"text-muted-foreground text-xs\">{props.publishedByLabel(props.publisher)}</p>\n </div>\n <Show when={props.action || props.status}>\n <div\n data-catalog-detail-actions\n class=\"flex min-w-0 basis-full flex-col items-start gap-2 wrap-anywhere sm:max-w-xs sm:basis-auto sm:items-end\"\n >\n {props.action}\n {props.status}\n </div>\n </Show>\n </div>\n <SectionsLayoutContext.Provider value={() => props.sectionsLayout ?? 'stacked'}>\n <div\n data-catalog-detail-sections\n data-layout={props.sectionsLayout ?? 'stacked'}\n class={sectionsVariants({ layout: props.sectionsLayout ?? 'stacked' })}\n >\n {props.children}\n </div>\n </SectionsLayoutContext.Provider>\n </article>\n )\n}\n\n/** A shared compact row for host-specific fields, permissions, and copy. */\nexport function CatalogDetailSection(props: { title: string; children?: JSX.Element }) {\n const layout = useContext(SectionsLayoutContext)\n const headingId = `catalog-detail-section-${createUniqueId()}`\n return (\n <section class={sectionVariants({ layout: layout() })} aria-labelledby={headingId}>\n <h3\n id={headingId}\n class=\"text-2xs font-semibold tracking-wider text-muted-foreground uppercase\"\n >\n {props.title}\n </h3>\n <div class=\"grid min-w-0 content-start gap-1.5\">{props.children}</div>\n </section>\n )\n}\n"],"mappings":";;;;;;;;;;AAKA,IAAMQ,wBAAwBR,oBAA0D,SAAS;AACjG,IAAMS,mBAAmBH,IAAI,gBAAgB,EAC3CI,UAAU,EACRC,QAAQ;CACNC,SAAS;CACTC,SACE;AACJ,EACF,EACF,CAAC;AACD,IAAMC,kBAAkBR,IAAI,oDAAoD,EAC9EI,UAAU,EACRC,QAAQ;CACNC,SAAS;CACTC,SACE;AACJ,EACF,EACF,CAAC;;AAGD,SAAgBE,cAAcC,OAc3B;CACD,cAAA;EAAA,IAAAc,OAAAC,QAAA,GAAAC,QAAAF,KAAAG,YAAAC,QAAAF,MAAAC,YAAAE,QAAAD,MAAAD,YAAAG,QAAAD,MAAAE,aAAAC,QAAAF,MAAAC,aAAAE,QAAAD,MAAAD;EAAAG,OAAAR,OAAAS,gBAMOvC,MAAI;GAAA,IAACwC,OAAI;IAAA,OAAE1B,MAAMM;GAAO;GAAA,IAAAO,WAA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,IAAAG,KAAAC,aAAAP,OAAA,eAAAG,IAAAG,IAAAF,GAAA;KAAAC,SAAAF,IAAAK,KAAAC,UAAAT,OAAAG,IAAAK,IAAAH,IAAA;KAAA,OAAAF;IAAA,GAAA;KAAAG,GAAAI,KAAAA;KAAAF,GAAAE,KAAAA;IAAA,CAAA;IAAA,OAAAV;GAAA;EAAA,CAAA,GAAA,IAAA;EAAA,OAAApB;CAAA,EAAA,CAAA;AAOhF;;AAGA,SAAgB+B,qBAAqB7C,OAAkD;CACrF,MAAML,SAASR,WAAWK,qBAAqB;CAC/C,MAAMsD,YAAY,0BAA0B7D,eAAe;CAC3D,cAAA;EAAA,IAAA8D,QAAAC,QAAA,GAAAC,SAAAF,MAAA9B,YAAAiC,SAAAD,OAAA5B;EAAAoB,aAAAM,OAAA,mBAC0ED,SAAS;EAAAL,aAAAQ,QAAA,MAEzEH,SAAS;EAAAtB,OAAAyB,cAGZjD,MAAMC,KAAK;EAAAuB,OAAA0B,cAEmClD,MAAMa,QAAQ;EAAAuB,aAAAO,UAAAI,OAPjDjD,gBAAgB,EAAEH,QAAQA,OAAO,EAAE,CAAC,CAAC,CAAA;EAAA,OAAAoD;CAAA,EAAA,CAAA;AAUzD"}
1
+ {"version":3,"file":"catalog-detail.js","names":["createContext","createUniqueId","Show","useContext","Badge","cva","SectionsLayoutContext","sectionsVariants","variants","layout","stacked","columns","sectionVariants","CatalogDetail","props","title","description","category","publisher","publishedByLabel","leading","eyebrow","badges","action","status","sectionsLayout","children","_el$","_tmpl$4","_el$2","firstChild","_el$4","_el$5","_el$6","nextSibling","_el$7","_el$8","_$insert","_$createComponent","when","_el$3","_tmpl$","variant","_el$9","_tmpl$2","Provider","value","_el$0","_tmpl$3","_$effect","_p$","_v$","_v$2","e","_$setAttribute","t","_$className","undefined","CatalogDetailSection","headingId","_el$1","_tmpl$5","_el$10","_el$11"],"sources":["../../../../src/components/composites/catalog-browser/catalog-detail.tsx"],"sourcesContent":["import { createContext, createUniqueId, Show, useContext, type JSX } from 'solid-js'\nimport { Badge } from '../../ui/badge'\nimport { cva } from 'class-variance-authority'\n\ntype SectionsLayout = 'stacked' | 'columns'\nconst SectionsLayoutContext = createContext<() => SectionsLayout>((): SectionsLayout => 'stacked')\nconst sectionsVariants = cva('grid min-w-0', {\n variants: {\n layout: {\n stacked: 'gap-2',\n columns:\n 'gap-4 rounded-xl border border-border p-3 md:auto-cols-fr md:grid-flow-col md:gap-0',\n },\n },\n})\nconst sectionVariants = cva('grid min-w-0 content-start gap-1.5 wrap-anywhere', {\n variants: {\n layout: {\n stacked: 'rounded-xl border border-border p-3',\n columns:\n 'md:border-s md:border-border md:px-3 md:first:border-s-0 md:first:ps-0 md:last:pe-0',\n },\n },\n})\n\n/** Shared item summary and action frame for catalog-owned detail content. */\nexport function CatalogDetail(props: {\n title: string\n description: string\n category: string\n publisher: string\n publishedByLabel: (publisher: string) => string\n leading?: JSX.Element\n eyebrow?: string\n badges?: JSX.Element\n action?: JSX.Element\n status?: JSX.Element\n /** Groups related fields in one padded card; stacks them on narrow screens. */\n sectionsLayout?: SectionsLayout\n children?: JSX.Element\n}) {\n return (\n <article class=\"grid min-w-0 gap-2\" data-catalog-detail>\n <div\n data-catalog-detail-header\n class=\"flex min-w-0 flex-wrap items-start gap-3 rounded-xl border border-border p-3 sm:flex-nowrap\"\n >\n <Show when={props.leading}>\n <span class=\"shrink-0\">{props.leading}</span>\n </Show>\n <div data-catalog-detail-identity class=\"grid min-w-0 flex-1 gap-1 wrap-anywhere\">\n <div class=\"flex min-w-0 flex-wrap items-center gap-1.5\">\n <Show when={props.eyebrow}>\n <Badge variant=\"outline\">{props.eyebrow}</Badge>\n </Show>\n <Badge variant=\"secondary\">{props.category}</Badge>\n {props.badges}\n </div>\n <h2 class=\"text-base leading-tight font-semibold tracking-tight\">{props.title}</h2>\n <p class=\"text-muted-foreground text-sm\">{props.description}</p>\n <p class=\"text-muted-foreground text-xs\">{props.publishedByLabel(props.publisher)}</p>\n </div>\n <Show when={props.action || props.status}>\n <div\n data-catalog-detail-actions\n class=\"flex min-w-0 basis-full flex-col items-start gap-2 wrap-anywhere sm:max-w-xs sm:basis-auto sm:items-end\"\n >\n {props.action}\n {props.status}\n </div>\n </Show>\n </div>\n <SectionsLayoutContext.Provider value={() => props.sectionsLayout ?? 'stacked'}>\n <div\n data-catalog-detail-sections\n data-layout={props.sectionsLayout ?? 'stacked'}\n class={sectionsVariants({ layout: props.sectionsLayout ?? 'stacked' })}\n >\n {props.children}\n </div>\n </SectionsLayoutContext.Provider>\n </article>\n )\n}\n\n/** A shared compact row for host-specific fields, permissions, and copy. */\nexport function CatalogDetailSection(props: { title: string; children?: JSX.Element }) {\n const layout = useContext(SectionsLayoutContext)\n const headingId = `catalog-detail-section-${createUniqueId()}`\n return (\n <section class={sectionVariants({ layout: layout() })} aria-labelledby={headingId}>\n <h3\n id={headingId}\n class=\"text-2xs font-semibold tracking-wider text-muted-foreground uppercase\"\n >\n {props.title}\n </h3>\n <div class=\"grid min-w-0 content-start gap-1.5\">{props.children}</div>\n </section>\n )\n}\n"],"mappings":";;;;;;;;;;AAKA,IAAMM,wBAAwBN,oBAA0D,SAAS;AACjG,IAAMO,mBAAmBF,IAAI,gBAAgB,EAC3CG,UAAU,EACRC,QAAQ;CACNC,SAAS;CACTC,SACE;AACJ,EACF,EACF,CAAC;AACD,IAAMC,kBAAkBP,IAAI,oDAAoD,EAC9EG,UAAU,EACRC,QAAQ;CACNC,SAAS;CACTC,SACE;AACJ,EACF,EACF,CAAC;;AAGD,SAAgBE,cAAcC,OAc3B;CACD,cAAA;EAAA,IAAAa,OAAAC,QAAA,GAAAC,QAAAF,KAAAG,YAAAC,QAAAF,MAAAC,YAAAE,QAAAD,MAAAD,YAAAG,QAAAD,MAAAE,aAAAC,QAAAF,MAAAC,aAAAE,QAAAD,MAAAD;EAAAG,OAAAR,OAAAS,gBAMOpC,MAAI;GAAA,IAACqC,OAAI;IAAA,OAAEzB,MAAMM;GAAO;GAAA,IAAAM,W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AD,IAAAG,KAAAC,aAAAP,OAAA,eAAAG,IAAAG,IAAAF,GAAA;KAAAC,SAAAF,IAAAK,KAAAC,UAAAT,OAAAG,IAAAK,IAAAH,IAAA;KAAA,OAAAF;IAAA,GAAA;KAAAG,GAAAI,KAAAA;KAAAF,GAAAE,KAAAA;IAAA,CAAA;IAAA,OAAAV;GAAA;EAAA,CAAA,GAAA,IAAA;EAAA,OAAApB;CAAA,EAAA,CAAA;AAOhF;;AAGA,SAAgB+B,qBAAqB5C,OAAkD;CACrF,MAAML,SAASN,WAAWG,qBAAqB;CAC/C,MAAMqD,YAAY,0BAA0B1D,eAAe;CAC3D,cAAA;EAAA,IAAA2D,QAAAC,QAAA,GAAAC,SAAAF,MAAA9B,YAAAiC,SAAAD,OAAA5B;EAAAoB,aAAAM,OAAA,mBAC0ED,SAAS;EAAAL,aAAAQ,QAAA,MAEzEH,SAAS;EAAAtB,OAAAyB,cAGZhD,MAAMC,KAAK;EAAAsB,OAAA0B,cAEmCjD,MAAMY,QAAQ;EAAAuB,aAAAO,UAAAI,OAPjDhD,gBAAgB,EAAEH,QAAQA,OAAO,EAAE,CAAC,CAAC,CAAA;EAAA,OAAAmD;CAAA,EAAA,CAAA;AAUzD"}
@@ -1 +1 @@
1
- {"version":3,"file":"chain-of-thought.js","names":["ListOrdered","children","resolveChildren","splitProps","ComponentProps","JSX","cn","Badge","Trace","TraceLine","WORK_STATUS_LABELS","WORK_TRACE_STATUS","TraceLineProps","WorkStatus","ChainOfThoughtStepStatus","Extract","CHAIN_OF_THOUGHT_STATUS_LABELS","Readonly","Record","complete","active","pending","ChainOfThoughtProps","Omit","Element","summary","stepsLabel","ChainOfThought","props","local","rest","steps","hasSteps","toArray","length","stepList","_$createComponent","size","aria-label","_$mergeProps","icon","title","undefined","ChainOfThoughtStepProps","label","status","ChainOfThoughtStep","_$memo","statusLabel","defaultOpen","ChainOfThoughtResults","_el$","_tmpl$","_$spread","class","_$insert","ChainOfThoughtResultProps","ChainOfThoughtResult","_el$2","_tmpl$3","variant","_el$3","_tmpl$2","resolveChildren","_$createComponent","_$mergeProps","_$memo"],"sources":["../../../../src/components/composites/chain-of-thought/chain-of-thought.tsx"],"sourcesContent":["import { ListOrdered } from 'lucide-solid'\nimport { children as resolveChildren, splitProps, type ComponentProps, type JSX } from 'solid-js'\nimport { cn } from '#lib/utils'\nimport { Badge } from '../../ui/badge'\nimport {\n Trace,\n TraceLine,\n WORK_STATUS_LABELS,\n WORK_TRACE_STATUS,\n type TraceLineProps,\n type WorkStatus,\n} from '../../ui/trace'\n\n/**\n * ChainOfThought.\n *\n * A summary line that opens onto the steps behind it: \"Searched 3 sources and\n * compared them\", then each source and each comparison as its own line. Reach for\n * `Reasoning` when the thinking is prose, for `Plan` when the steps are a\n * proposal still to be carried out, and for a plain `Trace` when each line is a\n * tool call — a step here is a statement about the agent's *method*, whatever\n * the host chooses to put in it.\n *\n * Nothing here knows how the steps were produced. The host passes the summary and\n * the steps it wants shown; the component does not imply there is more, and a\n * summary with no steps is a plain line.\n *\n * ## Steps\n *\n * A `ChainOfThoughtStep` is a `TraceLine` with a three-state `status` — `complete`\n * (keeps its own icon, or a tick), `active` (running mark and shimmer) and\n * `pending` (dashed mark). Every status is also spoken. A step without a status\n * makes no claim at all. A step's `children` are its evidence — search-result\n * badges, a snippet — and are open by default: someone who unfolded the summary\n * to see the working wants to see what the working found, and one more click per\n * step to read it defeats the point of the summary.\n *\n * `description` is a single truncated row beside the label. Anything longer\n * belongs in `children`.\n *\n * Both parts are lines: put a `ChainOfThought` inside a `Trace`, next to the\n * other activity of the turn.\n */\nexport type ChainOfThoughtStepStatus = Extract<WorkStatus, 'complete' | 'active' | 'pending'>\n\nexport const CHAIN_OF_THOUGHT_STATUS_LABELS: Readonly<Record<ChainOfThoughtStepStatus, string>> = {\n complete: 'Done',\n active: WORK_STATUS_LABELS.active,\n pending: WORK_STATUS_LABELS.pending,\n}\n\nexport type ChainOfThoughtProps = Omit<\n TraceLineProps,\n 'title' | 'href' | 'onSelect' | 'selectHaspopup' | 'children'\n> & {\n /** The steps, as `ChainOfThoughtStep`s. */\n children?: JSX.Element\n /** The one-line account of what the steps add up to. */\n summary?: JSX.Element\n /** The steps' accessible name. */\n stepsLabel?: string\n}\n\nexport function ChainOfThought(props: ChainOfThoughtProps) {\n const [local, rest] = splitProps(props, ['summary', 'stepsLabel', 'icon', 'children'])\n // Resolved once so the steps are created once: a step keeps its own open state\n // and its DOM while the summary is folded and unfolded.\n const steps = resolveChildren(() => local.children)\n const hasSteps = () => steps.toArray().length > 0\n const stepList = () => (\n <Trace size=\"sm\" aria-label={local.stepsLabel ?? 'Steps'}>\n {steps()}\n </Trace>\n )\n\n return (\n <TraceLine icon={local.icon ?? <ListOrdered />} title={local.summary ?? 'Steps'} {...rest}>\n {hasSteps() ? stepList : undefined}\n </TraceLine>\n )\n}\n\nexport type ChainOfThoughtStepProps = Omit<\n TraceLineProps,\n 'title' | 'status' | 'href' | 'onSelect' | 'selectHaspopup'\n> & {\n label: JSX.Element\n status?: ChainOfThoughtStepStatus\n}\n\nexport function ChainOfThoughtStep(props: ChainOfThoughtStepProps) {\n const [local, rest] = splitProps(props, ['label', 'status', 'statusLabel', 'defaultOpen'])\n return (\n <TraceLine\n title={local.label}\n status={local.status ? WORK_TRACE_STATUS[local.status] : undefined}\n statusLabel={\n local.status\n ? (local.statusLabel ?? CHAIN_OF_THOUGHT_STATUS_LABELS[local.status])\n : undefined\n }\n defaultOpen={local.defaultOpen ?? true}\n {...rest}\n />\n )\n}\n\n/** Evidence for a step: the sources it searched, as a wrapping row of badges. */\nexport function ChainOfThoughtResults(props: ComponentProps<'ul'>) {\n const [local, rest] = splitProps(props, ['class', 'children'])\n return (\n <ul\n role=\"list\"\n data-slot=\"chain-of-thought-results\"\n class={cn('m-0 flex min-w-0 list-none flex-wrap gap-1.5 p-0', local.class)}\n {...rest}\n >\n {local.children}\n </ul>\n )\n}\n\nexport type ChainOfThoughtResultProps = Omit<ComponentProps<'li'>, 'children'> & {\n /** Rendered as text. A long label truncates and keeps its full text in `title`. */\n label: string\n icon?: JSX.Element\n}\n\nexport function ChainOfThoughtResult(props: ChainOfThoughtResultProps) {\n const [local, rest] = splitProps(props, ['class', 'label', 'icon'])\n return (\n <li data-slot=\"chain-of-thought-result\" class={cn('min-w-0 max-w-full', local.class)} {...rest}>\n <Badge variant=\"outline\" class=\"max-w-full min-w-0\" title={local.label}>\n {local.icon}\n <span class=\"truncate\">{local.label}</span>\n </Badge>\n </li>\n )\n}\n"],"mappings":";;;;;;;;;;AA6CA,IAAagB,iCAAqF;CAChGG,UAAU;CACVC,QAAQV,mBAAmBU;CAC3BC,SAASX,mBAAmBW;AAC9B;AAcA,SAAgBM,eAAeC,OAA4B;CACzD,MAAM,CAACC,OAAOC,QAAQ3B,WAAWyB,OAAO;EAAC;EAAW;EAAc;EAAQ;CAAU,CAAC;CAGrF,MAAMG,QAAQ7B,eAAsB2B,MAAM5B,QAAQ;CAClD,MAAM+B,iBAAiBD,MAAME,QAAQ,CAAC,CAACC,SAAS;CAChD,MAAMC,iBAAWC,gBACd5B,OAAK;EAAC6B,MAAI;EAAA,KAAA,gBAAA;GAAA,OAAkBR,MAAMH,cAAc;EAAO;EAAA,IAAAzB,WAAA;GAAA,OACrD8B,MAAM;EAAC;CAAA,CAAA;CAIZ,OAAAK,gBACG3B,WAAS8B,WAAA;EAAA,IAACC,OAAI;GAAA,OAAEX,MAAMW,QAAIJ,gBAAKpC,aAAW,CAAA,CAAA;EAAG;EAAA,IAAEyC,QAAK;GAAA,OAAEZ,MAAMJ,WAAW;EAAO;CAAA,GAAMK,MAAI,EAAA,IAAA7B,WAAA;EAAA,OACtF+B,SAAS,IAAIG,WAAWO,KAAAA;CAAS,EAAA,CAAA,CAAA;AAGxC;AAUA,SAAgBI,mBAAmBlB,OAAgC;CACjE,MAAM,CAACC,OAAOC,QAAQ3B,WAAWyB,OAAO;EAAC;EAAS;EAAU;EAAe;CAAa,CAAC;CACzF,OAAAQ,gBACG3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nElB,MAAMW,IAAI,UAAA;KAAA,IAAAqB,QAAAC,QAAA;KAAAP,OAAAM,aACahC,MAAMe,KAAK;KAAA,OAAAiB;IAAA,EAAA,CAAA,CAAA;GAAA;EAAA,CAAA,CAAA;EAAA,OAAAH;CAAA,EAAA,CAAA;AAI3C"}
1
+ {"version":3,"file":"chain-of-thought.js","names":["ListOrdered","children","resolveChildren","splitProps","cn","Badge","Trace","TraceLine","WORK_STATUS_LABELS","WORK_TRACE_STATUS","CHAIN_OF_THOUGHT_STATUS_LABELS","complete","active","pending","summary","stepsLabel","ChainOfThought","props","local","rest","steps","hasSteps","toArray","length","stepList","_$createComponent","size","_$mergeProps","icon","title","undefined","label","status","ChainOfThoughtStep","_$memo","statusLabel","defaultOpen","ChainOfThoughtResults","_el$","_tmpl$","_$spread","class","_$insert","ChainOfThoughtResult","_el$2","_tmpl$3","variant","_el$3","_tmpl$2"],"sources":["../../../../src/components/composites/chain-of-thought/chain-of-thought.tsx"],"sourcesContent":["import { ListOrdered } from 'lucide-solid'\nimport { children as resolveChildren, splitProps, type ComponentProps, type JSX } from 'solid-js'\nimport { cn } from '#lib/utils'\nimport { Badge } from '../../ui/badge'\nimport {\n Trace,\n TraceLine,\n WORK_STATUS_LABELS,\n WORK_TRACE_STATUS,\n type TraceLineProps,\n type WorkStatus,\n} from '../../ui/trace'\n\n/**\n * ChainOfThought.\n *\n * A summary line that opens onto the steps behind it: \"Searched 3 sources and\n * compared them\", then each source and each comparison as its own line. Reach for\n * `Reasoning` when the thinking is prose, for `Plan` when the steps are a\n * proposal still to be carried out, and for a plain `Trace` when each line is a\n * tool call — a step here is a statement about the agent's *method*, whatever\n * the host chooses to put in it.\n *\n * Nothing here knows how the steps were produced. The host passes the summary and\n * the steps it wants shown; the component does not imply there is more, and a\n * summary with no steps is a plain line.\n *\n * ## Steps\n *\n * A `ChainOfThoughtStep` is a `TraceLine` with a three-state `status` — `complete`\n * (keeps its own icon, or a tick), `active` (running mark and shimmer) and\n * `pending` (dashed mark). Every status is also spoken. A step without a status\n * makes no claim at all. A step's `children` are its evidence — search-result\n * badges, a snippet — and are open by default: someone who unfolded the summary\n * to see the working wants to see what the working found, and one more click per\n * step to read it defeats the point of the summary.\n *\n * `description` is a single truncated row beside the label. Anything longer\n * belongs in `children`.\n *\n * Both parts are lines: put a `ChainOfThought` inside a `Trace`, next to the\n * other activity of the turn.\n */\nexport type ChainOfThoughtStepStatus = Extract<WorkStatus, 'complete' | 'active' | 'pending'>\n\nexport const CHAIN_OF_THOUGHT_STATUS_LABELS: Readonly<Record<ChainOfThoughtStepStatus, string>> = {\n complete: 'Done',\n active: WORK_STATUS_LABELS.active,\n pending: WORK_STATUS_LABELS.pending,\n}\n\nexport type ChainOfThoughtProps = Omit<\n TraceLineProps,\n 'title' | 'href' | 'onSelect' | 'selectHaspopup' | 'children'\n> & {\n /** The steps, as `ChainOfThoughtStep`s. */\n children?: JSX.Element\n /** The one-line account of what the steps add up to. */\n summary?: JSX.Element\n /** The steps' accessible name. */\n stepsLabel?: string\n}\n\nexport function ChainOfThought(props: ChainOfThoughtProps) {\n const [local, rest] = splitProps(props, ['summary', 'stepsLabel', 'icon', 'children'])\n // Resolved once so the steps are created once: a step keeps its own open state\n // and its DOM while the summary is folded and unfolded.\n const steps = resolveChildren(() => local.children)\n const hasSteps = () => steps.toArray().length > 0\n const stepList = () => (\n <Trace size=\"sm\" aria-label={local.stepsLabel ?? 'Steps'}>\n {steps()}\n </Trace>\n )\n\n return (\n <TraceLine icon={local.icon ?? <ListOrdered />} title={local.summary ?? 'Steps'} {...rest}>\n {hasSteps() ? stepList : undefined}\n </TraceLine>\n )\n}\n\nexport type ChainOfThoughtStepProps = Omit<\n TraceLineProps,\n 'title' | 'status' | 'href' | 'onSelect' | 'selectHaspopup'\n> & {\n label: JSX.Element\n status?: ChainOfThoughtStepStatus\n}\n\nexport function ChainOfThoughtStep(props: ChainOfThoughtStepProps) {\n const [local, rest] = splitProps(props, ['label', 'status', 'statusLabel', 'defaultOpen'])\n return (\n <TraceLine\n title={local.label}\n status={local.status ? WORK_TRACE_STATUS[local.status] : undefined}\n statusLabel={\n local.status\n ? (local.statusLabel ?? CHAIN_OF_THOUGHT_STATUS_LABELS[local.status])\n : undefined\n }\n defaultOpen={local.defaultOpen ?? true}\n {...rest}\n />\n )\n}\n\n/** Evidence for a step: the sources it searched, as a wrapping row of badges. */\nexport function ChainOfThoughtResults(props: ComponentProps<'ul'>) {\n const [local, rest] = splitProps(props, ['class', 'children'])\n return (\n <ul\n role=\"list\"\n data-slot=\"chain-of-thought-results\"\n class={cn('m-0 flex min-w-0 list-none flex-wrap gap-1.5 p-0', local.class)}\n {...rest}\n >\n {local.children}\n </ul>\n )\n}\n\nexport type ChainOfThoughtResultProps = Omit<ComponentProps<'li'>, 'children'> & {\n /** Rendered as text. A long label truncates and keeps its full text in `title`. */\n label: string\n icon?: JSX.Element\n}\n\nexport function ChainOfThoughtResult(props: ChainOfThoughtResultProps) {\n const [local, rest] = splitProps(props, ['class', 'label', 'icon'])\n return (\n <li data-slot=\"chain-of-thought-result\" class={cn('min-w-0 max-w-full', local.class)} {...rest}>\n <Badge variant=\"outline\" class=\"max-w-full min-w-0\" title={local.label}>\n {local.icon}\n <span class=\"truncate\">{local.label}</span>\n </Badge>\n </li>\n )\n}\n"],"mappings":";;;;;;;;;;AA6CA,IAAaU,iCAAqF;CAChGC,UAAU;CACVC,QAAQJ,mBAAmBI;CAC3BC,SAASL,mBAAmBK;AAC9B;AAcA,SAAgBG,eAAeC,OAA4B;CACzD,MAAM,CAACC,OAAOC,QAAQhB,WAAWc,OAAO;EAAC;EAAW;EAAc;EAAQ;CAAU,CAAC;CAGrF,MAAMG,QAAQlB,eAAsBgB,MAAMjB,QAAQ;CAClD,MAAMoB,iBAAiBD,MAAME,QAAQ,CAAC,CAACC,SAAS;CAChD,MAAMC,iBAAWC,gBACdnB,OAAK;EAACoB,MAAI;EAAA,KAAA,gBAAA;GAAA,OAAkBR,MAAMH,cAAc;EAAO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A,CAAA;AAGrB;AAQA,SAAgBK,qBAAqB1B,OAAkC;CACrE,MAAM,CAACC,OAAOC,QAAQhB,WAAWc,OAAO;EAAC;EAAS;EAAS;CAAM,CAAC;CAClE,cAAA;EAAA,IAAA2B,QAAAC,QAAA;EAAAL,OAAAI,OAAAjB,WAAA,EAAA,KAAA,WAAA;GAAA,OACiDvB,GAAG,sBAAsBc,MAAMuB,KAAK;EAAC,EAAA,GAAMtB,IAAI,GAAA,OAAA,IAAA;EAAAuB,OAAAE,OAAAnB,gBAC3FpB,OAAK;GAACyC,SAAO;GAAA,SAAA;GAAA,IAAsCjB,QAAK;IAAA,OAAEX,MAAMa;GAAK;GAAA,IAAA9B,WAAA;IAAA,OAAA,CAAAiC,WACnEhB,MAAMU,IAAI,UAAA;KAAA,IAAAmB,QAAAC,QAAA;KAAAN,OAAAK,aACa7B,MAAMa,KAAK;KAAA,OAAAgB;IAAA,EAAA,CAAA,CAAA;GAAA;EAAA,CAAA,CAAA;EAAA,OAAAH;CAAA,EAAA,CAAA;AAI3C"}
@@ -1 +1 @@
1
- {"version":3,"file":"chat.js","names":["CircleAlert","Info","TriangleAlert","Show","splitProps","ComponentProps","JSX","Dynamic","cn","cva","VariantProps","ChatProps","header","Element","notices","composer","Chat","props","local","rest","_el$","_tmpl$","_el$2","firstChild","_el$3","nextSibling","_el$4","_el$5","_$spread","_$mergeProps","class","_$insert","children","ChatHeaderProps","Omit","title","subtitle","status","actions","ChatHeader","_el$6","_tmpl$4","_el$7","_el$8","_$createComponent","when","_el$9","_tmpl$2","_el$0","_tmpl$3","chatNoticeVariants","variants","tone","info","warning","danger","defaultVariants","ChatNoticeProps","description","action","live","ChatNotice","Glyph","_el$1","_tmpl$7","_el$10","_el$11","_el$12","role","_$memo","undefined","component","_el$13","_tmpl$5","_el$14","_tmpl$6","_$effect","_$className","ChatEmptyProps","suggestions","ChatEmpty","_el$15","_tmpl$9","_el$16","_el$17","_el$18","_tmpl$8","_$mergeProps","_$createComponent","_$memo","_$className"],"sources":["../../../../src/components/composites/chat/chat.tsx"],"sourcesContent":["import { CircleAlert, Info, TriangleAlert } from 'lucide-solid'\nimport { Show, splitProps, type ComponentProps, type JSX } from 'solid-js'\nimport { Dynamic } from 'solid-js/web'\nimport { cn } from '#lib/utils'\nimport { cva, type VariantProps } from '#lib/variants'\n\n/**\n * Chat.\n *\n * The frame a conversation lives in: a header, a strip for things the reader\n * must know before reading anything else, the thread, and the composer. It is a\n * layout and nothing more — the thread is a `MessageScroller`, the input is a\n * composer, and what happens in between is the host's — which is why it takes\n * slots instead of data. `ConversationPane` is the other frame: reach for it when\n * the conversation opens a side thread rather than showing notices.\n *\n * ## Why notices have their own row\n *\n * \"The connection dropped\", \"this transcript has a gap\", \"this session is\n * read-only\" are about the whole conversation, not about a turn, and they must\n * not scroll away with the turns. They sit between the header and the thread in\n * their own grid track, so a notice appearing never steals the thread's row and\n * collapses to zero height when there are none. Each notice states its cause in\n * words and carries its own remedy (`action`); one that reports a *change*\n * (`live`) is announced, one that describes a standing condition is not.\n *\n * ## Layout\n *\n * `h-full min-h-0`, so the thread scrolls inside the frame rather than the page\n * growing, and a `min-w-0` track, so a long unbroken token in a turn cannot widen\n * the whole conversation. Nothing here sets a width: the reading column is the\n * turn's, and the composer sets its own measure.\n */\nexport type ChatProps = ComponentProps<'section'> & {\n header?: JSX.Element\n /** `ChatNotice`s. The row collapses when this is empty. */\n notices?: JSX.Element\n composer?: JSX.Element\n}\n\nexport function Chat(props: ChatProps) {\n const [local, rest] = splitProps(props, ['class', 'header', 'notices', 'composer', 'children'])\n return (\n <section\n data-slot=\"chat\"\n class={cn(\n 'grid h-full min-h-0 min-w-0 grid-cols-[minmax(0,1fr)] grid-rows-[auto_auto_minmax(0,1fr)_auto] bg-background text-foreground',\n local.class\n )}\n {...rest}\n >\n <div class=\"row-start-1 min-w-0\">{local.header}</div>\n <div class=\"row-start-2 flex min-w-0 flex-col\">{local.notices}</div>\n <div class=\"row-start-3 flex min-h-0 min-w-0 flex-col\">{local.children}</div>\n <div class=\"row-start-4 min-w-0\">{local.composer}</div>\n </section>\n )\n}\n\nexport type ChatHeaderProps = Omit<ComponentProps<'header'>, 'title'> & {\n title: JSX.Element\n /** One line under the title: identity, scope, generation. */\n subtitle?: JSX.Element\n /** The conversation's state in words (a `StatusChip`). */\n status?: JSX.Element\n /** Host actions: rename, archive, hand off. */\n actions?: JSX.Element\n}\n\nexport function ChatHeader(props: ChatHeaderProps) {\n const [local, rest] = splitProps(props, ['class', 'title', 'subtitle', 'status', 'actions'])\n return (\n <header\n data-slot=\"chat-header\"\n class={cn(\n 'flex min-h-topbar min-w-0 items-center gap-3 border-b border-border px-4 py-2',\n local.class\n )}\n {...rest}\n >\n <div class=\"flex min-w-0 flex-1 flex-col\">\n <h2 class=\"m-0 truncate text-sm font-semibold tracking-tight\">{local.title}</h2>\n <Show when={local.subtitle}>\n <p class=\"m-0 truncate text-xs text-muted-foreground\">{local.subtitle}</p>\n </Show>\n </div>\n <Show when={local.status}>{local.status}</Show>\n <Show when={local.actions}>\n <div class=\"flex shrink-0 items-center gap-1\">{local.actions}</div>\n </Show>\n </header>\n )\n}\n\nexport const chatNoticeVariants = cva(\n 'flex min-w-0 items-start gap-2.5 border-b px-4 py-2 text-sm',\n {\n variants: {\n tone: {\n info: 'border-border bg-muted/40',\n warning: 'border-warning/30 bg-warning-subtle',\n danger: 'border-destructive/30 bg-destructive-subtle',\n },\n },\n defaultVariants: { tone: 'info' },\n }\n)\n\nexport type ChatNoticeProps = Omit<ComponentProps<'div'>, 'title'> &\n VariantProps<typeof chatNoticeVariants> & {\n title: JSX.Element\n description?: JSX.Element\n /** The remedy: Reconnect, Jump to terminal. */\n action?: JSX.Element\n /** Announce it. Use for a change (connection lost), not a standing condition. */\n live?: 'polite' | 'assertive'\n }\n\nexport function ChatNotice(props: ChatNoticeProps) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'tone',\n 'title',\n 'description',\n 'action',\n 'live',\n ])\n const Glyph = () =>\n local.tone === 'danger' ? CircleAlert : local.tone === 'warning' ? TriangleAlert : Info\n return (\n <div\n data-slot=\"chat-notice\"\n role={local.live === 'assertive' ? 'alert' : local.live === 'polite' ? 'status' : undefined}\n class={cn(chatNoticeVariants({ tone: local.tone }), local.class)}\n {...rest}\n >\n <span\n aria-hidden=\"true\"\n class={cn('mt-0.5 shrink-0 [&_svg]:size-4', {\n 'text-muted-foreground': (local.tone ?? 'info') === 'info',\n 'text-warning': local.tone === 'warning',\n 'text-destructive': local.tone === 'danger',\n })}\n >\n <Dynamic component={Glyph()} />\n </span>\n <div class=\"min-w-0 flex-1\">\n <p class=\"m-0 font-medium [overflow-wrap:anywhere]\">{local.title}</p>\n <Show when={local.description}>\n <p class=\"m-0 text-xs text-muted-foreground [overflow-wrap:anywhere]\">\n {local.description}\n </p>\n </Show>\n </div>\n <Show when={local.action}>\n <div class=\"flex shrink-0 items-center gap-1.5\">{local.action}</div>\n </Show>\n </div>\n )\n}\n\nexport type ChatEmptyProps = Omit<ComponentProps<'div'>, 'title'> & {\n title: JSX.Element\n description?: JSX.Element\n /** Prompt chips (`Suggestions`), shown only when the host has real ones. */\n suggestions?: JSX.Element\n}\n\n/** A conversation with no turns yet. Centred in the thread, never in a card. */\nexport function ChatEmpty(props: ChatEmptyProps) {\n const [local, rest] = splitProps(props, ['class', 'title', 'description', 'suggestions'])\n return (\n <div\n data-slot=\"chat-empty\"\n class={cn(\n 'mx-auto flex min-h-full w-full max-w-xl flex-col items-center justify-center gap-4 px-6 py-10 text-center',\n local.class\n )}\n {...rest}\n >\n <div class=\"flex flex-col gap-1\">\n <h3 class=\"m-0 text-base font-semibold tracking-tight text-balance\">{local.title}</h3>\n <Show when={local.description}>\n <p class=\"m-0 text-sm text-muted-foreground text-balance\">{local.description}</p>\n </Show>\n </div>\n <Show when={local.suggestions}>{local.suggestions}</Show>\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;AAwCA,SAAgBgB,KAAKC,OAAkB;CACrC,MAAM,C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OAAAkD,QAAArC,gBAG/EzC,MAAI;GAAA,IAAC0C,OAAI;IAAA,OAAE3B,MAAM6D;GAAW;GAAA,IAAA/C,WAAA;IAAA,OAAGd,MAAM6D;GAAW;EAAA,CAAA,GAAA,IAAA;EAAA,OAAAE;CAAA,EAAA,CAAA;AAGvD"}
1
+ {"version":3,"file":"chat.js","names":["CircleAlert","Info","TriangleAlert","Show","splitProps","Dynamic","cn","cva","header","notices","composer","Chat","props","local","rest","_el$","_tmpl$","_el$2","firstChild","_el$3","nextSibling","_el$4","_el$5","_$spread","_$mergeProps","class","_$insert","children","title","subtitle","status","actions","ChatHeader","_el$6","_tmpl$4","_el$7","_el$8","_$createComponent","when","_el$9","_tmpl$2","_el$0","_tmpl$3","chatNoticeVariants","variants","tone","info","warning","danger","defaultVariants","description","action","live","ChatNotice","Glyph","_el$1","_tmpl$7","_el$10","_el$11","_el$12","role","_$memo","undefined","component","_el$13","_tmpl$5","_el$14","_tmpl$6","_$effect","_$className","suggestions","ChatEmpty","_el$15","_tmpl$9","_el$16","_el$17","_el$18","_tmpl$8"],"sources":["../../../../src/components/composites/chat/chat.tsx"],"sourcesContent":["import { CircleAlert, Info, TriangleAlert } from 'lucide-solid'\nimport { Show, splitProps, type ComponentProps, type JSX } from 'solid-js'\nimport { Dynamic } from 'solid-js/web'\nimport { cn } from '#lib/utils'\nimport { cva, type VariantProps } from '#lib/variants'\n\n/**\n * Chat.\n *\n * The frame a conversation lives in: a header, a strip for things the reader\n * must know before reading anything else, the thread, and the composer. It is a\n * layout and nothing more — the thread is a `MessageScroller`, the input is a\n * composer, and what happens in between is the host's — which is why it takes\n * slots instead of data. `ConversationPane` is the other frame: reach for it when\n * the conversation opens a side thread rather than showing notices.\n *\n * ## Why notices have their own row\n *\n * \"The connection dropped\", \"this transcript has a gap\", \"this session is\n * read-only\" are about the whole conversation, not about a turn, and they must\n * not scroll away with the turns. They sit between the header and the thread in\n * their own grid track, so a notice appearing never steals the thread's row and\n * collapses to zero height when there are none. Each notice states its cause in\n * words and carries its own remedy (`action`); one that reports a *change*\n * (`live`) is announced, one that describes a standing condition is not.\n *\n * ## Layout\n *\n * `h-full min-h-0`, so the thread scrolls inside the frame rather than the page\n * growing, and a `min-w-0` track, so a long unbroken token in a turn cannot widen\n * the whole conversation. Nothing here sets a width: the reading column is the\n * turn's, and the composer sets its own measure.\n */\nexport type ChatProps = ComponentProps<'section'> & {\n header?: JSX.Element\n /** `ChatNotice`s. The row collapses when this is empty. */\n notices?: JSX.Element\n composer?: JSX.Element\n}\n\nexport function Chat(props: ChatProps) {\n const [local, rest] = splitProps(props, ['class', 'header', 'notices', 'composer', 'children'])\n return (\n <section\n data-slot=\"chat\"\n class={cn(\n 'grid h-full min-h-0 min-w-0 grid-cols-[minmax(0,1fr)] grid-rows-[auto_auto_minmax(0,1fr)_auto] bg-background text-foreground',\n local.class\n )}\n {...rest}\n >\n <div class=\"row-start-1 min-w-0\">{local.header}</div>\n <div class=\"row-start-2 flex min-w-0 flex-col\">{local.notices}</div>\n <div class=\"row-start-3 flex min-h-0 min-w-0 flex-col\">{local.children}</div>\n <div class=\"row-start-4 min-w-0\">{local.composer}</div>\n </section>\n )\n}\n\nexport type ChatHeaderProps = Omit<ComponentProps<'header'>, 'title'> & {\n title: JSX.Element\n /** One line under the title: identity, scope, generation. */\n subtitle?: JSX.Element\n /** The conversation's state in words (a `StatusChip`). */\n status?: JSX.Element\n /** Host actions: rename, archive, hand off. */\n actions?: JSX.Element\n}\n\nexport function ChatHeader(props: ChatHeaderProps) {\n const [local, rest] = splitProps(props, ['class', 'title', 'subtitle', 'status', 'actions'])\n return (\n <header\n data-slot=\"chat-header\"\n class={cn(\n 'flex min-h-topbar min-w-0 items-center gap-3 border-b border-border px-4 py-2',\n local.class\n )}\n {...rest}\n >\n <div class=\"flex min-w-0 flex-1 flex-col\">\n <h2 class=\"m-0 truncate text-sm font-semibold tracking-tight\">{local.title}</h2>\n <Show when={local.subtitle}>\n <p class=\"m-0 truncate text-xs text-muted-foreground\">{local.subtitle}</p>\n </Show>\n </div>\n <Show when={local.status}>{local.status}</Show>\n <Show when={local.actions}>\n <div class=\"flex shrink-0 items-center gap-1\">{local.actions}</div>\n </Show>\n </header>\n )\n}\n\nexport const chatNoticeVariants = cva(\n 'flex min-w-0 items-start gap-2.5 border-b px-4 py-2 text-sm',\n {\n variants: {\n tone: {\n info: 'border-border bg-muted/40',\n warning: 'border-warning/30 bg-warning-subtle',\n danger: 'border-destructive/30 bg-destructive-subtle',\n },\n },\n defaultVariants: { tone: 'info' },\n }\n)\n\nexport type ChatNoticeProps = Omit<ComponentProps<'div'>, 'title'> &\n VariantProps<typeof chatNoticeVariants> & {\n title: JSX.Element\n description?: JSX.Element\n /** The remedy: Reconnect, Jump to terminal. */\n action?: JSX.Element\n /** Announce it. Use for a change (connection lost), not a standing condition. */\n live?: 'polite' | 'assertive'\n }\n\nexport function ChatNotice(props: ChatNoticeProps) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'tone',\n 'title',\n 'description',\n 'action',\n 'live',\n ])\n const Glyph = () =>\n local.tone === 'danger' ? CircleAlert : local.tone === 'warning' ? TriangleAlert : Info\n return (\n <div\n data-slot=\"chat-notice\"\n role={local.live === 'assertive' ? 'alert' : local.live === 'polite' ? 'status' : undefined}\n class={cn(chatNoticeVariants({ tone: local.tone }), local.class)}\n {...rest}\n >\n <span\n aria-hidden=\"true\"\n class={cn('mt-0.5 shrink-0 [&_svg]:size-4', {\n 'text-muted-foreground': (local.tone ?? 'info') === 'info',\n 'text-warning': local.tone === 'warning',\n 'text-destructive': local.tone === 'danger',\n })}\n >\n <Dynamic component={Glyph()} />\n </span>\n <div class=\"min-w-0 flex-1\">\n <p class=\"m-0 font-medium [overflow-wrap:anywhere]\">{local.title}</p>\n <Show when={local.description}>\n <p class=\"m-0 text-xs text-muted-foreground [overflow-wrap:anywhere]\">\n {local.description}\n </p>\n </Show>\n </div>\n <Show when={local.action}>\n <div class=\"flex shrink-0 items-center gap-1.5\">{local.action}</div>\n </Show>\n </div>\n )\n}\n\nexport type ChatEmptyProps = Omit<ComponentProps<'div'>, 'title'> & {\n title: JSX.Element\n description?: JSX.Element\n /** Prompt chips (`Suggestions`), shown only when the host has real ones. */\n suggestions?: JSX.Element\n}\n\n/** A conversation with no turns yet. Centred in the thread, never in a card. */\nexport function ChatEmpty(props: ChatEmptyProps) {\n const [local, rest] = splitProps(props, ['class', 'title', 'description', 'suggestions'])\n return (\n <div\n data-slot=\"chat-empty\"\n class={cn(\n 'mx-auto flex min-h-full w-full max-w-xl flex-col items-center justify-center gap-4 px-6 py-10 text-center',\n local.class\n )}\n {...rest}\n >\n <div class=\"flex flex-col gap-1\">\n <h3 class=\"m-0 text-base font-semibold tracking-tight text-balance\">{local.title}</h3>\n <Show when={local.description}>\n <p class=\"m-0 text-sm text-muted-foreground text-balance\">{local.description}</p>\n </Show>\n </div>\n <Show when={local.suggestions}>{local.suggestions}</Show>\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;AAwCA,SAAgBW,KAAKC,OAAkB;CACrC,MAAM,CAACC,OAAOC,QAAQV,WAAWQ,OAAO;EAAC;EAAS;EAAU;EAAW;EAAY;CAAU,CAAC;CAC9F,cAAA;EAAA,IAAAG,OAAAC,OAAA,GAAAC,QAAAF,KAAAG,YAAAC,QAAAF,MAAAG,aAAAC,QAAAF,MAAAC,aAAAE,QAAAD,MAAAD;EAAAG,OAAAR,MAAAS,WAAA,EAAA,KAAA,WAAA;GAAA,OAGWlB,GACL,gIACAO,MAAMY,KACR;EAAC,EAAA,GACGX,IAAI,GAAA,OAAA,IAAA;EAAAY,OAAAT,aAE0BJ,MAAML,MAAM;EAAAkB,OAAAP,aACEN,MAAMJ,OAAO;EAAAiB,OAAAL,aACLR,MAAMc,QAAQ;EAAAD,OAAAJ,aACpCT,MAAMH,QAAQ;EAAA,OAAAK;CAAA,EAAA,CAAA;AAGtD;AAYA,SAAgBiB,WAAWpB,OAAwB;CACjD,MAAM,CAACC,OAAOC,Q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A;EAAA,OAAAU;CAAA,EAAA,CAAA;AAiBV;;AAUA,SAAgBgB,UAAU3D,OAAuB;CAC/C,MAAM,CAACC,OAAOC,QAAQV,WAAWQ,OAAO;EAAC;EAAS;EAAS;EAAe;CAAa,CAAC;CACxF,cAAA;EAAA,IAAA4D,SAAAC,QAAA,GAAAC,SAAAF,OAAAtD,YAAAyD,SAAAD,OAAAxD;EAAAK,OAAAiD,QAAAhD,WAAA,EAAA,KAAA,WAAA;GAAA,OAGWlB,GACL,6GACAO,MAAMY,KACR;EAAC,EAAA,GACGX,IAAI,GAAA,OAAA,IAAA;EAAAY,OAAAiD,cAG+D9D,MAAMe,KAAK;EAAAF,OAAAgD,QAAArC,gBAC/ElC,MAAI;GAAA,IAACmC,OAAI;IAAA,OAAEzB,MAAMqC;GAAW;GAAA,IAAAvB,WAAA;IAAA,IAAAiD,SAAAC,QAAA;IAAAnD,OAAAkD,cACgC/D,MAAMqC,WAAW;IAAA,OAAA0B;GAAA;EAAA,CAAA,GAAA,IAAA;EAAAlD,OAAA8C,QAAAnC,gBAG/ElC,MAAI;GAAA,IAACmC,OAAI;IAAA,OAAEzB,MAAMyD;GAAW;GAAA,IAAA3C,WAAA;IAAA,OAAGd,MAAMyD;GAAW;EAAA,CAAA,GAAA,IAAA;EAAA,OAAAE;CAAA,EAAA,CAAA;AAGvD"}
@@ -1 +1 @@
1
- {"version":3,"file":"checkpoint.js","names":["Flag","createEffect","createMemo","createSignal","createUniqueId","on","Show","splitProps","ComponentProps","cn","Button","AlertDialog","AlertDialogAction","AlertDialogCancel","AlertDialogContent","AlertDialogDescription","AlertDialogFooter","AlertDialogHeader","AlertDialogTitle","AlertDialogTrigger","Marker","Spinner","settleAction","boundText","checkpointLabel","checkpointStatus","restoreControl","restoreDialogCopy","CheckpointState","CheckpointProps","Omit","label","time","state","onRestore","Promise","consequence","restoreLabel","disabledReason","error","Checkpoint","props","local","rest","uid","reasonId","followed","setFollowed","failure","setFailure","undefined","confirming","setConfirming","inflight","root","HTMLDivElement","status","HTMLParagraphElement","control","copy","statusText","restore","disabled","result","ok","message","restored","active","document","activeElement","body","contains","focus","defer","restoreAction","_$createComponent","when","visible","children","open","onOpenChange","as","variant","size","aria-disabled","aria-describedby","_$memo","title","description","onClick","_el$","_tmpl$","_el$2","firstChild","_$use","element","_$spread","_$mergeProps","data-state","class","_$insert","icon","tone","action","_$setAttribute","_$effect","_$className","_$createComponent","_$memo","_$mergeProps","_$className"],"sources":["../../../../src/components/composites/checkpoint/checkpoint.tsx"],"sourcesContent":["import { Flag } from 'lucide-solid'\nimport {\n createEffect,\n createMemo,\n createSignal,\n createUniqueId,\n on,\n Show,\n splitProps,\n type ComponentProps,\n} from 'solid-js'\nimport { cn } from '#lib/utils'\nimport { Button } from '../../ui/button'\nimport {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogTitle,\n AlertDialogTrigger,\n} from '../../ui/alert-dialog'\nimport { Marker } from '../../ui/marker'\nimport { Spinner } from '../../ui/spinner'\nimport { settleAction } from '#lib/async-action'\nimport { boundText } from '#lib/text'\nimport {\n checkpointLabel,\n checkpointStatus,\n restoreControl,\n restoreDialogCopy,\n type CheckpointState,\n} from './checkpoint-model'\n\n/**\n * Checkpoint.\n *\n * A point in the conversation the host can name: a divider in the transcript with\n * a label and a time. It always renders — as a `Marker`, the quietest thing in the\n * column — and it is honest about what it is:\n *\n * - **Without `onRestore` it is only a marker.** Not a disabled button, not a\n * greyed-out \"Restore\": nothing. Whether a checkpoint can be returned to is a\n * fact about the host's storage and permissions, and a control that implies it\n * can would be a claim nobody made.\n * - **With `onRestore` it offers Restore, and Restore asks first.** An\n * `AlertDialog` (Escape and the scrim do nothing; every exit is a named choice)\n * states what will change in the host's own words (`consequence`) before the\n * handler is called. A restore throws work away; the confirmation is the point.\n *\n * ## States\n *\n * `idle` → `restoring` → `restored`, or `failed` with `error`. Pass `state` to\n * drive it from the host; omit it and the component follows the promise\n * `onRestore` returns. The status sentence is a live region that exists from the\n * start, so a change is announced. While restoring, the control stays focusable\n * (`aria-disabled`, not `disabled`) so focus is not dropped when the dialog hands\n * it back; once restored the control goes and focus moves to the status line.\n *\n * A restore that cannot happen now takes `disabledReason`, shown in words under\n * the divider; the host decides, the component explains.\n */\nexport type CheckpointProps = Omit<ComponentProps<'div'>, 'children' | 'onError'> & {\n /** The checkpoint's name. Defaults to \"Checkpoint\". */\n label?: string\n /** When it was taken, already formatted for the reader. */\n time?: string\n state?: CheckpointState\n /** Supplying this is what makes the checkpoint restorable. */\n onRestore?: () => void | Promise<void>\n /** What restoring will change, in the host's words. Shown in the confirmation. */\n consequence?: string\n restoreLabel?: string\n /** Why Restore cannot be used right now. */\n disabledReason?: string\n /** Why a restore failed. */\n error?: string\n}\n\nexport function Checkpoint(props: CheckpointProps) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'label',\n 'time',\n 'state',\n 'onRestore',\n 'consequence',\n 'restoreLabel',\n 'disabledReason',\n 'error',\n ])\n const uid = createUniqueId()\n const reasonId = `${uid}-status`\n const [followed, setFollowed] = createSignal<CheckpointState>('idle')\n const [failure, setFailure] = createSignal<string | undefined>(undefined)\n const [confirming, setConfirming] = createSignal(false)\n let inflight = false\n let root: HTMLDivElement | undefined\n let status: HTMLParagraphElement | undefined\n\n const state = (): CheckpointState => local.state ?? followed()\n const error = () => local.error ?? failure()\n const control = () => restoreControl(local.onRestore !== undefined, state(), local.disabledReason)\n const copy = () => restoreDialogCopy(local.label, local.consequence)\n const statusText = () => checkpointStatus(state(), error(), local.disabledReason)\n\n const restore = async () => {\n if (inflight || control().disabled) return\n inflight = true\n setFailure(undefined)\n setFollowed('restoring')\n const result = await settleAction(local.onRestore)\n inflight = false\n if (result.ok) {\n setFollowed('restored')\n } else {\n setFailure(result.message)\n setFollowed('failed')\n }\n }\n\n // The control is replaced by the status line on success; do not strand focus.\n createEffect(\n on(\n () => state() === 'restored',\n (restored) => {\n if (!restored) return\n const active = document.activeElement\n if (active === null || active === document.body || root?.contains(active)) {\n status?.focus()\n }\n },\n { defer: true }\n )\n )\n\n // Built once. `Marker` reads `action` twice (to test it, then to draw it), and a\n // JSX prop re-creates its component on every read: a second AlertDialog root\n // would portal a second, invisible-to-the-tree dialog when this one opens.\n const restoreAction = createMemo(() => (\n <Show when={control().visible}>\n <AlertDialog\n open={confirming()}\n onOpenChange={(open) => setConfirming(open && !control().disabled)}\n >\n <AlertDialogTrigger\n as={Button}\n variant=\"ghost\"\n size=\"2xs\"\n aria-disabled={control().disabled || undefined}\n aria-describedby={statusText() ? reasonId : undefined}\n >\n <Show when={state() === 'restoring'}>\n <Spinner size=\"xs\" label={false} />\n </Show>\n {state() === 'restoring'\n ? 'Restoring…'\n : (local.restoreLabel ?? (state() === 'failed' ? 'Try again' : 'Restore'))}\n </AlertDialogTrigger>\n <AlertDialogContent>\n <AlertDialogHeader>\n <AlertDialogTitle>{copy().title}</AlertDialogTitle>\n <AlertDialogDescription class=\"[overflow-wrap:anywhere]\">\n {copy().description}\n </AlertDialogDescription>\n </AlertDialogHeader>\n <AlertDialogFooter>\n <AlertDialogCancel as={Button} variant=\"ghost\">\n Do not restore\n </AlertDialogCancel>\n <AlertDialogAction as={Button} onClick={() => void restore()}>\n {local.restoreLabel ?? 'Restore'}\n </AlertDialogAction>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialog>\n </Show>\n ))\n\n return (\n <div\n ref={(element) => (root = element)}\n data-slot=\"checkpoint\"\n data-state={state()}\n class={local.class}\n {...rest}\n >\n <Marker\n variant=\"rule\"\n icon={<Flag />}\n tone={state() === 'failed' ? 'danger' : 'neutral'}\n label={checkpointLabel(local.label)}\n description={local.time ? boundText(local.time, 60) : undefined}\n action={restoreAction()}\n />\n {/* Always present, so a state change is a change to a live region rather than\n the arrival of one. Empty while idle, which takes no space. */}\n <p\n id={reasonId}\n ref={(element) => (status = element)}\n role=\"status\"\n tabindex=\"-1\"\n class={cn('m-0 text-center text-xs outline-none [overflow-wrap:anywhere]', {\n 'text-destructive': state() === 'failed',\n 'text-muted-foreground': state() !== 'failed',\n })}\n >\n {statusText()}\n </p>\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;;AAiFA,SAAgBwC,WAAWC,OAAwB;CACjD,MAAM,CAACC,OAAOC,QAAQpC,WAAWkC,OAAO;EACtC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CAAO,CACR;CAED,MAAMI,WAAW,GADLzC,eACQwC,EAAG;CACvB,MAAM,CAACE,UAAUC,eAAe5C,aAA8B,MAAM;CACpE,MAAM,CAAC6C,SAASC,cAAc9C,aAAiC+C,KAAAA,CAAS;CACxE,MAAM,CAACC,YAAYC,iBAAiBjD,aAAa,KAAK;CACtD,IAAIkD,WAAW;CACf,IAAIC;CACJ,IAAIE;CAEJ,MAAMvB,cAA+BS,MAAMT,SAASa,SAAS;CAC7D,MAAMP,cAAcG,MAAMH,SAASS,QAAQ;CAC3C,MAAMU,gBAAgBhC,eAAegB,MAAMR,cAAcgB,KAAAA,GAAWjB,MAAM,GAAGS,MAAMJ,cAAc;CACjG,MAAMqB,aAAahC,kBAAkBe,MAAMX,OAAOW,MAAMN,WAAW;CACnE,MAAMwB,mBAAmBnC,iBAAiBQ,MAAM,GAAGM,MAAM,GAAGG,MAAMJ,cAAc;CAEhF,MAAMuB,UAAU,YAAY;EAC1B,IAAIR,YAAYK,QAAQ,CAAC,CAACI,UAAU;EACpCT,WAAW;EACXJ,WAAWC,KAAAA,CAAS;EACpBH,YAAY,WAAW;EACvB,MAAMgB,SAAS,MAAMzC,aAAaoB,MAAMR,SAAS;EACjDmB,WAAW;EACX,IAAIU,OAAOC,IACTjB,YAAY,UAAU;OACjB;GACLE,WAAWc,OAAOE,OAAO;GACzBlB,YAAY,QAAQ;EACtB;CACF;CAGA9C,aACEI,SACQ4B,MAAM,MAAM,aACjBiC,aAAa;EACZ,IAAI,CAACA,UAAU;EACf,MAAMC,SAASC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KAMjBC,YAAavC,SAASuC,SAAQH,KAAA;EAAAY,aAAAZ,OAAA,MADhC/C,QAAQ;EAAAuD,OAAAR,OASXhC,UAAU;EAAA6C,aAAAC,UAAAd,OALJnF,GAAG,iEAAiE;GACzE,oBAAoBwB,MAAM,MAAM;GAChC,yBAAyBA,MAAM,MAAM;EACvC,CAAC,CAAC,CAAA;EAAA,OAAAyD;CAAA,EAAA,CAAA;AAMV"}
1
+ {"version":3,"file":"checkpoint.js","names":["Flag","createEffect","createMemo","createSignal","createUniqueId","on","Show","splitProps","cn","Button","AlertDialog","AlertDialogAction","AlertDialogCancel","AlertDialogContent","AlertDialogDescription","AlertDialogFooter","AlertDialogHeader","AlertDialogTitle","AlertDialogTrigger","Marker","Spinner","settleAction","boundText","checkpointLabel","checkpointStatus","restoreControl","restoreDialogCopy","label","time","state","onRestore","consequence","restoreLabel","disabledReason","error","Checkpoint","props","local","rest","uid","reasonId","followed","setFollowed","failure","setFailure","undefined","confirming","setConfirming","inflight","root","status","control","copy","statusText","restore","disabled","result","ok","message","restored","active","document","activeElement","body","contains","focus","defer","restoreAction","_$createComponent","when","visible","children","open","onOpenChange","as","variant","size","_$memo","title","description","onClick","_el$","_tmpl$","_el$2","firstChild","_$use","element","_$spread","_$mergeProps","class","_$insert","icon","tone","action","_$setAttribute","_$effect","_$className"],"sources":["../../../../src/components/composites/checkpoint/checkpoint.tsx"],"sourcesContent":["import { Flag } from 'lucide-solid'\nimport {\n createEffect,\n createMemo,\n createSignal,\n createUniqueId,\n on,\n Show,\n splitProps,\n type ComponentProps,\n} from 'solid-js'\nimport { cn } from '#lib/utils'\nimport { Button } from '../../ui/button'\nimport {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogTitle,\n AlertDialogTrigger,\n} from '../../ui/alert-dialog'\nimport { Marker } from '../../ui/marker'\nimport { Spinner } from '../../ui/spinner'\nimport { settleAction } from '#lib/async-action'\nimport { boundText } from '#lib/text'\nimport {\n checkpointLabel,\n checkpointStatus,\n restoreControl,\n restoreDialogCopy,\n type CheckpointState,\n} from './checkpoint-model'\n\n/**\n * Checkpoint.\n *\n * A point in the conversation the host can name: a divider in the transcript with\n * a label and a time. It always renders — as a `Marker`, the quietest thing in the\n * column — and it is honest about what it is:\n *\n * - **Without `onRestore` it is only a marker.** Not a disabled button, not a\n * greyed-out \"Restore\": nothing. Whether a checkpoint can be returned to is a\n * fact about the host's storage and permissions, and a control that implies it\n * can would be a claim nobody made.\n * - **With `onRestore` it offers Restore, and Restore asks first.** An\n * `AlertDialog` (Escape and the scrim do nothing; every exit is a named choice)\n * states what will change in the host's own words (`consequence`) before the\n * handler is called. A restore throws work away; the confirmation is the point.\n *\n * ## States\n *\n * `idle` → `restoring` → `restored`, or `failed` with `error`. Pass `state` to\n * drive it from the host; omit it and the component follows the promise\n * `onRestore` returns. The status sentence is a live region that exists from the\n * start, so a change is announced. While restoring, the control stays focusable\n * (`aria-disabled`, not `disabled`) so focus is not dropped when the dialog hands\n * it back; once restored the control goes and focus moves to the status line.\n *\n * A restore that cannot happen now takes `disabledReason`, shown in words under\n * the divider; the host decides, the component explains.\n */\nexport type CheckpointProps = Omit<ComponentProps<'div'>, 'children' | 'onError'> & {\n /** The checkpoint's name. Defaults to \"Checkpoint\". */\n label?: string\n /** When it was taken, already formatted for the reader. */\n time?: string\n state?: CheckpointState\n /** Supplying this is what makes the checkpoint restorable. */\n onRestore?: () => void | Promise<void>\n /** What restoring will change, in the host's words. Shown in the confirmation. */\n consequence?: string\n restoreLabel?: string\n /** Why Restore cannot be used right now. */\n disabledReason?: string\n /** Why a restore failed. */\n error?: string\n}\n\nexport function Checkpoint(props: CheckpointProps) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'label',\n 'time',\n 'state',\n 'onRestore',\n 'consequence',\n 'restoreLabel',\n 'disabledReason',\n 'error',\n ])\n const uid = createUniqueId()\n const reasonId = `${uid}-status`\n const [followed, setFollowed] = createSignal<CheckpointState>('idle')\n const [failure, setFailure] = createSignal<string | undefined>(undefined)\n const [confirming, setConfirming] = createSignal(false)\n let inflight = false\n let root: HTMLDivElement | undefined\n let status: HTMLParagraphElement | undefined\n\n const state = (): CheckpointState => local.state ?? followed()\n const error = () => local.error ?? failure()\n const control = () => restoreControl(local.onRestore !== undefined, state(), local.disabledReason)\n const copy = () => restoreDialogCopy(local.label, local.consequence)\n const statusText = () => checkpointStatus(state(), error(), local.disabledReason)\n\n const restore = async () => {\n if (inflight || control().disabled) return\n inflight = true\n setFailure(undefined)\n setFollowed('restoring')\n const result = await settleAction(local.onRestore)\n inflight = false\n if (result.ok) {\n setFollowed('restored')\n } else {\n setFailure(result.message)\n setFollowed('failed')\n }\n }\n\n // The control is replaced by the status line on success; do not strand focus.\n createEffect(\n on(\n () => state() === 'restored',\n (restored) => {\n if (!restored) return\n const active = document.activeElement\n if (active === null || active === document.body || root?.contains(active)) {\n status?.focus()\n }\n },\n { defer: true }\n )\n )\n\n // Built once. `Marker` reads `action` twice (to test it, then to draw it), and a\n // JSX prop re-creates its component on every read: a second AlertDialog root\n // would portal a second, invisible-to-the-tree dialog when this one opens.\n const restoreAction = createMemo(() => (\n <Show when={control().visible}>\n <AlertDialog\n open={confirming()}\n onOpenChange={(open) => setConfirming(open && !control().disabled)}\n >\n <AlertDialogTrigger\n as={Button}\n variant=\"ghost\"\n size=\"2xs\"\n aria-disabled={control().disabled || undefined}\n aria-describedby={statusText() ? reasonId : undefined}\n >\n <Show when={state() === 'restoring'}>\n <Spinner size=\"xs\" label={false} />\n </Show>\n {state() === 'restoring'\n ? 'Restoring…'\n : (local.restoreLabel ?? (state() === 'failed' ? 'Try again' : 'Restore'))}\n </AlertDialogTrigger>\n <AlertDialogContent>\n <AlertDialogHeader>\n <AlertDialogTitle>{copy().title}</AlertDialogTitle>\n <AlertDialogDescription class=\"[overflow-wrap:anywhere]\">\n {copy().description}\n </AlertDialogDescription>\n </AlertDialogHeader>\n <AlertDialogFooter>\n <AlertDialogCancel as={Button} variant=\"ghost\">\n Do not restore\n </AlertDialogCancel>\n <AlertDialogAction as={Button} onClick={() => void restore()}>\n {local.restoreLabel ?? 'Restore'}\n </AlertDialogAction>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialog>\n </Show>\n ))\n\n return (\n <div\n ref={(element) => (root = element)}\n data-slot=\"checkpoint\"\n data-state={state()}\n class={local.class}\n {...rest}\n >\n <Marker\n variant=\"rule\"\n icon={<Flag />}\n tone={state() === 'failed' ? 'danger' : 'neutral'}\n label={checkpointLabel(local.label)}\n description={local.time ? boundText(local.time, 60) : undefined}\n action={restoreAction()}\n />\n {/* Always present, so a state change is a change to a live region rather than\n the arrival of one. Empty while idle, which takes no space. */}\n <p\n id={reasonId}\n ref={(element) => (status = element)}\n role=\"status\"\n tabindex=\"-1\"\n class={cn('m-0 text-center text-xs outline-none [overflow-wrap:anywhere]', {\n 'text-destructive': state() === 'failed',\n 'text-muted-foreground': state() !== 'failed',\n })}\n >\n {statusText()}\n </p>\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;;AAiFA,SAAgBmC,WAAWC,OAAwB;CACjD,MAAM,CAACC,OAAOC,QAAQ/B,WAAW6B,OAAO;EACtC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CAAO,CACR;CAED,MAAMI,WAAW,GADLpC,eACQmC,EAAG;CACvB,MAAM,CAACE,UAAUC,eAAevC,aAA8B,MAAM;CACpE,MAAM,CAACwC,SAASC,cAAczC,aAAiC0C,KAAAA,CAAS;CACxE,MAAM,CAACC,YAAYC,iBAAiB5C,aAAa,KAAK;CACtD,IAAI6C,WAAW;CACf,IAAIC;CACJ,IAAIC;CAEJ,MAAMrB,cAA+BQ,MAAMR,SAASY,SAAS;CAC7D,MAAMP,cAAcG,MAAMH,SAASS,QAAQ;CAC3C,MAAMQ,gBAAgB1B,eAAeY,MAAMP,cAAce,KAAAA,GAAWhB,MAAM,GAAGQ,MAA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WAAA;IAAA,OACZQ,MAAMoD;GAAK;EAAA,GACdnD,IAAI,GAAA,OAAA,IAAA;EAAAoD,OAAAT,MAAAb,gBAEPjD,QAAM;GACLwD,SAAO;GAAA,IACPgB,OAAI;IAAA,OAAAvB,gBAAGpE,MAAI,CAAA,CAAA;GAAA;GAAA,IACX4F,OAAI;IAAA,OAAE/D,MAAM,MAAM,WAAW,WAAW;GAAS;GAAA,IACjDF,QAAK;IAAA,OAAEJ,gBAAgBc,MAAMV,KAAK;GAAC;GAAA,IACnCoD,cAAW;IAAA,OAAEF,WAAA,CAAA,CAAAxC,MAAMT,IAAI,CAAA,CAAA,IAAGN,UAAUe,MAAMT,MAAM,EAAE,IAAIiB,KAAAA;GAAS;GAAA,IAC/DgD,SAAM;IAAA,OAAE1B,cAAc;GAAC;EAAA,CAAA,GAAAgB,KAAA;EAAAE,KAMjBC,YAAapC,SAASoC,SAAQH,KAAA;EAAAW,aAAAX,OAAA,MADhC3C,QAAQ;EAAAkD,OAAAP,OASX9B,UAAU;EAAA0C,aAAAC,UAAAb,OALJ3E,GAAG,iEAAiE;GACzE,oBAAoBqB,MAAM,MAAM;GAChC,yBAAyBA,MAAM,MAAM;EACvC,CAAC,CAAC,CAAA;EAAA,OAAAoD;CAAA,EAAA,CAAA;AAMV"}
@@ -1 +1 @@
1
- {"version":3,"file":"confirmation.js","names":["Ban","Check","Clock","Lock","ShieldQuestion","createEffect","createSignal","createUniqueId","Show","splitProps","ComponentProps","JSX","cn","Button","CodeBlock","DiffBlock","Spinner","REASON_TEXT_LIMIT","boundText","confirmationOutcome","decisionReason","isAwaitingAnswer","settleDecision","ConfirmationState","ConfirmationDetails","Readonly","kind","code","language","title","patch","ConfirmationProps","Omit","state","description","details","onApprove","Promise","onDeny","approveLabel","denyLabel","disabledReason","error","resolvedBy","resolvedAt","children","Element","Choice","Confirmation","props","local","rest","uid","titleId","reasonId","awaiting","pending","setPending","undefined","failure","setFailure","inflight","root","HTMLElement","outcome","HTMLParagraphElement","reasonFor","handler","missing","hasHandler","unavailableFallback","missingFallback","approveReason","denyReason","reasons","Set","filter","Boolean","join","choose","choice","blocked","result","ok","message","wasAwaiting","now","active","document","activeElement","body","contains","focus","buttonProps","disabled","onClick","_el$","_tmpl$6","_el$2","firstChild","_el$3","_el$4","nextSibling","_el$5","_$use","element","_$setAttribute","_$spread","_$mergeProps","data-state","class","_$insert","_$createComponent","when","_el$6","_tmpl$","_el$7","_tmpl$2","Details","fallback","_el$10","_tmpl$7","_el$8","_tmpl$3","_el$9","_tmpl$4","_el$0","_tmpl$5","_el$1","type","variant","size","label","_$memo","bounded","value","limit","Extract","complete","wrap","maxHeight","diff","_el$11","_tmpl$8","_$mergeProps","_$createComponent","_$memo"],"sources":["../../../../src/components/composites/confirmation/confirmation.tsx"],"sourcesContent":["import { Ban, Check, Clock, Lock, ShieldQuestion } from 'lucide-solid'\nimport {\n createEffect,\n createSignal,\n createUniqueId,\n Show,\n splitProps,\n type ComponentProps,\n type JSX,\n} from 'solid-js'\nimport { cn } from '#lib/utils'\nimport { Button } from '../../ui/button'\nimport { CodeBlock } from '../../ui/code-block'\nimport { DiffBlock } from '../../ui/diff-block'\nimport { Spinner } from '../../ui/spinner'\nimport { REASON_TEXT_LIMIT, boundText } from '#lib/text'\nimport {\n confirmationOutcome,\n decisionReason,\n isAwaitingAnswer,\n settleDecision,\n type ConfirmationState,\n} from './confirmation-model'\n\n/**\n * Confirmation.\n *\n * The agent has stopped a tool and will not continue until the person approves or\n * denies it. Like `Questionnaire`, this is one of the two elements in a transcript\n * the reader *must* act on, so it is allowed a card surface — and the border is\n * the focus ring's colour only while it is waiting. Once answered it drops to a\n * hairline and a one-line record, because a settled decision should read as\n * history, not as something still asking.\n *\n * ## It shows what is being approved, and nothing else\n *\n * `title` and `description` say what the tool wants to do; `details` is the\n * evidence, rendered as `CodeBlock size=\"sm\"` (a command, a request) or\n * `DiffBlock` (a patch). Details are text: never interpreted, and a long one\n * scrolls inside its block. Approve and Deny exist only while the request is\n * open; afterwards they are replaced by the outcome, with *who* and *when* only if\n * the host supplied them.\n *\n * ## The host owns authority\n *\n * Whether this client may answer is not decided here. No handler, or a host\n * `disabledReason`, or the `unavailable` state, leaves the buttons visible and\n * disabled with the reason beside them in words — never hidden, because a reader\n * who cannot see the choice cannot tell whether the agent is waiting on them.\n *\n * ## Answering is a round trip\n *\n * `onApprove` / `onDeny` may return a promise. While one is pending both buttons\n * refuse input (a synchronous guard as well as the signal, so a double click in\n * one tick cannot submit twice) and the pressed one shows a spinner. A failure\n * shows `error` (or the rejection's own message) and re-enables the buttons. The\n * buttons use `aria-disabled` rather than `disabled`: a native disabled button\n * drops focus, and the reader's place would be lost mid-decision. When the state\n * settles, focus moves to the outcome line if it was in the card, so a keyboard\n * user is not stranded on a control that no longer exists.\n */\nexport type ConfirmationDetails =\n | Readonly<{ kind: 'code'; code: string; language?: string; title?: string }>\n | Readonly<{ kind: 'diff'; patch: string; title?: string }>\n\nexport type ConfirmationProps = Omit<ComponentProps<'section'>, 'title' | 'onError'> & {\n state?: ConfirmationState\n /** What the tool wants to do, as a short sentence. */\n title: string\n description?: string\n details?: ConfirmationDetails\n onApprove?: () => void | Promise<void>\n onDeny?: () => void | Promise<void>\n approveLabel?: string\n denyLabel?: string\n /** Why the choice cannot be made right now; shown in words beside the buttons. */\n disabledReason?: string\n /** A failed answer, in words. Overrides the rejection's own message. */\n error?: string\n /** Who answered, once settled. Omit if unknown; nothing is assumed. */\n resolvedBy?: string\n /** When it was answered, already formatted for the reader. Omit if unknown. */\n resolvedAt?: string\n /** Extra content between the details and the buttons. */\n children?: JSX.Element\n}\n\ntype Choice = 'approve' | 'deny'\n\nexport function Confirmation(props: ConfirmationProps) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'state',\n 'title',\n 'description',\n 'details',\n 'onApprove',\n 'onDeny',\n 'approveLabel',\n 'denyLabel',\n 'disabledReason',\n 'error',\n 'resolvedBy',\n 'resolvedAt',\n 'children',\n ])\n const uid = createUniqueId()\n const titleId = `${uid}-title`\n const reasonId = `${uid}-reason`\n const state = (): ConfirmationState => local.state ?? 'requested'\n const awaiting = () => isAwaitingAnswer(state())\n const [pending, setPending] = createSignal<Choice | undefined>(undefined)\n const [failure, setFailure] = createSignal<string | undefined>(undefined)\n let inflight = false\n let root: HTMLElement | undefined\n let outcome: HTMLParagraphElement | undefined\n\n const reasonFor = (handler: (() => void | Promise<void>) | undefined, missing: string) => {\n if (pending() !== undefined) return 'Your answer is being sent.'\n return decisionReason({\n state: state(),\n disabledReason: local.disabledReason,\n hasHandler: handler !== undefined,\n unavailableFallback: 'This request cannot be answered right now.',\n missingFallback: missing,\n })\n }\n const approveReason = () => reasonFor(local.onApprove, 'Approving is not available here.')\n const denyReason = () => reasonFor(local.onDeny, 'Denying is not available here.')\n // One sentence per distinct reason, so two identical reasons are not read twice.\n const reasons = () => [...new Set([approveReason(), denyReason()].filter(Boolean))].join(' ')\n const error = () => (local.error ? boundText(local.error, REASON_TEXT_LIMIT) : failure())\n\n const choose = async (choice: Choice) => {\n const handler = choice === 'approve' ? local.onApprove : local.onDeny\n const blocked = choice === 'approve' ? approveReason() : denyReason()\n if (inflight || blocked || !awaiting()) return\n inflight = true\n setPending(choice)\n setFailure(undefined)\n const result = await settleDecision(handler)\n inflight = false\n setPending(undefined)\n if (!result.ok) setFailure(result.message)\n }\n\n // The buttons are replaced by the outcome line; keep a keyboard reader in the card.\n // The previous value is kept by hand: `on(..., { defer: true })` does not record the\n // input of its skipped first run, so its \"previous\" is undefined on the first change.\n let wasAwaiting = awaiting()\n createEffect(() => {\n const now = awaiting()\n if (wasAwaiting && !now) {\n const active = document.activeElement\n if (active === null || active === document.body || root?.contains(active)) {\n outcome?.focus()\n }\n }\n wasAwaiting = now\n })\n\n const buttonProps = (choice: Choice) => {\n const blocked = () => (choice === 'approve' ? approveReason() : denyReason())\n const disabled = () => pending() !== undefined || blocked() !== undefined\n return {\n 'aria-disabled': disabled() || undefined,\n 'aria-describedby': blocked() ? reasonId : undefined,\n onClick: () => void choose(choice),\n }\n }\n\n return (\n <section\n ref={(element) => (root = element)}\n data-slot=\"confirmation\"\n data-state={state()}\n aria-labelledby={titleId}\n class={cn('flex w-full max-w-xl min-w-0 flex-col gap-3 rounded-xl border bg-card p-4', {\n 'border-ring': awaiting(),\n 'border-border': !awaiting(),\n })}\n {...rest}\n >\n <header class=\"flex items-start gap-2.5\">\n <span aria-hidden=\"true\" class=\"mt-0.5 text-muted-foreground [&_svg]:size-4\">\n <Show when={state() === 'approved'}>\n <Check class=\"text-success\" />\n </Show>\n <Show when={state() === 'denied'}>\n <Ban />\n </Show>\n <Show when={state() === 'expired'}>\n <Clock />\n </Show>\n <Show when={state() === 'unavailable'}>\n <Lock />\n </Show>\n <Show when={state() === 'requested'}>\n <ShieldQuestion />\n </Show>\n </span>\n <div class=\"min-w-0 flex-1\">\n <h3 id={titleId} class=\"m-0 text-sm font-semibold [overflow-wrap:anywhere]\">\n {boundText(local.title, 200)}\n </h3>\n <Show when={local.description}>\n <p class=\"m-0 mt-0.5 text-xs text-muted-foreground [overflow-wrap:anywhere]\">\n {boundText(local.description ?? '', 400)}\n </p>\n </Show>\n </div>\n <Show when={awaiting()}>\n <span class=\"shrink-0 text-xs text-muted-foreground\">\n {state() === 'requested' ? 'Needs your answer' : 'Cannot be answered now'}\n </span>\n </Show>\n </header>\n\n <Show when={local.details}>{(details) => <Details details={details()} />}</Show>\n\n {local.children}\n\n <Show\n when={awaiting()}\n fallback={\n <p\n ref={(element) => (outcome = element)}\n tabindex=\"-1\"\n role=\"status\"\n class=\"m-0 flex items-center gap-1.5 text-xs text-muted-foreground outline-none\"\n >\n {confirmationOutcome(state(), local.resolvedBy, local.resolvedAt)}\n </p>\n }\n >\n <Show when={reasons()}>\n <p id={reasonId} role=\"status\" class=\"m-0 text-xs text-muted-foreground\">\n {reasons()}\n </p>\n </Show>\n <Show when={error()}>\n <p role=\"alert\" class=\"m-0 text-xs text-destructive [overflow-wrap:anywhere]\">\n {error()}\n </p>\n </Show>\n <footer class=\"flex flex-wrap items-center justify-end gap-2\">\n <Button type=\"button\" variant=\"outline\" size=\"sm\" {...buttonProps('deny')}>\n <Show when={pending() === 'deny'}>\n <Spinner size=\"sm\" label={false} />\n </Show>\n {local.denyLabel ?? 'Deny'}\n </Button>\n <Button type=\"button\" size=\"sm\" {...buttonProps('approve')}>\n <Show when={pending() === 'approve'}>\n <Spinner size=\"sm\" label={false} />\n </Show>\n {local.approveLabel ?? 'Approve'}\n </Button>\n {/* Present from the start: a live region inserted with its text is not reliably announced. */}\n <span role=\"status\" class=\"visually-hidden\">\n {pending() !== undefined ? 'Sending your answer' : ''}\n </span>\n </footer>\n </Show>\n </section>\n )\n}\n\n/** A name from the host or the model, cleaned and clipped before it reaches a header. */\nfunction bounded(value: string | undefined, limit: number): string | undefined {\n return value ? boundText(value, limit) || undefined : undefined\n}\n\nfunction Details(props: { details: ConfirmationDetails }) {\n return (\n <Show\n when={props.details.kind === 'diff' && props.details}\n fallback={\n <CodeBlock\n size=\"sm\"\n code={(props.details as Extract<ConfirmationDetails, { kind: 'code' }>).code}\n language={bounded(\n (props.details as Extract<ConfirmationDetails, { kind: 'code' }>).language,\n 24\n )}\n title={bounded(props.details.title, 80)}\n complete\n wrap\n maxHeight=\"14rem\"\n />\n }\n >\n {(diff) => (\n // The diff block has no height cap of its own, so the cap lives here; a\n // scroller must be focusable, hence the labelled region and tab stop.\n <div\n role=\"region\"\n aria-label=\"Proposed changes\"\n tabindex=\"0\"\n class=\"max-h-64 overflow-auto rounded-xl outline-none focus-visible:ring-3 focus-visible:ring-primary-subtle\"\n >\n <DiffBlock\n patch={(diff() as Extract<ConfirmationDetails, { kind: 'diff' }>).patch}\n title={bounded(diff().title, 80)}\n complete\n />\n </div>\n )}\n </Show>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAyFA,SAAgBgD,aAAaC,OAA0B;CACrD,MAAM,CAACC,OAAOC,QAAQ1C,WAAWwC,OAAO;EACtC;EACA;EAC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AAIuB,MAAMd;EAAO;EAAA,IACpDoF,WAAQ;GAAA,OAAAP,gBACLlG,WAAS;IACRqH,MAAI;IAAA,IACJxG,OAAI;KAAA,OAAGsB,MAAMd,QAA2DR;IAAI;IAAA,IAC5EC,WAAQ;KAAA,OAAE0G,QACPrF,MAAMd,QAA2DP,UAClE,EACF;IAAC;IAAA,IACDC,QAAK;KAAA,OAAEyG,QAAQrF,MAAMd,QAAQN,OAAO,EAAE;IAAC;IACvC6G,UAAQ;IACRC,MAAI;IACJC,WAAS;GAAA,CAAA;EAAA;EAAA/F,WAIXgG,gBAEA;GAAA,IAAAC,SAAAC,QAAA;GAAAhC,OAAA+B,QAAA9B,gBAOGjG,WAAS;IAAA,IACRe,QAAK;KAAA,OAAG+G,KAAK,CAAC,CAAoD/G;IAAK;IAAA,IACvED,QAAK;KAAA,OAAEyG,QAAQO,KAAK,CAAC,CAAChH,OAAO,EAAE;IAAC;IAChC6G,UAAQ;GAAA,CAAA,CAAA;GAAA,OAAAI;EAAA,EAAA,CAAA;CAGb,CAAA;AAGP"}
1
+ {"version":3,"file":"confirmation.js","names":["Ban","Check","Clock","Lock","ShieldQuestion","createEffect","createSignal","createUniqueId","Show","splitProps","cn","Button","CodeBlock","DiffBlock","Spinner","boundText","confirmationOutcome","decisionReason","isAwaitingAnswer","settleDecision","kind","code","language","title","patch","state","description","details","onApprove","onDeny","approveLabel","denyLabel","disabledReason","error","resolvedBy","resolvedAt","children","Confirmation","props","local","rest","uid","titleId","reasonId","awaiting","pending","setPending","undefined","failure","setFailure","inflight","root","outcome","reasonFor","handler","missing","hasHandler","unavailableFallback","missingFallback","approveReason","denyReason","reasons","Set","filter","Boolean","join","choose","choice","blocked","result","ok","message","wasAwaiting","now","active","document","activeElement","body","contains","focus","buttonProps","disabled","onClick","_el$","_tmpl$6","_el$2","firstChild","_el$3","_el$4","nextSibling","_el$5","_$use","element","_$setAttribute","_$spread","_$mergeProps","_$insert","_$createComponent","when","_el$6","_tmpl$","_el$7","_tmpl$2","Details","fallback","_el$10","_tmpl$7","_el$8","_tmpl$3","_el$9","_tmpl$4","_el$0","_tmpl$5","_el$1","type","variant","size","label","_$memo","bounded","value","limit","complete","wrap","maxHeight","diff","_el$11","_tmpl$8"],"sources":["../../../../src/components/composites/confirmation/confirmation.tsx"],"sourcesContent":["import { Ban, Check, Clock, Lock, ShieldQuestion } from 'lucide-solid'\nimport {\n createEffect,\n createSignal,\n createUniqueId,\n Show,\n splitProps,\n type ComponentProps,\n type JSX,\n} from 'solid-js'\nimport { cn } from '#lib/utils'\nimport { Button } from '../../ui/button'\nimport { CodeBlock } from '../../ui/code-block'\nimport { DiffBlock } from '../../ui/diff-block'\nimport { Spinner } from '../../ui/spinner'\nimport { REASON_TEXT_LIMIT, boundText } from '#lib/text'\nimport {\n confirmationOutcome,\n decisionReason,\n isAwaitingAnswer,\n settleDecision,\n type ConfirmationState,\n} from './confirmation-model'\n\n/**\n * Confirmation.\n *\n * The agent has stopped a tool and will not continue until the person approves or\n * denies it. Like `Questionnaire`, this is one of the two elements in a transcript\n * the reader *must* act on, so it is allowed a card surface — and the border is\n * the focus ring's colour only while it is waiting. Once answered it drops to a\n * hairline and a one-line record, because a settled decision should read as\n * history, not as something still asking.\n *\n * ## It shows what is being approved, and nothing else\n *\n * `title` and `description` say what the tool wants to do; `details` is the\n * evidence, rendered as `CodeBlock size=\"sm\"` (a command, a request) or\n * `DiffBlock` (a patch). Details are text: never interpreted, and a long one\n * scrolls inside its block. Approve and Deny exist only while the request is\n * open; afterwards they are replaced by the outcome, with *who* and *when* only if\n * the host supplied them.\n *\n * ## The host owns authority\n *\n * Whether this client may answer is not decided here. No handler, or a host\n * `disabledReason`, or the `unavailable` state, leaves the buttons visible and\n * disabled with the reason beside them in words — never hidden, because a reader\n * who cannot see the choice cannot tell whether the agent is waiting on them.\n *\n * ## Answering is a round trip\n *\n * `onApprove` / `onDeny` may return a promise. While one is pending both buttons\n * refuse input (a synchronous guard as well as the signal, so a double click in\n * one tick cannot submit twice) and the pressed one shows a spinner. A failure\n * shows `error` (or the rejection's own message) and re-enables the buttons. The\n * buttons use `aria-disabled` rather than `disabled`: a native disabled button\n * drops focus, and the reader's place would be lost mid-decision. When the state\n * settles, focus moves to the outcome line if it was in the card, so a keyboard\n * user is not stranded on a control that no longer exists.\n */\nexport type ConfirmationDetails =\n | Readonly<{ kind: 'code'; code: string; language?: string; title?: string }>\n | Readonly<{ kind: 'diff'; patch: string; title?: string }>\n\nexport type ConfirmationProps = Omit<ComponentProps<'section'>, 'title' | 'onError'> & {\n state?: ConfirmationState\n /** What the tool wants to do, as a short sentence. */\n title: string\n description?: string\n details?: ConfirmationDetails\n onApprove?: () => void | Promise<void>\n onDeny?: () => void | Promise<void>\n approveLabel?: string\n denyLabel?: string\n /** Why the choice cannot be made right now; shown in words beside the buttons. */\n disabledReason?: string\n /** A failed answer, in words. Overrides the rejection's own message. */\n error?: string\n /** Who answered, once settled. Omit if unknown; nothing is assumed. */\n resolvedBy?: string\n /** When it was answered, already formatted for the reader. Omit if unknown. */\n resolvedAt?: string\n /** Extra content between the details and the buttons. */\n children?: JSX.Element\n}\n\ntype Choice = 'approve' | 'deny'\n\nexport function Confirmation(props: ConfirmationProps) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'state',\n 'title',\n 'description',\n 'details',\n 'onApprove',\n 'onDeny',\n 'approveLabel',\n 'denyLabel',\n 'disabledReason',\n 'error',\n 'resolvedBy',\n 'resolvedAt',\n 'children',\n ])\n const uid = createUniqueId()\n const titleId = `${uid}-title`\n const reasonId = `${uid}-reason`\n const state = (): ConfirmationState => local.state ?? 'requested'\n const awaiting = () => isAwaitingAnswer(state())\n const [pending, setPending] = createSignal<Choice | undefined>(undefined)\n const [failure, setFailure] = createSignal<string | undefined>(undefined)\n let inflight = false\n let root: HTMLElement | undefined\n let outcome: HTMLParagraphElement | undefined\n\n const reasonFor = (handler: (() => void | Promise<void>) | undefined, missing: string) => {\n if (pending() !== undefined) return 'Your answer is being sent.'\n return decisionReason({\n state: state(),\n disabledReason: local.disabledReason,\n hasHandler: handler !== undefined,\n unavailableFallback: 'This request cannot be answered right now.',\n missingFallback: missing,\n })\n }\n const approveReason = () => reasonFor(local.onApprove, 'Approving is not available here.')\n const denyReason = () => reasonFor(local.onDeny, 'Denying is not available here.')\n // One sentence per distinct reason, so two identical reasons are not read twice.\n const reasons = () => [...new Set([approveReason(), denyReason()].filter(Boolean))].join(' ')\n const error = () => (local.error ? boundText(local.error, REASON_TEXT_LIMIT) : failure())\n\n const choose = async (choice: Choice) => {\n const handler = choice === 'approve' ? local.onApprove : local.onDeny\n const blocked = choice === 'approve' ? approveReason() : denyReason()\n if (inflight || blocked || !awaiting()) return\n inflight = true\n setPending(choice)\n setFailure(undefined)\n const result = await settleDecision(handler)\n inflight = false\n setPending(undefined)\n if (!result.ok) setFailure(result.message)\n }\n\n // The buttons are replaced by the outcome line; keep a keyboard reader in the card.\n // The previous value is kept by hand: `on(..., { defer: true })` does not record the\n // input of its skipped first run, so its \"previous\" is undefined on the first change.\n let wasAwaiting = awaiting()\n createEffect(() => {\n const now = awaiting()\n if (wasAwaiting && !now) {\n const active = document.activeElement\n if (active === null || active === document.body || root?.contains(active)) {\n outcome?.focus()\n }\n }\n wasAwaiting = now\n })\n\n const buttonProps = (choice: Choice) => {\n const blocked = () => (choice === 'approve' ? approveReason() : denyReason())\n const disabled = () => pending() !== undefined || blocked() !== undefined\n return {\n 'aria-disabled': disabled() || undefined,\n 'aria-describedby': blocked() ? reasonId : undefined,\n onClick: () => void choose(choice),\n }\n }\n\n return (\n <section\n ref={(element) => (root = element)}\n data-slot=\"confirmation\"\n data-state={state()}\n aria-labelledby={titleId}\n class={cn('flex w-full max-w-xl min-w-0 flex-col gap-3 rounded-xl border bg-card p-4', {\n 'border-ring': awaiting(),\n 'border-border': !awaiting(),\n })}\n {...rest}\n >\n <header class=\"flex items-start gap-2.5\">\n <span aria-hidden=\"true\" class=\"mt-0.5 text-muted-foreground [&_svg]:size-4\">\n <Show when={state() === 'approved'}>\n <Check class=\"text-success\" />\n </Show>\n <Show when={state() === 'denied'}>\n <Ban />\n </Show>\n <Show when={state() === 'expired'}>\n <Clock />\n </Show>\n <Show when={state() === 'unavailable'}>\n <Lock />\n </Show>\n <Show when={state() === 'requested'}>\n <ShieldQuestion />\n </Show>\n </span>\n <div class=\"min-w-0 flex-1\">\n <h3 id={titleId} class=\"m-0 text-sm font-semibold [overflow-wrap:anywhere]\">\n {boundText(local.title, 200)}\n </h3>\n <Show when={local.description}>\n <p class=\"m-0 mt-0.5 text-xs text-muted-foreground [overflow-wrap:anywhere]\">\n {boundText(local.description ?? '', 400)}\n </p>\n </Show>\n </div>\n <Show when={awaiting()}>\n <span class=\"shrink-0 text-xs text-muted-foreground\">\n {state() === 'requested' ? 'Needs your answer' : 'Cannot be answered now'}\n </span>\n </Show>\n </header>\n\n <Show when={local.details}>{(details) => <Details details={details()} />}</Show>\n\n {local.children}\n\n <Show\n when={awaiting()}\n fallback={\n <p\n ref={(element) => (outcome = element)}\n tabindex=\"-1\"\n role=\"status\"\n class=\"m-0 flex items-center gap-1.5 text-xs text-muted-foreground outline-none\"\n >\n {confirmationOutcome(state(), local.resolvedBy, local.resolvedAt)}\n </p>\n }\n >\n <Show when={reasons()}>\n <p id={reasonId} role=\"status\" class=\"m-0 text-xs text-muted-foreground\">\n {reasons()}\n </p>\n </Show>\n <Show when={error()}>\n <p role=\"alert\" class=\"m-0 text-xs text-destructive [overflow-wrap:anywhere]\">\n {error()}\n </p>\n </Show>\n <footer class=\"flex flex-wrap items-center justify-end gap-2\">\n <Button type=\"button\" variant=\"outline\" size=\"sm\" {...buttonProps('deny')}>\n <Show when={pending() === 'deny'}>\n <Spinner size=\"sm\" label={false} />\n </Show>\n {local.denyLabel ?? 'Deny'}\n </Button>\n <Button type=\"button\" size=\"sm\" {...buttonProps('approve')}>\n <Show when={pending() === 'approve'}>\n <Spinner size=\"sm\" label={false} />\n </Show>\n {local.approveLabel ?? 'Approve'}\n </Button>\n {/* Present from the start: a live region inserted with its text is not reliably announced. */}\n <span role=\"status\" class=\"visually-hidden\">\n {pending() !== undefined ? 'Sending your answer' : ''}\n </span>\n </footer>\n </Show>\n </section>\n )\n}\n\n/** A name from the host or the model, cleaned and clipped before it reaches a header. */\nfunction bounded(value: string | undefined, limit: number): string | undefined {\n return value ? boundText(value, limit) || undefined : undefined\n}\n\nfunction Details(props: { details: ConfirmationDetails }) {\n return (\n <Show\n when={props.details.kind === 'diff' && props.details}\n fallback={\n <CodeBlock\n size=\"sm\"\n code={(props.details as Extract<ConfirmationDetails, { kind: 'code' }>).code}\n language={bounded(\n (props.details as Extract<ConfirmationDetails, { kind: 'code' }>).language,\n 24\n )}\n title={bounded(props.details.title, 80)}\n complete\n wrap\n maxHeight=\"14rem\"\n />\n }\n >\n {(diff) => (\n // The diff block has no height cap of its own, so the cap lives here; a\n // scroller must be focusable, hence the labelled region and tab stop.\n <div\n role=\"region\"\n aria-label=\"Proposed changes\"\n tabindex=\"0\"\n class=\"max-h-64 overflow-auto rounded-xl outline-none focus-visible:ring-3 focus-visible:ring-primary-subtle\"\n >\n <DiffBlock\n patch={(diff() as Extract<ConfirmationDetails, { kind: 'diff' }>).patch}\n title={bounded(diff().title, 80)}\n complete\n />\n </div>\n )}\n </Show>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAyFA,SAAgBqC,aAAaC,OAA0B;CACrD,MAAM,CAACC,OAAOC,QAAQ/B,WAAW6B,OAAO;EACtC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CAAU,CACX;CACD,MAAMG,MAAMlC,eAAe;CAC3B,MAAMmC,UAAU,GAAGD,IAAG;CACtB,MAAME,WAAW,GAAGF,IAAG;CACvB,MAAMhB,cAAiCc,MAAMd,SAAS;CACtD,MAAMmB,iBAAiB1B,iBAAiBO,MAAM,CAAC;CAC/C,MAAM,CAACoB,SAASC,cAAcxC,aAAiCyC,KAAAA,CAAS;C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;IACRC,MAAI;IACJC,WAAS;GAAA,CAAA;EAAA;EAAAxF,WAIXyF,gBAEA;GAAA,IAAAC,SAAAC,QAAA;GAAA/B,OAAA8B,QAAA7B,gBAOGpF,WAAS;IAAA,IACRW,QAAK;KAAA,OAAGqG,KAAK,CAAC,CAAoDrG;IAAK;IAAA,IACvED,QAAK;KAAA,OAAEgG,QAAQM,KAAK,CAAC,CAACtG,OAAO,EAAE;IAAC;IAChCmG,UAAQ;GAAA,CAAA,CAAA;GAAA,OAAAI;EAAA,EAAA,CAAA;CAGb,CAAA;AAGP"}
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","names":["OctagonAlert","TriangleAlert","For","Show","splitProps","ComponentProps","cn","Button","Popover","PopoverContent","PopoverTitle","PopoverTrigger","Progress","breakdownRows","contextLabel","contextLevel","contextLevelWord","contextPercent","contextShort","formatCost","formatExact","hasContextFigures","isFigure","ContextFigures","ContextLevel","ContextProps","locale","placement","class","RING_RADIUS","RING_CIRCUMFERENCE","Math","PI","Context","props","local","figures","percent","used","total","level","levelWord","rows","breakdown","remaining","undefined","cost","amount","_$createComponent","when","children","gutter","as","variant","size","data-level","aria-label","fallback","Ring","_el$","_tmpl$","_$insert","_$effect","_$className","_el$2","_tmpl$2","_el$3","_tmpl$4","_el$6","firstChild","value","min","minValue","maxValue","label","getValueLabel","_el$4","_tmpl$3","_el$5","Row","each","row","filled","max","_el$7","_tmpl$5","_el$8","_el$9","nextSibling","_$setAttribute","_el$0","_tmpl$6","_el$1","_el$10","_$createComponent","_$className","_$setAttribute"],"sources":["../../../../src/components/composites/context/context.tsx"],"sourcesContent":["import { OctagonAlert, TriangleAlert } from 'lucide-solid'\nimport { For, Show, splitProps, type ComponentProps } from 'solid-js'\nimport { cn } from '#lib/utils'\nimport { Button } from '../../ui/button'\nimport { Popover, PopoverContent, PopoverTitle, PopoverTrigger } from '../../ui/popover'\nimport { Progress } from '../../ui/progress'\nimport {\n breakdownRows,\n contextLabel,\n contextLevel,\n contextLevelWord,\n contextPercent,\n contextShort,\n formatCost,\n formatExact,\n hasContextFigures,\n isFigure,\n type ContextFigures,\n type ContextLevel,\n} from './context-model'\n\n/**\n * Context.\n *\n * How much of the model's context window is in use, as a compact trigger that\n * opens the figures behind it. It sits next to the composer, where the reader\n * decides whether to keep going or start fresh, so the trigger is small and the\n * detail is a press away rather than permanent chrome.\n *\n * ## Every figure is a claim, so every figure is optional\n *\n * A host passes whatever it knows: `used`, `total`, a `breakdown` (input, output,\n * cache read and write, reasoning), a `cost`. A missing value is omitted — never\n * drawn as 0, which would say \"empty\" about a window nobody measured — and when\n * *nothing* is known the trigger is not rendered at all (`hasContextFigures`).\n * Nothing is estimated here; the one derived row, \"Remaining\", appears only when\n * both `used` and `total` are known and `used` does not exceed `total`.\n *\n * ## Never colour alone\n *\n * The ring shows the fraction; past 75% the ring gives way to a warning glyph\n * (triangle, then octagon at 90% and above), the popover says \"Getting full\",\n * \"Nearly full\" or \"Full\" in words, and the trigger's accessible name speaks the\n * same. An overrun is reported as it is (\"112%\"); only the ring saturates.\n *\n * It is a `Popover`, not a hover card: the figures must be reachable by keyboard\n * and by touch, and Escape closes it and returns focus to the trigger.\n */\nexport type ContextProps = ContextFigures & {\n /** BCP 47 tag for number formatting. Defaults to `en-US`, so output is stable. */\n locale?: string\n placement?: ComponentProps<typeof Popover>['placement']\n class?: string\n}\n\n// A circle of radius 6 in a 16-unit box; the dash array is the fraction of this.\nconst RING_RADIUS = 6\nconst RING_CIRCUMFERENCE = 2 * Math.PI * RING_RADIUS\n\nexport function Context(props: ContextProps) {\n const [local, figures] = splitProps(props, ['locale', 'placement', 'class'])\n const locale = () => local.locale ?? 'en-US'\n const percent = () => contextPercent(figures.used, figures.total)\n const level = (): ContextLevel => contextLevel(percent())\n const levelWord = () => contextLevelWord(level())\n const rows = () => breakdownRows(figures.breakdown)\n const remaining = () =>\n isFigure(figures.used) && isFigure(figures.total) && figures.used <= figures.total\n ? figures.total - figures.used\n : undefined\n const cost = () => (figures.cost && isFigure(figures.cost.amount) ? figures.cost : undefined)\n\n return (\n <Show when={hasContextFigures(figures)}>\n <Popover placement={local.placement ?? 'top'} gutter={6}>\n <PopoverTrigger\n as={Button}\n variant=\"ghost\"\n size=\"xs\"\n data-slot=\"context\"\n data-level={level()}\n aria-label={contextLabel(figures, locale())}\n class={local.class}\n >\n <Show\n when={level() !== 'normal'}\n fallback={\n <Show when={percent() !== undefined}>\n <Ring percent={percent() ?? 0} />\n </Show>\n }\n >\n <span\n aria-hidden=\"true\"\n class={cn({\n 'text-warning': level() === 'high',\n 'text-destructive': level() === 'critical' || level() === 'full',\n })}\n >\n <Show when={level() === 'high'} fallback={<OctagonAlert />}>\n <TriangleAlert />\n </Show>\n </span>\n </Show>\n <span aria-hidden=\"true\" class=\"tabular-nums\">\n {contextShort(figures, locale())}\n </span>\n </PopoverTrigger>\n <PopoverContent class=\"w-72 max-w-full\">\n <PopoverTitle>Context window</PopoverTitle>\n <div class=\"flex flex-col gap-2 px-2 pb-2\">\n <Show when={percent() !== undefined}>\n <Progress\n value={Math.min(percent() ?? 0, 100)}\n minValue={0}\n maxValue={100}\n label=\"Context used\"\n getValueLabel={() => `${percent()}% used`}\n />\n </Show>\n <Show when={levelWord()}>\n <p\n class={cn('m-0 flex items-center gap-1.5 text-sm font-medium', {\n 'text-warning': level() === 'high',\n 'text-destructive': level() === 'critical' || level() === 'full',\n })}\n >\n <Show when={level() === 'high'} fallback={<OctagonAlert class=\"size-4\" />}>\n <TriangleAlert class=\"size-4\" />\n </Show>\n <span class=\"text-foreground\">{levelWord()}</span>\n </p>\n </Show>\n <dl class=\"m-0 flex flex-col gap-1 text-sm\">\n <Show when={isFigure(figures.used)}>\n <Row label=\"Used\" value={`${formatExact(figures.used ?? 0, locale())} tokens`} />\n </Show>\n <Show when={isFigure(figures.total)}>\n <Row label=\"Window\" value={`${formatExact(figures.total ?? 0, locale())} tokens`} />\n </Show>\n <Show when={remaining() !== undefined}>\n <Row\n label=\"Remaining\"\n value={`${formatExact(remaining() ?? 0, locale())} tokens`}\n />\n </Show>\n <For each={rows()}>\n {(row) => <Row label={row.label} value={formatExact(row.value, locale())} />}\n </For>\n <Show when={cost()}>\n {(value) => <Row label=\"Cost\" value={formatCost(value(), locale())} />}\n </Show>\n </dl>\n </div>\n </PopoverContent>\n </Popover>\n </Show>\n )\n}\n\nfunction Ring(props: { percent: number }) {\n const filled = () => (RING_CIRCUMFERENCE * Math.min(Math.max(props.percent, 0), 100)) / 100\n return (\n <svg aria-hidden=\"true\" viewBox=\"0 0 16 16\" fill=\"none\" class=\"size-4\">\n <circle cx=\"8\" cy=\"8\" r={RING_RADIUS} stroke-width=\"2\" class=\"stroke-border\" />\n <circle\n cx=\"8\"\n cy=\"8\"\n r={RING_RADIUS}\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-dasharray={`${filled()} ${RING_CIRCUMFERENCE}`}\n transform=\"rotate(-90 8 8)\"\n class=\"stroke-primary\"\n />\n </svg>\n )\n}\n\nfunction Row(props: { label: string; value: string }) {\n return (\n <div class=\"flex items-baseline justify-between gap-4\">\n <dt class=\"text-muted-foreground\">{props.label}</dt>\n <dd class=\"m-0 text-end tabular-nums\">{props.value}</dd>\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;AAyDA,IAAM8B,qBAAqB,IAAIC,KAAKC,KAAKH;AAEzC,SAAgBI,QAAQC,OAAqB;CAC3C,MAAM,CAACC,OAAOC,WAAWhC,WAAW8B,OAAO;EAAC;EAAU;EAAa;CAAO,CAAC;CAC3E,MAAMR,eAAeS,MAAMT,UAAU;CACrC,MAAMW,gBAAgBpB,eAAemB,QAAQE,MAAMF,QAAQG,KAAK;CAChE,MAAMC,cAA4BzB,aAAasB,QAAQ,CAAC;CACxD,MAAMI,kBAAkBzB,iBAAiBwB,MAAM,CAAC;CAChD,MAAME,aAAa7B,cAAcuB,QAAQO,SAAS;CAClD,MAAMC,kBACJtB,SAASc,QAAQE,IAAI,KAAKhB,SAASc,QAAQG,KA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","PopoverTitle","PopoverTrigger","Progress","breakdownRows","contextLabel","contextLevel","contextLevelWord","contextPercent","contextShort","formatCost","formatExact","hasContextFigures","isFigure","locale","placement","class","RING_RADIUS","RING_CIRCUMFERENCE","Math","PI","Context","props","local","figures","percent","used","total","level","levelWord","rows","breakdown","remaining","undefined","cost","amount","_$createComponent","when","children","gutter","as","variant","size","fallback","Ring","_el$","_tmpl$","_$insert","_$effect","_$className","_el$2","_tmpl$2","_el$3","_tmpl$4","_el$6","firstChild","value","min","minValue","maxValue","label","getValueLabel","_el$4","_tmpl$3","_el$5","Row","each","row","filled","max","_el$7","_tmpl$5","_el$9","nextSibling","_$setAttribute","_el$0","_tmpl$6","_el$1","_el$10"],"sources":["../../../../src/components/composites/context/context.tsx"],"sourcesContent":["import { OctagonAlert, TriangleAlert } from 'lucide-solid'\nimport { For, Show, splitProps, type ComponentProps } from 'solid-js'\nimport { cn } from '#lib/utils'\nimport { Button } from '../../ui/button'\nimport { Popover, PopoverContent, PopoverTitle, PopoverTrigger } from '../../ui/popover'\nimport { Progress } from '../../ui/progress'\nimport {\n breakdownRows,\n contextLabel,\n contextLevel,\n contextLevelWord,\n contextPercent,\n contextShort,\n formatCost,\n formatExact,\n hasContextFigures,\n isFigure,\n type ContextFigures,\n type ContextLevel,\n} from './context-model'\n\n/**\n * Context.\n *\n * How much of the model's context window is in use, as a compact trigger that\n * opens the figures behind it. It sits next to the composer, where the reader\n * decides whether to keep going or start fresh, so the trigger is small and the\n * detail is a press away rather than permanent chrome.\n *\n * ## Every figure is a claim, so every figure is optional\n *\n * A host passes whatever it knows: `used`, `total`, a `breakdown` (input, output,\n * cache read and write, reasoning), a `cost`. A missing value is omitted — never\n * drawn as 0, which would say \"empty\" about a window nobody measured — and when\n * *nothing* is known the trigger is not rendered at all (`hasContextFigures`).\n * Nothing is estimated here; the one derived row, \"Remaining\", appears only when\n * both `used` and `total` are known and `used` does not exceed `total`.\n *\n * ## Never colour alone\n *\n * The ring shows the fraction; past 75% the ring gives way to a warning glyph\n * (triangle, then octagon at 90% and above), the popover says \"Getting full\",\n * \"Nearly full\" or \"Full\" in words, and the trigger's accessible name speaks the\n * same. An overrun is reported as it is (\"112%\"); only the ring saturates.\n *\n * It is a `Popover`, not a hover card: the figures must be reachable by keyboard\n * and by touch, and Escape closes it and returns focus to the trigger.\n */\nexport type ContextProps = ContextFigures & {\n /** BCP 47 tag for number formatting. Defaults to `en-US`, so output is stable. */\n locale?: string\n placement?: ComponentProps<typeof Popover>['placement']\n class?: string\n}\n\n// A circle of radius 6 in a 16-unit box; the dash array is the fraction of this.\nconst RING_RADIUS = 6\nconst RING_CIRCUMFERENCE = 2 * Math.PI * RING_RADIUS\n\nexport function Context(props: ContextProps) {\n const [local, figures] = splitProps(props, ['locale', 'placement', 'class'])\n const locale = () => local.locale ?? 'en-US'\n const percent = () => contextPercent(figures.used, figures.total)\n const level = (): ContextLevel => contextLevel(percent())\n const levelWord = () => contextLevelWord(level())\n const rows = () => breakdownRows(figures.breakdown)\n const remaining = () =>\n isFigure(figures.used) && isFigure(figures.total) && figures.used <= figures.total\n ? figures.total - figures.used\n : undefined\n const cost = () => (figures.cost && isFigure(figures.cost.amount) ? figures.cost : undefined)\n\n return (\n <Show when={hasContextFigures(figures)}>\n <Popover placement={local.placement ?? 'top'} gutter={6}>\n <PopoverTrigger\n as={Button}\n variant=\"ghost\"\n size=\"xs\"\n data-slot=\"context\"\n data-level={level()}\n aria-label={contextLabel(figures, locale())}\n class={local.class}\n >\n <Show\n when={level() !== 'normal'}\n fallback={\n <Show when={percent() !== undefined}>\n <Ring percent={percent() ?? 0} />\n </Show>\n }\n >\n <span\n aria-hidden=\"true\"\n class={cn({\n 'text-warning': level() === 'high',\n 'text-destructive': level() === 'critical' || level() === 'full',\n })}\n >\n <Show when={level() === 'high'} fallback={<OctagonAlert />}>\n <TriangleAlert />\n </Show>\n </span>\n </Show>\n <span aria-hidden=\"true\" class=\"tabular-nums\">\n {contextShort(figures, locale())}\n </span>\n </PopoverTrigger>\n <PopoverContent class=\"w-72 max-w-full\">\n <PopoverTitle>Context window</PopoverTitle>\n <div class=\"flex flex-col gap-2 px-2 pb-2\">\n <Show when={percent() !== undefined}>\n <Progress\n value={Math.min(percent() ?? 0, 100)}\n minValue={0}\n maxValue={100}\n label=\"Context used\"\n getValueLabel={() => `${percent()}% used`}\n />\n </Show>\n <Show when={levelWord()}>\n <p\n class={cn('m-0 flex items-center gap-1.5 text-sm font-medium', {\n 'text-warning': level() === 'high',\n 'text-destructive': level() === 'critical' || level() === 'full',\n })}\n >\n <Show when={level() === 'high'} fallback={<OctagonAlert class=\"size-4\" />}>\n <TriangleAlert class=\"size-4\" />\n </Show>\n <span class=\"text-foreground\">{levelWord()}</span>\n </p>\n </Show>\n <dl class=\"m-0 flex flex-col gap-1 text-sm\">\n <Show when={isFigure(figures.used)}>\n <Row label=\"Used\" value={`${formatExact(figures.used ?? 0, locale())} tokens`} />\n </Show>\n <Show when={isFigure(figures.total)}>\n <Row label=\"Window\" value={`${formatExact(figures.total ?? 0, locale())} tokens`} />\n </Show>\n <Show when={remaining() !== undefined}>\n <Row\n label=\"Remaining\"\n value={`${formatExact(remaining() ?? 0, locale())} tokens`}\n />\n </Show>\n <For each={rows()}>\n {(row) => <Row label={row.label} value={formatExact(row.value, locale())} />}\n </For>\n <Show when={cost()}>\n {(value) => <Row label=\"Cost\" value={formatCost(value(), locale())} />}\n </Show>\n </dl>\n </div>\n </PopoverContent>\n </Popover>\n </Show>\n )\n}\n\nfunction Ring(props: { percent: number }) {\n const filled = () => (RING_CIRCUMFERENCE * Math.min(Math.max(props.percent, 0), 100)) / 100\n return (\n <svg aria-hidden=\"true\" viewBox=\"0 0 16 16\" fill=\"none\" class=\"size-4\">\n <circle cx=\"8\" cy=\"8\" r={RING_RADIUS} stroke-width=\"2\" class=\"stroke-border\" />\n <circle\n cx=\"8\"\n cy=\"8\"\n r={RING_RADIUS}\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-dasharray={`${filled()} ${RING_CIRCUMFERENCE}`}\n transform=\"rotate(-90 8 8)\"\n class=\"stroke-primary\"\n />\n </svg>\n )\n}\n\nfunction Row(props: { label: string; value: string }) {\n return (\n <div class=\"flex items-baseline justify-between gap-4\">\n <dt class=\"text-muted-foreground\">{props.label}</dt>\n <dd class=\"m-0 text-end tabular-nums\">{props.value}</dd>\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;AAyDA,IAAM0B,qBAAqB,IAAIC,KAAKC,KAAKH;AAEzC,SAAgBI,QAAQC,OAAqB;CAC3C,MAAM,CAACC,OAAOC,WAAW5B,WAAW0B,OAAO;EAAC;EAAU;EAAa;CAAO,CAAC;CAC3E,MAAMR,eAAeS,MAAMT,UAAU;CACrC,MAAMW,gBAAgBjB,eAAegB,QAAQE,MAAMF,QAAQG,KAAK;CAChE,MAAMC,cAA4BtB,aAAamB,QAAQ,CAAC;CACxD,MAAMI,kBAAkBtB,iBAAiBqB,MAAM,CAAC;CAChD,MAAME,aAAa1B,cAAcoB,QAAQO,SAAS;CAClD,MAAMC,kBACJnB,SAASW,QAAQE,IAAI,KAAKb,SAASW,QAAQG,KAAK,KAAKH,QAAQE,QAAQF,QAAQG,QACzEH,QAAQG,QAAQH,QAAQE,OACxBO,KAAAA;CACN,MAAMC,aAAcV,QAAQU,QAAQrB,SAASW,QAAQU,KAAKC,MAAM,IAAIX,QAAQU,OAAOD,KAAAA;CAEnF,OAAAG,gBACGzC,MAAI;EAAA,IAAC0C,OAAI;GAAA,OAAEzB,kBAAkBY,OAAO;EAAC;EAAA,IAAAc,WAAA;GAAA,OAAAF,gBACnCrC,SAAO;IAAA,IAACgB,YAAS;KAAA,OAAEQ,MAAMR,aAAa;IAAK;IAAEwB,QAAQ;IAAC,IAAAD,WAAA;KAAA,OAAA,CAAAF,gBACpDlC,gBAAc;MACbsC,IAAI1C;MACJ2C,SAAO;MACPC,MAAI;MAAA,aAAA;MAAA,KAAA,gBAAA;OAAA,OAEQd,MAAM;MAAC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