plass-ui 1.2.0 → 1.4.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 (452) hide show
  1. package/CHANGELOG.md +668 -0
  2. package/README.md +1 -1
  3. package/dist/components/accordion/PlAccordion.js +1 -1
  4. package/dist/components/alert/PlAlert.js +1 -1
  5. package/dist/components/anchor/PlAnchor.d.ts +72 -0
  6. package/dist/components/anchor/PlAnchor.js +1 -0
  7. package/dist/components/anchor/index.d.ts +2 -0
  8. package/dist/components/anchor/index.js +1 -0
  9. package/dist/components/animate-appear/PlAnimateAppear.d.ts +10 -0
  10. package/dist/components/animate-appear/PlAnimateAppear.js +1 -1
  11. package/dist/components/animate-blink/PlAnimateBlink.d.ts +2 -2
  12. package/dist/components/animate-blink/PlAnimateBlink.js +1 -1
  13. package/dist/components/animate-counter/PlAnimateCounter.d.ts +83 -0
  14. package/dist/components/animate-counter/PlAnimateCounter.js +1 -0
  15. package/dist/components/animate-counter/index.d.ts +2 -0
  16. package/dist/components/animate-counter/index.js +1 -0
  17. package/dist/components/animate-fade/PlAnimateFade.d.ts +2 -2
  18. package/dist/components/animate-fade/PlAnimateFade.js +1 -1
  19. package/dist/components/animate-float/PlAnimateFloat.d.ts +51 -0
  20. package/dist/components/animate-float/PlAnimateFloat.js +1 -0
  21. package/dist/components/animate-float/index.d.ts +2 -0
  22. package/dist/components/animate-float/index.js +1 -0
  23. package/dist/components/animate-grow/PlAnimateGrow.d.ts +2 -2
  24. package/dist/components/animate-grow/PlAnimateGrow.js +1 -1
  25. package/dist/components/animate-headline/PlAnimateHeadline.js +1 -1
  26. package/dist/components/animate-lighting/PlAnimateLighting.js +1 -1
  27. package/dist/components/animate-reveal/PlAnimateReveal.d.ts +51 -0
  28. package/dist/components/animate-reveal/PlAnimateReveal.js +1 -0
  29. package/dist/components/animate-reveal/index.d.ts +2 -0
  30. package/dist/components/animate-reveal/index.js +1 -0
  31. package/dist/components/animate-rotate/PlAnimateRotate.d.ts +2 -2
  32. package/dist/components/animate-rotate/PlAnimateRotate.js +1 -1
  33. package/dist/components/animate-scramble/PlAnimateScramble.d.ts +75 -0
  34. package/dist/components/animate-scramble/PlAnimateScramble.js +1 -0
  35. package/dist/components/animate-scramble/index.d.ts +2 -0
  36. package/dist/components/animate-scramble/index.js +1 -0
  37. package/dist/components/animate-shake/PlAnimateShake.d.ts +57 -0
  38. package/dist/components/animate-shake/PlAnimateShake.js +1 -0
  39. package/dist/components/animate-shake/index.d.ts +2 -0
  40. package/dist/components/animate-shake/index.js +1 -0
  41. package/dist/components/animate-slide/PlAnimateSlide.d.ts +2 -2
  42. package/dist/components/animate-slide/PlAnimateSlide.js +1 -1
  43. package/dist/components/animate-split/PlAnimateSplit.d.ts +54 -0
  44. package/dist/components/animate-split/PlAnimateSplit.js +1 -0
  45. package/dist/components/animate-split/index.d.ts +2 -0
  46. package/dist/components/animate-split/index.js +1 -0
  47. package/dist/components/animate-typing/PlAnimateTyping.js +1 -1
  48. package/dist/components/animate-zoom/PlAnimateZoom.d.ts +2 -2
  49. package/dist/components/animate-zoom/PlAnimateZoom.js +1 -1
  50. package/dist/components/app-logo/PlAppLogo.d.ts +78 -0
  51. package/dist/components/app-logo/PlAppLogo.js +1 -0
  52. package/dist/components/app-logo/index.d.ts +2 -0
  53. package/dist/components/app-logo/index.js +1 -0
  54. package/dist/components/area-chart/PlAreaChart.d.ts +54 -0
  55. package/dist/components/area-chart/PlAreaChart.js +1 -0
  56. package/dist/components/area-chart/index.d.ts +2 -0
  57. package/dist/components/area-chart/index.js +1 -0
  58. package/dist/components/aspect-ratio/PlAspectRatio.js +1 -1
  59. package/dist/components/avatar/PlAvatar.js +1 -1
  60. package/dist/components/back-top/PlBackTop.d.ts +55 -0
  61. package/dist/components/back-top/PlBackTop.js +1 -0
  62. package/dist/components/back-top/index.d.ts +2 -0
  63. package/dist/components/back-top/index.js +1 -0
  64. package/dist/components/badge/PlBadge.js +1 -1
  65. package/dist/components/bar-chart/PlBarChart.d.ts +63 -0
  66. package/dist/components/bar-chart/PlBarChart.js +1 -0
  67. package/dist/components/bar-chart/index.d.ts +2 -0
  68. package/dist/components/bar-chart/index.js +1 -0
  69. package/dist/components/blockquote/PlBlockquote.js +1 -1
  70. package/dist/components/bottom-navigation/PlBottomNavigation.js +1 -1
  71. package/dist/components/box/PlBox.js +1 -1
  72. package/dist/components/breadcrumb/PlBreadcrumb.js +1 -1
  73. package/dist/components/button/PlButton.js +1 -1
  74. package/dist/components/button-group/PlButtonGroup.js +1 -1
  75. package/dist/components/calendar/PlCalendar.d.ts +104 -0
  76. package/dist/components/calendar/PlCalendar.js +1 -0
  77. package/dist/components/calendar/index.d.ts +2 -0
  78. package/dist/components/calendar/index.js +1 -0
  79. package/dist/components/card/PlCard.js +1 -1
  80. package/dist/components/carousel/PlCarousel.js +1 -1
  81. package/dist/components/chat-bubble/PlChatBubble.js +1 -1
  82. package/dist/components/checkbox/PlCheckbox.js +1 -1
  83. package/dist/components/chip/PlChip.js +1 -1
  84. package/dist/components/code-block/PlCodeBlock.d.ts +175 -0
  85. package/dist/components/code-block/PlCodeBlock.js +1 -0
  86. package/dist/components/code-block/index.d.ts +2 -0
  87. package/dist/components/code-block/index.js +1 -0
  88. package/dist/components/collapsible/PlCollapsible.js +1 -1
  89. package/dist/components/color-picker/PlColorPicker.js +1 -1
  90. package/dist/components/combobox/PlCombobox.d.ts +11 -2
  91. package/dist/components/combobox/PlCombobox.js +1 -1
  92. package/dist/components/command-palette/PlCommandPalette.d.ts +1 -1
  93. package/dist/components/command-palette/PlCommandPalette.js +1 -1
  94. package/dist/components/confirm/PlConfirmProvider.d.ts +100 -0
  95. package/dist/components/confirm/PlConfirmProvider.js +1 -0
  96. package/dist/components/confirm/index.d.ts +2 -0
  97. package/dist/components/confirm/index.js +1 -0
  98. package/dist/components/container/PlContainer.d.ts +22 -6
  99. package/dist/components/container/PlContainer.js +1 -1
  100. package/dist/components/data-list/PlDataList.d.ts +74 -0
  101. package/dist/components/data-list/PlDataList.js +1 -0
  102. package/dist/components/data-list/index.d.ts +2 -0
  103. package/dist/components/data-list/index.js +1 -0
  104. package/dist/components/data-table/PlDataTable.d.ts +202 -0
  105. package/dist/components/data-table/PlDataTable.js +1 -0
  106. package/dist/components/data-table/index.d.ts +2 -0
  107. package/dist/components/data-table/index.js +1 -0
  108. package/dist/components/date-picker/PlDatePicker.d.ts +41 -2
  109. package/dist/components/date-picker/PlDatePicker.js +1 -1
  110. package/dist/components/date-range-picker/PlDateRangePicker.js +1 -1
  111. package/dist/components/date-time-picker/PlDateTimePicker.js +1 -1
  112. package/dist/components/divider/PlDivider.js +1 -1
  113. package/dist/components/drawer/PlDrawer.d.ts +1 -1
  114. package/dist/components/drawer/PlDrawer.js +1 -1
  115. package/dist/components/empty/PlEmpty.d.ts +47 -0
  116. package/dist/components/empty/PlEmpty.js +1 -0
  117. package/dist/components/empty/index.d.ts +2 -0
  118. package/dist/components/empty/index.js +1 -0
  119. package/dist/components/file-picker/PlFilePicker.js +1 -1
  120. package/dist/components/flex/PlFlex.d.ts +83 -0
  121. package/dist/components/flex/PlFlex.js +1 -0
  122. package/dist/components/flex/index.d.ts +2 -0
  123. package/dist/components/flex/index.js +1 -0
  124. package/dist/components/floating-action-button/PlFloatingActionButton.d.ts +81 -0
  125. package/dist/components/floating-action-button/PlFloatingActionButton.js +1 -0
  126. package/dist/components/floating-action-button/index.d.ts +2 -0
  127. package/dist/components/floating-action-button/index.js +1 -0
  128. package/dist/components/floating-bottom-navigation/PlFloatingBottomNavigation.js +1 -1
  129. package/dist/components/footer/PlFooter.d.ts +4 -3
  130. package/dist/components/footer/PlFooter.js +1 -1
  131. package/dist/components/gallery/PlGallery.d.ts +154 -0
  132. package/dist/components/gallery/PlGallery.js +1 -0
  133. package/dist/components/gallery/PlGalleryViewer.d.ts +31 -0
  134. package/dist/components/gallery/PlGalleryViewer.js +1 -0
  135. package/dist/components/gallery/index.d.ts +2 -0
  136. package/dist/components/gallery/index.js +1 -0
  137. package/dist/components/gauge-chart/PlGaugeChart.d.ts +64 -0
  138. package/dist/components/gauge-chart/PlGaugeChart.js +1 -0
  139. package/dist/components/gauge-chart/index.d.ts +2 -0
  140. package/dist/components/gauge-chart/index.js +1 -0
  141. package/dist/components/grid/PlGrid.js +1 -1
  142. package/dist/components/grid/PlGridItem.js +1 -1
  143. package/dist/components/header/PlHeader.d.ts +4 -3
  144. package/dist/components/header/PlHeader.js +1 -1
  145. package/dist/components/heatmap-chart/PlHeatmapChart.d.ts +69 -0
  146. package/dist/components/heatmap-chart/PlHeatmapChart.js +1 -0
  147. package/dist/components/heatmap-chart/index.d.ts +2 -0
  148. package/dist/components/heatmap-chart/index.js +1 -0
  149. package/dist/components/highlight/PlHighlight.js +1 -1
  150. package/dist/components/hot-keys/PlHotKeys.js +1 -1
  151. package/dist/components/hover-card/PlHoverCard.d.ts +94 -0
  152. package/dist/components/hover-card/PlHoverCard.js +1 -0
  153. package/dist/components/hover-card/index.d.ts +2 -0
  154. package/dist/components/hover-card/index.js +1 -0
  155. package/dist/components/how-to-steps/PlHowToSteps.d.ts +87 -0
  156. package/dist/components/how-to-steps/PlHowToSteps.js +1 -0
  157. package/dist/components/how-to-steps/index.d.ts +2 -0
  158. package/dist/components/how-to-steps/index.js +1 -0
  159. package/dist/components/image/PlImage.d.ts +72 -0
  160. package/dist/components/image/PlImage.js +1 -0
  161. package/dist/components/image/index.d.ts +2 -0
  162. package/dist/components/image/index.js +1 -0
  163. package/dist/components/line-chart/PlLineChart.d.ts +74 -0
  164. package/dist/components/line-chart/PlLineChart.js +1 -0
  165. package/dist/components/line-chart/index.d.ts +2 -0
  166. package/dist/components/line-chart/index.js +1 -0
  167. package/dist/components/list/PlList.js +1 -1
  168. package/dist/components/menu/PlMenu.d.ts +2 -2
  169. package/dist/components/menu/PlMenu.js +1 -1
  170. package/dist/components/menubar/PlMenubar.js +1 -1
  171. package/dist/components/meter/PlMeter.d.ts +83 -0
  172. package/dist/components/meter/PlMeter.js +1 -0
  173. package/dist/components/meter/index.d.ts +2 -0
  174. package/dist/components/meter/index.js +1 -0
  175. package/dist/components/mockup/PlMockup.d.ts +146 -0
  176. package/dist/components/mockup/PlMockup.js +1 -0
  177. package/dist/components/mockup/index.d.ts +2 -0
  178. package/dist/components/mockup/index.js +1 -0
  179. package/dist/components/modal/PlModal.d.ts +1 -1
  180. package/dist/components/modal/PlModal.js +1 -1
  181. package/dist/components/navigation-menu/PlNavigationMenu.js +1 -1
  182. package/dist/components/number-field/PlNumberField.d.ts +11 -2
  183. package/dist/components/number-field/PlNumberField.js +1 -1
  184. package/dist/components/otp-field/PlOtpField.d.ts +10 -1
  185. package/dist/components/otp-field/PlOtpField.js +1 -1
  186. package/dist/components/overlay/PlOverlay.d.ts +1 -1
  187. package/dist/components/overlay/PlOverlay.js +1 -1
  188. package/dist/components/page-layout/PlPageLayout.js +1 -1
  189. package/dist/components/pagination/PlPagination.js +1 -1
  190. package/dist/components/panes/PlPanes.d.ts +2 -2
  191. package/dist/components/panes/PlPanes.js +1 -1
  192. package/dist/components/pie-chart/PlPieChart.d.ts +58 -0
  193. package/dist/components/pie-chart/PlPieChart.js +1 -0
  194. package/dist/components/pie-chart/index.d.ts +2 -0
  195. package/dist/components/pie-chart/index.js +1 -0
  196. package/dist/components/pill/PlPill.js +1 -1
  197. package/dist/components/popconfirm/PlPopconfirm.d.ts +61 -0
  198. package/dist/components/popconfirm/PlPopconfirm.js +1 -0
  199. package/dist/components/popconfirm/index.d.ts +2 -0
  200. package/dist/components/popconfirm/index.js +1 -0
  201. package/dist/components/popover/PlPopover.d.ts +1 -1
  202. package/dist/components/popover/PlPopover.js +1 -1
  203. package/dist/components/portal/PlPortal.d.ts +78 -0
  204. package/dist/components/portal/PlPortal.js +1 -0
  205. package/dist/components/portal/index.d.ts +2 -0
  206. package/dist/components/portal/index.js +1 -0
  207. package/dist/components/progress-box/PlProgressBox.js +1 -1
  208. package/dist/components/progress-circular/PlProgressCircular.js +1 -1
  209. package/dist/components/progress-linear/PlProgressLinear.js +1 -1
  210. package/dist/components/radio-group/PlRadioGroup.js +1 -1
  211. package/dist/components/rating/PlRating.js +1 -1
  212. package/dist/components/scatter-chart/PlScatterChart.d.ts +46 -0
  213. package/dist/components/scatter-chart/PlScatterChart.js +1 -0
  214. package/dist/components/scatter-chart/index.d.ts +2 -0
  215. package/dist/components/scatter-chart/index.js +1 -0
  216. package/dist/components/scroll-area/PlScrollArea.d.ts +98 -0
  217. package/dist/components/scroll-area/PlScrollArea.js +1 -0
  218. package/dist/components/scroll-area/index.d.ts +2 -0
  219. package/dist/components/scroll-area/index.js +1 -0
  220. package/dist/components/scroll-zone/PlScrollZone.d.ts +9 -5
  221. package/dist/components/scroll-zone/PlScrollZone.js +1 -1
  222. package/dist/components/segmented-button/PlSegmentedButton.js +1 -1
  223. package/dist/components/select/PlSelect.d.ts +10 -1
  224. package/dist/components/select/PlSelect.js +1 -1
  225. package/dist/components/show/PlShow.d.ts +60 -0
  226. package/dist/components/show/PlShow.js +1 -0
  227. package/dist/components/show/index.d.ts +2 -0
  228. package/dist/components/show/index.js +1 -0
  229. package/dist/components/sidebar/PlSidebar.js +1 -1
  230. package/dist/components/skeleton/PlSkeleton.js +1 -1
  231. package/dist/components/slider/PlSlider.js +1 -1
  232. package/dist/components/sparkline/PlSparkline.d.ts +68 -0
  233. package/dist/components/sparkline/PlSparkline.js +1 -0
  234. package/dist/components/sparkline/index.d.ts +2 -0
  235. package/dist/components/sparkline/index.js +1 -0
  236. package/dist/components/spoiler/PlSpoiler.d.ts +8 -0
  237. package/dist/components/spoiler/PlSpoiler.js +1 -1
  238. package/dist/components/stack/PlStack.d.ts +114 -0
  239. package/dist/components/stack/PlStack.js +1 -0
  240. package/dist/components/stack/index.d.ts +2 -0
  241. package/dist/components/stack/index.js +1 -0
  242. package/dist/components/stat/PlStat.d.ts +66 -0
  243. package/dist/components/stat/PlStat.js +1 -0
  244. package/dist/components/stat/index.d.ts +2 -0
  245. package/dist/components/stat/index.js +1 -0
  246. package/dist/components/stepper/PlStepper.d.ts +86 -0
  247. package/dist/components/stepper/PlStepper.js +1 -0
  248. package/dist/components/stepper/index.d.ts +2 -0
  249. package/dist/components/stepper/index.js +1 -0
  250. package/dist/components/switch/PlSwitch.js +1 -1
  251. package/dist/components/table/PlTable.js +1 -1
  252. package/dist/components/tabs/PlTabs.d.ts +2 -2
  253. package/dist/components/tabs/PlTabs.js +1 -1
  254. package/dist/components/text-field/PlTextField.d.ts +10 -1
  255. package/dist/components/text-field/PlTextField.js +1 -1
  256. package/dist/components/text-link/PlTextLink.js +1 -1
  257. package/dist/components/time-picker/PlTimePicker.js +1 -1
  258. package/dist/components/timeline/PlTimeline.d.ts +7 -10
  259. package/dist/components/timeline/PlTimeline.js +1 -1
  260. package/dist/components/timeline-chart/PlTimelineChart.d.ts +44 -0
  261. package/dist/components/timeline-chart/PlTimelineChart.js +1 -0
  262. package/dist/components/timeline-chart/index.d.ts +2 -0
  263. package/dist/components/timeline-chart/index.js +1 -0
  264. package/dist/components/toast/PlToast.d.ts +1 -1
  265. package/dist/components/toast/PlToast.js +1 -1
  266. package/dist/components/toggle/PlToggle.js +1 -1
  267. package/dist/components/toggle/PlToggleGroup.js +1 -1
  268. package/dist/components/toolbar/PlToolbar.js +1 -1
  269. package/dist/components/tooltip/PlTooltip.d.ts +1 -1
  270. package/dist/components/tooltip/PlTooltip.js +1 -1
  271. package/dist/components/tour/PlTour.d.ts +134 -0
  272. package/dist/components/tour/PlTour.js +1 -0
  273. package/dist/components/tour/index.d.ts +2 -0
  274. package/dist/components/tour/index.js +1 -0
  275. package/dist/components/transfer/PlTransfer.js +1 -1
  276. package/dist/components/tree/PlTree.d.ts +67 -0
  277. package/dist/components/tree/PlTree.js +1 -0
  278. package/dist/components/tree/index.d.ts +2 -0
  279. package/dist/components/tree/index.js +1 -0
  280. package/dist/components/tree-select/PlTreeSelect.d.ts +99 -0
  281. package/dist/components/tree-select/PlTreeSelect.js +1 -0
  282. package/dist/components/tree-select/index.d.ts +2 -0
  283. package/dist/components/tree-select/index.js +1 -0
  284. package/dist/components/visually-hidden/PlVisuallyHidden.d.ts +46 -0
  285. package/dist/components/visually-hidden/PlVisuallyHidden.js +1 -0
  286. package/dist/components/visually-hidden/index.d.ts +2 -0
  287. package/dist/components/visually-hidden/index.js +1 -0
  288. package/dist/components/window-pane/PlWindowPane.d.ts +179 -0
  289. package/dist/components/window-pane/PlWindowPane.js +1 -0
  290. package/dist/components/window-pane/index.d.ts +2 -0
  291. package/dist/components/window-pane/index.js +1 -0
  292. package/dist/css/anchor.css +2 -0
  293. package/dist/css/animate-counter.css +2 -0
  294. package/dist/css/animate-float.css +2 -0
  295. package/dist/css/animate-reveal.css +2 -0
  296. package/dist/css/animate-scramble.css +2 -0
  297. package/dist/css/animate-shake.css +2 -0
  298. package/dist/css/animate-split.css +2 -0
  299. package/dist/css/app-logo.css +2 -0
  300. package/dist/css/area-chart.css +2 -0
  301. package/dist/css/back-top.css +2 -0
  302. package/dist/css/bar-chart.css +2 -0
  303. package/dist/css/calendar.css +2 -0
  304. package/dist/css/code-block.css +2 -0
  305. package/dist/css/confirm.css +2 -0
  306. package/dist/css/data-list.css +2 -0
  307. package/dist/css/data-table.css +2 -0
  308. package/dist/css/empty.css +2 -0
  309. package/dist/css/flex.css +2 -0
  310. package/dist/css/floating-action-button.css +2 -0
  311. package/dist/css/gallery.css +2 -0
  312. package/dist/css/gauge-chart.css +2 -0
  313. package/dist/css/heatmap-chart.css +2 -0
  314. package/dist/css/hover-card.css +2 -0
  315. package/dist/css/how-to-steps.css +2 -0
  316. package/dist/css/image.css +2 -0
  317. package/dist/css/line-chart.css +2 -0
  318. package/dist/css/meter.css +2 -0
  319. package/dist/css/mockup.css +2 -0
  320. package/dist/css/pie-chart.css +2 -0
  321. package/dist/css/popconfirm.css +2 -0
  322. package/dist/css/portal.css +2 -0
  323. package/dist/css/scatter-chart.css +2 -0
  324. package/dist/css/scroll-area.css +2 -0
  325. package/dist/css/show.css +2 -0
  326. package/dist/css/sparkline.css +2 -0
  327. package/dist/css/stack.css +2 -0
  328. package/dist/css/stat.css +2 -0
  329. package/dist/css/stepper.css +2 -0
  330. package/dist/css/timeline-chart.css +2 -0
  331. package/dist/css/tour.css +2 -0
  332. package/dist/css/tree-select.css +2 -0
  333. package/dist/css/tree.css +2 -0
  334. package/dist/css/visually-hidden.css +2 -0
  335. package/dist/css/window-pane.css +2 -0
  336. package/dist/hooks/index.d.ts +13 -0
  337. package/dist/hooks/index.js +1 -0
  338. package/dist/hooks/usePlBreakpoint.d.ts +41 -0
  339. package/dist/hooks/usePlBreakpoint.js +1 -0
  340. package/dist/hooks/usePlColorScheme.d.ts +66 -0
  341. package/dist/hooks/usePlColorScheme.js +1 -0
  342. package/dist/hooks/usePlDisclosure.d.ts +44 -0
  343. package/dist/hooks/usePlDisclosure.js +1 -0
  344. package/dist/hooks/usePlElementSize.d.ts +31 -0
  345. package/dist/hooks/usePlElementSize.js +1 -0
  346. package/dist/hooks/usePlHotKeys.d.ts +81 -0
  347. package/dist/hooks/usePlHotKeys.js +1 -0
  348. package/dist/hooks/usePlMediaQuery.d.ts +22 -0
  349. package/dist/hooks/usePlMediaQuery.js +1 -0
  350. package/dist/hooks/usePlOnScreen.d.ts +50 -0
  351. package/dist/hooks/usePlOnScreen.js +1 -0
  352. package/dist/hooks/usePlReducedMotion.d.ts +22 -0
  353. package/dist/hooks/usePlReducedMotion.js +1 -0
  354. package/dist/index.d.ts +46 -1
  355. package/dist/index.js +1 -1
  356. package/dist/internal/animate.d.ts +91 -6
  357. package/dist/internal/animate.js +1 -1
  358. package/dist/internal/breakpoints.d.ts +31 -0
  359. package/dist/internal/breakpoints.js +1 -0
  360. package/dist/internal/button-group.d.ts +29 -2
  361. package/dist/internal/button-group.js +2 -2
  362. package/dist/internal/calendar.d.ts +33 -36
  363. package/dist/internal/calendar.js +1 -1
  364. package/dist/internal/chart-frame.d.ts +458 -0
  365. package/dist/internal/chart-frame.js +1 -0
  366. package/dist/internal/chart-line.d.ts +44 -0
  367. package/dist/internal/chart-line.js +1 -0
  368. package/dist/internal/chart.d.ts +473 -0
  369. package/dist/internal/chart.js +1 -0
  370. package/dist/internal/color-scheme.d.ts +23 -0
  371. package/dist/internal/color-scheme.js +1 -0
  372. package/dist/internal/data-table.d.ts +69 -0
  373. package/dist/internal/data-table.js +1 -0
  374. package/dist/internal/date.d.ts +21 -0
  375. package/dist/internal/date.js +1 -1
  376. package/dist/internal/defaults.d.ts +74 -0
  377. package/dist/internal/defaults.js +1 -0
  378. package/dist/internal/direction.d.ts +4 -0
  379. package/dist/internal/direction.js +1 -0
  380. package/dist/internal/drag.d.ts +49 -0
  381. package/dist/internal/drag.js +1 -0
  382. package/dist/internal/format.d.ts +2 -0
  383. package/dist/internal/format.js +1 -1
  384. package/dist/internal/gallery.d.ts +34 -0
  385. package/dist/internal/gallery.js +1 -0
  386. package/dist/internal/grid.d.ts +6 -25
  387. package/dist/internal/grid.js +1 -1
  388. package/dist/internal/highlight.d.ts +98 -0
  389. package/dist/internal/highlight.js +1 -0
  390. package/dist/internal/icons.d.ts +10 -0
  391. package/dist/internal/icons.js +1 -1
  392. package/dist/internal/keys.d.ts +93 -0
  393. package/dist/internal/keys.js +1 -0
  394. package/dist/internal/labels.d.ts +138 -0
  395. package/dist/internal/labels.js +1 -0
  396. package/dist/internal/media.d.ts +26 -0
  397. package/dist/internal/media.js +1 -0
  398. package/dist/internal/mockup.d.ts +193 -0
  399. package/dist/internal/mockup.js +1 -0
  400. package/dist/internal/page-layout.d.ts +6 -6
  401. package/dist/internal/page-layout.js +1 -1
  402. package/dist/internal/progress.d.ts +6 -0
  403. package/dist/internal/responsive.d.ts +108 -0
  404. package/dist/internal/responsive.js +1 -0
  405. package/dist/internal/scramble.d.ts +31 -0
  406. package/dist/internal/scramble.js +1 -0
  407. package/dist/internal/steps.d.ts +76 -0
  408. package/dist/internal/steps.js +1 -0
  409. package/dist/internal/styles.d.ts +15 -0
  410. package/dist/internal/styles.js +1 -1
  411. package/dist/internal/table.d.ts +86 -0
  412. package/dist/internal/table.js +1 -0
  413. package/dist/internal/threshold.d.ts +19 -0
  414. package/dist/internal/threshold.js +1 -0
  415. package/dist/internal/tour.d.ts +42 -0
  416. package/dist/internal/tour.js +1 -0
  417. package/dist/internal/window.d.ts +201 -0
  418. package/dist/internal/window.js +1 -0
  419. package/dist/locales/de.d.ts +3 -0
  420. package/dist/locales/de.js +1 -0
  421. package/dist/locales/en.d.ts +2 -0
  422. package/dist/locales/en.js +1 -0
  423. package/dist/locales/es.d.ts +3 -0
  424. package/dist/locales/es.js +1 -0
  425. package/dist/locales/fr.d.ts +3 -0
  426. package/dist/locales/fr.js +1 -0
  427. package/dist/locales/index.d.ts +33 -0
  428. package/dist/locales/index.js +1 -0
  429. package/dist/locales/ja.d.ts +3 -0
  430. package/dist/locales/ja.js +1 -0
  431. package/dist/locales/ko.d.ts +3 -0
  432. package/dist/locales/ko.js +1 -0
  433. package/dist/locales/zh-Hans.d.ts +3 -0
  434. package/dist/locales/zh-Hans.js +1 -0
  435. package/dist/provider/PlColorSchemeScript.d.ts +40 -0
  436. package/dist/provider/PlColorSchemeScript.js +1 -0
  437. package/dist/provider/PlassProvider.d.ts +39 -0
  438. package/dist/provider/PlassProvider.js +1 -0
  439. package/dist/provider/index.d.ts +6 -0
  440. package/dist/provider/index.js +1 -0
  441. package/dist/styles.css +1 -1
  442. package/dist/tailwind.css +1133 -20
  443. package/dist/tokens.css +1133 -20
  444. package/dist/types.d.ts +398 -2
  445. package/package.json +30 -4
  446. package/dist/components/avatar-group/PlAvatarGroup.d.ts +0 -47
  447. package/dist/components/avatar-group/PlAvatarGroup.js +0 -1
  448. package/dist/components/avatar-group/index.d.ts +0 -2
  449. package/dist/components/avatar-group/index.js +0 -1
  450. package/dist/css/avatar-group.css +0 -2
  451. package/dist/internal/avatar-group.d.ts +0 -25
  452. package/dist/internal/avatar-group.js +0 -2
