material-plus-ui 1.5.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 +2 -1
- 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 +2 -1
- package/dist/components/avatar/MPAvatar.d.ts +10 -1
- package/dist/components/avatar/MPAvatar.js +1 -1
- package/dist/components/badge/MPBadge.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 +19 -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.d.ts +49 -3
- package/dist/components/button/MPButton.js +1 -1
- package/dist/components/calendar/MPCalendar.d.ts +160 -0
- package/dist/components/calendar/MPCalendar.js +2 -0
- package/dist/components/calendar/index.d.ts +2 -0
- package/dist/components/calendar/index.js +1 -0
- package/dist/components/card/MPCard.js +1 -1
- package/dist/components/carousel/MPCarousel.js +1 -1
- package/dist/components/chat-bubble/MPChatBubble.js +1 -1
- package/dist/components/checkbox/MPCheckbox.js +1 -1
- package/dist/components/chip/MPChip.d.ts +31 -7
- 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 +71 -5
- 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 +166 -0
- package/dist/components/config/MPConfigProvider.js +2 -0
- package/dist/components/config/index.d.ts +2 -0
- package/dist/components/config/index.js +1 -0
- package/dist/components/confirm/MPConfirmProvider.d.ts +143 -0
- package/dist/components/confirm/MPConfirmProvider.js +2 -0
- package/dist/components/confirm/index.d.ts +2 -0
- package/dist/components/confirm/index.js +1 -0
- 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/date-picker/MPDatePicker.d.ts +53 -2
- package/dist/components/date-picker/MPDatePicker.js +1 -1
- package/dist/components/date-picker/index.d.ts +1 -1
- package/dist/components/date-range-picker/MPDateRangePicker.js +1 -1
- package/dist/components/date-time-picker/MPDateTimePicker.js +1 -1
- package/dist/components/dialog/MPDialog.d.ts +24 -3
- package/dist/components/dialog/MPDialog.js +1 -1
- package/dist/components/divider/MPDivider.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 +23 -1
- 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 +121 -0
- package/dist/components/image/MPImage.js +2 -0
- package/dist/components/image/index.d.ts +2 -0
- package/dist/components/image/index.js +1 -0
- 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 +51 -1
- package/dist/components/list/MPList.js +1 -1
- package/dist/components/menu/MPMenu.d.ts +21 -2
- 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.d.ts +3 -3
- package/dist/components/number-field/MPNumberField.js +1 -1
- package/dist/components/otp-field/MPOtpField.js +1 -1
- package/dist/components/overlay/MPOverlay.d.ts +1 -1
- package/dist/components/overlay/MPOverlay.js +1 -1
- package/dist/components/pagination/MPPagination.js +1 -1
- package/dist/components/panes/MPPanes.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 +92 -0
- package/dist/components/popconfirm/MPPopconfirm.js +2 -0
- package/dist/components/popconfirm/index.d.ts +2 -0
- package/dist/components/popconfirm/index.js +1 -0
- package/dist/components/popover/MPPopover.d.ts +1 -1
- 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/progress-box/MPProgressBox.js +1 -1
- package/dist/components/progress-circular/MPProgressCircular.js +1 -1
- package/dist/components/progress-linear/MPProgressLinear.js +1 -1
- 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 +28 -5
- package/dist/components/select/MPSelect.js +1 -1
- package/dist/components/shortcut/MPShortcut.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/skeleton/MPSkeleton.js +1 -1
- package/dist/components/slider/MPSlider.d.ts +27 -0
- package/dist/components/slider/MPSlider.js +1 -1
- package/dist/components/snackbar/MPSnackbar.d.ts +20 -1
- package/dist/components/snackbar/MPSnackbar.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.d.ts +153 -0
- package/dist/components/stepper/MPStepper.js +2 -0
- package/dist/components/stepper/index.d.ts +2 -0
- package/dist/components/stepper/index.js +1 -0
- package/dist/components/switch/MPSwitch.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/text-field/MPTextField.d.ts +38 -14
- package/dist/components/text-field/MPTextField.js +1 -1
- package/dist/components/time-picker/MPTimePicker.js +1 -1
- package/dist/components/timeline/MPTimeline.d.ts +10 -2
- 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/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 +17 -1
- package/dist/components/typography/MPTypography.js +1 -1
- package/dist/components/visually-hidden/MPVisuallyHidden.d.ts +60 -0
- package/dist/components/visually-hidden/MPVisuallyHidden.js +2 -0
- package/dist/components/visually-hidden/index.d.ts +2 -0
- package/dist/components/visually-hidden/index.js +1 -0
- package/dist/constants/glyphs.d.ts +4 -0
- package/dist/constants/glyphs.js +1 -1
- package/dist/constants/icons.d.ts +2 -0
- package/dist/constants/icons.js +1 -1
- package/dist/hooks/index.d.ts +40 -0
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/useMPColorScheme.d.ts +135 -0
- package/dist/hooks/useMPColorScheme.js +2 -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.d.ts +32 -0
- package/dist/hooks/useMPReducedMotion.js +2 -0
- package/dist/hooks/useMPShortcut.d.ts +105 -0
- package/dist/hooks/useMPShortcut.js +2 -0
- package/dist/hooks/useMPWindowClass.d.ts +55 -0
- package/dist/hooks/useMPWindowClass.js +2 -0
- package/dist/index.d.ts +43 -1
- package/dist/index.js +1 -1
- package/dist/internal/Calendar.d.ts +19 -4
- 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/Picker.d.ts +15 -3
- package/dist/internal/Picker.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/color-scheme.d.ts +28 -0
- package/dist/internal/color-scheme.js +2 -0
- package/dist/internal/config.d.ts +62 -0
- package/dist/internal/config.js +2 -0
- package/dist/internal/data-table.d.ts +162 -0
- package/dist/internal/data-table.js +1 -0
- package/dist/internal/date.d.ts +50 -3
- 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 +196 -1
- 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/confirm.d.ts +3 -0
- package/dist/internal/messages/confirm.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/picker.js +1 -1
- 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/progress.d.ts +14 -0
- 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 +86 -0
- package/dist/internal/step.js +1 -0
- 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 +48 -0
- package/dist/internal/window-class.js +2 -0
- 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 +2 -0
- 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 +2 -0
- package/dist/styles/confirm.css +2 -0
- 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 +2 -0
- 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/panes.css +1 -1
- package/dist/styles/pie-chart.css +2 -0
- package/dist/styles/pill.css +1 -1
- package/dist/styles/popconfirm.css +2 -0
- 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/shortcut.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 +2 -0
- 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/visually-hidden.css +2 -0
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1423 -114
- package/dist/types.d.ts +628 -3
- package/package.json +8 -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,162 @@
|
|
|
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.
|
|
124
|
+
*
|
|
125
|
+
* The escaping is the whole job here and getting it wrong is silent: a comma
|
|
126
|
+
* inside a cell shifts every column after it by one, and nobody notices until a
|
|
127
|
+
* spreadsheet somewhere is off by a column. RFC 4180 is four rules and all four
|
|
128
|
+
* are in these six lines — a field is quoted if it holds the separator, a quote
|
|
129
|
+
* or a line break, and a quote inside a quoted field is written twice.
|
|
130
|
+
*
|
|
131
|
+
* `null` and `undefined` are empty rather than the words "null" and "undefined",
|
|
132
|
+
* which is what `String()` would put in the cell.
|
|
133
|
+
*/
|
|
134
|
+
export declare function csvField(value: unknown, separator: string): string;
|
|
135
|
+
export interface MPCsvOptions {
|
|
136
|
+
/** What goes between fields. `;` for the locales whose spreadsheets expect it. */
|
|
137
|
+
separator?: string;
|
|
138
|
+
/**
|
|
139
|
+
* Writes a byte-order mark in front.
|
|
140
|
+
*
|
|
141
|
+
* On by default, and not as a nicety: Excel reads a UTF-8 CSV without one as
|
|
142
|
+
* the local code page, so every non-ASCII name in the file arrives as
|
|
143
|
+
* mojibake. Every other reader ignores the mark.
|
|
144
|
+
*/
|
|
145
|
+
bom?: boolean;
|
|
146
|
+
}
|
|
147
|
+
/** Rows of already-stringable values, as one CSV document. */
|
|
148
|
+
export declare function toCsv(rows: readonly (readonly unknown[])[], options?: MPCsvOptions): string;
|
|
149
|
+
/**
|
|
150
|
+
* Hands the file to the browser.
|
|
151
|
+
*
|
|
152
|
+
* A `blob:` URL and a synthesised press, which is the only way a page can
|
|
153
|
+
* produce a file the reader keeps. The URL is released on the next frame rather
|
|
154
|
+
* than straight away: some browsers have not finished reading it when the press
|
|
155
|
+
* returns, and releasing it too early is a download that silently produces
|
|
156
|
+
* nothing.
|
|
157
|
+
*/
|
|
158
|
+
export declare function downloadText(text: string, fileName: string, type: string): void;
|
|
159
|
+
/** How wide a column is when neither the caller nor a drag has said. */
|
|
160
|
+
export declare const DEFAULT_COLUMN_WIDTH = 160;
|
|
161
|
+
/** How narrow a drag may make one. Below this the heading is a single letter. */
|
|
162
|
+
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")}export function csvField(e,t){if(null==e)return"";const n=e instanceof Date?e.toISOString():"object"==typeof e?JSON.stringify(e):String(e);return/["\r\n]/.test(n)||n.includes(t)?`"${n.replaceAll('"','""')}"`:n}export function toCsv(e,t={}){const{separator:n=",",bom:o=!0}=t,r=e.map(e=>e.map(e=>csvField(e,n)).join(n)).join("\r\n");return o?`\ufeff${r}`:r}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
|
@@ -25,6 +25,16 @@
|
|
|
25
25
|
import type { MPWeekday } from '../types.js';
|
|
26
26
|
/** Which unit the calendar is currently letting you pick. */
|
|
27
27
|
export type MPCalendarView = 'day' | 'month' | 'year';
|
|
28
|
+
/**
|
|
29
|
+
* Which unit a picker asks for at all — the view the calendar stops at.
|
|
30
|
+
*
|
|
31
|
+
* The same three words as `MPCalendarView` and deliberately a second name: one
|
|
32
|
+
* is what is on screen at this moment, the other is what the control is *for*.
|
|
33
|
+
* A day picker passes through all three views and answers with a day; a month
|
|
34
|
+
* picker never draws a day grid, and the year view above it is a way of
|
|
35
|
+
* reaching a month rather than an answer of its own.
|
|
36
|
+
*/
|
|
37
|
+
export type MPDatePrecision = MPCalendarView;
|
|
28
38
|
/** How many years one page of the year grid holds. Four columns of three. */
|
|
29
39
|
export declare const YEAR_PAGE_SIZE = 12;
|
|
30
40
|
/**
|
|
@@ -44,8 +54,22 @@ export declare function isValidDate(value: unknown): value is Date;
|
|
|
44
54
|
export declare function startOfDay(date: Date): Date;
|
|
45
55
|
/** The first day of the month this date is in, at midnight. */
|
|
46
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;
|
|
47
59
|
/** How many days a month has, leap years included. */
|
|
48
60
|
export declare function daysInMonth(year: number, month: number): number;
|
|
61
|
+
/**
|
|
62
|
+
* The first instant of the day, month or year a date falls in.
|
|
63
|
+
*
|
|
64
|
+
* Which of the three is the picker's question rather than the calendar's. A
|
|
65
|
+
* control asked for a month holds a `Date` standing for a whole month, and the
|
|
66
|
+
* only honest one is that month's first day: a picker whose trigger says
|
|
67
|
+
* *July 2026* and whose form submits the 31st is printing one thing and sending
|
|
68
|
+
* another.
|
|
69
|
+
*/
|
|
70
|
+
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;
|
|
49
73
|
/** Today, at midnight. The one place the pickers read the clock for a *date*. */
|
|
50
74
|
export declare function today(): Date;
|
|
51
75
|
export declare function addDays(date: Date, amount: number): Date;
|
|
@@ -71,6 +95,21 @@ export declare function isSameMonth(a: Date | null | undefined, b: Date | null |
|
|
|
71
95
|
* has been chosen.
|
|
72
96
|
*/
|
|
73
97
|
export declare function isDayOutside(date: Date, min?: Date | null, max?: Date | null): boolean;
|
|
98
|
+
/**
|
|
99
|
+
* The same question asked of a whole month or a whole year.
|
|
100
|
+
*
|
|
101
|
+
* A unit is outside the span only when *every* day in it is, which is what
|
|
102
|
+
* leaves July reachable under a `minDate` of 10 July: the bound is about which
|
|
103
|
+
* months exist, and where inside one it falls is a day grid's problem. It is
|
|
104
|
+
* the widening `isDayOutside` already applies to the time of day, one rung up —
|
|
105
|
+
* and it is the rule both the month grid and the year grid were already
|
|
106
|
+
* spelling out for themselves.
|
|
107
|
+
*
|
|
108
|
+
* The day case is handed to `isDayOutside` rather than written as this rule
|
|
109
|
+
* with a one-day span, because that is the one that runs forty-two times per
|
|
110
|
+
* calendar per render and it can answer without building either end.
|
|
111
|
+
*/
|
|
112
|
+
export declare function isUnitOutside(date: Date, unit: MPCalendarView, min?: Date | null, max?: Date | null): boolean;
|
|
74
113
|
/** Seconds since local midnight — what `minTime`/`maxTime` are compared on. */
|
|
75
114
|
export declare function secondsOfDay(date: Date): number;
|
|
76
115
|
/** Which column of a clock a candidate time is being offered for. */
|
|
@@ -127,16 +166,24 @@ export declare function displaySamples(locale: string | undefined, options: Intl
|
|
|
127
166
|
*/
|
|
128
167
|
export declare function withPlaceholder(samples: string[], placeholder: unknown): string[];
|
|
129
168
|
/**
|
|
130
|
-
* The
|
|
169
|
+
* The machine-readable spellings, for the hidden input that makes a picker
|
|
131
170
|
* submit with a form.
|
|
132
171
|
*
|
|
133
172
|
* Local, not UTC, and that is the whole point: `toISOString()` on a `Date`
|
|
134
173
|
* standing for 27 July in Seoul gives `2026-07-26T15:00:00Z`, and a form field
|
|
135
174
|
* that quietly reports the day before the one on screen is the single most
|
|
136
175
|
* expensive bug a date picker can ship. The shapes are the ones the native
|
|
137
|
-
* `<input type="date">`, `type="
|
|
138
|
-
* server that already parses those needs no
|
|
176
|
+
* `<input type="date">`, `type="month"`, `type="time"` and
|
|
177
|
+
* `type="datetime-local"` submit, so a server that already parses those needs no
|
|
178
|
+
* new code.
|
|
179
|
+
*
|
|
180
|
+
* A year on its own is the one with no input type behind it, and `YYYY` is what
|
|
181
|
+
* is left of the others once the parts a year picker was never asked about are
|
|
182
|
+
* taken off. Each spelling is built from the one above it, so there is one
|
|
183
|
+
* answer to how a year is written and not three.
|
|
139
184
|
*/
|
|
185
|
+
export declare function toISOYear(date: Date): string;
|
|
186
|
+
export declare function toISOMonth(date: Date): string;
|
|
140
187
|
export declare function toISODate(date: Date): string;
|
|
141
188
|
export declare function toISOTime(date: Date, withSeconds?: boolean): string;
|
|
142
189
|
export declare function toISODateTime(date: Date, withSeconds?: boolean): string;
|
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 daysInMonth(t,e){return makeDate(t,e+1,0).getDate()}export function today(){return startOfDay(new Date)}export function addDays(t,e){const r=new Date(t.getTime());return r.setDate(r.getDate()+e),r}export function addMonths(t,e){const r=new Date(t.getTime()),n=makeDate(t.getFullYear(),t.getMonth()+e,1);return r.setFullYear(n.getFullYear(),n.getMonth(),Math.min(t.getDate(),daysInMonth(n.getFullYear(),n.getMonth()))),r}export function addYears(t,e){return addMonths(t,12*e)}export function compareDay(t,e){return startOfDay(t).getTime()-startOfDay(e).getTime()}export function isSameDay(t,e){return isValidDate(t)&&isValidDate(e)&&0===compareDay(t,e)}export function isSameMonth(t,e){return isValidDate(t)&&isValidDate(e)&&t.getFullYear()===e.getFullYear()&&t.getMonth()===e.getMonth()}export function isDayOutside(t,e,r){return!!(isValidDate(e)&&compareDay(t,e)<0)||isValidDate(r)&&compareDay(t,r)>0}export function secondsOfDay(t){return 3600*t.getHours()+60*t.getMinutes()+t.getSeconds()}export function timeUnitSpan(t,e){const r=secondsOfDay(e);if("hour"===t){const t=3600*Math.floor(r/3600);return[t,t+3599]}if("minute"===t){const t=60*Math.floor(r/60);return[t,t+59]}if("second"===t)return[r,r];const n=e.getHours()<12?0:43200;return[n,n+43200-1]}export function withTime(t,e){const r=new Date(t.getTime());return r.setHours(e.hours??r.getHours(),e.minutes??r.getMinutes(),e.seconds??r.getSeconds(),0),r}export function mergeDateAndTime(t,e){return withTime(startOfDay(t),{hours:e.getHours(),minutes:e.getMinutes(),seconds:e.getSeconds()})}export function calendarWeeks(t,e){const r=startOfMonth(t),n=(r.getDay()-e+7)%7,o=addDays(r,-n);return Array.from({length:6},(t,e)=>Array.from({length:7},(t,r)=>addDays(o,7*e+r)))}export function yearPageStart(t){return t-(t%12+12)%12}function t(t,e,r){if(t.set(e,r),t.size>64){const e=t.keys().next();e.done||t.delete(e.value)}return r}const e=new Map;export function dateFormatter(r,n){const o=`${r??""}\0${JSON.stringify(n)}`,a=e.get(o);return a||t(e,o,new Intl.DateTimeFormat(r,n))}export function formatDate(t,e,r){return isValidDate(t)?dateFormatter(e,r).format(t):""}const r=Array.from({length:24},(t,e)=>new Date(2027,e%12,21+e%7,e,58,58));export function displaySamples(t,e){const n=dateFormatter(t,e);return[...new Set(r.map(t=>n.format(t)))]}export function withPlaceholder(t,e){return"string"==typeof e&&""!==e?[...t,e]:t}export function
|
|
1
|
+
export const YEAR_PAGE_SIZE=12;export function makeDate(t,e,r){const n=new Date(0);return n.setFullYear(t,e,r),n.setHours(0,0,0,0),n}export function isValidDate(t){return t instanceof Date&&!Number.isNaN(t.getTime())}export function startOfDay(t){const e=new Date(t.getTime());return e.setHours(0,0,0,0),e}export function startOfMonth(t){return makeDate(t.getFullYear(),t.getMonth(),1)}export function startOfYear(t){return makeDate(t.getFullYear(),0,1)}export function daysInMonth(t,e){return makeDate(t,e+1,0).getDate()}export function startOfUnit(t,e){return"year"===e?startOfYear(t):"month"===e?startOfMonth(t):startOfDay(t)}export function endOfUnit(t,e){return"year"===e?makeDate(t.getFullYear(),11,31):"month"===e?makeDate(t.getFullYear(),t.getMonth()+1,0):startOfDay(t)}export function today(){return startOfDay(new Date)}export function addDays(t,e){const r=new Date(t.getTime());return r.setDate(r.getDate()+e),r}export function addMonths(t,e){const r=new Date(t.getTime()),n=makeDate(t.getFullYear(),t.getMonth()+e,1);return r.setFullYear(n.getFullYear(),n.getMonth(),Math.min(t.getDate(),daysInMonth(n.getFullYear(),n.getMonth()))),r}export function addYears(t,e){return addMonths(t,12*e)}export function compareDay(t,e){return startOfDay(t).getTime()-startOfDay(e).getTime()}export function isSameDay(t,e){return isValidDate(t)&&isValidDate(e)&&0===compareDay(t,e)}export function isSameMonth(t,e){return isValidDate(t)&&isValidDate(e)&&t.getFullYear()===e.getFullYear()&&t.getMonth()===e.getMonth()}export function isDayOutside(t,e,r){return!!(isValidDate(e)&&compareDay(t,e)<0)||isValidDate(r)&&compareDay(t,r)>0}export function isUnitOutside(t,e,r,n){return"day"===e?isDayOutside(t,r,n):!!(isValidDate(r)&&compareDay(endOfUnit(t,e),r)<0)||isValidDate(n)&&compareDay(startOfUnit(t,e),n)>0}export function secondsOfDay(t){return 3600*t.getHours()+60*t.getMinutes()+t.getSeconds()}export function timeUnitSpan(t,e){const r=secondsOfDay(e);if("hour"===t){const t=3600*Math.floor(r/3600);return[t,t+3599]}if("minute"===t){const t=60*Math.floor(r/60);return[t,t+59]}if("second"===t)return[r,r];const n=e.getHours()<12?0:43200;return[n,n+43200-1]}export function withTime(t,e){const r=new Date(t.getTime());return r.setHours(e.hours??r.getHours(),e.minutes??r.getMinutes(),e.seconds??r.getSeconds(),0),r}export function mergeDateAndTime(t,e){return withTime(startOfDay(t),{hours:e.getHours(),minutes:e.getMinutes(),seconds:e.getSeconds()})}export function calendarWeeks(t,e){const r=startOfMonth(t),n=(r.getDay()-e+7)%7,o=addDays(r,-n);return Array.from({length:6},(t,e)=>Array.from({length:7},(t,r)=>addDays(o,7*e+r)))}export function yearPageStart(t){return t-(t%12+12)%12}function t(t,e,r){if(t.set(e,r),t.size>64){const e=t.keys().next();e.done||t.delete(e.value)}return r}const e=new Map;export function dateFormatter(r,n){const o=`${r??""}\0${JSON.stringify(n)}`,a=e.get(o);return a||t(e,o,new Intl.DateTimeFormat(r,n))}export function formatDate(t,e,r){return isValidDate(t)?dateFormatter(e,r).format(t):""}const r=Array.from({length:24},(t,e)=>new Date(2027,e%12,21+e%7,e,58,58));export function displaySamples(t,e){const n=dateFormatter(t,e);return[...new Set(r.map(t=>n.format(t)))]}export function withPlaceholder(t,e){return"string"==typeof e&&""!==e?[...t,e]:t}export function toISOYear(t){return String(t.getFullYear()).padStart(4,"0")}export function toISOMonth(t){return`${toISOYear(t)}-${String(t.getMonth()+1).padStart(2,"0")}`}export function toISODate(t){return`${toISOMonth(t)}-${String(t.getDate()).padStart(2,"0")}`}export function toISOTime(t,e=!1){const r=t=>String(t).padStart(2,"0"),n=`${r(t.getHours())}:${r(t.getMinutes())}`;return e?`${n}:${r(t.getSeconds())}`:n}export function toISODateTime(t,e=!1){return`${toISODate(t)}T${toISOTime(t,e)}`}const n=makeDate(2021,7,1),o=new Map;export function weekdayLabels(e,r,a="narrow"){const i=`w ${e??""} ${r} ${a}`,u=o.get(i);if(u)return u;const s=dateFormatter(e,{weekday:a});return t(o,i,Array.from({length:7},(t,e)=>s.format(addDays(n,(r+e)%7))))}export function monthLabels(e,r="short"){const n=`m ${e??""} ${r}`,a=o.get(n);if(a)return a;const i=dateFormatter(e,{month:r});return t(o,n,Array.from({length:12},(t,e)=>i.format(makeDate(2021,e,1))))}export function isMonthBeforeYear(t){const e=dateFormatter(t,{year:"numeric",month:"long"}).formatToParts(n);return e.findIndex(t=>"month"===t.type)<e.findIndex(t=>"year"===t.type)}export function isHour12(t){const e=dateFormatter(t,{hour:"numeric"}).resolvedOptions();return e.hourCycle?"h11"===e.hourCycle||"h12"===e.hourCycle:!0===e.hour12}export function meridiemLabels(t){const e=dateFormatter(t,{hour:"numeric",hour12:!0}),r=t=>{const r=e.formatToParts(withTime(n,{hours:t})).find(t=>"dayPeriod"===t.type);return r?.value??(t<12?"AM":"PM")};return[r(9),r(21)]}export function localeWeekStart(t){try{const e=t??(new Intl.DateTimeFormat).resolvedOptions().locale,r=new Intl.Locale(e),n="function"==typeof r.getWeekInfo?r.getWeekInfo():r.weekInfo;if("number"==typeof n?.firstDay)return n.firstDay%7}catch{}return 0}
|
|
@@ -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}]:[])}
|