neba 1.12.0 → 1.15.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 (348) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +50 -56
  3. package/dist/a2ui/catalog.json +1466 -0
  4. package/dist/a2ui/components.d.ts +21 -0
  5. package/dist/a2ui/components.js +1 -0
  6. package/dist/a2ui/index.d.ts +62 -0
  7. package/dist/a2ui/index.js +1 -0
  8. package/dist/a2ui/schema.d.ts +47 -0
  9. package/dist/a2ui/schema.js +1 -0
  10. package/dist/components/accordion/Accordion.d.ts +23 -1
  11. package/dist/components/accordion/Accordion.js +1 -1
  12. package/dist/components/agent-steps/AgentSteps.d.ts +80 -0
  13. package/dist/components/agent-steps/AgentSteps.js +1 -0
  14. package/dist/components/agent-steps/index.d.ts +2 -0
  15. package/dist/components/agent-steps/index.js +1 -0
  16. package/dist/components/alert/Alert.js +1 -1
  17. package/dist/components/anchor/Anchor.d.ts +3 -2
  18. package/dist/components/anchor/Anchor.js +1 -1
  19. package/dist/components/animate-appear/AnimateAppear.js +1 -1
  20. package/dist/components/animate-blink/AnimateBlink.d.ts +3 -0
  21. package/dist/components/animate-blink/AnimateBlink.js +1 -1
  22. package/dist/components/animate-counter/AnimateCounter.d.ts +3 -1
  23. package/dist/components/animate-counter/AnimateCounter.js +1 -1
  24. package/dist/components/animate-fade/AnimateFade.js +1 -1
  25. package/dist/components/animate-float/AnimateFloat.js +1 -1
  26. package/dist/components/animate-grow/AnimateGrow.js +1 -1
  27. package/dist/components/animate-headline/AnimateHeadline.d.ts +9 -2
  28. package/dist/components/animate-headline/AnimateHeadline.js +1 -1
  29. package/dist/components/animate-lighting/AnimateLighting.d.ts +1 -1
  30. package/dist/components/animate-lighting/AnimateLighting.js +1 -1
  31. package/dist/components/animate-marquee/AnimateMarquee.d.ts +19 -8
  32. package/dist/components/animate-marquee/AnimateMarquee.js +1 -1
  33. package/dist/components/animate-reveal/AnimateReveal.js +1 -1
  34. package/dist/components/animate-rotate/AnimateRotate.js +1 -1
  35. package/dist/components/animate-scramble/AnimateScramble.d.ts +5 -3
  36. package/dist/components/animate-scramble/AnimateScramble.js +1 -1
  37. package/dist/components/animate-shake/AnimateShake.js +1 -1
  38. package/dist/components/animate-slide/AnimateSlide.js +1 -1
  39. package/dist/components/animate-split/AnimateSplit.d.ts +3 -1
  40. package/dist/components/animate-split/AnimateSplit.js +1 -1
  41. package/dist/components/animate-typing/AnimateTyping.d.ts +12 -4
  42. package/dist/components/animate-typing/AnimateTyping.js +1 -1
  43. package/dist/components/animate-zoom/AnimateZoom.js +1 -1
  44. package/dist/components/app-logo/AppLogo.js +1 -1
  45. package/dist/components/approval/Approval.d.ts +115 -0
  46. package/dist/components/approval/Approval.js +1 -0
  47. package/dist/components/approval/index.d.ts +2 -0
  48. package/dist/components/approval/index.js +1 -0
  49. package/dist/components/area-chart/AreaChart.js +1 -1
  50. package/dist/components/aspect-ratio/AspectRatio.d.ts +6 -4
  51. package/dist/components/aspect-ratio/AspectRatio.js +1 -1
  52. package/dist/components/avatar/Avatar.js +1 -1
  53. package/dist/components/badge/Badge.js +1 -1
  54. package/dist/components/bar-chart/BarChart.d.ts +1 -1
  55. package/dist/components/bar-chart/BarChart.js +1 -1
  56. package/dist/components/blockquote/Blockquote.js +1 -1
  57. package/dist/components/bottom-navigation/BottomNavigation.d.ts +12 -1
  58. package/dist/components/bottom-navigation/BottomNavigation.js +1 -1
  59. package/dist/components/box/Box.d.ts +5 -0
  60. package/dist/components/box/Box.js +1 -1
  61. package/dist/components/breadcrumb/Breadcrumb.d.ts +10 -0
  62. package/dist/components/breadcrumb/Breadcrumb.js +1 -1
  63. package/dist/components/button/Button.d.ts +11 -0
  64. package/dist/components/button/Button.js +1 -1
  65. package/dist/components/button-group/ButtonGroup.js +1 -1
  66. package/dist/components/calendar/Calendar.js +1 -1
  67. package/dist/components/card/Card.js +1 -1
  68. package/dist/components/carousel/Carousel.d.ts +17 -0
  69. package/dist/components/carousel/Carousel.js +1 -1
  70. package/dist/components/chat-bubble/ChatBubble.js +1 -1
  71. package/dist/components/checkbox/Checkbox.js +1 -1
  72. package/dist/components/chip/Chip.d.ts +3 -1
  73. package/dist/components/chip/Chip.js +1 -1
  74. package/dist/components/code-block/CodeBlock.d.ts +6 -3
  75. package/dist/components/code-block/CodeBlock.js +1 -1
  76. package/dist/components/collapsible/Collapsible.d.ts +11 -1
  77. package/dist/components/collapsible/Collapsible.js +1 -1
  78. package/dist/components/color-picker/ColorPicker.js +1 -1
  79. package/dist/components/combobox/Combobox.d.ts +29 -1
  80. package/dist/components/combobox/Combobox.js +1 -1
  81. package/dist/components/command-palette/CommandPalette.js +1 -1
  82. package/dist/components/confirm/Confirm.js +1 -1
  83. package/dist/components/container/Container.js +1 -1
  84. package/dist/components/context-window/ContextWindow.d.ts +103 -0
  85. package/dist/components/context-window/ContextWindow.js +1 -0
  86. package/dist/components/context-window/index.d.ts +2 -0
  87. package/dist/components/context-window/index.js +1 -0
  88. package/dist/components/data-list/DataList.js +1 -1
  89. package/dist/components/data-table/DataTable.d.ts +12 -1
  90. package/dist/components/data-table/DataTable.js +1 -1
  91. package/dist/components/date-picker/DatePicker.js +1 -1
  92. package/dist/components/date-range-picker/DateRangePicker.js +1 -1
  93. package/dist/components/date-time-picker/DateTimePicker.js +1 -1
  94. package/dist/components/dialog/Dialog.d.ts +12 -0
  95. package/dist/components/dialog/Dialog.js +1 -1
  96. package/dist/components/divider/Divider.js +1 -1
  97. package/dist/components/drawer/Drawer.d.ts +7 -0
  98. package/dist/components/drawer/Drawer.js +1 -1
  99. package/dist/components/empty/Empty.js +1 -1
  100. package/dist/components/fieldset/Fieldset.js +1 -1
  101. package/dist/components/file-picker/FilePicker.d.ts +12 -4
  102. package/dist/components/file-picker/FilePicker.js +1 -1
  103. package/dist/components/flex/Flex.d.ts +8 -2
  104. package/dist/components/flex/Flex.js +1 -1
  105. package/dist/components/floating-action-button/FloatingActionButton.d.ts +16 -1
  106. package/dist/components/floating-action-button/FloatingActionButton.js +1 -1
  107. package/dist/components/floating-bottom-navigation/FloatingBottomNavigation.js +1 -1
  108. package/dist/components/footer/Footer.d.ts +8 -0
  109. package/dist/components/footer/Footer.js +1 -1
  110. package/dist/components/form/Form.d.ts +4 -2
  111. package/dist/components/form/Form.js +1 -1
  112. package/dist/components/gallery/Gallery.d.ts +56 -3
  113. package/dist/components/gallery/Gallery.js +1 -1
  114. package/dist/components/gallery/GalleryViewer.js +1 -1
  115. package/dist/components/gauge-chart/GaugeChart.js +1 -1
  116. package/dist/components/grid/Grid.d.ts +11 -1
  117. package/dist/components/grid/Grid.js +1 -1
  118. package/dist/components/grid-container/GridContainer.js +1 -1
  119. package/dist/components/header/Header.js +1 -1
  120. package/dist/components/heatmap-chart/HeatmapChart.js +1 -1
  121. package/dist/components/highlight/Highlight.js +1 -1
  122. package/dist/components/hover-card/HoverCard.js +1 -1
  123. package/dist/components/how-to-steps/HowToSteps.d.ts +26 -1
  124. package/dist/components/how-to-steps/HowToSteps.js +1 -1
  125. package/dist/components/icon/Icon.js +1 -1
  126. package/dist/components/icon-button/IconButton.d.ts +0 -20
  127. package/dist/components/icon-button/IconButton.js +1 -1
  128. package/dist/components/image/Image.d.ts +162 -8
  129. package/dist/components/image/Image.js +1 -1
  130. package/dist/components/image/index.d.ts +1 -1
  131. package/dist/components/inline-citation/InlineCitation.d.ts +53 -0
  132. package/dist/components/inline-citation/InlineCitation.js +1 -0
  133. package/dist/components/inline-citation/index.d.ts +2 -0
  134. package/dist/components/inline-citation/index.js +1 -0
  135. package/dist/components/list/List.js +1 -1
  136. package/dist/components/menu/Menu.d.ts +7 -4
  137. package/dist/components/menu/Menu.js +1 -1
  138. package/dist/components/menubar/Menubar.js +1 -1
  139. package/dist/components/meter/Meter.d.ts +13 -0
  140. package/dist/components/meter/Meter.js +1 -1
  141. package/dist/components/mockup/Mockup.js +1 -1
  142. package/dist/components/navigation-menu/NavigationMenu.d.ts +10 -1
  143. package/dist/components/navigation-menu/NavigationMenu.js +1 -1
  144. package/dist/components/number-field/NumberField.d.ts +20 -6
  145. package/dist/components/number-field/NumberField.js +1 -1
  146. package/dist/components/otp-field/OtpField.d.ts +7 -0
  147. package/dist/components/otp-field/OtpField.js +1 -1
  148. package/dist/components/overlay/Overlay.d.ts +1 -1
  149. package/dist/components/overlay/Overlay.js +1 -1
  150. package/dist/components/page-layout/PageLayout.d.ts +11 -0
  151. package/dist/components/page-layout/PageLayout.js +1 -1
  152. package/dist/components/pagination/Pagination.js +1 -1
  153. package/dist/components/panes/Panes.d.ts +11 -0
  154. package/dist/components/panes/Panes.js +1 -1
  155. package/dist/components/pie-chart/PieChart.d.ts +5 -3
  156. package/dist/components/pie-chart/PieChart.js +1 -1
  157. package/dist/components/pill/Pill.d.ts +8 -0
  158. package/dist/components/pill/Pill.js +1 -1
  159. package/dist/components/popconfirm/Popconfirm.d.ts +10 -3
  160. package/dist/components/popconfirm/Popconfirm.js +1 -1
  161. package/dist/components/popover/Popover.d.ts +8 -1
  162. package/dist/components/popover/Popover.js +1 -1
  163. package/dist/components/portal/Portal.js +1 -1
  164. package/dist/components/progress-box/ProgressBox.js +1 -1
  165. package/dist/components/progress-circular/ProgressCircular.d.ts +10 -1
  166. package/dist/components/progress-circular/ProgressCircular.js +1 -1
  167. package/dist/components/progress-linear/ProgressLinear.d.ts +7 -1
  168. package/dist/components/progress-linear/ProgressLinear.js +1 -1
  169. package/dist/components/prompt-input/PromptInput.d.ts +104 -0
  170. package/dist/components/prompt-input/PromptInput.js +1 -0
  171. package/dist/components/prompt-input/index.d.ts +2 -0
  172. package/dist/components/prompt-input/index.js +1 -0
  173. package/dist/components/provider/NebaProvider.d.ts +3 -3
  174. package/dist/components/provider/NebaProvider.js +1 -1
  175. package/dist/components/radio-group/RadioGroup.js +1 -1
  176. package/dist/components/rating/Rating.d.ts +4 -1
  177. package/dist/components/rating/Rating.js +1 -1
  178. package/dist/components/reasoning/Reasoning.d.ts +78 -0
  179. package/dist/components/reasoning/Reasoning.js +1 -0
  180. package/dist/components/reasoning/index.d.ts +2 -0
  181. package/dist/components/reasoning/index.js +1 -0
  182. package/dist/components/scatter-chart/ScatterChart.js +1 -1
  183. package/dist/components/scroll-area/ScrollArea.js +1 -1
  184. package/dist/components/scroll-zone/ScrollZone.d.ts +18 -7
  185. package/dist/components/scroll-zone/ScrollZone.js +1 -1
  186. package/dist/components/segmented-button/SegmentedButton.js +1 -1
  187. package/dist/components/select/Select.d.ts +13 -0
  188. package/dist/components/select/Select.js +1 -1
  189. package/dist/components/shortcut/Shortcut.js +1 -1
  190. package/dist/components/show/Show.d.ts +6 -5
  191. package/dist/components/show/Show.js +1 -1
  192. package/dist/components/sidebar/Sidebar.d.ts +7 -5
  193. package/dist/components/sidebar/Sidebar.js +1 -1
  194. package/dist/components/sidebar/SidebarTrigger.js +1 -1
  195. package/dist/components/skeleton/Skeleton.d.ts +1 -1
  196. package/dist/components/skeleton/Skeleton.js +1 -1
  197. package/dist/components/slider/Slider.d.ts +49 -2
  198. package/dist/components/slider/Slider.js +1 -1
  199. package/dist/components/sources/Sources.d.ts +78 -0
  200. package/dist/components/sources/Sources.js +1 -0
  201. package/dist/components/sources/index.d.ts +2 -0
  202. package/dist/components/sources/index.js +1 -0
  203. package/dist/components/sparkline/Sparkline.js +1 -1
  204. package/dist/components/spoiler/Spoiler.js +1 -1
  205. package/dist/components/stack/Stack.d.ts +2 -2
  206. package/dist/components/stack/Stack.js +1 -1
  207. package/dist/components/statistic/Statistic.js +1 -1
  208. package/dist/components/streaming-text/StreamingText.d.ts +75 -0
  209. package/dist/components/streaming-text/StreamingText.js +1 -0
  210. package/dist/components/streaming-text/index.d.ts +2 -0
  211. package/dist/components/streaming-text/index.js +1 -0
  212. package/dist/components/switch/Switch.js +1 -1
  213. package/dist/components/table/Table.d.ts +8 -2
  214. package/dist/components/table/Table.js +1 -1
  215. package/dist/components/tabs/Tabs.d.ts +18 -0
  216. package/dist/components/tabs/Tabs.js +1 -1
  217. package/dist/components/text-field/TextField.js +1 -1
  218. package/dist/components/text-link/TextLink.js +1 -1
  219. package/dist/components/time-picker/TimePicker.js +1 -1
  220. package/dist/components/timeline/Timeline.d.ts +8 -0
  221. package/dist/components/timeline/Timeline.js +1 -1
  222. package/dist/components/timeline-chart/TimelineChart.js +1 -1
  223. package/dist/components/toast/Toast.d.ts +9 -3
  224. package/dist/components/toast/Toast.js +1 -1
  225. package/dist/components/toggle/Toggle.js +1 -1
  226. package/dist/components/toggle-group/ToggleGroup.js +1 -1
  227. package/dist/components/tool-call/ToolCall.d.ts +104 -0
  228. package/dist/components/tool-call/ToolCall.js +1 -0
  229. package/dist/components/tool-call/index.d.ts +2 -0
  230. package/dist/components/tool-call/index.js +1 -0
  231. package/dist/components/toolbar/Toolbar.d.ts +8 -0
  232. package/dist/components/toolbar/Toolbar.js +1 -1
  233. package/dist/components/tooltip/Tooltip.js +1 -1
  234. package/dist/components/tour/Tour.d.ts +2 -0
  235. package/dist/components/tour/Tour.js +1 -1
  236. package/dist/components/transfer/Transfer.js +1 -1
  237. package/dist/components/tree-select/TreeSelect.d.ts +2 -0
  238. package/dist/components/tree-select/TreeSelect.js +1 -1
  239. package/dist/components/tree-view/TreeView.d.ts +6 -0
  240. package/dist/components/tree-view/TreeView.js +1 -1
  241. package/dist/components/typography/Typography.js +1 -1
  242. package/dist/components/visually-hidden/VisuallyHidden.d.ts +9 -7
  243. package/dist/components/visually-hidden/VisuallyHidden.js +1 -1
  244. package/dist/components/window-pane/WindowPane.d.ts +2 -2
  245. package/dist/components/window-pane/WindowPane.js +1 -1
  246. package/dist/hooks/useElementSize.d.ts +3 -1
  247. package/dist/hooks/useElementSize.js +1 -1
  248. package/dist/hooks/useOnScreen.d.ts +3 -0
  249. package/dist/hooks/useOnScreen.js +1 -1
  250. package/dist/index.d.ts +9 -0
  251. package/dist/index.js +1 -1
  252. package/dist/internal/animate.d.ts +63 -16
  253. package/dist/internal/animate.js +1 -1
  254. package/dist/internal/cache.d.ts +24 -0
  255. package/dist/internal/cache.js +1 -0
  256. package/dist/internal/calendar.d.ts +21 -43
  257. package/dist/internal/calendar.js +1 -1
  258. package/dist/internal/chart-frame.d.ts +80 -25
  259. package/dist/internal/chart-frame.js +1 -1
  260. package/dist/internal/chart-line.js +1 -1
  261. package/dist/internal/chart.d.ts +55 -4
  262. package/dist/internal/chart.js +1 -1
  263. package/dist/internal/children.d.ts +15 -0
  264. package/dist/internal/children.js +1 -0
  265. package/dist/internal/color.d.ts +4 -0
  266. package/dist/internal/color.js +1 -1
  267. package/dist/internal/csv.d.ts +12 -1
  268. package/dist/internal/csv.js +1 -1
  269. package/dist/internal/data-table.d.ts +28 -10
  270. package/dist/internal/data-table.js +1 -1
  271. package/dist/internal/date.d.ts +12 -5
  272. package/dist/internal/date.js +1 -1
  273. package/dist/internal/defaults.d.ts +6 -1
  274. package/dist/internal/defaults.js +1 -1
  275. package/dist/internal/drag.d.ts +21 -7
  276. package/dist/internal/drag.js +1 -1
  277. package/dist/internal/drop.d.ts +61 -0
  278. package/dist/internal/drop.js +1 -0
  279. package/dist/internal/fieldset.d.ts +13 -0
  280. package/dist/internal/fieldset.js +1 -0
  281. package/dist/internal/format.d.ts +21 -7
  282. package/dist/internal/format.js +1 -1
  283. package/dist/internal/glow.d.ts +58 -0
  284. package/dist/internal/glow.js +1 -0
  285. package/dist/internal/grid.d.ts +16 -0
  286. package/dist/internal/grid.js +1 -1
  287. package/dist/internal/highlight.js +1 -1
  288. package/dist/internal/i18n.d.ts +302 -11
  289. package/dist/internal/i18n.js +1 -1
  290. package/dist/internal/icons.d.ts +38 -2
  291. package/dist/internal/icons.js +1 -1
  292. package/dist/internal/inert.d.ts +13 -0
  293. package/dist/internal/inert.js +1 -0
  294. package/dist/internal/initials.d.ts +8 -3
  295. package/dist/internal/initials.js +1 -1
  296. package/dist/internal/keys.d.ts +13 -0
  297. package/dist/internal/keys.js +1 -1
  298. package/dist/internal/link.d.ts +13 -14
  299. package/dist/internal/link.js +1 -1
  300. package/dist/internal/media.d.ts +9 -17
  301. package/dist/internal/media.js +1 -1
  302. package/dist/internal/menu.d.ts +6 -1
  303. package/dist/internal/mockup.d.ts +5 -4
  304. package/dist/internal/mockup.js +1 -1
  305. package/dist/internal/observe.d.ts +12 -0
  306. package/dist/internal/observe.js +1 -1
  307. package/dist/internal/page-layout.d.ts +10 -8
  308. package/dist/internal/page-layout.js +1 -1
  309. package/dist/internal/picker.d.ts +8 -3
  310. package/dist/internal/picker.js +1 -1
  311. package/dist/internal/progress.d.ts +35 -6
  312. package/dist/internal/progress.js +1 -1
  313. package/dist/internal/responsive.d.ts +0 -8
  314. package/dist/internal/responsive.js +1 -1
  315. package/dist/internal/run.d.ts +71 -0
  316. package/dist/internal/run.js +1 -0
  317. package/dist/internal/screen.d.ts +12 -0
  318. package/dist/internal/screen.js +1 -0
  319. package/dist/internal/styles.d.ts +245 -4
  320. package/dist/internal/styles.js +1 -1
  321. package/dist/internal/text.d.ts +3 -13
  322. package/dist/internal/text.js +1 -1
  323. package/dist/internal/wheel.d.ts +38 -0
  324. package/dist/internal/wheel.js +1 -0
  325. package/dist/internal/window.js +1 -1
  326. package/dist/locales/ar.js +1 -1
  327. package/dist/locales/de.js +1 -1
  328. package/dist/locales/es.js +1 -1
  329. package/dist/locales/fr.js +1 -1
  330. package/dist/locales/hi.js +1 -1
  331. package/dist/locales/id.js +1 -1
  332. package/dist/locales/it.js +1 -1
  333. package/dist/locales/ja.js +1 -1
  334. package/dist/locales/ko.js +1 -1
  335. package/dist/locales/nl.js +1 -1
  336. package/dist/locales/pl.js +1 -1
  337. package/dist/locales/pt.js +1 -1
  338. package/dist/locales/ru.js +1 -1
  339. package/dist/locales/th.js +1 -1
  340. package/dist/locales/tr.js +1 -1
  341. package/dist/locales/vi.js +1 -1
  342. package/dist/locales/zh-hans.js +1 -1
  343. package/dist/locales/zh-hant.js +1 -1
  344. package/dist/styles.css +1 -1
  345. package/dist/tailwind.css +632 -59
  346. package/dist/types.d.ts +34 -7
  347. package/dist/types.js +0 -8
  348. package/package.json +44 -10