@@ -0,0 +1,473 @@
1
+ /**
2
+ * The arithmetic every chart is made of.
3
+ *
4
+ * Here rather than in a component for the reason `internal/progress.ts` is: five
5
+ * components draw five different marks and ask exactly the same four questions
6
+ * first — what is the range, where does a value land in the plot, what are the
7
+ * clean numbers to tick at, and what colour is series four. A chart file that
8
+ * also has to answer those is a file where the drawing cannot be read.
9
+ *
10
+ * There is no React in here and nothing in it knows what an SVG is. What it
11
+ * knows is data and pixels; `internal/chart-frame.tsx` is where those become elements.
12
+ *
13
+ * The scales are deliberately not a `d3-scale`. A linear scale is six lines, a
14
+ * band scale is four, and `nice numbers` is twelve — against a charting stack
15
+ * that would be the largest thing in the package. The same trade `internal/color.ts`
16
+ * makes.
17
+ */
18
+ import type * as React from 'react';
19
+ import type { PlassChartCategory, PlassChartDatum, PlassChartSeries, PlassDensity, PlassSize } from '../types.js';
20
+ /**
21
+ * How tall a plot is when nobody said, in pixels.
22
+ *
23
+ * A chart is one of the few things in the library with no intrinsic height — it
24
+ * is as tall as it is given — so this ladder is what stops every chart on a
25
+ * dashboard being a different shape. The steps climb faster than the control
26
+ * ladder because the thing being scaled is a *picture*: at `xs` this is a strip
27
+ * beside a number, at `xl` it is what the screen is about.
28
+ *
29
+ * The axis band is drawn *inside* this, not added to it. A card sized to the
30
+ * plot and then handed axis labels is the card that grows a two-line scrollbar.
31
+ */
32
+ export declare const plotHeights: Record<PlassSize, number>;
33
+ /**
34
+ * A PlSparkline's own ladder, which is a different object: it has no axes, no
35
+ * legend and nothing to read off it but the shape, so it is sized against the
36
+ * line of text it sits next to rather than against the page.
37
+ */
38
+ export declare const sparklineHeights: Record<PlassSize, number>;
39
+ /**
40
+ * The weight of a line, in pixels. `md` is 2, which is the width a data line
41
+ * wants everywhere — thin enough to stay a line where two of them cross, heavy
42
+ * enough to hold a hue at 3:1.
43
+ */
44
+ export declare const lineWidths: Record<PlassSize, number>;
45
+ /**
46
+ * The radius of a marker. `md` is 4, so the dot is 8px across before its ring —
47
+ * the floor below which a marker stops being something a pointer can find.
48
+ */
49
+ export declare const markerRadii: Record<PlassSize, number>;
50
+ /**
51
+ * Tick and label type, in pixels rather than as a class.
52
+ *
53
+ * SVG text does not inherit a Tailwind utility usefully — the `<text>` has to
54
+ * carry a `font-size` the layout arithmetic can also read, because the room the
55
+ * axis reserves is measured from it. These are `metaTextClasses` as numbers;
56
+ * keep the two in step.
57
+ */
58
+ export declare const chartFontSizes: Record<PlassSize, number>;
59
+ /**
60
+ * How thick a bar is allowed to get, in pixels.
61
+ *
62
+ * A cap and not a width: the band a bar sits in is whatever the plot divided by
63
+ * the category count gives, and a bar that fills its band leaves the chart with
64
+ * no air in it at all. Past this the leftover stays as space.
65
+ */
66
+ export declare const barMaxThickness: Record<PlassSize, number>;
67
+ /**
68
+ * How much of a band the bars in it take, before the cap above applies.
69
+ * `density` is the only thing that moves it — the same rule as everywhere else,
70
+ * spacing and nothing but spacing.
71
+ */
72
+ export declare const barBandRatio: Record<PlassDensity, number>;
73
+ /** The gap the surface shows through between two touching marks, in pixels. */
74
+ export declare const markGap = 2;
75
+ /** The corner cut off the data end of a bar. Square at the baseline. */
76
+ export declare const barRadius = 4;
77
+ /** The eight slots, as the `var()`s that resolve them per theme. */
78
+ export declare const chartPalette: readonly string[];
79
+ /** A `PlassColor` resolves to its readable-on-surface accent; anything else is CSS. */
80
+ export declare function resolveColor(value: string): string;
81
+ /**
82
+ * What colour a mark is, in the fixed order the palette is handed out in.
83
+ *
84
+ * `index` is the series' place in the array it was passed in, not its place
85
+ * among the ones currently visible. That is the whole point: filtering a legend
86
+ * must not repaint the survivors, because a reader who learned that Europe is
87
+ * blue has learned something that a re-render is not allowed to take back.
88
+ *
89
+ * Past the eighth slot it wraps, and a chart that gets there should not have —
90
+ * a ninth hue is indistinguishable from one of the first eight under colour
91
+ * vision deficiency no matter which one is chosen. Fold the tail into an
92
+ * "Other" series, or draw a second chart.
93
+ */
94
+ export declare function seriesColor(series: Pick<PlassChartSeries, 'color'> | undefined, index: number, palette?: readonly string[]): string;
95
+ /** A datum unpacked into the shape the drawing code reads. */
96
+ export interface ChartValue {
97
+ value: number | null;
98
+ x?: PlassChartCategory;
99
+ z?: number;
100
+ color?: string;
101
+ label?: React.ReactNode;
102
+ }
103
+ /**
104
+ * One datum, whichever of the three ways it was written.
105
+ *
106
+ * `NaN` is folded into `null` here rather than at every call site: it arrives
107
+ * from a division somewhere upstream, it means the same thing a gap means, and
108
+ * a scale that is handed one produces a path with the letters `NaN` in it —
109
+ * which fails silently as a blank chart rather than loudly as an error.
110
+ */
111
+ export declare function toValue(datum: PlassChartDatum): ChartValue;
112
+ /** Every series unpacked, in the order it was given. */
113
+ export declare function toValues(series: readonly PlassChartSeries[]): ChartValue[][];
114
+ /**
115
+ * A category as a number, for a category axis that is really a value axis.
116
+ *
117
+ * A `Date` is its epoch milliseconds, which is what makes a scatter of
118
+ * timestamps work at all. A string is not a position on a number line, so it
119
+ * comes back `null` rather than `NaN` — the same rule `toValue` follows, and
120
+ * for the same reason: a `NaN` reaches the scale and leaves the letters in the
121
+ * path.
122
+ */
123
+ export declare function toNumber(value: PlassChartCategory | undefined): number | null;
124
+ /**
125
+ * Where one point sits along a category axis that runs on numbers.
126
+ *
127
+ * The same three sources `categoryAt` reads, in the same order — but per
128
+ * *point* rather than per column, because on a scatter each series has its own
129
+ * x at every index and there is no column for them to share.
130
+ */
131
+ export declare function pointX(value: ChartValue, index: number, categories: readonly PlassChartCategory[] | undefined): number | null;
132
+ /**
133
+ * The extent of the category values, for a chart whose x is a number.
134
+ *
135
+ * Only points that have a `y` count. A point with no value is not on the plot,
136
+ * so letting its `x` stretch the axis would leave a margin of empty plot
137
+ * standing in for data that was never drawn.
138
+ */
139
+ export declare function categoryExtent(values: readonly ChartValue[][], categories: readonly PlassChartCategory[] | undefined): {
140
+ min: number;
141
+ max: number;
142
+ } | null;
143
+ /**
144
+ * The radius a bubble gets for its `z`, in pixels.
145
+ *
146
+ * `z` is an **area** and not a radius, which is the single most common way a
147
+ * bubble chart lies: encode it as a radius and a value twice as large draws a
148
+ * mark four times the size. The square root is what makes the ink on the page
149
+ * proportional to the number behind it.
150
+ *
151
+ * `min` is a floor rather than a scale — a bubble for a small-but-real value
152
+ * has to stay something a pointer can find, and a zero is the only thing
153
+ * allowed to disappear.
154
+ */
155
+ export declare function bubbleRadius(z: number, maxZ: number, max: number, min: number): number;
156
+ /** How many categories the widest series has. */
157
+ export declare function categoryCount(series: readonly PlassChartSeries[]): number;
158
+ /**
159
+ * What the category axis says at position `index`.
160
+ *
161
+ * `categories` wins, then whatever the first series that has one calls its own
162
+ * point, then the index. Three sources rather than one because a chart is
163
+ * written both ways in the wild — a column of labels beside a column of
164
+ * numbers, or points that carry their own `x` — and neither is wrong.
165
+ */
166
+ export declare function categoryAt(index: number, categories: readonly PlassChartCategory[] | undefined, values: readonly ChartValue[][]): PlassChartCategory;
167
+ /**
168
+ * The extent of the values, with the stacking rule applied.
169
+ *
170
+ * Stacked charts measure the *totals* and not the parts, and the two arms are
171
+ * accumulated separately so a series that goes negative does not shorten the
172
+ * bar above it. An all-`null` chart has no extent at all, which is what the
173
+ * `null` return says — the caller draws its empty state rather than an axis
174
+ * from `Infinity` to `-Infinity`.
175
+ */
176
+ export declare function extentOf(values: readonly ChartValue[][], stacked: boolean): {
177
+ min: number;
178
+ max: number;
179
+ } | null;
180
+ /** A value scale: where it starts, where it ends, and what it ticks at. */
181
+ export interface ValueScale {
182
+ min: number;
183
+ max: number;
184
+ ticks: number[];
185
+ /** A value → a fraction of the plot, `0` at `min` and `1` at `max`. */
186
+ fraction: (value: number) => number;
187
+ }
188
+ /**
189
+ * The scale a value axis runs on, rounded out to clean numbers.
190
+ *
191
+ * Rounding *outward* is the part that matters: a maximum of 4,830 becomes 5,000
192
+ * and not 4,830, so the top tick is a number and the tallest bar stops short of
193
+ * the ceiling. A scale whose last bar touches the frame reads as clipped even
194
+ * when it is exactly right.
195
+ *
196
+ * Zero is included unless the caller says otherwise, because bar length is only
197
+ * proportional to value when the baseline is zero. A line chart of a quantity
198
+ * that never approaches zero is the case for passing `min` — and it is a case
199
+ * the caller has to make, not one the chart makes for them.
200
+ */
201
+ export declare function valueScale(extent: {
202
+ min: number;
203
+ max: number;
204
+ } | null, options?: {
205
+ min?: number;
206
+ max?: number;
207
+ tickCount?: number;
208
+ /** Keeps zero in range. Off for a line chart told an explicit `min`. */
209
+ includeZero?: boolean;
210
+ }): ValueScale;
211
+ /** The units a time axis is allowed to step in. */
212
+ export type TimeUnit = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year';
213
+ /** A value scale whose numbers are instants, and the unit its ticks step in. */
214
+ export interface TimeScale extends ValueScale {
215
+ unit: TimeUnit;
216
+ /** How many of that unit each step covers — 1, 5, 15 minutes and so on. */
217
+ step: number;
218
+ }
219
+ /**
220
+ * The scale a time axis runs on, ticking where a calendar ticks.
221
+ *
222
+ * The ends round *outward* to the step for the reason `valueScale`'s do: a span
223
+ * that starts exactly on the left edge reads as clipped rather than as
224
+ * starting there. Past a year the 1-2-5 family comes back, because above the
225
+ * year time really is decimal — decades and centuries are the only units left.
226
+ */
227
+ export declare function timeScale(extent: {
228
+ min: number;
229
+ max: number;
230
+ } | null, options?: {
231
+ min?: number;
232
+ max?: number;
233
+ tickCount?: number;
234
+ }): TimeScale;
235
+ /** One instant on a time axis, written unambiguously — for a tooltip or a table. */
236
+ export declare function formatTimeValue(value: number, unit: TimeUnit, locale?: string): string;
237
+ /**
238
+ * A whole axis of ticks, written the way an axis is read.
239
+ *
240
+ * The year is decided for the axis rather than for each tick, and that is the
241
+ * part worth explaining. Writing it only where it *changes* is what a reader
242
+ * wants and is not safe here: the labels are thinned again downstream, by a
243
+ * stride measured against the plot's real width, and the tick the year was
244
+ * riding on is exactly the one that gets dropped — leaving `Oct 2025 · Dec ·
245
+ * Feb` with nothing to say which year February is in.
246
+ *
247
+ * So: an axis inside one year names it once, on the first tick, which is the
248
+ * one tick a stride never removes. An axis that crosses a year names it on
249
+ * every tick, so whichever ones survive are each unambiguous. Wider labels mean
250
+ * a heavier stride, and a heavier stride is the better failure.
251
+ */
252
+ export declare function formatTimeTicks(ticks: readonly number[], unit: TimeUnit, locale?: string): string[];
253
+ /**
254
+ * How many ticks a category axis can show before the labels collide, and which
255
+ * ones they are.
256
+ *
257
+ * Every nth label rather than rotating them: a rotated axis is unreadable at a
258
+ * glance and it steals a band of the plot to be unreadable in. `n` is chosen so
259
+ * the labels clear each other at the measured width, and it always keeps the
260
+ * first — a reader who cannot see where the axis starts cannot read any of it.
261
+ */
262
+ export declare function tickStride(count: number, available: number, labelWidth: number): number;
263
+ /**
264
+ * Whether the label at `index` survives the stride.
265
+ *
266
+ * Every nth, and — when it fits — the last one, which is the part a plain
267
+ * modulo gets wrong: a fourteen-day axis at a stride of two ends at day
268
+ * thirteen, and a percentage axis ends at 80%. The end of a scale is the number
269
+ * a reader looks for first, and dropping it to keep the arithmetic tidy is the
270
+ * wrong trade.
271
+ *
272
+ * `roomForLast` is the other half of it and is measured rather than guessed —
273
+ * see `fitsLast`. Forcing a label that does not fit turns a missing "Jun" into
274
+ * an overlapping "MayJun", which is worse than what it fixed.
275
+ */
276
+ export declare function showsTick(index: number, count: number, stride: number, roomForLast: boolean): boolean;
277
+ /**
278
+ * Whether the last label clears the last one the stride kept.
279
+ *
280
+ * The two are `(count - 1) % stride` steps apart, and they need half of each
281
+ * label plus a little air between them — labels are centred on their tick, so
282
+ * only the inner halves can collide.
283
+ */
284
+ export declare function fitsLast(count: number, stride: number, step: number, labelWidth: number): boolean;
285
+ /**
286
+ * Roughly how wide a string renders at a given font size.
287
+ *
288
+ * An estimate on purpose. The alternative is a canvas measurement per label per
289
+ * render, which is a layout read on a path that runs on every resize — and what
290
+ * this number is used for is deciding how much room to reserve, where being a
291
+ * few pixels generous costs nothing and being exact costs a reflow.
292
+ *
293
+ * 0.6em is the average advance of a digit in the sans-serifs a UI runs in;
294
+ * anything CJK is close to a full em, so the widest character decides.
295
+ */
296
+ export declare function textWidth(text: string, fontSize: number): number;
297
+ /**
298
+ * A label cut to the room it has, with an ellipsis.
299
+ *
300
+ * The alternative when a category name is wider than its slot is to drop
301
+ * labels until the survivors fit, and on five categories called things like
302
+ * "Onboarding flow" that leaves exactly one of them on the axis — an axis with
303
+ * one label is not a shorter axis, it is an unlabelled one. Cut instead: the
304
+ * first few characters distinguish five words, and the tooltip and the table
305
+ * both still have the whole thing.
306
+ */
307
+ export declare function truncate(text: string, maxWidth: number, fontSize: number): string;
308
+ /** The plot's box inside the chart, once the axes have taken their bands. */
309
+ export interface PlotBox {
310
+ left: number;
311
+ top: number;
312
+ width: number;
313
+ height: number;
314
+ }
315
+ /** A band scale: one slot per category, with the marks centred in it. */
316
+ export interface BandScale {
317
+ /** The centre of category `index`, in pixels along the axis. */
318
+ centre: (index: number) => number;
319
+ /** How wide one slot is. */
320
+ step: number;
321
+ /** How wide the marks in a slot are allowed to be, together. */
322
+ band: number;
323
+ }
324
+ export declare function bandScale(count: number, length: number, ratio: number): BandScale;
325
+ /**
326
+ * A path through the points, in whichever of the three shapes was asked for.
327
+ *
328
+ * `null` breaks the path rather than interpolating across it — the `M` that
329
+ * starts a new subpath is the gap. A line that bridges a missing month is a
330
+ * line that invents a number.
331
+ *
332
+ * `smooth` is a monotone cubic and not a Catmull-Rom, which is not a detail: a
333
+ * plain spline overshoots between two close points, so a series that never goes
334
+ * below zero draws a curve that does. A chart is allowed to be curved and it is
335
+ * not allowed to show a value that is not in the data.
336
+ */
337
+ export declare function linePath(points: readonly ({
338
+ x: number;
339
+ y: number;
340
+ } | null)[], curve: 'linear' | 'smooth' | 'step'): string;
341
+ /**
342
+ * The same path closed down to a baseline, for an area.
343
+ *
344
+ * Built from the runs rather than from the whole line so a gap is a gap in the
345
+ * fill too — an area that closes across a missing month fills in a value that
346
+ * was never measured, which is the same lie the bridged line tells, painted
347
+ * over a larger part of the chart.
348
+ */
349
+ export declare function areaPath(points: readonly ({
350
+ x: number;
351
+ y: number;
352
+ } | null)[], baseline: readonly ({
353
+ x: number;
354
+ y: number;
355
+ } | null)[] | number, curve: 'linear' | 'smooth' | 'step'): string;
356
+ /**
357
+ * A rectangle with the two corners at its *data end* cut off.
358
+ *
359
+ * Rounded at the end and square at the baseline, which is not a stylistic
360
+ * split: a bar that is rounded where it meets the axis has lost the exact
361
+ * moment it starts, and a row of them turns the baseline into a scalloped edge.
362
+ * The end is where the value is, and that is the end worth softening.
363
+ *
364
+ * The radius shrinks to fit rather than clipping, so a bar two pixels tall is a
365
+ * bar and not a circle. `end` is which way the value grows.
366
+ */
367
+ export declare function barPath(x: number, y: number, width: number, height: number, radius: number, end: 'up' | 'down' | 'left' | 'right'): string;
368
+ /**
369
+ * The shapes a point mark can take.
370
+ *
371
+ * The dependable second identity channel, and the only chart form with one
372
+ * going spare: a line cannot be a triangle and a bar cannot be a cross, but a
373
+ * dot can be anything. Five is enough for every palette a chart is allowed.
374
+ */
375
+ export type MarkShape = 'circle' | 'square' | 'triangle' | 'diamond' | 'cross';
376
+ /** The order shapes are handed out in, matching the palette: fixed, never cycled. */
377
+ export declare const markShapes: readonly MarkShape[];
378
+ /**
379
+ * One point mark, as a path, centred on `cx`/`cy` and covering the same area a
380
+ * circle of radius `r` would.
381
+ *
382
+ * A circle comes back as a path too rather than as a `<circle>`, so whoever
383
+ * draws the marks writes one element and not a branch — the ring, the fill and
384
+ * the hover treatment are then unarguably the same on all five.
385
+ */
386
+ export declare function markPath(shape: MarkShape, cx: number, cy: number, r: number): string;
387
+ /**
388
+ * The centre line of that slice, as an *open* path.
389
+ *
390
+ * `arcPath` below draws the slice itself, which is a closed shape — and a shape
391
+ * whose `d` has to be rewritten every time the value moves. `d` is not a
392
+ * property CSS can travel along, so a dial drawn that way jumps to each new
393
+ * reading. Stroked instead, the same ring is one line with a width, and how much
394
+ * of it is drawn is `stroke-dashoffset`, which is a number and does travel.
395
+ *
396
+ * It is what ProgressCircular already does, bent to an arbitrary span — which is
397
+ * the point: a gauge is a Meter bent into an arc, and the four indicators in
398
+ * this library have to agree about what a value changing looks like.
399
+ *
400
+ * Angles are degrees clockwise from twelve o'clock, as below.
401
+ */
402
+ export declare function ringPath(cx: number, cy: number, radius: number, from: number, to: number): string;
403
+ /**
404
+ * A slice of a ring, as a path.
405
+ *
406
+ * `inner` of 0 is a pie and anything above it is a donut. Angles are degrees
407
+ * clockwise from twelve o'clock, which is where a reader starts reading a
408
+ * circle — SVG's own zero is at three o'clock, and the offset is applied here
409
+ * once rather than at four call sites.
410
+ */
411
+ export declare function arcPath(cx: number, cy: number, outer: number, inner: number, from: number, to: number): string;
412
+ /** Which way a magnitude is coloured. */
413
+ export type ChartScaleKind = 'sequential' | 'diverging';
414
+ /** How many steps each ramp has. Five, and the reason is in `styles.css`. */
415
+ export declare const rampSteps = 5;
416
+ /**
417
+ * The step a value lands on, and the ink a label on it wears.
418
+ *
419
+ * A magnitude is not an identity, so it does not come off the eight-slot
420
+ * categorical ramp — see the note above `--plass-chart-seq-1`. It comes off a
421
+ * one-hue ladder, and which rung is arithmetic on the value.
422
+ *
423
+ * A diverging scale is read from its *middle* rather than from its bottom, so
424
+ * it is the distance either side of the neutral that is scaled — and by the
425
+ * larger of the two arms, so a set running from −2 to +40 does not paint every
426
+ * negative the deepest blue there is.
427
+ */
428
+ export declare function rampStep(value: number, min: number, max: number, kind: ChartScaleKind, midpoint?: number): number;
429
+ /** The `var()` for a step of the ramp, and for the ink that reads on it. */
430
+ export declare function rampFill(step: number, kind: ChartScaleKind): string;
431
+ export declare function rampInk(step: number, kind: ChartScaleKind): string;
432
+ /** One tile, in pixels, and which value it came from. */
433
+ export interface TreemapTile {
434
+ index: number;
435
+ x: number;
436
+ y: number;
437
+ width: number;
438
+ height: number;
439
+ }
440
+ /**
441
+ * A squarified treemap: the values as boxes whose areas are proportional, laid
442
+ * out as close to square as they can be got.
443
+ *
444
+ * Squarified rather than sliced, and the difference is the whole reason the
445
+ * forty lines are worth it. A slice-and-dice treemap of twenty values ends in
446
+ * slivers a pixel wide, and a sliver's *area* is unreadable however exact it is
447
+ * — the reader compares its length instead, which is not the encoded quantity.
448
+ * Bruls, Huizing and van Wijk's answer is greedy and simple: fill a row along
449
+ * the box's shorter side, keep adding to it while the worst aspect ratio in it
450
+ * improves, and start a new row the moment it stops.
451
+ *
452
+ * The order is the caller's; the layout sorts descending internally because the
453
+ * algorithm needs it and hands the original index back on every tile, so a
454
+ * tile's colour and its name are still its own.
455
+ */
456
+ export declare function squarify(values: readonly number[], width: number, height: number): TreemapTile[];
457
+ /**
458
+ * How a category is written when nobody said.
459
+ *
460
+ * A `Date` gets the reader's own short form, because the alternative is an ISO
461
+ * string across the bottom of every time series. Everything else is `String`,
462
+ * which is what the caller wrote it as.
463
+ */
464
+ export declare function formatCategory(value: PlassChartCategory, locale?: string): string;
465
+ /**
466
+ * A number, compactly enough that a y-axis of thousands is not four labels of
467
+ * seven characters.
468
+ *
469
+ * Only when the caller passed no `format` of their own — the moment they do,
470
+ * they have said what the number means and the library's opinion about
471
+ * thousands separators stops being welcome.
472
+ */
473
+ export declare function compactNumber(value: number, locale?: string): string;
@@ -0,0 +1 @@
1
+ import{dateFormatter as t,numberFormatter as e}from"./format.js";export const plotHeights={xs:120,sm:160,md:220,lg:280,xl:360};export const sparklineHeights={xs:16,sm:20,md:28,lg:40,xl:56};export const lineWidths={xs:1.5,sm:1.75,md:2,lg:2.25,xl:2.5};export const markerRadii={xs:3,sm:3.5,md:4,lg:4.5,xl:5};export const chartFontSizes={xs:10,sm:11,md:12,lg:13,xl:14};export const barMaxThickness={xs:14,sm:18,md:24,lg:30,xl:36};export const barBandRatio={default:.62,compact:.82};export const markGap=2;export const barRadius=4;export const chartPalette=["var(--plass-chart-1)","var(--plass-chart-2)","var(--plass-chart-3)","var(--plass-chart-4)","var(--plass-chart-5)","var(--plass-chart-6)","var(--plass-chart-7)","var(--plass-chart-8)"];const n=new Set(["primary","secondary","success","warning","danger","info"]);export function resolveColor(t){return n.has(t)?`var(--plass-${t}-accent)`:t}export function seriesColor(t,e,n=chartPalette){return resolveColor(t?.color?t.color:n[e%n.length]??chartPalette[0])}export function toValue(t){return null==t?{value:null}:"number"==typeof t?{value:Number.isFinite(t)?t:null}:(t=>"object"==typeof t&&null!==t)(t)?{value:null!==t.y&&Number.isFinite(t.y)?t.y:null,x:t.x,z:t.z,color:t.color?resolveColor(t.color):void 0,label:t.label}:{value:null}}export function toValues(t){return t.map(t=>t.data.map(toValue))}export function toNumber(t){return t instanceof Date?Number.isFinite(t.getTime())?t.getTime():null:"number"==typeof t&&Number.isFinite(t)?t:null}export function pointX(t,e,n){return toNumber(t.x??n?.[e]??e)}export function categoryExtent(t,e){let n=1/0,r=-1/0,o=!1;return t.forEach(t=>{t.forEach((t,a)=>{if(null===t.value)return;const i=pointX(t,a,e);null!==i&&(o=!0,n=Math.min(n,i),r=Math.max(r,i))})}),o?{min:n,max:r}:null}export function bubbleRadius(t,e,n,r){return e>0&&Number.isFinite(t)&&!(t<=0)?Math.max(r,Math.sqrt(Math.min(t,e)/e)*n):0===t?0:r}export function categoryCount(t){return t.reduce((t,e)=>Math.max(t,e.data.length),0)}export function categoryAt(t,e,n){if(e&&t<e.length)return e[t];for(const e of n){const n=e[t]?.x;if(void 0!==n)return n}return t}export function extentOf(t,e){let n=1/0,r=-1/0,o=!1;if(e){const e=t.reduce((t,e)=>Math.max(t,e.length),0);for(let a=0;a<e;a++){let e=0,i=0;for(const n of t){const t=n[a]?.value;null!=t&&(o=!0,t>=0?e+=t:i+=t)}n=Math.min(n,i),r=Math.max(r,e)}}else for(const e of t)for(const{value:t}of e)null!==t&&(o=!0,n=Math.min(n,t),r=Math.max(r,t));return o?{min:n,max:r}:null}function niceStep(t){const e=10**Math.floor(Math.log10(t)),n=t/e;return n<=1?e:n<=2?2*e:n<=5?5*e:10*e}export function valueScale(t,e={}){const{tickCount:n=5,includeZero:r=!0}=e;let o=e.min??(t?t.min:0),a=e.max??(t?t.max:1);if(r&&void 0===e.min&&(o=Math.min(o,0)),r&&void 0===e.max&&(a=Math.max(a,0)),a===o){const t=Math.abs(a)>0?.5*Math.abs(a):1;o-=t,a+=t}const i=void 0!==e.min&&void 0!==e.max?function dividingStep(t,e){const n=10**Math.floor(Math.log10(t/Math.max(1,e)));let r=niceStep(t/Math.max(1,e)),o=1/0;for(const a of[.1,1,10])for(const i of[1,2,2.5,5]){const u=i*a*n,s=t/u,c=Math.round(s);if(c<1||Math.abs(s-c)>1e-9)continue;const l=Math.abs(c-e);l<o&&(o=l,r=u)}return r}(a-o,n):niceStep((a-o)/Math.max(1,n)),u=void 0!==e.min?o:Math.floor(o/i)*i,s=void 0!==e.max?a:Math.ceil(a/i)*i,c=s-u||1,l=[];for(let t=u;t<=s+1e-9*i;t+=i)l.push(Number(t.toFixed(12)));return{min:u,max:s,ticks:l,fraction:t=>(t-u)/c}}const r=1e3,o=6e4,a=36e5,i=24*a,u=[{unit:"second",count:1,size:r},{unit:"second",count:5,size:5e3},{unit:"second",count:15,size:15e3},{unit:"second",count:30,size:3e4},{unit:"minute",count:1,size:o},{unit:"minute",count:5,size:3e5},{unit:"minute",count:15,size:9e5},{unit:"minute",count:30,size:18e5},{unit:"hour",count:1,size:a},{unit:"hour",count:3,size:3*a},{unit:"hour",count:6,size:6*a},{unit:"hour",count:12,size:12*a},{unit:"day",count:1,size:i},{unit:"day",count:2,size:2*i},{unit:"week",count:1,size:7*i},{unit:"week",count:2,size:14*i},{unit:"month",count:1,size:30*i},{unit:"quarter",count:1,size:91*i},{unit:"month",count:6,size:182*i},{unit:"year",count:1,size:365*i}];function addTime(t,e,n){const a=new Date(t);if("year"===e)a.setFullYear(a.getFullYear()+n);else if("quarter"===e)a.setMonth(a.getMonth()+3*n);else if("month"===e)a.setMonth(a.getMonth()+n);else if("week"===e)a.setDate(a.getDate()+7*n);else if("day"===e)a.setDate(a.getDate()+n);else{if("hour"!==e)return t+n*("minute"===e?o:r);a.setHours(a.getHours()+n)}return a.getTime()}const s={second:"minute",minute:"hour",hour:"day",day:"month",week:"week",month:"year",quarter:"year",year:"year"};export function timeScale(t,e={}){const{tickCount:n=6}=e;let a=e.min??t?.min??Date.parse("2000-01-01T00:00:00"),c=e.max??t?.max??a+i;c<=a&&(a-=i/2,c+=i/2);const l=c-a;let h=u[0],m=1/0;for(const t of u){const e=Math.abs(l/t.size-n);e<m&&(m=e,h=t)}const $=h.unit,f="year"===$?Math.max(1,Math.round(niceStep(l/n/(365*i)))):h.count,x=e.min??function alignTime(t,e,n){let a=function floorTime(t,e){const n=new Date(t);if("year"===e)return new Date(n.getFullYear(),0,1).getTime();if("quarter"===e)return new Date(n.getFullYear(),3*Math.floor(n.getMonth()/3),1).getTime();if("month"===e)return new Date(n.getFullYear(),n.getMonth(),1).getTime();if("week"===e){const t=new Date(n.getFullYear(),n.getMonth(),n.getDate());return t.setDate(t.getDate()-t.getDay()),t.getTime()}return"day"===e?new Date(n.getFullYear(),n.getMonth(),n.getDate()).getTime():"hour"===e?new Date(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours()).getTime():"minute"===e?Math.floor(t/o)*o:Math.floor(t/r)*r}(t,s[e]);if("year"===e&&n>1){const t=new Date(a).getFullYear();a=new Date(t-(t%n+n)%n,0,1).getTime()}for(let r=0;r<500;r++){const r=addTime(a,e,n);if(r>t)return a;a=r}return a}(a,$,f),p=[];let M=x;for(let t=0;t<500&&(p.push(M),!(M>c));t++)M=addTime(M,$,f);const g=e.max??p[p.length-1],d=g-x||1;return{min:x,max:g,ticks:p.filter(t=>t>=x&&t<=g),unit:$,step:f,fraction:t=>(t-x)/d}}function timeParts(t,e){if("second"===t)return{hour:"2-digit",minute:"2-digit",second:"2-digit",hourCycle:"h23"};if("minute"===t||"hour"===t)return{hour:"2-digit",minute:"2-digit",hourCycle:"h23"};if("year"===t)return{year:"numeric"};const n="month"===t||"quarter"===t?{month:"short"}:{month:"short",day:"numeric"};return e?{...n,year:"numeric"}:n}export function formatTimeValue(e,n,r){return t(r,timeParts(n,!0)).format(new Date(e))}export function formatTimeTicks(e,n,r){const o=new Set(e.map(t=>new Date(t).getFullYear())).size>1;return e.map((e,a)=>t(r,timeParts(n,o||0===a)).format(new Date(e)))}export function tickStride(t,e,n){if(t<=1||e<=0)return 1;const r=Math.max(1,Math.floor(e/Math.max(1,n)));return Math.max(1,Math.ceil(t/r))}export function showsTick(t,e,n,r){return t%n===0||r&&t===e-1}export function fitsLast(t,e,n,r){const o=(t-1)%e;return o>0&&o*n>=r+8}export function textWidth(t,e){let n=0;for(const e of t)n+=/[ᄀ-ᇿ⺀-꓏가-퟿豈-﫿︰-﹏]/.test(e)?1:.6;return n*e}export function truncate(t,e,n){if(e<=0||textWidth(t,n)<=e)return t;const r=e-textWidth("…",n);let o="",a=0;for(const e of t){const t=a+textWidth(e,n);if(t>r)break;a=t,o+=e}return o.length>0?`${o.trimEnd()}…`:"…"}export function bandScale(t,e,n){const r=t>0?e/t:e;return{step:r,band:r*n,centre:t=>r*(t+.5)}}export function linePath(t,e){const n=[];let r=[];const flush=()=>{if(0!==r.length){if(1===r.length)n.push(`M${r[0].x} ${r[0].y}h0`);else if("step"===e){n.push(`M${r[0].x} ${r[0].y}`);for(let t=1;t<r.length;t++){const e=(r[t-1].x+r[t].x)/2;n.push(`H${e}V${r[t].y}H${r[t].x}`)}}else if("smooth"===e)n.push(`M${r[0].x} ${r[0].y}`),n.push(function monotonePath(t){const e=t.length,n=[];for(let r=0;r<e-1;r++){const e=t[r+1].x-t[r].x;n.push(0===e?0:(t[r+1].y-t[r].y)/e)}const r=[n[0]??0];for(let t=1;t<e-1;t++){const e=n[t-1],o=n[t];r.push(e*o<=0?0:2*e*o/(e+o))}r.push(n[e-2]??0);const o=[];for(let n=0;n<e-1;n++){const e=(t[n+1].x-t[n].x)/3;o.push(`C${t[n].x+e} ${t[n].y+r[n]*e} ${t[n+1].x-e} ${t[n+1].y-r[n+1]*e} ${t[n+1].x} ${t[n+1].y}`)}return o.join("")}(r));else{n.push(`M${r[0].x} ${r[0].y}`);for(let t=1;t<r.length;t++)n.push(`L${r[t].x} ${r[t].y}`)}r=[]}};for(const e of t)null===e?flush():r.push(e);return flush(),n.join("")}export function areaPath(t,e,n){const r=[];let o=0;const flush=a=>{const i=t.slice(o,a).filter(Boolean);if(0===i.length)return;const u="number"==typeof e?i.map(t=>({x:t.x,y:e})).reverse():e.slice(o,a).filter(Boolean).reverse();if(0===u.length)return;const s=linePath(i,n),c=linePath(u,n).replace(/^M/,"L");r.push(`${s}${c}Z`)};for(let e=0;e<t.length;e++)null===t[e]&&(flush(e),o=e+1);return flush(t.length),r.join("")}export function barPath(t,e,n,r,o,a){const i=Math.max(0,Math.min(o,n/2,r/2));if(0===i||n<=0||r<=0)return`M${t} ${e}h${n}v${r}h${-n}Z`;const arc=(t,e)=>`a${i} ${i} 0 0 1 ${t} ${e}`;return"up"===a?`M${t} ${e+r}V${e+i}${arc(i,-i)}H${t+n-i}${arc(i,i)}V${e+r}Z`:"down"===a?`M${t} ${e}H${t+n}V${e+r-i}${arc(-i,i)}H${t+i}${arc(-i,-i)}Z`:"right"===a?`M${t} ${e}H${t+n-i}${arc(i,i)}V${e+r-i}${arc(-i,i)}H${t}Z`:`M${t+n} ${e+r}H${t+i}${arc(-i,-i)}V${e+i}${arc(i,-i)}H${t+n}Z`}export const markShapes=["circle","square","triangle","diamond","cross"];const c={circle:1,square:.8862,triangle:1.5551,diamond:1.2533,cross:1.189};export function markPath(t,e,n,r){const o=Math.max(0,r)*c[t];if(0===o)return"";if("circle"===t)return`M${e-o} ${n}a${o} ${o} 0 1 0 ${2*o} 0a${o} ${o} 0 1 0 ${2*-o} 0Z`;if("square"===t)return`M${e-o} ${n-o}h${2*o}v${2*o}h${2*-o}Z`;if("diamond"===t)return`M${e} ${n-o}L${e+o} ${n}L${e} ${n+o}L${e-o} ${n}Z`;if("triangle"===t)return`M${[0,120,240].map(t=>{const r=(t-90)*Math.PI/180;return`${e+o*Math.cos(r)} ${n+o*Math.sin(r)}`}).join("L")}Z`;const a=o/3;return`M${e-a} ${n-o}h${2*a}v${o-a}h${o-a}v${2*a}h${-(o-a)}v${o-a}h${2*-a}v${-(o-a)}h${-(o-a)}v${2*-a}h${o-a}Z`}export function ringPath(t,e,n,r,o){const point=r=>{const o=(r-90)*Math.PI/180;return`${t+n*Math.cos(o)} ${e+n*Math.sin(o)}`};if(Math.abs(o-r)>=360){const t=r+180;return`M${point(r)}A${n} ${n} 0 1 1 ${point(t)}A${n} ${n} 0 1 1 ${point(r)}`}const a=Math.abs(o-r)>180?1:0;return`M${point(r)}A${n} ${n} 0 ${a} 1 ${point(o)}`}export function arcPath(t,e,n,r,o,a){const point=(n,r)=>{const o=(r-90)*Math.PI/180;return`${t+n*Math.cos(o)} ${e+n*Math.sin(o)}`};if(Math.abs(a-o)>=360){const t=o+180;return r>0?`M${point(n,o)}A${n} ${n} 0 1 1 ${point(n,t)}A${n} ${n} 0 1 1 ${point(n,o)}ZM${point(r,o)}A${r} ${r} 0 1 0 ${point(r,t)}A${r} ${r} 0 1 0 ${point(r,o)}Z`:`M${point(n,o)}A${n} ${n} 0 1 1 ${point(n,t)}A${n} ${n} 0 1 1 ${point(n,o)}Z`}const i=Math.abs(a-o)>180?1:0;return r<=0?`M${t} ${e}L${point(n,o)}A${n} ${n} 0 ${i} 1 ${point(n,a)}Z`:`M${point(n,o)}A${n} ${n} 0 ${i} 1 ${point(n,a)}L${point(r,a)}A${r} ${r} 0 ${i} 0 ${point(r,o)}Z`}export const rampSteps=5;export function rampStep(t,e,n,r,o=0){if("diverging"===r){const r=Math.max(Math.abs(n-o),Math.abs(o-e));if(!(r>0))return 2;const a=(t-o)/r;return Math.min(4,Math.max(0,2+Math.round(2*a)))}const a=n-e;return a>0?Math.min(4,Math.max(0,Math.floor((t-e)/a*5))):4}export function rampFill(t,e){return`var(--plass-chart-${"diverging"===e?"div":"seq"}-${t+1})`}export function rampInk(t,e){return`var(--plass-chart-${"diverging"===e?"div":"seq"}-on-${t+1})`}export function squarify(t,e,n){const r=t.reduce((t,e)=>t+Math.max(0,e),0);if(!(r>0)||e<=0||n<=0)return[];const o=e*n/r,a=t.map((t,e)=>({index:e,area:Math.max(0,t)*o})).filter(t=>t.area>0).sort((t,e)=>e.area-t.area),i=[];let u=0,s=0,c=e,l=n,h=[];const worst=t=>{const e=Math.min(c,l),n=t.reduce((t,e)=>t+e.area,0);if(!(n>0&&e>0))return 1/0;const r=t[0].area,o=t[t.length-1].area;return Math.max(e*e*r/(n*n),n*n/(e*e*o))},place=()=>{const t=h.reduce((t,e)=>t+e.area,0),e=Math.min(c,l),n=e>0?t/e:0,r=c>=l;let o=0;for(const t of h){const e=n>0?t.area/n:0;i.push(r?{index:t.index,x:u,y:s+o,width:n,height:e}:{index:t.index,x:u+o,y:s,width:e,height:n}),o+=e}r?(u+=n,c-=n):(s+=n,l-=n),h=[]};for(const t of a)0===h.length||worst([...h,t])<=worst(h)||place(),h.push(t);return h.length>0&&place(),i}const l={month:"short",day:"numeric"},h={notation:"compact",maximumFractionDigits:1},m={maximumFractionDigits:2};export function formatCategory(e,n){return e instanceof Date?t(n,l).format(e):String(e)}export function compactNumber(t,n){return Math.abs(t)>=1e4?e(n,h).format(t):e(n,m).format(t)}
@@ -0,0 +1,23 @@
1
+ /** What the reader chose. `system` is the absence of a choice, not a third theme. */
2
+ export type PlColorScheme = 'light' | 'dark' | 'system';
3
+ /** What the page is actually painted in, once `system` has been resolved. */
4
+ export type PlResolvedColorScheme = 'light' | 'dark';
5
+ export declare const DEFAULT_STORAGE_KEY = "plass-color-scheme";
6
+ export declare const darkQuery = "(prefers-color-scheme: dark)";
7
+ /**
8
+ * Writes the choice onto `<html>`.
9
+ *
10
+ * **Both** the attribute and the class, and not as belt and braces: the
11
+ * attribute is what this library's tokens read, and the class is what a
12
+ * consumer's own Tailwind `dark:` utilities read when they are configured
13
+ * against a class rather than the media query. A toggle that moved one and not
14
+ * the other would leave a page half switched.
15
+ *
16
+ * `system` removes both, which is not the same as writing `light`: it hands the
17
+ * question back to `prefers-color-scheme`, so the page follows the platform
18
+ * again rather than being pinned to the platform's current answer.
19
+ */
20
+ export declare function applyColorScheme(scheme: PlColorScheme): void;
21
+ /** Whatever was stored, if it is one of the three. */
22
+ export declare function readStoredScheme(key: string): PlColorScheme | null;
23
+ export declare function useColorSchemeStore(key: string, fallback: PlColorScheme): [PlColorScheme, (next: PlColorScheme) => void];
@@ -0,0 +1 @@
1
+ "use client";import*as e from"react";export const DEFAULT_STORAGE_KEY="plass-color-scheme";export const darkQuery="(prefers-color-scheme: dark)";export function applyColorScheme(e){if("undefined"==typeof document)return;const t=document.documentElement;t.classList.remove("light","dark"),"system"!==e?(t.dataset.theme=e,t.classList.add(e)):delete t.dataset.theme}export function readStoredScheme(e){if("undefined"==typeof localStorage)return null;try{const t=localStorage.getItem(e);return"light"===t||"dark"===t||"system"===t?t:null}catch{return null}}const t=new Map;function storeFor(e,r){let o=t.get(e);return o||(o={scheme:readStoredScheme(e)??r,listeners:new Set},t.set(e,o)),o}export function useColorSchemeStore(t,r){const o=e.useCallback(e=>{const o=storeFor(t,r);o.listeners.add(e);const onStorage=e=>{if(e.key!==t)return;const s=readStoredScheme(t)??r;s!==o.scheme&&(o.scheme=s,applyColorScheme(s),o.listeners.forEach(e=>e()))};return window.addEventListener("storage",onStorage),()=>{o.listeners.delete(e),window.removeEventListener("storage",onStorage)}},[t,r]),s=e.useCallback(()=>storeFor(t,r).scheme,[t,r]),n=e.useCallback(()=>r,[r]),c=e.useSyncExternalStore(o,s,n),l=e.useCallback(e=>{const o=storeFor(t,r);o.scheme=e,function writeStoredScheme(e,t){try{localStorage.setItem(e,t)}catch{}}(t,e),applyColorScheme(e),o.listeners.forEach(e=>e())},[t,r]);return[c,l]}
@@ -0,0 +1,69 @@
1
+ /**
2
+ * The arithmetic a data table does before it draws anything.
3
+ *
4
+ * Sorting, paging and range selection are decisions about values rather than
5
+ * about the DOM, so they are here as plain functions: they can be read without
6
+ * a browser, tested without one, and — the reason that matters — they are the
7
+ * same three answers the Flutter build gives, which is what keeps a table
8
+ * sorted one way on the web from being sorted another way in an app.
9
+ */
10
+ import type * as React from 'react';
11
+ /** Which way a column runs when it is sorted. */
12
+ export type PlassSortDirection = 'asc' | 'desc';
13
+ /** A column and the direction it is sorted in. */
14
+ export interface PlassSort {
15
+ /** The column's `key`. */
16
+ key: string;
17
+ /** Which way it runs. */
18
+ direction: PlassSortDirection;
19
+ }
20
+ /**
21
+ * Puts two cell values in order.
22
+ *
23
+ * Numbers and dates compare as themselves, strings compare the way the reader's
24
+ * language orders them, and everything else falls back to its text. Two rules
25
+ * carry the weight:
26
+ *
27
+ * **Nothing sorts last, in both directions.** A column of amounts with three
28
+ * blanks in it is a column whose blanks are not the smallest amounts, and a
29
+ * reader who reversed the sort to find the largest should not be handed the
30
+ * empty ones instead. So the answer for a missing value is decided here, before
31
+ * the direction is applied, and the caller flips only the rest.
32
+ *
33
+ * **Strings compare with `localeCompare`.** `'a' < 'B'` is false by code point,
34
+ * which puts every capitalised word above every lower-case one and sorts `Ösi`
35
+ * after `Zoe`. A list of names a reader cannot scan is a list that was sorted
36
+ * for the machine.
37
+ */
38
+ export declare function compareValues(a: unknown, b: unknown): number;
39
+ /**
40
+ * What pressing a column heading does next.
41
+ *
42
+ * Ascending, then descending, then **off** — a third press puts the rows back
43
+ * in the order they arrived in. That order is information: it is usually the
44
+ * order the server chose, and a table that can never be put back has thrown it
45
+ * away. Pressing a different column starts that column ascending rather than
46
+ * inheriting the direction of the one before it.
47
+ */
48
+ export declare function nextSort(current: PlassSort | null, key: string): PlassSort | null;
49
+ /**
50
+ * The keys of every row between two of them, inclusive, in the order the rows
51
+ * are currently in.
52
+ *
53
+ * What a shift-click ticks. "Currently in" is the point: a reader dragging a
54
+ * range down a sorted table means the rows they can see, not the rows the
55
+ * unsorted array happens to hold between those two indices.
56
+ *
57
+ * An unknown key selects nothing rather than throwing, because the anchor can
58
+ * legitimately have been filtered away between the two clicks.
59
+ */
60
+ export declare function keysBetween(keys: readonly React.Key[], from: React.Key, to: React.Key): React.Key[];
61
+ /**
62
+ * Which rows a page shows, as a `[start, end)` pair into the sorted set.
63
+ *
64
+ * Clamped rather than trusted: a page number that has gone past the end — the
65
+ * usual way being a filter that shortened the list under a reader sitting on
66
+ * page nine — shows the last page instead of an empty table with a pager that
67
+ * says there is something there.
68
+ */
69
+ export declare function pageBounds(total: number, page: number, pageSize: number): [number, number];
@@ -0,0 +1 @@
1
+ export function compareValues(e,n){const t=null==e||""===e,o=null==n||""===n;return t||o?t&&o?0:t?1:-1:"number"==typeof e&&"number"==typeof n?e-n:"boolean"==typeof e&&"boolean"==typeof n?Number(e)-Number(n):e instanceof Date&&n instanceof Date?e.getTime()-n.getTime():String(e).localeCompare(String(n))}export function nextSort(e,n){return null===e||e.key!==n?{key:n,direction:"asc"}:"asc"===e.direction?{key:n,direction:"desc"}:null}export function keysBetween(e,n,t){const o=e.indexOf(n),r=e.indexOf(t);return-1===o||-1===r?[]:o<=r?e.slice(o,r+1):e.slice(r,o+1)}export function pageBounds(e,n,t){const o=Math.max(1,Math.ceil(e/t)),r=(Math.min(Math.max(1,Math.trunc(n)),o)-1)*t;return[r,Math.min(r+t,e)]}
@@ -48,6 +48,8 @@ export declare function isValidDate(value: unknown): value is Date;
48
48
  export declare function startOfDay(date: Date): Date;
