@adea-ai/ui 0.152.2 → 0.152.4

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 (237) hide show
  1. package/dist/components/composites/about-dialog/about-dialog.js.map +1 -1
  2. package/dist/components/composites/accent-picker/accent-picker.js.map +1 -1
  3. package/dist/components/composites/accent-picker/custom-color-popover.js.map +1 -1
  4. package/dist/components/composites/account-menu/account-menu.js.map +1 -1
  5. package/dist/components/composites/action-button/action-button.js.map +1 -1
  6. package/dist/components/composites/appearance-editor/accent-swatch-groups.js.map +1 -1
  7. package/dist/components/composites/appearance-editor/appearance-choices.js.map +1 -1
  8. package/dist/components/composites/appearance-editor/appearance-editor.js.map +1 -1
  9. package/dist/components/composites/appearance-editor/appearance-rows.js.map +1 -1
  10. package/dist/components/composites/appearance-editor/font-settings-group.js.map +1 -1
  11. package/dist/components/composites/appearance-editor/theme-preview.js.map +1 -1
  12. package/dist/components/composites/catalog-browser/catalog-browser-group.js.map +1 -1
  13. package/dist/components/composites/catalog-browser/catalog-browser.js.map +1 -1
  14. package/dist/components/composites/catalog-browser/catalog-detail.js.map +1 -1
  15. package/dist/components/composites/chain-of-thought/chain-of-thought.js.map +1 -1
  16. package/dist/components/composites/chat/chat.js.map +1 -1
  17. package/dist/components/composites/checkpoint/checkpoint.js.map +1 -1
  18. package/dist/components/composites/confirmation/confirmation.js.map +1 -1
  19. package/dist/components/composites/context/context.js.map +1 -1
  20. package/dist/components/composites/file-tree/file-tree.js.map +1 -1
  21. package/dist/components/composites/help-center/help-center.js.map +1 -1
  22. package/dist/components/composites/icon-picker/icon-picker.js.map +1 -1
  23. package/dist/components/composites/inline-citation/inline-citation.js.map +1 -1
  24. package/dist/components/composites/list-row/list-row-control.js.map +1 -1
  25. package/dist/components/composites/list-row/list-row.js.map +1 -1
  26. package/dist/components/composites/message-scroller/message-scroller.js.map +1 -1
  27. package/dist/components/composites/model-selector/model-selector.js +3 -0
  28. package/dist/components/composites/model-selector/model-selector.js.map +1 -1
  29. package/dist/components/composites/plan/plan.js.map +1 -1
  30. package/dist/components/composites/queue/queue.js.map +1 -1
  31. package/dist/components/composites/reasoning/reasoning.js.map +1 -1
  32. package/dist/components/composites/scene-controls/scene-controls.js.map +1 -1
  33. package/dist/components/composites/settings/settings-layout.js.map +1 -1
  34. package/dist/components/composites/settings/settings-navigation.js.map +1 -1
  35. package/dist/components/composites/settings/settings.js.map +1 -1
  36. package/dist/components/composites/sources/sources.js.map +1 -1
  37. package/dist/components/composites/stack-trace/stack-trace.js.map +1 -1
  38. package/dist/components/composites/stat/stat.js.map +1 -1
  39. package/dist/components/composites/subagent/subagent.js.map +1 -1
  40. package/dist/components/composites/suggestion/suggestion.js.map +1 -1
  41. package/dist/components/composites/task/task.js.map +1 -1
  42. package/dist/components/composites/terminal/terminal.js.map +1 -1
  43. package/dist/components/composites/test-results/test-results.js.map +1 -1
  44. package/dist/components/composites/tool/tool.js.map +1 -1
  45. package/dist/components/composites/tree/tree.js.map +1 -1
  46. package/dist/components/composites/update-dialog/channel-control.js.map +1 -1
  47. package/dist/components/composites/update-dialog/update-dialog.js.map +1 -1
  48. package/dist/components/composites/workspace-mark/workspace-mark.js.map +1 -1
  49. package/dist/components/composites/workspace-switcher/workspace-reorder-dialog.js.map +1 -1
  50. package/dist/components/composites/workspace-switcher/workspace-switcher.js.map +1 -1
  51. package/dist/components/conversation/atomic/chat-composer.js.map +1 -1
  52. package/dist/components/conversation/busy-send-button.js.map +1 -1
  53. package/dist/components/conversation/chat-composer.js.map +1 -1
  54. package/dist/components/conversation/composer-menu.js.map +1 -1
  55. package/dist/components/conversation/conversation-avatar.js.map +1 -1
  56. package/dist/components/conversation/conversation-pane.js.map +1 -1
  57. package/dist/components/conversation/conversation-surface.js.map +1 -1
  58. package/dist/components/conversation/internal/chat-composer-shell.js.map +1 -1
  59. package/dist/components/conversation/message-composer.js.map +1 -1
  60. package/dist/components/conversation/message-row.js.map +1 -1
  61. package/dist/components/conversation/paste-token-editor.js.map +1 -1
  62. package/dist/components/conversation/thread-panel.js.map +1 -1
  63. package/dist/components/conversation/transcript-composition.js.map +1 -1
  64. package/dist/components/layout/app-shell/app-shell.js.map +1 -1
  65. package/dist/components/layout/app-shell/skip-link.js.map +1 -1
  66. package/dist/components/layout/contextual-sidebar/contextual-sidebar.js.map +1 -1
  67. package/dist/components/layout/contextual-sidebar/mobile-contextual-sidebar.js.map +1 -1
  68. package/dist/components/layout/floating-preview/floating-preview.js.map +1 -1
  69. package/dist/components/layout/orbit-layout/orbit-layout.js.map +1 -1
  70. package/dist/components/layout/page/page.js.map +1 -1
  71. package/dist/components/layout/panel/panel.js.map +1 -1
  72. package/dist/components/layout/pixel-pane/pixel-pane.js.map +1 -1
  73. package/dist/components/layout/pixel-resize-handle/pixel-resize-handle.js.map +1 -1
  74. package/dist/components/layout/shell-rail/shell-rail.js.map +1 -1
  75. package/dist/components/layout/shell-top-bar/shell-top-bar.js.map +1 -1
  76. package/dist/components/layout/side-rail/side-rail.js.map +1 -1
  77. package/dist/components/layout/sidebar-nav/sidebar-nav-resize-handle.js.map +1 -1
  78. package/dist/components/layout/sidebar-nav/sidebar-nav.js.map +1 -1
  79. package/dist/components/layout/split-layout/resize-controller-core-retry.js.map +1 -1
  80. package/dist/components/layout/split-layout/resize-controller-core.js.map +1 -1
  81. package/dist/components/layout/split-layout/split-layout.js.map +1 -1
  82. package/dist/components/layout/status-bar/status-bar.js.map +1 -1
  83. package/dist/components/layout/top-bar/top-bar.js.map +1 -1
  84. package/dist/components/layout/virtual-window/virtual-window.js.map +1 -1
  85. package/dist/components/motion/presence.js.map +1 -1
  86. package/dist/components/theme/appearance-panel.js.map +1 -1
  87. package/dist/components/theme/theme-mode-toggle.js.map +1 -1
  88. package/dist/components/theme/theme-picker.js.map +1 -1
  89. package/dist/components/theme/theme-provider.js.map +1 -1
  90. package/dist/components/theme/theme-toggle.js.map +1 -1
  91. package/dist/components/ui/accordion/accordion.js.map +1 -1
  92. package/dist/components/ui/alert/alert.js.map +1 -1
  93. package/dist/components/ui/alert-dialog/alert-dialog.js.map +1 -1
  94. package/dist/components/ui/annotation-surface/annotation-surface.js.map +1 -1
  95. package/dist/components/ui/aspect-ratio/aspect-ratio.js.map +1 -1
  96. package/dist/components/ui/attachment/attachment.js.map +1 -1
  97. package/dist/components/ui/avatar/avatar.js.map +1 -1
  98. package/dist/components/ui/badge/badge.js.map +1 -1
  99. package/dist/components/ui/board/board.js.map +1 -1
  100. package/dist/components/ui/breadcrumb/breadcrumb.js.map +1 -1
  101. package/dist/components/ui/bubble/bubble.js.map +1 -1
  102. package/dist/components/ui/button/button.js.map +1 -1
  103. package/dist/components/ui/button-group/button-group.js.map +1 -1
  104. package/dist/components/ui/calendar/calendar.js.map +1 -1
  105. package/dist/components/ui/callout/callout.js.map +1 -1
  106. package/dist/components/ui/card/card.js.map +1 -1
  107. package/dist/components/ui/carousel/carousel.js.map +1 -1
  108. package/dist/components/ui/chart/chart.js.map +1 -1
  109. package/dist/components/ui/checkbox/checkbox.js.map +1 -1
  110. package/dist/components/ui/code-block/code-block.js.map +1 -1
  111. package/dist/components/ui/collapsible/collapsible.js.map +1 -1
  112. package/dist/components/ui/combobox/combobox.js.map +1 -1
  113. package/dist/components/ui/combobox/value-combobox.js.map +1 -1
  114. package/dist/components/ui/command/command.js.map +1 -1
  115. package/dist/components/ui/context-menu/context-menu.js.map +1 -1
  116. package/dist/components/ui/detail-panel/detail-panel.js.map +1 -1
  117. package/dist/components/ui/dialog/dialog-layer.js.map +1 -1
  118. package/dist/components/ui/dialog/dialog.js.map +1 -1
  119. package/dist/components/ui/diff-block/diff-block.js.map +1 -1
  120. package/dist/components/ui/drawer/drawer.js.map +1 -1
  121. package/dist/components/ui/dropdown-menu/dropdown-menu.js.map +1 -1
  122. package/dist/components/ui/dropdown-menu/menu-parts.js.map +1 -1
  123. package/dist/components/ui/empty/empty-state.js.map +1 -1
  124. package/dist/components/ui/empty/empty.js.map +1 -1
  125. package/dist/components/ui/entity-icon/entity-icon.js.map +1 -1
  126. package/dist/components/ui/field/field.js.map +1 -1
  127. package/dist/components/ui/field/number-field.js.map +1 -1
  128. package/dist/components/ui/hover-card/hover-card.js.map +1 -1
  129. package/dist/components/ui/input/input-control.js.map +1 -1
  130. package/dist/components/ui/input/input.js.map +1 -1
  131. package/dist/components/ui/input-group/input-group.js.map +1 -1
  132. package/dist/components/ui/input-group/secret-input-group.js.map +1 -1
  133. package/dist/components/ui/input-otp/input-otp.js.map +1 -1
  134. package/dist/components/ui/item/item.js.map +1 -1
  135. package/dist/components/ui/kbd/kbd.js.map +1 -1
  136. package/dist/components/ui/label/label.js.map +1 -1
  137. package/dist/components/ui/marker/marker.js.map +1 -1
  138. package/dist/components/ui/menubar/menubar.js.map +1 -1
  139. package/dist/components/ui/message/message.js.map +1 -1
  140. package/dist/components/ui/modal-dialog/modal-dialog.js.map +1 -1
  141. package/dist/components/ui/native-select/native-select.js.map +1 -1
  142. package/dist/components/ui/navigation-menu/navigation-menu.js.map +1 -1
  143. package/dist/components/ui/pagination/pagination.js.map +1 -1
  144. package/dist/components/ui/popover/popover.js.map +1 -1
  145. package/dist/components/ui/progress/progress.js.map +1 -1
  146. package/dist/components/ui/questionnaire/questionnaire.js.map +1 -1
  147. package/dist/components/ui/radio-group/radio-group.js.map +1 -1
  148. package/dist/components/ui/resizable/resizable.js.map +1 -1
  149. package/dist/components/ui/scroll-area/scroll-area.js.map +1 -1
  150. package/dist/components/ui/select/select.js.map +1 -1
  151. package/dist/components/ui/separator/separator.js.map +1 -1
  152. package/dist/components/ui/sheet/sheet.js.map +1 -1
  153. package/dist/components/ui/skeleton/skeleton.js.map +1 -1
  154. package/dist/components/ui/slider/slider.js.map +1 -1
  155. package/dist/components/ui/spinner/spinner.js.map +1 -1
  156. package/dist/components/ui/status-chip/status-chip.js.map +1 -1
  157. package/dist/components/ui/switch/switch.js.map +1 -1
  158. package/dist/components/ui/table/table.js.map +1 -1
  159. package/dist/components/ui/tabs/tabs.js.map +1 -1
  160. package/dist/components/ui/text-link/text-link.js.map +1 -1
  161. package/dist/components/ui/textarea/textarea.js.map +1 -1
  162. package/dist/components/ui/toast/toast.js.map +1 -1
  163. package/dist/components/ui/toggle/toggle.js.map +1 -1
  164. package/dist/components/ui/toggle-group/toggle-group.js.map +1 -1
  165. package/dist/components/ui/tooltip/tooltip.js.map +1 -1
  166. package/dist/components/ui/trace/trace.js.map +1 -1
  167. package/dist/components/ui/typography/typography.js.map +1 -1
  168. package/dist/r/about-dialog.json +1 -1
  169. package/dist/r/accordion.json +1 -1
  170. package/dist/r/account-menu.json +1 -1
  171. package/dist/r/alert.json +1 -1
  172. package/dist/r/appearance-editor.json +1 -1
  173. package/dist/r/attachment.json +1 -1
  174. package/dist/r/breadcrumb.json +1 -1
  175. package/dist/r/calendar.json +1 -1
  176. package/dist/r/carousel.json +1 -1
  177. package/dist/r/catalog-browser.json +1 -1
  178. package/dist/r/chain-of-thought.json +1 -1
  179. package/dist/r/chat.json +1 -1
  180. package/dist/r/checkbox.json +1 -1
  181. package/dist/r/checkpoint.json +1 -1
  182. package/dist/r/code-block.json +1 -1
  183. package/dist/r/combobox.json +1 -1
  184. package/dist/r/command.json +1 -1
  185. package/dist/r/confirmation.json +1 -1
  186. package/dist/r/context.json +1 -1
  187. package/dist/r/conversation.json +1 -1
  188. package/dist/r/detail-panel.json +1 -1
  189. package/dist/r/dialog.json +1 -1
  190. package/dist/r/dropdown-menu.json +1 -1
  191. package/dist/r/empty.json +1 -1
  192. package/dist/r/file-tree.json +1 -1
  193. package/dist/r/floating-preview.json +1 -1
  194. package/dist/r/help-center.json +1 -1
  195. package/dist/r/icon-picker.json +1 -1
  196. package/dist/r/inline-citation.json +1 -1
  197. package/dist/r/lib.json +1 -1
  198. package/dist/r/message-scroller.json +1 -1
  199. package/dist/r/model-selector.json +1 -1
  200. package/dist/r/native-select.json +1 -1
  201. package/dist/r/navigation-menu.json +1 -1
  202. package/dist/r/pagination.json +1 -1
  203. package/dist/r/pixel-resize-handle.json +1 -1
  204. package/dist/r/plan.json +1 -1
  205. package/dist/r/questionnaire.json +1 -1
  206. package/dist/r/queue.json +1 -1
  207. package/dist/r/radio-group.json +1 -1
  208. package/dist/r/reasoning.json +1 -1
  209. package/dist/r/registry.json +65 -65
  210. package/dist/r/resizable.json +1 -1
  211. package/dist/r/scene-controls.json +1 -1
  212. package/dist/r/select.json +1 -1
  213. package/dist/r/settings.json +1 -1
  214. package/dist/r/sheet.json +1 -1
  215. package/dist/r/shell-rail.json +1 -1
  216. package/dist/r/sidebar-nav.json +1 -1
  217. package/dist/r/sources.json +1 -1
  218. package/dist/r/spinner.json +1 -1
  219. package/dist/r/split-layout.json +1 -1
  220. package/dist/r/src/components/composites/model-selector/model-selector.tsx +4 -1
  221. package/dist/r/stack-trace.json +1 -1
  222. package/dist/r/stat.json +1 -1
  223. package/dist/r/subagent.json +1 -1
  224. package/dist/r/task.json +1 -1
  225. package/dist/r/terminal.json +1 -1
  226. package/dist/r/test-results.json +1 -1
  227. package/dist/r/theming.json +1 -1
  228. package/dist/r/toast.json +1 -1
  229. package/dist/r/tool.json +1 -1
  230. package/dist/r/top-bar.json +1 -1
  231. package/dist/r/trace.json +1 -1
  232. package/dist/r/tree.json +1 -1
  233. package/dist/r/update-dialog.json +1 -1
  234. package/dist/r/workspace-switcher.json +1 -1
  235. package/package.json +11 -11
  236. package/registry.json +65 -65
  237. package/src/components/composites/model-selector/model-selector.tsx +4 -1