@@ -1 +1 @@
1
- export const dataRowHeights={default:{xs:24,sm:28,md:32,lg:38,xl:44},compact:{xs:20,sm:24,md:28,lg:32,xl:38}};export const dataHeaderHeights={default:{xs:28,sm:32,md:36,lg:42,xl:48},compact:{xs:24,sm:28,md:32,lg:36,xl:42}};export const dataTickWidths={xs:30,sm:34,md:38,lg:42,xl:50};export const defaultColumnWidth=160;export const minColumnWidth=48;export function compareValues(t,e,n){const o=null==t||""===t,r=null==e||""===e;return o||r?o&&r?0:o?1:-1:"number"==typeof t&&"number"==typeof e?Number.isNaN(t)||Number.isNaN(e)?Number.isNaN(t)&&Number.isNaN(e)?0:Number.isNaN(t)?1:-1:t-e:"boolean"==typeof t&&"boolean"==typeof e?Number(t)-Number(e):t instanceof Date&&e instanceof Date?t.getTime()-e.getTime():n.compare(String(t),String(e))}export function sortRows(t,e,n){if(0===e.length)return t;const o=e.map(t=>{const e=n(t.key);return e?{compare:e,sign:"desc"===t.direction?-1:1}:null}).filter(t=>null!==t);return 0===o.length?t:[...t].sort((t,e)=>{for(const n of o){const o=n.compare(t,e);if(0!==o)return o*n.sign}return 0})}export function nextSort(t,e,n){const o=t.find(t=>t.key===e),r=void 0===o?"asc":"asc"===o.direction?"desc":null;return n?null===r?t.filter(t=>t.key!==e):void 0===o?[...t,{key:e,direction:r}]:t.map(t=>t.key===e?{key:e,direction:r}:t):null===r?[]:[{key:e,direction:r}]}export function pageBounds(t,e,n){const o=Math.max(1,Math.floor(n)),r=Math.max(1,Math.ceil(t/o)),a=Math.min(Math.max(Math.floor(e),1),r),i=(a-1)*o;return{pages:r,page:a,start:i,end:Math.min(i+o,t)}}export function virtualWindow(t,e,n,o,r){const a=e>0?Math.ceil(e/n):3*r,i=Math.max(0,Math.floor(t/n)-r),s=Math.min(o,i+a+2*r);return{start:i,end:s,before:i*n,after:Math.max(0,(o-s)*n)}}export function keysBetween(t,e,n){const o=t.indexOf(e),r=t.indexOf(n);return-1===o||-1===r?[]:t.slice(Math.min(o,r),Math.max(o,r)+1)}
1
+ export const dataRowHeights={default:{xs:24,sm:28,md:32,lg:38,xl:44},compact:{xs:20,sm:24,md:28,lg:32,xl:38}};export const dataHeaderHeights={default:{xs:28,sm:32,md:36,lg:42,xl:48},compact:{xs:24,sm:28,md:32,lg:36,xl:42}};export const dataTickWidths={xs:30,sm:34,md:38,lg:42,xl:50};export const defaultColumnWidth=160;export const minColumnWidth=48;export function compareValues(t,e,n){const o=isEmptyValue(t),r=isEmptyValue(e);return o||r?o&&r?0:o?1:-1:"number"==typeof t&&"number"==typeof e?t-e:"boolean"==typeof t&&"boolean"==typeof e?Number(t)-Number(e):t instanceof Date&&e instanceof Date?t.getTime()-e.getTime():n.compare(String(t),String(e))}export function isEmptyValue(t){return null==t||""===t||"number"==typeof t&&Number.isNaN(t)}export function sortRows(t,e,n){if(0===e.length)return t;const o=e.map(t=>{const e=n(t.key);if(!e)return null;const o="desc"===t.direction?-1:1;return"function"==typeof e?{compare:e,isEmpty:null,sign:o}:{compare:e.compare,isEmpty:e.isEmpty,sign:o}}).filter(t=>null!==t);return 0===o.length?t:[...t].sort((t,e)=>{for(const n of o){if(n.isEmpty){const o=n.isEmpty(t);if(o!==n.isEmpty(e))return o?1:-1;if(o)continue}const o=n.compare(t,e);if(0!==o)return o*n.sign}return 0})}export function nextSort(t,e,n){const o=t.find(t=>t.key===e),r=void 0===o?"asc":"asc"===o.direction?"desc":null;return n?null===r?t.filter(t=>t.key!==e):void 0===o?[...t,{key:e,direction:r}]:t.map(t=>t.key===e?{key:e,direction:r}:t):null===r?[]:[{key:e,direction:r}]}export function pageBounds(t,e,n){const o=Math.max(1,Math.floor(n)),r=Math.max(1,Math.ceil(t/o)),i=Math.min(Math.max(Math.floor(e),1),r),a=(i-1)*o;return{pages:r,page:i,start:a,end:Math.min(a+o,t)}}export function virtualWindow(t,e,n,o,r){const i=e>0?Math.ceil(e/n):3*r,a=Math.min(Math.floor(t/n),Math.max(0,o-i)),s=Math.max(0,a-r),m=Math.min(o,s+i+2*r);return{start:s,end:m,before:s*n,after:Math.max(0,(o-m)*n)}}export function keysBetween(t,e,n){const o=t.indexOf(e),r=t.indexOf(n);return-1===o||-1===r?[]:t.slice(Math.min(o,r),Math.max(o,r)+1)}
@@ -72,8 +72,6 @@ export declare function addYears(date: Date, amount: number): Date;
72
72
  export declare function compareDay(a: Date, b: Date): number;
