plass-ui 1.3.0 → 1.5.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 (454) hide show
  1. package/CHANGELOG.md +962 -0
  2. package/README.md +19 -17
  3. package/dist/components/accordion/PlAccordion.d.ts +1 -1
  4. package/dist/components/alert/PlAlert.js +1 -1
  5. package/dist/components/anchor/PlAnchor.d.ts +85 -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-marquee/PlAnimateMarquee.d.ts +13 -4
  28. package/dist/components/animate-marquee/PlAnimateMarquee.js +1 -1
  29. package/dist/components/animate-reveal/PlAnimateReveal.d.ts +51 -0
  30. package/dist/components/animate-reveal/PlAnimateReveal.js +1 -0
  31. package/dist/components/animate-reveal/index.d.ts +2 -0
  32. package/dist/components/animate-reveal/index.js +1 -0
  33. package/dist/components/animate-rotate/PlAnimateRotate.d.ts +2 -2
  34. package/dist/components/animate-rotate/PlAnimateRotate.js +1 -1
  35. package/dist/components/animate-scramble/PlAnimateScramble.d.ts +75 -0
  36. package/dist/components/animate-scramble/PlAnimateScramble.js +1 -0
  37. package/dist/components/animate-scramble/index.d.ts +2 -0
  38. package/dist/components/animate-scramble/index.js +1 -0
  39. package/dist/components/animate-shake/PlAnimateShake.d.ts +57 -0
  40. package/dist/components/animate-shake/PlAnimateShake.js +1 -0
  41. package/dist/components/animate-shake/index.d.ts +2 -0
  42. package/dist/components/animate-shake/index.js +1 -0
  43. package/dist/components/animate-slide/PlAnimateSlide.d.ts +2 -2
  44. package/dist/components/animate-slide/PlAnimateSlide.js +1 -1
  45. package/dist/components/animate-split/PlAnimateSplit.d.ts +57 -0
  46. package/dist/components/animate-split/PlAnimateSplit.js +1 -0
  47. package/dist/components/animate-split/index.d.ts +2 -0
  48. package/dist/components/animate-split/index.js +1 -0
  49. package/dist/components/animate-typing/PlAnimateTyping.d.ts +3 -2
  50. package/dist/components/animate-typing/PlAnimateTyping.js +1 -1
  51. package/dist/components/animate-zoom/PlAnimateZoom.d.ts +2 -2
  52. package/dist/components/animate-zoom/PlAnimateZoom.js +1 -1
  53. package/dist/components/app-logo/PlAppLogo.d.ts +78 -0
  54. package/dist/components/app-logo/PlAppLogo.js +1 -0
  55. package/dist/components/app-logo/index.d.ts +2 -0
  56. package/dist/components/app-logo/index.js +1 -0
  57. package/dist/components/area-chart/PlAreaChart.d.ts +54 -0
  58. package/dist/components/area-chart/PlAreaChart.js +1 -0
  59. package/dist/components/area-chart/index.d.ts +2 -0
  60. package/dist/components/area-chart/index.js +1 -0
  61. package/dist/components/aspect-ratio/PlAspectRatio.d.ts +2 -1
  62. package/dist/components/aspect-ratio/PlAspectRatio.js +1 -1
  63. package/dist/components/avatar/PlAvatar.js +1 -1
  64. package/dist/components/back-top/PlBackTop.d.ts +2 -1
  65. package/dist/components/back-top/PlBackTop.js +1 -1
  66. package/dist/components/badge/PlBadge.js +1 -1
  67. package/dist/components/bar-chart/PlBarChart.d.ts +63 -0
  68. package/dist/components/bar-chart/PlBarChart.js +1 -0
  69. package/dist/components/bar-chart/index.d.ts +2 -0
  70. package/dist/components/bar-chart/index.js +1 -0
  71. package/dist/components/bottom-navigation/PlBottomNavigation.d.ts +3 -0
  72. package/dist/components/breadcrumb/PlBreadcrumb.js +1 -1
  73. package/dist/components/button/PlButton.d.ts +8 -0
  74. package/dist/components/button/PlButton.js +1 -1
  75. package/dist/components/button-group/PlButtonGroup.js +1 -1
  76. package/dist/components/calendar/PlCalendar.js +1 -1
  77. package/dist/components/card/PlCard.js +1 -1
  78. package/dist/components/carousel/PlCarousel.d.ts +1 -1
  79. package/dist/components/carousel/PlCarousel.js +1 -1
  80. package/dist/components/chat-bubble/PlChatBubble.d.ts +4 -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.d.ts +6 -2
  84. package/dist/components/chip/PlChip.js +1 -1
  85. package/dist/components/code-block/PlCodeBlock.d.ts +192 -0
  86. package/dist/components/code-block/PlCodeBlock.js +1 -0
  87. package/dist/components/code-block/index.d.ts +2 -0
  88. package/dist/components/code-block/index.js +1 -0
  89. package/dist/components/color-picker/PlColorPicker.js +1 -1
  90. package/dist/components/combobox/PlCombobox.d.ts +6 -5
  91. package/dist/components/combobox/PlCombobox.js +1 -1
  92. package/dist/components/command-palette/PlCommandPalette.d.ts +6 -2
  93. package/dist/components/command-palette/PlCommandPalette.js +1 -1
  94. package/dist/components/confirm/PlConfirmProvider.js +1 -1
  95. package/dist/components/container/PlContainer.d.ts +22 -6
  96. package/dist/components/container/PlContainer.js +1 -1
  97. package/dist/components/data-list/PlDataList.d.ts +74 -0
  98. package/dist/components/data-list/PlDataList.js +1 -0
  99. package/dist/components/data-list/index.d.ts +2 -0
  100. package/dist/components/data-list/index.js +1 -0
  101. package/dist/components/data-table/PlDataTable.d.ts +216 -0
  102. package/dist/components/data-table/PlDataTable.js +1 -0
  103. package/dist/components/data-table/index.d.ts +2 -0
  104. package/dist/components/data-table/index.js +1 -0
  105. package/dist/components/date-picker/PlDatePicker.js +1 -1
  106. package/dist/components/date-range-picker/PlDateRangePicker.js +1 -1
  107. package/dist/components/date-time-picker/PlDateTimePicker.js +1 -1
  108. package/dist/components/drawer/PlDrawer.d.ts +1 -1
  109. package/dist/components/drawer/PlDrawer.js +1 -1
  110. package/dist/components/file-picker/PlFilePicker.d.ts +4 -1
  111. package/dist/components/file-picker/PlFilePicker.js +1 -1
  112. package/dist/components/flex/PlFlex.d.ts +83 -0
  113. package/dist/components/flex/PlFlex.js +1 -0
  114. package/dist/components/flex/index.d.ts +2 -0
  115. package/dist/components/flex/index.js +1 -0
  116. package/dist/components/floating-action-button/PlFloatingActionButton.d.ts +81 -0
  117. package/dist/components/floating-action-button/PlFloatingActionButton.js +1 -0
  118. package/dist/components/floating-action-button/index.d.ts +2 -0
  119. package/dist/components/floating-action-button/index.js +1 -0
  120. package/dist/components/floating-bottom-navigation/PlFloatingBottomNavigation.d.ts +3 -0
  121. package/dist/components/floating-bottom-navigation/PlFloatingBottomNavigation.js +1 -1
  122. package/dist/components/footer/PlFooter.d.ts +4 -3
  123. package/dist/components/footer/PlFooter.js +1 -1
  124. package/dist/components/form/PlForm.js +1 -1
  125. package/dist/components/gallery/PlGallery.d.ts +192 -0
  126. package/dist/components/gallery/PlGallery.js +1 -0
  127. package/dist/components/gallery/PlGalleryViewer.d.ts +31 -0
  128. package/dist/components/gallery/PlGalleryViewer.js +1 -0
  129. package/dist/components/gallery/index.d.ts +2 -0
  130. package/dist/components/gallery/index.js +1 -0
  131. package/dist/components/gauge-chart/PlGaugeChart.d.ts +64 -0
  132. package/dist/components/gauge-chart/PlGaugeChart.js +1 -0
  133. package/dist/components/gauge-chart/index.d.ts +2 -0
  134. package/dist/components/gauge-chart/index.js +1 -0
  135. package/dist/components/grid/PlGrid.js +1 -1
  136. package/dist/components/grid/PlGridItem.js +1 -1
  137. package/dist/components/header/PlHeader.d.ts +4 -3
  138. package/dist/components/header/PlHeader.js +1 -1
  139. package/dist/components/heatmap-chart/PlHeatmapChart.d.ts +69 -0
  140. package/dist/components/heatmap-chart/PlHeatmapChart.js +1 -0
  141. package/dist/components/heatmap-chart/index.d.ts +2 -0
  142. package/dist/components/heatmap-chart/index.js +1 -0
  143. package/dist/components/highlight/PlHighlight.js +1 -1
  144. package/dist/components/hot-keys/PlHotKeys.js +1 -1
  145. package/dist/components/hover-card/PlHoverCard.d.ts +96 -0
  146. package/dist/components/hover-card/PlHoverCard.js +1 -0
  147. package/dist/components/hover-card/index.d.ts +2 -0
  148. package/dist/components/hover-card/index.js +1 -0
  149. package/dist/components/how-to-steps/PlHowToSteps.d.ts +87 -0
  150. package/dist/components/how-to-steps/PlHowToSteps.js +1 -0
  151. package/dist/components/how-to-steps/index.d.ts +2 -0
  152. package/dist/components/how-to-steps/index.js +1 -0
  153. package/dist/components/image/PlImage.d.ts +195 -8
  154. package/dist/components/image/PlImage.js +1 -1
  155. package/dist/components/image/PlImagePreview.d.ts +58 -0
  156. package/dist/components/image/PlImagePreview.js +1 -0
  157. package/dist/components/image/index.d.ts +1 -1
  158. package/dist/components/line-chart/PlLineChart.d.ts +74 -0
  159. package/dist/components/line-chart/PlLineChart.js +1 -0
  160. package/dist/components/line-chart/index.d.ts +2 -0
  161. package/dist/components/line-chart/index.js +1 -0
  162. package/dist/components/menu/PlMenu.d.ts +14 -5
  163. package/dist/components/menu/PlMenu.js +1 -1
  164. package/dist/components/meter/PlMeter.d.ts +83 -0
  165. package/dist/components/meter/PlMeter.js +1 -0
  166. package/dist/components/meter/index.d.ts +2 -0
  167. package/dist/components/meter/index.js +1 -0
  168. package/dist/components/mockup/PlMockup.d.ts +146 -0
  169. package/dist/components/mockup/PlMockup.js +1 -0
  170. package/dist/components/mockup/index.d.ts +2 -0
  171. package/dist/components/mockup/index.js +1 -0
  172. package/dist/components/modal/PlModal.d.ts +1 -1
  173. package/dist/components/modal/PlModal.js +1 -1
  174. package/dist/components/navigation-menu/PlNavigationMenu.d.ts +7 -1
  175. package/dist/components/navigation-menu/PlNavigationMenu.js +1 -1
  176. package/dist/components/number-field/PlNumberField.d.ts +1 -1
  177. package/dist/components/number-field/PlNumberField.js +1 -1
  178. package/dist/components/otp-field/PlOtpField.d.ts +6 -0
  179. package/dist/components/otp-field/PlOtpField.js +1 -1
  180. package/dist/components/overlay/PlOverlay.d.ts +1 -1
  181. package/dist/components/overlay/PlOverlay.js +1 -1
  182. package/dist/components/page-layout/PlPageLayout.js +1 -1
  183. package/dist/components/pagination/PlPagination.d.ts +12 -9
  184. package/dist/components/pagination/PlPagination.js +1 -1
  185. package/dist/components/panes/PlPanes.d.ts +7 -2
  186. package/dist/components/panes/PlPanes.js +1 -1
  187. package/dist/components/pie-chart/PlPieChart.d.ts +58 -0
  188. package/dist/components/pie-chart/PlPieChart.js +1 -0
  189. package/dist/components/pie-chart/index.d.ts +2 -0
  190. package/dist/components/pie-chart/index.js +1 -0
  191. package/dist/components/pill/PlPill.js +1 -1
  192. package/dist/components/popconfirm/PlPopconfirm.d.ts +1 -1
  193. package/dist/components/popconfirm/PlPopconfirm.js +1 -1
  194. package/dist/components/popover/PlPopover.d.ts +6 -6
  195. package/dist/components/popover/PlPopover.js +1 -1
  196. package/dist/components/portal/PlPortal.d.ts +78 -0
  197. package/dist/components/portal/PlPortal.js +1 -0
  198. package/dist/components/portal/index.d.ts +2 -0
  199. package/dist/components/portal/index.js +1 -0
  200. package/dist/components/progress-box/PlProgressBox.js +1 -1
  201. package/dist/components/progress-circular/PlProgressCircular.js +1 -1
  202. package/dist/components/progress-linear/PlProgressLinear.js +1 -1
  203. package/dist/components/radio-group/PlRadioGroup.js +1 -1
  204. package/dist/components/rating/PlRating.d.ts +1 -1
  205. package/dist/components/rating/PlRating.js +1 -1
  206. package/dist/components/scatter-chart/PlScatterChart.d.ts +46 -0
  207. package/dist/components/scatter-chart/PlScatterChart.js +1 -0
  208. package/dist/components/scatter-chart/index.d.ts +2 -0
  209. package/dist/components/scatter-chart/index.js +1 -0
  210. package/dist/components/scroll-area/PlScrollArea.d.ts +98 -0
  211. package/dist/components/scroll-area/PlScrollArea.js +1 -0
  212. package/dist/components/scroll-area/index.d.ts +2 -0
  213. package/dist/components/scroll-area/index.js +1 -0
  214. package/dist/components/scroll-zone/PlScrollZone.d.ts +27 -10
  215. package/dist/components/scroll-zone/PlScrollZone.js +1 -1
  216. package/dist/components/segmented-button/PlSegmentedButton.js +1 -1
  217. package/dist/components/select/PlSelect.js +1 -1
  218. package/dist/components/show/PlShow.d.ts +76 -0
  219. package/dist/components/show/PlShow.js +1 -0
  220. package/dist/components/show/index.d.ts +2 -0
  221. package/dist/components/show/index.js +1 -0
  222. package/dist/components/sidebar/PlSidebar.js +1 -1
  223. package/dist/components/sidebar/PlSidebarTrigger.js +1 -1
  224. package/dist/components/skeleton/PlSkeleton.js +1 -1
  225. package/dist/components/slider/PlSlider.d.ts +13 -1
  226. package/dist/components/slider/PlSlider.js +1 -1
  227. package/dist/components/sparkline/PlSparkline.d.ts +68 -0
  228. package/dist/components/sparkline/PlSparkline.js +1 -0
  229. package/dist/components/sparkline/index.d.ts +2 -0
  230. package/dist/components/sparkline/index.js +1 -0
  231. package/dist/components/spoiler/PlSpoiler.d.ts +16 -1
  232. package/dist/components/spoiler/PlSpoiler.js +1 -1
  233. package/dist/components/stack/PlStack.d.ts +114 -0
  234. package/dist/components/stack/PlStack.js +1 -0
  235. package/dist/components/stack/index.d.ts +2 -0
  236. package/dist/components/stack/index.js +1 -0
  237. package/dist/components/stat/PlStat.d.ts +4 -0
  238. package/dist/components/stat/PlStat.js +1 -1
  239. package/dist/components/stepper/PlStepper.d.ts +3 -3
  240. package/dist/components/stepper/PlStepper.js +1 -1
  241. package/dist/components/switch/PlSwitch.js +1 -1
  242. package/dist/components/table/PlTable.d.ts +5 -5
  243. package/dist/components/table/PlTable.js +1 -1
  244. package/dist/components/tabs/PlTabs.d.ts +27 -2
  245. package/dist/components/tabs/PlTabs.js +1 -1
  246. package/dist/components/text-link/PlTextLink.js +1 -1
  247. package/dist/components/time-picker/PlTimePicker.js +1 -1
  248. package/dist/components/timeline/PlTimeline.d.ts +2 -2
  249. package/dist/components/timeline/PlTimeline.js +1 -1
  250. package/dist/components/timeline-chart/PlTimelineChart.d.ts +44 -0
  251. package/dist/components/timeline-chart/PlTimelineChart.js +1 -0
  252. package/dist/components/timeline-chart/index.d.ts +2 -0
  253. package/dist/components/timeline-chart/index.js +1 -0
  254. package/dist/components/toast/PlToast.d.ts +1 -1
  255. package/dist/components/toast/PlToast.js +1 -1
  256. package/dist/components/toggle/PlToggle.js +1 -1
  257. package/dist/components/toggle/PlToggleGroup.js +1 -1
  258. package/dist/components/tooltip/PlTooltip.js +1 -1
  259. package/dist/components/tour/PlTour.d.ts +134 -0
  260. package/dist/components/tour/PlTour.js +1 -0
  261. package/dist/components/tour/index.d.ts +2 -0
  262. package/dist/components/tour/index.js +1 -0
  263. package/dist/components/transfer/PlTransfer.d.ts +10 -1
  264. package/dist/components/transfer/PlTransfer.js +1 -1
  265. package/dist/components/tree/PlTree.js +1 -1
  266. package/dist/components/tree-select/PlTreeSelect.d.ts +99 -0
  267. package/dist/components/tree-select/PlTreeSelect.js +1 -0
  268. package/dist/components/tree-select/index.d.ts +2 -0
  269. package/dist/components/tree-select/index.js +1 -0
  270. package/dist/components/typography/PlTypography.js +1 -1
  271. package/dist/components/window-pane/PlWindowPane.d.ts +179 -0
  272. package/dist/components/window-pane/PlWindowPane.js +1 -0
  273. package/dist/components/window-pane/index.d.ts +2 -0
  274. package/dist/components/window-pane/index.js +1 -0
  275. package/dist/css/anchor.css +2 -0
  276. package/dist/css/animate-counter.css +2 -0
  277. package/dist/css/animate-float.css +2 -0
  278. package/dist/css/animate-reveal.css +2 -0
  279. package/dist/css/animate-scramble.css +2 -0
  280. package/dist/css/animate-shake.css +2 -0
  281. package/dist/css/animate-split.css +2 -0
  282. package/dist/css/app-logo.css +2 -0
  283. package/dist/css/area-chart.css +3 -0
  284. package/dist/css/back-top.css +2 -0
  285. package/dist/css/bar-chart.css +3 -0
  286. package/dist/css/calendar.css +1 -0
  287. package/dist/css/carousel.css +2 -0
  288. package/dist/css/code-block.css +2 -0
  289. package/dist/css/color-picker.css +1 -0
  290. package/dist/css/combobox.css +1 -0
  291. package/dist/css/command-palette.css +1 -0
  292. package/dist/css/confirm.css +2 -0
  293. package/dist/css/data-list.css +2 -0
  294. package/dist/css/data-table.css +7 -0
  295. package/dist/css/date-picker.css +1 -0
  296. package/dist/css/date-range-picker.css +1 -0
  297. package/dist/css/date-time-picker.css +1 -0
  298. package/dist/css/flex.css +2 -0
  299. package/dist/css/floating-action-button.css +4 -0
  300. package/dist/css/gallery.css +7 -0
  301. package/dist/css/gauge-chart.css +3 -0
  302. package/dist/css/heatmap-chart.css +3 -0
  303. package/dist/css/hover-card.css +2 -0
  304. package/dist/css/how-to-steps.css +2 -0
  305. package/dist/css/icon-button.css +1 -0
  306. package/dist/css/image.css +2 -0
  307. package/dist/css/line-chart.css +3 -0
  308. package/dist/css/menubar.css +1 -0
  309. package/dist/css/meter.css +2 -0
  310. package/dist/css/mockup.css +2 -0
  311. package/dist/css/pagination.css +1 -0
  312. package/dist/css/pie-chart.css +3 -0
  313. package/dist/css/popconfirm.css +2 -0
  314. package/dist/css/portal.css +2 -0
  315. package/dist/css/scatter-chart.css +3 -0
  316. package/dist/css/scroll-area.css +2 -0
  317. package/dist/css/scroll-zone.css +2 -0
  318. package/dist/css/show.css +2 -0
  319. package/dist/css/sidebar.css +3 -0
  320. package/dist/css/sparkline.css +3 -0
  321. package/dist/css/spoiler.css +1 -0
  322. package/dist/css/stack.css +2 -0
  323. package/dist/css/stat.css +1 -0
  324. package/dist/css/time-picker.css +1 -0
  325. package/dist/css/timeline-chart.css +3 -0
  326. package/dist/css/tour.css +3 -0
  327. package/dist/css/transfer.css +4 -0
  328. package/dist/css/tree-select.css +4 -0
  329. package/dist/css/window-pane.css +2 -0
  330. package/dist/hooks/index.d.ts +6 -0
  331. package/dist/hooks/index.js +1 -1
  332. package/dist/hooks/usePlBreakpoint.d.ts +3 -0
  333. package/dist/hooks/usePlBreakpoint.js +1 -1
  334. package/dist/hooks/usePlDisclosure.d.ts +44 -0
  335. package/dist/hooks/usePlDisclosure.js +1 -0
  336. package/dist/hooks/usePlElementSize.d.ts +34 -0
  337. package/dist/hooks/usePlElementSize.js +1 -0
  338. package/dist/hooks/usePlHotKeys.d.ts +5 -1
  339. package/dist/hooks/usePlHotKeys.js +1 -1
  340. package/dist/hooks/usePlOnScreen.d.ts +54 -0
  341. package/dist/hooks/usePlOnScreen.js +1 -0
  342. package/dist/index.d.ts +34 -1
  343. package/dist/index.js +1 -1
  344. package/dist/internal/animate.d.ts +121 -7
  345. package/dist/internal/animate.js +1 -1
  346. package/dist/internal/breakpoints.d.ts +31 -0
  347. package/dist/internal/breakpoints.js +1 -0
  348. package/dist/internal/button-group.d.ts +29 -2
  349. package/dist/internal/button-group.js +2 -2
  350. package/dist/internal/calendar.d.ts +11 -36
  351. package/dist/internal/calendar.js +1 -1
  352. package/dist/internal/chart-frame.d.ts +462 -0
  353. package/dist/internal/chart-frame.js +1 -0
  354. package/dist/internal/chart-line.d.ts +44 -0
  355. package/dist/internal/chart-line.js +1 -0
  356. package/dist/internal/chart.d.ts +551 -0
  357. package/dist/internal/chart.js +1 -0
  358. package/dist/internal/color-scheme.js +1 -1
  359. package/dist/internal/data-table.d.ts +70 -0
  360. package/dist/internal/data-table.js +1 -0
  361. package/dist/internal/date.d.ts +10 -0
  362. package/dist/internal/date.js +1 -1
  363. package/dist/internal/defaults.d.ts +8 -3
  364. package/dist/internal/drag.d.ts +65 -0
  365. package/dist/internal/drag.js +1 -0
  366. package/dist/internal/focusable.d.ts +8 -0
  367. package/dist/internal/focusable.js +1 -0
  368. package/dist/internal/form.d.ts +61 -0
  369. package/dist/internal/form.js +1 -0
  370. package/dist/internal/format.d.ts +2 -0
  371. package/dist/internal/format.js +1 -1
  372. package/dist/internal/gallery.d.ts +80 -0
  373. package/dist/internal/gallery.js +1 -0
  374. package/dist/internal/glow.d.ts +17 -0
  375. package/dist/internal/glow.js +1 -0
  376. package/dist/internal/grid.d.ts +6 -27
  377. package/dist/internal/grid.js +1 -1
  378. package/dist/internal/highlight.d.ts +98 -0
  379. package/dist/internal/highlight.js +1 -0
  380. package/dist/internal/icons.d.ts +10 -0
  381. package/dist/internal/icons.js +1 -1
  382. package/dist/internal/image.d.ts +94 -0
  383. package/dist/internal/image.js +1 -0
  384. package/dist/internal/inert.d.ts +19 -0
  385. package/dist/internal/inert.js +1 -0
  386. package/dist/internal/keys.d.ts +19 -0
  387. package/dist/internal/keys.js +1 -1
  388. package/dist/internal/labels.d.ts +182 -0
  389. package/dist/internal/labels.js +1 -0
  390. package/dist/internal/link.d.ts +17 -0
  391. package/dist/internal/link.js +1 -1
  392. package/dist/internal/mockup.d.ts +193 -0
  393. package/dist/internal/mockup.js +1 -0
  394. package/dist/internal/page-layout.d.ts +14 -7
  395. package/dist/internal/page-layout.js +1 -1
  396. package/dist/internal/picker.d.ts +43 -6
  397. package/dist/internal/picker.js +1 -1
  398. package/dist/internal/progress.d.ts +22 -8
  399. package/dist/internal/progress.js +1 -1
  400. package/dist/internal/responsive.d.ts +108 -0
  401. package/dist/internal/responsive.js +1 -0
  402. package/dist/internal/scramble.d.ts +35 -0
  403. package/dist/internal/scramble.js +1 -0
  404. package/dist/internal/scroll-target.d.ts +5 -0
  405. package/dist/internal/scroll-target.js +1 -0
  406. package/dist/internal/steps.js +1 -1
  407. package/dist/internal/styles.d.ts +81 -0
  408. package/dist/internal/styles.js +1 -1
  409. package/dist/internal/table.d.ts +86 -0
  410. package/dist/internal/table.js +1 -0
  411. package/dist/internal/text.d.ts +39 -0
  412. package/dist/internal/text.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/watermark.d.ts +44 -0
  418. package/dist/internal/watermark.js +1 -0
  419. package/dist/internal/wheel.d.ts +52 -0
  420. package/dist/internal/wheel.js +1 -0
  421. package/dist/internal/window.d.ts +201 -0
  422. package/dist/internal/window.js +1 -0
  423. package/dist/locales/de.d.ts +3 -0
  424. package/dist/locales/de.js +1 -0
  425. package/dist/locales/en.d.ts +2 -0
  426. package/dist/locales/en.js +1 -0
  427. package/dist/locales/es.d.ts +3 -0
  428. package/dist/locales/es.js +1 -0
  429. package/dist/locales/fr.d.ts +3 -0
  430. package/dist/locales/fr.js +1 -0
  431. package/dist/locales/index.d.ts +33 -0
  432. package/dist/locales/index.js +1 -0
  433. package/dist/locales/ja.d.ts +3 -0
  434. package/dist/locales/ja.js +1 -0
  435. package/dist/locales/ko.d.ts +3 -0
  436. package/dist/locales/ko.js +1 -0
  437. package/dist/locales/zh-Hans.d.ts +3 -0
  438. package/dist/locales/zh-Hans.js +1 -0
  439. package/dist/provider/PlColorSchemeScript.js +1 -1
  440. package/dist/provider/PlassProvider.js +1 -1
  441. package/dist/provider/index.d.ts +1 -0
  442. package/dist/provider/index.js +1 -1
  443. package/dist/styles.css +1 -1
  444. package/dist/tailwind.css +1357 -25
  445. package/dist/tokens.css +1357 -25
  446. package/dist/types.d.ts +368 -2
  447. package/package.json +26 -16
  448. package/dist/components/avatar-group/PlAvatarGroup.d.ts +0 -47
  449. package/dist/components/avatar-group/PlAvatarGroup.js +0 -1
  450. package/dist/components/avatar-group/index.d.ts +0 -2
  451. package/dist/components/avatar-group/index.js +0 -1
  452. package/dist/css/avatar-group.css +0 -2
  453. package/dist/internal/avatar-group.d.ts +0 -25
  454. package/dist/internal/avatar-group.js +0 -2
