@adea-ai/ui 0.104.3 → 0.106.0

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 (191) hide show
  1. package/README.md +44 -8
  2. package/dist/components/composites/action-button/action-button.d.ts.map +1 -1
  3. package/dist/components/composites/action-button/action-button.js +6 -8
  4. package/dist/components/composites/action-button/action-button.js.map +1 -1
  5. package/dist/components/composites/appearance-editor/accent-swatch-groups.d.ts +16 -0
  6. package/dist/components/composites/appearance-editor/accent-swatch-groups.d.ts.map +1 -0
  7. package/dist/components/composites/appearance-editor/accent-swatch-groups.js +151 -0
  8. package/dist/components/composites/appearance-editor/accent-swatch-groups.js.map +1 -0
  9. package/dist/components/composites/appearance-editor/appearance-choices.d.ts.map +1 -1
  10. package/dist/components/composites/appearance-editor/appearance-choices.js +24 -84
  11. package/dist/components/composites/appearance-editor/appearance-choices.js.map +1 -1
  12. package/dist/components/composites/appearance-editor/appearance-editor.d.ts +2 -2
  13. package/dist/components/composites/appearance-editor/appearance-editor.d.ts.map +1 -1
  14. package/dist/components/composites/appearance-editor/appearance-editor.js +25 -7
  15. package/dist/components/composites/appearance-editor/appearance-editor.js.map +1 -1
  16. package/dist/components/composites/appearance-editor/appearance-types.d.ts +9 -0
  17. package/dist/components/composites/appearance-editor/appearance-types.d.ts.map +1 -1
  18. package/dist/components/composites/appearance-editor/font-settings-group.d.ts +10 -0
  19. package/dist/components/composites/appearance-editor/font-settings-group.d.ts.map +1 -0
  20. package/dist/components/composites/appearance-editor/font-settings-group.js +310 -0
  21. package/dist/components/composites/appearance-editor/font-settings-group.js.map +1 -0
  22. package/dist/components/composites/appearance-editor/index.d.ts +2 -0
  23. package/dist/components/composites/appearance-editor/index.d.ts.map +1 -1
  24. package/dist/components/composites/appearance-editor/index.js +3 -1
  25. package/dist/components/composites/update-dialog/update-dialog.js +2 -2
  26. package/dist/components/composites/update-dialog/update-dialog.js.map +1 -1
  27. package/dist/components/conversation/message-row.d.ts.map +1 -1
  28. package/dist/components/conversation/message-row.js +3 -3
  29. package/dist/components/conversation/message-row.js.map +1 -1
  30. package/dist/components/conversation/paste-token-editor.js +1 -1
  31. package/dist/components/conversation/paste-token-editor.js.map +1 -1
  32. package/dist/components/layout/side-rail/side-rail.js +2 -2
  33. package/dist/components/layout/side-rail/side-rail.js.map +1 -1
  34. package/dist/components/layout/top-bar/top-bar.js +1 -1
  35. package/dist/components/layout/top-bar/top-bar.js.map +1 -1
  36. package/dist/components/theme/appearance-panel.d.ts +1 -1
  37. package/dist/components/theme/appearance-panel.d.ts.map +1 -1
  38. package/dist/components/theme/appearance-panel.js +45 -105
  39. package/dist/components/theme/appearance-panel.js.map +1 -1
  40. package/dist/components/theme/theme-provider.d.ts +5 -2
  41. package/dist/components/theme/theme-provider.d.ts.map +1 -1
  42. package/dist/components/theme/theme-provider.js +38 -19
  43. package/dist/components/theme/theme-provider.js.map +1 -1
  44. package/dist/components/ui/code-block/code-block.d.ts +3 -3
  45. package/dist/components/ui/code-block/code-block.js +6 -6
  46. package/dist/components/ui/code-block/code-block.js.map +1 -1
  47. package/dist/components/ui/command/command.js +1 -1
  48. package/dist/components/ui/command/command.js.map +1 -1
  49. package/dist/components/ui/context-menu/context-menu.js +1 -1
  50. package/dist/components/ui/context-menu/context-menu.js.map +1 -1
  51. package/dist/components/ui/diff-block/diff-block.js +5 -5
  52. package/dist/components/ui/diff-block/diff-block.js.map +1 -1
  53. package/dist/components/ui/dropdown-menu/dropdown-menu.d.ts.map +1 -1
  54. package/dist/components/ui/dropdown-menu/dropdown-menu.js +101 -8
  55. package/dist/components/ui/dropdown-menu/dropdown-menu.js.map +1 -1
  56. package/dist/components/ui/kbd/index.d.ts +1 -1
  57. package/dist/components/ui/kbd/index.d.ts.map +1 -1
  58. package/dist/components/ui/kbd/index.js +2 -2
  59. package/dist/components/ui/kbd/kbd.d.ts +40 -2
  60. package/dist/components/ui/kbd/kbd.d.ts.map +1 -1
  61. package/dist/components/ui/kbd/kbd.js +74 -7
  62. package/dist/components/ui/kbd/kbd.js.map +1 -1
  63. package/dist/components/ui/menubar/menubar.js +1 -1
  64. package/dist/components/ui/menubar/menubar.js.map +1 -1
  65. package/dist/components/ui/typography/typography.d.ts +3 -5
  66. package/dist/components/ui/typography/typography.d.ts.map +1 -1
  67. package/dist/components/ui/typography/typography.js +6 -8
  68. package/dist/components/ui/typography/typography.js.map +1 -1
  69. package/dist/index.js +7 -4
  70. package/dist/lib/appearance-font-settings.d.ts +53 -0
  71. package/dist/lib/appearance-font-settings.d.ts.map +1 -0
  72. package/dist/lib/appearance-font-settings.js +160 -0
  73. package/dist/lib/appearance-font-settings.js.map +1 -0
  74. package/dist/lib/font-catalog.d.ts +72 -0
  75. package/dist/lib/font-catalog.d.ts.map +1 -0
  76. package/dist/lib/font-catalog.js +71 -0
  77. package/dist/lib/font-catalog.js.map +1 -0
  78. package/dist/lib/safe-script.d.ts +3 -0
  79. package/dist/lib/safe-script.d.ts.map +1 -0
  80. package/dist/lib/safe-script.js +9 -0
  81. package/dist/lib/safe-script.js.map +1 -0
  82. package/dist/lib/tokens.d.ts +2 -19
  83. package/dist/lib/tokens.d.ts.map +1 -1
  84. package/dist/lib/tokens.js +63 -39
  85. package/dist/lib/tokens.js.map +1 -1
  86. package/dist/r/about-dialog.json +1 -1
  87. package/dist/r/accordion.json +1 -1
  88. package/dist/r/account-menu.json +1 -1
  89. package/dist/r/alert.json +1 -1
  90. package/dist/r/appearance-editor.json +13 -2
  91. package/dist/r/breadcrumb.json +1 -1
  92. package/dist/r/calendar.json +1 -1
  93. package/dist/r/carousel.json +1 -1
  94. package/dist/r/catalog-browser.json +1 -1
  95. package/dist/r/checkbox.json +1 -1
  96. package/dist/r/code-block.json +1 -1
  97. package/dist/r/combobox.json +1 -1
  98. package/dist/r/command.json +1 -1
  99. package/dist/r/context-menu.json +1 -1
  100. package/dist/r/conversation.json +1 -1
  101. package/dist/r/detail-panel.json +1 -1
  102. package/dist/r/dialog.json +1 -1
  103. package/dist/r/dropdown-menu.json +1 -1
  104. package/dist/r/empty.json +1 -1
  105. package/dist/r/floating-preview.json +1 -1
  106. package/dist/r/help-center.json +1 -1
  107. package/dist/r/lib.json +16 -1
  108. package/dist/r/menubar.json +1 -1
  109. package/dist/r/native-select.json +1 -1
  110. package/dist/r/navigation-menu.json +1 -1
  111. package/dist/r/pagination.json +1 -1
  112. package/dist/r/radio-group.json +1 -1
  113. package/dist/r/registry.json +75 -42
  114. package/dist/r/resizable.json +1 -1
  115. package/dist/r/scene-controls.json +1 -1
  116. package/dist/r/select.json +1 -1
  117. package/dist/r/sheet.json +1 -1
  118. package/dist/r/sidebar-nav.json +1 -1
  119. package/dist/r/spinner.json +1 -1
  120. package/dist/r/split-layout.json +1 -1
  121. package/dist/r/src/components/composites/action-button/action-button.tsx +2 -1
  122. package/dist/r/src/components/composites/appearance-editor/accent-swatch-groups.tsx +147 -0
  123. package/dist/r/src/components/composites/appearance-editor/appearance-choices.tsx +17 -74
  124. package/dist/r/src/components/composites/appearance-editor/appearance-editor.tsx +19 -6
  125. package/dist/r/src/components/composites/appearance-editor/appearance-types.ts +9 -0
  126. package/dist/r/src/components/composites/appearance-editor/font-settings-group.tsx +350 -0
  127. package/dist/r/src/components/composites/appearance-editor/index.ts +19 -0
  128. package/dist/r/src/components/composites/update-dialog/update-dialog.tsx +2 -2
  129. package/dist/r/src/components/conversation/message-row.tsx +7 -3
  130. package/dist/r/src/components/conversation/paste-token-editor.tsx +1 -1
  131. package/dist/r/src/components/layout/side-rail/side-rail.tsx +3 -3
  132. package/dist/r/src/components/layout/top-bar/top-bar.tsx +1 -1
  133. package/dist/r/src/components/theme/appearance-panel.tsx +34 -83
  134. package/dist/r/src/components/theme/theme-provider.tsx +50 -20
  135. package/dist/r/src/components/ui/code-block/code-block.tsx +6 -6
  136. package/dist/r/src/components/ui/command/command.tsx +1 -1
  137. package/dist/r/src/components/ui/context-menu/context-menu.tsx +1 -1
  138. package/dist/r/src/components/ui/diff-block/diff-block.tsx +7 -7
  139. package/dist/r/src/components/ui/dropdown-menu/dropdown-menu.tsx +145 -7
  140. package/dist/r/src/components/ui/kbd/index.ts +10 -1
  141. package/dist/r/src/components/ui/kbd/kbd.tsx +77 -14
  142. package/dist/r/src/components/ui/menubar/menubar.tsx +1 -1
  143. package/dist/r/src/components/ui/typography/typography.tsx +6 -8
  144. package/dist/r/src/lib/appearance-font-settings.ts +233 -0
  145. package/dist/r/src/lib/font-catalog.ts +80 -0
  146. package/dist/r/src/lib/safe-script.ts +7 -0
  147. package/dist/r/src/lib/tokens.ts +64 -59
  148. package/dist/r/src/styles/appearance-font-settings.css +110 -0
  149. package/dist/r/src/styles/fonts.css +4 -5
  150. package/dist/r/src/styles/globals.css +4 -1
  151. package/dist/r/src/styles/theme.css +14 -0
  152. package/dist/r/stat.json +1 -1
  153. package/dist/r/theme.json +5 -0
  154. package/dist/r/theming.json +4 -2
  155. package/dist/r/toast.json +1 -1
  156. package/dist/r/top-bar.json +1 -1
  157. package/dist/r/tree.json +1 -1
  158. package/dist/r/update-dialog.json +1 -1
  159. package/package.json +7 -6
  160. package/registry.json +75 -42
  161. package/src/components/composites/action-button/action-button.tsx +2 -1
  162. package/src/components/composites/appearance-editor/accent-swatch-groups.tsx +147 -0
  163. package/src/components/composites/appearance-editor/appearance-choices.tsx +17 -74
  164. package/src/components/composites/appearance-editor/appearance-editor.tsx +19 -6
  165. package/src/components/composites/appearance-editor/appearance-types.ts +9 -0
  166. package/src/components/composites/appearance-editor/font-settings-group.tsx +350 -0
  167. package/src/components/composites/appearance-editor/index.ts +19 -0
  168. package/src/components/composites/update-dialog/update-dialog.tsx +2 -2
  169. package/src/components/conversation/message-row.tsx +7 -3
  170. package/src/components/conversation/paste-token-editor.tsx +1 -1
  171. package/src/components/layout/side-rail/side-rail.tsx +3 -3
  172. package/src/components/layout/top-bar/top-bar.tsx +1 -1
  173. package/src/components/theme/appearance-panel.tsx +34 -83
  174. package/src/components/theme/theme-provider.tsx +50 -20
  175. package/src/components/ui/code-block/code-block.tsx +6 -6
  176. package/src/components/ui/command/command.tsx +1 -1
  177. package/src/components/ui/context-menu/context-menu.tsx +1 -1
  178. package/src/components/ui/diff-block/diff-block.tsx +7 -7
  179. package/src/components/ui/dropdown-menu/dropdown-menu.tsx +145 -7
  180. package/src/components/ui/kbd/index.ts +10 -1
  181. package/src/components/ui/kbd/kbd.tsx +77 -14
  182. package/src/components/ui/menubar/menubar.tsx +1 -1
  183. package/src/components/ui/typography/typography.tsx +6 -8
  184. package/src/lib/appearance-font-settings.ts +233 -0
  185. package/src/lib/font-catalog.ts +80 -0
  186. package/src/lib/safe-script.ts +7 -0
  187. package/src/lib/tokens.ts +64 -59
  188. package/src/styles/appearance-font-settings.css +110 -0
  189. package/src/styles/fonts.css +4 -5
  190. package/src/styles/globals.css +4 -1
  191. package/src/styles/theme.css +14 -0
