@satinhq/kit 0.0.0-stage → 0.1.0-beta.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/NOTICE +96 -0
- package/README.md +454 -2
- package/THIRD_PARTY_NOTICES.md +65 -0
- package/bin/satin.mjs +13 -0
- package/dist/acknowledgements/Acknowledgements.d.ts +4 -0
- package/dist/acknowledgements/Acknowledgements.js +42 -0
- package/dist/acknowledgements/bundledNotices.d.ts +4 -0
- package/dist/acknowledgements/bundledNotices.js +58 -0
- package/dist/acknowledgements/inventory.d.ts +17 -0
- package/dist/acknowledgements/inventory.js +10 -0
- package/dist/acknowledgements/inventory.json +39 -0
- package/dist/actions/ActionMenu.d.ts +30 -0
- package/dist/actions/ActionMenu.js +103 -0
- package/dist/actions/RowActions.d.ts +42 -0
- package/dist/actions/RowActions.js +820 -0
- package/dist/actions/contextMotion.d.ts +78 -0
- package/dist/actions/contextMotion.js +329 -0
- package/dist/actions/motion.d.ts +19 -0
- package/dist/actions/motion.js +74 -0
- package/dist/actions/nativeContextAppearance.json +86 -0
- package/dist/actions/nativeContextMotion.json +734 -0
- package/dist/actions/nativeMotion.json +388 -0
- package/dist/actions/preview.d.ts +27 -0
- package/dist/actions/preview.js +217 -0
- package/dist/actions/recognizers.d.ts +24 -0
- package/dist/actions/recognizers.js +87 -0
- package/dist/actions/rowScrub.d.ts +59 -0
- package/dist/actions/rowScrub.js +400 -0
- package/dist/actions/swipeSpring.d.ts +14 -0
- package/dist/actions/swipeSpring.js +35 -0
- package/dist/actions/types.d.ts +71 -0
- package/dist/actions/types.js +28 -0
- package/dist/app/InstallComponents.d.ts +16 -0
- package/dist/app/InstallComponents.js +104 -0
- package/dist/app/InstallationDiagnostics.d.ts +7 -0
- package/dist/app/InstallationDiagnostics.js +23 -0
- package/dist/app/OrientationGuard.d.ts +8 -0
- package/dist/app/OrientationGuard.js +9 -0
- package/dist/app/appearance.d.ts +18 -0
- package/dist/app/appearance.js +15 -0
- package/dist/app/appearanceStore.d.ts +30 -0
- package/dist/app/appearanceStore.js +228 -0
- package/dist/app/backgroundUpdate.d.ts +20 -0
- package/dist/app/backgroundUpdate.js +151 -0
- package/dist/app/buildInfo.d.ts +11 -0
- package/dist/app/buildInfo.js +12 -0
- package/dist/app/buildInfoBuild.d.ts +3 -0
- package/dist/app/buildInfoBuild.js +12 -0
- package/dist/app/checkCli.d.ts +1 -0
- package/dist/app/checkCli.js +73 -0
- package/dist/app/coldLaunchUpdate.d.ts +14 -0
- package/dist/app/coldLaunchUpdate.js +384 -0
- package/dist/app/definition.d.ts +85 -0
- package/dist/app/definition.js +347 -0
- package/dist/app/deployment.d.ts +28 -0
- package/dist/app/deployment.js +352 -0
- package/dist/app/deploymentBuild.d.ts +3 -0
- package/dist/app/deploymentBuild.js +55 -0
- package/dist/app/earlyWorker.d.ts +3 -0
- package/dist/app/earlyWorker.js +77 -0
- package/dist/app/head.d.ts +10 -0
- package/dist/app/head.js +120 -0
- package/dist/app/icons.d.ts +4 -0
- package/dist/app/icons.js +35 -0
- package/dist/app/install.d.ts +18 -0
- package/dist/app/install.js +82 -0
- package/dist/app/installCheck.d.ts +2 -0
- package/dist/app/installCheck.js +148 -0
- package/dist/app/installContext.d.ts +35 -0
- package/dist/app/installContext.js +45 -0
- package/dist/app/installCustom.d.ts +25 -0
- package/dist/app/installCustom.js +55 -0
- package/dist/app/installExperience.d.ts +22 -0
- package/dist/app/installExperience.js +389 -0
- package/dist/app/installExperienceDevice.d.ts +29 -0
- package/dist/app/installExperienceDevice.js +160 -0
- package/dist/app/installExperienceHome.d.ts +16 -0
- package/dist/app/installExperienceHome.js +304 -0
- package/dist/app/installExperienceRuntime.d.ts +37 -0
- package/dist/app/installExperienceRuntime.js +285 -0
- package/dist/app/installPolicy.d.ts +28 -0
- package/dist/app/installPolicy.js +90 -0
- package/dist/app/installQr.d.ts +10 -0
- package/dist/app/installQr.js +139 -0
- package/dist/app/installStrings.d.ts +52 -0
- package/dist/app/installStrings.js +75 -0
- package/dist/app/installTipPath.d.ts +12 -0
- package/dist/app/installTipPath.js +9 -0
- package/dist/app/installationFailure.d.ts +14 -0
- package/dist/app/installationFailure.js +38 -0
- package/dist/app/launch.d.ts +7 -0
- package/dist/app/launch.js +241 -0
- package/dist/app/launchReadiness.d.ts +9 -0
- package/dist/app/launchReadiness.js +72 -0
- package/dist/app/launchScreen.d.ts +16 -0
- package/dist/app/launchScreen.js +14 -0
- package/dist/app/launchScreenRuntime.d.ts +19 -0
- package/dist/app/launchScreenRuntime.js +313 -0
- package/dist/app/launchWatchdog.d.ts +1 -0
- package/dist/app/launchWatchdog.js +202 -0
- package/dist/app/manifests.d.ts +19 -0
- package/dist/app/manifests.js +20 -0
- package/dist/app/mdm.d.ts +3 -0
- package/dist/app/mdm.js +20 -0
- package/dist/app/mediaCheck.d.ts +9 -0
- package/dist/app/mediaCheck.js +122 -0
- package/dist/app/mediaTypes.d.ts +2 -0
- package/dist/app/mediaTypes.js +13 -0
- package/dist/app/platformPolicy.d.ts +3 -0
- package/dist/app/platformPolicy.js +10 -0
- package/dist/app/platformScripts.d.ts +6 -0
- package/dist/app/platformScripts.js +65 -0
- package/dist/app/releaseUpdates.d.ts +7 -0
- package/dist/app/releaseUpdates.js +53 -0
- package/dist/app/runtime.d.ts +9 -0
- package/dist/app/runtime.js +38 -0
- package/dist/app/startup.d.ts +30 -0
- package/dist/app/startup.js +24 -0
- package/dist/app/statusBand.d.ts +11 -0
- package/dist/app/statusBand.js +257 -0
- package/dist/app/viewport.d.ts +3 -0
- package/dist/app/viewport.js +42 -0
- package/dist/app/viewportValue.d.ts +5 -0
- package/dist/app/viewportValue.js +14 -0
- package/dist/app/vite.d.ts +27 -0
- package/dist/app/vite.js +440 -0
- package/dist/app/warmImage.d.ts +3 -0
- package/dist/app/warmImage.js +59 -0
- package/dist/content/content.d.ts +153 -0
- package/dist/content/content.js +315 -0
- package/dist/content/layout.d.ts +26 -0
- package/dist/content/layout.js +114 -0
- package/dist/content/scaledMetric.d.ts +3 -0
- package/dist/content/scaledMetric.js +68 -0
- package/dist/content/typography.d.ts +83 -0
- package/dist/content/typography.js +32 -0
- package/dist/controls/ActivityIndicatorSegments.d.ts +4 -0
- package/dist/controls/ActivityIndicatorSegments.js +5 -0
- package/dist/controls/ColorPicker.d.ts +20 -0
- package/dist/controls/ColorPicker.js +70 -0
- package/dist/controls/ControlRow.d.ts +5 -0
- package/dist/controls/ControlRow.js +10 -0
- package/dist/controls/DatePicker.d.ts +41 -0
- package/dist/controls/DatePicker.js +148 -0
- package/dist/controls/ProgressView.d.ts +17 -0
- package/dist/controls/ProgressView.js +24 -0
- package/dist/controls/civilDate.d.ts +49 -0
- package/dist/controls/civilDate.js +112 -0
- package/dist/data/database.d.ts +154 -0
- package/dist/data/database.js +710 -0
- package/dist/data/value-equal.d.ts +2 -0
- package/dist/data/value-equal.js +36 -0
- package/dist/data/write-store.d.ts +38 -0
- package/dist/data/write-store.js +192 -0
- package/dist/dev-menu/DevMenu.d.ts +1 -0
- package/dist/dev-menu/DevMenu.js +121 -0
- package/dist/dev-menu/actions.d.ts +12 -0
- package/dist/dev-menu/actions.js +99 -0
- package/dist/dev-menu/build.d.ts +5 -0
- package/dist/dev-menu/build.js +40 -0
- package/dist/dev-menu/gesture.d.ts +18 -0
- package/dist/dev-menu/gesture.js +109 -0
- package/dist/dev-menu/shake.d.ts +2 -0
- package/dist/dev-menu/shake.js +36 -0
- package/dist/dev-menu/types.d.ts +8 -0
- package/dist/dev-menu/types.js +1 -0
- package/dist/diagnostics.d.ts +3 -0
- package/dist/diagnostics.js +4 -0
- package/dist/docs/app-recipes.md +411 -0
- package/dist/docs/components/file-importer.md +54 -0
- package/dist/docs/components/paste-button.md +48 -0
- package/dist/docs/components/photos-picker.md +53 -0
- package/dist/docs/components/share-link.md +58 -0
- package/dist/docs/content.md +159 -0
- package/dist/docs/controls.md +151 -0
- package/dist/docs/data.md +332 -0
- package/dist/docs/limitations.md +40 -0
- package/dist/docs/messaging-scroll.md +234 -0
- package/dist/docs/networking.md +190 -0
- package/dist/docs/push.md +215 -0
- package/dist/docs/swiftui-reference.md +1895 -0
- package/dist/docs/symbols.md +293 -0
- package/dist/docs/tokens.md +60 -0
- package/dist/fidelity/devAssertions.d.ts +21 -0
- package/dist/fidelity/devAssertions.js +199 -0
- package/dist/focus/focusIntentMachine.d.ts +106 -0
- package/dist/focus/focusIntentMachine.js +359 -0
- package/dist/focus/navigationFocus.d.ts +42 -0
- package/dist/focus/navigationFocus.js +241 -0
- package/dist/focus/programmaticFocus.d.ts +15 -0
- package/dist/focus/programmaticFocus.js +152 -0
- package/dist/gestures/GestureView.d.ts +12 -0
- package/dist/gestures/GestureView.js +321 -0
- package/dist/gestures/arena.d.ts +138 -0
- package/dist/gestures/arena.js +417 -0
- package/dist/gestures/existingCompetitors.d.ts +79 -0
- package/dist/gestures/existingCompetitors.js +82 -0
- package/dist/gestures/gesture.d.ts +62 -0
- package/dist/gestures/gesture.js +107 -0
- package/dist/glass/ControlLens.d.ts +46 -0
- package/dist/glass/ControlLens.js +88 -0
- package/dist/glass/GlassBar.d.ts +9 -0
- package/dist/glass/GlassBar.js +22 -0
- package/dist/glass/GlassConfusionReview.d.ts +3 -0
- package/dist/glass/GlassConfusionReview.js +185 -0
- package/dist/glass/GlassEffect.d.ts +69 -0
- package/dist/glass/GlassEffect.js +550 -0
- package/dist/glass/GlassMaterialRoot.d.ts +7 -0
- package/dist/glass/GlassMaterialRoot.js +39 -0
- package/dist/glass/GlassPresentation.d.ts +28 -0
- package/dist/glass/GlassPresentation.js +1038 -0
- package/dist/glass/GlassProbeIcons.d.ts +8 -0
- package/dist/glass/GlassProbeIcons.js +12 -0
- package/dist/glass/GlassProbeOverlay.d.ts +52 -0
- package/dist/glass/GlassProbeOverlay.js +45 -0
- package/dist/glass/GlassTextField.d.ts +22 -0
- package/dist/glass/GlassTextField.js +12 -0
- package/dist/glass/MaterialEffectRoot.d.ts +9 -0
- package/dist/glass/MaterialEffectRoot.js +189 -0
- package/dist/glass/Menu.d.ts +3 -0
- package/dist/glass/Menu.js +35 -0
- package/dist/glass/MenuStack.d.ts +23 -0
- package/dist/glass/MenuStack.js +371 -0
- package/dist/glass/MenuSymbol.d.ts +7 -0
- package/dist/glass/MenuSymbol.js +16 -0
- package/dist/glass/MorphEllipsisArtwork.d.ts +2 -0
- package/dist/glass/MorphEllipsisArtwork.js +6 -0
- package/dist/glass/TabBar.d.ts +29 -0
- package/dist/glass/TabBar.js +169 -0
- package/dist/glass/capability.d.ts +25 -0
- package/dist/glass/capability.js +63 -0
- package/dist/glass/captureWindow.d.ts +60 -0
- package/dist/glass/captureWindow.js +119 -0
- package/dist/glass/confusionSession.d.ts +41 -0
- package/dist/glass/confusionSession.js +44 -0
- package/dist/glass/contactPhysics.d.ts +130 -0
- package/dist/glass/contactPhysics.js +214 -0
- package/dist/glass/context.d.ts +37 -0
- package/dist/glass/context.js +11 -0
- package/dist/glass/errorAlert.d.ts +6 -0
- package/dist/glass/errorAlert.js +57 -0
- package/dist/glass/errors.d.ts +22 -0
- package/dist/glass/errors.js +78 -0
- package/dist/glass/failurePolicy.d.ts +4 -0
- package/dist/glass/failurePolicy.js +20 -0
- package/dist/glass/fallback/material.d.ts +16 -0
- package/dist/glass/fallback/material.js +87 -0
- package/dist/glass/fallback/regions.d.ts +16 -0
- package/dist/glass/fallback/regions.js +249 -0
- package/dist/glass/fallback/runtime.d.ts +72 -0
- package/dist/glass/fallback/runtime.js +278 -0
- package/dist/glass/fallback/selection.d.ts +2 -0
- package/dist/glass/fallback/selection.js +9 -0
- package/dist/glass/fieldGeometry.d.ts +28 -0
- package/dist/glass/fieldGeometry.js +64 -0
- package/dist/glass/fieldMotion.d.ts +42 -0
- package/dist/glass/fieldMotion.js +47 -0
- package/dist/glass/glassContact.d.ts +76 -0
- package/dist/glass/glassContact.js +153 -0
- package/dist/glass/glassProbeSettings.d.ts +18 -0
- package/dist/glass/glassProbeSettings.js +133 -0
- package/dist/glass/lens/Scene.d.ts +108 -0
- package/dist/glass/lens/Scene.js +553 -0
- package/dist/glass/lens/backgrounds.json +103 -0
- package/dist/glass/lens/bitmapBackdrop.d.ts +14 -0
- package/dist/glass/lens/bitmapBackdrop.js +35 -0
- package/dist/glass/lens/controlLift.d.ts +94 -0
- package/dist/glass/lens/controlLift.js +78 -0
- package/dist/glass/lens/data.d.ts +19 -0
- package/dist/glass/lens/data.js +161 -0
- package/dist/glass/lens/drawableTop.d.ts +16 -0
- package/dist/glass/lens/drawableTop.js +15 -0
- package/dist/glass/lens/icons.d.ts +9 -0
- package/dist/glass/lens/icons.js +34 -0
- package/dist/glass/lens/interactiveContact.d.ts +33 -0
- package/dist/glass/lens/interactiveContact.js +158 -0
- package/dist/glass/lens/interactivePress.d.ts +95 -0
- package/dist/glass/lens/interactivePress.js +169 -0
- package/dist/glass/lens/ios27GlyphFit.json +126 -0
- package/dist/glass/lens/lensLightingSamples.json +1 -0
- package/dist/glass/lens/lensPress.d.ts +22 -0
- package/dist/glass/lens/lensPress.js +68 -0
- package/dist/glass/lens/lensPressSamples.json +1 -0
- package/dist/glass/lens/liquidMotion.d.ts +50 -0
- package/dist/glass/lens/liquidMotion.js +239 -0
- package/dist/glass/lens/materialGlassRecipes.json +776 -0
- package/dist/glass/lens/materialUniforms.d.ts +22 -0
- package/dist/glass/lens/materialUniforms.js +117 -0
- package/dist/glass/lens/menu-closing-close-fit.json +380 -0
- package/dist/glass/lens/menu-opening-native-fits.json +911 -0
- package/dist/glass/lens/menuContextFit.json +88 -0
- package/dist/glass/lens/menuContextOpacity.json +98 -0
- package/dist/glass/lens/menuContextPresentation.d.ts +15 -0
- package/dist/glass/lens/menuContextPresentation.js +65 -0
- package/dist/glass/lens/menuCornerFit.json +252 -0
- package/dist/glass/lens/menuCornerMotion.d.ts +9 -0
- package/dist/glass/lens/menuCornerMotion.js +5 -0
- package/dist/glass/lens/menuDropFit.json +64 -0
- package/dist/glass/lens/menuField.d.ts +178 -0
- package/dist/glass/lens/menuField.js +564 -0
- package/dist/glass/lens/menuGesturePresentation.d.ts +12 -0
- package/dist/glass/lens/menuGesturePresentation.js +42 -0
- package/dist/glass/lens/menuGlyphDropFit.json +38 -0
- package/dist/glass/lens/menuMorphFit.json +564 -0
- package/dist/glass/lens/menuMorphMotion.d.ts +70 -0
- package/dist/glass/lens/menuMorphMotion.js +219 -0
- package/dist/glass/lens/menuMorphPhoneFit.json +85 -0
- package/dist/glass/lens/menuMotion.d.ts +81 -0
- package/dist/glass/lens/menuMotion.js +323 -0
- package/dist/glass/lens/menuPlacement.d.ts +5 -0
- package/dist/glass/lens/menuPlacement.js +29 -0
- package/dist/glass/lens/menuSpring.d.ts +18 -0
- package/dist/glass/lens/menuSpring.js +29 -0
- package/dist/glass/lens/menuTouchLight.d.ts +13 -0
- package/dist/glass/lens/menuTouchLight.js +147 -0
- package/dist/glass/lens/mirrorConstants.d.ts +1 -0
- package/dist/glass/lens/mirrorConstants.js +2 -0
- package/dist/glass/lens/mirrorExtents.d.ts +52 -0
- package/dist/glass/lens/mirrorExtents.js +264 -0
- package/dist/glass/lens/mirrorInvalidation.d.ts +6 -0
- package/dist/glass/lens/mirrorInvalidation.js +10 -0
- package/dist/glass/lens/mirrorReuse.d.ts +20 -0
- package/dist/glass/lens/mirrorReuse.js +166 -0
- package/dist/glass/lens/motion.d.ts +62 -0
- package/dist/glass/lens/motion.js +93 -0
- package/dist/glass/lens/recordedMotion.d.ts +6 -0
- package/dist/glass/lens/recordedMotion.js +44 -0
- package/dist/glass/lens/referenceBackground.d.ts +9 -0
- package/dist/glass/lens/referenceBackground.js +151 -0
- package/dist/glass/lens/referenceProfiles.d.ts +21 -0
- package/dist/glass/lens/referenceProfiles.js +33 -0
- package/dist/glass/lens/referenceRegularTint.d.ts +12 -0
- package/dist/glass/lens/referenceRegularTint.js +41 -0
- package/dist/glass/lens/scopeSegments.d.ts +12 -0
- package/dist/glass/lens/scopeSegments.js +18 -0
- package/dist/glass/lens/scrollAnchoring.d.ts +15 -0
- package/dist/glass/lens/scrollAnchoring.js +17 -0
- package/dist/glass/lens/selectionParameters.json +94 -0
- package/dist/glass/lens/shapeParameters.json +198 -0
- package/dist/glass/lens/tab-motion-native-fits.json +778 -0
- package/dist/glass/lens/tabAccessoryMotion.d.ts +52 -0
- package/dist/glass/lens/tabAccessoryMotion.js +52 -0
- package/dist/glass/lens/tabChromaRimModel.d.ts +43 -0
- package/dist/glass/lens/tabChromaRimModel.js +93 -0
- package/dist/glass/lens/tabCollapseInkSamples.json +49 -0
- package/dist/glass/lens/tabCompactGesture.d.ts +15 -0
- package/dist/glass/lens/tabCompactGesture.js +50 -0
- package/dist/glass/lens/tabGeometryAttack.json +70 -0
- package/dist/glass/lens/tabGlyphColours.d.ts +17 -0
- package/dist/glass/lens/tabGlyphColours.js +37 -0
- package/dist/glass/lens/tabInterruptedDecaySamples.json +245 -0
- package/dist/glass/lens/tabInterruptedRestoreSamples.json +290 -0
- package/dist/glass/lens/tabMaterialModel.d.ts +10 -0
- package/dist/glass/lens/tabMaterialModel.js +108 -0
- package/dist/glass/lens/tabMinimizeInk.d.ts +15 -0
- package/dist/glass/lens/tabMinimizeInk.js +14 -0
- package/dist/glass/lens/tabMinimizeMotion.d.ts +36 -0
- package/dist/glass/lens/tabMinimizeMotion.js +107 -0
- package/dist/glass/lens/tabMinimizeSamples.json +411 -0
- package/dist/glass/lens/tabMotion.d.ts +91 -0
- package/dist/glass/lens/tabMotion.js +478 -0
- package/dist/glass/lens/tabMotionFit.d.ts +76 -0
- package/dist/glass/lens/tabMotionFit.js +61 -0
- package/dist/glass/lens/tabNativeSymbols.d.ts +1 -0
- package/dist/glass/lens/tabNativeSymbols.js +7 -0
- package/dist/glass/lens/tabPresentation.d.ts +21 -0
- package/dist/glass/lens/tabPresentation.js +20 -0
- package/dist/glass/lens/tabRelease.d.ts +5 -0
- package/dist/glass/lens/tabRelease.js +14 -0
- package/dist/glass/lens/tabRestoreMotion.d.ts +19 -0
- package/dist/glass/lens/tabRestoreMotion.js +65 -0
- package/dist/glass/lens/tabRestoreSamples.json +1272 -0
- package/dist/glass/lens/tabSearchMember.d.ts +38 -0
- package/dist/glass/lens/tabSearchMember.js +74 -0
- package/dist/glass/lens/tabSelectionMaterial.d.ts +20 -0
- package/dist/glass/lens/tabSelectionMaterial.js +23 -0
- package/dist/glass/lens/tabSelectionMeasurements.test-fixture.d.ts +9 -0
- package/dist/glass/lens/tabSelectionMeasurements.test-fixture.js +74 -0
- package/dist/glass/lens/tabSettingsSymbol.d.ts +1 -0
- package/dist/glass/lens/tabSettingsSymbol.js +2 -0
- package/dist/glass/lens/tabShapeResponse.d.ts +7 -0
- package/dist/glass/lens/tabShapeResponse.js +30 -0
- package/dist/glass/lens/theme.d.ts +18 -0
- package/dist/glass/lens/theme.js +40 -0
- package/dist/glass/lens/trace.d.ts +2 -0
- package/dist/glass/lens/trace.js +27 -0
- package/dist/glass/liquidContext.d.ts +31 -0
- package/dist/glass/liquidContext.js +2 -0
- package/dist/glass/menuPanelPlacement.d.ts +51 -0
- package/dist/glass/menuPanelPlacement.js +128 -0
- package/dist/glass/menuPresenter.d.ts +34 -0
- package/dist/glass/menuPresenter.js +983 -0
- package/dist/glass/menuSymbolMasks.d.ts +1 -0
- package/dist/glass/menuSymbolMasks.js +1 -0
- package/dist/glass/menuSymbolTokens.d.ts +22 -0
- package/dist/glass/menuSymbolTokens.js +12 -0
- package/dist/glass/menuTriggerGeometry.d.ts +99 -0
- package/dist/glass/menuTriggerGeometry.js +126 -0
- package/dist/glass/menuTriggerSnapshot.d.ts +77 -0
- package/dist/glass/menuTriggerSnapshot.js +69 -0
- package/dist/glass/menuTypes.d.ts +22 -0
- package/dist/glass/menuTypes.js +1 -0
- package/dist/glass/morphField.d.ts +18 -0
- package/dist/glass/morphField.js +139 -0
- package/dist/glass/presentationFrame.d.ts +43 -0
- package/dist/glass/presentationFrame.js +82 -0
- package/dist/glass/pressHighlight.d.ts +9 -0
- package/dist/glass/pressHighlight.js +158 -0
- package/dist/glass/regionRegistry.d.ts +93 -0
- package/dist/glass/regionRegistry.js +313 -0
- package/dist/glass/regions.d.ts +262 -0
- package/dist/glass/regions.js +147 -0
- package/dist/glass/regularMaterialContext.d.ts +45 -0
- package/dist/glass/regularMaterialContext.js +118 -0
- package/dist/glass/regularTriggerMaterial.d.ts +19 -0
- package/dist/glass/regularTriggerMaterial.js +111 -0
- package/dist/glass/regularTriggerRim.d.ts +163 -0
- package/dist/glass/regularTriggerRim.js +436 -0
- package/dist/glass/renderSpecs.d.ts +454 -0
- package/dist/glass/renderSpecs.js +231 -0
- package/dist/glass/rendererContract.d.ts +205 -0
- package/dist/glass/rendererContract.js +18 -0
- package/dist/glass/shapeTrack.d.ts +53 -0
- package/dist/glass/shapeTrack.js +74 -0
- package/dist/glass/shapeTrackRegistry.d.ts +40 -0
- package/dist/glass/shapeTrackRegistry.js +49 -0
- package/dist/glass/sourceDamage.d.ts +6 -0
- package/dist/glass/sourceDamage.js +8 -0
- package/dist/glass/submenuMotion.d.ts +205 -0
- package/dist/glass/submenuMotion.js +306 -0
- package/dist/glass/tabBarModel.d.ts +12 -0
- package/dist/glass/tabBarModel.js +32 -0
- package/dist/glass/testing.d.ts +14 -0
- package/dist/glass/testing.js +14 -0
- package/dist/glass/tokens.d.ts +79 -0
- package/dist/glass/tokens.js +86 -0
- package/dist/glass/toolbarMaterialContext.d.ts +28 -0
- package/dist/glass/toolbarMaterialContext.js +66 -0
- package/dist/glass/topLayer.d.ts +5 -0
- package/dist/glass/topLayer.js +10 -0
- package/dist/glass/unionOutline.d.ts +11 -0
- package/dist/glass/unionOutline.js +98 -0
- package/dist/glass/visibleDeadline.d.ts +21 -0
- package/dist/glass/visibleDeadline.js +61 -0
- package/dist/glass/webgpu/accessoryMorph.d.ts +99 -0
- package/dist/glass/webgpu/accessoryMorph.js +473 -0
- package/dist/glass/webgpu/accessoryTrack.d.ts +47 -0
- package/dist/glass/webgpu/accessoryTrack.js +59 -0
- package/dist/glass/webgpu/areaMips.d.ts +50 -0
- package/dist/glass/webgpu/areaMips.js +166 -0
- package/dist/glass/webgpu/backdrop.d.ts +86 -0
- package/dist/glass/webgpu/backdrop.js +243 -0
- package/dist/glass/webgpu/backdropLayers.d.ts +29 -0
- package/dist/glass/webgpu/backdropLayers.js +182 -0
- package/dist/glass/webgpu/backgroundLayers.d.ts +71 -0
- package/dist/glass/webgpu/backgroundLayers.js +385 -0
- package/dist/glass/webgpu/cadence.d.ts +18 -0
- package/dist/glass/webgpu/cadence.js +35 -0
- package/dist/glass/webgpu/canvasSubmission.d.ts +6 -0
- package/dist/glass/webgpu/canvasSubmission.js +22 -0
- package/dist/glass/webgpu/capture.d.ts +77 -0
- package/dist/glass/webgpu/capture.js +534 -0
- package/dist/glass/webgpu/captureBands.d.ts +39 -0
- package/dist/glass/webgpu/captureBands.js +53 -0
- package/dist/glass/webgpu/captureContext.d.ts +1 -0
- package/dist/glass/webgpu/captureContext.js +6 -0
- package/dist/glass/webgpu/captureDemand.d.ts +44 -0
- package/dist/glass/webgpu/captureDemand.js +81 -0
- package/dist/glass/webgpu/captureRelease.d.ts +18 -0
- package/dist/glass/webgpu/captureRelease.js +39 -0
- package/dist/glass/webgpu/client.d.ts +49 -0
- package/dist/glass/webgpu/client.js +336 -0
- package/dist/glass/webgpu/contextBackdrop.d.ts +6 -0
- package/dist/glass/webgpu/contextBackdrop.js +13 -0
- package/dist/glass/webgpu/contextComposite.d.ts +64 -0
- package/dist/glass/webgpu/contextComposite.js +66 -0
- package/dist/glass/webgpu/decodedImage.d.ts +1 -0
- package/dist/glass/webgpu/decodedImage.js +2 -0
- package/dist/glass/webgpu/deviceLimits.d.ts +5 -0
- package/dist/glass/webgpu/deviceLimits.js +8 -0
- package/dist/glass/webgpu/edgePass.d.ts +9 -0
- package/dist/glass/webgpu/edgePass.js +170 -0
- package/dist/glass/webgpu/entry.worker.d.ts +1 -0
- package/dist/glass/webgpu/entry.worker.js +28 -0
- package/dist/glass/webgpu/errorCode.d.ts +3 -0
- package/dist/glass/webgpu/errorCode.js +27 -0
- package/dist/glass/webgpu/errors.d.ts +8 -0
- package/dist/glass/webgpu/errors.js +55 -0
- package/dist/glass/webgpu/fieldInk.d.ts +9 -0
- package/dist/glass/webgpu/fieldInk.js +62 -0
- package/dist/glass/webgpu/foreground.d.ts +29 -0
- package/dist/glass/webgpu/foreground.js +313 -0
- package/dist/glass/webgpu/frameClock.d.ts +34 -0
- package/dist/glass/webgpu/frameClock.js +60 -0
- package/dist/glass/webgpu/frameGraph.d.ts +57 -0
- package/dist/glass/webgpu/frameGraph.js +287 -0
- package/dist/glass/webgpu/frameProbe.d.ts +58 -0
- package/dist/glass/webgpu/frameProbe.js +181 -0
- package/dist/glass/webgpu/interactionProfiles.d.ts +10 -0
- package/dist/glass/webgpu/interactionProfiles.js +25 -0
- package/dist/glass/webgpu/keptGlyphs.d.ts +68 -0
- package/dist/glass/webgpu/keptGlyphs.js +85 -0
- package/dist/glass/webgpu/keyboardBackdrop.d.ts +12 -0
- package/dist/glass/webgpu/keyboardBackdrop.js +51 -0
- package/dist/glass/webgpu/lagTrace.d.ts +31 -0
- package/dist/glass/webgpu/lagTrace.js +22 -0
- package/dist/glass/webgpu/layers.d.ts +100 -0
- package/dist/glass/webgpu/layers.js +301 -0
- package/dist/glass/webgpu/lensDebug.d.ts +4 -0
- package/dist/glass/webgpu/lensDebug.js +28 -0
- package/dist/glass/webgpu/lensDiffusion.d.ts +2 -0
- package/dist/glass/webgpu/lensDiffusion.js +20 -0
- package/dist/glass/webgpu/lensLightingFit.json +222 -0
- package/dist/glass/webgpu/menuLiftInput.d.ts +30 -0
- package/dist/glass/webgpu/menuLiftInput.js +39 -0
- package/dist/glass/webgpu/menuSurfaceGuard.d.ts +17 -0
- package/dist/glass/webgpu/menuSurfaceGuard.js +26 -0
- package/dist/glass/webgpu/minimize.d.ts +184 -0
- package/dist/glass/webgpu/minimize.js +470 -0
- package/dist/glass/webgpu/navigationAtlasCopy.d.ts +12 -0
- package/dist/glass/webgpu/navigationAtlasCopy.js +121 -0
- package/dist/glass/webgpu/navigationTracks.d.ts +3 -0
- package/dist/glass/webgpu/navigationTracks.js +84 -0
- package/dist/glass/webgpu/passes.d.ts +204 -0
- package/dist/glass/webgpu/passes.js +394 -0
- package/dist/glass/webgpu/pendingSurfaceInput.d.ts +29 -0
- package/dist/glass/webgpu/pendingSurfaceInput.js +51 -0
- package/dist/glass/webgpu/preparedSourcePixels.d.ts +21 -0
- package/dist/glass/webgpu/preparedSourcePixels.js +43 -0
- package/dist/glass/webgpu/presentationBackdrop.d.ts +3 -0
- package/dist/glass/webgpu/presentationBackdrop.js +33 -0
- package/dist/glass/webgpu/presentationDiffusion.d.ts +48 -0
- package/dist/glass/webgpu/presentationDiffusion.js +57 -0
- package/dist/glass/webgpu/presentationMaterial.d.ts +9 -0
- package/dist/glass/webgpu/presentationMaterial.js +156 -0
- package/dist/glass/webgpu/presenterViewport.d.ts +11 -0
- package/dist/glass/webgpu/presenterViewport.js +193 -0
- package/dist/glass/webgpu/production.d.ts +552 -0
- package/dist/glass/webgpu/production.js +1929 -0
- package/dist/glass/webgpu/productionInstalls.d.ts +53 -0
- package/dist/glass/webgpu/productionInstalls.js +225 -0
- package/dist/glass/webgpu/productionNavigation.d.ts +5 -0
- package/dist/glass/webgpu/productionNavigation.js +360 -0
- package/dist/glass/webgpu/productionPinnedTop.d.ts +80 -0
- package/dist/glass/webgpu/productionPinnedTop.js +77 -0
- package/dist/glass/webgpu/productionPinnedTopPrepare.d.ts +21 -0
- package/dist/glass/webgpu/productionPinnedTopPrepare.js +132 -0
- package/dist/glass/webgpu/productionPlanes.d.ts +135 -0
- package/dist/glass/webgpu/productionPlanes.js +412 -0
- package/dist/glass/webgpu/productionPrepare.d.ts +18 -0
- package/dist/glass/webgpu/productionPrepare.js +832 -0
- package/dist/glass/webgpu/productionTracks.d.ts +73 -0
- package/dist/glass/webgpu/productionTracks.js +22 -0
- package/dist/glass/webgpu/productionViewport.d.ts +20 -0
- package/dist/glass/webgpu/productionViewport.js +52 -0
- package/dist/glass/webgpu/profile.d.ts +37 -0
- package/dist/glass/webgpu/profile.js +101 -0
- package/dist/glass/webgpu/raster.d.ts +337 -0
- package/dist/glass/webgpu/raster.js +1360 -0
- package/dist/glass/webgpu/rasterMaterial.d.ts +19 -0
- package/dist/glass/webgpu/rasterMaterial.js +197 -0
- package/dist/glass/webgpu/rasterShaders.d.ts +7 -0
- package/dist/glass/webgpu/rasterShaders.js +105 -0
- package/dist/glass/webgpu/rasterUniforms.d.ts +304 -0
- package/dist/glass/webgpu/rasterUniforms.js +415 -0
- package/dist/glass/webgpu/regionBackdrop.d.ts +8 -0
- package/dist/glass/webgpu/regionBackdrop.js +12 -0
- package/dist/glass/webgpu/regionBridge.d.ts +145 -0
- package/dist/glass/webgpu/regionBridge.js +1691 -0
- package/dist/glass/webgpu/regionScene.d.ts +294 -0
- package/dist/glass/webgpu/regionScene.js +2144 -0
- package/dist/glass/webgpu/renderer.d.ts +8 -0
- package/dist/glass/webgpu/renderer.js +1478 -0
- package/dist/glass/webgpu/residentPlanes.d.ts +69 -0
- package/dist/glass/webgpu/residentPlanes.js +104 -0
- package/dist/glass/webgpu/restMaterial.d.ts +6 -0
- package/dist/glass/webgpu/restMaterial.js +65 -0
- package/dist/glass/webgpu/resumeOverlay.d.ts +44 -0
- package/dist/glass/webgpu/resumeOverlay.js +82 -0
- package/dist/glass/webgpu/sampleTrace.d.ts +11 -0
- package/dist/glass/webgpu/sampleTrace.js +50 -0
- package/dist/glass/webgpu/scrollEdgeBackdrop.d.ts +89 -0
- package/dist/glass/webgpu/scrollEdgeBackdrop.js +177 -0
- package/dist/glass/webgpu/scrollEdgePose.d.ts +4 -0
- package/dist/glass/webgpu/scrollEdgePose.js +49 -0
- package/dist/glass/webgpu/selectionThumb.d.ts +81 -0
- package/dist/glass/webgpu/selectionThumb.js +209 -0
- package/dist/glass/webgpu/shaders.d.ts +67 -0
- package/dist/glass/webgpu/shaders.js +595 -0
- package/dist/glass/webgpu/sharedLift.d.ts +7 -0
- package/dist/glass/webgpu/sharedLift.js +223 -0
- package/dist/glass/webgpu/sourcePixels.d.ts +42 -0
- package/dist/glass/webgpu/sourcePixels.js +140 -0
- package/dist/glass/webgpu/sourcePixels.worker.d.ts +1 -0
- package/dist/glass/webgpu/sourcePixels.worker.js +62 -0
- package/dist/glass/webgpu/tabGlyphInk.d.ts +14 -0
- package/dist/glass/webgpu/tabGlyphInk.js +72 -0
- package/dist/glass/webgpu/touchLight.d.ts +4 -0
- package/dist/glass/webgpu/touchLight.js +15 -0
- package/dist/glass/worker/client.d.ts +21 -0
- package/dist/glass/worker/client.js +152 -0
- package/dist/glass/worker/experiment.d.ts +13 -0
- package/dist/glass/worker/experiment.js +221 -0
- package/dist/glass/worker/fixture.d.ts +21 -0
- package/dist/glass/worker/fixture.js +152 -0
- package/dist/glass/worker/protocol.d.ts +439 -0
- package/dist/glass/worker/protocol.js +5 -0
- package/dist/graphicsProbe.d.ts +19 -0
- package/dist/graphicsProbe.js +111 -0
- package/dist/haptics/SensoryButton.d.ts +21 -0
- package/dist/haptics/SensoryButton.js +80 -0
- package/dist/image/ContentAdmission.d.ts +19 -0
- package/dist/image/ContentAdmission.js +70 -0
- package/dist/image/Image.d.ts +30 -0
- package/dist/image/Image.js +341 -0
- package/dist/image/asset.d.ts +9 -0
- package/dist/image/asset.js +1 -0
- package/dist/image/contentReadiness.d.ts +7 -0
- package/dist/image/contentReadiness.js +54 -0
- package/dist/image/imports.d.ts +4 -0
- package/dist/image/resource.d.ts +53 -0
- package/dist/image/resource.js +286 -0
- package/dist/image/vite.d.ts +3 -0
- package/dist/image/vite.js +63 -0
- package/dist/index.d.ts +87 -0
- package/dist/index.js +102 -0
- package/dist/install.d.ts +8 -0
- package/dist/install.js +8 -0
- package/dist/internal.d.ts +96 -0
- package/dist/internal.js +80 -0
- package/dist/keyboard/adapter.d.ts +82 -0
- package/dist/keyboard/adapter.js +727 -0
- package/dist/keyboard/avoidance.d.ts +24 -0
- package/dist/keyboard/avoidance.js +283 -0
- package/dist/keyboard/caretMirror.d.ts +13 -0
- package/dist/keyboard/caretMirror.js +122 -0
- package/dist/keyboard/expectedKeyboard.d.ts +10 -0
- package/dist/keyboard/expectedKeyboard.js +60 -0
- package/dist/keyboard/geometry.d.ts +10 -0
- package/dist/keyboard/geometry.js +21 -0
- package/dist/keyboard/modalTapFocus.d.ts +41 -0
- package/dist/keyboard/modalTapFocus.js +224 -0
- package/dist/keyboard/motion.d.ts +54 -0
- package/dist/keyboard/motion.js +80 -0
- package/dist/keyboard/translation.d.ts +12 -0
- package/dist/keyboard/translation.js +19 -0
- package/dist/layout/adaptiveTabsContext.d.ts +5 -0
- package/dist/layout/adaptiveTabsContext.js +2 -0
- package/dist/layout/deviceIdiom.d.ts +4 -0
- package/dist/layout/deviceIdiom.js +12 -0
- package/dist/layout/layoutClass.d.ts +44 -0
- package/dist/layout/layoutClass.js +102 -0
- package/dist/layout/navigationLayoutContext.d.ts +8 -0
- package/dist/layout/navigationLayoutContext.js +5 -0
- package/dist/list-form/ListForm.d.ts +158 -0
- package/dist/list-form/ListForm.js +427 -0
- package/dist/list-form/ListItem.d.ts +30 -0
- package/dist/list-form/ListItem.js +251 -0
- package/dist/list-form/RowLabel.d.ts +14 -0
- package/dist/list-form/RowLabel.js +11 -0
- package/dist/list-form/Slider.d.ts +18 -0
- package/dist/list-form/Slider.js +235 -0
- package/dist/list-form/StepperButton.d.ts +9 -0
- package/dist/list-form/StepperButton.js +60 -0
- package/dist/list-form/Toggle.d.ts +16 -0
- package/dist/list-form/Toggle.js +204 -0
- package/dist/list-form/editMotion.d.ts +15 -0
- package/dist/list-form/editMotion.js +25 -0
- package/dist/list-form/editing.d.ts +102 -0
- package/dist/list-form/editing.js +51 -0
- package/dist/list-form/listContext.d.ts +4 -0
- package/dist/list-form/listContext.js +5 -0
- package/dist/list-form/offsets.d.ts +26 -0
- package/dist/list-form/offsets.js +34 -0
- package/dist/list-form/reorder.d.ts +20 -0
- package/dist/list-form/reorder.js +193 -0
- package/dist/list-form/rowMotion.d.ts +11 -0
- package/dist/list-form/rowMotion.js +236 -0
- package/dist/list-form/rowMotionScope.d.ts +14 -0
- package/dist/list-form/rowMotionScope.js +61 -0
- package/dist/list-form/separatorInsets.d.ts +4 -0
- package/dist/list-form/separatorInsets.js +87 -0
- package/dist/list-form/sliderContact.d.ts +40 -0
- package/dist/list-form/sliderContact.js +98 -0
- package/dist/list-form/state.d.ts +5 -0
- package/dist/list-form/state.js +8 -0
- package/dist/list-form/toggleContact.d.ts +55 -0
- package/dist/list-form/toggleContact.js +164 -0
- package/dist/media/controller.d.ts +7 -0
- package/dist/media/controller.js +612 -0
- package/dist/media/react.d.ts +9 -0
- package/dist/media/react.js +38 -0
- package/dist/media/systemMedia.d.ts +6 -0
- package/dist/media/systemMedia.js +200 -0
- package/dist/media/types.d.ts +83 -0
- package/dist/media/types.js +1 -0
- package/dist/menu/menuContact.d.ts +20 -0
- package/dist/menu/menuContact.js +286 -0
- package/dist/menu/menuGesture.d.ts +84 -0
- package/dist/menu/menuGesture.js +502 -0
- package/dist/menu/menuInteraction.d.ts +17 -0
- package/dist/menu/menuInteraction.js +34 -0
- package/dist/menu/menuOutside.d.ts +9 -0
- package/dist/menu/menuOutside.js +58 -0
- package/dist/menu/menuPanelContact.d.ts +11 -0
- package/dist/menu/menuPanelContact.js +77 -0
- package/dist/menu/menuTriggerHold.d.ts +3 -0
- package/dist/menu/menuTriggerHold.js +52 -0
- package/dist/menu/sampledMotion.d.ts +37 -0
- package/dist/menu/sampledMotion.js +86 -0
- package/dist/modal/lifecycle.d.ts +10 -0
- package/dist/modal/lifecycle.js +189 -0
- package/dist/motion/TransitionView.d.ts +12 -0
- package/dist/motion/TransitionView.js +118 -0
- package/dist/motion/animate.d.ts +20 -0
- package/dist/motion/animate.js +79 -0
- package/dist/motion/animationValue.d.ts +25 -0
- package/dist/motion/animationValue.js +42 -0
- package/dist/motion/composerMotion.d.ts +3 -0
- package/dist/motion/composerMotion.js +15 -0
- package/dist/motion/layoutTransaction.d.ts +7 -0
- package/dist/motion/layoutTransaction.js +28 -0
- package/dist/motion/matchedGeometry.d.ts +55 -0
- package/dist/motion/matchedGeometry.js +412 -0
- package/dist/motion/springPath.d.ts +27 -0
- package/dist/motion/springPath.js +46 -0
- package/dist/motion/springTrack.d.ts +33 -0
- package/dist/motion/springTrack.js +69 -0
- package/dist/motion/transition.d.ts +48 -0
- package/dist/motion/transition.js +56 -0
- package/dist/motion/transitionImages.d.ts +7 -0
- package/dist/motion/transitionImages.js +49 -0
- package/dist/motionProbe.d.ts +227 -0
- package/dist/motionProbe.js +697 -0
- package/dist/motionProbeControls.d.ts +2 -0
- package/dist/motionProbeControls.js +118 -0
- package/dist/motionProbeDelivery.d.ts +15 -0
- package/dist/motionProbeDelivery.js +84 -0
- package/dist/navigation/DetailList.d.ts +9 -0
- package/dist/navigation/DetailList.js +7 -0
- package/dist/navigation/NavigationChrome.d.ts +18 -0
- package/dist/navigation/NavigationChrome.js +195 -0
- package/dist/navigation/NavigationSearchRow.d.ts +9 -0
- package/dist/navigation/NavigationSearchRow.js +101 -0
- package/dist/navigation/NavigationTitleSlots.d.ts +18 -0
- package/dist/navigation/NavigationTitleSlots.js +64 -0
- package/dist/navigation/NavigatorHost.d.ts +17 -0
- package/dist/navigation/NavigatorHost.js +534 -0
- package/dist/navigation/ScreenContainer.d.ts +31 -0
- package/dist/navigation/ScreenContainer.js +219 -0
- package/dist/navigation/ScrubSourceFrames.d.ts +18 -0
- package/dist/navigation/ScrubSourceFrames.js +67 -0
- package/dist/navigation/Sidebar.d.ts +16 -0
- package/dist/navigation/Sidebar.js +20 -0
- package/dist/navigation/SidebarSymbol.d.ts +4 -0
- package/dist/navigation/SidebarSymbol.js +6 -0
- package/dist/navigation/ToolbarGlass.d.ts +2 -0
- package/dist/navigation/ToolbarGlass.js +429 -0
- package/dist/navigation/TransitionEdge.d.ts +4 -0
- package/dist/navigation/TransitionEdge.js +33 -0
- package/dist/navigation/bottomToolbarGeometry.d.ts +6 -0
- package/dist/navigation/bottomToolbarGeometry.js +14 -0
- package/dist/navigation/chromeCurves.d.ts +48 -0
- package/dist/navigation/chromeCurves.js +255 -0
- package/dist/navigation/glassTransition.d.ts +32 -0
- package/dist/navigation/glassTransition.js +55 -0
- package/dist/navigation/horizontalDrag.d.ts +6 -0
- package/dist/navigation/horizontalDrag.js +15 -0
- package/dist/navigation/interactivePop.d.ts +45 -0
- package/dist/navigation/interactivePop.js +86 -0
- package/dist/navigation/interactivePopTypes.d.ts +85 -0
- package/dist/navigation/interactivePopTypes.js +36 -0
- package/dist/navigation/keyboard.d.ts +9 -0
- package/dist/navigation/keyboard.js +55 -0
- package/dist/navigation/motion.d.ts +19 -0
- package/dist/navigation/motion.js +645 -0
- package/dist/navigation/motionTokens.d.ts +43 -0
- package/dist/navigation/motionTokens.js +75 -0
- package/dist/navigation/nativeScrubExperiment.d.ts +5 -0
- package/dist/navigation/nativeScrubExperiment.js +153 -0
- package/dist/navigation/nativeScrubSource.d.ts +15 -0
- package/dist/navigation/nativeScrubSource.js +88 -0
- package/dist/navigation/navigationChromeModel.d.ts +8 -0
- package/dist/navigation/navigationChromeModel.js +30 -0
- package/dist/navigation/navigationContext.d.ts +22 -0
- package/dist/navigation/navigationContext.js +65 -0
- package/dist/navigation/navigationEdge.d.ts +4 -0
- package/dist/navigation/navigationEdge.js +101 -0
- package/dist/navigation/pointerPop.d.ts +32 -0
- package/dist/navigation/pointerPop.js +206 -0
- package/dist/navigation/probeLayers.d.ts +7 -0
- package/dist/navigation/probeLayers.js +8 -0
- package/dist/navigation/registry.d.ts +14 -0
- package/dist/navigation/registry.js +31 -0
- package/dist/navigation/releaseDecision.d.ts +21 -0
- package/dist/navigation/releaseDecision.js +94 -0
- package/dist/navigation/releaseTrajectory.d.ts +20 -0
- package/dist/navigation/releaseTrajectory.js +95 -0
- package/dist/navigation/releaseVelocity.d.ts +9 -0
- package/dist/navigation/releaseVelocity.js +38 -0
- package/dist/navigation/routeCodec.d.ts +33 -0
- package/dist/navigation/routeCodec.js +123 -0
- package/dist/navigation/scrollEdge.d.ts +18 -0
- package/dist/navigation/scrollEdge.js +66 -0
- package/dist/navigation/scrubFrameLoop.d.ts +44 -0
- package/dist/navigation/scrubFrameLoop.js +129 -0
- package/dist/navigation/sidebarSelection.d.ts +5 -0
- package/dist/navigation/sidebarSelection.js +8 -0
- package/dist/navigation/splitContext.d.ts +17 -0
- package/dist/navigation/splitContext.js +9 -0
- package/dist/navigation/splitState.d.ts +46 -0
- package/dist/navigation/splitState.js +130 -0
- package/dist/navigation/stack.d.ts +25 -0
- package/dist/navigation/stack.js +136 -0
- package/dist/navigation/store.d.ts +80 -0
- package/dist/navigation/store.js +464 -0
- package/dist/navigation/toolbarGlassMotion.d.ts +40 -0
- package/dist/navigation/toolbarGlassMotion.js +202 -0
- package/dist/navigation/toolbarMinimization.d.ts +9 -0
- package/dist/navigation/toolbarMinimization.js +76 -0
- package/dist/navigation/toolbarMotionOwner.d.ts +6 -0
- package/dist/navigation/toolbarMotionOwner.js +30 -0
- package/dist/navigation/touchArbitration.d.ts +34 -0
- package/dist/navigation/touchArbitration.js +550 -0
- package/dist/navigation/tracking.d.ts +7 -0
- package/dist/navigation/tracking.js +19 -0
- package/dist/navigation/transitionBindings.d.ts +31 -0
- package/dist/navigation/transitionBindings.js +106 -0
- package/dist/navigation/transitionChrome.d.ts +31 -0
- package/dist/navigation/transitionChrome.js +380 -0
- package/dist/navigation/transitionPose.d.ts +52 -0
- package/dist/navigation/transitionPose.js +295 -0
- package/dist/navigation/types.d.ts +133 -0
- package/dist/navigation/types.js +1 -0
- package/dist/navigation/zoomDrag.d.ts +3 -0
- package/dist/navigation/zoomDrag.js +125 -0
- package/dist/navigation/zoomGeometry.d.ts +48 -0
- package/dist/navigation/zoomGeometry.js +94 -0
- package/dist/navigation/zoomGlass.d.ts +27 -0
- package/dist/navigation/zoomGlass.js +64 -0
- package/dist/navigation/zoomMotion.d.ts +73 -0
- package/dist/navigation/zoomMotion.js +104 -0
- package/dist/navigation/zoomTransition.d.ts +82 -0
- package/dist/navigation/zoomTransition.js +975 -0
- package/dist/presentation/Presentation.d.ts +61 -0
- package/dist/presentation/Presentation.js +92 -0
- package/dist/presentation/PresentationSurface.d.ts +29 -0
- package/dist/presentation/PresentationSurface.js +586 -0
- package/dist/presentation/PresentedSheet.d.ts +2 -0
- package/dist/presentation/PresentedSheet.js +571 -0
- package/dist/presentation/activity.d.ts +3 -0
- package/dist/presentation/activity.js +24 -0
- package/dist/presentation/coldLaunch.d.ts +2 -0
- package/dist/presentation/coldLaunch.js +19 -0
- package/dist/presentation/dismiss.d.ts +26 -0
- package/dist/presentation/dismiss.js +30 -0
- package/dist/presentation/glassMotion.d.ts +39 -0
- package/dist/presentation/glassMotion.js +259 -0
- package/dist/presentation/glassReady.d.ts +11 -0
- package/dist/presentation/glassReady.js +246 -0
- package/dist/presentation/model.d.ts +108 -0
- package/dist/presentation/model.js +183 -0
- package/dist/presentation/motion.d.ts +56 -0
- package/dist/presentation/motion.js +263 -0
- package/dist/presentation/presentationMotion.d.ts +10 -0
- package/dist/presentation/presentationMotion.js +74 -0
- package/dist/presentation/presentationSource.d.ts +2 -0
- package/dist/presentation/presentationSource.js +28 -0
- package/dist/presentation/sheetChromeContext.d.ts +2 -0
- package/dist/presentation/sheetChromeContext.js +3 -0
- package/dist/presentation/sheetMaterialTransition.d.ts +14 -0
- package/dist/presentation/sheetMaterialTransition.js +33 -0
- package/dist/presentation/sheetReleaseMotion.d.ts +18 -0
- package/dist/presentation/sheetReleaseMotion.js +123 -0
- package/dist/presentation/useAlertKeyboardMotion.d.ts +8 -0
- package/dist/presentation/useAlertKeyboardMotion.js +104 -0
- package/dist/press/Pressable.d.ts +19 -0
- package/dist/press/Pressable.js +16 -0
- package/dist/press/activation.d.ts +20 -0
- package/dist/press/activation.js +28 -0
- package/dist/press/contactReceipt.d.ts +23 -0
- package/dist/press/contactReceipt.js +177 -0
- package/dist/press/gestureArbitration.d.ts +13 -0
- package/dist/press/gestureArbitration.js +38 -0
- package/dist/press/stateMachine.d.ts +29 -0
- package/dist/press/stateMachine.js +39 -0
- package/dist/press/tokens.d.ts +18 -0
- package/dist/press/tokens.js +19 -0
- package/dist/press/usePressInteraction.d.ts +30 -0
- package/dist/press/usePressInteraction.js +247 -0
- package/dist/public/Label.d.ts +16 -0
- package/dist/public/Label.js +40 -0
- package/dist/public/NativeFilePicker.d.ts +19 -0
- package/dist/public/NativeFilePicker.js +75 -0
- package/dist/public/Screen.d.ts +42 -0
- package/dist/public/Screen.js +87 -0
- package/dist/public/actions.d.ts +16 -0
- package/dist/public/actions.js +15 -0
- package/dist/public/buttonBorderShape.d.ts +7 -0
- package/dist/public/buttonBorderShape.js +9 -0
- package/dist/public/chrome.d.ts +3 -0
- package/dist/public/chrome.js +5 -0
- package/dist/public/colors.d.ts +29 -0
- package/dist/public/colors.js +28 -0
- package/dist/public/context.d.ts +19 -0
- package/dist/public/context.js +8 -0
- package/dist/public/controlStyle.d.ts +93 -0
- package/dist/public/controlStyle.js +52 -0
- package/dist/public/controls.d.ts +360 -0
- package/dist/public/controls.js +301 -0
- package/dist/public/definition.d.ts +65 -0
- package/dist/public/definition.js +58 -0
- package/dist/public/deviceActions.d.ts +23 -0
- package/dist/public/deviceActions.js +87 -0
- package/dist/public/environment.d.ts +77 -0
- package/dist/public/environment.js +171 -0
- package/dist/public/fieldContext.d.ts +2 -0
- package/dist/public/fieldContext.js +3 -0
- package/dist/public/filePickers.d.ts +25 -0
- package/dist/public/filePickers.js +11 -0
- package/dist/public/glass.d.ts +31 -0
- package/dist/public/glass.js +29 -0
- package/dist/public/glassValue.d.ts +19 -0
- package/dist/public/glassValue.js +32 -0
- package/dist/public/keyboard.d.ts +4 -0
- package/dist/public/keyboard.js +6 -0
- package/dist/public/navigationTransition.d.ts +48 -0
- package/dist/public/navigationTransition.js +49 -0
- package/dist/public/pickerNavigation.d.ts +7 -0
- package/dist/public/pickerNavigation.js +64 -0
- package/dist/public/presentation.d.ts +40 -0
- package/dist/public/presentation.js +21 -0
- package/dist/public/presentationContext.d.ts +2 -0
- package/dist/public/presentationContext.js +3 -0
- package/dist/public/routeRegistry.d.ts +3 -0
- package/dist/public/routeRegistry.js +10 -0
- package/dist/public/routes.d.ts +74 -0
- package/dist/public/routes.js +105 -0
- package/dist/public/runtime.d.ts +134 -0
- package/dist/public/runtime.js +292 -0
- package/dist/public/screenChrome.d.ts +91 -0
- package/dist/public/screenChrome.js +187 -0
- package/dist/public/scroll.d.ts +38 -0
- package/dist/public/scroll.js +7 -0
- package/dist/public/storage.d.ts +9 -0
- package/dist/public/storage.js +9 -0
- package/dist/public/structure.d.ts +65 -0
- package/dist/public/structure.js +40 -0
- package/dist/public/toolbar.d.ts +37 -0
- package/dist/public/toolbar.js +76 -0
- package/dist/push/PushPermissionExplainer.d.ts +14 -0
- package/dist/push/PushPermissionExplainer.js +30 -0
- package/dist/push/notifications.d.ts +54 -0
- package/dist/push/notifications.js +276 -0
- package/dist/push/routes.d.ts +20 -0
- package/dist/push/routes.js +63 -0
- package/dist/push/schema.d.ts +42 -0
- package/dist/push/schema.js +41 -0
- package/dist/push/urlProjection.d.ts +24 -0
- package/dist/push/urlProjection.js +207 -0
- package/dist/reachability/controller.d.ts +21 -0
- package/dist/reachability/controller.js +202 -0
- package/dist/reachability/model.d.ts +94 -0
- package/dist/reachability/model.js +131 -0
- package/dist/reachability/react.d.ts +29 -0
- package/dist/reachability/react.js +69 -0
- package/dist/restoration/navigation.d.ts +9 -0
- package/dist/restoration/navigation.js +55 -0
- package/dist/restoration/react.d.ts +6 -0
- package/dist/restoration/react.js +21 -0
- package/dist/restoration/routes.d.ts +22 -0
- package/dist/restoration/routes.js +166 -0
- package/dist/restoration/scene.d.ts +44 -0
- package/dist/restoration/scene.js +284 -0
- package/dist/root/SatinRoot.d.ts +25 -0
- package/dist/root/SatinRoot.js +512 -0
- package/dist/root/mountSatin.d.ts +12 -0
- package/dist/root/mountSatin.js +60 -0
- package/dist/root/runtimeContext.d.ts +26 -0
- package/dist/root/runtimeContext.js +30 -0
- package/dist/safe-area/Overlay.d.ts +9 -0
- package/dist/safe-area/Overlay.js +26 -0
- package/dist/safe-area/SafeAreaInset.d.ts +25 -0
- package/dist/safe-area/SafeAreaInset.js +138 -0
- package/dist/safe-area/bottomInsetGeometry.d.ts +12 -0
- package/dist/safe-area/bottomInsetGeometry.js +73 -0
- package/dist/safe-area/context.d.ts +15 -0
- package/dist/safe-area/context.js +8 -0
- package/dist/safe-area/displayCorners.d.ts +21 -0
- package/dist/safe-area/displayCorners.js +70 -0
- package/dist/safe-area/keyboardCarrier.d.ts +26 -0
- package/dist/safe-area/keyboardCarrier.js +394 -0
- package/dist/safe-area/keyboardCarrierGeometry.d.ts +37 -0
- package/dist/safe-area/keyboardCarrierGeometry.js +49 -0
- package/dist/safe-area/modifiers.d.ts +52 -0
- package/dist/safe-area/modifiers.js +86 -0
- package/dist/safe-area/useSafeAreaMetrics.d.ts +83 -0
- package/dist/safe-area/useSafeAreaMetrics.js +367 -0
- package/dist/safe-area/windowChrome.d.ts +7 -0
- package/dist/safe-area/windowChrome.js +14 -0
- package/dist/scroll/RefreshControl.d.ts +8 -0
- package/dist/scroll/RefreshControl.js +135 -0
- package/dist/scroll/ScrollSurface.d.ts +62 -0
- package/dist/scroll/ScrollSurface.js +278 -0
- package/dist/scroll/ScrollTarget.d.ts +6 -0
- package/dist/scroll/ScrollTarget.js +11 -0
- package/dist/scroll/edgePolicy.d.ts +21 -0
- package/dist/scroll/edgePolicy.js +17 -0
- package/dist/scroll/insertionMotion.d.ts +15 -0
- package/dist/scroll/insertionMotion.js +128 -0
- package/dist/scroll/nativeScroll.d.ts +14 -0
- package/dist/scroll/nativeScroll.js +71 -0
- package/dist/scroll/position.d.ts +31 -0
- package/dist/scroll/position.js +273 -0
- package/dist/scroll/pressOwnership.d.ts +4 -0
- package/dist/scroll/pressOwnership.js +65 -0
- package/dist/scroll/refreshMotion.d.ts +9 -0
- package/dist/scroll/refreshMotion.js +15 -0
- package/dist/scroll/refreshable.d.ts +6 -0
- package/dist/scroll/refreshable.js +50 -0
- package/dist/scroll/registry.d.ts +38 -0
- package/dist/scroll/registry.js +261 -0
- package/dist/scroll/screenGeometry.d.ts +8 -0
- package/dist/scroll/screenGeometry.js +50 -0
- package/dist/scroll/scrollIndicator.d.ts +7 -0
- package/dist/scroll/scrollIndicator.js +114 -0
- package/dist/scroll/scrollJump.d.ts +7 -0
- package/dist/scroll/scrollJump.js +16 -0
- package/dist/scroll/types.d.ts +12 -0
- package/dist/scroll/types.js +1 -0
- package/dist/search/SearchDrawer.d.ts +16 -0
- package/dist/search/SearchDrawer.js +421 -0
- package/dist/search/SearchScopesBar.d.ts +6 -0
- package/dist/search/SearchScopesBar.js +12 -0
- package/dist/search/SearchToolbarField.d.ts +8 -0
- package/dist/search/SearchToolbarField.js +115 -0
- package/dist/search/searchBackdrop.d.ts +12 -0
- package/dist/search/searchBackdrop.js +45 -0
- package/dist/search/searchChrome.d.ts +13 -0
- package/dist/search/searchChrome.js +31 -0
- package/dist/search/searchMotion.d.ts +30 -0
- package/dist/search/searchMotion.js +46 -0
- package/dist/search/searchPlacement.d.ts +11 -0
- package/dist/search/searchPlacement.js +15 -0
- package/dist/search/searchable.d.ts +46 -0
- package/dist/search/searchable.js +5 -0
- package/dist/search/useSearchPresentation.d.ts +15 -0
- package/dist/search/useSearchPresentation.js +61 -0
- package/dist/server.d.ts +7 -0
- package/dist/server.js +144 -0
- package/dist/settings/DisclosureIndicator.d.ts +4 -0
- package/dist/settings/DisclosureIndicator.js +6 -0
- package/dist/settings/tokens.d.ts +129 -0
- package/dist/settings/tokens.js +143 -0
- package/dist/shapes/corners.d.ts +14 -0
- package/dist/shapes/corners.js +80 -0
- package/dist/styles.css +9078 -0
- package/dist/styles.css.d.ts +3 -0
- package/dist/sw/activationState.d.ts +20 -0
- package/dist/sw/activationState.js +39 -0
- package/dist/sw/generator.d.ts +14 -0
- package/dist/sw/generator.js +26 -0
- package/dist/sw/manifest.d.ts +32 -0
- package/dist/sw/manifest.js +137 -0
- package/dist/sw/protocol.d.ts +7 -0
- package/dist/sw/protocol.js +7 -0
- package/dist/sw/pushRuntime.d.ts +2 -0
- package/dist/sw/pushRuntime.js +161 -0
- package/dist/sw/registerAppShell.d.ts +25 -0
- package/dist/sw/registerAppShell.js +259 -0
- package/dist/sw/renderServiceWorker.d.ts +10 -0
- package/dist/sw/renderServiceWorker.js +370 -0
- package/dist/sw/requestRouting.d.ts +13 -0
- package/dist/sw/requestRouting.js +26 -0
- package/dist/sw/updateCheck.d.ts +2 -0
- package/dist/sw/updateCheck.js +25 -0
- package/dist/sw/vite.d.ts +20 -0
- package/dist/sw/vite.js +71 -0
- package/dist/symbols/Symbol.d.ts +33 -0
- package/dist/symbols/Symbol.js +59 -0
- package/dist/symbols/catalogue.d.ts +4 -0
- package/dist/symbols/catalogue.js +4139 -0
- package/dist/symbols/exclusions.d.ts +2 -0
- package/dist/symbols/exclusions.js +4 -0
- package/dist/symbols/inheritedWeight.d.ts +3 -0
- package/dist/symbols/inheritedWeight.js +104 -0
- package/dist/symbols/metrics.d.ts +38 -0
- package/dist/symbols/metrics.js +53 -0
- package/dist/symbols/svg.d.ts +3 -0
- package/dist/symbols/svg.js +16 -0
- package/dist/symbols/types.d.ts +30 -0
- package/dist/symbols/types.js +1 -0
- package/dist/tabs/TabSection.d.ts +12 -0
- package/dist/tabs/TabSection.js +4 -0
- package/dist/tabs/TabSidebarSurface.d.ts +7 -0
- package/dist/tabs/TabSidebarSurface.js +29 -0
- package/dist/tabs/TabView.d.ts +28 -0
- package/dist/tabs/TabView.js +258 -0
- package/dist/tabs/accessoryContact.d.ts +2 -0
- package/dist/tabs/accessoryContact.js +42 -0
- package/dist/tabs/compactBar.d.ts +4 -0
- package/dist/tabs/compactBar.js +28 -0
- package/dist/tabs/context.d.ts +8 -0
- package/dist/tabs/context.js +6 -0
- package/dist/tabs/keyboard.d.ts +3 -0
- package/dist/tabs/keyboard.js +23 -0
- package/dist/tabs/model.d.ts +6 -0
- package/dist/tabs/model.js +16 -0
- package/dist/tabs/presentation.d.ts +7 -0
- package/dist/tabs/presentation.js +14 -0
- package/dist/tabs/sourceRevision.d.ts +3 -0
- package/dist/tabs/sourceRevision.js +36 -0
- package/dist/tabs/tabSidebarGlyph.d.ts +2 -0
- package/dist/tabs/tabSidebarGlyph.js +11 -0
- package/dist/tasks/useTask.d.ts +16 -0
- package/dist/tasks/useTask.js +67 -0
- package/dist/testing.d.ts +9 -0
- package/dist/testing.js +11 -0
- package/dist/text-input/TextEditor.d.ts +25 -0
- package/dist/text-input/TextEditor.js +74 -0
- package/dist/text-input/TextField.d.ts +32 -0
- package/dist/text-input/TextField.js +29 -0
- package/dist/text-input/editorGeometry.d.ts +2 -0
- package/dist/text-input/editorGeometry.js +6 -0
- package/dist/text-input/editorTextLayout.d.ts +2 -0
- package/dist/text-input/editorTextLayout.js +31 -0
- package/dist/text-input/focusChain.d.ts +27 -0
- package/dist/text-input/focusChain.js +62 -0
- package/dist/text-input/kinds.d.ts +8 -0
- package/dist/text-input/kinds.js +34 -0
- package/dist/text-input/measureEditor.d.ts +2 -0
- package/dist/text-input/measureEditor.js +50 -0
- package/dist/text-input/submit.d.ts +9 -0
- package/dist/text-input/submit.js +7 -0
- package/dist/unstable.d.ts +16 -0
- package/dist/unstable.js +16 -0
- package/dist/vite.d.ts +3 -0
- package/dist/vite.js +3 -0
- package/dist/web/WebView.d.ts +42 -0
- package/dist/web/WebView.js +115 -0
- package/dist/web/authentication.d.ts +75 -0
- package/dist/web/authentication.js +488 -0
- package/dist/web/openURL.d.ts +37 -0
- package/dist/web/openURL.js +89 -0
- package/dist/web/urlPolicy.d.ts +3 -0
- package/dist/web/urlPolicy.js +19 -0
- package/dist/web/useWebAuthentication.d.ts +3 -0
- package/dist/web/useWebAuthentication.js +6 -0
- package/dist/zoom/Zoomable.d.ts +10 -0
- package/dist/zoom/Zoomable.js +116 -0
- package/dist/zoom/geometry.d.ts +11 -0
- package/dist/zoom/geometry.js +16 -0
- package/package.json +115 -3
|
@@ -0,0 +1,975 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* SwiftUI's zoom navigation transition: `matchedTransitionSource(id:in:)` on the view a push starts
|
|
3
|
+
* from, and `.navigationTransition(.zoom(sourceID:in:))` on the pushed screen.
|
|
4
|
+
*
|
|
5
|
+
* A push whose screen asks for a zoom, and whose source is on screen in the screen it covers, grows
|
|
6
|
+
* out of the source instead of sliding in. Its pop (the back button) and a downward drag on the
|
|
7
|
+
* screen shrink it back into the source. Every other push and pop keeps the ordinary slide: the
|
|
8
|
+
* choice is made per transition, when the transition first binds to its screens, and a transition
|
|
9
|
+
* that is not a zoom runs the unchanged slide controller.
|
|
10
|
+
*
|
|
11
|
+
* The window's edges are transforms of two nested clipping boxes and everything else is opacity
|
|
12
|
+
* and transform, sampled at 60 Hz from native-fitted springs into Web Animations, so WebKit's
|
|
13
|
+
* compositor plays it; only the corner radius is a main-thread value. The geometry is in
|
|
14
|
+
* zoomGeometry.ts and the measured values in zoomMotion.ts.
|
|
15
|
+
*/
|
|
16
|
+
import { announceAnimation } from '../motion/animate.js';
|
|
17
|
+
import { sampleChannel } from '../motion/springPath.js';
|
|
18
|
+
import { prepareDestinationImages } from '../image/resource.js';
|
|
19
|
+
import { prepareClonedImages, prepareRevealedImages } from '../motion/transitionImages.js';
|
|
20
|
+
import { registerZoomGlass } from './zoomGlass.js';
|
|
21
|
+
import { Animation as SpringAnimation } from '../motion/animationValue.js';
|
|
22
|
+
import { chromeDissolve } from './chromeCurves.js';
|
|
23
|
+
import { shouldCompleteInteractivePop } from './motionTokens.js';
|
|
24
|
+
import { dragRect, edgeRect, openness, windowRadius, windowStyle, } from './zoomGeometry.js';
|
|
25
|
+
import { ZOOM_DIM_OPACITY, ZOOM_DISMISS, ZOOM_DISMISS_DISTANCE, ZOOM_POP, ZOOM_POP_PAGE_ALPHA, ZOOM_POP_CHROME_FADE_MS, ZOOM_POP_SOURCE_FADE_MS, ZOOM_PUSH, ZOOM_PUSH_CHROME_FADE_MS, ZOOM_PUSH_SOURCE_FADE_MS, ZOOM_REAR_SCALE, ZOOM_RETURN, } from './zoomMotion.js';
|
|
26
|
+
const sources = new Set();
|
|
27
|
+
/** Zoom requests of mounted screens, by navigation entry key. */
|
|
28
|
+
const requests = new Map();
|
|
29
|
+
/** A route keeps the exact source that opened it, even when the same album appears twice. */
|
|
30
|
+
const selectedSources = new Map();
|
|
31
|
+
const activationDocuments = new Map();
|
|
32
|
+
/** The entry whose screen a finger is dragging down, until its pop has bound. */
|
|
33
|
+
let draggedEntryKey;
|
|
34
|
+
/** Registers a `MatchedTransitionSource`; returns its removal. */
|
|
35
|
+
export function registerTransitionSource(source) {
|
|
36
|
+
sources.add(source);
|
|
37
|
+
const document = source.wrapper.ownerDocument;
|
|
38
|
+
let activation = activationDocuments.get(document);
|
|
39
|
+
if (!activation) {
|
|
40
|
+
const state = {
|
|
41
|
+
count: 0,
|
|
42
|
+
record: event => {
|
|
43
|
+
state.target =
|
|
44
|
+
event.type !== 'pointercancel' && event.target instanceof Element
|
|
45
|
+
? event.target
|
|
46
|
+
: undefined;
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
activation = state;
|
|
50
|
+
activationDocuments.set(document, state);
|
|
51
|
+
for (const type of ['pointerdown', 'click', 'pointercancel'])
|
|
52
|
+
document.addEventListener(type, state.record, true);
|
|
53
|
+
}
|
|
54
|
+
activation.count++;
|
|
55
|
+
return () => {
|
|
56
|
+
sources.delete(source);
|
|
57
|
+
if (--activation.count === 0) {
|
|
58
|
+
for (const type of ['pointerdown', 'click', 'pointercancel'])
|
|
59
|
+
document.removeEventListener(type, activation.record, true);
|
|
60
|
+
activationDocuments.delete(document);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
/** Registers a screen's `.navigationTransition(.zoom)`; returns its removal. */
|
|
65
|
+
export function registerZoomRequest(entryKey, request) {
|
|
66
|
+
const previous = requests.get(entryKey);
|
|
67
|
+
if (previous?.namespace !== request.namespace || previous.sourceID !== request.sourceID)
|
|
68
|
+
selectedSources.delete(entryKey);
|
|
69
|
+
requests.set(entryKey, request);
|
|
70
|
+
return () => {
|
|
71
|
+
if (requests.get(entryKey) === request) {
|
|
72
|
+
requests.delete(entryKey);
|
|
73
|
+
selectedSources.delete(entryKey);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
function entryKeyOf(element) {
|
|
78
|
+
return element.closest('[data-satin-screen-key]')?.dataset.satinScreenKey;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* The source view a zoom of `entryKey` starts from or returns to, if it is on screen inside `rear`
|
|
82
|
+
* (and not inside `excluded`, the zoomed screen itself).
|
|
83
|
+
*/
|
|
84
|
+
export function visibleZoomSource(entryKey, rear, excluded) {
|
|
85
|
+
const request = requests.get(entryKey);
|
|
86
|
+
if (!request)
|
|
87
|
+
return undefined;
|
|
88
|
+
const selected = selectedSources.get(entryKey);
|
|
89
|
+
const candidates = [];
|
|
90
|
+
for (const source of sources) {
|
|
91
|
+
if (source.namespace !== request.namespace || source.id !== request.sourceID)
|
|
92
|
+
continue;
|
|
93
|
+
const view = source.wrapper.firstElementChild;
|
|
94
|
+
if (!(view instanceof HTMLElement) || !rear.contains(view))
|
|
95
|
+
continue;
|
|
96
|
+
if (excluded?.contains(view))
|
|
97
|
+
continue;
|
|
98
|
+
if (isOnScreen(view))
|
|
99
|
+
candidates.push({ source, view });
|
|
100
|
+
}
|
|
101
|
+
// Once selected, losing that view falls back to a slide, never to another copy of the album.
|
|
102
|
+
if (selected)
|
|
103
|
+
return candidates.find(candidate => candidate.source === selected)?.view;
|
|
104
|
+
const activation = activationDocuments.get(rear.ownerDocument);
|
|
105
|
+
const target = activation?.target;
|
|
106
|
+
const direct = candidates.find(candidate => target && candidate.source.wrapper.contains(target));
|
|
107
|
+
// Keyboard clicks target an enclosing button rather than its artwork. Only adopt an
|
|
108
|
+
// ancestor activation when it identifies a single source in this namespace and rear route.
|
|
109
|
+
const control = target?.closest('button, [role="button"], a[href], [data-satin-pressable]') ?? target;
|
|
110
|
+
const enclosed = control ? candidates.filter(candidate => control.contains(candidate.view)) : [];
|
|
111
|
+
const chosen = direct ?? (enclosed.length === 1 ? enclosed[0] : undefined) ?? candidates[0];
|
|
112
|
+
if (chosen) {
|
|
113
|
+
selectedSources.set(entryKey, chosen.source);
|
|
114
|
+
if (activation)
|
|
115
|
+
activation.target = undefined;
|
|
116
|
+
}
|
|
117
|
+
return chosen?.view;
|
|
118
|
+
}
|
|
119
|
+
/** SwiftUI zooms only from a source the user can see: at least part of it in the viewport. */
|
|
120
|
+
function isOnScreen(view) {
|
|
121
|
+
const bounds = view.getBoundingClientRect();
|
|
122
|
+
if (!(bounds.width > 0 && bounds.height > 0))
|
|
123
|
+
return false;
|
|
124
|
+
return (bounds.bottom > 0 &&
|
|
125
|
+
bounds.right > 0 &&
|
|
126
|
+
bounds.top < window.innerHeight &&
|
|
127
|
+
bounds.left < window.innerWidth);
|
|
128
|
+
}
|
|
129
|
+
const dragHandles = new WeakMap();
|
|
130
|
+
const zoomDeciders = new WeakMap();
|
|
131
|
+
/**
|
|
132
|
+
* Whether `controller` runs as a zoom once bound to `binding`. Deciding is idempotent and can
|
|
133
|
+
* happen before the binding is handed over (the navigator prepares glass first).
|
|
134
|
+
*/
|
|
135
|
+
export function decideZoomTransition(controller, binding) {
|
|
136
|
+
return zoomDeciders.get(controller)?.(binding) ?? false;
|
|
137
|
+
}
|
|
138
|
+
/** The drag handle of an interactive pop that a zoom drag started, once the pop is a zoom. */
|
|
139
|
+
export function zoomDragHandleOf(controller) {
|
|
140
|
+
return controller ? dragHandles.get(controller) : undefined;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Marks the next interactive pop of `entryKey` as a zoom drag (not the edge back swipe). The touch
|
|
144
|
+
* position is where the finger went down, which stays under the finger as the screen shrinks.
|
|
145
|
+
*/
|
|
146
|
+
export function beginZoomDrag(entryKey, touchDown) {
|
|
147
|
+
draggedEntryKey = entryKey;
|
|
148
|
+
pendingTouchDown = touchDown;
|
|
149
|
+
}
|
|
150
|
+
let pendingTouchDown = { x: 0, y: 0 };
|
|
151
|
+
/**
|
|
152
|
+
* Wraps the slide controller factory: each transition binds first, then runs as a zoom when its
|
|
153
|
+
* screens asked for one, and as the unchanged slide otherwise.
|
|
154
|
+
*/
|
|
155
|
+
export function withZoomTransitions(createSlide) {
|
|
156
|
+
return (completion, context) => createZoomAwareController(completion, context, createSlide);
|
|
157
|
+
}
|
|
158
|
+
function createZoomAwareController(completion, context, createSlide) {
|
|
159
|
+
const slide = createSlide(completion, context);
|
|
160
|
+
let zoom;
|
|
161
|
+
let decided = false;
|
|
162
|
+
let startRequested = false;
|
|
163
|
+
let slideStarted = false;
|
|
164
|
+
let zoomStarted = false;
|
|
165
|
+
/** Starts whichever controller runs this transition, once. */
|
|
166
|
+
const startActive = () => {
|
|
167
|
+
if (zoom) {
|
|
168
|
+
if (zoomStarted)
|
|
169
|
+
return;
|
|
170
|
+
zoomStarted = true;
|
|
171
|
+
zoom.start?.();
|
|
172
|
+
}
|
|
173
|
+
else if (!slideStarted) {
|
|
174
|
+
slideStarted = true;
|
|
175
|
+
slide.start?.();
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
const active = () => zoom ?? slide;
|
|
179
|
+
// A zoom drag marks its pop before beginning it; a plain back swipe never does.
|
|
180
|
+
const dragTouchDown = context.interactive && draggedEntryKey ? pendingTouchDown : undefined;
|
|
181
|
+
draggedEntryKey = undefined;
|
|
182
|
+
const decide = (binding) => {
|
|
183
|
+
if (decided)
|
|
184
|
+
return;
|
|
185
|
+
decided = true;
|
|
186
|
+
const plan = zoomPlan(binding, context, dragTouchDown);
|
|
187
|
+
if (!plan)
|
|
188
|
+
return;
|
|
189
|
+
zoom = createZoomController(completion, context, plan, wrapper);
|
|
190
|
+
};
|
|
191
|
+
const forward = (name) => ((...args) => active()[name]?.(...args));
|
|
192
|
+
const optional = (name) => active()[name] ? forward(name) : undefined;
|
|
193
|
+
const wrapper = {
|
|
194
|
+
get progress() {
|
|
195
|
+
return active().progress;
|
|
196
|
+
},
|
|
197
|
+
get interactionPhase() {
|
|
198
|
+
return active().interactionPhase;
|
|
199
|
+
},
|
|
200
|
+
get finishForPush() {
|
|
201
|
+
return optional('finishForPush');
|
|
202
|
+
},
|
|
203
|
+
get yieldForPop() {
|
|
204
|
+
return optional('yieldForPop');
|
|
205
|
+
},
|
|
206
|
+
get resumeInteractive() {
|
|
207
|
+
return optional('resumeInteractive');
|
|
208
|
+
},
|
|
209
|
+
get prepareForNextGesture() {
|
|
210
|
+
return optional('prepareForNextGesture');
|
|
211
|
+
},
|
|
212
|
+
get scrubFromScroll() {
|
|
213
|
+
return optional('scrubFromScroll');
|
|
214
|
+
},
|
|
215
|
+
get resolveInteractive() {
|
|
216
|
+
return optional('resolveInteractive');
|
|
217
|
+
},
|
|
218
|
+
get presentedPose() {
|
|
219
|
+
return optional('presentedPose');
|
|
220
|
+
},
|
|
221
|
+
setProgress: forward('setProgress'),
|
|
222
|
+
completeInteractive: forward('completeInteractive'),
|
|
223
|
+
cancelInteractive: forward('cancelInteractive'),
|
|
224
|
+
start() {
|
|
225
|
+
startRequested = true;
|
|
226
|
+
if (decided) {
|
|
227
|
+
startActive();
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
// Before the decision the slide starts as it always has: it waits for its binding itself,
|
|
231
|
+
// and finishes at once under reduced motion. If a zoom is chosen, the slide is never bound
|
|
232
|
+
// and does nothing. A zoom drag's pop never starts as a slide.
|
|
233
|
+
if (!dragTouchDown || prefersReducedMotion()) {
|
|
234
|
+
slideStarted = true;
|
|
235
|
+
slide.start?.();
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
bind(binding) {
|
|
239
|
+
decide(binding);
|
|
240
|
+
const release = active().bind?.(binding) ?? (() => undefined);
|
|
241
|
+
if (startRequested)
|
|
242
|
+
startActive();
|
|
243
|
+
return release;
|
|
244
|
+
},
|
|
245
|
+
finish: forward('finish'),
|
|
246
|
+
cancel: forward('cancel'),
|
|
247
|
+
};
|
|
248
|
+
zoomDeciders.set(wrapper, binding => {
|
|
249
|
+
decide(binding);
|
|
250
|
+
return zoom !== undefined;
|
|
251
|
+
});
|
|
252
|
+
return wrapper;
|
|
253
|
+
}
|
|
254
|
+
function prefersReducedMotion() {
|
|
255
|
+
if (typeof window === 'undefined')
|
|
256
|
+
return true;
|
|
257
|
+
return window.matchMedia?.('(prefers-reduced-motion: reduce)').matches ?? false;
|
|
258
|
+
}
|
|
259
|
+
/** A transition is a zoom when its front screen asked for one and the source is visible behind. */
|
|
260
|
+
function zoomPlan(binding, context, touchDown) {
|
|
261
|
+
if (prefersReducedMotion() || !binding.secondary)
|
|
262
|
+
return undefined;
|
|
263
|
+
if (context.operation !== 'push' && context.operation !== 'pop')
|
|
264
|
+
return undefined;
|
|
265
|
+
const entryKey = entryKeyOf(binding.primary);
|
|
266
|
+
if (!entryKey)
|
|
267
|
+
return undefined;
|
|
268
|
+
const source = visibleZoomSource(entryKey, binding.secondary);
|
|
269
|
+
if (!source || typeof binding.primary.animate !== 'function')
|
|
270
|
+
return undefined;
|
|
271
|
+
if (context.interactive && !touchDown)
|
|
272
|
+
return { source, edge: true };
|
|
273
|
+
return { source, ...(touchDown ? { touchDown } : {}) };
|
|
274
|
+
}
|
|
275
|
+
function createZoomController(completion, context, plan, owner) {
|
|
276
|
+
let lifecycle = 'created';
|
|
277
|
+
let interactionPhase = context.interactive
|
|
278
|
+
? 'held'
|
|
279
|
+
: 'completing';
|
|
280
|
+
let binding;
|
|
281
|
+
let stage;
|
|
282
|
+
let shown;
|
|
283
|
+
let progress = 0;
|
|
284
|
+
let animations = [];
|
|
285
|
+
let generation = 0;
|
|
286
|
+
let preparation;
|
|
287
|
+
let dragTranslation = { x: 0, y: 0 };
|
|
288
|
+
let readyToMove = true;
|
|
289
|
+
let pendingRelease;
|
|
290
|
+
let glassFrames = [];
|
|
291
|
+
const glassPose = (pose, receded) => {
|
|
292
|
+
const screen = stage.screen;
|
|
293
|
+
const scale = 1 - (1 - ZOOM_REAR_SCALE) * receded;
|
|
294
|
+
const rear = {
|
|
295
|
+
x: screen.x + (screen.width * (1 - scale)) / 2,
|
|
296
|
+
y: screen.y + (screen.height * (1 - scale)) / 2,
|
|
297
|
+
width: screen.width * scale,
|
|
298
|
+
height: screen.height * scale,
|
|
299
|
+
};
|
|
300
|
+
return {
|
|
301
|
+
front: {
|
|
302
|
+
origin: [screen.x, screen.y],
|
|
303
|
+
x: pose.rect.x,
|
|
304
|
+
y: pose.rect.y,
|
|
305
|
+
scale: pose.rect.width / screen.width,
|
|
306
|
+
clip: [pose.rect.x, pose.rect.y, pose.rect.width, pose.rect.height],
|
|
307
|
+
radius: pose.radius,
|
|
308
|
+
},
|
|
309
|
+
rear: {
|
|
310
|
+
origin: [screen.x, screen.y],
|
|
311
|
+
x: rear.x,
|
|
312
|
+
y: rear.y,
|
|
313
|
+
scale,
|
|
314
|
+
clip: [rear.x, rear.y, rear.width, rear.height],
|
|
315
|
+
radius: 0,
|
|
316
|
+
},
|
|
317
|
+
};
|
|
318
|
+
};
|
|
319
|
+
const glassTrack = (side, at) => {
|
|
320
|
+
const animation = animations[0];
|
|
321
|
+
const running = animation?.playState === 'running' && typeof animation.startTime === 'number';
|
|
322
|
+
const start = running ? Number(animation.startTime) : at - Number(animation?.currentTime ?? 0);
|
|
323
|
+
const duration = glassFrames.at(-1)?.ms ?? 0;
|
|
324
|
+
return {
|
|
325
|
+
end: running ? start + duration : at,
|
|
326
|
+
sample: (time) => {
|
|
327
|
+
const elapsed = Math.max(0, Math.min(duration, (running ? time : at) - start));
|
|
328
|
+
const index = glassFrames.findIndex(frame => frame.ms >= elapsed);
|
|
329
|
+
const upper = glassFrames[Math.max(0, index)];
|
|
330
|
+
const lower = glassFrames[Math.max(0, index - 1)];
|
|
331
|
+
const fraction = upper.ms === lower.ms ? 0 : (elapsed - lower.ms) / (upper.ms - lower.ms);
|
|
332
|
+
const from = lower[side], to = upper[side];
|
|
333
|
+
const mix = (a, b) => a + (b - a) * fraction;
|
|
334
|
+
return {
|
|
335
|
+
origin: from.origin,
|
|
336
|
+
x: mix(from.x, to.x),
|
|
337
|
+
y: mix(from.y, to.y),
|
|
338
|
+
scale: mix(from.scale, to.scale),
|
|
339
|
+
clip: from.clip.map((value, i) => mix(value, to.clip[i])),
|
|
340
|
+
radius: mix(from.radius, to.radius),
|
|
341
|
+
};
|
|
342
|
+
},
|
|
343
|
+
};
|
|
344
|
+
};
|
|
345
|
+
const fullWindow = () => ({ rect: stage.screen, radius: stage.restingRadius });
|
|
346
|
+
/** Corners follow width openness, including the page's exact resting endpoint. */
|
|
347
|
+
const windowAt = (rect) => ({
|
|
348
|
+
rect,
|
|
349
|
+
radius: windowRadius(openOf(rect), stage.source.radius, stage.restingRadius),
|
|
350
|
+
});
|
|
351
|
+
const openOf = (rect) => openness(stage.screen, stage.source.rect, rect);
|
|
352
|
+
/** The bar's items that arrive with the zoomed screen, and the rear screen's that leave. */
|
|
353
|
+
const frontChrome = () => binding
|
|
354
|
+
? [binding.primaryTitle, ...(binding.primaryToolbar ?? []), backVisualIfChanging()].filter((element) => element !== undefined)
|
|
355
|
+
: [];
|
|
356
|
+
const rearChrome = () => binding
|
|
357
|
+
? [binding.secondaryTitle, ...(binding.secondaryToolbar ?? [])].filter((element) => element !== undefined)
|
|
358
|
+
: [];
|
|
359
|
+
const backVisualIfChanging = () => binding?.backButtonVisual && binding.backButtonFromVisible !== binding.backButtonToVisible
|
|
360
|
+
? binding.backButtonVisual
|
|
361
|
+
: undefined;
|
|
362
|
+
/** How far the screen behind has receded: 0 at rest, 1 scaled down and dimmed. */
|
|
363
|
+
const rearStyle = (receded) => ({
|
|
364
|
+
transform: `scale(${round(1 - (1 - ZOOM_REAR_SCALE) * receded, 5)})`,
|
|
365
|
+
dim: ZOOM_DIM_OPACITY * receded,
|
|
366
|
+
});
|
|
367
|
+
/** Draws one moment at once (the first frame, and every finger move). */
|
|
368
|
+
const render = (pose, receded, tileOpacity, chrome) => {
|
|
369
|
+
if (!binding || !stage)
|
|
370
|
+
return;
|
|
371
|
+
shown = pose;
|
|
372
|
+
glassFrames = [{ ms: 0, ...glassPose(pose, receded) }];
|
|
373
|
+
const style = windowStyle(stage.screen, pose);
|
|
374
|
+
stage.container.style.transform = style.containerTransform;
|
|
375
|
+
stage.motion.style.transform = style.motionTransform;
|
|
376
|
+
stage.portal.style.transform = style.motionTransform;
|
|
377
|
+
stage.container.style.borderRadius = style.borderRadius;
|
|
378
|
+
stage.motion.style.borderRadius = style.borderRadius;
|
|
379
|
+
stage.portal.style.borderRadius = style.borderRadius;
|
|
380
|
+
stage.ghost.style.opacity = String(tileOpacity);
|
|
381
|
+
stage.motion.style.opacity = String(stage.pageOpacity);
|
|
382
|
+
const rear = rearStyle(receded);
|
|
383
|
+
if (binding.secondary)
|
|
384
|
+
binding.secondary.style.transform = rear.transform;
|
|
385
|
+
if (binding.secondaryDim)
|
|
386
|
+
binding.secondaryDim.style.opacity = String(rear.dim);
|
|
387
|
+
for (const element of frontChrome())
|
|
388
|
+
Object.assign(element.style, chromeStyle(chrome));
|
|
389
|
+
for (const element of rearChrome())
|
|
390
|
+
Object.assign(element.style, chromeStyle(1 - chrome));
|
|
391
|
+
};
|
|
392
|
+
const stopAnimations = () => {
|
|
393
|
+
generation++;
|
|
394
|
+
preparation?.abort();
|
|
395
|
+
preparation = undefined;
|
|
396
|
+
for (const animation of animations) {
|
|
397
|
+
animation.onfinish = null;
|
|
398
|
+
animation.cancel();
|
|
399
|
+
}
|
|
400
|
+
animations = [];
|
|
401
|
+
};
|
|
402
|
+
/** Hands every element back as it was: the zoom leaves no styles behind. */
|
|
403
|
+
const clearStage = () => {
|
|
404
|
+
if (!stage || !binding)
|
|
405
|
+
return;
|
|
406
|
+
stage.releaseGlass();
|
|
407
|
+
const boxStyles = ['transform', 'transform-origin', 'overflow', 'border-radius', 'position'];
|
|
408
|
+
for (const property of boxStyles) {
|
|
409
|
+
stage.container.style.removeProperty(property);
|
|
410
|
+
stage.motion.style.removeProperty(property);
|
|
411
|
+
}
|
|
412
|
+
for (const { element, value, priority } of stage.cornerStyles) {
|
|
413
|
+
if (value)
|
|
414
|
+
element.style.setProperty('border-radius', value, priority);
|
|
415
|
+
}
|
|
416
|
+
stage.portal.remove();
|
|
417
|
+
if (stage.opacityStyle)
|
|
418
|
+
stage.motion.style.setProperty('opacity', stage.opacityStyle, stage.opacityPriority);
|
|
419
|
+
else
|
|
420
|
+
stage.motion.style.removeProperty('opacity');
|
|
421
|
+
binding.secondary?.style.removeProperty('transform');
|
|
422
|
+
binding.secondary?.style.removeProperty('transform-origin');
|
|
423
|
+
binding.secondaryDim?.style.removeProperty('opacity');
|
|
424
|
+
for (const element of [...frontChrome(), ...rearChrome()]) {
|
|
425
|
+
for (const property of ['opacity', 'scale', 'filter'])
|
|
426
|
+
element.style.removeProperty(property);
|
|
427
|
+
}
|
|
428
|
+
plan.source.style.visibility = stage.sourceVisibility;
|
|
429
|
+
stage.container.style.visibility = stage.containerVisibility;
|
|
430
|
+
};
|
|
431
|
+
const complete = (target) => {
|
|
432
|
+
if (lifecycle === 'completed')
|
|
433
|
+
return;
|
|
434
|
+
lifecycle = 'completed';
|
|
435
|
+
stopScrub();
|
|
436
|
+
stopAnimations();
|
|
437
|
+
clearStage();
|
|
438
|
+
// React retires the outgoing route after this callback. Never repaint its restored
|
|
439
|
+
// full-size page in the gap between retiring the portal and that DOM commit.
|
|
440
|
+
if (target === 'finish' && context.operation === 'pop' && stage)
|
|
441
|
+
stage.container.style.visibility = 'hidden';
|
|
442
|
+
progress = target === 'finish' ? 1 : 0;
|
|
443
|
+
if (target === 'finish')
|
|
444
|
+
completion.finish();
|
|
445
|
+
else
|
|
446
|
+
completion.cancel();
|
|
447
|
+
};
|
|
448
|
+
/**
|
|
449
|
+
* Moves the window from `from` to `to` the way native does for `kind`: each frame of the
|
|
450
|
+
* channel springs becomes the two boxes' transforms (compositor), their corner radius, the
|
|
451
|
+
* tile's cross-fade, the screen behind and the bar's items. `receded` is how far the screen
|
|
452
|
+
* behind has receded at the start.
|
|
453
|
+
*/
|
|
454
|
+
const run = (kind, target, from, to, velocity, receded) => {
|
|
455
|
+
if (!binding || !stage)
|
|
456
|
+
return;
|
|
457
|
+
stopAnimations();
|
|
458
|
+
const runGeneration = generation;
|
|
459
|
+
const frames = windowKeyframes(from.rect, to.rect, springsFor(kind), velocity);
|
|
460
|
+
const startOpen = Math.max(openOf(from.rect), 0.001);
|
|
461
|
+
const recededAt = (rect) => {
|
|
462
|
+
if (kind === 'return')
|
|
463
|
+
return receded;
|
|
464
|
+
if (kind === 'dismiss')
|
|
465
|
+
return receded * Math.min(1, openOf(rect) / startOpen);
|
|
466
|
+
return openOf(rect);
|
|
467
|
+
};
|
|
468
|
+
const duration = frames.at(-1).ms;
|
|
469
|
+
glassFrames = frames.map(frame => ({
|
|
470
|
+
ms: frame.ms,
|
|
471
|
+
...glassPose(windowAt(frame.rect), recededAt(frame.rect)),
|
|
472
|
+
}));
|
|
473
|
+
const options = { duration, easing: 'linear', fill: 'forwards' };
|
|
474
|
+
const keyed = (value) => frames.map(frame => ({ offset: duration > 0 ? frame.ms / duration : 1, value: value(frame) }));
|
|
475
|
+
const styles = keyed(frame => windowStyle(stage.screen, windowAt(frame.rect)));
|
|
476
|
+
const animate = (element, keyframes) => {
|
|
477
|
+
if (!element?.animate)
|
|
478
|
+
return;
|
|
479
|
+
animations.push(element.animate(keyframes, options));
|
|
480
|
+
};
|
|
481
|
+
// The moving boxes first: their transforms stay on the compositor. The corner radius is a
|
|
482
|
+
// separate effect, so a main-thread value never holds the edges back.
|
|
483
|
+
animate(stage.container, styles.map(({ offset, value }) => ({ offset, transform: value.containerTransform })));
|
|
484
|
+
animate(stage.motion, styles.map(({ offset, value }) => ({ offset, transform: value.motionTransform })));
|
|
485
|
+
animate(stage.portal, styles.map(({ offset, value }) => ({ offset, transform: value.motionTransform })));
|
|
486
|
+
for (const box of [stage.container, stage.motion, stage.portal]) {
|
|
487
|
+
animate(box, styles.map(({ offset, value }) => ({ offset, borderRadius: value.borderRadius })));
|
|
488
|
+
}
|
|
489
|
+
animate(stage.ghost, keyed(frame => tileOpacity(kind, frame.ms)).map(({ offset, value }) => ({
|
|
490
|
+
offset,
|
|
491
|
+
opacity: value,
|
|
492
|
+
})));
|
|
493
|
+
animate(stage.motion, keyed(frame => stage.pageOpacity * pageOpacity(kind, frame.ms)).map(({ offset, value }) => ({
|
|
494
|
+
offset,
|
|
495
|
+
opacity: value,
|
|
496
|
+
})));
|
|
497
|
+
const rear = keyed(frame => rearStyle(recededAt(frame.rect)));
|
|
498
|
+
animate(binding.secondary, rear.map(({ offset, value }) => ({ offset, transform: value.transform })));
|
|
499
|
+
animate(binding.secondaryDim, rear.map(({ offset, value }) => ({ offset, opacity: value.dim })));
|
|
500
|
+
const chrome = keyed(frame => chromeOpacity(kind, frame.ms));
|
|
501
|
+
for (const element of frontChrome())
|
|
502
|
+
animate(element, chrome.map(({ offset, value }) => ({ offset, ...chromeDissolve(value) })));
|
|
503
|
+
for (const element of rearChrome())
|
|
504
|
+
animate(element, chrome.map(({ offset, value }) => ({ offset, ...chromeDissolve(1 - value) })));
|
|
505
|
+
shown = to;
|
|
506
|
+
for (const animation of animations) {
|
|
507
|
+
const element = animation.effect?.target;
|
|
508
|
+
if (element)
|
|
509
|
+
announceAnimation(element);
|
|
510
|
+
}
|
|
511
|
+
if (!animations.length)
|
|
512
|
+
return;
|
|
513
|
+
animations[0].onfinish = () => {
|
|
514
|
+
if (runGeneration !== generation)
|
|
515
|
+
return;
|
|
516
|
+
complete(target);
|
|
517
|
+
};
|
|
518
|
+
if (kind === 'push' || kind === 'pop')
|
|
519
|
+
playWhenPrepared(runGeneration);
|
|
520
|
+
};
|
|
521
|
+
/** Both directions revalidate the nodes they reveal, including the artwork copy. */
|
|
522
|
+
const playWhenPrepared = (runGeneration) => {
|
|
523
|
+
if (!binding)
|
|
524
|
+
return;
|
|
525
|
+
const prepared = animations;
|
|
526
|
+
for (const animation of prepared)
|
|
527
|
+
animation.pause();
|
|
528
|
+
preparation = new AbortController();
|
|
529
|
+
void Promise.all([
|
|
530
|
+
...prepared.map(animation => animation.ready),
|
|
531
|
+
prepareDestinationImages(binding.primary, preparation.signal),
|
|
532
|
+
binding.secondary ? prepareRevealedImages(binding.secondary) : undefined,
|
|
533
|
+
stage?.imagesReady,
|
|
534
|
+
binding.glassReady,
|
|
535
|
+
]).then(() => {
|
|
536
|
+
if (runGeneration !== generation)
|
|
537
|
+
return;
|
|
538
|
+
if (stage) {
|
|
539
|
+
plan.source.style.visibility = 'hidden';
|
|
540
|
+
stage.container.style.visibility = stage.containerVisibility;
|
|
541
|
+
}
|
|
542
|
+
const start = performance.now();
|
|
543
|
+
for (const animation of prepared) {
|
|
544
|
+
animation.currentTime = 0;
|
|
545
|
+
animation.play();
|
|
546
|
+
animation.startTime = start;
|
|
547
|
+
const element = animation.effect?.target;
|
|
548
|
+
if (element)
|
|
549
|
+
announceAnimation(element);
|
|
550
|
+
}
|
|
551
|
+
}, () => {
|
|
552
|
+
if (runGeneration === generation)
|
|
553
|
+
complete(binding?.glassReady ? 'cancel' : 'finish');
|
|
554
|
+
});
|
|
555
|
+
};
|
|
556
|
+
const startAutomatic = () => {
|
|
557
|
+
if (!binding || !stage || lifecycle !== 'started' || animations.length)
|
|
558
|
+
return;
|
|
559
|
+
if (context.interactive)
|
|
560
|
+
return;
|
|
561
|
+
if (context.operation === 'push')
|
|
562
|
+
run('push', 'finish', stage.source, fullWindow(), NO_VELOCITY, 0);
|
|
563
|
+
else
|
|
564
|
+
run('pop', 'finish', shown ?? fullWindow(), stage.source, NO_VELOCITY, 1);
|
|
565
|
+
};
|
|
566
|
+
const release = (velocity) => {
|
|
567
|
+
if (!readyToMove) {
|
|
568
|
+
pendingRelease = () => release(velocity);
|
|
569
|
+
return;
|
|
570
|
+
}
|
|
571
|
+
if (lifecycle === 'completed' || interactionPhase !== 'held' || !stage)
|
|
572
|
+
return;
|
|
573
|
+
const dismiss = dragTranslation.y > ZOOM_DISMISS_DISTANCE;
|
|
574
|
+
interactionPhase = dismiss ? 'completing' : 'cancelling';
|
|
575
|
+
completion.changed?.();
|
|
576
|
+
const from = shown ?? fullWindow();
|
|
577
|
+
if (dismiss)
|
|
578
|
+
run('dismiss', 'finish', from, stage.source, velocity, 1);
|
|
579
|
+
else
|
|
580
|
+
run('return', 'cancel', from, fullWindow(), velocity, 1);
|
|
581
|
+
};
|
|
582
|
+
/** Sets up the boxes and the tile, measured at rest (the entering screen arrives parked off
|
|
583
|
+
* screen by its own transform, which the zoom replaces). */
|
|
584
|
+
const prepareStage = (next) => {
|
|
585
|
+
const container = next.primary.parentElement;
|
|
586
|
+
if (!container)
|
|
587
|
+
return undefined;
|
|
588
|
+
next.primary.style.transform = 'none';
|
|
589
|
+
container.style.transform = 'none';
|
|
590
|
+
const screen = rectOf(next.primary);
|
|
591
|
+
const source = { rect: rectOf(plan.source), radius: cornerRadiusOf(plan.source) };
|
|
592
|
+
// The display's physical mask is outside the page. Using its radius here would
|
|
593
|
+
// hold rounded CSS corners until cleanup, then snap them to the page's own clip.
|
|
594
|
+
const restingRadius = Math.max(cornerRadiusOf(container), cornerRadiusOf(next.primary));
|
|
595
|
+
const cornerStyles = [container, next.primary].map(element => ({
|
|
596
|
+
element,
|
|
597
|
+
value: element.style.getPropertyValue('border-radius'),
|
|
598
|
+
priority: element.style.getPropertyPriority('border-radius'),
|
|
599
|
+
}));
|
|
600
|
+
for (const box of [container, next.primary]) {
|
|
601
|
+
box.style.transformOrigin = '0 0';
|
|
602
|
+
box.style.overflow = 'hidden';
|
|
603
|
+
}
|
|
604
|
+
// The tile is placed against the motion layer's top left.
|
|
605
|
+
if (getComputedStyle(next.primary).position === 'static')
|
|
606
|
+
next.primary.style.position = 'relative';
|
|
607
|
+
if (next.secondary)
|
|
608
|
+
next.secondary.style.transformOrigin = '50% 50%';
|
|
609
|
+
const sourceVisibility = plan.source.style.visibility;
|
|
610
|
+
const containerVisibility = container.style.visibility;
|
|
611
|
+
const ghost = tileGhost(plan.source, screen.width, source.rect);
|
|
612
|
+
const portal = container.ownerDocument.createElement('div');
|
|
613
|
+
portal.dataset.satinZoomSourcePortal = 'true';
|
|
614
|
+
portal.setAttribute('aria-hidden', 'true');
|
|
615
|
+
portal.inert = true;
|
|
616
|
+
Object.assign(portal.style, {
|
|
617
|
+
position: 'absolute',
|
|
618
|
+
inset: '0px',
|
|
619
|
+
width: `${screen.width}px`,
|
|
620
|
+
height: `${screen.height}px`,
|
|
621
|
+
transformOrigin: '0 0',
|
|
622
|
+
overflow: 'hidden',
|
|
623
|
+
pointerEvents: 'none',
|
|
624
|
+
zIndex: '1',
|
|
625
|
+
});
|
|
626
|
+
const opacityStyle = next.primary.style.getPropertyValue('opacity');
|
|
627
|
+
const opacityPriority = next.primary.style.getPropertyPriority('opacity');
|
|
628
|
+
const opacity = Number.parseFloat(getComputedStyle(next.primary).opacity);
|
|
629
|
+
const imagesReady = prepareClonedImages(plan.source, ghost);
|
|
630
|
+
// Do not cover the still-painted source with an undecoded image clone. The same
|
|
631
|
+
// paused entrance is revealed only after both its images and glass are ready.
|
|
632
|
+
if (imagesReady && context.operation === 'push')
|
|
633
|
+
container.style.visibility = 'hidden';
|
|
634
|
+
else
|
|
635
|
+
plan.source.style.visibility = 'hidden';
|
|
636
|
+
void imagesReady?.catch(() => { });
|
|
637
|
+
portal.append(ghost);
|
|
638
|
+
container.append(portal);
|
|
639
|
+
return {
|
|
640
|
+
container,
|
|
641
|
+
motion: next.primary,
|
|
642
|
+
portal,
|
|
643
|
+
ghost,
|
|
644
|
+
screen,
|
|
645
|
+
source,
|
|
646
|
+
restingRadius,
|
|
647
|
+
cornerStyles,
|
|
648
|
+
imagesReady,
|
|
649
|
+
sourceVisibility,
|
|
650
|
+
containerVisibility,
|
|
651
|
+
pageOpacity: Number.isFinite(opacity) ? opacity : 1,
|
|
652
|
+
opacityStyle,
|
|
653
|
+
opacityPriority,
|
|
654
|
+
releaseGlass: (() => {
|
|
655
|
+
const releases = [
|
|
656
|
+
registerZoomGlass(next.primary, {
|
|
657
|
+
layout: screen,
|
|
658
|
+
carriers: [container, next.primary],
|
|
659
|
+
read: at => glassTrack('front', at),
|
|
660
|
+
}),
|
|
661
|
+
];
|
|
662
|
+
if (next.secondary)
|
|
663
|
+
releases.push(registerZoomGlass(next.secondary, {
|
|
664
|
+
layout: screen,
|
|
665
|
+
carriers: [next.secondary],
|
|
666
|
+
read: at => glassTrack('rear', at),
|
|
667
|
+
}));
|
|
668
|
+
return () => releases.forEach(release => release());
|
|
669
|
+
})(),
|
|
670
|
+
};
|
|
671
|
+
};
|
|
672
|
+
let edgeProgress = 0;
|
|
673
|
+
let scrub;
|
|
674
|
+
const dragPose = () => windowAt(plan.edge ? edgeRect(stage.screen, edgeProgress) : dragRect(stage.screen, dragTranslation));
|
|
675
|
+
const stopScrub = () => {
|
|
676
|
+
if (scrub)
|
|
677
|
+
window.cancelAnimationFrame(scrub.frame);
|
|
678
|
+
scrub = undefined;
|
|
679
|
+
};
|
|
680
|
+
/** The edge swipe lets go: the slide's own rule decides, then native's springs finish it. */
|
|
681
|
+
const releaseEdge = (velocity, raw, cancelled) => {
|
|
682
|
+
if (!readyToMove) {
|
|
683
|
+
pendingRelease = () => releaseEdge(velocity, raw, cancelled);
|
|
684
|
+
return;
|
|
685
|
+
}
|
|
686
|
+
if (lifecycle === 'completed' || interactionPhase !== 'held' || !stage)
|
|
687
|
+
return;
|
|
688
|
+
stopScrub();
|
|
689
|
+
if (raw !== undefined)
|
|
690
|
+
edgeProgress = raw;
|
|
691
|
+
const dismiss = !cancelled && shouldCompleteInteractivePop(edgeProgress, velocity);
|
|
692
|
+
interactionPhase = dismiss ? 'completing' : 'cancelling';
|
|
693
|
+
completion.changed?.();
|
|
694
|
+
const from = shown ?? fullWindow();
|
|
695
|
+
const push = { x: velocity, y: 0 };
|
|
696
|
+
if (dismiss)
|
|
697
|
+
run('dismiss', 'finish', from, stage.source, push, 1);
|
|
698
|
+
else
|
|
699
|
+
run('return', 'cancel', from, fullWindow(), push, 1);
|
|
700
|
+
};
|
|
701
|
+
const controller = {
|
|
702
|
+
get progress() {
|
|
703
|
+
return progress;
|
|
704
|
+
},
|
|
705
|
+
get interactionPhase() {
|
|
706
|
+
return context.interactive ? interactionPhase : undefined;
|
|
707
|
+
},
|
|
708
|
+
start() {
|
|
709
|
+
if (lifecycle !== 'created')
|
|
710
|
+
return;
|
|
711
|
+
lifecycle = 'started';
|
|
712
|
+
startAutomatic();
|
|
713
|
+
},
|
|
714
|
+
bind(nextBinding) {
|
|
715
|
+
if (lifecycle === 'completed')
|
|
716
|
+
return () => undefined;
|
|
717
|
+
if (binding?.primary === nextBinding.primary) {
|
|
718
|
+
binding = nextBinding;
|
|
719
|
+
return () => undefined;
|
|
720
|
+
}
|
|
721
|
+
binding = nextBinding;
|
|
722
|
+
stage = prepareStage(nextBinding);
|
|
723
|
+
if (!stage) {
|
|
724
|
+
complete('finish');
|
|
725
|
+
return () => undefined;
|
|
726
|
+
}
|
|
727
|
+
// The first frame is already the transition's: never a full-screen flash before it runs.
|
|
728
|
+
if (context.interactive) {
|
|
729
|
+
readyToMove = !binding.glassReady && !stage.imagesReady;
|
|
730
|
+
render(fullWindow(), 1, 0, 1);
|
|
731
|
+
if (!readyToMove) {
|
|
732
|
+
const runGeneration = generation;
|
|
733
|
+
void Promise.all([
|
|
734
|
+
binding.glassReady,
|
|
735
|
+
stage.imagesReady,
|
|
736
|
+
binding.secondary ? prepareRevealedImages(binding.secondary) : undefined,
|
|
737
|
+
]).then(() => {
|
|
738
|
+
if (lifecycle === 'completed' || runGeneration !== generation)
|
|
739
|
+
return;
|
|
740
|
+
readyToMove = true;
|
|
741
|
+
render(dragPose(), 1, 0, 1);
|
|
742
|
+
const release = pendingRelease;
|
|
743
|
+
pendingRelease = undefined;
|
|
744
|
+
release?.();
|
|
745
|
+
}, () => complete('cancel'));
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
else if (context.operation === 'push')
|
|
749
|
+
render(stage.source, 0, 1, 0);
|
|
750
|
+
else
|
|
751
|
+
render(fullWindow(), 1, 0, 1);
|
|
752
|
+
startAutomatic();
|
|
753
|
+
return () => {
|
|
754
|
+
if (lifecycle === 'completed' && stage)
|
|
755
|
+
stage.container.style.visibility = stage.containerVisibility;
|
|
756
|
+
};
|
|
757
|
+
},
|
|
758
|
+
setProgress(next) {
|
|
759
|
+
// The edge swipe's frame loop: progress is the finger's travel over the screen's width.
|
|
760
|
+
// A zoom drag moves in two dimensions through its drag handle instead.
|
|
761
|
+
if (!plan.edge || lifecycle === 'completed' || interactionPhase !== 'held' || !stage)
|
|
762
|
+
return;
|
|
763
|
+
stopScrub();
|
|
764
|
+
edgeProgress = Math.max(0, next);
|
|
765
|
+
if (readyToMove)
|
|
766
|
+
render(dragPose(), 1, 0, 1);
|
|
767
|
+
},
|
|
768
|
+
scrubFromScroll(source, origin, adjustment) {
|
|
769
|
+
// The native back-swipe scroller drives the swipe: follow it once per frame.
|
|
770
|
+
if (!plan.edge || lifecycle === 'completed' || !stage)
|
|
771
|
+
return;
|
|
772
|
+
stopScrub();
|
|
773
|
+
const follow = () => {
|
|
774
|
+
edgeProgress = Math.max(0, (origin - source.scrollLeft + adjustment) / stage.screen.width);
|
|
775
|
+
if (readyToMove)
|
|
776
|
+
render(dragPose(), 1, 0, 1);
|
|
777
|
+
scrub = { frame: window.requestAnimationFrame(follow) };
|
|
778
|
+
};
|
|
779
|
+
follow();
|
|
780
|
+
},
|
|
781
|
+
resolveInteractive(velocity, raw, cancelled) {
|
|
782
|
+
if (plan.edge)
|
|
783
|
+
releaseEdge(velocity, raw, cancelled);
|
|
784
|
+
},
|
|
785
|
+
completeInteractive(velocity) {
|
|
786
|
+
if (interactionPhase !== 'held')
|
|
787
|
+
return;
|
|
788
|
+
if (plan.edge) {
|
|
789
|
+
releaseEdge(Math.max(velocity, 0), undefined, false);
|
|
790
|
+
return;
|
|
791
|
+
}
|
|
792
|
+
dragTranslation = {
|
|
793
|
+
x: dragTranslation.x,
|
|
794
|
+
y: Math.max(dragTranslation.y, ZOOM_DISMISS_DISTANCE + 1),
|
|
795
|
+
};
|
|
796
|
+
release(NO_VELOCITY);
|
|
797
|
+
},
|
|
798
|
+
cancelInteractive(velocity) {
|
|
799
|
+
if (lifecycle === 'completed' || interactionPhase !== 'held')
|
|
800
|
+
return;
|
|
801
|
+
if (plan.edge) {
|
|
802
|
+
releaseEdge(velocity, undefined, true);
|
|
803
|
+
return;
|
|
804
|
+
}
|
|
805
|
+
dragTranslation = { x: 0, y: 0 };
|
|
806
|
+
release(NO_VELOCITY);
|
|
807
|
+
},
|
|
808
|
+
finish() {
|
|
809
|
+
complete('finish');
|
|
810
|
+
},
|
|
811
|
+
cancel() {
|
|
812
|
+
complete('cancel');
|
|
813
|
+
},
|
|
814
|
+
};
|
|
815
|
+
dragHandles.set(owner, {
|
|
816
|
+
track(translation) {
|
|
817
|
+
if (lifecycle === 'completed' || interactionPhase !== 'held' || !stage)
|
|
818
|
+
return;
|
|
819
|
+
dragTranslation = { x: translation.x, y: translation.y };
|
|
820
|
+
if (readyToMove)
|
|
821
|
+
render(dragPose(), 1, 0, 1);
|
|
822
|
+
},
|
|
823
|
+
release,
|
|
824
|
+
});
|
|
825
|
+
return controller;
|
|
826
|
+
}
|
|
827
|
+
const NO_VELOCITY = { x: 0, y: 0 };
|
|
828
|
+
function springsFor(kind) {
|
|
829
|
+
if (kind === 'push')
|
|
830
|
+
return ZOOM_PUSH;
|
|
831
|
+
if (kind === 'pop')
|
|
832
|
+
return ZOOM_POP;
|
|
833
|
+
if (kind === 'dismiss')
|
|
834
|
+
return ZOOM_DISMISS;
|
|
835
|
+
return ZOOM_RETURN;
|
|
836
|
+
}
|
|
837
|
+
/** The source tile's opacity over the window `ms` into a run: it fades out early in a push and in
|
|
838
|
+
* early in a pop or a dismissal. */
|
|
839
|
+
function tileOpacity(kind, ms) {
|
|
840
|
+
if (kind === 'return')
|
|
841
|
+
return 0;
|
|
842
|
+
const fade = kind === 'push' ? ZOOM_PUSH_SOURCE_FADE_MS : ZOOM_POP_SOURCE_FADE_MS;
|
|
843
|
+
const progress = clamp01((ms - fade.start) / (fade.end - fade.start));
|
|
844
|
+
return kind === 'push' ? 1 - progress : progress;
|
|
845
|
+
}
|
|
846
|
+
/** The native page and source have independent alpha channels. Cancelled gestures and
|
|
847
|
+
* pushes retain their existing page presentation; only a return to the tile retires it. */
|
|
848
|
+
function pageOpacity(kind, ms) {
|
|
849
|
+
if (kind !== 'pop' && kind !== 'dismiss')
|
|
850
|
+
return 1;
|
|
851
|
+
const index = ZOOM_POP_PAGE_ALPHA.findIndex(([time]) => time >= ms);
|
|
852
|
+
if (index < 0)
|
|
853
|
+
return 0;
|
|
854
|
+
const [end, to] = ZOOM_POP_PAGE_ALPHA[index];
|
|
855
|
+
const [start, from] = ZOOM_POP_PAGE_ALPHA[Math.max(0, index - 1)];
|
|
856
|
+
const fraction = end === start ? 0 : (ms - start) / (end - start);
|
|
857
|
+
return from + (to - from) * fraction;
|
|
858
|
+
}
|
|
859
|
+
/** The bar items' opacity `ms` into a run: in on a smoothstep over a push, out linearly over a pop. */
|
|
860
|
+
function chromeOpacity(kind, ms) {
|
|
861
|
+
if (kind === 'return')
|
|
862
|
+
return 1;
|
|
863
|
+
if (kind === 'push') {
|
|
864
|
+
const progress = clamp01(ms / ZOOM_PUSH_CHROME_FADE_MS);
|
|
865
|
+
return progress * progress * (3 - 2 * progress);
|
|
866
|
+
}
|
|
867
|
+
const fade = ZOOM_POP_CHROME_FADE_MS;
|
|
868
|
+
return 1 - clamp01((ms - fade.start) / (fade.end - fade.start));
|
|
869
|
+
}
|
|
870
|
+
function chromeStyle(opacity) {
|
|
871
|
+
const frame = chromeDissolve(opacity);
|
|
872
|
+
return {
|
|
873
|
+
opacity: String(frame.opacity),
|
|
874
|
+
scale: String(frame.scale),
|
|
875
|
+
filter: String(frame.filter),
|
|
876
|
+
};
|
|
877
|
+
}
|
|
878
|
+
/**
|
|
879
|
+
* A copy of the source view drawn over the window's top square, as natively (a portal of the tile
|
|
880
|
+
* scaled to the window's width). Its separate portal uses the page's motion at screen width, so it scales
|
|
881
|
+
* and clips with the window. Its image nodes are decoded separately before the window is shown.
|
|
882
|
+
*/
|
|
883
|
+
function tileGhost(source, screenWidth, sourceRect) {
|
|
884
|
+
const ghost = source.cloneNode(true);
|
|
885
|
+
const look = getComputedStyle(source);
|
|
886
|
+
ghost.removeAttribute('id');
|
|
887
|
+
ghost.setAttribute('aria-hidden', 'true');
|
|
888
|
+
ghost.inert = true;
|
|
889
|
+
const height = sourceRect.width > 0 ? (screenWidth * sourceRect.height) / sourceRect.width : 0;
|
|
890
|
+
Object.assign(ghost.style, {
|
|
891
|
+
position: 'absolute',
|
|
892
|
+
left: '0px',
|
|
893
|
+
top: '0px',
|
|
894
|
+
margin: '0px',
|
|
895
|
+
zIndex: '2147483647',
|
|
896
|
+
width: `${screenWidth}px`,
|
|
897
|
+
height: `${height}px`,
|
|
898
|
+
maxWidth: 'none',
|
|
899
|
+
borderRadius: '0px',
|
|
900
|
+
transform: 'none',
|
|
901
|
+
pointerEvents: 'none',
|
|
902
|
+
visibility: 'visible',
|
|
903
|
+
backgroundColor: look.backgroundColor,
|
|
904
|
+
backgroundImage: look.backgroundImage,
|
|
905
|
+
backgroundSize: look.backgroundSize,
|
|
906
|
+
backgroundPosition: look.backgroundPosition,
|
|
907
|
+
objectFit: look.objectFit,
|
|
908
|
+
objectPosition: look.objectPosition,
|
|
909
|
+
});
|
|
910
|
+
return ghost;
|
|
911
|
+
}
|
|
912
|
+
const FRAME_MS = 1000 / 60;
|
|
913
|
+
const LONGEST_RUN_MS = 2000;
|
|
914
|
+
/** Below a third of a point the remaining travel is invisible at 3× on a phone. */
|
|
915
|
+
const REST_POINTS = 0.3;
|
|
916
|
+
/**
|
|
917
|
+
* The 60 Hz frames of one window run, as native moves it: the window's centre follows one spring
|
|
918
|
+
* and its size another (a push moves the width with the centre and the height on its own spring).
|
|
919
|
+
* The finger's velocity starts the centre moving.
|
|
920
|
+
*/
|
|
921
|
+
export function windowKeyframes(from, to, springs, velocity) {
|
|
922
|
+
const center = (rect) => ({
|
|
923
|
+
x: rect.x + rect.width / 2,
|
|
924
|
+
y: rect.y + rect.height / 2,
|
|
925
|
+
});
|
|
926
|
+
const start = center(from);
|
|
927
|
+
const end = center(to);
|
|
928
|
+
const channels = [
|
|
929
|
+
{ spring: springs.center, from: start.x, to: end.x, velocity: velocity.x },
|
|
930
|
+
{ spring: springs.center, from: start.y, to: end.y, velocity: velocity.y },
|
|
931
|
+
{ spring: springs.size, from: from.width, to: to.width, velocity: 0 },
|
|
932
|
+
{ spring: springs.height ?? springs.size, from: from.height, to: to.height, velocity: 0 },
|
|
933
|
+
].map(channel => ({
|
|
934
|
+
...channel,
|
|
935
|
+
animation: animationOf(channel.spring),
|
|
936
|
+
motion: { displacement: channel.from - channel.to, velocity: channel.velocity },
|
|
937
|
+
}));
|
|
938
|
+
const valueAt = (channel, ms) => channel.to + sampleChannel(channel.animation, channel.motion, ms).offset;
|
|
939
|
+
const frames = [];
|
|
940
|
+
for (let ms = 0; ms <= LONGEST_RUN_MS; ms += FRAME_MS) {
|
|
941
|
+
const [x, y, width, height] = channels.map(channel => valueAt(channel, ms));
|
|
942
|
+
frames.push({
|
|
943
|
+
ms,
|
|
944
|
+
rect: { x: x - width / 2, y: y - height / 2, width: width, height: height },
|
|
945
|
+
});
|
|
946
|
+
const moving = channels.some(channel => Math.abs(valueAt(channel, ms) - channel.to) > REST_POINTS);
|
|
947
|
+
if (!moving && ms > FRAME_MS * 3)
|
|
948
|
+
break;
|
|
949
|
+
}
|
|
950
|
+
frames.push({ ms: frames.at(-1).ms + FRAME_MS, rect: to });
|
|
951
|
+
return frames;
|
|
952
|
+
}
|
|
953
|
+
/** A measured Core Animation spring as Satin's `Animation` (SwiftUI's duration/bounce mapping is
|
|
954
|
+
* exact: omega = 2π / duration, damping ratio = 1 − bounce). */
|
|
955
|
+
function animationOf(spring) {
|
|
956
|
+
return SpringAnimation.spring({
|
|
957
|
+
durationMs: ((2 * Math.PI) / spring.omega) * 1000,
|
|
958
|
+
bounce: 1 - spring.zeta,
|
|
959
|
+
});
|
|
960
|
+
}
|
|
961
|
+
function rectOf(element) {
|
|
962
|
+
const bounds = element.getBoundingClientRect();
|
|
963
|
+
return { x: bounds.x, y: bounds.y, width: bounds.width, height: bounds.height };
|
|
964
|
+
}
|
|
965
|
+
function cornerRadiusOf(element) {
|
|
966
|
+
const radius = Number.parseFloat(getComputedStyle(element).borderTopLeftRadius);
|
|
967
|
+
return Number.isFinite(radius) ? radius : 0;
|
|
968
|
+
}
|
|
969
|
+
function clamp01(value) {
|
|
970
|
+
return Math.min(1, Math.max(0, value));
|
|
971
|
+
}
|
|
972
|
+
function round(value, digits = 3) {
|
|
973
|
+
const factor = 10 ** digits;
|
|
974
|
+
return Math.round(value * factor) / factor;
|
|
975
|
+
}
|