material-plus-ui 1.6.0 → 1.7.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/README.md +2 -2
- package/dist/components/accordion/MPAccordion.d.ts +21 -1
- package/dist/components/accordion/MPAccordion.js +1 -1
- package/dist/components/alert/MPAlert.d.ts +33 -2
- 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 +156 -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.js +1 -0
- 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 +10 -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/card/MPCard.js +1 -1
- package/dist/components/checkbox/MPCheckbox.js +1 -1
- package/dist/components/chip/MPChip.d.ts +10 -1
- 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/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/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 +295 -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/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-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.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 +100 -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/image/MPImage.d.ts +10 -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.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/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/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/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 +24 -2
- 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/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/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 +2 -0
- package/dist/constants/glyphs.js +1 -1
- package/dist/constants/icons.d.ts +1 -0
- 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 +205 -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/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 +471 -0
- package/dist/internal/chart.js +1 -0
- package/dist/internal/config.d.ts +24 -5
- package/dist/internal/config.js +1 -1
- package/dist/internal/data-table.d.ts +162 -0
- package/dist/internal/data-table.js +1 -0
- 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 +170 -0
- package/dist/internal/initials.d.ts +28 -0
- package/dist/internal/initials.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/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/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/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 +1356 -133
- package/dist/types.d.ts +564 -3
- package/package.json +3 -2
- 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 @@
|
|
|
1
|
+
export const CHART={name:"chart",en:{label:"Chart",table:"Chart data",category:"Category"}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const CODE={name:"code",en:{copy:"Copy",copied:"Copied",copyFailed:"Could not copy",raw:"Plain text",label:"Code"}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const DATA_TABLE={name:"dataTable",en:{selectAll:"Select all rows",selectRow:"Select row",total:"Rows: {total}",selected:"Selected: {count}",download:"Download CSV",perPage:"Rows per page",resize:"Resize column"}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const SCROLL={name:"scroll",en:{label:"Scrollable content",previous:"Scroll back",next:"Scroll forward"}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const SPARKLINE={name:"sparkline",en:{summary:"{count} points, from {first} to {last}"}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const TOUR={name:"tour",en:{previous:"Back",next:"Next",done:"Done",skip:"Skip",position:"Step {index} of {total}"}};
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The parts a device mockup is drawn out of.
|
|
3
|
+
*
|
|
4
|
+
* `MPMockup` is one component with a lot of pictures in it: three devices, six
|
|
5
|
+
* systems, four bezels, three finishes and four cut-outs. Kept in the component
|
|
6
|
+
* that would be a thousand-line file whose interesting fifty lines — the scale,
|
|
7
|
+
* the screen, the content — are buried in geometry.
|
|
8
|
+
*
|
|
9
|
+
* So the geometry lives here, as tables and small drawings, and the component
|
|
10
|
+
* is left holding the decisions: what a caller asked for, what the device
|
|
11
|
+
* implies when they did not, and how big it all comes out on the page.
|
|
12
|
+
*
|
|
13
|
+
* ## Why the numbers are in the screen's own pixels
|
|
14
|
+
*
|
|
15
|
+
* Every measurement below is in the device's logical resolution rather than in
|
|
16
|
+
* page pixels, and that is what makes one scale at the end work: a bezel that
|
|
17
|
+
* was 14 device pixels stays 14 device pixels whether the mockup is drawn at
|
|
18
|
+
* full size or at a third of it, so the hardware never thickens as the picture
|
|
19
|
+
* shrinks.
|
|
20
|
+
*
|
|
21
|
+
* ## What is not a token
|
|
22
|
+
*
|
|
23
|
+
* The finishes. A graphite phone stays graphite on a page switched to dark,
|
|
24
|
+
* because the hardware is a photograph of an object rather than a surface of
|
|
25
|
+
* this library's — a mockup whose aluminium turned white with the page would be
|
|
26
|
+
* a mockup of nothing.
|
|
27
|
+
*/
|
|
28
|
+
import * as React from 'react';
|
|
29
|
+
import type { MPSize } from '../types.js';
|
|
30
|
+
/** Which machine the mockup is a picture of. */
|
|
31
|
+
export type MPMockupDevice = 'desktop' | 'tablet' | 'mobile';
|
|
32
|
+
/** The system whose chrome is drawn on the screen. */
|
|
33
|
+
export type MPMockupOs = 'macos' | 'windows' | 'linux' | 'ios' | 'ipados' | 'android';
|
|
34
|
+
/** What holds a desktop screen up. */
|
|
35
|
+
export type MPMockupHardware = 'monitor' | 'laptop';
|
|
36
|
+
/** The camera cut-out along the top edge of a handheld. */
|
|
37
|
+
export type MPMockupNotch = 'none' | 'notch' | 'dynamic-island' | 'punch-hole';
|
|
38
|
+
/**
|
|
39
|
+
* How much hardware there is around the screen.
|
|
40
|
+
*
|
|
41
|
+
* `none` is not a thinner bezel — it is no hardware at all, leaving the screen
|
|
42
|
+
* on its own with its corners cut, which is what a mockup that only wants the
|
|
43
|
+
* viewport is asking for.
|
|
44
|
+
*/
|
|
45
|
+
export type MPMockupBezel = 'none' | 'thin' | 'standard' | 'thick';
|
|
46
|
+
/** What the hardware is made of. */
|
|
47
|
+
export type MPMockupFinish = 'graphite' | 'silver' | 'white';
|
|
48
|
+
/** Which way a handheld is held. */
|
|
49
|
+
export type MPMockupOrientation = 'portrait' | 'landscape';
|
|
50
|
+
/** A screen's logical size, in CSS pixels. */
|
|
51
|
+
export interface MPMockupResolution {
|
|
52
|
+
width: number;
|
|
53
|
+
height: number;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* The system to draw, with a mismatch corrected rather than refused.
|
|
57
|
+
*
|
|
58
|
+
* `os="macos"` on a phone is a caller who changed `device` and forgot the other
|
|
59
|
+
* prop, and the useful answer is the phone's own system — not a desktop menu
|
|
60
|
+
* bar across a 390-pixel screen.
|
|
61
|
+
*/
|
|
62
|
+
export declare function resolveOs(device: MPMockupDevice, os?: MPMockupOs): MPMockupOs;
|
|
63
|
+
/** The cut-out a device would have if nobody said otherwise. */
|
|
64
|
+
export declare function defaultNotch(device: MPMockupDevice, os: MPMockupOs): MPMockupNotch;
|
|
65
|
+
/**
|
|
66
|
+
* Five real resolutions per device, which is what `size` picks between.
|
|
67
|
+
*
|
|
68
|
+
* Real ones rather than a smooth ladder, because the number that matters is the
|
|
69
|
+
* one a media query fires at: a layout tested at 390 and at 430 has been tested
|
|
70
|
+
* at the two widths most phones actually are, and a made-up 400 would be a
|
|
71
|
+
* width nobody's device has.
|
|
72
|
+
*/
|
|
73
|
+
export declare const RESOLUTIONS: Record<MPMockupDevice, Record<MPSize, MPMockupResolution>>;
|
|
74
|
+
/** How much hardware sits on each side of the screen, in screen pixels. */
|
|
75
|
+
interface Shell {
|
|
76
|
+
side: number;
|
|
77
|
+
top: number;
|
|
78
|
+
bottom: number;
|
|
79
|
+
/** The outer corner. The screen's own is this minus `side`. */
|
|
80
|
+
radius: number;
|
|
81
|
+
}
|
|
82
|
+
/** What the stand under a desktop is made of, in screen pixels. */
|
|
83
|
+
interface Stand {
|
|
84
|
+
neckWidth: number;
|
|
85
|
+
neckHeight: number;
|
|
86
|
+
footWidth: number;
|
|
87
|
+
footHeight: number;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Everything the component needs to draw one device, resolved.
|
|
91
|
+
*
|
|
92
|
+
* One object rather than eight return values, because the frame's size is the
|
|
93
|
+
* sum of the rest and a caller that recomputed it would be a second place for
|
|
94
|
+
* the arithmetic to be wrong.
|
|
95
|
+
*/
|
|
96
|
+
export interface MPMockupMetrics {
|
|
97
|
+
screen: MPMockupResolution;
|
|
98
|
+
/** The device itself: the screen plus its hardware. */
|
|
99
|
+
body: MPMockupResolution;
|
|
100
|
+
/** The whole picture: the body plus whatever holds it up. */
|
|
101
|
+
frame: MPMockupResolution;
|
|
102
|
+
shell: Shell;
|
|
103
|
+
screenRadius: number;
|
|
104
|
+
stand: Stand | null;
|
|
105
|
+
/** The wedge a laptop sits on, drawn as a trapezium. */
|
|
106
|
+
laptop: {
|
|
107
|
+
width: number;
|
|
108
|
+
height: number;
|
|
109
|
+
lipWidth: number;
|
|
110
|
+
} | null;
|
|
111
|
+
}
|
|
112
|
+
export declare function mockupMetrics(options: {
|
|
113
|
+
device: MPMockupDevice;
|
|
114
|
+
bezel: MPMockupBezel;
|
|
115
|
+
hardware: MPMockupHardware;
|
|
116
|
+
orientation: MPMockupOrientation;
|
|
117
|
+
resolution: MPMockupResolution;
|
|
118
|
+
}): MPMockupMetrics;
|
|
119
|
+
/**
|
|
120
|
+
* The three finishes, as fixed colours.
|
|
121
|
+
*
|
|
122
|
+
* Not tokens, and not derived from the source colour: a graphite phone stays
|
|
123
|
+
* graphite on a page switched to dark, because the hardware is a photograph of
|
|
124
|
+
* an object rather than a surface of this library's. A mockup whose aluminium
|
|
125
|
+
* turned white with the page would be a mockup of nothing.
|
|
126
|
+
*
|
|
127
|
+
* Two slots each — the face and the edge — because the hardware is drawn as a
|
|
128
|
+
* flat face with a hairline of a darker shade inside it, which is what reads as
|
|
129
|
+
* an edge rather than as a border.
|
|
130
|
+
*/
|
|
131
|
+
export declare const FINISHES: Record<MPMockupFinish, React.CSSProperties>;
|
|
132
|
+
/** What every piece of hardware is painted with. */
|
|
133
|
+
export declare const HARDWARE = "bg-(--_mp-device) ring-1 ring-(--_mp-device-edge) ring-inset";
|
|
134
|
+
/**
|
|
135
|
+
* The camera cut-out, drawn into the top edge of the screen.
|
|
136
|
+
*
|
|
137
|
+
* Hardware rather than chrome, so it is drawn whether or not `systemUi` is on —
|
|
138
|
+
* a phone does not stop having a camera because the status bar was turned off.
|
|
139
|
+
* It sits over the screen rather than taking room from it, which is what the
|
|
140
|
+
* real thing does: the content runs underneath and the system inset keeps the
|
|
141
|
+
* words clear of it.
|
|
142
|
+
*/
|
|
143
|
+
export declare function MockupCutout({ notch, width }: {
|
|
144
|
+
notch: MPMockupNotch;
|
|
145
|
+
width: number;
|
|
146
|
+
}): React.JSX.Element | null;
|
|
147
|
+
/** What one system puts above and below the content. */
|
|
148
|
+
export interface MPMockupChrome {
|
|
149
|
+
top: React.ReactNode;
|
|
150
|
+
bottom: React.ReactNode;
|
|
151
|
+
/** How much room each takes out of the screen, in screen pixels. */
|
|
152
|
+
insetTop: number;
|
|
153
|
+
insetBottom: number;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* A system's own bars.
|
|
157
|
+
*
|
|
158
|
+
* Each takes its own room out of the screen rather than covering the content,
|
|
159
|
+
* so turning `systemUi` off gives the screen back to `children` rather than
|
|
160
|
+
* uncovering something that was hidden underneath.
|
|
161
|
+
*
|
|
162
|
+
* The bars are drawn out of this library's own roles — `surface`, `on-surface`
|
|
163
|
+
* — rather than out of each system's real colours, and that is the line this
|
|
164
|
+
* component keeps: the *hardware* is a photograph and has fixed colours, the
|
|
165
|
+
* *software* on the screen is a page and follows the page. A macOS menu bar
|
|
166
|
+
* that stayed light on a dark mockup would be a picture of somebody else's
|
|
167
|
+
* screenshot rather than a frame around yours.
|
|
168
|
+
*/
|
|
169
|
+
export declare function mockupChrome(options: {
|
|
170
|
+
os: MPMockupOs;
|
|
171
|
+
width: number;
|
|
172
|
+
notch: MPMockupNotch;
|
|
173
|
+
}): MPMockupChrome;
|
|
174
|
+
export {};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{jsx as t,jsxs as e}from"react/jsx-runtime";const i={desktop:["macos","windows","linux"],tablet:["ipados","android"],mobile:["ios","android"]},s={desktop:"macos",tablet:"ipados",mobile:"ios"};export function resolveOs(t,e){return e&&i[t].includes(e)?e:s[t]}export function defaultNotch(t,e){return"mobile"!==t?"none":"ios"===e?"dynamic-island":"punch-hole"}export const RESOLUTIONS={mobile:{xs:{width:320,height:568},sm:{width:360,height:780},md:{width:390,height:844},lg:{width:414,height:896},xl:{width:430,height:932}},tablet:{xs:{width:744,height:1133},sm:{width:810,height:1080},md:{width:820,height:1180},lg:{width:1024,height:1366},xl:{width:1032,height:1376}},desktop:{xs:{width:1024,height:640},sm:{width:1280,height:800},md:{width:1440,height:900},lg:{width:1680,height:1050},xl:{width:1920,height:1200}}};const a={mobile:{thin:{side:10,top:10,bottom:10,radius:46},standard:{side:14,top:14,bottom:14,radius:52},thick:{side:12,top:62,bottom:82,radius:26}},tablet:{thin:{side:14,top:14,bottom:14,radius:28},standard:{side:22,top:22,bottom:22,radius:36},thick:{side:20,top:58,bottom:58,radius:22}},desktop:{thin:{side:10,top:10,bottom:10,radius:12},standard:{side:14,top:14,bottom:52,radius:16},thick:{side:20,top:20,bottom:72,radius:10}}},n={mobile:44,tablet:26,desktop:8};export function mockupMetrics(t){const{device:e,bezel:i,hardware:s,orientation:h,resolution:d}=t,o="desktop"!==e&&"landscape"===h?{width:d.height,height:d.width}:{width:d.width,height:d.height};if("none"===i)return{screen:o,body:o,frame:o,shell:{side:0,top:0,bottom:0,radius:n[e]},screenRadius:n[e],stand:null,laptop:null};const r=a[e][i],l={width:o.width+2*r.side,height:o.height+r.top+r.bottom};if("desktop"!==e)return{screen:o,body:l,frame:l,shell:r,screenRadius:Math.max(2,r.radius-r.side),stand:null,laptop:null};if("laptop"===s){const t={width:Math.round(1.14*l.width),height:Math.round(.028*l.height)+12,lipWidth:Math.round(.12*l.width)};return{screen:o,body:l,frame:{width:t.width,height:l.height+t.height},shell:r,screenRadius:Math.max(2,r.radius-r.side),stand:null,laptop:t}}const c={neckWidth:Math.round(.16*l.width),neckHeight:Math.round(.11*l.height),footWidth:Math.round(.42*l.width),footHeight:Math.max(8,Math.round(.018*l.height))};return{screen:o,body:l,frame:{width:Math.max(l.width,c.footWidth),height:l.height+c.neckHeight+c.footHeight},shell:r,screenRadius:Math.max(2,r.radius-r.side),stand:c,laptop:null}}export const FINISHES={graphite:{"--_mp-device":"#2f3033","--_mp-device-edge":"#131416"},silver:{"--_mp-device":"#d8d9dd","--_mp-device-edge":"#a3a5aa"},white:{"--_mp-device":"#f3f3f5","--_mp-device-edge":"#c8c9ce"}};export const HARDWARE="bg-(--_mp-device) ring-1 ring-(--_mp-device-edge) ring-inset";export function MockupCutout({notch:e,width:i}){if("none"===e)return null;if("punch-hole"===e){const e=Math.round(.032*i);return t("span",{"aria-hidden":"true",className:"absolute left-1/2 -translate-x-1/2 rounded-full bg-black",style:{top:.8*e,width:e,height:e}})}if("dynamic-island"===e){const e=Math.round(.09*i);return t("span",{"aria-hidden":"true",className:"absolute left-1/2 -translate-x-1/2 rounded-full bg-black",style:{top:.35*e,width:Math.round(.31*i),height:e}})}const s=Math.round(.075*i);return t("span",{"aria-hidden":"true",className:"absolute top-0 left-1/2 -translate-x-1/2 bg-black",style:{width:Math.round(.52*i),height:s,borderBottomLeftRadius:.6*s,borderBottomRightRadius:.6*s}})}function h({width:e,height:i,round:s}){return t("span",{className:"bg-mp-on-surface/38 shrink-0",style:{width:e,height:i,borderRadius:s?"9999px":.3*i}})}function d({widths:e,height:i,gap:s,round:a}){return t("span",{className:"flex items-center",style:{gap:s},children:e.map((e,s)=>t(h,{width:e,height:i,round:a},s))})}function o({height:i}){const s=Math.max(1,Math.round(.18*i));return e("span",{className:"flex items-end",style:{gap:.4*i},children:[t("span",{className:"flex items-end",style:{gap:.6*s},children:[.4,.6,.8,1].map(e=>t("span",{className:"bg-mp-on-surface rounded-[1px]",style:{width:s,height:i*e}},e))}),t("span",{className:"relative",style:{width:1.2*i,height:i},children:[1,.62,.26].map((e,a)=>t("span",{className:"border-mp-on-surface absolute bottom-0 left-1/2 -translate-x-1/2 rounded-t-full border-t",style:{width:1.2*i*e,height:i*e,borderWidth:2===a?.3*i:s}},e))}),e("span",{className:"flex items-center",style:{gap:.8*s},children:[t("span",{className:"border-mp-on-surface/60 relative rounded-[2px] border",style:{width:1.9*i,height:i,padding:.6*s},children:t("span",{className:"bg-mp-on-surface block h-full rounded-[1px]",style:{width:"68%"}})}),t("span",{className:"bg-mp-on-surface/60 rounded-r-[1px]",style:{width:s,height:.4*i}})]})]})}function r({size:i}){return e("span",{className:"flex items-center",style:{gap:1.6*i},children:[t("span",{className:"border-mp-on-surface rotate-45 border-b-2 border-l-2",style:{width:.6*i,height:.6*i}}),t("span",{className:"border-mp-on-surface rounded-full border-2",style:{width:.75*i,height:.75*i}}),t("span",{className:"border-mp-on-surface rounded-[2px] border-2",style:{width:.7*i,height:.7*i}})]})}export function mockupChrome(i){const{os:s,width:a,notch:n}=i,l=Math.max(10,Math.round(.035*a)),c=Math.round(.36*l),p=Math.round(.5*l),u="text-mp-on-surface pointer-events-none flex shrink-0 items-center";if("ios"===s||"ipados"===s||"android"===s){const i="none"===n?Math.round(1.3*l):Math.round(2.2*l),d=Math.round(1.4*l),m=e("span",{className:`${u} justify-between`,style:{height:i,paddingInline:2*p,paddingTop:"none"===n?0:Math.round(.6*l)},children:[t(h,{width:Math.round(1.4*l),height:c}),t(o,{height:c})]});return"android"===s?{top:m,bottom:t("span",{className:`${u} justify-center`,style:{height:Math.round(1.8*l)},children:t(r,{size:1.6*c})}),insetTop:i,insetBottom:Math.round(1.8*l)}:{top:m,bottom:t("span",{className:`${u} justify-center`,style:{height:d},children:t("span",{className:"bg-mp-on-surface/60 rounded-full",style:{width:Math.round(.36*a),height:Math.max(3,.28*c)}})}),insetTop:i,insetBottom:d}}if("macos"===s){const i=Math.round(.95*l),s=Math.round(2.1*l),a=Math.round(1.3*l);return{top:e("span",{className:`${u} bg-mp-surface-container/80 justify-between`,style:{height:i,paddingInline:1.5*p,gap:2*p},children:[e("span",{className:"flex items-center",style:{gap:p},children:[t("span",{className:"flex items-center",style:{gap:.7*p},children:["#ff5f57","#febc2e","#28c840"].map(e=>t("span",{className:"rounded-full",style:{width:c,height:c,background:e}},e))}),t(d,{widths:[3*c,2*c,2.4*c],height:c,gap:p})]}),t(d,{widths:[1.6*c,3*c],height:c,gap:p})]}),bottom:t("span",{className:`${u} justify-center`,style:{height:s},children:t("span",{className:"bg-mp-surface-container-high/80 flex items-center rounded-[18%]",style:{gap:p,padding:p},children:[0,1,2,3,4].map(e=>t(h,{width:a,height:a},e))})}),insetTop:i,insetBottom:s}}const m=Math.round(1.5*l),g=Math.round(.95*l);return"windows"===s?{top:null,bottom:e("span",{className:`${u} bg-mp-surface-container/85 justify-center`,style:{height:m,gap:1.5*p},children:[t("span",{className:"grid shrink-0",style:{width:g,height:g,gap:.14*g,gridTemplateColumns:"1fr 1fr"},children:[0,1,2,3].map(e=>t("span",{className:"bg-mp-on-surface/60 rounded-[1px]"},e))}),t(d,{widths:[g,g,g,g],height:g,gap:p})]}),insetTop:0,insetBottom:m}:{top:e("span",{className:`${u} bg-mp-surface-container/85 justify-between`,style:{height:m,paddingInline:2*p},children:[t(d,{widths:[3*c,2*c],height:c,gap:p}),t(h,{width:3.4*c,height:c}),t(d,{widths:[1.6*c,1.6*c,2.4*c],height:c,gap:p})]}),bottom:null,insetTop:m,insetBottom:0}}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* stops being a column, whether a drawer is open, and how tall the bars are.
|
|
16
16
|
*/
|
|
17
17
|
import * as React from 'react';
|
|
18
|
-
import type { MPSide, MPVariant, MPWindowClass } from '../types.js';
|
|
18
|
+
import type { MPElevation, MPSide, MPVariant, MPWindowClass } from '../types.js';
|
|
19
19
|
/**
|
|
20
20
|
* Which end of the band a sidebar takes.
|
|
21
21
|
*
|
|
@@ -109,18 +109,25 @@ export declare const MPPageLayoutContext: React.Context<MPPageLayoutContextValue
|
|
|
109
109
|
*/
|
|
110
110
|
export declare const MPSidebarSideContext: React.Context<MPSidebarSide | null>;
|
|
111
111
|
/**
|
|
112
|
-
* The same
|
|
112
|
+
* The same boundaries as classes, for the part of this that is decided in CSS
|
|
113
113
|
* rather than in JavaScript.
|
|
114
114
|
*
|
|
115
|
-
* `COLLAPSED_ONLY` hides something from the
|
|
115
|
+
* `COLLAPSED_ONLY` hides something from the class *up*, which is what a
|
|
116
116
|
* sidebar's own trigger wants: the button exists exactly while the column does
|
|
117
117
|
* not. `EXPANDED_ONLY` hides it below, which is what the column wants for the
|
|
118
118
|
* one paint between the server's markup arriving and JavaScript finding out how
|
|
119
119
|
* wide the window is — without it a phone draws a full-width sidebar and throws
|
|
120
120
|
* it away a moment later.
|
|
121
121
|
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
122
|
+
* These were four arbitrary variants each — `min-[600px]:hidden` and its
|
|
123
|
+
* mirror — which is to say two more copies of the four widths, sitting a few
|
|
124
|
+
* lines under the copy that has just been removed. They are `internal/visibility.ts`
|
|
125
|
+
* now, and the same classes `MPShow` puts on: one vocabulary for "not at this
|
|
126
|
+
* width", so a sidebar and a bottom bar written against each other cannot part
|
|
127
|
+
* company at one of them.
|
|
128
|
+
*
|
|
129
|
+
* `none` is the only value that is not a window size class. A sidebar that never
|
|
130
|
+
* collapses has a trigger that is never shown and a column that always is.
|
|
124
131
|
*/
|
|
125
132
|
export declare const COLLAPSED_ONLY: Record<MPPageCollapse, string>;
|
|
126
133
|
export declare const EXPANDED_ONLY: Record<MPPageCollapse, string>;
|
|
@@ -180,3 +187,15 @@ export declare function drawerSide(side: MPSidebarSide): MPSide;
|
|
|
180
187
|
* `surface` — which is why it is what a bar defaults to.
|
|
181
188
|
*/
|
|
182
189
|
export declare const BAR_SURFACE: Record<MPVariant, string>;
|
|
190
|
+
/**
|
|
191
|
+
* What a bar paints, from whichever of `variant` and `elevation` answered.
|
|
192
|
+
*
|
|
193
|
+
* `containerSurface`'s rule, with the one difference a bar has: `outlined` does not
|
|
194
|
+
* draw a hairline round it — the rule under a top app bar belongs to the bar's
|
|
195
|
+
* own edge treatment — so a level replaces the surface outright whatever the
|
|
196
|
+
* variant was.
|
|
197
|
+
*
|
|
198
|
+
* A bar's `elevated` is level 2 rather than 1, because a bar sits over the
|
|
199
|
+
* page's content rather than in it. An explicit level says what it says.
|
|
200
|
+
*/
|
|
201
|
+
export declare function barSurface(variant: MPVariant, elevation: MPElevation | undefined): string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import*as e from"react";export const MPPageLayoutContext=/*@__PURE__*/e.createContext({present:!1,register:()=>{},collapseBelow:"none",open:{start:!1,end:!1},setOpen:()=>{},scroll:"page"});export const MPSidebarSideContext=/*@__PURE__*/e.createContext(null);
|
|
2
|
+
import*as e from"react";import{HIDDEN_BELOW as t,HIDDEN_FROM as n}from"./visibility.js";import{below as r,useWindowMins as o}from"./window-class.js";import{ELEVATION_SURFACE as a}from"./elevation.js";export const MPPageLayoutContext=/*@__PURE__*/e.createContext({present:!1,register:()=>{},collapseBelow:"none",open:{start:!1,end:!1},setOpen:()=>{},scroll:"page"});export const MPSidebarSideContext=/*@__PURE__*/e.createContext(null);export const COLLAPSED_ONLY={none:"hidden",compact:n.compact,medium:n.medium,expanded:n.expanded,large:n.large,"extra-large":n["extra-large"]};export const EXPANDED_ONLY={none:"",compact:t.compact,medium:t.medium,expanded:t.expanded,large:t.large,"extra-large":t["extra-large"]};export function useMPCollapsed(t){const n=o(),a=r("none"===t?0:n[t]),d=e.useCallback(e=>{if(!a||"undefined"==typeof window||!window.matchMedia)return()=>{};const t=window.matchMedia(a);return t.addEventListener("change",e),()=>t.removeEventListener("change",e)},[a]),i=e.useCallback(()=>!(!a||"undefined"==typeof window||!window.matchMedia)&&window.matchMedia(a).matches,[a]);return e.useSyncExternalStore(d,i,()=>!1)}export function drawerSide(e){const t="undefined"!=typeof document&&"rtl"===document.documentElement.dir;return"start"===e?t?"right":"left":t?"left":"right"}export const BAR_SURFACE={filled:"bg-mp-surface-container-highest",tonal:"bg-mp-surface-container",elevated:"shadow-mp-2 bg-mp-surface-container-low",outlined:"bg-mp-surface",text:"bg-transparent"};export function barSurface(e,t){return void 0===t?BAR_SURFACE[e]:a[t]}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one shape a value that changes with the window is written in.
|
|
3
|
+
*
|
|
4
|
+
* `MPResponsive<T>` in `src/types.ts` is the type — a value, or a map keyed by
|
|
5
|
+
* window size class, each entry applying from its own class upward. This is what
|
|
6
|
+
* turns one of those into something the stylesheet can read, and it is a module
|
|
7
|
+
* rather than three functions inside `MPGrid` because the grid stopped being the
|
|
8
|
+
* only component with a responsive prop.
|
|
9
|
+
*
|
|
10
|
+
* ## Why a custom property and not a class
|
|
11
|
+
*
|
|
12
|
+
* Because the values are arithmetic a caller picks at runtime. A column is
|
|
13
|
+
* `(100% + gutter) * span / columns - gutter` and a measure is whatever length
|
|
14
|
+
* was asked for; Tailwind finds classes by scanning source text, so an
|
|
15
|
+
* interpolated `w-[${n}]` generates no rule at all. The rules are therefore
|
|
16
|
+
* written once in `src/styles.css` and the per-instance numbers arrive as inline
|
|
17
|
+
* `--_mp-{name}-{class}` slots, exactly as a `color` reaches a background.
|
|
18
|
+
*
|
|
19
|
+
* The other half of that decision is what a media query can do that React
|
|
20
|
+
* cannot: an inherited custom property changes at a boundary without anything
|
|
21
|
+
* re-rendering, so the value a component lays itself out against is always the
|
|
22
|
+
* one that is actually on screen. A responsive prop resolved in JavaScript would
|
|
23
|
+
* be a subtree re-rendering at every window class to say the same thing, and a
|
|
24
|
+
* first paint on the server that has to be corrected afterwards.
|
|
25
|
+
*
|
|
26
|
+
* ## Why only the classes that were named
|
|
27
|
+
*
|
|
28
|
+
* `span={{ expanded: 6 }}` writes one custom property and not five. The gaps are
|
|
29
|
+
* filled in by the stylesheet, which falls each class back to the one below it —
|
|
30
|
+
* see the rungs in `src/styles.css`. That keeps the `style` attribute down to
|
|
31
|
+
* what was asked for, which is the difference between a list of two hundred rows
|
|
32
|
+
* carrying one declaration each and carrying five.
|
|
33
|
+
*/
|
|
34
|
+
import type * as React from 'react';
|
|
35
|
+
import type { MPResponsive, MPWindowClass } from '../types.js';
|
|
36
|
+
/** A bare value means "from `compact` up"; a map is already per class. */
|
|
37
|
+
export declare function classMap<T>(value: MPResponsive<T> | undefined): Partial<Record<MPWindowClass, T>>;
|
|
38
|
+
/**
|
|
39
|
+
* Turns a responsive value into the `--_mp-{name}-{class}` slots the stylesheet
|
|
40
|
+
* reads, writing only the classes the caller actually named.
|
|
41
|
+
*
|
|
42
|
+
* `toCss` is the component's own, because what a number means is the component's
|
|
43
|
+
* business: a span is a count, a gutter is a length on Tailwind's spacing scale,
|
|
44
|
+
* a measure is either a rung of the size ladder or a length said outright.
|
|
45
|
+
*/
|
|
46
|
+
export declare function responsiveSlots<T>(name: string, value: MPResponsive<T> | undefined, toCss: (value: T) => string): React.CSSProperties;
|
|
47
|
+
/**
|
|
48
|
+
* Fills the `compact` entry of a partial map in with the prop's own default.
|
|
49
|
+
*
|
|
50
|
+
* Without this, `spacing={{ expanded: 8 }}` would be a grid with no gutter at all
|
|
51
|
+
* below 840dp — the stylesheet's `0px` fallback rather than the documented 4 —
|
|
52
|
+
* and a caller who widened one class would silently lose every class under it. A
|
|
53
|
+
* map says "from here up, this instead"; it does not say "and nothing below".
|
|
54
|
+
*/
|
|
55
|
+
export declare function withBaseline<T>(value: MPResponsive<T> | undefined, baseline: T): MPResponsive<T>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{WINDOW_CLASSES as o}from"./window-class.js";export function classMap(o){return null==o?{}:"object"==typeof o?o:{compact:o}}export function responsiveSlots(t,n,c){const e=classMap(n),s={};for(const n of o){const o=e[n];void 0!==o&&(s[`--_mp-${t}-${n}`]=c(o))}return s}export function withBaseline(o,t){return null==o?t:"object"==typeof o?{compact:t,...o}:o}
|
package/dist/internal/scale.d.ts
CHANGED
|
@@ -116,23 +116,6 @@ export declare const SHEET_TITLE: Record<MPSize, string>;
|
|
|
116
116
|
export declare const SHEET_GAP: Record<MPSize, string>;
|
|
117
117
|
/** The gap between a control and the text stacked above or below it. */
|
|
118
118
|
export declare const STACK_GAP: Record<MPSize, string>;
|
|
119
|
-
/**
|
|
120
|
-
* The measure — how wide a row of content is allowed to get — in `rem` and
|
|
121
|
-
* pinned to MD3's window size class boundaries: 600, 840, 1200 and 1600dp, with
|
|
122
|
-
* one rung below them.
|
|
123
|
-
*
|
|
124
|
-
* So `maxWidth="md"` is "never wider than a medium window", which is a sentence
|
|
125
|
-
* about the specification rather than a number somebody liked. Tailwind's own
|
|
126
|
-
* `max-w-*` scale is a different set — `max-w-lg` is 32rem — and two ladders
|
|
127
|
-
* called `lg` on one page is how a layout drifts by a few pixels for no reason
|
|
128
|
-
* anybody can find later.
|
|
129
|
-
*
|
|
130
|
-
* It is here rather than in `MPContainer`, which was its first reader, for the
|
|
131
|
-
* reason at the top of this file: a header, a footer and a container that hold
|
|
132
|
-
* their content to "a medium window" have to agree on where that edge is, or the
|
|
133
|
-
* bar and the article under it line up at every width but one.
|
|
134
|
-
*/
|
|
135
|
-
export declare const MEASURE: Record<MPSize, string>;
|
|
136
119
|
/**
|
|
137
120
|
* Whether a slot was given something worth drawing a wrapper around.
|
|
138
121
|
*
|
package/dist/internal/scale.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const CONTROL_HEIGHT={xs:"h-8",sm:"h-10",md:"h-14",lg:"h-16",xl:"h-18"};export const CONTROL_SQUARE={xs:"size-8",sm:"size-10",md:"size-14",lg:"size-16",xl:"size-18"};export const CONTROL_TEXT={xs:"text-mp-label-large",sm:"text-mp-label-large",md:"text-mp-title-medium",lg:"text-mp-title-medium",xl:"text-mp-title-medium"};export const CONTROL_PAD_X={xs:"px-3",sm:"px-4",md:"px-6",lg:"px-8",xl:"px-10"};export const CONTROL_GAP={xs:"gap-1.5",sm:"gap-2",md:"gap-2",lg:"gap-2.5",xl:"gap-3"};export const CONTROL_ICON={xs:16,sm:18,md:20,lg:22,xl:24};export const PROSE_TEXT={xs:"text-mp-body-medium",sm:"text-mp-body-medium",md:"text-mp-body-large",lg:"text-mp-body-large",xl:"text-mp-body-large"};export const META_TEXT="text-mp-body-small";export const SHEET_PAD={xs:"p-2.5",sm:"p-3",md:"p-4",lg:"p-5",xl:"p-6"};export const SHEET_PAD_X={xs:"px-2.5",sm:"px-3",md:"px-4",lg:"px-5",xl:"px-6"};export const SHEET_PAD_Y={xs:"py-2.5",sm:"py-3",md:"py-4",lg:"py-5",xl:"py-6"};export const SHEET_TITLE={xs:"text-mp-title-small",sm:"text-mp-title-small",md:"text-mp-title-medium",lg:"text-mp-title-large",xl:"text-mp-headline-small"};export const SHEET_GAP={xs:"gap-1.5",sm:"gap-2",md:"gap-3",lg:"gap-3.5",xl:"gap-4"};export const STACK_GAP={xs:"gap-0.5",sm:"gap-0.5",md:"gap-1",lg:"gap-1",xl:"gap-1.5"};export
|
|
1
|
+
export const CONTROL_HEIGHT={xs:"h-8",sm:"h-10",md:"h-14",lg:"h-16",xl:"h-18"};export const CONTROL_SQUARE={xs:"size-8",sm:"size-10",md:"size-14",lg:"size-16",xl:"size-18"};export const CONTROL_TEXT={xs:"text-mp-label-large",sm:"text-mp-label-large",md:"text-mp-title-medium",lg:"text-mp-title-medium",xl:"text-mp-title-medium"};export const CONTROL_PAD_X={xs:"px-3",sm:"px-4",md:"px-6",lg:"px-8",xl:"px-10"};export const CONTROL_GAP={xs:"gap-1.5",sm:"gap-2",md:"gap-2",lg:"gap-2.5",xl:"gap-3"};export const CONTROL_ICON={xs:16,sm:18,md:20,lg:22,xl:24};export const PROSE_TEXT={xs:"text-mp-body-medium",sm:"text-mp-body-medium",md:"text-mp-body-large",lg:"text-mp-body-large",xl:"text-mp-body-large"};export const META_TEXT="text-mp-body-small";export const SHEET_PAD={xs:"p-2.5",sm:"p-3",md:"p-4",lg:"p-5",xl:"p-6"};export const SHEET_PAD_X={xs:"px-2.5",sm:"px-3",md:"px-4",lg:"px-5",xl:"px-6"};export const SHEET_PAD_Y={xs:"py-2.5",sm:"py-3",md:"py-4",lg:"py-5",xl:"py-6"};export const SHEET_TITLE={xs:"text-mp-title-small",sm:"text-mp-title-small",md:"text-mp-title-medium",lg:"text-mp-title-large",xl:"text-mp-headline-small"};export const SHEET_GAP={xs:"gap-1.5",sm:"gap-2",md:"gap-3",lg:"gap-3.5",xl:"gap-4"};export const STACK_GAP={xs:"gap-0.5",sm:"gap-0.5",md:"gap-1",lg:"gap-1",xl:"gap-1.5"};export function hasContent(t){return null!=t&&!1!==t&&""!==t}
|
package/dist/internal/step.d.ts
CHANGED
|
@@ -51,6 +51,21 @@ export declare const BULLET_GAP: Record<MPSize, string>;
|
|
|
51
51
|
export declare const ITEM_GAP: Record<MPSize, string>;
|
|
52
52
|
/** The same ladder across, for the horizontal form. */
|
|
53
53
|
export declare const ITEM_GAP_X: Record<MPSize, string>;
|
|
54
|
+
/**
|
|
55
|
+
* What everything that changes with a step's status eases on.
|
|
56
|
+
*
|
|
57
|
+
* The bullet always had this. The line leaving it and the title beside it did
|
|
58
|
+
* not, so advancing a stepper drew one event twice: a bullet filling with the
|
|
59
|
+
* accent over 200ms, and a connector and a heading arriving at their new colours
|
|
60
|
+
* in the frame the state changed. A sequence is read across, and the half of it
|
|
61
|
+
* that snapped was the half that carries the eye to the next step.
|
|
62
|
+
*
|
|
63
|
+
* `border-color` and `color` rather than a blanket `transition-colors`, which
|
|
64
|
+
* would also put the `background-color` and the `box-shadow` of the three-line
|
|
65
|
+
* `BULLET` table on every connector — a line has neither, and a transition
|
|
66
|
+
* listing a property nothing declares is a declaration the browser keeps.
|
|
67
|
+
*/
|
|
68
|
+
export declare const STEP_MOTION: string;
|
|
54
69
|
export declare const BORDER_STYLE: Record<MPStepConnector, string>;
|
|
55
70
|
/**
|
|
56
71
|
* The bullet at each of the three states.
|
package/dist/internal/step.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const BULLET_SIZE={xs:"0.875rem",sm:"1rem",md:"1.25rem",lg:"1.5rem",xl:"1.875rem"};export const BULLET_GAP={xs:"gap-2",sm:"gap-2.5",md:"gap-3",lg:"gap-3.5",xl:"gap-4"};export const ITEM_GAP={xs:"pb-5",sm:"pb-6",md:"pb-7",lg:"pb-8",xl:"pb-10"};export const ITEM_GAP_X={xs:"pe-5",sm:"pe-6",md:"pe-7",lg:"pe-8",xl:"pe-10"};export const BORDER_STYLE={solid:"border-solid",dashed:"border-dashed",dotted:"border-dotted",none:""};export const BULLET={complete:"bg-(--_mp-accent) text-(--_mp-on-accent)",current:"bg-(--_mp-accent) text-(--_mp-on-accent) shadow-[0_0_0_0.25rem_var(--_mp-accent-container)]",upcoming:"border-mp-outline text-mp-on-surface-variant border-2 bg-transparent"};export const CONNECTOR_COLOR={complete:"border-(--_mp-accent)",current:"border-mp-outline-variant",upcoming:"border-mp-outline-variant"};export const TITLE_COLOR={complete:"text-mp-on-surface",current:"text-(--_mp-accent)",upcoming:"text-mp-on-surface-variant"};
|
|
1
|
+
export const BULLET_SIZE={xs:"0.875rem",sm:"1rem",md:"1.25rem",lg:"1.5rem",xl:"1.875rem"};export const BULLET_GAP={xs:"gap-2",sm:"gap-2.5",md:"gap-3",lg:"gap-3.5",xl:"gap-4"};export const ITEM_GAP={xs:"pb-5",sm:"pb-6",md:"pb-7",lg:"pb-8",xl:"pb-10"};export const ITEM_GAP_X={xs:"pe-5",sm:"pe-6",md:"pe-7",lg:"pe-8",xl:"pe-10"};export const STEP_MOTION=/*@__PURE__*/["transition-[border-color,color]","duration-(--mp-sys-motion-duration-short4)","ease-mp-standard"].join(" ");export const BORDER_STYLE={solid:"border-solid",dashed:"border-dashed",dotted:"border-dotted",none:""};export const BULLET={complete:"bg-(--_mp-accent) text-(--_mp-on-accent)",current:"bg-(--_mp-accent) text-(--_mp-on-accent) shadow-[0_0_0_0.25rem_var(--_mp-accent-container)]",upcoming:"border-mp-outline text-mp-on-surface-variant border-2 bg-transparent"};export const CONNECTOR_COLOR={complete:"border-(--_mp-accent)",current:"border-mp-outline-variant",upcoming:"border-mp-outline-variant"};export const TITLE_COLOR={complete:"text-mp-on-surface",current:"text-(--_mp-accent)",upcoming:"text-mp-on-surface-variant"};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { MPDensity, MPSize } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* The cell padding at a density step: two pixels off each face, which is MD3's
|
|
5
|
+
* four off the row.
|
|
6
|
+
*
|
|
7
|
+
* The two axes bottom out in different places because they are answering
|
|
8
|
+
* different questions. Sideways it is the room between one column and the next,
|
|
9
|
+
* and 6px is where two numbers start touching. Vertically it is the row height,
|
|
10
|
+
* and 4px is what keeps the shortest row — `body-small`'s 16px line box at `xs`
|
|
11
|
+
* — on the 24px floor `MPDensity` names.
|
|
12
|
+
*/
|
|
13
|
+
export declare function cellPadX(size: MPSize, density: MPDensity): string;
|
|
14
|
+
export declare function cellPadY(size: MPSize, density: MPDensity): string;
|
|
15
|
+
/**
|
|
16
|
+
* What a cell is set in. MD3's data table puts its cells in `body-medium` and
|
|
17
|
+
* its column headings in `title-small` — 14px at weight 500, which is the same
|
|
18
|
+
* size one weight up, so a heading reads as a heading without changing the
|
|
19
|
+
* column's measure.
|
|
20
|
+
*/
|
|
21
|
+
export declare const CELL_TEXT: Record<MPSize, string>;
|
|
22
|
+
export declare const HEAD_TEXT: Record<MPSize, string>;
|
|
23
|
+
/**
|
|
24
|
+
* A row's own background, read from a slot rather than written inline.
|
|
25
|
+
*
|
|
26
|
+
* Everything else about a cell is inline because a host stylesheet outranks a
|
|
27
|
+
* utility — but a row has a *hover* state, and an inline style has no `:hover`.
|
|
28
|
+
* A custom property is the way out: the host cannot see it, so a one-class
|
|
29
|
+
* variant sets it without a fight, and the inline `background-color` on the row
|
|
30
|
+
* just reads whatever it currently holds.
|
|
31
|
+
*/
|
|
32
|
+
export declare const ROW: string;
|
|
33
|
+
/**
|
|
34
|
+
* A cell's raw value, if React can draw it, and nothing if it cannot.
|
|
35
|
+
*
|
|
36
|
+
* Without `render`, a cell is `row[column.key]` — and `Row` is the caller's own
|
|
37
|
+
* type, so that value is genuinely anything. A `Date`, a nested object, a `Map`:
|
|
38
|
+
* handed to React each of them throws *Objects are not valid as a React child*,
|
|
39
|
+
* from inside a `.map()` in a `<tbody>`, which takes down the table and every
|
|
40
|
+
* boundary above it. One unexpected column in an API response was a blank page.
|
|
41
|
+
*
|
|
42
|
+
* A blank cell is the honest answer to "this is not text". The column already
|
|
43
|
+
* has `render` for the case where it is something else, and the prop docs
|
|
44
|
+
* already say so — what was missing is that failing to reach for it cost the
|
|
45
|
+
* whole page rather than one cell.
|
|
46
|
+
*
|
|
47
|
+
* The list is what React itself will draw: strings, numbers, bigints, and the
|
|
48
|
+
* three nothings. `null`, `undefined` and `boolean` are already nothing to
|
|
49
|
+
* React, and are passed through rather than filtered so that the `false` a
|
|
50
|
+
* `condition && value` leaves behind stays as harmless here as it is anywhere
|
|
51
|
+
* else in this library.
|
|
52
|
+
*/
|
|
53
|
+
export declare function drawableCell(value: unknown): React.ReactNode;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as t from"react";const e={xs:10,sm:12,md:16,lg:20,xl:24},m={xs:6,sm:10,md:16,lg:20,xl:24};function l(t){return t/16+"rem"}export function cellPadX(t,m){return l(Math.max(6,e[t]+2*m))}export function cellPadY(t,e){return l(Math.max(4,m[t]+2*e))}export const CELL_TEXT={xs:"text-mp-body-small",sm:"text-mp-body-small",md:"text-mp-body-medium",lg:"text-mp-body-medium",xl:"text-mp-body-large"};export const HEAD_TEXT={xs:"text-mp-label-medium",sm:"text-mp-label-medium",md:"text-mp-title-small",lg:"text-mp-title-small",xl:"text-mp-title-medium"};export const ROW=/*@__PURE__*/["[--_mp-row:transparent]","transition-[background-color] duration-(--mp-sys-motion-duration-short4)"].join(" ");export function drawableCell(e){if(null==e)return null;const m=typeof e;return"string"===m||"number"===m||"bigint"===m||"boolean"===m||t.isValidElement(e)?e:null}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where a character ends, and where a word does.
|
|
3
|
+
*
|
|
4
|
+
* One module, because the alternative is three. `MPAnimateTyping` counts
|
|
5
|
+
* characters, `MPAnimateScramble` replaces them and `MPAnimateSplit` hands each
|
|
6
|
+
* one its own delay, and every one of those has to agree about what a character
|
|
7
|
+
* *is*. Three copies would be three opinions, and they would only disagree on
|
|
8
|
+
* the text nobody tests with.
|
|
9
|
+
*
|
|
10
|
+
* ## Why not `[...text]`, and why not `split('')`
|
|
11
|
+
*
|
|
12
|
+
* A code point is not a character. `👩👩👧` is seven of them joined by zero-width
|
|
13
|
+
* joiners; `한` typed on a Korean keyboard can be three; a flag is two; an
|
|
14
|
+
* accented letter may be one or two depending on how the file was normalised.
|
|
15
|
+
* A typewriter that advances by code points spends four frames assembling an
|
|
16
|
+
* emoji out of parts that mean nothing on their own, and a splitter that does it
|
|
17
|
+
* hands a screen reader — or a `key` — a fragment that is not a character.
|
|
18
|
+
*
|
|
19
|
+
* `split('')` is worse again: it splits by UTF-16 code *unit*, so it halves
|
|
20
|
+
* every astral character into two lone surrogates, which render as `�`.
|
|
21
|
+
*
|
|
22
|
+
* ## Why not `split(' ')` for words
|
|
23
|
+
*
|
|
24
|
+
* Because a word boundary is not a space anywhere east of Myanmar. Japanese,
|
|
25
|
+
* Chinese, Thai, Khmer and Lao write without them, so splitting on whitespace
|
|
26
|
+
* hands back the entire sentence as a single fragment — an effect that silently
|
|
27
|
+
* does nothing, in the languages where nobody testing it would notice.
|
|
28
|
+
*
|
|
29
|
+
* `Intl.Segmenter` knows both boundaries and is in every current engine. The
|
|
30
|
+
* fallbacks below are for a runtime that does not have it, and they are the
|
|
31
|
+
* naive answers rather than an attempt at a second implementation: something
|
|
32
|
+
* imperfect that runs beats an effect that throws.
|
|
33
|
+
*/
|
|
34
|
+
import * as React from 'react';
|
|
35
|
+
/**
|
|
36
|
+
* The text a node carries, and nothing about its markup.
|
|
37
|
+
*
|
|
38
|
+
* Elements contribute nothing on purpose. There is no honest way to type out
|
|
39
|
+
* half of a link, or to scramble the third character of a `<strong>` and leave
|
|
40
|
+
* the emphasis intact — the effects that read this animate *text*, so what they
|
|
41
|
+
* take is text.
|
|
42
|
+
*/
|
|
43
|
+
export declare function textOf(node: React.ReactNode): string;
|
|
44
|
+
/** The text split the way a reader would split it: by grapheme cluster. */
|
|
45
|
+
export declare function graphemesOf(text: string, locale?: string): string[];
|
|
46
|
+
/**
|
|
47
|
+
* The text split into words, with the space after each one kept on it.
|
|
48
|
+
*
|
|
49
|
+
* Kept rather than dropped, because a set of fragments that has thrown its
|
|
50
|
+
* whitespace away cannot be laid out again: joining with `' '` puts a space
|
|
51
|
+
* where a line break was and another one before a full stop. Each fragment
|
|
52
|
+
* carries what followed it, so the pieces still concatenate to the original.
|
|
53
|
+
*
|
|
54
|
+
* `isWordLike` is what separates a word from the punctuation and spacing
|
|
55
|
+
* between two of them, and the run of non-words after a word is folded onto it.
|
|
56
|
+
*/
|
|
57
|
+
export declare function wordsOf(text: string, locale?: string): string[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e="undefined"!=typeof Intl&&"Segmenter"in Intl;export function textOf(e){return"string"==typeof e||"number"==typeof e?String(e):Array.isArray(e)?e.map(textOf).join(""):""}export function graphemesOf(t,n){if(!e)return[...t];return[...new Intl.Segmenter(n,{granularity:"grapheme"}).segment(t)].map(e=>e.segment)}export function wordsOf(t,n){if(!e)return t.match(/\S+\s*|\s+/g)??[];const r=new Intl.Segmenter(n,{granularity:"word"}),o=[];for(const e of r.segment(t))e.isWordLike||0===o.length?o.push(e.segment):o[o.length-1]+=e.segment;return o}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { MPColor, MPThreshold } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Where a reading changes colour, resolved once.
|
|
4
|
+
*
|
|
5
|
+
* A meter and a gauge are the same quantity in two shapes, and a page carrying
|
|
6
|
+
* both must not disagree about where the amber starts. That is the whole reason
|
|
7
|
+
* this is not a private function inside whichever component needed it first —
|
|
8
|
+
* two copies of a scan this short would agree until the day one of them was
|
|
9
|
+
* edited alone.
|
|
10
|
+
*
|
|
11
|
+
* It is a file of its own rather than a section of `internal/chart.ts` because
|
|
12
|
+
* `MPMeter` is not a chart: reaching into that module for six lines would hand
|
|
13
|
+
* a bar the scales, the path builders and the palette.
|
|
14
|
+
*
|
|
15
|
+
* Written as a scan rather than a sort, so the array is read in the order it
|
|
16
|
+
* was given. Thresholds are meant to be listed in ascending order, and quietly
|
|
17
|
+
* reordering them would hide the one call site that did not.
|
|
18
|
+
*/
|
|
19
|
+
export declare function thresholdColor(value: number, color: MPColor, thresholds: readonly MPThreshold[] | undefined): MPColor;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function thresholdColor(o,r,t){if(!t||0===t.length)return r;let e=r;for(const r of t)o>=r.from&&(e=r.color);return e}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { ValueScale } from './chart.js';
|
|
2
|
+
/**
|
|
3
|
+
* A scale for an axis of instants.
|
|
4
|
+
*
|
|
5
|
+
* `valueScale`'s 1-2-5-10 family is the right one for a count and exactly the
|
|
6
|
+
* wrong one for a moment: run on epoch milliseconds it produces a tick every
|
|
7
|
+
* 200,000,000 ms, which lands at 14:53:20 on an arbitrary Tuesday. Nobody reads
|
|
8
|
+
* that. Time is not decimal below the year — sixty, sixty, twenty-four, seven,
|
|
9
|
+
* twelve — so its steps are written down rather than derived.
|
|
10
|
+
*
|
|
11
|
+
* A file of its own because only the timeline needs it. The other seven charts
|
|
12
|
+
* would carry a calendar for nothing.
|
|
13
|
+
*/
|
|
14
|
+
/** The units a time axis is allowed to step in. */
|
|
15
|
+
export type TimeUnit = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year';
|
|
16
|
+
/** A value scale whose ticks are instants, plus the unit they step in. */
|
|
17
|
+
export interface TimeScale extends ValueScale {
|
|
18
|
+
unit: TimeUnit;
|
|
19
|
+
count: number;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The scale an axis of instants runs on.
|
|
23
|
+
*
|
|
24
|
+
* The ends round outward to the step, exactly as `valueScale`'s do, so an axis
|
|
25
|
+
* of work starting on a Wednesday afternoon begins at midnight on the Wednesday
|
|
26
|
+
* rather than at the first task's start.
|
|
27
|
+
*/
|
|
28
|
+
export declare function timeScale(extent: {
|
|
29
|
+
min: number;
|
|
30
|
+
max: number;
|
|
31
|
+
} | null, options?: {
|
|
32
|
+
min?: number;
|
|
33
|
+
max?: number;
|
|
34
|
+
tickCount?: number;
|
|
35
|
+
}): TimeScale;
|
|
36
|
+
/**
|
|
37
|
+
* A tick written at the resolution its step implies.
|
|
38
|
+
*
|
|
39
|
+
* An axis stepping in hours writes clock times and one stepping in months
|
|
40
|
+
* writes month names. Writing the whole instant at every step would be an axis
|
|
41
|
+
* of identical strings differing in one field, which is the least readable form
|
|
42
|
+
* of a date there is.
|
|
43
|
+
*/
|
|
44
|
+
export declare function formatTimeTick(value: number, unit: TimeUnit, locale: string | undefined): string;
|