@adea-ai/ui 0.152.2 → 0.152.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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":"detail-panel.js","names":["createUniqueId","Show","splitProps","ComponentProps","JSX","X","Button","cn","DetailPanelProps","label","DetailPanel","props","local","rest","_el$","_tmpl$","_$spread","_$mergeProps","class","aria-label","_$insert","children","DetailPanelHeaderProps","eyebrow","title","actions","Element","onDismiss","dismissLabel","DetailPanelHeader","titleId","_el$2","_tmpl$3","_el$3","firstChild","_el$5","_el$6","nextSibling","_$createComponent","when","_el$4","_tmpl$2","_$setAttribute","dismiss","variant","size","onClick","DetailPanelBody","_el$7","_tmpl$4","DetailPanelSection","_el$8","_tmpl$5","_el$9","_el$0","DetailPanelField","name","value","muted","_el$1","_tmpl$6","_el$10","_el$11","_$effect","_$className","_$mergeProps","_$createComponent","_$className"],"sources":["../../../../src/components/ui/detail-panel/detail-panel.tsx"],"sourcesContent":["import { createUniqueId, Show, splitProps, type ComponentProps, type JSX } from 'solid-js'\nimport { X } from 'lucide-solid'\nimport { Button } from '../button'\nimport { cn } from '#lib/utils'\n\n/**\n * DetailPanel.\n *\n * The companion surface to a list: something is selected over there, and its\n * detail is here. Every application grows one — an artifact, a task, a member, a\n * file, a commit — and every one of them is a header, a body, and a way to close.\n *\n * It is an `<aside>` with a label, not a `<div>`. That is the whole reason it is a\n * component: a detail panel is a *second region* next to the main content, and a\n * screen reader user needs to be able to skip to it, name it, and know when it\n * appeared. A div with a heading inside is invisible to that navigation. The\n * label is wired to the title by id, so the panel announces itself as the thing\n * it is showing rather than as \"complementary\".\n *\n * The header is sticky and the body scrolls, because a detail panel is usually\n * taller than its viewport and the close affordance must not scroll away — the\n * panel is dismissed far more often than it is read to the end.\n *\n * `DetailPanelSection` is the repeating unit of a detail body: a small caption\n * and its value. Definition-list semantics, because these are facets of one\n * subject rather than a table with columns to compare.\n */\nexport type DetailPanelProps = ComponentProps<'aside'> & {\n /** The panel's name, for its accessible label. Usually the selected item's name. */\n label: string\n}\n\nexport function DetailPanel(props: DetailPanelProps) {\n const [local, rest] = splitProps(props, ['label', 'class', 'children'])\n\n return (\n <aside\n class={cn(\n 'flex h-full min-h-0 flex-col overflow-hidden border-l border-border bg-card',\n local.class\n )}\n aria-label={local.label}\n {...rest}\n >\n {local.children}\n </aside>\n )\n}\n\nexport type DetailPanelHeaderProps = ComponentProps<'header'> & {\n /** A small caption above the title: what kind of thing this is. */\n eyebrow?: string\n title: string\n /** Trailing controls, before the close button. */\n actions?: JSX.Element\n onDismiss?: () => void\n /** Accessible name for the dismiss control. Defaults to `Dismiss <title>`. */\n dismissLabel?: string\n}\n\nexport function DetailPanelHeader(props: DetailPanelHeaderProps) {\n const [local, rest] = splitProps(props, [\n 'eyebrow',\n 'title',\n 'actions',\n 'onDismiss',\n 'dismissLabel',\n 'class',\n 'children',\n ])\n const titleId = createUniqueId()\n\n return (\n <header\n class={cn(\n 'sticky top-0 z-(--z-sticky) flex shrink-0 items-start justify-between gap-3 border-b border-border bg-card px-4 py-3',\n local.class\n )}\n {...rest}\n >\n <div class=\"min-w-0\">\n <Show when={local.eyebrow}>\n <p class=\"text-2xs font-semibold tracking-wide text-muted-foreground uppercase\">\n {local.eyebrow}\n </p>\n </Show>\n <h2 id={titleId} class=\"truncate text-sm font-semibold text-foreground\">\n {local.title}\n </h2>\n {local.children}\n </div>\n <div class=\"flex shrink-0 items-center gap-1\">\n {local.actions}\n <Show when={local.onDismiss}>\n {(dismiss) => (\n <Button\n variant=\"ghost\"\n size=\"icon-sm\"\n aria-label={local.dismissLabel ?? `Dismiss ${local.title}`}\n onClick={() => dismiss()()}\n >\n <X aria-hidden=\"true\" />\n </Button>\n )}\n </Show>\n </div>\n </header>\n )\n}\n\nexport function DetailPanelBody(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class', 'children'])\n\n return (\n <div class={cn('min-h-0 flex-1 overflow-y-auto px-4 py-3', local.class)} {...rest}>\n {local.children}\n </div>\n )\n}\n\n/**\n * A group of related facets. Renders a `<dl>`, so its children are\n * `DetailPanelField`s; a section whose content is not name/value pairs — a\n * preview, a list, a form — belongs directly in `DetailPanelBody` with its own\n * layout rather than inside this.\n */\nexport function DetailPanelSection(props: ComponentProps<'dl'> & { title: string }) {\n const [local, rest] = splitProps(props, ['title', 'class', 'children'])\n\n return (\n <div class=\"grid gap-2\">\n <h3 class=\"text-2xs font-semibold tracking-wide text-muted-foreground uppercase\">\n {local.title}\n </h3>\n <dl class={cn('grid gap-2', local.class)} {...rest}>\n {local.children}\n </dl>\n </div>\n )\n}\n\n/**\n * One facet: a name and its value. `muted` is for a value that is absent or\n * unknown, so \"—\" reads as *no value* rather than as a value that happens to be\n * a dash.\n */\nexport function DetailPanelField(props: {\n name: string\n value?: JSX.Element\n /** Render the value in the muted colour: an absent, unknown, or inherited value. */\n muted?: boolean\n}) {\n return (\n <div class=\"flex items-baseline justify-between gap-4 text-sm\">\n <dt class=\"text-muted-foreground\">{props.name}</dt>\n <dd class={cn('text-right', props.muted ? 'text-muted-foreground' : 'text-foreground')}>\n {props.value ?? '—'}\n </dd>\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;AAgCA,SAAgBU,YAAYC,OAAyB;CACnD,MAAM,CAACC,OAAOC,QAAQX,WAAWS,OAAO;EAAC;EAAS;EAAS;CAAU,CAAC;CAEtE,cAAA;EAAA,IAAAG,OAAAC,OAAA;EAAAC,OAAAF,MAAAG,WAAA;GAAA,KAAA,WAAA;IAAA,OAEWV,GACL,+EACAK,MAAMM,KACR;GAAC;GAAA,KAAA,gBAAA;IAAA,OACWN,MAAMH;GAAK;EAAA,GACnBI,IAAI,GAAA,OAAA,IAAA;EAAAO,OAAAN,YAEPF,MAAMS,QAAQ;EAAA,OAAAP;CAAA,EAAA,CAAA;AAGrB;AAaA,SAAgBe,kBAAkBlB,OAA+B;CAC/D,MAAM,CAACC,OAAOC,QAAQX,WAAWS,OAAO;EACtC;EACA;EACA;EACA;EACA;EACA;EACA;CAAU,CACX;CACD,MAAMmB,UAAU9B,eAAe;CAE/B,cAAA;EAAA,IAAA+B,QAAAC,QAAA,GAAAC,QAAAF,MAAAG,YAAAC,QAAAF,MAAAC,YAAAE,QAAAH,MAAAI;EAAArB,OAAAe,OAAAd,WAAA,EAAA,KAAA,WAAA;GAAA,OAEWV,GACL,wHACAK,MAAMM,KACR;EAAC,EAAA,GACGL,IAAI,GAAA,OAAA,IAAA;EAAAO,OAAAa,OAAAK,gBAGLrC,MAAI;GAAA,IAACsC,OAAI;IAAA,OAAE3B,MAAMW;GAAO;GAAA,IAAAF,WAAA;IAAA,IAAAmB,QAAAC,QAAA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GOzC,MAAMY,KAAK;EAAAR,OAAAsC,OAAArC,WAAA,EAAA,KAAA,WAAA;GAAA,OAEHV,GAAG,cAAcK,MAAMM,KAAK;EAAC,EAAA,GAAML,IAAI,GAAA,OAAA,IAAA;EAAAO,OAAAkC,aAC/C1C,MAAMS,QAAQ;EAAA,OAAA8B;CAAA,EAAA,CAAA;AAIvB;;;;;;AAOA,SAAgBI,iBAAiB5C,OAK9B;CACD,cAAA;EAAA,IAAAgD,QAAAC,QAAA,GAAAC,SAAAF,MAAAzB,YAAA4B,SAAAD,OAAAxB;EAAAjB,OAAAyC,cAEuClD,MAAM6C,IAAI;EAAApC,OAAA0C,cAE1CnD,MAAM8C,SAAS,GAAG;EAAAM,aAAAC,UAAAF,QADVvD,GAAG,cAAcI,MAAM+C,QAAQ,0BAA0B,iBAAiB,CAAC,CAAA;EAAA,OAAAC;CAAA,EAAA,CAAA;AAK5F"}
1
+ {"version":3,"file":"detail-panel.js","names":["createUniqueId","Show","splitProps","X","Button","cn","label","DetailPanel","props","local","rest","_el$","_tmpl$","_$spread","_$mergeProps","class","_$insert","children","eyebrow","title","actions","onDismiss","dismissLabel","DetailPanelHeader","titleId","_el$2","_tmpl$3","_el$3","firstChild","_el$5","_el$6","nextSibling","_$createComponent","when","_el$4","_tmpl$2","_$setAttribute","dismiss","variant","size","onClick","DetailPanelBody","_el$7","_tmpl$4","DetailPanelSection","_el$8","_tmpl$5","_el$9","_el$0","DetailPanelField","name","value","muted","_el$1","_tmpl$6","_el$10","_el$11","_$effect","_$className"],"sources":["../../../../src/components/ui/detail-panel/detail-panel.tsx"],"sourcesContent":["import { createUniqueId, Show, splitProps, type ComponentProps, type JSX } from 'solid-js'\nimport { X } from 'lucide-solid'\nimport { Button } from '../button'\nimport { cn } from '#lib/utils'\n\n/**\n * DetailPanel.\n *\n * The companion surface to a list: something is selected over there, and its\n * detail is here. Every application grows one — an artifact, a task, a member, a\n * file, a commit — and every one of them is a header, a body, and a way to close.\n *\n * It is an `<aside>` with a label, not a `<div>`. That is the whole reason it is a\n * component: a detail panel is a *second region* next to the main content, and a\n * screen reader user needs to be able to skip to it, name it, and know when it\n * appeared. A div with a heading inside is invisible to that navigation. The\n * label is wired to the title by id, so the panel announces itself as the thing\n * it is showing rather than as \"complementary\".\n *\n * The header is sticky and the body scrolls, because a detail panel is usually\n * taller than its viewport and the close affordance must not scroll away — the\n * panel is dismissed far more often than it is read to the end.\n *\n * `DetailPanelSection` is the repeating unit of a detail body: a small caption\n * and its value. Definition-list semantics, because these are facets of one\n * subject rather than a table with columns to compare.\n */\nexport type DetailPanelProps = ComponentProps<'aside'> & {\n /** The panel's name, for its accessible label. Usually the selected item's name. */\n label: string\n}\n\nexport function DetailPanel(props: DetailPanelProps) {\n const [local, rest] = splitProps(props, ['label', 'class', 'children'])\n\n return (\n <aside\n class={cn(\n 'flex h-full min-h-0 flex-col overflow-hidden border-l border-border bg-card',\n local.class\n )}\n aria-label={local.label}\n {...rest}\n >\n {local.children}\n </aside>\n )\n}\n\nexport type DetailPanelHeaderProps = ComponentProps<'header'> & {\n /** A small caption above the title: what kind of thing this is. */\n eyebrow?: string\n title: string\n /** Trailing controls, before the close button. */\n actions?: JSX.Element\n onDismiss?: () => void\n /** Accessible name for the dismiss control. Defaults to `Dismiss <title>`. */\n dismissLabel?: string\n}\n\nexport function DetailPanelHeader(props: DetailPanelHeaderProps) {\n const [local, rest] = splitProps(props, [\n 'eyebrow',\n 'title',\n 'actions',\n 'onDismiss',\n 'dismissLabel',\n 'class',\n 'children',\n ])\n const titleId = createUniqueId()\n\n return (\n <header\n class={cn(\n 'sticky top-0 z-(--z-sticky) flex shrink-0 items-start justify-between gap-3 border-b border-border bg-card px-4 py-3',\n local.class\n )}\n {...rest}\n >\n <div class=\"min-w-0\">\n <Show when={local.eyebrow}>\n <p class=\"text-2xs font-semibold tracking-wide text-muted-foreground uppercase\">\n {local.eyebrow}\n </p>\n </Show>\n <h2 id={titleId} class=\"truncate text-sm font-semibold text-foreground\">\n {local.title}\n </h2>\n {local.children}\n </div>\n <div class=\"flex shrink-0 items-center gap-1\">\n {local.actions}\n <Show when={local.onDismiss}>\n {(dismiss) => (\n <Button\n variant=\"ghost\"\n size=\"icon-sm\"\n aria-label={local.dismissLabel ?? `Dismiss ${local.title}`}\n onClick={() => dismiss()()}\n >\n <X aria-hidden=\"true\" />\n </Button>\n )}\n </Show>\n </div>\n </header>\n )\n}\n\nexport function DetailPanelBody(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class', 'children'])\n\n return (\n <div class={cn('min-h-0 flex-1 overflow-y-auto px-4 py-3', local.class)} {...rest}>\n {local.children}\n </div>\n )\n}\n\n/**\n * A group of related facets. Renders a `<dl>`, so its children are\n * `DetailPanelField`s; a section whose content is not name/value pairs — a\n * preview, a list, a form — belongs directly in `DetailPanelBody` with its own\n * layout rather than inside this.\n */\nexport function DetailPanelSection(props: ComponentProps<'dl'> & { title: string }) {\n const [local, rest] = splitProps(props, ['title', 'class', 'children'])\n\n return (\n <div class=\"grid gap-2\">\n <h3 class=\"text-2xs font-semibold tracking-wide text-muted-foreground uppercase\">\n {local.title}\n </h3>\n <dl class={cn('grid gap-2', local.class)} {...rest}>\n {local.children}\n </dl>\n </div>\n )\n}\n\n/**\n * One facet: a name and its value. `muted` is for a value that is absent or\n * unknown, so \"—\" reads as *no value* rather than as a value that happens to be\n * a dash.\n */\nexport function DetailPanelField(props: {\n name: string\n value?: JSX.Element\n /** Render the value in the muted colour: an absent, unknown, or inherited value. */\n muted?: boolean\n}) {\n return (\n <div class=\"flex items-baseline justify-between gap-4 text-sm\">\n <dt class=\"text-muted-foreground\">{props.name}</dt>\n <dd class={cn('text-right', props.muted ? 'text-muted-foreground' : 'text-foreground')}>\n {props.value ?? '—'}\n </dd>\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;AAgCA,SAAgBO,YAAYC,OAAyB;CACnD,MAAM,CAACC,OAAOC,QAAQR,WAAWM,OAAO;EAAC;EAAS;EAAS;CAAU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AS,GAAG;EAAAM,aAAAC,UAAAF,QADVnD,GAAG,cAAcG,MAAM4C,QAAQ,0BAA0B,iBAAiB,CAAC,CAAA;EAAA,OAAAC;CAAA,EAAA,CAAA;AAK5F"}
@@ -1 +1 @@
1
- {"version":3,"file":"dialog-layer.js","names":["useDialogContext","Accessor","JSX","createRenderEffect","onCleanup","TooltipEscapeTargetContext","AutoFocusHandler","event","Event","DialogLayerOptions","restoreFocusRef","HTMLElement","onOpenAutoFocus","onCloseAutoFocus","FocusCycle","content","opener","openerEligible","closed","focusMovedOutside","closeAutoFocusScheduled","frame","fallbackTimer","observer","MutationObserver","onFocusIn","FocusEvent","openLayers","Set","isVisible","element","isConnected","getClientRects","length","canRestoreFocus","target","document","body","documentElement","closest","matches","anotherLayerOpen","layer","contains","createDialogFocusReturn","open","options","focusCycles","WeakMap","activeFocusCycle","pendingOpener","pendingOpenerEligible","active","activeElement","finishFocusCycle","cycle","undefined","window","cancelAnimationFrame","clearTimeout","disconnect","removeEventListener","delete","markClosed","scheduleFocusRestore","requestAnimationFrame","focusIsAvailable","Node","focus","preventScroll","currentTarget","openerWasCaptured","openerElement","focusEvent","set","add","addEventListener","get","defaultPrevented","observe","attributes","attributeFilter","childList","subtree","queueMicrotask","setTimeout","createDialogLayer","isOpen","DialogEscapeTarget","props","onEscapeKeyDown","KeyboardEvent","children","Element","dialog","dismiss","close","_$createComponent","Provider","value","contentRef","_$createComponent"],"sources":["../../../../src/components/ui/dialog/dialog-layer.tsx"],"sourcesContent":["import { useDialogContext } from '@kobalte/core/dialog'\nimport type { Accessor, JSX } from 'solid-js'\nimport { createRenderEffect, onCleanup } from 'solid-js'\nimport { TooltipEscapeTargetContext } from '../tooltip/tooltip'\n\n/**\n * The rules the kit's dialog-shaped layers share, so a caller never wires them\n * by hand:\n *\n * 1. Focus returns to whatever had it before the layer opened. Kobalte only\n * returns focus to its own `Trigger`; a controlled layer opened from a menu\n * row, a shortcut or another layer would otherwise drop focus on `<body>`.\n * Dialog, AlertDialog, Sheet and the command palette.\n * 2. An Escape that a tooltip inside the layer swallowed still closes the layer\n * (see `TooltipEscapeTargetContext`). Dialog, AlertDialog and Sheet only;\n * the command palette does not provide it.\n *\n * Private to the overlay kit: content components apply it; callers pass\n * `restoreFocusRef` when the opener is gone by the time the layer opens.\n */\n\ntype AutoFocusHandler = (event: Event) => void\n\nexport type DialogLayerOptions = {\n restoreFocusRef?: Accessor<HTMLElement | undefined>\n onOpenAutoFocus?: AutoFocusHandler\n onCloseAutoFocus?: AutoFocusHandler\n}\n\ntype FocusCycle = {\n content: HTMLElement\n opener: HTMLElement | null\n openerEligible: boolean\n closed: boolean\n focusMovedOutside: boolean\n closeAutoFocusScheduled: boolean\n frame?: number\n fallbackTimer?: number\n observer?: MutationObserver\n onFocusIn: (event: FocusEvent) => void\n}\n\n/** The kit's dialog layers that are open now, so a closing layer can tell a newer one took over. */\nconst openLayers = new Set<HTMLElement>()\n\nfunction isVisible(element: HTMLElement) {\n return element.isConnected && element.getClientRects().length > 0\n}\n\nfunction canRestoreFocus(target: HTMLElement): boolean {\n return (\n target !== document.body &&\n target !== document.documentElement &&\n !target.closest('[inert], [aria-hidden=\"true\"]') &&\n !target.matches(':disabled') &&\n isVisible(target)\n )\n}\n\nfunction anotherLayerOpen(content: HTMLElement, opener: HTMLElement): boolean {\n for (const layer of openLayers) {\n if (\n layer !== content &&\n !content.contains(layer) &&\n !layer.contains(opener) &&\n !layer.closest('[aria-hidden=\"true\"], [inert]') &&\n isVisible(layer)\n ) {\n return true\n }\n }\n return false\n}\n\n/**\n * The focus-return half of the layer rules, for a layer whose open state is\n * `open`. Returns the autofocus handlers to give the Kobalte content.\n */\nexport function createDialogFocusReturn(\n open: Accessor<boolean>,\n options: DialogLayerOptions\n): { onOpenAutoFocus: AutoFocusHandler; onCloseAutoFocus: AutoFocusHandler } {\n const focusCycles = new WeakMap<HTMLElement, FocusCycle>()\n let activeFocusCycle: FocusCycle | undefined\n let pendingOpener: HTMLElement | null = null\n let pendingOpenerEligible = false\n\n // Captured while the open state changes, before Kobalte's effects move focus\n // into the layer and before a closing menu takes its row out of the page.\n createRenderEffect(() => {\n if (!open() || typeof document === 'undefined') {\n pendingOpener = null\n pendingOpenerEligible = false\n return\n }\n const active = options.restoreFocusRef?.() ?? document.activeElement\n pendingOpener = active instanceof HTMLElement ? active : null\n pendingOpenerEligible = active instanceof HTMLElement && canRestoreFocus(active)\n })\n\n const finishFocusCycle = (cycle: FocusCycle) => {\n if (cycle.frame !== undefined) window.cancelAnimationFrame(cycle.frame)\n if (cycle.fallbackTimer !== undefined) window.clearTimeout(cycle.fallbackTimer)\n cycle.observer?.disconnect()\n document.removeEventListener('focusin', cycle.onFocusIn)\n openLayers.delete(cycle.content)\n if (activeFocusCycle === cycle) activeFocusCycle = undefined\n }\n\n const markClosed = (cycle: FocusCycle) => {\n cycle.closed = true\n openLayers.delete(cycle.content)\n }\n\n const scheduleFocusRestore = (cycle: FocusCycle) => {\n if (cycle.frame !== undefined) return\n cycle.frame = window.requestAnimationFrame(() => {\n cycle.frame = undefined\n const opener = cycle.opener\n const active = document.activeElement\n const focusIsAvailable =\n active === document.body ||\n active === document.documentElement ||\n active === cycle.content ||\n (active instanceof Node && cycle.content.contains(active))\n if (\n activeFocusCycle !== cycle ||\n !cycle.closed ||\n cycle.focusMovedOutside ||\n !opener ||\n !isVisible(opener) ||\n opener.matches(':disabled') ||\n !focusIsAvailable ||\n anotherLayerOpen(cycle.content, opener)\n ) {\n finishFocusCycle(cycle)\n return\n }\n\n // Kobalte removes the `inert` / `aria-hidden` it put on the background\n // only after the layer unmounts; the observer below brings us back here.\n if (opener.closest('[inert], [aria-hidden=\"true\"]')) return\n if (cycle.openerEligible && canRestoreFocus(opener)) {\n opener.focus({ preventScroll: true })\n }\n finishFocusCycle(cycle)\n })\n }\n\n const onOpenAutoFocus = (event: Event) => {\n const element = event.currentTarget\n if (element instanceof HTMLElement) {\n if (activeFocusCycle) finishFocusCycle(activeFocusCycle)\n\n const openerWasCaptured = pendingOpener !== null\n const opener = pendingOpener ?? document.activeElement\n const openerEligible = openerWasCaptured\n ? pendingOpenerEligible\n : opener instanceof HTMLElement && canRestoreFocus(opener)\n pendingOpener = null\n pendingOpenerEligible = false\n const openerElement = opener instanceof HTMLElement ? opener : null\n const cycle: FocusCycle = {\n content: element,\n opener: openerElement,\n openerEligible,\n closed: false,\n focusMovedOutside: false,\n closeAutoFocusScheduled: false,\n onFocusIn: (focusEvent) => {\n const target = focusEvent.target\n if (\n !(target instanceof HTMLElement) ||\n target === document.body ||\n target === document.documentElement\n ) {\n return\n }\n if (target === element || element.contains(target) || target === openerElement) {\n if (!cycle.closed) cycle.focusMovedOutside = false\n return\n }\n cycle.focusMovedOutside = true\n },\n }\n focusCycles.set(element, cycle)\n activeFocusCycle = cycle\n openLayers.add(element)\n document.addEventListener('focusin', cycle.onFocusIn)\n }\n options.onOpenAutoFocus?.(event)\n }\n\n const onCloseAutoFocus = (event: Event) => {\n const element = event.currentTarget\n const cycle = element instanceof HTMLElement ? focusCycles.get(element) : undefined\n options.onCloseAutoFocus?.(event)\n\n if (!cycle) return\n markClosed(cycle)\n\n // A caller that prevents Kobalte's close autofocus owns the focus decision.\n if (event.defaultPrevented) {\n finishFocusCycle(cycle)\n return\n }\n\n if (cycle.fallbackTimer !== undefined) {\n window.clearTimeout(cycle.fallbackTimer)\n cycle.fallbackTimer = undefined\n }\n cycle.closeAutoFocusScheduled = true\n cycle.observer = new MutationObserver(() => scheduleFocusRestore(cycle))\n cycle.observer.observe(document.body, {\n attributes: true,\n attributeFilter: ['aria-hidden', 'inert'],\n childList: true,\n subtree: true,\n })\n scheduleFocusRestore(cycle)\n }\n\n onCleanup(() => {\n const cycle = activeFocusCycle\n if (!cycle) return\n markClosed(cycle)\n\n // Kobalte dispatches the close autofocus from a timer after unmount. If the\n // content never dispatches it, release the focus listener after that timer.\n queueMicrotask(() => {\n if (cycle.closeAutoFocusScheduled) return\n cycle.fallbackTimer = window.setTimeout(() => {\n cycle.fallbackTimer = undefined\n if (!cycle.closeAutoFocusScheduled) finishFocusCycle(cycle)\n }, 0)\n })\n })\n\n return { onOpenAutoFocus, onCloseAutoFocus }\n}\n\n/** The layer rules for a content rendered inside a Kobalte Dialog or AlertDialog root. */\nexport function createDialogLayer(options: DialogLayerOptions) {\n return createDialogFocusReturn(useDialogContext().isOpen, options)\n}\n\n/**\n * Lets an Escape swallowed by a tooltip inside the layer close the layer. The\n * content's own `onEscapeKeyDown` sees that Escape first, so a layer that\n * blocks Escape (a dirty form, a save in flight) stays blocked.\n */\nexport function DialogEscapeTarget(props: {\n onEscapeKeyDown?: (event: KeyboardEvent) => void\n children?: JSX.Element\n}) {\n const dialog = useDialogContext()\n const dismiss = (event: KeyboardEvent) => {\n props.onEscapeKeyDown?.(event)\n if (!event.defaultPrevented) dialog.close()\n }\n return (\n <TooltipEscapeTargetContext.Provider value={{ element: dialog.contentRef, dismiss }}>\n {props.children}\n </TooltipEscapeTargetContext.Provider>\n )\n}\n"],"mappings":";;;;;;AA2CA,IAAM2B,6BAAa,IAAIC,IAAiB;AAExC,SAASC,UAAUC,SAAsB;CACvC,OAAOA,QAAQC,eAAeD,QAAQE,eAAe,CAAC,CAACC,SAAS;AAClE;AAEA,SAASC,gBAAgBC,QAA8B;CACrD,OACEA,WAAWC,SAASC,QACpBF,WAAWC,SAASE,mBACpB,CAACH,OAAOI,QAAQ,iCAA+B,KAC/C,CAACJ,OAAOK,QAAQ,WAAW,KAC3BX,UAAUM,MAAM;AAEpB;AAEA,SAASM,iBAAiB1B,SAAsBC,QAA8B;CAC5E,KAAK,MAAM0B,SAASf,YAClB,IACEe,UAAU3B,WACV,CAACA,QAAQ4B,SAASD,KAAK,KACvB,CAACA,MAAMC,SAAS3B,MAAM,KACtB,CAAC0B,MAAMH,QAAQ,iCAA+B,KAC9CV,UAAUa,KAAK,GAEf,OAAO;CAGX,OAAO;AACT;;;;;AAMA,SAAgBE,wBACdC,MACAC,SAC2E;CAC3E,MAAMC,8B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kF,MAAMC,kBAAkBnF,KAAK;EAC7B,IAAI,CAACA,MAAMuE,kBAAkBgB,OAAOE,MAAM;CAC5C;CACA,OAAAC,gBACG5F,2BAA2B6F,UAAQ;EAAA,IAACC,QAAK;GAAA,OAAE;IAAErE,SAASgE,OAAOM;IAAYL;GAAQ;EAAC;EAAA,IAAAH,WAAA;GAAA,OAChFH,MAAMG;EAAQ;CAAA,CAAA;AAGrB"}
1
+ {"version":3,"file":"dialog-layer.js","names":["useDialogContext","createRenderEffect","onCleanup","TooltipEscapeTargetContext","event","restoreFocusRef","HTMLElement","onOpenAutoFocus","onCloseAutoFocus","content","opener","openerEligible","closed","focusMovedOutside","closeAutoFocusScheduled","frame","fallbackTimer","observer","MutationObserver","onFocusIn","openLayers","Set","isVisible","element","isConnected","getClientRects","length","canRestoreFocus","target","document","body","documentElement","closest","matches","anotherLayerOpen","layer","contains","createDialogFocusReturn","open","options","focusCycles","WeakMap","activeFocusCycle","pendingOpener","pendingOpenerEligible","active","activeElement","finishFocusCycle","cycle","undefined","window","cancelAnimationFrame","clearTimeout","disconnect","removeEventListener","delete","markClosed","scheduleFocusRestore","requestAnimationFrame","focusIsAvailable","Node","focus","preventScroll","currentTarget","openerWasCaptured","openerElement","focusEvent","set","add","addEventListener","get","defaultPrevented","observe","attributes","attributeFilter","childList","subtree","queueMicrotask","setTimeout","createDialogLayer","isOpen","DialogEscapeTarget","props","onEscapeKeyDown","children","dialog","dismiss","close","_$createComponent","Provider","value","contentRef"],"sources":["../../../../src/components/ui/dialog/dialog-layer.tsx"],"sourcesContent":["import { useDialogContext } from '@kobalte/core/dialog'\nimport type { Accessor, JSX } from 'solid-js'\nimport { createRenderEffect, onCleanup } from 'solid-js'\nimport { TooltipEscapeTargetContext } from '../tooltip/tooltip'\n\n/**\n * The rules the kit's dialog-shaped layers share, so a caller never wires them\n * by hand:\n *\n * 1. Focus returns to whatever had it before the layer opened. Kobalte only\n * returns focus to its own `Trigger`; a controlled layer opened from a menu\n * row, a shortcut or another layer would otherwise drop focus on `<body>`.\n * Dialog, AlertDialog, Sheet and the command palette.\n * 2. An Escape that a tooltip inside the layer swallowed still closes the layer\n * (see `TooltipEscapeTargetContext`). Dialog, AlertDialog and Sheet only;\n * the command palette does not provide it.\n *\n * Private to the overlay kit: content components apply it; callers pass\n * `restoreFocusRef` when the opener is gone by the time the layer opens.\n */\n\ntype AutoFocusHandler = (event: Event) => void\n\nexport type DialogLayerOptions = {\n restoreFocusRef?: Accessor<HTMLElement | undefined>\n onOpenAutoFocus?: AutoFocusHandler\n onCloseAutoFocus?: AutoFocusHandler\n}\n\ntype FocusCycle = {\n content: HTMLElement\n opener: HTMLElement | null\n openerEligible: boolean\n closed: boolean\n focusMovedOutside: boolean\n closeAutoFocusScheduled: boolean\n frame?: number\n fallbackTimer?: number\n observer?: MutationObserver\n onFocusIn: (event: FocusEvent) => void\n}\n\n/** The kit's dialog layers that are open now, so a closing layer can tell a newer one took over. */\nconst openLayers = new Set<HTMLElement>()\n\nfunction isVisible(element: HTMLElement) {\n return element.isConnected && element.getClientRects().length > 0\n}\n\nfunction canRestoreFocus(target: HTMLElement): boolean {\n return (\n target !== document.body &&\n target !== document.documentElement &&\n !target.closest('[inert], [aria-hidden=\"true\"]') &&\n !target.matches(':disabled') &&\n isVisible(target)\n )\n}\n\nfunction anotherLayerOpen(content: HTMLElement, opener: HTMLElement): boolean {\n for (const layer of openLayers) {\n if (\n layer !== content &&\n !content.contains(layer) &&\n !layer.contains(opener) &&\n !layer.closest('[aria-hidden=\"true\"], [inert]') &&\n isVisible(layer)\n ) {\n return true\n }\n }\n return false\n}\n\n/**\n * The focus-return half of the layer rules, for a layer whose open state is\n * `open`. Returns the autofocus handlers to give the Kobalte content.\n */\nexport function createDialogFocusReturn(\n open: Accessor<boolean>,\n options: DialogLayerOptions\n): { onOpenAutoFocus: AutoFocusHandler; onCloseAutoFocus: AutoFocusHandler } {\n const focusCycles = new WeakMap<HTMLElement, FocusCycle>()\n let activeFocusCycle: FocusCycle | undefined\n let pendingOpener: HTMLElement | null = null\n let pendingOpenerEligible = false\n\n // Captured while the open state changes, before Kobalte's effects move focus\n // into the layer and before a closing menu takes its row out of the page.\n createRenderEffect(() => {\n if (!open() || typeof document === 'undefined') {\n pendingOpener = null\n pendingOpenerEligible = false\n return\n }\n const active = options.restoreFocusRef?.() ?? document.activeElement\n pendingOpener = active instanceof HTMLElement ? active : null\n pendingOpenerEligible = active instanceof HTMLElement && canRestoreFocus(active)\n })\n\n const finishFocusCycle = (cycle: FocusCycle) => {\n if (cycle.frame !== undefined) window.cancelAnimationFrame(cycle.frame)\n if (cycle.fallbackTimer !== undefined) window.clearTimeout(cycle.fallbackTimer)\n cycle.observer?.disconnect()\n document.removeEventListener('focusin', cycle.onFocusIn)\n openLayers.delete(cycle.content)\n if (activeFocusCycle === cycle) activeFocusCycle = undefined\n }\n\n const markClosed = (cycle: FocusCycle) => {\n cycle.closed = true\n openLayers.delete(cycle.content)\n }\n\n const scheduleFocusRestore = (cycle: FocusCycle) => {\n if (cycle.frame !== undefined) return\n cycle.frame = window.requestAnimationFrame(() => {\n cycle.frame = undefined\n const opener = cycle.opener\n const active = document.activeElement\n const focusIsAvailable =\n active === document.body ||\n active === document.documentElement ||\n active === cycle.content ||\n (active instanceof Node && cycle.content.contains(active))\n if (\n activeFocusCycle !== cycle ||\n !cycle.closed ||\n cycle.focusMovedOutside ||\n !opener ||\n !isVisible(opener) ||\n opener.matches(':disabled') ||\n !focusIsAvailable ||\n anotherLayerOpen(cycle.content, opener)\n ) {\n finishFocusCycle(cycle)\n return\n }\n\n // Kobalte removes the `inert` / `aria-hidden` it put on the background\n // only after the layer unmounts; the observer below brings us back here.\n if (opener.closest('[inert], [aria-hidden=\"true\"]')) return\n if (cycle.openerEligible && canRestoreFocus(opener)) {\n opener.focus({ preventScroll: true })\n }\n finishFocusCycle(cycle)\n })\n }\n\n const onOpenAutoFocus = (event: Event) => {\n const element = event.currentTarget\n if (element instanceof HTMLElement) {\n if (activeFocusCycle) finishFocusCycle(activeFocusCycle)\n\n const openerWasCaptured = pendingOpener !== null\n const opener = pendingOpener ?? document.activeElement\n const openerEligible = openerWasCaptured\n ? pendingOpenerEligible\n : opener instanceof HTMLElement && canRestoreFocus(opener)\n pendingOpener = null\n pendingOpenerEligible = false\n const openerElement = opener instanceof HTMLElement ? opener : null\n const cycle: FocusCycle = {\n content: element,\n opener: openerElement,\n openerEligible,\n closed: false,\n focusMovedOutside: false,\n closeAutoFocusScheduled: false,\n onFocusIn: (focusEvent) => {\n const target = focusEvent.target\n if (\n !(target instanceof HTMLElement) ||\n target === document.body ||\n target === document.documentElement\n ) {\n return\n }\n if (target === element || element.contains(target) || target === openerElement) {\n if (!cycle.closed) cycle.focusMovedOutside = false\n return\n }\n cycle.focusMovedOutside = true\n },\n }\n focusCycles.set(element, cycle)\n activeFocusCycle = cycle\n openLayers.add(element)\n document.addEventListener('focusin', cycle.onFocusIn)\n }\n options.onOpenAutoFocus?.(event)\n }\n\n const onCloseAutoFocus = (event: Event) => {\n const element = event.currentTarget\n const cycle = element instanceof HTMLElement ? focusCycles.get(element) : undefined\n options.onCloseAutoFocus?.(event)\n\n if (!cycle) return\n markClosed(cycle)\n\n // A caller that prevents Kobalte's close autofocus owns the focus decision.\n if (event.defaultPrevented) {\n finishFocusCycle(cycle)\n return\n }\n\n if (cycle.fallbackTimer !== undefined) {\n window.clearTimeout(cycle.fallbackTimer)\n cycle.fallbackTimer = undefined\n }\n cycle.closeAutoFocusScheduled = true\n cycle.observer = new MutationObserver(() => scheduleFocusRestore(cycle))\n cycle.observer.observe(document.body, {\n attributes: true,\n attributeFilter: ['aria-hidden', 'inert'],\n childList: true,\n subtree: true,\n })\n scheduleFocusRestore(cycle)\n }\n\n onCleanup(() => {\n const cycle = activeFocusCycle\n if (!cycle) return\n markClosed(cycle)\n\n // Kobalte dispatches the close autofocus from a timer after unmount. If the\n // content never dispatches it, release the focus listener after that timer.\n queueMicrotask(() => {\n if (cycle.closeAutoFocusScheduled) return\n cycle.fallbackTimer = window.setTimeout(() => {\n cycle.fallbackTimer = undefined\n if (!cycle.closeAutoFocusScheduled) finishFocusCycle(cycle)\n }, 0)\n })\n })\n\n return { onOpenAutoFocus, onCloseAutoFocus }\n}\n\n/** The layer rules for a content rendered inside a Kobalte Dialog or AlertDialog root. */\nexport function createDialogLayer(options: DialogLayerOptions) {\n return createDialogFocusReturn(useDialogContext().isOpen, options)\n}\n\n/**\n * Lets an Escape swallowed by a tooltip inside the layer close the layer. The\n * content's own `onEscapeKeyDown` sees that Escape first, so a layer that\n * blocks Escape (a dirty form, a save in flight) stays blocked.\n */\nexport function DialogEscapeTarget(props: {\n onEscapeKeyDown?: (event: KeyboardEvent) => void\n children?: JSX.Element\n}) {\n const dialog = useDialogContext()\n const dismiss = (event: KeyboardEvent) => {\n props.onEscapeKeyDown?.(event)\n if (!event.defaultPrevented) dialog.close()\n }\n return (\n <TooltipEscapeTargetContext.Provider value={{ element: dialog.contentRef, dismiss }}>\n {props.children}\n </TooltipEscapeTargetContext.Provider>\n )\n}\n"],"mappings":";;;;;;AA2CA,IAAMoB,6BAAa,IAAIC,IAAiB;AAExC,SAASC,UAAUC,SAAsB;CACvC,OAAOA,QAAQC,eAAeD,QAAQE,eAAe,CAAC,CAACC,SAAS;AAClE;AAEA,SAASC,gBAAgBC,QAA8B;CACrD,OACEA,WAAWC,SAASC,QACpBF,WAAWC,SAASE,mBACpB,CAACH,OAAOI,QAAQ,iCAA+B,KAC/C,CAACJ,OAAOK,QAAQ,WAAW,KAC3BX,UAAUM,MAAM;AAEpB;AAEA,SAASM,iBAAiBzB,SAAsBC,QAA8B;CAC5E,KAAK,MAAMyB,SAASf,YAClB,IACEe,UAAU1B,WACV,CAACA,QAAQ2B,SAASD,KAAK,KACvB,CAACA,MAAMC,SAAS1B,MAAM,KACtB,CAACyB,MAAMH,QAAQ,iCAA+B,KAC9CV,UAAUa,KAAK,GAEf,OAAO;CAGX,OAAO;AACT;;;;;AAMA,SAAgBE,w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BAAiB;CAChC,MAAMsF,WAAWlF,UAAyB;EACxC8E,MAAMC,kBAAkB/E,KAAK;EAC7B,IAAI,CAACA,MAAMmE,kBAAkBc,OAAOE,MAAM;CAC5C;CACA,OAAAC,gBACGrF,2BAA2BsF,UAAQ;EAAA,IAACC,QAAK;GAAA,OAAE;IAAEnE,SAAS8D,OAAOM;IAAYL;GAAQ;EAAC;EAAA,IAAAF,WAAA;GAAA,OAChFF,MAAME;EAAQ;CAAA,CAAA;AAGrB"}
@@ -1 +1 @@
1
- {"version":3,"file":"dialog.js","names":["Dialog","KobalteDialog","Content","KobalteDialogContent","Overlay","KobalteDialogOverlay","X","Accessor","ComponentProps","JSX","Show","splitProps","dialogSurface","overlayCornerClose","overlayDescription","overlayFooter","overlayHeader","overlayMotion","overlayPositioner","overlayScrim","overlayScrimMotion","overlayTitle","cn","Tooltip","TooltipContent","TooltipTrigger","createDialogLayer","DialogEscapeTarget","Root","Trigger","DialogTrigger","Portal","DialogPortal","DialogOverlay","props","local","rest","_$createComponent","_$mergeProps","class","DialogContentProps","closeButton","Element","closeLabel","positioner","size","DialogContentSize","initialFocus","restoreFocusRef","HTMLElement","dialogContentSizes","sm","md","lg","xl","const","DialogContent","layer","onOpenAutoFocus","event","defaultPrevented","currentTarget","preventDefault","focus","preventScroll","onCloseAutoFocus","children","_el$","_tmpl$","_$insert","onEscapeKeyDown","_$memo","when","as","CloseButton","aria-label","_$effect","_$className","DialogHeader","band","_el$2","_tmpl$2","_$spread","DialogFooter","_el$3","_tmpl$3","DialogTitle","Title","DialogDescription","Description","DialogClose","DialogCloseButton","_$createComponent","KobalteDialogOverlay","_$mergeProps","KobalteDialog","KobalteDialogContent","_$memo","_$className"],"sources":["../../../../src/components/ui/dialog/dialog.tsx"],"sourcesContent":["import {\n Dialog as KobalteDialog,\n Content as KobalteDialogContent,\n Overlay as KobalteDialogOverlay,\n} from '@kobalte/core/dialog'\n// AlertDialog assigns to the shared DialogRoot.Content object, so these named exports stay role-stable.\nimport { X } from 'lucide-solid'\nimport type { Accessor, ComponentProps, JSX } from 'solid-js'\nimport { Show, splitProps } from 'solid-js'\nimport {\n dialogSurface,\n overlayCornerClose,\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 { Tooltip, TooltipContent, TooltipTrigger } from '../tooltip'\nimport { createDialogLayer, DialogEscapeTarget } from './dialog-layer'\n\n/**\n * Dialog.\n *\n * A modal surface for a decision or a short task. `Dialog.Portal` keeps the\n * panel out of the app's stacking and overflow contexts, `Dialog.Overlay`\n * dims what is behind it, and Kobalte handles the focus trap, the escape key\n * and scroll locking. Focus returns on close to whatever had it before the\n * dialog opened, trigger or not (pass `restoreFocusRef` when that control is\n * gone by then, such as a menu row).\n *\n * The close button is part of the content rather than optional, because every\n * modal needs a way out that is not the keyboard. A dialog whose only exit is\n * Escape is a trap for anyone using a pointer.\n */\nexport {\n Root as Dialog,\n Trigger as DialogTrigger,\n Portal as DialogPortal,\n} from '@kobalte/core/dialog'\n\nexport function DialogOverlay(props: ComponentProps<typeof KobalteDialogOverlay>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <KobalteDialogOverlay class={cn(overlayScrim, overlayScrimMotion, local.class)} {...rest} />\n )\n}\n\nexport type DialogContentProps = ComponentProps<typeof KobalteDialogContent> & {\n /**\n * Replaces the default close button. Pass `false` to remove it — only for a\n * dialog that cannot be dismissed (an update that must finish); anything the\n * user can escape from needs the button.\n */\n closeButton?: JSX.Element | false\n /**\n * The corner close's accessible name. Defaults to \"Close\". Name it for the\n * dialog (\"Close version and updates\") when the footer also has a text\n * \"Close\", so the two controls do not share one name.\n */\n closeLabel?: string\n /** Use a 1rem inset as the positioner bounds for tall, viewport-filling surfaces. */\n positioner?: 'default' | 'inset'\n /**\n * The panel's maximum width. `md` (32rem) is the default and right for a\n * confirmation or a short form; `sm` (28rem) for a single question; `lg`\n * (42rem) for a picker or a form with two columns; `xl` (48rem) for a\n * multi-step flow that needs a table or a preview beside its fields.\n */\n size?: DialogContentSize\n /**\n * Where focus lands on open. `first-control` (the default) is the first\n * tabbable control; `panel` focuses the panel itself, for a dialog whose\n * content should be read before an action is reached (an About box, an\n * update summary).\n */\n initialFocus?: 'first-control' | 'panel'\n /** The control to focus on close when the one focused before opening is gone by then. */\n restoreFocusRef?: Accessor<HTMLElement | undefined>\n}\n\n/** The dialog width ladder, so a caller picks a rung instead of a `max-w-*`. */\nexport const dialogContentSizes = {\n sm: 'max-w-md',\n md: 'max-w-lg',\n lg: 'max-w-2xl',\n xl: 'max-w-3xl',\n} as const\n\nexport type DialogContentSize = keyof typeof dialogContentSizes\n\nexport function DialogContent(props: DialogContentProps) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'children',\n 'closeButton',\n 'closeLabel',\n 'positioner',\n 'size',\n 'initialFocus',\n 'restoreFocusRef',\n 'onOpenAutoFocus',\n 'onCloseAutoFocus',\n ])\n const layer = createDialogLayer({\n restoreFocusRef: local.restoreFocusRef,\n onOpenAutoFocus: (event) => {\n local.onOpenAutoFocus?.(event)\n if (\n local.initialFocus === 'panel' &&\n !event.defaultPrevented &&\n event.currentTarget instanceof HTMLElement\n ) {\n event.preventDefault()\n event.currentTarget.focus({ preventScroll: true })\n }\n },\n onCloseAutoFocus: (event) => local.onCloseAutoFocus?.(event),\n })\n\n return (\n <KobalteDialog.Portal>\n <DialogOverlay />\n <div class={cn(overlayPositioner, local.positioner === 'inset' && 'inset-4 grid-rows-1 p-0')}>\n <KobalteDialogContent\n class={cn(\n dialogSurface,\n overlayMotion,\n 'relative grid max-h-full w-full gap-4 overflow-y-auto p-5',\n dialogContentSizes[local.size ?? 'md'],\n local.class\n )}\n {...rest}\n onOpenAutoFocus={layer.onOpenAutoFocus}\n onCloseAutoFocus={layer.onCloseAutoFocus}\n >\n <DialogEscapeTarget onEscapeKeyDown={props.onEscapeKeyDown}>\n {local.children}\n <Show when={local.closeButton !== false}>\n {/* The corner close is icon-only, so it carries the shared tooltip\n treatment. */}\n <Tooltip>\n <TooltipTrigger\n as={KobalteDialog.CloseButton}\n data-slot=\"dialog-corner-close\"\n aria-label={local.closeLabel ?? 'Close'}\n class={overlayCornerClose}\n >\n {local.closeButton ?? <X class=\"size-4\" />}\n </TooltipTrigger>\n <TooltipContent>\n {local.closeLabel ? `${local.closeLabel}.` : 'Close dialog.'}\n </TooltipContent>\n </Tooltip>\n </Show>\n </DialogEscapeTarget>\n </KobalteDialogContent>\n </div>\n </KobalteDialog.Portal>\n )\n}\n\n/**\n * The dialog's title block. `band` steps it onto the elevation ladder's\n * subtle-fill rung (`--muted`), the same treatment as the sheet parts' band —\n * for the dialog family whose panel anatomy matches a sheet's (a title band\n * over a full-bleed shell, such as a settings dialog) rather than the centred\n * modal's documented flat surface. See `SheetFooter` for the rung's rationale.\n */\nexport function DialogHeader(props: ComponentProps<'div'> & { band?: boolean }) {\n const [local, rest] = splitProps(props, ['class', 'band'])\n return (\n <div\n data-slot=\"dialog-header\"\n class={cn(overlayHeader, 'pe-6', { 'bg-muted': local.band }, local.class)}\n {...rest}\n />\n )\n}\n\nexport function DialogFooter(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class'])\n return <div data-slot=\"dialog-footer\" class={cn(overlayFooter, local.class)} {...rest} />\n}\n\nexport function DialogTitle(props: ComponentProps<typeof KobalteDialog.Title>) {\n const [local, rest] = splitProps(props, ['class'])\n return <KobalteDialog.Title class={cn(overlayTitle, local.class)} {...rest} />\n}\n\nexport function DialogDescription(props: ComponentProps<typeof KobalteDialog.Description>) {\n const [local, rest] = splitProps(props, ['class'])\n return <KobalteDialog.Description class={cn(overlayDescription, local.class)} {...rest} />\n}\n\n/**\n * A close control of the caller's own, polymorphic — for a footer's text\n * \"Cancel\" or \"Close\", which is a different control from the corner icon the\n * content draws. Take it as `as={Button}` so it carries the button's variants\n * rather than a copied class string.\n */\nexport function DialogClose(props: ComponentProps<typeof KobalteDialog.CloseButton>) {\n const [local, rest] = splitProps(props, ['class'])\n return <KobalteDialog.CloseButton class={cn('focus-ring', local.class)} {...rest} />\n}\n\n/** The earlier name for `DialogClose`. */\nexport const DialogCloseButton = DialogClose\n"],"mappings":";;;;;;;;;;;;AA6CA,SAAgBiC,cAAcC,OAAoD;CAChF,MAAM,CAACC,OAAOC,QAAQzB,WAAWuB,OAAO,CAAC,OAAO,CAAC;CACjD,OAAAG,gBACGhC,SAAoBiC,WAAA,EAAA,KAAA,WAAA;EAAA,OAAQhB,GAAGH,cAAcC,oBAAoBe,MAAMI,KAAK;CAAC,EAAA,GAAMH,IAAI,CAAA;AAE5F;;AAoCA,IAAac,qBAAqB;CAChCC,IAAI;CACJC,IAAI;CACJC,IAAI;CACJC,IAAI;AACN;AAIA,SAAgBE,cAActB,OAA2B;CACvD,MAAM,CAACC,OAAOC,QAAQzB,WAAWuB,OAAO;EACtC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CAAkB,CACnB;CACD,MAAMuB,QAAQ/B,kBAAkB;EAC9BsB,iBAAiBb,MAAMa;EACvBU,kBAAkBC,UAAU;GAC1BxB,MAAMuB,kBAAkBC,KAAK;GAC7B,IACExB,MAAMY,iBAAiB,WACvB,CAACY,MAAMC,oBACPD,MAAME,yBAAyBZ,aAC/B;IACAU,MAAMG,eAAe;IACrBH,MAAME,cAAcE,MAAM,EAAEC,eAAe,KAAK,CAAC;GACnD;EACF;EACAC,mBAAmBN,UAAUxB,MAAM8B,mBAAmBN,KAAK;CAC7D,CAAC;CAED,OAAAtB,gBACGpC,OAAc8B,QAAM,EAAA,IAAAmC,WAAA;EAAA,OAAA,CAAA7B,gBAClBJ,eAAa,CAAA,CAAA,UAAA;GAAA,IAAAkC,OAAAC,OAAA;GAAAC,OAAAF,MAAA9B,gBAEXlC,SAAoBmC,WAAA,EAAA,KAAA,WAAA;IAAA,OACZhB,GACLV,eACAK,eACA,6DACAiC,mBAAmBf,MAAMU,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AAA,WAAA;EAAA,OAAQhB,GAAG,cAAca,MAAMI,KAAK;CAAC,EAAA,GAAMH,IAAI,CAAA;AAClF;;AAGA,IAAauD,oBAAoBD"}
1
+ {"version":3,"file":"dialog.js","names":["KobalteDialog","KobalteDialogContent","KobalteDialogOverlay","X","Show","splitProps","dialogSurface","overlayCornerClose","overlayDescription","overlayFooter","overlayHeader","overlayMotion","overlayPositioner","overlayScrim","overlayScrimMotion","overlayTitle","cn","Tooltip","TooltipContent","TooltipTrigger","createDialogLayer","DialogEscapeTarget","Portal","DialogOverlay","props","local","rest","_$createComponent","_$mergeProps","class","closeButton","closeLabel","positioner","size","initialFocus","restoreFocusRef","HTMLElement","dialogContentSizes","sm","md","lg","xl","DialogContent","layer","onOpenAutoFocus","event","defaultPrevented","currentTarget","preventDefault","focus","preventScroll","onCloseAutoFocus","children","_el$","_tmpl$","_$insert","onEscapeKeyDown","_$memo","when","as","CloseButton","_$effect","_$className","DialogHeader","band","_el$2","_tmpl$2","_$spread","DialogFooter","_el$3","_tmpl$3","DialogTitle","Title","DialogDescription","Description","DialogClose","DialogCloseButton"],"sources":["../../../../src/components/ui/dialog/dialog.tsx"],"sourcesContent":["import {\n Dialog as KobalteDialog,\n Content as KobalteDialogContent,\n Overlay as KobalteDialogOverlay,\n} from '@kobalte/core/dialog'\n// AlertDialog assigns to the shared DialogRoot.Content object, so these named exports stay role-stable.\nimport { X } from 'lucide-solid'\nimport type { Accessor, ComponentProps, JSX } from 'solid-js'\nimport { Show, splitProps } from 'solid-js'\nimport {\n dialogSurface,\n overlayCornerClose,\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 { Tooltip, TooltipContent, TooltipTrigger } from '../tooltip'\nimport { createDialogLayer, DialogEscapeTarget } from './dialog-layer'\n\n/**\n * Dialog.\n *\n * A modal surface for a decision or a short task. `Dialog.Portal` keeps the\n * panel out of the app's stacking and overflow contexts, `Dialog.Overlay`\n * dims what is behind it, and Kobalte handles the focus trap, the escape key\n * and scroll locking. Focus returns on close to whatever had it before the\n * dialog opened, trigger or not (pass `restoreFocusRef` when that control is\n * gone by then, such as a menu row).\n *\n * The close button is part of the content rather than optional, because every\n * modal needs a way out that is not the keyboard. A dialog whose only exit is\n * Escape is a trap for anyone using a pointer.\n */\nexport {\n Root as Dialog,\n Trigger as DialogTrigger,\n Portal as DialogPortal,\n} from '@kobalte/core/dialog'\n\nexport function DialogOverlay(props: ComponentProps<typeof KobalteDialogOverlay>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <KobalteDialogOverlay class={cn(overlayScrim, overlayScrimMotion, local.class)} {...rest} />\n )\n}\n\nexport type DialogContentProps = ComponentProps<typeof KobalteDialogContent> & {\n /**\n * Replaces the default close button. Pass `false` to remove it — only for a\n * dialog that cannot be dismissed (an update that must finish); anything the\n * user can escape from needs the button.\n */\n closeButton?: JSX.Element | false\n /**\n * The corner close's accessible name. Defaults to \"Close\". Name it for the\n * dialog (\"Close version and updates\") when the footer also has a text\n * \"Close\", so the two controls do not share one name.\n */\n closeLabel?: string\n /** Use a 1rem inset as the positioner bounds for tall, viewport-filling surfaces. */\n positioner?: 'default' | 'inset'\n /**\n * The panel's maximum width. `md` (32rem) is the default and right for a\n * confirmation or a short form; `sm` (28rem) for a single question; `lg`\n * (42rem) for a picker or a form with two columns; `xl` (48rem) for a\n * multi-step flow that needs a table or a preview beside its fields.\n */\n size?: DialogContentSize\n /**\n * Where focus lands on open. `first-control` (the default) is the first\n * tabbable control; `panel` focuses the panel itself, for a dialog whose\n * content should be read before an action is reached (an About box, an\n * update summary).\n */\n initialFocus?: 'first-control' | 'panel'\n /** The control to focus on close when the one focused before opening is gone by then. */\n restoreFocusRef?: Accessor<HTMLElement | undefined>\n}\n\n/** The dialog width ladder, so a caller picks a rung instead of a `max-w-*`. */\nexport const dialogContentSizes = {\n sm: 'max-w-md',\n md: 'max-w-lg',\n lg: 'max-w-2xl',\n xl: 'max-w-3xl',\n} as const\n\nexport type DialogContentSize = keyof typeof dialogContentSizes\n\nexport function DialogContent(props: DialogContentProps) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'children',\n 'closeButton',\n 'closeLabel',\n 'positioner',\n 'size',\n 'initialFocus',\n 'restoreFocusRef',\n 'onOpenAutoFocus',\n 'onCloseAutoFocus',\n ])\n const layer = createDialogLayer({\n restoreFocusRef: local.restoreFocusRef,\n onOpenAutoFocus: (event) => {\n local.onOpenAutoFocus?.(event)\n if (\n local.initialFocus === 'panel' &&\n !event.defaultPrevented &&\n event.currentTarget instanceof HTMLElement\n ) {\n event.preventDefault()\n event.currentTarget.focus({ preventScroll: true })\n }\n },\n onCloseAutoFocus: (event) => local.onCloseAutoFocus?.(event),\n })\n\n return (\n <KobalteDialog.Portal>\n <DialogOverlay />\n <div class={cn(overlayPositioner, local.positioner === 'inset' && 'inset-4 grid-rows-1 p-0')}>\n <KobalteDialogContent\n class={cn(\n dialogSurface,\n overlayMotion,\n 'relative grid max-h-full w-full gap-4 overflow-y-auto p-5',\n dialogContentSizes[local.size ?? 'md'],\n local.class\n )}\n {...rest}\n onOpenAutoFocus={layer.onOpenAutoFocus}\n onCloseAutoFocus={layer.onCloseAutoFocus}\n >\n <DialogEscapeTarget onEscapeKeyDown={props.onEscapeKeyDown}>\n {local.children}\n <Show when={local.closeButton !== false}>\n {/* The corner close is icon-only, so it carries the shared tooltip\n treatment. */}\n <Tooltip>\n <TooltipTrigger\n as={KobalteDialog.CloseButton}\n data-slot=\"dialog-corner-close\"\n aria-label={local.closeLabel ?? 'Close'}\n class={overlayCornerClose}\n >\n {local.closeButton ?? <X class=\"size-4\" />}\n </TooltipTrigger>\n <TooltipContent>\n {local.closeLabel ? `${local.closeLabel}.` : 'Close dialog.'}\n </TooltipContent>\n </Tooltip>\n </Show>\n </DialogEscapeTarget>\n </KobalteDialogContent>\n </div>\n </KobalteDialog.Portal>\n )\n}\n\n/**\n * The dialog's title block. `band` steps it onto the elevation ladder's\n * subtle-fill rung (`--muted`), the same treatment as the sheet parts' band —\n * for the dialog family whose panel anatomy matches a sheet's (a title band\n * over a full-bleed shell, such as a settings dialog) rather than the centred\n * modal's documented flat surface. See `SheetFooter` for the rung's rationale.\n */\nexport function DialogHeader(props: ComponentProps<'div'> & { band?: boolean }) {\n const [local, rest] = splitProps(props, ['class', 'band'])\n return (\n <div\n data-slot=\"dialog-header\"\n class={cn(overlayHeader, 'pe-6', { 'bg-muted': local.band }, local.class)}\n {...rest}\n />\n )\n}\n\nexport function DialogFooter(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class'])\n return <div data-slot=\"dialog-footer\" class={cn(overlayFooter, local.class)} {...rest} />\n}\n\nexport function DialogTitle(props: ComponentProps<typeof KobalteDialog.Title>) {\n const [local, rest] = splitProps(props, ['class'])\n return <KobalteDialog.Title class={cn(overlayTitle, local.class)} {...rest} />\n}\n\nexport function DialogDescription(props: ComponentProps<typeof KobalteDialog.Description>) {\n const [local, rest] = splitProps(props, ['class'])\n return <KobalteDialog.Description class={cn(overlayDescription, local.class)} {...rest} />\n}\n\n/**\n * A close control of the caller's own, polymorphic — for a footer's text\n * \"Cancel\" or \"Close\", which is a different control from the corner icon the\n * content draws. Take it as `as={Button}` so it carries the button's variants\n * rather than a copied class string.\n */\nexport function DialogClose(props: ComponentProps<typeof KobalteDialog.CloseButton>) {\n const [local, rest] = splitProps(props, ['class'])\n return <KobalteDialog.CloseButton class={cn('focus-ring', local.class)} {...rest} />\n}\n\n/** The earlier name for `DialogClose`. */\nexport const DialogCloseButton = DialogClose\n"],"mappings":";;;;;;;;;;;;AA6CA,SAAgBuB,cAAcC,OAAoD;CAChF,MAAM,CAACC,OAAOC,QAAQrB,WAAWmB,OAAO,CAAC,OAAO,CAAC;CACjD,OAAAG,gBACGzB,SAAoB0B,WAAA,EAAA,KAAA,WAAA;EAAA,OAAQZ,GAAGH,cAAcC,oBAAoB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CACjD,cAAA;EAAA,IAAA6C,QAAAC,QAAA;EAAAH,OAAAE,OAAAzC,WAAA,EAAA,KAAA,WAAA;GAAA,OAA6CZ,GAAGP,eAAegB,MAAMI,KAAK;EAAC,EAAA,GAAMH,IAAI,GAAA,OAAA,KAAA;EAAA,OAAA2C;CAAA,EAAA,CAAA;AACvF;AAEA,SAAgBE,YAAY/C,OAAmD;CAC7E,MAAM,CAACC,OAAOC,QAAQrB,WAAWmB,OAAO,CAAC,OAAO,CAAC;CACjD,OAAAG,gBAAQ3B,OAAcwE,OAAK5C,WAAA,EAAA,KAAA,WAAA;EAAA,OAAQZ,GAAGD,cAAcU,MAAMI,KAAK;CAAC,EAAA,GAAMH,IAAI,CAAA;AAC5E;AAEA,SAAgB+C,kBAAkBjD,OAAyD;CACzF,MAAM,CAACC,OAAOC,QAAQrB,WAAWmB,OAAO,CAAC,OAAO,CAAC;CACjD,OAAAG,gBAAQ3B,OAAc0E,aAAW9C,WAAA,EAAA,KAAA,WAAA;EAAA,OAAQZ,GAAGR,oBAAoBiB,MAAMI,KAAK;CAAC,EAAA,GAAMH,IAAI,CAAA;AACxF;;;;;;;AAQA,SAAgBiD,YAAYnD,OAAyD;CACnF,MAAM,CAACC,OAAOC,QAAQrB,WAAWmB,OAAO,CAAC,OAAO,CAAC;CACjD,OAAAG,gBAAQ3B,OAAc4D,aAAWhC,WAAA,EAAA,KAAA,WAAA;EAAA,OAAQZ,GAAG,cAAcS,MAAMI,KAAK;CAAC,EAAA,GAAMH,IAAI,CAAA;AAClF;;AAGA,IAAakD,oBAAoBD"}
@@ -1 +1 @@
1
- {"version":3,"file":"diff-block.js","names":["createMemo","For","Show","splitProps","ComponentProps","JSX","cva","VariantProps","cn","DiffLineKind","DiffLine","Readonly","kind","text","marker","oldLine","newLine","HUNK_HEADER","parseDiff","patch","lines","inHunk","raw","replace","split","test","match","exec","Number","push","isFileHeader","startsWith","slice","numbered","line","show","Boolean","diffStats","added","removed","diffTargetPath","git","plain","fromHeader","diffLineVariants","variants","add","delete","context","hunk","header","meta","defaultVariants","DiffBlockProps","Omit","title","complete","showLineNumbers","actions","Element","DiffBlock","props","local","rest","stats","name","pop","_el$","_tmpl$2","_el$2","firstChild","_el$3","_el$4","_el$5","nextSibling","_el$6","_el$7","_el$8","_el$9","_el$0","_el$1","_el$10","_$spread","_$mergeProps","class","_$insert","_$createComponent","each","children","_el$12","_tmpl$4","_el$15","_el$16","_el$17","when","_el$13","_tmpl$3","_el$14","_c$","_$memo","_c$2","_$effect","_$className","_tmpl$","_$setAttribute","DiffSummary","onSelect","_el$18","_tmpl$5","_el$19","_el$20","_el$21","_el$22","_el$23","_el$24","_el$25","$$click","_$delegateEvents","_$mergeProps","_$createComponent","_$memo","_$className","_$setAttribute","_$delegateEvents"],"sources":["../../../../src/components/ui/diff-block/diff-block.tsx"],"sourcesContent":["import { createMemo, For, Show, splitProps, type ComponentProps, type JSX } from 'solid-js'\nimport { cva, type VariantProps } from '#lib/variants'\nimport { cn } from '#lib/utils'\n\n/**\n * DiffBlock.\n *\n * A unified diff, classified and toned. Parsing lives here because the\n * classification is the part that is easy to get subtly wrong and impossible to\n * fix from a caller: whether a line is an addition, a deletion, a hunk header,\n * a file header, or context depends on state — a line beginning with `+++` is a\n * file header *before* the first hunk and an added line beginning with `++`\n * *inside* one — and a renderer that tested prefixes without that state would\n * mis-colour real patches.\n *\n * The line grammar:\n *\n * | Prefix | Meaning |\n * | --- | --- |\n * | `diff --git`, `index`, `---`, `+++` (before a hunk) | file header |\n * | `@@` | hunk header |\n * | `+` | addition |\n * | `-` | deletion |\n * | `\\` | the \"no newline at end of file\" marker |\n * | anything else, including a leading space | context |\n *\n * Tones are pairs of surface and text, so an addition is readable in both\n * polarities and with any accent — the greens and reds are the theme's own\n * `success` and `destructive` at low alpha, not fixed hexes. Colour is never the\n * only signal: the gutter carries `+` or `-` as well, which is what makes the\n * block usable in greyscale and by anyone who cannot separate the two hues.\n *\n * Split (side-by-side) view is deliberately not implemented. It is a different\n * layout algorithm — pairing deletions with additions across hunks — and a\n * half-correct one is worse than none. `view=\"unified\"` is the only value, and\n * the prop exists so that adding the second is not a breaking change.\n */\n\nexport type DiffLineKind = 'add' | 'delete' | 'context' | 'hunk' | 'header' | 'meta'\n\nexport type DiffLine = Readonly<{\n kind: DiffLineKind\n /** The line without its diff prefix. */\n text: string\n /** The prefix as written: `+`, `-`, a space, or nothing for a header. */\n marker: string\n /** The old-side line number, when the line exists on the old side. */\n oldLine?: number\n /** The new-side line number, when the line exists on the new side. */\n newLine?: number\n}>\n\nconst HUNK_HEADER = /^@@ -(\\d+)(?:,\\d+)? \\+(\\d+)(?:,\\d+)? @@/\n\n/**\n * Classify a unified diff.\n *\n * `headerState` is what makes `---` and `+++` unambiguous: git writes them as\n * file headers before the first `@@` and as content after it, and the two need\n * different tones. `oldLine`/`newLine` are tracked so the gutter can number both\n * sides — the numbers a reader uses to find the change in their editor.\n */\nexport function parseDiff(patch: string): readonly DiffLine[] {\n const lines: DiffLine[] = []\n let inHunk = false\n let oldLine = 0\n let newLine = 0\n\n for (const raw of patch.replace(/\\n$/, '').split('\\n')) {\n if (HUNK_HEADER.test(raw)) {\n const match = HUNK_HEADER.exec(raw)!\n oldLine = Number(match[1])\n newLine = Number(match[2])\n inHunk = true\n lines.push({ kind: 'hunk', text: raw, marker: '' })\n continue\n }\n\n if (!inHunk) {\n const isFileHeader =\n raw.startsWith('diff --git') ||\n raw.startsWith('index ') ||\n raw.startsWith('new file') ||\n raw.startsWith('deleted file') ||\n raw.startsWith('similarity index') ||\n raw.startsWith('rename ') ||\n raw.startsWith('--- ') ||\n raw.startsWith('+++ ')\n lines.push({ kind: isFileHeader ? 'header' : 'meta', text: raw, marker: '' })\n continue\n }\n\n if (raw.startsWith('\\\\')) {\n lines.push({ kind: 'meta', text: raw, marker: '' })\n continue\n }\n\n const marker = raw[0] ?? ' '\n if (marker === '+') {\n lines.push({ kind: 'add', text: raw.slice(1), marker, newLine })\n newLine += 1\n } else if (marker === '-') {\n lines.push({ kind: 'delete', text: raw.slice(1), marker, oldLine })\n oldLine += 1\n } else {\n lines.push({ kind: 'context', text: raw.slice(1), marker: ' ', oldLine, newLine })\n oldLine += 1\n newLine += 1\n }\n }\n\n return lines\n}\n\n/**\n * Whether a line gets gutter numbers. A hunk header and a file header are\n * structural, so numbering them would put a number on a line that has none.\n */\nfunction numbered(line: DiffLine, show: boolean | undefined): boolean {\n return Boolean(show) && line.kind !== 'hunk' && line.kind !== 'header' && line.kind !== 'meta'\n}\n\n/** The counts a diff summary reports: how much was added and removed. */\nexport function diffStats(\n lines: readonly DiffLine[]\n): Readonly<{ added: number; removed: number }> {\n let added = 0\n let removed = 0\n for (const line of lines) {\n if (line.kind === 'add') added += 1\n else if (line.kind === 'delete') removed += 1\n }\n return { added, removed }\n}\n\n/**\n * The target path from a unified diff's file header. Prefers `+++ b/<path>` —\n * git's explicit new-side marker — and skips `/dev/null`, which marks an added\n * or deleted side rather than naming a file. Only lines outside a hunk are\n * considered, for the same reason the parser tracks state.\n */\nexport function diffTargetPath(patch: string): string | null {\n for (const line of patch.split('\\n')) {\n if (line.startsWith('@@')) break\n const git = /^\\+\\+\\+ b\\/(.+?)(?:\\t|$)/.exec(line)\n if (git) return git[1]!\n const plain = /^\\+\\+\\+ ([^\\s/][^\\t]*?)(?:\\t|$)/.exec(line)\n if (plain && plain[1] !== '/dev/null') return plain[1]!\n const fromHeader = /^diff --git a\\/.+ b\\/(.+)/.exec(line)\n if (fromHeader) return fromHeader[1]!\n }\n return null\n}\n\nexport const diffLineVariants = cva('flex items-baseline font-code text-code', {\n variants: {\n kind: {\n add: 'bg-success-subtle text-foreground',\n delete: 'bg-destructive-subtle text-foreground',\n context: 'text-foreground',\n hunk: 'bg-muted text-muted-foreground',\n header: 'bg-muted font-semibold text-foreground',\n meta: 'text-muted-foreground italic',\n },\n },\n defaultVariants: { kind: 'context' },\n})\n\nexport type DiffBlockProps = Omit<ComponentProps<'div'>, 'children'> &\n VariantProps<typeof diffLineVariants> & {\n /** The unified diff. */\n patch: string\n /** A filename. Defaults to the path in the patch's header, or \"diff\". */\n title?: string\n /** False while the patch is still streaming. */\n complete?: boolean\n /** Show the two line-number gutters. Off for a fragment with no line numbers. */\n showLineNumbers?: boolean\n /** Extra header controls. */\n actions?: JSX.Element\n }\n\nexport function DiffBlock(props: DiffBlockProps) {\n const [local, rest] = splitProps(props, [\n 'patch',\n 'title',\n 'complete',\n 'showLineNumbers',\n 'actions',\n 'class',\n ])\n\n const lines = createMemo(() => parseDiff(local.patch))\n const stats = createMemo(() => diffStats(lines()))\n const name = () => local.title ?? diffTargetPath(local.patch)?.split('/').pop() ?? 'diff'\n\n return (\n <div\n class={cn('overflow-hidden rounded-xl border border-border bg-card', local.class)}\n {...rest}\n >\n <div class=\"flex items-center justify-between gap-2 border-b border-border px-3 py-1\">\n <span class=\"flex min-w-0 items-baseline gap-2\">\n <span class=\"truncate font-code text-code text-foreground\">{name()}</span>\n {/* The counts are text, so the summary survives greyscale and a reader\n who cannot separate the two line tones still gets the shape of it. */}\n <span class=\"shrink-0 font-code text-code text-muted-foreground\">\n <span class=\"text-foreground\">+{stats().added}</span>{' '}\n <span class=\"text-foreground\">−{stats().removed}</span>\n </span>\n </span>\n {local.actions}\n </div>\n <div\n class=\"scroll-fade overflow-x-auto\"\n tabindex=\"0\"\n role=\"region\"\n aria-label={`Diff for ${name()}`}\n >\n <div class=\"min-w-fit\">\n <For each={lines()}>\n {(line) => (\n <div class={diffLineVariants({ kind: line.kind })}>\n <Show when={numbered(line, local.showLineNumbers)}>\n <span\n class=\"w-10 shrink-0 pr-2 text-right text-code text-muted-foreground tabular-nums select-none\"\n aria-hidden=\"true\"\n >\n {line.oldLine ?? ''}\n </span>\n <span\n class=\"w-10 shrink-0 pr-2 text-right text-code text-muted-foreground tabular-nums select-none\"\n aria-hidden=\"true\"\n >\n {line.newLine ?? ''}\n </span>\n </Show>\n {/* The marker is the signal that is not a colour. */}\n <span class=\"w-4 shrink-0 text-center select-none\" aria-hidden=\"true\">\n {line.kind === 'add' ? '+' : line.kind === 'delete' ? '−' : ''}\n </span>\n <span class=\"min-w-0 whitespace-pre pr-4\">\n {/* A screen reader gets the kind as a word, not a glyph. */}\n <span class=\"visually-hidden\">\n {line.kind === 'add' ? 'Added: ' : line.kind === 'delete' ? 'Removed: ' : ''}\n </span>\n {line.text || ' '}\n </span>\n </div>\n )}\n </For>\n </div>\n <Show when={!local.complete}>\n <p class=\"px-3 py-1 text-xs text-muted-foreground italic\">Generating diff…</p>\n </Show>\n </div>\n </div>\n )\n}\n\n/**\n * A diff summary line, for a list of changes rather than one patch: the file and\n * its counts. Uses `CodeBlock`'s height rules and nothing else, because a summary\n * is a row and not a surface.\n */\nexport function DiffSummary(props: { patch: string; class?: string; onSelect?: () => void }) {\n const stats = createMemo(() => diffStats(parseDiff(props.patch)))\n const name = () => diffTargetPath(props.patch) ?? 'diff'\n\n return (\n <button\n type=\"button\"\n class={cn(\n 'flex w-full items-baseline justify-between gap-3 rounded-md px-2 py-1 text-left font-code text-code hover:bg-muted',\n props.class\n )}\n onClick={() => props.onSelect?.()}\n >\n <span class=\"truncate text-foreground\">{name()}</span>\n <span class=\"shrink-0 text-code\">\n <span class=\"text-foreground\">+{stats().added}</span>{' '}\n <span class=\"text-foreground\">−{stats().removed}</span>\n </span>\n </button>\n )\n}\n"],"mappings":";;;;;;;;;;AAoDA,IAAMiB,cAAc;;;;;;;;;AAUpB,SAAgBC,UAAUC,OAAoC;CAC5D,MAAMC,QAAoB,CAAA;CAC1B,IAAIC,SAAS;CACb,IAAIN,UAAU;CACd,IAAIC,UAAU;CAEd,KAAK,MAAMM,OAAOH,MAAMI,QAAQ,OAAO,EAAE,CAAC,CAACC,MAAM,IAAI,GAAG;EACtD,IAAIP,YAAYQ,KAAKH,GAAG,GAAG;GACzB,MAAMI,QAAQT,YAAYU,KAAKL,GAAG;GAClCP,UAAUa,OAAOF,MAAM,EAAE;GACzBV,UAAUY,OAAOF,MAAM,EAAE;GAC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AUP;AAACU,eAAA,CAAA,OAAA,CAAA"}
1
+ {"version":3,"file":"diff-block.js","names":["createMemo","For","Show","splitProps","cva","cn","kind","text","marker","oldLine","newLine","HUNK_HEADER","parseDiff","patch","lines","inHunk","raw","replace","split","test","match","exec","Number","push","isFileHeader","startsWith","slice","numbered","line","show","Boolean","diffStats","added","removed","diffTargetPath","git","plain","fromHeader","diffLineVariants","variants","add","delete","context","hunk","header","meta","defaultVariants","title","complete","showLineNumbers","actions","DiffBlock","props","local","rest","stats","name","pop","_el$","_tmpl$2","_el$2","firstChild","_el$4","nextSibling","_el$6","_el$9","_el$1","_el$10","_$spread","_$mergeProps","class","_$insert","_$createComponent","each","children","_el$12","_tmpl$4","_el$15","_el$16","_el$17","when","_el$13","_tmpl$3","_el$14","_c$","_$memo","_c$2","_$effect","_$className","_tmpl$","_$setAttribute","DiffSummary","onSelect","_el$18","_tmpl$5","_el$19","_el$21","_el$24","$$click","_$delegateEvents"],"sources":["../../../../src/components/ui/diff-block/diff-block.tsx"],"sourcesContent":["import { createMemo, For, Show, splitProps, type ComponentProps, type JSX } from 'solid-js'\nimport { cva, type VariantProps } from '#lib/variants'\nimport { cn } from '#lib/utils'\n\n/**\n * DiffBlock.\n *\n * A unified diff, classified and toned. Parsing lives here because the\n * classification is the part that is easy to get subtly wrong and impossible to\n * fix from a caller: whether a line is an addition, a deletion, a hunk header,\n * a file header, or context depends on state — a line beginning with `+++` is a\n * file header *before* the first hunk and an added line beginning with `++`\n * *inside* one — and a renderer that tested prefixes without that state would\n * mis-colour real patches.\n *\n * The line grammar:\n *\n * | Prefix | Meaning |\n * | --- | --- |\n * | `diff --git`, `index`, `---`, `+++` (before a hunk) | file header |\n * | `@@` | hunk header |\n * | `+` | addition |\n * | `-` | deletion |\n * | `\\` | the \"no newline at end of file\" marker |\n * | anything else, including a leading space | context |\n *\n * Tones are pairs of surface and text, so an addition is readable in both\n * polarities and with any accent — the greens and reds are the theme's own\n * `success` and `destructive` at low alpha, not fixed hexes. Colour is never the\n * only signal: the gutter carries `+` or `-` as well, which is what makes the\n * block usable in greyscale and by anyone who cannot separate the two hues.\n *\n * Split (side-by-side) view is deliberately not implemented. It is a different\n * layout algorithm — pairing deletions with additions across hunks — and a\n * half-correct one is worse than none. `view=\"unified\"` is the only value, and\n * the prop exists so that adding the second is not a breaking change.\n */\n\nexport type DiffLineKind = 'add' | 'delete' | 'context' | 'hunk' | 'header' | 'meta'\n\nexport type DiffLine = Readonly<{\n kind: DiffLineKind\n /** The line without its diff prefix. */\n text: string\n /** The prefix as written: `+`, `-`, a space, or nothing for a header. */\n marker: string\n /** The old-side line number, when the line exists on the old side. */\n oldLine?: number\n /** The new-side line number, when the line exists on the new side. */\n newLine?: number\n}>\n\nconst HUNK_HEADER = /^@@ -(\\d+)(?:,\\d+)? \\+(\\d+)(?:,\\d+)? @@/\n\n/**\n * Classify a unified diff.\n *\n * `headerState` is what makes `---` and `+++` unambiguous: git writes them as\n * file headers before the first `@@` and as content after it, and the two need\n * different tones. `oldLine`/`newLine` are tracked so the gutter can number both\n * sides — the numbers a reader uses to find the change in their editor.\n */\nexport function parseDiff(patch: string): readonly DiffLine[] {\n const lines: DiffLine[] = []\n let inHunk = false\n let oldLine = 0\n let newLine = 0\n\n for (const raw of patch.replace(/\\n$/, '').split('\\n')) {\n if (HUNK_HEADER.test(raw)) {\n const match = HUNK_HEADER.exec(raw)!\n oldLine = Number(match[1])\n newLine = Number(match[2])\n inHunk = true\n lines.push({ kind: 'hunk', text: raw, marker: '' })\n continue\n }\n\n if (!inHunk) {\n const isFileHeader =\n raw.startsWith('diff --git') ||\n raw.startsWith('index ') ||\n raw.startsWith('new file') ||\n raw.startsWith('deleted file') ||\n raw.startsWith('similarity index') ||\n raw.startsWith('rename ') ||\n raw.startsWith('--- ') ||\n raw.startsWith('+++ ')\n lines.push({ kind: isFileHeader ? 'header' : 'meta', text: raw, marker: '' })\n continue\n }\n\n if (raw.startsWith('\\\\')) {\n lines.push({ kind: 'meta', text: raw, marker: '' })\n continue\n }\n\n const marker = raw[0] ?? ' '\n if (marker === '+') {\n lines.push({ kind: 'add', text: raw.slice(1), marker, newLine })\n newLine += 1\n } else if (marker === '-') {\n lines.push({ kind: 'delete', text: raw.slice(1), marker, oldLine })\n oldLine += 1\n } else {\n lines.push({ kind: 'context', text: raw.slice(1), marker: ' ', oldLine, newLine })\n oldLine += 1\n newLine += 1\n }\n }\n\n return lines\n}\n\n/**\n * Whether a line gets gutter numbers. A hunk header and a file header are\n * structural, so numbering them would put a number on a line that has none.\n */\nfunction numbered(line: DiffLine, show: boolean | undefined): boolean {\n return Boolean(show) && line.kind !== 'hunk' && line.kind !== 'header' && line.kind !== 'meta'\n}\n\n/** The counts a diff summary reports: how much was added and removed. */\nexport function diffStats(\n lines: readonly DiffLine[]\n): Readonly<{ added: number; removed: number }> {\n let added = 0\n let removed = 0\n for (const line of lines) {\n if (line.kind === 'add') added += 1\n else if (line.kind === 'delete') removed += 1\n }\n return { added, removed }\n}\n\n/**\n * The target path from a unified diff's file header. Prefers `+++ b/<path>` —\n * git's explicit new-side marker — and skips `/dev/null`, which marks an added\n * or deleted side rather than naming a file. Only lines outside a hunk are\n * considered, for the same reason the parser tracks state.\n */\nexport function diffTargetPath(patch: string): string | null {\n for (const line of patch.split('\\n')) {\n if (line.startsWith('@@')) break\n const git = /^\\+\\+\\+ b\\/(.+?)(?:\\t|$)/.exec(line)\n if (git) return git[1]!\n const plain = /^\\+\\+\\+ ([^\\s/][^\\t]*?)(?:\\t|$)/.exec(line)\n if (plain && plain[1] !== '/dev/null') return plain[1]!\n const fromHeader = /^diff --git a\\/.+ b\\/(.+)/.exec(line)\n if (fromHeader) return fromHeader[1]!\n }\n return null\n}\n\nexport const diffLineVariants = cva('flex items-baseline font-code text-code', {\n variants: {\n kind: {\n add: 'bg-success-subtle text-foreground',\n delete: 'bg-destructive-subtle text-foreground',\n context: 'text-foreground',\n hunk: 'bg-muted text-muted-foreground',\n header: 'bg-muted font-semibold text-foreground',\n meta: 'text-muted-foreground italic',\n },\n },\n defaultVariants: { kind: 'context' },\n})\n\nexport type DiffBlockProps = Omit<ComponentProps<'div'>, 'children'> &\n VariantProps<typeof diffLineVariants> & {\n /** The unified diff. */\n patch: string\n /** A filename. Defaults to the path in the patch's header, or \"diff\". */\n title?: string\n /** False while the patch is still streaming. */\n complete?: boolean\n /** Show the two line-number gutters. Off for a fragment with no line numbers. */\n showLineNumbers?: boolean\n /** Extra header controls. */\n actions?: JSX.Element\n }\n\nexport function DiffBlock(props: DiffBlockProps) {\n const [local, rest] = splitProps(props, [\n 'patch',\n 'title',\n 'complete',\n 'showLineNumbers',\n 'actions',\n 'class',\n ])\n\n const lines = createMemo(() => parseDiff(local.patch))\n const stats = createMemo(() => diffStats(lines()))\n const name = () => local.title ?? diffTargetPath(local.patch)?.split('/').pop() ?? 'diff'\n\n return (\n <div\n class={cn('overflow-hidden rounded-xl border border-border bg-card', local.class)}\n {...rest}\n >\n <div class=\"flex items-center justify-between gap-2 border-b border-border px-3 py-1\">\n <span class=\"flex min-w-0 items-baseline gap-2\">\n <span class=\"truncate font-code text-code text-foreground\">{name()}</span>\n {/* The counts are text, so the summary survives greyscale and a reader\n who cannot separate the two line tones still gets the shape of it. */}\n <span class=\"shrink-0 font-code text-code text-muted-foreground\">\n <span class=\"text-foreground\">+{stats().added}</span>{' '}\n <span class=\"text-foreground\">−{stats().removed}</span>\n </span>\n </span>\n {local.actions}\n </div>\n <div\n class=\"scroll-fade overflow-x-auto\"\n tabindex=\"0\"\n role=\"region\"\n aria-label={`Diff for ${name()}`}\n >\n <div class=\"min-w-fit\">\n <For each={lines()}>\n {(line) => (\n <div class={diffLineVariants({ kind: line.kind })}>\n <Show when={numbered(line, local.showLineNumbers)}>\n <span\n class=\"w-10 shrink-0 pr-2 text-right text-code text-muted-foreground tabular-nums select-none\"\n aria-hidden=\"true\"\n >\n {line.oldLine ?? ''}\n </span>\n <span\n class=\"w-10 shrink-0 pr-2 text-right text-code text-muted-foreground tabular-nums select-none\"\n aria-hidden=\"true\"\n >\n {line.newLine ?? ''}\n </span>\n </Show>\n {/* The marker is the signal that is not a colour. */}\n <span class=\"w-4 shrink-0 text-center select-none\" aria-hidden=\"true\">\n {line.kind === 'add' ? '+' : line.kind === 'delete' ? '−' : ''}\n </span>\n <span class=\"min-w-0 whitespace-pre pr-4\">\n {/* A screen reader gets the kind as a word, not a glyph. */}\n <span class=\"visually-hidden\">\n {line.kind === 'add' ? 'Added: ' : line.kind === 'delete' ? 'Removed: ' : ''}\n </span>\n {line.text || ' '}\n </span>\n </div>\n )}\n </For>\n </div>\n <Show when={!local.complete}>\n <p class=\"px-3 py-1 text-xs text-muted-foreground italic\">Generating diff…</p>\n </Show>\n </div>\n </div>\n )\n}\n\n/**\n * A diff summary line, for a list of changes rather than one patch: the file and\n * its counts. Uses `CodeBlock`'s height rules and nothing else, because a summary\n * is a row and not a surface.\n */\nexport function DiffSummary(props: { patch: string; class?: string; onSelect?: () => void }) {\n const stats = createMemo(() => diffStats(parseDiff(props.patch)))\n const name = () => diffTargetPath(props.patch) ?? 'diff'\n\n return (\n <button\n type=\"button\"\n class={cn(\n 'flex w-full items-baseline justify-between gap-3 rounded-md px-2 py-1 text-left font-code text-code hover:bg-muted',\n props.class\n )}\n onClick={() => props.onSelect?.()}\n >\n <span class=\"truncate text-foreground\">{name()}</span>\n <span class=\"shrink-0 text-code\">\n <span class=\"text-foreground\">+{stats().added}</span>{' '}\n <span class=\"text-foreground\">−{stats().removed}</span>\n </span>\n </button>\n )\n}\n"],"mappings":";;;;;;;;;;AAoDA,IAAMW,cAAc;;;;;;;;;AAUpB,SAAgBC,UAAUC,OAAoC;CAC5D,MAAMC,QAAoB,CAAA;CAC1B,IAAIC,SAAS;CACb,IAAIN,UAAU;CACd,IAAIC,UAAU;CAEd,KAAK,MAAMM,OAAOH,MAAMI,QAAQ,OAAO,EAAE,CAAC,CAACC,MAAM,IAAI,GAAG;EACtD,IAAIP,YAAYQ,KAAKH,GAAG,GAAG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aAAAC,UAAAK,QAT1CxF,GACL,sHACA+C,MAAMkB,KACR,CAAC,CAAA;EAAA,OAAAuB;CAAA,EAAA,CAAA;AAUP;AAACM,eAAA,CAAA,OAAA,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"drawer.js","names":["DrawerPrimitive","ComponentProps","splitProps","overlayDescription","overlayFooter","overlayHeader","overlayTitle","cn","Drawer","props","_$createComponent","DrawerTrigger","Trigger","DrawerOverlay","Overlay","local","rest","_$mergeProps","class","DrawerContentProps","Omit","Content","side","withHandle","DrawerContent","Portal","children","_$memo","_el$","_tmpl$","_$effect","_$className","DrawerTitle","Label","DrawerDescription","Description","DrawerCloseButton","Close","DrawerHeader","_el$2","_tmpl$2","_$spread","DrawerBody","_el$3","_tmpl$3","DrawerFooter","_el$4","_tmpl$4","_$createComponent","_$mergeProps","_$memo","_$className"],"sources":["../../../../src/components/ui/drawer/drawer.tsx"],"sourcesContent":["import DrawerPrimitive from '@corvu/drawer'\nimport type { ComponentProps } from 'solid-js'\nimport { splitProps } from 'solid-js'\nimport { overlayDescription, overlayFooter, overlayHeader, overlayTitle } from '#lib/overlay'\nimport { cn } from '#lib/utils'\n\n/**\n * Drawer.\n *\n * A sheet the user can drag away: it opens from an edge, carries a handle, and\n * closes by swipe as well as by button. That drag affordance is the reason to\n * choose it over Sheet — the gesture is for content the user is *finishing*\n * with (a summary, a queue, a confirmation), not for browsing.\n *\n * On a large window a Drawer is usually the wrong control: dragging is a touch\n * idiom, and on a desktop the same content is better as a Sheet or a Dialog.\n * The exceptions are the surfaces a pointer also drags naturally — a bottom\n * console, a media panel.\n *\n * corvu supplies the drag physics, the snap points and the pointer capture.\n */\nexport function Drawer(props: ComponentProps<typeof DrawerPrimitive>) {\n return <DrawerPrimitive {...props} />\n}\n\nexport function DrawerTrigger(props: ComponentProps<typeof DrawerPrimitive.Trigger>) {\n return <DrawerPrimitive.Trigger {...props} />\n}\n\nexport function DrawerOverlay(props: ComponentProps<typeof DrawerPrimitive.Overlay>) {\n const [local, rest] = splitProps(props, ['class'])\n\n return (\n <DrawerPrimitive.Overlay\n class={cn(\n 'fixed inset-0 z-(--z-drawer) bg-scrim/50',\n 'data-[open]:animate-in data-[open]:fade-in-0 data-[closed]:animate-out data-[closed]:fade-out-0',\n local.class\n )}\n {...rest}\n />\n )\n}\n\nexport type DrawerContentProps = Omit<ComponentProps<typeof DrawerPrimitive.Content>, 'side'> & {\n /**\n * Not accepted here. corvu reads the side from the root `Drawer`, which uses it\n * for the drag axis and publishes it as `data-side`; a `side` on the content\n * would type-check through the polymorphic props and be silently ignored,\n * leaving the drawer on the bottom edge. Set `<Drawer side=\"right\">` instead.\n */\n side?: never\n /**\n * Draw the grabber at the leading edge of the sheet.\n *\n * It is an affordance, not the drag target: corvu makes the whole sheet\n * draggable, exactly as the platform's own sheets behave. So this is\n * `aria-hidden` decoration that tells the user the sheet can be pulled — it\n * carries no behaviour and must not be the only thing that moves.\n */\n withHandle?: boolean\n}\n\nexport function DrawerContent(props: DrawerContentProps) {\n const [local, rest] = splitProps(props, ['class', 'withHandle', 'children'])\n\n return (\n <DrawerPrimitive.Portal>\n <DrawerOverlay />\n <DrawerPrimitive.Content\n class={cn(\n 'group/drawer bg-background text-foreground fixed z-(--z-drawer) flex flex-col border-border shadow-lg',\n 'data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:max-h-[85vh] data-[side=bottom]:rounded-t-xl data-[side=bottom]:border-t',\n 'data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:max-h-[85vh] data-[side=top]:rounded-b-xl data-[side=top]:border-b',\n 'data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:w-80 data-[side=left]:rounded-e-xl data-[side=left]:border-e',\n 'data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:w-80 data-[side=right]:rounded-s-xl data-[side=right]:border-s',\n local.class\n )}\n {...rest}\n >\n {local.withHandle ? (\n <span\n aria-hidden=\"true\"\n class={cn(\n 'bg-muted shrink-0 self-center',\n 'group-data-[side=bottom]/drawer:mt-2 group-data-[side=bottom]/drawer:h-1.5 group-data-[side=bottom]/drawer:w-10 group-data-[side=bottom]/drawer:rounded-full'\n )}\n />\n ) : null}\n {local.children}\n </DrawerPrimitive.Content>\n </DrawerPrimitive.Portal>\n )\n}\n\nexport function DrawerTitle(props: ComponentProps<typeof DrawerPrimitive.Label>) {\n const [local, rest] = splitProps(props, ['class'])\n return <DrawerPrimitive.Label class={cn(overlayTitle, local.class)} {...rest} />\n}\n\nexport function DrawerDescription(props: ComponentProps<typeof DrawerPrimitive.Description>) {\n const [local, rest] = splitProps(props, ['class'])\n return <DrawerPrimitive.Description class={cn(overlayDescription, local.class)} {...rest} />\n}\n\nexport function DrawerCloseButton(props: ComponentProps<typeof DrawerPrimitive.Close>) {\n const [local, rest] = splitProps(props, ['class'])\n return <DrawerPrimitive.Close class={cn('focus-ring', local.class)} {...rest} />\n}\n\nexport function DrawerHeader(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <div data-slot=\"drawer-header\" class={cn(overlayHeader, 'p-5 pb-3', local.class)} {...rest} />\n )\n}\n\nexport function DrawerBody(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <div\n data-slot=\"drawer-body\"\n class={cn('min-h-0 flex-1 overflow-y-auto px-5 pb-4', local.class)}\n {...rest}\n />\n )\n}\n\nexport function DrawerFooter(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <div data-slot=\"drawer-footer\" class={cn(overlayFooter, 'p-5 pt-3', local.class)} {...rest} />\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,SAAgBQ,OAAOC,OAA+C;CACpE,OAAAC,gBAAQV,iBAAoBS,KAAK;AACnC;AAEA,SAAgBE,cAAcF,OAAuD;CACnF,OAAAC,gBAAQV,gBAAgBY,SAAYH,KAAK;AAC3C;AAEA,SAAgBI,cA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AAC,EAAA,GAAMF,IAAI,GAAA,OAAA,KAAA;EAAA,OAAA8B;CAAA,EAAA,CAAA;AAE9F"}
1
+ {"version":3,"file":"drawer.js","names":["DrawerPrimitive","splitProps","overlayDescription","overlayFooter","overlayHeader","overlayTitle","cn","Drawer","props","_$createComponent","DrawerTrigger","Trigger","DrawerOverlay","Overlay","local","rest","_$mergeProps","class","Content","withHandle","DrawerContent","Portal","children","_$memo","_el$","_tmpl$","_$effect","_$className","DrawerTitle","Label","DrawerDescription","Description","DrawerCloseButton","Close","DrawerHeader","_el$2","_tmpl$2","_$spread","DrawerBody","_el$3","_tmpl$3","DrawerFooter","_el$4","_tmpl$4"],"sources":["../../../../src/components/ui/drawer/drawer.tsx"],"sourcesContent":["import DrawerPrimitive from '@corvu/drawer'\nimport type { ComponentProps } from 'solid-js'\nimport { splitProps } from 'solid-js'\nimport { overlayDescription, overlayFooter, overlayHeader, overlayTitle } from '#lib/overlay'\nimport { cn } from '#lib/utils'\n\n/**\n * Drawer.\n *\n * A sheet the user can drag away: it opens from an edge, carries a handle, and\n * closes by swipe as well as by button. That drag affordance is the reason to\n * choose it over Sheet — the gesture is for content the user is *finishing*\n * with (a summary, a queue, a confirmation), not for browsing.\n *\n * On a large window a Drawer is usually the wrong control: dragging is a touch\n * idiom, and on a desktop the same content is better as a Sheet or a Dialog.\n * The exceptions are the surfaces a pointer also drags naturally — a bottom\n * console, a media panel.\n *\n * corvu supplies the drag physics, the snap points and the pointer capture.\n */\nexport function Drawer(props: ComponentProps<typeof DrawerPrimitive>) {\n return <DrawerPrimitive {...props} />\n}\n\nexport function DrawerTrigger(props: ComponentProps<typeof DrawerPrimitive.Trigger>) {\n return <DrawerPrimitive.Trigger {...props} />\n}\n\nexport function DrawerOverlay(props: ComponentProps<typeof DrawerPrimitive.Overlay>) {\n const [local, rest] = splitProps(props, ['class'])\n\n return (\n <DrawerPrimitive.Overlay\n class={cn(\n 'fixed inset-0 z-(--z-drawer) bg-scrim/50',\n 'data-[open]:animate-in data-[open]:fade-in-0 data-[closed]:animate-out data-[closed]:fade-out-0',\n local.class\n )}\n {...rest}\n />\n )\n}\n\nexport type DrawerContentProps = Omit<ComponentProps<typeof DrawerPrimitive.Content>, 'side'> & {\n /**\n * Not accepted here. corvu reads the side from the root `Drawer`, which uses it\n * for the drag axis and publishes it as `data-side`; a `side` on the content\n * would type-check through the polymorphic props and be silently ignored,\n * leaving the drawer on the bottom edge. Set `<Drawer side=\"right\">` instead.\n */\n side?: never\n /**\n * Draw the grabber at the leading edge of the sheet.\n *\n * It is an affordance, not the drag target: corvu makes the whole sheet\n * draggable, exactly as the platform's own sheets behave. So this is\n * `aria-hidden` decoration that tells the user the sheet can be pulled — it\n * carries no behaviour and must not be the only thing that moves.\n */\n withHandle?: boolean\n}\n\nexport function DrawerContent(props: DrawerContentProps) {\n const [local, rest] = splitProps(props, ['class', 'withHandle', 'children'])\n\n return (\n <DrawerPrimitive.Portal>\n <DrawerOverlay />\n <DrawerPrimitive.Content\n class={cn(\n 'group/drawer bg-background text-foreground fixed z-(--z-drawer) flex flex-col border-border shadow-lg',\n 'data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:max-h-[85vh] data-[side=bottom]:rounded-t-xl data-[side=bottom]:border-t',\n 'data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:max-h-[85vh] data-[side=top]:rounded-b-xl data-[side=top]:border-b',\n 'data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:w-80 data-[side=left]:rounded-e-xl data-[side=left]:border-e',\n 'data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:w-80 data-[side=right]:rounded-s-xl data-[side=right]:border-s',\n local.class\n )}\n {...rest}\n >\n {local.withHandle ? (\n <span\n aria-hidden=\"true\"\n class={cn(\n 'bg-muted shrink-0 self-center',\n 'group-data-[side=bottom]/drawer:mt-2 group-data-[side=bottom]/drawer:h-1.5 group-data-[side=bottom]/drawer:w-10 group-data-[side=bottom]/drawer:rounded-full'\n )}\n />\n ) : null}\n {local.children}\n </DrawerPrimitive.Content>\n </DrawerPrimitive.Portal>\n )\n}\n\nexport function DrawerTitle(props: ComponentProps<typeof DrawerPrimitive.Label>) {\n const [local, rest] = splitProps(props, ['class'])\n return <DrawerPrimitive.Label class={cn(overlayTitle, local.class)} {...rest} />\n}\n\nexport function DrawerDescription(props: ComponentProps<typeof DrawerPrimitive.Description>) {\n const [local, rest] = splitProps(props, ['class'])\n return <DrawerPrimitive.Description class={cn(overlayDescription, local.class)} {...rest} />\n}\n\nexport function DrawerCloseButton(props: ComponentProps<typeof DrawerPrimitive.Close>) {\n const [local, rest] = splitProps(props, ['class'])\n return <DrawerPrimitive.Close class={cn('focus-ring', local.class)} {...rest} />\n}\n\nexport function DrawerHeader(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <div data-slot=\"drawer-header\" class={cn(overlayHeader, 'p-5 pb-3', local.class)} {...rest} />\n )\n}\n\nexport function DrawerBody(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <div\n data-slot=\"drawer-body\"\n class={cn('min-h-0 flex-1 overflow-y-auto px-5 pb-4', local.class)}\n {...rest}\n />\n )\n}\n\nexport function DrawerFooter(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <div data-slot=\"drawer-footer\" class={cn(overlayFooter, 'p-5 pt-3', local.class)} {...rest} />\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,SAAgBO,OAAOC,OAA+C;CACpE,OAAAC,gBAAQT,iBAAoBQ,KAAK;AACnC;AAEA,SAAgBE,cAAcF,OAAuD;CACnF,OAAAC,gBAAQT,gBAAgBW,SAAYH,KAAK;AAC3C;AAEA,SAAgBI,cAAcJ,OAAuD;CACnF,MAAM,CAACM,OAAOC,QAAQd,WAAWO,OAAO,CAAC,OAAO,CAAC;CAEjD,OAAAC,gBACGT,gBAAgBa,SAAOG,WA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","names":["DropdownMenu","KobalteDropdownMenu","useMenuContext","Accessor","ComponentProps","createContext","onCleanup","splitProps","useContext","callHandler","popoverArrow","topLayerProps","cn","createMenuParts","menuPanel","MenuOrientation","DropdownMenuScope","orientation","setAfterClose","callback","takeAfterClose","disposed","DropdownMenuScopeContext","HandlerEvent","Handler","args","Arguments","DropdownMenuTriggerKeyEvent","NonNullable","Trigger","DropdownMenuTriggerPointerEvent","props","local","rest","afterClose","undefined","scope","_$createComponent","Provider","value","children","_$mergeProps","modal","onOpenChange","open","SCROLLABLE_OVERFLOW","OVERFLOW_PROPERTIES","const","OverflowProperty","OverflowDeclaration","Readonly","property","priority","readInlineOverflow","element","HTMLElement","map","style","getPropertyValue","getPropertyPriority","declarationsMatch","declarations","every","bypassUnboundedScrollLookup","trigger","scrollRoot","document","scrollingElement","documentElement","window","getComputedStyle","overflow","temporaryStyles","Array","original","applied","parent","parentElement","computed","overflowX","overflowY","test","setProperty","push","length","queueMicrotask","isConnected","removeProperty","DropdownMenuTrigger","inheritedOrientation","onPointerDown","event","disabled","defaultPrevented","isPrimary","button","altKey","ctrlKey","metaKey","shiftKey","currentTarget","isNativeLink","HTMLAnchorElement","hasAttribute","focus","preventScroll","pointerType","preventDefault","onKeyDown","menubarOrientation","closest","getAttribute","openingArrow","includes","key","Portal","DropdownMenuPortal","TAB_STOP_SELECTOR","isTabStop","tabIndex","matches","getClientRects","tabStopAt","target","Element","control","adjacentTabStop","from","backwards","dialog","ownerDocument","body","stops","querySelectorAll","filter","ordered","toSorted","a","b","index","indexOf","step","at","MENU_ROW_SELECTOR","DropdownMenuContentProps","Content","hideArrow","portalMount","tabKey","DropdownMenuContent","menu","leaveTarget","onTab","KeyboardEvent","isComposing","panel","stopPropagation","rows","row","active","activeElement","next","triggerRef","close","onCloseAutoFocus","Event","isOpen","mount","class","ref","HTMLDivElement","addEventListener","removeEventListener","_$memo","Arrow","parts","DropdownMenuItem","Item","onSelectAfterClose","onSelect","DropdownMenuShortcut","Shortcut","DropdownMenuCheckboxItem","CheckboxItem","DropdownMenuRadioItem","RadioItem","DropdownMenuLabel","Label","DropdownMenuSeparator","Separator","DropdownMenuSubTrigger","SubTrigger","DropdownMenuSubContent","SubContent","Group","DropdownMenuGroup","RadioGroup","DropdownMenuRadioGroup","Sub","DropdownMenuSub","DropdownMenu","_$createComponent","KobalteDropdownMenu","_$mergeProps","_$memo"],"sources":["../../../../src/components/ui/dropdown-menu/dropdown-menu.tsx"],"sourcesContent":["import { DropdownMenu as KobalteDropdownMenu } from '@kobalte/core/dropdown-menu'\nimport { useMenuContext } from '@kobalte/core/menu'\nimport type { Accessor, ComponentProps } from 'solid-js'\nimport { createContext, onCleanup, splitProps, useContext } from 'solid-js'\nimport { callHandler } from '#lib/events'\nimport { popoverArrow, topLayerProps } from '#lib/overlay'\nimport { cn } from '#lib/utils'\nimport { createMenuParts, menuPanel } from './menu-parts'\n\ntype MenuOrientation = 'horizontal' | 'vertical'\ntype DropdownMenuScope = {\n orientation: Accessor<MenuOrientation | undefined>\n /** Queue work for after the menu has closed and focus has settled. */\n setAfterClose: (callback: (() => void) | undefined) => void\n takeAfterClose: () => (() => void) | undefined\n disposed: () => boolean\n}\nconst DropdownMenuScopeContext = createContext<DropdownMenuScope>()\ntype HandlerEvent<Handler> = Handler extends (...args: infer Arguments) => void\n ? Arguments[0]\n : never\ntype DropdownMenuTriggerKeyEvent = HandlerEvent<\n NonNullable<ComponentProps<typeof KobalteDropdownMenu.Trigger>['onKeyDown']>\n>\ntype DropdownMenuTriggerPointerEvent = HandlerEvent<\n NonNullable<ComponentProps<typeof KobalteDropdownMenu.Trigger>['onPointerDown']>\n>\n\n/**\n * DropdownMenu.\n *\n * A list of actions on a trigger, with radio groups for persistent choices\n * that fit naturally in a compact menu. Use Select for form inputs whose\n * selected value needs the field-style control, and Popover for arbitrary\n * content.\n *\n * Kobalte supplies the full menu contract — arrow keys, typeahead, the roving\n * highlight, Escape to close and return focus — which is exactly what a\n * hand-rolled `div` with click handlers gets wrong.\n * Menus are nonmodal by default so their generated focus guards do not become\n * invalid direct children of the ARIA menu. Set `modal` explicitly when the\n * surrounding interaction needs modal containment.\n *\n * The `destructive` variant marks the row with a status-coloured edge and\n * highlighted tint while keeping its label on the body foreground. Pairing it\n * with an AlertDialog is the caller's job.\n *\n * An item that opens something else — a dialog, a sheet — passes it as\n * `onSelectAfterClose`, which runs once the menu has closed and returned focus\n * to its trigger, so the next layer captures the trigger as the control to\n * return to.\n */\nexport function DropdownMenu(props: ComponentProps<typeof KobalteDropdownMenu>) {\n const [local, rest] = splitProps(props, ['modal', 'orientation', 'onOpenChange'])\n let afterClose: (() => void) | undefined\n let disposed = false\n onCleanup(() => {\n disposed = true\n afterClose = undefined\n })\n const scope: DropdownMenuScope = {\n orientation: () => local.orientation,\n setAfterClose: (callback) => (afterClose = callback),\n takeAfterClose: () => {\n const callback = afterClose\n afterClose = undefined\n return callback\n },\n disposed: () => disposed,\n }\n return (\n <DropdownMenuScopeContext.Provider value={scope}>\n <KobalteDropdownMenu\n modal={local.modal ?? false}\n orientation={local.orientation}\n onOpenChange={(open) => {\n if (open) afterClose = undefined\n local.onOpenChange?.(open)\n }}\n {...rest}\n />\n </DropdownMenuScopeContext.Provider>\n )\n}\n\nconst SCROLLABLE_OVERFLOW = /(auto|scroll)/\nconst OVERFLOW_PROPERTIES = ['overflow', 'overflow-x', 'overflow-y'] as const\n\ntype OverflowProperty = (typeof OVERFLOW_PROPERTIES)[number]\ntype OverflowDeclaration = Readonly<{\n property: OverflowProperty\n value: string\n priority: string\n}>\n\nfunction readInlineOverflow(element: HTMLElement): OverflowDeclaration[] {\n return OVERFLOW_PROPERTIES.map((property) => ({\n property,\n value: element.style.getPropertyValue(property),\n priority: element.style.getPropertyPriority(property),\n }))\n}\n\nfunction declarationsMatch(element: HTMLElement, declarations: OverflowDeclaration[]) {\n return declarations.every(\n ({ property, value, priority }) =>\n element.style.getPropertyValue(property) === value &&\n element.style.getPropertyPriority(property) === priority\n )\n}\n\nfunction bypassUnboundedScrollLookup(trigger: HTMLElement) {\n const scrollRoot = document.scrollingElement ?? document.documentElement\n if (window.getComputedStyle(scrollRoot).overflow !== 'hidden') return\n\n const temporaryStyles: Array<{\n element: HTMLElement\n original: OverflowDeclaration[]\n applied: OverflowDeclaration[]\n }> = []\n\n for (let element: HTMLElement | null = trigger; element;) {\n const parent: HTMLElement | null = element.parentElement\n if (element !== scrollRoot) {\n const computed = window.getComputedStyle(element)\n const overflow = `${computed.overflow} ${computed.overflowX} ${computed.overflowY}`\n if (SCROLLABLE_OVERFLOW.test(overflow)) {\n const original = readInlineOverflow(element)\n element.style.setProperty('overflow', 'clip', 'important')\n temporaryStyles.push({ element, original, applied: readInlineOverflow(element) })\n }\n }\n element = parent\n }\n\n if (temporaryStyles.length === 0) return\n\n // Kobalte 0.13.14's keyboard open path synchronously walks scroll parents\n // and never terminates when the root scroller is `overflow: hidden`.\n // Clipping only non-root scroll ancestors makes that walk stop at the locked\n // viewport. Restore those declarations once the event handler finishes, and\n // leave any newer owner write untouched.\n queueMicrotask(() => {\n for (const { element, original, applied } of temporaryStyles) {\n if (!element.isConnected || !declarationsMatch(element, applied)) continue\n for (const property of OVERFLOW_PROPERTIES) element.style.removeProperty(property)\n for (const { property, value, priority } of original) {\n if (value) element.style.setProperty(property, value, priority)\n }\n }\n })\n}\n\nexport function DropdownMenuTrigger(props: ComponentProps<typeof KobalteDropdownMenu.Trigger>) {\n const inheritedOrientation = useContext(DropdownMenuScopeContext)?.orientation\n const [local, rest] = splitProps(props, ['disabled', 'onKeyDown', 'onPointerDown'])\n const onPointerDown = (event: DropdownMenuTriggerPointerEvent) => {\n callHandler(local.onPointerDown, event)\n\n // WebKit can leave focus on a previous control when a native button gets\n // a pointer click. Focus the trigger before Kobalte opens the menu so an\n // enclosing modal focus scope does not restore focus and dismiss the menu.\n if (\n local.disabled ||\n event.defaultPrevented ||\n !event.isPrimary ||\n event.button !== 0 ||\n event.altKey ||\n event.ctrlKey ||\n event.metaKey ||\n event.shiftKey\n ) {\n return\n }\n const trigger = event.currentTarget\n const isNativeLink = trigger instanceof HTMLAnchorElement && trigger.hasAttribute('href')\n if (trigger instanceof HTMLElement && !isNativeLink) {\n trigger.focus({ preventScroll: true })\n // Focusing first is not enough in WebKit: the press's default mousedown\n // action runs afterwards and moves focus off a button to the nearest\n // focusable ancestor — inside a dialog, the dialog — so the menu that\n // just opened still reads focus leaving it and closes. Cancelling the\n // default keeps focus where it was put.\n if (event.pointerType !== 'touch') event.preventDefault()\n }\n }\n const onKeyDown = (event: DropdownMenuTriggerKeyEvent) => {\n // Kobalte's MenuTrigger does not consult defaultPrevented before its own\n // open-key handling. Preserve its existing callback behavior; this wrapper\n // only makes the pre-open scroll-parent lookup terminate.\n callHandler(local.onKeyDown, event)\n\n if (local.disabled) return\n const trigger = event.currentTarget\n if (!(trigger instanceof HTMLElement)) return\n const menubarOrientation = trigger.closest('[role=\"menubar\"]')?.getAttribute('aria-orientation')\n const orientation =\n inheritedOrientation?.() ?? (menubarOrientation === 'vertical' ? 'vertical' : 'horizontal')\n const openingArrow = orientation === 'horizontal' ? 'ArrowDown' : 'ArrowRight'\n if (!['Enter', ' ', openingArrow].includes(event.key)) return\n const isNativeLink = trigger instanceof HTMLAnchorElement && trigger.hasAttribute('href')\n if (isNativeLink && (event.key === 'Enter' || event.key === ' ')) return\n bypassUnboundedScrollLookup(trigger)\n }\n\n return (\n <KobalteDropdownMenu.Trigger\n {...rest}\n disabled={local.disabled}\n onPointerDown={onPointerDown}\n onKeyDown={onKeyDown}\n />\n )\n}\n\nexport { Portal as DropdownMenuPortal } from '@kobalte/core/dropdown-menu'\n\n/** The controls a pointer press can focus. */\nconst TAB_STOP_SELECTOR =\n 'a[href], area[href], button, input, select, textarea, iframe, [tabindex], [contenteditable], details > summary:first-of-type'\n\n/** Whether Tab can land on the element as the page stands now. */\nexport function isTabStop(element: HTMLElement) {\n return (\n (element.tabIndex >= 0 ||\n (element.matches('details > summary:first-of-type') && !element.hasAttribute('tabindex'))) &&\n !element.matches(':disabled') &&\n element.getAttribute('aria-disabled') !== 'true' &&\n element.closest('[hidden], [inert], [aria-hidden=\"true\"]') === null &&\n element.getClientRects().length > 0\n )\n}\n\n/** The focusable control under a pointer press, if Tab could reach it. */\nexport function tabStopAt(target: Element): HTMLElement | undefined {\n const control = target.closest<HTMLElement>(TAB_STOP_SELECTOR)\n return control && isTabStop(control) ? control : undefined\n}\n\n/**\n * The tab stop before or after `from` inside the enclosing dialog (wrapping,\n * as the dialog's focus trap does) or the document (not wrapping), skipping\n * any open menu.\n */\nfunction adjacentTabStop(from: HTMLElement, backwards: boolean): HTMLElement | undefined {\n const dialog = from.closest<HTMLElement>('[role=\"dialog\"]')\n const scope = dialog ?? from.ownerDocument.body\n // Every element, not just TAB_STOP_SELECTOR: the native tabIndex decides,\n // which keeps details summaries and explicit tabindex overrides in order.\n const stops = Array.from(scope.querySelectorAll<HTMLElement>('*')).filter(\n (element) => isTabStop(element) && element.closest('[role=\"menu\"]') === null\n )\n const ordered = [\n ...stops.filter((element) => element.tabIndex > 0).toSorted((a, b) => a.tabIndex - b.tabIndex),\n ...stops.filter((element) => element.tabIndex <= 0),\n ]\n const index = ordered.indexOf(from)\n if (index < 0) return undefined\n const step = backwards ? -1 : 1\n return ordered[index + step] ?? (dialog ? (backwards ? ordered.at(-1) : ordered[0]) : undefined)\n}\n\nconst MENU_ROW_SELECTOR = '[role=\"menuitem\"], [role=\"menuitemradio\"], [role=\"menuitemcheckbox\"]'\n\nexport type DropdownMenuContentProps = ComponentProps<typeof KobalteDropdownMenu.Content> & {\n /**\n * Kept for callers that hid the arrow explicitly; the arrow is now hidden by\n * default. Pass `false` to draw one. The default flipped because Kobalte\n * reserves half of the arrow's 30px box as popper gutter — a menu anchored to\n * its trigger floated 15px off it, which read as a gap rather than as a\n * pointer, and every anchored caller already passed `hideArrow`.\n */\n hideArrow?: boolean\n /** Mount under an owner element such as a modal, keeping the menu in its accessible subtree. */\n portalMount?: HTMLElement\n /**\n * What Tab does while the menu is open. Kobalte 0.13.14 swallows it and\n * leaves focus where it was; `leave` closes the menu and moves on to the tab\n * stop after (or, with Shift, before) the trigger, inside an enclosing\n * dialog or the page; `cycle` moves between the menu's enabled rows.\n */\n tabKey?: 'leave' | 'cycle'\n}\n\nexport function DropdownMenuContent(props: DropdownMenuContentProps) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'hideArrow',\n 'children',\n 'portalMount',\n 'tabKey',\n 'ref',\n 'onCloseAutoFocus',\n ])\n const scope = useContext(DropdownMenuScopeContext)\n const menu = useMenuContext()\n let leaveTarget: HTMLElement | undefined\n\n // A capture listener on the panel, because Kobalte's list handler moves focus\n // on Tab itself and runs whatever a caller's `onKeyDown` does.\n const onTab = (event: KeyboardEvent) => {\n if (event.key !== 'Tab' || event.isComposing || !local.tabKey) return\n const panel = event.currentTarget as HTMLElement\n event.preventDefault()\n event.stopPropagation()\n if (local.tabKey === 'cycle') {\n const rows = Array.from(panel.querySelectorAll<HTMLElement>(MENU_ROW_SELECTOR)).filter(\n (row) => row.getAttribute('aria-disabled') !== 'true'\n )\n if (!rows.length) return\n const active = document.activeElement\n const index = active instanceof HTMLElement ? rows.indexOf(active) : -1\n const step = event.shiftKey ? -1 : 1\n const next =\n index < 0\n ? event.shiftKey\n ? rows.length - 1\n : 0\n : (index + step + rows.length) % rows.length\n rows[next]?.focus()\n return\n }\n const trigger = menu.triggerRef()\n leaveTarget = trigger ? adjacentTabStop(trigger, event.shiftKey) : undefined\n // Focus first, so a nonmodal menu sees the focus leave and skips its own\n // return-to-trigger; then close in case it did not dismiss itself.\n leaveTarget?.focus({ preventScroll: true })\n menu.close(true)\n }\n\n const onCloseAutoFocus = (event: Event) => {\n local.onCloseAutoFocus?.(event)\n const target = leaveTarget\n leaveTarget = undefined\n if (target) {\n event.preventDefault()\n // Kobalte's focus scope restores its stale mount-time focus after this\n // callback; land on the Tab destination once that has run.\n queueMicrotask(() => {\n if (!menu.isOpen() && target.isConnected && document.activeElement !== target) {\n target.focus({ preventScroll: true })\n }\n })\n }\n const afterClose = scope?.takeAfterClose()\n // Kobalte returns focus to the trigger and releases its focus scope after\n // this callback; the queued work runs once that has finished.\n if (afterClose) queueMicrotask(() => scope?.disposed() || afterClose())\n }\n\n return (\n <KobalteDropdownMenu.Portal mount={local.portalMount}>\n <KobalteDropdownMenu.Content\n {...topLayerProps}\n class={cn(menuPanel, 'min-w-[10rem]', local.class)}\n {...rest}\n ref={(element: HTMLDivElement) => {\n element.addEventListener('keydown', onTab, true)\n onCleanup(() => element.removeEventListener('keydown', onTab, true))\n if (typeof local.ref === 'function') local.ref(element)\n }}\n onCloseAutoFocus={onCloseAutoFocus}\n >\n {local.hideArrow === false && (\n /* Rendered only when a caller asks for it back: the popper folds half\n the arrow's box into the content's gutter, so an arrow and a flush\n menu have never been true at once. */\n <KobalteDropdownMenu.Arrow aria-hidden=\"true\" class={popoverArrow} />\n )}\n {local.children}\n </KobalteDropdownMenu.Content>\n </KobalteDropdownMenu.Portal>\n )\n}\n\nconst parts = createMenuParts(KobalteDropdownMenu, 'dropdown-menu')\n\nexport function DropdownMenuItem(\n props: ComponentProps<typeof parts.Item> & {\n /**\n * Runs after the menu has closed and returned focus to its trigger — the\n * place to open a dialog or sheet, which then returns focus to the trigger.\n */\n onSelectAfterClose?: () => void\n }\n) {\n const scope = useContext(DropdownMenuScopeContext)\n const [local, rest] = splitProps(props, ['onSelectAfterClose', 'onSelect'])\n return (\n <parts.Item\n {...rest}\n onSelect={() => {\n scope?.setAfterClose(local.onSelectAfterClose)\n local.onSelect?.()\n }}\n />\n )\n}\n\nexport const DropdownMenuShortcut = parts.Shortcut\nexport const DropdownMenuCheckboxItem = parts.CheckboxItem\nexport const DropdownMenuRadioItem = parts.RadioItem\nexport const DropdownMenuLabel = parts.Label\nexport const DropdownMenuSeparator = parts.Separator\nexport const DropdownMenuSubTrigger = parts.SubTrigger\nexport const DropdownMenuSubContent = parts.SubContent\nexport {\n Group as DropdownMenuGroup,\n Rad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AAaC,2BAA2BP,MAAMQ;AAC9C,IAAaC,wBAAwBT,MAAMU;AAC3C,IAAaC,oBAAoBX,MAAMY;AACvC,IAAaC,wBAAwBb,MAAMc;AAC3C,IAAaC,yBAAyBf,MAAMgB;AAC5C,IAAaC,yBAAyBjB,MAAMkB"}
1
+ {"version":3,"file":"dropdown-menu.js","names":["DropdownMenu","KobalteDropdownMenu","useMenuContext","createContext","onCleanup","splitProps","useContext","callHandler","topLayerProps","cn","createMenuParts","menuPanel","orientation","setAfterClose","callback","takeAfterClose","disposed","DropdownMenuScopeContext","Trigger","props","local","rest","afterClose","undefined","scope","_$createComponent","Provider","value","children","_$mergeProps","modal","onOpenChange","open","SCROLLABLE_OVERFLOW","OVERFLOW_PROPERTIES","property","priority","readInlineOverflow","element","HTMLElement","map","style","getPropertyValue","getPropertyPriority","declarationsMatch","declarations","every","bypassUnboundedScrollLookup","trigger","scrollRoot","document","scrollingElement","documentElement","window","getComputedStyle","overflow","temporaryStyles","Array","original","applied","parent","parentElement","computed","overflowX","overflowY","test","setProperty","push","length","queueMicrotask","isConnected","removeProperty","DropdownMenuTrigger","inheritedOrientation","onPointerDown","event","disabled","defaultPrevented","isPrimary","button","altKey","ctrlKey","metaKey","shiftKey","currentTarget","isNativeLink","HTMLAnchorElement","hasAttribute","focus","preventScroll","pointerType","preventDefault","onKeyDown","menubarOrientation","closest","getAttribute","includes","key","Portal","TAB_STOP_SELECTOR","isTabStop","tabIndex","matches","getClientRects","tabStopAt","target","control","adjacentTabStop","from","backwards","dialog","ownerDocument","body","stops","querySelectorAll","filter","ordered","toSorted","a","b","index","indexOf","step","at","MENU_ROW_SELECTOR","Content","hideArrow","portalMount","tabKey","DropdownMenuContent","menu","leaveTarget","onTab","isComposing","panel","stopPropagation","rows","row","active","activeElement","triggerRef","close","onCloseAutoFocus","isOpen","mount","class","ref","addEventListener","removeEventListener","_$memo","Arrow","parts","DropdownMenuItem","Item","onSelectAfterClose","onSelect","DropdownMenuShortcut","Shortcut","DropdownMenuCheckboxItem","CheckboxItem","DropdownMenuRadioItem","RadioItem","DropdownMenuLabel","Label","DropdownMenuSeparator","Separator","DropdownMenuSubTrigger","SubTrigger","DropdownMenuSubContent","SubContent"],"sources":["../../../../src/components/ui/dropdown-menu/dropdown-menu.tsx"],"sourcesContent":["import { DropdownMenu as KobalteDropdownMenu } from '@kobalte/core/dropdown-menu'\nimport { useMenuContext } from '@kobalte/core/menu'\nimport type { Accessor, ComponentProps } from 'solid-js'\nimport { createContext, onCleanup, splitProps, useContext } from 'solid-js'\nimport { callHandler } from '#lib/events'\nimport { popoverArrow, topLayerProps } from '#lib/overlay'\nimport { cn } from '#lib/utils'\nimport { createMenuParts, menuPanel } from './menu-parts'\n\ntype MenuOrientation = 'horizontal' | 'vertical'\ntype DropdownMenuScope = {\n orientation: Accessor<MenuOrientation | undefined>\n /** Queue work for after the menu has closed and focus has settled. */\n setAfterClose: (callback: (() => void) | undefined) => void\n takeAfterClose: () => (() => void) | undefined\n disposed: () => boolean\n}\nconst DropdownMenuScopeContext = createContext<DropdownMenuScope>()\ntype HandlerEvent<Handler> = Handler extends (...args: infer Arguments) => void\n ? Arguments[0]\n : never\ntype DropdownMenuTriggerKeyEvent = HandlerEvent<\n NonNullable<ComponentProps<typeof KobalteDropdownMenu.Trigger>['onKeyDown']>\n>\ntype DropdownMenuTriggerPointerEvent = HandlerEvent<\n NonNullable<ComponentProps<typeof KobalteDropdownMenu.Trigger>['onPointerDown']>\n>\n\n/**\n * DropdownMenu.\n *\n * A list of actions on a trigger, with radio groups for persistent choices\n * that fit naturally in a compact menu. Use Select for form inputs whose\n * selected value needs the field-style control, and Popover for arbitrary\n * content.\n *\n * Kobalte supplies the full menu contract — arrow keys, typeahead, the roving\n * highlight, Escape to close and return focus — which is exactly what a\n * hand-rolled `div` with click handlers gets wrong.\n * Menus are nonmodal by default so their generated focus guards do not become\n * invalid direct children of the ARIA menu. Set `modal` explicitly when the\n * surrounding interaction needs modal containment.\n *\n * The `destructive` variant marks the row with a status-coloured edge and\n * highlighted tint while keeping its label on the body foreground. Pairing it\n * with an AlertDialog is the caller's job.\n *\n * An item that opens something else — a dialog, a sheet — passes it as\n * `onSelectAfterClose`, which runs once the menu has closed and returned focus\n * to its trigger, so the next layer captures the trigger as the control to\n * return to.\n */\nexport function DropdownMenu(props: ComponentProps<typeof KobalteDropdownMenu>) {\n const [local, rest] = splitProps(props, ['modal', 'orientation', 'onOpenChange'])\n let afterClose: (() => void) | undefined\n let disposed = false\n onCleanup(() => {\n disposed = true\n afterClose = undefined\n })\n const scope: DropdownMenuScope = {\n orientation: () => local.orientation,\n setAfterClose: (callback) => (afterClose = callback),\n takeAfterClose: () => {\n const callback = afterClose\n afterClose = undefined\n return callback\n },\n disposed: () => disposed,\n }\n return (\n <DropdownMenuScopeContext.Provider value={scope}>\n <KobalteDropdownMenu\n modal={local.modal ?? false}\n orientation={local.orientation}\n onOpenChange={(open) => {\n if (open) afterClose = undefined\n local.onOpenChange?.(open)\n }}\n {...rest}\n />\n </DropdownMenuScopeContext.Provider>\n )\n}\n\nconst SCROLLABLE_OVERFLOW = /(auto|scroll)/\nconst OVERFLOW_PROPERTIES = ['overflow', 'overflow-x', 'overflow-y'] as const\n\ntype OverflowProperty = (typeof OVERFLOW_PROPERTIES)[number]\ntype OverflowDeclaration = Readonly<{\n property: OverflowProperty\n value: string\n priority: string\n}>\n\nfunction readInlineOverflow(element: HTMLElement): OverflowDeclaration[] {\n return OVERFLOW_PROPERTIES.map((property) => ({\n property,\n value: element.style.getPropertyValue(property),\n priority: element.style.getPropertyPriority(property),\n }))\n}\n\nfunction declarationsMatch(element: HTMLElement, declarations: OverflowDeclaration[]) {\n return declarations.every(\n ({ property, value, priority }) =>\n element.style.getPropertyValue(property) === value &&\n element.style.getPropertyPriority(property) === priority\n )\n}\n\nfunction bypassUnboundedScrollLookup(trigger: HTMLElement) {\n const scrollRoot = document.scrollingElement ?? document.documentElement\n if (window.getComputedStyle(scrollRoot).overflow !== 'hidden') return\n\n const temporaryStyles: Array<{\n element: HTMLElement\n original: OverflowDeclaration[]\n applied: OverflowDeclaration[]\n }> = []\n\n for (let element: HTMLElement | null = trigger; element;) {\n const parent: HTMLElement | null = element.parentElement\n if (element !== scrollRoot) {\n const computed = window.getComputedStyle(element)\n const overflow = `${computed.overflow} ${computed.overflowX} ${computed.overflowY}`\n if (SCROLLABLE_OVERFLOW.test(overflow)) {\n const original = readInlineOverflow(element)\n element.style.setProperty('overflow', 'clip', 'important')\n temporaryStyles.push({ element, original, applied: readInlineOverflow(element) })\n }\n }\n element = parent\n }\n\n if (temporaryStyles.length === 0) return\n\n // Kobalte 0.13.14's keyboard open path synchronously walks scroll parents\n // and never terminates when the root scroller is `overflow: hidden`.\n // Clipping only non-root scroll ancestors makes that walk stop at the locked\n // viewport. Restore those declarations once the event handler finishes, and\n // leave any newer owner write untouched.\n queueMicrotask(() => {\n for (const { element, original, applied } of temporaryStyles) {\n if (!element.isConnected || !declarationsMatch(element, applied)) continue\n for (const property of OVERFLOW_PROPERTIES) element.style.removeProperty(property)\n for (const { property, value, priority } of original) {\n if (value) element.style.setProperty(property, value, priority)\n }\n }\n })\n}\n\nexport function DropdownMenuTrigger(props: ComponentProps<typeof KobalteDropdownMenu.Trigger>) {\n const inheritedOrientation = useContext(DropdownMenuScopeContext)?.orientation\n const [local, rest] = splitProps(props, ['disabled', 'onKeyDown', 'onPointerDown'])\n const onPointerDown = (event: DropdownMenuTriggerPointerEvent) => {\n callHandler(local.onPointerDown, event)\n\n // WebKit can leave focus on a previous control when a native button gets\n // a pointer click. Focus the trigger before Kobalte opens the menu so an\n // enclosing modal focus scope does not restore focus and dismiss the menu.\n if (\n local.disabled ||\n event.defaultPrevented ||\n !event.isPrimary ||\n event.button !== 0 ||\n event.altKey ||\n event.ctrlKey ||\n event.metaKey ||\n event.shiftKey\n ) {\n return\n }\n const trigger = event.currentTarget\n const isNativeLink = trigger instanceof HTMLAnchorElement && trigger.hasAttribute('href')\n if (trigger instanceof HTMLElement && !isNativeLink) {\n trigger.focus({ preventScroll: true })\n // Focusing first is not enough in WebKit: the press's default mousedown\n // action runs afterwards and moves focus off a button to the nearest\n // focusable ancestor — inside a dialog, the dialog — so the menu that\n // just opened still reads focus leaving it and closes. Cancelling the\n // default keeps focus where it was put.\n if (event.pointerType !== 'touch') event.preventDefault()\n }\n }\n const onKeyDown = (event: DropdownMenuTriggerKeyEvent) => {\n // Kobalte's MenuTrigger does not consult defaultPrevented before its own\n // open-key handling. Preserve its existing callback behavior; this wrapper\n // only makes the pre-open scroll-parent lookup terminate.\n callHandler(local.onKeyDown, event)\n\n if (local.disabled) return\n const trigger = event.currentTarget\n if (!(trigger instanceof HTMLElement)) return\n const menubarOrientation = trigger.closest('[role=\"menubar\"]')?.getAttribute('aria-orientation')\n const orientation =\n inheritedOrientation?.() ?? (menubarOrientation === 'vertical' ? 'vertical' : 'horizontal')\n const openingArrow = orientation === 'horizontal' ? 'ArrowDown' : 'ArrowRight'\n if (!['Enter', ' ', openingArrow].includes(event.key)) return\n const isNativeLink = trigger instanceof HTMLAnchorElement && trigger.hasAttribute('href')\n if (isNativeLink && (event.key === 'Enter' || event.key === ' ')) return\n bypassUnboundedScrollLookup(trigger)\n }\n\n return (\n <KobalteDropdownMenu.Trigger\n {...rest}\n disabled={local.disabled}\n onPointerDown={onPointerDown}\n onKeyDown={onKeyDown}\n />\n )\n}\n\nexport { Portal as DropdownMenuPortal } from '@kobalte/core/dropdown-menu'\n\n/** The controls a pointer press can focus. */\nconst TAB_STOP_SELECTOR =\n 'a[href], area[href], button, input, select, textarea, iframe, [tabindex], [contenteditable], details > summary:first-of-type'\n\n/** Whether Tab can land on the element as the page stands now. */\nexport function isTabStop(element: HTMLElement) {\n return (\n (element.tabIndex >= 0 ||\n (element.matches('details > summary:first-of-type') && !element.hasAttribute('tabindex'))) &&\n !element.matches(':disabled') &&\n element.getAttribute('aria-disabled') !== 'true' &&\n element.closest('[hidden], [inert], [aria-hidden=\"true\"]') === null &&\n element.getClientRects().length > 0\n )\n}\n\n/** The focusable control under a pointer press, if Tab could reach it. */\nexport function tabStopAt(target: Element): HTMLElement | undefined {\n const control = target.closest<HTMLElement>(TAB_STOP_SELECTOR)\n return control && isTabStop(control) ? control : undefined\n}\n\n/**\n * The tab stop before or after `from` inside the enclosing dialog (wrapping,\n * as the dialog's focus trap does) or the document (not wrapping), skipping\n * any open menu.\n */\nfunction adjacentTabStop(from: HTMLElement, backwards: boolean): HTMLElement | undefined {\n const dialog = from.closest<HTMLElement>('[role=\"dialog\"]')\n const scope = dialog ?? from.ownerDocument.body\n // Every element, not just TAB_STOP_SELECTOR: the native tabIndex decides,\n // which keeps details summaries and explicit tabindex overrides in order.\n const stops = Array.from(scope.querySelectorAll<HTMLElement>('*')).filter(\n (element) => isTabStop(element) && element.closest('[role=\"menu\"]') === null\n )\n const ordered = [\n ...stops.filter((element) => element.tabIndex > 0).toSorted((a, b) => a.tabIndex - b.tabIndex),\n ...stops.filter((element) => element.tabIndex <= 0),\n ]\n const index = ordered.indexOf(from)\n if (index < 0) return undefined\n const step = backwards ? -1 : 1\n return ordered[index + step] ?? (dialog ? (backwards ? ordered.at(-1) : ordered[0]) : undefined)\n}\n\nconst MENU_ROW_SELECTOR = '[role=\"menuitem\"], [role=\"menuitemradio\"], [role=\"menuitemcheckbox\"]'\n\nexport type DropdownMenuContentProps = ComponentProps<typeof KobalteDropdownMenu.Content> & {\n /**\n * Kept for callers that hid the arrow explicitly; the arrow is now hidden by\n * default. Pass `false` to draw one. The default flipped because Kobalte\n * reserves half of the arrow's 30px box as popper gutter — a menu anchored to\n * its trigger floated 15px off it, which read as a gap rather than as a\n * pointer, and every anchored caller already passed `hideArrow`.\n */\n hideArrow?: boolean\n /** Mount under an owner element such as a modal, keeping the menu in its accessible subtree. */\n portalMount?: HTMLElement\n /**\n * What Tab does while the menu is open. Kobalte 0.13.14 swallows it and\n * leaves focus where it was; `leave` closes the menu and moves on to the tab\n * stop after (or, with Shift, before) the trigger, inside an enclosing\n * dialog or the page; `cycle` moves between the menu's enabled rows.\n */\n tabKey?: 'leave' | 'cycle'\n}\n\nexport function DropdownMenuContent(props: DropdownMenuContentProps) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'hideArrow',\n 'children',\n 'portalMount',\n 'tabKey',\n 'ref',\n 'onCloseAutoFocus',\n ])\n const scope = useContext(DropdownMenuScopeContext)\n const menu = useMenuContext()\n let leaveTarget: HTMLElement | undefined\n\n // A capture listener on the panel, because Kobalte's list handler moves focus\n // on Tab itself and runs whatever a caller's `onKeyDown` does.\n const onTab = (event: KeyboardEvent) => {\n if (event.key !== 'Tab' || event.isComposing || !local.tabKey) return\n const panel = event.currentTarget as HTMLElement\n event.preventDefault()\n event.stopPropagation()\n if (local.tabKey === 'cycle') {\n const rows = Array.from(panel.querySelectorAll<HTMLElement>(MENU_ROW_SELECTOR)).filter(\n (row) => row.getAttribute('aria-disabled') !== 'true'\n )\n if (!rows.length) return\n const active = document.activeElement\n const index = active instanceof HTMLElement ? rows.indexOf(active) : -1\n const step = event.shiftKey ? -1 : 1\n const next =\n index < 0\n ? event.shiftKey\n ? rows.length - 1\n : 0\n : (index + step + rows.length) % rows.length\n rows[next]?.focus()\n return\n }\n const trigger = menu.triggerRef()\n leaveTarget = trigger ? adjacentTabStop(trigger, event.shiftKey) : undefined\n // Focus first, so a nonmodal menu sees the focus leave and skips its own\n // return-to-trigger; then close in case it did not dismiss itself.\n leaveTarget?.focus({ preventScroll: true })\n menu.close(true)\n }\n\n const onCloseAutoFocus = (event: Event) => {\n local.onCloseAutoFocus?.(event)\n const target = leaveTarget\n leaveTarget = undefined\n if (target) {\n event.preventDefault()\n // Kobalte's focus scope restores its stale mount-time focus after this\n // callback; land on the Tab destination once that has run.\n queueMicrotask(() => {\n if (!menu.isOpen() && target.isConnected && document.activeElement !== target) {\n target.focus({ preventScroll: true })\n }\n })\n }\n const afterClose = scope?.takeAfterClose()\n // Kobalte returns focus to the trigger and releases its focus scope after\n // this callback; the queued work runs once that has finished.\n if (afterClose) queueMicrotask(() => scope?.disposed() || afterClose())\n }\n\n return (\n <KobalteDropdownMenu.Portal mount={local.portalMount}>\n <KobalteDropdownMenu.Content\n {...topLayerProps}\n class={cn(menuPanel, 'min-w-[10rem]', local.class)}\n {...rest}\n ref={(element: HTMLDivElement) => {\n element.addEventListener('keydown', onTab, true)\n onCleanup(() => element.removeEventListener('keydown', onTab, true))\n if (typeof local.ref === 'function') local.ref(element)\n }}\n onCloseAutoFocus={onCloseAutoFocus}\n >\n {local.hideArrow === false && (\n /* Rendered only when a caller asks for it back: the popper folds half\n the arrow's box into the content's gutter, so an arrow and a flush\n menu have never been true at once. */\n <KobalteDropdownMenu.Arrow aria-hidden=\"true\" class={popoverArrow} />\n )}\n {local.children}\n </KobalteDropdownMenu.Content>\n </KobalteDropdownMenu.Portal>\n )\n}\n\nconst parts = createMenuParts(KobalteDropdownMenu, 'dropdown-menu')\n\nexport function DropdownMenuItem(\n props: ComponentProps<typeof parts.Item> & {\n /**\n * Runs after the menu has closed and returned focus to its trigger — the\n * place to open a dialog or sheet, which then returns focus to the trigger.\n */\n onSelectAfterClose?: () => void\n }\n) {\n const scope = useContext(DropdownMenuScopeContext)\n const [local, rest] = splitProps(props, ['onSelectAfterClose', 'onSelect'])\n return (\n <parts.Item\n {...rest}\n onSelect={() => {\n scope?.setAfterClose(local.onSelectAfterClose)\n local.onSelect?.()\n }}\n />\n )\n}\n\nexport const DropdownMenuShortcut = parts.Shortcut\nexport const DropdownMenuCheckboxItem = parts.CheckboxItem\nexport const DropdownMenuRadioItem = parts.RadioItem\nexport const DropdownMenuLabel = parts.Label\nexport const DropdownMenuSeparator = parts.Separator\nexport const DropdownMenuSubTrigger = parts.SubTrigger\nexport const DropdownMenuSubContent = parts.SubContent\nexport {\n Group as DropdownMenuGroup,\n RadioGroup as DropdownMenuRadioGroup,\n Sub as DropdownMenuSub,\n} from '@kobalte/core/dropdown-menu'\n"],"mappings":";;;;;;;;;AAiBA,IAAMiB,2BA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yBf,MAAMgB;AAC5C,IAAaC,yBAAyBjB,MAAMkB"}
@@ -1 +1 @@
1
- {"version":3,"file":"menu-parts.js","names":["DropdownMenu","KobalteDropdownMenu","Check","ChevronRight","Circle","ComponentProps","Show","splitProps","destructiveMenuItem","menuContentPadding","menuItem","menuLabel","menuSeparator","menuShortcut","menuSwatchTone","overlayMotion","overlaySurface","topLayerProps","MenuSwatchTone","cn","MenuPrimitives","Pick","menuPanel","MenuItemProps","Item","variant","shortcut","keyshortcuts","swatch","MenuChoiceItemProps","Swatch","props","tone","_$createComponent","when","children","_el$","_tmpl$","_$effect","_$className","createMenuParts","Menu","family","indicatorSlot","ItemPrimitive","local","rest","_$mergeProps","class","aria-keyshortcuts","_$memo","_el$2","_$insert","Shortcut","_el$3","_$setAttribute","_$spread","CheckboxItem","CheckboxItemPrimitive","ItemIndicator","RadioItem","RadioItemPrimitive","Label","GroupLabel","Separator","SeparatorPrimitive","SubTrigger","SubTriggerPrimitive","SubContent","SubContentPrimitive","Portal","_$createComponent","_$className","_$mergeProps","_$memo"],"sources":["../../../../src/components/ui/dropdown-menu/menu-parts.tsx"],"sourcesContent":["import type { DropdownMenu as KobalteDropdownMenu } from '@kobalte/core/dropdown-menu'\nimport { Check, ChevronRight, Circle } from 'lucide-solid'\nimport type { ComponentProps } from 'solid-js'\nimport { Show, splitProps } from 'solid-js'\nimport {\n destructiveMenuItem,\n menuContentPadding,\n menuItem,\n menuLabel,\n menuSeparator,\n menuShortcut,\n menuSwatchTone,\n overlayMotion,\n overlaySurface,\n topLayerProps,\n type MenuSwatchTone,\n} from '#lib/overlay'\nimport { cn } from '#lib/utils'\n\n/**\n * The rows and panels every Kobalte menu family draws alike — DropdownMenu,\n * ContextMenu and Menubar. Kobalte builds all three from the same menu\n * primitives; each family passes its own namespace and keeps its own exported\n * names, so a row looks and reads the same whichever menu it is in.\n */\ntype MenuPrimitives = Pick<\n typeof KobalteDropdownMenu,\n | 'Item'\n | 'CheckboxItem'\n | 'RadioItem'\n | 'ItemIndicator'\n | 'GroupLabel'\n | 'Separator'\n | 'SubTrigger'\n | 'SubContent'\n | 'Portal'\n>\n\n/** The floating panel of a menu or submenu; `min-w-*` is the caller's. */\nexport const menuPanel = cn(\n overlaySurface,\n overlayMotion,\n 'z-(--z-menu) origin-(--kb-menu-content-transform-origin) overflow-hidden',\n menuContentPadding\n)\n\nexport type MenuItemProps<Item> = Item & {\n /** Colour the row as a destructive action. Confirm it separately. */\n variant?: 'default' | 'destructive'\n /** Draw a shortcut hint at the trailing edge of the row. */\n shortcut?: string\n /**\n * The parseable chord behind `shortcut`, e.g. `Meta+E`. The drawn glyph is\n * `aria-hidden` — reading it out would pollute the item's accessible name —\n * so this is what assistive technology announces instead. Supply it\n * whenever `shortcut` is drawn.\n */\n keyshortcuts?: string\n /** Draw a leading colour dot from the shared tone ladder — the accent or\n * status role the option's card badge carries. `aria-hidden`; the label\n * carries the meaning. */\n swatch?: MenuSwatchTone\n}\n\nexport type MenuChoiceItemProps<Item> = Item & {\n /** Draw a leading colour dot from the shared tone ladder. `aria-hidden`;\n * the label carries the meaning. */\n swatch?: MenuSwatchTone\n}\n\nfunction Swatch(props: { tone: MenuSwatchTone | undefined }) {\n return (\n <Show when={props.tone}>\n <span aria-hidden=\"true\" class={menuSwatchTone({ tone: props.tone })} />\n </Show>\n )\n}\n\nexport function createMenuParts(\n Menu: MenuPrimitives,\n family: 'dropdown-menu' | 'context-menu' | 'menubar'\n) {\n const indicatorSlot = `${family}-indicator`\n\n function Item(props: MenuItemProps<ComponentProps<typeof KobalteDropdownMenu.Item>>) {\n const ItemPrimitive = Menu.Item\n const [local, rest] = splitProps(props, [\n 'class',\n 'variant',\n 'shortcut',\n 'keyshortcuts',\n 'swatch',\n 'children',\n ])\n return (\n <ItemPrimitive\n class={cn(\n menuItem,\n { [destructiveMenuItem]: local.variant === 'destructive' },\n local.class\n )}\n aria-keyshortcuts={local.keyshortcuts}\n {...rest}\n >\n <Swatch tone={local.swatch} />\n {local.children}\n {local.shortcut ? (\n <span aria-hidden=\"true\" class={menuShortcut}>\n {local.shortcut}\n </span>\n ) : null}\n </ItemPrimitive>\n )\n }\n\n /**\n * The chord drawn at a row's trailing edge, for a caller composing a row by\n * hand. The glyphs are decorative: the span is `aria-hidden` and the\n * parseable chord belongs in the row's `aria-keyshortcuts`, so the item's\n * accessible name stays exactly its label.\n */\n function Shortcut(props: ComponentProps<'span'>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <span\n data-slot={`${family}-shortcut`}\n aria-hidden=\"true\"\n class={cn(menuShortcut, local.class)}\n {...rest}\n />\n )\n }\n\n // Selection indicators read in the accent, like every other selected state\n // in the system — a canvas-coloured mark on a checked row reads as decoration.\n function CheckboxItem(\n props: MenuChoiceItemProps<ComponentProps<typeof KobalteDropdownMenu.CheckboxItem>>\n ) {\n const { CheckboxItem: CheckboxItemPrimitive, ItemIndicator } = Menu\n const [local, rest] = splitProps(props, ['class', 'swatch', 'children'])\n return (\n <CheckboxItemPrimitive class={cn(menuItem, 'pe-8', local.class)} {...rest}>\n <Swatch tone={local.swatch} />\n {local.children}\n <ItemIndicator\n data-slot={indicatorSlot}\n class=\"absolute end-2 flex size-4 items-center justify-center text-primary\"\n >\n <Check class=\"size-4\" />\n </ItemIndicator>\n </CheckboxItemPrimitive>\n )\n }\n\n function RadioItem(\n props: MenuChoiceItemProps<ComponentProps<typeof KobalteDropdownMenu.RadioItem>>\n ) {\n const { RadioItem: RadioItemPrimitive, ItemIndicator } = Menu\n const [local, rest] = splitProps(props, ['class', 'swatch', 'children'])\n return (\n <RadioItemPrimitive class={cn(menuItem, 'pe-8', local.class)} {...rest}>\n <Swatch tone={local.swatch} />\n {local.children}\n <ItemIndicator\n data-slot={indicatorSlot}\n class=\"absolute end-2 flex size-4 items-center justify-center text-primary\"\n >\n <Circle class=\"size-2 fill-current\" />\n </ItemIndicator>\n </RadioItemPrimitive>\n )\n }\n\n /**\n * The caption of a group, and that group's accessible name. It must be a\n * child of the group it names: Kobalte reads the group from context, so a\n * label placed directly in the content throws `useMenuGroupContext must be\n * used within a Menu.Group` the moment the menu opens. For an ungrouped\n * caption, wrap the label and its items in a group anyway — the grouping is\n * what a screen reader announces.\n */\n function Label(props: ComponentProps<typeof KobalteDropdownMenu.GroupLabel>) {\n const GroupLabel = Menu.GroupLabel\n const [local, rest] = splitProps(props, ['class'])\n return <GroupLabel class={cn(menuLabel, local.class)} {...rest} />\n }\n\n function Separator(props: ComponentProps<typeof KobalteDropdownMenu.Separator>) {\n const SeparatorPrimitive = Menu.Separator\n const [local, rest] = splitProps(props, ['class'])\n return <SeparatorPrimitive class={cn(menuSeparator, local.class)} {...rest} />\n }\n\n function SubTrigger(props: ComponentProps<typeof KobalteDropdownMenu.SubTrigger>) {\n const SubTriggerPrimitive = Menu.SubTrigger\n const [local, rest] = splitProps(props, ['class', 'children'])\n return (\n <SubTriggerPrimitive class={cn(menuItem, local.class)} {...rest}>\n {local.children}\n <ChevronRight class=\"ms-auto size-4\" />\n </SubTriggerPrimitive>\n )\n }\n\n function SubContent(props: ComponentProps<typeof KobalteDropdownMenu.SubContent>) {\n const { SubContent: SubContentPrimitive, Portal } = Menu\n const [local, rest] = splitProps(props, ['class'])\n return (\n <Portal>\n <SubContentPrimitive\n {...topLayerProps}\n class={cn(menuPanel, 'min-w-[8rem]', local.class)}\n {...rest}\n />\n </Portal>\n )\n }\n\n return { Item, Shortcut, CheckboxItem, RadioItem, Label, Separator, SubTrigger, SubContent }\n}\n"],"mappings":";;;;;;;;AAuCA,IAAasB,YAAYH,GACvBH,gBACAD,eACA,4EAAA,KAEF;AA0BA,SAASe,OAAOC,OAA6C;CAC3D,OAAAE,gBACG3B,MAAI;EAAA,IAAC4B,OAAI;GAAA,OAAEH,MAAMC;EAAI;EAAA,IAAAG,WAAA;GAAA,IAAAC,OAAAC,OAAA;GAAAC,aAAAC,UAAAH,MACYtB,eAAe,EAAEkB,MAAMD,MAAMC,KAAK,CAAC,CAAC,CAAA;GAAA,OAAAI;E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;CAIhB;CAEA,OAAO;EAAEtB;EAAM6B;EAAUI;EAAcG;EAAWE;EAAOE;EAAWE;EAAYE;CAAW;AAC7F"}
1
+ {"version":3,"file":"menu-parts.js","names":["Check","ChevronRight","Circle","Show","splitProps","destructiveMenuItem","menuItem","menuLabel","menuSeparator","menuShortcut","menuSwatchTone","overlayMotion","overlaySurface","topLayerProps","cn","menuPanel","Item","variant","shortcut","keyshortcuts","swatch","Swatch","props","tone","_$createComponent","when","children","_el$","_tmpl$","_$effect","_$className","createMenuParts","Menu","family","indicatorSlot","ItemPrimitive","local","rest","_$mergeProps","class","_$memo","_el$2","_$insert","Shortcut","_el$3","_$setAttribute","_$spread","CheckboxItem","CheckboxItemPrimitive","ItemIndicator","RadioItem","RadioItemPrimitive","Label","GroupLabel","Separator","SeparatorPrimitive","SubTrigger","SubTriggerPrimitive","SubContent","SubContentPrimitive","Portal"],"sources":["../../../../src/components/ui/dropdown-menu/menu-parts.tsx"],"sourcesContent":["import type { DropdownMenu as KobalteDropdownMenu } from '@kobalte/core/dropdown-menu'\nimport { Check, ChevronRight, Circle } from 'lucide-solid'\nimport type { ComponentProps } from 'solid-js'\nimport { Show, splitProps } from 'solid-js'\nimport {\n destructiveMenuItem,\n menuContentPadding,\n menuItem,\n menuLabel,\n menuSeparator,\n menuShortcut,\n menuSwatchTone,\n overlayMotion,\n overlaySurface,\n topLayerProps,\n type MenuSwatchTone,\n} from '#lib/overlay'\nimport { cn } from '#lib/utils'\n\n/**\n * The rows and panels every Kobalte menu family draws alike — DropdownMenu,\n * ContextMenu and Menubar. Kobalte builds all three from the same menu\n * primitives; each family passes its own namespace and keeps its own exported\n * names, so a row looks and reads the same whichever menu it is in.\n */\ntype MenuPrimitives = Pick<\n typeof KobalteDropdownMenu,\n | 'Item'\n | 'CheckboxItem'\n | 'RadioItem'\n | 'ItemIndicator'\n | 'GroupLabel'\n | 'Separator'\n | 'SubTrigger'\n | 'SubContent'\n | 'Portal'\n>\n\n/** The floating panel of a menu or submenu; `min-w-*` is the caller's. */\nexport const menuPanel = cn(\n overlaySurface,\n overlayMotion,\n 'z-(--z-menu) origin-(--kb-menu-content-transform-origin) overflow-hidden',\n menuContentPadding\n)\n\nexport type MenuItemProps<Item> = Item & {\n /** Colour the row as a destructive action. Confirm it separately. */\n variant?: 'default' | 'destructive'\n /** Draw a shortcut hint at the trailing edge of the row. */\n shortcut?: string\n /**\n * The parseable chord behind `shortcut`, e.g. `Meta+E`. The drawn glyph is\n * `aria-hidden` — reading it out would pollute the item's accessible name —\n * so this is what assistive technology announces instead. Supply it\n * whenever `shortcut` is drawn.\n */\n keyshortcuts?: string\n /** Draw a leading colour dot from the shared tone ladder — the accent or\n * status role the option's card badge carries. `aria-hidden`; the label\n * carries the meaning. */\n swatch?: MenuSwatchTone\n}\n\nexport type MenuChoiceItemProps<Item> = Item & {\n /** Draw a leading colour dot from the shared tone ladder. `aria-hidden`;\n * the label carries the meaning. */\n swatch?: MenuSwatchTone\n}\n\nfunction Swatch(props: { tone: MenuSwatchTone | undefined }) {\n return (\n <Show when={props.tone}>\n <span aria-hidden=\"true\" class={menuSwatchTone({ tone: props.tone })} />\n </Show>\n )\n}\n\nexport function createMenuParts(\n Menu: MenuPrimitives,\n family: 'dropdown-menu' | 'context-menu' | 'menubar'\n) {\n const indicatorSlot = `${family}-indicator`\n\n function Item(props: MenuItemProps<ComponentProps<typeof KobalteDropdownMenu.Item>>) {\n const ItemPrimitive = Menu.Item\n const [local, rest] = splitProps(props, [\n 'class',\n 'variant',\n 'shortcut',\n 'keyshortcuts',\n 'swatch',\n 'children',\n ])\n return (\n <ItemPrimitive\n class={cn(\n menuItem,\n { [destructiveMenuItem]: local.variant === 'destructive' },\n local.class\n )}\n aria-keyshortcuts={local.keyshortcuts}\n {...rest}\n >\n <Swatch tone={local.swatch} />\n {local.children}\n {local.shortcut ? (\n <span aria-hidden=\"true\" class={menuShortcut}>\n {local.shortcut}\n </span>\n ) : null}\n </ItemPrimitive>\n )\n }\n\n /**\n * The chord drawn at a row's trailing edge, for a caller composing a row by\n * hand. The glyphs are decorative: the span is `aria-hidden` and the\n * parseable chord belongs in the row's `aria-keyshortcuts`, so the item's\n * accessible name stays exactly its label.\n */\n function Shortcut(props: ComponentProps<'span'>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <span\n data-slot={`${family}-shortcut`}\n aria-hidden=\"true\"\n class={cn(menuShortcut, local.class)}\n {...rest}\n />\n )\n }\n\n // Selection indicators read in the accent, like every other selected state\n // in the system — a canvas-coloured mark on a checked row reads as decoration.\n function CheckboxItem(\n props: MenuChoiceItemProps<ComponentProps<typeof KobalteDropdownMenu.CheckboxItem>>\n ) {\n const { CheckboxItem: CheckboxItemPrimitive, ItemIndicator } = Menu\n const [local, rest] = splitProps(props, ['class', 'swatch', 'children'])\n return (\n <CheckboxItemPrimitive class={cn(menuItem, 'pe-8', local.class)} {...rest}>\n <Swatch tone={local.swatch} />\n {local.children}\n <ItemIndicator\n data-slot={indicatorSlot}\n class=\"absolute end-2 flex size-4 items-center justify-center text-primary\"\n >\n <Check class=\"size-4\" />\n </ItemIndicator>\n </CheckboxItemPrimitive>\n )\n }\n\n function RadioItem(\n props: MenuChoiceItemProps<ComponentProps<typeof KobalteDropdownMenu.RadioItem>>\n ) {\n const { RadioItem: RadioItemPrimitive, ItemIndicator } = Menu\n const [local, rest] = splitProps(props, ['class', 'swatch', 'children'])\n return (\n <RadioItemPrimitive class={cn(menuItem, 'pe-8', local.class)} {...rest}>\n <Swatch tone={local.swatch} />\n {local.children}\n <ItemIndicator\n data-slot={indicatorSlot}\n class=\"absolute end-2 flex size-4 items-center justify-center text-primary\"\n >\n <Circle class=\"size-2 fill-current\" />\n </ItemIndicator>\n </RadioItemPrimitive>\n )\n }\n\n /**\n * The caption of a group, and that group's accessible name. It must be a\n * child of the group it names: Kobalte reads the group from context, so a\n * label placed directly in the content throws `useMenuGroupContext must be\n * used within a Menu.Group` the moment the menu opens. For an ungrouped\n * caption, wrap the label and its items in a group anyway — the grouping is\n * what a screen reader announces.\n */\n function Label(props: ComponentProps<typeof KobalteDropdownMenu.GroupLabel>) {\n const GroupLabel = Menu.GroupLabel\n const [local, rest] = splitProps(props, ['class'])\n return <GroupLabel class={cn(menuLabel, local.class)} {...rest} />\n }\n\n function Separator(props: ComponentProps<typeof KobalteDropdownMenu.Separator>) {\n const SeparatorPrimitive = Menu.Separator\n const [local, rest] = splitProps(props, ['class'])\n return <SeparatorPrimitive class={cn(menuSeparator, local.class)} {...rest} />\n }\n\n function SubTrigger(props: ComponentProps<typeof KobalteDropdownMenu.SubTrigger>) {\n const SubTriggerPrimitive = Menu.SubTrigger\n const [local, rest] = splitProps(props, ['class', 'children'])\n return (\n <SubTriggerPrimitive class={cn(menuItem, local.class)} {...rest}>\n {local.children}\n <ChevronRight class=\"ms-auto size-4\" />\n </SubTriggerPrimitive>\n )\n }\n\n function SubContent(props: ComponentProps<typeof KobalteDropdownMenu.SubContent>) {\n const { SubContent: SubContentPrimitive, Portal } = Menu\n const [local, rest] = splitProps(props, ['class'])\n return (\n <Portal>\n <SubContentPrimitive\n {...topLayerProps}\n class={cn(menuPanel, 'min-w-[8rem]', local.class)}\n {...rest}\n />\n </Portal>\n )\n }\n\n return { Item, Shortcut, CheckboxItem, RadioItem, Label, Separator, SubTrigger, SubContent }\n}\n"],"mappings":";;;;;;;;AAuCA,IAAae,YAAYD,GACvBF,gBACAD,eACA,4EAAA,KAEF;AA0BA,SAASU,OAAOC,OAA6C;CAC3D,OAAAE,gBACGrB,MAAI;EAAA,IAACsB,OAAI;GAAA,OAAEH,MAAMC;EAAI;EAAA,IAAAG,WAAA;GAAA,IAAAC,OAAAC,OAAA;GAAAC,aAAAC,UAAAH,MACYjB,eAAe,EAAEa,MAAMD,MAAMC,KAAK,CAAC,CAAC,CAAA;GAAA,OAAAI;EAAA;CAAA,CAAA;AAG1E;AAEA,SAAgBI,gBACdC,MACAC,QACA;CACA,MAAMC,gBAAgB,GAAGD,OAAM;CAE/B,SAASjB,K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