73
73
  export declare function isSameDay(a: Date | null | undefined, b: Date | null | undefined): boolean;
74
74
  export declare function isSameMonth(a: Date | null | undefined, b: Date | null | undefined): boolean;
75
- /** Strictly between the two ends, both of which are optional. */
76
- export declare function isDayInRange(date: Date, start: Date | null, end: Date | null): boolean;
77
75
  /** Holds a date inside `[min, max]`, at whatever precision the bounds carry. */
78
76
  export declare function clampDate(date: Date, min?: Date | null, max?: Date | null): Date;
79
77
  /**
@@ -98,8 +96,6 @@ export declare function isDayOutside(date: Date, min?: Date | null, max?: Date |
98
96
  * At `day` granularity this is `isDayOutside` exactly.
99
97
  */
100
98
  export declare function isUnitOutside(date: Date, granularity: NebaDateGranularity, min?: Date | null, max?: Date | null): boolean;
101
- /** Minutes since local midnight — what `minTime`/`maxTime` are compared on. */
102
- export declare function minutesOfDay(date: Date): number;
103
99
  /** Seconds since local midnight, for the pickers that show a seconds column. */
104
100
  export declare function secondsOfDay(date: Date): number;
105
101
  /** Which column of a clock a candidate time is being offered for. */
