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.
- package/LICENSE +1 -1
- package/README.md +20 -14
- package/dist/components/accordion/MPAccordion.d.ts +21 -1
- package/dist/components/accordion/MPAccordion.js +1 -1
- package/dist/components/alert/MPAlert.d.ts +34 -3
- package/dist/components/alert/MPAlert.js +1 -1
- package/dist/components/anchor/MPAnchor.d.ts +107 -0
- package/dist/components/anchor/MPAnchor.js +2 -0
- package/dist/components/anchor/index.d.ts +2 -0
- package/dist/components/anchor/index.js +1 -0
- package/dist/components/animate-appear/MPAnimateAppear.d.ts +2 -2
- package/dist/components/animate-appear/MPAnimateAppear.js +1 -1
- package/dist/components/animate-blink/MPAnimateBlink.d.ts +2 -2
- package/dist/components/animate-blink/MPAnimateBlink.js +2 -1
- package/dist/components/animate-counter/MPAnimateCounter.d.ts +67 -0
- package/dist/components/animate-counter/MPAnimateCounter.js +2 -0
- package/dist/components/animate-counter/index.d.ts +2 -0
- package/dist/components/animate-counter/index.js +1 -0
- package/dist/components/animate-fade/MPAnimateFade.d.ts +2 -2
- package/dist/components/animate-fade/MPAnimateFade.js +2 -1
- package/dist/components/animate-float/MPAnimateFloat.d.ts +53 -0
- package/dist/components/animate-float/MPAnimateFloat.js +2 -0
- package/dist/components/animate-float/index.d.ts +2 -0
- package/dist/components/animate-float/index.js +1 -0
- package/dist/components/animate-grow/MPAnimateGrow.d.ts +2 -2
- package/dist/components/animate-grow/MPAnimateGrow.js +2 -1
- package/dist/components/animate-lighting/MPAnimateLighting.js +1 -0
- package/dist/components/animate-reveal/MPAnimateReveal.d.ts +64 -0
- package/dist/components/animate-reveal/MPAnimateReveal.js +2 -0
- package/dist/components/animate-reveal/index.d.ts +2 -0
- package/dist/components/animate-reveal/index.js +1 -0
- package/dist/components/animate-rotate/MPAnimateRotate.d.ts +2 -2
- package/dist/components/animate-rotate/MPAnimateRotate.js +2 -1
- package/dist/components/animate-scramble/MPAnimateScramble.d.ts +65 -0
- package/dist/components/animate-scramble/MPAnimateScramble.js +2 -0
- package/dist/components/animate-scramble/index.d.ts +2 -0
- package/dist/components/animate-scramble/index.js +1 -0
- package/dist/components/animate-shake/MPAnimateShake.d.ts +65 -0
- package/dist/components/animate-shake/MPAnimateShake.js +2 -0
- package/dist/components/animate-shake/index.d.ts +2 -0
- package/dist/components/animate-shake/index.js +1 -0
- package/dist/components/animate-slide/MPAnimateSlide.d.ts +2 -2
- package/dist/components/animate-slide/MPAnimateSlide.js +2 -1
- package/dist/components/animate-split/MPAnimateSplit.d.ts +56 -0
- package/dist/components/animate-split/MPAnimateSplit.js +2 -0
- package/dist/components/animate-split/index.d.ts +2 -0
- package/dist/components/animate-split/index.js +1 -0
- package/dist/components/animate-typing/MPAnimateTyping.js +1 -1
- package/dist/components/animate-zoom/MPAnimateZoom.d.ts +2 -2
- package/dist/components/animate-zoom/MPAnimateZoom.js +2 -1
- package/dist/components/app-logo/MPAppLogo.d.ts +171 -0
- package/dist/components/app-logo/MPAppLogo.js +2 -0
- package/dist/components/app-logo/index.d.ts +2 -0
- package/dist/components/app-logo/index.js +1 -0
- package/dist/components/area-chart/MPAreaChart.d.ts +79 -0
- package/dist/components/area-chart/MPAreaChart.js +2 -0
- package/dist/components/area-chart/index.d.ts +2 -0
- package/dist/components/area-chart/index.js +1 -0
- package/dist/components/aspect-ratio/MPAspectRatio.d.ts +1 -1
- package/dist/components/aspect-ratio/MPAspectRatio.js +2 -1
- package/dist/components/avatar/MPAvatar.d.ts +10 -1
- package/dist/components/avatar/MPAvatar.js +1 -1
- package/dist/components/bar-chart/MPBarChart.d.ts +74 -0
- package/dist/components/bar-chart/MPBarChart.js +2 -0
- package/dist/components/bar-chart/index.d.ts +2 -0
- package/dist/components/bar-chart/index.js +1 -0
- package/dist/components/blockquote/MPBlockquote.d.ts +18 -1
- package/dist/components/blockquote/MPBlockquote.js +1 -1
- package/dist/components/bottom-navigation/MPBottomNavigation.d.ts +2 -18
- package/dist/components/bottom-navigation/MPBottomNavigation.js +1 -1
- package/dist/components/box/MPBox.d.ts +43 -8
- package/dist/components/box/MPBox.js +2 -1
- package/dist/components/breadcrumb/MPBreadcrumb.js +1 -1
- package/dist/components/button/MPButton.js +1 -1
- package/dist/components/calendar/MPCalendar.js +1 -1
- package/dist/components/card/MPCard.js +1 -1
- package/dist/components/carousel/MPCarousel.js +1 -1
- package/dist/components/checkbox/MPCheckbox.js +1 -1
- package/dist/components/chip/MPChip.d.ts +11 -2
- package/dist/components/chip/MPChip.js +1 -1
- package/dist/components/code-block/MPCodeBlock.d.ts +177 -0
- package/dist/components/code-block/MPCodeBlock.js +2 -0
- package/dist/components/code-block/index.d.ts +2 -0
- package/dist/components/code-block/index.js +1 -0
- package/dist/components/collapsible/MPCollapsible.d.ts +12 -1
- package/dist/components/collapsible/MPCollapsible.js +1 -1
- package/dist/components/color-picker/MPColorPicker.js +1 -1
- package/dist/components/combobox/MPCombobox.d.ts +21 -4
- package/dist/components/combobox/MPCombobox.js +1 -1
- package/dist/components/command-palette/MPCommandPalette.d.ts +12 -2
- package/dist/components/command-palette/MPCommandPalette.js +1 -1
- package/dist/components/config/MPConfigProvider.d.ts +49 -7
- package/dist/components/config/MPConfigProvider.js +1 -1
- package/dist/components/confirm/MPConfirmProvider.js +1 -1
- package/dist/components/container/MPContainer.d.ts +9 -2
- package/dist/components/container/MPContainer.js +2 -1
- package/dist/components/data-list/MPDataList.d.ts +82 -0
- package/dist/components/data-list/MPDataList.js +2 -0
- package/dist/components/data-list/index.d.ts +2 -0
- package/dist/components/data-list/index.js +1 -0
- package/dist/components/data-table/MPDataTable.d.ts +314 -0
- package/dist/components/data-table/MPDataTable.js +2 -0
- package/dist/components/data-table/index.d.ts +2 -0
- package/dist/components/data-table/index.js +1 -0
- package/dist/components/date-picker/MPDatePicker.js +1 -1
- package/dist/components/dialog/MPDialog.d.ts +10 -2
- package/dist/components/dialog/MPDialog.js +1 -1
- package/dist/components/drawer/MPDrawer.d.ts +8 -2
- package/dist/components/drawer/MPDrawer.js +1 -1
- package/dist/components/empty/MPEmpty.d.ts +10 -1
- package/dist/components/empty/MPEmpty.js +1 -1
- package/dist/components/fieldset/MPFieldset.js +1 -1
- package/dist/components/file-picker/MPFilePicker.js +1 -1
- package/dist/components/flex/MPFlex.d.ts +95 -0
- package/dist/components/flex/MPFlex.js +2 -0
- package/dist/components/flex/index.d.ts +2 -0
- package/dist/components/flex/index.js +1 -0
- package/dist/components/floating-action-button/MPFloatingActionButton.js +1 -1
- package/dist/components/floating-bottom-navigation/MPFloatingBottomNavigation.d.ts +127 -0
- package/dist/components/floating-bottom-navigation/MPFloatingBottomNavigation.js +2 -0
- package/dist/components/floating-bottom-navigation/index.d.ts +2 -0
- package/dist/components/floating-bottom-navigation/index.js +1 -0
- package/dist/components/footer/MPFooter.d.ts +24 -4
- package/dist/components/footer/MPFooter.js +1 -1
- package/dist/components/form/MPForm.js +1 -1
- package/dist/components/gauge-chart/MPGaugeChart.d.ts +78 -0
- package/dist/components/gauge-chart/MPGaugeChart.js +2 -0
- package/dist/components/gauge-chart/index.d.ts +2 -0
- package/dist/components/gauge-chart/index.js +1 -0
- package/dist/components/grid/MPGrid.d.ts +25 -8
- package/dist/components/grid/MPGrid.js +1 -1
- package/dist/components/header/MPHeader.d.ts +26 -4
- package/dist/components/header/MPHeader.js +1 -1
- package/dist/components/heatmap-chart/MPHeatmapChart.d.ts +75 -0
- package/dist/components/heatmap-chart/MPHeatmapChart.js +2 -0
- package/dist/components/heatmap-chart/index.d.ts +2 -0
- package/dist/components/heatmap-chart/index.js +1 -0
- package/dist/components/hover-card/MPHoverCard.d.ts +101 -0
- package/dist/components/hover-card/MPHoverCard.js +2 -0
- package/dist/components/hover-card/index.d.ts +2 -0
- package/dist/components/hover-card/index.js +1 -0
- package/dist/components/icon/MPIcon.js +1 -1
- package/dist/components/image/MPImage.d.ts +122 -5
- package/dist/components/image/MPImage.js +1 -1
- package/dist/components/image/index.d.ts +1 -1
- package/dist/components/line-chart/MPLineChart.d.ts +66 -0
- package/dist/components/line-chart/MPLineChart.js +2 -0
- package/dist/components/line-chart/index.d.ts +2 -0
- package/dist/components/line-chart/index.js +1 -0
- package/dist/components/list/MPList.d.ts +23 -1
- package/dist/components/list/MPList.js +1 -1
- package/dist/components/menu/MPMenu.d.ts +1 -1
- package/dist/components/menu/MPMenu.js +1 -1
- package/dist/components/menubar/MPMenubar.js +1 -1
- package/dist/components/meter/MPMeter.d.ts +87 -0
- package/dist/components/meter/MPMeter.js +2 -0
- package/dist/components/meter/index.d.ts +2 -0
- package/dist/components/meter/index.js +1 -0
- package/dist/components/mockup/MPMockup.d.ts +143 -0
- package/dist/components/mockup/MPMockup.js +2 -0
- package/dist/components/mockup/index.d.ts +2 -0
- package/dist/components/mockup/index.js +1 -0
- package/dist/components/navigation-menu/MPNavigationMenu.js +1 -1
- package/dist/components/number-field/MPNumberField.js +1 -1
- package/dist/components/pie-chart/MPPieChart.d.ts +77 -0
- package/dist/components/pie-chart/MPPieChart.js +2 -0
- package/dist/components/pie-chart/index.d.ts +2 -0
- package/dist/components/pie-chart/index.js +1 -0
- package/dist/components/pill/MPPill.js +1 -1
- package/dist/components/popconfirm/MPPopconfirm.d.ts +2 -2
- package/dist/components/popover/MPPopover.d.ts +1 -0
- package/dist/components/popover/MPPopover.js +1 -1
- package/dist/components/portal/MPPortal.d.ts +75 -0
- package/dist/components/portal/MPPortal.js +2 -0
- package/dist/components/portal/index.d.ts +2 -0
- package/dist/components/portal/index.js +1 -0
- package/dist/components/radio-group/MPRadioGroup.js +1 -1
- package/dist/components/rating/MPRating.js +1 -1
- package/dist/components/scatter-chart/MPScatterChart.d.ts +66 -0
- package/dist/components/scatter-chart/MPScatterChart.js +2 -0
- package/dist/components/scatter-chart/index.d.ts +2 -0
- package/dist/components/scatter-chart/index.js +1 -0
- package/dist/components/scroll-area/MPScrollArea.d.ts +82 -0
- package/dist/components/scroll-area/MPScrollArea.js +2 -0
- package/dist/components/scroll-area/index.d.ts +2 -0
- package/dist/components/scroll-area/index.js +1 -0
- package/dist/components/scroll-zone/MPScrollZone.d.ts +165 -0
- package/dist/components/scroll-zone/MPScrollZone.js +2 -0
- package/dist/components/scroll-zone/index.d.ts +2 -0
- package/dist/components/scroll-zone/index.js +1 -0
- package/dist/components/segmented-button/MPSegmentedButton.js +1 -1
- package/dist/components/select/MPSelect.d.ts +27 -4
- package/dist/components/select/MPSelect.js +1 -1
- package/dist/components/show/MPShow.d.ts +78 -0
- package/dist/components/show/MPShow.js +2 -0
- package/dist/components/show/index.d.ts +2 -0
- package/dist/components/show/index.js +1 -0
- package/dist/components/sidebar/MPSidebar.d.ts +20 -1
- package/dist/components/sidebar/MPSidebar.js +1 -1
- package/dist/components/sparkline/MPSparkline.d.ts +85 -0
- package/dist/components/sparkline/MPSparkline.js +2 -0
- package/dist/components/sparkline/index.d.ts +2 -0
- package/dist/components/sparkline/index.js +1 -0
- package/dist/components/spoiler/MPSpoiler.d.ts +12 -0
- package/dist/components/spoiler/MPSpoiler.js +1 -1
- package/dist/components/stack/MPStack.d.ts +198 -0
- package/dist/components/stack/MPStack.js +2 -0
- package/dist/components/stack/index.d.ts +2 -0
- package/dist/components/stack/index.js +1 -0
- package/dist/components/statistic/MPStatistic.d.ts +104 -0
- package/dist/components/statistic/MPStatistic.js +2 -0
- package/dist/components/statistic/index.d.ts +2 -0
- package/dist/components/statistic/index.js +1 -0
- package/dist/components/stepper/MPStepper.js +1 -1
- package/dist/components/table/MPTable.d.ts +25 -3
- package/dist/components/table/MPTable.js +1 -1
- package/dist/components/tabs/MPTabs.d.ts +12 -0
- package/dist/components/tabs/MPTabs.js +1 -1
- package/dist/components/timeline/MPTimeline.js +1 -1
- package/dist/components/timeline-chart/MPTimelineChart.d.ts +63 -0
- package/dist/components/timeline-chart/MPTimelineChart.js +2 -0
- package/dist/components/timeline-chart/index.d.ts +2 -0
- package/dist/components/timeline-chart/index.js +1 -0
- package/dist/components/toggle/MPToggle.js +1 -1
- package/dist/components/toolbar/MPToolbar.d.ts +106 -0
- package/dist/components/toolbar/MPToolbar.js +2 -0
- package/dist/components/toolbar/index.d.ts +2 -0
- package/dist/components/toolbar/index.js +1 -0
- package/dist/components/tooltip/MPTooltip.js +1 -1
- package/dist/components/tour/MPTour.d.ts +120 -0
- package/dist/components/tour/MPTour.js +2 -0
- package/dist/components/tour/index.d.ts +2 -0
- package/dist/components/tour/index.js +1 -0
- package/dist/components/transfer/MPTransfer.js +1 -1
- package/dist/components/tree-select/MPTreeSelect.d.ts +113 -0
- package/dist/components/tree-select/MPTreeSelect.js +2 -0
- package/dist/components/tree-select/index.d.ts +2 -0
- package/dist/components/tree-select/index.js +1 -0
- package/dist/components/tree-view/MPTreeView.d.ts +153 -0
- package/dist/components/tree-view/MPTreeView.js +2 -0
- package/dist/components/tree-view/index.d.ts +2 -0
- package/dist/components/tree-view/index.js +1 -0
- package/dist/components/typography/MPTypography.d.ts +10 -1
- package/dist/components/typography/MPTypography.js +2 -1
- package/dist/constants/glyphs.d.ts +33 -31
- package/dist/constants/glyphs.js +1 -1
- package/dist/constants/icons.d.ts +32 -31
- package/dist/constants/icons.js +1 -1
- package/dist/hooks/index.d.ts +22 -5
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/useMPColorScheme.js +1 -0
- package/dist/hooks/useMPDisclosure.d.ts +58 -0
- package/dist/hooks/useMPDisclosure.js +2 -0
- package/dist/hooks/useMPElementSize.d.ts +55 -0
- package/dist/hooks/useMPElementSize.js +2 -0
- package/dist/hooks/useMPMediaQuery.d.ts +40 -0
- package/dist/hooks/useMPMediaQuery.js +2 -0
- package/dist/hooks/useMPOnScreen.d.ts +58 -0
- package/dist/hooks/useMPOnScreen.js +2 -0
- package/dist/hooks/useMPReducedMotion.js +1 -0
- package/dist/hooks/useMPWindowClass.d.ts +7 -0
- package/dist/hooks/useMPWindowClass.js +1 -0
- package/dist/index.d.ts +35 -1
- package/dist/index.js +1 -1
- package/dist/internal/Calendar.js +1 -1
- package/dist/internal/ChartChrome.d.ts +199 -0
- package/dist/internal/ChartChrome.js +2 -0
- package/dist/internal/ChartFrame.d.ts +197 -0
- package/dist/internal/ChartFrame.js +2 -0
- package/dist/internal/FieldOutline.d.ts +14 -5
- package/dist/internal/FieldOutline.js +1 -1
- package/dist/internal/Picker.js +1 -1
- package/dist/internal/PopupArrow.d.ts +60 -0
- package/dist/internal/PopupArrow.js +2 -0
- package/dist/internal/SupportingText.d.ts +24 -0
- package/dist/internal/SupportingText.js +1 -1
- package/dist/internal/animate-core.d.ts +121 -0
- package/dist/internal/animate-core.js +1 -0
- package/dist/internal/animate.d.ts +75 -55
- package/dist/internal/animate.js +1 -1
- package/dist/internal/bottom-navigation.d.ts +58 -0
- package/dist/internal/bottom-navigation.js +2 -0
- package/dist/internal/chart.d.ts +461 -0
- package/dist/internal/chart.js +1 -0
- package/dist/internal/color-scheme.d.ts +0 -9
- package/dist/internal/color-scheme.js +1 -1
- package/dist/internal/config.d.ts +24 -5
- package/dist/internal/config.js +1 -1
- package/dist/internal/data-table.d.ts +195 -0
- package/dist/internal/data-table.js +1 -0
- package/dist/internal/date.d.ts +22 -18
- package/dist/internal/date.js +1 -1
- package/dist/internal/density.d.ts +9 -0
- package/dist/internal/density.js +1 -0
- package/dist/internal/elevation.d.ts +26 -0
- package/dist/internal/elevation.js +1 -0
- package/dist/internal/highlight.d.ts +96 -0
- package/dist/internal/highlight.js +1 -0
- package/dist/internal/i18n.d.ts +180 -0
- package/dist/internal/initials.d.ts +28 -0
- package/dist/internal/initials.js +1 -0
- package/dist/internal/intl.d.ts +64 -0
- package/dist/internal/intl.js +1 -0
- package/dist/internal/mark.d.ts +52 -0
- package/dist/internal/mark.js +1 -0
- package/dist/internal/measure.d.ts +31 -0
- package/dist/internal/measure.js +1 -0
- package/dist/internal/messages/anchor.d.ts +3 -0
- package/dist/internal/messages/anchor.js +1 -0
- package/dist/internal/messages/chart.d.ts +3 -0
- package/dist/internal/messages/chart.js +1 -0
- package/dist/internal/messages/code.d.ts +3 -0
- package/dist/internal/messages/code.js +1 -0
- package/dist/internal/messages/data-table.d.ts +3 -0
- package/dist/internal/messages/data-table.js +1 -0
- package/dist/internal/messages/scroll.d.ts +3 -0
- package/dist/internal/messages/scroll.js +1 -0
- package/dist/internal/messages/sparkline.d.ts +3 -0
- package/dist/internal/messages/sparkline.js +1 -0
- package/dist/internal/messages/tour.d.ts +3 -0
- package/dist/internal/messages/tour.js +1 -0
- package/dist/internal/messages/transfer.d.ts +1 -1
- package/dist/internal/messages/transfer.js +1 -1
- package/dist/internal/mockup.d.ts +174 -0
- package/dist/internal/mockup.js +2 -0
- package/dist/internal/page-layout.d.ts +24 -5
- package/dist/internal/page-layout.js +1 -1
- package/dist/internal/responsive.d.ts +55 -0
- package/dist/internal/responsive.js +1 -0
- package/dist/internal/scale.d.ts +0 -17
- package/dist/internal/scale.js +1 -1
- package/dist/internal/step.d.ts +15 -0
- package/dist/internal/step.js +1 -1
- package/dist/internal/table.d.ts +53 -0
- package/dist/internal/table.js +1 -0
- package/dist/internal/text.d.ts +57 -0
- package/dist/internal/text.js +1 -0
- package/dist/internal/threshold.d.ts +19 -0
- package/dist/internal/threshold.js +1 -0
- package/dist/internal/time-scale.d.ts +44 -0
- package/dist/internal/time-scale.js +1 -0
- package/dist/internal/transition.d.ts +33 -0
- package/dist/internal/transition.js +1 -0
- package/dist/internal/visibility.d.ts +48 -0
- package/dist/internal/visibility.js +1 -0
- package/dist/internal/window-class.d.ts +29 -2
- package/dist/internal/window-class.js +1 -1
- package/dist/locales/ar.js +1 -1
- package/dist/locales/de.js +1 -1
- package/dist/locales/es.js +1 -1
- package/dist/locales/fr.js +1 -1
- package/dist/locales/hi.js +1 -1
- package/dist/locales/id.js +1 -1
- package/dist/locales/it.js +1 -1
- package/dist/locales/ja.js +1 -1
- package/dist/locales/ko.js +1 -1
- package/dist/locales/nl.js +1 -1
- package/dist/locales/pl.js +1 -1
- package/dist/locales/pt.js +1 -1
- package/dist/locales/ru.js +1 -1
- package/dist/locales/th.js +1 -1
- package/dist/locales/tr.js +1 -1
- package/dist/locales/vi.js +1 -1
- package/dist/locales/zh-hans.js +1 -1
- package/dist/locales/zh-hant.js +1 -1
- package/dist/styles/accordion.css +1 -1
- package/dist/styles/alert.css +1 -1
- package/dist/styles/anchor.css +2 -0
- package/dist/styles/animate-appear.css +1 -1
- package/dist/styles/animate-blink.css +1 -1
- package/dist/styles/animate-counter.css +2 -0
- package/dist/styles/animate-fade.css +1 -1
- package/dist/styles/animate-float.css +2 -0
- package/dist/styles/animate-grow.css +1 -1
- package/dist/styles/animate-headline.css +1 -1
- package/dist/styles/animate-lighting.css +1 -1
- package/dist/styles/animate-marquee.css +1 -1
- package/dist/styles/animate-reveal.css +2 -0
- package/dist/styles/animate-rotate.css +1 -1
- package/dist/styles/animate-scramble.css +2 -0
- package/dist/styles/animate-shake.css +2 -0
- package/dist/styles/animate-slide.css +1 -1
- package/dist/styles/animate-split.css +2 -0
- package/dist/styles/animate-typing.css +1 -1
- package/dist/styles/animate-zoom.css +1 -1
- package/dist/styles/app-logo.css +2 -0
- package/dist/styles/area-chart.css +2 -0
- package/dist/styles/aspect-ratio.css +1 -1
- package/dist/styles/avatar.css +1 -1
- package/dist/styles/badge.css +1 -1
- package/dist/styles/bar-chart.css +2 -0
- package/dist/styles/blockquote.css +1 -1
- package/dist/styles/bottom-navigation.css +1 -1
- package/dist/styles/box.css +1 -1
- package/dist/styles/breadcrumb.css +1 -1
- package/dist/styles/button.css +1 -1
- package/dist/styles/calendar.css +1 -1
- package/dist/styles/card.css +1 -1
- package/dist/styles/carousel.css +1 -1
- package/dist/styles/chat-bubble.css +1 -1
- package/dist/styles/checkbox.css +1 -1
- package/dist/styles/chip.css +1 -1
- package/dist/styles/code-block.css +2 -0
- package/dist/styles/collapsible.css +1 -1
- package/dist/styles/color-picker.css +1 -1
- package/dist/styles/combobox.css +1 -1
- package/dist/styles/command-palette.css +1 -1
- package/dist/styles/config.css +1 -1
- package/dist/styles/confirm.css +1 -1
- package/dist/styles/container.css +1 -1
- package/dist/styles/data-list.css +2 -0
- package/dist/styles/data-table.css +2 -0
- package/dist/styles/date-picker.css +1 -1
- package/dist/styles/date-range-picker.css +1 -1
- package/dist/styles/date-time-picker.css +1 -1
- package/dist/styles/dialog.css +1 -1
- package/dist/styles/divider.css +1 -1
- package/dist/styles/drawer.css +1 -1
- package/dist/styles/empty.css +1 -1
- package/dist/styles/fieldset.css +1 -1
- package/dist/styles/file-picker.css +1 -1
- package/dist/styles/flex.css +2 -0
- package/dist/styles/floating-action-button.css +1 -1
- package/dist/styles/floating-bottom-navigation.css +2 -0
- package/dist/styles/footer.css +1 -1
- package/dist/styles/form.css +1 -1
- package/dist/styles/gauge-chart.css +2 -0
- package/dist/styles/grid.css +1 -1
- package/dist/styles/header.css +1 -1
- package/dist/styles/heatmap-chart.css +2 -0
- package/dist/styles/highlight.css +1 -1
- package/dist/styles/hover-card.css +2 -0
- package/dist/styles/icon-button.css +1 -1
- package/dist/styles/icon.css +1 -1
- package/dist/styles/image.css +1 -1
- package/dist/styles/line-chart.css +2 -0
- package/dist/styles/list.css +1 -1
- package/dist/styles/locale.css +1 -1
- package/dist/styles/menu.css +1 -1
- package/dist/styles/menubar.css +1 -1
- package/dist/styles/meter.css +2 -0
- package/dist/styles/mockup.css +2 -0
- package/dist/styles/navigation-menu.css +1 -1
- package/dist/styles/number-field.css +1 -1
- package/dist/styles/otp-field.css +1 -1
- package/dist/styles/overlay.css +1 -1
- package/dist/styles/page-layout.css +1 -1
- package/dist/styles/pagination.css +1 -1
- package/dist/styles/pie-chart.css +2 -0
- package/dist/styles/pill.css +1 -1
- package/dist/styles/popconfirm.css +1 -1
- package/dist/styles/popover.css +1 -1
- package/dist/styles/portal.css +2 -0
- package/dist/styles/progress-box.css +1 -1
- package/dist/styles/progress-circular.css +1 -1
- package/dist/styles/progress-linear.css +1 -1
- package/dist/styles/radio-group.css +1 -1
- package/dist/styles/rating.css +1 -1
- package/dist/styles/scatter-chart.css +2 -0
- package/dist/styles/scroll-area.css +2 -0
- package/dist/styles/scroll-zone.css +2 -0
- package/dist/styles/segmented-button.css +1 -1
- package/dist/styles/select.css +1 -1
- package/dist/styles/show.css +2 -0
- package/dist/styles/sidebar.css +1 -1
- package/dist/styles/skeleton.css +1 -1
- package/dist/styles/slider.css +1 -1
- package/dist/styles/snackbar.css +1 -1
- package/dist/styles/sparkline.css +2 -0
- package/dist/styles/spoiler.css +1 -1
- package/dist/styles/stack.css +2 -0
- package/dist/styles/statistic.css +2 -0
- package/dist/styles/stepper.css +1 -1
- package/dist/styles/switch.css +1 -1
- package/dist/styles/table.css +1 -1
- package/dist/styles/tabs.css +1 -1
- package/dist/styles/text-field.css +1 -1
- package/dist/styles/text-link.css +1 -1
- package/dist/styles/time-picker.css +1 -1
- package/dist/styles/timeline-chart.css +2 -0
- package/dist/styles/timeline.css +1 -1
- package/dist/styles/toggle.css +1 -1
- package/dist/styles/tokens.css +1 -1
- package/dist/styles/toolbar.css +2 -0
- package/dist/styles/tour.css +2 -0
- package/dist/styles/transfer.css +1 -1
- package/dist/styles/tree-select.css +2 -0
- package/dist/styles/tree-view.css +2 -0
- package/dist/styles/typography.css +1 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +2606 -185
- package/dist/types.d.ts +566 -5
- package/package.json +26 -25
- package/.fix.py +0 -92
- package/dist/components/avatar-group/MPAvatarGroup.d.ts +0 -74
- package/dist/components/avatar-group/MPAvatarGroup.js +0 -2
- package/dist/components/avatar-group/index.d.ts +0 -2
- package/dist/components/avatar-group/index.js +0 -1
- package/dist/internal/avatar-group.d.ts +0 -22
- package/dist/internal/avatar-group.js +0 -2
- 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;
|
package/dist/internal/date.d.ts
CHANGED
|
@@ -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
|
-
/**
|
|
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;
|
package/dist/internal/date.js
CHANGED
|
@@ -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
|
|
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={"&":"&","<":"<",">":">",""":'"',"'":"'"};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}]:[])}
|