material-plus-ui 1.6.0 → 1.8.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 (501) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +20 -14
  3. package/dist/components/accordion/MPAccordion.d.ts +21 -1
  4. package/dist/components/accordion/MPAccordion.js +1 -1
  5. package/dist/components/alert/MPAlert.d.ts +34 -3
  6. package/dist/components/alert/MPAlert.js +1 -1
  7. package/dist/components/anchor/MPAnchor.d.ts +107 -0
  8. package/dist/components/anchor/MPAnchor.js +2 -0
  9. package/dist/components/anchor/index.d.ts +2 -0
  10. package/dist/components/anchor/index.js +1 -0
  11. package/dist/components/animate-appear/MPAnimateAppear.d.ts +2 -2
  12. package/dist/components/animate-appear/MPAnimateAppear.js +1 -1
  13. package/dist/components/animate-blink/MPAnimateBlink.d.ts +2 -2
  14. package/dist/components/animate-blink/MPAnimateBlink.js +2 -1
  15. package/dist/components/animate-counter/MPAnimateCounter.d.ts +67 -0
  16. package/dist/components/animate-counter/MPAnimateCounter.js +2 -0
  17. package/dist/components/animate-counter/index.d.ts +2 -0
  18. package/dist/components/animate-counter/index.js +1 -0
  19. package/dist/components/animate-fade/MPAnimateFade.d.ts +2 -2
  20. package/dist/components/animate-fade/MPAnimateFade.js +2 -1
  21. package/dist/components/animate-float/MPAnimateFloat.d.ts +53 -0
  22. package/dist/components/animate-float/MPAnimateFloat.js +2 -0
  23. package/dist/components/animate-float/index.d.ts +2 -0
  24. package/dist/components/animate-float/index.js +1 -0
  25. package/dist/components/animate-grow/MPAnimateGrow.d.ts +2 -2
  26. package/dist/components/animate-grow/MPAnimateGrow.js +2 -1
  27. package/dist/components/animate-lighting/MPAnimateLighting.js +1 -0
  28. package/dist/components/animate-reveal/MPAnimateReveal.d.ts +64 -0
  29. package/dist/components/animate-reveal/MPAnimateReveal.js +2 -0
  30. package/dist/components/animate-reveal/index.d.ts +2 -0
  31. package/dist/components/animate-reveal/index.js +1 -0
  32. package/dist/components/animate-rotate/MPAnimateRotate.d.ts +2 -2
  33. package/dist/components/animate-rotate/MPAnimateRotate.js +2 -1
  34. package/dist/components/animate-scramble/MPAnimateScramble.d.ts +65 -0
  35. package/dist/components/animate-scramble/MPAnimateScramble.js +2 -0
  36. package/dist/components/animate-scramble/index.d.ts +2 -0
  37. package/dist/components/animate-scramble/index.js +1 -0
  38. package/dist/components/animate-shake/MPAnimateShake.d.ts +65 -0
  39. package/dist/components/animate-shake/MPAnimateShake.js +2 -0
  40. package/dist/components/animate-shake/index.d.ts +2 -0
  41. package/dist/components/animate-shake/index.js +1 -0
  42. package/dist/components/animate-slide/MPAnimateSlide.d.ts +2 -2
  43. package/dist/components/animate-slide/MPAnimateSlide.js +2 -1
  44. package/dist/components/animate-split/MPAnimateSplit.d.ts +56 -0
  45. package/dist/components/animate-split/MPAnimateSplit.js +2 -0
  46. package/dist/components/animate-split/index.d.ts +2 -0
  47. package/dist/components/animate-split/index.js +1 -0
  48. package/dist/components/animate-typing/MPAnimateTyping.js +1 -1
  49. package/dist/components/animate-zoom/MPAnimateZoom.d.ts +2 -2
  50. package/dist/components/animate-zoom/MPAnimateZoom.js +2 -1
  51. package/dist/components/app-logo/MPAppLogo.d.ts +171 -0
  52. package/dist/components/app-logo/MPAppLogo.js +2 -0
  53. package/dist/components/app-logo/index.d.ts +2 -0
  54. package/dist/components/app-logo/index.js +1 -0
  55. package/dist/components/area-chart/MPAreaChart.d.ts +79 -0
  56. package/dist/components/area-chart/MPAreaChart.js +2 -0
  57. package/dist/components/area-chart/index.d.ts +2 -0
  58. package/dist/components/area-chart/index.js +1 -0
  59. package/dist/components/aspect-ratio/MPAspectRatio.d.ts +1 -1
  60. package/dist/components/aspect-ratio/MPAspectRatio.js +2 -1
  61. package/dist/components/avatar/MPAvatar.d.ts +10 -1
  62. package/dist/components/avatar/MPAvatar.js +1 -1
  63. package/dist/components/bar-chart/MPBarChart.d.ts +74 -0
  64. package/dist/components/bar-chart/MPBarChart.js +2 -0
  65. package/dist/components/bar-chart/index.d.ts +2 -0
  66. package/dist/components/bar-chart/index.js +1 -0
  67. package/dist/components/blockquote/MPBlockquote.d.ts +18 -1
  68. package/dist/components/blockquote/MPBlockquote.js +1 -1
  69. package/dist/components/bottom-navigation/MPBottomNavigation.d.ts +2 -18
  70. package/dist/components/bottom-navigation/MPBottomNavigation.js +1 -1
  71. package/dist/components/box/MPBox.d.ts +43 -8
  72. package/dist/components/box/MPBox.js +2 -1
  73. package/dist/components/breadcrumb/MPBreadcrumb.js +1 -1
  74. package/dist/components/button/MPButton.js +1 -1
  75. package/dist/components/calendar/MPCalendar.js +1 -1
  76. package/dist/components/card/MPCard.js +1 -1
  77. package/dist/components/carousel/MPCarousel.js +1 -1
  78. package/dist/components/checkbox/MPCheckbox.js +1 -1
  79. package/dist/components/chip/MPChip.d.ts +11 -2
  80. package/dist/components/chip/MPChip.js +1 -1
  81. package/dist/components/code-block/MPCodeBlock.d.ts +177 -0
  82. package/dist/components/code-block/MPCodeBlock.js +2 -0
  83. package/dist/components/code-block/index.d.ts +2 -0
  84. package/dist/components/code-block/index.js +1 -0
  85. package/dist/components/collapsible/MPCollapsible.d.ts +12 -1
  86. package/dist/components/collapsible/MPCollapsible.js +1 -1
  87. package/dist/components/color-picker/MPColorPicker.js +1 -1
  88. package/dist/components/combobox/MPCombobox.d.ts +21 -4
  89. package/dist/components/combobox/MPCombobox.js +1 -1
  90. package/dist/components/command-palette/MPCommandPalette.d.ts +12 -2
  91. package/dist/components/command-palette/MPCommandPalette.js +1 -1
  92. package/dist/components/config/MPConfigProvider.d.ts +49 -7
  93. package/dist/components/config/MPConfigProvider.js +1 -1
  94. package/dist/components/confirm/MPConfirmProvider.js +1 -1
  95. package/dist/components/container/MPContainer.d.ts +9 -2
  96. package/dist/components/container/MPContainer.js +2 -1
  97. package/dist/components/data-list/MPDataList.d.ts +82 -0
  98. package/dist/components/data-list/MPDataList.js +2 -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/MPDataTable.d.ts +314 -0
  102. package/dist/components/data-table/MPDataTable.js +2 -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/MPDatePicker.js +1 -1
  106. package/dist/components/dialog/MPDialog.d.ts +10 -2
  107. package/dist/components/dialog/MPDialog.js +1 -1
  108. package/dist/components/drawer/MPDrawer.d.ts +8 -2
  109. package/dist/components/drawer/MPDrawer.js +1 -1
  110. package/dist/components/empty/MPEmpty.d.ts +10 -1
  111. package/dist/components/empty/MPEmpty.js +1 -1
  112. package/dist/components/fieldset/MPFieldset.js +1 -1
  113. package/dist/components/file-picker/MPFilePicker.js +1 -1
  114. package/dist/components/flex/MPFlex.d.ts +95 -0
  115. package/dist/components/flex/MPFlex.js +2 -0
  116. package/dist/components/flex/index.d.ts +2 -0
  117. package/dist/components/flex/index.js +1 -0
  118. package/dist/components/floating-action-button/MPFloatingActionButton.js +1 -1
  119. package/dist/components/floating-bottom-navigation/MPFloatingBottomNavigation.d.ts +127 -0
  120. package/dist/components/floating-bottom-navigation/MPFloatingBottomNavigation.js +2 -0
  121. package/dist/components/floating-bottom-navigation/index.d.ts +2 -0
  122. package/dist/components/floating-bottom-navigation/index.js +1 -0
  123. package/dist/components/footer/MPFooter.d.ts +24 -4
  124. package/dist/components/footer/MPFooter.js +1 -1
  125. package/dist/components/form/MPForm.js +1 -1
  126. package/dist/components/gauge-chart/MPGaugeChart.d.ts +78 -0
  127. package/dist/components/gauge-chart/MPGaugeChart.js +2 -0
  128. package/dist/components/gauge-chart/index.d.ts +2 -0
  129. package/dist/components/gauge-chart/index.js +1 -0
  130. package/dist/components/grid/MPGrid.d.ts +25 -8
  131. package/dist/components/grid/MPGrid.js +1 -1
  132. package/dist/components/header/MPHeader.d.ts +26 -4
  133. package/dist/components/header/MPHeader.js +1 -1
  134. package/dist/components/heatmap-chart/MPHeatmapChart.d.ts +75 -0
  135. package/dist/components/heatmap-chart/MPHeatmapChart.js +2 -0
  136. package/dist/components/heatmap-chart/index.d.ts +2 -0
  137. package/dist/components/heatmap-chart/index.js +1 -0
  138. package/dist/components/hover-card/MPHoverCard.d.ts +101 -0
  139. package/dist/components/hover-card/MPHoverCard.js +2 -0
  140. package/dist/components/hover-card/index.d.ts +2 -0
  141. package/dist/components/hover-card/index.js +1 -0
  142. package/dist/components/icon/MPIcon.js +1 -1
  143. package/dist/components/image/MPImage.d.ts +122 -5
  144. package/dist/components/image/MPImage.js +1 -1
  145. package/dist/components/image/index.d.ts +1 -1
  146. package/dist/components/line-chart/MPLineChart.d.ts +66 -0
  147. package/dist/components/line-chart/MPLineChart.js +2 -0
  148. package/dist/components/line-chart/index.d.ts +2 -0
  149. package/dist/components/line-chart/index.js +1 -0
  150. package/dist/components/list/MPList.d.ts +23 -1
  151. package/dist/components/list/MPList.js +1 -1
  152. package/dist/components/menu/MPMenu.d.ts +1 -1
  153. package/dist/components/menu/MPMenu.js +1 -1
  154. package/dist/components/menubar/MPMenubar.js +1 -1
  155. package/dist/components/meter/MPMeter.d.ts +87 -0
  156. package/dist/components/meter/MPMeter.js +2 -0
  157. package/dist/components/meter/index.d.ts +2 -0
  158. package/dist/components/meter/index.js +1 -0
  159. package/dist/components/mockup/MPMockup.d.ts +143 -0
  160. package/dist/components/mockup/MPMockup.js +2 -0
  161. package/dist/components/mockup/index.d.ts +2 -0
  162. package/dist/components/mockup/index.js +1 -0
  163. package/dist/components/navigation-menu/MPNavigationMenu.js +1 -1
  164. package/dist/components/number-field/MPNumberField.js +1 -1
  165. package/dist/components/pie-chart/MPPieChart.d.ts +77 -0
  166. package/dist/components/pie-chart/MPPieChart.js +2 -0
  167. package/dist/components/pie-chart/index.d.ts +2 -0
  168. package/dist/components/pie-chart/index.js +1 -0
  169. package/dist/components/pill/MPPill.js +1 -1
  170. package/dist/components/popconfirm/MPPopconfirm.d.ts +2 -2
  171. package/dist/components/popover/MPPopover.d.ts +1 -0
  172. package/dist/components/popover/MPPopover.js +1 -1
  173. package/dist/components/portal/MPPortal.d.ts +75 -0
  174. package/dist/components/portal/MPPortal.js +2 -0
  175. package/dist/components/portal/index.d.ts +2 -0
  176. package/dist/components/portal/index.js +1 -0
  177. package/dist/components/radio-group/MPRadioGroup.js +1 -1
  178. package/dist/components/rating/MPRating.js +1 -1
  179. package/dist/components/scatter-chart/MPScatterChart.d.ts +66 -0
  180. package/dist/components/scatter-chart/MPScatterChart.js +2 -0
  181. package/dist/components/scatter-chart/index.d.ts +2 -0
  182. package/dist/components/scatter-chart/index.js +1 -0
  183. package/dist/components/scroll-area/MPScrollArea.d.ts +82 -0
  184. package/dist/components/scroll-area/MPScrollArea.js +2 -0
  185. package/dist/components/scroll-area/index.d.ts +2 -0
  186. package/dist/components/scroll-area/index.js +1 -0
  187. package/dist/components/scroll-zone/MPScrollZone.d.ts +165 -0
  188. package/dist/components/scroll-zone/MPScrollZone.js +2 -0
  189. package/dist/components/scroll-zone/index.d.ts +2 -0
  190. package/dist/components/scroll-zone/index.js +1 -0
  191. package/dist/components/segmented-button/MPSegmentedButton.js +1 -1
  192. package/dist/components/select/MPSelect.d.ts +27 -4
  193. package/dist/components/select/MPSelect.js +1 -1
  194. package/dist/components/show/MPShow.d.ts +78 -0
  195. package/dist/components/show/MPShow.js +2 -0
  196. package/dist/components/show/index.d.ts +2 -0
  197. package/dist/components/show/index.js +1 -0
  198. package/dist/components/sidebar/MPSidebar.d.ts +20 -1
  199. package/dist/components/sidebar/MPSidebar.js +1 -1
  200. package/dist/components/sparkline/MPSparkline.d.ts +85 -0
  201. package/dist/components/sparkline/MPSparkline.js +2 -0
  202. package/dist/components/sparkline/index.d.ts +2 -0
  203. package/dist/components/sparkline/index.js +1 -0
  204. package/dist/components/spoiler/MPSpoiler.d.ts +12 -0
  205. package/dist/components/spoiler/MPSpoiler.js +1 -1
  206. package/dist/components/stack/MPStack.d.ts +198 -0
  207. package/dist/components/stack/MPStack.js +2 -0
  208. package/dist/components/stack/index.d.ts +2 -0
  209. package/dist/components/stack/index.js +1 -0
  210. package/dist/components/statistic/MPStatistic.d.ts +104 -0
  211. package/dist/components/statistic/MPStatistic.js +2 -0
  212. package/dist/components/statistic/index.d.ts +2 -0
  213. package/dist/components/statistic/index.js +1 -0
  214. package/dist/components/stepper/MPStepper.js +1 -1
  215. package/dist/components/table/MPTable.d.ts +25 -3
  216. package/dist/components/table/MPTable.js +1 -1
  217. package/dist/components/tabs/MPTabs.d.ts +12 -0
  218. package/dist/components/tabs/MPTabs.js +1 -1
  219. package/dist/components/timeline/MPTimeline.js +1 -1
  220. package/dist/components/timeline-chart/MPTimelineChart.d.ts +63 -0
  221. package/dist/components/timeline-chart/MPTimelineChart.js +2 -0
  222. package/dist/components/timeline-chart/index.d.ts +2 -0
  223. package/dist/components/timeline-chart/index.js +1 -0
  224. package/dist/components/toggle/MPToggle.js +1 -1
  225. package/dist/components/toolbar/MPToolbar.d.ts +106 -0
  226. package/dist/components/toolbar/MPToolbar.js +2 -0
  227. package/dist/components/toolbar/index.d.ts +2 -0
  228. package/dist/components/toolbar/index.js +1 -0
  229. package/dist/components/tooltip/MPTooltip.js +1 -1
  230. package/dist/components/tour/MPTour.d.ts +120 -0
  231. package/dist/components/tour/MPTour.js +2 -0
  232. package/dist/components/tour/index.d.ts +2 -0
  233. package/dist/components/tour/index.js +1 -0
  234. package/dist/components/transfer/MPTransfer.js +1 -1
  235. package/dist/components/tree-select/MPTreeSelect.d.ts +113 -0
  236. package/dist/components/tree-select/MPTreeSelect.js +2 -0
  237. package/dist/components/tree-select/index.d.ts +2 -0
  238. package/dist/components/tree-select/index.js +1 -0
  239. package/dist/components/tree-view/MPTreeView.d.ts +153 -0
  240. package/dist/components/tree-view/MPTreeView.js +2 -0
  241. package/dist/components/tree-view/index.d.ts +2 -0
  242. package/dist/components/tree-view/index.js +1 -0
  243. package/dist/components/typography/MPTypography.d.ts +10 -1
  244. package/dist/components/typography/MPTypography.js +2 -1
  245. package/dist/constants/glyphs.d.ts +33 -31
  246. package/dist/constants/glyphs.js +1 -1
  247. package/dist/constants/icons.d.ts +32 -31
  248. package/dist/constants/icons.js +1 -1
  249. package/dist/hooks/index.d.ts +22 -5
  250. package/dist/hooks/index.js +1 -1
  251. package/dist/hooks/useMPColorScheme.js +1 -0
  252. package/dist/hooks/useMPDisclosure.d.ts +58 -0
  253. package/dist/hooks/useMPDisclosure.js +2 -0
  254. package/dist/hooks/useMPElementSize.d.ts +55 -0
  255. package/dist/hooks/useMPElementSize.js +2 -0
  256. package/dist/hooks/useMPMediaQuery.d.ts +40 -0
  257. package/dist/hooks/useMPMediaQuery.js +2 -0
  258. package/dist/hooks/useMPOnScreen.d.ts +58 -0
  259. package/dist/hooks/useMPOnScreen.js +2 -0
  260. package/dist/hooks/useMPReducedMotion.js +1 -0
  261. package/dist/hooks/useMPWindowClass.d.ts +7 -0
  262. package/dist/hooks/useMPWindowClass.js +1 -0
  263. package/dist/index.d.ts +35 -1
  264. package/dist/index.js +1 -1
  265. package/dist/internal/Calendar.js +1 -1
  266. package/dist/internal/ChartChrome.d.ts +199 -0
  267. package/dist/internal/ChartChrome.js +2 -0
  268. package/dist/internal/ChartFrame.d.ts +197 -0
  269. package/dist/internal/ChartFrame.js +2 -0
  270. package/dist/internal/FieldOutline.d.ts +14 -5
  271. package/dist/internal/FieldOutline.js +1 -1
  272. package/dist/internal/Picker.js +1 -1
  273. package/dist/internal/PopupArrow.d.ts +60 -0
  274. package/dist/internal/PopupArrow.js +2 -0
  275. package/dist/internal/SupportingText.d.ts +24 -0
  276. package/dist/internal/SupportingText.js +1 -1
  277. package/dist/internal/animate-core.d.ts +121 -0
  278. package/dist/internal/animate-core.js +1 -0
  279. package/dist/internal/animate.d.ts +75 -55
  280. package/dist/internal/animate.js +1 -1
  281. package/dist/internal/bottom-navigation.d.ts +58 -0
  282. package/dist/internal/bottom-navigation.js +2 -0
  283. package/dist/internal/chart.d.ts +461 -0
  284. package/dist/internal/chart.js +1 -0
  285. package/dist/internal/color-scheme.d.ts +0 -9
  286. package/dist/internal/color-scheme.js +1 -1
  287. package/dist/internal/config.d.ts +24 -5
  288. package/dist/internal/config.js +1 -1
  289. package/dist/internal/data-table.d.ts +195 -0
  290. package/dist/internal/data-table.js +1 -0
  291. package/dist/internal/date.d.ts +22 -18
  292. package/dist/internal/date.js +1 -1
  293. package/dist/internal/density.d.ts +9 -0
  294. package/dist/internal/density.js +1 -0
  295. package/dist/internal/elevation.d.ts +26 -0
  296. package/dist/internal/elevation.js +1 -0
  297. package/dist/internal/highlight.d.ts +96 -0
  298. package/dist/internal/highlight.js +1 -0
  299. package/dist/internal/i18n.d.ts +180 -0
  300. package/dist/internal/initials.d.ts +28 -0
  301. package/dist/internal/initials.js +1 -0
  302. package/dist/internal/intl.d.ts +64 -0
  303. package/dist/internal/intl.js +1 -0
  304. package/dist/internal/mark.d.ts +52 -0
  305. package/dist/internal/mark.js +1 -0
  306. package/dist/internal/measure.d.ts +31 -0
  307. package/dist/internal/measure.js +1 -0
  308. package/dist/internal/messages/anchor.d.ts +3 -0
  309. package/dist/internal/messages/anchor.js +1 -0
  310. package/dist/internal/messages/chart.d.ts +3 -0
  311. package/dist/internal/messages/chart.js +1 -0
  312. package/dist/internal/messages/code.d.ts +3 -0
  313. package/dist/internal/messages/code.js +1 -0
  314. package/dist/internal/messages/data-table.d.ts +3 -0
  315. package/dist/internal/messages/data-table.js +1 -0
  316. package/dist/internal/messages/scroll.d.ts +3 -0
  317. package/dist/internal/messages/scroll.js +1 -0
  318. package/dist/internal/messages/sparkline.d.ts +3 -0
  319. package/dist/internal/messages/sparkline.js +1 -0
  320. package/dist/internal/messages/tour.d.ts +3 -0
  321. package/dist/internal/messages/tour.js +1 -0
  322. package/dist/internal/messages/transfer.d.ts +1 -1
  323. package/dist/internal/messages/transfer.js +1 -1
  324. package/dist/internal/mockup.d.ts +174 -0
  325. package/dist/internal/mockup.js +2 -0
  326. package/dist/internal/page-layout.d.ts +24 -5
  327. package/dist/internal/page-layout.js +1 -1
  328. package/dist/internal/responsive.d.ts +55 -0
  329. package/dist/internal/responsive.js +1 -0
  330. package/dist/internal/scale.d.ts +0 -17
  331. package/dist/internal/scale.js +1 -1
  332. package/dist/internal/step.d.ts +15 -0
  333. package/dist/internal/step.js +1 -1
  334. package/dist/internal/table.d.ts +53 -0
  335. package/dist/internal/table.js +1 -0
  336. package/dist/internal/text.d.ts +57 -0
  337. package/dist/internal/text.js +1 -0
  338. package/dist/internal/threshold.d.ts +19 -0
  339. package/dist/internal/threshold.js +1 -0
  340. package/dist/internal/time-scale.d.ts +44 -0
  341. package/dist/internal/time-scale.js +1 -0
  342. package/dist/internal/transition.d.ts +33 -0
  343. package/dist/internal/transition.js +1 -0
  344. package/dist/internal/visibility.d.ts +48 -0
  345. package/dist/internal/visibility.js +1 -0
  346. package/dist/internal/window-class.d.ts +29 -2
  347. package/dist/internal/window-class.js +1 -1
  348. package/dist/locales/ar.js +1 -1
  349. package/dist/locales/de.js +1 -1
  350. package/dist/locales/es.js +1 -1
  351. package/dist/locales/fr.js +1 -1
  352. package/dist/locales/hi.js +1 -1
  353. package/dist/locales/id.js +1 -1
  354. package/dist/locales/it.js +1 -1
  355. package/dist/locales/ja.js +1 -1
  356. package/dist/locales/ko.js +1 -1
  357. package/dist/locales/nl.js +1 -1
  358. package/dist/locales/pl.js +1 -1
  359. package/dist/locales/pt.js +1 -1
  360. package/dist/locales/ru.js +1 -1
  361. package/dist/locales/th.js +1 -1
  362. package/dist/locales/tr.js +1 -1
  363. package/dist/locales/vi.js +1 -1
  364. package/dist/locales/zh-hans.js +1 -1
  365. package/dist/locales/zh-hant.js +1 -1
  366. package/dist/styles/accordion.css +1 -1
  367. package/dist/styles/alert.css +1 -1
  368. package/dist/styles/anchor.css +2 -0
  369. package/dist/styles/animate-appear.css +1 -1
  370. package/dist/styles/animate-blink.css +1 -1
  371. package/dist/styles/animate-counter.css +2 -0
  372. package/dist/styles/animate-fade.css +1 -1
  373. package/dist/styles/animate-float.css +2 -0
  374. package/dist/styles/animate-grow.css +1 -1
  375. package/dist/styles/animate-headline.css +1 -1
  376. package/dist/styles/animate-lighting.css +1 -1
  377. package/dist/styles/animate-marquee.css +1 -1
  378. package/dist/styles/animate-reveal.css +2 -0
  379. package/dist/styles/animate-rotate.css +1 -1
  380. package/dist/styles/animate-scramble.css +2 -0
  381. package/dist/styles/animate-shake.css +2 -0
  382. package/dist/styles/animate-slide.css +1 -1
  383. package/dist/styles/animate-split.css +2 -0
  384. package/dist/styles/animate-typing.css +1 -1
  385. package/dist/styles/animate-zoom.css +1 -1
  386. package/dist/styles/app-logo.css +2 -0
  387. package/dist/styles/area-chart.css +2 -0
  388. package/dist/styles/aspect-ratio.css +1 -1
  389. package/dist/styles/avatar.css +1 -1
  390. package/dist/styles/badge.css +1 -1
  391. package/dist/styles/bar-chart.css +2 -0
  392. package/dist/styles/blockquote.css +1 -1
  393. package/dist/styles/bottom-navigation.css +1 -1
  394. package/dist/styles/box.css +1 -1
  395. package/dist/styles/breadcrumb.css +1 -1
  396. package/dist/styles/button.css +1 -1
  397. package/dist/styles/calendar.css +1 -1
  398. package/dist/styles/card.css +1 -1
  399. package/dist/styles/carousel.css +1 -1
  400. package/dist/styles/chat-bubble.css +1 -1
  401. package/dist/styles/checkbox.css +1 -1
  402. package/dist/styles/chip.css +1 -1
  403. package/dist/styles/code-block.css +2 -0
  404. package/dist/styles/collapsible.css +1 -1
  405. package/dist/styles/color-picker.css +1 -1
  406. package/dist/styles/combobox.css +1 -1
  407. package/dist/styles/command-palette.css +1 -1
  408. package/dist/styles/config.css +1 -1
  409. package/dist/styles/confirm.css +1 -1
  410. package/dist/styles/container.css +1 -1
  411. package/dist/styles/data-list.css +2 -0
  412. package/dist/styles/data-table.css +2 -0
  413. package/dist/styles/date-picker.css +1 -1
  414. package/dist/styles/date-range-picker.css +1 -1
  415. package/dist/styles/date-time-picker.css +1 -1
  416. package/dist/styles/dialog.css +1 -1
  417. package/dist/styles/divider.css +1 -1
  418. package/dist/styles/drawer.css +1 -1
  419. package/dist/styles/empty.css +1 -1
  420. package/dist/styles/fieldset.css +1 -1
  421. package/dist/styles/file-picker.css +1 -1
  422. package/dist/styles/flex.css +2 -0
  423. package/dist/styles/floating-action-button.css +1 -1
  424. package/dist/styles/floating-bottom-navigation.css +2 -0
  425. package/dist/styles/footer.css +1 -1
  426. package/dist/styles/form.css +1 -1
  427. package/dist/styles/gauge-chart.css +2 -0
  428. package/dist/styles/grid.css +1 -1
  429. package/dist/styles/header.css +1 -1
  430. package/dist/styles/heatmap-chart.css +2 -0
  431. package/dist/styles/highlight.css +1 -1
  432. package/dist/styles/hover-card.css +2 -0
  433. package/dist/styles/icon-button.css +1 -1
  434. package/dist/styles/icon.css +1 -1
  435. package/dist/styles/image.css +1 -1
  436. package/dist/styles/line-chart.css +2 -0
  437. package/dist/styles/list.css +1 -1
  438. package/dist/styles/locale.css +1 -1
  439. package/dist/styles/menu.css +1 -1
  440. package/dist/styles/menubar.css +1 -1
  441. package/dist/styles/meter.css +2 -0
  442. package/dist/styles/mockup.css +2 -0
  443. package/dist/styles/navigation-menu.css +1 -1
  444. package/dist/styles/number-field.css +1 -1
  445. package/dist/styles/otp-field.css +1 -1
  446. package/dist/styles/overlay.css +1 -1
  447. package/dist/styles/page-layout.css +1 -1
  448. package/dist/styles/pagination.css +1 -1
  449. package/dist/styles/pie-chart.css +2 -0
  450. package/dist/styles/pill.css +1 -1
  451. package/dist/styles/popconfirm.css +1 -1
  452. package/dist/styles/popover.css +1 -1
  453. package/dist/styles/portal.css +2 -0
  454. package/dist/styles/progress-box.css +1 -1
  455. package/dist/styles/progress-circular.css +1 -1
  456. package/dist/styles/progress-linear.css +1 -1
  457. package/dist/styles/radio-group.css +1 -1
  458. package/dist/styles/rating.css +1 -1
  459. package/dist/styles/scatter-chart.css +2 -0
  460. package/dist/styles/scroll-area.css +2 -0
  461. package/dist/styles/scroll-zone.css +2 -0
  462. package/dist/styles/segmented-button.css +1 -1
  463. package/dist/styles/select.css +1 -1
  464. package/dist/styles/show.css +2 -0
  465. package/dist/styles/sidebar.css +1 -1
  466. package/dist/styles/skeleton.css +1 -1
  467. package/dist/styles/slider.css +1 -1
  468. package/dist/styles/snackbar.css +1 -1
  469. package/dist/styles/sparkline.css +2 -0
  470. package/dist/styles/spoiler.css +1 -1
  471. package/dist/styles/stack.css +2 -0
  472. package/dist/styles/statistic.css +2 -0
  473. package/dist/styles/stepper.css +1 -1
  474. package/dist/styles/switch.css +1 -1
  475. package/dist/styles/table.css +1 -1
  476. package/dist/styles/tabs.css +1 -1
  477. package/dist/styles/text-field.css +1 -1
  478. package/dist/styles/text-link.css +1 -1
  479. package/dist/styles/time-picker.css +1 -1
  480. package/dist/styles/timeline-chart.css +2 -0
  481. package/dist/styles/timeline.css +1 -1
  482. package/dist/styles/toggle.css +1 -1
  483. package/dist/styles/tokens.css +1 -1
  484. package/dist/styles/toolbar.css +2 -0
  485. package/dist/styles/tour.css +2 -0
  486. package/dist/styles/transfer.css +1 -1
  487. package/dist/styles/tree-select.css +2 -0
  488. package/dist/styles/tree-view.css +2 -0
  489. package/dist/styles/typography.css +1 -1
  490. package/dist/styles.css +1 -1
  491. package/dist/tailwind.css +2606 -185
  492. package/dist/types.d.ts +566 -5
  493. package/package.json +26 -25
  494. package/.fix.py +0 -92
  495. package/dist/components/avatar-group/MPAvatarGroup.d.ts +0 -74
  496. package/dist/components/avatar-group/MPAvatarGroup.js +0 -2
  497. package/dist/components/avatar-group/index.d.ts +0 -2
  498. package/dist/components/avatar-group/index.js +0 -1
  499. package/dist/internal/avatar-group.d.ts +0 -22
  500. package/dist/internal/avatar-group.js +0 -2
  501. package/dist/styles/avatar-group.css +0 -2