@@ -115,6 +111,16 @@ export type TimeUnit = 'hour' | 'minute' | 'second' | 'meridiem';
115
111
  * candidate instead hides the 9 and makes half past nine unreachable.
116
112
  */
117
113
  export declare function timeUnitSpan(unit: TimeUnit, at: Date): [number, number];
114
+ /**
115
+ * The same span as `timeUnitSpan`, as the two instants on `at`'s day.
116
+ *
117
+ * A picker comparing a row with a bound that carries a date has to leave seconds
118
+ * of the day behind, and the step that looks equivalent — midnight plus that
119
+ * many seconds — is an hour out on a day the clocks change, because that day is
120
+ * 23 or 25 hours long. Setting the clock fields lands on the wall-clock time the
121
+ * row is labelled with.
122
+ */
123
+ export declare function timeUnitRange(unit: TimeUnit, at: Date): [Date, Date];
118
124
  /** The same instant with one or more clock fields replaced. */
119
125
  export declare function withTime(date: Date, parts: {
120
126
  hours?: number;
@@ -140,7 +146,8 @@ export declare function yearPageStart(year: number): number;
140
146
  export declare function formatDate(date: Date | null | undefined, locale: string | undefined, options: Intl.DateTimeFormatOptions): string;
141
147
  /**
142
148
  * Every distinct string those instants format to. Deduplicated, because a
143
- * date-only format collapses twenty-four of them into a handful.
149
+ * date-only format collapses the samples into a handful. Built once per
150
+ * formatter, since a picker asks on every render.
144
151
  */
145
152
  export declare function displaySamples(locale: string | undefined, options: Intl.DateTimeFormatOptions): string[];
146
153
  /**
@@ -1 +1 @@
1
- import{dateFormatter as t}from"./format.js";export const YEAR_PAGE_SIZE=12;export function makeDate(t,e,r){const n=new Date(0);return n.setFullYear(t,e,r),n.setHours(0,0,0,0),n}export function isValidDate(t){return t instanceof Date&&!Number.isNaN(t.getTime())}export function startOfDay(t){const e=new Date(t.getTime());return e.setHours(0,0,0,0),e}export function startOfMonth(t){return makeDate(t.getFullYear(),t.getMonth(),1)}export function startOfYear(t){return makeDate(t.getFullYear(),0,1)}export function startOfUnit(t,e){return"year"===e?startOfYear(t):"month"===e?startOfMonth(t):startOfDay(t)}export function endOfUnit(t,e){const r=t.getFullYear();return"year"===e?makeDate(r,11,31):"month"===e?makeDate(r,t.getMonth(),daysInMonth(r,t.getMonth())):startOfDay(t)}export function daysInMonth(t,e){return makeDate(t,e+1,0).getDate()}export function today(){return startOfDay(new Date)}export function addDays(t,e){const r=new Date(t.getTime());return r.setDate(r.getDate()+e),r}export function addMonths(t,e){const r=t.getFullYear(),n=t.getMonth()+e,o=new Date(t.getTime()),a=makeDate(r,n,1);return o.setFullYear(a.getFullYear(),a.getMonth(),Math.min(t.getDate(),daysInMonth(a.getFullYear(),a.getMonth()))),o}export function addYears(t,e){return addMonths(t,12*e)}export function compareDay(t,e){return startOfDay(t).getTime()-startOfDay(e).getTime()}export function isSameDay(t,e){return isValidDate(t)&&isValidDate(e)&&0===compareDay(t,e)}export function isSameMonth(t,e){return isValidDate(t)&&isValidDate(e)&&t.getFullYear()===e.getFullYear()&&t.getMonth()===e.getMonth()}export function isDayInRange(t,e,r){return!(!isValidDate(e)||!isValidDate(r))&&(compareDay(t,e)>0&&compareDay(t,r)<0)}export function clampDate(t,e,r){return isValidDate(e)&&t.getTime()<e.getTime()?new Date(e.getTime()):isValidDate(r)&&t.getTime()>r.getTime()?new Date(r.getTime()):t}export function isDayOutside(t,e,r){return!!(isValidDate(e)&&compareDay(t,e)<0)||isValidDate(r)&&compareDay(t,r)>0}export function isUnitOutside(t,e,r,n){return!!(isValidDate(r)&&compareDay(endOfUnit(t,e),r)<0)||isValidDate(n)&&compareDay(startOfUnit(t,e),n)>0}export function minutesOfDay(t){return 60*t.getHours()+t.getMinutes()}export function secondsOfDay(t){return 3600*t.getHours()+60*t.getMinutes()+t.getSeconds()}export function timeUnitSpan(t,e){const r=secondsOfDay(e);if("hour"===t){const t=3600*Math.floor(r/3600);return[t,t+3599]}if("minute"===t){const t=60*Math.floor(r/60);return[t,t+59]}if("second"===t)return[r,r];const n=e.getHours()<12?0:43200;return[n,n+43200-1]}export function withTime(t,e){const r=new Date(t.getTime());return r.setHours(e.hours??r.getHours(),e.minutes??r.getMinutes(),e.seconds??r.getSeconds(),0),r}export function mergeDateAndTime(t,e){return withTime(startOfDay(t),{hours:e.getHours(),minutes:e.getMinutes(),seconds:e.getSeconds()})}export function calendarWeeks(t,e){const r=startOfMonth(t),n=(r.getDay()-e+7)%7,o=addDays(r,-n);return Array.from({length:6},(t,e)=>Array.from({length:7},(t,r)=>addDays(o,7*e+r)))}export function yearPageStart(t){return t-(t%12+12)%12}export function formatDate(e,r,n){return isValidDate(e)?t(r,n).format(e):""}const e=Array.from({length:24},(t,e)=>new Date(2027,e%12,21+e%7,e,58,58));export function displaySamples(r,n){const o=t(r,n);return[...new Set(e.map(t=>o.format(t)))]}export function withPlaceholder(t,e){return"string"==typeof e&&""!==e?[...t,e]:t}export function toISODate(t){const e=t=>String(t).padStart(2,"0");return`${String(t.getFullYear()).padStart(4,"0")}-${e(t.getMonth()+1)}-${e(t.getDate())}`}export function toISOMonth(t){return`${String(t.getFullYear()).padStart(4,"0")}-${String(t.getMonth()+1).padStart(2,"0")}`}export function toISOYear(t){return String(t.getFullYear()).padStart(4,"0")}export function toISOTime(t,e=!1){const r=t=>String(t).padStart(2,"0"),n=`${r(t.getHours())}:${r(t.getMinutes())}`;return e?`${n}:${r(t.getSeconds())}`:n}export function toISODateTime(t,e=!1){return`${toISODate(t)}T${toISOTime(t,e)}`}const r=makeDate(2021,7,1);export function weekdayLabels(e,n,o="short"){const a=t(e,{weekday:o});return Array.from({length:7},(t,e)=>a.format(addDays(r,(n+e)%7)))}export function monthLabels(e,r="short"){const n=t(e,{month:r});return Array.from({length:12},(t,e)=>n.format(makeDate(2021,e,1)))}export function isMonthBeforeYear(e){const n=t(e,{year:"numeric",month:"long"}).formatToParts(r);return n.findIndex(t=>"month"===t.type)<n.findIndex(t=>"year"===t.type)}export function isHour12(e){const r=t(e,{hour:"numeric"}).resolvedOptions();return r.hourCycle?"h11"===r.hourCycle||"h12"===r.hourCycle:!0===r.hour12}export function meridiemLabels(e){const n=t(e,{hour:"numeric",hour12:!0}),o=t=>{const e=n.formatToParts(withTime(r,{hours:t})).find(t=>"dayPeriod"===t.type);return e?.value??(t<12?"AM":"PM")};return[o(9),o(21)]}export function localeWeekStart(t){try{const e=t??(new Intl.DateTimeFormat).resolvedOptions().locale,r=new Intl.Locale(e),n="function"==typeof r.getWeekInfo?r.getWeekInfo():r.weekInfo;if("number"==typeof n?.firstDay)return n.firstDay%7}catch{}return 0}
1
+ import{memoise as t}from"./cache.js";import{dateFormatter as e}from"./format.js";export const YEAR_PAGE_SIZE=12;export function makeDate(t,e,r){const n=new Date(0);return n.setFullYear(t,e,r),n.setHours(0,0,0,0),n}export function isValidDate(t){return t instanceof Date&&!Number.isNaN(t.getTime())}export function startOfDay(t){const e=new Date(t.getTime());return e.setHours(0,0,0,0),e}export function startOfMonth(t){return makeDate(t.getFullYear(),t.getMonth(),1)}export function startOfYear(t){return makeDate(t.getFullYear(),0,1)}export function startOfUnit(t,e){return"year"===e?startOfYear(t):"month"===e?startOfMonth(t):startOfDay(t)}export function endOfUnit(t,e){const r=t.getFullYear();return"year"===e?makeDate(r,11,31):"month"===e?makeDate(r,t.getMonth(),daysInMonth(r,t.getMonth())):startOfDay(t)}export function daysInMonth(t,e){return makeDate(t,e+1,0).getDate()}export function today(){return startOfDay(new Date)}export function addDays(t,e){const r=new Date(t.getTime());return r.setDate(r.getDate()+e),r}export function addMonths(t,e){const r=t.getFullYear(),n=t.getMonth()+e,o=new Date(t.getTime()),a=makeDate(r,n,1);return o.setFullYear(a.getFullYear(),a.getMonth(),Math.min(t.getDate(),daysInMonth(a.getFullYear(),a.getMonth()))),o}export function addYears(t,e){return addMonths(t,12*e)}export function compareDay(t,e){return startOfDay(t).getTime()-startOfDay(e).getTime()}export function isSameDay(t,e){return isValidDate(t)&&isValidDate(e)&&0===compareDay(t,e)}export function isSameMonth(t,e){return isValidDate(t)&&isValidDate(e)&&t.getFullYear()===e.getFullYear()&&t.getMonth()===e.getMonth()}export function clampDate(t,e,r){return isValidDate(e)&&t.getTime()<e.getTime()?new Date(e.getTime()):isValidDate(r)&&t.getTime()>r.getTime()?new Date(r.getTime()):t}export function isDayOutside(t,e,r){return!!(isValidDate(e)&&compareDay(t,e)<0)||isValidDate(r)&&compareDay(t,r)>0}export function isUnitOutside(t,e,r,n){return!!(isValidDate(r)&&compareDay(endOfUnit(t,e),r)<0)||isValidDate(n)&&compareDay(startOfUnit(t,e),n)>0}export function secondsOfDay(t){return 3600*t.getHours()+60*t.getMinutes()+t.getSeconds()}export function timeUnitSpan(t,e){const r=secondsOfDay(e);if("hour"===t){const t=3600*Math.floor(r/3600);return[t,t+3599]}if("minute"===t){const t=60*Math.floor(r/60);return[t,t+59]}if("second"===t)return[r,r];const n=e.getHours()<12?0:43200;return[n,n+43200-1]}export function timeUnitRange(t,e){const[r,n]=timeUnitSpan(t,e),o=t=>withTime(e,{hours:Math.floor(t/3600),minutes:Math.floor(t%3600/60),seconds:t%60});return[o(r),o(n)]}export function withTime(t,e){const r=new Date(t.getTime());return r.setHours(e.hours??r.getHours(),e.minutes??r.getMinutes(),e.seconds??r.getSeconds(),0),r}export function mergeDateAndTime(t,e){return withTime(startOfDay(t),{hours:e.getHours(),minutes:e.getMinutes(),seconds:e.getSeconds()})}export function calendarWeeks(t,e){const r=startOfMonth(t),n=(r.getDay()-e+7)%7,o=addDays(r,-n);return Array.from({length:6},(t,e)=>Array.from({length:7},(t,r)=>addDays(o,7*e+r)))}export function yearPageStart(t){return t-(t%12+12)%12}export function formatDate(t,r,n){return isValidDate(t)?e(r,n).format(t):""}const r=Array.from({length:24},(t,e)=>new Date(2027,e%12,21+e%7,e,58,58)),n=Array.from({length:84},(t,e)=>{const r=Math.floor(e/7),n=new Date(2027,r,21).getDay();return new Date(2027,r,21+(e-n+7)%7,e%24,58,58)}),o=new WeakMap;export function displaySamples(t,a){const i=e(t,a),u=o.get(i);if(u)return u;const s=i.formatToParts(r[0]).some(t=>"weekday"===t.type),c=[...new Set((s?n:r).map(t=>i.format(t)))];return o.set(i,c),c}export function withPlaceholder(t,e){return"string"==typeof e&&""!==e?[...t,e]:t}export function toISODate(t){const e=t=>String(t).padStart(2,"0");return`${String(t.getFullYear()).padStart(4,"0")}-${e(t.getMonth()+1)}-${e(t.getDate())}`}export function toISOMonth(t){return`${String(t.getFullYear()).padStart(4,"0")}-${String(t.getMonth()+1).padStart(2,"0")}`}export function toISOYear(t){return String(t.getFullYear()).padStart(4,"0")}export function toISOTime(t,e=!1){const r=t=>String(t).padStart(2,"0"),n=`${r(t.getHours())}:${r(t.getMinutes())}`;return e?`${n}:${r(t.getSeconds())}`:n}export function toISODateTime(t,e=!1){return`${toISODate(t)}T${toISOTime(t,e)}`}const a=makeDate(2021,7,1);export function weekdayLabels(t,r,n="short"){const o=e(t,{weekday:n});return Array.from({length:7},(t,e)=>o.format(addDays(a,(r+e)%7)))}export function monthLabels(t,r="short"){const n=e(t,{month:r});return Array.from({length:12},(t,e)=>n.format(makeDate(2021,e,1)))}export function isMonthBeforeYear(t){const r=e(t,{year:"numeric",month:"long"}).formatToParts(a);return r.findIndex(t=>"month"===t.type)<r.findIndex(t=>"year"===t.type)}export function isHour12(t){const r=e(t,{hour:"numeric"}).resolvedOptions();return r.hourCycle?"h11"===r.hourCycle||"h12"===r.hourCycle:!0===r.hour12}export function meridiemLabels(t){const r=e(t,{hour:"numeric",hour12:!0}),n=t=>{const e=r.formatToParts(withTime(a,{hours:t})).find(t=>"dayPeriod"===t.type);return e?.value??(t<12?"AM":"PM")};return[n(9),n(21)]}const i=new Map;export function localeWeekStart(e){return t(i,e??"",()=>function(t){try{const e=t??(new Intl.DateTimeFormat).resolvedOptions().locale,r=new Intl.Locale(e),n="function"==typeof r.getWeekInfo?r.getWeekInfo():r.weekInfo;if("number"==typeof n?.firstDay)return n.firstDay%7}catch{}return 0}(e))}
@@ -37,10 +37,15 @@ export declare const DefaultsContext: React.Context<NebaDefaults | null>;
37
37
  * the one a reader expects: the call site, then the provider, then the
38
38
  * component's own literal default.
39
39
  *
40
+ * `nearer` is a layer between the call site and the provider — a ButtonGroup
41
+ * around a Button — and a key it sets is left for the component to read from
42
+ * it. Filled first, the provider's `size` beat the group's, so a Button in a
43
+ * `size="lg"` group under a `size: 'sm'` provider came out small.
44
+ *
40
45
  * The keys are passed in rather than worked out, and that is load-bearing. A
41
46
  * key a component does not destructure stays in the props it spreads onto its
42
47
  * root, so filling `density` into a component that has none would put
43
48
  * `density="compact"` on a `<div>` — and `size` on an `<input>` is a real
44
49
  * attribute that would quietly resize the field.
45
50
  */
46
- export declare function useStyleDefaults<P extends object>(props: P, keys: DefaultableKey[]): P;
51
+ export declare function useStyleDefaults<P extends object>(props: P, keys: DefaultableKey[], nearer?: NebaDefaults | null): P;
@@ -1 +1 @@
1
- "use client";import*as t from"react";export const DefaultsContext=/*@__PURE__*/t.createContext(null);export function useStyleDefaults(e,o){const n=t.useContext(DefaultsContext);if(!n)return e;const s=e;let r=null;for(const t of o){const e=n[t];void 0!==e&&void 0===s[t]&&(r=r??{...s},r[t]=e)}return r??s}
1
+ "use client";import*as t from"react";export const DefaultsContext=/*@__PURE__*/t.createContext(null);export function useStyleDefaults(e,o,n){const s=t.useContext(DefaultsContext);if(!s)return e;const r=e;let u=null;for(const t of o){const e=s[t];void 0!==e&&void 0===r[t]&&void 0===n?.[t]&&(u=u??{...r},u[t]=e)}return u??r}
@@ -3,17 +3,19 @@
3
3
  * that gives all of it back.
4
4
  *
5
5
  * Five components drag something: a Sidebar's edge, a Panes boundary, a
6
- * WindowPane by its bar or its corner, a ScrollZone's strip, a DataTable's
7
- * column rule. The arithmetic differs in every one of them and stays where it
8
- * is. What was written five times and had already drifted is the scaffold
9
- * around it — three listeners, a `dataset.dragging`, the document's text
10
- * selection, and a teardown an unmount can call.
6
+ * WindowPane by its bar or its corner, a ScrollZone's strip, and a DataTable's
7
+ * column rule, its column headers and a run of its rows. The arithmetic differs
8
+ * in every one of them and stays where it is. What was written six times and
9
+ * had already drifted is the scaffold around it — three listeners, a
10
+ * `dataset.dragging`, the document's text selection, and a teardown an unmount
11
+ * can call.
11
12
  *
12
13
  * The drift is the reason this exists rather than the repetition. A DataTable's
13
14
  * column resize was the one copy with no selection suppression in it, so
14
15
  * dragging a column boundary in Safari selected the text of every cell the
15
16
  * pointer crossed; and it was the one with no unmount teardown, so a table that
16
- * went away mid-drag left two listeners on a detached node.
17
+ * went away mid-drag left two listeners on a detached node. Its row-range drag
18
+ * was the last copy and had the same hole in it, over more cells.
17
19
  *
18
20
  * There is deliberately **no requestAnimationFrame in here.** A `pointermove`
19
21
  * is already delivered once per frame in every browser the library supports —
@@ -28,6 +30,18 @@ export interface PointerDragOptions {
28
30
  * the pointer leaving the element it started on.
29
31
  */
30
32
  target: HTMLElement;
33
+ /**
34
+ * Whether the pointer is captured to `target`. Without it the listeners go on
35
+ * the target's document, which hears the gesture wherever the pointer goes.
36
+ *
37
+ * It is for a drag that starts on something the reader may only have meant
38
+ * to press. A captured pointer's `click` and `dblclick` go to the capturing
39
+ * element rather than to what is under the pointer, so capturing on the press
40
+ * takes the click away from a row's `onClick` or a sort button inside a
41
+ * header in every browser, whether or not the pointer moved.
42
+ * @default true
43
+ */
44
+ capture?: boolean;
31
45
  /** The pointer that started it. */
32
46
  pointerId: number;
33
47
  /** Every move until the gesture ends. */
@@ -59,4 +73,4 @@ export interface PointerDragOptions {
59
73
  * Call `release` from an unmount effect. It is idempotent, so the pointer's own
60
74
  * `pointerup` calling it first costs nothing.
61
75
  */
62
- export declare function beginPointerDrag({ target, pointerId, onMove, onEnd, selectable, mark }: PointerDragOptions): () => void;
76
+ export declare function beginPointerDrag({ target, pointerId, onMove, onEnd, capture, selectable, mark }: PointerDragOptions): () => void;
@@ -1 +1 @@
1
- export function beginPointerDrag({target:e,pointerId:t,onMove:r,onEnd:n,selectable:o=!0,mark:s=!0}){const i=o?function(){const e=document.body,t=e.style.getPropertyValue("-webkit-user-select");return e.style.setProperty("-webkit-user-select","none"),()=>{t?e.style.setProperty("-webkit-user-select",t):e.style.removeProperty("-webkit-user-select")}}():null;s&&(e.dataset.dragging="true"),e.setPointerCapture&&e.setPointerCapture(t);let a=!0;const l=()=>{a&&(a=!1,e.removeEventListener("pointermove",r),e.removeEventListener("pointerup",p),e.removeEventListener("pointercancel",p),s&&delete e.dataset.dragging,i?.())},p=()=>{l(),n?.()};return e.addEventListener("pointermove",r),e.addEventListener("pointerup",p),e.addEventListener("pointercancel",p),l}
1
+ export function beginPointerDrag({target:e,pointerId:t,onMove:r,onEnd:n,capture:o=!0,selectable:s=!0,mark:i=!0}){const a=s?function(){const e=document.body,t=e.style.getPropertyValue("-webkit-user-select");return e.style.setProperty("-webkit-user-select","none"),()=>{t?e.style.setProperty("-webkit-user-select",t):e.style.removeProperty("-webkit-user-select")}}():null,c=o?e:e.ownerDocument;if(i&&(e.dataset.dragging="true"),o)try{e.setPointerCapture?.(t)}catch{}let l=!0;const u=()=>{l&&(l=!1,c.removeEventListener("pointermove",r),c.removeEventListener("pointerup",p),c.removeEventListener("pointercancel",p),i&&delete e.dataset.dragging,a?.())},p=()=>{u(),n?.()};return c.addEventListener("pointermove",r),c.addEventListener("pointerup",p),c.addEventListener("pointercancel",p),u}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * What a drop actually handed over, and the state of the box it landed on.
3
+ *
4
+ * Two components take dropped files — a
5
+ * [FilePicker](../components/inputs/file-picker), and a
6
+ * [PromptInput](../components/agent/prompt-input) whose shell is a drop target
7
+ * — and both have to get the same two things right. Neither is hard; both are
8
+ * the kind of thing that is written correctly once and approximately the second
9
+ * time.
10
+ */
11
+ import * as React from 'react';
12
+ /**
13
+ * Whether what was dropped is a file at all.
14
+ *
15
+ * A folder dragged onto a page arrives in `dataTransfer.files` as a `File` with
16
+ * no type and a size of zero, and there is no flag on it that says so. The only
17
+ * thing that does is `webkitGetAsEntry`, which is on the *item* rather than on
18
+ * the file — so the two lists are walked in step, and a browser too old to have
19
+ * it is left trusting what it was given.
20
+ *
21
+ * Silently accepting a folder is worse than refusing it: it goes into the list
22
+ * looking like a file, and the upload that follows sends nothing.
23
+ */
24
+ export declare function droppedFiles(transfer: DataTransfer): File[];
25
+ /** What a drop zone hands back: whether a drag is over it, and the listeners. */
26
+ export interface DropZone {
27
+ /** A drag is over the zone right now. Always `false` while it is off. */
28
+ over: boolean;
29
+ /**
30
+ * Spread onto the element that *is* the zone — the whole area a drop is a
31
+ * gesture over, rather than the control inside it.
32
+ */
33
+ handlers: {
34
+ onDragEnter?: React.DragEventHandler;
35
+ onDragOver?: React.DragEventHandler;
36
+ onDragLeave?: React.DragEventHandler;
37
+ onDrop?: React.DragEventHandler;
38
+ };
39
+ }
40
+ /**
41
+ * An area that takes dropped files.
42
+ *
43
+ * `accept` is called with the files, folders already filtered out. Pass
44
+ * `undefined` and the zone is off: no listeners at all, and `over` never turns
45
+ * true — which is what a disabled or read-only control wants, and what a
46
+ * component with nothing to do with files wants.
47
+ *
48
+ * Two details are the whole reason this is shared rather than written twice.
49
+ *
50
+ * **The depth count.** `dragenter` and `dragleave` fire for every child the
51
+ * pointer crosses, so a boolean flickers the entire time a file is over a box
52
+ * with anything in it — which is every box worth dropping on.
53
+ *
54
+ * **The drag that never comes back.** Escape cancels a drag, and a drop outside
55
+ * the window ends it somewhere the zone will never hear about; neither fires a
56
+ * `dragleave` here, so the counter stays up and the box keeps its lit edge
57
+ * until some later drag happens to balance it. `dragend` fires on the source
58
+ * and `drop` on whatever accepted it, so both are listened for at the document,
59
+ * with capture.
60
+ */
61
+ export declare function useDropZone(accept: ((files: File[]) => void) | undefined): DropZone;
@@ -0,0 +1 @@
1
+ "use client";import*as e from"react";export function droppedFiles(e){const r=[...e.items],t=[...e.files];return r.length!==t.length?t:t.filter((e,t)=>{const n=r[t]?.webkitGetAsEntry?.();return!n||n.isFile})}export function useDropZone(r){const t=e.useRef(0),[n,o]=e.useState(!1),u=void 0!==r;return e.useEffect(()=>{if(!u)return;const e=()=>{t.current=0,o(!1)};return document.addEventListener("dragend",e,!0),document.addEventListener("drop",e,!0),()=>{document.removeEventListener("dragend",e,!0),document.removeEventListener("drop",e,!0)}},[u]),u?{over:n,handlers:{onDragEnter:e=>{e.preventDefault(),t.current+=1,o(!0)},onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect="copy"},onDragLeave:()=>{t.current=Math.max(0,t.current-1),0===t.current&&o(!1)},onDrop:e=>{e.preventDefault(),t.current=0,o(!1),r(droppedFiles(e.dataTransfer))}}}:{over:!1,handlers:{}}}
@@ -0,0 +1,13 @@
1
+ import * as React from 'react';
2
+ /**
3
+ * Whether a Fieldset around a field is disabled.
4
+ *
5
+ * Base UI's own Fieldset already stops every field inside it answering, and
6
+ * says nothing a Neba component can read: its context is not part of the
7
+ * package's public exports. So a field went on drawing itself available inside
8
+ * a disabled group, because each one decides how it looks from its own
9
+ * `disabled` prop. This is the half Base UI does not carry.
10
+ */
11
+ export declare const FieldsetDisabledContext: React.Context<boolean>;
12
+ /** A field's own `disabled`, or the Fieldset's around it. */
13
+ export declare function useFieldsetDisabled(disabled: boolean | undefined): boolean;
@@ -0,0 +1 @@
1
+ "use client";import*as e from"react";export const FieldsetDisabledContext=/*@__PURE__*/e.createContext(!1);export function useFieldsetDisabled(t){return e.useContext(FieldsetDisabledContext)||!0===t}
@@ -1,8 +1,8 @@
1
1
  /**
2
- * The `Intl` formatters, memoised.
2
+ * The `Intl` objects, memoised.
3
3
  *
4
- * Here for the reason everything else in this folder is: three unrelated parts
5
- * of the library construct them, and constructing one is the expensive half of
4
+ * Here for the reason everything else in this folder is: unrelated parts of the
5
+ * library construct them, and constructing one is the expensive half of
6
6
  * using one. Measured on V8, `new Intl.NumberFormat(...).format(n)` costs about
7
7
  * 16µs and `format(n)` on a formatter that already exists costs about 0.3µs —
8
8
  * fifty-five times the work to produce the same string.
@@ -13,10 +13,11 @@
13
13
  * one per category and one per tooltip row, and it writes all of them again on
14
14
  * every re-render — which, on a chart being hovered, is every frame.
15
15
  *
16
- * The cache is keyed on the locale and the options together, and it is unbounded
17
- * on purpose. The keys are not user data: they come from a component's own
18
- * option objects, of which any one page has a handful, so there is nothing here
19
- * that grows with the size of a table or the length of a series.
16
+ * The cache is keyed on the locale and the options together, and it goes
17
+ * through `memoise` so it cannot grow without bound. Nothing here grows with
18
+ * the size of a table or the length of a series — a page has a handful of
19
+ * option objects — but both halves of the key reach these functions from public
20
+ * props, so neither half is the library's to promise anything about.
20
21
  *
21
22
  * The options object is deliberately *not* part of the key by identity. A caller
22
23
  * writing `format={{ style: 'currency', currency: 'USD' }}` inline hands over a
@@ -25,5 +26,18 @@
25
26
  */
26
27
  /** A memoised `Intl.DateTimeFormat`. */
27
28
  export declare function dateFormatter(locale: string | undefined, options: Intl.DateTimeFormatOptions): Intl.DateTimeFormat;
29
+ /**
30
+ * A memoised `Intl.Segmenter`, or `null` on a runtime that has none.
31
+ *
32
+ * The same rule as the two above, and the one constructor that was still being
33
+ * built per call. `AnimateTyping` asks for a string's graphemes, `AnimateSplit`
34
+ * for its words and `AnimateScramble` for its graphemes again — three effects
35
+ * that a page may well hold several of, each rebuilding a segmenter for a
36
+ * string that has not changed.
37
+ *
38
+ * `null` rather than a throw where `Intl.Segmenter` is missing: a caller can
39
+ * fall back to a spread, and a text effect is not worth taking a page down for.
40
+ */
41
+ export declare function segmenter(locale: string | undefined, granularity: Intl.SegmenterOptions['granularity']): Intl.Segmenter | null;
28
42
  /** A memoised `Intl.NumberFormat`. */
29
43
  export declare function numberFormatter(locale: string | undefined, options?: Intl.NumberFormatOptions): Intl.NumberFormat;
@@ -1 +1 @@
1
- function t(t,e){return`${t??""}\0${e?JSON.stringify(e):""}`}const e=new Map;export function dateFormatter(n,r){const o=t(n,r);let a=e.get(o);return a||(a=new Intl.DateTimeFormat(n,r),e.set(o,a)),a}const n=new Map;export function numberFormatter(e,r){const o=t(e,r);let a=n.get(o);return a||(a=new Intl.NumberFormat(e,r),n.set(o,a)),a}
1
+ import{memoise as n}from"./cache.js";function t(n,t){return`${n??""}\0${t?JSON.stringify(t):""}`}const e=new Map;export function dateFormatter(r,o){return n(e,t(r,o),()=>new Intl.DateTimeFormat(r,o))}const r=new Map;export function segmenter(e,o){return"undefined"!=typeof Intl&&"Segmenter"in Intl?n(r,t(e,{granularity:o}),()=>new Intl.Segmenter(e,{granularity:o})):null}const o=new Map;export function numberFormatter(e,r){return n(o,t(e,r),()=>new Intl.NumberFormat(e,r))}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * The pointer's place on a surface that is lit by it.
3
+ *
4
+ * `.neba-glow` in `styles.css` draws two layers off `--n-mx`/`--n-my` — a
5
+ * spotlight that follows the pointer and an afterglow that lands on a press —
6
+ * and neither of them can find the pointer on its own: CSS has no way to ask
7
+ * where it is. This is the two lines that tell it, and they are here because
8
+ * the number of components that want them is no longer two.
9
+ *
10
+ * **The rect, rather than `offsetX`.** `offsetX` is measured from the *target*,
11
+ * which is the innermost element under the pointer — so it is only the surface's
12
+ * own offset while every descendant is `pointer-events: none`. That holds for a
13
+ * Button's icons and stops holding the moment a caller wraps the label in a
14
+ * `<span>`, and it never held for a field, whose `<input>` is exactly the thing
15
+ * the pointer is over. One `getBoundingClientRect` per frame on the one element
16
+ * a pointer can be over is the price of being right about all of them.
17
+ *
18
+ * Nothing else costs anything. `pointermove` is already coalesced to one per
19
+ * frame; the two properties are written straight to the element rather than
20
+ * held in state, so React never re-renders; and what changes is where a
21
+ * gradient is centred, which is a repaint of one box and not a layout. Only the
22
+ * hovered element paints at all, `@media (hover: hover)` keeps it off a touch
23
+ * screen entirely, and a reduced-motion preference drops both layers.
24
+ *
25
+ * The one thing to watch is **whose subtree it is**. A custom property written
26
+ * on an element invalidates the style of everything under it, so the slots go
27
+ * on the surface that paints the light and never on a container holding rows of
28
+ * other things: a Menu lights its own rows, one at a time, and not the popup
29
+ * around them.
30
+ */
31
+ import type * as React from 'react';
32
+ /** Carries the two layers. Useless without the slots below and the handler. */
33
+ export declare const glowClasses = "neba-glow";
34
+ /**
35
+ * The spotlight without the press flash, for a surface that is **entered**
36
+ * rather than pressed and held.
37
+ *
38
+ * `--n-flash` is left unset and the afterglow falls back to `transparent`,
39
+ * which is the whole distinction. A press is answered by a flash that lands on
40
+ * the frame of the click and drains for the best part of a second: clicking
41
+ * into a field is not that, and neither is choosing a menu row, which is gone
42
+ * before the flash is a third of the way out.
43
+ *
44
+ * It reads `--n-soft` rather than a family, so it follows whatever the
45
+ * component's own slots resolved to — including a field turning `danger` the
46
+ * moment it is invalid.
47
+ */
48
+ export declare const spotlightSlot: React.CSSProperties;
49
+ /**
50
+ * Writes the pointer's place onto the element, in front of whatever handler the
51
+ * caller passed.
52
+ *
53
+ * `lit` is what stops a disabled, read-only or otherwise unlit surface paying
54
+ * for a light nobody is painting: without the class there are no layers to
55
+ * feed, and writing the slots anyway would invalidate that element's style on
56
+ * every pointer event for nothing.
57
+ */
58
+ export declare function trackPointer<E extends HTMLElement>(handler: React.PointerEventHandler<E> | undefined, lit: boolean): React.PointerEventHandler<E> | undefined;
@@ -0,0 +1 @@
1
+ export const glowClasses="neba-glow";export const spotlightSlot={"--n-glow":"var(--n-soft)"};export function trackPointer(t,e){return e?e=>{const n=e.currentTarget,o=n.getBoundingClientRect();n.style.setProperty("--n-mx",e.clientX-o.left+"px"),n.style.setProperty("--n-my",e.clientY-o.top+"px"),t?.(e)}:t}
@@ -36,6 +36,22 @@ export declare function columnCount(value: number): string;
36
36
  export declare function columnUnits(value: number, min: number): string;
37
37
  export declare const spanValue: (value: number) => string;
38
38
  export declare const offsetValue: (value: number) => string;
39
+ /**
40
+ * A width a column count cannot reach.
41
+ *
42
+ * `auto` is the contents' own width — an icon, a chip, a button at the end of
43
+ * a row — and `grow` is that plus whatever is left over in the row, which is
44
+ * how a title sits between an icon and an action. Neither is a share of
45
+ * twelve, so neither can come out of the arithmetic above.
46
+ *
47
+ * A number points back at `--n-col-width`, the arithmetic named in
48
+ * `styles.css`, rather than restating it: that is what lets one map mix the
49
+ * two — `span={{ xs: 'grow', md: 4 }}` — without the keyword at a narrow
50
+ * width leaking into a wider one.
51
+ */
52
+ export declare function spanWidth(value: number | 'auto' | 'grow'): string;
53
+ /** Which of the two keywords takes the space the row has left. */
54
+ export declare function spanGrow(value: number | 'auto' | 'grow'): string;
39
55
  /**
40
56
  * A gutter, as a length.
41
57
  *
@@ -1 +1 @@
1
- export function columnCount(t){return String(Math.max(1,Math.round(t)))}export function columnUnits(t,e){return String(Math.max(e,Math.round(t)))}export const spanValue=t=>columnUnits(t,1);export const offsetValue=t=>columnUnits(t,0);export function spacingValue(t){const e=.25*Math.max(0,t);return`${Number(e.toFixed(5))}rem`}export const justifyContentClasses={start:"justify-start",center:"justify-center",end:"justify-end","space-between":"justify-between","space-around":"justify-around","space-evenly":"justify-evenly",stretch:"justify-stretch"};export const alignItemsClasses={start:"items-start",center:"items-center",end:"items-end",stretch:"items-stretch",baseline:"items-baseline"};export const alignContentClasses={start:"content-start",center:"content-center",end:"content-end","space-between":"content-between","space-around":"content-around","space-evenly":"content-evenly",stretch:"content-stretch"};export const alignSelfClasses={auto:"self-auto",start:"self-start",center:"self-center",end:"self-end",stretch:"self-stretch",baseline:"self-baseline"};
1
+ export function columnCount(t){return String(Math.max(1,Math.round(t)))}export function columnUnits(t,e){return String(Math.max(e,Math.round(t)))}export const spanValue=t=>columnUnits(t,1);export const offsetValue=t=>columnUnits(t,0);export function spanWidth(t){return"number"==typeof t?"var(--n-col-width)":"auto"}export function spanGrow(t){return"grow"===t?"1":"0"}export function spacingValue(t){const e=.25*Math.max(0,t);return`${Number(e.toFixed(5))}rem`}export const justifyContentClasses={start:"justify-start",center:"justify-center",end:"justify-end","space-between":"justify-between","space-around":"justify-around","space-evenly":"justify-evenly",stretch:"justify-stretch"};export const alignItemsClasses={start:"items-start",center:"items-center",end:"items-end",stretch:"items-stretch",baseline:"items-baseline"};export const alignContentClasses={start:"content-start",center:"content-center",end:"content-end","space-between":"content-between","space-around":"content-around","space-evenly":"content-evenly",stretch:"content-stretch"};export const alignSelfClasses={auto:"self-auto",start:"self-start",center:"self-center",end:"self-end",stretch:"self-stretch",baseline:"self-baseline"};
@@ -1 +1 @@
1
- const i={bash:()=>import("highlight.js/lib/languages/bash"),c:()=>import("highlight.js/lib/languages/c"),cpp:()=>import("highlight.js/lib/languages/cpp"),csharp:()=>import("highlight.js/lib/languages/csharp"),css:()=>import("highlight.js/lib/languages/css"),diff:()=>import("highlight.js/lib/languages/diff"),dockerfile:()=>import("highlight.js/lib/languages/dockerfile"),go:()=>import("highlight.js/lib/languages/go"),graphql:()=>import("highlight.js/lib/languages/graphql"),ini:()=>import("highlight.js/lib/languages/ini"),java:()=>import("highlight.js/lib/languages/java"),javascript:()=>import("highlight.js/lib/languages/javascript"),json:()=>import("highlight.js/lib/languages/json"),kotlin:()=>import("highlight.js/lib/languages/kotlin"),less:()=>import("highlight.js/lib/languages/less"),lua:()=>import("highlight.js/lib/languages/lua"),makefile:()=>import("highlight.js/lib/languages/makefile"),markdown:()=>import("highlight.js/lib/languages/markdown"),objectivec:()=>import("highlight.js/lib/languages/objectivec"),perl:()=>import("highlight.js/lib/languages/perl"),php:()=>import("highlight.js/lib/languages/php"),plaintext:()=>import("highlight.js/lib/languages/plaintext"),powershell:()=>import("highlight.js/lib/languages/powershell"),python:()=>import("highlight.js/lib/languages/python"),r:()=>import("highlight.js/lib/languages/r"),ruby:()=>import("highlight.js/lib/languages/ruby"),rust:()=>import("highlight.js/lib/languages/rust"),scss:()=>import("highlight.js/lib/languages/scss"),shell:()=>import("highlight.js/lib/languages/shell"),sql:()=>import("highlight.js/lib/languages/sql"),swift:()=>import("highlight.js/lib/languages/swift"),typescript:()=>import("highlight.js/lib/languages/typescript"),xml:()=>import("highlight.js/lib/languages/xml"),yaml:()=>import("highlight.js/lib/languages/yaml")},t={"c++":"cpp",cc:"cpp",cjs:"javascript",console:"bash",cs:"csharp",cts:"typescript",docker:"dockerfile",gql:"graphql",golang:"go",h:"cpp",hpp:"cpp",htm:"xml",html:"xml",js:"javascript",jsx:"javascript",kt:"kotlin",kts:"kotlin",md:"markdown",mdx:"markdown",mjs:"javascript",mm:"objectivec",mts:"typescript",mysql:"sql",node:"javascript",none:"plaintext",objc:"objectivec",plain:"plaintext",posh:"powershell",ps1:"powershell",psql:"sql",py:"python",rb:"ruby",rs:"rust",sh:"bash",svelte:"xml",svg:"xml",text:"plaintext",toml:"ini",ts:"typescript",tsx:"typescript",txt:"plaintext",vue:"xml",yml:"yaml",zsh:"bash"},l=new Map;export function registerLanguage(i,t){const g=i.toLowerCase();l.set(g,t),s.delete(g)}let g=null;const s=new Map;export function canonicalLanguage(i){if(!i)return null;const l=i.trim().toLowerCase();return l?t[l]??l:null}export async function highlight(t,a){let e=s.get(a);e||(e=async function(t){const s=l.get(t),a=s?void 0:i[t];if(!s&&!a)return null;g??=import("highlight.js/lib/core").then(i=>i.default);const e=await g;return s?e.registerLanguage(t,s):e.getLanguage(t)||e.registerLanguage(t,(await a()).default),t}(a).catch(i=>{throw s.delete(a),i}),s.set(a,e));const h=await e;if(!h||!g)return null;return tokenize((await g).highlight(t,{language:h,ignoreIllegals:!0}).value)}const a={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#x27;":"'"};export function tokenize(i){const t=[[]],l=[],g=/<span class="([^"]*)">|<\/span>/g;let s=0;const e=i=>{if(!i)return;const g=l[l.length-1];i.replace(/&(?:amp|lt|gt|quot|#x27);/g,i=>a[i]).split("\n").forEach((i,l)=>{l>0&&t.push([]),i&&t[t.length-1].push(g?{text:i,token:g}:{text:i})})};for(const t of i.matchAll(g))e(i.slice(s,t.index)),s=t.index+t[0].length,void 0===t[1]?l.pop():l.push(t[1]);return e(i.slice(s)),t}export function plainLines(i){return i.split("\n").map(i=>i?[{text:i}]:[])}
1
+ const t={bash:()=>import("highlight.js/lib/languages/bash"),c:()=>import("highlight.js/lib/languages/c"),cpp:()=>import("highlight.js/lib/languages/cpp"),csharp:()=>import("highlight.js/lib/languages/csharp"),css:()=>import("highlight.js/lib/languages/css"),diff:()=>import("highlight.js/lib/languages/diff"),dockerfile:()=>import("highlight.js/lib/languages/dockerfile"),go:()=>import("highlight.js/lib/languages/go"),graphql:()=>import("highlight.js/lib/languages/graphql"),ini:()=>import("highlight.js/lib/languages/ini"),java:()=>import("highlight.js/lib/languages/java"),javascript:()=>import("highlight.js/lib/languages/javascript"),json:()=>import("highlight.js/lib/languages/json"),kotlin:()=>import("highlight.js/lib/languages/kotlin"),less:()=>import("highlight.js/lib/languages/less"),lua:()=>import("highlight.js/lib/languages/lua"),makefile:()=>import("highlight.js/lib/languages/makefile"),markdown:()=>import("highlight.js/lib/languages/markdown"),objectivec:()=>import("highlight.js/lib/languages/objectivec"),perl:()=>import("highlight.js/lib/languages/perl"),php:()=>import("highlight.js/lib/languages/php"),plaintext:()=>import("highlight.js/lib/languages/plaintext"),powershell:()=>import("highlight.js/lib/languages/powershell"),python:()=>import("highlight.js/lib/languages/python"),r:()=>import("highlight.js/lib/languages/r"),ruby:()=>import("highlight.js/lib/languages/ruby"),rust:()=>import("highlight.js/lib/languages/rust"),scss:()=>import("highlight.js/lib/languages/scss"),shell:()=>import("highlight.js/lib/languages/shell"),sql:()=>import("highlight.js/lib/languages/sql"),swift:()=>import("highlight.js/lib/languages/swift"),typescript:()=>import("highlight.js/lib/languages/typescript"),xml:()=>import("highlight.js/lib/languages/xml"),yaml:()=>import("highlight.js/lib/languages/yaml")},i={"c++":"cpp",cc:"cpp",cjs:"javascript",console:"bash",cs:"csharp",cts:"typescript",docker:"dockerfile",gql:"graphql",golang:"go",h:"cpp",hpp:"cpp",htm:"xml",html:"xml",js:"javascript",jsx:"javascript",kt:"kotlin",kts:"kotlin",md:"markdown",mdx:"markdown",mjs:"javascript",mm:"objectivec",mts:"typescript",mysql:"sql",node:"javascript",none:"plaintext",objc:"objectivec",plain:"plaintext",posh:"powershell",ps1:"powershell",psql:"sql",py:"python",rb:"ruby",rs:"rust",sh:"bash",svelte:"xml",svg:"xml",text:"plaintext",toml:"ini",ts:"typescript",tsx:"typescript",txt:"plaintext",vue:"xml",yml:"yaml",zsh:"bash"},l={dockerfile:["bash"],javascript:["xml"],markdown:["xml"],shell:["bash"],typescript:["xml"],xml:["javascript","css"]},s=new Map;export function registerLanguage(t,i){const l=t.toLowerCase();s.set(l,i),a.delete(l)}let g=null;const a=new Map;export function canonicalLanguage(t){if(!t)return null;const l=t.trim().toLowerCase();return l?s.has(l)?l:i[l]??l:null}export async function highlight(i,e){if(!s.has(e)&&!Object.hasOwn(t,e))return null;let h=a.get(e);h||(h=async function(i){const a=s.get(i),e=a||!Object.hasOwn(t,i)?void 0:t[i];if(!a&&!e)return null;g??=import("highlight.js/lib/core").then(t=>t.default).catch(t=>{throw g=null,t});const h=await g;a?h.registerLanguage(i,a):h.getLanguage(i)||h.registerLanguage(i,(await e()).default);const n=Object.hasOwn(l,i)?l[i]:[];return await Promise.all(n.map(async i=>{if(h.getLanguage(i))return;const l=s.get(i);h.registerLanguage(i,l??(await t[i]()).default)})),i}(e).catch(t=>{throw a.delete(e),t}),a.set(e,h));const n=await h;if(!n||!g)return null;return tokenize((await g).highlight(i,{language:n,ignoreIllegals:!0}).value)}const e={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#x27;":"'"};export function tokenize(t){const i=[[]],l=[],s=/<span class="([^"]*)">|<\/span>/g;let g=0;const a=t=>{if(!t)return;const s=l[l.length-1];t.replace(/&(?:amp|lt|gt|quot|#x27);/g,t=>e[t]).split("\n").forEach((t,l)=>{l>0&&i.push([]),t&&i[i.length-1].push(s?{text:t,token:s}:{text:t})})};for(const i of t.matchAll(s))a(t.slice(g,i.index)),g=i.index+i[0].length,void 0===i[1]?l.pop():l.push(i[1]);return a(t.slice(g)),i}export function plainLines(t){return t.split("\n").map(t=>t?[{text:t}]:[])}