@@ -0,0 +1,44 @@
1
+ /**
2
+ * The marks a PlLineChart and an PlAreaChart draw.
3
+ *
4
+ * They are one picture with one part switched off, which is exactly the case
5
+ * `internal/` exists for: an area is a line with the space under it filled, and
6
+ * a stacked area is that with each band sitting on the one below. Writing the
7
+ * path arithmetic twice would mean a `curve="smooth"` that curves differently
8
+ * depending on which of the two components a caller reached for.
9
+ *
10
+ * PlSparkline deliberately does *not* come through here. It has no axes, no
11
+ * legend and no stacking, and what it needs from `internal/chart.ts` is two function
12
+ * calls — routing it through a component built for a full plot would cost it
13
+ * the thing that makes it a sparkline.
14
+ */
15
+ import * as React from 'react';
16
+ import type { CartesianContext } from './chart-frame.js';
17
+ import type { PlassChartCurve, PlassChartValueLabels } from '../types.js';
18
+ /** Whether a point gets a dot on it. */
19
+ export type ChartMarkers = 'none' | 'auto' | 'all';
20
+ export interface LineSeriesProps {
21
+ context: CartesianContext;
22
+ curve: PlassChartCurve;
23
+ /** Fills the space between the line and whatever is under it. */
24
+ filled: boolean;
25
+ /** Each band sits on the total of the ones before it. */
26
+ stacked: boolean;
27
+ markers: ChartMarkers;
28
+ valueLabels: PlassChartValueLabels;
29
+ /**
30
+ * Bridges a gap instead of breaking at it. Off by default, and it should
31
+ * stay off unless the caller knows the gap is an artefact of collection
32
+ * rather than a month where nothing happened.
33
+ */
34
+ connectNulls: boolean;
35
+ /**
36
+ * Fades the line from a paler step of its own hue at the old end to the full
37
+ * colour at the new one. One hue throughout — a stroke that changes hue along
38
+ * its length is a second series pretending to be one.
39
+ */
40
+ gradient: boolean;
41
+ /** Unique per chart instance, so two charts' gradient defs cannot collide. */
42
+ idPrefix: string;
43
+ }
44
+ export declare function LineSeries({ context, curve, filled, stacked, markers, valueLabels, connectNulls, gradient, idPrefix }: LineSeriesProps): React.JSX.Element;
@@ -0,0 +1 @@
1
+ import{jsx as l,jsxs as e}from"react/jsx-runtime";import{areaPath as r,chartFontSizes as t,dimmedByHover as o,labelledPoints as n,linePath as a,lineWidths as s,markerRadii as i,markGap as c}from"./chart.js";import{markTransitionClasses as u}from"./chart-frame.js";export function LineSeries({context:f,curve:p,filled:d,stacked:m,markers:x,valueLabels:h,connectNulls:k,gradient:v,idPrefix:$}){const{values:y,visible:b,colors:g,hovered:j,activeIndex:C,plot:L,point:N,zeroPx:W,size:z,format:B}=f,E=s[z],G=i[z],P=b.indexOf(!0),S=[],w=[];return y.forEach((l,e)=>{const r=l.map((l,e)=>w[e]??0);S.push(r),m&&b[e]&&l.forEach((l,e)=>{w[e]=(w[e]??0)+(l.value??0)})}),e("g",{children:[e("defs",{children:[v?g.map((r,t)=>e("linearGradient",{id:`${$}-stroke-${t}`,x1:"0",y1:"0",x2:"1",y2:"0",children:[l("stop",{offset:"0%",stopColor:`color-mix(in oklab, ${r} 45%, transparent)`}),l("stop",{offset:"100%",stopColor:r})]},`stroke-${t}`)):null,d&&!m?g.map((r,t)=>e("linearGradient",{id:`${$}-fill-${t}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[l("stop",{offset:"0%",stopColor:`color-mix(in oklab, ${r} 28%, transparent)`}),l("stop",{offset:"100%",stopColor:`color-mix(in oklab, ${r} 2%, transparent)`})]},`fill-${t}`)):null]}),y.map((s,i)=>{if(!b[i])return null;const f=g[i],y=o(j,i,b),w=s.map((l,e)=>{if(null===l.value)return null;const r=m?S[i][e]+l.value:l.value;return N(e,r)}),A=k?w.filter(Boolean):w,I=s.map((l,e)=>null===l.value?null:m?N(e,S[i][e]):{x:N(e,l.value).x,y:W}),O=d&&m,q=n(s,h);return e("g",{opacity:y?.28:1,className:u,children:[d?l("path",{d:r(A,k?I.filter(Boolean):I,p),fill:m?`color-mix(in oklab, ${f} 70%, transparent)`:`url(#${$}-fill-${i})`,stroke:"none"}):null,O&&i!==P?l("path",{d:a(k?I.filter(Boolean):I,p),fill:"none",stroke:"var(--plass-chart-gap)",strokeWidth:c}):null,O?null:l("path",{d:a(A,p),fill:"none",stroke:v?`url(#${$}-stroke-${i})`:f,strokeWidth:E,strokeLinecap:"round",strokeLinejoin:"round"}),w.map((e,r)=>e&&("all"===x||"auto"===x&&s.length<=14||r===C)?l("circle",{cx:e.x,cy:e.y,r:r===C?G+1:G,fill:s[r].color??f,stroke:"var(--plass-chart-gap)",strokeWidth:c,className:u},r):null),"none"===h?null:w.map((e,r)=>{const o=s[r].value;return e&&null!==o&&q(r)?l("text",{x:e.x,y:e.y-G-5,textAnchor:e.x>L.left+L.width-24?"end":e.x<L.left+24?"start":"middle",fontSize:t[z],fontWeight:500,fill:"var(--plass-fg)",className:"tabular-nums",children:s[r].label??B(o)},`label-${r}`):null})]},i)})]})}
@@ -0,0 +1,551 @@
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, PlassChartValueLabels, 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
+ /**
96
+ * Whether the mark of `index` fades while the legend entry of `hovered` is
97
+ * under the pointer.
98
+ *
99
+ * A hovered entry dims the *others* — but only when the series it names is
100
+ * actually on the plot. Pointing at an entry that is switched off would
101
+ * otherwise fade every visible series to make room for one that is not there,
102
+ * which reads as the whole chart going grey for no reason.
103
+ */
104
+ export declare function dimmedByHover(hovered: number | null, index: number, visible: readonly boolean[]): boolean;
105
+ /** A datum unpacked into the shape the drawing code reads. */
106
+ export interface ChartValue {
107
+ value: number | null;
108
+ x?: PlassChartCategory;
109
+ z?: number;
110
+ color?: string;
111
+ label?: React.ReactNode;
112
+ }
113
+ /**
114
+ * One datum, whichever of the three ways it was written.
115
+ *
116
+ * `NaN` is folded into `null` here rather than at every call site: it arrives
117
+ * from a division somewhere upstream, it means the same thing a gap means, and
118
+ * a scale that is handed one produces a path with the letters `NaN` in it —
119
+ * which fails silently as a blank chart rather than loudly as an error.
120
+ */
121
+ export declare function toValue(datum: PlassChartDatum): ChartValue;
122
+ /** Every series unpacked, in the order it was given. */
123
+ export declare function toValues(series: readonly PlassChartSeries[]): ChartValue[][];
124
+ /**
125
+ * Which points of a series get a value label, decided once for the whole
126
+ * series.
127
+ *
128
+ * Once and not per point, which is the only thing worth saying about it: asking
129
+ * "is this the series' high" inside the loop over the points means walking the
130
+ * series again for each of them, and a five-hundred-point line then does a
131
+ * quarter of a million comparisons to place two labels — on every render, which
132
+ * on a chart being hovered is every frame. `last` is the last point that is
133
+ * there rather than the last slot, so a series that ends in a gap still says
134
+ * where it got to.
135
+ */
136
+ export declare function labelledPoints(one: readonly {
137
+ value: number | null;
138
+ }[], valueLabels: PlassChartValueLabels): (index: number) => boolean;
139
+ /**
140
+ * Every category of a stacked chart renormalised to a hundred.
141
+ *
142
+ * A change to the data rather than to the drawing, which is what lets the axis,
143
+ * the tooltip and the table agree that the number drawn is a share. The number
144
+ * the caller passed survives as each point's `label`, written by `write` the way
145
+ * the chart writes every other value — a chart stacked to `full` that can only
146
+ * tell a reader percentages has thrown away what it was given, and one that
147
+ * writes a revenue as `4830` beside a `$` axis has thrown away how it was given.
148
+ */
149
+ export declare function stackToFull(series: readonly PlassChartSeries[], write: (value: number) => string): PlassChartSeries[];
150
+ /**
151
+ * A category as a number, for a category axis that is really a value axis.
152
+ *
153
+ * A `Date` is its epoch milliseconds, which is what makes a scatter of
154
+ * timestamps work at all. A string is not a position on a number line, so it
155
+ * comes back `null` rather than `NaN` — the same rule `toValue` follows, and
156
+ * for the same reason: a `NaN` reaches the scale and leaves the letters in the
157
+ * path.
158
+ */
159
+ export declare function toNumber(value: PlassChartCategory | undefined): number | null;
160
+ /**
161
+ * Where one point sits along a category axis that runs on numbers.
162
+ *
163
+ * The same three sources `categoryAt` reads, in the same order — but per
164
+ * *point* rather than per column, because on a scatter each series has its own
165
+ * x at every index and there is no column for them to share.
166
+ */
167
+ export declare function pointX(value: ChartValue, index: number, categories: readonly PlassChartCategory[] | undefined): number | null;
168
+ /**
169
+ * Whether the positions along a chart's x axis are moments.
170
+ *
171
+ * Such an axis runs on milliseconds, and ticking milliseconds by 1-2-5 puts a
172
+ * `1.7T` under every mark. A dated axis ticks where a calendar does instead.
173
+ */
174
+ export declare function categoriesAreDates(values: readonly ChartValue[][], categories: readonly PlassChartCategory[] | undefined): boolean;
175
+ /**
176
+ * The extent of the category values, for a chart whose x is a number.
177
+ *
178
+ * Only points that have a `y` count. A point with no value is not on the plot,
179
+ * so letting its `x` stretch the axis would leave a margin of empty plot
180
+ * standing in for data that was never drawn.
181
+ */
182
+ export declare function categoryExtent(values: readonly ChartValue[][], categories: readonly PlassChartCategory[] | undefined): {
183
+ min: number;
184
+ max: number;
185
+ } | null;
186
+ /**
187
+ * The radius a bubble gets for its `z`, in pixels.
188
+ *
189
+ * `z` is an **area** and not a radius, which is the single most common way a
190
+ * bubble chart lies: encode it as a radius and a value twice as large draws a
191
+ * mark four times the size. The square root is what makes the ink on the page
192
+ * proportional to the number behind it.
193
+ *
194
+ * `min` is a floor rather than a scale — a bubble for a small-but-real value
195
+ * has to stay something a pointer can find, and a zero is the only thing
196
+ * allowed to disappear.
197
+ */
198
+ export declare function bubbleRadius(z: number, maxZ: number, max: number, min: number): number;
199
+ /** How many categories the widest series has. */
200
+ export declare function categoryCount(series: readonly PlassChartSeries[]): number;
201
+ /**
202
+ * What the category axis says at position `index`.
203
+ *
204
+ * `categories` wins, then whatever the first series that has one calls its own
205
+ * point, then the index. Three sources rather than one because a chart is
206
+ * written both ways in the wild — a column of labels beside a column of
207
+ * numbers, or points that carry their own `x` — and neither is wrong.
208
+ */
209
+ export declare function categoryAt(index: number, categories: readonly PlassChartCategory[] | undefined, values: readonly ChartValue[][]): PlassChartCategory;
210
+ /**
211
+ * The extent of the values, with the stacking rule applied.
212
+ *
213
+ * Stacked charts measure the *totals* and not the parts, and the two arms are
214
+ * accumulated separately so a series that goes negative does not shorten the
215
+ * bar above it. An all-`null` chart has no extent at all, which is what the
216
+ * `null` return says — the caller draws its empty state rather than an axis
217
+ * from `Infinity` to `-Infinity`.
218
+ */
219
+ export declare function extentOf(values: readonly ChartValue[][], stacked: boolean): {
220
+ min: number;
221
+ max: number;
222
+ } | null;
223
+ /** A value scale: where it starts, where it ends, and what it ticks at. */
224
+ export interface ValueScale {
225
+ min: number;
226
+ max: number;
227
+ ticks: number[];
228
+ /** A value → a fraction of the plot, `0` at `min` and `1` at `max`. */
229
+ fraction: (value: number) => number;
230
+ }
231
+ /**
232
+ * The scale a value axis runs on, rounded out to clean numbers.
233
+ *
234
+ * Rounding *outward* is the part that matters: a maximum of 4,830 becomes 5,000
235
+ * and not 4,830, so the top tick is a number and the tallest bar stops short of
236
+ * the ceiling. A scale whose last bar touches the frame reads as clipped even
237
+ * when it is exactly right.
238
+ *
239
+ * Zero is included unless the caller says otherwise, because bar length is only
240
+ * proportional to value when the baseline is zero. A line chart of a quantity
241
+ * that never approaches zero is the case for passing `min` — and it is a case
242
+ * the caller has to make, not one the chart makes for them.
243
+ */
244
+ export declare function valueScale(extent: {
245
+ min: number;
246
+ max: number;
247
+ } | null, options?: {
248
+ min?: number;
249
+ max?: number;
250
+ tickCount?: number;
251
+ /** Keeps zero in range. Off for a line chart told an explicit `min`. */
252
+ includeZero?: boolean;
253
+ }): ValueScale;
254
+ /** The units a time axis is allowed to step in. */
255
+ export type TimeUnit = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year';
256
+ /** A value scale whose numbers are instants, and the unit its ticks step in. */
257
+ export interface TimeScale extends ValueScale {
258
+ unit: TimeUnit;
259
+ /** How many of that unit each step covers — 1, 5, 15 minutes and so on. */
260
+ step: number;
261
+ }
262
+ /**
263
+ * The scale a time axis runs on, ticking where a calendar ticks.
264
+ *
265
+ * The ends round *outward* to the step for the reason `valueScale`'s do: a span
266
+ * that starts exactly on the left edge reads as clipped rather than as
267
+ * starting there. Past a year the 1-2-5 family comes back, because above the
268
+ * year time really is decimal — decades and centuries are the only units left.
269
+ */
270
+ export declare function timeScale(extent: {
271
+ min: number;
272
+ max: number;
273
+ } | null, options?: {
274
+ min?: number;
275
+ max?: number;
276
+ tickCount?: number;
277
+ }): TimeScale;
278
+ /**
279
+ * Whether an axis stepping in hours, minutes or seconds runs over more than one
280
+ * calendar day, and so has to write the date beside each time.
281
+ *
282
+ * `09:00 – 17:00` on an axis two days long could be either day. An axis that
283
+ * ends exactly at midnight has not started the next day, so its last tick does
284
+ * not count on its own.
285
+ */
286
+ export declare function timeNeedsDate(ticks: readonly number[], unit: TimeUnit): boolean;
287
+ /**
288
+ * One instant on a time axis, written unambiguously — for a tooltip or a table.
289
+ * `withDate` puts the date in front of a time, for an axis `timeNeedsDate`.
290
+ */
291
+ export declare function formatTimeValue(value: number, unit: TimeUnit, locale?: string, withDate?: boolean): string;
292
+ /**
293
+ * A whole axis of ticks, written the way an axis is read.
294
+ *
295
+ * The year is decided for the axis rather than for each tick, and that is the
296
+ * part worth explaining. Writing it only where it *changes* is what a reader
297
+ * wants and is not safe here: the labels are thinned again downstream, by a
298
+ * stride measured against the plot's real width, and the tick the year was
299
+ * riding on is exactly the one that gets dropped — leaving `Oct 2025 · Dec ·
300
+ * Feb` with nothing to say which year February is in.
301
+ *
302
+ * So: an axis inside one year names it once, on the first tick, which is the
303
+ * one tick a stride never removes. An axis that crosses a year names it on
304
+ * every tick, so whichever ones survive are each unambiguous. Wider labels mean
305
+ * a heavier stride, and a heavier stride is the better failure.
306
+ *
307
+ * The date on an axis of hours follows the second rule for the same reason: an
308
+ * axis that crosses midnight writes it on every tick, since the midnight tick
309
+ * is as likely to be dropped as the one a year was riding on.
310
+ */
311
+ export declare function formatTimeTicks(ticks: readonly number[], unit: TimeUnit, locale?: string): string[];
312
+ /**
313
+ * How many ticks a category axis can show before the labels collide, and which
314
+ * ones they are.
315
+ *
316
+ * Every nth label rather than rotating them: a rotated axis is unreadable at a
317
+ * glance and it steals a band of the plot to be unreadable in. `n` is chosen so
318
+ * the labels clear each other at the measured width, and it always keeps the
319
+ * first — a reader who cannot see where the axis starts cannot read any of it.
320
+ */
321
+ export declare function tickStride(count: number, available: number, labelWidth: number): number;
322
+ /**
323
+ * Whether the label at `index` survives the stride.
324
+ *
325
+ * Every nth, and — when it fits — the last one, which is the part a plain
326
+ * modulo gets wrong: a fourteen-day axis at a stride of two ends at day
327
+ * thirteen, and a percentage axis ends at 80%. The end of a scale is the number
328
+ * a reader looks for first, and dropping it to keep the arithmetic tidy is the
329
+ * wrong trade.
330
+ *
331
+ * `roomForLast` is the other half of it and is measured rather than guessed —
332
+ * see `fitsLast`. Forcing a label that does not fit turns a missing "Jun" into
333
+ * an overlapping "MayJun", which is worse than what it fixed.
334
+ */
335
+ export declare function showsTick(index: number, count: number, stride: number, roomForLast: boolean): boolean;
336
+ /**
337
+ * Whether the last label clears the last one the stride kept.
338
+ *
339
+ * The two are `(count - 1) % stride` steps apart, and they need half of each
340
+ * label plus a little air between them — labels are centred on their tick, so
341
+ * only the inner halves can collide.
342
+ */
343
+ export declare function fitsLast(count: number, stride: number, step: number, labelWidth: number): boolean;
344
+ /**
345
+ * Roughly how wide a string renders at a given font size.
346
+ *
347
+ * An estimate on purpose. The alternative is a canvas measurement per label per
348
+ * render, which is a layout read on a path that runs on every resize — and what
349
+ * this number is used for is deciding how much room to reserve, where being a
350
+ * few pixels generous costs nothing and being exact costs a reflow.
351
+ *
352
+ * 0.6em is the average advance of a digit in the sans-serifs a UI runs in;
353
+ * anything CJK is close to a full em, so the widest character decides.
354
+ */
355
+ export declare function textWidth(text: string, fontSize: number): number;
356
+ /**
357
+ * A label cut to the room it has, with an ellipsis.
358
+ *
359
+ * The alternative when a category name is wider than its slot is to drop
360
+ * labels until the survivors fit, and on five categories called things like
361
+ * "Onboarding flow" that leaves exactly one of them on the axis — an axis with
362
+ * one label is not a shorter axis, it is an unlabelled one. Cut instead: the
363
+ * first few characters distinguish five words, and the tooltip and the table
364
+ * both still have the whole thing.
365
+ */
366
+ export declare function truncate(text: string, maxWidth: number, fontSize: number): string;
367
+ /**
368
+ * The category labels as the axis writes them.
369
+ *
370
+ * A long name is cut to its slot rather than labels being dropped until the
371
+ * rest fit: five categories called "Onboarding flow" would otherwise leave one
372
+ * label on the axis. Once a slot is narrower than about four characters a cut
373
+ * stops helping, and the axis thins its labels out by stride instead. The
374
+ * ticks of a value-scaled axis are numbers already rounded to be short, so they
375
+ * are never cut: half of `12.4K` is not a smaller number, it is a wrong one.
376
+ * The Dart build answers with `fitCategoryLabels`.
377
+ */
378
+ export declare function fitCategoryLabels(texts: string[], options: {
379
+ horizontal: boolean;
380
+ slot: number;
381
+ fontSize: number;
382
+ ticks: boolean;
383
+ }): string[];
384
+ /** The plot's box inside the chart, once the axes have taken their bands. */
385
+ export interface PlotBox {
386
+ left: number;
387
+ top: number;
388
+ width: number;
389
+ height: number;
390
+ }
391
+ /** A band scale: one slot per category, with the marks centred in it. */
392
+ export interface BandScale {
393
+ /** The centre of category `index`, in pixels along the axis. */
394
+ centre: (index: number) => number;
395
+ /** How wide one slot is. */
396
+ step: number;
397
+ /** How wide the marks in a slot are allowed to be, together. */
398
+ band: number;
399
+ }
400
+ export declare function bandScale(count: number, length: number, ratio: number): BandScale;
401
+ /**
402
+ * A path through the points, in whichever of the three shapes was asked for.
403
+ *
404
+ * `null` breaks the path rather than interpolating across it — the `M` that
405
+ * starts a new subpath is the gap. A line that bridges a missing month is a
406
+ * line that invents a number.
407
+ *
408
+ * `smooth` is a monotone cubic and not a Catmull-Rom, which is not a detail: a
409
+ * plain spline overshoots between two close points, so a series that never goes
410
+ * below zero draws a curve that does. A chart is allowed to be curved and it is
411
+ * not allowed to show a value that is not in the data.
412
+ */
413
+ export declare function linePath(points: readonly ({
414
+ x: number;
415
+ y: number;
416
+ } | null)[], curve: 'linear' | 'smooth' | 'step'): string;
417
+ /**
418
+ * The same path closed down to a baseline, for an area.
419
+ *
420
+ * Built from the runs rather than from the whole line so a gap is a gap in the
421
+ * fill too — an area that closes across a missing month fills in a value that
422
+ * was never measured, which is the same lie the bridged line tells, painted
423
+ * over a larger part of the chart.
424
+ */
425
+ export declare function areaPath(points: readonly ({
426
+ x: number;
427
+ y: number;
428
+ } | null)[], baseline: readonly ({
429
+ x: number;
430
+ y: number;
431
+ } | null)[] | number, curve: 'linear' | 'smooth' | 'step'): string;
432
+ /**
433
+ * A rectangle with the two corners at its *data end* cut off.
434
+ *
435
+ * Rounded at the end and square at the baseline, which is not a stylistic
436
+ * split: a bar that is rounded where it meets the axis has lost the exact
437
+ * moment it starts, and a row of them turns the baseline into a scalloped edge.
438
+ * The end is where the value is, and that is the end worth softening.
439
+ *
440
+ * The radius shrinks to fit rather than clipping, so a bar two pixels tall is a
441
+ * bar and not a circle. `end` is which way the value grows.
442
+ */
443
+ export declare function barPath(x: number, y: number, width: number, height: number, radius: number, end: 'up' | 'down' | 'left' | 'right'): string;
444
+ /**
445
+ * The shapes a point mark can take.
446
+ *
447
+ * The dependable second identity channel, and the only chart form with one
448
+ * going spare: a line cannot be a triangle and a bar cannot be a cross, but a
449
+ * dot can be anything. Five is enough for every palette a chart is allowed.
450
+ */
451
+ export type MarkShape = 'circle' | 'square' | 'triangle' | 'diamond' | 'cross';
452
+ /** The order shapes are handed out in, matching the palette: fixed, never cycled. */
453
+ export declare const markShapes: readonly MarkShape[];
454
+ /**
455
+ * One point mark, as a path, centred on `cx`/`cy` and covering the same area a
456
+ * circle of radius `r` would.
457
+ *
458
+ * A circle comes back as a path too rather than as a `<circle>`, so whoever
459
+ * draws the marks writes one element and not a branch — the ring, the fill and
460
+ * the hover treatment are then unarguably the same on all five.
461
+ */
462
+ export declare function markPath(shape: MarkShape, cx: number, cy: number, r: number): string;
463
+ /**
464
+ * The centre line of that slice, as an *open* path.
465
+ *
466
+ * `arcPath` below draws the slice itself, which is a closed shape — and a shape
467
+ * whose `d` has to be rewritten every time the value moves. `d` is not a
468
+ * property CSS can travel along, so a dial drawn that way jumps to each new
469
+ * reading. Stroked instead, the same ring is one line with a width, and how much
470
+ * of it is drawn is `stroke-dashoffset`, which is a number and does travel.
471
+ *
472
+ * It is what ProgressCircular already does, bent to an arbitrary span — which is
473
+ * the point: a gauge is a Meter bent into an arc, and the four indicators in
474
+ * this library have to agree about what a value changing looks like.
475
+ *
476
+ * Angles are degrees clockwise from twelve o'clock, as below.
477
+ */
478
+ export declare function ringPath(cx: number, cy: number, radius: number, from: number, to: number): string;
479
+ /**
480
+ * A slice of a ring, as a path.
481
+ *
482
+ * `inner` of 0 is a pie and anything above it is a donut. Angles are degrees
483
+ * clockwise from twelve o'clock, which is where a reader starts reading a
484
+ * circle — SVG's own zero is at three o'clock, and the offset is applied here
485
+ * once rather than at four call sites.
486
+ */
487
+ export declare function arcPath(cx: number, cy: number, outer: number, inner: number, from: number, to: number): string;
488
+ /** Which way a magnitude is coloured. */
489
+ export type ChartScaleKind = 'sequential' | 'diverging';
490
+ /** How many steps each ramp has. Five, and the reason is in `styles.css`. */
491
+ export declare const rampSteps = 5;
492
+ /**
493
+ * The step a value lands on, and the ink a label on it wears.
494
+ *
495
+ * A magnitude is not an identity, so it does not come off the eight-slot
496
+ * categorical ramp — see the note above `--plass-chart-seq-1`. It comes off a
497
+ * one-hue ladder, and which rung is arithmetic on the value.
498
+ *
499
+ * A diverging scale is read from its *middle* rather than from its bottom, so
500
+ * it is the distance either side of the neutral that is scaled — and by the
501
+ * larger of the two arms, so a set running from −2 to +40 does not paint every
502
+ * negative the deepest blue there is.
503
+ */
504
+ export declare function rampStep(value: number, min: number, max: number, kind: ChartScaleKind, midpoint?: number): number;
505
+ /** The `var()` for a step of the ramp, and for the ink that reads on it. */
506
+ export declare function rampFill(step: number, kind: ChartScaleKind): string;
507
+ export declare function rampInk(step: number, kind: ChartScaleKind): string;
508
+ /** One tile, in pixels, and which value it came from. */
509
+ export interface TreemapTile {
510
+ index: number;
511
+ x: number;
512
+ y: number;
513
+ width: number;
514
+ height: number;
515
+ }
516
+ /**
517
+ * A squarified treemap: the values as boxes whose areas are proportional, laid
518
+ * out as close to square as they can be got.
519
+ *
520
+ * Squarified rather than sliced, and the difference is the whole reason the
521
+ * forty lines are worth it. A slice-and-dice treemap of twenty values ends in
522
+ * slivers a pixel wide, and a sliver's *area* is unreadable however exact it is
523
+ * — the reader compares its length instead, which is not the encoded quantity.
524
+ * Bruls, Huizing and van Wijk's answer is greedy and simple: fill a row along
525
+ * the box's shorter side, keep adding to it while the worst aspect ratio in it
526
+ * improves, and start a new row the moment it stops.
527
+ *
528
+ * The order is the caller's; the layout sorts descending internally because the
529
+ * algorithm needs it and hands the original index back on every tile, so a
530
+ * tile's colour and its name are still its own.
531
+ */
532
+ export declare function squarify(values: readonly number[], width: number, height: number): TreemapTile[];
533
+ /**
534
+ * How a category is written when nobody said.
535
+ *
536
+ * A `Date` gets the reader's own short form, because the alternative is an ISO
537
+ * string across the bottom of every time series. Everything else is `String`,
538
+ * which is what the caller wrote it as.
539
+ */
540
+ export declare function formatCategory(value: PlassChartCategory, locale?: string): string;
541
+ /**
542
+ * A number, compactly enough that a y-axis of thousands is not four labels of
543
+ * seven characters.
544
+ *
545
+ * Only when the caller passed no `format` of their own — the moment they do,
546
+ * they have said what the number means and the library's opinion about
547
+ * thousands separators stops being welcome.
548
+ */
549
+ export declare function compactNumber(value: number, locale?: string): string;
550
+ /** A value as a chart writes it: in the caller's `format`, or compactly without one. */
551
+ export declare function writeChartValue(value: number, format: Intl.NumberFormatOptions | undefined, locale: string | undefined): 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 dimmedByHover(t,e,n){return null!==t&&t!==e&&!0===n[t]}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 labelledPoints(t,e){if("none"===e)return()=>!1;if("all"===e)return()=>!0;if("last"===e){let e=-1;for(let n=t.length-1;n>=0;n--)if(null!==t[n].value){e=n;break}return t=>t===e}let n=1/0,r=-1/0;for(const e of t)null!==e.value&&(n=Math.min(n,e.value),r=Math.max(r,e.value));return e=>{const o=t[e].value;return null!==o&&(o===n||o===r)}}export function stackToFull(t,e){const n=toValues(t),r=[];for(const t of n)t.forEach((t,e)=>{r[e]=(r[e]??0)+Math.abs(t.value??0)});return t.map((t,o)=>({...t,data:n[o].map((t,n)=>{if(null===t.value)return null;const o=r[n];return{x:t.x,y:0===o?0:t.value/o*100,color:t.color,label:t.label??e(t.value)}})}))}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 categoriesAreDates(t,e){return(e?.some(t=>t instanceof Date)??!1)||t.some(t=>t.some(t=>t.x instanceof Date))}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,n=void 0===e.min,r=void 0===e.max;!n&&r||(o-=t),!r&&n||(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 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}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 r=e.min??t?.min??Date.parse("2000-01-01T00:00:00"),o=e.max??t?.max??r+i;o<=r&&(r-=i/2,o+=i/2);const a=o-r;let c=u[0],l=1/0;for(const t of u){const e=Math.abs(a/t.size-n);e<l&&(l=e,c=t)}const h=c.unit,m="year"===h?Math.max(1,Math.round(niceStep(a/n/(365*i)))):c.count,f=e.min??function alignTime(t,e,n){let r=floorTime(t,s[e]);if("year"===e&&n>1){const t=new Date(r).getFullYear();r=new Date(t-(t%n+n)%n,0,1).getTime()}for(let o=0;o<500;o++){const o=addTime(r,e,n);if(o>t)return r;r=o}return r}(r,h,m),$=[];let x=f;for(let t=0;t<500&&($.push(x),!(x>o));t++)x=addTime(x,h,m);const p=e.max??$[$.length-1],M=p-f||1;return{min:f,max:p,ticks:$.filter(t=>t>=f&&t<=p),unit:h,step:m,fraction:t=>(t-f)/M}}function timeParts(t,e,n=!1){if("second"===t||"minute"===t||"hour"===t){const r="second"===t?{hour:"2-digit",minute:"2-digit",second:"2-digit",hourCycle:"h23"}:{hour:"2-digit",minute:"2-digit",hourCycle:"h23"};if(!n)return r;const o={month:"short",day:"numeric",...r};return e?{...o,year:"numeric"}:o}if("year"===t)return{year:"numeric"};const r="month"===t||"quarter"===t?{month:"short"}:{month:"short",day:"numeric"};return e?{...r,year:"numeric"}:r}export function timeNeedsDate(t,e){return!("second"!==e&&"minute"!==e&&"hour"!==e||t.length<2||floorTime(t[0],"day")===floorTime(t[t.length-1]-1,"day"))}export function formatTimeValue(e,n,r,o=!1){return t(r,timeParts(n,!0,o)).format(new Date(e))}export function formatTimeTicks(e,n,r){const o=new Set(e.map(t=>new Date(t).getFullYear())).size>1,a=timeNeedsDate(e,n);return e.map((e,i)=>t(r,timeParts(n,o||0===i,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 fitCategoryLabels(t,e){const{horizontal:n,slot:r,fontSize:o,ticks:a}=e;return a||!n&&r-6<2.4*o?t:t.map(t=>truncate(t,n?150:r-6,o))}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)}export function writeChartValue(t,n,r){return n?e(r,n).format(t):compactNumber(t,r)}
@@ -1 +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]}
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){try{if("undefined"==typeof localStorage)return null;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]}