@rafaelaugusto/jolt 0.1.0-beta.8 → 0.1.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +136 -15
- package/dist/animate.d.ts +25 -4
- package/dist/animate.d.ts.map +1 -1
- package/dist/animate.js +67 -26
- package/dist/animate.js.map +1 -1
- package/dist/blur/index.d.ts +6 -0
- package/dist/blur/index.d.ts.map +1 -0
- package/dist/blur/index.js +196 -0
- package/dist/blur/index.js.map +1 -0
- package/dist/blur/native.d.ts +17 -0
- package/dist/blur/native.d.ts.map +1 -0
- package/dist/blur/native.js +44 -0
- package/dist/blur/native.js.map +1 -0
- package/dist/blur/types.d.ts +32 -0
- package/dist/blur/types.d.ts.map +1 -0
- package/dist/blur/types.js +2 -0
- package/dist/blur/types.js.map +1 -0
- package/dist/bottom-sheet/geometry.d.ts +18 -0
- package/dist/bottom-sheet/geometry.d.ts.map +1 -0
- package/dist/bottom-sheet/geometry.js +51 -0
- package/dist/bottom-sheet/geometry.js.map +1 -0
- package/dist/bottom-sheet/index.d.ts +56 -0
- package/dist/bottom-sheet/index.d.ts.map +1 -0
- package/dist/bottom-sheet/index.js +462 -0
- package/dist/bottom-sheet/index.js.map +1 -0
- package/dist/bottom-sheet/native.d.ts +11 -0
- package/dist/bottom-sheet/native.d.ts.map +1 -0
- package/dist/bottom-sheet/native.js +173 -0
- package/dist/bottom-sheet/native.js.map +1 -0
- package/dist/config.d.ts +9 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +40 -1
- package/dist/config.js.map +1 -1
- package/dist/decay.d.ts +1 -0
- package/dist/decay.d.ts.map +1 -1
- package/dist/decay.js +7 -0
- package/dist/decay.js.map +1 -1
- package/dist/drag-physics.d.ts +6 -1
- package/dist/drag-physics.d.ts.map +1 -1
- package/dist/drag.d.ts +17 -3
- package/dist/drag.d.ts.map +1 -1
- package/dist/drag.js +34 -11
- package/dist/drag.js.map +1 -1
- package/dist/driver/android-gradient.d.ts +5 -0
- package/dist/driver/android-gradient.d.ts.map +1 -0
- package/dist/driver/android-gradient.js +99 -0
- package/dist/driver/android-gradient.js.map +1 -0
- package/dist/driver/android-particles.d.ts +6 -0
- package/dist/driver/android-particles.d.ts.map +1 -0
- package/dist/driver/android-particles.js +93 -0
- package/dist/driver/android-particles.js.map +1 -0
- package/dist/driver/android.d.ts.map +1 -1
- package/dist/driver/android.js +67 -1
- package/dist/driver/android.js.map +1 -1
- package/dist/driver/frame.d.ts +3 -0
- package/dist/driver/frame.d.ts.map +1 -0
- package/dist/driver/frame.js +7 -0
- package/dist/driver/frame.js.map +1 -0
- package/dist/driver/index.d.ts +14 -0
- package/dist/driver/index.d.ts.map +1 -1
- package/dist/driver/index.js.map +1 -1
- package/dist/driver/ios-gradient.d.ts +5 -0
- package/dist/driver/ios-gradient.d.ts.map +1 -0
- package/dist/driver/ios-gradient.js +131 -0
- package/dist/driver/ios-gradient.js.map +1 -0
- package/dist/driver/ios-layout.d.ts +9 -0
- package/dist/driver/ios-layout.d.ts.map +1 -0
- package/dist/driver/ios-layout.js +52 -0
- package/dist/driver/ios-layout.js.map +1 -0
- package/dist/driver/ios-scroll-delegate.d.ts +4 -0
- package/dist/driver/ios-scroll-delegate.d.ts.map +1 -0
- package/dist/driver/ios-scroll-delegate.js +26 -0
- package/dist/driver/ios-scroll-delegate.js.map +1 -0
- package/dist/driver/ios.d.ts.map +1 -1
- package/dist/driver/ios.js +57 -1
- package/dist/driver/ios.js.map +1 -1
- package/dist/easing.d.ts +3 -1
- package/dist/easing.d.ts.map +1 -1
- package/dist/easing.js +18 -1
- package/dist/easing.js.map +1 -1
- package/dist/engine.d.ts +35 -2
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +211 -42
- package/dist/engine.js.map +1 -1
- package/dist/gesture-native.d.ts +28 -0
- package/dist/gesture-native.d.ts.map +1 -0
- package/dist/gesture-native.js +61 -0
- package/dist/gesture-native.js.map +1 -0
- package/dist/gestures/index.d.ts +69 -0
- package/dist/gestures/index.d.ts.map +1 -0
- package/dist/gestures/index.js +262 -0
- package/dist/gestures/index.js.map +1 -0
- package/dist/glass/index.d.ts +55 -0
- package/dist/glass/index.d.ts.map +1 -0
- package/dist/glass/index.js +205 -0
- package/dist/glass/index.js.map +1 -0
- package/dist/gradient-binding.d.ts +38 -0
- package/dist/gradient-binding.d.ts.map +1 -0
- package/dist/gradient-binding.js +128 -0
- package/dist/gradient-binding.js.map +1 -0
- package/dist/gradient.d.ts +105 -0
- package/dist/gradient.d.ts.map +1 -0
- package/dist/gradient.js +514 -0
- package/dist/gradient.js.map +1 -0
- package/dist/gravity.d.ts +13 -0
- package/dist/gravity.d.ts.map +1 -0
- package/dist/gravity.js +84 -0
- package/dist/gravity.js.map +1 -0
- package/dist/haptics.d.ts.map +1 -1
- package/dist/haptics.js +101 -28
- package/dist/haptics.js.map +1 -1
- package/dist/image-effect.d.ts +1 -0
- package/dist/image-effect.d.ts.map +1 -1
- package/dist/image-effect.js +10 -2
- package/dist/image-effect.js.map +1 -1
- package/dist/index.d.ts +21 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -4
- package/dist/index.js.map +1 -1
- package/dist/inspector/index.d.ts +86 -0
- package/dist/inspector/index.d.ts.map +1 -0
- package/dist/inspector/index.js +419 -0
- package/dist/inspector/index.js.map +1 -0
- package/dist/inspector/plot.d.ts +4 -0
- package/dist/inspector/plot.d.ts.map +1 -0
- package/dist/inspector/plot.js +23 -0
- package/dist/inspector/plot.js.map +1 -0
- package/dist/inspector/probe.d.ts +19 -0
- package/dist/inspector/probe.d.ts.map +1 -0
- package/dist/inspector/probe.js +37 -0
- package/dist/inspector/probe.js.map +1 -0
- package/dist/inspector/tuning.d.ts +19 -0
- package/dist/inspector/tuning.d.ts.map +1 -0
- package/dist/inspector/tuning.js +37 -0
- package/dist/inspector/tuning.js.map +1 -0
- package/dist/interactive-navigation/index.d.ts +44 -0
- package/dist/interactive-navigation/index.d.ts.map +1 -0
- package/dist/interactive-navigation/index.js +314 -0
- package/dist/interactive-navigation/index.js.map +1 -0
- package/dist/keyboard.d.ts +24 -0
- package/dist/keyboard.d.ts.map +1 -1
- package/dist/keyboard.js +199 -6
- package/dist/keyboard.js.map +1 -1
- package/dist/layout.d.ts +13 -0
- package/dist/layout.d.ts.map +1 -0
- package/dist/layout.js +348 -0
- package/dist/layout.js.map +1 -0
- package/dist/live-spring-driver.d.ts +52 -0
- package/dist/live-spring-driver.d.ts.map +1 -0
- package/dist/live-spring-driver.js +104 -0
- package/dist/live-spring-driver.js.map +1 -0
- package/dist/mixer.d.ts +55 -0
- package/dist/mixer.d.ts.map +1 -0
- package/dist/mixer.js +278 -0
- package/dist/mixer.js.map +1 -0
- package/dist/motion-scope.d.ts +10 -2
- package/dist/motion-scope.d.ts.map +1 -1
- package/dist/motion-scope.js +30 -3
- package/dist/motion-scope.js.map +1 -1
- package/dist/motion-states.d.ts +19 -7
- package/dist/motion-states.d.ts.map +1 -1
- package/dist/motion-states.js +116 -26
- package/dist/motion-states.js.map +1 -1
- package/dist/motion-value.d.ts +227 -0
- package/dist/motion-value.d.ts.map +1 -0
- package/dist/motion-value.js +1074 -0
- package/dist/motion-value.js.map +1 -0
- package/dist/native/index.d.ts +10 -0
- package/dist/native/index.d.ts.map +1 -0
- package/dist/native/index.js +6 -0
- package/dist/native/index.js.map +1 -0
- package/dist/native-properties.d.ts +28 -0
- package/dist/native-properties.d.ts.map +1 -0
- package/dist/native-properties.js +154 -0
- package/dist/native-properties.js.map +1 -0
- package/dist/native-property-driver.d.ts +19 -0
- package/dist/native-property-driver.d.ts.map +1 -0
- package/dist/native-property-driver.js +69 -0
- package/dist/native-property-driver.js.map +1 -0
- package/dist/native-property.d.ts +37 -0
- package/dist/native-property.d.ts.map +1 -0
- package/dist/native-property.js +285 -0
- package/dist/native-property.js.map +1 -0
- package/dist/particles.d.ts +5 -2
- package/dist/particles.d.ts.map +1 -1
- package/dist/particles.js +16 -10
- package/dist/particles.js.map +1 -1
- package/dist/path.d.ts.map +1 -1
- package/dist/path.js +2 -2
- package/dist/path.js.map +1 -1
- package/dist/physics/index.d.ts +116 -0
- package/dist/physics/index.d.ts.map +1 -0
- package/dist/physics/index.js +306 -0
- package/dist/physics/index.js.map +1 -0
- package/dist/physics/native.d.ts +53 -0
- package/dist/physics/native.d.ts.map +1 -0
- package/dist/physics/native.js +58 -0
- package/dist/physics/native.js.map +1 -0
- package/dist/playback-group.d.ts.map +1 -1
- package/dist/playback-group.js +17 -1
- package/dist/playback-group.js.map +1 -1
- package/dist/playback.d.ts +15 -0
- package/dist/playback.d.ts.map +1 -1
- package/dist/playback.js +23 -0
- package/dist/playback.js.map +1 -1
- package/dist/predictive-back/index.d.ts +45 -0
- package/dist/predictive-back/index.d.ts.map +1 -0
- package/dist/predictive-back/index.js +220 -0
- package/dist/predictive-back/index.js.map +1 -0
- package/dist/predictive-back/presentation.d.ts +4 -0
- package/dist/predictive-back/presentation.d.ts.map +1 -0
- package/dist/predictive-back/presentation.js +3 -0
- package/dist/predictive-back/presentation.js.map +1 -0
- package/dist/reorder/handle.d.ts +6 -0
- package/dist/reorder/handle.d.ts.map +1 -0
- package/dist/reorder/handle.js +10 -0
- package/dist/reorder/handle.js.map +1 -0
- package/dist/reorder/index.d.ts +10 -0
- package/dist/reorder/index.d.ts.map +1 -0
- package/dist/reorder/index.js +233 -0
- package/dist/reorder/index.js.map +1 -0
- package/dist/reorder/list-view.d.ts +5 -0
- package/dist/reorder/list-view.d.ts.map +1 -0
- package/dist/reorder/list-view.js +238 -0
- package/dist/reorder/list-view.js.map +1 -0
- package/dist/reorder/model.d.ts +6 -0
- package/dist/reorder/model.d.ts.map +1 -0
- package/dist/reorder/model.js +30 -0
- package/dist/reorder/model.js.map +1 -0
- package/dist/reorder/surface.d.ts +6 -0
- package/dist/reorder/surface.d.ts.map +1 -0
- package/dist/reorder/surface.js +10 -0
- package/dist/reorder/surface.js.map +1 -0
- package/dist/reorder/types.d.ts +92 -0
- package/dist/reorder/types.d.ts.map +1 -0
- package/dist/reorder/types.js +2 -0
- package/dist/reorder/types.js.map +1 -0
- package/dist/sampling.d.ts +35 -0
- package/dist/sampling.d.ts.map +1 -0
- package/dist/sampling.js +123 -0
- package/dist/sampling.js.map +1 -0
- package/dist/scene-appearance.d.ts +14 -0
- package/dist/scene-appearance.d.ts.map +1 -0
- package/dist/scene-appearance.js +68 -0
- package/dist/scene-appearance.js.map +1 -0
- package/dist/scene-camera.d.ts +5 -0
- package/dist/scene-camera.d.ts.map +1 -0
- package/dist/scene-camera.js +23 -0
- package/dist/scene-camera.js.map +1 -0
- package/dist/scene-shader.d.ts +18 -0
- package/dist/scene-shader.d.ts.map +1 -0
- package/dist/scene-shader.js +76 -0
- package/dist/scene-shader.js.map +1 -0
- package/dist/scroll-header/geometry.d.ts +18 -0
- package/dist/scroll-header/geometry.d.ts.map +1 -0
- package/dist/scroll-header/geometry.js +46 -0
- package/dist/scroll-header/geometry.js.map +1 -0
- package/dist/scroll-header/index.d.ts +48 -0
- package/dist/scroll-header/index.d.ts.map +1 -0
- package/dist/scroll-header/index.js +373 -0
- package/dist/scroll-header/index.js.map +1 -0
- package/dist/scroll-header/native.d.ts +28 -0
- package/dist/scroll-header/native.d.ts.map +1 -0
- package/dist/scroll-header/native.js +43 -0
- package/dist/scroll-header/native.js.map +1 -0
- package/dist/sensors/index.d.ts +69 -0
- package/dist/sensors/index.d.ts.map +1 -0
- package/dist/sensors/index.js +149 -0
- package/dist/sensors/index.js.map +1 -0
- package/dist/sensors/native.d.ts +20 -0
- package/dist/sensors/native.d.ts.map +1 -0
- package/dist/sensors/native.js +48 -0
- package/dist/sensors/native.js.map +1 -0
- package/dist/sequence.d.ts +24 -0
- package/dist/sequence.d.ts.map +1 -1
- package/dist/sequence.js +181 -19
- package/dist/sequence.js.map +1 -1
- package/dist/shapes/android.d.ts +3 -0
- package/dist/shapes/android.d.ts.map +1 -0
- package/dist/shapes/android.js +51 -0
- package/dist/shapes/android.js.map +1 -0
- package/dist/shapes/index.d.ts +6 -0
- package/dist/shapes/index.d.ts.map +1 -0
- package/dist/shapes/index.js +238 -0
- package/dist/shapes/index.js.map +1 -0
- package/dist/shapes/ios.d.ts +3 -0
- package/dist/shapes/ios.d.ts.map +1 -0
- package/dist/shapes/ios.js +164 -0
- package/dist/shapes/ios.js.map +1 -0
- package/dist/shapes/native.d.ts +18 -0
- package/dist/shapes/native.d.ts.map +1 -0
- package/dist/shapes/native.js +10 -0
- package/dist/shapes/native.js.map +1 -0
- package/dist/shapes/path.d.ts +10 -0
- package/dist/shapes/path.d.ts.map +1 -0
- package/dist/shapes/path.js +106 -0
- package/dist/shapes/path.js.map +1 -0
- package/dist/shapes/types.d.ts +55 -0
- package/dist/shapes/types.d.ts.map +1 -0
- package/dist/shapes/types.js +11 -0
- package/dist/shapes/types.js.map +1 -0
- package/dist/shared-layout/index.d.ts +40 -0
- package/dist/shared-layout/index.d.ts.map +1 -0
- package/dist/shared-layout/index.js +267 -0
- package/dist/shared-layout/index.js.map +1 -0
- package/dist/shared-layout/native.d.ts +15 -0
- package/dist/shared-layout/native.d.ts.map +1 -0
- package/dist/shared-layout/native.js +79 -0
- package/dist/shared-layout/native.js.map +1 -0
- package/dist/shared-layout/timing.d.ts +9 -0
- package/dist/shared-layout/timing.d.ts.map +1 -0
- package/dist/shared-layout/timing.js +68 -0
- package/dist/shared-layout/timing.js.map +1 -0
- package/dist/shared-navigation/entry.d.ts +51 -0
- package/dist/shared-navigation/entry.d.ts.map +1 -0
- package/dist/shared-navigation/entry.js +619 -0
- package/dist/shared-navigation/entry.js.map +1 -0
- package/dist/shared-navigation/index.d.ts +58 -0
- package/dist/shared-navigation/index.d.ts.map +1 -0
- package/dist/shared-navigation/index.js +318 -0
- package/dist/shared-navigation/index.js.map +1 -0
- package/dist/shared-navigation/return-signal.d.ts +16 -0
- package/dist/shared-navigation/return-signal.d.ts.map +1 -0
- package/dist/shared-navigation/return-signal.js +35 -0
- package/dist/shared-navigation/return-signal.js.map +1 -0
- package/dist/shared-navigation/return-target.d.ts +32 -0
- package/dist/shared-navigation/return-target.d.ts.map +1 -0
- package/dist/shared-navigation/return-target.js +168 -0
- package/dist/shared-navigation/return-target.js.map +1 -0
- package/dist/shared-navigation/scope.d.ts +4 -0
- package/dist/shared-navigation/scope.d.ts.map +1 -0
- package/dist/shared-navigation/scope.js +2 -0
- package/dist/shared-navigation/scope.js.map +1 -0
- package/dist/shared-navigation/targets.d.ts +6 -0
- package/dist/shared-navigation/targets.d.ts.map +1 -0
- package/dist/shared-navigation/targets.js +36 -0
- package/dist/shared-navigation/targets.js.map +1 -0
- package/dist/size-layout.d.ts +19 -0
- package/dist/size-layout.d.ts.map +1 -0
- package/dist/size-layout.js +216 -0
- package/dist/size-layout.js.map +1 -0
- package/dist/size.d.ts +19 -0
- package/dist/size.d.ts.map +1 -0
- package/dist/size.js +251 -0
- package/dist/size.js.map +1 -0
- package/dist/spring.d.ts +2 -0
- package/dist/spring.d.ts.map +1 -1
- package/dist/spring.js +11 -0
- package/dist/spring.js.map +1 -1
- package/dist/svg-path.d.ts +18 -0
- package/dist/svg-path.d.ts.map +1 -1
- package/dist/svg-path.js +3 -2
- package/dist/svg-path.js.map +1 -1
- package/dist/testing/clock.d.ts +40 -0
- package/dist/testing/clock.d.ts.map +1 -0
- package/dist/testing/clock.js +116 -0
- package/dist/testing/clock.js.map +1 -0
- package/dist/testing/handoff-recorder.d.ts +8 -0
- package/dist/testing/handoff-recorder.d.ts.map +1 -0
- package/dist/testing/handoff-recorder.js +77 -0
- package/dist/testing/handoff-recorder.js.map +1 -0
- package/dist/testing/index.d.ts +5 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +5 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/native.d.ts +46 -0
- package/dist/testing/native.d.ts.map +1 -0
- package/dist/testing/native.js +313 -0
- package/dist/testing/native.js.map +1 -0
- package/dist/testing/presentation.d.ts +11 -0
- package/dist/testing/presentation.d.ts.map +1 -0
- package/dist/testing/presentation.js +45 -0
- package/dist/testing/presentation.js.map +1 -0
- package/dist/testing/replay.d.ts +39 -0
- package/dist/testing/replay.d.ts.map +1 -0
- package/dist/testing/replay.js +99 -0
- package/dist/testing/replay.js.map +1 -0
- package/dist/testing/scroll-handoff-native.d.ts +10 -0
- package/dist/testing/scroll-handoff-native.d.ts.map +1 -0
- package/dist/testing/scroll-handoff-native.js +151 -0
- package/dist/testing/scroll-handoff-native.js.map +1 -0
- package/dist/testing/scroll-handoff.d.ts +25 -0
- package/dist/testing/scroll-handoff.d.ts.map +1 -0
- package/dist/testing/scroll-handoff.js +127 -0
- package/dist/testing/scroll-handoff.js.map +1 -0
- package/dist/testing/sensors.d.ts +13 -0
- package/dist/testing/sensors.d.ts.map +1 -0
- package/dist/testing/sensors.js +26 -0
- package/dist/testing/sensors.js.map +1 -0
- package/dist/testing/trace.d.ts +101 -0
- package/dist/testing/trace.d.ts.map +1 -0
- package/dist/testing/trace.js +263 -0
- package/dist/testing/trace.js.map +1 -0
- package/dist/timed-animation.d.ts +38 -0
- package/dist/timed-animation.d.ts.map +1 -0
- package/dist/timed-animation.js +177 -0
- package/dist/timed-animation.js.map +1 -0
- package/dist/track.d.ts +3 -0
- package/dist/track.d.ts.map +1 -1
- package/dist/track.js +281 -40
- package/dist/track.js.map +1 -1
- package/dist/transition.d.ts +54 -2
- package/dist/transition.d.ts.map +1 -1
- package/dist/transition.js +128 -8
- package/dist/transition.js.map +1 -1
- package/dist/types.d.ts +10 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/value-observers.d.ts +22 -0
- package/dist/value-observers.d.ts.map +1 -0
- package/dist/value-observers.js +122 -0
- package/dist/value-observers.js.map +1 -0
- package/dist/value-track.d.ts +13 -0
- package/dist/value-track.d.ts.map +1 -0
- package/dist/value-track.js +59 -0
- package/dist/value-track.js.map +1 -0
- package/dist/vue/index.d.ts +33 -3
- package/dist/vue/index.d.ts.map +1 -1
- package/dist/vue/index.js +118 -3
- package/dist/vue/index.js.map +1 -1
- package/dist/zoomable.d.ts +1 -1
- package/dist/zoomable.d.ts.map +1 -1
- package/package.json +68 -3
- package/platforms/android/include.gradle +10 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/BlurEffect.java +89 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/CircleMath.java +151 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/CircleWorld.java +210 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/GestureSession.java +227 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/GestureSurface.java +54 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/GradientLayer.java +224 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/KeyboardFrame.java +53 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/KeyboardFrameFollower.java +57 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/KeyboardObserver.java +97 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/LiveSpring.java +277 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/MotionProbe.java +70 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/ParticleEmitter.java +192 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/ParticleSimulation.java +114 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/PredictiveBackSession.java +212 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/ReorderHandle.java +25 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/ReorderSession.java +213 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/ReorderSurface.java +27 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/ScrollHeader.java +84 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/SensorMath.java +28 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/SensorSource.java +217 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/ShapeLayer.java +120 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/SharedLayoutFlight.java +287 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/SharedNavigationScene.java +115 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/SpringState.java +39 -0
- package/platforms/android/proguard-rules.pro +20 -0
- package/platforms/ios/build.xcconfig +1 -1
- package/platforms/ios/src/JoltBlur.h +14 -0
- package/platforms/ios/src/JoltBlur.m +86 -0
- package/platforms/ios/src/JoltCircleMath.h +183 -0
- package/platforms/ios/src/JoltCircleWorld.h +17 -0
- package/platforms/ios/src/JoltCircleWorld.m +203 -0
- package/platforms/ios/src/JoltGestureSession.h +23 -0
- package/platforms/ios/src/JoltGestureSession.m +251 -0
- package/platforms/ios/src/JoltInteractiveNavigation.h +23 -0
- package/platforms/ios/src/JoltInteractiveNavigation.m +255 -0
- package/platforms/ios/src/JoltLiveSpring.h +29 -0
- package/platforms/ios/src/JoltLiveSpring.m +243 -0
- package/platforms/ios/src/JoltMotionProbe.h +9 -0
- package/platforms/ios/src/JoltMotionProbe.m +72 -0
- package/platforms/ios/src/JoltReorderSession.h +15 -0
- package/platforms/ios/src/JoltReorderSession.m +205 -0
- package/platforms/ios/src/JoltScrollHeader.h +13 -0
- package/platforms/ios/src/JoltScrollHeader.m +93 -0
- package/platforms/ios/src/JoltSensorMath.h +39 -0
- package/platforms/ios/src/JoltSensorSource.h +13 -0
- package/platforms/ios/src/JoltSensorSource.m +201 -0
- package/platforms/ios/src/JoltSharedLayoutFlight.h +19 -0
- package/platforms/ios/src/JoltSharedLayoutFlight.m +250 -0
- package/platforms/ios/src/JoltSpringState.h +35 -0
- package/platforms/ios/src/module.modulemap +10 -0
- package/src/android-plugin.d.ts +463 -0
- package/src/animate.ts +129 -15
- package/src/blur/index.ts +195 -0
- package/src/blur/native.ts +70 -0
- package/src/blur/types.ts +32 -0
- package/src/bottom-sheet/geometry.ts +84 -0
- package/src/bottom-sheet/index.ts +536 -0
- package/src/bottom-sheet/native.ts +214 -0
- package/src/config.ts +39 -1
- package/src/decay.ts +9 -0
- package/src/drag.ts +67 -21
- package/src/driver/android-gradient.ts +116 -0
- package/src/driver/android-particles.ts +118 -0
- package/src/driver/android.ts +69 -1
- package/src/driver/frame.ts +10 -0
- package/src/driver/index.ts +15 -0
- package/src/driver/ios-gradient.ts +136 -0
- package/src/driver/ios-layout.ts +63 -0
- package/src/driver/ios-scroll-delegate.ts +23 -0
- package/src/driver/ios.ts +70 -17
- package/src/easing.ts +21 -1
- package/src/engine.ts +226 -59
- package/src/gesture-native.ts +139 -0
- package/src/gestures/index.ts +365 -0
- package/src/glass/index.ts +218 -0
- package/src/gradient-binding.ts +158 -0
- package/src/gradient.ts +663 -0
- package/src/gravity.ts +107 -0
- package/src/haptics.ts +106 -28
- package/src/image-effect.ts +10 -2
- package/src/index.ts +59 -7
- package/src/inspector/index.ts +523 -0
- package/src/inspector/plot.ts +27 -0
- package/src/inspector/probe.ts +50 -0
- package/src/inspector/tuning.ts +51 -0
- package/src/interactive-navigation/index.ts +398 -0
- package/src/ios-plugin.d.ts +279 -0
- package/src/keyboard.ts +231 -7
- package/src/layout.ts +408 -0
- package/src/live-spring-driver.ts +181 -0
- package/src/mixer.ts +306 -0
- package/src/motion-scope.ts +53 -6
- package/src/motion-states.ts +149 -42
- package/src/motion-value.ts +1289 -0
- package/src/native/index.ts +30 -0
- package/src/native-properties.ts +188 -0
- package/src/native-property-driver.ts +123 -0
- package/src/native-property.ts +366 -0
- package/src/particles.ts +18 -17
- package/src/path.ts +2 -1
- package/src/physics/index.ts +443 -0
- package/src/physics/native.ts +110 -0
- package/src/playback-group.ts +17 -1
- package/src/playback.ts +41 -0
- package/src/predictive-back/index.ts +280 -0
- package/src/predictive-back/presentation.ts +6 -0
- package/src/reorder/handle.ts +9 -0
- package/src/reorder/index.ts +243 -0
- package/src/reorder/list-view.ts +262 -0
- package/src/reorder/model.ts +47 -0
- package/src/reorder/surface.ts +10 -0
- package/src/reorder/types.ts +87 -0
- package/src/sampling.ts +173 -0
- package/src/scene-appearance.ts +92 -0
- package/src/scene-camera.ts +30 -0
- package/src/scene-shader.ts +139 -0
- package/src/scroll-header/geometry.ts +88 -0
- package/src/scroll-header/index.ts +504 -0
- package/src/scroll-header/native.ts +89 -0
- package/src/sensors/index.ts +246 -0
- package/src/sensors/native.ts +72 -0
- package/src/sequence.ts +209 -20
- package/src/shapes/android.ts +63 -0
- package/src/shapes/index.ts +267 -0
- package/src/shapes/ios.ts +194 -0
- package/src/shapes/native.ts +27 -0
- package/src/shapes/path.ts +127 -0
- package/src/shapes/types.ts +63 -0
- package/src/shared-layout/index.ts +343 -0
- package/src/shared-layout/native.ts +138 -0
- package/src/shared-layout/timing.ts +87 -0
- package/src/shared-navigation/entry.ts +695 -0
- package/src/shared-navigation/index.ts +414 -0
- package/src/shared-navigation/return-signal.ts +41 -0
- package/src/shared-navigation/return-target.ts +197 -0
- package/src/shared-navigation/scope.ts +3 -0
- package/src/shared-navigation/targets.ts +38 -0
- package/src/size-layout.ts +237 -0
- package/src/size.ts +302 -0
- package/src/spring.ts +18 -0
- package/src/svg-path.ts +8 -3
- package/src/testing/clock.ts +128 -0
- package/src/testing/handoff-recorder.ts +98 -0
- package/src/testing/index.ts +4 -0
- package/src/testing/native.ts +386 -0
- package/src/testing/presentation.ts +46 -0
- package/src/testing/replay.ts +149 -0
- package/src/testing/scroll-handoff-native.ts +201 -0
- package/src/testing/scroll-handoff.ts +140 -0
- package/src/testing/sensors.ts +41 -0
- package/src/testing/trace.ts +340 -0
- package/src/timed-animation.ts +192 -0
- package/src/track.ts +334 -38
- package/src/transition.ts +197 -9
- package/src/types.ts +11 -1
- package/src/value-observers.ts +147 -0
- package/src/value-track.ts +71 -0
- package/src/vue/index.ts +147 -1
- package/src/zoomable.ts +1 -1
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { ColorValue } from '../color.js'
|
|
2
|
+
import type { PlaybackAnimation } from '../playback.js'
|
|
3
|
+
import type { Transition, SpringName } from '../transition.js'
|
|
4
|
+
import type { ShapePath } from './path.js'
|
|
5
|
+
export interface ShapeValues {
|
|
6
|
+
d?: string
|
|
7
|
+
/** Fractions of a single contour, clamped to 0..1. Fill remains complete. */
|
|
8
|
+
strokeStart?: number
|
|
9
|
+
strokeEnd?: number
|
|
10
|
+
}
|
|
11
|
+
export interface ShapeOptions extends ShapeValues {
|
|
12
|
+
d: string
|
|
13
|
+
/** minX, minY, width, height. Centered aspect-fit; stroke scales with this box. */
|
|
14
|
+
viewBox: readonly [number, number, number, number]
|
|
15
|
+
stroke?: ColorValue
|
|
16
|
+
fill?: ColorValue
|
|
17
|
+
/** In viewBox units, 0..1000; default 2. */
|
|
18
|
+
strokeWidth?: number
|
|
19
|
+
lineCap?: 'butt' | 'round' | 'square'
|
|
20
|
+
lineJoin?: 'miter' | 'round' | 'bevel'
|
|
21
|
+
fillRule?: 'nonzero' | 'evenodd'
|
|
22
|
+
}
|
|
23
|
+
export interface Shape {
|
|
24
|
+
readonly disposed: boolean
|
|
25
|
+
animate(values: ShapeValues, transition?: Transition | SpringName): PlaybackAnimation
|
|
26
|
+
/** Replace geometry/trim immediately, including a different path topology. */
|
|
27
|
+
set(values: ShapeValues): void
|
|
28
|
+
/** Native presentation sampled only on demand. */
|
|
29
|
+
snapshot(): ShapeValues & {
|
|
30
|
+
d: string
|
|
31
|
+
strokeStart: number
|
|
32
|
+
strokeEnd: number
|
|
33
|
+
attached: boolean
|
|
34
|
+
nativeAnimations: number
|
|
35
|
+
bounds: readonly number[] | null
|
|
36
|
+
}
|
|
37
|
+
stop(): void
|
|
38
|
+
dispose(): void
|
|
39
|
+
}
|
|
40
|
+
export interface ShapeFrame {
|
|
41
|
+
path: ShapePath
|
|
42
|
+
start: number
|
|
43
|
+
end: number
|
|
44
|
+
}
|
|
45
|
+
export interface ShapeStyle {
|
|
46
|
+
viewBox: [number, number, number, number]
|
|
47
|
+
stroke: number
|
|
48
|
+
fill: number
|
|
49
|
+
width: number
|
|
50
|
+
cap: 'butt' | 'round' | 'square'
|
|
51
|
+
join: 'miter' | 'round' | 'bevel'
|
|
52
|
+
rule: 'nonzero' | 'evenodd'
|
|
53
|
+
}
|
|
54
|
+
export function mixFrame(a: ShapeFrame, b: ShapeFrame, t: number): ShapeFrame {
|
|
55
|
+
return {
|
|
56
|
+
path: {
|
|
57
|
+
...a.path,
|
|
58
|
+
points: a.path.points.map((p, i) => p + (b.path.points[i]! - p) * t),
|
|
59
|
+
},
|
|
60
|
+
start: Math.max(0, Math.min(1, a.start + (b.start - a.start) * t)),
|
|
61
|
+
end: Math.max(0, Math.min(1, a.end + (b.end - a.end) * t)),
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
import { Application, type View } from '@nativescript/core'
|
|
2
|
+
import { toView } from '../animate.js'
|
|
3
|
+
import { reducedMotion, onReducedMotion } from '../config.js'
|
|
4
|
+
import { getDriver } from '../driver/index.js'
|
|
5
|
+
import { timing, tracks } from './timing.js'
|
|
6
|
+
import { type Spring, type Tween, type SpringName } from '../transition.js'
|
|
7
|
+
import type { Target } from '../types.js'
|
|
8
|
+
import { capture, type Flight } from './native.js'
|
|
9
|
+
|
|
10
|
+
export type SharedLayoutTransition =
|
|
11
|
+
| Omit<Spring, 'repeat' | 'repeatType' | 'repeatDelay'>
|
|
12
|
+
| Omit<Tween, 'repeat' | 'repeatType' | 'repeatDelay'>
|
|
13
|
+
| SpringName
|
|
14
|
+
export interface SharedLayoutOptions {
|
|
15
|
+
transition?: SharedLayoutTransition
|
|
16
|
+
/** Bound the wait for Vue/native layout, in milliseconds. Default: 500. */
|
|
17
|
+
layoutTimeout?: number
|
|
18
|
+
/** Total pixel budget, including temporary reversal captures. Default: 8 million (32 MB RGBA). */
|
|
19
|
+
maxSnapshotPixels?: number
|
|
20
|
+
}
|
|
21
|
+
export interface SharedLayoutAttachment {
|
|
22
|
+
/** Images scale uniformly to fill the moving clip. Container content crossfades at its original size. */
|
|
23
|
+
content?: 'image' | 'container'
|
|
24
|
+
/** Uniform clipping radius in DIPs; defaults to the view's numeric borderRadius. */
|
|
25
|
+
radius?: number
|
|
26
|
+
}
|
|
27
|
+
export interface SharedLayoutResult {
|
|
28
|
+
status: 'completed' | 'cancelled' | 'unavailable'
|
|
29
|
+
reason?:
|
|
30
|
+
| 'interrupted'
|
|
31
|
+
| 'cancelled'
|
|
32
|
+
| 'unloaded'
|
|
33
|
+
| 'suspended'
|
|
34
|
+
| 'reduced-motion'
|
|
35
|
+
| 'missing-source'
|
|
36
|
+
| 'missing-target'
|
|
37
|
+
| 'unsupported-target'
|
|
38
|
+
| 'layout-timeout'
|
|
39
|
+
| 'geometry-changed'
|
|
40
|
+
}
|
|
41
|
+
export interface SharedLayoutAnimation {
|
|
42
|
+
readonly finished: Promise<SharedLayoutResult>
|
|
43
|
+
cancel(): void
|
|
44
|
+
stop(): void
|
|
45
|
+
}
|
|
46
|
+
export interface SharedLayout {
|
|
47
|
+
/** Register one identity. Replacing it is allowed inside transition(); stale disposers cannot detach its replacement. */
|
|
48
|
+
attach(view: Target, key: string, options?: SharedLayoutAttachment): () => void
|
|
49
|
+
/** Captures before the synchronous mutation, then resolves identities after the next native layout. */
|
|
50
|
+
transition(
|
|
51
|
+
change: () => void,
|
|
52
|
+
transition?: SharedLayoutTransition,
|
|
53
|
+
): SharedLayoutAnimation
|
|
54
|
+
readonly active: boolean
|
|
55
|
+
readonly paused: boolean
|
|
56
|
+
cancel(): void
|
|
57
|
+
pause(): void
|
|
58
|
+
play(): void
|
|
59
|
+
dispose(): void
|
|
60
|
+
}
|
|
61
|
+
interface Attachment {
|
|
62
|
+
view: View
|
|
63
|
+
image: boolean
|
|
64
|
+
radius: () => number
|
|
65
|
+
detach(): void
|
|
66
|
+
}
|
|
67
|
+
interface Operation {
|
|
68
|
+
flights: Map<string, Flight>
|
|
69
|
+
preparing: boolean
|
|
70
|
+
finish(result: SharedLayoutResult, preserve?: boolean): void
|
|
71
|
+
}
|
|
72
|
+
const scopes = new WeakMap<View, SharedLayout>()
|
|
73
|
+
const owners = new WeakMap<View, SharedLayout>()
|
|
74
|
+
const inside = (view: View, host: View): boolean => {
|
|
75
|
+
for (
|
|
76
|
+
let current: View | undefined = view;
|
|
77
|
+
current;
|
|
78
|
+
current = current.parent as View | undefined
|
|
79
|
+
)
|
|
80
|
+
if (current === host) return true
|
|
81
|
+
return false
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** Optional same-page shared identities; all moving snapshots are evaluated by the native runtime. */
|
|
85
|
+
export function sharedLayout(
|
|
86
|
+
container: Target,
|
|
87
|
+
options: SharedLayoutOptions = {},
|
|
88
|
+
): SharedLayout {
|
|
89
|
+
const host = toView(container)
|
|
90
|
+
if (scopes.has(host))
|
|
91
|
+
throw new Error('This container already has a shared layout owner.')
|
|
92
|
+
const defaultTiming = timing(options.transition)
|
|
93
|
+
const timeout = options.layoutTimeout ?? 500,
|
|
94
|
+
budget = options.maxSnapshotPixels ?? 8_000_000
|
|
95
|
+
if (!Number.isFinite(timeout) || timeout <= 0 || timeout > 10_000)
|
|
96
|
+
throw new RangeError('layoutTimeout must be between 0 and 10000 ms.')
|
|
97
|
+
if (!Number.isSafeInteger(budget) || budget <= 0 || budget > 32_000_000)
|
|
98
|
+
throw new RangeError('maxSnapshotPixels must be a positive integer at most 32000000.')
|
|
99
|
+
const attached = new Map<string, Attachment>()
|
|
100
|
+
let operation: Operation | undefined,
|
|
101
|
+
disposed = false,
|
|
102
|
+
paused = false,
|
|
103
|
+
suspended = false
|
|
104
|
+
const cancel = (reason: SharedLayoutResult['reason'] = 'cancelled') =>
|
|
105
|
+
operation?.finish({ status: 'cancelled', reason })
|
|
106
|
+
const unload = () => cancel('unloaded')
|
|
107
|
+
const suspend = () => {
|
|
108
|
+
suspended = true
|
|
109
|
+
cancel('suspended')
|
|
110
|
+
}
|
|
111
|
+
const resume = () => {
|
|
112
|
+
suspended = false
|
|
113
|
+
}
|
|
114
|
+
const releaseMotion = onReducedMotion((value) => {
|
|
115
|
+
if (value) cancel('reduced-motion')
|
|
116
|
+
})
|
|
117
|
+
const control: SharedLayout = {
|
|
118
|
+
get active() {
|
|
119
|
+
return !!operation
|
|
120
|
+
},
|
|
121
|
+
get paused() {
|
|
122
|
+
return paused || suspended
|
|
123
|
+
},
|
|
124
|
+
attach(target, key, config = {}) {
|
|
125
|
+
if (disposed) throw new Error('Shared layout is disposed.')
|
|
126
|
+
if (typeof key !== 'string' || !key.trim())
|
|
127
|
+
throw new TypeError('Shared layout needs a nonempty string identity.')
|
|
128
|
+
if (
|
|
129
|
+
config.content !== undefined &&
|
|
130
|
+
config.content !== 'image' &&
|
|
131
|
+
config.content !== 'container'
|
|
132
|
+
)
|
|
133
|
+
throw new TypeError('Unknown shared layout content mode.')
|
|
134
|
+
if (
|
|
135
|
+
config.radius !== undefined &&
|
|
136
|
+
(!Number.isFinite(config.radius) || config.radius < 0)
|
|
137
|
+
)
|
|
138
|
+
throw new RangeError('Shared layout radius must be finite and nonnegative.')
|
|
139
|
+
const view = toView(target)
|
|
140
|
+
if (view === host || !inside(view, host))
|
|
141
|
+
throw new Error('Attach a descendant of the shared layout container.')
|
|
142
|
+
const previous = attached.get(key)
|
|
143
|
+
if (previous?.view === view)
|
|
144
|
+
throw new Error(`Identity "${key}" is already attached.`)
|
|
145
|
+
if (previous && !operation?.preparing)
|
|
146
|
+
throw new Error(`Duplicate shared layout identity "${key}".`)
|
|
147
|
+
if (owners.has(view))
|
|
148
|
+
throw new Error('This view already belongs to a shared layout identity.')
|
|
149
|
+
for (const [id, entry] of attached)
|
|
150
|
+
if (id !== key && (inside(view, entry.view) || inside(entry.view, view)))
|
|
151
|
+
throw new Error('Shared layout identities cannot overlap.')
|
|
152
|
+
if (!previous && attached.size >= 8)
|
|
153
|
+
throw new RangeError(
|
|
154
|
+
'A shared layout supports at most eight simultaneous identities.',
|
|
155
|
+
)
|
|
156
|
+
previous?.detach()
|
|
157
|
+
const entry: Attachment = {
|
|
158
|
+
view,
|
|
159
|
+
image: config.content === 'image',
|
|
160
|
+
radius: () =>
|
|
161
|
+
config.radius ??
|
|
162
|
+
(typeof view.borderRadius === 'number' ? view.borderRadius : 0),
|
|
163
|
+
detach() {
|
|
164
|
+
view.off('unloaded', entry.detach)
|
|
165
|
+
if (attached.get(key) === entry) attached.delete(key)
|
|
166
|
+
if (owners.get(view) === control) owners.delete(view)
|
|
167
|
+
},
|
|
168
|
+
}
|
|
169
|
+
attached.set(key, entry)
|
|
170
|
+
owners.set(view, control)
|
|
171
|
+
view.on('unloaded', entry.detach)
|
|
172
|
+
return entry.detach
|
|
173
|
+
},
|
|
174
|
+
transition(change, input) {
|
|
175
|
+
if (disposed) throw new Error('Shared layout is disposed.')
|
|
176
|
+
if (paused || suspended) throw new Error('Shared layout is paused.')
|
|
177
|
+
if (typeof change !== 'function')
|
|
178
|
+
throw new TypeError('Shared layout needs a synchronous mutation.')
|
|
179
|
+
const transition = timing(input ?? defaultTiming)
|
|
180
|
+
let settle!: (value: SharedLayoutResult) => void,
|
|
181
|
+
ended = false,
|
|
182
|
+
timer: ReturnType<typeof setTimeout> | undefined,
|
|
183
|
+
detach: (() => void) | undefined
|
|
184
|
+
const finished = new Promise<SharedLayoutResult>((resolve) => {
|
|
185
|
+
settle = resolve
|
|
186
|
+
})
|
|
187
|
+
const previous = operation
|
|
188
|
+
const flights = previous?.flights ?? new Map<string, Flight>()
|
|
189
|
+
previous?.finish({ status: 'cancelled', reason: 'interrupted' }, true)
|
|
190
|
+
const current: Operation = {
|
|
191
|
+
flights,
|
|
192
|
+
preparing: true,
|
|
193
|
+
finish(result, preserve = false) {
|
|
194
|
+
if (ended) return
|
|
195
|
+
ended = true
|
|
196
|
+
if (timer !== undefined) clearTimeout(timer)
|
|
197
|
+
detach?.()
|
|
198
|
+
if (!preserve) {
|
|
199
|
+
for (const flight of flights.values()) flight.dispose()
|
|
200
|
+
flights.clear()
|
|
201
|
+
}
|
|
202
|
+
if (operation === current) operation = undefined
|
|
203
|
+
settle(result)
|
|
204
|
+
},
|
|
205
|
+
}
|
|
206
|
+
operation = current
|
|
207
|
+
const handle: SharedLayoutAnimation = {
|
|
208
|
+
finished,
|
|
209
|
+
cancel: () => current.finish({ status: 'cancelled', reason: 'cancelled' }),
|
|
210
|
+
stop: () => handle.cancel(),
|
|
211
|
+
}
|
|
212
|
+
const used = () =>
|
|
213
|
+
[...flights.values()].reduce((sum, flight) => sum + flight.pixels(), 0)
|
|
214
|
+
try {
|
|
215
|
+
let unavailable: SharedLayoutResult['reason']
|
|
216
|
+
if (reducedMotion()) unavailable = 'reduced-motion'
|
|
217
|
+
else if (!host.isLoaded || !host.nativeViewProtected) unavailable = 'unloaded'
|
|
218
|
+
else {
|
|
219
|
+
for (const [key, flight] of flights)
|
|
220
|
+
if (!flight.freeze(budget - used() + flight.pixels())) {
|
|
221
|
+
unavailable = 'unsupported-target'
|
|
222
|
+
break
|
|
223
|
+
}
|
|
224
|
+
if (!unavailable)
|
|
225
|
+
for (const [key, entry] of attached) {
|
|
226
|
+
if (flights.has(key)) continue
|
|
227
|
+
const flight = capture(
|
|
228
|
+
entry.view,
|
|
229
|
+
entry.image,
|
|
230
|
+
entry.radius(),
|
|
231
|
+
budget - used(),
|
|
232
|
+
)
|
|
233
|
+
if (!flight) {
|
|
234
|
+
unavailable = 'unsupported-target'
|
|
235
|
+
break
|
|
236
|
+
}
|
|
237
|
+
flights.set(key, flight)
|
|
238
|
+
}
|
|
239
|
+
if (!flights.size) unavailable ??= 'missing-source'
|
|
240
|
+
}
|
|
241
|
+
const result = change() as unknown
|
|
242
|
+
if (result && typeof (result as PromiseLike<unknown>).then === 'function') {
|
|
243
|
+
void Promise.resolve(result).catch(() => {})
|
|
244
|
+
throw new TypeError(
|
|
245
|
+
'Shared layout mutations must be synchronous; await data before transition().',
|
|
246
|
+
)
|
|
247
|
+
}
|
|
248
|
+
if (unavailable) current.finish({ status: 'unavailable', reason: unavailable })
|
|
249
|
+
if (!ended) {
|
|
250
|
+
timer = setTimeout(
|
|
251
|
+
() => current.finish({ status: 'unavailable', reason: 'layout-timeout' }),
|
|
252
|
+
timeout,
|
|
253
|
+
)
|
|
254
|
+
void Promise.resolve().then(() => {
|
|
255
|
+
if (ended) return
|
|
256
|
+
try {
|
|
257
|
+
if (!getDriver().afterLayout) {
|
|
258
|
+
current.finish({ status: 'unavailable', reason: 'unsupported-target' })
|
|
259
|
+
return
|
|
260
|
+
}
|
|
261
|
+
detach = getDriver().afterLayout!(host, () => {
|
|
262
|
+
if (ended) return
|
|
263
|
+
current.preparing = false
|
|
264
|
+
if (timer !== undefined) clearTimeout(timer)
|
|
265
|
+
try {
|
|
266
|
+
const prepared: { flight: Flight; json: string }[] = []
|
|
267
|
+
for (const [key, flight] of flights) {
|
|
268
|
+
const entry = attached.get(key)
|
|
269
|
+
if (!entry || !entry.view.isLoaded || !inside(entry.view, host)) {
|
|
270
|
+
current.finish({ status: 'unavailable', reason: 'missing-target' })
|
|
271
|
+
return
|
|
272
|
+
}
|
|
273
|
+
const target = flight.prepare(
|
|
274
|
+
entry.view,
|
|
275
|
+
entry.image,
|
|
276
|
+
entry.radius(),
|
|
277
|
+
budget - used() + flight.pixels(),
|
|
278
|
+
)
|
|
279
|
+
if (!target) {
|
|
280
|
+
current.finish({
|
|
281
|
+
status: 'unavailable',
|
|
282
|
+
reason: 'unsupported-target',
|
|
283
|
+
})
|
|
284
|
+
return
|
|
285
|
+
}
|
|
286
|
+
prepared.push({
|
|
287
|
+
flight,
|
|
288
|
+
json: tracks(flight, JSON.parse(target) as number[], transition),
|
|
289
|
+
})
|
|
290
|
+
}
|
|
291
|
+
let remaining = prepared.length
|
|
292
|
+
for (const { flight, json } of prepared)
|
|
293
|
+
flight.play(json, (completed) => {
|
|
294
|
+
if (ended) return
|
|
295
|
+
if (!completed)
|
|
296
|
+
current.finish({
|
|
297
|
+
status: 'cancelled',
|
|
298
|
+
reason: 'geometry-changed',
|
|
299
|
+
})
|
|
300
|
+
else if (--remaining === 0) current.finish({ status: 'completed' })
|
|
301
|
+
})
|
|
302
|
+
} catch {
|
|
303
|
+
current.finish({ status: 'unavailable', reason: 'unsupported-target' })
|
|
304
|
+
}
|
|
305
|
+
})
|
|
306
|
+
host.requestLayout()
|
|
307
|
+
} catch {
|
|
308
|
+
current.finish({ status: 'unavailable', reason: 'unsupported-target' })
|
|
309
|
+
}
|
|
310
|
+
})
|
|
311
|
+
}
|
|
312
|
+
} catch (error) {
|
|
313
|
+
handle.cancel()
|
|
314
|
+
throw error
|
|
315
|
+
}
|
|
316
|
+
return handle
|
|
317
|
+
},
|
|
318
|
+
cancel: () => cancel(),
|
|
319
|
+
pause() {
|
|
320
|
+
paused = true
|
|
321
|
+
cancel()
|
|
322
|
+
},
|
|
323
|
+
play() {
|
|
324
|
+
paused = false
|
|
325
|
+
},
|
|
326
|
+
dispose() {
|
|
327
|
+
if (disposed) return
|
|
328
|
+
disposed = true
|
|
329
|
+
cancel()
|
|
330
|
+
for (const entry of [...attached.values()]) entry.detach()
|
|
331
|
+
releaseMotion()
|
|
332
|
+
host.off('unloaded', unload)
|
|
333
|
+
Application.off(Application.suspendEvent, suspend)
|
|
334
|
+
Application.off(Application.resumeEvent, resume)
|
|
335
|
+
scopes.delete(host)
|
|
336
|
+
},
|
|
337
|
+
}
|
|
338
|
+
scopes.set(host, control)
|
|
339
|
+
host.on('unloaded', unload)
|
|
340
|
+
Application.on(Application.suspendEvent, suspend)
|
|
341
|
+
Application.on(Application.resumeEvent, resume)
|
|
342
|
+
return control
|
|
343
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { isIOS, type View } from '@nativescript/core'
|
|
2
|
+
|
|
3
|
+
export interface Flight {
|
|
4
|
+
pixels(): number
|
|
5
|
+
state(): string
|
|
6
|
+
prepare(view: View, image: boolean, radius: number, budget: number): string | null
|
|
7
|
+
holdPage?(page: View, budget: number): boolean
|
|
8
|
+
fade?(duration: number, complete: (finished: boolean) => void): void
|
|
9
|
+
freeze(budget: number): boolean
|
|
10
|
+
play(tracks: string, complete: (finished: boolean) => void): void
|
|
11
|
+
dispose(): void
|
|
12
|
+
}
|
|
13
|
+
export function capture(
|
|
14
|
+
view: View,
|
|
15
|
+
image: boolean,
|
|
16
|
+
radius: number,
|
|
17
|
+
budget: number,
|
|
18
|
+
): Flight | undefined {
|
|
19
|
+
if (isIOS) {
|
|
20
|
+
if (typeof JoltSharedLayoutFlight === 'undefined')
|
|
21
|
+
throw new Error('Rebuild the native app to use sharedLayout().')
|
|
22
|
+
const flight = JoltSharedLayoutFlight.captureImageRadiusMaxPixels(
|
|
23
|
+
view.nativeViewProtected,
|
|
24
|
+
image,
|
|
25
|
+
radius,
|
|
26
|
+
budget,
|
|
27
|
+
)
|
|
28
|
+
if (!flight) return
|
|
29
|
+
return {
|
|
30
|
+
holdPage: (page, budget) =>
|
|
31
|
+
flight.holdPageMaxPixels(page.nativeViewProtected, budget),
|
|
32
|
+
fade: (duration, done) => flight.fadeOnEnd(duration, done),
|
|
33
|
+
pixels: () => flight.pixels(),
|
|
34
|
+
state: () => flight.state(),
|
|
35
|
+
prepare: (target, image, radius, budget) =>
|
|
36
|
+
flight.prepareImageRadiusMaxPixels(
|
|
37
|
+
target.nativeViewProtected,
|
|
38
|
+
image,
|
|
39
|
+
radius,
|
|
40
|
+
budget,
|
|
41
|
+
),
|
|
42
|
+
freeze: (budget) => flight.freeze(budget),
|
|
43
|
+
play: (json, done) => flight.playOnEnd(json, done),
|
|
44
|
+
dispose: () => flight.dispose(),
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
const Native = org.rafaelaugusto.jolt.SharedLayoutFlight
|
|
48
|
+
if (!Native) throw new Error('Rebuild the native app to use sharedLayout().')
|
|
49
|
+
const flight = Native.capture(view.nativeViewProtected, image, radius, budget)
|
|
50
|
+
if (!flight) return
|
|
51
|
+
return {
|
|
52
|
+
holdPage: (page, budget) => flight.holdPage(page.nativeViewProtected, budget),
|
|
53
|
+
fade: (duration, done) =>
|
|
54
|
+
flight.fade(
|
|
55
|
+
duration,
|
|
56
|
+
new org.rafaelaugusto.jolt.SharedLayoutFlight.Listener({ onEnd: done }),
|
|
57
|
+
),
|
|
58
|
+
pixels: () => flight.pixels(),
|
|
59
|
+
state: () => flight.state(),
|
|
60
|
+
prepare: (target, image, radius, budget) =>
|
|
61
|
+
flight.prepare(target.nativeViewProtected, image, radius, budget),
|
|
62
|
+
freeze: (budget) => flight.freeze(budget),
|
|
63
|
+
play: (json, done) =>
|
|
64
|
+
flight.play(
|
|
65
|
+
json,
|
|
66
|
+
new org.rafaelaugusto.jolt.SharedLayoutFlight.Listener({ onEnd: done }),
|
|
67
|
+
),
|
|
68
|
+
dispose: () => flight.dispose(),
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** Static decoded Image content; native crop coordinates animate with the moving clip. */
|
|
73
|
+
export function captureNavigationImage(
|
|
74
|
+
view: View,
|
|
75
|
+
radius: number,
|
|
76
|
+
budget: number,
|
|
77
|
+
clipped = false,
|
|
78
|
+
): Flight | undefined {
|
|
79
|
+
if (isIOS) {
|
|
80
|
+
if (
|
|
81
|
+
typeof JoltSharedLayoutFlight === 'undefined' ||
|
|
82
|
+
!JoltSharedLayoutFlight.captureNavigationImageRadiusMaxPixels
|
|
83
|
+
)
|
|
84
|
+
throw new Error('Rebuild the native app to use sharedNavigation().')
|
|
85
|
+
const capture = clipped
|
|
86
|
+
? JoltSharedLayoutFlight.captureClippedNavigationImageRadiusMaxPixels
|
|
87
|
+
: JoltSharedLayoutFlight.captureNavigationImageRadiusMaxPixels
|
|
88
|
+
const flight = capture.call(
|
|
89
|
+
JoltSharedLayoutFlight,
|
|
90
|
+
view.nativeViewProtected,
|
|
91
|
+
radius,
|
|
92
|
+
budget,
|
|
93
|
+
)
|
|
94
|
+
if (!flight) return
|
|
95
|
+
return {
|
|
96
|
+
holdPage: (page, budget) =>
|
|
97
|
+
flight.holdPageMaxPixels(page.nativeViewProtected, budget),
|
|
98
|
+
fade: (duration, done) => flight.fadeOnEnd(duration, done),
|
|
99
|
+
pixels: () => flight.pixels(),
|
|
100
|
+
state: () => flight.state(),
|
|
101
|
+
prepare: (target, _image, radius, budget) =>
|
|
102
|
+
flight.prepareNavigationImageRadiusMaxPixels(
|
|
103
|
+
target.nativeViewProtected,
|
|
104
|
+
radius,
|
|
105
|
+
budget,
|
|
106
|
+
),
|
|
107
|
+
freeze: () => false,
|
|
108
|
+
play: (json, done) => flight.playOnEnd(json, done),
|
|
109
|
+
dispose: () => flight.dispose(),
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
const Native = org.rafaelaugusto.jolt.SharedLayoutFlight
|
|
113
|
+
if (!Native?.captureNavigationImage)
|
|
114
|
+
throw new Error('Rebuild the native app to use sharedNavigation().')
|
|
115
|
+
const flight = clipped
|
|
116
|
+
? Native.captureClippedNavigationImage(view.nativeViewProtected, radius, budget)
|
|
117
|
+
: Native.captureNavigationImage(view.nativeViewProtected, radius, budget)
|
|
118
|
+
if (!flight) return
|
|
119
|
+
return {
|
|
120
|
+
holdPage: (page, budget) => flight.holdPage(page.nativeViewProtected, budget),
|
|
121
|
+
fade: (duration, done) =>
|
|
122
|
+
flight.fade(
|
|
123
|
+
duration,
|
|
124
|
+
new org.rafaelaugusto.jolt.SharedLayoutFlight.Listener({ onEnd: done }),
|
|
125
|
+
),
|
|
126
|
+
pixels: () => flight.pixels(),
|
|
127
|
+
state: () => flight.state(),
|
|
128
|
+
prepare: (target, _image, radius, budget) =>
|
|
129
|
+
flight.prepareNavigationImage(target.nativeViewProtected, radius, budget),
|
|
130
|
+
freeze: () => false,
|
|
131
|
+
play: (json, done) =>
|
|
132
|
+
flight.play(
|
|
133
|
+
json,
|
|
134
|
+
new org.rafaelaugusto.jolt.SharedLayoutFlight.Listener({ onEnd: done }),
|
|
135
|
+
),
|
|
136
|
+
dispose: () => flight.dispose(),
|
|
137
|
+
}
|
|
138
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { createTrack } from '../track.js'
|
|
2
|
+
import { resolveTransition, springs, type Spring, type Tween } from '../transition.js'
|
|
3
|
+
import type { SharedLayoutTransition } from './index.js'
|
|
4
|
+
import type { Flight } from './native.js'
|
|
5
|
+
|
|
6
|
+
export function timing(input: SharedLayoutTransition | undefined): Spring | Tween {
|
|
7
|
+
const result = typeof input === 'string' ? springs[input] : (input ?? springs.smooth)
|
|
8
|
+
if (!result || typeof result !== 'object')
|
|
9
|
+
throw new TypeError('Unknown shared layout transition.')
|
|
10
|
+
const allowed = new Set([
|
|
11
|
+
'type',
|
|
12
|
+
'duration',
|
|
13
|
+
'ease',
|
|
14
|
+
'times',
|
|
15
|
+
'easeTrack',
|
|
16
|
+
'stiffness',
|
|
17
|
+
'damping',
|
|
18
|
+
'mass',
|
|
19
|
+
'bounce',
|
|
20
|
+
'velocity',
|
|
21
|
+
'delay',
|
|
22
|
+
])
|
|
23
|
+
for (const [key, value] of Object.entries(result)) {
|
|
24
|
+
if (!allowed.has(key))
|
|
25
|
+
throw new TypeError(`Unsupported shared layout transition option: ${key}.`)
|
|
26
|
+
if (typeof value === 'number' && !Number.isFinite(value))
|
|
27
|
+
throw new RangeError(`${key} must be finite.`)
|
|
28
|
+
}
|
|
29
|
+
if (result.type !== undefined && result.type !== 'spring' && result.type !== 'tween')
|
|
30
|
+
throw new TypeError('Unknown shared layout transition type.')
|
|
31
|
+
const spring = result as Spring
|
|
32
|
+
for (const key of ['stiffness', 'mass'] as const)
|
|
33
|
+
if (spring[key] !== undefined && spring[key]! <= 0)
|
|
34
|
+
throw new RangeError(`${key} must be positive.`)
|
|
35
|
+
if (spring.damping !== undefined && spring.damping < 0)
|
|
36
|
+
throw new RangeError('damping must be nonnegative.')
|
|
37
|
+
// Validate before touching the visible tree.
|
|
38
|
+
const resolved = resolveTransition(result, 'x', 2)
|
|
39
|
+
if (
|
|
40
|
+
resolved.curve.type === 'spring' &&
|
|
41
|
+
result.duration !== undefined &&
|
|
42
|
+
result.duration <= 0
|
|
43
|
+
)
|
|
44
|
+
throw new RangeError('Spring duration must be positive.')
|
|
45
|
+
if ((result.duration ?? 0) > 30_000 || (result.delay ?? 0) > 30_000)
|
|
46
|
+
throw new RangeError('Shared layout playback must finish within 30 seconds.')
|
|
47
|
+
return { ...result }
|
|
48
|
+
}
|
|
49
|
+
export function tracks(
|
|
50
|
+
flight: Flight,
|
|
51
|
+
destination: number[],
|
|
52
|
+
transition: Spring | Tween,
|
|
53
|
+
initialVelocity?: Readonly<{ x: number; y: number }>,
|
|
54
|
+
): string {
|
|
55
|
+
const state = JSON.parse(flight.state()) as { pose: number[]; velocity: number[] }
|
|
56
|
+
const geometry = destination.map((to, index) => {
|
|
57
|
+
const property = index === 4 ? 'borderRadius' : 'x'
|
|
58
|
+
return createTrack(
|
|
59
|
+
property,
|
|
60
|
+
[state.pose[index >= 5 ? index + 1 : index]!, to],
|
|
61
|
+
resolveTransition(transition, property, 2),
|
|
62
|
+
(index === 0 ? initialVelocity?.x : index === 1 ? initialVelocity?.y : undefined) ??
|
|
63
|
+
state.velocity[index >= 5 ? index + 1 : index] ??
|
|
64
|
+
0,
|
|
65
|
+
)
|
|
66
|
+
})
|
|
67
|
+
const duration = Math.max(...geometry.map((track) => track.end))
|
|
68
|
+
if (!Number.isFinite(duration) || duration > 30_000)
|
|
69
|
+
throw new RangeError('Shared layout playback must finish within 30 seconds.')
|
|
70
|
+
const blend = createTrack(
|
|
71
|
+
'opacity',
|
|
72
|
+
[0, 1],
|
|
73
|
+
resolveTransition({ duration: 180, ease: 'linear' }, 'opacity', 2),
|
|
74
|
+
0,
|
|
75
|
+
)
|
|
76
|
+
return JSON.stringify({
|
|
77
|
+
tracks: [...geometry.slice(0, 5), blend, ...geometry.slice(5)].map((track) => {
|
|
78
|
+
const times = track.times.map((time) => track.delay + time * track.duration)
|
|
79
|
+
const values = [...track.values]
|
|
80
|
+
if (track.delay > 0) {
|
|
81
|
+
times.unshift(0)
|
|
82
|
+
values.unshift(values[0]!)
|
|
83
|
+
}
|
|
84
|
+
return { times, values }
|
|
85
|
+
}),
|
|
86
|
+
})
|
|
87
|
+
}
|