@@ -1 +1 @@
1
- {"version":3,"file":"theme-toggle.js","names":["Monitor","Moon","Sun","ComponentProps","For","splitProps","cn","ToggleGroup","ToggleGroupItem","useTheme","ThemeToggleProps","Omit","withLabels","APPEARANCES","value","label","icon","const","ThemeToggle","props","local","rest","selection","setSelection","_$createComponent","_$mergeProps","attached","appearance","onChange","class","children","each","variant","size","aria-label","_$memo","_el$","_tmpl$","_$insert","_$createComponent","_$mergeProps","_$memo"],"sources":["../../../src/components/theme/theme-toggle.tsx"],"sourcesContent":["import { Monitor, Moon, Sun } from 'lucide-solid'\nimport type { ComponentProps } from 'solid-js'\nimport { For, splitProps } from 'solid-js'\nimport { cn } from '#lib/utils'\nimport { ToggleGroup, ToggleGroupItem } from '../ui/toggle-group'\nimport { useTheme } from './theme-context'\n\n/**\n * ThemeToggle.\n *\n * Three states, not two: light, dark, and follow the system. A two-state switch is\n * the common mistake — it forces a choice on someone who wanted the application to\n * track their OS, and it has no way to say \"I have not decided\", so the first click\n * silently overrides a system preference the user set deliberately.\n *\n * The icons carry the state and the accessible name comes from the label, so the\n * control is usable without seeing which glyph is lit.\n */\nexport type ThemeToggleProps = Omit<ComponentProps<typeof ToggleGroup>, 'children'> & {\n /** Draw labels beside the icons. Off by default: a toolbar wants icons. */\n withLabels?: boolean\n}\n\nconst APPEARANCES = [\n { value: 'light', label: 'Light', icon: Sun },\n { value: 'dark', label: 'Dark', icon: Moon },\n { value: 'system', label: 'System', icon: Monitor },\n] as const\n\nexport function ThemeToggle(props: ThemeToggleProps) {\n const [local, rest] = splitProps(props, ['class', 'withLabels'])\n const { selection, setSelection } = useTheme()\n\n return (\n <ToggleGroup\n attached\n value={selection().appearance}\n onChange={(value: string | null) => {\n // A toggle group reports the pressed value or null; null would leave the\n // appearance unset, so a re-press keeps the current one.\n if (typeof value === 'string') {\n setSelection({ appearance: value as 'light' | 'dark' | 'system' })\n }\n }}\n aria-label=\"Appearance\"\n class={cn(local.class)}\n {...rest}\n >\n <For each={APPEARANCES}>\n {(appearance) => (\n <ToggleGroupItem\n value={appearance.value}\n variant=\"outline\"\n size={local.withLabels ? 'sm' : 'icon-sm'}\n aria-label={appearance.label}\n >\n <appearance.icon />\n {local.withLabels ? <span>{appearance.label}</span> : null}\n </ToggleGroupItem>\n )}\n </For>\n </ToggleGroup>\n )\n}\n"],"mappings":";;;;;;;;AAuBA,IAAMa,cAAc;CAClB;EAAEC,OAAO;EAASC,OAAO;EAASC,MAAMd;CAAI;CAC5C;EAAEY,OAAO;EAAQC,OAAO;EAAQC,MAAMf;CAAK;CAC3C;EAAEa,OAAO;EAAUC,OAAO;EAAUC,MAAMhB;CAAQ;AAAC;AAGrD,SAAgBkB,YAAYC,OAAyB;CACnD,MAAM,CAACC,OAAOC,QAAQhB,WAAWc,OAAO,CAAC,SAAS,YAAY,CAAC;CAC/D,MAAM,EAAEG,WAAWC,iBAAiBd,SAAS;CAE7C,OAAAe,gBACGjB,aAAWkB,WAAA;EACVC,UAAQ;EAAA,IACRZ,QAAK;GAAA,OAAEQ,UAAU,CAAC,CAACK;EAAU;EAC7BC,WAAWd,UAAyB;GAGlC,IAAI,OAAOA,UAAU,UACnBS,aAAa,EAAEI,YAAYb,MAAqC,CAAC;EAErE;EAAC,cAAA;EAAA,KAAA,WAAA;GAAA,OAEMR,GAAGc,MAAMS,KAAK;EAAC;CAAA,GAClBR,MAAI,EAAA,IAAAS,WAAA;EAAA,OAAAN,gBAEPpB,KAAG;GAAC2B,MAAMlB;GAAWiB,WAClBH,eAAUH,gBACThB,iBAAe;IAAA,IACdM,QAAK;KAAA,OAAEa,WAAWb;IAAK;IACvBkB,SAAO;IAAA,IACPC,OAAI;KAAA,OAAEb,MAAMR,aAAa,OAAO;IAAS;IAAA,KAAA,gBAAA;KAAA,OAC7Be,WAAWZ;IAAK;IAAA,IAAAe,WAAA;KAAA,OAAA,CAAAN,gBAE3BG,WAAWX,MAAI,CAAA,CAAA,GAAAmB,WACfA,WAAA,CAAA,CAAAf,MAAMR,UAAU,CAAA,CAAA,WAAA;MAAA,IAAAwB,OAAAC,OAAA;MAAAC,OAAAF,YAAUT,WAAWZ,KAAK;MAAA,OAAAqB;KAAA,EAAA,CAAA,IAAW,IAAI,CAAA;IAAA;GAAA,CAAA;EAE7D,CAAA;CAAA,EAAA,CAAA,CAAA;AAIT"}
1
+ {"version":3,"file":"theme-toggle.js","names":["Monitor","Moon","Sun","For","splitProps","cn","ToggleGroup","ToggleGroupItem","useTheme","withLabels","APPEARANCES","value","label","icon","ThemeToggle","props","local","rest","selection","setSelection","_$createComponent","_$mergeProps","attached","appearance","onChange","class","children","each","variant","size","_$memo","_el$","_tmpl$","_$insert"],"sources":["../../../src/components/theme/theme-toggle.tsx"],"sourcesContent":["import { Monitor, Moon, Sun } from 'lucide-solid'\nimport type { ComponentProps } from 'solid-js'\nimport { For, splitProps } from 'solid-js'\nimport { cn } from '#lib/utils'\nimport { ToggleGroup, ToggleGroupItem } from '../ui/toggle-group'\nimport { useTheme } from './theme-context'\n\n/**\n * ThemeToggle.\n *\n * Three states, not two: light, dark, and follow the system. A two-state switch is\n * the common mistake — it forces a choice on someone who wanted the application to\n * track their OS, and it has no way to say \"I have not decided\", so the first click\n * silently overrides a system preference the user set deliberately.\n *\n * The icons carry the state and the accessible name comes from the label, so the\n * control is usable without seeing which glyph is lit.\n */\nexport type ThemeToggleProps = Omit<ComponentProps<typeof ToggleGroup>, 'children'> & {\n /** Draw labels beside the icons. Off by default: a toolbar wants icons. */\n withLabels?: boolean\n}\n\nconst APPEARANCES = [\n { value: 'light', label: 'Light', icon: Sun },\n { value: 'dark', label: 'Dark', icon: Moon },\n { value: 'system', label: 'System', icon: Monitor },\n] as const\n\nexport function ThemeToggle(props: ThemeToggleProps) {\n const [local, rest] = splitProps(props, ['class', 'withLabels'])\n const { selection, setSelection } = useTheme()\n\n return (\n <ToggleGroup\n attached\n value={selection().appearance}\n onChange={(value: string | null) => {\n // A toggle group reports the pressed value or null; null would leave the\n // appearance unset, so a re-press keeps the current one.\n if (typeof value === 'string') {\n setSelection({ appearance: value as 'light' | 'dark' | 'system' })\n }\n }}\n aria-label=\"Appearance\"\n class={cn(local.class)}\n {...rest}\n >\n <For each={APPEARANCES}>\n {(appearance) => (\n <ToggleGroupItem\n value={appearance.value}\n variant=\"outline\"\n size={local.withLabels ? 'sm' : 'icon-sm'}\n aria-label={appearance.label}\n >\n <appearance.icon />\n {local.withLabels ? <span>{appearance.label}</span> : null}\n </ToggleGroupItem>\n )}\n </For>\n </ToggleGroup>\n )\n}\n"],"mappings":";;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3,"file":"accordion.js","names":["Accordion","KobalteAccordion","ChevronDown","ComponentProps","splitProps","cn","props","local","rest","_$createComponent","_$mergeProps","class","AccordionItem","Item","AccordionTrigger","Trigger","Header","children","_$memo","AccordionContent","Content","_el$","_tmpl$","_$insert","Accordion","_$createComponent","KobalteAccordion","_$mergeProps","_$memo"],"sources":["../../../../src/components/ui/accordion/accordion.tsx"],"sourcesContent":["import { Accordion as KobalteAccordion } from '@kobalte/core/accordion'\nimport { ChevronDown } from 'lucide-solid'\nimport type { ComponentProps } from 'solid-js'\nimport { splitProps } from 'solid-js'\nimport { cn } from '#lib/utils'\n\n/**\n * Accordion.\n *\n * A list of collapsible sections. `collapsible` (the default) lets the user\n * close the open section; without it one section is always open, which is what\n * a settings page usually wants and a FAQ usually does not.\n *\n * The trigger is a real button with `aria-expanded` and the panel is\n * `aria-labelledby` the trigger, so the relationship survives even when the\n * panel is empty.\n */\nexport function Accordion(props: ComponentProps<typeof KobalteAccordion>) {\n const [local, rest] = splitProps(props, ['class'])\n return <KobalteAccordion class={cn('flex w-full flex-col', local.class)} {...rest} />\n}\n\nexport function AccordionItem(props: ComponentProps<typeof KobalteAccordion.Item>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <KobalteAccordion.Item\n class={cn('border-b border-border last:border-b-0', local.class)}\n {...rest}\n />\n )\n}\n\nexport function AccordionTrigger(props: ComponentProps<typeof KobalteAccordion.Trigger>) {\n const [local, rest] = splitProps(props, ['class', 'children'])\n\n return (\n <KobalteAccordion.Header class=\"flex\">\n <KobalteAccordion.Trigger\n class={cn(\n // `group/accordion` is what the chevron's `group-data-[expanded]/accordion`\n // reads. Kobalte puts `data-expanded` on this trigger, not on the item, so\n // the trigger is the group; without the class the rotation selector has no\n // ancestor to match and the chevron never turns.\n 'group/accordion flex flex-1 items-center justify-between gap-2 py-3 text-left text-sm font-medium',\n 'transition-colors ease-out outline-none',\n 'hover:text-foreground',\n 'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle',\n 'disabled:pointer-events-none disabled:opacity-50',\n local.class\n )}\n {...rest}\n >\n {local.children}\n <ChevronDown\n class=\"text-muted-foreground size-4 shrink-0 transition-transform ease-out group-data-[expanded]/accordion:rotate-180\"\n aria-hidden=\"true\"\n />\n </KobalteAccordion.Trigger>\n </KobalteAccordion.Header>\n )\n}\n\nexport function AccordionContent(props: ComponentProps<typeof KobalteAccordion.Content>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <KobalteAccordion.Content class={cn('overflow-hidden text-sm', local.class)} {...rest}>\n <div class=\"pt-0 pb-3\">{props.children}</div>\n </KobalteAccordion.Content>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAiBA,SAAgBA,YAAUM,OAAgD;CACxE,MAAM,CAACC,OAAOC,QAAQJ,WAAWE,OAAO,CAAC,OAAO,CAAC;CACjD,OAAAG,gBAAQR,WAAgBS,WAAA,EAAA,KAAA,WAAA;EAAA,OAAQL,GAAG,wBAAwBE,MAAMI,KAAK;CAAC,EAAA,GAAMH,IAAI,CAAA;AACnF;AAEA,SAAgBI,cAAcN,OAAqD;CACjF,MAAM,CAACC,OAAOC,QAAQJ,WAAWE,OAAO,CAAC,OAAO,CAAC;CACjD,OAAAG,gBACGR,UAAiBY,MAAIH,WAAA,EAAA,KAAA,WAAA;EAAA,OACbL,GAAG,0CAA0CE,MAAMI,KAAK;CAAC,EAAA,GAC5DH,IAAI,CAAA;AAGd;AAEA,SAAgBM,iBAAiBR,OAAwD;CACvF,MAAM,CAACC,OAAOC,QAAQJ,WAAWE,OAAO,CAAC,SAAS,UAAU,CAAC;CAE7D,OAAAG,gBACGR,UAAiBe,QAAM;EAAA,SAAA;EAAA,IAAAC,WAAA;GAAA,OAAAR,gBACrBR,UAAiBc,SAAOL,WAAA,EAAA,KAAA,WAAA;IAAA,OAChBL,GAKL,qGACA,2CACA,yBACA,oFACA,oDACAE,MAAMI,KACR;GAAC,EAAA,GACGH,MAAI,EAAA,IAAAS,WAAA;IAAA,OAAA,CAAAC,WAEPX,MAAMU,QAAQ,GAAAR,gBACdP,aAAW;KAAA,SAAA;KAAA,eAAA;IAAA,CAAA,CAAA;GAAA,EAAA,CAAA,CAAA;EAAA;CAAA,CAAA;AAOpB;AAEA,SAAgBiB,iBAAiBb,OAAwD;CACvF,MAAM,CAACC,OAAOC,QAAQJ,WAAWE,OAAO,CAAC,OAAO,CAAC;CACjD,OAAAG,gBACGR,UAAiBmB,SAAOV,WAAA,EAAA,KAAA,WAAA;EAAA,OAAQL,GAAG,2BAA2BE,MAAMI,KAAK;CAAC,EAAA,GAAMH,MAAI,EAAA,IAAAS,WAAA;EAAA,IAAAI,OAAAC,OAAA;EAAAC,OAAAF,YAC3Df,MAAMW,QAAQ;EAAA,OAAAI;CAAA,EAAA,CAAA,CAAA;AAG5C"}
1
+ {"version":3,"file":"accordion.js","names":["Accordion","KobalteAccordion","ChevronDown","splitProps","cn","props","local","rest","_$createComponent","_$mergeProps","class","AccordionItem","Item","AccordionTrigger","Trigger","Header","children","_$memo","AccordionContent","Content","_el$","_tmpl$","_$insert"],"sources":["../../../../src/components/ui/accordion/accordion.tsx"],"sourcesContent":["import { Accordion as KobalteAccordion } from '@kobalte/core/accordion'\nimport { ChevronDown } from 'lucide-solid'\nimport type { ComponentProps } from 'solid-js'\nimport { splitProps } from 'solid-js'\nimport { cn } from '#lib/utils'\n\n/**\n * Accordion.\n *\n * A list of collapsible sections. `collapsible` (the default) lets the user\n * close the open section; without it one section is always open, which is what\n * a settings page usually wants and a FAQ usually does not.\n *\n * The trigger is a real button with `aria-expanded` and the panel is\n * `aria-labelledby` the trigger, so the relationship survives even when the\n * panel is empty.\n */\nexport function Accordion(props: ComponentProps<typeof KobalteAccordion>) {\n const [local, rest] = splitProps(props, ['class'])\n return <KobalteAccordion class={cn('flex w-full flex-col', local.class)} {...rest} />\n}\n\nexport function AccordionItem(props: ComponentProps<typeof KobalteAccordion.Item>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <KobalteAccordion.Item\n class={cn('border-b border-border last:border-b-0', local.class)}\n {...rest}\n />\n )\n}\n\nexport function AccordionTrigger(props: ComponentProps<typeof KobalteAccordion.Trigger>) {\n const [local, rest] = splitProps(props, ['class', 'children'])\n\n return (\n <KobalteAccordion.Header class=\"flex\">\n <KobalteAccordion.Trigger\n class={cn(\n // `group/accordion` is what the chevron's `group-data-[expanded]/accordion`\n // reads. Kobalte puts `data-expanded` on this trigger, not on the item, so\n // the trigger is the group; without the class the rotation selector has no\n // ancestor to match and the chevron never turns.\n 'group/accordion flex flex-1 items-center justify-between gap-2 py-3 text-left text-sm font-medium',\n 'transition-colors ease-out outline-none',\n 'hover:text-foreground',\n 'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle',\n 'disabled:pointer-events-none disabled:opacity-50',\n local.class\n )}\n {...rest}\n >\n {local.children}\n <ChevronDown\n class=\"text-muted-foreground size-4 shrink-0 transition-transform ease-out group-data-[expanded]/accordion:rotate-180\"\n aria-hidden=\"true\"\n />\n </KobalteAccordion.Trigger>\n </KobalteAccordion.Header>\n )\n}\n\nexport function AccordionContent(props: ComponentProps<typeof KobalteAccordion.Content>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <KobalteAccordion.Content class={cn('overflow-hidden text-sm', local.class)} {...rest}>\n <div class=\"pt-0 pb-3\">{props.children}</div>\n </KobalteAccordion.Content>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAiBA,SAAgBA,YAAUK,OAAgD;CACxE,MAAM,CAACC,OAAOC,QAAQJ,WAAWE,OAAO,CAAC,OAAO,CAAC;CACjD,OAAAG,gBAAQP,WAAgBQ,WAAA,EAAA,KAAA,WAAA;EAAA,OAAQL,GAAG,wBAAwBE,MAAMI,KAAK;CAAC,EAAA,GAAMH,IAAI,CAAA;AACnF;AAEA,SAAgBI,cAAcN,OAAqD;CACjF,MAAM,CAACC,OAAOC,QAAQJ,WAAWE,OAAO,CAAC,OAAO,CAAC;CACjD,OAAAG,gBACGP,UAAiBW,MAAIH,WAAA,EAAA,KAAA,WAAA;EAAA,OACbL,GAAG,0CAA0CE,MAAMI,KAAK;CAAC,EAAA,GAC5DH,IAAI,CAAA;AAGd;AAEA,SAAgBM,iBAAiBR,OAAwD;CACvF,MAAM,CAACC,OAAOC,QAAQJ,WAAWE,OAAO,CAAC,SAAS,UAAU,CAAC;CAE7D,OAAAG,gBACGP,UAAiBc,QAAM;EAAA,SAAA;EAAA,IAAAC,WAAA;GAAA,OAAAR,gBACrBP,UAAiBa,SAAOL,WAAA,EAAA,KAAA,WAAA;IAAA,OAChBL,GAKL,qGACA,2CACA,yBACA,oFACA,oDACAE,MAAMI,KACR;GAAC,EAAA,GACGH,MAAI,EAAA,IAAAS,WAAA;IAAA,OAAA,CAAAC,WAEPX,MAAMU,QAAQ,GAAAR,gBACdN,aAAW;KAAA,SAAA;KAAA,eAAA;IAAA,CAAA,CAAA;GAAA,EAAA,CAAA,CAAA;EAAA;CAAA,CAAA;AAOpB;AAEA,SAAgBgB,iBAAiBb,OAAwD;CACvF,MAAM,CAACC,OAAOC,QAAQJ,WAAWE,OAAO,CAAC,OAAO,CAAC;CACjD,OAAAG,gBACGP,UAAiBkB,SAAOV,WAAA,EAAA,KAAA,WAAA;EAAA,OAAQL,GAAG,2BAA2BE,MAAMI,KAAK;CAAC,EAAA,GAAMH,MAAI,EAAA,IAAAS,WAAA;EAAA,IAAAI,OAAAC,OAAA;EAAAC,OAAAF,YAC3Df,MAAMW,QAAQ;EAAA,OAAAI;CAAA,EAAA,CAAA,CAAA;AAG5C"}
@@ -1 +1 @@
1
- {"version":3,"file":"alert.js","names":["AlertCircle","CheckCircle2","Info","TriangleAlert","ComponentProps","JSX","splitProps","Dynamic","cva","VariantProps","cn","alertVariants","variants","variant","default","destructive","success","warning","info","defaultVariants","alertIcons","const","alertIconTones","AlertVariantProps","AlertProps","icon","Element","Alert","props","local","rest","tone","_el$","_tmpl$","_$spread","_$mergeProps","class","_$insert","_c$","_$memo","_el$2","_tmpl$2","_$createComponent","component","_$effect","_$className","children","AlertTitle","_el$3","_tmpl$3","AlertDescription","_el$4","_tmpl$4","AlertAction","_el$5","_tmpl$5","_$mergeProps","_$memo","_$createComponent","_$className"],"sources":["../../../../src/components/ui/alert/alert.tsx"],"sourcesContent":["import { AlertCircle, CheckCircle2, Info, TriangleAlert } from 'lucide-solid'\nimport type { ComponentProps, JSX } from 'solid-js'\nimport { splitProps } from 'solid-js'\nimport { Dynamic } from 'solid-js/web'\nimport { cva, type VariantProps } from '#lib/variants'\nimport { cn } from '#lib/utils'\n\n/**\n * Alert.\n *\n * A message about the whole surface it sits in — a form's validation summary,\n * a failed sync banner, a permission notice. It is deliberately not a dialog:\n * an alert that must be dismissed before the user can continue is a Dialog.\n *\n * The glyph follows the tone rather than being passed in, so an alert cannot\n * be given a green checkmark on a destructive fill. A caller that genuinely\n * needs a different icon passes `icon`; `icon={null}` removes it. Text stays on\n * the body foreground over the tinted status surface, while the glyph and edge\n * carry the status hue.\n */\nconst alertVariants = cva(\n 'relative grid w-full grid-cols-[auto_1fr] items-start gap-x-3 gap-y-1 rounded-lg border px-3 py-2.5 text-sm',\n {\n variants: {\n variant: {\n default: 'bg-card text-card-foreground border-border',\n destructive: 'bg-destructive-subtle text-foreground border-destructive/30',\n success: 'bg-success-subtle text-foreground border-success/30',\n warning: 'bg-warning-subtle text-foreground border-warning/30',\n info: 'bg-info-subtle text-foreground border-info/30',\n },\n },\n defaultVariants: { variant: 'default' },\n }\n)\n\nconst alertIcons = {\n default: Info,\n destructive: AlertCircle,\n success: CheckCircle2,\n warning: TriangleAlert,\n info: Info,\n} as const\n\nconst alertIconTones = {\n default: 'text-muted-foreground',\n destructive: 'text-destructive',\n success: 'text-success',\n warning: 'text-warning',\n info: 'text-info',\n} as const\n\ntype AlertVariantProps = VariantProps<typeof alertVariants>\n\nexport type AlertProps = ComponentProps<'div'> &\n AlertVariantProps & {\n /** Replace the tone's glyph with your own element. `null` removes it. */\n icon?: JSX.Element | null\n }\n\nexport function Alert(props: AlertProps) {\n const [local, rest] = splitProps(props, ['class', 'variant', 'icon', 'children'])\n\n const tone = () => local.variant ?? 'default'\n\n return (\n <div\n data-slot=\"alert\"\n role=\"alert\"\n class={cn(alertVariants({ variant: local.variant }), local.class)}\n {...rest}\n >\n {local.icon === null ? null : (\n <span\n data-slot=\"alert-icon\"\n class={cn('row-span-2 pt-0.5 [&_svg]:size-4', alertIconTones[tone()])}\n >\n {local.icon ?? <Dynamic component={alertIcons[tone()]} />}\n </span>\n )}\n {local.children}\n </div>\n )\n}\n\nexport function AlertTitle(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <div\n data-slot=\"alert-title\"\n class={cn('col-start-2 font-medium tracking-tight', local.class)}\n {...rest}\n />\n )\n}\n\nexport function AlertDescription(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <div\n data-slot=\"alert-description\"\n class={cn('col-start-2 text-sm [&_p]:leading-relaxed', local.class)}\n {...rest}\n />\n )\n}\n\n/**\n * The alert's own actions — a Retry, an Open settings, a Cancel — on a row\n * under the text, aligned with the title rather than the glyph. Buttons here\n * are `size=\"xs\" variant=\"outline\"` by convention, so an alert's action reads\n * as part of the message rather than as the page's primary action.\n */\nexport function AlertAction(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <div\n data-slot=\"alert-action\"\n class={cn('col-start-2 mt-1 flex flex-wrap items-center gap-2', local.class)}\n {...rest}\n />\n )\n}\n\nexport { alertVariants }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAoBA,IAAMW,gBAAgBH,IACpB,+GACA;CACEI,UAAU,EACRC,SAAS;EACPC,SAAS;EACTC,aAAa;EACbC,SAAS;EACTC,SAAS;EACTC,MAAM;CACR,EACF;CACAC,iBAAiB,EAAEN,SAAS,UAAU;AACxC,CACF;AAEA,IAAMO,aAAa;CACjBN,SAASZ;CACTa,aAAaf;CACbgB,SAASf;CACTg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EAAA,OAAAkB;CAAA,EAAA,CAAA;AAGd;AAEA,SAAgBE,iBAAiBtB,OAA8B;CAC7D,MAAM,CAACC,OAAOC,QAAQxB,WAAWsB,OAAO,CAAC,OAAO,CAAC;CACjD,cAAA;EAAA,IAAAuB,QAAAC,QAAA;EAAAlB,OAAAiB,OAAAhB,WAAA,EAAA,KAAA,WAAA;GAAA,OAGWzB,GAAG,6CAA6CmB,MAAMO,KAAK;EAAC,EAAA,GAC/DN,IAAI,GAAA,OAAA,KAAA;EAAA,OAAAqB;CAAA,EAAA,CAAA;AAGd;;;;;;;AAQA,SAAgBE,YAAYzB,OAA8B;CACxD,MAAM,CAACC,OAAOC,QAAQxB,WAAWsB,OAAO,CAAC,OAAO,CAAC;CACjD,cAAA;EAAA,IAAA0B,QAAAC,QAAA;EAAArB,OAAAoB,OAAAnB,WAAA,EAAA,KAAA,WAAA;GAAA,OAGWzB,GAAG,sDAAsDmB,MAAMO,KAAK;EAAC,EAAA,GACxEN,IAAI,GAAA,OAAA,KAAA;EAAA,OAAAwB;CAAA,EAAA,CAAA;AAGd"}
1
+ {"version":3,"file":"alert.js","names":["AlertCircle","CheckCircle2","Info","TriangleAlert","splitProps","Dynamic","cva","cn","alertVariants","variants","variant","default","destructive","success","warning","info","defaultVariants","alertIcons","alertIconTones","icon","Alert","props","local","rest","tone","_el$","_tmpl$","_$spread","_$mergeProps","class","_$insert","_c$","_$memo","_el$2","_tmpl$2","_$createComponent","component","_$effect","_$className","children","AlertTitle","_el$3","_tmpl$3","AlertDescription","_el$4","_tmpl$4","AlertAction","_el$5","_tmpl$5"],"sources":["../../../../src/components/ui/alert/alert.tsx"],"sourcesContent":["import { AlertCircle, CheckCircle2, Info, TriangleAlert } from 'lucide-solid'\nimport type { ComponentProps, JSX } from 'solid-js'\nimport { splitProps } from 'solid-js'\nimport { Dynamic } from 'solid-js/web'\nimport { cva, type VariantProps } from '#lib/variants'\nimport { cn } from '#lib/utils'\n\n/**\n * Alert.\n *\n * A message about the whole surface it sits in — a form's validation summary,\n * a failed sync banner, a permission notice. It is deliberately not a dialog:\n * an alert that must be dismissed before the user can continue is a Dialog.\n *\n * The glyph follows the tone rather than being passed in, so an alert cannot\n * be given a green checkmark on a destructive fill. A caller that genuinely\n * needs a different icon passes `icon`; `icon={null}` removes it. Text stays on\n * the body foreground over the tinted status surface, while the glyph and edge\n * carry the status hue.\n */\nconst alertVariants = cva(\n 'relative grid w-full grid-cols-[auto_1fr] items-start gap-x-3 gap-y-1 rounded-lg border px-3 py-2.5 text-sm',\n {\n variants: {\n variant: {\n default: 'bg-card text-card-foreground border-border',\n destructive: 'bg-destructive-subtle text-foreground border-destructive/30',\n success: 'bg-success-subtle text-foreground border-success/30',\n warning: 'bg-warning-subtle text-foreground border-warning/30',\n info: 'bg-info-subtle text-foreground border-info/30',\n },\n },\n defaultVariants: { variant: 'default' },\n }\n)\n\nconst alertIcons = {\n default: Info,\n destructive: AlertCircle,\n success: CheckCircle2,\n warning: TriangleAlert,\n info: Info,\n} as const\n\nconst alertIconTones = {\n default: 'text-muted-foreground',\n destructive: 'text-destructive',\n success: 'text-success',\n warning: 'text-warning',\n info: 'text-info',\n} as const\n\ntype AlertVariantProps = VariantProps<typeof alertVariants>\n\nexport type AlertProps = ComponentProps<'div'> &\n AlertVariantProps & {\n /** Replace the tone's glyph with your own element. `null` removes it. */\n icon?: JSX.Element | null\n }\n\nexport function Alert(props: AlertProps) {\n const [local, rest] = splitProps(props, ['class', 'variant', 'icon', 'children'])\n\n const tone = () => local.variant ?? 'default'\n\n return (\n <div\n data-slot=\"alert\"\n role=\"alert\"\n class={cn(alertVariants({ variant: local.variant }), local.class)}\n {...rest}\n >\n {local.icon === null ? null : (\n <span\n data-slot=\"alert-icon\"\n class={cn('row-span-2 pt-0.5 [&_svg]:size-4', alertIconTones[tone()])}\n >\n {local.icon ?? <Dynamic component={alertIcons[tone()]} />}\n </span>\n )}\n {local.children}\n </div>\n )\n}\n\nexport function AlertTitle(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <div\n data-slot=\"alert-title\"\n class={cn('col-start-2 font-medium tracking-tight', local.class)}\n {...rest}\n />\n )\n}\n\nexport function AlertDescription(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <div\n data-slot=\"alert-description\"\n class={cn('col-start-2 text-sm [&_p]:leading-relaxed', local.class)}\n {...rest}\n />\n )\n}\n\n/**\n * The alert's own actions — a Retry, an Open settings, a Cancel — on a row\n * under the text, aligned with the title rather than the glyph. Buttons here\n * are `size=\"xs\" variant=\"outline\"` by convention, so an alert's action reads\n * as part of the message rather than as the page's primary action.\n */\nexport function AlertAction(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <div\n data-slot=\"alert-action\"\n class={cn('col-start-2 mt-1 flex flex-wrap items-center gap-2', local.class)}\n {...rest}\n />\n )\n}\n\nexport { alertVariants }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAoBA,IAAMQ,gBAAgBF,IACpB,+GACA;CACEG,UAAU,EACRC,SAAS;EACPC,SAAS;EACTC,aAAa;EACbC,SAAS;EACTC,SAAS;EACTC,MAAM;CACR,EACF;CACAC,iBAAiB,EAAEN,SAAS,UAAU;AACxC,CACF;AAEA,IAAMO,aAAa;CACjBN,SAAST;CACTU,aAAaZ;CACba,SAASZ;CACTa,SAASX;CACTY,MAAMb;AACR;AAEA,IAAMgB,iBAAiB;CACrBP,SAAS;CACTC,aAAa;CACbC,SAAS;CACTC,SAAS;CACTC,MAAM;AACR;AAUA,SAAgBK,MAAMC,OAAmB;CACvC,MAAM,CAACC,OAAOC,QAAQnB,WAAWiB,OAAO;EAAC;EAAS;EAAW;EAAQ;CAAU,CAAC;CAEhF,MAAMG,aAAaF,MAAMZ,WAAW;CAEpC,cAAA;EAAA,IAAAe,OAAAC,OAAA;EAAAC,OAAAF,MAAAG,WAAA,EAAA,KAAA,WAAA;GAAA,OAIWrB,GAAGC,cAAc,E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AA8B;CACxD,MAAM,CAACC,OAAOC,QAAQnB,WAAWiB,OAAO,CAAC,OAAO,CAAC;CACjD,cAAA;EAAA,IAAA0B,QAAAC,QAAA;EAAArB,OAAAoB,OAAAnB,WAAA,EAAA,KAAA,WAAA;GAAA,OAGWrB,GAAG,sDAAsDe,MAAMO,KAAK;EAAC,EAAA,GACxEN,IAAI,GAAA,OAAA,KAAA;EAAA,OAAAwB;CAAA,EAAA,CAAA;AAGd"}
@@ -1 +1 @@
1
- {"version":3,"file":"alert-dialog.js","names":["AlertDialog","KobalteAlertDialog","Content","KobalteAlertDialogContent","Accessor","ComponentProps","createEffect","createSignal","splitProps","dialogSurface","overlayDescription","overlayFooter","overlayHeader","overlayMotion","overlayPositioner","overlayScrim","overlayScrimMotion","overlayTitle","cn","createDialogLayer","DialogEscapeTarget","Root","Trigger","AlertDialogTrigger","Portal","AlertDialogPortal","AlertDialogOverlay","props","Overlay","local","rest","_$createComponent","_$mergeProps","class","blockDismissal","onPointerDownOutside","event","Event","preventDefault","onFocusOutside","onInteractOutside","const","AlertDialogContentProps","restoreFocusRef","HTMLElement","AlertDialogContent","layer","onOpenAutoFocus","onCloseAutoFocus","children","_el$","_tmpl$","_$className","_$insert","onEscapeKeyDown","AlertDialogHeader","_el$2","_tmpl$2","_$spread","AlertDialogFooter","_el$3","_tmpl$3","AlertDialogTitle","Title","AlertDialogDescription","Description","AlertDialogChoice","CloseButton","wrapper","setWrapper","HTMLSpanElement","root","undefined","querySelector","removeAttribute","_el$4","_tmpl$4","_$use","aria-label","AlertDialogAction","AlertDialogCancel","_$createComponent","KobalteAlertDialog","_$mergeProps","KobalteAlertDialogContent"],"sources":["../../../../src/components/ui/alert-dialog/alert-dialog.tsx"],"sourcesContent":["import {\n AlertDialog as KobalteAlertDialog,\n Content as KobalteAlertDialogContent,\n} from '@kobalte/core/alert-dialog'\n// Use the alert-specific export rather than DialogRoot.Content, which other imports can replace.\nimport type { Accessor, ComponentProps } from 'solid-js'\nimport { createEffect, createSignal, splitProps } from 'solid-js'\nimport {\n dialogSurface,\n overlayDescription,\n overlayFooter,\n overlayHeader,\n overlayMotion,\n overlayPositioner,\n overlayScrim,\n overlayScrimMotion,\n overlayTitle,\n} from '#lib/overlay'\nimport { cn } from '#lib/utils'\nimport { createDialogLayer, DialogEscapeTarget } from '../dialog/dialog-layer'\n\n/**\n * AlertDialog.\n *\n * A dialog that cannot be dismissed by accident: a click on the scrim does nothing,\n * and the user must choose one of the actions. Escape is the keyboard's Cancel: it\n * closes the dialog exactly as the cancel action does, so nothing is confirmed. That\n * is the whole difference from Dialog, and it is why this exists as its own\n * component rather than a prop — a caller has to reach for it deliberately.\n *\n * The consequence is a rule of use: this is for confirming a destructive or\n * irreversible step. Wrapping an ordinary form in an AlertDialog traps someone who\n * wants to back out.\n *\n * There is deliberately no close button in the corner. An X has no label, and the\n * point of this surface is that every exit is a named choice.\n */\nexport {\n Root as AlertDialog,\n Trigger as AlertDialogTrigger,\n Portal as AlertDialogPortal,\n} from '@kobalte/core/alert-dialog'\n\nexport function AlertDialogOverlay(props: ComponentProps<typeof KobalteAlertDialog.Overlay>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <KobalteAlertDialog.Overlay\n class={cn(overlayScrim, overlayScrimMotion, local.class)}\n {...rest}\n />\n )\n}\n\n/**\n * The panel.\n *\n * Kobalte's `AlertDialog.Content` is `Dialog.Content` with `role=\"alertdialog\"`\n * and nothing else — an outside click dismisses it exactly as it dismisses a\n * Dialog. That is a real gap in the primitive, so the blocking is implemented\n * here, and it is the whole difference between this component and a Dialog:\n *\n * - Pointer and focus interactions outside are prevented, including the scrim\n * click, because a stray click that closes a confirmation is a click that\n * makes \"confirm\" meaningless.\n *\n * Escape is deliberately left to the primitive. It can only ever cancel, never\n * confirm, so it is not an accident that matters; refusing it traps a keyboard\n * user who has changed their mind, and the WAI-ARIA alertdialog pattern says\n * Escape closes. It reports `onOpenChange(false)` and returns focus to what had\n * it before the confirmation opened, which is what the cancel action does, and\n * as the topmost layer it closes only the confirmation, not a dialog underneath.\n *\n * There is deliberately no prop to turn the scrim blocking off. A surface that can be escaped\n * accidentally does not need to be an AlertDialog; it is a Dialog, and using this\n * one would be a claim about the flow that is not true.\n */\nconst blockDismissal = {\n onPointerDownOutside: (event: Event) => event.preventDefault(),\n onFocusOutside: (event: Event) => event.preventDefault(),\n onInteractOutside: (event: Event) => event.preventDefault(),\n} as const\n\nexport type AlertDialogContentProps = ComponentProps<typeof KobalteAlertDialogContent> & {\n /** The control to focus on close when the one focused before opening is gone by then. */\n restoreFocusRef?: Accessor<HTMLElement | undefined>\n}\n\nexport function AlertDialogContent(props: AlertDialogContentProps) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'children',\n 'restoreFocusRef',\n 'onOpenAutoFocus',\n 'onCloseAutoFocus',\n ])\n const layer = createDialogLayer({\n restoreFocusRef: local.restoreFocusRef,\n onOpenAutoFocus: (event) => local.onOpenAutoFocus?.(event),\n onCloseAutoFocus: (event) => local.onCloseAutoFocus?.(event),\n })\n\n return (\n <KobalteAlertDialog.Portal>\n <AlertDialogOverlay />\n <div class={overlayPositioner}>\n <KobalteAlertDialogContent\n {...blockDismissal}\n class={cn(\n dialogSurface,\n overlayMotion,\n 'grid max-h-full w-full max-w-md gap-4 overflow-y-auto p-5',\n local.class\n )}\n {...rest}\n onOpenAutoFocus={layer.onOpenAutoFocus}\n onCloseAutoFocus={layer.onCloseAutoFocus}\n >\n <DialogEscapeTarget onEscapeKeyDown={props.onEscapeKeyDown}>\n {local.children}\n </DialogEscapeTarget>\n </KobalteAlertDialogContent>\n </div>\n </KobalteAlertDialog.Portal>\n )\n}\n\nexport function AlertDialogHeader(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class'])\n return <div data-slot=\"alert-dialog-header\" class={cn(overlayHeader, local.class)} {...rest} />\n}\n\nexport function AlertDialogFooter(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class'])\n return <div data-slot=\"alert-dialog-footer\" class={cn(overlayFooter, local.class)} {...rest} />\n}\n\nexport function AlertDialogTitle(props: ComponentProps<typeof KobalteAlertDialog.Title>) {\n const [local, rest] = splitProps(props, ['class'])\n return <KobalteAlertDialog.Title class={cn(overlayTitle, local.class)} {...rest} />\n}\n\nexport function AlertDialogDescription(\n props: ComponentProps<typeof KobalteAlertDialog.Description>\n) {\n const [local, rest] = splitProps(props, ['class'])\n return <KobalteAlertDialog.Description class={cn(overlayDescription, local.class)} {...rest} />\n}\n\n/**\n * One of the dialog's two named choices.\n *\n * Kobalte labels its close button \"Dismiss\" by default, because a generic close\n * button is usually an icon with no text of its own. In an AlertDialog it is\n * something else: the named choices. An `aria-label` there *replaces* the visible\n * text, so a screen reader hears \"Dismiss\" twice and the user cannot tell the\n * destructive action from the safe one.\n *\n * The injected label is removed rather than overridden with an empty one. An empty\n * `aria-label` is not reliably ignored — some name computations treat its presence\n * as an explicit empty name, which leaves the button unnamed — so the attribute\n * has to go, and the visible text becomes the name. A caller whose button is an\n * icon passes its own `aria-label`, and that one is left alone.\n *\n * Applied through a layout-neutral wrapper because Kobalte keeps the `ref` for its\n * own dismissable layer and does not forward it. The wrapper is `display: contents`\n * so the button remains the flex item its parent lays out.\n */\nfunction AlertDialogChoice(props: ComponentProps<typeof KobalteAlertDialog.CloseButton>) {\n const [local, rest] = splitProps(props, ['class', 'aria-label'])\n const [wrapper, setWrapper] = createSignal<HTMLSpanElement>()\n\n createEffect(() => {\n const root = wrapper()\n if (!root || local['aria-label'] !== undefined) return\n root.querySelector('button')?.removeAttribute('aria-label')\n })\n\n return (\n <span ref={setWrapper} class=\"contents\">\n <KobalteAlertDialog.CloseButton\n class={cn(local.class)}\n aria-label={local['aria-label']}\n {...rest}\n />\n </span>\n )\n}\n\nexport function AlertDialogAction(props: ComponentProps<typeof KobalteAlertDialog.CloseButton>) {\n return <AlertDialogChoice {...props} />\n}\n\nexport function AlertDialogCancel(props: ComponentProps<typeof KobalteAlertDialog.CloseButton>) {\n return <AlertDialogCho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,oBAAoBmB,MAAMI,KAAK;CAAC,EAAA,GAAMH,IAAI,CAAA;AAC7F;;;;;;;;;;;;;;;;;;;;AAqBA,SAASoC,kBAAkBvC,OAA8D;CACvF,MAAM,CAACE,OAAOC,QAAQtB,WAAWmB,OAAO,CAAC,SAAS,YAAY,CAAC;CAC/D,MAAM,CAACyC,SAASC,cAAc9D,aAA8B;CAE5DD,mBAAmB;EACjB,MAAMiE,OAAOH,QAAQ;EACrB,IAAI,CAACG,QAAQ1C,MAAM,kBAAkB2C,KAAAA,GAAW;EAChDD,KAAKE,cAAc,QAAQ,CAAC,EAAEC,gBAAgB,YAAY;CAC5D,CAAC;CAED,cAAA;EAAA,IAAAC,QAAAC,QAAA;EAAAC,IACaR,YAAUM,KAAA;EAAAtB,OAAAsB,OAAA5C,gBAClB9B,YAAmBkE,aAAWnC,WAAA;GAAA,KAAA,WAAA;IAAA,OACtBd,GAAGW,MAAMI,KAAK;GAAC;GAAA,KAAA,gBAAA;IAAA,OACVJ,MAAM;GAAa;EAAA,GAC3BC,IAAI,CAAA,CAAA;EAAA,OAAA6C;CAAA,EAAA,CAAA;AAIhB;AAEA,SAAgBI,kBAAkBpD,OAA8D;CAC9F,OAAAI,gBAAQmC,mBAAsBvC,KAAK;AACrC;AAEA,SAAgBqD,kBAAkBrD,OAA8D;CAC9F,OAAAI,gBAAQmC,mBAAsBvC,KAAK;AACrC"}
1
+ {"version":3,"file":"alert-dialog.js","names":["KobalteAlertDialog","KobalteAlertDialogContent","createEffect","createSignal","splitProps","dialogSurface","overlayDescription","overlayFooter","overlayHeader","overlayMotion","overlayPositioner","overlayScrim","overlayScrimMotion","overlayTitle","cn","createDialogLayer","DialogEscapeTarget","Portal","AlertDialogOverlay","props","Overlay","local","rest","_$createComponent","_$mergeProps","class","blockDismissal","onPointerDownOutside","event","preventDefault","onFocusOutside","onInteractOutside","restoreFocusRef","AlertDialogContent","layer","onOpenAutoFocus","onCloseAutoFocus","children","_el$","_tmpl$","_$className","_$insert","onEscapeKeyDown","AlertDialogHeader","_el$2","_tmpl$2","_$spread","AlertDialogFooter","_el$3","_tmpl$3","AlertDialogTitle","Title","AlertDialogDescription","Description","AlertDialogChoice","CloseButton","wrapper","setWrapper","root","undefined","querySelector","removeAttribute","_el$4","_tmpl$4","_$use","AlertDialogAction","AlertDialogCancel"],"sources":["../../../../src/components/ui/alert-dialog/alert-dialog.tsx"],"sourcesContent":["import {\n AlertDialog as KobalteAlertDialog,\n Content as KobalteAlertDialogContent,\n} from '@kobalte/core/alert-dialog'\n// Use the alert-specific export rather than DialogRoot.Content, which other imports can replace.\nimport type { Accessor, ComponentProps } from 'solid-js'\nimport { createEffect, createSignal, splitProps } from 'solid-js'\nimport {\n dialogSurface,\n overlayDescription,\n overlayFooter,\n overlayHeader,\n overlayMotion,\n overlayPositioner,\n overlayScrim,\n overlayScrimMotion,\n overlayTitle,\n} from '#lib/overlay'\nimport { cn } from '#lib/utils'\nimport { createDialogLayer, DialogEscapeTarget } from '../dialog/dialog-layer'\n\n/**\n * AlertDialog.\n *\n * A dialog that cannot be dismissed by accident: a click on the scrim does nothing,\n * and the user must choose one of the actions. Escape is the keyboard's Cancel: it\n * closes the dialog exactly as the cancel action does, so nothing is confirmed. That\n * is the whole difference from Dialog, and it is why this exists as its own\n * component rather than a prop — a caller has to reach for it deliberately.\n *\n * The consequence is a rule of use: this is for confirming a destructive or\n * irreversible step. Wrapping an ordinary form in an AlertDialog traps someone who\n * wants to back out.\n *\n * There is deliberately no close button in the corner. An X has no label, and the\n * point of this surface is that every exit is a named choice.\n */\nexport {\n Root as AlertDialog,\n Trigger as AlertDialogTrigger,\n Portal as AlertDialogPortal,\n} from '@kobalte/core/alert-dialog'\n\nexport function AlertDialogOverlay(props: ComponentProps<typeof KobalteAlertDialog.Overlay>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <KobalteAlertDialog.Overlay\n class={cn(overlayScrim, overlayScrimMotion, local.class)}\n {...rest}\n />\n )\n}\n\n/**\n * The panel.\n *\n * Kobalte's `AlertDialog.Content` is `Dialog.Content` with `role=\"alertdialog\"`\n * and nothing else — an outside click dismisses it exactly as it dismisses a\n * Dialog. That is a real gap in the primitive, so the blocking is implemented\n * here, and it is the whole difference between this component and a Dialog:\n *\n * - Pointer and focus interactions outside are prevented, including the scrim\n * click, because a stray click that closes a confirmation is a click that\n * makes \"confirm\" meaningless.\n *\n * Escape is deliberately left to the primitive. It can only ever cancel, never\n * confirm, so it is not an accident that matters; refusing it traps a keyboard\n * user who has changed their mind, and the WAI-ARIA alertdialog pattern says\n * Escape closes. It reports `onOpenChange(false)` and returns focus to what had\n * it before the confirmation opened, which is what the cancel action does, and\n * as the topmost layer it closes only the confirmation, not a dialog underneath.\n *\n * There is deliberately no prop to turn the scrim blocking off. A surface that can be escaped\n * accidentally does not need to be an AlertDialog; it is a Dialog, and using this\n * one would be a claim about the flow that is not true.\n */\nconst blockDismissal = {\n onPointerDownOutside: (event: Event) => event.preventDefault(),\n onFocusOutside: (event: Event) => event.preventDefault(),\n onInteractOutside: (event: Event) => event.preventDefault(),\n} as const\n\nexport type AlertDialogContentProps = ComponentProps<typeof KobalteAlertDialogContent> & {\n /** The control to focus on close when the one focused before opening is gone by then. */\n restoreFocusRef?: Accessor<HTMLElement | undefined>\n}\n\nexport function AlertDialogContent(props: AlertDialogContentProps) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'children',\n 'restoreFocusRef',\n 'onOpenAutoFocus',\n 'onCloseAutoFocus',\n ])\n const layer = createDialogLayer({\n restoreFocusRef: local.restoreFocusRef,\n onOpenAutoFocus: (event) => local.onOpenAutoFocus?.(event),\n onCloseAutoFocus: (event) => local.onCloseAutoFocus?.(event),\n })\n\n return (\n <KobalteAlertDialog.Portal>\n <AlertDialogOverlay />\n <div class={overlayPositioner}>\n <KobalteAlertDialogContent\n {...blockDismissal}\n class={cn(\n dialogSurface,\n overlayMotion,\n 'grid max-h-full w-full max-w-md gap-4 overflow-y-auto p-5',\n local.class\n )}\n {...rest}\n onOpenAutoFocus={layer.onOpenAutoFocus}\n onCloseAutoFocus={layer.onCloseAutoFocus}\n >\n <DialogEscapeTarget onEscapeKeyDown={props.onEscapeKeyDown}>\n {local.children}\n </DialogEscapeTarget>\n </KobalteAlertDialogContent>\n </div>\n </KobalteAlertDialog.Portal>\n )\n}\n\nexport function AlertDialogHeader(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class'])\n return <div data-slot=\"alert-dialog-header\" class={cn(overlayHeader, local.class)} {...rest} />\n}\n\nexport function AlertDialogFooter(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class'])\n return <div data-slot=\"alert-dialog-footer\" class={cn(overlayFooter, local.class)} {...rest} />\n}\n\nexport function AlertDialogTitle(props: ComponentProps<typeof KobalteAlertDialog.Title>) {\n const [local, rest] = splitProps(props, ['class'])\n return <KobalteAlertDialog.Title class={cn(overlayTitle, local.class)} {...rest} />\n}\n\nexport function AlertDialogDescription(\n props: ComponentProps<typeof KobalteAlertDialog.Description>\n) {\n const [local, rest] = splitProps(props, ['class'])\n return <KobalteAlertDialog.Description class={cn(overlayDescription, local.class)} {...rest} />\n}\n\n/**\n * One of the dialog's two named choices.\n *\n * Kobalte labels its close button \"Dismiss\" by default, because a generic close\n * button is usually an icon with no text of its own. In an AlertDialog it is\n * something else: the named choices. An `aria-label` there *replaces* the visible\n * text, so a screen reader hears \"Dismiss\" twice and the user cannot tell the\n * destructive action from the safe one.\n *\n * The injected label is removed rather than overridden with an empty one. An empty\n * `aria-label` is not reliably ignored — some name computations treat its presence\n * as an explicit empty name, which leaves the button unnamed — so the attribute\n * has to go, and the visible text becomes the name. A caller whose button is an\n * icon passes its own `aria-label`, and that one is left alone.\n *\n * Applied through a layout-neutral wrapper because Kobalte keeps the `ref` for its\n * own dismissable layer and does not forward it. The wrapper is `display: contents`\n * so the button remains the flex item its parent lays out.\n */\nfunction AlertDialogChoice(props: ComponentProps<typeof KobalteAlertDialog.CloseButton>) {\n const [local, rest] = splitProps(props, ['class', 'aria-label'])\n const [wrapper, setWrapper] = createSignal<HTMLSpanElement>()\n\n createEffect(() => {\n const root = wrapper()\n if (!root || local['aria-label'] !== undefined) return\n root.querySelector('button')?.removeAttribute('aria-label')\n })\n\n return (\n <span ref={setWrapper} class=\"contents\">\n <KobalteAlertDialog.CloseButton\n class={cn(local.class)}\n aria-label={local['aria-label']}\n {...rest}\n />\n </span>\n )\n}\n\nexport function AlertDialogAction(props: ComponentProps<typeof KobalteAlertDialog.CloseButton>) {\n return <AlertDialogChoice {...props} />\n}\n\nexport function AlertDialogCancel(props: ComponentProps<typeof KobalteAlertDialog.CloseButton>) {\n return <AlertDialogChoice {...props} />\n}\n"],"mappings":";;;;;;;;;;;AA2CA,SAAgBkB,mBAAmBC,OAA0D;CAC3F,MAAM,CAACE,OAAOC,QAAQlB,WAAWe,OAAO,CAAC,OAAO,CAAC;CACjD,OAAAI,gBACGvB,YAAmBoB,SAAOI,WAAA,EAAA,KAAA,WAAA;EAAA,OAClBV,GAAGH,cAAcC,oBAAoBS,MAAMI,KAAK;CAAC,EAAA,GACpDH,IAAI,CAAA;AAGd;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,IAAMI,iBAAiB;CACrBC,uBAAuBC,UAAiBA,MAAMC,eAAe;CAC7DC,iBAAiBF,UAAiBA,MAAMC,eAAe;CACvDE,oBAAoBH,UAAiBA,MAAMC,eAAe;AAC5D;AAOA,SAAgBI,mBAAmBd,OAAgC;CACjE,MAAM,CAACE,OAAOC,QAAQlB,WAAWe,OAAO;EACtC;EACA;EACA;EACA;EACA;CAAkB,CACnB;CACD,MAAMe,QAAQnB,kBAAkB;EAC9BiB,iBAAiBX,MAAMW;EACvBG,kBAAkBP,UAAUP,MAAMc,kBAAkBP,KAAK;EACzDQ,mBAAmBR,UAAUP,MAAMe,mBAAmBR,KAAK;CAC7D,CAAC;CAED,OAAAL,gBACGvB,YAAmBiB,QAAM,EAAA,IAAAoB,WAAA;EAAA,OAAA,CAAAd,gBACvB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,KAAK;AACrC"}
@@ -1 +1 @@
1
- {"version":3,"file":"annotation-surface.js","names":["createEffect","createSignal","createUniqueId","onCleanup","Show","splitProps","JSX","cn","clampSurfaceFraction","normalizedSurfacePoint","AnnotationSurfacePoint","AnnotationSurfaceRegion","Readonly","x","y","width","height","AnnotationSurfaceDrag","start","current","AnnotationSurfaceTool","AnnotationSurfaceDragPhase","AnnotationSurfacePointerEvent","PointerEvent","currentTarget","HTMLDivElement","AnnotationSurfaceKeyboardEvent","KeyboardEvent","AnnotationSurfaceInputEvent","SurfaceElementProps","Pick","HTMLAttributes","AnnotationSurfaceProps","label","tool","region","hint","Element","interactive","resetKey","onPoint","point","event","onDragChange","drag","phase","onKeyDown","ref","element","class","ActiveDrag","pointerId","target","pointFrom","bounds","getBoundingClientRect","clientX","clientY","AnnotationSurface","props","local","dragging","setDragging","hintId","activeDrag","previousResetKey","previousTool","isInteractive","releaseCapture","hasPointerCapture","releasePointerCapture","cancelDrag","release","undefined","handlePointerDown","isPrimary","button","preventDefault","focus","preventScroll","setPointerCapture","handlePointerMove","handlePointerUp","handlePointerCancel","handleLostPointerCapture","handleKeyDown","key","defaultPrevented","repeat","isComposing","altKey","ctrlKey","metaKey","visibleRegion","Math","min","describedBy","filter","Boolean","join","_el$","_tmpl$2","$$keydown","addEventListener","$$pointerup","$$pointermove","$$pointerdown","_$use","_$insert","_$createComponent","when","children","_el$3","_tmpl$3","_el$4","firstChild","_$effect","_p$","_v$8","_v$9","_v$0","_v$1","e","_$setAttribute","t","a","o","_$memo","_el$2","_tmpl$","_v$","id","_v$2","_v$3","_v$4","_v$5","_v$6","_v$7","i","n","s","_$className","_$delegateEvents","_$createComponent","_$setAttribute","_$memo","_$className","_$delegateEvents"],"sources":["../../../../src/components/ui/annotation-surface/annotation-surface.tsx"],"sourcesContent":["import {\n createEffect,\n createSignal,\n createUniqueId,\n onCleanup,\n Show,\n splitProps,\n type JSX,\n} from 'solid-js'\nimport { cn } from '#lib/utils'\nimport './annotation-surface.css'\nimport {\n clampSurfaceFraction,\n normalizedSurfacePoint,\n type AnnotationSurfacePoint,\n} from './geometry'\n\nexport type AnnotationSurfaceRegion = Readonly<{\n x: number\n y: number\n width: number\n height: number\n}>\n\nexport type AnnotationSurfaceDrag = Readonly<{\n start: AnnotationSurfacePoint\n current: AnnotationSurfacePoint\n}>\n\nexport type AnnotationSurfaceTool = 'region' | 'point'\nexport type AnnotationSurfaceDragPhase = 'start' | 'move' | 'end' | 'cancel' | 'keyboard'\nexport type AnnotationSurfacePointerEvent = PointerEvent & { currentTarget: HTMLDivElement }\nexport type AnnotationSurfaceKeyboardEvent = KeyboardEvent & { currentTarget: HTMLDivElement }\nexport type AnnotationSurfaceInputEvent =\n | AnnotationSurfacePointerEvent\n | AnnotationSurfaceKeyboardEvent\n\ntype SurfaceElementProps = Pick<JSX.HTMLAttributes<HTMLDivElement>, 'id' | 'aria-describedby'>\n\nexport type AnnotationSurfaceProps = SurfaceElementProps & {\n /** Accessible instructions for the keyboard-operated surface. */\n label: string\n /** Region draws a captured drag; point reports a single placement point. */\n tool: AnnotationSurfaceTool\n /** Normalized 0..1 geometry supplied by the host; absent means no region. */\n region?: AnnotationSurfaceRegion\n /** Visible idle guidance. It is hidden while a region is present. */\n hint?: JSX.Element\n /** Disable new drawing while the host is busy. Defaults to true. */\n interactive?: boolean\n /** Changing this value cancels an in-flight drag owned by the host context. */\n resetKey?: string | number\n /** Receives one normalized point in point mode. */\n onPoint?: (point: AnnotationSurfacePoint, event: AnnotationSurfaceInputEvent) => void\n /** Receives drag phases; cancel has no drag and fires at most once per capture. */\n onDragChange?: (\n drag: AnnotationSurfaceDrag | undefined,\n phase: AnnotationSurfaceDragPhase,\n event?: AnnotationSurfaceInputEvent\n ) => void\n /** Domain keyboard policy stays with the host and receives the native event. */\n onKeyDown?: (event: AnnotationSurfaceKeyboardEvent) => void\n /** Ref to the actual focusable and pointer-capturing HTMLDivElement. */\n ref?: (element: HTMLDivElement) => void\n /** Layout only; appearance remains owned by the shared component. */\n class?: string\n}\n\ntype ActiveDrag = AnnotationSurfaceDrag & {\n pointerId: number\n target: HTMLDivElement\n}\n\nfunction pointFrom(event: PointerEvent, target: HTMLDivElement): AnnotationSurfacePoint {\n const bounds = target.getBoundingClientRect()\n return normalizedSurfacePoint(event.clientX, event.clientY, bounds)\n}\n\n/**\n * AnnotationSurface.\n *\n * A keyboard-focusable, viewport-shaped drawing surface for hosts that own an\n * annotation domain. It renders normalized region geometry and idle guidance,\n * captures region drags, and reports normalized points without reading or\n * rendering screenshot pixels. The host keeps tool policy, domain geometry,\n * persistence and capture commands.\n *\n * This bespoke application widget is necessary because a generic button or\n * slider cannot represent a two-dimensional drawing viewport. Its keyboard\n * behavior is supplied by the host and forwarded as a native key event. Space\n * creates a centered region or places a point at the center; Escape is left to\n * the host first, which can prevent the default gesture cancellation while it\n * applies its own draft and mode rules.\n */\nexport function AnnotationSurface(props: AnnotationSurfaceProps) {\n const [local] = splitProps(props, [\n 'id',\n 'aria-describedby',\n 'label',\n 'tool',\n 'region',\n 'hint',\n 'interactive',\n 'resetKey',\n 'onPoint',\n 'onDragChange',\n 'onKeyDown',\n 'ref',\n 'class',\n ])\n\n const [dragging, setDragging] = createSignal(false)\n const hintId = createUniqueId()\n let activeDrag: ActiveDrag | undefined\n let previousResetKey = local.resetKey\n let previousTool = local.tool\n\n const isInteractive = () => local.interactive ?? true\n\n function releaseCapture(drag: ActiveDrag): void {\n try {\n if (drag.target.hasPointerCapture(drag.pointerId))\n drag.target.releasePointerCapture(drag.pointerId)\n } catch {\n // The browser may release capture while a host reset or unmount is running.\n }\n }\n\n function cancelDrag(event?: AnnotationSurfaceInputEvent, release = true): void {\n const drag = activeDrag\n if (!drag) return\n\n activeDrag = undefined\n setDragging(false)\n if (release) releaseCapture(drag)\n local.onDragChange?.(undefined, 'cancel', event)\n }\n\n createEffect(() => {\n const resetKey = local.resetKey\n const tool = local.tool\n const interactive = isInteractive()\n if (activeDrag && (resetKey !== previousResetKey || tool !== previousTool || !interactive)) {\n cancelDrag()\n }\n previousResetKey = resetKey\n previousTool = tool\n })\n\n onCleanup(() => cancelDrag())\n\n function handlePointerDown(event: AnnotationSurfacePointerEvent): void {\n if (!isInteractive() || !event.isPrimary || event.button !== 0) return\n event.preventDefault()\n event.currentTarget.focus({ preventScroll: true })\n const point = pointFrom(event, event.currentTarget)\n if (activeDrag) return\n\n if (local.tool === 'point') {\n local.onPoint?.(point, event)\n return\n }\n\n try {\n event.currentTarget.setPointerCapture(event.pointerId)\n } catch {\n // A drag without real pointer capture can lose its final coordinates.\n return\n }\n\n const drag: ActiveDrag = {\n pointerId: event.pointerId,\n target: event.currentTarget,\n start: point,\n current: point,\n }\n activeDrag = drag\n setDragging(true)\n local.onDragChange?.({ start: point, current: point }, 'start', event)\n }\n\n function handlePointerMove(event: AnnotationSurfacePointerEvent): void {\n const drag = activeDrag\n if (!drag || drag.pointerId !== event.pointerId) return\n\n const current = pointFrom(event, event.currentTarget)\n activeDrag = { ...drag, current }\n local.onDragChange?.({ start: drag.start, current }, 'move', event)\n }\n\n function handlePointerUp(event: AnnotationSurfacePointerEvent): void {\n const drag = activeDrag\n if (!drag || drag.pointerId !== event.pointerId) return\n\n const current = pointFrom(event, event.currentTarget)\n activeDrag = undefined\n setDragging(false)\n releaseCapture(drag)\n local.onDragChange?.({ start: drag.start, current }, 'end', event)\n }\n\n function handlePointerCancel(event: AnnotationSurfacePointerEvent): void {\n if (activeDrag?.pointerId === event.pointerId) cancelDrag(event)\n }\n\n function handleLostPointerCapture(event: AnnotationSurfacePointerEvent): void {\n if (activeDrag?.pointerId === event.pointerId) cancelDrag(event, false)\n }\n\n function handleKeyDown(event: AnnotationSurfaceKeyboardEvent): void {\n local.onKeyDown?.(event)\n if (event.key === 'Escape') {\n if (!event.defaultPrevented) cancelDrag()\n return\n }\n if (\n event.defaultPrevented ||\n !isInteractive() ||\n event.key !== ' ' ||\n event.repeat ||\n event.isComposing ||\n event.altKey ||\n event.ctrlKey ||\n event.metaKey ||\n activeDrag\n )\n return\n\n event.preventDefault()\n if (local.tool === 'point') {\n local.onPoint?.({ x: 0.5, y: 0.5 }, event)\n return\n }\n\n local.onDragChange?.(\n {\n start: { x: 0.25, y: 0.25 },\n current: { x: 0.75, y: 0.75 },\n },\n 'keyboard',\n event\n )\n }\n\n const visibleRegion = (): AnnotationSurfaceRegion | undefined => {\n const region = local.region\n if (!region) return undefined\n const x = clampSurfaceFraction(region.x)\n const y = clampSurfaceFraction(region.y)\n return {\n x,\n y,\n width: Math.min(clampSurfaceFraction(region.width), 1 - x),\n height: Math.min(clampSurfaceFraction(region.height), 1 - y),\n }\n }\n\n const describedBy = () =>\n [local['aria-describedby'], local.hint && !visibleRegion() ? hintId : undefined]\n .filter(Boolean)\n .join(' ') || undefined\n\n return (\n <div\n id={local.id}\n aria-describedby={describedBy()}\n role=\"application\"\n aria-roledescription=\"annotation surface\"\n aria-label={local.label}\n aria-disabled={isInteractive() ? undefined : 'true'}\n tabIndex={0}\n data-tool={local.tool}\n data-dragging={dragging() ? 'true' : 'false'}\n class={cn(\n 'dev-annotation-surface relative isolate block w-full aspect-video select-none overflow-hidden rounded-md border border-border bg-muted/20 text-muted-foreground outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle',\n local.class\n )}\n ref={(element) => local.ref?.(element)}\n onPointerDown={handlePointerDown}\n onPointerMove={handlePointerMove}\n onPointerUp={handlePointerUp}\n onPointerCancel={handlePointerCancel}\n onLostPointerCapture={handleLostPointerCapture}\n onKeyDown={handleKeyDown}\n >\n <Show when={visibleRegion()}>\n {(region) => (\n <svg\n class=\"dev-annotation-surface__region pointer-events-none absolute inset-0 size-full\"\n viewBox=\"0 0 10000 10000\"\n preserveAspectRatio=\"none\"\n aria-hidden=\"true\"\n >\n <rect\n class=\"fill-primary-subtle stroke-primary\"\n x={region().x * 10_000}\n y={region().y * 10_000}\n width={region().width * 10_000}\n height={region().height * 10_000}\n stroke-width=\"1.5\"\n vector-effect=\"non-scaling-stroke\"\n />\n </svg>\n )}\n </Show>\n <Show when={local.hint && !visibleRegion()}>\n <span\n id={hintId}\n class=\"dev-annotation-surface__hint pointer-events-none absolute inset-0 grid place-items-center p-4 text-center text-xs text-muted-foreground\"\n >\n {local.hint}\n </span>\n </Show>\n </div>\n )\n}\n"],"mappings":";;;;;;;;;AAyEA,SAASqD,UAAUX,OAAqBU,QAAgD;CACtF,MAAME,SAASF,OAAOG,sBAAsB;CAC5C,OAAO9C,uBAAuBiC,MAAMc,SAASd,MAAMe,SAASH,MAAM;AACpE;;;;;;;;;;;;;;;;;AAkBA,SAAgBI,kBAAkBC,OAA+B;CAC/D,MAAM,CAACC,SAASvD,WAAWsD,OAAO;EAChC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CAAO,CACR;CAED,MAAM,CAACE,UAAUC,eAAe7D,aAAa,KAAK;CAClD,MAAM8D,SAAS7D,eAAe;CAC9B,IAAI8D;CACJ,IAAIC,mBAAmBL,MAAMrB;CAC7B,IAAI2B,eAAeN,MAAM1B;CAEzB,MAAMiC,sBAAsBP,MAAMtB,eAAe;CAEjD,SAAS8B,eAAexB,MAAwB;EAC9C,IAAI;GACF,IAAIA,KAAKQ,OAAOiB,kBAAkBzB,KAAKO,SAAS,GAC9CP,KAAKQ,OAAOkB,sBAAsB1B,KAAKO,SAAS;EACpD,QAAQ,CACN;CAEJ;CAEA,SAASoB,WAAW7B,OAAqC8B,UAAU,MAAY;EAC7E,MAAM5B,OAAOoB;EACb,IAAI,CAACpB,MAAM;EAEXoB,aAAaS,KAAAA;EACbX,YAAY,KAAK;EACjB,IAAIU,SAASJ,eAAexB,IAAI;EAChCgB,MAAMjB,eAAe8B,KAAAA,GAAW,UAAU/B,KAAK;CACjD;CAEA1C,mBAAmB;EACjB,MAAMuC,WAAWqB,MAAMrB;EACvB,MAAML,OAAO0B,MAAM1B;EACnB,MAAMI,cAAc6B,cAAc;EAClC,IAAIH,eAAezB,aAAa0B,oB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AAAA;GAAAoD,GAAApD,KAAAA;GAAAqD,GAAArD,KAAAA;GAAAiE,GAAAjE,KAAAA;GAAAkE,GAAAlE,KAAAA;GAAAmE,GAAAnE,KAAAA;EAAA,CAAA;EAAA,OAAA2B;CAAA,EAAA,CAAA;AAuCP;AAAC0C,eAAA;CAAA;CAAA;CAAA;CAAA;AAAA,CAAA"}
1
+ {"version":3,"file":"annotation-surface.js","names":["createEffect","createSignal","createUniqueId","onCleanup","Show","splitProps","cn","clampSurfaceFraction","normalizedSurfacePoint","x","y","width","height","start","current","currentTarget","label","tool","region","hint","interactive","resetKey","onPoint","point","event","onDragChange","drag","onKeyDown","ref","element","class","pointerId","target","pointFrom","bounds","getBoundingClientRect","clientX","clientY","AnnotationSurface","props","local","dragging","setDragging","hintId","activeDrag","previousResetKey","previousTool","isInteractive","releaseCapture","hasPointerCapture","releasePointerCapture","cancelDrag","release","undefined","handlePointerDown","isPrimary","button","preventDefault","focus","preventScroll","setPointerCapture","handlePointerMove","handlePointerUp","handlePointerCancel","handleLostPointerCapture","handleKeyDown","key","defaultPrevented","repeat","isComposing","altKey","ctrlKey","metaKey","visibleRegion","Math","min","describedBy","filter","Boolean","join","_el$","_tmpl$2","$$keydown","addEventListener","$$pointerup","$$pointermove","$$pointerdown","_$use","_$insert","_$createComponent","when","children","_el$3","_tmpl$3","_el$4","firstChild","_$effect","_p$","_v$8","_v$9","_v$0","_v$1","e","_$setAttribute","t","a","o","_$memo","_el$2","_tmpl$","_v$","id","_v$2","_v$3","_v$4","_v$5","_v$6","_v$7","i","n","s","_$className","_$delegateEvents"],"sources":["../../../../src/components/ui/annotation-surface/annotation-surface.tsx"],"sourcesContent":["import {\n createEffect,\n createSignal,\n createUniqueId,\n onCleanup,\n Show,\n splitProps,\n type JSX,\n} from 'solid-js'\nimport { cn } from '#lib/utils'\nimport './annotation-surface.css'\nimport {\n clampSurfaceFraction,\n normalizedSurfacePoint,\n type AnnotationSurfacePoint,\n} from './geometry'\n\nexport type AnnotationSurfaceRegion = Readonly<{\n x: number\n y: number\n width: number\n height: number\n}>\n\nexport type AnnotationSurfaceDrag = Readonly<{\n start: AnnotationSurfacePoint\n current: AnnotationSurfacePoint\n}>\n\nexport type AnnotationSurfaceTool = 'region' | 'point'\nexport type AnnotationSurfaceDragPhase = 'start' | 'move' | 'end' | 'cancel' | 'keyboard'\nexport type AnnotationSurfacePointerEvent = PointerEvent & { currentTarget: HTMLDivElement }\nexport type AnnotationSurfaceKeyboardEvent = KeyboardEvent & { currentTarget: HTMLDivElement }\nexport type AnnotationSurfaceInputEvent =\n | AnnotationSurfacePointerEvent\n | AnnotationSurfaceKeyboardEvent\n\ntype SurfaceElementProps = Pick<JSX.HTMLAttributes<HTMLDivElement>, 'id' | 'aria-describedby'>\n\nexport type AnnotationSurfaceProps = SurfaceElementProps & {\n /** Accessible instructions for the keyboard-operated surface. */\n label: string\n /** Region draws a captured drag; point reports a single placement point. */\n tool: AnnotationSurfaceTool\n /** Normalized 0..1 geometry supplied by the host; absent means no region. */\n region?: AnnotationSurfaceRegion\n /** Visible idle guidance. It is hidden while a region is present. */\n hint?: JSX.Element\n /** Disable new drawing while the host is busy. Defaults to true. */\n interactive?: boolean\n /** Changing this value cancels an in-flight drag owned by the host context. */\n resetKey?: string | number\n /** Receives one normalized point in point mode. */\n onPoint?: (point: AnnotationSurfacePoint, event: AnnotationSurfaceInputEvent) => void\n /** Receives drag phases; cancel has no drag and fires at most once per capture. */\n onDragChange?: (\n drag: AnnotationSurfaceDrag | undefined,\n phase: AnnotationSurfaceDragPhase,\n event?: AnnotationSurfaceInputEvent\n ) => void\n /** Domain keyboard policy stays with the host and receives the native event. */\n onKeyDown?: (event: AnnotationSurfaceKeyboardEvent) => void\n /** Ref to the actual focusable and pointer-capturing HTMLDivElement. */\n ref?: (element: HTMLDivElement) => void\n /** Layout only; appearance remains owned by the shared component. */\n class?: string\n}\n\ntype ActiveDrag = AnnotationSurfaceDrag & {\n pointerId: number\n target: HTMLDivElement\n}\n\nfunction pointFrom(event: PointerEvent, target: HTMLDivElement): AnnotationSurfacePoint {\n const bounds = target.getBoundingClientRect()\n return normalizedSurfacePoint(event.clientX, event.clientY, bounds)\n}\n\n/**\n * AnnotationSurface.\n *\n * A keyboard-focusable, viewport-shaped drawing surface for hosts that own an\n * annotation domain. It renders normalized region geometry and idle guidance,\n * captures region drags, and reports normalized points without reading or\n * rendering screenshot pixels. The host keeps tool policy, domain geometry,\n * persistence and capture commands.\n *\n * This bespoke application widget is necessary because a generic button or\n * slider cannot represent a two-dimensional drawing viewport. Its keyboard\n * behavior is supplied by the host and forwarded as a native key event. Space\n * creates a centered region or places a point at the center; Escape is left to\n * the host first, which can prevent the default gesture cancellation while it\n * applies its own draft and mode rules.\n */\nexport function AnnotationSurface(props: AnnotationSurfaceProps) {\n const [local] = splitProps(props, [\n 'id',\n 'aria-describedby',\n 'label',\n 'tool',\n 'region',\n 'hint',\n 'interactive',\n 'resetKey',\n 'onPoint',\n 'onDragChange',\n 'onKeyDown',\n 'ref',\n 'class',\n ])\n\n const [dragging, setDragging] = createSignal(false)\n const hintId = createUniqueId()\n let activeDrag: ActiveDrag | undefined\n let previousResetKey = local.resetKey\n let previousTool = local.tool\n\n const isInteractive = () => local.interactive ?? true\n\n function releaseCapture(drag: ActiveDrag): void {\n try {\n if (drag.target.hasPointerCapture(drag.pointerId))\n drag.target.releasePointerCapture(drag.pointerId)\n } catch {\n // The browser may release capture while a host reset or unmount is running.\n }\n }\n\n function cancelDrag(event?: AnnotationSurfaceInputEvent, release = true): void {\n const drag = activeDrag\n if (!drag) return\n\n activeDrag = undefined\n setDragging(false)\n if (release) releaseCapture(drag)\n local.onDragChange?.(undefined, 'cancel', event)\n }\n\n createEffect(() => {\n const resetKey = local.resetKey\n const tool = local.tool\n const interactive = isInteractive()\n if (activeDrag && (resetKey !== previousResetKey || tool !== previousTool || !interactive)) {\n cancelDrag()\n }\n previousResetKey = resetKey\n previousTool = tool\n })\n\n onCleanup(() => cancelDrag())\n\n function handlePointerDown(event: AnnotationSurfacePointerEvent): void {\n if (!isInteractive() || !event.isPrimary || event.button !== 0) return\n event.preventDefault()\n event.currentTarget.focus({ preventScroll: true })\n const point = pointFrom(event, event.currentTarget)\n if (activeDrag) return\n\n if (local.tool === 'point') {\n local.onPoint?.(point, event)\n return\n }\n\n try {\n event.currentTarget.setPointerCapture(event.pointerId)\n } catch {\n // A drag without real pointer capture can lose its final coordinates.\n return\n }\n\n const drag: ActiveDrag = {\n pointerId: event.pointerId,\n target: event.currentTarget,\n start: point,\n current: point,\n }\n activeDrag = drag\n setDragging(true)\n local.onDragChange?.({ start: point, current: point }, 'start', event)\n }\n\n function handlePointerMove(event: AnnotationSurfacePointerEvent): void {\n const drag = activeDrag\n if (!drag || drag.pointerId !== event.pointerId) return\n\n const current = pointFrom(event, event.currentTarget)\n activeDrag = { ...drag, current }\n local.onDragChange?.({ start: drag.start, current }, 'move', event)\n }\n\n function handlePointerUp(event: AnnotationSurfacePointerEvent): void {\n const drag = activeDrag\n if (!drag || drag.pointerId !== event.pointerId) return\n\n const current = pointFrom(event, event.currentTarget)\n activeDrag = undefined\n setDragging(false)\n releaseCapture(drag)\n local.onDragChange?.({ start: drag.start, current }, 'end', event)\n }\n\n function handlePointerCancel(event: AnnotationSurfacePointerEvent): void {\n if (activeDrag?.pointerId === event.pointerId) cancelDrag(event)\n }\n\n function handleLostPointerCapture(event: AnnotationSurfacePointerEvent): void {\n if (activeDrag?.pointerId === event.pointerId) cancelDrag(event, false)\n }\n\n function handleKeyDown(event: AnnotationSurfaceKeyboardEvent): void {\n local.onKeyDown?.(event)\n if (event.key === 'Escape') {\n if (!event.defaultPrevented) cancelDrag()\n return\n }\n if (\n event.defaultPrevented ||\n !isInteractive() ||\n event.key !== ' ' ||\n event.repeat ||\n event.isComposing ||\n event.altKey ||\n event.ctrlKey ||\n event.metaKey ||\n activeDrag\n )\n return\n\n event.preventDefault()\n if (local.tool === 'point') {\n local.onPoint?.({ x: 0.5, y: 0.5 }, event)\n return\n }\n\n local.onDragChange?.(\n {\n start: { x: 0.25, y: 0.25 },\n current: { x: 0.75, y: 0.75 },\n },\n 'keyboard',\n event\n )\n }\n\n const visibleRegion = (): AnnotationSurfaceRegion | undefined => {\n const region = local.region\n if (!region) return undefined\n const x = clampSurfaceFraction(region.x)\n const y = clampSurfaceFraction(region.y)\n return {\n x,\n y,\n width: Math.min(clampSurfaceFraction(region.width), 1 - x),\n height: Math.min(clampSurfaceFraction(region.height), 1 - y),\n }\n }\n\n const describedBy = () =>\n [local['aria-describedby'], local.hint && !visibleRegion() ? hintId : undefined]\n .filter(Boolean)\n .join(' ') || undefined\n\n return (\n <div\n id={local.id}\n aria-describedby={describedBy()}\n role=\"application\"\n aria-roledescription=\"annotation surface\"\n aria-label={local.label}\n aria-disabled={isInteractive() ? undefined : 'true'}\n tabIndex={0}\n data-tool={local.tool}\n data-dragging={dragging() ? 'true' : 'false'}\n class={cn(\n 'dev-annotation-surface relative isolate block w-full aspect-video select-none overflow-hidden rounded-md border border-border bg-muted/20 text-muted-foreground outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle',\n local.class\n )}\n ref={(element) => local.ref?.(element)}\n onPointerDown={handlePointerDown}\n onPointerMove={handlePointerMove}\n onPointerUp={handlePointerUp}\n onPointerCancel={handlePointerCancel}\n onLostPointerCapture={handleLostPointerCapture}\n onKeyDown={handleKeyDown}\n >\n <Show when={visibleRegion()}>\n {(region) => (\n <svg\n class=\"dev-annotation-surface__region pointer-events-none absolute inset-0 size-full\"\n viewBox=\"0 0 10000 10000\"\n preserveAspectRatio=\"none\"\n aria-hidden=\"true\"\n >\n <rect\n class=\"fill-primary-subtle stroke-primary\"\n x={region().x * 10_000}\n y={region().y * 10_000}\n width={region().width * 10_000}\n height={region().height * 10_000}\n stroke-width=\"1.5\"\n vector-effect=\"non-scaling-stroke\"\n />\n </svg>\n )}\n </Show>\n <Show when={local.hint && !visibleRegion()}>\n <span\n id={hintId}\n class=\"dev-annotation-surface__hint pointer-events-none absolute inset-0 grid place-items-center p-4 text-center text-xs text-muted-foreground\"\n >\n {local.hint}\n </span>\n </Show>\n </div>\n )\n}\n"],"mappings":";;;;;;;;;AAyEA,SAASiC,UAAUT,OAAqBQ,QAAgD;CACtF,MAAME,SAASF,OAAOG,sBAAsB;CAC5C,OAAO3B,uBAAuBgB,MAAMY,SAASZ,MAAMa,SAASH,MAAM;AACpE;;;;;;;;;;;;;;;;;AAkBA,SAAgBI,kBAAkBC,OAA+B;CAC/D,MAAM,CAACC,SAASnC,WAAWkC,OAAO;EAChC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CAAO,CACR;CAED,MAAM,CAACE,UAAUC,eAAezC,aAAa,KAAK;CAClD,MAAM0C,SAASzC,eAAe;CAC9B,IAAI0C;CACJ,IAAIC,mBAAmBL,MAAMnB;CAC7B,IAAIyB,eAAeN,MAAMvB;CAEzB,MAAM8B,sBAAsBP,MAAMpB,eAAe;CAEjD,SAAS4B,eAAetB,MAAwB;EAC9C,IAAI;GACF,IAAIA,KAAKM,OAAOiB,kBAAkBvB,KAAKK,SAAS,GAC9CL,KAAKM,OAAOkB,sBAAsBxB,KAAKK,SAAS;EACpD,QAAQ,CACN;CAEJ;CAEA,SAASoB,WAAW3B,OAAqC4B,UAAU,MAAY;EAC7E,MAAM1B,OAAOkB;EACb,IAAI,CAAClB,MAAM;EAEXkB,aAAaS,KAAAA;EACbX,YAAY,KAAK;EACjB,IAAIU,SAASJ,eAAetB,IAAI;EAChCc,MAAMf,eAAe4B,KAAAA,GAAW,UAAU7B,KAAK;CACjD;CAEAxB,mBAAmB;EACjB,MAAMqB,WAAWmB,MAAMnB;EACvB,MAAMJ,OAAOuB,MAAMvB;EACnB,MAAMG,cAAc2B,cAAc;EAClC,IAAIH,eAAevB,aAAawB,oBAAoB5B,SAAS6B,gBAAgB,CAAC1B,cAC5E+B,WAAW;EAEbN,mBAAmBxB;EACnByB,eAAe7B;CACjB,C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,OAAA2B;CAAA,EAAA,CAAA;AAuCP;AAAC0C,eAAA;CAAA;CAAA;CAAA;CAAA;AAAA,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"aspect-ratio.js","names":["ComponentProps","JSX","splitProps","cn","AspectRatioProps","ratio","withRatio","style","CSSProperties","value","String","AspectRatio","props","local","rest","_el$","_tmpl$","_$spread","_$mergeProps","class","_$insert","children","_$mergeProps"],"sources":["../../../../src/components/ui/aspect-ratio/aspect-ratio.tsx"],"sourcesContent":["import type { ComponentProps, JSX } from 'solid-js'\nimport { splitProps } from 'solid-js'\nimport { cn } from '#lib/utils'\n\n/**\n * AspectRatio.\n *\n * Holds a box to a ratio so its content cannot change the layout as it loads. The\n * problem it solves is a specific one: an image or an embed whose intrinsic size is\n * unknown until it arrives pushes everything below it down when it does, and a\n * preview or a grid of cards is where that is most visible.\n *\n * CSS `aspect-ratio` rather than the padding-top trick a decade of libraries used:\n * the property is supported everywhere this system runs, it does not require a\n * wrapper element, and it does not break when the child is positioned.\n *\n * The child fills the box, so a caller passes the image, video or iframe directly\n * and never sizes it.\n */\nexport type AspectRatioProps = ComponentProps<'div'> & {\n /** Width divided by height, e.g. `16 / 9` or `1`. */\n ratio?: number\n}\n\n/**\n * The caller's style with the ratio laid over it. A spread `style` replaces the\n * element's rather than merging, so passing any style used to drop the ratio and\n * collapse the box to zero height. `ratio` is the API for the ratio, so it wins.\n */\nfunction withRatio(style: AspectRatioProps['style'], ratio: number): JSX.CSSProperties | string {\n const value = String(ratio)\n if (typeof style === 'string') return `${style};aspect-ratio:${value}`\n return { ...style, 'aspect-ratio': value }\n}\n\nexport function AspectRatio(props: AspectRatioProps) {\n const [local, rest] = splitProps(props, ['class', 'ratio', 'style', 'children'])\n\n return (\n <div\n data-slot=\"aspect-ratio\"\n style={withRatio(local.style, local.ratio ?? 16 / 9)}\n class={cn('relative w-full [&>*]:absolute [&>*]:inset-0 [&>*]:size-full', local.class)}\n {...rest}\n >\n {local.children}\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;AA6BA,SAASM,UAAUC,OAAkCF,OAA2C;CAC9F,MAAMI,QAAQC,OAAOL,KAAK;CAC1B,IAAI,OAAOE,UAAU,UAAU,OAAO,GAAGA,MAAK,gBAAiBE;CAC/D,OAAO;EAAE,GAAGF;EAAO,gBAAgBE;CAAM;AAC3C;AAEA,SAAgBE,YAAYC,OAAyB;CACnD,MAAM,CAACC,OAAOC,QAAQZ,WAAWU,OAAO;EAAC;EAAS;EAAS;EAAS;CAAU,CAAC;CAE/E,cAAA;EAAA,IAAAG,OAAAC,OAAA;EAAAC,OAAAF,MAAAG,WAAA;GAAA,IAGIX,QAAK;IAAA,OAAED,UAAUO,MAAMN,OAAOM,MAAMR,SAAS,KAAK,CAAC;GAAC;GAAA,KAAA,WAAA;IAAA,OAC7CF,GAAG,gEAAgEU,MAAMM,KAAK;GAAC;EAAA,GAClFL,IAAI,GAAA,OAAA,IAAA;EAAAM,OAAAL,YAEPF,MAAMQ,QAAQ;EAAA,OAAAN;CAAA,EAAA,CAAA;AAGrB"}
1
+ {"version":3,"file":"aspect-ratio.js","names":["splitProps","cn","ratio","withRatio","style","value","String","AspectRatio","props","local","rest","_el$","_tmpl$","_$spread","_$mergeProps","class","_$insert","children"],"sources":["../../../../src/components/ui/aspect-ratio/aspect-ratio.tsx"],"sourcesContent":["import type { ComponentProps, JSX } from 'solid-js'\nimport { splitProps } from 'solid-js'\nimport { cn } from '#lib/utils'\n\n/**\n * AspectRatio.\n *\n * Holds a box to a ratio so its content cannot change the layout as it loads. The\n * problem it solves is a specific one: an image or an embed whose intrinsic size is\n * unknown until it arrives pushes everything below it down when it does, and a\n * preview or a grid of cards is where that is most visible.\n *\n * CSS `aspect-ratio` rather than the padding-top trick a decade of libraries used:\n * the property is supported everywhere this system runs, it does not require a\n * wrapper element, and it does not break when the child is positioned.\n *\n * The child fills the box, so a caller passes the image, video or iframe directly\n * and never sizes it.\n */\nexport type AspectRatioProps = ComponentProps<'div'> & {\n /** Width divided by height, e.g. `16 / 9` or `1`. */\n ratio?: number\n}\n\n/**\n * The caller's style with the ratio laid over it. A spread `style` replaces the\n * element's rather than merging, so passing any style used to drop the ratio and\n * collapse the box to zero height. `ratio` is the API for the ratio, so it wins.\n */\nfunction withRatio(style: AspectRatioProps['style'], ratio: number): JSX.CSSProperties | string {\n const value = String(ratio)\n if (typeof style === 'string') return `${style};aspect-ratio:${value}`\n return { ...style, 'aspect-ratio': value }\n}\n\nexport function AspectRatio(props: AspectRatioProps) {\n const [local, rest] = splitProps(props, ['class', 'ratio', 'style', 'children'])\n\n return (\n <div\n data-slot=\"aspect-ratio\"\n style={withRatio(local.style, local.ratio ?? 16 / 9)}\n class={cn('relative w-full [&>*]:absolute [&>*]:inset-0 [&>*]:size-full', local.class)}\n {...rest}\n >\n {local.children}\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;AA6BA,SAASG,UAAUC,OAAkCF,OAA2C;CAC9F,MAAMG,QAAQC,OAAOJ,KAAK;CAC1B,IAAI,OAAOE,UAAU,UAAU,OAAO,GAAGA,MAAK,gBAAiBC;CAC/D,OAAO;EAAE,GAAGD;EAAO,gBAAgBC;CAAM;AAC3C;AAEA,SAAgBE,YAAYC,OAAyB;CACnD,MAAM,CAACC,OAAOC,QAAQV,WAAWQ,OAAO;EAAC;EAAS;EAAS;EAAS;CAAU,CAAC;CAE/E,cAAA;EAAA,IAAAG,OAAAC,OAAA;EAAAC,OAAAF,MAAAG,WAAA;GAAA,IAGIV,QAAK;IAAA,OAAED,UAAUM,MAAML,OAAOK,MAAMP,SAAS,KAAK,CAAC;GAAC;GAAA,KAAA,WAAA;IAAA,OAC7CD,GAAG,gEAAgEQ,MAAMM,KAAK;GAAC;EAAA,GAClFL,IAAI,GAAA,OAAA,IAAA;EAAAM,OAAAL,YAEPF,MAAMQ,QAAQ;EAAA,OAAAN;CAAA,EAAA,CAAA;AAGrB"}
@@ -1 +1 @@
1
- {"version":3,"file":"attachment.js","names":["Archive","File","FileIcon","FileCode","FileText","Image","ImageIcon","LoaderCircle","TriangleAlert","X","Show","splitProps","ComponentProps","JSX","formatByteSize","FETCH_SCHEMES","urlWithScheme","cn","Button","AttachmentKind","AttachmentStatus","AttachmentVariant","KIND_ICON","image","document","code","text","archive","other","const","shown","amount","Math","round","formatAttachmentSize","bytes","undefined","Number","isFinite","value","String","safePreviewSrc","startsWith","test","AttachmentProps","Omit","name","kind","size","variant","status","progress","statusLabel","previewSrc","onOpen","href","onRemove","removeLabel","Attachment","props","local","rest","preview","Icon","actionable","mark","Element","_$createComponent","Glyph","label","_el$","_tmpl$","_$insert","_$effect","_$setAttribute","when","_$memo","fallback","children","_el$3","_tmpl$3","$$click","_el$2","_tmpl$2","_p$","_v$","_v$2","e","t","detail","_el$4","_tmpl$4","_c$","_v$3","_v$4","_$className","remove","type","aria-label","onClick","_el$5","_tmpl$8","_$spread","_$mergeProps","data-variant","data-status","class","_el$9","_el$0","_tmpl$5","_el$1","_tmpl$9","_el$6","_tmpl$6","_el$7","_el$8","_tmpl$7","AttachmentList","_el$10","_tmpl$0","_$delegateEvents","ImageIcon","FileIcon","_$createComponent","_$setAttribute","_$memo","_$className","_$mergeProps","_$delegateEvents"],"sources":["../../../../src/components/ui/attachment/attachment.tsx"],"sourcesContent":["import {\n Archive,\n File as FileIcon,\n FileCode,\n FileText,\n Image as ImageIcon,\n LoaderCircle,\n TriangleAlert,\n X,\n} from 'lucide-solid'\nimport { Show, splitProps, type ComponentProps, type JSX } from 'solid-js'\nimport { formatByteSize } from '#lib/bytes'\nimport { FETCH_SCHEMES, urlWithScheme } from '#lib/url'\nimport { cn } from '#lib/utils'\nimport { Button } from '../button'\n\n/**\n * Attachment.\n *\n * A file that travels with a message or sits in the composer. Three\n * presentations of one thing: a `chip` (a line, for the composer and for a list\n * of many), a `card` (name, type and size, for a message's attachments), and a\n * `tile` (a preview image with the name beneath, for pictures).\n *\n * ## It only offers what works\n *\n * An attachment is a *claim that a file exists and can be handled*. This\n * component therefore draws an action only when the caller supplied the\n * handler: no `onOpen`/`href` and the name is plain text, not a dead button; no\n * `onRemove` and there is no ✕. A host whose attachments cannot be reopened (a\n * name the runtime echoed back, a file that was never stored) renders honest,\n * static chips instead of controls that do nothing.\n *\n * ## Untrusted metadata\n *\n * Name, type and size come from whoever sent the file. They are rendered as\n * text, the name is never used as a path or URL, and a preview is shown only\n * for `blob:`, `https:`/`http:` or a `data:image/*` raster source (no SVG, which\n * can carry script when opened on its own).\n *\n * `status` states the truth about the file's lifecycle in words (`uploading`,\n * `error`, `unavailable`), not by colour alone.\n */\nexport type AttachmentKind = 'image' | 'document' | 'code' | 'text' | 'archive' | 'other'\nexport type AttachmentStatus = 'ready' | 'uploading' | 'error' | 'unavailable'\nexport type AttachmentVariant = 'chip' | 'card' | 'tile'\n\nconst KIND_ICON = {\n image: ImageIcon,\n document: FileText,\n code: FileCode,\n text: FileText,\n archive: Archive,\n other: FileIcon,\n} as const\n\n/** The figure as written: whole numbers from 10 up, one decimal below. */\nconst shown = (amount: number) => (amount >= 10 ? Math.round(amount) : Math.round(amount * 10) / 10)\n\n/** `1536` → `1.5 KB`. Returns nothing for a value that is not a finite size. */\nexport function formatAttachmentSize(bytes: number | undefined): string | undefined {\n if (bytes === undefined || !Number.isFinite(bytes) || bytes < 0) return undefined\n return formatByteSize(bytes, ['KB', 'MB', 'GB', 'TB'], (value) => String(shown(value)))\n}\n\n/** The only sources a preview may use. */\nexport function safePreviewSrc(value: string | undefined): string | undefined {\n if (!value) return undefined\n if (value.startsWith('blob:')) return value\n if (/^data:image\\/(?:png|jpe?g|gif|webp|avif);base64,[A-Za-z0-9+/=]+$/.test(value)) return value\n return urlWithScheme(value, FETCH_SCHEMES) ? value : undefined\n}\n\nexport type AttachmentProps = Omit<ComponentProps<'div'>, 'children'> & {\n name: string\n kind?: AttachmentKind\n /** Bytes. */\n size?: number\n variant?: AttachmentVariant\n status?: AttachmentStatus\n /** 0–100 while `uploading`; omit for indeterminate. */\n progress?: number\n /** Why it failed or is unavailable, in words. */\n statusLabel?: string\n previewSrc?: string\n /** Open the file in the host. Omit and the name is not a control. */\n onOpen?: () => void\n /** Open the file by address. Omit and the name is not a link. */\n href?: string\n /** Detach it. Omit and there is no remove control. */\n onRemove?: () => void\n removeLabel?: string\n}\n\nexport function Attachment(props: AttachmentProps) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'name',\n 'kind',\n 'size',\n 'variant',\n 'status',\n 'progress',\n 'statusLabel',\n 'previewSrc',\n 'onOpen',\n 'href',\n 'onRemove',\n 'removeLabel',\n ])\n const variant = () => local.variant ?? 'chip'\n const status = () => local.status ?? 'ready'\n const preview = () => (local.kind === 'image' ? safePreviewSrc(local.previewSrc) : undefined)\n const Icon = () => KIND_ICON[local.kind ?? 'other']\n const size = () => formatAttachmentSize(local.size)\n const actionable = () => status() === 'ready' || status() === 'error'\n\n const mark = (): JSX.Element => {\n if (status() === 'uploading')\n return <LoaderCircle aria-hidden=\"true\" class=\"motion-safe:animate-spin\" />\n if (status() === 'error') return <TriangleAlert aria-hidden=\"true\" />\n const Glyph = Icon()\n return <Glyph aria-hidden=\"true\" />\n }\n\n const label = (): JSX.Element => (\n <span class=\"min-w-0 truncate font-medium\" title={local.name}>\n {local.name}\n </span>\n )\n\n const name = (): JSX.Element => (\n <Show\n when={actionable() && (local.href !== undefined || local.onOpen !== undefined)}\n fallback={label()}\n >\n <Show\n when={local.href !== undefined}\n fallback={\n <button\n type=\"button\"\n class=\"min-w-0 truncate rounded-xs text-start font-medium outline-none hover:underline focus-visible:ring-3 focus-visible:ring-primary-subtle\"\n title={local.name}\n onClick={() => local.onOpen?.()}\n >\n {local.name}\n </button>\n }\n >\n <a\n href={local.href}\n target=\"_blank\"\n rel=\"noreferrer noopener\"\n class=\"min-w-0 truncate rounded-xs font-medium outline-none hover:underline focus-visible:ring-3 focus-visible:ring-primary-subtle\"\n title={local.name}\n >\n {local.name}\n </a>\n </Show>\n </Show>\n )\n\n const detail = (): JSX.Element => (\n <Show when={status() !== 'ready' || size()}>\n <span\n class={cn('shrink-0 text-xs', {\n 'text-destructive': status() === 'error',\n 'text-muted-foreground': status() !== 'error',\n })}\n role={status() === 'uploading' || status() === 'error' ? 'status' : undefined}\n >\n {status() === 'uploading'\n ? local.progress === undefined\n ? 'Uploading…'\n : `Uploading ${Math.round(local.progress)}%`\n : status() === 'error'\n ? (local.statusLabel ?? 'Could not attach')\n : status() === 'unavailable'\n ? (local.statusLabel ?? 'Unavailable')\n : size()}\n </span>\n </Show>\n )\n\n const remove = (): JSX.Element => (\n <Show when={local.onRemove}>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon-2xs\"\n class=\"shrink-0\"\n aria-label={local.removeLabel ?? `Remove ${local.name}`}\n onClick={() => local.onRemove?.()}\n >\n <X aria-hidden=\"true\" />\n </Button>\n </Show>\n )\n\n return (\n <div\n data-slot=\"attachment\"\n data-variant={variant()}\n data-status={status()}\n class={cn(\n 'min-w-0 text-sm',\n {\n 'inline-flex max-w-full items-center gap-1.5 rounded-lg border border-border bg-card py-1 ps-2 pe-1':\n variant() === 'chip',\n 'flex w-full max-w-sm items-center gap-2.5 rounded-xl border border-border bg-card p-2':\n variant() === 'card',\n 'flex w-32 flex-col gap-1.5': variant() === 'tile',\n 'border-destructive': status() === 'error',\n 'opacity-70': status() === 'unavailable',\n },\n local.class\n )}\n {...rest}\n >\n <Show\n when={variant() === 'tile'}\n fallback={\n <>\n <span\n class={cn('grid shrink-0 place-items-center text-muted-foreground [&_svg]:size-4', {\n 'size-9 overflow-hidden rounded-lg bg-muted': variant() === 'card',\n 'text-destructive': status() === 'error',\n })}\n >\n <Show when={preview() && variant() === 'card'} fallback={mark()}>\n <img src={preview()} alt=\"\" class=\"size-full object-cover\" />\n </Show>\n </span>\n <span class=\"flex min-w-0 flex-1 items-center gap-2\">\n {name()}\n {detail()}\n </span>\n {remove()}\n </>\n }\n >\n <span class=\"relative grid aspect-square w-full place-items-center overflow-hidden rounded-xl border border-border bg-muted text-muted-foreground [&_svg]:size-6\">\n <Show when={preview()} fallback={mark()}>\n <img src={preview()} alt=\"\" class=\"size-full object-cover\" />\n </Show>\n </span>\n <span class=\"flex min-w-0 items-center gap-1\">\n {name()}\n {remove()}\n </span>\n {detail()}\n </Show>\n </div>\n )\n}\n\nexport function AttachmentList(props: ComponentProps<'ul'>) {\n const [local, rest] = splitProps(props, ['class', 'children'])\n return (\n <ul\n role=\"list\"\n data-slot=\"attachment-list\"\n class={cn('m-0 flex min-w-0 list-none flex-wrap gap-2 p-0', local.class)}\n {...rest}\n >\n {local.children}\n </ul>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA+CA,IAAMsB,YAAY;CAChBC,OAAOjB;CACPkB,UAAUpB;CACVqB,MAAMtB;CACNuB,MAAMtB;CACNuB,SAAS3B;CACT4B,OAAO1B;AACT;;AAGA,IAAM4B,SAASC,WAAoBA,UAAU,KAAKC,KAAKC,MAAMF,MAAM,IAAIC,KAAKC,MAAMF,SAAS,EAAE,IAAI;;AAGjG,SAAgBG,qBAAqBC,OAA+C;CAClF,IAAIA,UAAUC,KAAAA,KAAa,CAACC,OAAOC,SAASH,KAAK,KAAKA,QAAQ,GAAG,OAAOC,KAAAA;CACxE,OAAOtB,eAAeqB,OAAO;EAAC;EAAM;EAAM;EAAM;CAAI,IAAII,UAAUC,OAAOV,MAAMS,KAAK,CAAC,CAAC;AACxF;;AAGA,SAAgBE,eAAeF,OAA+C;CAC5E,IAAI,CAACA,OAAO,OAAOH,KAAAA;CACnB,IAAIG,MAAMG,WAAW,OAAO,GAAG,OAAOH;CACtC,IAAI,mEAAmEI,KAAKJ,KAAK,GAAG,OAAOA;CAC3F,OAAOvB,cAAcuB,OAAOxB,aAAa,IAAIwB,QAAQH,KAAAA;AACvD;AAuBA,SAAgBsB,WAAWC,OAAwB;CACjD,MAAM,CAACC,OAAOC,QAAQlD,WAAWgD,OAAO;EACtC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;C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AA,CAAA;EAAA,OAAAW;CAAA,EAAA,CAAA;AAIjB;AAEA,SAAgBiB,eAAe1D,OAA6B;CAC1D,MAAM,CAACC,OAAOC,QAAQlD,WAAWgD,OAAO,CAAC,SAAS,UAAU,CAAC;CAC7D,cAAA;EAAA,IAAA2D,SAAAC,QAAA;EAAAjB,OAAAgB,QAAAf,WAAA,EAAA,KAAA,WAAA;GAAA,OAIWtF,GAAG,kDAAkD2C,MAAM8C,KAAK;EAAC,EAAA,GACpE7C,IAAI,GAAA,OAAA,IAAA;EAAAW,OAAA8C,cAEP1D,MAAMkB,QAAQ;EAAA,OAAAwC;CAAA,EAAA,CAAA;AAGrB;AAACE,eAAA,CAAA,OAAA,CAAA"}
1
+ {"version":3,"file":"attachment.js","names":["Archive","FileIcon","FileCode","FileText","ImageIcon","LoaderCircle","TriangleAlert","X","Show","splitProps","formatByteSize","FETCH_SCHEMES","urlWithScheme","cn","Button","KIND_ICON","image","document","code","text","archive","other","shown","amount","Math","round","formatAttachmentSize","bytes","undefined","Number","isFinite","value","String","safePreviewSrc","startsWith","test","name","kind","size","variant","status","progress","statusLabel","previewSrc","onOpen","href","onRemove","removeLabel","Attachment","props","local","rest","preview","Icon","actionable","mark","_$createComponent","Glyph","label","_el$","_tmpl$","_$insert","_$effect","_$setAttribute","when","_$memo","fallback","children","_el$3","_tmpl$3","$$click","_el$2","_tmpl$2","_p$","_v$","_v$2","e","t","detail","_el$4","_tmpl$4","_c$","_v$3","_v$4","_$className","remove","type","onClick","_el$5","_tmpl$8","_$spread","_$mergeProps","class","_el$9","_el$0","_tmpl$5","_el$1","_tmpl$9","_el$6","_tmpl$6","_el$7","_el$8","_tmpl$7","AttachmentList","_el$10","_tmpl$0","_$delegateEvents"],"sources":["../../../../src/components/ui/attachment/attachment.tsx"],"sourcesContent":["import {\n Archive,\n File as FileIcon,\n FileCode,\n FileText,\n Image as ImageIcon,\n LoaderCircle,\n TriangleAlert,\n X,\n} from 'lucide-solid'\nimport { Show, splitProps, type ComponentProps, type JSX } from 'solid-js'\nimport { formatByteSize } from '#lib/bytes'\nimport { FETCH_SCHEMES, urlWithScheme } from '#lib/url'\nimport { cn } from '#lib/utils'\nimport { Button } from '../button'\n\n/**\n * Attachment.\n *\n * A file that travels with a message or sits in the composer. Three\n * presentations of one thing: a `chip` (a line, for the composer and for a list\n * of many), a `card` (name, type and size, for a message's attachments), and a\n * `tile` (a preview image with the name beneath, for pictures).\n *\n * ## It only offers what works\n *\n * An attachment is a *claim that a file exists and can be handled*. This\n * component therefore draws an action only when the caller supplied the\n * handler: no `onOpen`/`href` and the name is plain text, not a dead button; no\n * `onRemove` and there is no ✕. A host whose attachments cannot be reopened (a\n * name the runtime echoed back, a file that was never stored) renders honest,\n * static chips instead of controls that do nothing.\n *\n * ## Untrusted metadata\n *\n * Name, type and size come from whoever sent the file. They are rendered as\n * text, the name is never used as a path or URL, and a preview is shown only\n * for `blob:`, `https:`/`http:` or a `data:image/*` raster source (no SVG, which\n * can carry script when opened on its own).\n *\n * `status` states the truth about the file's lifecycle in words (`uploading`,\n * `error`, `unavailable`), not by colour alone.\n */\nexport type AttachmentKind = 'image' | 'document' | 'code' | 'text' | 'archive' | 'other'\nexport type AttachmentStatus = 'ready' | 'uploading' | 'error' | 'unavailable'\nexport type AttachmentVariant = 'chip' | 'card' | 'tile'\n\nconst KIND_ICON = {\n image: ImageIcon,\n document: FileText,\n code: FileCode,\n text: FileText,\n archive: Archive,\n other: FileIcon,\n} as const\n\n/** The figure as written: whole numbers from 10 up, one decimal below. */\nconst shown = (amount: number) => (amount >= 10 ? Math.round(amount) : Math.round(amount * 10) / 10)\n\n/** `1536` → `1.5 KB`. Returns nothing for a value that is not a finite size. */\nexport function formatAttachmentSize(bytes: number | undefined): string | undefined {\n if (bytes === undefined || !Number.isFinite(bytes) || bytes < 0) return undefined\n return formatByteSize(bytes, ['KB', 'MB', 'GB', 'TB'], (value) => String(shown(value)))\n}\n\n/** The only sources a preview may use. */\nexport function safePreviewSrc(value: string | undefined): string | undefined {\n if (!value) return undefined\n if (value.startsWith('blob:')) return value\n if (/^data:image\\/(?:png|jpe?g|gif|webp|avif);base64,[A-Za-z0-9+/=]+$/.test(value)) return value\n return urlWithScheme(value, FETCH_SCHEMES) ? value : undefined\n}\n\nexport type AttachmentProps = Omit<ComponentProps<'div'>, 'children'> & {\n name: string\n kind?: AttachmentKind\n /** Bytes. */\n size?: number\n variant?: AttachmentVariant\n status?: AttachmentStatus\n /** 0–100 while `uploading`; omit for indeterminate. */\n progress?: number\n /** Why it failed or is unavailable, in words. */\n statusLabel?: string\n previewSrc?: string\n /** Open the file in the host. Omit and the name is not a control. */\n onOpen?: () => void\n /** Open the file by address. Omit and the name is not a link. */\n href?: string\n /** Detach it. Omit and there is no remove control. */\n onRemove?: () => void\n removeLabel?: string\n}\n\nexport function Attachment(props: AttachmentProps) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'name',\n 'kind',\n 'size',\n 'variant',\n 'status',\n 'progress',\n 'statusLabel',\n 'previewSrc',\n 'onOpen',\n 'href',\n 'onRemove',\n 'removeLabel',\n ])\n const variant = () => local.variant ?? 'chip'\n const status = () => local.status ?? 'ready'\n const preview = () => (local.kind === 'image' ? safePreviewSrc(local.previewSrc) : undefined)\n const Icon = () => KIND_ICON[local.kind ?? 'other']\n const size = () => formatAttachmentSize(local.size)\n const actionable = () => status() === 'ready' || status() === 'error'\n\n const mark = (): JSX.Element => {\n if (status() === 'uploading')\n return <LoaderCircle aria-hidden=\"true\" class=\"motion-safe:animate-spin\" />\n if (status() === 'error') return <TriangleAlert aria-hidden=\"true\" />\n const Glyph = Icon()\n return <Glyph aria-hidden=\"true\" />\n }\n\n const label = (): JSX.Element => (\n <span class=\"min-w-0 truncate font-medium\" title={local.name}>\n {local.name}\n </span>\n )\n\n const name = (): JSX.Element => (\n <Show\n when={actionable() && (local.href !== undefined || local.onOpen !== undefined)}\n fallback={label()}\n >\n <Show\n when={local.href !== undefined}\n fallback={\n <button\n type=\"button\"\n class=\"min-w-0 truncate rounded-xs text-start font-medium outline-none hover:underline focus-visible:ring-3 focus-visible:ring-primary-subtle\"\n title={local.name}\n onClick={() => local.onOpen?.()}\n >\n {local.name}\n </button>\n }\n >\n <a\n href={local.href}\n target=\"_blank\"\n rel=\"noreferrer noopener\"\n class=\"min-w-0 truncate rounded-xs font-medium outline-none hover:underline focus-visible:ring-3 focus-visible:ring-primary-subtle\"\n title={local.name}\n >\n {local.name}\n </a>\n </Show>\n </Show>\n )\n\n const detail = (): JSX.Element => (\n <Show when={status() !== 'ready' || size()}>\n <span\n class={cn('shrink-0 text-xs', {\n 'text-destructive': status() === 'error',\n 'text-muted-foreground': status() !== 'error',\n })}\n role={status() === 'uploading' || status() === 'error' ? 'status' : undefined}\n >\n {status() === 'uploading'\n ? local.progress === undefined\n ? 'Uploading…'\n : `Uploading ${Math.round(local.progress)}%`\n : status() === 'error'\n ? (local.statusLabel ?? 'Could not attach')\n : status() === 'unavailable'\n ? (local.statusLabel ?? 'Unavailable')\n : size()}\n </span>\n </Show>\n )\n\n const remove = (): JSX.Element => (\n <Show when={local.onRemove}>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon-2xs\"\n class=\"shrink-0\"\n aria-label={local.removeLabel ?? `Remove ${local.name}`}\n onClick={() => local.onRemove?.()}\n >\n <X aria-hidden=\"true\" />\n </Button>\n </Show>\n )\n\n return (\n <div\n data-slot=\"attachment\"\n data-variant={variant()}\n data-status={status()}\n class={cn(\n 'min-w-0 text-sm',\n {\n 'inline-flex max-w-full items-center gap-1.5 rounded-lg border border-border bg-card py-1 ps-2 pe-1':\n variant() === 'chip',\n 'flex w-full max-w-sm items-center gap-2.5 rounded-xl border border-border bg-card p-2':\n variant() === 'card',\n 'flex w-32 flex-col gap-1.5': variant() === 'tile',\n 'border-destructive': status() === 'error',\n 'opacity-70': status() === 'unavailable',\n },\n local.class\n )}\n {...rest}\n >\n <Show\n when={variant() === 'tile'}\n fallback={\n <>\n <span\n class={cn('grid shrink-0 place-items-center text-muted-foreground [&_svg]:size-4', {\n 'size-9 overflow-hidden rounded-lg bg-muted': variant() === 'card',\n 'text-destructive': status() === 'error',\n })}\n >\n <Show when={preview() && variant() === 'card'} fallback={mark()}>\n <img src={preview()} alt=\"\" class=\"size-full object-cover\" />\n </Show>\n </span>\n <span class=\"flex min-w-0 flex-1 items-center gap-2\">\n {name()}\n {detail()}\n </span>\n {remove()}\n </>\n }\n >\n <span class=\"relative grid aspect-square w-full place-items-center overflow-hidden rounded-xl border border-border bg-muted text-muted-foreground [&_svg]:size-6\">\n <Show when={preview()} fallback={mark()}>\n <img src={preview()} alt=\"\" class=\"size-full object-cover\" />\n </Show>\n </span>\n <span class=\"flex min-w-0 items-center gap-1\">\n {name()}\n {remove()}\n </span>\n {detail()}\n </Show>\n </div>\n )\n}\n\nexport function AttachmentList(props: ComponentProps<'ul'>) {\n const [local, rest] = splitProps(props, ['class', 'children'])\n return (\n <ul\n role=\"list\"\n data-slot=\"attachment-list\"\n class={cn('m-0 flex min-w-0 list-none flex-wrap gap-2 p-0', local.class)}\n {...rest}\n >\n {local.children}\n </ul>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA+CA,IAAMe,YAAY;CAChBC,OAAOZ;CACPa,UAAUd;CACVe,MAAMhB;CACNiB,MAAMhB;CACNiB,SAASpB;CACTqB,OAAOpB;AACT;;AAGA,IAAMqB,SAASC,WAAoBA,UAAU,KAAKC,KAAKC,MAAMF,MAAM,IAAIC,KAAKC,MAAMF,SAAS,EAAE,IAAI;;AAGjG,SAAgBG,qBAAqBC,OAA+C;CAClF,IAAIA,UAAUC,KAAAA,KAAa,CAACC,OAAOC,SAASH,KAAK,KAAKA,QAAQ,GAAG,OAAOC,KAAAA;CACxE,OAAOlB,eAAeiB,OAAO;EAAC;EAAM;EAAM;EAAM;CAAI,IAAII,UAAUC,OAAOV,MAAMS,KAAK,CAAC,CAAC;AACxF;;AAGA,SAAgBE,eAAeF,OAA+C;CAC5E,IAAI,CAACA,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AAL,QAAA;QAAAjC,aAAAC,aAAAqC,OAAA,OAC3BhD,QAAQ,CAAC,CAAA;QAAA,OAAAgD;OAAA;MAAA,CAAA,CAAA;MAAA,OAAAF;KAAA,EAAA,CAAA;YAAA;MAAA,IAAAG,QAAAC,QAAA;MAAAzC,OAAAwC,OAIpBjE,MAAI,IAAA;MAAAyB,OAAAwC,OACJhB,QAAM,IAAA;MAAA,OAAAgB;KAAA,EAAA,CAAA;KAAApC,WAERa,OAAO,CAAC;IAAA;GAAA;EAAA,CAAA,CAAA;EAAA,OAAAU;CAAA,EAAA,CAAA;AAIjB;AAEA,SAAgBe,eAAetD,OAA6B;CAC1D,MAAM,CAACC,OAAOC,QAAQ1C,WAAWwC,OAAO,CAAC,SAAS,UAAU,CAAC;CAC7D,cAAA;EAAA,IAAAuD,SAAAC,QAAA;EAAAf,OAAAc,QAAAb,WAAA,EAAA,KAAA,WAAA;GAAA,OAIW9E,GAAG,kDAAkDqC,MAAM0C,KAAK;EAAC,EAAA,GACpEzC,IAAI,GAAA,OAAA,IAAA;EAAAU,OAAA2C,cAEPtD,MAAMiB,QAAQ;EAAA,OAAAqC;CAAA,EAAA,CAAA;AAGrB;AAACE,eAAA,CAAA,OAAA,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"avatar.js","names":["ComponentProps","createSignal","onCleanup","Show","splitProps","cn","initialsFrom","name","parts","trim","split","filter","Boolean","first","last","length","toUpperCase","avatarSizes","xs","sm","md","lg","xl","const","AvatarProps","size","Avatar","props","local","rest","_el$","_tmpl$","_$spread","_$mergeProps","class","AvatarImageProps","Omit","onLoadingStatusChange","status","AvatarImage","setStatus","update","next","_$createComponent","when","children","_el$2","_tmpl$2","addEventListener","alt","AvatarFallbackProps","content","delay","AvatarFallback","revealed","setRevealed","timer","setTimeout","clearTimeout","label","_el$3","_tmpl$3","_el$4","firstChild","_$insert","_c$","_$memo","_el$5","_tmpl$4","_$mergeProps","_$createComponent","_$memo"],"sources":["../../../../src/components/ui/avatar/avatar.tsx"],"sourcesContent":["import type { ComponentProps } from 'solid-js'\nimport { createSignal, onCleanup, Show, splitProps } from 'solid-js'\nimport { cn } from '#lib/utils'\n\n/**\n * Avatar.\n *\n * The fallback is painted *under* the image and the image is removed on error,\n * which is the arrangement that avoids every flicker case: a cached image\n * covers the fallback on the first paint, a slow image shows the fallback\n * until it arrives, and a broken image leaves the fallback in place instead of\n * a browser glyph.\n *\n * Initials are derived here so the rule lives in one place rather than in\n * every caller's string slicing: two words give two letters, one word gives\n * one, and a name with no letters gives nothing rather than a stray dot.\n */\nexport function initialsFrom(name: string): string {\n const parts = name.trim().split(/\\s+/).filter(Boolean)\n const first = parts[0]?.[0] ?? ''\n if (!first) return ''\n const last = parts.length > 1 ? (parts[parts.length - 1]?.[0] ?? '') : ''\n return (first + last).toUpperCase()\n}\n\nconst avatarSizes = {\n xs: 'size-5 text-2xs',\n sm: 'size-6 text-2xs',\n md: 'size-8 text-xs',\n lg: 'size-10 text-sm',\n xl: 'size-12 text-base',\n} as const\n\nexport type AvatarProps = ComponentProps<'span'> & {\n size?: keyof typeof avatarSizes\n}\n\nexport function Avatar(props: AvatarProps) {\n const [local, rest] = splitProps(props, ['class', 'size'])\n\n return (\n <span\n data-slot=\"avatar\"\n class={cn(\n 'relative flex shrink-0 overflow-hidden rounded-full select-none',\n avatarSizes[local.size ?? 'md'],\n local.class\n )}\n {...rest}\n />\n )\n}\n\nexport type AvatarImageProps = Omit<ComponentProps<'img'>, 'onError'> & {\n onLoadingStatusChange?: (status: 'loading' | 'loaded' | 'error') => void\n}\n\nexport function AvatarImage(props: AvatarImageProps) {\n const [local, rest] = splitProps(props, ['class', 'alt', 'onLoadingStatusChange'])\n const [status, setStatus] = createSignal<'loading' | 'loaded' | 'error'>('loading')\n\n const update = (next: 'loading' | 'loaded' | 'error') => {\n setStatus(next)\n local.onLoadingStatusChange?.(next)\n }\n\n return (\n <Show when={status() !== 'error'}>\n <img\n data-slot=\"avatar-image\"\n alt={local.alt ?? ''}\n class={cn('absolute inset-0 z-10 aspect-square size-full object-cover', local.class)}\n onLoad={() => update('loaded')}\n onError={() => update('error')}\n {...rest}\n />\n </Show>\n )\n}\n\nexport type AvatarFallbackProps = ComponentProps<'span'> & {\n /** A person or entity name. Initials are derived from it. */\n name?: string\n /** Replace the derived initials with a glyph or emoji string. */\n content?: string\n /** How long to wait before showing the fallback, in ms. 0 shows it at once. */\n delay?: number\n}\n\nexport function AvatarFallback(props: AvatarFallbackProps) {\n const [local, rest] = splitProps(props, ['class', 'name', 'content', 'delay'])\n const [revealed, setRevealed] = createSignal((local.delay ?? 0) <= 0)\n\n if ((local.delay ?? 0) > 0) {\n const timer = setTimeout(() => setRevealed(true), local.delay)\n onCleanup(() => clearTimeout(timer))\n }\n\n const label = () => local.content ?? initialsFrom(local.name ?? '')\n\n return (\n <span\n data-slot=\"avatar-fallback\"\n class={cn(\n 'bg-muted text-muted-foreground flex size-full items-center justify-center rounded-full font-medium',\n { 'opacity-0': !revealed() },\n local.class\n )}\n {...rest}\n >\n <span aria-hidden=\"true\">{label()}</span>\n {local.name ? <span class=\"visually-hidden\">{local.name}</span> : null}\n </span>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAiBA,SAAgBM,aAAaC,MAAsB;CACjD,MAAMC,QAAQD,KAAKE,KAAK,CAAC,CAACC,MAAM,KAAK,CAAC,CAACC,OAAOC,OAAO;CACrD,MAAMC,QAAQL,MAAM,EAAE,GAAG,MAAM;CAC/B,IAAI,CAACK,OAAO,OAAO;CAEnB,QAAQA,SADKL,MAAMO,SAAS,IAAKP,MAAMA,MAAMO,SAAS,EAAE,GAAG,MAAM,KAAM,IAAA,CACjDC,YAAY;AACpC;AAEA,IAAMC,cAAc;CAClBC,IAAI;CACJC,IAAI;CACJC,IAAI;CACJC,IAAI;CACJC,IAAI;AACN;AAMA,SAAgBI,OAAOC,OAAoB;CACzC,MAAM,CAACC,OAAOC,QAAQzB,WAAWuB,OAAO,CAAC,SAAS,MAAM,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BAAgBwD,aAAaF,KAAK,CAAC;CACrC;CAEA,MAAMG,cAAc/B,MAAMuB,WAAW7C,aAAasB,MAAMrB,QAAQ,EAAE;CAElE,cAAA;EAAA,IAAAqD,QAAAC,QAAA,GAAAC,QAAAF,MAAAG;EAAA/B,OAAA4B,OAAA3B,WAAA,EAAA,KAAA,WAAA;GAAA,OAGW5B,GACL,sGACA,EAAE,aAAa,CAACiD,SAAS,EAAE,GAC3B1B,MAAMM,KACR;EAAC,EAAA,GACGL,IAAI,GAAA,OAAA,IAAA;EAAAmC,OAAAF,OAEkBH,KAAK;EAAAK,OAAAJ,cAAA;GAAA,IAAAK,MAAAC,WAAA,CAAA,CAC9BtC,MAAMrB,IAAI;GAAA,aAAV0D,IAAA,WAAA;IAAA,IAAAE,QAAAC,QAAA;IAAAJ,OAAAG,aAA4CvC,MAAMrB,IAAI;IAAA,OAAA4D;GAAA,EAAA,CAAA,IAAW;EAAI,EAAA,CAAA,GAAA,IAAA;EAAA,OAAAP;CAAA,EAAA,CAAA;AAG5E"}
1
+ {"version":3,"file":"avatar.js","names":["createSignal","onCleanup","Show","splitProps","cn","initialsFrom","name","parts","trim","split","filter","Boolean","first","last","length","toUpperCase","avatarSizes","xs","sm","md","lg","xl","size","Avatar","props","local","rest","_el$","_tmpl$","_$spread","_$mergeProps","class","onLoadingStatusChange","status","AvatarImage","setStatus","update","next","_$createComponent","when","children","_el$2","_tmpl$2","addEventListener","alt","content","delay","AvatarFallback","revealed","setRevealed","timer","setTimeout","clearTimeout","label","_el$3","_tmpl$3","_el$4","firstChild","_$insert","_c$","_$memo","_el$5","_tmpl$4"],"sources":["../../../../src/components/ui/avatar/avatar.tsx"],"sourcesContent":["import type { ComponentProps } from 'solid-js'\nimport { createSignal, onCleanup, Show, splitProps } from 'solid-js'\nimport { cn } from '#lib/utils'\n\n/**\n * Avatar.\n *\n * The fallback is painted *under* the image and the image is removed on error,\n * which is the arrangement that avoids every flicker case: a cached image\n * covers the fallback on the first paint, a slow image shows the fallback\n * until it arrives, and a broken image leaves the fallback in place instead of\n * a browser glyph.\n *\n * Initials are derived here so the rule lives in one place rather than in\n * every caller's string slicing: two words give two letters, one word gives\n * one, and a name with no letters gives nothing rather than a stray dot.\n */\nexport function initialsFrom(name: string): string {\n const parts = name.trim().split(/\\s+/).filter(Boolean)\n const first = parts[0]?.[0] ?? ''\n if (!first) return ''\n const last = parts.length > 1 ? (parts[parts.length - 1]?.[0] ?? '') : ''\n return (first + last).toUpperCase()\n}\n\nconst avatarSizes = {\n xs: 'size-5 text-2xs',\n sm: 'size-6 text-2xs',\n md: 'size-8 text-xs',\n lg: 'size-10 text-sm',\n xl: 'size-12 text-base',\n} as const\n\nexport type AvatarProps = ComponentProps<'span'> & {\n size?: keyof typeof avatarSizes\n}\n\nexport function Avatar(props: AvatarProps) {\n const [local, rest] = splitProps(props, ['class', 'size'])\n\n return (\n <span\n data-slot=\"avatar\"\n class={cn(\n 'relative flex shrink-0 overflow-hidden rounded-full select-none',\n avatarSizes[local.size ?? 'md'],\n local.class\n )}\n {...rest}\n />\n )\n}\n\nexport type AvatarImageProps = Omit<ComponentProps<'img'>, 'onError'> & {\n onLoadingStatusChange?: (status: 'loading' | 'loaded' | 'error') => void\n}\n\nexport function AvatarImage(props: AvatarImageProps) {\n const [local, rest] = splitProps(props, ['class', 'alt', 'onLoadingStatusChange'])\n const [status, setStatus] = createSignal<'loading' | 'loaded' | 'error'>('loading')\n\n const update = (next: 'loading' | 'loaded' | 'error') => {\n setStatus(next)\n local.onLoadingStatusChange?.(next)\n }\n\n return (\n <Show when={status() !== 'error'}>\n <img\n data-slot=\"avatar-image\"\n alt={local.alt ?? ''}\n class={cn('absolute inset-0 z-10 aspect-square size-full object-cover', local.class)}\n onLoad={() => update('loaded')}\n onError={() => update('error')}\n {...rest}\n />\n </Show>\n )\n}\n\nexport type AvatarFallbackProps = ComponentProps<'span'> & {\n /** A person or entity name. Initials are derived from it. */\n name?: string\n /** Replace the derived initials with a glyph or emoji string. */\n content?: string\n /** How long to wait before showing the fallback, in ms. 0 shows it at once. */\n delay?: number\n}\n\nexport function AvatarFallback(props: AvatarFallbackProps) {\n const [local, rest] = splitProps(props, ['class', 'name', 'content', 'delay'])\n const [revealed, setRevealed] = createSignal((local.delay ?? 0) <= 0)\n\n if ((local.delay ?? 0) > 0) {\n const timer = setTimeout(() => setRevealed(true), local.delay)\n onCleanup(() => clearTimeout(timer))\n }\n\n const label = () => local.content ?? initialsFrom(local.name ?? '')\n\n return (\n <span\n data-slot=\"avatar-fallback\"\n class={cn(\n 'bg-muted text-muted-foreground flex size-full items-center justify-center rounded-full font-medium',\n { 'opacity-0': !revealed() },\n local.class\n )}\n {...rest}\n >\n <span aria-hidden=\"true\">{label()}</span>\n {local.name ? <span class=\"visually-hidden\">{local.name}</span> : null}\n </span>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAiBA,SAAgBK,aAAaC,MAAsB;CACjD,MAAMC,QAAQD,KAAKE,KAAK,CAAC,CAACC,MAAM,KAAK,CAAC,CAACC,OAAOC,OAAO;CACrD,MAAMC,QAAQL,MAAM,EAAE,GAAG,MAAM;CAC/B,IAAI,CAACK,OAAO,OAAO;CAEnB,QAAQA,SADKL,MAAMO,SAAS,IAAKP,MAAMA,MAAMO,SAAS,EAAE,GAAG,MAAM,KAAM,IAAA,CACjDC,YAAY;AACpC;AAEA,IAAMC,cAAc;CAClBC,IAAI;CACJC,IAAI;CACJC,IAAI;CACJC,IAAI;CACJC,IAAI;AACN;AAMA,SAAgBE,OAAOC,OAAoB;CACzC,MAAM,CAACC,OAAOC,QAAQvB,WAAWqB,OAAO,CAAC,SAAS,MAAM,CAAC;CAEzD,cAAA;EAAA,IAAAG,OAAAC,OAAA;EAAAC,OAAAF,MAAAG,WAAA,EAAA,KAAA,WAAA;GAAA,OAGW1B,GACL,mEACAY,YAAYS,MAAMH,QAAQ,OAC1BG,MAAMM,KACR;EAAC,EAAA,GACGL,IAAI,GAAA,OAAA,KAAA;EAAA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AAA;GAAA,OAGW1B,GACL,sGACA,EAAE,aAAa,CAAC4C,SAAS,EAAE,GAC3BvB,MAAMM,KACR;EAAC,EAAA,GACGL,IAAI,GAAA,OAAA,IAAA;EAAAgC,OAAAF,OAEkBH,KAAK;EAAAK,OAAAJ,cAAA;GAAA,IAAAK,MAAAC,WAAA,CAAA,CAC9BnC,MAAMnB,IAAI;GAAA,aAAVqD,IAAA,WAAA;IAAA,IAAAE,QAAAC,QAAA;IAAAJ,OAAAG,aAA4CpC,MAAMnB,IAAI;IAAA,OAAAuD;GAAA,EAAA,CAAA,IAAW;EAAI,EAAA,CAAA,GAAA,IAAA;EAAA,OAAAP;CAAA,EAAA,CAAA;AAG5E"}
@@ -1 +1 @@
1
- {"version":3,"file":"badge.js","names":["Polymorphic","PolymorphicProps","ComponentProps","splitProps","ValidComponent","cva","VariantProps","cn","badgeVariants","variants","variant","default","secondary","outline","success","warning","destructive","info","subtle","notification","size","sm","md","lg","defaultVariants","BadgeVariantProps","BadgeProps","T","class","Badge","props","local","rest","_$createComponent","_$mergeProps","as","_$createComponent","_$mergeProps"],"sources":["../../../../src/components/ui/badge/badge.tsx"],"sourcesContent":["import { Polymorphic, type PolymorphicProps } from '@kobalte/core/polymorphic'\nimport { type ComponentProps, splitProps, type ValidComponent } from 'solid-js'\nimport { cva, type VariantProps } from '#lib/variants'\nimport { cn } from '#lib/utils'\n\n/**\n * Badge.\n *\n * A short, non-interactive status label. If it can be clicked it is a Button\n * with `size=\"2xs\"`, not a Badge — the difference matters because a Badge\n * carries no focus or pressed state and must never be the only way to reach an\n * action.\n */\nexport const badgeVariants = cva(\n 'inline-flex w-fit shrink-0 items-center justify-center gap-1 whitespace-nowrap rounded-md border border-transparent font-medium transition-colors [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg]:size-3',\n {\n variants: {\n variant: {\n default: 'bg-primary text-primary-foreground',\n secondary: 'bg-secondary text-secondary-foreground',\n outline: 'border-border text-foreground',\n /**\n * Tinted status fills, for counts and states rather than actions. The\n * word stays in `foreground` for contrast; the glyph takes the status\n * hue, so tags of different tones read apart at a glance.\n */\n success: 'bg-success-subtle text-foreground [&_svg]:text-success',\n warning: 'bg-warning-subtle text-foreground [&_svg]:text-warning',\n destructive: 'bg-destructive-subtle text-foreground [&_svg]:text-destructive',\n info: 'bg-info-subtle text-foreground [&_svg]:text-info',\n subtle: 'bg-primary-subtle text-primary',\n /**\n * A count that asks for attention, pinned to a corner of another control\n * (a workspace mark, a rail icon). At `sm` it is a 2xs label on whatever\n * surface sits behind the corner, where the destructive tint all but\n * disappears — so it takes the solid, contrast-measured action fill.\n */\n notification: 'bg-destructive-action text-destructive-action-foreground',\n },\n size: {\n sm: 'h-4 px-1.5 text-2xs',\n md: 'h-5 px-2 text-xs',\n lg: 'h-6 px-2.5 text-xs',\n },\n },\n defaultVariants: {\n variant: 'default',\n size: 'md',\n },\n }\n)\n\ntype BadgeVariantProps = VariantProps<typeof badgeVariants>\n\nexport type BadgeProps<T extends ValidComponent = 'span'> = PolymorphicProps<\n T,\n BadgeVariantProps & { class?: string }\n>\n\nexport function Badge<T extends ValidComponent = 'span'>(props: BadgeProps<T>) {\n const [local, rest] = splitProps(props as BadgeProps, ['variant', 'size', 'class'])\n\n return (\n <Polymorphic\n as=\"span\"\n data-slot=\"badge\"\n class={cn(badgeVariants({ variant: local.variant, size: local.size }), local.class)}\n {...(rest as ComponentProps<'span'>)}\n />\n )\n}\n"],"mappings":";;;;;;;;;;;;;;AAaA,IAAaQ,gBAAgBH,IAC3B,iNACA;CACEI,UAAU;EACRC,SAAS;GACPC,SAAS;GACTC,WAAW;GACXC,SAAS;;;;;;GAMTC,SAAS;GACTC,SAAS;GACTC,aAAa;GACbC,MAAM;GACNC,QAAQ;;;;;;;GAORC,cAAc;EAChB;EACAC,MAAM;GACJC,IAAI;GACJC,IAAI;GACJC,IAAI;EACN;CACF;CACAC,iBAAiB;EACfd,SAAS;EACTU,MAAM;CACR;AACF,CACF;AASA,SAAgBS,MAAyCC,OAAsB;CAC7E,MAAM,CAACC,OAAOC,QAAQ7B,WAAW2B,OAAqB;EAAC;EAAW;EAAQ;CAAO,CAAC;CAElF,OAAAG,gBACGjC,aAAWkC,WAAA;EACVC,IAAE;EAAA,aAAA;EAAA,KAAA,WAAA;GAAA,OAEK5B,GAAGC,cAAc;IAAEE,SAASqB,MAAMrB;IAASU,MAAMW,MAAMX;GAAK,CAAC,GAAGW,MAAMH,KAAK;EAAC;CAAA,GAC9EI,IAA8B,CAAA;AAGzC"}
1
+ {"version":3,"file":"badge.js","names":["Polymorphic","splitProps","cva","cn","badgeVariants","variants","variant","default","secondary","outline","success","warning","destructive","info","subtle","notification","size","sm","md","lg","defaultVariants","class","Badge","props","local","rest","_$createComponent","_$mergeProps","as"],"sources":["../../../../src/components/ui/badge/badge.tsx"],"sourcesContent":["import { Polymorphic, type PolymorphicProps } from '@kobalte/core/polymorphic'\nimport { type ComponentProps, splitProps, type ValidComponent } from 'solid-js'\nimport { cva, type VariantProps } from '#lib/variants'\nimport { cn } from '#lib/utils'\n\n/**\n * Badge.\n *\n * A short, non-interactive status label. If it can be clicked it is a Button\n * with `size=\"2xs\"`, not a Badge — the difference matters because a Badge\n * carries no focus or pressed state and must never be the only way to reach an\n * action.\n */\nexport const badgeVariants = cva(\n 'inline-flex w-fit shrink-0 items-center justify-center gap-1 whitespace-nowrap rounded-md border border-transparent font-medium transition-colors [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg]:size-3',\n {\n variants: {\n variant: {\n default: 'bg-primary text-primary-foreground',\n secondary: 'bg-secondary text-secondary-foreground',\n outline: 'border-border text-foreground',\n /**\n * Tinted status fills, for counts and states rather than actions. The\n * word stays in `foreground` for contrast; the glyph takes the status\n * hue, so tags of different tones read apart at a glance.\n */\n success: 'bg-success-subtle text-foreground [&_svg]:text-success',\n warning: 'bg-warning-subtle text-foreground [&_svg]:text-warning',\n destructive: 'bg-destructive-subtle text-foreground [&_svg]:text-destructive',\n info: 'bg-info-subtle text-foreground [&_svg]:text-info',\n subtle: 'bg-primary-subtle text-primary',\n /**\n * A count that asks for attention, pinned to a corner of another control\n * (a workspace mark, a rail icon). At `sm` it is a 2xs label on whatever\n * surface sits behind the corner, where the destructive tint all but\n * disappears — so it takes the solid, contrast-measured action fill.\n */\n notification: 'bg-destructive-action text-destructive-action-foreground',\n },\n size: {\n sm: 'h-4 px-1.5 text-2xs',\n md: 'h-5 px-2 text-xs',\n lg: 'h-6 px-2.5 text-xs',\n },\n },\n defaultVariants: {\n variant: 'default',\n size: 'md',\n },\n }\n)\n\ntype BadgeVariantProps = VariantProps<typeof badgeVariants>\n\nexport type BadgeProps<T extends ValidComponent = 'span'> = PolymorphicProps<\n T,\n BadgeVariantProps & { class?: string }\n>\n\nexport function Badge<T extends ValidComponent = 'span'>(props: BadgeProps<T>) {\n const [local, rest] = splitProps(props as BadgeProps, ['variant', 'size', 'class'])\n\n return (\n <Polymorphic\n as=\"span\"\n data-slot=\"badge\"\n class={cn(badgeVariants({ variant: local.variant, size: local.size }), local.class)}\n {...(rest as ComponentProps<'span'>)}\n />\n )\n}\n"],"mappings":";;;;;;;;;;;;;;AAaA,IAAaI,gBAAgBF,IAC3B,iNACA;CACEG,UAAU;EACRC,SAAS;GACPC,SAAS;GACTC,WAAW;GACXC,SAAS;;;;;;GAMTC,SAAS;GACTC,SAAS;GACTC,aAAa;GACbC,MAAM;GACNC,QAAQ;;;;;;;GAORC,cAAc;EAChB;EACAC,MAAM;GACJC,IAAI;GACJC,IAAI;GACJC,IAAI;EACN;CACF;CACAC,iBAAiB;EACfd,SAAS;EACTU,MAAM;CACR;AACF,CACF;AASA,SAAgBM,MAAyCC,OAAsB;CAC7E,MAAM,CAACC,OAAOC,QAAQxB,WAAWsB,OAAqB;EAAC;EAAW;EAAQ;CAAO,CAAC;CAElF,OAAAG,gBACG1B,aAAW2B,WAAA;EACVC,IAAE;EAAA,aAAA;EAAA,KAAA,WAAA;GAAA,OAEKzB,GAAGC,cAAc;IAAEE,SAASkB,MAAMlB;IAASU,MAAMQ,MAAMR;GAAK,CAAC,GAAGQ,MAAMH,KAAK;EAAC;CAAA,GAC9EI,IAA8B,CAAA;AAGzC"}