@@ -1 +1 @@
1
- {"version":3,"file":"paste-token-editor.js","names":["For","Show","createEffect","createMemo","createSignal","createUniqueId","on","onCleanup","onMount","countLines","findTokenRanges","formatToken","isPasteBlock","nextSeq","pruneBlocks","shouldCollapse","stripTrailingBlankLines","tokenRangeAt","PasteBlock","summarizePastePreview","Tooltip","KobalteTooltip","PasteTokenDraft","text","blocks","TokenRange","start","end","block","Segment","PasteTokenEditorProps","value","resetKey","ref","element","HTMLTextAreaElement","createBlockId","onChange","draft","inputLabel","placeholder","disabled","readOnly","composing","onCompositionStart","onCompositionEnd","onFocus","onBlur","onKeyDown","event","KeyboardEvent","PREVIEW_OPEN_DELAY_MS","isTouchDevice","window","matchMedia","matches","isBlockquotePrefix","linePrefix","sawMarker","index","length","code","charCodeAt","PasteTokenEditor","props","preview","setPreview","previewSummary","content","lines","descriptionId","keyboardHintId","field","mirror","HTMLDivElement","previewTimer","ReturnType","setTimeout","scheduledBlockId","previewSource","rawPasteNext","suppressPasteInput","nativePasteInputSeen","keyboardNavigationPending","acceptingTextDrop","snappedCaretPreview","blockId","position","ranges","clearTimer","clearTimeout","undefined","closePreview","schedulePreview","source","id","current","find","range","change","snapToTokenEdge","tokenRanges","edge","setCaret","focus","requestAnimationFrame","setSelectionRange","replaceRange","removed","filter","nextStart","Math","min","map","nextEnd","max","next","slice","some","expandToken","segments","result","cursor","push","scheduleCaretPreview","selectionStart","selectionEnd","caret","candidate","snappedRange","openKeyboardPreview","schedulePointerPreview","MouseEvent","buttons","span","querySelectorAll","HTMLElement","rect","getBoundingClientRect","clientX","left","right","clientY","top","bottom","sequence","Number","dataset","pasteSeq","seq","snapSelection","direction","selectionDirection","handleKeyDown","metaKey","ctrlKey","shiftKey","altKey","key","toLowerCase","isComposing","keyCode","preventDefault","collapsed","plainModifier","backspace","deletion","remove","adjacent","boundary","lastIndexOf","indexOf","from","to","active","navigation","leftward","nextRanges","expandSelectionForClipboard","covered","handlePaste","ClipboardEvent","forceRaw","pasted","clipboardData","getData","cleaned","before","after","leading","endsWith","trailing","startsWith","insert","inserted","document","execCommand","handleDragOver","DragEvent","dataTransfer","types","includes","handleDragLeave","handleDrop","dropped","handleClipboard","expanded","setData","type","handleClick","detail","addEventListener","removeEventListener","_$createComponent","open","onOpenChange","openDelay","children","Trigger","as","_el$","_tmpl$","_$use","_$insert","each","segment","_el$4","_tmpl$4","_$effect","_$setAttribute","_el$5","_tmpl$5","_el$2","_tmpl$2","$$keydown","_$addEventListener","scrollTop","currentTarget","scrollLeft","$$mousemove","$$click","$$input","_p$","_v$","_v$2","_v$3","_v$4","_v$5","e","t","a","o","i","_el$3","_tmpl$3","when","summary","Portal","Content","_el$6","_tmpl$6","hiddenLines","_el$7","_tmpl$7","_el$8","firstChild","_el$0","nextSibling","_el$9","_$memo","hiddenCharacters","_el$1","_tmpl$8","_el$10","_el$12","_el$11","Arrow","_$delegateEvents","_$createComponent","KobalteTooltip","_$setAttribute","_$memo","_$delegateEvents"],"sources":["../../../src/components/conversation/paste-token-editor.tsx"],"sourcesContent":["/*\n * Substantially translated from KiroCrew website/src/components/ChatInput.tsx\n * and PasteHighlightLayer.tsx at 283e136c0f902e965a535a7c9548c57c7504fed0.\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * Licensed under Apache-2.0; see LICENSE and NOTICE.\n */\nimport {\n For,\n Show,\n createEffect,\n createMemo,\n createSignal,\n createUniqueId,\n on,\n onCleanup,\n onMount,\n} from 'solid-js'\nimport {\n countLines,\n findTokenRanges,\n formatToken,\n isPasteBlock,\n nextSeq,\n pruneBlocks,\n shouldCollapse,\n stripTrailingBlankLines,\n tokenRangeAt,\n type PasteBlock,\n} from './paste-tokens'\nimport { summarizePastePreview } from './paste-preview'\nimport { Tooltip as KobalteTooltip } from '@kobalte/core/tooltip'\n\nexport type PasteTokenDraft = { text: string; blocks: PasteBlock[] }\ntype TokenRange = { start: number; end: number; block: PasteBlock }\ntype Segment = { text: string; block?: PasteBlock }\n\nexport type PasteTokenEditorProps = {\n value: string\n resetKey?: unknown\n blocks: readonly PasteBlock[]\n ref: (element: HTMLTextAreaElement | undefined) => void\n createBlockId: () => string\n onChange: (draft: PasteTokenDraft) => void\n inputLabel: string\n placeholder: string\n disabled?: boolean\n readOnly?: boolean\n composing: () => boolean\n onCompositionStart: () => void\n onCompositionEnd: () => void\n onFocus: () => void\n onBlur: () => void\n onKeyDown: (event: KeyboardEvent) => void\n}\n\nconst PREVIEW_OPEN_DELAY_MS = 300\n\nfunction isTouchDevice(): boolean {\n return (\n typeof window !== 'undefined' &&\n typeof window.matchMedia === 'function' &&\n (window.matchMedia('(pointer: coarse)').matches || window.matchMedia('(hover: none)').matches)\n )\n}\n\nfunction isBlockquotePrefix(linePrefix: string): boolean {\n let sawMarker = false\n for (let index = 0; index < linePrefix.length; index += 1) {\n const code = linePrefix.charCodeAt(index)\n if (code === 62) sawMarker = true\n else if (code !== 32 && code !== 9) return false\n }\n return sawMarker\n}\n\n/** Controlled plain-text editor that treats known paste markers as atomic ranges. */\nexport function PasteTokenEditor(props: PasteTokenEditorProps) {\n const [preview, setPreview] = createSignal<PasteBlock | null>(null)\n const previewSummary = createMemo(() => {\n const block = preview()\n return block ? summarizePastePreview(block.content, block.lines) : null\n })\n const descriptionId = `paste-preview-${createUniqueId()}`\n const keyboardHintId = `paste-keyboard-hint-${createUniqueId()}`\n let field: HTMLTextAreaElement | undefined\n let mirror: HTMLDivElement | undefined\n let previewTimer: ReturnType<typeof setTimeout> | undefined\n let scheduledBlockId: string | null = null\n /**\n * What scheduled the current preview. A caret event must not cancel a preview\n * the pointer is owed: a programmatic caret restore (`setCaret` defers to an\n * animation frame) dispatches its `select` event as a separate task that can\n * land *after* a pointermove has already scheduled the hover preview, and a\n * caret with no token under it would otherwise tear that preview down with no\n * further pointermove ever arriving to reschedule it. The pointer's own leave,\n * scroll, blur and reset paths still close unconditionally.\n */\n let previewSource: 'pointer' | 'caret' | 'keyboard' | null = null\n let rawPasteNext = false\n let suppressPasteInput = false\n let nativePasteInputSeen = false\n let keyboardNavigationPending = false\n let acceptingTextDrop = false\n let snappedCaretPreview: { blockId: string; position: number } | null = null\n\n const ranges = () => findTokenRanges(props.value, props.blocks)\n const clearTimer = () => {\n clearTimeout(previewTimer)\n previewTimer = undefined\n }\n const closePreview = () => {\n clearTimer()\n scheduledBlockId = null\n snappedCaretPreview = null\n previewSource = null\n setPreview(null)\n }\n const schedulePreview = (block: PasteBlock, source: 'pointer' | 'caret') => {\n if (scheduledBlockId === block.id) return\n clearTimer()\n scheduledBlockId = block.id\n previewSource = source\n setPreview(null)\n previewTimer = setTimeout(() => {\n previewTimer = undefined\n const current = ranges().find((range) => range.block.id === block.id)\n if (current) setPreview(current.block)\n else closePreview()\n }, PREVIEW_OPEN_DELAY_MS)\n }\n const change = (text: string, blocks: readonly PasteBlock[] = props.blocks) => {\n props.onChange({ text, blocks: pruneBlocks(text, [...blocks]) })\n }\n const snapToTokenEdge = (\n position: number,\n tokenRanges: readonly TokenRange[] = ranges(),\n edge?: 'start' | 'end'\n ) => {\n for (const range of tokenRanges) {\n if (position > range.start && position < range.end) {\n if (edge === 'start') return range.start\n if (edge === 'end') return range.end\n return position - range.start <= range.end - position ? range.start : range.end\n }\n }\n return position\n }\n const setCaret = (position: number, focus = false) => {\n requestAnimationFrame(() => {\n if (!field) return\n if (focus) field.focus()\n field.setSelectionRange(position, position)\n })\n }\n const replaceRange = (start: number, end: number) => {\n if (!field) return\n const removed = ranges().filter((range) => range.start < end && range.end > start)\n if (!removed.length) return\n const nextStart = Math.min(start, ...removed.map((range) => range.start))\n const nextEnd = Math.max(end, ...removed.map((range) => range.end))\n const next = props.value.slice(0, nextStart) + props.value.slice(nextEnd)\n change(\n next,\n props.blocks.filter((block) => !removed.some((range) => range.block.id === block.id))\n )\n setCaret(nextStart)\n }\n const expandToken = (range: TokenRange) => {\n const next =\n props.value.slice(0, range.start) + range.block.content + props.value.slice(range.end)\n change(\n next,\n props.blocks.filter((block) => block.id !== range.block.id)\n )\n closePreview()\n setCaret(range.start + range.block.content.length, true)\n }\n\n const segments = (): Segment[] => {\n const result: Segment[] = []\n let cursor = 0\n for (const range of ranges()) {\n if (range.start > cursor) result.push({ text: props.value.slice(cursor, range.start) })\n result.push({ text: props.value.slice(range.start, range.end), block: range.block })\n cursor = range.end\n }\n if (cursor < props.value.length) result.push({ text: props.value.slice(cursor) })\n if (!result.length) result.push({ text: props.value })\n return result\n }\n\n const scheduleCaretPreview = () => {\n if (isTouchDevice() || props.composing() || !field) {\n closePreview()\n return\n }\n if (field.selectionStart !== field.selectionEnd) {\n closePreview()\n return\n }\n const caret = field.selectionStart\n const range = ranges().find((candidate) => caret > candidate.start && caret < candidate.end)\n if (range) {\n schedulePreview(range.block, 'caret')\n return\n }\n const snappedRange =\n snappedCaretPreview?.position === caret\n ? ranges().find((candidate) => candidate.block.id === snappedCaretPreview?.blockId)\n : undefined\n if (snappedRange) schedulePreview(snappedRange.block, 'caret')\n // A caret with no token under it dismisses a caret-sourced preview, but a\n // pointer-scheduled preview outlives it: the pointer has not moved.\n else if (previewSource !== 'pointer') closePreview()\n }\n\n const openKeyboardPreview = (): boolean => {\n if (!field) return false\n const start = field.selectionStart\n const end = field.selectionEnd\n const range = ranges().find((candidate) =>\n start === end\n ? start >= candidate.start && start <= candidate.end\n : candidate.start < end && candidate.end > start\n )\n if (!range) return false\n clearTimer()\n scheduledBlockId = range.block.id\n previewSource = 'keyboard'\n setPreview(range.block)\n return true\n }\n\n const schedulePointerPreview = (event: MouseEvent) => {\n if (isTouchDevice() || props.composing() || event.buttons !== 0 || !mirror) {\n closePreview()\n return\n }\n for (const span of mirror.querySelectorAll<HTMLElement>('[data-paste-seq]')) {\n const rect = span.getBoundingClientRect()\n if (\n event.clientX >= rect.left &&\n event.clientX <= rect.right &&\n event.clientY >= rect.top &&\n event.clientY <= rect.bottom\n ) {\n const sequence = Number(span.dataset.pasteSeq)\n const range = ranges().find((candidate) => candidate.block.seq === sequence)\n if (range) schedulePreview(range.block, 'pointer')\n else closePreview()\n return\n }\n }\n closePreview()\n }\n\n const snapSelection = () => {\n if (!field || props.composing() || acceptingTextDrop) return\n const start = field.selectionStart\n const end = field.selectionEnd\n const direction = field.selectionDirection\n const tokenRanges = ranges()\n if (start === end) {\n if (keyboardNavigationPending) return\n scheduleCaretPreview()\n const next = snapToTokenEdge(start, tokenRanges)\n if (next !== start) {\n const range = tokenRanges.find(\n (candidate) => start > candidate.start && start < candidate.end\n )\n if (range) snappedCaretPreview = { blockId: range.block.id, position: next }\n field.setSelectionRange(next, next, direction)\n }\n return\n }\n scheduleCaretPreview()\n const nextStart = snapToTokenEdge(start, tokenRanges)\n const nextEnd = snapToTokenEdge(end, tokenRanges)\n if (nextStart !== start || nextEnd !== end) {\n field.setSelectionRange(Math.min(nextStart, nextEnd), Math.max(nextStart, nextEnd), direction)\n }\n }\n\n const handleKeyDown = (event: KeyboardEvent) => {\n snappedCaretPreview = null\n rawPasteNext =\n (event.metaKey || event.ctrlKey) &&\n event.shiftKey &&\n !event.altKey &&\n event.key.toLowerCase() === 'v'\n if (props.composing() || event.isComposing || event.keyCode === 229 || !field) {\n props.onKeyDown(event)\n return\n }\n if (\n event.key === 'ArrowDown' &&\n event.altKey &&\n !event.metaKey &&\n !event.ctrlKey &&\n !event.shiftKey &&\n openKeyboardPreview()\n ) {\n event.preventDefault()\n props.onKeyDown(event)\n return\n }\n if (event.key === 'Escape' && preview()) closePreview()\n\n const value = props.value\n const start = field.selectionStart\n const end = field.selectionEnd\n const collapsed = start === end\n const tokenRanges = ranges()\n const plainModifier = !event.metaKey && !event.ctrlKey && !event.altKey\n const backspace = event.key === 'Backspace'\n const deletion = backspace || event.key === 'Delete'\n let remove: readonly [number, number] | undefined\n\n if (deletion && !collapsed) {\n if (tokenRanges.some((range) => range.start < end && range.end > start)) remove = [start, end]\n } else if (deletion) {\n const adjacent = tokenRanges.find((range) =>\n backspace ? range.end === start : range.start === start\n )\n if (adjacent && (plainModifier || event.altKey || event.ctrlKey)) {\n remove = [adjacent.start, adjacent.end]\n } else if (event.metaKey) {\n const boundary = backspace\n ? value.lastIndexOf('\\n', start - 1) + 1\n : value.indexOf('\\n', start)\n const from = backspace ? boundary : start\n const to = backspace ? start : boundary < 0 ? value.length : boundary\n if (tokenRanges.some((range) => range.start < to && range.end > from)) remove = [from, to]\n }\n }\n if (remove) {\n event.preventDefault()\n replaceRange(remove[0], remove[1])\n props.onKeyDown(event)\n return\n }\n\n if (plainModifier && collapsed && !event.shiftKey) {\n const left = event.key === 'ArrowLeft'\n const right = event.key === 'ArrowRight'\n const adjacent = left\n ? tokenRanges.find((range) => range.end === start)\n : right\n ? tokenRanges.find((range) => range.start === start)\n : undefined\n if (adjacent) {\n event.preventDefault()\n setCaret(left ? adjacent.start : adjacent.end)\n props.onKeyDown(event)\n return\n }\n }\n if (!event.metaKey && !event.ctrlKey && !event.altKey && event.shiftKey) {\n const direction = field.selectionDirection === 'backward' ? 'backward' : 'forward'\n const active = direction === 'backward' ? start : end\n const adjacent =\n event.key === 'ArrowLeft'\n ? tokenRanges.find((range) => range.end === active)\n : event.key === 'ArrowRight'\n ? tokenRanges.find((range) => range.start === active)\n : undefined\n if (adjacent) {\n event.preventDefault()\n requestAnimationFrame(() => {\n if (!field) return\n if (event.key === 'ArrowLeft' && direction === 'backward')\n field.setSelectionRange(adjacent.start, end, 'backward')\n else if (event.key === 'ArrowLeft')\n field.setSelectionRange(\n start,\n adjacent.start,\n start <= adjacent.start ? 'forward' : 'backward'\n )\n else if (direction === 'backward')\n field.setSelectionRange(adjacent.end, end, adjacent.end <= end ? 'backward' : 'forward')\n else field.setSelectionRange(start, adjacent.end, 'forward')\n })\n props.onKeyDown(event)\n return\n }\n }\n\n const navigation =\n event.key === 'Home' ||\n event.key === 'End' ||\n ((event.key === 'ArrowLeft' || event.key === 'ArrowRight') &&\n (event.metaKey || event.ctrlKey || event.altKey))\n if (navigation) {\n const leftward = event.key === 'ArrowLeft' || event.key === 'Home'\n keyboardNavigationPending = true\n requestAnimationFrame(() => {\n if (field) {\n const nextRanges = findTokenRanges(field.value, props.blocks)\n const edge = leftward ? 'start' : 'end'\n const nextStart = snapToTokenEdge(field.selectionStart, nextRanges, edge)\n const nextEnd = snapToTokenEdge(field.selectionEnd, nextRanges, edge)\n if (nextStart !== field.selectionStart || nextEnd !== field.selectionEnd) {\n field.setSelectionRange(\n Math.min(nextStart, nextEnd),\n Math.max(nextStart, nextEnd),\n field.selectionDirection\n )\n }\n }\n keyboardNavigationPending = false\n })\n }\n props.onKeyDown(event)\n }\n\n const expandSelectionForClipboard = (start: number, end: number): string | null => {\n if (start === end) return null\n const covered = ranges().filter((range) => range.start >= start && range.end <= end)\n if (!covered.length) return null\n let result = ''\n let cursor = start\n for (const range of covered) {\n result += props.value.slice(cursor, range.start) + range.block.content\n cursor = range.end\n }\n return result + props.value.slice(cursor, end)\n }\n\n const handlePaste = (event: ClipboardEvent) => {\n const forceRaw = rawPasteNext\n rawPasteNext = false\n const pasted = event.clipboardData?.getData('text/plain') ?? ''\n if (!pasted || !field || props.readOnly || props.disabled) return\n const cleaned = forceRaw ? pasted : stripTrailingBlankLines(pasted)\n const start = field.selectionStart\n const end = field.selectionEnd\n const before = props.value.slice(0, start)\n const after = props.value.slice(end)\n\n if (!forceRaw && shouldCollapse(cleaned)) {\n const id = props.createBlockId()\n if (props.blocks.some((block) => block.id === id)) return\n const block: PasteBlock = {\n id,\n seq: nextSeq([...props.blocks]),\n lines: countLines(cleaned),\n content: cleaned,\n }\n if (!isPasteBlock(block)) return\n const linePrefix = before.slice(before.lastIndexOf('\\n') + 1)\n const leading =\n before && !before.endsWith('\\n') && !isBlockquotePrefix(linePrefix) ? '\\n' : ''\n const trailing = after && !after.startsWith('\\n') ? '\\n' : ''\n const insert = leading + formatToken(block) + trailing\n event.preventDefault()\n change(before + insert + after, [...props.blocks, block])\n closePreview()\n setCaret(before.length + insert.length)\n return\n }\n if (forceRaw) return\n if (cleaned !== pasted && cleaned !== '') {\n event.preventDefault()\n const next = before + cleaned + after\n nativePasteInputSeen = false\n suppressPasteInput = true\n let inserted = false\n try {\n inserted =\n typeof document.execCommand === 'function' &&\n document.execCommand('insertText', false, cleaned)\n } catch {\n inserted = false\n }\n if (!nativePasteInputSeen) suppressPasteInput = false\n change(next)\n if (inserted && field.value === next) return\n setCaret(before.length + cleaned.length)\n }\n }\n\n const handleDragOver = (event: DragEvent) => {\n if (!field || props.readOnly || props.disabled || props.composing()) return\n if (event.dataTransfer?.types.includes('text/plain')) {\n acceptingTextDrop = true\n closePreview()\n event.preventDefault()\n }\n }\n\n const handleDragLeave = () => {\n acceptingTextDrop = false\n }\n\n const handleDrop = (event: DragEvent) => {\n if (!field || props.readOnly || props.disabled || props.composing()) {\n acceptingTextDrop = false\n return\n }\n if (!event.dataTransfer?.types.includes('text/plain')) {\n acceptingTextDrop = false\n return\n }\n const dropped = event.dataTransfer.getData('text/plain')\n event.preventDefault()\n acceptingTextDrop = false\n if (!dropped) return\n\n const tokenRanges = ranges()\n let start = field.selectionStart\n let end = field.selectionEnd\n const removed = tokenRanges.filter((range) =>\n start === end\n ? start > range.start && start < range.end\n : range.start < end && range.end > start\n )\n if (removed.length) {\n start = Math.min(start, ...removed.map((range) => range.start))\n end = Math.max(end, ...removed.map((range) => range.end))\n }\n\n change(props.value.slice(0, start) + dropped + props.value.slice(end))\n closePreview()\n setCaret(start + dropped.length)\n }\n\n const handleClipboard = (event: ClipboardEvent) => {\n if (!field || !event.clipboardData) return\n const start = field.selectionStart\n const end = field.selectionEnd\n const expanded = expandSelectionForClipboard(start, end)\n if (expanded === null) return\n event.clipboardData.setData('text/plain', expanded)\n event.preventDefault()\n if (event.type === 'cut') {\n change(props.value.slice(0, start) + props.value.slice(end))\n setCaret(start)\n }\n }\n\n const handleClick = (event: MouseEvent) => {\n if (!field || !props.blocks.length) return\n const range = tokenRangeAt(props.value, props.blocks, field.selectionStart)\n if (!range) return\n if (isTouchDevice() || event.detail >= 2) expandToken(range)\n else {\n requestAnimationFrame(() => field?.setSelectionRange(range.start, range.end))\n }\n }\n\n createEffect(on(() => props.value, closePreview))\n createEffect(on(() => props.blocks, closePreview))\n createEffect(\n on(\n () => props.resetKey,\n () => {\n rawPasteNext = false\n closePreview()\n }\n )\n )\n onMount(() => {\n window.addEventListener('scroll', closePreview, true)\n window.addEventListener('resize', closePreview)\n onCleanup(() => {\n window.removeEventListener('scroll', closePreview, true)\n window.removeEventListener('resize', closePreview)\n })\n })\n onCleanup(() => clearTimer())\n\n return (\n <KobalteTooltip\n open={!!preview()}\n onOpenChange={(open) => {\n if (!open) closePreview()\n }}\n openDelay={PREVIEW_OPEN_DELAY_MS}\n >\n <KobalteTooltip.Trigger as=\"div\" class=\"relative\">\n <div\n ref={(element) => (mirror = element)}\n data-slot=\"paste-token-mirror\"\n aria-hidden=\"true\"\n class=\"pointer-events-none absolute inset-0 overflow-hidden select-none whitespace-pre-wrap break-words px-4 py-3 text-sm text-transparent\"\n >\n <For each={segments()}>\n {(segment) =>\n segment.block ? (\n <span\n class=\"box-decoration-clone rounded-md bg-primary-subtle\"\n data-paste-seq={segment.block.seq}\n >\n {segment.text}\n </span>\n ) : (\n <span>{segment.text}</span>\n )\n }\n </For>\n {props.value.endsWith('\\n') ? '\\u200b' : ''}\n </div>\n <textarea\n ref={(element) => {\n field = element\n props.ref(element)\n onCleanup(() => {\n if (field === element) field = undefined\n props.ref(undefined)\n })\n }}\n data-slot=\"composer-input\"\n aria-label={props.inputLabel}\n aria-describedby={preview() ? `${keyboardHintId} ${descriptionId}` : keyboardHintId}\n aria-keyshortcuts=\"Alt+ArrowDown\"\n class=\"relative field-sizing-content text-foreground placeholder:text-muted-foreground min-h-11 max-h-36 w-full resize-none border-0 bg-transparent px-4 py-3 text-sm outline-none disabled:opacity-50\"\n value={props.value}\n disabled={props.disabled}\n readOnly={props.readOnly}\n placeholder={props.placeholder}\n rows={1}\n onInput={(event) => {\n if (suppressPasteInput) {\n suppressPasteInput = false\n nativePasteInputSeen = true\n return\n }\n change(event.currentTarget.value)\n }}\n onPaste={handlePaste}\n onDragOver={handleDragOver}\n onDragLeave={handleDragLeave}\n onDrop={handleDrop}\n onCopy={handleClipboard}\n onCut={handleClipboard}\n onClick={handleClick}\n onSelect={snapSelection}\n onMouseMove={schedulePointerPreview}\n onMouseLeave={closePreview}\n onScroll={(event) => {\n if (mirror) {\n mirror.scrollTop = event.currentTarget.scrollTop\n mirror.scrollLeft = event.currentTarget.scrollLeft\n }\n closePreview()\n }}\n onCompositionStart={props.onCompositionStart}\n onCompositionEnd={props.onCompositionEnd}\n onFocus={props.onFocus}\n onBlur={() => {\n rawPasteNext = false\n acceptingTextDrop = false\n props.onBlur()\n closePreview()\n }}\n onKeyDown={handleKeyDown}\n />\n <span id={keyboardHintId} class=\"visually-hidden\">\n When the caret is next to a paste token or a token is selected, press Alt+Down Arrow to\n preview its text. Press Escape to close the preview.\n </span>\n </KobalteTooltip.Trigger>\n <Show when={previewSummary()}>\n {(summary) => (\n <KobalteTooltip.Portal>\n <KobalteTooltip.Content\n id={descriptionId}\n data-slot=\"paste-token-preview\"\n class=\"bg-scrim text-scrim-foreground z-(--z-tooltip) w-fit max-w-64 rounded-md px-2 py-1 text-xs origin-(--kb-tooltip-content-transform-origin) text-balance data-expanded:animate-in data-expanded:fade-in-0 data-expanded:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 data-expanded:duration-150 data-closed:duration-100\"\n >\n <pre class=\"m-0 max-h-48 max-w-64 overflow-y-auto whitespace-pre-wrap break-words font-mono\">\n {summary().text}\n </pre>\n <Show when={summary().hiddenLines > 0}>\n <span>+{summary().hiddenLines} more lines</span>\n </Show>\n <Show when={summary().hiddenLines === 0 && summary().hiddenCharacters > 0}>\n <span>+{summary().hiddenCharacters} more characters</span>\n </Show>\n <KobalteTooltip.Arrow aria-hidden=\"true\" />\n </KobalteTooltip.Content>\n </KobalteTooltip.Portal>\n )}\n </Show>\n </KobalteTooltip>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;AAuDA,IAAMmD,wBAAwB;AAE9B,SAASC,gBAAyB;CAChC,OACE,OAAOC,WAAW,eAClB,OAAOA,OAAOC,eAAe,eAC5BD,OAAOC,WAAW,mBAAmB,CAAC,CAACC,WAAWF,OAAOC,WAAW,eAAe,CAAC,CAACC;AAE1F;AAEA,SAASC,mBAAmBC,YAA6B;CACvD,IAAIC,YAAY;CAChB,KAAK,IAAIC,QAAQ,GAAGA,QAAQF,WAAWG,QAAQD,SAAS,GAAG;EACzD,MAAME,OAAOJ,WAAWK,WAAWH,KAAK;EACxC,IAAIE,SAAS,IAAIH,YAAY;OACxB,IAAIG,SAAS,MAAMA,SAAS,GAAG,OAAO;CAC7C;CACA,OAAOH;AACT;;AAGA,SAAgBK,iBAAiBC,OAA8B;CAC7D,MAAM,CAACC,SAASC,cAAc9D,aAAgC,IAAI;CAClE,MAAM+D,iBAAiBhE,iBAAiB;EACtC,MAAMyB,QAAQqC,QAAQ;EACtB,OAAOrC,QAAQT,sBAAsBS,MAAMwC,SAASxC,MAAMyC,KAAK,IAAI;CACrE,CAAC;CACD,MAAMC,gBAAgB,iBAAiBjE,eAAe;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IzB;MAAa,aAAA;MAAA,SAAA;MAAA,IAAAmJ,WAAA;OAAA,OAAA;eAAA;SAAA,IAAA0C,QAAAC,QAAA;SAAArC,OAAAoC,aAKdH,QAAQ,CAAC,CAACzO,IAAI;SAAA,OAAA4O;QAAA,EAAA,CAAA;QAAA9C,gBAEhBpN,MAAI;SAAA,IAAC8P,OAAI;UAAA,OAAEC,QAAQ,CAAC,CAACK,cAAc;SAAC;SAAA,IAAA5C,WAAA;UAAA,IAAA6C,QAAAC,QAAA,GAAAG,QAAAJ,MAAAG,WAAAE;UAAAD,MAAAC;UAAA5C,OAAAuC,aAC3BN,QAAQ,CAAC,CAACK,aAAWK,KAAA;UAAA,OAAAJ;SAAA;QAAA,CAAA;QAAAjD,gBAE9BpN,MAAI;SAAA,IAAC8P,OAAI;UAAA,OAAEc,WAAAb,QAAQ,CAAC,CAACK,gBAAgB,CAAC,CAAA,CAAA,KAAIL,QAAQ,CAAC,CAACc,mBAAmB;SAAC;SAAA,IAAArD,WAAA;UAAA,IAAAsD,QAAAC,QAAA,GAAAE,SAAAH,MAAAN,WAAAE;UAAAO,OAAAP;UAAA5C,OAAAgD,aAC/Df,QAAQ,CAAC,CAACc,kBAAgBI,MAAA;UAAA,OAAAH;SAAA;QAAA,CAAA;QAAA1D,gBAEnChM,QAAe+P,OAAK,EAAA,eAAA,OAAA,CAAA;OAAA;MAAA;KAAA,CAAA;IAAA,EAAA,CAAA;GAG1B,CAAA,CAAA;EAAA;CAAA,CAAA;AAIT;AAACC,eAAA;CAAA;CAAA;CAAA;CAAA;AAAA,CAAA"}
1
+ {"version":3,"file":"paste-token-editor.js","names":["For","Show","createEffect","createMemo","createSignal","createUniqueId","on","onCleanup","onMount","countLines","findTokenRanges","formatToken","isPasteBlock","nextSeq","pruneBlocks","shouldCollapse","stripTrailingBlankLines","tokenRangeAt","PasteBlock","summarizePastePreview","Tooltip","KobalteTooltip","PasteTokenDraft","text","blocks","TokenRange","start","end","block","Segment","PasteTokenEditorProps","value","resetKey","ref","element","HTMLTextAreaElement","createBlockId","onChange","draft","inputLabel","placeholder","disabled","readOnly","composing","onCompositionStart","onCompositionEnd","onFocus","onBlur","onKeyDown","event","KeyboardEvent","PREVIEW_OPEN_DELAY_MS","isTouchDevice","window","matchMedia","matches","isBlockquotePrefix","linePrefix","sawMarker","index","length","code","charCodeAt","PasteTokenEditor","props","preview","setPreview","previewSummary","content","lines","descriptionId","keyboardHintId","field","mirror","HTMLDivElement","previewTimer","ReturnType","setTimeout","scheduledBlockId","previewSource","rawPasteNext","suppressPasteInput","nativePasteInputSeen","keyboardNavigationPending","acceptingTextDrop","snappedCaretPreview","blockId","position","ranges","clearTimer","clearTimeout","undefined","closePreview","schedulePreview","source","id","current","find","range","change","snapToTokenEdge","tokenRanges","edge","setCaret","focus","requestAnimationFrame","setSelectionRange","replaceRange","removed","filter","nextStart","Math","min","map","nextEnd","max","next","slice","some","expandToken","segments","result","cursor","push","scheduleCaretPreview","selectionStart","selectionEnd","caret","candidate","snappedRange","openKeyboardPreview","schedulePointerPreview","MouseEvent","buttons","span","querySelectorAll","HTMLElement","rect","getBoundingClientRect","clientX","left","right","clientY","top","bottom","sequence","Number","dataset","pasteSeq","seq","snapSelection","direction","selectionDirection","handleKeyDown","metaKey","ctrlKey","shiftKey","altKey","key","toLowerCase","isComposing","keyCode","preventDefault","collapsed","plainModifier","backspace","deletion","remove","adjacent","boundary","lastIndexOf","indexOf","from","to","active","navigation","leftward","nextRanges","expandSelectionForClipboard","covered","handlePaste","ClipboardEvent","forceRaw","pasted","clipboardData","getData","cleaned","before","after","leading","endsWith","trailing","startsWith","insert","inserted","document","execCommand","handleDragOver","DragEvent","dataTransfer","types","includes","handleDragLeave","handleDrop","dropped","handleClipboard","expanded","setData","type","handleClick","detail","addEventListener","removeEventListener","_$createComponent","open","onOpenChange","openDelay","children","Trigger","as","_el$","_tmpl$","_$use","_$insert","each","segment","_el$4","_tmpl$4","_$effect","_$setAttribute","_el$5","_tmpl$5","_el$2","_tmpl$2","$$keydown","_$addEventListener","scrollTop","currentTarget","scrollLeft","$$mousemove","$$click","$$input","_p$","_v$","_v$2","_v$3","_v$4","_v$5","e","t","a","o","i","_el$3","_tmpl$3","when","summary","Portal","Content","_el$6","_tmpl$6","hiddenLines","_el$7","_tmpl$7","_el$8","firstChild","_el$0","nextSibling","_el$9","_$memo","hiddenCharacters","_el$1","_tmpl$8","_el$10","_el$12","_el$11","Arrow","_$delegateEvents","_$createComponent","KobalteTooltip","_$setAttribute","_$memo","_$delegateEvents"],"sources":["../../../src/components/conversation/paste-token-editor.tsx"],"sourcesContent":["/*\n * Substantially translated from KiroCrew website/src/components/ChatInput.tsx\n * and PasteHighlightLayer.tsx at 283e136c0f902e965a535a7c9548c57c7504fed0.\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * Licensed under Apache-2.0; see LICENSE and NOTICE.\n */\nimport {\n For,\n Show,\n createEffect,\n createMemo,\n createSignal,\n createUniqueId,\n on,\n onCleanup,\n onMount,\n} from 'solid-js'\nimport {\n countLines,\n findTokenRanges,\n formatToken,\n isPasteBlock,\n nextSeq,\n pruneBlocks,\n shouldCollapse,\n stripTrailingBlankLines,\n tokenRangeAt,\n type PasteBlock,\n} from './paste-tokens'\nimport { summarizePastePreview } from './paste-preview'\nimport { Tooltip as KobalteTooltip } from '@kobalte/core/tooltip'\n\nexport type PasteTokenDraft = { text: string; blocks: PasteBlock[] }\ntype TokenRange = { start: number; end: number; block: PasteBlock }\ntype Segment = { text: string; block?: PasteBlock }\n\nexport type PasteTokenEditorProps = {\n value: string\n resetKey?: unknown\n blocks: readonly PasteBlock[]\n ref: (element: HTMLTextAreaElement | undefined) => void\n createBlockId: () => string\n onChange: (draft: PasteTokenDraft) => void\n inputLabel: string\n placeholder: string\n disabled?: boolean\n readOnly?: boolean\n composing: () => boolean\n onCompositionStart: () => void\n onCompositionEnd: () => void\n onFocus: () => void\n onBlur: () => void\n onKeyDown: (event: KeyboardEvent) => void\n}\n\nconst PREVIEW_OPEN_DELAY_MS = 300\n\nfunction isTouchDevice(): boolean {\n return (\n typeof window !== 'undefined' &&\n typeof window.matchMedia === 'function' &&\n (window.matchMedia('(pointer: coarse)').matches || window.matchMedia('(hover: none)').matches)\n )\n}\n\nfunction isBlockquotePrefix(linePrefix: string): boolean {\n let sawMarker = false\n for (let index = 0; index < linePrefix.length; index += 1) {\n const code = linePrefix.charCodeAt(index)\n if (code === 62) sawMarker = true\n else if (code !== 32 && code !== 9) return false\n }\n return sawMarker\n}\n\n/** Controlled plain-text editor that treats known paste markers as atomic ranges. */\nexport function PasteTokenEditor(props: PasteTokenEditorProps) {\n const [preview, setPreview] = createSignal<PasteBlock | null>(null)\n const previewSummary = createMemo(() => {\n const block = preview()\n return block ? summarizePastePreview(block.content, block.lines) : null\n })\n const descriptionId = `paste-preview-${createUniqueId()}`\n const keyboardHintId = `paste-keyboard-hint-${createUniqueId()}`\n let field: HTMLTextAreaElement | undefined\n let mirror: HTMLDivElement | undefined\n let previewTimer: ReturnType<typeof setTimeout> | undefined\n let scheduledBlockId: string | null = null\n /**\n * What scheduled the current preview. A caret event must not cancel a preview\n * the pointer is owed: a programmatic caret restore (`setCaret` defers to an\n * animation frame) dispatches its `select` event as a separate task that can\n * land *after* a pointermove has already scheduled the hover preview, and a\n * caret with no token under it would otherwise tear that preview down with no\n * further pointermove ever arriving to reschedule it. The pointer's own leave,\n * scroll, blur and reset paths still close unconditionally.\n */\n let previewSource: 'pointer' | 'caret' | 'keyboard' | null = null\n let rawPasteNext = false\n let suppressPasteInput = false\n let nativePasteInputSeen = false\n let keyboardNavigationPending = false\n let acceptingTextDrop = false\n let snappedCaretPreview: { blockId: string; position: number } | null = null\n\n const ranges = () => findTokenRanges(props.value, props.blocks)\n const clearTimer = () => {\n clearTimeout(previewTimer)\n previewTimer = undefined\n }\n const closePreview = () => {\n clearTimer()\n scheduledBlockId = null\n snappedCaretPreview = null\n previewSource = null\n setPreview(null)\n }\n const schedulePreview = (block: PasteBlock, source: 'pointer' | 'caret') => {\n if (scheduledBlockId === block.id) return\n clearTimer()\n scheduledBlockId = block.id\n previewSource = source\n setPreview(null)\n previewTimer = setTimeout(() => {\n previewTimer = undefined\n const current = ranges().find((range) => range.block.id === block.id)\n if (current) setPreview(current.block)\n else closePreview()\n }, PREVIEW_OPEN_DELAY_MS)\n }\n const change = (text: string, blocks: readonly PasteBlock[] = props.blocks) => {\n props.onChange({ text, blocks: pruneBlocks(text, [...blocks]) })\n }\n const snapToTokenEdge = (\n position: number,\n tokenRanges: readonly TokenRange[] = ranges(),\n edge?: 'start' | 'end'\n ) => {\n for (const range of tokenRanges) {\n if (position > range.start && position < range.end) {\n if (edge === 'start') return range.start\n if (edge === 'end') return range.end\n return position - range.start <= range.end - position ? range.start : range.end\n }\n }\n return position\n }\n const setCaret = (position: number, focus = false) => {\n requestAnimationFrame(() => {\n if (!field) return\n if (focus) field.focus()\n field.setSelectionRange(position, position)\n })\n }\n const replaceRange = (start: number, end: number) => {\n if (!field) return\n const removed = ranges().filter((range) => range.start < end && range.end > start)\n if (!removed.length) return\n const nextStart = Math.min(start, ...removed.map((range) => range.start))\n const nextEnd = Math.max(end, ...removed.map((range) => range.end))\n const next = props.value.slice(0, nextStart) + props.value.slice(nextEnd)\n change(\n next,\n props.blocks.filter((block) => !removed.some((range) => range.block.id === block.id))\n )\n setCaret(nextStart)\n }\n const expandToken = (range: TokenRange) => {\n const next =\n props.value.slice(0, range.start) + range.block.content + props.value.slice(range.end)\n change(\n next,\n props.blocks.filter((block) => block.id !== range.block.id)\n )\n closePreview()\n setCaret(range.start + range.block.content.length, true)\n }\n\n const segments = (): Segment[] => {\n const result: Segment[] = []\n let cursor = 0\n for (const range of ranges()) {\n if (range.start > cursor) result.push({ text: props.value.slice(cursor, range.start) })\n result.push({ text: props.value.slice(range.start, range.end), block: range.block })\n cursor = range.end\n }\n if (cursor < props.value.length) result.push({ text: props.value.slice(cursor) })\n if (!result.length) result.push({ text: props.value })\n return result\n }\n\n const scheduleCaretPreview = () => {\n if (isTouchDevice() || props.composing() || !field) {\n closePreview()\n return\n }\n if (field.selectionStart !== field.selectionEnd) {\n closePreview()\n return\n }\n const caret = field.selectionStart\n const range = ranges().find((candidate) => caret > candidate.start && caret < candidate.end)\n if (range) {\n schedulePreview(range.block, 'caret')\n return\n }\n const snappedRange =\n snappedCaretPreview?.position === caret\n ? ranges().find((candidate) => candidate.block.id === snappedCaretPreview?.blockId)\n : undefined\n if (snappedRange) schedulePreview(snappedRange.block, 'caret')\n // A caret with no token under it dismisses a caret-sourced preview, but a\n // pointer-scheduled preview outlives it: the pointer has not moved.\n else if (previewSource !== 'pointer') closePreview()\n }\n\n const openKeyboardPreview = (): boolean => {\n if (!field) return false\n const start = field.selectionStart\n const end = field.selectionEnd\n const range = ranges().find((candidate) =>\n start === end\n ? start >= candidate.start && start <= candidate.end\n : candidate.start < end && candidate.end > start\n )\n if (!range) return false\n clearTimer()\n scheduledBlockId = range.block.id\n previewSource = 'keyboard'\n setPreview(range.block)\n return true\n }\n\n const schedulePointerPreview = (event: MouseEvent) => {\n if (isTouchDevice() || props.composing() || event.buttons !== 0 || !mirror) {\n closePreview()\n return\n }\n for (const span of mirror.querySelectorAll<HTMLElement>('[data-paste-seq]')) {\n const rect = span.getBoundingClientRect()\n if (\n event.clientX >= rect.left &&\n event.clientX <= rect.right &&\n event.clientY >= rect.top &&\n event.clientY <= rect.bottom\n ) {\n const sequence = Number(span.dataset.pasteSeq)\n const range = ranges().find((candidate) => candidate.block.seq === sequence)\n if (range) schedulePreview(range.block, 'pointer')\n else closePreview()\n return\n }\n }\n closePreview()\n }\n\n const snapSelection = () => {\n if (!field || props.composing() || acceptingTextDrop) return\n const start = field.selectionStart\n const end = field.selectionEnd\n const direction = field.selectionDirection\n const tokenRanges = ranges()\n if (start === end) {\n if (keyboardNavigationPending) return\n scheduleCaretPreview()\n const next = snapToTokenEdge(start, tokenRanges)\n if (next !== start) {\n const range = tokenRanges.find(\n (candidate) => start > candidate.start && start < candidate.end\n )\n if (range) snappedCaretPreview = { blockId: range.block.id, position: next }\n field.setSelectionRange(next, next, direction)\n }\n return\n }\n scheduleCaretPreview()\n const nextStart = snapToTokenEdge(start, tokenRanges)\n const nextEnd = snapToTokenEdge(end, tokenRanges)\n if (nextStart !== start || nextEnd !== end) {\n field.setSelectionRange(Math.min(nextStart, nextEnd), Math.max(nextStart, nextEnd), direction)\n }\n }\n\n const handleKeyDown = (event: KeyboardEvent) => {\n snappedCaretPreview = null\n rawPasteNext =\n (event.metaKey || event.ctrlKey) &&\n event.shiftKey &&\n !event.altKey &&\n event.key.toLowerCase() === 'v'\n if (props.composing() || event.isComposing || event.keyCode === 229 || !field) {\n props.onKeyDown(event)\n return\n }\n if (\n event.key === 'ArrowDown' &&\n event.altKey &&\n !event.metaKey &&\n !event.ctrlKey &&\n !event.shiftKey &&\n openKeyboardPreview()\n ) {\n event.preventDefault()\n props.onKeyDown(event)\n return\n }\n if (event.key === 'Escape' && preview()) closePreview()\n\n const value = props.value\n const start = field.selectionStart\n const end = field.selectionEnd\n const collapsed = start === end\n const tokenRanges = ranges()\n const plainModifier = !event.metaKey && !event.ctrlKey && !event.altKey\n const backspace = event.key === 'Backspace'\n const deletion = backspace || event.key === 'Delete'\n let remove: readonly [number, number] | undefined\n\n if (deletion && !collapsed) {\n if (tokenRanges.some((range) => range.start < end && range.end > start)) remove = [start, end]\n } else if (deletion) {\n const adjacent = tokenRanges.find((range) =>\n backspace ? range.end === start : range.start === start\n )\n if (adjacent && (plainModifier || event.altKey || event.ctrlKey)) {\n remove = [adjacent.start, adjacent.end]\n } else if (event.metaKey) {\n const boundary = backspace\n ? value.lastIndexOf('\\n', start - 1) + 1\n : value.indexOf('\\n', start)\n const from = backspace ? boundary : start\n const to = backspace ? start : boundary < 0 ? value.length : boundary\n if (tokenRanges.some((range) => range.start < to && range.end > from)) remove = [from, to]\n }\n }\n if (remove) {\n event.preventDefault()\n replaceRange(remove[0], remove[1])\n props.onKeyDown(event)\n return\n }\n\n if (plainModifier && collapsed && !event.shiftKey) {\n const left = event.key === 'ArrowLeft'\n const right = event.key === 'ArrowRight'\n const adjacent = left\n ? tokenRanges.find((range) => range.end === start)\n : right\n ? tokenRanges.find((range) => range.start === start)\n : undefined\n if (adjacent) {\n event.preventDefault()\n setCaret(left ? adjacent.start : adjacent.end)\n props.onKeyDown(event)\n return\n }\n }\n if (!event.metaKey && !event.ctrlKey && !event.altKey && event.shiftKey) {\n const direction = field.selectionDirection === 'backward' ? 'backward' : 'forward'\n const active = direction === 'backward' ? start : end\n const adjacent =\n event.key === 'ArrowLeft'\n ? tokenRanges.find((range) => range.end === active)\n : event.key === 'ArrowRight'\n ? tokenRanges.find((range) => range.start === active)\n : undefined\n if (adjacent) {\n event.preventDefault()\n requestAnimationFrame(() => {\n if (!field) return\n if (event.key === 'ArrowLeft' && direction === 'backward')\n field.setSelectionRange(adjacent.start, end, 'backward')\n else if (event.key === 'ArrowLeft')\n field.setSelectionRange(\n start,\n adjacent.start,\n start <= adjacent.start ? 'forward' : 'backward'\n )\n else if (direction === 'backward')\n field.setSelectionRange(adjacent.end, end, adjacent.end <= end ? 'backward' : 'forward')\n else field.setSelectionRange(start, adjacent.end, 'forward')\n })\n props.onKeyDown(event)\n return\n }\n }\n\n const navigation =\n event.key === 'Home' ||\n event.key === 'End' ||\n ((event.key === 'ArrowLeft' || event.key === 'ArrowRight') &&\n (event.metaKey || event.ctrlKey || event.altKey))\n if (navigation) {\n const leftward = event.key === 'ArrowLeft' || event.key === 'Home'\n keyboardNavigationPending = true\n requestAnimationFrame(() => {\n if (field) {\n const nextRanges = findTokenRanges(field.value, props.blocks)\n const edge = leftward ? 'start' : 'end'\n const nextStart = snapToTokenEdge(field.selectionStart, nextRanges, edge)\n const nextEnd = snapToTokenEdge(field.selectionEnd, nextRanges, edge)\n if (nextStart !== field.selectionStart || nextEnd !== field.selectionEnd) {\n field.setSelectionRange(\n Math.min(nextStart, nextEnd),\n Math.max(nextStart, nextEnd),\n field.selectionDirection\n )\n }\n }\n keyboardNavigationPending = false\n })\n }\n props.onKeyDown(event)\n }\n\n const expandSelectionForClipboard = (start: number, end: number): string | null => {\n if (start === end) return null\n const covered = ranges().filter((range) => range.start >= start && range.end <= end)\n if (!covered.length) return null\n let result = ''\n let cursor = start\n for (const range of covered) {\n result += props.value.slice(cursor, range.start) + range.block.content\n cursor = range.end\n }\n return result + props.value.slice(cursor, end)\n }\n\n const handlePaste = (event: ClipboardEvent) => {\n const forceRaw = rawPasteNext\n rawPasteNext = false\n const pasted = event.clipboardData?.getData('text/plain') ?? ''\n if (!pasted || !field || props.readOnly || props.disabled) return\n const cleaned = forceRaw ? pasted : stripTrailingBlankLines(pasted)\n const start = field.selectionStart\n const end = field.selectionEnd\n const before = props.value.slice(0, start)\n const after = props.value.slice(end)\n\n if (!forceRaw && shouldCollapse(cleaned)) {\n const id = props.createBlockId()\n if (props.blocks.some((block) => block.id === id)) return\n const block: PasteBlock = {\n id,\n seq: nextSeq([...props.blocks]),\n lines: countLines(cleaned),\n content: cleaned,\n }\n if (!isPasteBlock(block)) return\n const linePrefix = before.slice(before.lastIndexOf('\\n') + 1)\n const leading =\n before && !before.endsWith('\\n') && !isBlockquotePrefix(linePrefix) ? '\\n' : ''\n const trailing = after && !after.startsWith('\\n') ? '\\n' : ''\n const insert = leading + formatToken(block) + trailing\n event.preventDefault()\n change(before + insert + after, [...props.blocks, block])\n closePreview()\n setCaret(before.length + insert.length)\n return\n }\n if (forceRaw) return\n if (cleaned !== pasted && cleaned !== '') {\n event.preventDefault()\n const next = before + cleaned + after\n nativePasteInputSeen = false\n suppressPasteInput = true\n let inserted = false\n try {\n inserted =\n typeof document.execCommand === 'function' &&\n document.execCommand('insertText', false, cleaned)\n } catch {\n inserted = false\n }\n if (!nativePasteInputSeen) suppressPasteInput = false\n change(next)\n if (inserted && field.value === next) return\n setCaret(before.length + cleaned.length)\n }\n }\n\n const handleDragOver = (event: DragEvent) => {\n if (!field || props.readOnly || props.disabled || props.composing()) return\n if (event.dataTransfer?.types.includes('text/plain')) {\n acceptingTextDrop = true\n closePreview()\n event.preventDefault()\n }\n }\n\n const handleDragLeave = () => {\n acceptingTextDrop = false\n }\n\n const handleDrop = (event: DragEvent) => {\n if (!field || props.readOnly || props.disabled || props.composing()) {\n acceptingTextDrop = false\n return\n }\n if (!event.dataTransfer?.types.includes('text/plain')) {\n acceptingTextDrop = false\n return\n }\n const dropped = event.dataTransfer.getData('text/plain')\n event.preventDefault()\n acceptingTextDrop = false\n if (!dropped) return\n\n const tokenRanges = ranges()\n let start = field.selectionStart\n let end = field.selectionEnd\n const removed = tokenRanges.filter((range) =>\n start === end\n ? start > range.start && start < range.end\n : range.start < end && range.end > start\n )\n if (removed.length) {\n start = Math.min(start, ...removed.map((range) => range.start))\n end = Math.max(end, ...removed.map((range) => range.end))\n }\n\n change(props.value.slice(0, start) + dropped + props.value.slice(end))\n closePreview()\n setCaret(start + dropped.length)\n }\n\n const handleClipboard = (event: ClipboardEvent) => {\n if (!field || !event.clipboardData) return\n const start = field.selectionStart\n const end = field.selectionEnd\n const expanded = expandSelectionForClipboard(start, end)\n if (expanded === null) return\n event.clipboardData.setData('text/plain', expanded)\n event.preventDefault()\n if (event.type === 'cut') {\n change(props.value.slice(0, start) + props.value.slice(end))\n setCaret(start)\n }\n }\n\n const handleClick = (event: MouseEvent) => {\n if (!field || !props.blocks.length) return\n const range = tokenRangeAt(props.value, props.blocks, field.selectionStart)\n if (!range) return\n if (isTouchDevice() || event.detail >= 2) expandToken(range)\n else {\n requestAnimationFrame(() => field?.setSelectionRange(range.start, range.end))\n }\n }\n\n createEffect(on(() => props.value, closePreview))\n createEffect(on(() => props.blocks, closePreview))\n createEffect(\n on(\n () => props.resetKey,\n () => {\n rawPasteNext = false\n closePreview()\n }\n )\n )\n onMount(() => {\n window.addEventListener('scroll', closePreview, true)\n window.addEventListener('resize', closePreview)\n onCleanup(() => {\n window.removeEventListener('scroll', closePreview, true)\n window.removeEventListener('resize', closePreview)\n })\n })\n onCleanup(() => clearTimer())\n\n return (\n <KobalteTooltip\n open={!!preview()}\n onOpenChange={(open) => {\n if (!open) closePreview()\n }}\n openDelay={PREVIEW_OPEN_DELAY_MS}\n >\n <KobalteTooltip.Trigger as=\"div\" class=\"relative\">\n <div\n ref={(element) => (mirror = element)}\n data-slot=\"paste-token-mirror\"\n aria-hidden=\"true\"\n class=\"pointer-events-none absolute inset-0 overflow-hidden select-none whitespace-pre-wrap break-words px-4 py-3 text-sm text-transparent\"\n >\n <For each={segments()}>\n {(segment) =>\n segment.block ? (\n <span\n class=\"box-decoration-clone rounded-md bg-primary-subtle\"\n data-paste-seq={segment.block.seq}\n >\n {segment.text}\n </span>\n ) : (\n <span>{segment.text}</span>\n )\n }\n </For>\n {props.value.endsWith('\\n') ? '\\u200b' : ''}\n </div>\n <textarea\n ref={(element) => {\n field = element\n props.ref(element)\n onCleanup(() => {\n if (field === element) field = undefined\n props.ref(undefined)\n })\n }}\n data-slot=\"composer-input\"\n aria-label={props.inputLabel}\n aria-describedby={preview() ? `${keyboardHintId} ${descriptionId}` : keyboardHintId}\n aria-keyshortcuts=\"Alt+ArrowDown\"\n class=\"relative field-sizing-content text-foreground placeholder:text-muted-foreground min-h-11 max-h-36 w-full resize-none border-0 bg-transparent px-4 py-3 text-sm outline-none disabled:opacity-50\"\n value={props.value}\n disabled={props.disabled}\n readOnly={props.readOnly}\n placeholder={props.placeholder}\n rows={1}\n onInput={(event) => {\n if (suppressPasteInput) {\n suppressPasteInput = false\n nativePasteInputSeen = true\n return\n }\n change(event.currentTarget.value)\n }}\n onPaste={handlePaste}\n onDragOver={handleDragOver}\n onDragLeave={handleDragLeave}\n onDrop={handleDrop}\n onCopy={handleClipboard}\n onCut={handleClipboard}\n onClick={handleClick}\n onSelect={snapSelection}\n onMouseMove={schedulePointerPreview}\n onMouseLeave={closePreview}\n onScroll={(event) => {\n if (mirror) {\n mirror.scrollTop = event.currentTarget.scrollTop\n mirror.scrollLeft = event.currentTarget.scrollLeft\n }\n closePreview()\n }}\n onCompositionStart={props.onCompositionStart}\n onCompositionEnd={props.onCompositionEnd}\n onFocus={props.onFocus}\n onBlur={() => {\n rawPasteNext = false\n acceptingTextDrop = false\n props.onBlur()\n closePreview()\n }}\n onKeyDown={handleKeyDown}\n />\n <span id={keyboardHintId} class=\"visually-hidden\">\n When the caret is next to a paste token or a token is selected, press Alt+Down Arrow to\n preview its text. Press Escape to close the preview.\n </span>\n </KobalteTooltip.Trigger>\n <Show when={previewSummary()}>\n {(summary) => (\n <KobalteTooltip.Portal>\n <KobalteTooltip.Content\n id={descriptionId}\n data-slot=\"paste-token-preview\"\n class=\"bg-scrim text-scrim-foreground z-(--z-tooltip) w-fit max-w-64 rounded-md px-2 py-1 text-xs origin-(--kb-tooltip-content-transform-origin) text-balance data-expanded:animate-in data-expanded:fade-in-0 data-expanded:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 data-expanded:duration-150 data-closed:duration-100\"\n >\n <pre class=\"m-0 max-h-48 max-w-64 overflow-y-auto whitespace-pre-wrap break-words font-code text-code\">\n {summary().text}\n </pre>\n <Show when={summary().hiddenLines > 0}>\n <span>+{summary().hiddenLines} more lines</span>\n </Show>\n <Show when={summary().hiddenLines === 0 && summary().hiddenCharacters > 0}>\n <span>+{summary().hiddenCharacters} more characters</span>\n </Show>\n <KobalteTooltip.Arrow aria-hidden=\"true\" />\n </KobalteTooltip.Content>\n </KobalteTooltip.Portal>\n )}\n </Show>\n </KobalteTooltip>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;AAuDA,IAAMmD,wBAAwB;AAE9B,SAASC,gBAAyB;CAChC,OACE,OAAOC,WAAW,eAClB,OAAOA,OAAOC,eAAe,eAC5BD,OAAOC,WAAW,mBAAmB,CAAC,CAACC,WAAWF,OAAOC,WAAW,eAAe,CAAC,CAACC;AAE1F;AAEA,SAASC,mBAAmBC,YAA6B;CACvD,IAAIC,YAAY;CAChB,KAAK,IAAIC,QAAQ,GAAGA,Q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EnChM,QAAe+P,OAAK,EAAA,eAAA,OAAA,CAAA;OAAA;MAAA;KAAA,CAAA;IAAA,EAAA,CAAA;GAG1B,CAAA,CAAA;EAAA;CAAA,CAAA;AAIT;AAACC,eAAA;CAAA;CAAA;CAAA;CAAA;AAAA,CAAA"}
@@ -13,9 +13,9 @@ var _tmpl$5 = /*#__PURE__*/ template(`<div data-slot=side-rail-section>`);
13
13
  var _tmpl$6 = /*#__PURE__*/ template(`<span class="flex size-5 shrink-0 items-center justify-center [&amp;_svg]:size-5">`);
14
14
  var _tmpl$7 = /*#__PURE__*/ template(`<span class="min-w-0 flex-1 truncate text-start group-data-[collapsed=true]/rail:sr-only">`);
15
15
  var _tmpl$8 = /*#__PURE__*/ template(`<span data-slot=side-rail-badge class="flex shrink-0 items-center justify-center group-data-[collapsed=true]/rail:absolute group-data-[collapsed=true]/rail:end-1/2 group-data-[collapsed=true]/rail:top-1/2 group-data-[collapsed=true]/rail:-me-3.5 group-data-[collapsed=true]/rail:-mt-3.5">`);
16
- var _tmpl$9 = /*#__PURE__*/ template(`<span aria-hidden=true class="text-sidebar-muted-foreground shrink-0 font-mono text-2xs leading-none opacity-0 transition-opacity group-hover/rail-item:opacity-100 group-focus-visible/rail-item:opacity-100 group-data-[collapsed=true]/rail:hidden">`);
16
+ var _tmpl$9 = /*#__PURE__*/ template(`<span aria-hidden=true class="text-sidebar-muted-foreground shrink-0 font-code text-code leading-none opacity-0 transition-opacity group-hover/rail-item:opacity-100 group-focus-visible/rail-item:opacity-100 group-data-[collapsed=true]/rail:hidden">`);
17
17
  var _tmpl$0 = /*#__PURE__*/ template(`<span class="ms-auto shrink-0">`);
18
- var _tmpl$1 = /*#__PURE__*/ template(`<span class="text-muted-foreground shrink-0 font-mono text-2xs leading-none">`);
18
+ var _tmpl$1 = /*#__PURE__*/ template(`<span class="text-muted-foreground shrink-0 font-code text-code leading-none">`);
19
19
  var _tmpl$10 = /*#__PURE__*/ template(`<div aria-hidden=true data-slot=side-rail-tip><span>`);
20
20
  var _tmpl$11 = /*#__PURE__*/ template(`<button type=button><span class="flex size-5 shrink-0 items-center justify-center [&amp;_svg]:size-5"></span><span class="min-w-0 flex-1 truncate text-start group-data-[collapsed=true]/rail:sr-only">`);
21
21
  var _tmpl$12 = /*#__PURE__*/ template(`<div aria-hidden=true data-slot=side-rail-tip><span class="flex size-5 shrink-0 items-center justify-center [&amp;_svg]:size-5">`);
@@ -1 +1 @@
1
- {"version":3,"file":"side-rail.js","names":["Polymorphic","PolymorphicProps","ComponentProps","JSX","ValidComponent","Show","createMemo","createSignal","splitProps","Portal","tooltipTip","cn","SideRailContext","createSideRailValue","SideRailProps","T","class","collapsed","SideRail","props","local","rest","value","_$createComponent","Provider","children","_$mergeProps","as","aria-label","data-collapsed","SideRailHeader","_el$","_tmpl$","_$spread","SideRailContent","_el$2","_tmpl$2","SideRailFooter","_el$3","_tmpl$3","SideRailSection","label","_el$4","_tmpl$5","_$insert","when","_el$5","_tmpl$4","sideRailItemClass","join","sideRailItemStateClass","active","idle","SideRailItemProps","badge","Element","trailing","shortcut","keyshortcuts","SideRailItem","row","setRow","HTMLElement","tip","setTip","top","left","height","closest","getAttribute","showTip","element","rect","getBoundingClientRect","right","hideTip","ref","aria-current","undefined","aria-keyshortcuts","data-active","onPointerEnter","onPointerLeave","onFocus","onBlur","Record","_el$6","_tmpl$6","_el$7","_tmpl$7","_el$8","_tmpl$8","_$memo","_el$9","_tmpl$9","_el$0","_tmpl$0","position","_el$1","_tmpl$10","_el$10","firstChild","_el$11","_tmpl$1","_$effect","_p$","_v$","_v$2","_v$3","_v$4","_v$5","e","_$className","t","_$setStyleProperty","a","o","i","SideRailButton","Omit","_el$12","_tmpl$11","_el$13","_el$14","nextSibling","addEventListener","_$use","_el$15","_el$16","_tmpl$12","_el$17","_v$6","_v$7","_v$8","_v$9","_$createComponent","_$mergeProps","_$memo","_$className","_$setStyleProperty"],"sources":["../../../../src/components/layout/side-rail/side-rail.tsx"],"sourcesContent":["import { Polymorphic, type PolymorphicProps } from '@kobalte/core/polymorphic'\nimport type { ComponentProps, JSX, ValidComponent } from 'solid-js'\nimport { Show, createMemo, createSignal, splitProps } from 'solid-js'\nimport { Portal } from 'solid-js/web'\nimport { tooltipTip } from '#lib/overlay'\nimport { cn } from '#lib/utils'\nimport { SideRailContext, createSideRailValue } from './side-rail-context'\n\n/**\n * SideRail.\n *\n * The narrow, persistent column of top-level destinations at the window's leading\n * edge: the app mark, the primary sections, and a footer for account and settings.\n * It is the one piece of chrome that is always on screen, which is why it is a\n * component rather than something each view arranges.\n *\n * Two forms, one component. Collapsed it is an icon column; expanded it carries\n * labels. Both widths come from `--rail-width` (56px) and `--rail-width-expanded`\n * (236px), so an app cannot pick its own and end up a few pixels out of step with\n * the app beside it.\n *\n * The rail does not own its collapsed state; the app does. That state has to\n * survive a reload and usually lives with the rest of the window preferences, and\n * a rail that kept it privately could not be restored.\n */\nexport type SideRailProps<T extends ValidComponent = 'nav'> = PolymorphicProps<\n T,\n {\n class?: string\n collapsed?: boolean\n 'aria-label'?: string\n }\n>\n\nexport function SideRail<T extends ValidComponent = 'nav'>(props: SideRailProps<T>) {\n const [local, rest] = splitProps(props as SideRailProps, [\n 'class',\n 'collapsed',\n 'aria-label',\n 'children',\n ])\n\n const collapsed = () => local.collapsed ?? false\n const value = createSideRailValue(\n collapsed,\n createMemo(() => (collapsed() ? 'var(--rail-width)' : 'var(--rail-width-expanded)'))\n )\n\n return (\n <SideRailContext.Provider value={value}>\n <Polymorphic\n as=\"nav\"\n aria-label={local['aria-label'] ?? 'Primary'}\n /* Rendered in both states, with a real value, so the descendant selectors\n below can key on true *and* false — an absent attribute would leave the\n expanded form matching neither. */\n data-collapsed={collapsed() ? 'true' : 'false'}\n class={cn(\n 'group/rail bg-sidebar text-sidebar-foreground flex h-full shrink-0 flex-col border-e border-sidebar-border',\n 'transition-[width] duration-150 ease-out',\n { 'w-rail': collapsed(), 'w-rail-expanded': !collapsed() },\n local.class\n )}\n {...(rest as ComponentProps<'nav'>)}\n >\n {local.children}\n </Polymorphic>\n </SideRailContext.Provider>\n )\n}\n\n/** The header slot: the app mark, and the product name when there is room. */\nexport function SideRailHeader(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <div\n data-slot=\"side-rail-header\"\n class={cn(\n 'h-topbar flex shrink-0 items-center gap-2.5 px-3 group-data-[collapsed=true]/rail:justify-center group-data-[collapsed=true]/rail:px-0',\n local.class\n )}\n {...rest}\n />\n )\n}\n\n/** The scrolling middle. Keeps the header and the footer pinned. */\nexport function SideRailContent(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <div\n data-slot=\"side-rail-content\"\n class={cn(\n 'flex min-h-0 flex-1 flex-col gap-0.5 overflow-x-hidden overflow-y-auto px-2 py-2',\n local.class\n )}\n {...rest}\n />\n )\n}\n\n/** The pinned footer: account, settings, help. */\nexport function SideRailFooter(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <div\n data-slot=\"side-rail-footer\"\n class={cn(\n 'flex shrink-0 flex-col gap-0.5 border-t border-sidebar-border px-2 py-2',\n local.class\n )}\n {...rest}\n />\n )\n}\n\n/** A titled group of rail destinations. The title hides when collapsed. */\nexport function SideRailSection(props: ComponentProps<'div'> & { label?: string }) {\n const [local, rest] = splitProps(props, ['class', 'label', 'children'])\n\n return (\n <div data-slot=\"side-rail-section\" class={cn('flex flex-col gap-0.5', local.class)} {...rest}>\n <Show when={local.label}>\n <div class=\"text-sidebar-muted-foreground px-2 pt-2 pb-1 text-2xs font-medium tracking-wide uppercase group-data-[collapsed=true]/rail:hidden\">\n {local.label}\n </div>\n </Show>\n {local.children}\n </div>\n )\n}\n\n/**\n * The classes a rail row uses. Exported so a caller's own element — a router link,\n * a custom button — can match the rail exactly instead of approximating it.\n */\nexport const sideRailItemClass = [\n 'group/rail-item flex h-rail-item min-w-0 w-full items-center gap-2.5 rounded-md px-3 text-sm font-medium',\n 'group-data-[collapsed=true]/rail:justify-center group-data-[collapsed=true]/rail:px-0',\n 'transition-[color,background-color,transform] ease-out outline-none select-none',\n 'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle',\n /*\n * The donor's row scales up slightly under the pointer and down under a press.\n * It is a CSS transform rather than a motion-library gesture because the two are\n * the same thing here and the transform costs nothing at runtime: no wrapper\n * element, no listener, and it works on whatever element a caller renders the row\n * as — an anchor, a button, a router's own link.\n *\n * The collapsed rail opts out: a 1.02 scale on a 56px column pushes the row past\n * the rail's own edge, which reads as a glitch rather than as feedback.\n */\n 'hover:scale-[1.02] active:scale-[0.97] group-data-[collapsed=true]/rail:hover:scale-100 group-data-[collapsed=true]/rail:active:scale-[0.98]',\n '[&_svg]:size-5 [&_svg]:shrink-0',\n].join(' ')\n\n/*\n * The rail's states are accent-driven: the icon carries `--primary` on hover and\n * on the active destination, and both states draw the accent's own tint rather\n * than a neutral fill, so the rail reads as the app's accent chroma instead of a\n * grey column. The active label stays on `sidebar-foreground` because the accent\n * presets guarantee their 3:1 interaction minimum against the surface, not the\n * 4.5:1 small text owes; the icon is a graphic and rides the accent.\n */\nexport const sideRailItemStateClass = {\n active: 'bg-primary-subtle text-sidebar-foreground [&_svg]:text-primary',\n idle: 'text-sidebar-muted-foreground hover:bg-primary-subtle/60 hover:text-primary',\n}\n\n/**\n * A rail destination.\n *\n * ## The tooltip is the rail's hover affordance, not a generic bubble\n *\n * Collapsed, the row has no text, so the label has to come from somewhere. This\n * ports the donor's treatment rather than using a standard tooltip, because the\n * details are what make it read as part of the rail:\n *\n * - It is **flush with the row**: positioned at the row's own top and given the\n * row's own height, so it continues the row outward instead of floating near\n * it. A centred bubble with an arrow reads as a separate object.\n * - It **repeats the icon**, which anchors it to the row it belongs to.\n * - It carries the **keyboard chord**, which is the one piece of information a\n * collapsed rail otherwise cannot show.\n * - It opens on **hover and on focus**, so a keyboard user gets the same label a\n * pointer user does.\n * - It is `pointer-events-none` and `aria-hidden`: the row already carries the\n * name (as a visually hidden span when collapsed), so this is decoration and\n * must never be the accessible name.\n *\n * ## The chord on the row\n *\n * Expanded, the row shows its chord on hover and on focus — and the chord is\n * declared once to assistive technology through `aria-keyshortcuts` rather than\n * being read out as glyphs. The visible badge is `aria-hidden` for that reason.\n */\nexport type SideRailItemProps<T extends ValidComponent = 'a'> = PolymorphicProps<\n T,\n {\n class?: string\n /** Marks the item as the current destination. */\n active?: boolean\n /**\n * The item's accessible name. Required, and always in the accessibility tree:\n * collapsed it moves into the tooltip and a visually hidden span rather than\n * being deleted.\n */\n label: string\n /**\n * A count or a dot. Expanded, it trails the label at the row's end; collapsed,\n * it moves onto the icon's corner, so the rail never loses it.\n */\n badge?: JSX.Element\n /** An indicator pinned to the trailing edge in the expanded form. */\n trailing?: JSX.Element\n /** The chord as it should be drawn, e.g. `⌘1`. Shown on hover and focus. */\n shortcut?: string\n /**\n * The same chord in the ARIA grammar, e.g. `Meta+1`. Declared to assistive\n * technology instead of the display glyphs, which are not a keyboard shortcut\n * a screen reader can parse. Supply it whenever `shortcut` is drawn.\n */\n keyshortcuts?: string\n }\n>\n\nexport function SideRailItem<T extends ValidComponent = 'a'>(props: SideRailItemProps<T>) {\n const [local, rest] = splitProps(props as SideRailItemProps, [\n 'as',\n 'class',\n 'active',\n 'label',\n 'badge',\n 'trailing',\n 'shortcut',\n 'keyshortcuts',\n 'children',\n ])\n\n const [row, setRow] = createSignal<HTMLElement>()\n const [tip, setTip] = createSignal<{ top: number; left: number; height: number } | null>(null)\n\n const collapsed = () =>\n row()?.closest('[data-collapsed]')?.getAttribute('data-collapsed') === 'true'\n\n const showTip = () => {\n const element = row()\n if (!element || !collapsed()) return\n const rect = element.getBoundingClientRect()\n setTip({ top: rect.top, left: rect.right + 8, height: rect.height })\n }\n\n const hideTip = () => setTip(null)\n\n return (\n <>\n <Polymorphic\n as={local.as ?? 'a'}\n ref={setRow}\n aria-current={local.active ? 'page' : undefined}\n aria-keyshortcuts={local.keyshortcuts}\n data-active={local.active ? '' : undefined}\n class={cn(\n sideRailItemClass,\n 'relative',\n local.active ? sideRailItemStateClass.active : sideRailItemStateClass.idle,\n local.class\n )}\n onPointerEnter={showTip}\n onPointerLeave={hideTip}\n onFocus={showTip}\n onBlur={hideTip}\n {...(rest as Record<string, unknown>)}\n >\n <span class=\"flex size-5 shrink-0 items-center justify-center [&_svg]:size-5\">\n {local.children}\n </span>\n\n <span class=\"min-w-0 flex-1 truncate text-start group-data-[collapsed=true]/rail:sr-only\">\n {local.label}\n </span>\n\n {/*\n * One element, two placements, because the badge is caller content and a DOM\n * node cannot be in two places. Expanded, it is a trailing count in the row's\n * flow, after the label — over the icon it would cover the glyph the row is\n * recognised by. Collapsed, there is no label to trail, so it leaves the flow\n * and pins to the icon's top-end corner: anchored to the row's centre (where\n * the centred icon sits) and pushed out by 14px, the icon's half-width plus\n * the 4px overhang, so a wider count grows back over the icon rather than past\n * the rail's edge.\n */}\n <Show when={local.badge}>\n <span\n data-slot=\"side-rail-badge\"\n class=\"flex shrink-0 items-center justify-center group-data-[collapsed=true]/rail:absolute group-data-[collapsed=true]/rail:end-1/2 group-data-[collapsed=true]/rail:top-1/2 group-data-[collapsed=true]/rail:-me-3.5 group-data-[collapsed=true]/rail:-mt-3.5\"\n >\n {local.badge}\n </span>\n </Show>\n\n <Show when={local.shortcut && local.trailing === undefined}>\n <span\n aria-hidden=\"true\"\n class=\"text-sidebar-muted-foreground shrink-0 font-mono text-2xs leading-none opacity-0 transition-opacity group-hover/rail-item:opacity-100 group-focus-visible/rail-item:opacity-100 group-data-[collapsed=true]/rail:hidden\"\n >\n {local.shortcut}\n </span>\n </Show>\n\n <Show when={local.trailing}>\n <span class=\"ms-auto shrink-0\">{local.trailing}</span>\n </Show>\n </Polymorphic>\n\n <Show when={tip()}>\n {(position) => (\n <Portal>\n <div\n aria-hidden=\"true\"\n data-slot=\"side-rail-tip\"\n class={cn(\n tooltipTip,\n 'pointer-events-none fixed z-(--z-tooltip) flex items-center gap-2.5 ps-3 pe-3 whitespace-nowrap'\n )}\n style={{\n top: `${position().top}px`,\n left: `${position().left}px`,\n height: `${position().height}px`,\n }}\n >\n <span\n class={cn('flex size-5 shrink-0 items-center justify-center [&_svg]:size-5', {\n 'text-primary': local.active,\n })}\n >\n {local.children}\n </span>\n {local.label}\n <Show when={local.shortcut}>\n <span class=\"text-muted-foreground shrink-0 font-mono text-2xs leading-none\">\n {local.shortcut}\n </span>\n </Show>\n </div>\n </Portal>\n )}\n </Show>\n </>\n )\n}\n\n/** A non-navigating rail control: a collapse toggle, a \"new\" action. */\nexport function SideRailButton(\n props: Omit<ComponentProps<'button'>, 'type'> & {\n label: string\n shortcut?: string\n active?: boolean\n }\n) {\n const [local, rest] = splitProps(props, ['class', 'label', 'shortcut', 'children', 'active'])\n const [row, setRow] = createSignal<HTMLElement>()\n const [tip, setTip] = createSignal<{ top: number; left: number; height: number } | null>(null)\n\n const collapsed = () =>\n row()?.closest('[data-collapsed]')?.getAttribute('data-collapsed') === 'true'\n\n const showTip = () => {\n const element = row()\n if (!element || !collapsed()) return\n const rect = element.getBoundingClientRect()\n setTip({ top: rect.top, left: rect.right + 8, height: rect.height })\n }\n\n return (\n <>\n <button\n type=\"button\"\n ref={setRow}\n aria-label={local.label}\n data-active={local.active ? 'true' : undefined}\n onPointerEnter={showTip}\n onPointerLeave={() => setTip(null)}\n onFocus={showTip}\n onBlur={() => setTip(null)}\n class={cn(\n sideRailItemClass,\n local.active ? sideRailItemStateClass.active : sideRailItemStateClass.idle,\n 'disabled:pointer-events-none disabled:opacity-50',\n local.class\n )}\n {...rest}\n >\n <span class=\"flex size-5 shrink-0 items-center justify-center [&_svg]:size-5\">\n {local.children}\n </span>\n <span class=\"min-w-0 flex-1 truncate text-start group-data-[collapsed=true]/rail:sr-only\">\n {local.label}\n </span>\n <Show when={local.shortcut}>\n <span\n aria-hidden=\"true\"\n class=\"text-sidebar-muted-foreground shrink-0 font-mono text-2xs leading-none opacity-0 transition-opacity group-hover/rail-item:opacity-100 group-focus-visible/rail-item:opacity-100 group-data-[collapsed=true]/rail:hidden\"\n >\n {local.shortcut}\n </span>\n </Show>\n </button>\n\n <Show when={tip()}>\n {(position) => (\n <Portal>\n <div\n aria-hidden=\"true\"\n data-slot=\"side-rail-tip\"\n class={cn(\n tooltipTip,\n 'pointer-events-none fixed z-(--z-tooltip) flex items-center gap-2.5 ps-3 pe-3 whitespace-nowrap'\n )}\n style={{\n top: `${position().top}px`,\n left: `${position().left}px`,\n height: `${position().height}px`,\n }}\n >\n <span class=\"flex size-5 shrink-0 items-center justify-center [&_svg]:size-5\">\n {local.children}\n </span>\n {local.label}\n </div>\n </Portal>\n )}\n </Show>\n </>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAkCA,SAAgBkB,SAA2CC,OAAyB;CAClF,MAAM,CAACC,OAAOC,QAAQb,WAAWW,OAAwB;EACvD;EACA;EACA;EACA;CAAU,CACX;CAED,MAAMF,kBAAkBG,MAAMH,aAAa;CAC3C,MAAMK,QAAQT,oBACZI,WACAX,iBAAkBW,UAAU,IAAI,sBAAsB,4BAA6B,CACrF;CAEA,OAAAM,gBACGX,gBAAgBY,UAAQ;EAAQF;EAAK,IAAAG,WAAA;GAAA,OAAAF,gBACnCvB,aAAW0B,WAAA;IACVC,IAAE;IAAA,KAAA,gBAAA;KAAA,OACUP,MAAM,iBAAiB;IAAS;IAAA,KAAA,oBAAA;KAAA,OAI5BH,UAAU,IAAI,SAAS;IAAO;IAAA,KAAA,WAAA;KAAA,OACvCN,GACL,8GACA,4CACA;MAAE,UAAUM,UAAU;MAAG,mBAAmB,CAACA,UAAU;KAAE,GACzDG,MAAMJ,KACR;IAAC;GAAA,GACIK,MAA6B,EAAA,IAAAI,WAAA;IAAA,OAEjCL,MAAMK;GAAQ,EAAA,CAAA,CAAA;EAAA;CAAA,CAAA;AAIvB;;AAGA,SAAgBK,eAAeX,OAA8B;CAC3D,MAAM,CAACC,OAAOC,QAAQb,WAAWW,OAAO,CAAC,OAAO,CAA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al","splitProps","Portal","tooltipTip","cn","SideRailContext","createSideRailValue","SideRailProps","T","class","collapsed","SideRail","props","local","rest","value","_$createComponent","Provider","children","_$mergeProps","as","aria-label","data-collapsed","SideRailHeader","_el$","_tmpl$","_$spread","SideRailContent","_el$2","_tmpl$2","SideRailFooter","_el$3","_tmpl$3","SideRailSection","label","_el$4","_tmpl$5","_$insert","when","_el$5","_tmpl$4","sideRailItemClass","join","sideRailItemStateClass","active","idle","SideRailItemProps","badge","Element","trailing","shortcut","keyshortcuts","SideRailItem","row","setRow","HTMLElement","tip","setTip","top","left","height","closest","getAttribute","showTip","element","rect","getBoundingClientRect","right","hideTip","ref","aria-current","undefined","aria-keyshortcuts","data-active","onPointerEnter","onPointerLeave","onFocus","onBlur","Record","_el$6","_tmpl$6","_el$7","_tmpl$7","_el$8","_tmpl$8","_$memo","_el$9","_tmpl$9","_el$0","_tmpl$0","position","_el$1","_tmpl$10","_el$10","firstChild","_el$11","_tmpl$1","_$effect","_p$","_v$","_v$2","_v$3","_v$4","_v$5","e","_$className","t","_$setStyleProperty","a","o","i","SideRailButton","Omit","_el$12","_tmpl$11","_el$13","_el$14","nextSibling","addEventListener","_$use","_el$15","_el$16","_tmpl$12","_el$17","_v$6","_v$7","_v$8","_v$9","_$createComponent","_$mergeProps","_$memo","_$className","_$setStyleProperty"],"sources":["../../../../src/components/layout/side-rail/side-rail.tsx"],"sourcesContent":["import { Polymorphic, type PolymorphicProps } from '@kobalte/core/polymorphic'\nimport type { ComponentProps, JSX, ValidComponent } from 'solid-js'\nimport { Show, createMemo, createSignal, splitProps } from 'solid-js'\nimport { Portal } from 'solid-js/web'\nimport { tooltipTip } from '#lib/overlay'\nimport { cn } from '#lib/utils'\nimport { SideRailContext, createSideRailValue } from './side-rail-context'\n\n/**\n * SideRail.\n *\n * The narrow, persistent column of top-level destinations at the window's leading\n * edge: the app mark, the primary sections, and a footer for account and settings.\n * It is the one piece of chrome that is always on screen, which is why it is a\n * component rather than something each view arranges.\n *\n * Two forms, one component. Collapsed it is an icon column; expanded it carries\n * labels. Both widths come from `--rail-width` (56px) and `--rail-width-expanded`\n * (236px), so an app cannot pick its own and end up a few pixels out of step with\n * the app beside it.\n *\n * The rail does not own its collapsed state; the app does. That state has to\n * survive a reload and usually lives with the rest of the window preferences, and\n * a rail that kept it privately could not be restored.\n */\nexport type SideRailProps<T extends ValidComponent = 'nav'> = PolymorphicProps<\n T,\n {\n class?: string\n collapsed?: boolean\n 'aria-label'?: string\n }\n>\n\nexport function SideRail<T extends ValidComponent = 'nav'>(props: SideRailProps<T>) {\n const [local, rest] = splitProps(props as SideRailProps, [\n 'class',\n 'collapsed',\n 'aria-label',\n 'children',\n ])\n\n const collapsed = () => local.collapsed ?? false\n const value = createSideRailValue(\n collapsed,\n createMemo(() => (collapsed() ? 'var(--rail-width)' : 'var(--rail-width-expanded)'))\n )\n\n return (\n <SideRailContext.Provider value={value}>\n <Polymorphic\n as=\"nav\"\n aria-label={local['aria-label'] ?? 'Primary'}\n /* Rendered in both states, with a real value, so the descendant selectors\n below can key on true *and* false — an absent attribute would leave the\n expanded form matching neither. */\n data-collapsed={collapsed() ? 'true' : 'false'}\n class={cn(\n 'group/rail bg-sidebar text-sidebar-foreground flex h-full shrink-0 flex-col border-e border-sidebar-border',\n 'transition-[width] duration-150 ease-out',\n { 'w-rail': collapsed(), 'w-rail-expanded': !collapsed() },\n local.class\n )}\n {...(rest as ComponentProps<'nav'>)}\n >\n {local.children}\n </Polymorphic>\n </SideRailContext.Provider>\n )\n}\n\n/** The header slot: the app mark, and the product name when there is room. */\nexport function SideRailHeader(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <div\n data-slot=\"side-rail-header\"\n class={cn(\n 'h-topbar flex shrink-0 items-center gap-2.5 px-3 group-data-[collapsed=true]/rail:justify-center group-data-[collapsed=true]/rail:px-0',\n local.class\n )}\n {...rest}\n />\n )\n}\n\n/** The scrolling middle. Keeps the header and the footer pinned. */\nexport function SideRailContent(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <div\n data-slot=\"side-rail-content\"\n class={cn(\n 'flex min-h-0 flex-1 flex-col gap-0.5 overflow-x-hidden overflow-y-auto px-2 py-2',\n local.class\n )}\n {...rest}\n />\n )\n}\n\n/** The pinned footer: account, settings, help. */\nexport function SideRailFooter(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <div\n data-slot=\"side-rail-footer\"\n class={cn(\n 'flex shrink-0 flex-col gap-0.5 border-t border-sidebar-border px-2 py-2',\n local.class\n )}\n {...rest}\n />\n )\n}\n\n/** A titled group of rail destinations. The title hides when collapsed. */\nexport function SideRailSection(props: ComponentProps<'div'> & { label?: string }) {\n const [local, rest] = splitProps(props, ['class', 'label', 'children'])\n\n return (\n <div data-slot=\"side-rail-section\" class={cn('flex flex-col gap-0.5', local.class)} {...rest}>\n <Show when={local.label}>\n <div class=\"text-sidebar-muted-foreground px-2 pt-2 pb-1 text-2xs font-medium tracking-wide uppercase group-data-[collapsed=true]/rail:hidden\">\n {local.label}\n </div>\n </Show>\n {local.children}\n </div>\n )\n}\n\n/**\n * The classes a rail row uses. Exported so a caller's own element — a router link,\n * a custom button — can match the rail exactly instead of approximating it.\n */\nexport const sideRailItemClass = [\n 'group/rail-item flex h-rail-item min-w-0 w-full items-center gap-2.5 rounded-md px-3 text-sm font-medium',\n 'group-data-[collapsed=true]/rail:justify-center group-data-[collapsed=true]/rail:px-0',\n 'transition-[color,background-color,transform] ease-out outline-none select-none',\n 'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle',\n /*\n * The donor's row scales up slightly under the pointer and down under a press.\n * It is a CSS transform rather than a motion-library gesture because the two are\n * the same thing here and the transform costs nothing at runtime: no wrapper\n * element, no listener, and it works on whatever element a caller renders the row\n * as — an anchor, a button, a router's own link.\n *\n * The collapsed rail opts out: a 1.02 scale on a 56px column pushes the row past\n * the rail's own edge, which reads as a glitch rather than as feedback.\n */\n 'hover:scale-[1.02] active:scale-[0.97] group-data-[collapsed=true]/rail:hover:scale-100 group-data-[collapsed=true]/rail:active:scale-[0.98]',\n '[&_svg]:size-5 [&_svg]:shrink-0',\n].join(' ')\n\n/*\n * The rail's states are accent-driven: the icon carries `--primary` on hover and\n * on the active destination, and both states draw the accent's own tint rather\n * than a neutral fill, so the rail reads as the app's accent chroma instead of a\n * grey column. The active label stays on `sidebar-foreground` because the accent\n * presets guarantee their 3:1 interaction minimum against the surface, not the\n * 4.5:1 small text owes; the icon is a graphic and rides the accent.\n */\nexport const sideRailItemStateClass = {\n active: 'bg-primary-subtle text-sidebar-foreground [&_svg]:text-primary',\n idle: 'text-sidebar-muted-foreground hover:bg-primary-subtle/60 hover:text-primary',\n}\n\n/**\n * A rail destination.\n *\n * ## The tooltip is the rail's hover affordance, not a generic bubble\n *\n * Collapsed, the row has no text, so the label has to come from somewhere. This\n * ports the donor's treatment rather than using a standard tooltip, because the\n * details are what make it read as part of the rail:\n *\n * - It is **flush with the row**: positioned at the row's own top and given the\n * row's own height, so it continues the row outward instead of floating near\n * it. A centred bubble with an arrow reads as a separate object.\n * - It **repeats the icon**, which anchors it to the row it belongs to.\n * - It carries the **keyboard chord**, which is the one piece of information a\n * collapsed rail otherwise cannot show.\n * - It opens on **hover and on focus**, so a keyboard user gets the same label a\n * pointer user does.\n * - It is `pointer-events-none` and `aria-hidden`: the row already carries the\n * name (as a visually hidden span when collapsed), so this is decoration and\n * must never be the accessible name.\n *\n * ## The chord on the row\n *\n * Expanded, the row shows its chord on hover and on focus — and the chord is\n * declared once to assistive technology through `aria-keyshortcuts` rather than\n * being read out as glyphs. The visible badge is `aria-hidden` for that reason.\n */\nexport type SideRailItemProps<T extends ValidComponent = 'a'> = PolymorphicProps<\n T,\n {\n class?: string\n /** Marks the item as the current destination. */\n active?: boolean\n /**\n * The item's accessible name. Required, and always in the accessibility tree:\n * collapsed it moves into the tooltip and a visually hidden span rather than\n * being deleted.\n */\n label: string\n /**\n * A count or a dot. Expanded, it trails the label at the row's end; collapsed,\n * it moves onto the icon's corner, so the rail never loses it.\n */\n badge?: JSX.Element\n /** An indicator pinned to the trailing edge in the expanded form. */\n trailing?: JSX.Element\n /** The chord as it should be drawn, e.g. `⌘1`. Shown on hover and focus. */\n shortcut?: string\n /**\n * The same chord in the ARIA grammar, e.g. `Meta+1`. Declared to assistive\n * technology instead of the display glyphs, which are not a keyboard shortcut\n * a screen reader can parse. Supply it whenever `shortcut` is drawn.\n */\n keyshortcuts?: string\n }\n>\n\nexport function SideRailItem<T extends ValidComponent = 'a'>(props: SideRailItemProps<T>) {\n const [local, rest] = splitProps(props as SideRailItemProps, [\n 'as',\n 'class',\n 'active',\n 'label',\n 'badge',\n 'trailing',\n 'shortcut',\n 'keyshortcuts',\n 'children',\n ])\n\n const [row, setRow] = createSignal<HTMLElement>()\n const [tip, setTip] = createSignal<{ top: number; left: number; height: number } | null>(null)\n\n const collapsed = () =>\n row()?.closest('[data-collapsed]')?.getAttribute('data-collapsed') === 'true'\n\n const showTip = () => {\n const element = row()\n if (!element || !collapsed()) return\n const rect = element.getBoundingClientRect()\n setTip({ top: rect.top, left: rect.right + 8, height: rect.height })\n }\n\n const hideTip = () => setTip(null)\n\n return (\n <>\n <Polymorphic\n as={local.as ?? 'a'}\n ref={setRow}\n aria-current={local.active ? 'page' : undefined}\n aria-keyshortcuts={local.keyshortcuts}\n data-active={local.active ? '' : undefined}\n class={cn(\n sideRailItemClass,\n 'relative',\n local.active ? sideRailItemStateClass.active : sideRailItemStateClass.idle,\n local.class\n )}\n onPointerEnter={showTip}\n onPointerLeave={hideTip}\n onFocus={showTip}\n onBlur={hideTip}\n {...(rest as Record<string, unknown>)}\n >\n <span class=\"flex size-5 shrink-0 items-center justify-center [&_svg]:size-5\">\n {local.children}\n </span>\n\n <span class=\"min-w-0 flex-1 truncate text-start group-data-[collapsed=true]/rail:sr-only\">\n {local.label}\n </span>\n\n {/*\n * One element, two placements, because the badge is caller content and a DOM\n * node cannot be in two places. Expanded, it is a trailing count in the row's\n * flow, after the label — over the icon it would cover the glyph the row is\n * recognised by. Collapsed, there is no label to trail, so it leaves the flow\n * and pins to the icon's top-end corner: anchored to the row's centre (where\n * the centred icon sits) and pushed out by 14px, the icon's half-width plus\n * the 4px overhang, so a wider count grows back over the icon rather than past\n * the rail's edge.\n */}\n <Show when={local.badge}>\n <span\n data-slot=\"side-rail-badge\"\n class=\"flex shrink-0 items-center justify-center group-data-[collapsed=true]/rail:absolute group-data-[collapsed=true]/rail:end-1/2 group-data-[collapsed=true]/rail:top-1/2 group-data-[collapsed=true]/rail:-me-3.5 group-data-[collapsed=true]/rail:-mt-3.5\"\n >\n {local.badge}\n </span>\n </Show>\n\n <Show when={local.shortcut && local.trailing === undefined}>\n <span\n aria-hidden=\"true\"\n class=\"text-sidebar-muted-foreground shrink-0 font-code text-code leading-none opacity-0 transition-opacity group-hover/rail-item:opacity-100 group-focus-visible/rail-item:opacity-100 group-data-[collapsed=true]/rail:hidden\"\n >\n {local.shortcut}\n </span>\n </Show>\n\n <Show when={local.trailing}>\n <span class=\"ms-auto shrink-0\">{local.trailing}</span>\n </Show>\n </Polymorphic>\n\n <Show when={tip()}>\n {(position) => (\n <Portal>\n <div\n aria-hidden=\"true\"\n data-slot=\"side-rail-tip\"\n class={cn(\n tooltipTip,\n 'pointer-events-none fixed z-(--z-tooltip) flex items-center gap-2.5 ps-3 pe-3 whitespace-nowrap'\n )}\n style={{\n top: `${position().top}px`,\n left: `${position().left}px`,\n height: `${position().height}px`,\n }}\n >\n <span\n class={cn('flex size-5 shrink-0 items-center justify-center [&_svg]:size-5', {\n 'text-primary': local.active,\n })}\n >\n {local.children}\n </span>\n {local.label}\n <Show when={local.shortcut}>\n <span class=\"text-muted-foreground shrink-0 font-code text-code leading-none\">\n {local.shortcut}\n </span>\n </Show>\n </div>\n </Portal>\n )}\n </Show>\n </>\n )\n}\n\n/** A non-navigating rail control: a collapse toggle, a \"new\" action. */\nexport function SideRailButton(\n props: Omit<ComponentProps<'button'>, 'type'> & {\n label: string\n shortcut?: string\n active?: boolean\n }\n) {\n const [local, rest] = splitProps(props, ['class', 'label', 'shortcut', 'children', 'active'])\n const [row, setRow] = createSignal<HTMLElement>()\n const [tip, setTip] = createSignal<{ top: number; left: number; height: number } | null>(null)\n\n const collapsed = () =>\n row()?.closest('[data-collapsed]')?.getAttribute('data-collapsed') === 'true'\n\n const showTip = () => {\n const element = row()\n if (!element || !collapsed()) return\n const rect = element.getBoundingClientRect()\n setTip({ top: rect.top, left: rect.right + 8, height: rect.height })\n }\n\n return (\n <>\n <button\n type=\"button\"\n ref={setRow}\n aria-label={local.label}\n data-active={local.active ? 'true' : undefined}\n onPointerEnter={showTip}\n onPointerLeave={() => setTip(null)}\n onFocus={showTip}\n onBlur={() => setTip(null)}\n class={cn(\n sideRailItemClass,\n local.active ? sideRailItemStateClass.active : sideRailItemStateClass.idle,\n 'disabled:pointer-events-none disabled:opacity-50',\n local.class\n )}\n {...rest}\n >\n <span class=\"flex size-5 shrink-0 items-center justify-center [&_svg]:size-5\">\n {local.children}\n </span>\n <span class=\"min-w-0 flex-1 truncate text-start group-data-[collapsed=true]/rail:sr-only\">\n {local.label}\n </span>\n <Show when={local.shortcut}>\n <span\n aria-hidden=\"true\"\n class=\"text-sidebar-muted-foreground shrink-0 font-code text-code leading-none opacity-0 transition-opacity group-hover/rail-item:opacity-100 group-focus-visible/rail-item:opacity-100 group-data-[collapsed=true]/rail:hidden\"\n >\n {local.shortcut}\n </span>\n </Show>\n </button>\n\n <Show when={tip()}>\n {(position) => (\n <Portal>\n <div\n aria-hidden=\"true\"\n data-slot=\"side-rail-tip\"\n class={cn(\n tooltipTip,\n 'pointer-events-none fixed z-(--z-tooltip) flex items-center gap-2.5 ps-3 pe-3 whitespace-nowrap'\n )}\n style={{\n top: `${position().top}px`,\n left: `${position().left}px`,\n height: `${position().height}px`,\n }}\n >\n <span class=\"flex size-5 shrink-0 items-center justify-center [&_svg]:size-5\">\n {local.children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B;GAAAzD,OAAAsF,cAeA9G,MAAMK,QAAQ;GAAAmB,OAAAoF,cAEhB5G,MAAMqB,OAAK,IAAA;GAAA+D,QAAAC,QAAA;IAAA,IAAA0B,OAbLxH,GACLD,YACA,iGACF,GAAC0H,OAEM,GAAGnC,SAAS,CAAC,CAAChC,IAAG,KAAIoE,OACpB,GAAGpC,SAAS,CAAC,CAAC/B,KAAI,KAAIoE,OACpB,GAAGrC,SAAS,CAAC,CAAC9B,OAAM;IAAIgE,SAAA1B,IAAAM,KAAAC,UAAAgB,QAAAvB,IAAAM,IAAAoB,IAAA;IAAAC,SAAA3B,IAAAQ,KAAAC,iBAAAc,QAAA,OAAAvB,IAAAQ,IAAAmB,IAAA;IAAAC,SAAA5B,IAAAU,KAAAD,iBAAAc,QAAA,QAAAvB,IAAAU,IAAAkB,IAAA;IAAAC,SAAA7B,IAAAW,KAAAF,iBAAAc,QAAA,UAAAvB,IAAAW,IAAAkB,IAAA;IAAA,OAAA7B;GAAA,GAAA;IAAAM,GAAAjC,KAAAA;IAAAmC,GAAAnC,KAAAA;IAAAqC,GAAArC,KAAAA;IAAAsC,GAAAtC,KAAAA;GAAA,CAAA;GAAA,OAAAkD;EAAA,EAAA,CAAA;CASvC,CAAA,CAAA;AAIT"}
@@ -7,7 +7,7 @@ var _tmpl$ = /*#__PURE__*/ template(`<header data-slot=top-bar>`);
7
7
  var _tmpl$2 = /*#__PURE__*/ template(`<div data-slot=top-bar-section>`);
8
8
  var _tmpl$3 = /*#__PURE__*/ template(`<div data-slot=top-bar-title>`);
9
9
  var _tmpl$4 = /*#__PURE__*/ template(`<div data-slot=top-bar-breadcrumb>`);
10
- var _tmpl$5 = /*#__PURE__*/ template(`<kbd aria-hidden=true class="bg-muted ms-auto hidden h-5 shrink-0 items-center rounded-sm border border-border px-1.5 font-mono text-2xs sm:flex">`);
10
+ var _tmpl$5 = /*#__PURE__*/ template(`<kbd aria-hidden=true class="bg-muted ms-auto hidden h-5 shrink-0 items-center rounded-sm border border-border px-1.5 font-code text-code sm:flex">`);
11
11
  var _tmpl$6 = /*#__PURE__*/ template(`<button type=button data-slot=top-bar-search><span class="sr-only sm:not-sr-only sm:truncate">`);
12
12
  var _tmpl$7 = /*#__PURE__*/ template(`<button type=button data-slot=top-bar-pill><span>`);
13
13
  function TopBar(props) {
@@ -1 +1 @@
1
- {"version":3,"file":"top-bar.js","names":["ComponentProps","Show","splitProps","Search","cn","TopBarProps","draggable","macosInset","windowsInset","glass","TopBar","props","local","rest","_el$","_tmpl$","_$spread","_$mergeProps","class","invokeFocusHandler","handler","event","Event","Array","isArray","callback","data","TopBarSection","align","_el$2","_tmpl$2","$$focusin","target","HTMLElement","scrollIntoView","block","inline","onFocusIn","TopBarTitle","_el$3","_tmpl$3","TopBarBreadcrumb","_el$4","_tmpl$4","TopBarSearchProps","placeholder","shortcut","keyshortcuts","TopBarSearch","_el$5","_tmpl$6","_el$6","firstChild","aria-keyshortcuts","_$insert","_$createComponent","when","children","_el$7","_tmpl$5","TopBarPill","label","_el$8","_tmpl$7","_el$9","_$delegateEvents","_$mergeProps","_$createComponent","_$delegateEvents"],"sources":["../../../../src/components/layout/top-bar/top-bar.tsx"],"sourcesContent":["import type { ComponentProps } from 'solid-js'\nimport { Show, splitProps } from 'solid-js'\nimport { Search } from 'lucide-solid'\nimport { cn } from '#lib/utils'\n\n/**\n * TopBar.\n *\n * The window's title row and primary toolbar. Three tracks: a leading group, a\n * centred search, and a trailing group. On wide screens the search is a fixed\n * function of the window width and the side groups are equal remainders. On\n * narrow screens the middle track yields space to the controls, and each side\n * group scrolls when necessary so keyboard focus can reveal every action.\n *\n * On a frameless desktop window this row is also the drag region, so it carries\n * `window-drag` and the controls inside it opt back out. `macos-inset` and\n * `windows-inset` reserve the space the native window controls occupy, which is\n * why the row can look off-centre in a frameless window and be correct: it is\n * centred in the space the user can actually see.\n */\nexport type TopBarProps = ComponentProps<'header'> & {\n /** Make the row draggable, for a frameless window. */\n draggable?: boolean\n /** Reserve space for the macOS traffic lights. */\n macosInset?: boolean\n /** Reserve space for the Windows caption buttons. */\n windowsInset?: boolean\n /** Blur the content scrolling under the bar. */\n glass?: boolean\n}\n\nexport function TopBar(props: TopBarProps) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'draggable',\n 'macosInset',\n 'windowsInset',\n 'glass',\n ])\n\n return (\n <header\n data-slot=\"top-bar\"\n class={cn(\n 'h-topbar relative z-(--z-sticky) grid shrink-0 grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] items-center gap-3 border-b border-border bg-card text-card-foreground px-3 md:grid-cols-[minmax(0,1fr)_clamp(240px,22vw,480px)_minmax(0,1fr)]',\n local.glass && 'glass-panel',\n local.draggable && 'window-drag',\n local.macosInset && 'window-inset-macos',\n local.windowsInset && 'window-inset-windows',\n local.class\n )}\n {...rest}\n />\n )\n}\n\nfunction invokeFocusHandler(handler: unknown, event: Event) {\n if (Array.isArray(handler)) {\n const [callback, data] = handler as [(data: unknown, event: Event) => void, unknown]\n callback(data, event)\n } else if (typeof handler === 'function') {\n const callback = handler as (event: Event) => void\n callback(event)\n }\n}\n\n/** A scrollable side group; equal wide-screen tracks centre the search. */\nexport function TopBarSection(props: ComponentProps<'div'> & { align?: 'start' | 'end' }) {\n const [local, rest] = splitProps(props, ['class', 'align', 'onFocusIn'])\n\n return (\n <div\n data-slot=\"top-bar-section\"\n class={cn(\n 'window-no-drag flex min-w-0 items-center gap-2 overflow-x-auto overflow-y-hidden',\n local.align === 'end' && 'md:justify-end',\n local.align !== 'end' && 'justify-start',\n local.class\n )}\n onFocusIn={(event) => {\n if (event.target instanceof HTMLElement) {\n event.target.scrollIntoView({ block: 'nearest', inline: 'nearest' })\n }\n invokeFocusHandler(local.onFocusIn, event)\n }}\n {...rest}\n />\n )\n}\n\nexport function TopBarTitle(\n props: ComponentProps<'div'> & {\n /** Aligns text within this slot; it does not position the slot. */\n align?: 'start' | 'center'\n }\n) {\n const [local, rest] = splitProps(props, ['class', 'align'])\n return (\n <div\n data-slot=\"top-bar-title\"\n class={cn(\n 'truncate text-sm font-medium',\n local.align === 'center' && 'text-center',\n local.class\n )}\n {...rest}\n />\n )\n}\n\n/** A breadcrumb or path readout that yields to the actions when space runs out. */\nexport function TopBarBreadcrumb(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <div\n data-slot=\"top-bar-breadcrumb\"\n class={cn('flex min-w-0 items-center gap-1.5 text-sm', local.class)}\n {...rest}\n />\n )\n}\n\nexport type TopBarSearchProps = ComponentProps<'button'> & {\n /** The hint shown inside the field, e.g. \"Search projects and files\". */\n placeholder?: string\n /** The shortcut chip drawn at the trailing edge, e.g. \"⌘K\". */\n shortcut?: string\n /**\n * The parseable chord behind `shortcut`, e.g. `Meta+K`. The chip is\n * `aria-hidden` — reading it out would pollute the button's accessible\n * name — so this is what assistive technology announces instead. Supply it\n * whenever `shortcut` is drawn.\n */\n keyshortcuts?: string\n}\n\n/**\n * The search affordance in the middle track.\n *\n * It is a button, not an input, and that is deliberate: clicking it opens the\n * command palette, which already owns the input, the ranking and the keyboard\n * handling. A second live input here would be a second source of truth for the\n * same query. It is styled to read as a field because that is what it behaves\n * like from the user's side.\n */\nexport function TopBarSearch(props: TopBarSearchProps) {\n const [local, rest] = splitProps(props, ['class', 'placeholder', 'shortcut', 'keyshortcuts'])\n\n return (\n <button\n type=\"button\"\n data-slot=\"top-bar-search\"\n class={cn(\n 'text-muted-foreground flex h-control-md w-full min-w-(--control-height-md) items-center justify-center gap-2 rounded-md border border-input px-3 text-sm sm:justify-start',\n 'transition-colors ease-out outline-none',\n 'hover:bg-surface-hover hover:text-foreground',\n 'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle',\n 'window-no-drag',\n local.class\n )}\n aria-keyshortcuts={local.keyshortcuts}\n {...rest}\n >\n <Search aria-hidden=\"true\" class=\"size-4 shrink-0 sm:hidden\" />\n <span class=\"sr-only sm:not-sr-only sm:truncate\">{local.placeholder ?? 'Search'}</span>\n <Show when={local.shortcut}>\n <kbd\n aria-hidden=\"true\"\n class=\"bg-muted ms-auto hidden h-5 shrink-0 items-center rounded-sm border border-border px-1.5 font-mono text-2xs sm:flex\"\n >\n {local.shortcut}\n </kbd>\n </Show>\n </button>\n )\n}\n\n/**\n * A labelled top-bar control — the readouts KiroCrew puts in the trailing\n * group. Container queries on the group decide which of these survive a narrow\n * window; a caller marks the cheap-to-drop ones and the group handles the rest.\n */\nexport function TopBarPill(props: ComponentProps<'button'> & { label: string }) {\n const [local, rest] = splitProps(props, ['class', 'label', 'children'])\n\n return (\n <button\n type=\"button\"\n data-slot=\"top-bar-pill\"\n class={cn(\n 'text-muted-foreground inline-flex h-control-sm shrink-0 items-center gap-1.5 rounded-md border border-border px-2.5 text-xs font-medium',\n 'transition-colors ease-out outline-none',\n 'hover:border-input hover:text-foreground',\n 'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle',\n 'window-no-drag [&_svg]:size-3.5 [&_svg]:shrink-0',\n local.class\n )}\n {...rest}\n >\n {local.children}\n <span>{local.label}</span>\n </button>\n )\n}\n"],"mappings":";;;;;;;;;;;;AA+BA,SAAgBU,OAAOC,OAAoB;CACzC,MAAM,CAACC,OAAOC,QAAQX,WAAWS,OAAO;EACtC;EACA;EACA;EACA;EACA;CAAO,CACR;CAED,cAAA;EAAA,IAAAG,OAAAC,OAAA;EAAAC,OAAAF,MAAAG,WAAA,EAAA,KAAA,WAAA;GAAA,OAGWb,GACL,8OACAQ,MAAMH,SAAS,eACfG,MAAMN,aAAa,eACnBM,MAAML,cAAc,sBACpBK,MAAMJ,gBAAgB,wBACtBI,MAAMM,KACR;EAAC,EAAA,GACGL,IAAI,GAAA,OAAA,KAAA;EAAA,OAAAC;CAAA,EAAA,CAAA;AAGd;AAEA,SAASK,mBAAmBC,SAAkBC,OAAc;CAC1D,IAAIE,MAAMC,QAAQJ,OAAO,GAAG;EAC1B,MAAM,CAACK,UAAUC,QAAQN;EACzBK,SAASC,MAAML,KAAK;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EAAA,CAAA;AAGxB;AAACG,eAAA,CAAA,SAAA,CAAA"}
1
+ {"version":3,"file":"top-bar.js","names":["ComponentProps","Show","splitProps","Search","cn","TopBarProps","draggable","macosInset","windowsInset","glass","TopBar","props","local","rest","_el$","_tmpl$","_$spread","_$mergeProps","class","invokeFocusHandler","handler","event","Event","Array","isArray","callback","data","TopBarSection","align","_el$2","_tmpl$2","$$focusin","target","HTMLElement","scrollIntoView","block","inline","onFocusIn","TopBarTitle","_el$3","_tmpl$3","TopBarBreadcrumb","_el$4","_tmpl$4","TopBarSearchProps","placeholder","shortcut","keyshortcuts","TopBarSearch","_el$5","_tmpl$6","_el$6","firstChild","aria-keyshortcuts","_$insert","_$createComponent","when","children","_el$7","_tmpl$5","TopBarPill","label","_el$8","_tmpl$7","_el$9","_$delegateEvents","_$mergeProps","_$createComponent","_$delegateEvents"],"sources":["../../../../src/components/layout/top-bar/top-bar.tsx"],"sourcesContent":["import type { ComponentProps } from 'solid-js'\nimport { Show, splitProps } from 'solid-js'\nimport { Search } from 'lucide-solid'\nimport { cn } from '#lib/utils'\n\n/**\n * TopBar.\n *\n * The window's title row and primary toolbar. Three tracks: a leading group, a\n * centred search, and a trailing group. On wide screens the search is a fixed\n * function of the window width and the side groups are equal remainders. On\n * narrow screens the middle track yields space to the controls, and each side\n * group scrolls when necessary so keyboard focus can reveal every action.\n *\n * On a frameless desktop window this row is also the drag region, so it carries\n * `window-drag` and the controls inside it opt back out. `macos-inset` and\n * `windows-inset` reserve the space the native window controls occupy, which is\n * why the row can look off-centre in a frameless window and be correct: it is\n * centred in the space the user can actually see.\n */\nexport type TopBarProps = ComponentProps<'header'> & {\n /** Make the row draggable, for a frameless window. */\n draggable?: boolean\n /** Reserve space for the macOS traffic lights. */\n macosInset?: boolean\n /** Reserve space for the Windows caption buttons. */\n windowsInset?: boolean\n /** Blur the content scrolling under the bar. */\n glass?: boolean\n}\n\nexport function TopBar(props: TopBarProps) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'draggable',\n 'macosInset',\n 'windowsInset',\n 'glass',\n ])\n\n return (\n <header\n data-slot=\"top-bar\"\n class={cn(\n 'h-topbar relative z-(--z-sticky) grid shrink-0 grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] items-center gap-3 border-b border-border bg-card text-card-foreground px-3 md:grid-cols-[minmax(0,1fr)_clamp(240px,22vw,480px)_minmax(0,1fr)]',\n local.glass && 'glass-panel',\n local.draggable && 'window-drag',\n local.macosInset && 'window-inset-macos',\n local.windowsInset && 'window-inset-windows',\n local.class\n )}\n {...rest}\n />\n )\n}\n\nfunction invokeFocusHandler(handler: unknown, event: Event) {\n if (Array.isArray(handler)) {\n const [callback, data] = handler as [(data: unknown, event: Event) => void, unknown]\n callback(data, event)\n } else if (typeof handler === 'function') {\n const callback = handler as (event: Event) => void\n callback(event)\n }\n}\n\n/** A scrollable side group; equal wide-screen tracks centre the search. */\nexport function TopBarSection(props: ComponentProps<'div'> & { align?: 'start' | 'end' }) {\n const [local, rest] = splitProps(props, ['class', 'align', 'onFocusIn'])\n\n return (\n <div\n data-slot=\"top-bar-section\"\n class={cn(\n 'window-no-drag flex min-w-0 items-center gap-2 overflow-x-auto overflow-y-hidden',\n local.align === 'end' && 'md:justify-end',\n local.align !== 'end' && 'justify-start',\n local.class\n )}\n onFocusIn={(event) => {\n if (event.target instanceof HTMLElement) {\n event.target.scrollIntoView({ block: 'nearest', inline: 'nearest' })\n }\n invokeFocusHandler(local.onFocusIn, event)\n }}\n {...rest}\n />\n )\n}\n\nexport function TopBarTitle(\n props: ComponentProps<'div'> & {\n /** Aligns text within this slot; it does not position the slot. */\n align?: 'start' | 'center'\n }\n) {\n const [local, rest] = splitProps(props, ['class', 'align'])\n return (\n <div\n data-slot=\"top-bar-title\"\n class={cn(\n 'truncate text-sm font-medium',\n local.align === 'center' && 'text-center',\n local.class\n )}\n {...rest}\n />\n )\n}\n\n/** A breadcrumb or path readout that yields to the actions when space runs out. */\nexport function TopBarBreadcrumb(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <div\n data-slot=\"top-bar-breadcrumb\"\n class={cn('flex min-w-0 items-center gap-1.5 text-sm', local.class)}\n {...rest}\n />\n )\n}\n\nexport type TopBarSearchProps = ComponentProps<'button'> & {\n /** The hint shown inside the field, e.g. \"Search projects and files\". */\n placeholder?: string\n /** The shortcut chip drawn at the trailing edge, e.g. \"⌘K\". */\n shortcut?: string\n /**\n * The parseable chord behind `shortcut`, e.g. `Meta+K`. The chip is\n * `aria-hidden` — reading it out would pollute the button's accessible\n * name — so this is what assistive technology announces instead. Supply it\n * whenever `shortcut` is drawn.\n */\n keyshortcuts?: string\n}\n\n/**\n * The search affordance in the middle track.\n *\n * It is a button, not an input, and that is deliberate: clicking it opens the\n * command palette, which already owns the input, the ranking and the keyboard\n * handling. A second live input here would be a second source of truth for the\n * same query. It is styled to read as a field because that is what it behaves\n * like from the user's side.\n */\nexport function TopBarSearch(props: TopBarSearchProps) {\n const [local, rest] = splitProps(props, ['class', 'placeholder', 'shortcut', 'keyshortcuts'])\n\n return (\n <button\n type=\"button\"\n data-slot=\"top-bar-search\"\n class={cn(\n 'text-muted-foreground flex h-control-md w-full min-w-(--control-height-md) items-center justify-center gap-2 rounded-md border border-input px-3 text-sm sm:justify-start',\n 'transition-colors ease-out outline-none',\n 'hover:bg-surface-hover hover:text-foreground',\n 'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle',\n 'window-no-drag',\n local.class\n )}\n aria-keyshortcuts={local.keyshortcuts}\n {...rest}\n >\n <Search aria-hidden=\"true\" class=\"size-4 shrink-0 sm:hidden\" />\n <span class=\"sr-only sm:not-sr-only sm:truncate\">{local.placeholder ?? 'Search'}</span>\n <Show when={local.shortcut}>\n <kbd\n aria-hidden=\"true\"\n class=\"bg-muted ms-auto hidden h-5 shrink-0 items-center rounded-sm border border-border px-1.5 font-code text-code sm:flex\"\n >\n {local.shortcut}\n </kbd>\n </Show>\n </button>\n )\n}\n\n/**\n * A labelled top-bar control — the readouts KiroCrew puts in the trailing\n * group. Container queries on the group decide which of these survive a narrow\n * window; a caller marks the cheap-to-drop ones and the group handles the rest.\n */\nexport function TopBarPill(props: ComponentProps<'button'> & { label: string }) {\n const [local, rest] = splitProps(props, ['class', 'label', 'children'])\n\n return (\n <button\n type=\"button\"\n data-slot=\"top-bar-pill\"\n class={cn(\n 'text-muted-foreground inline-flex h-control-sm shrink-0 items-center gap-1.5 rounded-md border border-border px-2.5 text-xs font-medium',\n 'transition-colors ease-out outline-none',\n 'hover:border-input hover:text-foreground',\n 'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle',\n 'window-no-drag [&_svg]:size-3.5 [&_svg]:shrink-0',\n local.class\n )}\n {...rest}\n >\n {local.children}\n <span>{local.label}</span>\n </button>\n )\n}\n"],"mappings":";;;;;;;;;;;;AA+BA,SAAgBU,OAAOC,OAAoB;CACzC,MAAM,CAACC,OAAOC,QAAQX,WAAWS,OAAO;EACtC;EACA;EACA;EACA;EACA;CAAO,CACR;CAED,cAAA;EAAA,IAAAG,OAAAC,OAAA;EAAAC,OAAAF,MAAAG,WAAA,EAAA,KAAA,WAAA;GAAA,OAGWb,GACL,8OACAQ,MAAMH,SAAS,eACfG,MAAMN,aAAa,eACnBM,MAAML,cAAc,sBACpBK,MAAMJ,gBAAgB,wBACtBI,MAAMM,KACR;EAAC,EAAA,GACGL,IAAI,GAAA,OAAA,KAAA;EAAA,OAAAC;CAAA,EAAA,CAAA;AAGd;AAEA,SAASK,mBAAmBC,SAAkBC,OAAc;CAC1D,IAAIE,MAAMC,QAAQJ,OAAO,GAAG;EAC1B,MAAM,CAACK,UAAUC,QAAQN;EACzBK,SAASC,MAAML,KAAK;CACtB,OAAO,IAAI,OAAOD,YAAY,YAE5BK,QAASJ,KAAK;AAElB;;AAGA,SAAgBM,cAAchB,OAA4D;CACxF,MAAM,CAACC,OAAOC,QAAQX,WAAWS,OAAO;EAAC;EAAS;EAAS;CAAW,CAA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AAA,IAAAsC,QAAAC,QAAA,GAAAC,QAAAF,MAAAG;EAAApC,OAAAiC,OAAAhC,WAAA;GAAA,KAAA,WAAA;IAAA,OAIWb,GACL,6KACA,2CACA,gDACA,oFACA,kBACAQ,MAAMM,KACR;GAAC;GAAA,KAAA,uBAAA;IAAA,OACkBN,MAAMmC;GAAY;EAAA,GACjClC,IAAI,GAAA,OAAA,IAAA;EAAAyC,OAAAL,OAAAM,gBAEPpD,QAAM;GAAA,eAAA;GAAA,SAAA;EAAA,CAAA,GAAAgD,KAAA;EAAAG,OAAAH,aAC2CvC,MAAMiC,eAAe,QAAQ;EAAAS,OAAAL,OAAAM,gBAC9EtD,MAAI;GAAA,IAACuD,OAAI;IAAA,OAAE5C,MAAMkC;GAAQ;GAAA,IAAAW,WAAA;IAAA,IAAAC,QAAAC,QAAA;IAAAL,OAAAI,aAKrB9C,MAAMkC,QAAQ;IAAA,OAAAY;GAAA;EAAA,CAAA,GAAA,IAAA;EAAA,OAAAT;CAAA,EAAA,CAAA;AAKzB;;;;;;AAOA,SAAgBW,WAAWjD,OAAqD;CAC9E,MAAM,CAACC,OAAOC,QAAQX,WAAWS,OAAO;EAAC;EAAS;EAAS;CAAU,CAAC;CAEtE,cAAA;EAAA,IAAAmD,QAAAC,QAAA,GAAAC,QAAAF,MAAAV;EAAApC,OAAA8C,OAAA7C,WAAA,EAAA,KAAA,WAAA;GAAA,OAIWb,GACL,2IACA,2CACA,4CACA,oFACA,oDACAQ,MAAMM,KACR;EAAC,EAAA,GACGL,IAAI,GAAA,OAAA,IAAA;EAAAyC,OAAAQ,aAEPlD,MAAM6C,UAAQO,KAAA;EAAAV,OAAAU,aACRpD,MAAMiD,KAAK;EAAA,OAAAC;CAAA,EAAA,CAAA;AAGxB;AAACG,eAAA,CAAA,SAAA,CAAA"}
@@ -16,7 +16,7 @@ import type { ComponentProps } from 'solid-js';
16
16
  * setting that keeps changing.
17
17
  * 3. **Accent** — adea's presets, then the accents the selected theme pair
18
18
  * carries itself, layered on whichever theme is active.
19
- * 4. **Font** — the interface face.
19
+ * 4. **Fonts** — separate families and sizes for interface, content and code.
20
20
  *
21
21
  * The panel reads and writes the provider's preference and keeps no state of its
22
22
  * own, so it cannot disagree with what is applied.
@@ -1 +1 @@
1
- {"version":3,"file":"appearance-panel.d.ts","sourceRoot":"","sources":["../../../src/components/theme/appearance-panel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAW9C;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,MAAM,oBAAoB,GAAG,cAAc,CAAC,KAAK,CAAC,CAAA;AAKxD,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,kCA8H1D"}
1
+ {"version":3,"file":"appearance-panel.d.ts","sourceRoot":"","sources":["../../../src/components/theme/appearance-panel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAc9C;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,MAAM,oBAAoB,GAAG,cAAc,CAAC,KAAK,CAAC,CAAA;AAKxD,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,kCAwG1D"}