plass-ui 1.3.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +962 -0
- package/README.md +19 -17
- package/dist/components/accordion/PlAccordion.d.ts +1 -1
- package/dist/components/alert/PlAlert.js +1 -1
- package/dist/components/anchor/PlAnchor.d.ts +85 -0
- package/dist/components/anchor/PlAnchor.js +1 -0
- package/dist/components/anchor/index.d.ts +2 -0
- package/dist/components/anchor/index.js +1 -0
- package/dist/components/animate-appear/PlAnimateAppear.d.ts +10 -0
- package/dist/components/animate-appear/PlAnimateAppear.js +1 -1
- package/dist/components/animate-blink/PlAnimateBlink.d.ts +2 -2
- package/dist/components/animate-blink/PlAnimateBlink.js +1 -1
- package/dist/components/animate-counter/PlAnimateCounter.d.ts +83 -0
- package/dist/components/animate-counter/PlAnimateCounter.js +1 -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/PlAnimateFade.d.ts +2 -2
- package/dist/components/animate-fade/PlAnimateFade.js +1 -1
- package/dist/components/animate-float/PlAnimateFloat.d.ts +51 -0
- package/dist/components/animate-float/PlAnimateFloat.js +1 -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/PlAnimateGrow.d.ts +2 -2
- package/dist/components/animate-grow/PlAnimateGrow.js +1 -1
- package/dist/components/animate-headline/PlAnimateHeadline.js +1 -1
- package/dist/components/animate-lighting/PlAnimateLighting.js +1 -1
- package/dist/components/animate-marquee/PlAnimateMarquee.d.ts +13 -4
- package/dist/components/animate-marquee/PlAnimateMarquee.js +1 -1
- package/dist/components/animate-reveal/PlAnimateReveal.d.ts +51 -0
- package/dist/components/animate-reveal/PlAnimateReveal.js +1 -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/PlAnimateRotate.d.ts +2 -2
- package/dist/components/animate-rotate/PlAnimateRotate.js +1 -1
- package/dist/components/animate-scramble/PlAnimateScramble.d.ts +75 -0
- package/dist/components/animate-scramble/PlAnimateScramble.js +1 -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/PlAnimateShake.d.ts +57 -0
- package/dist/components/animate-shake/PlAnimateShake.js +1 -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/PlAnimateSlide.d.ts +2 -2
- package/dist/components/animate-slide/PlAnimateSlide.js +1 -1
- package/dist/components/animate-split/PlAnimateSplit.d.ts +57 -0
- package/dist/components/animate-split/PlAnimateSplit.js +1 -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/PlAnimateTyping.d.ts +3 -2
- package/dist/components/animate-typing/PlAnimateTyping.js +1 -1
- package/dist/components/animate-zoom/PlAnimateZoom.d.ts +2 -2
- package/dist/components/animate-zoom/PlAnimateZoom.js +1 -1
- package/dist/components/app-logo/PlAppLogo.d.ts +78 -0
- package/dist/components/app-logo/PlAppLogo.js +1 -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/PlAreaChart.d.ts +54 -0
- package/dist/components/area-chart/PlAreaChart.js +1 -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/PlAspectRatio.d.ts +2 -1
- package/dist/components/aspect-ratio/PlAspectRatio.js +1 -1
- package/dist/components/avatar/PlAvatar.js +1 -1
- package/dist/components/back-top/PlBackTop.d.ts +2 -1
- package/dist/components/back-top/PlBackTop.js +1 -1
- package/dist/components/badge/PlBadge.js +1 -1
- package/dist/components/bar-chart/PlBarChart.d.ts +63 -0
- package/dist/components/bar-chart/PlBarChart.js +1 -0
- package/dist/components/bar-chart/index.d.ts +2 -0
- package/dist/components/bar-chart/index.js +1 -0
- package/dist/components/bottom-navigation/PlBottomNavigation.d.ts +3 -0
- package/dist/components/breadcrumb/PlBreadcrumb.js +1 -1
- package/dist/components/button/PlButton.d.ts +8 -0
- package/dist/components/button/PlButton.js +1 -1
- package/dist/components/button-group/PlButtonGroup.js +1 -1
- package/dist/components/calendar/PlCalendar.js +1 -1
- package/dist/components/card/PlCard.js +1 -1
- package/dist/components/carousel/PlCarousel.d.ts +1 -1
- package/dist/components/carousel/PlCarousel.js +1 -1
- package/dist/components/chat-bubble/PlChatBubble.d.ts +4 -1
- package/dist/components/chat-bubble/PlChatBubble.js +1 -1
- package/dist/components/checkbox/PlCheckbox.js +1 -1
- package/dist/components/chip/PlChip.d.ts +6 -2
- package/dist/components/chip/PlChip.js +1 -1
- package/dist/components/code-block/PlCodeBlock.d.ts +192 -0
- package/dist/components/code-block/PlCodeBlock.js +1 -0
- package/dist/components/code-block/index.d.ts +2 -0
- package/dist/components/code-block/index.js +1 -0
- package/dist/components/color-picker/PlColorPicker.js +1 -1
- package/dist/components/combobox/PlCombobox.d.ts +6 -5
- package/dist/components/combobox/PlCombobox.js +1 -1
- package/dist/components/command-palette/PlCommandPalette.d.ts +6 -2
- package/dist/components/command-palette/PlCommandPalette.js +1 -1
- package/dist/components/confirm/PlConfirmProvider.js +1 -1
- package/dist/components/container/PlContainer.d.ts +22 -6
- package/dist/components/container/PlContainer.js +1 -1
- package/dist/components/data-list/PlDataList.d.ts +74 -0
- package/dist/components/data-list/PlDataList.js +1 -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/PlDataTable.d.ts +216 -0
- package/dist/components/data-table/PlDataTable.js +1 -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/PlDatePicker.js +1 -1
- package/dist/components/date-range-picker/PlDateRangePicker.js +1 -1
- package/dist/components/date-time-picker/PlDateTimePicker.js +1 -1
- package/dist/components/drawer/PlDrawer.d.ts +1 -1
- package/dist/components/drawer/PlDrawer.js +1 -1
- package/dist/components/file-picker/PlFilePicker.d.ts +4 -1
- package/dist/components/file-picker/PlFilePicker.js +1 -1
- package/dist/components/flex/PlFlex.d.ts +83 -0
- package/dist/components/flex/PlFlex.js +1 -0
- package/dist/components/flex/index.d.ts +2 -0
- package/dist/components/flex/index.js +1 -0
- package/dist/components/floating-action-button/PlFloatingActionButton.d.ts +81 -0
- package/dist/components/floating-action-button/PlFloatingActionButton.js +1 -0
- package/dist/components/floating-action-button/index.d.ts +2 -0
- package/dist/components/floating-action-button/index.js +1 -0
- package/dist/components/floating-bottom-navigation/PlFloatingBottomNavigation.d.ts +3 -0
- package/dist/components/floating-bottom-navigation/PlFloatingBottomNavigation.js +1 -1
- package/dist/components/footer/PlFooter.d.ts +4 -3
- package/dist/components/footer/PlFooter.js +1 -1
- package/dist/components/form/PlForm.js +1 -1
- package/dist/components/gallery/PlGallery.d.ts +192 -0
- package/dist/components/gallery/PlGallery.js +1 -0
- package/dist/components/gallery/PlGalleryViewer.d.ts +31 -0
- package/dist/components/gallery/PlGalleryViewer.js +1 -0
- package/dist/components/gallery/index.d.ts +2 -0
- package/dist/components/gallery/index.js +1 -0
- package/dist/components/gauge-chart/PlGaugeChart.d.ts +64 -0
- package/dist/components/gauge-chart/PlGaugeChart.js +1 -0
- package/dist/components/gauge-chart/index.d.ts +2 -0
- package/dist/components/gauge-chart/index.js +1 -0
- package/dist/components/grid/PlGrid.js +1 -1
- package/dist/components/grid/PlGridItem.js +1 -1
- package/dist/components/header/PlHeader.d.ts +4 -3
- package/dist/components/header/PlHeader.js +1 -1
- package/dist/components/heatmap-chart/PlHeatmapChart.d.ts +69 -0
- package/dist/components/heatmap-chart/PlHeatmapChart.js +1 -0
- package/dist/components/heatmap-chart/index.d.ts +2 -0
- package/dist/components/heatmap-chart/index.js +1 -0
- package/dist/components/highlight/PlHighlight.js +1 -1
- package/dist/components/hot-keys/PlHotKeys.js +1 -1
- package/dist/components/hover-card/PlHoverCard.d.ts +96 -0
- package/dist/components/hover-card/PlHoverCard.js +1 -0
- package/dist/components/hover-card/index.d.ts +2 -0
- package/dist/components/hover-card/index.js +1 -0
- package/dist/components/how-to-steps/PlHowToSteps.d.ts +87 -0
- package/dist/components/how-to-steps/PlHowToSteps.js +1 -0
- package/dist/components/how-to-steps/index.d.ts +2 -0
- package/dist/components/how-to-steps/index.js +1 -0
- package/dist/components/image/PlImage.d.ts +195 -8
- package/dist/components/image/PlImage.js +1 -1
- package/dist/components/image/PlImagePreview.d.ts +58 -0
- package/dist/components/image/PlImagePreview.js +1 -0
- package/dist/components/image/index.d.ts +1 -1
- package/dist/components/line-chart/PlLineChart.d.ts +74 -0
- package/dist/components/line-chart/PlLineChart.js +1 -0
- package/dist/components/line-chart/index.d.ts +2 -0
- package/dist/components/line-chart/index.js +1 -0
- package/dist/components/menu/PlMenu.d.ts +14 -5
- package/dist/components/menu/PlMenu.js +1 -1
- package/dist/components/meter/PlMeter.d.ts +83 -0
- package/dist/components/meter/PlMeter.js +1 -0
- package/dist/components/meter/index.d.ts +2 -0
- package/dist/components/meter/index.js +1 -0
- package/dist/components/mockup/PlMockup.d.ts +146 -0
- package/dist/components/mockup/PlMockup.js +1 -0
- package/dist/components/mockup/index.d.ts +2 -0
- package/dist/components/mockup/index.js +1 -0
- package/dist/components/modal/PlModal.d.ts +1 -1
- package/dist/components/modal/PlModal.js +1 -1
- package/dist/components/navigation-menu/PlNavigationMenu.d.ts +7 -1
- package/dist/components/navigation-menu/PlNavigationMenu.js +1 -1
- package/dist/components/number-field/PlNumberField.d.ts +1 -1
- package/dist/components/number-field/PlNumberField.js +1 -1
- package/dist/components/otp-field/PlOtpField.d.ts +6 -0
- package/dist/components/otp-field/PlOtpField.js +1 -1
- package/dist/components/overlay/PlOverlay.d.ts +1 -1
- package/dist/components/overlay/PlOverlay.js +1 -1
- package/dist/components/page-layout/PlPageLayout.js +1 -1
- package/dist/components/pagination/PlPagination.d.ts +12 -9
- package/dist/components/pagination/PlPagination.js +1 -1
- package/dist/components/panes/PlPanes.d.ts +7 -2
- package/dist/components/panes/PlPanes.js +1 -1
- package/dist/components/pie-chart/PlPieChart.d.ts +58 -0
- package/dist/components/pie-chart/PlPieChart.js +1 -0
- package/dist/components/pie-chart/index.d.ts +2 -0
- package/dist/components/pie-chart/index.js +1 -0
- package/dist/components/pill/PlPill.js +1 -1
- package/dist/components/popconfirm/PlPopconfirm.d.ts +1 -1
- package/dist/components/popconfirm/PlPopconfirm.js +1 -1
- package/dist/components/popover/PlPopover.d.ts +6 -6
- package/dist/components/popover/PlPopover.js +1 -1
- package/dist/components/portal/PlPortal.d.ts +78 -0
- package/dist/components/portal/PlPortal.js +1 -0
- package/dist/components/portal/index.d.ts +2 -0
- package/dist/components/portal/index.js +1 -0
- package/dist/components/progress-box/PlProgressBox.js +1 -1
- package/dist/components/progress-circular/PlProgressCircular.js +1 -1
- package/dist/components/progress-linear/PlProgressLinear.js +1 -1
- package/dist/components/radio-group/PlRadioGroup.js +1 -1
- package/dist/components/rating/PlRating.d.ts +1 -1
- package/dist/components/rating/PlRating.js +1 -1
- package/dist/components/scatter-chart/PlScatterChart.d.ts +46 -0
- package/dist/components/scatter-chart/PlScatterChart.js +1 -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/PlScrollArea.d.ts +98 -0
- package/dist/components/scroll-area/PlScrollArea.js +1 -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/PlScrollZone.d.ts +27 -10
- package/dist/components/scroll-zone/PlScrollZone.js +1 -1
- package/dist/components/segmented-button/PlSegmentedButton.js +1 -1
- package/dist/components/select/PlSelect.js +1 -1
- package/dist/components/show/PlShow.d.ts +76 -0
- package/dist/components/show/PlShow.js +1 -0
- package/dist/components/show/index.d.ts +2 -0
- package/dist/components/show/index.js +1 -0
- package/dist/components/sidebar/PlSidebar.js +1 -1
- package/dist/components/sidebar/PlSidebarTrigger.js +1 -1
- package/dist/components/skeleton/PlSkeleton.js +1 -1
- package/dist/components/slider/PlSlider.d.ts +13 -1
- package/dist/components/slider/PlSlider.js +1 -1
- package/dist/components/sparkline/PlSparkline.d.ts +68 -0
- package/dist/components/sparkline/PlSparkline.js +1 -0
- package/dist/components/sparkline/index.d.ts +2 -0
- package/dist/components/sparkline/index.js +1 -0
- package/dist/components/spoiler/PlSpoiler.d.ts +16 -1
- package/dist/components/spoiler/PlSpoiler.js +1 -1
- package/dist/components/stack/PlStack.d.ts +114 -0
- package/dist/components/stack/PlStack.js +1 -0
- package/dist/components/stack/index.d.ts +2 -0
- package/dist/components/stack/index.js +1 -0
- package/dist/components/stat/PlStat.d.ts +4 -0
- package/dist/components/stat/PlStat.js +1 -1
- package/dist/components/stepper/PlStepper.d.ts +3 -3
- package/dist/components/stepper/PlStepper.js +1 -1
- package/dist/components/switch/PlSwitch.js +1 -1
- package/dist/components/table/PlTable.d.ts +5 -5
- package/dist/components/table/PlTable.js +1 -1
- package/dist/components/tabs/PlTabs.d.ts +27 -2
- package/dist/components/tabs/PlTabs.js +1 -1
- package/dist/components/text-link/PlTextLink.js +1 -1
- package/dist/components/time-picker/PlTimePicker.js +1 -1
- package/dist/components/timeline/PlTimeline.d.ts +2 -2
- package/dist/components/timeline/PlTimeline.js +1 -1
- package/dist/components/timeline-chart/PlTimelineChart.d.ts +44 -0
- package/dist/components/timeline-chart/PlTimelineChart.js +1 -0
- package/dist/components/timeline-chart/index.d.ts +2 -0
- package/dist/components/timeline-chart/index.js +1 -0
- package/dist/components/toast/PlToast.d.ts +1 -1
- package/dist/components/toast/PlToast.js +1 -1
- package/dist/components/toggle/PlToggle.js +1 -1
- package/dist/components/toggle/PlToggleGroup.js +1 -1
- package/dist/components/tooltip/PlTooltip.js +1 -1
- package/dist/components/tour/PlTour.d.ts +134 -0
- package/dist/components/tour/PlTour.js +1 -0
- package/dist/components/tour/index.d.ts +2 -0
- package/dist/components/tour/index.js +1 -0
- package/dist/components/transfer/PlTransfer.d.ts +10 -1
- package/dist/components/transfer/PlTransfer.js +1 -1
- package/dist/components/tree/PlTree.js +1 -1
- package/dist/components/tree-select/PlTreeSelect.d.ts +99 -0
- package/dist/components/tree-select/PlTreeSelect.js +1 -0
- package/dist/components/tree-select/index.d.ts +2 -0
- package/dist/components/tree-select/index.js +1 -0
- package/dist/components/typography/PlTypography.js +1 -1
- package/dist/components/window-pane/PlWindowPane.d.ts +179 -0
- package/dist/components/window-pane/PlWindowPane.js +1 -0
- package/dist/components/window-pane/index.d.ts +2 -0
- package/dist/components/window-pane/index.js +1 -0
- package/dist/css/anchor.css +2 -0
- package/dist/css/animate-counter.css +2 -0
- package/dist/css/animate-float.css +2 -0
- package/dist/css/animate-reveal.css +2 -0
- package/dist/css/animate-scramble.css +2 -0
- package/dist/css/animate-shake.css +2 -0
- package/dist/css/animate-split.css +2 -0
- package/dist/css/app-logo.css +2 -0
- package/dist/css/area-chart.css +3 -0
- package/dist/css/back-top.css +2 -0
- package/dist/css/bar-chart.css +3 -0
- package/dist/css/calendar.css +1 -0
- package/dist/css/carousel.css +2 -0
- package/dist/css/code-block.css +2 -0
- package/dist/css/color-picker.css +1 -0
- package/dist/css/combobox.css +1 -0
- package/dist/css/command-palette.css +1 -0
- package/dist/css/confirm.css +2 -0
- package/dist/css/data-list.css +2 -0
- package/dist/css/data-table.css +7 -0
- package/dist/css/date-picker.css +1 -0
- package/dist/css/date-range-picker.css +1 -0
- package/dist/css/date-time-picker.css +1 -0
- package/dist/css/flex.css +2 -0
- package/dist/css/floating-action-button.css +4 -0
- package/dist/css/gallery.css +7 -0
- package/dist/css/gauge-chart.css +3 -0
- package/dist/css/heatmap-chart.css +3 -0
- package/dist/css/hover-card.css +2 -0
- package/dist/css/how-to-steps.css +2 -0
- package/dist/css/icon-button.css +1 -0
- package/dist/css/image.css +2 -0
- package/dist/css/line-chart.css +3 -0
- package/dist/css/menubar.css +1 -0
- package/dist/css/meter.css +2 -0
- package/dist/css/mockup.css +2 -0
- package/dist/css/pagination.css +1 -0
- package/dist/css/pie-chart.css +3 -0
- package/dist/css/popconfirm.css +2 -0
- package/dist/css/portal.css +2 -0
- package/dist/css/scatter-chart.css +3 -0
- package/dist/css/scroll-area.css +2 -0
- package/dist/css/scroll-zone.css +2 -0
- package/dist/css/show.css +2 -0
- package/dist/css/sidebar.css +3 -0
- package/dist/css/sparkline.css +3 -0
- package/dist/css/spoiler.css +1 -0
- package/dist/css/stack.css +2 -0
- package/dist/css/stat.css +1 -0
- package/dist/css/time-picker.css +1 -0
- package/dist/css/timeline-chart.css +3 -0
- package/dist/css/tour.css +3 -0
- package/dist/css/transfer.css +4 -0
- package/dist/css/tree-select.css +4 -0
- package/dist/css/window-pane.css +2 -0
- package/dist/hooks/index.d.ts +6 -0
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/usePlBreakpoint.d.ts +3 -0
- package/dist/hooks/usePlBreakpoint.js +1 -1
- package/dist/hooks/usePlDisclosure.d.ts +44 -0
- package/dist/hooks/usePlDisclosure.js +1 -0
- package/dist/hooks/usePlElementSize.d.ts +34 -0
- package/dist/hooks/usePlElementSize.js +1 -0
- package/dist/hooks/usePlHotKeys.d.ts +5 -1
- package/dist/hooks/usePlHotKeys.js +1 -1
- package/dist/hooks/usePlOnScreen.d.ts +54 -0
- package/dist/hooks/usePlOnScreen.js +1 -0
- package/dist/index.d.ts +34 -1
- package/dist/index.js +1 -1
- package/dist/internal/animate.d.ts +121 -7
- package/dist/internal/animate.js +1 -1
- package/dist/internal/breakpoints.d.ts +31 -0
- package/dist/internal/breakpoints.js +1 -0
- package/dist/internal/button-group.d.ts +29 -2
- package/dist/internal/button-group.js +2 -2
- package/dist/internal/calendar.d.ts +11 -36
- package/dist/internal/calendar.js +1 -1
- package/dist/internal/chart-frame.d.ts +462 -0
- package/dist/internal/chart-frame.js +1 -0
- package/dist/internal/chart-line.d.ts +44 -0
- package/dist/internal/chart-line.js +1 -0
- package/dist/internal/chart.d.ts +551 -0
- package/dist/internal/chart.js +1 -0
- package/dist/internal/color-scheme.js +1 -1
- package/dist/internal/data-table.d.ts +70 -0
- package/dist/internal/data-table.js +1 -0
- package/dist/internal/date.d.ts +10 -0
- package/dist/internal/date.js +1 -1
- package/dist/internal/defaults.d.ts +8 -3
- package/dist/internal/drag.d.ts +65 -0
- package/dist/internal/drag.js +1 -0
- package/dist/internal/focusable.d.ts +8 -0
- package/dist/internal/focusable.js +1 -0
- package/dist/internal/form.d.ts +61 -0
- package/dist/internal/form.js +1 -0
- package/dist/internal/format.d.ts +2 -0
- package/dist/internal/format.js +1 -1
- package/dist/internal/gallery.d.ts +80 -0
- package/dist/internal/gallery.js +1 -0
- package/dist/internal/glow.d.ts +17 -0
- package/dist/internal/glow.js +1 -0
- package/dist/internal/grid.d.ts +6 -27
- package/dist/internal/grid.js +1 -1
- package/dist/internal/highlight.d.ts +98 -0
- package/dist/internal/highlight.js +1 -0
- package/dist/internal/icons.d.ts +10 -0
- package/dist/internal/icons.js +1 -1
- package/dist/internal/image.d.ts +94 -0
- package/dist/internal/image.js +1 -0
- package/dist/internal/inert.d.ts +19 -0
- package/dist/internal/inert.js +1 -0
- package/dist/internal/keys.d.ts +19 -0
- package/dist/internal/keys.js +1 -1
- package/dist/internal/labels.d.ts +182 -0
- package/dist/internal/labels.js +1 -0
- package/dist/internal/link.d.ts +17 -0
- package/dist/internal/link.js +1 -1
- package/dist/internal/mockup.d.ts +193 -0
- package/dist/internal/mockup.js +1 -0
- package/dist/internal/page-layout.d.ts +14 -7
- package/dist/internal/page-layout.js +1 -1
- package/dist/internal/picker.d.ts +43 -6
- package/dist/internal/picker.js +1 -1
- package/dist/internal/progress.d.ts +22 -8
- package/dist/internal/progress.js +1 -1
- package/dist/internal/responsive.d.ts +108 -0
- package/dist/internal/responsive.js +1 -0
- package/dist/internal/scramble.d.ts +35 -0
- package/dist/internal/scramble.js +1 -0
- package/dist/internal/scroll-target.d.ts +5 -0
- package/dist/internal/scroll-target.js +1 -0
- package/dist/internal/steps.js +1 -1
- package/dist/internal/styles.d.ts +81 -0
- package/dist/internal/styles.js +1 -1
- package/dist/internal/table.d.ts +86 -0
- package/dist/internal/table.js +1 -0
- package/dist/internal/text.d.ts +39 -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/tour.d.ts +42 -0
- package/dist/internal/tour.js +1 -0
- package/dist/internal/watermark.d.ts +44 -0
- package/dist/internal/watermark.js +1 -0
- package/dist/internal/wheel.d.ts +52 -0
- package/dist/internal/wheel.js +1 -0
- package/dist/internal/window.d.ts +201 -0
- package/dist/internal/window.js +1 -0
- package/dist/locales/de.d.ts +3 -0
- package/dist/locales/de.js +1 -0
- package/dist/locales/en.d.ts +2 -0
- package/dist/locales/en.js +1 -0
- package/dist/locales/es.d.ts +3 -0
- package/dist/locales/es.js +1 -0
- package/dist/locales/fr.d.ts +3 -0
- package/dist/locales/fr.js +1 -0
- package/dist/locales/index.d.ts +33 -0
- package/dist/locales/index.js +1 -0
- package/dist/locales/ja.d.ts +3 -0
- package/dist/locales/ja.js +1 -0
- package/dist/locales/ko.d.ts +3 -0
- package/dist/locales/ko.js +1 -0
- package/dist/locales/zh-Hans.d.ts +3 -0
- package/dist/locales/zh-Hans.js +1 -0
- package/dist/provider/PlColorSchemeScript.js +1 -1
- package/dist/provider/PlassProvider.js +1 -1
- package/dist/provider/index.d.ts +1 -0
- package/dist/provider/index.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1357 -25
- package/dist/tokens.css +1357 -25
- package/dist/types.d.ts +368 -2
- package/package.json +26 -16
- package/dist/components/avatar-group/PlAvatarGroup.d.ts +0 -47
- package/dist/components/avatar-group/PlAvatarGroup.js +0 -1
- package/dist/components/avatar-group/index.d.ts +0 -2
- package/dist/components/avatar-group/index.js +0 -1
- package/dist/css/avatar-group.css +0 -2
- package/dist/internal/avatar-group.d.ts +0 -25
- package/dist/internal/avatar-group.js +0 -2
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The arithmetic a data table does before it draws anything.
|
|
3
|
+
*
|
|
4
|
+
* Sorting, paging and range selection are decisions about values rather than
|
|
5
|
+
* about the DOM, so they are here as plain functions: they can be read without
|
|
6
|
+
* a browser, tested without one, and — the reason that matters — they are the
|
|
7
|
+
* same three answers the Flutter build gives, which is what keeps a table
|
|
8
|
+
* sorted one way on the web from being sorted another way in an app.
|
|
9
|
+
*/
|
|
10
|
+
import type * as React from 'react';
|
|
11
|
+
/** Which way a column runs when it is sorted. */
|
|
12
|
+
export type PlassSortDirection = 'asc' | 'desc';
|
|
13
|
+
/** A column and the direction it is sorted in. */
|
|
14
|
+
export interface PlassSort {
|
|
15
|
+
/** The column's `key`. */
|
|
16
|
+
key: string;
|
|
17
|
+
/** Which way it runs. */
|
|
18
|
+
direction: PlassSortDirection;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Puts two cell values in order, in the direction given: `1` for ascending and
|
|
22
|
+
* `-1` for descending.
|
|
23
|
+
*
|
|
24
|
+
* Numbers and dates compare as themselves, strings compare the way the reader's
|
|
25
|
+
* language orders them, and everything else falls back to its text. Two rules
|
|
26
|
+
* carry the weight:
|
|
27
|
+
*
|
|
28
|
+
* **Nothing sorts last, in both directions.** A column of amounts with three
|
|
29
|
+
* blanks in it is a column whose blanks are not the smallest amounts, and a
|
|
30
|
+
* reader who reversed the sort to find the largest should not be handed the
|
|
31
|
+
* empty ones instead. So the answer for a missing value is decided here, and the
|
|
32
|
+
* direction turns only the rest round.
|
|
33
|
+
*
|
|
34
|
+
* **Strings compare with `localeCompare`.** `'a' < 'B'` is false by code point,
|
|
35
|
+
* which puts every capitalised word above every lower-case one and sorts `Ösi`
|
|
36
|
+
* after `Zoe`. A list of names a reader cannot scan is a list that was sorted
|
|
37
|
+
* for the machine.
|
|
38
|
+
*/
|
|
39
|
+
export declare function compareValues(a: unknown, b: unknown, direction?: 1 | -1): number;
|
|
40
|
+
/**
|
|
41
|
+
* What pressing a column heading does next.
|
|
42
|
+
*
|
|
43
|
+
* Ascending, then descending, then **off** — a third press puts the rows back
|
|
44
|
+
* in the order they arrived in. That order is information: it is usually the
|
|
45
|
+
* order the server chose, and a table that can never be put back has thrown it
|
|
46
|
+
* away. Pressing a different column starts that column ascending rather than
|
|
47
|
+
* inheriting the direction of the one before it.
|
|
48
|
+
*/
|
|
49
|
+
export declare function nextSort(current: PlassSort | null, key: string): PlassSort | null;
|
|
50
|
+
/**
|
|
51
|
+
* The keys of every row between two of them, inclusive, in the order the rows
|
|
52
|
+
* are currently in.
|
|
53
|
+
*
|
|
54
|
+
* What a shift-click ticks. "Currently in" is the point: a reader dragging a
|
|
55
|
+
* range down a sorted table means the rows they can see, not the rows the
|
|
56
|
+
* unsorted array happens to hold between those two indices.
|
|
57
|
+
*
|
|
58
|
+
* An unknown key selects nothing rather than throwing, because the anchor can
|
|
59
|
+
* legitimately have been filtered away between the two clicks.
|
|
60
|
+
*/
|
|
61
|
+
export declare function keysBetween(keys: readonly React.Key[], from: React.Key, to: React.Key): React.Key[];
|
|
62
|
+
/**
|
|
63
|
+
* Which rows a page shows, as a `[start, end)` pair into the sorted set.
|
|
64
|
+
*
|
|
65
|
+
* Clamped rather than trusted: a page number that has gone past the end — the
|
|
66
|
+
* usual way being a filter that shortened the list under a reader sitting on
|
|
67
|
+
* page nine — shows the last page instead of an empty table with a pager that
|
|
68
|
+
* says there is something there.
|
|
69
|
+
*/
|
|
70
|
+
export declare function pageBounds(total: number, page: number, pageSize: number): [number, number];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function compareValues(e,n,t=1){const o=null==e||""===e,r=null==n||""===n;return o||r?o&&r?0:o?1:-1:function compareKnown(e,n){return"number"==typeof e&&"number"==typeof n?e-n:"boolean"==typeof e&&"boolean"==typeof n?Number(e)-Number(n):e instanceof Date&&n instanceof Date?e.getTime()-n.getTime():String(e).localeCompare(String(n))}(e,n)*t}export function nextSort(e,n){return null===e||e.key!==n?{key:n,direction:"asc"}:"asc"===e.direction?{key:n,direction:"desc"}:null}export function keysBetween(e,n,t){const o=e.indexOf(n),r=e.indexOf(t);return-1===o||-1===r?[]:o<=r?e.slice(o,r+1):e.slice(r,o+1)}export function pageBounds(e,n,t){const o=Math.max(1,Math.ceil(e/t)),r=(Math.min(Math.max(1,Math.trunc(n)),o)-1)*t;return[r,Math.min(r+t,e)]}
|
package/dist/internal/date.d.ts
CHANGED
|
@@ -112,6 +112,16 @@ export declare function withTime(date: Date, parts: {
|
|
|
112
112
|
minutes?: number;
|
|
113
113
|
seconds?: number;
|
|
114
114
|
}): Date;
|
|
115
|
+
/**
|
|
116
|
+
* Holds a moment inside `[min, max]`, on a whole second when `seconds` is set
|
|
117
|
+
* and a whole minute when it is not — the smallest step the clock can show.
|
|
118
|
+
*
|
|
119
|
+
* The bounds are read at full precision, so a moment is rounded into the span
|
|
120
|
+
* rather than onto a bound it would then sit outside of: up from a minimum and
|
|
121
|
+
* down from a maximum. Two bounds inside one step leave no whole step between
|
|
122
|
+
* them, and the bound itself is returned.
|
|
123
|
+
*/
|
|
124
|
+
export declare function clampMoment(date: Date, min: Date | null | undefined, max: Date | null | undefined, seconds: boolean): Date;
|
|
115
125
|
/** `date`'s calendar day wearing `time`'s clock. */
|
|
116
126
|
export declare function mergeDateAndTime(date: Date, time: Date): Date;
|
|
117
127
|
/**
|
package/dist/internal/date.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{dateFormatter as t}from"./format.js";export const YEAR_PAGE_SIZE=12;export function makeDate(t,e,
|
|
1
|
+
import{dateFormatter as t}from"./format.js";export const YEAR_PAGE_SIZE=12;export function makeDate(t,e,n){const r=new Date(0);return r.setFullYear(t,e,n),r.setHours(0,0,0,0),r}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 today(){return startOfDay(new Date)}export function addDays(t,e){const n=new Date(t.getTime());return n.setDate(n.getDate()+e),n}export function addMonths(t,e){const n=new Date(t.getTime()),r=makeDate(t.getFullYear(),t.getMonth()+e,1);return n.setFullYear(r.getFullYear(),r.getMonth(),Math.min(t.getDate(),daysInMonth(r.getFullYear(),r.getMonth()))),n}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 clampDate(t,e,n){return isValidDate(e)&&t.getTime()<e.getTime()?new Date(e.getTime()):isValidDate(n)&&t.getTime()>n.getTime()?new Date(n.getTime()):t}export function isDayOutside(t,e,n){return!!(isValidDate(e)&&compareDay(t,e)<0)||isValidDate(n)&&compareDay(t,n)>0}export function isMonthOutside(t,e,n){const r=t.getFullYear(),o=t.getMonth();return isDayOutside(makeDate(r,o,daysInMonth(r,o)),e,null)||isDayOutside(makeDate(r,o,1),null,n)}export function isYearOutside(t,e,n){const r=t.getFullYear();return isValidDate(e)&&r<e.getFullYear()||isValidDate(n)&&r>n.getFullYear()}export function secondsOfDay(t){return 3600*t.getHours()+60*t.getMinutes()+t.getSeconds()}export function timeUnitSpan(t,e){const n=secondsOfDay(e);if("hour"===t){const t=3600*Math.floor(n/3600);return[t,t+3599]}if("minute"===t){const t=60*Math.floor(n/60);return[t,t+59]}if("second"===t)return[n,n];const r=e.getHours()<12?0:43200;return[r,r+43200-1]}export function withTime(t,e){const n=new Date(t.getTime());return n.setHours(e.hours??n.getHours(),e.minutes??n.getMinutes(),e.seconds??n.getSeconds(),0),n}export function clampMoment(t,e,n,r){const o=r?1e3:6e4,floor=t=>withTime(t,{seconds:r?t.getSeconds():0});if(isValidDate(e)&&t.getTime()<e.getTime()){const t=floor(e),r=t.getTime()<e.getTime()?new Date(t.getTime()+o):t;return isValidDate(n)&&r.getTime()>n.getTime()?new Date(e.getTime()):r}if(isValidDate(n)&&t.getTime()>n.getTime()){const t=floor(n);return isValidDate(e)&&t.getTime()<e.getTime()?new Date(n.getTime()):t}return t}export function mergeDateAndTime(t,e){return withTime(startOfDay(t),{hours:e.getHours(),minutes:e.getMinutes(),seconds:e.getSeconds()})}export function calendarWeeks(t,e){const n=startOfMonth(t),r=(n.getDay()-e+7)%7,o=addDays(n,-r);return Array.from({length:6},(t,e)=>Array.from({length:7},(t,n)=>addDays(o,7*e+n)))}export function yearPageStart(t){return t-(t%12+12)%12}export function formatDate(e,n,r){return isValidDate(e)?t(n,r).format(e):""}const e=/* @__PURE__ */[...Array.from({length:24},(t,e)=>new Date(2027,e%12,21+e%7,e,58,58)),new Date(2027,0,22,12,58,58)];export function displaySamples(n,r){const o=t(n,r);return[...new Set(e.map(t=>o.format(t)))]}export function withPlaceholder(t,e){return"string"==typeof e&&""!==e?[...t,e]:t}export function toISODate(t){const pad=t=>String(t).padStart(2,"0");return`${String(t.getFullYear()).padStart(4,"0")}-${pad(t.getMonth()+1)}-${pad(t.getDate())}`}export function toISOMonth(t){return`${String(t.getFullYear()).padStart(4,"0")}-${String(t.getMonth()+1).padStart(2,"0")}`}export function toISOYear(t){return String(t.getFullYear()).padStart(4,"0")}export function toISOTime(t,e=!1){const pad=t=>String(t).padStart(2,"0"),n=`${pad(t.getHours())}:${pad(t.getMinutes())}`;return e?`${n}:${pad(t.getSeconds())}`:n}export function toISODateTime(t,e=!1){return`${toISODate(t)}T${toISOTime(t,e)}`}const n=/* @__PURE__ */makeDate(2021,7,1);export function weekdayLabels(e,r,o="short"){const a=t(e,{weekday:o});return Array.from({length:7},(t,e)=>a.format(addDays(n,(r+e)%7)))}export function monthLabels(e,n="short"){const r=t(e,{month:n});return Array.from({length:12},(t,e)=>r.format(makeDate(2021,e,1)))}export function isMonthBeforeYear(e){const r=t(e,{year:"numeric",month:"long"}).formatToParts(n);return r.findIndex(t=>"month"===t.type)<r.findIndex(t=>"year"===t.type)}export function isHour12(e){const n=t(e,{hour:"numeric"}).resolvedOptions();return n.hourCycle?"h11"===n.hourCycle||"h12"===n.hourCycle:!0===n.hour12}export function meridiemLabels(e){const r=t(e,{hour:"numeric",hour12:!0}),read=t=>{const e=r.formatToParts(withTime(n,{hours:t})).find(t=>"dayPeriod"===t.type);return e?.value??(t<12?"AM":"PM")};return[read(9),read(21)]}export function localeWeekStart(t){try{const e=t??(new Intl.DateTimeFormat).resolvedOptions().locale,n=new Intl.Locale(e),r="function"==typeof n.getWeekInfo?n.getWeekInfo():n.weekInfo;if("number"==typeof r?.firstDay)return r.firstDay%7}catch{}return 0}
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
* A caller who genuinely wants every button glass writes it on the buttons.
|
|
30
30
|
*/
|
|
31
31
|
import * as React from 'react';
|
|
32
|
-
import type {
|
|
32
|
+
import type { PlassLabels } from './labels.js';
|
|
33
33
|
import type { PlassDirection } from './direction.js';
|
|
34
34
|
import type { PlassColor, PlassDensity, PlassSize, PlassWeekday } from '../types.js';
|
|
35
35
|
/** Everything a `PlassProvider` can decide for the tree under it. */
|
|
@@ -44,8 +44,13 @@ export interface PlassDefaults {
|
|
|
44
44
|
locale?: string;
|
|
45
45
|
/** Which day their weeks start on, as `Date` counts them — Sunday is `0`. */
|
|
46
46
|
weekStartsOn?: PlassWeekday;
|
|
47
|
-
/**
|
|
48
|
-
|
|
47
|
+
/**
|
|
48
|
+
* The words the library says on its own behalf, translated.
|
|
49
|
+
*
|
|
50
|
+
* A partial: whatever is not in it stays English, so a caller can replace one
|
|
51
|
+
* string without owning the other sixty. `plass-ui/locales` ships whole ones.
|
|
52
|
+
*/
|
|
53
|
+
labels?: Partial<PlassLabels>;
|
|
49
54
|
/**
|
|
50
55
|
* Which way the tree runs, for the behaviours that read it in JavaScript.
|
|
51
56
|
*
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Everything a pointer drag takes from outside itself, and the one function
|
|
3
|
+
* that gives all of it back.
|
|
4
|
+
*
|
|
5
|
+
* The arithmetic of a drag differs in every component that has one and stays
|
|
6
|
+
* where it is. What is the same everywhere is the scaffold around it — three
|
|
7
|
+
* listeners, a `data-dragging` to style against, the document's text selection,
|
|
8
|
+
* and a teardown an unmount can call — and every copy of that scaffold is a
|
|
9
|
+
* place for one of the four to be forgotten.
|
|
10
|
+
*
|
|
11
|
+
* There is deliberately **no `requestAnimationFrame` in here.** A `pointermove`
|
|
12
|
+
* is already delivered once per frame in every browser the library supports —
|
|
13
|
+
* `pointerrawupdate` is the uncoalesced one — so coalescing again would buy
|
|
14
|
+
* nothing and cost a frame of latency on the one gesture where latency is the
|
|
15
|
+
* whole feel of it.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* The selection, taken for the length of a gesture.
|
|
19
|
+
*
|
|
20
|
+
* Written prefixed and through `setProperty` because WebKit implements only
|
|
21
|
+
* `-webkit-user-select`: `style.userSelect = 'none'` hangs a plain JavaScript
|
|
22
|
+
* property off the object, changes nothing, and Safari goes on selecting text
|
|
23
|
+
* through the whole drag. It is taken off the document rather than fixed with
|
|
24
|
+
* `preventDefault`, which would also stop the browser focusing what was
|
|
25
|
+
* pressed and leave every mouse press wearing a keyboard focus ring.
|
|
26
|
+
*
|
|
27
|
+
* Exported as well as used below, for the gesture that takes the selection at a
|
|
28
|
+
* moment of its own rather than at the press: `PlScrollZone` waits for the
|
|
29
|
+
* pointer to pass its threshold, because up to that point the press is still a
|
|
30
|
+
* click on a card and the reader is still allowed to select the text under it.
|
|
31
|
+
*/
|
|
32
|
+
export declare function takeSelection(): () => void;
|
|
33
|
+
export interface PointerDragOptions {
|
|
34
|
+
/**
|
|
35
|
+
* The element the three listeners go on, and the one the pointer is captured
|
|
36
|
+
* to. Capture is what retargets every later event here, so a drag survives
|
|
37
|
+
* the pointer leaving the element it started on.
|
|
38
|
+
*/
|
|
39
|
+
target: HTMLElement;
|
|
40
|
+
/** The pointer that started it. */
|
|
41
|
+
pointerId: number;
|
|
42
|
+
/** Every move until the gesture ends. */
|
|
43
|
+
onMove: (event: PointerEvent) => void;
|
|
44
|
+
/**
|
|
45
|
+
* The gesture ended the way it was meant to — the pointer was released.
|
|
46
|
+
*
|
|
47
|
+
* A `pointercancel` counts: the gesture is over and the caller wants to know
|
|
48
|
+
* where it settled. What does **not** count is the drag being torn down by an
|
|
49
|
+
* unmount — a component that disappeared did not finish resizing, and telling
|
|
50
|
+
* a caller it did would set state on the way out of the tree. That split is
|
|
51
|
+
* why `release` and `onEnd` are two things.
|
|
52
|
+
*/
|
|
53
|
+
onEnd?: () => void;
|
|
54
|
+
/** Whether the document's text selection is taken for the length of it. @default true */
|
|
55
|
+
selectable?: boolean;
|
|
56
|
+
/** Marks the target while it runs, for `data-dragging` to style against. @default true */
|
|
57
|
+
mark?: boolean;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Starts a drag. Returns `release` — everything above, given back.
|
|
61
|
+
*
|
|
62
|
+
* Call `release` from an unmount effect. It is idempotent, so the pointer's own
|
|
63
|
+
* `pointerup` calling it first costs nothing.
|
|
64
|
+
*/
|
|
65
|
+
export declare function beginPointerDrag({ target, pointerId, onMove, onEnd, selectable, mark }: PointerDragOptions): () => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function takeSelection(){const e=document.body,t=e.style.getPropertyValue("-webkit-user-select");return e.style.setProperty("-webkit-user-select","none"),()=>{t?e.style.setProperty("-webkit-user-select",t):e.style.removeProperty("-webkit-user-select")}}export function beginPointerDrag({target:e,pointerId:t,onMove:n,onEnd:r,selectable:o=!0,mark:s=!0}){const i=o?takeSelection():null;s&&(e.dataset.dragging="true"),e.setPointerCapture?.(t);let a=!0;const release=()=>{a&&(a=!1,e.removeEventListener("pointermove",n),e.removeEventListener("pointerup",end),e.removeEventListener("pointercancel",end),s&&delete e.dataset.dragging,i?.())},end=()=>{release(),r?.()};return e.addEventListener("pointermove",n),e.addEventListener("pointerup",end),e.addEventListener("pointercancel",end),release}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every element under `root` that the Tab key could land on, in document order.
|
|
3
|
+
*
|
|
4
|
+
* Anything inside an `inert` subtree is left out: it matches the selector and
|
|
5
|
+
* a browser still refuses to focus it, so handing the focus to one is handing
|
|
6
|
+
* it to the top of the document.
|
|
7
|
+
*/
|
|
8
|
+
export declare function focusablesIn(root: ParentNode): HTMLElement[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function focusablesIn(e){return Array.from(e.querySelectorAll('a[href], button:not([disabled]), input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')).filter(e=>!e.closest("[inert]"))}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* How a control whose visible part is not an `<input>` takes part in a form.
|
|
4
|
+
*
|
|
5
|
+
* Base UI's `Form` validates, focuses and collects only the controls registered
|
|
6
|
+
* with a `Field`, and the one public way to register is `Field.Control`, which
|
|
7
|
+
* is an `<input>` holding a string. A picker's trigger is a button and a file
|
|
8
|
+
* picker's is a drop zone, so on their own they were invisible to a `PlForm`:
|
|
9
|
+
* missing from its values, never blocking a submit, and never showing the error
|
|
10
|
+
* it had for their `name`.
|
|
11
|
+
*
|
|
12
|
+
* `FormControl` is that input, kept off screen. It holds the value as a string,
|
|
13
|
+
* so `required` is the browser's own check, and it hands the focus a form moves
|
|
14
|
+
* to it on to the control a reader actually uses. What a string cannot carry —
|
|
15
|
+
* the two ends of a range, several selections, a list of files — is reported to
|
|
16
|
+
* the `PlForm` around it through `useFormReport`, and `PlForm` lays those over
|
|
17
|
+
* the values Base UI collected.
|
|
18
|
+
*/
|
|
19
|
+
/** Values reported to a `PlForm` by name, read when the form is submitted. */
|
|
20
|
+
export type FormReport = Map<string, () => unknown>;
|
|
21
|
+
export declare const FormReportContext: React.Context<FormReport | null>;
|
|
22
|
+
/**
|
|
23
|
+
* Reports `read()` as the value of `name` to the `PlForm` around the caller,
|
|
24
|
+
* for as long as `enabled` holds. Outside a `PlForm` it does nothing.
|
|
25
|
+
*/
|
|
26
|
+
export declare function useFormReport(name: string | undefined, read: () => unknown, enabled?: boolean): void;
|
|
27
|
+
/**
|
|
28
|
+
* Whether `element` is inside a disabled `<fieldset>`, re-rendering when a
|
|
29
|
+
* fieldset around it turns `disabled` on or off.
|
|
30
|
+
*
|
|
31
|
+
* The browser disables a native control inside one by itself. A control drawn
|
|
32
|
+
* as elements with a `tabIndex` is not a form control, so the fieldset never
|
|
33
|
+
* reaches it and it has to ask. The answer is the platform's: a disabled
|
|
34
|
+
* fieldset reaches everything inside it except what is in its first `<legend>`.
|
|
35
|
+
*/
|
|
36
|
+
export declare function useFieldsetDisabled(element: Element | null): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Tells a `FormControl` the reader has left the control it stands behind, so a
|
|
39
|
+
* form that validates on blur checks it then. The input never has the focus
|
|
40
|
+
* itself, so the event it would have had is sent to it.
|
|
41
|
+
*/
|
|
42
|
+
export declare function leaveFormControl(input: HTMLInputElement | null): void;
|
|
43
|
+
export interface FormControlProps {
|
|
44
|
+
/** The name the value submits under, and the key a form's `errors` use. */
|
|
45
|
+
name?: string;
|
|
46
|
+
/**
|
|
47
|
+
* The value as a form submits it: one string, or one entry per row. An empty
|
|
48
|
+
* string, a list with an empty entry and an empty list are no value, which is
|
|
49
|
+
* what `required` checks.
|
|
50
|
+
*/
|
|
51
|
+
value: string | readonly string[];
|
|
52
|
+
required: boolean;
|
|
53
|
+
disabled: boolean;
|
|
54
|
+
/** The element a reader uses, which takes the focus a form moves here. */
|
|
55
|
+
standIn: () => HTMLElement | null | undefined;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* The input a `Field` registers for a control that is not one. Renders inside a
|
|
59
|
+
* `Field.Root`.
|
|
60
|
+
*/
|
|
61
|
+
export declare const FormControl: React.ForwardRefExoticComponent<FormControlProps & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e,Fragment as t,jsxs as r}from"react/jsx-runtime";import*as n from"react";import{Field as o}from"@base-ui/react/field";export const FormReportContext=/* @__PURE__ */n.createContext(null);export function useFormReport(e,t,r=!0){const o=n.useContext(FormReportContext),s=n.useRef(t);n.useEffect(()=>{s.current=t}),n.useEffect(()=>{if(!o||!e||!r)return;const entry=()=>s.current();return o.set(e,entry),()=>{o.get(e)===entry&&o.delete(e)}},[o,e,r])}function fieldsetsAround(e){const t=[];for(let r=e.parentElement?.closest("fieldset");r;r=r.parentElement?.closest("fieldset"))t.push(r);return t}export function useFieldsetDisabled(e){const t=n.useCallback(t=>{if(!e)return()=>{};const r=new MutationObserver(t);return fieldsetsAround(e).forEach(e=>r.observe(e,{attributes:!0,attributeFilter:["disabled"]})),()=>r.disconnect()},[e]);return n.useSyncExternalStore(t,()=>null!==e&&fieldsetsAround(e).some(t=>t.disabled&&!t.querySelector(":scope > legend")?.contains(e)),()=>!1)}export function leaveFormControl(e){e?.dispatchEvent(new FocusEvent("focusout",{bubbles:!0}))}export const FormControl=/* @__PURE__ */n.forwardRef(function FormControl({name:n,value:s,required:u,disabled:i,standIn:a},l){const c=Array.isArray(s),d=c?s.length>0&&s.every(e=>""!==e):""!==s;return useFormReport(n,()=>[...s],c&&!i),r(t,{children:[e(o.Control,{ref:l,name:n,value:c?d?s.join("\n"):"":s,required:u,disabled:i,tabIndex:-1,"aria-hidden":"true",autoComplete:"off",className:"pointer-events-none absolute size-px overflow-hidden opacity-0 [clip-path:inset(50%)]",onFocus:()=>a()?.focus(),render:c?t=>e("input",{...t,name:void 0}):void 0}),c&&n?s.map((t,r)=>e("input",{type:"hidden",name:n,value:t,disabled:i},r)):null]})});
|
|
@@ -22,3 +22,5 @@
|
|
|
22
22
|
*/
|
|
23
23
|
/** A memoised `Intl.DateTimeFormat`. */
|
|
24
24
|
export declare function dateFormatter(locale: string | undefined, options: Intl.DateTimeFormatOptions): Intl.DateTimeFormat;
|
|
25
|
+
/** A memoised `Intl.NumberFormat`. */
|
|
26
|
+
export declare function numberFormatter(locale: string | undefined, options?: Intl.NumberFormatOptions): Intl.NumberFormat;
|
package/dist/internal/format.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function cacheKey(t,e){return`${t??""}\0${e?JSON.stringify(e):""}`}const t=new Map;export function dateFormatter(e,n){const r=cacheKey(e,n);let c=t.get(r);return c||(c=new Intl.DateTimeFormat(e,n),t.set(r,c)),c}const e=new Map;export function numberFormatter(t,n){const r=cacheKey(t,n);let c=e.get(r);return c||(c=new Intl.NumberFormat(t,n),e.set(r,c)),c}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A tile's proportion as the number the layouts do arithmetic on.
|
|
3
|
+
*
|
|
4
|
+
* A ratio is `16 / 9` as often as it is `1.78`, because that is how CSS writes
|
|
5
|
+
* one and this library does not make a caller translate it.
|
|
6
|
+
*/
|
|
7
|
+
export declare function ratioOf(value: number | string | undefined, fallback: number): number;
|
|
8
|
+
/**
|
|
9
|
+
* Whether an item's picture is turned onto its side.
|
|
10
|
+
*
|
|
11
|
+
* The gallery and its viewer both ask, so they ask here: a tile laid out on its
|
|
12
|
+
* side that opened upright, or the other way round, would be one picture shown
|
|
13
|
+
* two ways.
|
|
14
|
+
*/
|
|
15
|
+
export declare function isTurned(rotate: number | undefined): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* The proportion an item is shown at: its file's own, or the inverse for a
|
|
18
|
+
* picture on its side.
|
|
19
|
+
*
|
|
20
|
+
* An item's `ratio` stays the stored file's proportion, which is what a caller
|
|
21
|
+
* has to hand, so every piece of layout arithmetic that runs before anything
|
|
22
|
+
* loads reads it through this.
|
|
23
|
+
*/
|
|
24
|
+
export declare function shownRatio(ratio: number, rotate: number | undefined): number;
|
|
25
|
+
/**
|
|
26
|
+
* The items dealt into columns, shortest column first.
|
|
27
|
+
*
|
|
28
|
+
* Not CSS `columns`, which fills the first column top to bottom before it
|
|
29
|
+
* starts the second — so a set numbered 1 to 12 reads *down* the left edge, and
|
|
30
|
+
* the first three pictures a reader meets are stacked on top of each other.
|
|
31
|
+
* Dealt this way the first row is items 1, 2 and 3, which is the order they
|
|
32
|
+
* were given in.
|
|
33
|
+
*
|
|
34
|
+
* The heights are the ratios rather than anything measured, which is what makes
|
|
35
|
+
* this run on the server and hold still while the files arrive.
|
|
36
|
+
*/
|
|
37
|
+
export declare function dealColumns(ratios: readonly number[], columns: number): number[][];
|
|
38
|
+
/**
|
|
39
|
+
* One row track of a masonry: a share of the column width, the height of the
|
|
40
|
+
* captions that end there, or the gap.
|
|
41
|
+
*/
|
|
42
|
+
export type PlassMasonryTrack = number | 'caption' | 'gap';
|
|
43
|
+
/** Where one tile sits in a masonry's grid, as `grid-column` and `grid-row` count. */
|
|
44
|
+
export interface PlassMasonryTile {
|
|
45
|
+
/** The lane, from 1. */
|
|
46
|
+
column: number;
|
|
47
|
+
/** The row line the tile starts on. */
|
|
48
|
+
start: number;
|
|
49
|
+
/** The row line it ends on. */
|
|
50
|
+
end: number;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* The same deal as `dealColumns`, written as the rows of one CSS grid rather
|
|
54
|
+
* than as a list per lane.
|
|
55
|
+
*
|
|
56
|
+
* A list per lane put the document in lane order: Tab went 1, 4, 7 through
|
|
57
|
+
* twelve pictures in three lanes, and a tile that changed lane when the count
|
|
58
|
+
* did was a new element, with its picture's state thrown away. Placed in one
|
|
59
|
+
* grid, every tile stays where it was given and only its placement changes.
|
|
60
|
+
* The web build needs this and the Dart build does not, because a Flutter
|
|
61
|
+
* layout is not a document.
|
|
62
|
+
*
|
|
63
|
+
* Every edge where a tile ends, in any lane, is a row line. The track up to it
|
|
64
|
+
* is a share, sized in `fr` by its distance from the edge before, in column
|
|
65
|
+
* widths. In a grid whose height is its content every `fr` then comes out one
|
|
66
|
+
* column width long, so a tile spanning its shares is exactly as tall as its
|
|
67
|
+
* picture. After the share come the captions that end on that edge, in a track
|
|
68
|
+
* of their own so their height is not spread over the pictures, and then the
|
|
69
|
+
* gap, when a tile starts there.
|
|
70
|
+
*
|
|
71
|
+
* What a stylesheet cannot know is where an edge in one lane falls among the
|
|
72
|
+
* edges of another once the gaps and captions are added, because that depends
|
|
73
|
+
* on the width. A tile that runs past the end of a tile in another lane spans
|
|
74
|
+
* that tile's caption and gap tracks as well, and is that much taller than its
|
|
75
|
+
* picture.
|
|
76
|
+
*/
|
|
77
|
+
export declare function masonryRows(ratios: readonly number[], columns: number, captions: boolean): {
|
|
78
|
+
tracks: PlassMasonryTrack[];
|
|
79
|
+
tiles: PlassMasonryTile[];
|
|
80
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{isSideways as t,quartersOf as r}from"./image.js";export function ratioOf(t,r){if(void 0===t)return r;if("number"==typeof t)return t>0?t:r;const[n,o]=t.split("/"),e=void 0===o?Number(n):Number(n)/Number(o);return Number.isFinite(e)&&e>0?e:r}export function isTurned(n){return void 0!==n&&t(r(n))}export function shownRatio(t,r){return isTurned(r)?1/t:t}export function dealColumns(t,r){const n=Array.from({length:r},()=>[]),o=new Array(r).fill(0);return t.forEach((t,e)=>{let s=0;for(let t=1;t<r;t+=1)o[t]<o[s]&&(s=t);n[s].push(e),o[s]+=1/t}),n}export function masonryRows(t,r,n){const o=dealColumns(t,r),e=[],s=[],u=[];o.forEach((r,n)=>{let o=0;r.forEach((i,a)=>{o+=1/t[i],e[i]=n,s[i]=o,u[i]=0===a?-1:r[a-1]})});const i=[],a=[];for(const r of t.map((t,r)=>r).sort((t,r)=>s[t]-s[r]))(0===i.length||s[r]-i[i.length-1]>.001)&&i.push(s[r]),a[r]=i.length-1;const f=new Set(u.filter(t=>-1!==t).map(t=>a[t])),c=[],l=[],p=[];i.forEach((t,r)=>{c.push(t-(0===r?0:i[r-1])),n&&c.push("caption"),l[r]=c.length+1,f.has(r)&&c.push("gap"),p[r]=c.length+1});const h=t.map((t,r)=>({column:e[r]+1,start:-1===u[r]?1:p[a[u[r]]],end:l[a[r]]}));return{tracks:c,tiles:h}}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Moves `.plass-glow`'s light to where the pointer is on the surface.
|
|
4
|
+
*
|
|
5
|
+
* Written straight to the element as `--p-mx` and `--p-my` rather than held in
|
|
6
|
+
* state: it runs at pointer rate, and a `setState` here would re-render the
|
|
7
|
+
* tree on every mouse move. It also runs while a finger is down, which is what
|
|
8
|
+
* makes the light follow a drag on a touch screen, where there is no hover and
|
|
9
|
+
* the `:active` layer does the work.
|
|
10
|
+
*
|
|
11
|
+
* `offsetX` and `offsetY` cost nothing, but they are measured from whatever the
|
|
12
|
+
* pointer is over. On a surface whose own element is under the pointer — a
|
|
13
|
+
* button, whose icons ignore the pointer — that is the surface, and they are
|
|
14
|
+
* used as they are. On one that holds other elements the pointer can land on,
|
|
15
|
+
* the position is read against the surface's own box instead.
|
|
16
|
+
*/
|
|
17
|
+
export declare function followPointer(event: React.PointerEvent<HTMLElement>): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function followPointer(t){const e=t.currentTarget;let n=t.nativeEvent.offsetX,o=t.nativeEvent.offsetY;if(t.target!==e){const r=e.getBoundingClientRect();n=t.clientX-r.left,o=t.clientY-r.top}e.style.setProperty("--p-mx",`${n}px`),e.style.setProperty("--p-my",`${o}px`)}
|
package/dist/internal/grid.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The arithmetic and the vocabulary `PlGrid` and `
|
|
2
|
+
* The arithmetic and the vocabulary `PlGrid`, `PlGridItem` and `PlFlex` share.
|
|
3
3
|
*
|
|
4
4
|
* Like `internal/styles.ts` this is the library talking to itself, and it lives
|
|
5
|
-
* here rather than in
|
|
6
|
-
* system in two elements
|
|
5
|
+
* here rather than in any of their folders for one reason: the grid is one
|
|
6
|
+
* system in two elements and neither should have to import the other, and a
|
|
7
|
+
* flex box distributes and aligns its children with the same five words — so a
|
|
8
|
+
* caller who has learned `justify` on one has learned it on all three.
|
|
7
9
|
*
|
|
8
10
|
* What is *not* here is the layout itself. A column width is
|
|
9
11
|
* `(100% + gap) * span / columns - gap`, it has to change at four breakpoints,
|
|
@@ -14,30 +16,7 @@
|
|
|
14
16
|
* file generates. That is the same split the rest of the library makes:
|
|
15
17
|
* per-instance values go in inline custom properties, never in class names.
|
|
16
18
|
*/
|
|
17
|
-
import type
|
|
18
|
-
import type { PlassAlignItems, PlassAlignSelf, PlassBreakpoint, PlassJustify, PlassResponsive } from '../types.js';
|
|
19
|
-
/** Smallest first, which is also the order the media queries have to be in. */
|
|
20
|
-
export declare const breakpoints: readonly PlassBreakpoint[];
|
|
21
|
-
/** A bare value means "from `xs` up"; a map is already per-breakpoint. */
|
|
22
|
-
export declare function breakpointMap<T>(value: PlassResponsive<T> | undefined): Partial<Record<PlassBreakpoint, T>>;
|
|
23
|
-
/**
|
|
24
|
-
* Turns a responsive value into the `--p-{name}-{breakpoint}` slots the CSS
|
|
25
|
-
* reads, emitting only the breakpoints the caller actually named.
|
|
26
|
-
*
|
|
27
|
-
* The gaps are filled in by CSS rather than here: each breakpoint's rule falls
|
|
28
|
-
* back through the ones below it, so `{ md: 6 }` needs one slot and not five.
|
|
29
|
-
* That keeps the inline style on a grid item down to what was asked for.
|
|
30
|
-
*/
|
|
31
|
-
export declare function responsiveSlots<T>(name: string, value: PlassResponsive<T> | undefined, toCss: (value: T) => string): React.CSSProperties;
|
|
32
|
-
/**
|
|
33
|
-
* Fills in the `xs` entry of a partial map with the prop's own default.
|
|
34
|
-
*
|
|
35
|
-
* Without this, `spacing={{ md: 4 }}` would be a grid with no gutter at all
|
|
36
|
-
* below 48rem — the CSS fallback rather than the documented default — and a
|
|
37
|
-
* caller who narrowed one breakpoint would silently lose every other one. A map
|
|
38
|
-
* says "from here up, use this instead"; it does not say "and nothing below".
|
|
39
|
-
*/
|
|
40
|
-
export declare function withBaseline<T>(value: PlassResponsive<T> | undefined, baseline: T): PlassResponsive<T>;
|
|
19
|
+
import type { PlassAlignItems, PlassAlignSelf, PlassJustify } from '../types.js';
|
|
41
20
|
/**
|
|
42
21
|
* A count of columns, as a plain number for `calc()` to divide by.
|
|
43
22
|
*
|
package/dist/internal/grid.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export function columnCount(t){return String(Math.max(1,Math.round(t)))}export function columnUnits(t,e){return String(Math.max(e,Math.round(t)))}export const spanValue=t=>columnUnits(t,1);export const offsetValue=t=>columnUnits(t,0);export function spacingValue(t){const e=.25*Math.max(0,t);return`${Number(e.toFixed(5))}rem`}export const justifyClasses={start:"justify-start",center:"justify-center",end:"justify-end","space-between":"justify-between","space-around":"justify-around","space-evenly":"justify-evenly",stretch:"justify-stretch"};export const alignItemsClasses={start:"items-start",center:"items-center",end:"items-end",stretch:"items-stretch",baseline:"items-baseline"};export const alignContentClasses={start:"content-start",center:"content-center",end:"content-end","space-between":"content-between","space-around":"content-around","space-evenly":"content-evenly",stretch:"content-stretch"};export const alignSelfClasses={auto:"self-auto",start:"self-start",center:"self-center",end:"self-end",stretch:"self-stretch",baseline:"self-baseline"};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The grammar engine behind [PlCodeBlock], and the only thing in the library that
|
|
3
|
+
* is loaded rather than imported.
|
|
4
|
+
*
|
|
5
|
+
* highlight.js is the second runtime dependency Plass has, and it is here for a
|
|
6
|
+
* reason no amount of hand-written regex answers: colouring a language means
|
|
7
|
+
* knowing that language, and there are thirty-five of them. It is reached
|
|
8
|
+
* through `highlight.js/lib/core` plus one module per language — never through
|
|
9
|
+
* the package root, which is all hundred and ninety at once.
|
|
10
|
+
*
|
|
11
|
+
* **Every one of those specifiers is 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 imports `PlCodeBlock` and never highlights anything — a
|
|
14
|
+
* one-line `npm install` with `highlight={false}` — downloads none of it, and a
|
|
15
|
+
* page that highlights TypeScript downloads the core and TypeScript and not the
|
|
16
|
+
* other thirty-four. A component that does the same with a static import
|
|
17
|
+
* spends forty kilobytes before it has drawn a character.
|
|
18
|
+
*
|
|
19
|
+
* The dependency is a real `dependencies` entry rather than an optional peer
|
|
20
|
+
* because a specifier a bundler cannot resolve fails the *whole* build, not
|
|
21
|
+
* just the part that would have used it: Rollup walks and resolves
|
|
22
|
+
* `PlCodeBlock.js` while it is still deciding whether to keep it. An optional peer
|
|
23
|
+
* would mean `import { PlButton } from 'plass-ui'` breaking for anyone who had
|
|
24
|
+
* not installed a syntax highlighter.
|
|
25
|
+
*
|
|
26
|
+
* What comes back out of here is not HTML. highlight.js emits a string of
|
|
27
|
+
* nested `<span>`s, and PlCodeBlock needs lines — a line is what carries a
|
|
28
|
+
* number, a prompt and a place in a scroll — so `tokenize` turns that string
|
|
29
|
+
* into runs of text with a class on them, split at every newline. That also
|
|
30
|
+
* means nothing in the library ever writes `dangerouslySetInnerHTML`.
|
|
31
|
+
*/
|
|
32
|
+
/** One run of text with a single colour: the innermost span highlight.js drew. */
|
|
33
|
+
export interface PlCodeToken {
|
|
34
|
+
text: string;
|
|
35
|
+
/** The class highlight.js put on it — `hljs-keyword`, `hljs-title function_`. */
|
|
36
|
+
token?: string;
|
|
37
|
+
}
|
|
38
|
+
/** One line of code, as the runs it is made of. An empty array is a blank line. */
|
|
39
|
+
export type PlCodeLine = PlCodeToken[];
|
|
40
|
+
/** The core, and what it hands `registerLanguage`. Opaque here; only hljs reads them. */
|
|
41
|
+
type Hljs = typeof import('highlight.js/lib/core').default;
|
|
42
|
+
type LanguageDefinition = Parameters<Hljs['registerLanguage']>[1];
|
|
43
|
+
/**
|
|
44
|
+
* Teaches CodeBlock a language the built-in set does not have.
|
|
45
|
+
*
|
|
46
|
+
* The same arrangement `src/locales/` makes for the languages the library's own
|
|
47
|
+
* words are not translated into, and for the same reason: highlight.js knows a
|
|
48
|
+
* hundred and ninety grammars, a documentation site uses six, and the
|
|
49
|
+
* thirty-five here are a guess at which six. Registering is how a Nix flake or
|
|
50
|
+
* an Elixir project gets coloured without the other hundred and fifty being in
|
|
51
|
+
* anyone's build.
|
|
52
|
+
*
|
|
53
|
+
* ```ts
|
|
54
|
+
* import { registerLanguage } from 'plass-ui';
|
|
55
|
+
* import elixir from 'highlight.js/lib/languages/elixir';
|
|
56
|
+
*
|
|
57
|
+
* registerLanguage('elixir', elixir);
|
|
58
|
+
* ```
|
|
59
|
+
*
|
|
60
|
+
* Call it at module scope. A language registered after a block has drawn does
|
|
61
|
+
* not repaint that block — nothing re-renders on its own — but every block
|
|
62
|
+
* mounted after it sees it.
|
|
63
|
+
*
|
|
64
|
+
* @param name What `language` will be written as. Registering a name the
|
|
65
|
+
* library already has replaces it.
|
|
66
|
+
* @param definition The default export of a `highlight.js/lib/languages/*`
|
|
67
|
+
* module.
|
|
68
|
+
*/
|
|
69
|
+
export declare function registerLanguage(name: string, definition: LanguageDefinition): void;
|
|
70
|
+
/** The canonical name a caller's spelling means, whether or not it can be loaded. */
|
|
71
|
+
export declare function canonicalLanguage(language: string | undefined): string | null;
|
|
72
|
+
/**
|
|
73
|
+
* Colours `code`, or returns `null` when the language is unknown or the chunk
|
|
74
|
+
* has not arrived yet.
|
|
75
|
+
*
|
|
76
|
+
* Highlighting the block as a whole and splitting afterwards, never line by
|
|
77
|
+
* line: a block comment, a template literal and a heredoc all span lines, and a
|
|
78
|
+
* highlighter handed one line at a time sees the second line of a comment as
|
|
79
|
+
* code.
|
|
80
|
+
*/
|
|
81
|
+
export declare function highlight(code: string, language: string): Promise<PlCodeLine[] | null>;
|
|
82
|
+
/**
|
|
83
|
+
* highlight.js's own markup, as lines of coloured runs.
|
|
84
|
+
*
|
|
85
|
+
* The output is a strictly nested tree of `<span class="…">` with escaped text
|
|
86
|
+
* between, and a span may cross a newline — which is exactly why this exists
|
|
87
|
+
* rather than a `split('\n')` over the string. Walking it keeps the open class
|
|
88
|
+
* across the break and reopens it on the next line.
|
|
89
|
+
*
|
|
90
|
+
* Only the innermost class survives a nesting. In the browser it is the one on
|
|
91
|
+
* the element the text actually sits in, so it is the one whose colour applies;
|
|
92
|
+
* keeping the ancestors would put two equally specific rules on one run and let
|
|
93
|
+
* stylesheet order decide the colour.
|
|
94
|
+
*/
|
|
95
|
+
export declare function tokenize(html: string): PlCodeLine[];
|
|
96
|
+
/** The same shape with no colour in it: what a block draws before its chunk lands. */
|
|
97
|
+
export declare function plainLines(code: string): PlCodeLine[];
|
|
98
|
+
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"),dart:()=>import("highlight.js/lib/languages/dart"),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",gql:"graphql",golang:"go",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;export function registerLanguage(i,t){const g=i.toLowerCase();l.set(g,t),s.delete(g)}let g=null;const s=new Map;export function canonicalLanguage(i){if(!i)return null;const g=i.trim().toLowerCase();return g?l.has(g)?g:t[g]??g:null}export async function highlight(t,a){let e=s.get(a);e||(e=async function prepare(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;return h&&g?tokenize((await g).highlight(t,{language:h,ignoreIllegals:!0}).value):null}const a={"&":"&","<":"<",">":">",""":'"',"'":"'"};export function tokenize(i){const t=[[]],l=[],g=/<span class="([^"]*)">|<\/span>/g;let s=0;const push=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))push(i.slice(s,t.index)),s=t.index+t[0].length,void 0===t[1]?l.pop():l.push(t[1]);return push(i.slice(s)),t}export function plainLines(i){return i.split("\n").map(i=>i?[{text:i}]:[])}
|
package/dist/internal/icons.d.ts
CHANGED
|
@@ -39,6 +39,16 @@ export declare function ArrowRightIcon(): React.ReactElement;
|
|
|
39
39
|
export declare function EllipsisIcon(): React.ReactElement;
|
|
40
40
|
/** The tick: a chosen option, a ticked menu item, a checked box. */
|
|
41
41
|
export declare function CheckIcon(): React.ReactElement;
|
|
42
|
+
/**
|
|
43
|
+
* The clipboard: one sheet behind another, which is what copying is.
|
|
44
|
+
*
|
|
45
|
+
* `PlCodeBlock`'s bar draws it, and it turns into the tick above once the
|
|
46
|
+
* clipboard has taken the code — the same tick a chosen option wears, because
|
|
47
|
+
* "it worked" is one mark in this library and not two.
|
|
48
|
+
*/
|
|
49
|
+
export declare function CopyIcon(): React.ReactElement;
|
|
50
|
+
/** The angle brackets: the toggle that drops the colouring off a code block. */
|
|
51
|
+
export declare function CodeIcon(): React.ReactElement;
|
|
42
52
|
/**
|
|
43
53
|
* The two steppers' marks.
|
|
44
54
|
*
|