flikkui 0.1.0-beta.2
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/dist/_virtual/jsx-runtime.js +5 -0
- package/dist/_virtual/jsx-runtime2.js +3 -0
- package/dist/_virtual/react-jsx-runtime.development.js +3 -0
- package/dist/_virtual/react-jsx-runtime.production.js +3 -0
- package/dist/components/charts/AreaChart/AreaChart.d.ts +3 -0
- package/dist/components/charts/AreaChart/AreaChart.types.d.ts +32 -0
- package/dist/components/charts/AreaChart/index.d.ts +2 -0
- package/dist/components/charts/BarChart/BarChart.d.ts +3 -0
- package/dist/components/charts/BarChart/BarChart.types.d.ts +26 -0
- package/dist/components/charts/BarChart/index.d.ts +2 -0
- package/dist/components/charts/ChartContainer.d.ts +9 -0
- package/dist/components/charts/DonutChart/DonutChart.d.ts +7 -0
- package/dist/components/charts/DonutChart/DonutChart.theme.d.ts +164 -0
- package/dist/components/charts/DonutChart/DonutChart.types.d.ts +113 -0
- package/dist/components/charts/Heatmap/Heatmap.d.ts +7 -0
- package/dist/components/charts/Heatmap/Heatmap.types.d.ts +151 -0
- package/dist/components/charts/Heatmap/HeatmapCell.d.ts +6 -0
- package/dist/components/charts/Heatmap/HeatmapLegend.d.ts +20 -0
- package/dist/components/charts/Heatmap/index.d.ts +6 -0
- package/dist/components/charts/Heatmap/utils/heatmapUtils.d.ts +30 -0
- package/dist/components/charts/LineChart/LineChart.d.ts +3 -0
- package/dist/components/charts/LineChart/LineChart.types.d.ts +27 -0
- package/dist/components/charts/LineChart/index.d.ts +2 -0
- package/dist/components/charts/hooks/index.d.ts +4 -0
- package/dist/components/charts/hooks/useChartAccessibility.d.ts +39 -0
- package/dist/components/charts/hooks/useChartTheme.d.ts +16 -0
- package/dist/components/charts/hooks/useChartValidation.d.ts +74 -0
- package/dist/components/charts/hooks/useTooltipPosition.d.ts +98 -0
- package/dist/components/charts/index.d.ts +35 -0
- package/dist/components/charts/shared/ChartAxis/ChartAxis.types.d.ts +90 -0
- package/dist/components/charts/shared/ChartAxis/XAxis.d.ts +7 -0
- package/dist/components/charts/shared/ChartAxis/YAxis.d.ts +7 -0
- package/dist/components/charts/shared/ChartAxis/index.d.ts +3 -0
- package/dist/components/charts/shared/ChartCrosshair/ChartCrosshair.d.ts +7 -0
- package/dist/components/charts/shared/ChartCrosshair/ChartCrosshair.theme.d.ts +6 -0
- package/dist/components/charts/shared/ChartCrosshair/ChartCrosshair.types.d.ts +35 -0
- package/dist/components/charts/shared/ChartCrosshair/index.d.ts +3 -0
- package/dist/components/charts/shared/ChartErrorBoundary/ChartErrorBoundary.d.ts +34 -0
- package/dist/components/charts/shared/ChartErrorBoundary/index.d.ts +1 -0
- package/dist/components/charts/shared/ChartGrid/HorizontalGrid.d.ts +26 -0
- package/dist/components/charts/shared/ChartGrid/index.d.ts +2 -0
- package/dist/components/charts/shared/ChartLegend/ChartLegend.types.d.ts +15 -0
- package/dist/components/charts/shared/ChartLegend/index.d.ts +1 -0
- package/dist/components/charts/shared/ChartMarker/ChartMarker.d.ts +7 -0
- package/dist/components/charts/shared/ChartMarker/ChartMarker.theme.d.ts +6 -0
- package/dist/components/charts/shared/ChartMarker/ChartMarker.types.d.ts +21 -0
- package/dist/components/charts/shared/ChartMarker/index.d.ts +3 -0
- package/dist/components/charts/shared/ChartText/ChartText.d.ts +7 -0
- package/dist/components/charts/shared/ChartText/ChartText.theme.d.ts +6 -0
- package/dist/components/charts/shared/ChartText/ChartText.types.d.ts +21 -0
- package/dist/components/charts/shared/ChartText/index.d.ts +2 -0
- package/dist/components/charts/shared/ChartTooltip/ChartTooltip.d.ts +19 -0
- package/dist/components/charts/shared/ChartTooltip/ChartTooltip.types.d.ts +48 -0
- package/dist/components/charts/shared/ChartTooltip/ChartTooltipContent.d.ts +3 -0
- package/dist/components/charts/shared/ChartTooltip/index.d.ts +3 -0
- package/dist/components/charts/shared/index.d.ts +7 -0
- package/dist/components/charts/theme/chart.theme.d.ts +6 -0
- package/dist/components/charts/types/chart.types.d.ts +171 -0
- package/dist/components/charts/utils/chart-validation.d.ts +79 -0
- package/dist/components/charts/utils/color-utils.d.ts +78 -0
- package/dist/components/charts/utils/index.d.ts +2 -0
- package/dist/components/core/Accordion/Accordion.animations.d.ts +9 -0
- package/dist/components/core/Accordion/Accordion.d.ts +12 -0
- package/dist/components/core/Accordion/Accordion.theme.d.ts +7 -0
- package/dist/components/core/Accordion/Accordion.types.d.ts +93 -0
- package/dist/components/core/Accordion/AccordionContent.d.ts +3 -0
- package/dist/components/core/Accordion/AccordionItem.d.ts +4 -0
- package/dist/components/core/Accordion/AccordionTrigger.d.ts +3 -0
- package/dist/components/core/Accordion/index.d.ts +5 -0
- package/dist/components/core/Avatar/Avatar.d.ts +4 -0
- package/dist/components/core/Avatar/Avatar.theme.d.ts +14 -0
- package/dist/components/core/Avatar/Avatar.types.d.ts +64 -0
- package/dist/components/core/Avatar/index.d.ts +2 -0
- package/dist/components/core/AvatarGroup/AvatarGroup.animations.d.ts +12 -0
- package/dist/components/core/AvatarGroup/AvatarGroup.d.ts +4 -0
- package/dist/components/core/AvatarGroup/AvatarGroup.theme.d.ts +14 -0
- package/dist/components/core/AvatarGroup/AvatarGroup.types.d.ts +44 -0
- package/dist/components/core/AvatarGroup/index.d.ts +2 -0
- package/dist/components/core/Badge/Badge.animations.d.ts +8 -0
- package/dist/components/core/Badge/Badge.d.ts +14 -0
- package/dist/components/core/Badge/Badge.theme.d.ts +5 -0
- package/dist/components/core/Badge/Badge.types.d.ts +98 -0
- package/dist/components/core/Badge/index.d.ts +2 -0
- package/dist/components/core/Breadcrumbs/Breadcrumbs.d.ts +17 -0
- package/dist/components/core/Breadcrumbs/Breadcrumbs.js +101 -0
- package/dist/components/core/Breadcrumbs/Breadcrumbs.theme.d.ts +17 -0
- package/dist/components/core/Breadcrumbs/Breadcrumbs.theme.js +34 -0
- package/dist/components/core/Breadcrumbs/Breadcrumbs.types.d.ts +69 -0
- package/dist/components/core/Breadcrumbs/index.d.ts +4 -0
- package/dist/components/core/Button/Button.animations.d.ts +17 -0
- package/dist/components/core/Button/Button.animations.js +35 -0
- package/dist/components/core/Button/Button.d.ts +4 -0
- package/dist/components/core/Button/Button.js +72 -0
- package/dist/components/core/Button/Button.theme.d.ts +24 -0
- package/dist/components/core/Button/Button.theme.js +41 -0
- package/dist/components/core/Button/Button.types.d.ts +29 -0
- package/dist/components/core/Button/index.d.ts +2 -0
- package/dist/components/core/Calendar/CalendarEvent/CalendarEvent.d.ts +4 -0
- package/dist/components/core/Calendar/CalendarEvent/CalendarEvent.theme.d.ts +12 -0
- package/dist/components/core/Calendar/CalendarEvent/CalendarEvent.types.d.ts +24 -0
- package/dist/components/core/Calendar/CalendarEvent/index.d.ts +2 -0
- package/dist/components/core/Calendar/DayView/DayViewCell.d.ts +20 -0
- package/dist/components/core/Calendar/MonthView/MonthView.d.ts +2 -0
- package/dist/components/core/Calendar/MonthView/components/CalendarCell/CalendarCell.d.ts +4 -0
- package/dist/components/core/Calendar/MonthView/components/CalendarCell/CalendarCell.theme.d.ts +29 -0
- package/dist/components/core/Calendar/MonthView/components/CalendarCell/CalendarCell.types.d.ts +41 -0
- package/dist/components/core/Calendar/MonthView/components/CalendarCell/index.d.ts +3 -0
- package/dist/components/core/Calendar/MonthView/components/MontViewHeader/MonthViewHeader.d.ts +2 -0
- package/dist/components/core/Card/Card.d.ts +8 -0
- package/dist/components/core/Card/Card.theme.d.ts +2 -0
- package/dist/components/core/Card/Card.types.d.ts +48 -0
- package/dist/components/core/Card/index.d.ts +2 -0
- package/dist/components/core/Carousel/Carousel.animations.d.ts +33 -0
- package/dist/components/core/Carousel/Carousel.animations.js +353 -0
- package/dist/components/core/Carousel/Carousel.d.ts +3 -0
- package/dist/components/core/Carousel/Carousel.js +94 -0
- package/dist/components/core/Carousel/Carousel.theme.d.ts +2 -0
- package/dist/components/core/Carousel/Carousel.theme.js +16 -0
- package/dist/components/core/Carousel/Carousel.types.d.ts +164 -0
- package/dist/components/core/Carousel/CarouselContext.d.ts +3 -0
- package/dist/components/core/Carousel/CarouselContext.js +12 -0
- package/dist/components/core/Carousel/components/CarouselControlButton.d.ts +4 -0
- package/dist/components/core/Carousel/components/CarouselControlButton.js +26 -0
- package/dist/components/core/Carousel/components/CarouselControls.d.ts +4 -0
- package/dist/components/core/Carousel/components/CarouselControls.js +17 -0
- package/dist/components/core/Carousel/components/CarouselSlide.d.ts +4 -0
- package/dist/components/core/Carousel/components/CarouselSlide.js +74 -0
- package/dist/components/core/Carousel/components/index.d.ts +3 -0
- package/dist/components/core/Carousel/index.d.ts +4 -0
- package/dist/components/core/Carousel/index.js +5 -0
- package/dist/components/core/Divider/Divider.d.ts +3 -0
- package/dist/components/core/Divider/Divider.theme.d.ts +2 -0
- package/dist/components/core/Divider/Divider.types.d.ts +34 -0
- package/dist/components/core/Divider/index.d.ts +2 -0
- package/dist/components/core/Drawer/Drawer.animations.d.ts +10 -0
- package/dist/components/core/Drawer/Drawer.animations.js +104 -0
- package/dist/components/core/Drawer/Drawer.d.ts +21 -0
- package/dist/components/core/Drawer/Drawer.js +80 -0
- package/dist/components/core/Drawer/Drawer.theme.d.ts +30 -0
- package/dist/components/core/Drawer/Drawer.theme.js +37 -0
- package/dist/components/core/Drawer/Drawer.types.d.ts +56 -0
- package/dist/components/core/Drawer/DrawerBody.d.ts +6 -0
- package/dist/components/core/Drawer/DrawerBody.js +13 -0
- package/dist/components/core/Drawer/DrawerFooter.d.ts +6 -0
- package/dist/components/core/Drawer/DrawerFooter.js +13 -0
- package/dist/components/core/Drawer/DrawerHeader.d.ts +6 -0
- package/dist/components/core/Drawer/DrawerHeader.js +18 -0
- package/dist/components/core/Drawer/index.d.ts +2 -0
- package/dist/components/core/Modal/Modal.animations.d.ts +9 -0
- package/dist/components/core/Modal/Modal.animations.js +51 -0
- package/dist/components/core/Modal/Modal.d.ts +21 -0
- package/dist/components/core/Modal/Modal.js +74 -0
- package/dist/components/core/Modal/Modal.theme.d.ts +9 -0
- package/dist/components/core/Modal/Modal.theme.js +19 -0
- package/dist/components/core/Modal/Modal.types.d.ts +53 -0
- package/dist/components/core/Modal/ModalBody.d.ts +6 -0
- package/dist/components/core/Modal/ModalBody.js +13 -0
- package/dist/components/core/Modal/ModalFooter.d.ts +6 -0
- package/dist/components/core/Modal/ModalFooter.js +13 -0
- package/dist/components/core/Modal/ModalHeader.d.ts +6 -0
- package/dist/components/core/Modal/ModalHeader.js +18 -0
- package/dist/components/core/Modal/index.d.ts +2 -0
- package/dist/components/core/Pagination/Pagination.d.ts +7 -0
- package/dist/components/core/Pagination/Pagination.theme.d.ts +23 -0
- package/dist/components/core/Pagination/Pagination.types.d.ts +57 -0
- package/dist/components/core/Pagination/index.d.ts +2 -0
- package/dist/components/core/Popover/Popover.animations.d.ts +5 -0
- package/dist/components/core/Popover/Popover.d.ts +25 -0
- package/dist/components/core/Popover/Popover.js +68 -0
- package/dist/components/core/Popover/Popover.theme.d.ts +12 -0
- package/dist/components/core/Popover/Popover.theme.js +13 -0
- package/dist/components/core/Popover/Popover.types.d.ts +53 -0
- package/dist/components/core/Popover/PopoverContent.d.ts +7 -0
- package/dist/components/core/Popover/PopoverContent.js +190 -0
- package/dist/components/core/Popover/PopoverContext.d.ts +4 -0
- package/dist/components/core/Popover/PopoverContext.js +14 -0
- package/dist/components/core/Popover/PopoverTrigger.d.ts +3 -0
- package/dist/components/core/Popover/PopoverTrigger.js +65 -0
- package/dist/components/core/Popover/index.d.ts +6 -0
- package/dist/components/core/Popover/index.js +6 -0
- package/dist/components/core/Popover/test-popover.d.ts +3 -0
- package/dist/components/core/ProgressiveBlur/ProgressiveBlur.d.ts +4 -0
- package/dist/components/core/ProgressiveBlur/ProgressiveBlur.js +35 -0
- package/dist/components/core/ProgressiveBlur/ProgressiveBlur.theme.d.ts +15 -0
- package/dist/components/core/ProgressiveBlur/ProgressiveBlur.theme.js +17 -0
- package/dist/components/core/ProgressiveBlur/ProgressiveBlur.types.d.ts +42 -0
- package/dist/components/core/ProgressiveBlur/index.d.ts +2 -0
- package/dist/components/core/Segmented/Segmented.d.ts +6 -0
- package/dist/components/core/Segmented/Segmented.theme.d.ts +30 -0
- package/dist/components/core/Segmented/Segmented.types.d.ts +35 -0
- package/dist/components/core/Segmented/SegmentedContext.d.ts +16 -0
- package/dist/components/core/Segmented/SegmentedItem.d.ts +4 -0
- package/dist/components/core/Segmented/index.d.ts +4 -0
- package/dist/components/core/Stepper/Stepper.animations.d.ts +9 -0
- package/dist/components/core/Stepper/Stepper.d.ts +21 -0
- package/dist/components/core/Stepper/Stepper.theme.d.ts +36 -0
- package/dist/components/core/Stepper/Stepper.types.d.ts +29 -0
- package/dist/components/core/Stepper/components/ConnectorLine.d.ts +21 -0
- package/dist/components/core/Stepper/components/IconCircle.d.ts +19 -0
- package/dist/components/core/Stepper/components/ProgressIndicator.d.ts +7 -0
- package/dist/components/core/Stepper/components/StepContent.d.ts +20 -0
- package/dist/components/core/Stepper/components/StepperItem.d.ts +24 -0
- package/dist/components/core/Stepper/index.d.ts +2 -0
- package/dist/components/core/Tabs/Tabs.d.ts +8 -0
- package/dist/components/core/Tabs/Tabs.js +52 -0
- package/dist/components/core/Tabs/Tabs.theme.d.ts +52 -0
- package/dist/components/core/Tabs/Tabs.theme.js +70 -0
- package/dist/components/core/Tabs/Tabs.types.d.ts +100 -0
- package/dist/components/core/Tabs/TabsContent.d.ts +6 -0
- package/dist/components/core/Tabs/TabsContent.js +29 -0
- package/dist/components/core/Tabs/TabsContext.d.ts +10 -0
- package/dist/components/core/Tabs/TabsContext.js +18 -0
- package/dist/components/core/Tabs/TabsList.d.ts +6 -0
- package/dist/components/core/Tabs/TabsList.js +24 -0
- package/dist/components/core/Tabs/TabsTrigger.d.ts +6 -0
- package/dist/components/core/Tabs/TabsTrigger.js +84 -0
- package/dist/components/core/Tabs/index.d.ts +9 -0
- package/dist/components/core/Tabs/index.js +9 -0
- package/dist/components/core/Tabs/test-tabs.d.ts +3 -0
- package/dist/components/core/Tooltip/Tooltip.animations.d.ts +32 -0
- package/dist/components/core/Tooltip/Tooltip.d.ts +7 -0
- package/dist/components/core/Tooltip/Tooltip.theme.d.ts +8 -0
- package/dist/components/core/Tooltip/Tooltip.types.d.ts +81 -0
- package/dist/components/core/Tooltip/index.d.ts +3 -0
- package/dist/components/core/Tree/Tree.animations.d.ts +5 -0
- package/dist/components/core/Tree/Tree.d.ts +2 -0
- package/dist/components/core/Tree/Tree.theme.d.ts +2 -0
- package/dist/components/core/Tree/Tree.types.d.ts +101 -0
- package/dist/components/core/Tree/TreeIcon.d.ts +3 -0
- package/dist/components/core/Tree/TreeNode.d.ts +6 -0
- package/dist/components/core/Tree/index.d.ts +5 -0
- package/dist/components/data-display/Masonry/Masonry.d.ts +4 -0
- package/dist/components/data-display/Masonry/Masonry.js +184 -0
- package/dist/components/data-display/Masonry/Masonry.theme.d.ts +9 -0
- package/dist/components/data-display/Masonry/Masonry.theme.js +40 -0
- package/dist/components/data-display/Masonry/Masonry.types.d.ts +53 -0
- package/dist/components/data-display/Masonry/index.d.ts +3 -0
- package/dist/components/data-display/Table/Table.d.ts +54 -0
- package/dist/components/data-display/Table/Table.theme.d.ts +2 -0
- package/dist/components/data-display/Table/Table.types.d.ts +254 -0
- package/dist/components/data-display/Table/Table.utils.d.ts +8 -0
- package/dist/components/data-display/Table/components/DeclarativeComponents.d.ts +7 -0
- package/dist/components/data-display/Table/components/TableActions/TableActions.d.ts +8 -0
- package/dist/components/data-display/Table/components/TableActions/TableActions.types.d.ts +40 -0
- package/dist/components/data-display/Table/components/TableActions/TableActionsMenu.d.ts +6 -0
- package/dist/components/data-display/Table/components/TableActions/index.d.ts +3 -0
- package/dist/components/data-display/Table/components/TableActionsMenu.d.ts +6 -0
- package/dist/components/data-display/Table/components/TableColumnManager/TableColumnManager.d.ts +3 -0
- package/dist/components/data-display/Table/components/TableColumnManager/TableColumnManager.theme.d.ts +4 -0
- package/dist/components/data-display/Table/components/TableColumnManager/index.d.ts +1 -0
- package/dist/components/data-display/Table/components/TableSelectionHeader/TableSelectionHeader.d.ts +16 -0
- package/dist/components/data-display/Table/components/TableSelectionHeader/index.d.ts +3 -0
- package/dist/components/data-display/Table/components/core/TableBody.d.ts +3 -0
- package/dist/components/data-display/Table/components/core/TableCell.d.ts +22 -0
- package/dist/components/data-display/Table/components/core/TableHeader.d.ts +3 -0
- package/dist/components/data-display/Table/components/core/TableRow.d.ts +3 -0
- package/dist/components/data-display/Table/components/core/index.d.ts +4 -0
- package/dist/components/data-display/Table/index.d.ts +18 -0
- package/dist/components/feedback/Alert/Alert.d.ts +3 -0
- package/dist/components/feedback/Alert/Alert.theme.d.ts +2 -0
- package/dist/components/feedback/Alert/Alert.types.d.ts +40 -0
- package/dist/components/feedback/Alert/index.d.ts +3 -0
- package/dist/components/feedback/ChatMessage/ChatMessage.d.ts +3 -0
- package/dist/components/feedback/ChatMessage/ChatMessage.theme.d.ts +2 -0
- package/dist/components/feedback/ChatMessage/ChatMessage.types.d.ts +66 -0
- package/dist/components/feedback/ChatMessage/index.d.ts +2 -0
- package/dist/components/feedback/Empty/Empty.d.ts +4 -0
- package/dist/components/feedback/Empty/Empty.theme.d.ts +22 -0
- package/dist/components/feedback/Empty/Empty.types.d.ts +40 -0
- package/dist/components/feedback/Empty/index.d.ts +3 -0
- package/dist/components/feedback/Notification/Notification.d.ts +3 -0
- package/dist/components/feedback/Notification/Notification.theme.d.ts +2 -0
- package/dist/components/feedback/Notification/Notification.types.d.ts +55 -0
- package/dist/components/feedback/Notification/index.d.ts +3 -0
- package/dist/components/feedback/Spinner/Spinner.d.ts +4 -0
- package/dist/components/feedback/Spinner/Spinner.js +14 -0
- package/dist/components/feedback/Spinner/Spinner.theme.d.ts +15 -0
- package/dist/components/feedback/Spinner/Spinner.theme.js +26 -0
- package/dist/components/feedback/Spinner/Spinner.types.d.ts +31 -0
- package/dist/components/feedback/Spinner/index.d.ts +2 -0
- package/dist/components/feedback/Toast/Toast.d.ts +3 -0
- package/dist/components/feedback/Toast/Toast.theme.d.ts +2 -0
- package/dist/components/feedback/Toast/Toast.types.d.ts +99 -0
- package/dist/components/feedback/Toast/ToastProvider.d.ts +4 -0
- package/dist/components/feedback/Toast/index.d.ts +5 -0
- package/dist/components/feedback/Toast/useToast.d.ts +2 -0
- package/dist/components/feedback/index.d.ts +11 -0
- package/dist/components/forms/Checkbox/Checkbox.d.ts +7 -0
- package/dist/components/forms/Checkbox/Checkbox.js +51 -0
- package/dist/components/forms/Checkbox/Checkbox.theme.d.ts +5 -0
- package/dist/components/forms/Checkbox/Checkbox.theme.js +13 -0
- package/dist/components/forms/Checkbox/Checkbox.types.d.ts +52 -0
- package/dist/components/forms/Checkbox/index.d.ts +3 -0
- package/dist/components/forms/DatePicker/DatePicker.animations.d.ts +34 -0
- package/dist/components/forms/DatePicker/DatePicker.d.ts +4 -0
- package/dist/components/forms/DatePicker/DatePicker.theme.d.ts +6 -0
- package/dist/components/forms/DatePicker/DatePicker.types.d.ts +106 -0
- package/dist/components/forms/DatePicker/components/CalendarHeader/CalendarHeader.d.ts +7 -0
- package/dist/components/forms/DatePicker/components/CalendarHeader/CalendarHeader.theme.d.ts +6 -0
- package/dist/components/forms/DatePicker/components/CalendarHeader/CalendarHeader.types.d.ts +42 -0
- package/dist/components/forms/DatePicker/components/CalendarHeader/index.d.ts +3 -0
- package/dist/components/forms/DatePicker/components/DateInput/DateInput.d.ts +7 -0
- package/dist/components/forms/DatePicker/components/DateInput/DateInput.types.d.ts +25 -0
- package/dist/components/forms/DatePicker/components/DateInput/index.d.ts +2 -0
- package/dist/components/forms/DatePicker/components/MonthPicker/MonthPicker.d.ts +7 -0
- package/dist/components/forms/DatePicker/components/MonthPicker/MonthPicker.theme.d.ts +6 -0
- package/dist/components/forms/DatePicker/components/MonthPicker/MonthPicker.types.d.ts +64 -0
- package/dist/components/forms/DatePicker/components/MonthPicker/index.d.ts +3 -0
- package/dist/components/forms/DatePicker/components/YearPicker/YearPicker.d.ts +7 -0
- package/dist/components/forms/DatePicker/components/YearPicker/YearPicker.theme.d.ts +6 -0
- package/dist/components/forms/DatePicker/components/YearPicker/YearPicker.types.d.ts +62 -0
- package/dist/components/forms/DatePicker/components/YearPicker/index.d.ts +3 -0
- package/dist/components/forms/DatePicker/components/index.d.ts +8 -0
- package/dist/components/forms/DatePicker/index.d.ts +5 -0
- package/dist/components/forms/DateRangePicker/DateRangePicker.d.ts +7 -0
- package/dist/components/forms/DateRangePicker/DateRangePicker.theme.d.ts +6 -0
- package/dist/components/forms/DateRangePicker/DateRangePicker.types.d.ts +129 -0
- package/dist/components/forms/DateRangePicker/index.d.ts +3 -0
- package/dist/components/forms/FormLabel/FormLabel.d.ts +7 -0
- package/dist/components/forms/FormLabel/FormLabel.js +23 -0
- package/dist/components/forms/FormLabel/FormLabel.theme.d.ts +6 -0
- package/dist/components/forms/FormLabel/FormLabel.theme.js +17 -0
- package/dist/components/forms/FormLabel/FormLabel.types.d.ts +36 -0
- package/dist/components/forms/FormLabel/index.d.ts +3 -0
- package/dist/components/forms/Input/Input.AdvancedStories.d.ts +13 -0
- package/dist/components/forms/Input/Input.d.ts +4 -0
- package/dist/components/forms/Input/Input.js +346 -0
- package/dist/components/forms/Input/Input.theme.d.ts +7 -0
- package/dist/components/forms/Input/Input.theme.js +82 -0
- package/dist/components/forms/Input/Input.types.d.ts +162 -0
- package/dist/components/forms/Input/index.d.ts +3 -0
- package/dist/components/forms/Input/inputMasks.d.ts +67 -0
- package/dist/components/forms/Input/inputMasks.js +198 -0
- package/dist/components/forms/InputAddress/InputAddress.d.ts +19 -0
- package/dist/components/forms/InputAddress/InputAddress.js +77 -0
- package/dist/components/forms/InputAddress/InputAddress.theme.d.ts +26 -0
- package/dist/components/forms/InputAddress/InputAddress.theme.js +30 -0
- package/dist/components/forms/InputAddress/InputAddress.types.d.ts +93 -0
- package/dist/components/forms/InputAddress/index.d.ts +3 -0
- package/dist/components/forms/InputCreditCard/InputCreditCard.animations.d.ts +9 -0
- package/dist/components/forms/InputCreditCard/InputCreditCard.d.ts +19 -0
- package/dist/components/forms/InputCreditCard/InputCreditCard.theme.d.ts +31 -0
- package/dist/components/forms/InputCreditCard/InputCreditCard.types.d.ts +88 -0
- package/dist/components/forms/InputCreditCard/index.d.ts +4 -0
- package/dist/components/forms/InputOTP/InputOTP.d.ts +18 -0
- package/dist/components/forms/InputOTP/InputOTP.js +177 -0
- package/dist/components/forms/InputOTP/InputOTP.theme.d.ts +2 -0
- package/dist/components/forms/InputOTP/InputOTP.theme.js +11 -0
- package/dist/components/forms/InputOTP/InputOTP.types.d.ts +50 -0
- package/dist/components/forms/InputOTP/index.d.ts +3 -0
- package/dist/components/forms/Radio/Radio.d.ts +7 -0
- package/dist/components/forms/Radio/Radio.js +41 -0
- package/dist/components/forms/Radio/Radio.theme.d.ts +21 -0
- package/dist/components/forms/Radio/Radio.theme.js +25 -0
- package/dist/components/forms/Radio/Radio.types.d.ts +51 -0
- package/dist/components/forms/Radio/index.d.ts +3 -0
- package/dist/components/forms/Select/Select.animations.d.ts +5 -0
- package/dist/components/forms/Select/Select.animations.js +30 -0
- package/dist/components/forms/Select/Select.d.ts +22 -0
- package/dist/components/forms/Select/Select.js +277 -0
- package/dist/components/forms/Select/Select.theme.d.ts +6 -0
- package/dist/components/forms/Select/Select.theme.js +55 -0
- package/dist/components/forms/Select/Select.types.d.ts +184 -0
- package/dist/components/forms/Select/index.d.ts +4 -0
- package/dist/components/forms/Signature/Signature.d.ts +3 -0
- package/dist/components/forms/Signature/Signature.js +120 -0
- package/dist/components/forms/Signature/Signature.theme.d.ts +2 -0
- package/dist/components/forms/Signature/Signature.theme.js +8 -0
- package/dist/components/forms/Signature/Signature.types.d.ts +37 -0
- package/dist/components/forms/Signature/index.d.ts +2 -0
- package/dist/components/forms/Slider/Slider.d.ts +4 -0
- package/dist/components/forms/Slider/Slider.theme.d.ts +7 -0
- package/dist/components/forms/Slider/Slider.types.d.ts +131 -0
- package/dist/components/forms/Slider/index.d.ts +3 -0
- package/dist/components/forms/Switch/Switch.d.ts +7 -0
- package/dist/components/forms/Switch/Switch.js +61 -0
- package/dist/components/forms/Switch/Switch.theme.d.ts +34 -0
- package/dist/components/forms/Switch/Switch.theme.js +43 -0
- package/dist/components/forms/Switch/Switch.types.d.ts +66 -0
- package/dist/components/forms/Switch/index.d.ts +3 -0
- package/dist/components/forms/Textarea/Textarea.d.ts +4 -0
- package/dist/components/forms/Textarea/Textarea.js +46 -0
- package/dist/components/forms/Textarea/Textarea.theme.d.ts +7 -0
- package/dist/components/forms/Textarea/Textarea.theme.js +26 -0
- package/dist/components/forms/Textarea/Textarea.types.d.ts +55 -0
- package/dist/components/forms/Textarea/index.d.ts +3 -0
- package/dist/components/forms/TimePicker/TimePicker.animations.d.ts +178 -0
- package/dist/components/forms/TimePicker/TimePicker.animations.js +188 -0
- package/dist/components/forms/TimePicker/TimePicker.d.ts +7 -0
- package/dist/components/forms/TimePicker/TimePicker.js +413 -0
- package/dist/components/forms/TimePicker/TimePicker.theme.d.ts +9 -0
- package/dist/components/forms/TimePicker/TimePicker.theme.js +113 -0
- package/dist/components/forms/TimePicker/TimePicker.types.d.ts +158 -0
- package/dist/components/forms/TimePicker/index.d.ts +4 -0
- package/dist/components/forms/forms.theme.d.ts +49 -0
- package/dist/components/forms/forms.theme.js +61 -0
- package/dist/components/forms/index.d.ts +12 -0
- package/dist/components/layout/DragDrop/DragDrop.d.ts +4 -0
- package/dist/components/layout/DragDrop/DragDrop.theme.d.ts +2 -0
- package/dist/components/layout/DragDrop/DragDrop.types.d.ts +50 -0
- package/dist/components/layout/DragDrop/index.d.ts +2 -0
- package/dist/components/layout/Sortable/Sortable.d.ts +4 -0
- package/dist/components/layout/Sortable/Sortable.theme.d.ts +2 -0
- package/dist/components/layout/Sortable/Sortable.types.d.ts +67 -0
- package/dist/components/layout/Sortable/index.d.ts +2 -0
- package/dist/components/layout/index.d.ts +2 -0
- package/dist/components/navigation/NavItem/NavItem.d.ts +3 -0
- package/dist/components/navigation/NavItem/NavItem.theme.d.ts +2 -0
- package/dist/components/navigation/NavItem/NavItem.types.d.ts +113 -0
- package/dist/components/navigation/NavItem/index.d.ts +2 -0
- package/dist/components/navigation/Sidebar/Sidebar.d.ts +3 -0
- package/dist/components/navigation/Sidebar/Sidebar.theme.d.ts +2 -0
- package/dist/components/navigation/Sidebar/Sidebar.types.d.ts +129 -0
- package/dist/components/navigation/Sidebar/SidebarContent.d.ts +3 -0
- package/dist/components/navigation/Sidebar/SidebarContext.d.ts +17 -0
- package/dist/components/navigation/Sidebar/SidebarFooter.d.ts +3 -0
- package/dist/components/navigation/Sidebar/SidebarHeader.d.ts +3 -0
- package/dist/components/navigation/Sidebar/SidebarNav.d.ts +3 -0
- package/dist/components/navigation/Sidebar/SidebarNavGroup.d.ts +3 -0
- package/dist/components/navigation/Sidebar/SidebarToggle.d.ts +3 -0
- package/dist/components/navigation/Sidebar/index.d.ts +9 -0
- package/dist/components/navigation/index.d.ts +4 -0
- package/dist/icons/Icon.d.ts +17 -0
- package/dist/icons/Icon.js +28 -0
- package/dist/icons/Index.d.ts +16 -0
- package/dist/icons/core/ChevronUpDown.d.ts +1 -0
- package/dist/icons/core/ChevronUpDown.js +10 -0
- package/dist/icons/core/DollarIcon.d.ts +1 -0
- package/dist/icons/core/DollarIcon.js +8 -0
- package/dist/icons/core/LockIcon.d.ts +1 -0
- package/dist/icons/core/LockIcon.js +8 -0
- package/dist/icons/core/MinusIcon.d.ts +1 -0
- package/dist/icons/core/MinusIcon.js +9 -0
- package/dist/icons/core/PlusIcon.d.ts +1 -0
- package/dist/icons/core/PlusIcon.js +10 -0
- package/dist/icons/core/SearchIcon.d.ts +1 -0
- package/dist/icons/core/SearchIcon.js +10 -0
- package/dist/icons/core/TickIcon.d.ts +1 -0
- package/dist/icons/core/TickIcon.js +7 -0
- package/dist/icons/core/User.d.ts +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +40 -0
- package/dist/node_modules/@heroicons/react/20/solid/esm/ChevronRightIcon.js +26 -0
- package/dist/node_modules/@heroicons/react/24/outline/esm/CheckIcon.js +28 -0
- package/dist/node_modules/@heroicons/react/24/outline/esm/ChevronRightIcon.js +28 -0
- package/dist/node_modules/@heroicons/react/24/outline/esm/ChevronUpDownIcon.js +28 -0
- package/dist/node_modules/@heroicons/react/24/outline/esm/ClockIcon.js +28 -0
- package/dist/node_modules/@heroicons/react/24/outline/esm/MinusIcon.js +28 -0
- package/dist/node_modules/@heroicons/react/24/outline/esm/XMarkIcon.js +28 -0
- package/dist/node_modules/@heroicons/react/24/solid/esm/EyeIcon.js +28 -0
- package/dist/node_modules/@heroicons/react/24/solid/esm/EyeSlashIcon.js +28 -0
- package/dist/node_modules/@heroicons/react/24/solid/esm/LockClosedIcon.js +26 -0
- package/dist/node_modules/clsx/dist/clsx.js +3 -0
- package/dist/node_modules/framer-motion/dist/es/animation/animate/single-value.js +11 -0
- package/dist/node_modules/framer-motion/dist/es/animation/animators/waapi/utils/get-final-keyframe.js +11 -0
- package/dist/node_modules/framer-motion/dist/es/animation/hooks/animation-controls.js +80 -0
- package/dist/node_modules/framer-motion/dist/es/animation/hooks/use-animation.js +41 -0
- package/dist/node_modules/framer-motion/dist/es/animation/interfaces/motion-value.js +103 -0
- package/dist/node_modules/framer-motion/dist/es/animation/interfaces/visual-element-target.js +85 -0
- package/dist/node_modules/framer-motion/dist/es/animation/interfaces/visual-element-variant.js +59 -0
- package/dist/node_modules/framer-motion/dist/es/animation/interfaces/visual-element.js +26 -0
- package/dist/node_modules/framer-motion/dist/es/animation/optimized-appear/data-id.js +6 -0
- package/dist/node_modules/framer-motion/dist/es/animation/optimized-appear/get-appear-id.js +7 -0
- package/dist/node_modules/framer-motion/dist/es/animation/utils/calc-child-stagger.js +15 -0
- package/dist/node_modules/framer-motion/dist/es/animation/utils/default-transitions.js +40 -0
- package/dist/node_modules/framer-motion/dist/es/animation/utils/is-animation-controls.js +7 -0
- package/dist/node_modules/framer-motion/dist/es/animation/utils/is-keyframes-target.js +5 -0
- package/dist/node_modules/framer-motion/dist/es/animation/utils/is-transition-defined.js +10 -0
- package/dist/node_modules/framer-motion/dist/es/components/AnimatePresence/PopChild.js +87 -0
- package/dist/node_modules/framer-motion/dist/es/components/AnimatePresence/PresenceChild.js +63 -0
- package/dist/node_modules/framer-motion/dist/es/components/AnimatePresence/index.js +165 -0
- package/dist/node_modules/framer-motion/dist/es/components/AnimatePresence/use-presence.js +44 -0
- package/dist/node_modules/framer-motion/dist/es/components/AnimatePresence/utils.js +14 -0
- package/dist/node_modules/framer-motion/dist/es/context/LayoutGroupContext.js +5 -0
- package/dist/node_modules/framer-motion/dist/es/context/LazyContext.js +5 -0
- package/dist/node_modules/framer-motion/dist/es/context/MotionConfigContext.js +12 -0
- package/dist/node_modules/framer-motion/dist/es/context/MotionContext/create.js +13 -0
- package/dist/node_modules/framer-motion/dist/es/context/MotionContext/index.js +5 -0
- package/dist/node_modules/framer-motion/dist/es/context/MotionContext/utils.js +17 -0
- package/dist/node_modules/framer-motion/dist/es/context/PresenceContext.js +9 -0
- package/dist/node_modules/framer-motion/dist/es/context/SwitchLayoutGroupContext.js +8 -0
- package/dist/node_modules/framer-motion/dist/es/events/add-dom-event.js +6 -0
- package/dist/node_modules/framer-motion/dist/es/events/add-pointer-event.js +8 -0
- package/dist/node_modules/framer-motion/dist/es/events/event-info.js +15 -0
- package/dist/node_modules/framer-motion/dist/es/gestures/drag/VisualElementDragControls.js +501 -0
- package/dist/node_modules/framer-motion/dist/es/gestures/drag/index.js +27 -0
- package/dist/node_modules/framer-motion/dist/es/gestures/drag/utils/constraints.js +129 -0
- package/dist/node_modules/framer-motion/dist/es/gestures/focus.js +41 -0
- package/dist/node_modules/framer-motion/dist/es/gestures/hover.js +30 -0
- package/dist/node_modules/framer-motion/dist/es/gestures/pan/PanSession.js +157 -0
- package/dist/node_modules/framer-motion/dist/es/gestures/pan/index.js +50 -0
- package/dist/node_modules/framer-motion/dist/es/gestures/press.js +33 -0
- package/dist/node_modules/framer-motion/dist/es/motion/features/Feature.js +9 -0
- package/dist/node_modules/framer-motion/dist/es/motion/features/animation/exit.js +36 -0
- package/dist/node_modules/framer-motion/dist/es/motion/features/animation/index.js +40 -0
- package/dist/node_modules/framer-motion/dist/es/motion/features/animations.js +13 -0
- package/dist/node_modules/framer-motion/dist/es/motion/features/definitions.js +28 -0
- package/dist/node_modules/framer-motion/dist/es/motion/features/drag.js +17 -0
- package/dist/node_modules/framer-motion/dist/es/motion/features/gestures.js +21 -0
- package/dist/node_modules/framer-motion/dist/es/motion/features/layout/MeasureLayout.js +147 -0
- package/dist/node_modules/framer-motion/dist/es/motion/features/layout.js +11 -0
- package/dist/node_modules/framer-motion/dist/es/motion/features/load-features.js +12 -0
- package/dist/node_modules/framer-motion/dist/es/motion/features/viewport/index.js +72 -0
- package/dist/node_modules/framer-motion/dist/es/motion/features/viewport/observers.js +49 -0
- package/dist/node_modules/framer-motion/dist/es/motion/index.js +107 -0
- package/dist/node_modules/framer-motion/dist/es/motion/utils/is-forced-motion-value.js +11 -0
- package/dist/node_modules/framer-motion/dist/es/motion/utils/symbol.js +3 -0
- package/dist/node_modules/framer-motion/dist/es/motion/utils/use-motion-ref.js +38 -0
- package/dist/node_modules/framer-motion/dist/es/motion/utils/use-visual-element.js +139 -0
- package/dist/node_modules/framer-motion/dist/es/motion/utils/use-visual-state.js +79 -0
- package/dist/node_modules/framer-motion/dist/es/motion/utils/valid-prop.js +57 -0
- package/dist/node_modules/framer-motion/dist/es/projection/animation/mix-values.js +91 -0
- package/dist/node_modules/framer-motion/dist/es/projection/geometry/conversion.js +33 -0
- package/dist/node_modules/framer-motion/dist/es/projection/geometry/copy.js +31 -0
- package/dist/node_modules/framer-motion/dist/es/projection/geometry/delta-apply.js +119 -0
- package/dist/node_modules/framer-motion/dist/es/projection/geometry/delta-calc.js +52 -0
- package/dist/node_modules/framer-motion/dist/es/projection/geometry/delta-remove.js +54 -0
- package/dist/node_modules/framer-motion/dist/es/projection/geometry/models.js +17 -0
- package/dist/node_modules/framer-motion/dist/es/projection/geometry/utils.js +31 -0
- package/dist/node_modules/framer-motion/dist/es/projection/node/DocumentProjectionNode.js +13 -0
- package/dist/node_modules/framer-motion/dist/es/projection/node/HTMLProjectionNode.js +27 -0
- package/dist/node_modules/framer-motion/dist/es/projection/node/create-projection-node.js +1582 -0
- package/dist/node_modules/framer-motion/dist/es/projection/node/state.js +19 -0
- package/dist/node_modules/framer-motion/dist/es/projection/shared/stack.js +112 -0
- package/dist/node_modules/framer-motion/dist/es/projection/styles/scale-border-radius.js +41 -0
- package/dist/node_modules/framer-motion/dist/es/projection/styles/scale-box-shadow.js +35 -0
- package/dist/node_modules/framer-motion/dist/es/projection/styles/scale-correction.js +13 -0
- package/dist/node_modules/framer-motion/dist/es/projection/styles/transform.js +49 -0
- package/dist/node_modules/framer-motion/dist/es/projection/utils/each-axis.js +5 -0
- package/dist/node_modules/framer-motion/dist/es/projection/utils/has-transform.js +26 -0
- package/dist/node_modules/framer-motion/dist/es/projection/utils/measure.js +17 -0
- package/dist/node_modules/framer-motion/dist/es/render/VisualElement.js +489 -0
- package/dist/node_modules/framer-motion/dist/es/render/components/create-proxy.js +45 -0
- package/dist/node_modules/framer-motion/dist/es/render/components/motion/feature-bundle.js +13 -0
- package/dist/node_modules/framer-motion/dist/es/render/components/motion/proxy.js +7 -0
- package/dist/node_modules/framer-motion/dist/es/render/dom/DOMVisualElement.js +43 -0
- package/dist/node_modules/framer-motion/dist/es/render/dom/create-visual-element.js +14 -0
- package/dist/node_modules/framer-motion/dist/es/render/dom/use-render.js +28 -0
- package/dist/node_modules/framer-motion/dist/es/render/dom/utils/camel-to-dash.js +6 -0
- package/dist/node_modules/framer-motion/dist/es/render/dom/utils/filter-props.js +59 -0
- package/dist/node_modules/framer-motion/dist/es/render/dom/utils/is-svg-component.js +30 -0
- package/dist/node_modules/framer-motion/dist/es/render/html/HTMLVisualElement.js +44 -0
- package/dist/node_modules/framer-motion/dist/es/render/html/use-html-visual-state.js +10 -0
- package/dist/node_modules/framer-motion/dist/es/render/html/use-props.js +57 -0
- package/dist/node_modules/framer-motion/dist/es/render/html/utils/build-styles.js +65 -0
- package/dist/node_modules/framer-motion/dist/es/render/html/utils/build-transform.js +62 -0
- package/dist/node_modules/framer-motion/dist/es/render/html/utils/create-render-state.js +8 -0
- package/dist/node_modules/framer-motion/dist/es/render/html/utils/render.js +17 -0
- package/dist/node_modules/framer-motion/dist/es/render/html/utils/scrape-motion-values.js +19 -0
- package/dist/node_modules/framer-motion/dist/es/render/store.js +3 -0
- package/dist/node_modules/framer-motion/dist/es/render/svg/SVGVisualElement.js +45 -0
- package/dist/node_modules/framer-motion/dist/es/render/svg/lowercase-elements.js +33 -0
- package/dist/node_modules/framer-motion/dist/es/render/svg/use-props.js +24 -0
- package/dist/node_modules/framer-motion/dist/es/render/svg/use-svg-visual-state.js +10 -0
- package/dist/node_modules/framer-motion/dist/es/render/svg/utils/build-attrs.js +57 -0
- package/dist/node_modules/framer-motion/dist/es/render/svg/utils/camel-case-attrs.js +30 -0
- package/dist/node_modules/framer-motion/dist/es/render/svg/utils/create-render-state.js +8 -0
- package/dist/node_modules/framer-motion/dist/es/render/svg/utils/is-svg-tag.js +3 -0
- package/dist/node_modules/framer-motion/dist/es/render/svg/utils/path.js +32 -0
- package/dist/node_modules/framer-motion/dist/es/render/svg/utils/render.js +12 -0
- package/dist/node_modules/framer-motion/dist/es/render/svg/utils/scrape-motion-values.js +19 -0
- package/dist/node_modules/framer-motion/dist/es/render/utils/animation-state.js +357 -0
- package/dist/node_modules/framer-motion/dist/es/render/utils/compare-by-depth.js +3 -0
- package/dist/node_modules/framer-motion/dist/es/render/utils/flat-tree.js +24 -0
- package/dist/node_modules/framer-motion/dist/es/render/utils/get-variant-context.js +28 -0
- package/dist/node_modules/framer-motion/dist/es/render/utils/is-controlling-variants.js +13 -0
- package/dist/node_modules/framer-motion/dist/es/render/utils/is-variant-label.js +8 -0
- package/dist/node_modules/framer-motion/dist/es/render/utils/motion-values.js +51 -0
- package/dist/node_modules/framer-motion/dist/es/render/utils/resolve-dynamic-variants.js +8 -0
- package/dist/node_modules/framer-motion/dist/es/render/utils/resolve-variants.js +36 -0
- package/dist/node_modules/framer-motion/dist/es/render/utils/setters.js +31 -0
- package/dist/node_modules/framer-motion/dist/es/render/utils/variant-props.js +12 -0
- package/dist/node_modules/framer-motion/dist/es/utils/delay.js +20 -0
- package/dist/node_modules/framer-motion/dist/es/utils/distance.js +9 -0
- package/dist/node_modules/framer-motion/dist/es/utils/get-context-window.js +6 -0
- package/dist/node_modules/framer-motion/dist/es/utils/is-browser.js +3 -0
- package/dist/node_modules/framer-motion/dist/es/utils/is-ref-object.js +7 -0
- package/dist/node_modules/framer-motion/dist/es/utils/reduced-motion/index.js +19 -0
- package/dist/node_modules/framer-motion/dist/es/utils/reduced-motion/state.js +5 -0
- package/dist/node_modules/framer-motion/dist/es/utils/reduced-motion/use-reduced-motion.js +47 -0
- package/dist/node_modules/framer-motion/dist/es/utils/shallow-compare.js +14 -0
- package/dist/node_modules/framer-motion/dist/es/utils/use-constant.js +18 -0
- package/dist/node_modules/framer-motion/dist/es/utils/use-isomorphic-effect.js +6 -0
- package/dist/node_modules/framer-motion/dist/es/value/use-combine-values.js +37 -0
- package/dist/node_modules/framer-motion/dist/es/value/use-computed.js +19 -0
- package/dist/node_modules/framer-motion/dist/es/value/use-motion-value.js +38 -0
- package/dist/node_modules/framer-motion/dist/es/value/use-spring.js +22 -0
- package/dist/node_modules/framer-motion/dist/es/value/use-transform.js +27 -0
- package/dist/node_modules/framer-motion/dist/es/value/use-will-change/add-will-change.js +20 -0
- package/dist/node_modules/framer-motion/dist/es/value/use-will-change/is.js +7 -0
- package/dist/node_modules/framer-motion/dist/es/value/utils/resolve-motion-value.js +12 -0
- package/dist/node_modules/motion-dom/dist/es/animation/AsyncMotionValueAnimation.js +176 -0
- package/dist/node_modules/motion-dom/dist/es/animation/JSAnimation.js +341 -0
- package/dist/node_modules/motion-dom/dist/es/animation/NativeAnimation.js +158 -0
- package/dist/node_modules/motion-dom/dist/es/animation/NativeAnimationExtended.js +65 -0
- package/dist/node_modules/motion-dom/dist/es/animation/drivers/frame.js +17 -0
- package/dist/node_modules/motion-dom/dist/es/animation/generators/inertia.js +87 -0
- package/dist/node_modules/motion-dom/dist/es/animation/generators/keyframes.js +51 -0
- package/dist/node_modules/motion-dom/dist/es/animation/generators/spring/defaults.js +27 -0
- package/dist/node_modules/motion-dom/dist/es/animation/generators/spring/find.js +86 -0
- package/dist/node_modules/motion-dom/dist/es/animation/generators/spring/index.js +176 -0
- package/dist/node_modules/motion-dom/dist/es/animation/generators/utils/calc-duration.js +17 -0
- package/dist/node_modules/motion-dom/dist/es/animation/generators/utils/create-generator-easing.js +19 -0
- package/dist/node_modules/motion-dom/dist/es/animation/generators/utils/is-generator.js +5 -0
- package/dist/node_modules/motion-dom/dist/es/animation/generators/utils/velocity.js +9 -0
- package/dist/node_modules/motion-dom/dist/es/animation/keyframes/DOMKeyframesResolver.js +131 -0
- package/dist/node_modules/motion-dom/dist/es/animation/keyframes/KeyframesResolver.js +147 -0
- package/dist/node_modules/motion-dom/dist/es/animation/keyframes/get-final.js +11 -0
- package/dist/node_modules/motion-dom/dist/es/animation/keyframes/offsets/default.js +9 -0
- package/dist/node_modules/motion-dom/dist/es/animation/keyframes/offsets/fill.js +12 -0
- package/dist/node_modules/motion-dom/dist/es/animation/keyframes/offsets/time.js +5 -0
- package/dist/node_modules/motion-dom/dist/es/animation/keyframes/utils/fill-wildcards.js +7 -0
- package/dist/node_modules/motion-dom/dist/es/animation/keyframes/utils/is-none.js +15 -0
- package/dist/node_modules/motion-dom/dist/es/animation/keyframes/utils/make-none-animatable.js +30 -0
- package/dist/node_modules/motion-dom/dist/es/animation/keyframes/utils/unit-conversion.js +36 -0
- package/dist/node_modules/motion-dom/dist/es/animation/utils/WithPromise.js +26 -0
- package/dist/node_modules/motion-dom/dist/es/animation/utils/can-animate.js +42 -0
- package/dist/node_modules/motion-dom/dist/es/animation/utils/css-variables-conversion.js +42 -0
- package/dist/node_modules/motion-dom/dist/es/animation/utils/get-value-transition.js +7 -0
- package/dist/node_modules/motion-dom/dist/es/animation/utils/is-animatable.js +30 -0
- package/dist/node_modules/motion-dom/dist/es/animation/utils/is-css-variable.js +15 -0
- package/dist/node_modules/motion-dom/dist/es/animation/utils/make-animation-instant.js +6 -0
- package/dist/node_modules/motion-dom/dist/es/animation/utils/replace-transition-type.js +18 -0
- package/dist/node_modules/motion-dom/dist/es/animation/waapi/easing/cubic-bezier.js +3 -0
- package/dist/node_modules/motion-dom/dist/es/animation/waapi/easing/map-easing.js +28 -0
- package/dist/node_modules/motion-dom/dist/es/animation/waapi/easing/supported.js +15 -0
- package/dist/node_modules/motion-dom/dist/es/animation/waapi/start-waapi-animation.js +29 -0
- package/dist/node_modules/motion-dom/dist/es/animation/waapi/supports/waapi.js +43 -0
- package/dist/node_modules/motion-dom/dist/es/animation/waapi/utils/apply-generator.js +15 -0
- package/dist/node_modules/motion-dom/dist/es/animation/waapi/utils/linear.js +12 -0
- package/dist/node_modules/motion-dom/dist/es/animation/waapi/utils/unsupported-easing.js +20 -0
- package/dist/node_modules/motion-dom/dist/es/frameloop/batcher.js +71 -0
- package/dist/node_modules/motion-dom/dist/es/frameloop/frame.js +6 -0
- package/dist/node_modules/motion-dom/dist/es/frameloop/microtask.js +6 -0
- package/dist/node_modules/motion-dom/dist/es/frameloop/order.js +12 -0
- package/dist/node_modules/motion-dom/dist/es/frameloop/render-step.js +81 -0
- package/dist/node_modules/motion-dom/dist/es/frameloop/sync-time.js +31 -0
- package/dist/node_modules/motion-dom/dist/es/gestures/drag/state/is-active.js +9 -0
- package/dist/node_modules/motion-dom/dist/es/gestures/drag/state/set-active.js +28 -0
- package/dist/node_modules/motion-dom/dist/es/gestures/hover.js +37 -0
- package/dist/node_modules/motion-dom/dist/es/gestures/press/index.js +83 -0
- package/dist/node_modules/motion-dom/dist/es/gestures/press/utils/is-keyboard-accessible.js +13 -0
- package/dist/node_modules/motion-dom/dist/es/gestures/press/utils/keyboard.js +38 -0
- package/dist/node_modules/motion-dom/dist/es/gestures/press/utils/state.js +3 -0
- package/dist/node_modules/motion-dom/dist/es/gestures/utils/is-node-or-child.js +20 -0
- package/dist/node_modules/motion-dom/dist/es/gestures/utils/is-primary-pointer.js +18 -0
- package/dist/node_modules/motion-dom/dist/es/gestures/utils/setup.js +15 -0
- package/dist/node_modules/motion-dom/dist/es/render/dom/is-css-var.js +3 -0
- package/dist/node_modules/motion-dom/dist/es/render/dom/parse-transform.js +83 -0
- package/dist/node_modules/motion-dom/dist/es/render/dom/style-set.js +9 -0
- package/dist/node_modules/motion-dom/dist/es/render/utils/keys-position.js +13 -0
- package/dist/node_modules/motion-dom/dist/es/render/utils/keys-transform.js +28 -0
- package/dist/node_modules/motion-dom/dist/es/utils/interpolate.js +79 -0
- package/dist/node_modules/motion-dom/dist/es/utils/is-html-element.js +11 -0
- package/dist/node_modules/motion-dom/dist/es/utils/is-svg-element.js +11 -0
- package/dist/node_modules/motion-dom/dist/es/utils/is-svg-svg-element.js +11 -0
- package/dist/node_modules/motion-dom/dist/es/utils/mix/color.js +47 -0
- package/dist/node_modules/motion-dom/dist/es/utils/mix/complex.js +93 -0
- package/dist/node_modules/motion-dom/dist/es/utils/mix/immediate.js +5 -0
- package/dist/node_modules/motion-dom/dist/es/utils/mix/index.js +14 -0
- package/dist/node_modules/motion-dom/dist/es/utils/mix/number.js +26 -0
- package/dist/node_modules/motion-dom/dist/es/utils/mix/visibility.js +16 -0
- package/dist/node_modules/motion-dom/dist/es/utils/resolve-elements.js +14 -0
- package/dist/node_modules/motion-dom/dist/es/utils/supports/flags.js +7 -0
- package/dist/node_modules/motion-dom/dist/es/utils/supports/linear-easing.js +15 -0
- package/dist/node_modules/motion-dom/dist/es/utils/supports/memo.js +9 -0
- package/dist/node_modules/motion-dom/dist/es/utils/supports/scroll-timeline.js +5 -0
- package/dist/node_modules/motion-dom/dist/es/utils/transform.js +14 -0
- package/dist/node_modules/motion-dom/dist/es/value/index.js +325 -0
- package/dist/node_modules/motion-dom/dist/es/value/spring-value.js +54 -0
- package/dist/node_modules/motion-dom/dist/es/value/types/auto.js +9 -0
- package/dist/node_modules/motion-dom/dist/es/value/types/color/hex.js +40 -0
- package/dist/node_modules/motion-dom/dist/es/value/types/color/hsla-to-rgba.js +42 -0
- package/dist/node_modules/motion-dom/dist/es/value/types/color/hsla.js +22 -0
- package/dist/node_modules/motion-dom/dist/es/value/types/color/index.js +32 -0
- package/dist/node_modules/motion-dom/dist/es/value/types/color/rgba.js +25 -0
- package/dist/node_modules/motion-dom/dist/es/value/types/color/utils.js +29 -0
- package/dist/node_modules/motion-dom/dist/es/value/types/complex/filter.js +30 -0
- package/dist/node_modules/motion-dom/dist/es/value/types/complex/index.js +91 -0
- package/dist/node_modules/motion-dom/dist/es/value/types/dimensions.js +15 -0
- package/dist/node_modules/motion-dom/dist/es/value/types/int.js +8 -0
- package/dist/node_modules/motion-dom/dist/es/value/types/maps/defaults.js +30 -0
- package/dist/node_modules/motion-dom/dist/es/value/types/maps/number.js +50 -0
- package/dist/node_modules/motion-dom/dist/es/value/types/maps/transform.js +31 -0
- package/dist/node_modules/motion-dom/dist/es/value/types/numbers/index.js +17 -0
- package/dist/node_modules/motion-dom/dist/es/value/types/numbers/units.js +18 -0
- package/dist/node_modules/motion-dom/dist/es/value/types/test.js +6 -0
- package/dist/node_modules/motion-dom/dist/es/value/types/utils/animatable-none.js +15 -0
- package/dist/node_modules/motion-dom/dist/es/value/types/utils/color-regex.js +3 -0
- package/dist/node_modules/motion-dom/dist/es/value/types/utils/find.js +15 -0
- package/dist/node_modules/motion-dom/dist/es/value/types/utils/float-regex.js +3 -0
- package/dist/node_modules/motion-dom/dist/es/value/types/utils/get-as-type.js +10 -0
- package/dist/node_modules/motion-dom/dist/es/value/types/utils/is-nullish.js +5 -0
- package/dist/node_modules/motion-dom/dist/es/value/types/utils/sanitize.js +5 -0
- package/dist/node_modules/motion-dom/dist/es/value/types/utils/single-color-regex.js +3 -0
- package/dist/node_modules/motion-dom/dist/es/value/utils/is-motion-value.js +3 -0
- package/dist/node_modules/motion-utils/dist/es/array.js +11 -0
- package/dist/node_modules/motion-utils/dist/es/clamp.js +9 -0
- package/dist/node_modules/motion-utils/dist/es/easing/anticipate.js +5 -0
- package/dist/node_modules/motion-utils/dist/es/easing/back.js +9 -0
- package/dist/node_modules/motion-utils/dist/es/easing/circ.js +8 -0
- package/dist/node_modules/motion-utils/dist/es/easing/cubic-bezier.js +51 -0
- package/dist/node_modules/motion-utils/dist/es/easing/ease.js +7 -0
- package/dist/node_modules/motion-utils/dist/es/easing/modifiers/mirror.js +5 -0
- package/dist/node_modules/motion-utils/dist/es/easing/modifiers/reverse.js +5 -0
- package/dist/node_modules/motion-utils/dist/es/easing/utils/is-bezier-definition.js +3 -0
- package/dist/node_modules/motion-utils/dist/es/easing/utils/is-easing-array.js +5 -0
- package/dist/node_modules/motion-utils/dist/es/easing/utils/map.js +41 -0
- package/dist/node_modules/motion-utils/dist/es/errors.js +18 -0
- package/dist/node_modules/motion-utils/dist/es/format-error-message.js +7 -0
- package/dist/node_modules/motion-utils/dist/es/global-config.js +3 -0
- package/dist/node_modules/motion-utils/dist/es/is-numerical-string.js +6 -0
- package/dist/node_modules/motion-utils/dist/es/is-object.js +5 -0
- package/dist/node_modules/motion-utils/dist/es/is-zero-value-string.js +6 -0
- package/dist/node_modules/motion-utils/dist/es/memo.js +11 -0
- package/dist/node_modules/motion-utils/dist/es/noop.js +4 -0
- package/dist/node_modules/motion-utils/dist/es/pipe.js +11 -0
- package/dist/node_modules/motion-utils/dist/es/progress.js +19 -0
- package/dist/node_modules/motion-utils/dist/es/subscription-manager.js +40 -0
- package/dist/node_modules/motion-utils/dist/es/time-conversion.js +12 -0
- package/dist/node_modules/motion-utils/dist/es/velocity-per-second.js +11 -0
- package/dist/node_modules/motion-utils/dist/es/warn-once.js +11 -0
- package/dist/node_modules/react/cjs/react-jsx-runtime.development.js +368 -0
- package/dist/node_modules/react/cjs/react-jsx-runtime.production.js +44 -0
- package/dist/node_modules/react/jsx-runtime.js +19 -0
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js +2956 -0
- package/dist/node_modules/tslib/tslib.es6.js +56 -0
- package/dist/styles.css +2 -0
- package/dist/theme/ThemeContext.d.ts +15 -0
- package/dist/types/button.types.d.ts +28 -0
- package/dist/utils/calendarUtils.d.ts +60 -0
- package/dist/utils/cn.d.ts +2 -0
- package/dist/utils/cn.js +12 -0
- package/dist/utils/dateUtils.d.ts +58 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/useClickOutside.d.ts +7 -0
- package/dist/utils/useClickOutside.js +26 -0
- package/package.json +87 -0
|
@@ -0,0 +1,1582 @@
|
|
|
1
|
+
import { animateSingleValue } from '../../animation/animate/single-value.js';
|
|
2
|
+
import { getOptimisedAppearId } from '../../animation/optimized-appear/get-appear-id.js';
|
|
3
|
+
import { FlatTree } from '../../render/utils/flat-tree.js';
|
|
4
|
+
import { delay } from '../../utils/delay.js';
|
|
5
|
+
import { resolveMotionValue } from '../../value/utils/resolve-motion-value.js';
|
|
6
|
+
import { mixValues } from '../animation/mix-values.js';
|
|
7
|
+
import { copyBoxInto, copyAxisDeltaInto } from '../geometry/copy.js';
|
|
8
|
+
import { translateAxis, transformBox, applyBoxDelta, applyTreeDeltas } from '../geometry/delta-apply.js';
|
|
9
|
+
import { calcLength, calcRelativePosition, calcRelativeBox, calcBoxDelta, isNear } from '../geometry/delta-calc.js';
|
|
10
|
+
import { removeBoxTransforms } from '../geometry/delta-remove.js';
|
|
11
|
+
import { createBox, createDelta } from '../geometry/models.js';
|
|
12
|
+
import { boxEqualsRounded, isDeltaZero, axisDeltaEquals, boxEquals, aspectRatio } from '../geometry/utils.js';
|
|
13
|
+
import { NodeStack } from '../shared/stack.js';
|
|
14
|
+
import { scaleCorrectors } from '../styles/scale-correction.js';
|
|
15
|
+
import { buildProjectionTransform } from '../styles/transform.js';
|
|
16
|
+
import { eachAxis } from '../utils/each-axis.js';
|
|
17
|
+
import { hasTransform, hasScale, has2DTranslate } from '../utils/has-transform.js';
|
|
18
|
+
import { globalProjectionState } from './state.js';
|
|
19
|
+
import { SubscriptionManager } from '../../../../../motion-utils/dist/es/subscription-manager.js';
|
|
20
|
+
import { isSVGElement } from '../../../../../motion-dom/dist/es/utils/is-svg-element.js';
|
|
21
|
+
import { isSVGSVGElement } from '../../../../../motion-dom/dist/es/utils/is-svg-svg-element.js';
|
|
22
|
+
import { frame, cancelFrame, frameData, frameSteps } from '../../../../../motion-dom/dist/es/frameloop/frame.js';
|
|
23
|
+
import { getValueTransition } from '../../../../../motion-dom/dist/es/animation/utils/get-value-transition.js';
|
|
24
|
+
import { time } from '../../../../../motion-dom/dist/es/frameloop/sync-time.js';
|
|
25
|
+
import { clamp } from '../../../../../motion-utils/dist/es/clamp.js';
|
|
26
|
+
import { microtask } from '../../../../../motion-dom/dist/es/frameloop/microtask.js';
|
|
27
|
+
import { motionValue } from '../../../../../motion-dom/dist/es/value/index.js';
|
|
28
|
+
import { mixNumber } from '../../../../../motion-dom/dist/es/utils/mix/number.js';
|
|
29
|
+
import { noop } from '../../../../../motion-utils/dist/es/noop.js';
|
|
30
|
+
|
|
31
|
+
const transformAxes = ["", "X", "Y", "Z"];
|
|
32
|
+
/**
|
|
33
|
+
* We use 1000 as the animation target as 0-1000 maps better to pixels than 0-1
|
|
34
|
+
* which has a noticeable difference in spring animations
|
|
35
|
+
*/
|
|
36
|
+
const animationTarget = 1000;
|
|
37
|
+
let id = 0;
|
|
38
|
+
function resetDistortingTransform(key, visualElement, values, sharedAnimationValues) {
|
|
39
|
+
const { latestValues } = visualElement;
|
|
40
|
+
// Record the distorting transform and then temporarily set it to 0
|
|
41
|
+
if (latestValues[key]) {
|
|
42
|
+
values[key] = latestValues[key];
|
|
43
|
+
visualElement.setStaticValue(key, 0);
|
|
44
|
+
if (sharedAnimationValues) {
|
|
45
|
+
sharedAnimationValues[key] = 0;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function cancelTreeOptimisedTransformAnimations(projectionNode) {
|
|
50
|
+
projectionNode.hasCheckedOptimisedAppear = true;
|
|
51
|
+
if (projectionNode.root === projectionNode)
|
|
52
|
+
return;
|
|
53
|
+
const { visualElement } = projectionNode.options;
|
|
54
|
+
if (!visualElement)
|
|
55
|
+
return;
|
|
56
|
+
const appearId = getOptimisedAppearId(visualElement);
|
|
57
|
+
if (window.MotionHasOptimisedAnimation(appearId, "transform")) {
|
|
58
|
+
const { layout, layoutId } = projectionNode.options;
|
|
59
|
+
window.MotionCancelOptimisedAnimation(appearId, "transform", frame, !(layout || layoutId));
|
|
60
|
+
}
|
|
61
|
+
const { parent } = projectionNode;
|
|
62
|
+
if (parent && !parent.hasCheckedOptimisedAppear) {
|
|
63
|
+
cancelTreeOptimisedTransformAnimations(parent);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function createProjectionNode({ attachResizeListener, defaultParent, measureScroll, checkIsScrollRoot, resetTransform, }) {
|
|
67
|
+
return class ProjectionNode {
|
|
68
|
+
constructor(latestValues = {}, parent = defaultParent?.()) {
|
|
69
|
+
/**
|
|
70
|
+
* A unique ID generated for every projection node.
|
|
71
|
+
*/
|
|
72
|
+
this.id = id++;
|
|
73
|
+
/**
|
|
74
|
+
* An id that represents a unique session instigated by startUpdate.
|
|
75
|
+
*/
|
|
76
|
+
this.animationId = 0;
|
|
77
|
+
this.animationCommitId = 0;
|
|
78
|
+
/**
|
|
79
|
+
* A Set containing all this component's children. This is used to iterate
|
|
80
|
+
* through the children.
|
|
81
|
+
*
|
|
82
|
+
* TODO: This could be faster to iterate as a flat array stored on the root node.
|
|
83
|
+
*/
|
|
84
|
+
this.children = new Set();
|
|
85
|
+
/**
|
|
86
|
+
* Options for the node. We use this to configure what kind of layout animations
|
|
87
|
+
* we should perform (if any).
|
|
88
|
+
*/
|
|
89
|
+
this.options = {};
|
|
90
|
+
/**
|
|
91
|
+
* We use this to detect when its safe to shut down part of a projection tree.
|
|
92
|
+
* We have to keep projecting children for scale correction and relative projection
|
|
93
|
+
* until all their parents stop performing layout animations.
|
|
94
|
+
*/
|
|
95
|
+
this.isTreeAnimating = false;
|
|
96
|
+
this.isAnimationBlocked = false;
|
|
97
|
+
/**
|
|
98
|
+
* Flag to true if we think this layout has been changed. We can't always know this,
|
|
99
|
+
* currently we set it to true every time a component renders, or if it has a layoutDependency
|
|
100
|
+
* if that has changed between renders. Additionally, components can be grouped by LayoutGroup
|
|
101
|
+
* and if one node is dirtied, they all are.
|
|
102
|
+
*/
|
|
103
|
+
this.isLayoutDirty = false;
|
|
104
|
+
/**
|
|
105
|
+
* Flag to true if we think the projection calculations for this node needs
|
|
106
|
+
* recalculating as a result of an updated transform or layout animation.
|
|
107
|
+
*/
|
|
108
|
+
this.isProjectionDirty = false;
|
|
109
|
+
/**
|
|
110
|
+
* Flag to true if the layout *or* transform has changed. This then gets propagated
|
|
111
|
+
* throughout the projection tree, forcing any element below to recalculate on the next frame.
|
|
112
|
+
*/
|
|
113
|
+
this.isSharedProjectionDirty = false;
|
|
114
|
+
/**
|
|
115
|
+
* Flag transform dirty. This gets propagated throughout the whole tree but is only
|
|
116
|
+
* respected by shared nodes.
|
|
117
|
+
*/
|
|
118
|
+
this.isTransformDirty = false;
|
|
119
|
+
/**
|
|
120
|
+
* Block layout updates for instant layout transitions throughout the tree.
|
|
121
|
+
*/
|
|
122
|
+
this.updateManuallyBlocked = false;
|
|
123
|
+
this.updateBlockedByResize = false;
|
|
124
|
+
/**
|
|
125
|
+
* Set to true between the start of the first `willUpdate` call and the end of the `didUpdate`
|
|
126
|
+
* call.
|
|
127
|
+
*/
|
|
128
|
+
this.isUpdating = false;
|
|
129
|
+
/**
|
|
130
|
+
* If this is an SVG element we currently disable projection transforms
|
|
131
|
+
*/
|
|
132
|
+
this.isSVG = false;
|
|
133
|
+
/**
|
|
134
|
+
* Flag to true (during promotion) if a node doing an instant layout transition needs to reset
|
|
135
|
+
* its projection styles.
|
|
136
|
+
*/
|
|
137
|
+
this.needsReset = false;
|
|
138
|
+
/**
|
|
139
|
+
* Flags whether this node should have its transform reset prior to measuring.
|
|
140
|
+
*/
|
|
141
|
+
this.shouldResetTransform = false;
|
|
142
|
+
/**
|
|
143
|
+
* Store whether this node has been checked for optimised appear animations. As
|
|
144
|
+
* effects fire bottom-up, and we want to look up the tree for appear animations,
|
|
145
|
+
* this makes sure we only check each path once, stopping at nodes that
|
|
146
|
+
* have already been checked.
|
|
147
|
+
*/
|
|
148
|
+
this.hasCheckedOptimisedAppear = false;
|
|
149
|
+
/**
|
|
150
|
+
* An object representing the calculated contextual/accumulated/tree scale.
|
|
151
|
+
* This will be used to scale calculcated projection transforms, as these are
|
|
152
|
+
* calculated in screen-space but need to be scaled for elements to layoutly
|
|
153
|
+
* make it to their calculated destinations.
|
|
154
|
+
*
|
|
155
|
+
* TODO: Lazy-init
|
|
156
|
+
*/
|
|
157
|
+
this.treeScale = { x: 1, y: 1 };
|
|
158
|
+
/**
|
|
159
|
+
*
|
|
160
|
+
*/
|
|
161
|
+
this.eventHandlers = new Map();
|
|
162
|
+
this.hasTreeAnimated = false;
|
|
163
|
+
// Note: Currently only running on root node
|
|
164
|
+
this.updateScheduled = false;
|
|
165
|
+
this.scheduleUpdate = () => this.update();
|
|
166
|
+
this.projectionUpdateScheduled = false;
|
|
167
|
+
this.checkUpdateFailed = () => {
|
|
168
|
+
if (this.isUpdating) {
|
|
169
|
+
this.isUpdating = false;
|
|
170
|
+
this.clearAllSnapshots();
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
/**
|
|
174
|
+
* This is a multi-step process as shared nodes might be of different depths. Nodes
|
|
175
|
+
* are sorted by depth order, so we need to resolve the entire tree before moving to
|
|
176
|
+
* the next step.
|
|
177
|
+
*/
|
|
178
|
+
this.updateProjection = () => {
|
|
179
|
+
this.projectionUpdateScheduled = false;
|
|
180
|
+
this.nodes.forEach(propagateDirtyNodes);
|
|
181
|
+
this.nodes.forEach(resolveTargetDelta);
|
|
182
|
+
this.nodes.forEach(calcProjection);
|
|
183
|
+
this.nodes.forEach(cleanDirtyNodes);
|
|
184
|
+
};
|
|
185
|
+
/**
|
|
186
|
+
* Frame calculations
|
|
187
|
+
*/
|
|
188
|
+
this.resolvedRelativeTargetAt = 0.0;
|
|
189
|
+
this.hasProjected = false;
|
|
190
|
+
this.isVisible = true;
|
|
191
|
+
this.animationProgress = 0;
|
|
192
|
+
/**
|
|
193
|
+
* Shared layout
|
|
194
|
+
*/
|
|
195
|
+
// TODO Only running on root node
|
|
196
|
+
this.sharedNodes = new Map();
|
|
197
|
+
this.latestValues = latestValues;
|
|
198
|
+
this.root = parent ? parent.root || parent : this;
|
|
199
|
+
this.path = parent ? [...parent.path, parent] : [];
|
|
200
|
+
this.parent = parent;
|
|
201
|
+
this.depth = parent ? parent.depth + 1 : 0;
|
|
202
|
+
for (let i = 0; i < this.path.length; i++) {
|
|
203
|
+
this.path[i].shouldResetTransform = true;
|
|
204
|
+
}
|
|
205
|
+
if (this.root === this)
|
|
206
|
+
this.nodes = new FlatTree();
|
|
207
|
+
}
|
|
208
|
+
addEventListener(name, handler) {
|
|
209
|
+
if (!this.eventHandlers.has(name)) {
|
|
210
|
+
this.eventHandlers.set(name, new SubscriptionManager());
|
|
211
|
+
}
|
|
212
|
+
return this.eventHandlers.get(name).add(handler);
|
|
213
|
+
}
|
|
214
|
+
notifyListeners(name, ...args) {
|
|
215
|
+
const subscriptionManager = this.eventHandlers.get(name);
|
|
216
|
+
subscriptionManager && subscriptionManager.notify(...args);
|
|
217
|
+
}
|
|
218
|
+
hasListeners(name) {
|
|
219
|
+
return this.eventHandlers.has(name);
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Lifecycles
|
|
223
|
+
*/
|
|
224
|
+
mount(instance) {
|
|
225
|
+
if (this.instance)
|
|
226
|
+
return;
|
|
227
|
+
this.isSVG = isSVGElement(instance) && !isSVGSVGElement(instance);
|
|
228
|
+
this.instance = instance;
|
|
229
|
+
const { layoutId, layout, visualElement } = this.options;
|
|
230
|
+
if (visualElement && !visualElement.current) {
|
|
231
|
+
visualElement.mount(instance);
|
|
232
|
+
}
|
|
233
|
+
this.root.nodes.add(this);
|
|
234
|
+
this.parent && this.parent.children.add(this);
|
|
235
|
+
if (this.root.hasTreeAnimated && (layout || layoutId)) {
|
|
236
|
+
this.isLayoutDirty = true;
|
|
237
|
+
}
|
|
238
|
+
if (attachResizeListener) {
|
|
239
|
+
let cancelDelay;
|
|
240
|
+
let innerWidth = 0;
|
|
241
|
+
const resizeUnblockUpdate = () => (this.root.updateBlockedByResize = false);
|
|
242
|
+
// Set initial innerWidth in a frame.read callback to batch the read
|
|
243
|
+
frame.read(() => {
|
|
244
|
+
innerWidth = window.innerWidth;
|
|
245
|
+
});
|
|
246
|
+
attachResizeListener(instance, () => {
|
|
247
|
+
const newInnerWidth = window.innerWidth;
|
|
248
|
+
if (newInnerWidth === innerWidth)
|
|
249
|
+
return;
|
|
250
|
+
innerWidth = newInnerWidth;
|
|
251
|
+
this.root.updateBlockedByResize = true;
|
|
252
|
+
cancelDelay && cancelDelay();
|
|
253
|
+
cancelDelay = delay(resizeUnblockUpdate, 250);
|
|
254
|
+
if (globalProjectionState.hasAnimatedSinceResize) {
|
|
255
|
+
globalProjectionState.hasAnimatedSinceResize = false;
|
|
256
|
+
this.nodes.forEach(finishAnimation);
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
if (layoutId) {
|
|
261
|
+
this.root.registerSharedNode(layoutId, this);
|
|
262
|
+
}
|
|
263
|
+
// Only register the handler if it requires layout animation
|
|
264
|
+
if (this.options.animate !== false &&
|
|
265
|
+
visualElement &&
|
|
266
|
+
(layoutId || layout)) {
|
|
267
|
+
this.addEventListener("didUpdate", ({ delta, hasLayoutChanged, hasRelativeLayoutChanged, layout: newLayout, }) => {
|
|
268
|
+
if (this.isTreeAnimationBlocked()) {
|
|
269
|
+
this.target = undefined;
|
|
270
|
+
this.relativeTarget = undefined;
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
// TODO: Check here if an animation exists
|
|
274
|
+
const layoutTransition = this.options.transition ||
|
|
275
|
+
visualElement.getDefaultTransition() ||
|
|
276
|
+
defaultLayoutTransition;
|
|
277
|
+
const { onLayoutAnimationStart, onLayoutAnimationComplete, } = visualElement.getProps();
|
|
278
|
+
/**
|
|
279
|
+
* The target layout of the element might stay the same,
|
|
280
|
+
* but its position relative to its parent has changed.
|
|
281
|
+
*/
|
|
282
|
+
const hasTargetChanged = !this.targetLayout ||
|
|
283
|
+
!boxEqualsRounded(this.targetLayout, newLayout);
|
|
284
|
+
/*
|
|
285
|
+
* Note: Disabled to fix relative animations always triggering new
|
|
286
|
+
* layout animations. If this causes further issues, we can try
|
|
287
|
+
* a different approach to detecting relative target changes.
|
|
288
|
+
*/
|
|
289
|
+
// || hasRelativeLayoutChanged
|
|
290
|
+
/**
|
|
291
|
+
* If the layout hasn't seemed to have changed, it might be that the
|
|
292
|
+
* element is visually in the same place in the document but its position
|
|
293
|
+
* relative to its parent has indeed changed. So here we check for that.
|
|
294
|
+
*/
|
|
295
|
+
const hasOnlyRelativeTargetChanged = !hasLayoutChanged && hasRelativeLayoutChanged;
|
|
296
|
+
if (this.options.layoutRoot ||
|
|
297
|
+
this.resumeFrom ||
|
|
298
|
+
hasOnlyRelativeTargetChanged ||
|
|
299
|
+
(hasLayoutChanged &&
|
|
300
|
+
(hasTargetChanged || !this.currentAnimation))) {
|
|
301
|
+
if (this.resumeFrom) {
|
|
302
|
+
this.resumingFrom = this.resumeFrom;
|
|
303
|
+
this.resumingFrom.resumingFrom = undefined;
|
|
304
|
+
}
|
|
305
|
+
const animationOptions = {
|
|
306
|
+
...getValueTransition(layoutTransition, "layout"),
|
|
307
|
+
onPlay: onLayoutAnimationStart,
|
|
308
|
+
onComplete: onLayoutAnimationComplete,
|
|
309
|
+
};
|
|
310
|
+
if (visualElement.shouldReduceMotion ||
|
|
311
|
+
this.options.layoutRoot) {
|
|
312
|
+
animationOptions.delay = 0;
|
|
313
|
+
animationOptions.type = false;
|
|
314
|
+
}
|
|
315
|
+
this.startAnimation(animationOptions);
|
|
316
|
+
/**
|
|
317
|
+
* Set animation origin after starting animation to avoid layout jump
|
|
318
|
+
* caused by stopping previous layout animation
|
|
319
|
+
*/
|
|
320
|
+
this.setAnimationOrigin(delta, hasOnlyRelativeTargetChanged);
|
|
321
|
+
}
|
|
322
|
+
else {
|
|
323
|
+
/**
|
|
324
|
+
* If the layout hasn't changed and we have an animation that hasn't started yet,
|
|
325
|
+
* finish it immediately. Otherwise it will be animating from a location
|
|
326
|
+
* that was probably never commited to screen and look like a jumpy box.
|
|
327
|
+
*/
|
|
328
|
+
if (!hasLayoutChanged) {
|
|
329
|
+
finishAnimation(this);
|
|
330
|
+
}
|
|
331
|
+
if (this.isLead() && this.options.onExitComplete) {
|
|
332
|
+
this.options.onExitComplete();
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
this.targetLayout = newLayout;
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
unmount() {
|
|
340
|
+
this.options.layoutId && this.willUpdate();
|
|
341
|
+
this.root.nodes.remove(this);
|
|
342
|
+
const stack = this.getStack();
|
|
343
|
+
stack && stack.remove(this);
|
|
344
|
+
this.parent && this.parent.children.delete(this);
|
|
345
|
+
this.instance = undefined;
|
|
346
|
+
this.eventHandlers.clear();
|
|
347
|
+
cancelFrame(this.updateProjection);
|
|
348
|
+
}
|
|
349
|
+
// only on the root
|
|
350
|
+
blockUpdate() {
|
|
351
|
+
this.updateManuallyBlocked = true;
|
|
352
|
+
}
|
|
353
|
+
unblockUpdate() {
|
|
354
|
+
this.updateManuallyBlocked = false;
|
|
355
|
+
}
|
|
356
|
+
isUpdateBlocked() {
|
|
357
|
+
return this.updateManuallyBlocked || this.updateBlockedByResize;
|
|
358
|
+
}
|
|
359
|
+
isTreeAnimationBlocked() {
|
|
360
|
+
return (this.isAnimationBlocked ||
|
|
361
|
+
(this.parent && this.parent.isTreeAnimationBlocked()) ||
|
|
362
|
+
false);
|
|
363
|
+
}
|
|
364
|
+
// Note: currently only running on root node
|
|
365
|
+
startUpdate() {
|
|
366
|
+
if (this.isUpdateBlocked())
|
|
367
|
+
return;
|
|
368
|
+
this.isUpdating = true;
|
|
369
|
+
this.nodes && this.nodes.forEach(resetSkewAndRotation);
|
|
370
|
+
this.animationId++;
|
|
371
|
+
}
|
|
372
|
+
getTransformTemplate() {
|
|
373
|
+
const { visualElement } = this.options;
|
|
374
|
+
return visualElement && visualElement.getProps().transformTemplate;
|
|
375
|
+
}
|
|
376
|
+
willUpdate(shouldNotifyListeners = true) {
|
|
377
|
+
this.root.hasTreeAnimated = true;
|
|
378
|
+
if (this.root.isUpdateBlocked()) {
|
|
379
|
+
this.options.onExitComplete && this.options.onExitComplete();
|
|
380
|
+
return;
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* If we're running optimised appear animations then these must be
|
|
384
|
+
* cancelled before measuring the DOM. This is so we can measure
|
|
385
|
+
* the true layout of the element rather than the WAAPI animation
|
|
386
|
+
* which will be unaffected by the resetSkewAndRotate step.
|
|
387
|
+
*
|
|
388
|
+
* Note: This is a DOM write. Worst case scenario is this is sandwiched
|
|
389
|
+
* between other snapshot reads which will cause unnecessary style recalculations.
|
|
390
|
+
* This has to happen here though, as we don't yet know which nodes will need
|
|
391
|
+
* snapshots in startUpdate(), but we only want to cancel optimised animations
|
|
392
|
+
* if a layout animation measurement is actually going to be affected by them.
|
|
393
|
+
*/
|
|
394
|
+
if (window.MotionCancelOptimisedAnimation &&
|
|
395
|
+
!this.hasCheckedOptimisedAppear) {
|
|
396
|
+
cancelTreeOptimisedTransformAnimations(this);
|
|
397
|
+
}
|
|
398
|
+
!this.root.isUpdating && this.root.startUpdate();
|
|
399
|
+
if (this.isLayoutDirty)
|
|
400
|
+
return;
|
|
401
|
+
this.isLayoutDirty = true;
|
|
402
|
+
for (let i = 0; i < this.path.length; i++) {
|
|
403
|
+
const node = this.path[i];
|
|
404
|
+
node.shouldResetTransform = true;
|
|
405
|
+
node.updateScroll("snapshot");
|
|
406
|
+
if (node.options.layoutRoot) {
|
|
407
|
+
node.willUpdate(false);
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
const { layoutId, layout } = this.options;
|
|
411
|
+
if (layoutId === undefined && !layout)
|
|
412
|
+
return;
|
|
413
|
+
const transformTemplate = this.getTransformTemplate();
|
|
414
|
+
this.prevTransformTemplateValue = transformTemplate
|
|
415
|
+
? transformTemplate(this.latestValues, "")
|
|
416
|
+
: undefined;
|
|
417
|
+
this.updateSnapshot();
|
|
418
|
+
shouldNotifyListeners && this.notifyListeners("willUpdate");
|
|
419
|
+
}
|
|
420
|
+
update() {
|
|
421
|
+
this.updateScheduled = false;
|
|
422
|
+
const updateWasBlocked = this.isUpdateBlocked();
|
|
423
|
+
// When doing an instant transition, we skip the layout update,
|
|
424
|
+
// but should still clean up the measurements so that the next
|
|
425
|
+
// snapshot could be taken correctly.
|
|
426
|
+
if (updateWasBlocked) {
|
|
427
|
+
this.unblockUpdate();
|
|
428
|
+
this.clearAllSnapshots();
|
|
429
|
+
this.nodes.forEach(clearMeasurements);
|
|
430
|
+
return;
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* If this is a repeat of didUpdate then ignore the animation.
|
|
434
|
+
*/
|
|
435
|
+
if (this.animationId <= this.animationCommitId) {
|
|
436
|
+
this.nodes.forEach(clearIsLayoutDirty);
|
|
437
|
+
return;
|
|
438
|
+
}
|
|
439
|
+
this.animationCommitId = this.animationId;
|
|
440
|
+
if (!this.isUpdating) {
|
|
441
|
+
this.nodes.forEach(clearIsLayoutDirty);
|
|
442
|
+
}
|
|
443
|
+
else {
|
|
444
|
+
this.isUpdating = false;
|
|
445
|
+
/**
|
|
446
|
+
* Write
|
|
447
|
+
*/
|
|
448
|
+
this.nodes.forEach(resetTransformStyle);
|
|
449
|
+
/**
|
|
450
|
+
* Read ==================
|
|
451
|
+
*/
|
|
452
|
+
// Update layout measurements of updated children
|
|
453
|
+
this.nodes.forEach(updateLayout);
|
|
454
|
+
/**
|
|
455
|
+
* Write
|
|
456
|
+
*/
|
|
457
|
+
// Notify listeners that the layout is updated
|
|
458
|
+
this.nodes.forEach(notifyLayoutUpdate);
|
|
459
|
+
}
|
|
460
|
+
this.clearAllSnapshots();
|
|
461
|
+
/**
|
|
462
|
+
* Manually flush any pending updates. Ideally
|
|
463
|
+
* we could leave this to the following requestAnimationFrame but this seems
|
|
464
|
+
* to leave a flash of incorrectly styled content.
|
|
465
|
+
*/
|
|
466
|
+
const now = time.now();
|
|
467
|
+
frameData.delta = clamp(0, 1000 / 60, now - frameData.timestamp);
|
|
468
|
+
frameData.timestamp = now;
|
|
469
|
+
frameData.isProcessing = true;
|
|
470
|
+
frameSteps.update.process(frameData);
|
|
471
|
+
frameSteps.preRender.process(frameData);
|
|
472
|
+
frameSteps.render.process(frameData);
|
|
473
|
+
frameData.isProcessing = false;
|
|
474
|
+
}
|
|
475
|
+
didUpdate() {
|
|
476
|
+
if (!this.updateScheduled) {
|
|
477
|
+
this.updateScheduled = true;
|
|
478
|
+
microtask.read(this.scheduleUpdate);
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
clearAllSnapshots() {
|
|
482
|
+
this.nodes.forEach(clearSnapshot);
|
|
483
|
+
this.sharedNodes.forEach(removeLeadSnapshots);
|
|
484
|
+
}
|
|
485
|
+
scheduleUpdateProjection() {
|
|
486
|
+
if (!this.projectionUpdateScheduled) {
|
|
487
|
+
this.projectionUpdateScheduled = true;
|
|
488
|
+
frame.preRender(this.updateProjection, false, true);
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
scheduleCheckAfterUnmount() {
|
|
492
|
+
/**
|
|
493
|
+
* If the unmounting node is in a layoutGroup and did trigger a willUpdate,
|
|
494
|
+
* we manually call didUpdate to give a chance to the siblings to animate.
|
|
495
|
+
* Otherwise, cleanup all snapshots to prevents future nodes from reusing them.
|
|
496
|
+
*/
|
|
497
|
+
frame.postRender(() => {
|
|
498
|
+
if (this.isLayoutDirty) {
|
|
499
|
+
this.root.didUpdate();
|
|
500
|
+
}
|
|
501
|
+
else {
|
|
502
|
+
this.root.checkUpdateFailed();
|
|
503
|
+
}
|
|
504
|
+
});
|
|
505
|
+
}
|
|
506
|
+
/**
|
|
507
|
+
* Update measurements
|
|
508
|
+
*/
|
|
509
|
+
updateSnapshot() {
|
|
510
|
+
if (this.snapshot || !this.instance)
|
|
511
|
+
return;
|
|
512
|
+
this.snapshot = this.measure();
|
|
513
|
+
if (this.snapshot &&
|
|
514
|
+
!calcLength(this.snapshot.measuredBox.x) &&
|
|
515
|
+
!calcLength(this.snapshot.measuredBox.y)) {
|
|
516
|
+
this.snapshot = undefined;
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
updateLayout() {
|
|
520
|
+
if (!this.instance)
|
|
521
|
+
return;
|
|
522
|
+
this.updateScroll();
|
|
523
|
+
if (!(this.options.alwaysMeasureLayout && this.isLead()) &&
|
|
524
|
+
!this.isLayoutDirty) {
|
|
525
|
+
return;
|
|
526
|
+
}
|
|
527
|
+
/**
|
|
528
|
+
* When a node is mounted, it simply resumes from the prevLead's
|
|
529
|
+
* snapshot instead of taking a new one, but the ancestors scroll
|
|
530
|
+
* might have updated while the prevLead is unmounted. We need to
|
|
531
|
+
* update the scroll again to make sure the layout we measure is
|
|
532
|
+
* up to date.
|
|
533
|
+
*/
|
|
534
|
+
if (this.resumeFrom && !this.resumeFrom.instance) {
|
|
535
|
+
for (let i = 0; i < this.path.length; i++) {
|
|
536
|
+
const node = this.path[i];
|
|
537
|
+
node.updateScroll();
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
const prevLayout = this.layout;
|
|
541
|
+
this.layout = this.measure(false);
|
|
542
|
+
this.layoutCorrected = createBox();
|
|
543
|
+
this.isLayoutDirty = false;
|
|
544
|
+
this.projectionDelta = undefined;
|
|
545
|
+
this.notifyListeners("measure", this.layout.layoutBox);
|
|
546
|
+
const { visualElement } = this.options;
|
|
547
|
+
visualElement &&
|
|
548
|
+
visualElement.notify("LayoutMeasure", this.layout.layoutBox, prevLayout ? prevLayout.layoutBox : undefined);
|
|
549
|
+
}
|
|
550
|
+
updateScroll(phase = "measure") {
|
|
551
|
+
let needsMeasurement = Boolean(this.options.layoutScroll && this.instance);
|
|
552
|
+
if (this.scroll &&
|
|
553
|
+
this.scroll.animationId === this.root.animationId &&
|
|
554
|
+
this.scroll.phase === phase) {
|
|
555
|
+
needsMeasurement = false;
|
|
556
|
+
}
|
|
557
|
+
if (needsMeasurement && this.instance) {
|
|
558
|
+
const isRoot = checkIsScrollRoot(this.instance);
|
|
559
|
+
this.scroll = {
|
|
560
|
+
animationId: this.root.animationId,
|
|
561
|
+
phase,
|
|
562
|
+
isRoot,
|
|
563
|
+
offset: measureScroll(this.instance),
|
|
564
|
+
wasRoot: this.scroll ? this.scroll.isRoot : isRoot,
|
|
565
|
+
};
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
resetTransform() {
|
|
569
|
+
if (!resetTransform)
|
|
570
|
+
return;
|
|
571
|
+
const isResetRequested = this.isLayoutDirty ||
|
|
572
|
+
this.shouldResetTransform ||
|
|
573
|
+
this.options.alwaysMeasureLayout;
|
|
574
|
+
const hasProjection = this.projectionDelta && !isDeltaZero(this.projectionDelta);
|
|
575
|
+
const transformTemplate = this.getTransformTemplate();
|
|
576
|
+
const transformTemplateValue = transformTemplate
|
|
577
|
+
? transformTemplate(this.latestValues, "")
|
|
578
|
+
: undefined;
|
|
579
|
+
const transformTemplateHasChanged = transformTemplateValue !== this.prevTransformTemplateValue;
|
|
580
|
+
if (isResetRequested &&
|
|
581
|
+
this.instance &&
|
|
582
|
+
(hasProjection ||
|
|
583
|
+
hasTransform(this.latestValues) ||
|
|
584
|
+
transformTemplateHasChanged)) {
|
|
585
|
+
resetTransform(this.instance, transformTemplateValue);
|
|
586
|
+
this.shouldResetTransform = false;
|
|
587
|
+
this.scheduleRender();
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
measure(removeTransform = true) {
|
|
591
|
+
const pageBox = this.measurePageBox();
|
|
592
|
+
let layoutBox = this.removeElementScroll(pageBox);
|
|
593
|
+
/**
|
|
594
|
+
* Measurements taken during the pre-render stage
|
|
595
|
+
* still have transforms applied so we remove them
|
|
596
|
+
* via calculation.
|
|
597
|
+
*/
|
|
598
|
+
if (removeTransform) {
|
|
599
|
+
layoutBox = this.removeTransform(layoutBox);
|
|
600
|
+
}
|
|
601
|
+
roundBox(layoutBox);
|
|
602
|
+
return {
|
|
603
|
+
animationId: this.root.animationId,
|
|
604
|
+
measuredBox: pageBox,
|
|
605
|
+
layoutBox,
|
|
606
|
+
latestValues: {},
|
|
607
|
+
source: this.id,
|
|
608
|
+
};
|
|
609
|
+
}
|
|
610
|
+
measurePageBox() {
|
|
611
|
+
const { visualElement } = this.options;
|
|
612
|
+
if (!visualElement)
|
|
613
|
+
return createBox();
|
|
614
|
+
const box = visualElement.measureViewportBox();
|
|
615
|
+
const wasInScrollRoot = this.scroll?.wasRoot || this.path.some(checkNodeWasScrollRoot);
|
|
616
|
+
if (!wasInScrollRoot) {
|
|
617
|
+
// Remove viewport scroll to give page-relative coordinates
|
|
618
|
+
const { scroll } = this.root;
|
|
619
|
+
if (scroll) {
|
|
620
|
+
translateAxis(box.x, scroll.offset.x);
|
|
621
|
+
translateAxis(box.y, scroll.offset.y);
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
return box;
|
|
625
|
+
}
|
|
626
|
+
removeElementScroll(box) {
|
|
627
|
+
const boxWithoutScroll = createBox();
|
|
628
|
+
copyBoxInto(boxWithoutScroll, box);
|
|
629
|
+
if (this.scroll?.wasRoot) {
|
|
630
|
+
return boxWithoutScroll;
|
|
631
|
+
}
|
|
632
|
+
/**
|
|
633
|
+
* Performance TODO: Keep a cumulative scroll offset down the tree
|
|
634
|
+
* rather than loop back up the path.
|
|
635
|
+
*/
|
|
636
|
+
for (let i = 0; i < this.path.length; i++) {
|
|
637
|
+
const node = this.path[i];
|
|
638
|
+
const { scroll, options } = node;
|
|
639
|
+
if (node !== this.root && scroll && options.layoutScroll) {
|
|
640
|
+
/**
|
|
641
|
+
* If this is a new scroll root, we want to remove all previous scrolls
|
|
642
|
+
* from the viewport box.
|
|
643
|
+
*/
|
|
644
|
+
if (scroll.wasRoot) {
|
|
645
|
+
copyBoxInto(boxWithoutScroll, box);
|
|
646
|
+
}
|
|
647
|
+
translateAxis(boxWithoutScroll.x, scroll.offset.x);
|
|
648
|
+
translateAxis(boxWithoutScroll.y, scroll.offset.y);
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
return boxWithoutScroll;
|
|
652
|
+
}
|
|
653
|
+
applyTransform(box, transformOnly = false) {
|
|
654
|
+
const withTransforms = createBox();
|
|
655
|
+
copyBoxInto(withTransforms, box);
|
|
656
|
+
for (let i = 0; i < this.path.length; i++) {
|
|
657
|
+
const node = this.path[i];
|
|
658
|
+
if (!transformOnly &&
|
|
659
|
+
node.options.layoutScroll &&
|
|
660
|
+
node.scroll &&
|
|
661
|
+
node !== node.root) {
|
|
662
|
+
transformBox(withTransforms, {
|
|
663
|
+
x: -node.scroll.offset.x,
|
|
664
|
+
y: -node.scroll.offset.y,
|
|
665
|
+
});
|
|
666
|
+
}
|
|
667
|
+
if (!hasTransform(node.latestValues))
|
|
668
|
+
continue;
|
|
669
|
+
transformBox(withTransforms, node.latestValues);
|
|
670
|
+
}
|
|
671
|
+
if (hasTransform(this.latestValues)) {
|
|
672
|
+
transformBox(withTransforms, this.latestValues);
|
|
673
|
+
}
|
|
674
|
+
return withTransforms;
|
|
675
|
+
}
|
|
676
|
+
removeTransform(box) {
|
|
677
|
+
const boxWithoutTransform = createBox();
|
|
678
|
+
copyBoxInto(boxWithoutTransform, box);
|
|
679
|
+
for (let i = 0; i < this.path.length; i++) {
|
|
680
|
+
const node = this.path[i];
|
|
681
|
+
if (!node.instance)
|
|
682
|
+
continue;
|
|
683
|
+
if (!hasTransform(node.latestValues))
|
|
684
|
+
continue;
|
|
685
|
+
hasScale(node.latestValues) && node.updateSnapshot();
|
|
686
|
+
const sourceBox = createBox();
|
|
687
|
+
const nodeBox = node.measurePageBox();
|
|
688
|
+
copyBoxInto(sourceBox, nodeBox);
|
|
689
|
+
removeBoxTransforms(boxWithoutTransform, node.latestValues, node.snapshot ? node.snapshot.layoutBox : undefined, sourceBox);
|
|
690
|
+
}
|
|
691
|
+
if (hasTransform(this.latestValues)) {
|
|
692
|
+
removeBoxTransforms(boxWithoutTransform, this.latestValues);
|
|
693
|
+
}
|
|
694
|
+
return boxWithoutTransform;
|
|
695
|
+
}
|
|
696
|
+
setTargetDelta(delta) {
|
|
697
|
+
this.targetDelta = delta;
|
|
698
|
+
this.root.scheduleUpdateProjection();
|
|
699
|
+
this.isProjectionDirty = true;
|
|
700
|
+
}
|
|
701
|
+
setOptions(options) {
|
|
702
|
+
this.options = {
|
|
703
|
+
...this.options,
|
|
704
|
+
...options,
|
|
705
|
+
crossfade: options.crossfade !== undefined ? options.crossfade : true,
|
|
706
|
+
};
|
|
707
|
+
}
|
|
708
|
+
clearMeasurements() {
|
|
709
|
+
this.scroll = undefined;
|
|
710
|
+
this.layout = undefined;
|
|
711
|
+
this.snapshot = undefined;
|
|
712
|
+
this.prevTransformTemplateValue = undefined;
|
|
713
|
+
this.targetDelta = undefined;
|
|
714
|
+
this.target = undefined;
|
|
715
|
+
this.isLayoutDirty = false;
|
|
716
|
+
}
|
|
717
|
+
forceRelativeParentToResolveTarget() {
|
|
718
|
+
if (!this.relativeParent)
|
|
719
|
+
return;
|
|
720
|
+
/**
|
|
721
|
+
* If the parent target isn't up-to-date, force it to update.
|
|
722
|
+
* This is an unfortunate de-optimisation as it means any updating relative
|
|
723
|
+
* projection will cause all the relative parents to recalculate back
|
|
724
|
+
* up the tree.
|
|
725
|
+
*/
|
|
726
|
+
if (this.relativeParent.resolvedRelativeTargetAt !==
|
|
727
|
+
frameData.timestamp) {
|
|
728
|
+
this.relativeParent.resolveTargetDelta(true);
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
resolveTargetDelta(forceRecalculation = false) {
|
|
732
|
+
/**
|
|
733
|
+
* Once the dirty status of nodes has been spread through the tree, we also
|
|
734
|
+
* need to check if we have a shared node of a different depth that has itself
|
|
735
|
+
* been dirtied.
|
|
736
|
+
*/
|
|
737
|
+
const lead = this.getLead();
|
|
738
|
+
this.isProjectionDirty || (this.isProjectionDirty = lead.isProjectionDirty);
|
|
739
|
+
this.isTransformDirty || (this.isTransformDirty = lead.isTransformDirty);
|
|
740
|
+
this.isSharedProjectionDirty || (this.isSharedProjectionDirty = lead.isSharedProjectionDirty);
|
|
741
|
+
const isShared = Boolean(this.resumingFrom) || this !== lead;
|
|
742
|
+
/**
|
|
743
|
+
* We don't use transform for this step of processing so we don't
|
|
744
|
+
* need to check whether any nodes have changed transform.
|
|
745
|
+
*/
|
|
746
|
+
const canSkip = !(forceRecalculation ||
|
|
747
|
+
(isShared && this.isSharedProjectionDirty) ||
|
|
748
|
+
this.isProjectionDirty ||
|
|
749
|
+
this.parent?.isProjectionDirty ||
|
|
750
|
+
this.attemptToResolveRelativeTarget ||
|
|
751
|
+
this.root.updateBlockedByResize);
|
|
752
|
+
if (canSkip)
|
|
753
|
+
return;
|
|
754
|
+
const { layout, layoutId } = this.options;
|
|
755
|
+
/**
|
|
756
|
+
* If we have no layout, we can't perform projection, so early return
|
|
757
|
+
*/
|
|
758
|
+
if (!this.layout || !(layout || layoutId))
|
|
759
|
+
return;
|
|
760
|
+
this.resolvedRelativeTargetAt = frameData.timestamp;
|
|
761
|
+
/**
|
|
762
|
+
* If we don't have a targetDelta but do have a layout, we can attempt to resolve
|
|
763
|
+
* a relativeParent. This will allow a component to perform scale correction
|
|
764
|
+
* even if no animation has started.
|
|
765
|
+
*/
|
|
766
|
+
if (!this.targetDelta && !this.relativeTarget) {
|
|
767
|
+
const relativeParent = this.getClosestProjectingParent();
|
|
768
|
+
if (relativeParent &&
|
|
769
|
+
relativeParent.layout &&
|
|
770
|
+
this.animationProgress !== 1) {
|
|
771
|
+
this.relativeParent = relativeParent;
|
|
772
|
+
this.forceRelativeParentToResolveTarget();
|
|
773
|
+
this.relativeTarget = createBox();
|
|
774
|
+
this.relativeTargetOrigin = createBox();
|
|
775
|
+
calcRelativePosition(this.relativeTargetOrigin, this.layout.layoutBox, relativeParent.layout.layoutBox);
|
|
776
|
+
copyBoxInto(this.relativeTarget, this.relativeTargetOrigin);
|
|
777
|
+
}
|
|
778
|
+
else {
|
|
779
|
+
this.relativeParent = this.relativeTarget = undefined;
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
/**
|
|
783
|
+
* If we have no relative target or no target delta our target isn't valid
|
|
784
|
+
* for this frame.
|
|
785
|
+
*/
|
|
786
|
+
if (!this.relativeTarget && !this.targetDelta)
|
|
787
|
+
return;
|
|
788
|
+
/**
|
|
789
|
+
* Lazy-init target data structure
|
|
790
|
+
*/
|
|
791
|
+
if (!this.target) {
|
|
792
|
+
this.target = createBox();
|
|
793
|
+
this.targetWithTransforms = createBox();
|
|
794
|
+
}
|
|
795
|
+
/**
|
|
796
|
+
* If we've got a relative box for this component, resolve it into a target relative to the parent.
|
|
797
|
+
*/
|
|
798
|
+
if (this.relativeTarget &&
|
|
799
|
+
this.relativeTargetOrigin &&
|
|
800
|
+
this.relativeParent &&
|
|
801
|
+
this.relativeParent.target) {
|
|
802
|
+
this.forceRelativeParentToResolveTarget();
|
|
803
|
+
calcRelativeBox(this.target, this.relativeTarget, this.relativeParent.target);
|
|
804
|
+
/**
|
|
805
|
+
* If we've only got a targetDelta, resolve it into a target
|
|
806
|
+
*/
|
|
807
|
+
}
|
|
808
|
+
else if (this.targetDelta) {
|
|
809
|
+
if (Boolean(this.resumingFrom)) {
|
|
810
|
+
// TODO: This is creating a new object every frame
|
|
811
|
+
this.target = this.applyTransform(this.layout.layoutBox);
|
|
812
|
+
}
|
|
813
|
+
else {
|
|
814
|
+
copyBoxInto(this.target, this.layout.layoutBox);
|
|
815
|
+
}
|
|
816
|
+
applyBoxDelta(this.target, this.targetDelta);
|
|
817
|
+
}
|
|
818
|
+
else {
|
|
819
|
+
/**
|
|
820
|
+
* If no target, use own layout as target
|
|
821
|
+
*/
|
|
822
|
+
copyBoxInto(this.target, this.layout.layoutBox);
|
|
823
|
+
}
|
|
824
|
+
/**
|
|
825
|
+
* If we've been told to attempt to resolve a relative target, do so.
|
|
826
|
+
*/
|
|
827
|
+
if (this.attemptToResolveRelativeTarget) {
|
|
828
|
+
this.attemptToResolveRelativeTarget = false;
|
|
829
|
+
const relativeParent = this.getClosestProjectingParent();
|
|
830
|
+
if (relativeParent &&
|
|
831
|
+
Boolean(relativeParent.resumingFrom) ===
|
|
832
|
+
Boolean(this.resumingFrom) &&
|
|
833
|
+
!relativeParent.options.layoutScroll &&
|
|
834
|
+
relativeParent.target &&
|
|
835
|
+
this.animationProgress !== 1) {
|
|
836
|
+
this.relativeParent = relativeParent;
|
|
837
|
+
this.forceRelativeParentToResolveTarget();
|
|
838
|
+
this.relativeTarget = createBox();
|
|
839
|
+
this.relativeTargetOrigin = createBox();
|
|
840
|
+
calcRelativePosition(this.relativeTargetOrigin, this.target, relativeParent.target);
|
|
841
|
+
copyBoxInto(this.relativeTarget, this.relativeTargetOrigin);
|
|
842
|
+
}
|
|
843
|
+
else {
|
|
844
|
+
this.relativeParent = this.relativeTarget = undefined;
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
getClosestProjectingParent() {
|
|
849
|
+
if (!this.parent ||
|
|
850
|
+
hasScale(this.parent.latestValues) ||
|
|
851
|
+
has2DTranslate(this.parent.latestValues)) {
|
|
852
|
+
return undefined;
|
|
853
|
+
}
|
|
854
|
+
if (this.parent.isProjecting()) {
|
|
855
|
+
return this.parent;
|
|
856
|
+
}
|
|
857
|
+
else {
|
|
858
|
+
return this.parent.getClosestProjectingParent();
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
isProjecting() {
|
|
862
|
+
return Boolean((this.relativeTarget ||
|
|
863
|
+
this.targetDelta ||
|
|
864
|
+
this.options.layoutRoot) &&
|
|
865
|
+
this.layout);
|
|
866
|
+
}
|
|
867
|
+
calcProjection() {
|
|
868
|
+
const lead = this.getLead();
|
|
869
|
+
const isShared = Boolean(this.resumingFrom) || this !== lead;
|
|
870
|
+
let canSkip = true;
|
|
871
|
+
/**
|
|
872
|
+
* If this is a normal layout animation and neither this node nor its nearest projecting
|
|
873
|
+
* is dirty then we can't skip.
|
|
874
|
+
*/
|
|
875
|
+
if (this.isProjectionDirty || this.parent?.isProjectionDirty) {
|
|
876
|
+
canSkip = false;
|
|
877
|
+
}
|
|
878
|
+
/**
|
|
879
|
+
* If this is a shared layout animation and this node's shared projection is dirty then
|
|
880
|
+
* we can't skip.
|
|
881
|
+
*/
|
|
882
|
+
if (isShared &&
|
|
883
|
+
(this.isSharedProjectionDirty || this.isTransformDirty)) {
|
|
884
|
+
canSkip = false;
|
|
885
|
+
}
|
|
886
|
+
/**
|
|
887
|
+
* If we have resolved the target this frame we must recalculate the
|
|
888
|
+
* projection to ensure it visually represents the internal calculations.
|
|
889
|
+
*/
|
|
890
|
+
if (this.resolvedRelativeTargetAt === frameData.timestamp) {
|
|
891
|
+
canSkip = false;
|
|
892
|
+
}
|
|
893
|
+
if (canSkip)
|
|
894
|
+
return;
|
|
895
|
+
const { layout, layoutId } = this.options;
|
|
896
|
+
/**
|
|
897
|
+
* If this section of the tree isn't animating we can
|
|
898
|
+
* delete our target sources for the following frame.
|
|
899
|
+
*/
|
|
900
|
+
this.isTreeAnimating = Boolean((this.parent && this.parent.isTreeAnimating) ||
|
|
901
|
+
this.currentAnimation ||
|
|
902
|
+
this.pendingAnimation);
|
|
903
|
+
if (!this.isTreeAnimating) {
|
|
904
|
+
this.targetDelta = this.relativeTarget = undefined;
|
|
905
|
+
}
|
|
906
|
+
if (!this.layout || !(layout || layoutId))
|
|
907
|
+
return;
|
|
908
|
+
/**
|
|
909
|
+
* Reset the corrected box with the latest values from box, as we're then going
|
|
910
|
+
* to perform mutative operations on it.
|
|
911
|
+
*/
|
|
912
|
+
copyBoxInto(this.layoutCorrected, this.layout.layoutBox);
|
|
913
|
+
/**
|
|
914
|
+
* Record previous tree scales before updating.
|
|
915
|
+
*/
|
|
916
|
+
const prevTreeScaleX = this.treeScale.x;
|
|
917
|
+
const prevTreeScaleY = this.treeScale.y;
|
|
918
|
+
/**
|
|
919
|
+
* Apply all the parent deltas to this box to produce the corrected box. This
|
|
920
|
+
* is the layout box, as it will appear on screen as a result of the transforms of its parents.
|
|
921
|
+
*/
|
|
922
|
+
applyTreeDeltas(this.layoutCorrected, this.treeScale, this.path, isShared);
|
|
923
|
+
/**
|
|
924
|
+
* If this layer needs to perform scale correction but doesn't have a target,
|
|
925
|
+
* use the layout as the target.
|
|
926
|
+
*/
|
|
927
|
+
if (lead.layout &&
|
|
928
|
+
!lead.target &&
|
|
929
|
+
(this.treeScale.x !== 1 || this.treeScale.y !== 1)) {
|
|
930
|
+
lead.target = lead.layout.layoutBox;
|
|
931
|
+
lead.targetWithTransforms = createBox();
|
|
932
|
+
}
|
|
933
|
+
const { target } = lead;
|
|
934
|
+
if (!target) {
|
|
935
|
+
/**
|
|
936
|
+
* If we don't have a target to project into, but we were previously
|
|
937
|
+
* projecting, we want to remove the stored transform and schedule
|
|
938
|
+
* a render to ensure the elements reflect the removed transform.
|
|
939
|
+
*/
|
|
940
|
+
if (this.prevProjectionDelta) {
|
|
941
|
+
this.createProjectionDeltas();
|
|
942
|
+
this.scheduleRender();
|
|
943
|
+
}
|
|
944
|
+
return;
|
|
945
|
+
}
|
|
946
|
+
if (!this.projectionDelta || !this.prevProjectionDelta) {
|
|
947
|
+
this.createProjectionDeltas();
|
|
948
|
+
}
|
|
949
|
+
else {
|
|
950
|
+
copyAxisDeltaInto(this.prevProjectionDelta.x, this.projectionDelta.x);
|
|
951
|
+
copyAxisDeltaInto(this.prevProjectionDelta.y, this.projectionDelta.y);
|
|
952
|
+
}
|
|
953
|
+
/**
|
|
954
|
+
* Update the delta between the corrected box and the target box before user-set transforms were applied.
|
|
955
|
+
* This will allow us to calculate the corrected borderRadius and boxShadow to compensate
|
|
956
|
+
* for our layout reprojection, but still allow them to be scaled correctly by the user.
|
|
957
|
+
* It might be that to simplify this we may want to accept that user-set scale is also corrected
|
|
958
|
+
* and we wouldn't have to keep and calc both deltas, OR we could support a user setting
|
|
959
|
+
* to allow people to choose whether these styles are corrected based on just the
|
|
960
|
+
* layout reprojection or the final bounding box.
|
|
961
|
+
*/
|
|
962
|
+
calcBoxDelta(this.projectionDelta, this.layoutCorrected, target, this.latestValues);
|
|
963
|
+
if (this.treeScale.x !== prevTreeScaleX ||
|
|
964
|
+
this.treeScale.y !== prevTreeScaleY ||
|
|
965
|
+
!axisDeltaEquals(this.projectionDelta.x, this.prevProjectionDelta.x) ||
|
|
966
|
+
!axisDeltaEquals(this.projectionDelta.y, this.prevProjectionDelta.y)) {
|
|
967
|
+
this.hasProjected = true;
|
|
968
|
+
this.scheduleRender();
|
|
969
|
+
this.notifyListeners("projectionUpdate", target);
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
hide() {
|
|
973
|
+
this.isVisible = false;
|
|
974
|
+
// TODO: Schedule render
|
|
975
|
+
}
|
|
976
|
+
show() {
|
|
977
|
+
this.isVisible = true;
|
|
978
|
+
// TODO: Schedule render
|
|
979
|
+
}
|
|
980
|
+
scheduleRender(notifyAll = true) {
|
|
981
|
+
this.options.visualElement?.scheduleRender();
|
|
982
|
+
if (notifyAll) {
|
|
983
|
+
const stack = this.getStack();
|
|
984
|
+
stack && stack.scheduleRender();
|
|
985
|
+
}
|
|
986
|
+
if (this.resumingFrom && !this.resumingFrom.instance) {
|
|
987
|
+
this.resumingFrom = undefined;
|
|
988
|
+
}
|
|
989
|
+
}
|
|
990
|
+
createProjectionDeltas() {
|
|
991
|
+
this.prevProjectionDelta = createDelta();
|
|
992
|
+
this.projectionDelta = createDelta();
|
|
993
|
+
this.projectionDeltaWithTransform = createDelta();
|
|
994
|
+
}
|
|
995
|
+
setAnimationOrigin(delta, hasOnlyRelativeTargetChanged = false) {
|
|
996
|
+
const snapshot = this.snapshot;
|
|
997
|
+
const snapshotLatestValues = snapshot ? snapshot.latestValues : {};
|
|
998
|
+
const mixedValues = { ...this.latestValues };
|
|
999
|
+
const targetDelta = createDelta();
|
|
1000
|
+
if (!this.relativeParent ||
|
|
1001
|
+
!this.relativeParent.options.layoutRoot) {
|
|
1002
|
+
this.relativeTarget = this.relativeTargetOrigin = undefined;
|
|
1003
|
+
}
|
|
1004
|
+
this.attemptToResolveRelativeTarget = !hasOnlyRelativeTargetChanged;
|
|
1005
|
+
const relativeLayout = createBox();
|
|
1006
|
+
const snapshotSource = snapshot ? snapshot.source : undefined;
|
|
1007
|
+
const layoutSource = this.layout ? this.layout.source : undefined;
|
|
1008
|
+
const isSharedLayoutAnimation = snapshotSource !== layoutSource;
|
|
1009
|
+
const stack = this.getStack();
|
|
1010
|
+
const isOnlyMember = !stack || stack.members.length <= 1;
|
|
1011
|
+
const shouldCrossfadeOpacity = Boolean(isSharedLayoutAnimation &&
|
|
1012
|
+
!isOnlyMember &&
|
|
1013
|
+
this.options.crossfade === true &&
|
|
1014
|
+
!this.path.some(hasOpacityCrossfade));
|
|
1015
|
+
this.animationProgress = 0;
|
|
1016
|
+
let prevRelativeTarget;
|
|
1017
|
+
this.mixTargetDelta = (latest) => {
|
|
1018
|
+
const progress = latest / 1000;
|
|
1019
|
+
mixAxisDelta(targetDelta.x, delta.x, progress);
|
|
1020
|
+
mixAxisDelta(targetDelta.y, delta.y, progress);
|
|
1021
|
+
this.setTargetDelta(targetDelta);
|
|
1022
|
+
if (this.relativeTarget &&
|
|
1023
|
+
this.relativeTargetOrigin &&
|
|
1024
|
+
this.layout &&
|
|
1025
|
+
this.relativeParent &&
|
|
1026
|
+
this.relativeParent.layout) {
|
|
1027
|
+
calcRelativePosition(relativeLayout, this.layout.layoutBox, this.relativeParent.layout.layoutBox);
|
|
1028
|
+
mixBox(this.relativeTarget, this.relativeTargetOrigin, relativeLayout, progress);
|
|
1029
|
+
/**
|
|
1030
|
+
* If this is an unchanged relative target we can consider the
|
|
1031
|
+
* projection not dirty.
|
|
1032
|
+
*/
|
|
1033
|
+
if (prevRelativeTarget &&
|
|
1034
|
+
boxEquals(this.relativeTarget, prevRelativeTarget)) {
|
|
1035
|
+
this.isProjectionDirty = false;
|
|
1036
|
+
}
|
|
1037
|
+
if (!prevRelativeTarget)
|
|
1038
|
+
prevRelativeTarget = createBox();
|
|
1039
|
+
copyBoxInto(prevRelativeTarget, this.relativeTarget);
|
|
1040
|
+
}
|
|
1041
|
+
if (isSharedLayoutAnimation) {
|
|
1042
|
+
this.animationValues = mixedValues;
|
|
1043
|
+
mixValues(mixedValues, snapshotLatestValues, this.latestValues, progress, shouldCrossfadeOpacity, isOnlyMember);
|
|
1044
|
+
}
|
|
1045
|
+
this.root.scheduleUpdateProjection();
|
|
1046
|
+
this.scheduleRender();
|
|
1047
|
+
this.animationProgress = progress;
|
|
1048
|
+
};
|
|
1049
|
+
this.mixTargetDelta(this.options.layoutRoot ? 1000 : 0);
|
|
1050
|
+
}
|
|
1051
|
+
startAnimation(options) {
|
|
1052
|
+
this.notifyListeners("animationStart");
|
|
1053
|
+
this.currentAnimation?.stop();
|
|
1054
|
+
this.resumingFrom?.currentAnimation?.stop();
|
|
1055
|
+
if (this.pendingAnimation) {
|
|
1056
|
+
cancelFrame(this.pendingAnimation);
|
|
1057
|
+
this.pendingAnimation = undefined;
|
|
1058
|
+
}
|
|
1059
|
+
/**
|
|
1060
|
+
* Start the animation in the next frame to have a frame with progress 0,
|
|
1061
|
+
* where the target is the same as when the animation started, so we can
|
|
1062
|
+
* calculate the relative positions correctly for instant transitions.
|
|
1063
|
+
*/
|
|
1064
|
+
this.pendingAnimation = frame.update(() => {
|
|
1065
|
+
globalProjectionState.hasAnimatedSinceResize = true;
|
|
1066
|
+
this.motionValue || (this.motionValue = motionValue(0));
|
|
1067
|
+
this.currentAnimation = animateSingleValue(this.motionValue, [0, 1000], {
|
|
1068
|
+
...options,
|
|
1069
|
+
velocity: 0,
|
|
1070
|
+
isSync: true,
|
|
1071
|
+
onUpdate: (latest) => {
|
|
1072
|
+
this.mixTargetDelta(latest);
|
|
1073
|
+
options.onUpdate && options.onUpdate(latest);
|
|
1074
|
+
},
|
|
1075
|
+
onStop: () => {
|
|
1076
|
+
},
|
|
1077
|
+
onComplete: () => {
|
|
1078
|
+
options.onComplete && options.onComplete();
|
|
1079
|
+
this.completeAnimation();
|
|
1080
|
+
},
|
|
1081
|
+
});
|
|
1082
|
+
if (this.resumingFrom) {
|
|
1083
|
+
this.resumingFrom.currentAnimation = this.currentAnimation;
|
|
1084
|
+
}
|
|
1085
|
+
this.pendingAnimation = undefined;
|
|
1086
|
+
});
|
|
1087
|
+
}
|
|
1088
|
+
completeAnimation() {
|
|
1089
|
+
if (this.resumingFrom) {
|
|
1090
|
+
this.resumingFrom.currentAnimation = undefined;
|
|
1091
|
+
this.resumingFrom.preserveOpacity = undefined;
|
|
1092
|
+
}
|
|
1093
|
+
const stack = this.getStack();
|
|
1094
|
+
stack && stack.exitAnimationComplete();
|
|
1095
|
+
this.resumingFrom =
|
|
1096
|
+
this.currentAnimation =
|
|
1097
|
+
this.animationValues =
|
|
1098
|
+
undefined;
|
|
1099
|
+
this.notifyListeners("animationComplete");
|
|
1100
|
+
}
|
|
1101
|
+
finishAnimation() {
|
|
1102
|
+
if (this.currentAnimation) {
|
|
1103
|
+
this.mixTargetDelta && this.mixTargetDelta(animationTarget);
|
|
1104
|
+
this.currentAnimation.stop();
|
|
1105
|
+
}
|
|
1106
|
+
this.completeAnimation();
|
|
1107
|
+
}
|
|
1108
|
+
applyTransformsToTarget() {
|
|
1109
|
+
const lead = this.getLead();
|
|
1110
|
+
let { targetWithTransforms, target, layout, latestValues } = lead;
|
|
1111
|
+
if (!targetWithTransforms || !target || !layout)
|
|
1112
|
+
return;
|
|
1113
|
+
/**
|
|
1114
|
+
* If we're only animating position, and this element isn't the lead element,
|
|
1115
|
+
* then instead of projecting into the lead box we instead want to calculate
|
|
1116
|
+
* a new target that aligns the two boxes but maintains the layout shape.
|
|
1117
|
+
*/
|
|
1118
|
+
if (this !== lead &&
|
|
1119
|
+
this.layout &&
|
|
1120
|
+
layout &&
|
|
1121
|
+
shouldAnimatePositionOnly(this.options.animationType, this.layout.layoutBox, layout.layoutBox)) {
|
|
1122
|
+
target = this.target || createBox();
|
|
1123
|
+
const xLength = calcLength(this.layout.layoutBox.x);
|
|
1124
|
+
target.x.min = lead.target.x.min;
|
|
1125
|
+
target.x.max = target.x.min + xLength;
|
|
1126
|
+
const yLength = calcLength(this.layout.layoutBox.y);
|
|
1127
|
+
target.y.min = lead.target.y.min;
|
|
1128
|
+
target.y.max = target.y.min + yLength;
|
|
1129
|
+
}
|
|
1130
|
+
copyBoxInto(targetWithTransforms, target);
|
|
1131
|
+
/**
|
|
1132
|
+
* Apply the latest user-set transforms to the targetBox to produce the targetBoxFinal.
|
|
1133
|
+
* This is the final box that we will then project into by calculating a transform delta and
|
|
1134
|
+
* applying it to the corrected box.
|
|
1135
|
+
*/
|
|
1136
|
+
transformBox(targetWithTransforms, latestValues);
|
|
1137
|
+
/**
|
|
1138
|
+
* Update the delta between the corrected box and the final target box, after
|
|
1139
|
+
* user-set transforms are applied to it. This will be used by the renderer to
|
|
1140
|
+
* create a transform style that will reproject the element from its layout layout
|
|
1141
|
+
* into the desired bounding box.
|
|
1142
|
+
*/
|
|
1143
|
+
calcBoxDelta(this.projectionDeltaWithTransform, this.layoutCorrected, targetWithTransforms, latestValues);
|
|
1144
|
+
}
|
|
1145
|
+
registerSharedNode(layoutId, node) {
|
|
1146
|
+
if (!this.sharedNodes.has(layoutId)) {
|
|
1147
|
+
this.sharedNodes.set(layoutId, new NodeStack());
|
|
1148
|
+
}
|
|
1149
|
+
const stack = this.sharedNodes.get(layoutId);
|
|
1150
|
+
stack.add(node);
|
|
1151
|
+
const config = node.options.initialPromotionConfig;
|
|
1152
|
+
node.promote({
|
|
1153
|
+
transition: config ? config.transition : undefined,
|
|
1154
|
+
preserveFollowOpacity: config && config.shouldPreserveFollowOpacity
|
|
1155
|
+
? config.shouldPreserveFollowOpacity(node)
|
|
1156
|
+
: undefined,
|
|
1157
|
+
});
|
|
1158
|
+
}
|
|
1159
|
+
isLead() {
|
|
1160
|
+
const stack = this.getStack();
|
|
1161
|
+
return stack ? stack.lead === this : true;
|
|
1162
|
+
}
|
|
1163
|
+
getLead() {
|
|
1164
|
+
const { layoutId } = this.options;
|
|
1165
|
+
return layoutId ? this.getStack()?.lead || this : this;
|
|
1166
|
+
}
|
|
1167
|
+
getPrevLead() {
|
|
1168
|
+
const { layoutId } = this.options;
|
|
1169
|
+
return layoutId ? this.getStack()?.prevLead : undefined;
|
|
1170
|
+
}
|
|
1171
|
+
getStack() {
|
|
1172
|
+
const { layoutId } = this.options;
|
|
1173
|
+
if (layoutId)
|
|
1174
|
+
return this.root.sharedNodes.get(layoutId);
|
|
1175
|
+
}
|
|
1176
|
+
promote({ needsReset, transition, preserveFollowOpacity, } = {}) {
|
|
1177
|
+
const stack = this.getStack();
|
|
1178
|
+
if (stack)
|
|
1179
|
+
stack.promote(this, preserveFollowOpacity);
|
|
1180
|
+
if (needsReset) {
|
|
1181
|
+
this.projectionDelta = undefined;
|
|
1182
|
+
this.needsReset = true;
|
|
1183
|
+
}
|
|
1184
|
+
if (transition)
|
|
1185
|
+
this.setOptions({ transition });
|
|
1186
|
+
}
|
|
1187
|
+
relegate() {
|
|
1188
|
+
const stack = this.getStack();
|
|
1189
|
+
if (stack) {
|
|
1190
|
+
return stack.relegate(this);
|
|
1191
|
+
}
|
|
1192
|
+
else {
|
|
1193
|
+
return false;
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
resetSkewAndRotation() {
|
|
1197
|
+
const { visualElement } = this.options;
|
|
1198
|
+
if (!visualElement)
|
|
1199
|
+
return;
|
|
1200
|
+
// If there's no detected skew or rotation values, we can early return without a forced render.
|
|
1201
|
+
let hasDistortingTransform = false;
|
|
1202
|
+
/**
|
|
1203
|
+
* An unrolled check for rotation values. Most elements don't have any rotation and
|
|
1204
|
+
* skipping the nested loop and new object creation is 50% faster.
|
|
1205
|
+
*/
|
|
1206
|
+
const { latestValues } = visualElement;
|
|
1207
|
+
if (latestValues.z ||
|
|
1208
|
+
latestValues.rotate ||
|
|
1209
|
+
latestValues.rotateX ||
|
|
1210
|
+
latestValues.rotateY ||
|
|
1211
|
+
latestValues.rotateZ ||
|
|
1212
|
+
latestValues.skewX ||
|
|
1213
|
+
latestValues.skewY) {
|
|
1214
|
+
hasDistortingTransform = true;
|
|
1215
|
+
}
|
|
1216
|
+
// If there's no distorting values, we don't need to do any more.
|
|
1217
|
+
if (!hasDistortingTransform)
|
|
1218
|
+
return;
|
|
1219
|
+
const resetValues = {};
|
|
1220
|
+
if (latestValues.z) {
|
|
1221
|
+
resetDistortingTransform("z", visualElement, resetValues, this.animationValues);
|
|
1222
|
+
}
|
|
1223
|
+
// Check the skew and rotate value of all axes and reset to 0
|
|
1224
|
+
for (let i = 0; i < transformAxes.length; i++) {
|
|
1225
|
+
resetDistortingTransform(`rotate${transformAxes[i]}`, visualElement, resetValues, this.animationValues);
|
|
1226
|
+
resetDistortingTransform(`skew${transformAxes[i]}`, visualElement, resetValues, this.animationValues);
|
|
1227
|
+
}
|
|
1228
|
+
// Force a render of this element to apply the transform with all skews and rotations
|
|
1229
|
+
// set to 0.
|
|
1230
|
+
visualElement.render();
|
|
1231
|
+
// Put back all the values we reset
|
|
1232
|
+
for (const key in resetValues) {
|
|
1233
|
+
visualElement.setStaticValue(key, resetValues[key]);
|
|
1234
|
+
if (this.animationValues) {
|
|
1235
|
+
this.animationValues[key] = resetValues[key];
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
// Schedule a render for the next frame. This ensures we won't visually
|
|
1239
|
+
// see the element with the reset rotate value applied.
|
|
1240
|
+
visualElement.scheduleRender();
|
|
1241
|
+
}
|
|
1242
|
+
applyProjectionStyles(targetStyle, // CSSStyleDeclaration - doesn't allow numbers to be assigned to properties
|
|
1243
|
+
styleProp) {
|
|
1244
|
+
if (!this.instance || this.isSVG)
|
|
1245
|
+
return;
|
|
1246
|
+
if (!this.isVisible) {
|
|
1247
|
+
targetStyle.visibility = "hidden";
|
|
1248
|
+
return;
|
|
1249
|
+
}
|
|
1250
|
+
const transformTemplate = this.getTransformTemplate();
|
|
1251
|
+
if (this.needsReset) {
|
|
1252
|
+
this.needsReset = false;
|
|
1253
|
+
targetStyle.visibility = "";
|
|
1254
|
+
targetStyle.opacity = "";
|
|
1255
|
+
targetStyle.pointerEvents =
|
|
1256
|
+
resolveMotionValue(styleProp?.pointerEvents) || "";
|
|
1257
|
+
targetStyle.transform = transformTemplate
|
|
1258
|
+
? transformTemplate(this.latestValues, "")
|
|
1259
|
+
: "none";
|
|
1260
|
+
return;
|
|
1261
|
+
}
|
|
1262
|
+
const lead = this.getLead();
|
|
1263
|
+
if (!this.projectionDelta || !this.layout || !lead.target) {
|
|
1264
|
+
if (this.options.layoutId) {
|
|
1265
|
+
targetStyle.opacity =
|
|
1266
|
+
this.latestValues.opacity !== undefined
|
|
1267
|
+
? this.latestValues.opacity
|
|
1268
|
+
: 1;
|
|
1269
|
+
targetStyle.pointerEvents =
|
|
1270
|
+
resolveMotionValue(styleProp?.pointerEvents) || "";
|
|
1271
|
+
}
|
|
1272
|
+
if (this.hasProjected && !hasTransform(this.latestValues)) {
|
|
1273
|
+
targetStyle.transform = transformTemplate
|
|
1274
|
+
? transformTemplate({}, "")
|
|
1275
|
+
: "none";
|
|
1276
|
+
this.hasProjected = false;
|
|
1277
|
+
}
|
|
1278
|
+
return;
|
|
1279
|
+
}
|
|
1280
|
+
targetStyle.visibility = "";
|
|
1281
|
+
const valuesToRender = lead.animationValues || lead.latestValues;
|
|
1282
|
+
this.applyTransformsToTarget();
|
|
1283
|
+
let transform = buildProjectionTransform(this.projectionDeltaWithTransform, this.treeScale, valuesToRender);
|
|
1284
|
+
if (transformTemplate) {
|
|
1285
|
+
transform = transformTemplate(valuesToRender, transform);
|
|
1286
|
+
}
|
|
1287
|
+
targetStyle.transform = transform;
|
|
1288
|
+
const { x, y } = this.projectionDelta;
|
|
1289
|
+
targetStyle.transformOrigin = `${x.origin * 100}% ${y.origin * 100}% 0`;
|
|
1290
|
+
if (lead.animationValues) {
|
|
1291
|
+
/**
|
|
1292
|
+
* If the lead component is animating, assign this either the entering/leaving
|
|
1293
|
+
* opacity
|
|
1294
|
+
*/
|
|
1295
|
+
targetStyle.opacity =
|
|
1296
|
+
lead === this
|
|
1297
|
+
? valuesToRender.opacity ??
|
|
1298
|
+
this.latestValues.opacity ??
|
|
1299
|
+
1
|
|
1300
|
+
: this.preserveOpacity
|
|
1301
|
+
? this.latestValues.opacity
|
|
1302
|
+
: valuesToRender.opacityExit;
|
|
1303
|
+
}
|
|
1304
|
+
else {
|
|
1305
|
+
/**
|
|
1306
|
+
* Or we're not animating at all, set the lead component to its layout
|
|
1307
|
+
* opacity and other components to hidden.
|
|
1308
|
+
*/
|
|
1309
|
+
targetStyle.opacity =
|
|
1310
|
+
lead === this
|
|
1311
|
+
? valuesToRender.opacity !== undefined
|
|
1312
|
+
? valuesToRender.opacity
|
|
1313
|
+
: ""
|
|
1314
|
+
: valuesToRender.opacityExit !== undefined
|
|
1315
|
+
? valuesToRender.opacityExit
|
|
1316
|
+
: 0;
|
|
1317
|
+
}
|
|
1318
|
+
/**
|
|
1319
|
+
* Apply scale correction
|
|
1320
|
+
*/
|
|
1321
|
+
for (const key in scaleCorrectors) {
|
|
1322
|
+
if (valuesToRender[key] === undefined)
|
|
1323
|
+
continue;
|
|
1324
|
+
const { correct, applyTo, isCSSVariable } = scaleCorrectors[key];
|
|
1325
|
+
/**
|
|
1326
|
+
* Only apply scale correction to the value if we have an
|
|
1327
|
+
* active projection transform. Otherwise these values become
|
|
1328
|
+
* vulnerable to distortion if the element changes size without
|
|
1329
|
+
* a corresponding layout animation.
|
|
1330
|
+
*/
|
|
1331
|
+
const corrected = transform === "none"
|
|
1332
|
+
? valuesToRender[key]
|
|
1333
|
+
: correct(valuesToRender[key], lead);
|
|
1334
|
+
if (applyTo) {
|
|
1335
|
+
const num = applyTo.length;
|
|
1336
|
+
for (let i = 0; i < num; i++) {
|
|
1337
|
+
targetStyle[applyTo[i]] = corrected;
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1340
|
+
else {
|
|
1341
|
+
// If this is a CSS variable, set it directly on the instance.
|
|
1342
|
+
// Replacing this function from creating styles to setting them
|
|
1343
|
+
// would be a good place to remove per frame object creation
|
|
1344
|
+
if (isCSSVariable) {
|
|
1345
|
+
this.options.visualElement.renderState.vars[key] = corrected;
|
|
1346
|
+
}
|
|
1347
|
+
else {
|
|
1348
|
+
targetStyle[key] = corrected;
|
|
1349
|
+
}
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1352
|
+
/**
|
|
1353
|
+
* Disable pointer events on follow components. This is to ensure
|
|
1354
|
+
* that if a follow component covers a lead component it doesn't block
|
|
1355
|
+
* pointer events on the lead.
|
|
1356
|
+
*/
|
|
1357
|
+
if (this.options.layoutId) {
|
|
1358
|
+
targetStyle.pointerEvents =
|
|
1359
|
+
lead === this
|
|
1360
|
+
? resolveMotionValue(styleProp?.pointerEvents) || ""
|
|
1361
|
+
: "none";
|
|
1362
|
+
}
|
|
1363
|
+
}
|
|
1364
|
+
clearSnapshot() {
|
|
1365
|
+
this.resumeFrom = this.snapshot = undefined;
|
|
1366
|
+
}
|
|
1367
|
+
// Only run on root
|
|
1368
|
+
resetTree() {
|
|
1369
|
+
this.root.nodes.forEach((node) => node.currentAnimation?.stop());
|
|
1370
|
+
this.root.nodes.forEach(clearMeasurements);
|
|
1371
|
+
this.root.sharedNodes.clear();
|
|
1372
|
+
}
|
|
1373
|
+
};
|
|
1374
|
+
}
|
|
1375
|
+
function updateLayout(node) {
|
|
1376
|
+
node.updateLayout();
|
|
1377
|
+
}
|
|
1378
|
+
function notifyLayoutUpdate(node) {
|
|
1379
|
+
const snapshot = node.resumeFrom?.snapshot || node.snapshot;
|
|
1380
|
+
if (node.isLead() &&
|
|
1381
|
+
node.layout &&
|
|
1382
|
+
snapshot &&
|
|
1383
|
+
node.hasListeners("didUpdate")) {
|
|
1384
|
+
const { layoutBox: layout, measuredBox: measuredLayout } = node.layout;
|
|
1385
|
+
const { animationType } = node.options;
|
|
1386
|
+
const isShared = snapshot.source !== node.layout.source;
|
|
1387
|
+
// TODO Maybe we want to also resize the layout snapshot so we don't trigger
|
|
1388
|
+
// animations for instance if layout="size" and an element has only changed position
|
|
1389
|
+
if (animationType === "size") {
|
|
1390
|
+
eachAxis((axis) => {
|
|
1391
|
+
const axisSnapshot = isShared
|
|
1392
|
+
? snapshot.measuredBox[axis]
|
|
1393
|
+
: snapshot.layoutBox[axis];
|
|
1394
|
+
const length = calcLength(axisSnapshot);
|
|
1395
|
+
axisSnapshot.min = layout[axis].min;
|
|
1396
|
+
axisSnapshot.max = axisSnapshot.min + length;
|
|
1397
|
+
});
|
|
1398
|
+
}
|
|
1399
|
+
else if (shouldAnimatePositionOnly(animationType, snapshot.layoutBox, layout)) {
|
|
1400
|
+
eachAxis((axis) => {
|
|
1401
|
+
const axisSnapshot = isShared
|
|
1402
|
+
? snapshot.measuredBox[axis]
|
|
1403
|
+
: snapshot.layoutBox[axis];
|
|
1404
|
+
const length = calcLength(layout[axis]);
|
|
1405
|
+
axisSnapshot.max = axisSnapshot.min + length;
|
|
1406
|
+
/**
|
|
1407
|
+
* Ensure relative target gets resized and rerendererd
|
|
1408
|
+
*/
|
|
1409
|
+
if (node.relativeTarget && !node.currentAnimation) {
|
|
1410
|
+
node.isProjectionDirty = true;
|
|
1411
|
+
node.relativeTarget[axis].max =
|
|
1412
|
+
node.relativeTarget[axis].min + length;
|
|
1413
|
+
}
|
|
1414
|
+
});
|
|
1415
|
+
}
|
|
1416
|
+
const layoutDelta = createDelta();
|
|
1417
|
+
calcBoxDelta(layoutDelta, layout, snapshot.layoutBox);
|
|
1418
|
+
const visualDelta = createDelta();
|
|
1419
|
+
if (isShared) {
|
|
1420
|
+
calcBoxDelta(visualDelta, node.applyTransform(measuredLayout, true), snapshot.measuredBox);
|
|
1421
|
+
}
|
|
1422
|
+
else {
|
|
1423
|
+
calcBoxDelta(visualDelta, layout, snapshot.layoutBox);
|
|
1424
|
+
}
|
|
1425
|
+
const hasLayoutChanged = !isDeltaZero(layoutDelta);
|
|
1426
|
+
let hasRelativeLayoutChanged = false;
|
|
1427
|
+
if (!node.resumeFrom) {
|
|
1428
|
+
const relativeParent = node.getClosestProjectingParent();
|
|
1429
|
+
/**
|
|
1430
|
+
* If the relativeParent is itself resuming from a different element then
|
|
1431
|
+
* the relative snapshot is not relavent
|
|
1432
|
+
*/
|
|
1433
|
+
if (relativeParent && !relativeParent.resumeFrom) {
|
|
1434
|
+
const { snapshot: parentSnapshot, layout: parentLayout } = relativeParent;
|
|
1435
|
+
if (parentSnapshot && parentLayout) {
|
|
1436
|
+
const relativeSnapshot = createBox();
|
|
1437
|
+
calcRelativePosition(relativeSnapshot, snapshot.layoutBox, parentSnapshot.layoutBox);
|
|
1438
|
+
const relativeLayout = createBox();
|
|
1439
|
+
calcRelativePosition(relativeLayout, layout, parentLayout.layoutBox);
|
|
1440
|
+
if (!boxEqualsRounded(relativeSnapshot, relativeLayout)) {
|
|
1441
|
+
hasRelativeLayoutChanged = true;
|
|
1442
|
+
}
|
|
1443
|
+
if (relativeParent.options.layoutRoot) {
|
|
1444
|
+
node.relativeTarget = relativeLayout;
|
|
1445
|
+
node.relativeTargetOrigin = relativeSnapshot;
|
|
1446
|
+
node.relativeParent = relativeParent;
|
|
1447
|
+
}
|
|
1448
|
+
}
|
|
1449
|
+
}
|
|
1450
|
+
}
|
|
1451
|
+
node.notifyListeners("didUpdate", {
|
|
1452
|
+
layout,
|
|
1453
|
+
snapshot,
|
|
1454
|
+
delta: visualDelta,
|
|
1455
|
+
layoutDelta,
|
|
1456
|
+
hasLayoutChanged,
|
|
1457
|
+
hasRelativeLayoutChanged,
|
|
1458
|
+
});
|
|
1459
|
+
}
|
|
1460
|
+
else if (node.isLead()) {
|
|
1461
|
+
const { onExitComplete } = node.options;
|
|
1462
|
+
onExitComplete && onExitComplete();
|
|
1463
|
+
}
|
|
1464
|
+
/**
|
|
1465
|
+
* Clearing transition
|
|
1466
|
+
* TODO: Investigate why this transition is being passed in as {type: false } from Framer
|
|
1467
|
+
* and why we need it at all
|
|
1468
|
+
*/
|
|
1469
|
+
node.options.transition = undefined;
|
|
1470
|
+
}
|
|
1471
|
+
function propagateDirtyNodes(node) {
|
|
1472
|
+
if (!node.parent)
|
|
1473
|
+
return;
|
|
1474
|
+
/**
|
|
1475
|
+
* If this node isn't projecting, propagate isProjectionDirty. It will have
|
|
1476
|
+
* no performance impact but it will allow the next child that *is* projecting
|
|
1477
|
+
* but *isn't* dirty to just check its parent to see if *any* ancestor needs
|
|
1478
|
+
* correcting.
|
|
1479
|
+
*/
|
|
1480
|
+
if (!node.isProjecting()) {
|
|
1481
|
+
node.isProjectionDirty = node.parent.isProjectionDirty;
|
|
1482
|
+
}
|
|
1483
|
+
/**
|
|
1484
|
+
* Propagate isSharedProjectionDirty and isTransformDirty
|
|
1485
|
+
* throughout the whole tree. A future revision can take another look at
|
|
1486
|
+
* this but for safety we still recalcualte shared nodes.
|
|
1487
|
+
*/
|
|
1488
|
+
node.isSharedProjectionDirty || (node.isSharedProjectionDirty = Boolean(node.isProjectionDirty ||
|
|
1489
|
+
node.parent.isProjectionDirty ||
|
|
1490
|
+
node.parent.isSharedProjectionDirty));
|
|
1491
|
+
node.isTransformDirty || (node.isTransformDirty = node.parent.isTransformDirty);
|
|
1492
|
+
}
|
|
1493
|
+
function cleanDirtyNodes(node) {
|
|
1494
|
+
node.isProjectionDirty =
|
|
1495
|
+
node.isSharedProjectionDirty =
|
|
1496
|
+
node.isTransformDirty =
|
|
1497
|
+
false;
|
|
1498
|
+
}
|
|
1499
|
+
function clearSnapshot(node) {
|
|
1500
|
+
node.clearSnapshot();
|
|
1501
|
+
}
|
|
1502
|
+
function clearMeasurements(node) {
|
|
1503
|
+
node.clearMeasurements();
|
|
1504
|
+
}
|
|
1505
|
+
function clearIsLayoutDirty(node) {
|
|
1506
|
+
node.isLayoutDirty = false;
|
|
1507
|
+
}
|
|
1508
|
+
function resetTransformStyle(node) {
|
|
1509
|
+
const { visualElement } = node.options;
|
|
1510
|
+
if (visualElement && visualElement.getProps().onBeforeLayoutMeasure) {
|
|
1511
|
+
visualElement.notify("BeforeLayoutMeasure");
|
|
1512
|
+
}
|
|
1513
|
+
node.resetTransform();
|
|
1514
|
+
}
|
|
1515
|
+
function finishAnimation(node) {
|
|
1516
|
+
node.finishAnimation();
|
|
1517
|
+
node.targetDelta = node.relativeTarget = node.target = undefined;
|
|
1518
|
+
node.isProjectionDirty = true;
|
|
1519
|
+
}
|
|
1520
|
+
function resolveTargetDelta(node) {
|
|
1521
|
+
node.resolveTargetDelta();
|
|
1522
|
+
}
|
|
1523
|
+
function calcProjection(node) {
|
|
1524
|
+
node.calcProjection();
|
|
1525
|
+
}
|
|
1526
|
+
function resetSkewAndRotation(node) {
|
|
1527
|
+
node.resetSkewAndRotation();
|
|
1528
|
+
}
|
|
1529
|
+
function removeLeadSnapshots(stack) {
|
|
1530
|
+
stack.removeLeadSnapshot();
|
|
1531
|
+
}
|
|
1532
|
+
function mixAxisDelta(output, delta, p) {
|
|
1533
|
+
output.translate = mixNumber(delta.translate, 0, p);
|
|
1534
|
+
output.scale = mixNumber(delta.scale, 1, p);
|
|
1535
|
+
output.origin = delta.origin;
|
|
1536
|
+
output.originPoint = delta.originPoint;
|
|
1537
|
+
}
|
|
1538
|
+
function mixAxis(output, from, to, p) {
|
|
1539
|
+
output.min = mixNumber(from.min, to.min, p);
|
|
1540
|
+
output.max = mixNumber(from.max, to.max, p);
|
|
1541
|
+
}
|
|
1542
|
+
function mixBox(output, from, to, p) {
|
|
1543
|
+
mixAxis(output.x, from.x, to.x, p);
|
|
1544
|
+
mixAxis(output.y, from.y, to.y, p);
|
|
1545
|
+
}
|
|
1546
|
+
function hasOpacityCrossfade(node) {
|
|
1547
|
+
return (node.animationValues && node.animationValues.opacityExit !== undefined);
|
|
1548
|
+
}
|
|
1549
|
+
const defaultLayoutTransition = {
|
|
1550
|
+
duration: 0.45,
|
|
1551
|
+
ease: [0.4, 0, 0.1, 1],
|
|
1552
|
+
};
|
|
1553
|
+
const userAgentContains = (string) => typeof navigator !== "undefined" &&
|
|
1554
|
+
navigator.userAgent &&
|
|
1555
|
+
navigator.userAgent.toLowerCase().includes(string);
|
|
1556
|
+
/**
|
|
1557
|
+
* Measured bounding boxes must be rounded in Safari and
|
|
1558
|
+
* left untouched in Chrome, otherwise non-integer layouts within scaled-up elements
|
|
1559
|
+
* can appear to jump.
|
|
1560
|
+
*/
|
|
1561
|
+
const roundPoint = userAgentContains("applewebkit/") && !userAgentContains("chrome/")
|
|
1562
|
+
? Math.round
|
|
1563
|
+
: noop;
|
|
1564
|
+
function roundAxis(axis) {
|
|
1565
|
+
// Round to the nearest .5 pixels to support subpixel layouts
|
|
1566
|
+
axis.min = roundPoint(axis.min);
|
|
1567
|
+
axis.max = roundPoint(axis.max);
|
|
1568
|
+
}
|
|
1569
|
+
function roundBox(box) {
|
|
1570
|
+
roundAxis(box.x);
|
|
1571
|
+
roundAxis(box.y);
|
|
1572
|
+
}
|
|
1573
|
+
function shouldAnimatePositionOnly(animationType, snapshot, layout) {
|
|
1574
|
+
return (animationType === "position" ||
|
|
1575
|
+
(animationType === "preserve-aspect" &&
|
|
1576
|
+
!isNear(aspectRatio(snapshot), aspectRatio(layout), 0.2)));
|
|
1577
|
+
}
|
|
1578
|
+
function checkNodeWasScrollRoot(node) {
|
|
1579
|
+
return node !== node.root && node.scroll?.wasRoot;
|
|
1580
|
+
}
|
|
1581
|
+
|
|
1582
|
+
export { cleanDirtyNodes, createProjectionNode, mixAxis, mixAxisDelta, mixBox, propagateDirtyNodes };
|