@fivepixels-js/react 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +648 -0
- package/dist/components/ShortcutHint.d.ts +8 -0
- package/dist/components/ShortcutHint.d.ts.map +1 -0
- package/dist/components/ShortcutHint.js +9 -0
- package/dist/components/ShortcutHint.js.map +1 -0
- package/dist/components/icons/Icons.d.ts +70 -0
- package/dist/components/icons/Icons.d.ts.map +1 -0
- package/dist/components/icons/Icons.js +127 -0
- package/dist/components/icons/Icons.js.map +1 -0
- package/dist/components/icons/MaterialIcon.d.ts +8 -0
- package/dist/components/icons/MaterialIcon.d.ts.map +1 -0
- package/dist/components/icons/MaterialIcon.js +5 -0
- package/dist/components/icons/MaterialIcon.js.map +1 -0
- package/dist/components/motion/index.d.ts +48 -0
- package/dist/components/motion/index.d.ts.map +1 -0
- package/dist/components/motion/index.js +910 -0
- package/dist/components/motion/index.js.map +1 -0
- package/dist/components/overlay/ReportOverlayLayer.d.ts +7 -0
- package/dist/components/overlay/ReportOverlayLayer.d.ts.map +1 -0
- package/dist/components/overlay/ReportOverlayLayer.js +14 -0
- package/dist/components/overlay/ReportOverlayLayer.js.map +1 -0
- package/dist/components/overlay/TargetHighlights.d.ts +9 -0
- package/dist/components/overlay/TargetHighlights.d.ts.map +1 -0
- package/dist/components/overlay/TargetHighlights.js +24 -0
- package/dist/components/overlay/TargetHighlights.js.map +1 -0
- package/dist/components/panel/PanelDockGuides.d.ts +8 -0
- package/dist/components/panel/PanelDockGuides.d.ts.map +1 -0
- package/dist/components/panel/PanelDockGuides.js +15 -0
- package/dist/components/panel/PanelDockGuides.js.map +1 -0
- package/dist/components/panel/PanelDropdownMenu.d.ts +19 -0
- package/dist/components/panel/PanelDropdownMenu.d.ts.map +1 -0
- package/dist/components/panel/PanelDropdownMenu.js +132 -0
- package/dist/components/panel/PanelDropdownMenu.js.map +1 -0
- package/dist/components/panel/PanelMoreMenu.d.ts +20 -0
- package/dist/components/panel/PanelMoreMenu.d.ts.map +1 -0
- package/dist/components/panel/PanelMoreMenu.js +20 -0
- package/dist/components/panel/PanelMoreMenu.js.map +1 -0
- package/dist/components/panel/PanelOptionSwitch.d.ts +14 -0
- package/dist/components/panel/PanelOptionSwitch.d.ts.map +1 -0
- package/dist/components/panel/PanelOptionSwitch.js +10 -0
- package/dist/components/panel/PanelOptionSwitch.js.map +1 -0
- package/dist/components/panel/ReportCommandPanel.d.ts +18 -0
- package/dist/components/panel/ReportCommandPanel.d.ts.map +1 -0
- package/dist/components/panel/ReportCommandPanel.js +43 -0
- package/dist/components/panel/ReportCommandPanel.js.map +1 -0
- package/dist/components/panel/ReportCommandReplaceConfirmDialog.d.ts +9 -0
- package/dist/components/panel/ReportCommandReplaceConfirmDialog.d.ts.map +1 -0
- package/dist/components/panel/ReportCommandReplaceConfirmDialog.js +7 -0
- package/dist/components/panel/ReportCommandReplaceConfirmDialog.js.map +1 -0
- package/dist/components/panel/ReportControlPanel.d.ts +2 -0
- package/dist/components/panel/ReportControlPanel.d.ts.map +1 -0
- package/dist/components/panel/ReportControlPanel.js +119 -0
- package/dist/components/panel/ReportControlPanel.js.map +1 -0
- package/dist/components/panel/ReportDraftForm.d.ts +2 -0
- package/dist/components/panel/ReportDraftForm.d.ts.map +1 -0
- package/dist/components/panel/ReportDraftForm.js +33 -0
- package/dist/components/panel/ReportDraftForm.js.map +1 -0
- package/dist/components/panel/ReportFeedbackList.d.ts +2 -0
- package/dist/components/panel/ReportFeedbackList.d.ts.map +1 -0
- package/dist/components/panel/ReportFeedbackList.js +165 -0
- package/dist/components/panel/ReportFeedbackList.js.map +1 -0
- package/dist/components/panel/ReportImportConfirmDialog.d.ts +8 -0
- package/dist/components/panel/ReportImportConfirmDialog.d.ts.map +1 -0
- package/dist/components/panel/ReportImportConfirmDialog.js +7 -0
- package/dist/components/panel/ReportImportConfirmDialog.js.map +1 -0
- package/dist/components/panel/ReportImportProjectMismatchDialog.d.ts +12 -0
- package/dist/components/panel/ReportImportProjectMismatchDialog.d.ts.map +1 -0
- package/dist/components/panel/ReportImportProjectMismatchDialog.js +19 -0
- package/dist/components/panel/ReportImportProjectMismatchDialog.js.map +1 -0
- package/dist/components/panel/ReportPersonalKeyDialog.d.ts +8 -0
- package/dist/components/panel/ReportPersonalKeyDialog.d.ts.map +1 -0
- package/dist/components/panel/ReportPersonalKeyDialog.js +60 -0
- package/dist/components/panel/ReportPersonalKeyDialog.js.map +1 -0
- package/dist/components/panel/ReportRouteDetails.d.ts +2 -0
- package/dist/components/panel/ReportRouteDetails.d.ts.map +1 -0
- package/dist/components/panel/ReportRouteDetails.js +18 -0
- package/dist/components/panel/ReportRouteDetails.js.map +1 -0
- package/dist/components/panel/feedback/AuthorSelector.d.ts +9 -0
- package/dist/components/panel/feedback/AuthorSelector.d.ts.map +1 -0
- package/dist/components/panel/feedback/AuthorSelector.js +17 -0
- package/dist/components/panel/feedback/AuthorSelector.js.map +1 -0
- package/dist/components/panel/feedback/FeedbackComposer.d.ts +23 -0
- package/dist/components/panel/feedback/FeedbackComposer.d.ts.map +1 -0
- package/dist/components/panel/feedback/FeedbackComposer.js +48 -0
- package/dist/components/panel/feedback/FeedbackComposer.js.map +1 -0
- package/dist/components/panel/feedback/FeedbackCreatorBadge.d.ts +2 -0
- package/dist/components/panel/feedback/FeedbackCreatorBadge.d.ts.map +1 -0
- package/dist/components/panel/feedback/FeedbackCreatorBadge.js +7 -0
- package/dist/components/panel/feedback/FeedbackCreatorBadge.js.map +1 -0
- package/dist/components/panel/feedback/FeedbackFieldTags.d.ts +9 -0
- package/dist/components/panel/feedback/FeedbackFieldTags.d.ts.map +1 -0
- package/dist/components/panel/feedback/FeedbackFieldTags.js +8 -0
- package/dist/components/panel/feedback/FeedbackFieldTags.js.map +1 -0
- package/dist/components/panel/feedback/FeedbackHoverCard.d.ts +11 -0
- package/dist/components/panel/feedback/FeedbackHoverCard.d.ts.map +1 -0
- package/dist/components/panel/feedback/FeedbackHoverCard.js +14 -0
- package/dist/components/panel/feedback/FeedbackHoverCard.js.map +1 -0
- package/dist/components/panel/feedback/FeedbackIssueHeader.d.ts +12 -0
- package/dist/components/panel/feedback/FeedbackIssueHeader.d.ts.map +1 -0
- package/dist/components/panel/feedback/FeedbackIssueHeader.js +10 -0
- package/dist/components/panel/feedback/FeedbackIssueHeader.js.map +1 -0
- package/dist/components/panel/feedback/FeedbackStatusBadge.d.ts +8 -0
- package/dist/components/panel/feedback/FeedbackStatusBadge.d.ts.map +1 -0
- package/dist/components/panel/feedback/FeedbackStatusBadge.js +10 -0
- package/dist/components/panel/feedback/FeedbackStatusBadge.js.map +1 -0
- package/dist/components/panel/feedback/FeedbackThread.d.ts +21 -0
- package/dist/components/panel/feedback/FeedbackThread.d.ts.map +1 -0
- package/dist/components/panel/feedback/FeedbackThread.js +90 -0
- package/dist/components/panel/feedback/FeedbackThread.js.map +1 -0
- package/dist/components/panel/feedback/FieldTagSelector.d.ts +9 -0
- package/dist/components/panel/feedback/FieldTagSelector.d.ts.map +1 -0
- package/dist/components/panel/feedback/FieldTagSelector.js +15 -0
- package/dist/components/panel/feedback/FieldTagSelector.js.map +1 -0
- package/dist/components/panel/feedback/GitIssueButton.d.ts +12 -0
- package/dist/components/panel/feedback/GitIssueButton.d.ts.map +1 -0
- package/dist/components/panel/feedback/GitIssueButton.js +43 -0
- package/dist/components/panel/feedback/GitIssueButton.js.map +1 -0
- package/dist/components/panel/feedback/GitIssuedThreadEntry.d.ts +8 -0
- package/dist/components/panel/feedback/GitIssuedThreadEntry.d.ts.map +1 -0
- package/dist/components/panel/feedback/GitIssuedThreadEntry.js +25 -0
- package/dist/components/panel/feedback/GitIssuedThreadEntry.js.map +1 -0
- package/dist/components/point/ReportDraftMarker.d.ts +2 -0
- package/dist/components/point/ReportDraftMarker.d.ts.map +1 -0
- package/dist/components/point/ReportDraftMarker.js +28 -0
- package/dist/components/point/ReportDraftMarker.js.map +1 -0
- package/dist/components/point/ReportMarkersLayer.d.ts +2 -0
- package/dist/components/point/ReportMarkersLayer.d.ts.map +1 -0
- package/dist/components/point/ReportMarkersLayer.js +129 -0
- package/dist/components/point/ReportMarkersLayer.js.map +1 -0
- package/dist/components/report/FivePixels.d.ts +50 -0
- package/dist/components/report/FivePixels.d.ts.map +1 -0
- package/dist/components/report/FivePixels.js +15 -0
- package/dist/components/report/FivePixels.js.map +1 -0
- package/dist/components/report/ReportView.d.ts +2 -0
- package/dist/components/report/ReportView.d.ts.map +1 -0
- package/dist/components/report/ReportView.js +14 -0
- package/dist/components/report/ReportView.js.map +1 -0
- package/dist/components/report/ShadowReportRoot.d.ts +9 -0
- package/dist/components/report/ShadowReportRoot.d.ts.map +1 -0
- package/dist/components/report/ShadowReportRoot.js +80 -0
- package/dist/components/report/ShadowReportRoot.js.map +1 -0
- package/dist/components/report/index.d.ts +13 -0
- package/dist/components/report/index.d.ts.map +1 -0
- package/dist/components/report/index.js +9 -0
- package/dist/components/report/index.js.map +1 -0
- package/dist/components/ui/HoverTooltip.d.ts +10 -0
- package/dist/components/ui/HoverTooltip.d.ts.map +1 -0
- package/dist/components/ui/HoverTooltip.js +64 -0
- package/dist/components/ui/HoverTooltip.js.map +1 -0
- package/dist/components/ui/IconTooltipButton.d.ts +12 -0
- package/dist/components/ui/IconTooltipButton.d.ts.map +1 -0
- package/dist/components/ui/IconTooltipButton.js +7 -0
- package/dist/components/ui/IconTooltipButton.js.map +1 -0
- package/dist/constants/feedbackStatus.d.ts +6 -0
- package/dist/constants/feedbackStatus.d.ts.map +1 -0
- package/dist/constants/feedbackStatus.js +27 -0
- package/dist/constants/feedbackStatus.js.map +1 -0
- package/dist/constants/project.d.ts +2 -0
- package/dist/constants/project.d.ts.map +1 -0
- package/dist/constants/project.js +2 -0
- package/dist/constants/project.js.map +1 -0
- package/dist/constants/report.d.ts +7 -0
- package/dist/constants/report.d.ts.map +1 -0
- package/dist/constants/report.js +14 -0
- package/dist/constants/report.js.map +1 -0
- package/dist/constants/reportShortcuts.d.ts +31 -0
- package/dist/constants/reportShortcuts.d.ts.map +1 -0
- package/dist/constants/reportShortcuts.js +9 -0
- package/dist/constants/reportShortcuts.js.map +1 -0
- package/dist/constants/storageKeys.d.ts +5 -0
- package/dist/constants/storageKeys.d.ts.map +1 -0
- package/dist/constants/storageKeys.js +16 -0
- package/dist/constants/storageKeys.js.map +1 -0
- package/dist/hooks/report.api.d.ts +8 -0
- package/dist/hooks/report.api.d.ts.map +1 -0
- package/dist/hooks/report.api.js +20 -0
- package/dist/hooks/report.api.js.map +1 -0
- package/dist/hooks/report.query.d.ts +27 -0
- package/dist/hooks/report.query.d.ts.map +1 -0
- package/dist/hooks/report.query.js +137 -0
- package/dist/hooks/report.query.js.map +1 -0
- package/dist/hooks/useAppearancePreference.d.ts +6 -0
- package/dist/hooks/useAppearancePreference.d.ts.map +1 -0
- package/dist/hooks/useAppearancePreference.js +40 -0
- package/dist/hooks/useAppearancePreference.js.map +1 -0
- package/dist/hooks/useCurrentPathname.d.ts +2 -0
- package/dist/hooks/useCurrentPathname.d.ts.map +1 -0
- package/dist/hooks/useCurrentPathname.js +18 -0
- package/dist/hooks/useCurrentPathname.js.map +1 -0
- package/dist/hooks/useIsMobileViewport.d.ts +2 -0
- package/dist/hooks/useIsMobileViewport.d.ts.map +1 -0
- package/dist/hooks/useIsMobileViewport.js +12 -0
- package/dist/hooks/useIsMobileViewport.js.map +1 -0
- package/dist/hooks/useLocalePreference.d.ts +6 -0
- package/dist/hooks/useLocalePreference.d.ts.map +1 -0
- package/dist/hooks/useLocalePreference.js +40 -0
- package/dist/hooks/useLocalePreference.js.map +1 -0
- package/dist/hooks/useNativeHover.d.ts +7 -0
- package/dist/hooks/useNativeHover.d.ts.map +1 -0
- package/dist/hooks/useNativeHover.js +28 -0
- package/dist/hooks/useNativeHover.js.map +1 -0
- package/dist/hooks/usePanelDock.d.ts +29 -0
- package/dist/hooks/usePanelDock.d.ts.map +1 -0
- package/dist/hooks/usePanelDock.js +279 -0
- package/dist/hooks/usePanelDock.js.map +1 -0
- package/dist/hooks/usePanelFeedbackTransfer.d.ts +59 -0
- package/dist/hooks/usePanelFeedbackTransfer.d.ts.map +1 -0
- package/dist/hooks/usePanelFeedbackTransfer.js +250 -0
- package/dist/hooks/usePanelFeedbackTransfer.js.map +1 -0
- package/dist/hooks/usePersonalKey.d.ts +30 -0
- package/dist/hooks/usePersonalKey.d.ts.map +1 -0
- package/dist/hooks/usePersonalKey.js +72 -0
- package/dist/hooks/usePersonalKey.js.map +1 -0
- package/dist/hooks/useReportPersistence.d.ts +63 -0
- package/dist/hooks/useReportPersistence.d.ts.map +1 -0
- package/dist/hooks/useReportPersistence.js +142 -0
- package/dist/hooks/useReportPersistence.js.map +1 -0
- package/dist/hooks/useReportShortcuts.d.ts +5 -0
- package/dist/hooks/useReportShortcuts.d.ts.map +1 -0
- package/dist/hooks/useReportShortcuts.js +117 -0
- package/dist/hooks/useReportShortcuts.js.map +1 -0
- package/dist/hooks/useReportState.d.ts +177 -0
- package/dist/hooks/useReportState.d.ts.map +1 -0
- package/dist/hooks/useReportState.js +904 -0
- package/dist/hooks/useReportState.js.map +1 -0
- package/dist/hooks/useResolvedAppearance.d.ts +4 -0
- package/dist/hooks/useResolvedAppearance.d.ts.map +1 -0
- package/dist/hooks/useResolvedAppearance.js +23 -0
- package/dist/hooks/useResolvedAppearance.js.map +1 -0
- package/dist/hooks/useTooltipLayout.d.ts +21 -0
- package/dist/hooks/useTooltipLayout.d.ts.map +1 -0
- package/dist/hooks/useTooltipLayout.js +45 -0
- package/dist/hooks/useTooltipLayout.js.map +1 -0
- package/dist/i18n/en.d.ts +3 -0
- package/dist/i18n/en.d.ts.map +1 -0
- package/dist/i18n/en.js +277 -0
- package/dist/i18n/en.js.map +1 -0
- package/dist/i18n/index.d.ts +20 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/index.js +77 -0
- package/dist/i18n/index.js.map +1 -0
- package/dist/i18n/ko.d.ts +3 -0
- package/dist/i18n/ko.d.ts.map +1 -0
- package/dist/i18n/ko.js +277 -0
- package/dist/i18n/ko.js.map +1 -0
- package/dist/i18n/types.d.ts +267 -0
- package/dist/i18n/types.d.ts.map +1 -0
- package/dist/i18n/types.js +2 -0
- package/dist/i18n/types.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/providers/ReportProvider.d.ts +52 -0
- package/dist/providers/ReportProvider.d.ts.map +1 -0
- package/dist/providers/ReportProvider.js +49 -0
- package/dist/providers/ReportProvider.js.map +1 -0
- package/dist/providers/reportContext.d.ts +286 -0
- package/dist/providers/reportContext.d.ts.map +1 -0
- package/dist/providers/reportContext.js +11 -0
- package/dist/providers/reportContext.js.map +1 -0
- package/dist/storage/local/localStorageAdapter.d.ts +12 -0
- package/dist/storage/local/localStorageAdapter.d.ts.map +1 -0
- package/dist/storage/local/localStorageAdapter.js +187 -0
- package/dist/storage/local/localStorageAdapter.js.map +1 -0
- package/dist/styles/reportStylesheet.d.ts +2 -0
- package/dist/styles/reportStylesheet.d.ts.map +1 -0
- package/dist/styles/reportStylesheet.js +3 -0
- package/dist/styles/reportStylesheet.js.map +1 -0
- package/dist/types/report-ui.d.ts +47 -0
- package/dist/types/report-ui.d.ts.map +1 -0
- package/dist/types/report-ui.js +2 -0
- package/dist/types/report-ui.js.map +1 -0
- package/dist/types/report.d.ts +177 -0
- package/dist/types/report.d.ts.map +1 -0
- package/dist/types/report.js +8 -0
- package/dist/types/report.js.map +1 -0
- package/dist/utils/coordinates.d.ts +63 -0
- package/dist/utils/coordinates.d.ts.map +1 -0
- package/dist/utils/coordinates.js +236 -0
- package/dist/utils/coordinates.js.map +1 -0
- package/dist/utils/dom.d.ts +14 -0
- package/dist/utils/dom.d.ts.map +1 -0
- package/dist/utils/dom.js +104 -0
- package/dist/utils/dom.js.map +1 -0
- package/dist/utils/env.d.ts +6 -0
- package/dist/utils/env.d.ts.map +1 -0
- package/dist/utils/env.js +18 -0
- package/dist/utils/env.js.map +1 -0
- package/dist/utils/feedbackDataTransfer.d.ts +31 -0
- package/dist/utils/feedbackDataTransfer.d.ts.map +1 -0
- package/dist/utils/feedbackDataTransfer.js +195 -0
- package/dist/utils/feedbackDataTransfer.js.map +1 -0
- package/dist/utils/feedbackThread.d.ts +14 -0
- package/dist/utils/feedbackThread.d.ts.map +1 -0
- package/dist/utils/feedbackThread.js +57 -0
- package/dist/utils/feedbackThread.js.map +1 -0
- package/dist/utils/feedbackTransferSchema.d.ts +37 -0
- package/dist/utils/feedbackTransferSchema.d.ts.map +1 -0
- package/dist/utils/feedbackTransferSchema.js +162 -0
- package/dist/utils/feedbackTransferSchema.js.map +1 -0
- package/dist/utils/fields.d.ts +11 -0
- package/dist/utils/fields.d.ts.map +1 -0
- package/dist/utils/fields.js +43 -0
- package/dist/utils/fields.js.map +1 -0
- package/dist/utils/format.d.ts +6 -0
- package/dist/utils/format.d.ts.map +1 -0
- package/dist/utils/format.js +46 -0
- package/dist/utils/format.js.map +1 -0
- package/dist/utils/formatStatCount.d.ts +2 -0
- package/dist/utils/formatStatCount.d.ts.map +1 -0
- package/dist/utils/formatStatCount.js +4 -0
- package/dist/utils/formatStatCount.js.map +1 -0
- package/dist/utils/githubIntegration.d.ts +12 -0
- package/dist/utils/githubIntegration.d.ts.map +1 -0
- package/dist/utils/githubIntegration.js +56 -0
- package/dist/utils/githubIntegration.js.map +1 -0
- package/dist/utils/hoverTooltipLayout.d.ts +8 -0
- package/dist/utils/hoverTooltipLayout.d.ts.map +1 -0
- package/dist/utils/hoverTooltipLayout.js +30 -0
- package/dist/utils/hoverTooltipLayout.js.map +1 -0
- package/dist/utils/locateFeedback.d.ts +11 -0
- package/dist/utils/locateFeedback.d.ts.map +1 -0
- package/dist/utils/locateFeedback.js +16 -0
- package/dist/utils/locateFeedback.js.map +1 -0
- package/dist/utils/panelTypography.d.ts +4 -0
- package/dist/utils/panelTypography.d.ts.map +1 -0
- package/dist/utils/panelTypography.js +4 -0
- package/dist/utils/panelTypography.js.map +1 -0
- package/dist/utils/pathname.d.ts +2 -0
- package/dist/utils/pathname.d.ts.map +1 -0
- package/dist/utils/pathname.js +10 -0
- package/dist/utils/pathname.js.map +1 -0
- package/dist/utils/pathnameNavigation.d.ts +4 -0
- package/dist/utils/pathnameNavigation.d.ts.map +1 -0
- package/dist/utils/pathnameNavigation.js +52 -0
- package/dist/utils/pathnameNavigation.js.map +1 -0
- package/dist/utils/personalKey.d.ts +45 -0
- package/dist/utils/personalKey.d.ts.map +1 -0
- package/dist/utils/personalKey.js +180 -0
- package/dist/utils/personalKey.js.map +1 -0
- package/dist/utils/projectId.d.ts +2 -0
- package/dist/utils/projectId.d.ts.map +1 -0
- package/dist/utils/projectId.js +14 -0
- package/dist/utils/projectId.js.map +1 -0
- package/dist/utils/reportCallbacks.d.ts +20 -0
- package/dist/utils/reportCallbacks.d.ts.map +1 -0
- package/dist/utils/reportCallbacks.js +42 -0
- package/dist/utils/reportCallbacks.js.map +1 -0
- package/dist/utils/reportProject.d.ts +17 -0
- package/dist/utils/reportProject.d.ts.map +1 -0
- package/dist/utils/reportProject.js +9 -0
- package/dist/utils/reportProject.js.map +1 -0
- package/dist/utils/reportTeam.d.ts +15 -0
- package/dist/utils/reportTeam.d.ts.map +1 -0
- package/dist/utils/reportTeam.js +8 -0
- package/dist/utils/reportTeam.js.map +1 -0
- package/dist/utils/reportUi.d.ts +24 -0
- package/dist/utils/reportUi.d.ts.map +1 -0
- package/dist/utils/reportUi.js +19 -0
- package/dist/utils/reportUi.js.map +1 -0
- package/dist/utils/reportVisibility.d.ts +19 -0
- package/dist/utils/reportVisibility.d.ts.map +1 -0
- package/dist/utils/reportVisibility.js +12 -0
- package/dist/utils/reportVisibility.js.map +1 -0
- package/dist/utils/reportVisual.d.ts +12 -0
- package/dist/utils/reportVisual.d.ts.map +1 -0
- package/dist/utils/reportVisual.js +31 -0
- package/dist/utils/reportVisual.js.map +1 -0
- package/dist/utils/routeDetailStatus.d.ts +7 -0
- package/dist/utils/routeDetailStatus.d.ts.map +1 -0
- package/dist/utils/routeDetailStatus.js +29 -0
- package/dist/utils/routeDetailStatus.js.map +1 -0
- package/dist/utils/shortcuts.d.ts +12 -0
- package/dist/utils/shortcuts.d.ts.map +1 -0
- package/dist/utils/shortcuts.js +59 -0
- package/dist/utils/shortcuts.js.map +1 -0
- package/dist/utils/storage.d.ts +17 -0
- package/dist/utils/storage.d.ts.map +1 -0
- package/dist/utils/storage.js +36 -0
- package/dist/utils/storage.js.map +1 -0
- package/dist/utils/validateFeedbackImport.d.ts +4 -0
- package/dist/utils/validateFeedbackImport.d.ts.map +1 -0
- package/dist/utils/validateFeedbackImport.js +187 -0
- package/dist/utils/validateFeedbackImport.js.map +1 -0
- package/package.json +68 -0
|
@@ -0,0 +1,910 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Children, cloneElement, createContext, forwardRef, isValidElement, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState, } from "react";
|
|
3
|
+
const PresenceContext = createContext(null);
|
|
4
|
+
const LayoutAnimationContext = createContext({ counterScale: null });
|
|
5
|
+
const layoutRegistry = new Map();
|
|
6
|
+
const motionComponentCache = new Map();
|
|
7
|
+
function cloneRect(rect) {
|
|
8
|
+
return new DOMRect(rect.x, rect.y, rect.width, rect.height);
|
|
9
|
+
}
|
|
10
|
+
function rectsDiffer(a, b, threshold = 0.5) {
|
|
11
|
+
return (Math.abs(a.left - b.left) >= threshold ||
|
|
12
|
+
Math.abs(a.top - b.top) >= threshold ||
|
|
13
|
+
Math.abs(a.width - b.width) >= threshold ||
|
|
14
|
+
Math.abs(a.height - b.height) >= threshold);
|
|
15
|
+
}
|
|
16
|
+
function normalizeLayoutMode(layout) {
|
|
17
|
+
if (!layout) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
if (layout === true) {
|
|
21
|
+
return "both";
|
|
22
|
+
}
|
|
23
|
+
return layout;
|
|
24
|
+
}
|
|
25
|
+
function rectsDifferForLayout(a, b, mode, threshold = 0.5) {
|
|
26
|
+
if (mode === "position") {
|
|
27
|
+
return Math.abs(a.left - b.left) >= threshold || Math.abs(a.top - b.top) >= threshold;
|
|
28
|
+
}
|
|
29
|
+
if (mode === "size") {
|
|
30
|
+
return Math.abs(a.width - b.width) >= threshold || Math.abs(a.height - b.height) >= threshold;
|
|
31
|
+
}
|
|
32
|
+
return rectsDiffer(a, b, threshold);
|
|
33
|
+
}
|
|
34
|
+
function layoutUsesScale(mode) {
|
|
35
|
+
return mode !== "position";
|
|
36
|
+
}
|
|
37
|
+
function readLayoutRectFromStyle(style) {
|
|
38
|
+
if (!style) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
const left = Number.parseFloat(String(style.left ?? ""));
|
|
42
|
+
const top = Number.parseFloat(String(style.top ?? ""));
|
|
43
|
+
const width = Number.parseFloat(String(style.width ?? ""));
|
|
44
|
+
const height = Number.parseFloat(String(style.height ?? ""));
|
|
45
|
+
if (![left, top, width, height].every(Number.isFinite)) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
return new DOMRect(left, top, width, height);
|
|
49
|
+
}
|
|
50
|
+
function readTargetLayoutRect(node) {
|
|
51
|
+
const left = Number.parseFloat(node.style.left);
|
|
52
|
+
const top = Number.parseFloat(node.style.top);
|
|
53
|
+
const width = Number.parseFloat(node.style.width);
|
|
54
|
+
const height = Number.parseFloat(node.style.height);
|
|
55
|
+
if ([left, top, width, height].every(Number.isFinite)) {
|
|
56
|
+
return new DOMRect(left, top, width, height);
|
|
57
|
+
}
|
|
58
|
+
return cloneRect(node.getBoundingClientRect());
|
|
59
|
+
}
|
|
60
|
+
function applyLayoutRectStyle(node, rect) {
|
|
61
|
+
node.style.left = `${rect.left}px`;
|
|
62
|
+
node.style.top = `${rect.top}px`;
|
|
63
|
+
node.style.width = `${rect.width}px`;
|
|
64
|
+
node.style.height = `${rect.height}px`;
|
|
65
|
+
}
|
|
66
|
+
function rectToPositionStyle(rect) {
|
|
67
|
+
return {
|
|
68
|
+
left: rect.left,
|
|
69
|
+
top: rect.top,
|
|
70
|
+
width: rect.width,
|
|
71
|
+
height: rect.height,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
function readVisualLayoutRect(node) {
|
|
75
|
+
return cloneRect(node.getBoundingClientRect());
|
|
76
|
+
}
|
|
77
|
+
function layoutTransformFromRects(fromRect, toRect, mode) {
|
|
78
|
+
let deltaX = fromRect.left - toRect.left;
|
|
79
|
+
let deltaY = fromRect.top - toRect.top;
|
|
80
|
+
let scaleX = fromRect.width / Math.max(toRect.width, 1);
|
|
81
|
+
let scaleY = fromRect.height / Math.max(toRect.height, 1);
|
|
82
|
+
if (mode === "position") {
|
|
83
|
+
scaleX = 1;
|
|
84
|
+
scaleY = 1;
|
|
85
|
+
}
|
|
86
|
+
else if (mode === "size") {
|
|
87
|
+
deltaX = 0;
|
|
88
|
+
deltaY = 0;
|
|
89
|
+
}
|
|
90
|
+
else if (mode === "preserve-aspect") {
|
|
91
|
+
const fromAspect = fromRect.width / Math.max(fromRect.height, 1);
|
|
92
|
+
const toAspect = toRect.width / Math.max(toRect.height, 1);
|
|
93
|
+
if (Math.abs(fromAspect - toAspect) >= 0.01) {
|
|
94
|
+
scaleX = 1;
|
|
95
|
+
scaleY = 1;
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
const uniformScale = (scaleX + scaleY) / 2;
|
|
99
|
+
scaleX = uniformScale;
|
|
100
|
+
scaleY = uniformScale;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return { deltaX, deltaY, scaleX, scaleY };
|
|
104
|
+
}
|
|
105
|
+
function composeLayoutTransform(deltaX, deltaY, scaleX, scaleY) {
|
|
106
|
+
if (scaleX === 1 && scaleY === 1) {
|
|
107
|
+
return `translate(${deltaX}px, ${deltaY}px)`;
|
|
108
|
+
}
|
|
109
|
+
if (deltaX === 0 && deltaY === 0) {
|
|
110
|
+
return `scale(${scaleX}, ${scaleY})`;
|
|
111
|
+
}
|
|
112
|
+
return `translate(${deltaX}px, ${deltaY}px) scale(${scaleX}, ${scaleY})`;
|
|
113
|
+
}
|
|
114
|
+
function layoutTransformEndState(mode) {
|
|
115
|
+
if (mode === "size") {
|
|
116
|
+
return "scale(1, 1)";
|
|
117
|
+
}
|
|
118
|
+
if (mode === "position") {
|
|
119
|
+
return "translate(0px, 0px)";
|
|
120
|
+
}
|
|
121
|
+
return "translate(0px, 0px) scale(1, 1)";
|
|
122
|
+
}
|
|
123
|
+
function layoutTransformIsNoOp(deltaX, deltaY, scaleX, scaleY, mode) {
|
|
124
|
+
const positionChanged = Math.abs(deltaX) >= 0.5 || Math.abs(deltaY) >= 0.5;
|
|
125
|
+
const sizeChanged = Math.abs(scaleX - 1) >= 0.01 || Math.abs(scaleY - 1) >= 0.01;
|
|
126
|
+
if (mode === "position") {
|
|
127
|
+
return !positionChanged;
|
|
128
|
+
}
|
|
129
|
+
if (mode === "size") {
|
|
130
|
+
return !sizeChanged;
|
|
131
|
+
}
|
|
132
|
+
return !positionChanged && !sizeChanged;
|
|
133
|
+
}
|
|
134
|
+
function applyLayoutTransform(node, fromRect, toRect, mode) {
|
|
135
|
+
const { deltaX, deltaY, scaleX, scaleY } = layoutTransformFromRects(fromRect, toRect, mode);
|
|
136
|
+
node.style.transformOrigin = "top left";
|
|
137
|
+
node.style.transform = composeLayoutTransform(deltaX, deltaY, scaleX, scaleY);
|
|
138
|
+
}
|
|
139
|
+
function clearLayoutTransform(node) {
|
|
140
|
+
node.style.transformOrigin = "";
|
|
141
|
+
if (node.style.transform) {
|
|
142
|
+
node.style.transform = "";
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
function pushLayoutSnapshot(layoutId, rect) {
|
|
146
|
+
const stack = layoutRegistry.get(layoutId) ?? [];
|
|
147
|
+
stack.push(cloneRect(rect));
|
|
148
|
+
layoutRegistry.set(layoutId, stack);
|
|
149
|
+
}
|
|
150
|
+
function popLayoutSnapshot(layoutId) {
|
|
151
|
+
const stack = layoutRegistry.get(layoutId);
|
|
152
|
+
if (!stack?.length) {
|
|
153
|
+
return undefined;
|
|
154
|
+
}
|
|
155
|
+
const rect = stack.pop();
|
|
156
|
+
if (!stack.length) {
|
|
157
|
+
layoutRegistry.delete(layoutId);
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
layoutRegistry.set(layoutId, stack);
|
|
161
|
+
}
|
|
162
|
+
return rect;
|
|
163
|
+
}
|
|
164
|
+
function trackedListsEqual(current, next) {
|
|
165
|
+
return current.length === next.length && current.every((child, index) => child === next[index]);
|
|
166
|
+
}
|
|
167
|
+
function getPresentKeySignature(children) {
|
|
168
|
+
return children.map((child) => String(child.key ?? "")).join("\0");
|
|
169
|
+
}
|
|
170
|
+
function isBrowser() {
|
|
171
|
+
return typeof window !== "undefined" && typeof document !== "undefined";
|
|
172
|
+
}
|
|
173
|
+
function toMs(value, fallback) {
|
|
174
|
+
if (value == null) {
|
|
175
|
+
return fallback;
|
|
176
|
+
}
|
|
177
|
+
return value <= 10 ? value * 1000 : value;
|
|
178
|
+
}
|
|
179
|
+
function parseNumericValue(value) {
|
|
180
|
+
if (value == null) {
|
|
181
|
+
return undefined;
|
|
182
|
+
}
|
|
183
|
+
if (typeof value === "number") {
|
|
184
|
+
return { value, unit: "px" };
|
|
185
|
+
}
|
|
186
|
+
const match = String(value)
|
|
187
|
+
.trim()
|
|
188
|
+
.match(/^(-?\d+(?:\.\d+)?)(px|%|rem|em|vw|vh)?$/);
|
|
189
|
+
if (!match) {
|
|
190
|
+
return undefined;
|
|
191
|
+
}
|
|
192
|
+
return { value: Number(match[1]), unit: match[2] ?? "px" };
|
|
193
|
+
}
|
|
194
|
+
function parseScaleValue(value) {
|
|
195
|
+
if (value == null) {
|
|
196
|
+
return undefined;
|
|
197
|
+
}
|
|
198
|
+
if (typeof value === "number") {
|
|
199
|
+
return value;
|
|
200
|
+
}
|
|
201
|
+
const parsed = Number(value);
|
|
202
|
+
return Number.isNaN(parsed) ? undefined : parsed;
|
|
203
|
+
}
|
|
204
|
+
function parseTransformParts(style) {
|
|
205
|
+
const rawTransform = style?.transform?.trim() ?? "";
|
|
206
|
+
const matrixMatch = rawTransform.match(/^matrix\(([^)]+)\)$/);
|
|
207
|
+
const matrix3dMatch = rawTransform.match(/^matrix3d\(([^)]+)\)$/);
|
|
208
|
+
if (matrixMatch) {
|
|
209
|
+
const values = matrixMatch[1].split(",").map((value) => Number.parseFloat(value.trim()));
|
|
210
|
+
return {
|
|
211
|
+
x: Number.isFinite(values[4]) ? { value: values[4], unit: "px" } : undefined,
|
|
212
|
+
y: Number.isFinite(values[5]) ? { value: values[5], unit: "px" } : undefined,
|
|
213
|
+
scale: Number.isFinite(values[0]) ? values[0] : undefined,
|
|
214
|
+
rest: [],
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
if (matrix3dMatch) {
|
|
218
|
+
const values = matrix3dMatch[1].split(",").map((value) => Number.parseFloat(value.trim()));
|
|
219
|
+
return {
|
|
220
|
+
x: Number.isFinite(values[12]) ? { value: values[12], unit: "px" } : undefined,
|
|
221
|
+
y: Number.isFinite(values[13]) ? { value: values[13], unit: "px" } : undefined,
|
|
222
|
+
scale: Number.isFinite(values[0]) ? values[0] : undefined,
|
|
223
|
+
rest: [],
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
const rest = rawTransform
|
|
227
|
+
.replace(/translate3d\(([^,]+),([^,]+),([^)]+)\)/g, "")
|
|
228
|
+
.replace(/translateX\(([^)]+)\)/g, "")
|
|
229
|
+
.replace(/translateY\(([^)]+)\)/g, "")
|
|
230
|
+
.replace(/scale\(([^)]+)\)/g, "")
|
|
231
|
+
.trim();
|
|
232
|
+
const translate3d = rawTransform.match(/translate3d\(([^,]+),([^,]+),([^)]+)\)/);
|
|
233
|
+
const translateX = rawTransform.match(/translateX\(([^)]+)\)/);
|
|
234
|
+
const translateY = rawTransform.match(/translateY\(([^)]+)\)/);
|
|
235
|
+
const scale = rawTransform.match(/scale\(([^)]+)\)/);
|
|
236
|
+
return {
|
|
237
|
+
x: parseNumericValue(style?.x ?? translate3d?.[1]?.trim() ?? translateX?.[1]?.trim()),
|
|
238
|
+
y: parseNumericValue(style?.y ?? translate3d?.[2]?.trim() ?? translateY?.[1]?.trim()),
|
|
239
|
+
scale: parseScaleValue(style?.scale ?? scale?.[1]?.trim()),
|
|
240
|
+
rest: rest ? [rest] : [],
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
function composeTransform(parts) {
|
|
244
|
+
const transforms = [];
|
|
245
|
+
if (parts.x || parts.y) {
|
|
246
|
+
const x = parts.x ? `${parts.x.value}${parts.x.unit}` : "0px";
|
|
247
|
+
const y = parts.y ? `${parts.y.value}${parts.y.unit}` : "0px";
|
|
248
|
+
transforms.push(`translate3d(${x}, ${y}, 0px)`);
|
|
249
|
+
}
|
|
250
|
+
transforms.push(...parts.rest.filter(Boolean));
|
|
251
|
+
if (parts.scale != null) {
|
|
252
|
+
transforms.push(`scale(${parts.scale})`);
|
|
253
|
+
}
|
|
254
|
+
return transforms.join(" ").trim();
|
|
255
|
+
}
|
|
256
|
+
function clamp(value, min, max) {
|
|
257
|
+
return Math.min(max, Math.max(min, value));
|
|
258
|
+
}
|
|
259
|
+
function resolveMotionStyle(style) {
|
|
260
|
+
if (!style) {
|
|
261
|
+
return {};
|
|
262
|
+
}
|
|
263
|
+
const nextStyle = {};
|
|
264
|
+
for (const [key, value] of Object.entries(style)) {
|
|
265
|
+
if (value == null || key === "x" || key === "y" || key === "scale" || key === "transform") {
|
|
266
|
+
continue;
|
|
267
|
+
}
|
|
268
|
+
nextStyle[key] = value;
|
|
269
|
+
}
|
|
270
|
+
const transform = composeTransform(parseTransformParts(style));
|
|
271
|
+
if (transform) {
|
|
272
|
+
nextStyle.transform = transform;
|
|
273
|
+
}
|
|
274
|
+
return nextStyle;
|
|
275
|
+
}
|
|
276
|
+
function getSpringMetrics(transition) {
|
|
277
|
+
const mass = Math.max(0.001, transition?.mass ?? 1);
|
|
278
|
+
const stiffness = Math.max(0.001, transition?.stiffness ?? 100);
|
|
279
|
+
const damping = Math.max(0.001, transition?.damping ?? 10);
|
|
280
|
+
const naturalFrequency = Math.sqrt(stiffness / mass);
|
|
281
|
+
const dampingRatio = damping / (2 * Math.sqrt(stiffness * mass));
|
|
282
|
+
return {
|
|
283
|
+
damping,
|
|
284
|
+
dampingRatio,
|
|
285
|
+
mass,
|
|
286
|
+
naturalFrequency,
|
|
287
|
+
stiffness,
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
function getSpringSettlingDuration(metrics) {
|
|
291
|
+
const epsilon = 0.001;
|
|
292
|
+
if (metrics.dampingRatio < 1) {
|
|
293
|
+
return Math.log(1 / epsilon) / (metrics.dampingRatio * metrics.naturalFrequency);
|
|
294
|
+
}
|
|
295
|
+
if (Math.abs(metrics.dampingRatio - 1) < 0.0001) {
|
|
296
|
+
return Math.log(1 / epsilon) / metrics.naturalFrequency;
|
|
297
|
+
}
|
|
298
|
+
const slowPole = metrics.naturalFrequency * (metrics.dampingRatio - Math.sqrt(metrics.dampingRatio * metrics.dampingRatio - 1));
|
|
299
|
+
return Math.log(1 / epsilon) / Math.max(slowPole, 0.001);
|
|
300
|
+
}
|
|
301
|
+
function getSpringProgress(time, metrics) {
|
|
302
|
+
if (metrics.dampingRatio < 1) {
|
|
303
|
+
const dampedFrequency = metrics.naturalFrequency * Math.sqrt(1 - metrics.dampingRatio * metrics.dampingRatio);
|
|
304
|
+
const coefficient = metrics.dampingRatio / Math.sqrt(1 - metrics.dampingRatio * metrics.dampingRatio);
|
|
305
|
+
return 1 - Math.exp(-metrics.dampingRatio * metrics.naturalFrequency * time) * (Math.cos(dampedFrequency * time) + coefficient * Math.sin(dampedFrequency * time));
|
|
306
|
+
}
|
|
307
|
+
if (Math.abs(metrics.dampingRatio - 1) < 0.0001) {
|
|
308
|
+
const envelope = Math.exp(-metrics.naturalFrequency * time);
|
|
309
|
+
return 1 - envelope * (1 + metrics.naturalFrequency * time);
|
|
310
|
+
}
|
|
311
|
+
const sqrtTerm = Math.sqrt(metrics.dampingRatio * metrics.dampingRatio - 1);
|
|
312
|
+
const slowPole = -metrics.naturalFrequency * (metrics.dampingRatio - sqrtTerm);
|
|
313
|
+
const fastPole = -metrics.naturalFrequency * (metrics.dampingRatio + sqrtTerm);
|
|
314
|
+
return 1 - (fastPole * Math.exp(slowPole * time) - slowPole * Math.exp(fastPole * time)) / (fastPole - slowPole);
|
|
315
|
+
}
|
|
316
|
+
function interpolateParsedValue(from, to, progress) {
|
|
317
|
+
if (!from && !to) {
|
|
318
|
+
return undefined;
|
|
319
|
+
}
|
|
320
|
+
if (!from) {
|
|
321
|
+
return to;
|
|
322
|
+
}
|
|
323
|
+
if (!to) {
|
|
324
|
+
return from;
|
|
325
|
+
}
|
|
326
|
+
if (from.unit !== to.unit) {
|
|
327
|
+
return progress >= 1 ? to : from;
|
|
328
|
+
}
|
|
329
|
+
return {
|
|
330
|
+
value: from.value + (to.value - from.value) * progress,
|
|
331
|
+
unit: to.unit,
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
function interpolateNumber(from, to, progress) {
|
|
335
|
+
if (from == null && to == null) {
|
|
336
|
+
return undefined;
|
|
337
|
+
}
|
|
338
|
+
if (from == null) {
|
|
339
|
+
return to;
|
|
340
|
+
}
|
|
341
|
+
if (to == null) {
|
|
342
|
+
return from;
|
|
343
|
+
}
|
|
344
|
+
return from + (to - from) * progress;
|
|
345
|
+
}
|
|
346
|
+
function createTweenKeyframes(from, to) {
|
|
347
|
+
return [resolveMotionStyle(from), resolveMotionStyle(to)];
|
|
348
|
+
}
|
|
349
|
+
function createSpringKeyframes(from, to, transition) {
|
|
350
|
+
const metrics = getSpringMetrics(transition);
|
|
351
|
+
const fromStyle = resolveMotionStyle(from);
|
|
352
|
+
const toStyle = resolveMotionStyle(to);
|
|
353
|
+
const fromParts = parseTransformParts(from);
|
|
354
|
+
const toParts = parseTransformParts(to);
|
|
355
|
+
const duration = resolveDuration(transition) / 1000;
|
|
356
|
+
const frameCount = clamp(Math.round(duration * 60), 12, 180);
|
|
357
|
+
const keyframes = [];
|
|
358
|
+
for (let index = 0; index < frameCount; index += 1) {
|
|
359
|
+
const offset = frameCount === 1 ? 1 : index / (frameCount - 1);
|
|
360
|
+
const progress = getSpringProgress(duration * offset, metrics);
|
|
361
|
+
const clampedProgress = clamp(progress, 0, 1);
|
|
362
|
+
const keyframe = {
|
|
363
|
+
offset,
|
|
364
|
+
};
|
|
365
|
+
const opacity = interpolateNumber(typeof fromStyle.opacity === "number" ? fromStyle.opacity : undefined, typeof toStyle.opacity === "number" ? toStyle.opacity : undefined, clampedProgress);
|
|
366
|
+
if (opacity != null) {
|
|
367
|
+
keyframe.opacity = opacity;
|
|
368
|
+
}
|
|
369
|
+
const transform = composeTransform({
|
|
370
|
+
x: interpolateParsedValue(fromParts.x, toParts.x, progress),
|
|
371
|
+
y: interpolateParsedValue(fromParts.y, toParts.y, progress),
|
|
372
|
+
scale: interpolateNumber(fromParts.scale, toParts.scale, progress),
|
|
373
|
+
rest: toParts.rest.length ? toParts.rest : fromParts.rest,
|
|
374
|
+
});
|
|
375
|
+
if (transform) {
|
|
376
|
+
keyframe.transform = transform;
|
|
377
|
+
}
|
|
378
|
+
keyframes.push(keyframe);
|
|
379
|
+
}
|
|
380
|
+
const lastKeyframe = keyframes[keyframes.length - 1];
|
|
381
|
+
if (typeof toStyle.opacity === "number") {
|
|
382
|
+
lastKeyframe.opacity = toStyle.opacity;
|
|
383
|
+
}
|
|
384
|
+
if (typeof toStyle.transform === "string") {
|
|
385
|
+
lastKeyframe.transform = toStyle.transform;
|
|
386
|
+
}
|
|
387
|
+
return keyframes;
|
|
388
|
+
}
|
|
389
|
+
function createAnimationFrames(from, to, transition) {
|
|
390
|
+
if (transition?.type !== "spring") {
|
|
391
|
+
return createTweenKeyframes(from, to);
|
|
392
|
+
}
|
|
393
|
+
return createSpringKeyframes(from, to, transition);
|
|
394
|
+
}
|
|
395
|
+
function resolveTimingFunction(transition) {
|
|
396
|
+
if (transition?.type === "spring") {
|
|
397
|
+
return "linear";
|
|
398
|
+
}
|
|
399
|
+
return transition?.ease ?? "ease";
|
|
400
|
+
}
|
|
401
|
+
function resolveDuration(transition) {
|
|
402
|
+
if (transition?.duration != null) {
|
|
403
|
+
return toMs(transition.duration, 320);
|
|
404
|
+
}
|
|
405
|
+
if (transition?.type === "spring") {
|
|
406
|
+
// console.log("transition", transition);
|
|
407
|
+
// console.log("??", getSpringSettlingDuration(getSpringMetrics(transition)) * (transition.delay ? 1000 : 1));
|
|
408
|
+
const duration = getSpringSettlingDuration(getSpringMetrics(transition)) * (transition.delay ? 1000 : 1);
|
|
409
|
+
return clamp(duration, 120, 6000);
|
|
410
|
+
}
|
|
411
|
+
return 320;
|
|
412
|
+
}
|
|
413
|
+
function stringifyStyle(style) {
|
|
414
|
+
return JSON.stringify(resolveMotionStyle(style));
|
|
415
|
+
}
|
|
416
|
+
function applyResolvedMotionStyle(node, style) {
|
|
417
|
+
const resolvedStyle = resolveMotionStyle(style);
|
|
418
|
+
if ("opacity" in resolvedStyle) {
|
|
419
|
+
node.style.opacity = String(resolvedStyle.opacity);
|
|
420
|
+
}
|
|
421
|
+
if ("transform" in resolvedStyle) {
|
|
422
|
+
node.style.transform = String(resolvedStyle.transform);
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
function captureCurrentMotionStyle(node, fallback) {
|
|
426
|
+
const computedStyle = window.getComputedStyle(node);
|
|
427
|
+
const nextStyle = { ...(fallback ?? {}) };
|
|
428
|
+
const opacity = Number.parseFloat(computedStyle.opacity);
|
|
429
|
+
if (!Number.isNaN(opacity)) {
|
|
430
|
+
nextStyle.opacity = opacity;
|
|
431
|
+
}
|
|
432
|
+
if (computedStyle.transform && computedStyle.transform !== "none") {
|
|
433
|
+
nextStyle.transform = computedStyle.transform;
|
|
434
|
+
}
|
|
435
|
+
else if (fallback?.transform) {
|
|
436
|
+
nextStyle.transform = fallback.transform;
|
|
437
|
+
}
|
|
438
|
+
else {
|
|
439
|
+
delete nextStyle.transform;
|
|
440
|
+
}
|
|
441
|
+
return nextStyle;
|
|
442
|
+
}
|
|
443
|
+
function useMergedRef(forwardedRef, localRef) {
|
|
444
|
+
return (value) => {
|
|
445
|
+
localRef.current = value;
|
|
446
|
+
if (typeof forwardedRef === "function") {
|
|
447
|
+
forwardedRef(value);
|
|
448
|
+
return;
|
|
449
|
+
}
|
|
450
|
+
if (forwardedRef && "current" in forwardedRef) {
|
|
451
|
+
forwardedRef.current = value;
|
|
452
|
+
}
|
|
453
|
+
};
|
|
454
|
+
}
|
|
455
|
+
function animateLayout(node, fromRect, transition, layoutAnimationRef, layoutMode, onScaleChange, onComplete) {
|
|
456
|
+
if (typeof node.animate !== "function") {
|
|
457
|
+
return null;
|
|
458
|
+
}
|
|
459
|
+
const toRect = readTargetLayoutRect(node);
|
|
460
|
+
const { deltaX, deltaY, scaleX, scaleY } = layoutTransformFromRects(fromRect, toRect, layoutMode);
|
|
461
|
+
if (layoutTransformIsNoOp(deltaX, deltaY, scaleX, scaleY, layoutMode)) {
|
|
462
|
+
clearLayoutTransform(node);
|
|
463
|
+
onScaleChange?.(null);
|
|
464
|
+
onComplete?.(toRect);
|
|
465
|
+
return null;
|
|
466
|
+
}
|
|
467
|
+
if (layoutAnimationRef.current) {
|
|
468
|
+
layoutAnimationRef.current.cancel();
|
|
469
|
+
layoutAnimationRef.current = null;
|
|
470
|
+
}
|
|
471
|
+
applyLayoutTransform(node, fromRect, toRect, layoutMode);
|
|
472
|
+
const startTransform = node.style.transform;
|
|
473
|
+
const endTransform = layoutTransformEndState(layoutMode);
|
|
474
|
+
const animation = node.animate([
|
|
475
|
+
{
|
|
476
|
+
transformOrigin: "top left",
|
|
477
|
+
transform: startTransform,
|
|
478
|
+
},
|
|
479
|
+
{
|
|
480
|
+
transformOrigin: "top left",
|
|
481
|
+
transform: endTransform,
|
|
482
|
+
},
|
|
483
|
+
], {
|
|
484
|
+
duration: resolveDuration(transition),
|
|
485
|
+
easing: resolveTimingFunction(transition),
|
|
486
|
+
fill: "both",
|
|
487
|
+
});
|
|
488
|
+
layoutAnimationRef.current = animation;
|
|
489
|
+
let scaleFrameId = 0;
|
|
490
|
+
const shouldTrackScale = layoutUsesScale(layoutMode) && onScaleChange;
|
|
491
|
+
if (shouldTrackScale) {
|
|
492
|
+
onScaleChange({ scaleX, scaleY });
|
|
493
|
+
const trackScale = () => {
|
|
494
|
+
if (layoutAnimationRef.current !== animation) {
|
|
495
|
+
return;
|
|
496
|
+
}
|
|
497
|
+
const playState = animation.playState;
|
|
498
|
+
if (playState === "finished" || playState === "idle") {
|
|
499
|
+
onScaleChange(null);
|
|
500
|
+
return;
|
|
501
|
+
}
|
|
502
|
+
const timing = animation.effect?.getComputedTiming();
|
|
503
|
+
const progress = typeof timing?.progress === "number" ? timing.progress : 0;
|
|
504
|
+
onScaleChange({
|
|
505
|
+
scaleX: scaleX + (1 - scaleX) * progress,
|
|
506
|
+
scaleY: scaleY + (1 - scaleY) * progress,
|
|
507
|
+
});
|
|
508
|
+
scaleFrameId = requestAnimationFrame(trackScale);
|
|
509
|
+
};
|
|
510
|
+
scaleFrameId = requestAnimationFrame(trackScale);
|
|
511
|
+
}
|
|
512
|
+
animation.onfinish = () => {
|
|
513
|
+
if (layoutAnimationRef.current !== animation) {
|
|
514
|
+
return;
|
|
515
|
+
}
|
|
516
|
+
if (scaleFrameId) {
|
|
517
|
+
cancelAnimationFrame(scaleFrameId);
|
|
518
|
+
}
|
|
519
|
+
clearLayoutTransform(node);
|
|
520
|
+
layoutAnimationRef.current = null;
|
|
521
|
+
onScaleChange?.(null);
|
|
522
|
+
onComplete?.(toRect);
|
|
523
|
+
};
|
|
524
|
+
animation.oncancel = () => {
|
|
525
|
+
if (layoutAnimationRef.current === animation) {
|
|
526
|
+
if (scaleFrameId) {
|
|
527
|
+
cancelAnimationFrame(scaleFrameId);
|
|
528
|
+
}
|
|
529
|
+
layoutAnimationRef.current = null;
|
|
530
|
+
onScaleChange?.(null);
|
|
531
|
+
}
|
|
532
|
+
};
|
|
533
|
+
return animation;
|
|
534
|
+
}
|
|
535
|
+
function PresenceChild({ children, isPresent, onExitComplete }) {
|
|
536
|
+
const value = useMemo(() => ({ isPresent, onExitComplete }), [isPresent, onExitComplete]);
|
|
537
|
+
return _jsx(PresenceContext.Provider, { value: value, children: children });
|
|
538
|
+
}
|
|
539
|
+
export function AnimatedPresence({ children }) {
|
|
540
|
+
const validChildren = Children.toArray(children).filter(isValidElement);
|
|
541
|
+
const presentKeySignature = getPresentKeySignature(validChildren);
|
|
542
|
+
const [exitingChildren, setExitingChildren] = useState([]);
|
|
543
|
+
const previousPresentRef = useRef(new Map());
|
|
544
|
+
useLayoutEffect(() => {
|
|
545
|
+
const presentKeys = new Set(validChildren.flatMap((child) => (child.key != null ? [child.key] : [])));
|
|
546
|
+
const previousPresent = previousPresentRef.current;
|
|
547
|
+
setExitingChildren((current) => {
|
|
548
|
+
let next = current;
|
|
549
|
+
for (const [key, element] of previousPresent) {
|
|
550
|
+
if (!presentKeys.has(key) && !next.some((child) => child.element.key === key)) {
|
|
551
|
+
if (next === current) {
|
|
552
|
+
next = [...current];
|
|
553
|
+
}
|
|
554
|
+
next.push({ element, isPresent: false });
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
const filtered = next.filter((child) => !(child.isPresent === false && child.element.key != null && presentKeys.has(child.element.key)));
|
|
558
|
+
return trackedListsEqual(filtered, current) ? current : filtered;
|
|
559
|
+
});
|
|
560
|
+
previousPresentRef.current = new Map(validChildren.flatMap((child) => (child.key != null ? [[child.key, child]] : [])));
|
|
561
|
+
}, [presentKeySignature]);
|
|
562
|
+
const presentKeys = new Set(validChildren.flatMap((child) => (child.key != null ? [child.key] : [])));
|
|
563
|
+
const trackedChildren = [
|
|
564
|
+
...exitingChildren.filter((child) => child.element.key != null && !presentKeys.has(child.element.key)),
|
|
565
|
+
...validChildren.map((element) => ({ element, isPresent: true })),
|
|
566
|
+
];
|
|
567
|
+
return trackedChildren.map((child) => (_jsx(PresenceChild, { isPresent: child.isPresent, onExitComplete: () => {
|
|
568
|
+
setExitingChildren((current) => {
|
|
569
|
+
const nextTrackedChildren = current.filter((item) => item.element.key !== child.element.key);
|
|
570
|
+
return nextTrackedChildren.length === current.length ? current : nextTrackedChildren;
|
|
571
|
+
});
|
|
572
|
+
}, children: cloneElement(child.element) }, child.element.key)));
|
|
573
|
+
}
|
|
574
|
+
function createMotionComponent(tagName) {
|
|
575
|
+
return forwardRef(function MotionComponent({ animate, as, children, exit, initial, layout, layoutId, layoutRoot, layoutTransition, style, transition, ...rest }, forwardedRef) {
|
|
576
|
+
const Component = (as ?? tagName);
|
|
577
|
+
const presence = useContext(PresenceContext);
|
|
578
|
+
const parentLayoutContext = useContext(LayoutAnimationContext);
|
|
579
|
+
const localRef = useRef(null);
|
|
580
|
+
const lastAnimatedStyleRef = useRef(animate ?? {});
|
|
581
|
+
const previousRectRef = useRef(null);
|
|
582
|
+
const committedLayoutRectRef = useRef(null);
|
|
583
|
+
const animationRef = useRef(null);
|
|
584
|
+
const layoutAnimationRef = useRef(null);
|
|
585
|
+
const hasMountedRef = useRef(false);
|
|
586
|
+
const wasPresentForLayoutRef = useRef(true);
|
|
587
|
+
const useExplicitLayoutRef = useRef(false);
|
|
588
|
+
const [isLayoutAnimating, setIsLayoutAnimating] = useState(false);
|
|
589
|
+
const [layoutMeasureGeneration, setLayoutMeasureGeneration] = useState(0);
|
|
590
|
+
const [childCounterScale, setChildCounterScale] = useState(null);
|
|
591
|
+
const mergedRef = useMergedRef(forwardedRef, localRef);
|
|
592
|
+
const animateKey = stringifyStyle(animate);
|
|
593
|
+
const layoutMode = normalizeLayoutMode(layout);
|
|
594
|
+
const effectiveLayoutMode = layoutMode || "both";
|
|
595
|
+
const layoutEnabled = Boolean(layoutMode || layoutId);
|
|
596
|
+
const resolvedLayoutTransition = layoutTransition ?? transition;
|
|
597
|
+
const incomingLayoutRect = readLayoutRectFromStyle(style);
|
|
598
|
+
const layoutStyleKey = incomingLayoutRect
|
|
599
|
+
? `${incomingLayoutRect.left}|${incomingLayoutRect.top}|${incomingLayoutRect.width}|${incomingLayoutRect.height}`
|
|
600
|
+
: "";
|
|
601
|
+
const parentCounterScale = layoutRoot ? null : parentLayoutContext.counterScale;
|
|
602
|
+
const layoutAnimationContextValue = useMemo(() => ({ counterScale: childCounterScale }), [childCounterScale]);
|
|
603
|
+
const finishLayout = (targetRect) => {
|
|
604
|
+
previousRectRef.current = cloneRect(targetRect);
|
|
605
|
+
committedLayoutRectRef.current = cloneRect(targetRect);
|
|
606
|
+
setIsLayoutAnimating(false);
|
|
607
|
+
setChildCounterScale(null);
|
|
608
|
+
};
|
|
609
|
+
const handleLayoutScaleChange = (scale) => {
|
|
610
|
+
if (!layoutUsesScale(effectiveLayoutMode)) {
|
|
611
|
+
setChildCounterScale(null);
|
|
612
|
+
return;
|
|
613
|
+
}
|
|
614
|
+
setChildCounterScale(scale);
|
|
615
|
+
};
|
|
616
|
+
const startLayoutAnimation = (node, fromRect, targetRect) => {
|
|
617
|
+
useExplicitLayoutRef.current = true;
|
|
618
|
+
applyLayoutRectStyle(node, targetRect);
|
|
619
|
+
committedLayoutRectRef.current = cloneRect(targetRect);
|
|
620
|
+
setIsLayoutAnimating(true);
|
|
621
|
+
const animation = animateLayout(node, fromRect, resolvedLayoutTransition, layoutAnimationRef, effectiveLayoutMode, handleLayoutScaleChange, finishLayout);
|
|
622
|
+
if (!animation) {
|
|
623
|
+
finishLayout(targetRect);
|
|
624
|
+
}
|
|
625
|
+
};
|
|
626
|
+
const startImplicitLayoutAnimation = (node, fromRect, targetRect) => {
|
|
627
|
+
useExplicitLayoutRef.current = false;
|
|
628
|
+
committedLayoutRectRef.current = cloneRect(targetRect);
|
|
629
|
+
setIsLayoutAnimating(true);
|
|
630
|
+
const animation = animateLayout(node, fromRect, resolvedLayoutTransition, layoutAnimationRef, effectiveLayoutMode, handleLayoutScaleChange, finishLayout);
|
|
631
|
+
if (!animation) {
|
|
632
|
+
finishLayout(targetRect);
|
|
633
|
+
}
|
|
634
|
+
};
|
|
635
|
+
useLayoutEffect(() => {
|
|
636
|
+
return () => {
|
|
637
|
+
if (layoutId && localRef.current) {
|
|
638
|
+
pushLayoutSnapshot(layoutId, localRef.current.getBoundingClientRect());
|
|
639
|
+
}
|
|
640
|
+
};
|
|
641
|
+
}, [layoutId]);
|
|
642
|
+
useEffect(() => () => {
|
|
643
|
+
if (animationRef.current) {
|
|
644
|
+
animationRef.current.cancel();
|
|
645
|
+
animationRef.current = null;
|
|
646
|
+
}
|
|
647
|
+
if (layoutAnimationRef.current) {
|
|
648
|
+
layoutAnimationRef.current.cancel();
|
|
649
|
+
layoutAnimationRef.current = null;
|
|
650
|
+
}
|
|
651
|
+
}, []);
|
|
652
|
+
useEffect(() => {
|
|
653
|
+
if (!layoutMode || !isBrowser()) {
|
|
654
|
+
return;
|
|
655
|
+
}
|
|
656
|
+
const node = localRef.current;
|
|
657
|
+
if (!node || typeof ResizeObserver === "undefined") {
|
|
658
|
+
return;
|
|
659
|
+
}
|
|
660
|
+
const observer = new ResizeObserver(() => {
|
|
661
|
+
if (layoutAnimationRef.current) {
|
|
662
|
+
return;
|
|
663
|
+
}
|
|
664
|
+
setLayoutMeasureGeneration((current) => current + 1);
|
|
665
|
+
});
|
|
666
|
+
observer.observe(node);
|
|
667
|
+
return () => {
|
|
668
|
+
observer.disconnect();
|
|
669
|
+
};
|
|
670
|
+
}, [layoutId, layoutMode]);
|
|
671
|
+
useLayoutEffect(() => {
|
|
672
|
+
if (presence?.isPresent === false || !animate) {
|
|
673
|
+
return;
|
|
674
|
+
}
|
|
675
|
+
const node = localRef.current;
|
|
676
|
+
if (!node) {
|
|
677
|
+
return;
|
|
678
|
+
}
|
|
679
|
+
const fromStyle = hasMountedRef.current ? captureCurrentMotionStyle(node, lastAnimatedStyleRef.current) : initial === false ? animate : (initial ?? animate);
|
|
680
|
+
const shouldAnimate = hasMountedRef.current ? animateKey !== stringifyStyle(lastAnimatedStyleRef.current) : initial !== false;
|
|
681
|
+
if (!shouldAnimate) {
|
|
682
|
+
hasMountedRef.current = true;
|
|
683
|
+
lastAnimatedStyleRef.current = animate;
|
|
684
|
+
applyResolvedMotionStyle(node, animate);
|
|
685
|
+
return;
|
|
686
|
+
}
|
|
687
|
+
const currentAnimation = animationRef.current;
|
|
688
|
+
const wasInterrupted = Boolean(currentAnimation);
|
|
689
|
+
if (currentAnimation) {
|
|
690
|
+
currentAnimation.cancel();
|
|
691
|
+
animationRef.current = null;
|
|
692
|
+
}
|
|
693
|
+
const duration = resolveDuration(transition);
|
|
694
|
+
const delay = wasInterrupted ? 0 : toMs(transition?.delay, 0);
|
|
695
|
+
const animation = node.animate(createAnimationFrames(fromStyle, animate, transition), {
|
|
696
|
+
duration,
|
|
697
|
+
delay,
|
|
698
|
+
easing: resolveTimingFunction(transition),
|
|
699
|
+
fill: "both",
|
|
700
|
+
});
|
|
701
|
+
animationRef.current = animation;
|
|
702
|
+
node.style.willChange = "transform, opacity";
|
|
703
|
+
hasMountedRef.current = true;
|
|
704
|
+
lastAnimatedStyleRef.current = animate;
|
|
705
|
+
animation.onfinish = () => {
|
|
706
|
+
if (animationRef.current !== animation) {
|
|
707
|
+
return;
|
|
708
|
+
}
|
|
709
|
+
applyResolvedMotionStyle(node, animate);
|
|
710
|
+
node.style.willChange = "";
|
|
711
|
+
animationRef.current = null;
|
|
712
|
+
};
|
|
713
|
+
animation.oncancel = () => {
|
|
714
|
+
if (animationRef.current === animation) {
|
|
715
|
+
animationRef.current = null;
|
|
716
|
+
node.style.willChange = "";
|
|
717
|
+
}
|
|
718
|
+
};
|
|
719
|
+
}, [animate, animateKey, initial, presence?.isPresent, transition]);
|
|
720
|
+
useLayoutEffect(() => {
|
|
721
|
+
void layoutMeasureGeneration;
|
|
722
|
+
if (!layoutEnabled) {
|
|
723
|
+
return;
|
|
724
|
+
}
|
|
725
|
+
const node = localRef.current;
|
|
726
|
+
if (!node) {
|
|
727
|
+
return;
|
|
728
|
+
}
|
|
729
|
+
const isExiting = presence?.isPresent === false;
|
|
730
|
+
if (layoutId && isExiting && wasPresentForLayoutRef.current) {
|
|
731
|
+
pushLayoutSnapshot(layoutId, node.getBoundingClientRect());
|
|
732
|
+
wasPresentForLayoutRef.current = false;
|
|
733
|
+
}
|
|
734
|
+
if (!isExiting) {
|
|
735
|
+
wasPresentForLayoutRef.current = true;
|
|
736
|
+
}
|
|
737
|
+
if (isExiting) {
|
|
738
|
+
return;
|
|
739
|
+
}
|
|
740
|
+
if (!incomingLayoutRect) {
|
|
741
|
+
if (!layoutMode) {
|
|
742
|
+
return;
|
|
743
|
+
}
|
|
744
|
+
const targetRect = readVisualLayoutRect(node);
|
|
745
|
+
let fromRect = null;
|
|
746
|
+
if (layoutId) {
|
|
747
|
+
fromRect = popLayoutSnapshot(layoutId) ?? null;
|
|
748
|
+
}
|
|
749
|
+
if (!committedLayoutRectRef.current) {
|
|
750
|
+
if (fromRect) {
|
|
751
|
+
startImplicitLayoutAnimation(node, fromRect, targetRect);
|
|
752
|
+
return;
|
|
753
|
+
}
|
|
754
|
+
finishLayout(targetRect);
|
|
755
|
+
return;
|
|
756
|
+
}
|
|
757
|
+
if (layoutAnimationRef.current && committedLayoutRectRef.current && !rectsDifferForLayout(committedLayoutRectRef.current, targetRect, effectiveLayoutMode)) {
|
|
758
|
+
return;
|
|
759
|
+
}
|
|
760
|
+
if (layoutAnimationRef.current) {
|
|
761
|
+
const visualRect = readVisualLayoutRect(node);
|
|
762
|
+
layoutAnimationRef.current.cancel();
|
|
763
|
+
layoutAnimationRef.current = null;
|
|
764
|
+
if (!rectsDifferForLayout(visualRect, targetRect, effectiveLayoutMode)) {
|
|
765
|
+
clearLayoutTransform(node);
|
|
766
|
+
finishLayout(targetRect);
|
|
767
|
+
return;
|
|
768
|
+
}
|
|
769
|
+
startImplicitLayoutAnimation(node, visualRect, targetRect);
|
|
770
|
+
return;
|
|
771
|
+
}
|
|
772
|
+
if (previousRectRef.current && !rectsDifferForLayout(previousRectRef.current, targetRect, effectiveLayoutMode)) {
|
|
773
|
+
finishLayout(targetRect);
|
|
774
|
+
return;
|
|
775
|
+
}
|
|
776
|
+
if (previousRectRef.current && rectsDifferForLayout(previousRectRef.current, targetRect, effectiveLayoutMode)) {
|
|
777
|
+
startImplicitLayoutAnimation(node, previousRectRef.current, targetRect);
|
|
778
|
+
return;
|
|
779
|
+
}
|
|
780
|
+
finishLayout(targetRect);
|
|
781
|
+
return;
|
|
782
|
+
}
|
|
783
|
+
const targetRect = incomingLayoutRect;
|
|
784
|
+
let fromRect = null;
|
|
785
|
+
if (layoutId) {
|
|
786
|
+
fromRect = popLayoutSnapshot(layoutId) ?? null;
|
|
787
|
+
}
|
|
788
|
+
if (!committedLayoutRectRef.current) {
|
|
789
|
+
if (fromRect) {
|
|
790
|
+
startLayoutAnimation(node, fromRect, targetRect);
|
|
791
|
+
return;
|
|
792
|
+
}
|
|
793
|
+
applyLayoutRectStyle(node, targetRect);
|
|
794
|
+
finishLayout(targetRect);
|
|
795
|
+
return;
|
|
796
|
+
}
|
|
797
|
+
if (layoutAnimationRef.current && committedLayoutRectRef.current && !rectsDifferForLayout(committedLayoutRectRef.current, targetRect, effectiveLayoutMode)) {
|
|
798
|
+
return;
|
|
799
|
+
}
|
|
800
|
+
if (layoutAnimationRef.current) {
|
|
801
|
+
const visualRect = readVisualLayoutRect(node);
|
|
802
|
+
layoutAnimationRef.current.cancel();
|
|
803
|
+
layoutAnimationRef.current = null;
|
|
804
|
+
if (!rectsDifferForLayout(visualRect, targetRect, effectiveLayoutMode)) {
|
|
805
|
+
applyLayoutRectStyle(node, targetRect);
|
|
806
|
+
clearLayoutTransform(node);
|
|
807
|
+
finishLayout(targetRect);
|
|
808
|
+
return;
|
|
809
|
+
}
|
|
810
|
+
startLayoutAnimation(node, visualRect, targetRect);
|
|
811
|
+
return;
|
|
812
|
+
}
|
|
813
|
+
if (previousRectRef.current && !rectsDifferForLayout(previousRectRef.current, targetRect, effectiveLayoutMode)) {
|
|
814
|
+
applyLayoutRectStyle(node, targetRect);
|
|
815
|
+
finishLayout(targetRect);
|
|
816
|
+
return;
|
|
817
|
+
}
|
|
818
|
+
if (!fromRect && layoutMode && previousRectRef.current && rectsDifferForLayout(previousRectRef.current, targetRect, effectiveLayoutMode)) {
|
|
819
|
+
fromRect = previousRectRef.current;
|
|
820
|
+
}
|
|
821
|
+
if (!fromRect) {
|
|
822
|
+
applyLayoutRectStyle(node, targetRect);
|
|
823
|
+
finishLayout(targetRect);
|
|
824
|
+
return;
|
|
825
|
+
}
|
|
826
|
+
startLayoutAnimation(node, fromRect, targetRect);
|
|
827
|
+
}, [effectiveLayoutMode, layoutEnabled, layoutId, layoutMeasureGeneration, layoutMode, layoutStyleKey, presence?.isPresent, resolvedLayoutTransition, style]);
|
|
828
|
+
useEffect(() => {
|
|
829
|
+
if (presence?.isPresent !== false) {
|
|
830
|
+
return;
|
|
831
|
+
}
|
|
832
|
+
if (!exit) {
|
|
833
|
+
presence.onExitComplete?.();
|
|
834
|
+
return;
|
|
835
|
+
}
|
|
836
|
+
const node = localRef.current;
|
|
837
|
+
if (!node) {
|
|
838
|
+
presence.onExitComplete?.();
|
|
839
|
+
return;
|
|
840
|
+
}
|
|
841
|
+
const fromStyle = captureCurrentMotionStyle(node, lastAnimatedStyleRef.current);
|
|
842
|
+
const currentAnimation = animationRef.current;
|
|
843
|
+
const wasInterrupted = Boolean(currentAnimation);
|
|
844
|
+
if (currentAnimation) {
|
|
845
|
+
currentAnimation.cancel();
|
|
846
|
+
animationRef.current = null;
|
|
847
|
+
}
|
|
848
|
+
const duration = resolveDuration(transition);
|
|
849
|
+
const delay = wasInterrupted ? 0 : toMs(transition?.delay, 0);
|
|
850
|
+
const animation = node.animate(createAnimationFrames(fromStyle, exit, transition), {
|
|
851
|
+
duration,
|
|
852
|
+
delay,
|
|
853
|
+
easing: resolveTimingFunction(transition),
|
|
854
|
+
fill: "both",
|
|
855
|
+
});
|
|
856
|
+
animationRef.current = animation;
|
|
857
|
+
node.style.willChange = "transform, opacity";
|
|
858
|
+
animation.onfinish = () => {
|
|
859
|
+
if (animationRef.current !== animation) {
|
|
860
|
+
return;
|
|
861
|
+
}
|
|
862
|
+
applyResolvedMotionStyle(node, exit);
|
|
863
|
+
node.style.willChange = "";
|
|
864
|
+
animationRef.current = null;
|
|
865
|
+
presence.onExitComplete?.();
|
|
866
|
+
};
|
|
867
|
+
animation.oncancel = () => {
|
|
868
|
+
if (animationRef.current === animation) {
|
|
869
|
+
animationRef.current = null;
|
|
870
|
+
node.style.willChange = "";
|
|
871
|
+
}
|
|
872
|
+
};
|
|
873
|
+
}, [exit, presence, transition]);
|
|
874
|
+
const resolvedAnimatedStyle = animate ? resolveMotionStyle(animate) : {};
|
|
875
|
+
const { transform: animatedTransform, ...restAnimatedStyle } = resolvedAnimatedStyle;
|
|
876
|
+
const layoutPositionStyle = isLayoutAnimating && useExplicitLayoutRef.current && committedLayoutRectRef.current
|
|
877
|
+
? rectToPositionStyle(committedLayoutRectRef.current)
|
|
878
|
+
: null;
|
|
879
|
+
const mergedTransforms = [];
|
|
880
|
+
if (layoutMode && parentCounterScale) {
|
|
881
|
+
mergedTransforms.push(`scale(${1 / parentCounterScale.scaleX}, ${1 / parentCounterScale.scaleY})`);
|
|
882
|
+
}
|
|
883
|
+
if (animatedTransform) {
|
|
884
|
+
mergedTransforms.push(String(animatedTransform));
|
|
885
|
+
}
|
|
886
|
+
const mergedStyle = {
|
|
887
|
+
...style,
|
|
888
|
+
...restAnimatedStyle,
|
|
889
|
+
...(layoutPositionStyle ?? {}),
|
|
890
|
+
...(mergedTransforms.length ? { transform: mergedTransforms.join(" ") } : {}),
|
|
891
|
+
};
|
|
892
|
+
const element = (_jsx(Component, { ref: mergedRef, style: mergedStyle, ...rest, children: children }));
|
|
893
|
+
if (layoutRoot || childCounterScale) {
|
|
894
|
+
return _jsx(LayoutAnimationContext.Provider, { value: layoutAnimationContextValue, children: element });
|
|
895
|
+
}
|
|
896
|
+
return element;
|
|
897
|
+
});
|
|
898
|
+
}
|
|
899
|
+
export const motion = new Proxy({}, {
|
|
900
|
+
get(_, property) {
|
|
901
|
+
const cached = motionComponentCache.get(property);
|
|
902
|
+
if (cached) {
|
|
903
|
+
return cached;
|
|
904
|
+
}
|
|
905
|
+
const component = createMotionComponent(property);
|
|
906
|
+
motionComponentCache.set(property, component);
|
|
907
|
+
return component;
|
|
908
|
+
},
|
|
909
|
+
});
|
|
910
|
+
//# sourceMappingURL=index.js.map
|