@@ -0,0 +1,195 @@
1
+ /**
2
+ * The arithmetic an `MPDataTable` is made of.
3
+ *
4
+ * Here rather than in the component for the reason `internal/mockup.tsx` gives:
5
+ * a component whose interesting fifty lines are buried in machinery is a
6
+ * component nobody can read. Ranking two rows, cutting a page out of a list,
7
+ * working out which rows a Shift-click covers and escaping a comma so a
8
+ * spreadsheet does not shift a column are four questions with plain answers, and
9
+ * a file that also has to draw a resize handle is not where they can be found.
10
+ *
11
+ * There is no React in this file and nothing in it knows what a column is.
12
+ * Everything takes plain values and returns plain values, which is also what
13
+ * makes it the half of the component that can be tested without a browser.
14
+ */
15
+ /** Which way a column runs when it is sorted. */
16
+ export type MPSortDirection = 'asc' | 'desc';
17
+ /** One key of the sort, and its direction. A sort is a list of these. */
18
+ export interface MPDataTableSort {
19
+ /** The column's `key`. */
20
+ key: string;
21
+ direction: MPSortDirection;
22
+ }
23
+ /**
24
+ * The default comparison, for the columns that do not bring one.
25
+ *
26
+ * Empty sorts last in **both** directions, which is the one asymmetry here and
27
+ * the one every spreadsheet has: a blank is not the smallest value, it is the
28
+ * absence of one, and a descending sort whose first screen is forty blanks has
29
+ * answered a question nobody asked.
30
+ *
31
+ * Numbers compare as numbers, dates as instants, booleans with `false` first,
32
+ * and everything else through the collator — which is `numeric`, so `item2`
33
+ * comes before `item10` rather than after it.
34
+ */
35
+ export declare function compareValues(a: unknown, b: unknown, collator: Intl.Collator, descending?: boolean): number;
36
+ /**
37
+ * Sorts by every key at once, the first key outermost.
38
+ *
39
+ * The sort is **stable** — `Array.prototype.sort` has been since ES2019 — which
40
+ * is what makes a multi-key sort composable: sorting by name and then adding
41
+ * date to the end of the list leaves rows with the same date in name order,
42
+ * because that is the order they were already in.
43
+ *
44
+ * **The direction goes to `comparatorFor` rather than being applied to what it
45
+ * hands back.** A machine that reversed the result would reverse everything in
46
+ * it, and a comparison has parts that must not turn over — an empty cell sorts
47
+ * last whichever way the column runs. Who reverses what is a policy, and this
48
+ * function has none.
49
+ *
50
+ * `comparatorFor` answers `null` for a key no column claims, so a sort left over
51
+ * from a column that has since gone is skipped rather than throwing.
52
+ */
53
+ export declare function sortRows<T>(rows: readonly T[], sort: readonly MPDataTableSort[], comparatorFor: (key: string, direction: MPSortDirection) => ((a: T, b: T) => number) | null): T[];
54
+ /**
55
+ * What pressing a heading does, given what the sort already says.
56
+ *
57
+ * Three states rather than two — ascending, descending, unsorted — because the
58
+ * order the rows arrived in is a state a reader cannot get back to by pressing
59
+ * anything if the cycle only has two. That is the opposite of the choice
60
+ * `MPTreeView`'s single select makes, and for the same reason read the other
61
+ * way: there, "nothing chosen" is reachable by pressing something else; here it
62
+ * is not.
63
+ *
64
+ * `additive` is what a Shift-press sets. It leaves the column where it already
65
+ * is in the list rather than moving it to the end, so flipping the second key of
66
+ * a two-key sort does not quietly make it the first.
67
+ */
68
+ export declare function nextSort(current: readonly MPDataTableSort[], key: string, additive: boolean): MPDataTableSort[];
69
+ /** Where one page starts and stops, and how many there are. */
70
+ export interface MPPageBounds {
71
+ /** How many pages the rows come to. Never below `1`. */
72
+ pages: number;
73
+ /** The page actually shown, clamped into range. */
74
+ page: number;
75
+ /** Index of the first row on it. */
76
+ start: number;
77
+ /** One past the last. */
78
+ end: number;
79
+ }
80
+ /**
81
+ * The page arithmetic, with the clamp in it.
82
+ *
83
+ * The clamp is the whole reason this is a function rather than two expressions
84
+ * at the call site. A search that cuts a twenty-page table to three leaves the
85
+ * caller's `page` at fourteen, and a table that answers with an empty screen has
86
+ * told the reader their search found nothing. The page moves to the last one
87
+ * that exists instead.
88
+ */
89
+ export declare function pageBounds(total: number, page: number, pageSize: number): MPPageBounds;
90
+ /**
91
+ * Every key between two, inclusive, in the order the rows are currently in.
92
+ *
93
+ * "Currently" is the point. A Shift-press chooses what the reader can see
94
+ * between the two rows they pressed, so the range is taken from the sorted,
95
+ * searched order rather than from the order `items` arrived in — otherwise
96
+ * shift-pressing two adjacent rows of a sorted table would take in every row
97
+ * that happens to lie between them in the original array.
98
+ *
99
+ * Which of the two keys is the anchor does not matter: dragging up covers the
100
+ * same rows as dragging down. A key that is no longer in the list — a row the
101
+ * current search hides — yields nothing rather than the range from one end that
102
+ * an index of `-1` would quietly produce.
103
+ */
104
+ export declare function keysBetween(order: readonly string[], from: string, to: string): string[];
105
+ /**
106
+ * A value as something a query can be matched against.
107
+ *
108
+ * `toLocaleLowerCase` and nothing else, which is the fold `MPCombobox`,
109
+ * `MPCommandPalette` and `MPTreeSelect` already use. A collator that knew about
110
+ * diacritics would be a second answer to a question this library has answered
111
+ * one way — and a reader who has learned what the search box in one part of a
112
+ * product does should not have learned the wrong thing about the rest of it.
113
+ *
114
+ * A `Date` is deliberately not formatted. What a reader sees in a cell came out
115
+ * of the caller's own `render`, and guessing a format the search would agree
116
+ * with is how a table ends up not finding a date that is on the screen. A column
117
+ * whose dates should be searchable gives them a `value`.
118
+ */
119
+ export declare function searchText(value: unknown): string;
120
+ /** Every string a row can be found by, folded once and joined into one haystack. */
121
+ export declare function searchHaystack(values: readonly unknown[]): string;
122
+ /**
123
+ * One field, quoted only when it has to be, and defused when a spreadsheet would
124
+ * otherwise run it.
125
+ *
126
+ * The escaping is the whole job here and getting it wrong is silent: a comma
127
+ * inside a cell shifts every column after it by one, and nobody notices until a
128
+ * spreadsheet somewhere is off by a column. RFC 4180 is four rules and all four
129
+ * are in these six lines — a field is quoted if it holds the separator, a quote
130
+ * or a line break, and a quote inside a quoted field is written twice.
131
+ *
132
+ * ## Why a leading apostrophe
133
+ *
134
+ * RFC 4180 has nothing to say about the second problem, which is that a
135
+ * spreadsheet does not read a CSV as data. A cell that begins `=` or `@` or `+`
136
+ * is a **formula**, and `=HYPERLINK("https://…"&A1)` in a table of things other
137
+ * people typed is one click from posting a colleague's row to somebody else's
138
+ * server. It is the reader's own spreadsheet that runs it, so nothing this
139
+ * library does at render time can reach it — the file is where it has to be
140
+ * stopped.
141
+ *
142
+ * An apostrophe in front is the answer Excel, Sheets and LibreOffice all
143
+ * understand: it is their own marker for "the rest of this is text", and all
144
+ * three strip it on the way in. It is not free. A plain CSV parser — `pandas`,
145
+ * a `csv` module, a database loader — has no such rule and will see the
146
+ * apostrophe as part of the value, which is why `escapeFormulas` exists: a file
147
+ * going to a machine rather than to a person is a file nobody is going to open
148
+ * in a spreadsheet, and it should go out byte for byte.
149
+ *
150
+ * `null` and `undefined` are empty rather than the words "null" and "undefined",
151
+ * which is what `String()` would put in the cell.
152
+ */
153
+ export declare function csvField(value: unknown, separator: string, escapeFormulas?: boolean): string;
154
+ export interface MPCsvOptions {
155
+ /** What goes between fields. `;` for the locales whose spreadsheets expect it. */
156
+ separator?: string;
157
+ /**
158
+ * Writes a byte-order mark in front.
159
+ *
160
+ * On by default, and not as a nicety: Excel reads a UTF-8 CSV without one as
161
+ * the local code page, so every non-ASCII name in the file arrives as
162
+ * mojibake. Every other reader ignores the mark.
163
+ */
164
+ bom?: boolean;
165
+ /**
166
+ * Puts an apostrophe in front of a cell a spreadsheet would otherwise run as a
167
+ * formula.
168
+ *
169
+ * On by default, because the rows in a table are usually things other people
170
+ * typed and the file is usually going to be opened in a spreadsheet — which is
171
+ * the pair that makes a cell beginning `=` an attack rather than a curiosity.
172
+ * A number keeps its sign either way; `csvField` has the whole argument.
173
+ *
174
+ * Turn it off for a file going to a parser rather than to a person, where the
175
+ * apostrophe would arrive as part of the value.
176
+ * @default true
177
+ */
178
+ escapeFormulas?: boolean;
179
+ }
180
+ /** Rows of already-stringable values, as one CSV document. */
181
+ export declare function toCsv(rows: readonly (readonly unknown[])[], options?: MPCsvOptions): string;
182
+ /**
183
+ * Hands the file to the browser.
184
+ *
185
+ * A `blob:` URL and a synthesised press, which is the only way a page can
186
+ * produce a file the reader keeps. The URL is released on the next frame rather
187
+ * than straight away: some browsers have not finished reading it when the press
188
+ * returns, and releasing it too early is a download that silently produces
189
+ * nothing.
190
+ */
191
+ export declare function downloadText(text: string, fileName: string, type: string): void;
192
+ /** How wide a column is when neither the caller nor a drag has said. */
193
+ export declare const DEFAULT_COLUMN_WIDTH = 160;
194
+ /** How narrow a drag may make one. Below this the heading is a single letter. */
195
+ export declare const MIN_COLUMN_WIDTH = 48;
@@ -0,0 +1 @@
1
+ export function compareValues(e,t,n,o=!1){const r=null==e||""===e,i=null==t||""===t;if(r||i)return r&&i?0:r?1:-1;const a=o?-1:1;return"number"==typeof e&&"number"==typeof t?Number.isNaN(e)||Number.isNaN(t)?Number.isNaN(e)&&Number.isNaN(t)?0:Number.isNaN(e)?1:-1:a*(e-t):"boolean"==typeof e&&"boolean"==typeof t?a*(Number(e)-Number(t)):e instanceof Date&&t instanceof Date?a*(e.getTime()-t.getTime()):a*n.compare(String(e),String(t))}export function sortRows(e,t,n){const o=[];for(const e of t){const t=n(e.key,e.direction);t&&o.push(t)}return 0===o.length?e:[...e].sort((e,t)=>{for(const n of o){const o=n(e,t);if(0!==o)return o}return 0})}export function nextSort(e,t,n){const o=e.find(e=>e.key===t),r=void 0===o?"asc":"asc"===o.direction?"desc":null;return n?null===r?e.filter(e=>e.key!==t):void 0===o?[...e,{key:t,direction:r}]:e.map(e=>e.key===t?{key:t,direction:r}:e):null===r?[]:[{key:t,direction:r}]}export function pageBounds(e,t,n){const o=Math.max(1,Math.floor(n)),r=Math.max(1,Math.ceil(e/o)),i=Math.min(Math.max(Math.floor(t),1),r),a=(i-1)*o;return{pages:r,page:i,start:a,end:Math.min(a+o,e)}}export function keysBetween(e,t,n){const o=e.indexOf(t),r=e.indexOf(n);return-1===o||-1===r?[]:e.slice(Math.min(o,r),Math.max(o,r)+1)}export function searchText(e){return null==e||"object"==typeof e?"":String(e).toLocaleLowerCase()}export function searchHaystack(e){return e.map(searchText).join("\0")}const e=/^[=+\-@\t\r]/,t=/^[+-]?[\d.,\u00a0\u202f ]*\d[\d.,\u00a0\u202f ]*$/;export function csvField(n,o,r=!0){if(null==n)return"";const i=n instanceof Date?n.toISOString():"object"==typeof n?JSON.stringify(n):String(n),a=r&&function(n){return!!e.test(n)&&!t.test(n)&&!Number.isFinite(Number(n))}(i)?`'${i}`:i;return/["\r\n]/.test(a)||a.includes(o)?`"${a.replaceAll('"','""')}"`:a}export function toCsv(e,t={}){const{separator:n=",",bom:o=!0,escapeFormulas:r=!0}=t,i=e.map(e=>e.map(e=>csvField(e,n,r)).join(n)).join("\r\n");return o?`\ufeff${i}`:i}export function downloadText(e,t,n){const o=URL.createObjectURL(new Blob([e],{type:n})),r=document.createElement("a");r.href=o,r.download=t,r.rel="noopener",r.style.display="none",document.body.append(r),r.click(),r.remove(),requestAnimationFrame(()=>URL.revokeObjectURL(o))}export const DEFAULT_COLUMN_WIDTH=160;export const MIN_COLUMN_WIDTH=48;
@@ -54,10 +54,6 @@ export declare function isValidDate(value: unknown): value is Date;
54
54
  export declare function startOfDay(date: Date): Date;
55
55
  /** The first day of the month this date is in, at midnight. */
56
56
  export declare function startOfMonth(date: Date): Date;
57
- /** The first day of the year this date is in, at midnight. */
58
- export declare function startOfYear(date: Date): Date;
59
- /** How many days a month has, leap years included. */
60
- export declare function daysInMonth(year: number, month: number): number;
61
57
  /**
62
58
  * The first instant of the day, month or year a date falls in.
63
59
  *
@@ -68,8 +64,6 @@ export declare function daysInMonth(year: number, month: number): number;
68
64
  * another.
69
65
  */
70
66
  export declare function startOfUnit(date: Date, unit: MPCalendarView): Date;
71
- /** The last day of that same unit, at midnight — the other end of its span. */
72
- export declare function endOfUnit(date: Date, unit: MPCalendarView): Date;
73
67
  /** Today, at midnight. The one place the pickers read the clock for a *date*. */
74
68
  export declare function today(): Date;
75
69
  export declare function addDays(date: Date, amount: number): Date;
@@ -146,7 +140,14 @@ export declare function mergeDateAndTime(date: Date, time: Date): Date;
146
140
  export declare function calendarWeeks(month: Date, weekStartsOn: MPWeekday): Date[][];
147
141
  /** The first year on the page a given year falls on. 2026 → 2016 at 12 a page. */
148
142
  export declare function yearPageStart(year: number): number;
149
- /** A memoised `Intl.DateTimeFormat`. `undefined` locale means the runtime's own. */
143
+ /**
144
+ * A memoised `Intl.DateTimeFormat`. `undefined` locale means the runtime's own.
145
+ *
146
+ * The cache itself lives in `internal/intl.ts`, along with the bound it keeps
147
+ * and the two other `Intl` constructors the library asks for. This name stays
148
+ * because it is what the pickers call and because it says which formatter is
149
+ * meant, but it is now the shared cache underneath rather than a second one.
150
+ */
150
151
  export declare function dateFormatter(locale: string | undefined, options: Intl.DateTimeFormatOptions): Intl.DateTimeFormat;
151
152
  /** Formats a date, tolerating the `null` a cleared picker holds. */
152
153
  export declare function formatDate(date: Date | null | undefined, locale: string | undefined, options: Intl.DateTimeFormatOptions): string;
@@ -185,6 +186,20 @@ export declare function withPlaceholder(samples: string[], placeholder: unknown)
185
186
  export declare function toISOYear(date: Date): string;
186
187
  export declare function toISOMonth(date: Date): string;
187
188
  export declare function toISODate(date: Date): string;
189
+ /**
190
+ * The spelling a given precision submits, as a table to look up.
191
+ *
192
+ * `MPCalendar` and `MPDatePicker` each kept this, identically, and each said in
193
+ * its own comment that the two had to agree — which is the argument for there
194
+ * being one of it. A calendar and a picker that submitted the same day two
195
+ * different ways would be two answers to one question.
196
+ *
197
+ * `YYYY-MM-DD` and `YYYY-MM` are what `<input type="date">` and
198
+ * `<input type="month">` submit. A year on its own has no input type behind it
199
+ * and is simply `YYYY` — the same string with the parts nobody chose taken off,
200
+ * rather than a day the server would have to know to ignore.
201
+ */
202
+ export declare const TO_ISO: Record<MPDatePrecision, (date: Date) => string>;
188
203
  export declare function toISOTime(date: Date, withSeconds?: boolean): string;
189
204
  export declare function toISODateTime(date: Date, withSeconds?: boolean): string;
190
205
  /**
@@ -209,18 +224,7 @@ export declare function monthLabels(locale: string | undefined, month?: 'short'
209
224
  * it is wrong for.
210
225
  */
211
226
  export declare function isMonthBeforeYear(locale: string | undefined): boolean;
212
- /** Does this locale put a clock on a 12-hour dial? */
213
227
  export declare function isHour12(locale: string | undefined): boolean;
214
228
  /** What this locale calls AM and PM. */
215
229
  export declare function meridiemLabels(locale: string | undefined): [string, string];
216
- /**
217
- * Which day the week starts on here — Sunday in the US and Korea, Monday across
218
- * most of Europe, Saturday in much of the Middle East.
219
- *
220
- * `Intl.Locale`'s week info is the right source and is also the least evenly
221
- * implemented corner of `Intl`: it is a getter in some engines, a method in
222
- * others, and absent in the rest. All three are handled, and the fallback is
223
- * Sunday rather than a throw — a calendar that renders starting on the wrong day
224
- * is a small annoyance, and a calendar that renders nothing is not.
225
- */
226
230
  export declare function localeWeekStart(locale: string | undefined): MPWeekday;
@@ -1 +1 @@
1
- export const YEAR_PAGE_SIZE=12;export function makeDate(t,e,r){const n=new Date(0);return n.setFullYear(t,e,r),n.setHours(0,0,0,0),n}export function isValidDate(t){return t instanceof Date&&!Number.isNaN(t.getTime())}export function startOfDay(t){const e=new Date(t.getTime());return e.setHours(0,0,0,0),e}export function startOfMonth(t){return makeDate(t.getFullYear(),t.getMonth(),1)}export function startOfYear(t){return makeDate(t.getFullYear(),0,1)}export function daysInMonth(t,e){return makeDate(t,e+1,0).getDate()}export function startOfUnit(t,e){return"year"===e?startOfYear(t):"month"===e?startOfMonth(t):startOfDay(t)}export function endOfUnit(t,e){return"year"===e?makeDate(t.getFullYear(),11,31):"month"===e?makeDate(t.getFullYear(),t.getMonth()+1,0):startOfDay(t)}export function today(){return startOfDay(new Date)}export function addDays(t,e){const r=new Date(t.getTime());return r.setDate(r.getDate()+e),r}export function addMonths(t,e){const r=new Date(t.getTime()),n=makeDate(t.getFullYear(),t.getMonth()+e,1);return r.setFullYear(n.getFullYear(),n.getMonth(),Math.min(t.getDate(),daysInMonth(n.getFullYear(),n.getMonth()))),r}export function addYears(t,e){return addMonths(t,12*e)}export function compareDay(t,e){return startOfDay(t).getTime()-startOfDay(e).getTime()}export function isSameDay(t,e){return isValidDate(t)&&isValidDate(e)&&0===compareDay(t,e)}export function isSameMonth(t,e){return isValidDate(t)&&isValidDate(e)&&t.getFullYear()===e.getFullYear()&&t.getMonth()===e.getMonth()}export function isDayOutside(t,e,r){return!!(isValidDate(e)&&compareDay(t,e)<0)||isValidDate(r)&&compareDay(t,r)>0}export function isUnitOutside(t,e,r,n){return"day"===e?isDayOutside(t,r,n):!!(isValidDate(r)&&compareDay(endOfUnit(t,e),r)<0)||isValidDate(n)&&compareDay(startOfUnit(t,e),n)>0}export function secondsOfDay(t){return 3600*t.getHours()+60*t.getMinutes()+t.getSeconds()}export function timeUnitSpan(t,e){const r=secondsOfDay(e);if("hour"===t){const t=3600*Math.floor(r/3600);return[t,t+3599]}if("minute"===t){const t=60*Math.floor(r/60);return[t,t+59]}if("second"===t)return[r,r];const n=e.getHours()<12?0:43200;return[n,n+43200-1]}export function withTime(t,e){const r=new Date(t.getTime());return r.setHours(e.hours??r.getHours(),e.minutes??r.getMinutes(),e.seconds??r.getSeconds(),0),r}export function mergeDateAndTime(t,e){return withTime(startOfDay(t),{hours:e.getHours(),minutes:e.getMinutes(),seconds:e.getSeconds()})}export function calendarWeeks(t,e){const r=startOfMonth(t),n=(r.getDay()-e+7)%7,o=addDays(r,-n);return Array.from({length:6},(t,e)=>Array.from({length:7},(t,r)=>addDays(o,7*e+r)))}export function yearPageStart(t){return t-(t%12+12)%12}function t(t,e,r){if(t.set(e,r),t.size>64){const e=t.keys().next();e.done||t.delete(e.value)}return r}const e=new Map;export function dateFormatter(r,n){const o=`${r??""}\0${JSON.stringify(n)}`,a=e.get(o);return a||t(e,o,new Intl.DateTimeFormat(r,n))}export function formatDate(t,e,r){return isValidDate(t)?dateFormatter(e,r).format(t):""}const r=Array.from({length:24},(t,e)=>new Date(2027,e%12,21+e%7,e,58,58));export function displaySamples(t,e){const n=dateFormatter(t,e);return[...new Set(r.map(t=>n.format(t)))]}export function withPlaceholder(t,e){return"string"==typeof e&&""!==e?[...t,e]:t}export function toISOYear(t){return String(t.getFullYear()).padStart(4,"0")}export function toISOMonth(t){return`${toISOYear(t)}-${String(t.getMonth()+1).padStart(2,"0")}`}export function toISODate(t){return`${toISOMonth(t)}-${String(t.getDate()).padStart(2,"0")}`}export function toISOTime(t,e=!1){const r=t=>String(t).padStart(2,"0"),n=`${r(t.getHours())}:${r(t.getMinutes())}`;return e?`${n}:${r(t.getSeconds())}`:n}export function toISODateTime(t,e=!1){return`${toISODate(t)}T${toISOTime(t,e)}`}const n=makeDate(2021,7,1),o=new Map;export function weekdayLabels(e,r,a="narrow"){const i=`w ${e??""} ${r} ${a}`,u=o.get(i);if(u)return u;const s=dateFormatter(e,{weekday:a});return t(o,i,Array.from({length:7},(t,e)=>s.format(addDays(n,(r+e)%7))))}export function monthLabels(e,r="short"){const n=`m ${e??""} ${r}`,a=o.get(n);if(a)return a;const i=dateFormatter(e,{month:r});return t(o,n,Array.from({length:12},(t,e)=>i.format(makeDate(2021,e,1))))}export function isMonthBeforeYear(t){const e=dateFormatter(t,{year:"numeric",month:"long"}).formatToParts(n);return e.findIndex(t=>"month"===t.type)<e.findIndex(t=>"year"===t.type)}export function isHour12(t){const e=dateFormatter(t,{hour:"numeric"}).resolvedOptions();return e.hourCycle?"h11"===e.hourCycle||"h12"===e.hourCycle:!0===e.hour12}export function meridiemLabels(t){const e=dateFormatter(t,{hour:"numeric",hour12:!0}),r=t=>{const r=e.formatToParts(withTime(n,{hours:t})).find(t=>"dayPeriod"===t.type);return r?.value??(t<12?"AM":"PM")};return[r(9),r(21)]}export function localeWeekStart(t){try{const e=t??(new Intl.DateTimeFormat).resolvedOptions().locale,r=new Intl.Locale(e),n="function"==typeof r.getWeekInfo?r.getWeekInfo():r.weekInfo;if("number"==typeof n?.firstDay)return n.firstDay%7}catch{}return 0}
1
+ import{dateTimeFormatter as t,remember as e}from"./intl.js";export const YEAR_PAGE_SIZE=12;export function makeDate(t,e,r){const n=new Date(0);return n.setFullYear(t,e,r),n.setHours(0,0,0,0),n}export function isValidDate(t){return t instanceof Date&&!Number.isNaN(t.getTime())}export function startOfDay(t){const e=new Date(t.getTime());return e.setHours(0,0,0,0),e}export function startOfMonth(t){return makeDate(t.getFullYear(),t.getMonth(),1)}export function startOfUnit(t,e){return"year"===e?function(t){return makeDate(t.getFullYear(),0,1)}(t):"month"===e?startOfMonth(t):startOfDay(t)}export function today(){return startOfDay(new Date)}export function addDays(t,e){const r=new Date(t.getTime());return r.setDate(r.getDate()+e),r}export function addMonths(t,e){const r=new Date(t.getTime()),n=makeDate(t.getFullYear(),t.getMonth()+e,1);var o,a;return r.setFullYear(n.getFullYear(),n.getMonth(),Math.min(t.getDate(),(o=n.getFullYear(),a=n.getMonth(),makeDate(o,a+1,0).getDate()))),r}export function addYears(t,e){return addMonths(t,12*e)}export function compareDay(t,e){return startOfDay(t).getTime()-startOfDay(e).getTime()}export function isSameDay(t,e){return isValidDate(t)&&isValidDate(e)&&0===compareDay(t,e)}export function isSameMonth(t,e){return isValidDate(t)&&isValidDate(e)&&t.getFullYear()===e.getFullYear()&&t.getMonth()===e.getMonth()}export function isDayOutside(t,e,r){return!!(isValidDate(e)&&compareDay(t,e)<0)||isValidDate(r)&&compareDay(t,r)>0}export function isUnitOutside(t,e,r,n){return"day"===e?isDayOutside(t,r,n):!!(isValidDate(r)&&compareDay(function(t,e){return"year"===e?makeDate(t.getFullYear(),11,31):"month"===e?makeDate(t.getFullYear(),t.getMonth()+1,0):startOfDay(t)}(t,e),r)<0)||isValidDate(n)&&compareDay(startOfUnit(t,e),n)>0}export function secondsOfDay(t){return 3600*t.getHours()+60*t.getMinutes()+t.getSeconds()}export function timeUnitSpan(t,e){const r=secondsOfDay(e);if("hour"===t){const t=3600*Math.floor(r/3600);return[t,t+3599]}if("minute"===t){const t=60*Math.floor(r/60);return[t,t+59]}if("second"===t)return[r,r];const n=e.getHours()<12?0:43200;return[n,n+43200-1]}export function withTime(t,e){const r=new Date(t.getTime());return r.setHours(e.hours??r.getHours(),e.minutes??r.getMinutes(),e.seconds??r.getSeconds(),0),r}export function mergeDateAndTime(t,e){return withTime(startOfDay(t),{hours:e.getHours(),minutes:e.getMinutes(),seconds:e.getSeconds()})}export function calendarWeeks(t,e){const r=startOfMonth(t),n=(r.getDay()-e+7)%7,o=addDays(r,-n);return Array.from({length:6},(t,e)=>Array.from({length:7},(t,r)=>addDays(o,7*e+r)))}export function yearPageStart(t){return t-(t%12+12)%12}export function dateFormatter(e,r){return t(e,r)}export function formatDate(t,e,r){return isValidDate(t)?dateFormatter(e,r).format(t):""}const r=Array.from({length:24},(t,e)=>new Date(2027,e%12,21+e%7,e,58,58));export function displaySamples(t,e){const n=dateFormatter(t,e);return[...new Set(r.map(t=>n.format(t)))]}export function withPlaceholder(t,e){return"string"==typeof e&&""!==e?[...t,e]:t}export function toISOYear(t){return String(t.getFullYear()).padStart(4,"0")}export function toISOMonth(t){return`${toISOYear(t)}-${String(t.getMonth()+1).padStart(2,"0")}`}export function toISODate(t){return`${toISOMonth(t)}-${String(t.getDate()).padStart(2,"0")}`}export const TO_ISO={day:toISODate,month:toISOMonth,year:toISOYear};export function toISOTime(t,e=!1){const r=t=>String(t).padStart(2,"0"),n=`${r(t.getHours())}:${r(t.getMinutes())}`;return e?`${n}:${r(t.getSeconds())}`:n}export function toISODateTime(t,e=!1){return`${toISODate(t)}T${toISOTime(t,e)}`}const n=makeDate(2021,7,1),o=new Map;export function weekdayLabels(t,r,a="narrow"){const i=`w ${t??""} ${r} ${a}`,u=o.get(i);if(u)return u;const s=dateFormatter(t,{weekday:a});return e(o,i,Array.from({length:7},(t,e)=>s.format(addDays(n,(r+e)%7))))}export function monthLabels(t,r="short"){const n=`m ${t??""} ${r}`,a=o.get(n);if(a)return a;const i=dateFormatter(t,{month:r});return e(o,n,Array.from({length:12},(t,e)=>i.format(makeDate(2021,e,1))))}export function isMonthBeforeYear(t){const e=dateFormatter(t,{year:"numeric",month:"long"}).formatToParts(n);return e.findIndex(t=>"month"===t.type)<e.findIndex(t=>"year"===t.type)}const a=new Map;export function isHour12(t){const r=t??"",n=a.get(r);if(void 0!==n)return n;const o=dateFormatter(t,{hour:"numeric"}).resolvedOptions(),i=o.hourCycle?"h11"===o.hourCycle||"h12"===o.hourCycle:!0===o.hour12;return e(a,r,i)}export function meridiemLabels(t){const e=dateFormatter(t,{hour:"numeric",hour12:!0}),r=t=>{const r=e.formatToParts(withTime(n,{hours:t})).find(t=>"dayPeriod"===t.type);return r?.value??(t<12?"AM":"PM")};return[r(9),r(21)]}const i=new Map;export function localeWeekStart(t){const r=t??"",n=i.get(r);return void 0!==n?n:e(i,r,function(t){try{const e=t??(new Intl.DateTimeFormat).resolvedOptions().locale,r=new Intl.Locale(e),n="function"==typeof r.getWeekInfo?r.getWeekInfo():r.weekInfo;if("number"==typeof n?.firstDay)return n.firstDay%7}catch{}return 0}(t))}
@@ -0,0 +1,9 @@
1
+ import type { MPDensity, MPSize } from '../types.js';
2
+ /** The control height at a rung, tightened by a density step. */
3
+ export declare function controlHeight(size: MPSize, density?: MPDensity): string;
4
+ /** The room inside a sheet at a rung, tightened by a density step. */
5
+ export declare function sheetPad(size: MPSize, density?: MPDensity): string;
6
+ /** The same, sideways only. */
7
+ export declare function sheetPadX(size: MPSize, density?: MPDensity): string;
8
+ /** And the other axis. */
9
+ export declare function sheetPadY(size: MPSize, density?: MPDensity): string;
@@ -0,0 +1 @@
1
+ import{CONTROL_HEIGHT as p,SHEET_PAD as x,SHEET_PAD_X as t,SHEET_PAD_Y as h}from"./scale.js";const e={xs:["h-7","h-6","h-6"],sm:["h-9","h-8","h-7"],md:["h-13","h-12","h-11"],lg:["h-15","h-14","h-13"],xl:["h-17","h-16","h-15"]};export function controlHeight(x,t=0){return 0===t?p[x]:e[x][-t-1]}const n={xs:["p-2","p-1.5","p-1.5"],sm:["p-2.5","p-2","p-1.5"],md:["p-3.5","p-3","p-2.5"],lg:["p-4.5","p-4","p-3.5"],xl:["p-5.5","p-5","p-4.5"]},r={xs:["px-2","px-1.5","px-1.5"],sm:["px-2.5","px-2","px-1.5"],md:["px-3.5","px-3","px-2.5"],lg:["px-4.5","px-4","px-3.5"],xl:["px-5.5","px-5","px-4.5"]},s={xs:["py-2","py-1.5","py-1.5"],sm:["py-2.5","py-2","py-1.5"],md:["py-3.5","py-3","py-2.5"],lg:["py-4.5","py-4","py-3.5"],xl:["py-5.5","py-5","py-4.5"]};export function sheetPad(p,t=0){return 0===t?x[p]:n[p][-t-1]}export function sheetPadX(p,x=0){return 0===x?t[p]:r[p][-x-1]}export function sheetPadY(p,x=0){return 0===x?h[p]:s[p][-x-1]}
@@ -0,0 +1,26 @@
1
+ import type { MPElevation, MPVariant } from '../types.js';
2
+ /**
3
+ * The five weights of `CONTAINER_SURFACE` said as a height instead, one row per
4
+ * MD3 level.
5
+ *
6
+ * A tone **and** a shadow per row, which is what makes an `elevation` prop
7
+ * possible at all. The `elevated` row of the variant table is this table's level
8
+ * 1, written twice because the two props are two different questions and neither
9
+ * should have to resolve the other to answer its own.
10
+ *
11
+ * Levels 4 and 5 share `surface-container-high` and `surface-container-highest`
12
+ * with the levels under them because the specification runs out of container
13
+ * roles before it runs out of levels. Inventing a sixth tone to keep the columns
14
+ * tidy would be inventing a colour role.
15
+ */
16
+ export declare const ELEVATION_SURFACE: Record<MPElevation, string>;
17
+ /**
18
+ * What a container paints, from whichever of the two props answered.
19
+ *
20
+ * A level wins where one was given, and takes the tone with it — so `variant` is
21
+ * left holding only what a level does not describe, which is the hairline. Two
22
+ * props writing one `background-color` would otherwise be settled by the order
23
+ * two class names happened to reach the generated stylesheet, which is not a
24
+ * decision anybody made.
25
+ */
26
+ export declare function containerSurface(variant: MPVariant, elevation: MPElevation | undefined): string;
@@ -0,0 +1 @@
1
+ import{CONTAINER_SURFACE as o}from"./surface.js";export const ELEVATION_SURFACE={0:"bg-mp-surface shadow-none",1:"shadow-mp-1 bg-mp-surface-container-low",2:"shadow-mp-2 bg-mp-surface-container",3:"shadow-mp-3 bg-mp-surface-container-high",4:"shadow-mp-4 bg-mp-surface-container-high",5:"shadow-mp-5 bg-mp-surface-container-highest"};export function containerSurface(r,e){return void 0===e?o[r]:"outlined"===r?`border-mp-outline-variant border ${ELEVATION_SURFACE[e]}`:ELEVATION_SURFACE[e]}
@@ -0,0 +1,96 @@
1
+ /**
2
+ * The grammar engine behind `MPCodeBlock`, and the only thing in this library
3
+ * that is *loaded* rather than imported.
4
+ *
5
+ * highlight.js is the second runtime dependency the package has, and it is here
6
+ * for a reason no amount of hand-written regex answers: colouring a language
7
+ * means knowing that language, and there are thirty-four of them here. It is
8
+ * reached through `highlight.js/lib/core` plus one module per language, never
9
+ * through the package root — which is all hundred and ninety at once.
10
+ *
11
+ * **Every one of those specifiers sits behind an `import()`, and that is the
12
+ * whole design.** A bundler resolves it at build time and emits it as its own
13
+ * chunk, so a page that renders an `MPCodeBlock` with `highlight={false}`
14
+ * downloads none of it, and a page that colours TypeScript downloads the core
15
+ * and TypeScript and not the other thirty-three. Done with a static import the
16
+ * component would spend forty kilobytes before drawing a character.
17
+ *
18
+ * It is a real `dependencies` entry rather than an optional peer because a
19
+ * specifier a bundler cannot resolve fails the **whole** build rather than the
20
+ * part that would have used it: the bundler walks and resolves this module
21
+ * while it is still deciding whether to keep it. An optional peer would mean
22
+ * `import { MPButton } from 'material-plus-ui'` breaking for anyone who had not
23
+ * installed a syntax highlighter.
24
+ *
25
+ * What comes back out of here is not HTML. highlight.js emits a string of
26
+ * nested `<span>`s, and the block needs *lines* — a line is what carries a
27
+ * number, a prompt and a place in the scroll — so `tokenize` turns that string
28
+ * into runs of text with a class on them, split at every newline. Which is also
29
+ * why nothing in this library ever writes `dangerouslySetInnerHTML`.
30
+ */
31
+ /** One run of text with a single colour: the innermost span highlight.js drew. */
32
+ export interface MPCodeToken {
33
+ text: string;
34
+ /** The class it was drawn under — `hljs-keyword`, `hljs-title function_`. */
35
+ token?: string;
36
+ }
37
+ /** One line of code, as the runs it is made of. An empty array is a blank line. */
38
+ export type MPCodeLine = MPCodeToken[];
39
+ /** The core, and what it hands `registerMPLanguage`. Opaque here; only hljs reads them. */
40
+ type Hljs = typeof import('highlight.js/lib/core').default;
41
+ type LanguageDefinition = Parameters<Hljs['registerLanguage']>[1];
42
+ /**
43
+ * Teaches `MPCodeBlock` a language the built-in set does not have.
44
+ *
45
+ * The same arrangement `registerMPMessages` makes for the eighteen languages
46
+ * the library does not ship, and for the same reason: highlight.js knows a
47
+ * hundred and ninety grammars, a documentation site uses six, and the
48
+ * thirty-four here are a guess at which six. Registering is how an Elixir
49
+ * project or a Nix flake gets coloured without the other hundred and fifty
50
+ * being in anybody's build.
51
+ *
52
+ * ```ts
53
+ * import { registerMPLanguage } from 'material-plus-ui';
54
+ * import elixir from 'highlight.js/lib/languages/elixir';
55
+ *
56
+ * registerMPLanguage('elixir', elixir);
57
+ * ```
58
+ *
59
+ * Call it at module scope. A language registered after a block has drawn does
60
+ * not repaint that block — nothing here re-renders on its own — but every block
61
+ * mounted after it sees it.
62
+ *
63
+ * @param name What `language` will be written as. Registering a name the
64
+ * library already has replaces it.
65
+ * @param definition The default export of a `highlight.js/lib/languages/*`
66
+ * module.
67
+ */
68
+ export declare function registerMPLanguage(name: string, definition: LanguageDefinition): void;
69
+ /** The canonical name a caller's spelling means, whether or not it can be loaded. */
70
+ export declare function canonicalLanguage(language: string | undefined): string | null;
71
+ /**
72
+ * Colours `code`, or answers `null` when the language is unknown.
73
+ *
74
+ * The block is coloured whole and split afterwards, never a line at a time: a
75
+ * block comment, a template literal and a heredoc all span lines, and a
76
+ * highlighter handed one line at a time reads the second line of a comment as
77
+ * code.
78
+ */
79
+ export declare function highlightCode(code: string, language: string): Promise<MPCodeLine[] | null>;
80
+ /**
81
+ * highlight.js's own markup, as lines of coloured runs.
82
+ *
83
+ * The output is a strictly nested tree of `<span class="…">` with escaped text
84
+ * between, and a span may cross a newline — which is exactly why this exists
85
+ * rather than a `split('\n')` over the string. Walking it keeps the open class
86
+ * across the break and reopens it on the next line.
87
+ *
88
+ * Only the innermost class survives a nesting. In the browser that is the one
89
+ * on the element the text actually sits in, so it is the one whose colour
90
+ * applies; keeping the ancestors would put two equally specific rules on one
91
+ * run and let stylesheet order decide the colour.
92
+ */
93
+ export declare function tokenize(html: string): MPCodeLine[];
94
+ /** The same shape with no colour in it: what a block draws before its chunk lands. */
95
+ export declare function plainLines(code: string): MPCodeLine[];
96
+ export {};
@@ -0,0 +1 @@
1
+ const i={bash:()=>import("highlight.js/lib/languages/bash"),c:()=>import("highlight.js/lib/languages/c"),cpp:()=>import("highlight.js/lib/languages/cpp"),csharp:()=>import("highlight.js/lib/languages/csharp"),css:()=>import("highlight.js/lib/languages/css"),diff:()=>import("highlight.js/lib/languages/diff"),dockerfile:()=>import("highlight.js/lib/languages/dockerfile"),go:()=>import("highlight.js/lib/languages/go"),graphql:()=>import("highlight.js/lib/languages/graphql"),ini:()=>import("highlight.js/lib/languages/ini"),java:()=>import("highlight.js/lib/languages/java"),javascript:()=>import("highlight.js/lib/languages/javascript"),json:()=>import("highlight.js/lib/languages/json"),kotlin:()=>import("highlight.js/lib/languages/kotlin"),less:()=>import("highlight.js/lib/languages/less"),lua:()=>import("highlight.js/lib/languages/lua"),makefile:()=>import("highlight.js/lib/languages/makefile"),markdown:()=>import("highlight.js/lib/languages/markdown"),objectivec:()=>import("highlight.js/lib/languages/objectivec"),perl:()=>import("highlight.js/lib/languages/perl"),php:()=>import("highlight.js/lib/languages/php"),plaintext:()=>import("highlight.js/lib/languages/plaintext"),powershell:()=>import("highlight.js/lib/languages/powershell"),python:()=>import("highlight.js/lib/languages/python"),r:()=>import("highlight.js/lib/languages/r"),ruby:()=>import("highlight.js/lib/languages/ruby"),rust:()=>import("highlight.js/lib/languages/rust"),scss:()=>import("highlight.js/lib/languages/scss"),shell:()=>import("highlight.js/lib/languages/shell"),sql:()=>import("highlight.js/lib/languages/sql"),swift:()=>import("highlight.js/lib/languages/swift"),typescript:()=>import("highlight.js/lib/languages/typescript"),xml:()=>import("highlight.js/lib/languages/xml"),yaml:()=>import("highlight.js/lib/languages/yaml")},t={"c++":"cpp",cc:"cpp",cjs:"javascript",console:"bash",cs:"csharp",cts:"typescript",docker:"dockerfile",golang:"go",gql:"graphql",h:"cpp",hpp:"cpp",htm:"xml",html:"xml",js:"javascript",jsx:"javascript",kt:"kotlin",kts:"kotlin",md:"markdown",mdx:"markdown",mjs:"javascript",mm:"objectivec",mts:"typescript",mysql:"sql",node:"javascript",none:"plaintext",objc:"objectivec",plain:"plaintext",posh:"powershell",ps1:"powershell",psql:"sql",py:"python",rb:"ruby",rs:"rust",sh:"bash",svelte:"xml",svg:"xml",text:"plaintext",toml:"ini",ts:"typescript",tsx:"typescript",txt:"plaintext",vue:"xml",yml:"yaml",zsh:"bash"},l=new Map;let g=null;const s=new Map;export function registerMPLanguage(i,t){const g=i.toLowerCase();l.set(g,t),s.delete(g)}export function canonicalLanguage(i){if(!i)return null;const l=i.trim().toLowerCase();return l?t[l]??l:null}export async function highlightCode(t,a){let e=s.get(a);e||(e=async function(t){const s=l.get(t),a=s?void 0:i[t];if(!s&&!a)return null;g??=import("highlight.js/lib/core").then(i=>i.default);const e=await g;return s?e.registerLanguage(t,s):e.getLanguage(t)||e.registerLanguage(t,(await a()).default),t}(a).catch(i=>{throw s.delete(a),i}),s.set(a,e));const h=await e;if(!h||!g)return null;return tokenize((await g).highlight(t,{language:h,ignoreIllegals:!0}).value)}const a={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#x27;":"'"};export function tokenize(i){const t=[[]],l=[],g=/<span class="([^"]*)">|<\/span>/g;let s=0;const e=i=>{if(!i)return;const g=l[l.length-1];i.replace(/&(?:amp|lt|gt|quot|#x27);/g,i=>a[i]).split("\n").forEach((i,l)=>{l>0&&t.push([]),i&&t[t.length-1].push(g?{text:i,token:g}:{text:i})})};for(const t of i.matchAll(g))e(i.slice(s,t.index)),s=t.index+t[0].length,void 0===t[1]?l.pop():l.push(t[1]);return e(i.slice(s)),t}export function plainLines(i){return i.split("\n").map(i=>i?[{text:i}]:[])}