49
49
  /** The first day of the month this date is in, at midnight. */
50
50
  export declare function startOfMonth(date: Date): Date;
51
+ /** The 1st of January of the year this date is in, at midnight. */
52
+ export declare function startOfYear(date: Date): Date;
51
53
  /** How many days a month has, leap years included. */
52
54
  export declare function daysInMonth(year: number, month: number): number;
53
55
  /** Today, at midnight. The one place the pickers read the clock for a *date*. */
@@ -77,6 +79,18 @@ export declare function clampDate(date: Date, min?: Date | null, max?: Date | nu
77
79
  * once an hour has been chosen.
78
80
  */
79
81
  export declare function isDayOutside(date: Date, min?: Date | null, max?: Date | null): boolean;
82
+ /**
83
+ * Is *every* day of this month outside the allowed span?
84
+ *
85
+ * A month is unreachable only when nothing in it is reachable: the month a
86
+ * `minDate` of the 15th falls in still exists, it just starts late. That is the
87
+ * rule the month grid has always drawn, and it is also what a `month` picker
88
+ * reads its bounds at — a bound on a picker that returns a month is a bound on
89
+ * months.
90
+ */
91
+ export declare function isMonthOutside(date: Date, min?: Date | null, max?: Date | null): boolean;
92
+ /** The same question about a whole year, for a `year` picker. */
93
+ export declare function isYearOutside(date: Date, min?: Date | null, max?: Date | null): boolean;
80
94
  /** Seconds since local midnight — what `minTime`/`maxTime` are compared on. */
81
95
  export declare function secondsOfDay(date: Date): number;
82
96
  /** Which column of a clock a candidate time is being offered for. */
@@ -143,6 +157,13 @@ export declare function withPlaceholder(samples: string[], placeholder: unknown)
143
157
  * server that already parses those needs no new code.
144
158
  */
145
159
  export declare function toISODate(date: Date): string;
160
+ /**
161
+ * The two shorter spellings, for a picker that only asked for a month or a
162
+ * year. `YYYY-MM` is what the native `<input type="month">` submits; there is no
163
+ * native control that submits a year, so a year is just the year.
164
+ */
165
+ export declare function toISOMonth(date: Date): string;
166
+ export declare function toISOYear(date: Date): string;
146
167
  export declare function toISOTime(date: Date, withSeconds?: boolean): string;
147
168
  export declare function toISODateTime(date: Date, withSeconds?: boolean): string;
148
169
  /**