@rafaelaugusto/jolt 0.1.0-beta.9 → 0.1.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +167 -21
- 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 +27 -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 +4 -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-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 +9 -0
- 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 +31 -2
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +194 -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 +19 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -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 +350 -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/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 +286 -0
- package/dist/mixer.js.map +1 -0
- package/dist/motion-scope.d.ts +8 -2
- package/dist/motion-scope.d.ts.map +1 -1
- package/dist/motion-scope.js +24 -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 +139 -0
- package/dist/physics/index.d.ts.map +1 -0
- package/dist/physics/index.js +316 -0
- package/dist/physics/index.js.map +1 -0
- package/dist/physics/native.d.ts +54 -0
- package/dist/physics/native.d.ts.map +1 -0
- package/dist/physics/native.js +64 -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/press.d.ts.map +1 -1
- package/dist/press.js +11 -2
- package/dist/press.js.map +1 -1
- 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 +399 -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 +158 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/CircleWorld.java +221 -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 +191 -0
- package/platforms/ios/src/JoltCircleWorld.h +18 -0
- package/platforms/ios/src/JoltCircleWorld.m +218 -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 +101 -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 +464 -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 +31 -1
- package/src/driver/frame.ts +10 -0
- package/src/driver/index.ts +4 -0
- package/src/driver/ios-gradient.ts +136 -0
- package/src/driver/ios-scroll-delegate.ts +23 -0
- package/src/driver/ios.ts +10 -0
- package/src/easing.ts +21 -1
- package/src/engine.ts +209 -60
- 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 +56 -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 +427 -0
- package/src/ios-plugin.d.ts +280 -0
- package/src/keyboard.ts +231 -7
- package/src/live-spring-driver.ts +181 -0
- package/src/mixer.ts +312 -0
- package/src/motion-scope.ts +39 -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 +476 -0
- package/src/physics/native.ts +121 -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/press.ts +10 -2
- 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 +530 -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,121 @@
|
|
|
1
|
+
import { isIOS, type View } from '@nativescript/core'
|
|
2
|
+
import type { PhysicsSnapshot, PhysicsVector } from './index.js'
|
|
3
|
+
export interface CircleDriver {
|
|
4
|
+
enabled(active: boolean): void
|
|
5
|
+
resize(width: number, height: number): void
|
|
6
|
+
impulse(index: number, x: number, y: number): void
|
|
7
|
+
attach(index: number, options: NativeAttachment | null): void
|
|
8
|
+
snapTo(index: number, target: number): void
|
|
9
|
+
reset(): void
|
|
10
|
+
snapshot(): Omit<PhysicsSnapshot, 'bodies'> & {
|
|
11
|
+
bodies: Omit<PhysicsSnapshot['bodies'][number], 'id'>[]
|
|
12
|
+
}
|
|
13
|
+
dispose(): void
|
|
14
|
+
}
|
|
15
|
+
export interface NativeAttachment {
|
|
16
|
+
x: number
|
|
17
|
+
y: number
|
|
18
|
+
length: number
|
|
19
|
+
stiffness: number
|
|
20
|
+
damping: number
|
|
21
|
+
line: { color: number; width: number } | null
|
|
22
|
+
}
|
|
23
|
+
interface Configuration {
|
|
24
|
+
width: number
|
|
25
|
+
height: number
|
|
26
|
+
gravity: PhysicsVector
|
|
27
|
+
restitution: number
|
|
28
|
+
damping: number
|
|
29
|
+
bodies: {
|
|
30
|
+
x: number
|
|
31
|
+
y: number
|
|
32
|
+
radius: number
|
|
33
|
+
mass: number
|
|
34
|
+
vx: number
|
|
35
|
+
vy: number
|
|
36
|
+
attachment: NativeAttachment | null
|
|
37
|
+
drag: Omit<NativeAttachment, 'x' | 'y'> | null
|
|
38
|
+
snap: {
|
|
39
|
+
points: PhysicsVector[]
|
|
40
|
+
stiffness: number
|
|
41
|
+
damping: number
|
|
42
|
+
projection: number
|
|
43
|
+
} | null
|
|
44
|
+
}[]
|
|
45
|
+
}
|
|
46
|
+
export type CircleFactory = (
|
|
47
|
+
container: View,
|
|
48
|
+
views: readonly View[],
|
|
49
|
+
options: Configuration,
|
|
50
|
+
) => CircleDriver
|
|
51
|
+
let override: CircleFactory | undefined
|
|
52
|
+
/** Internal test seam; not exported from the physics entry. */
|
|
53
|
+
export function setCircleFactory(factory: CircleFactory | undefined) {
|
|
54
|
+
override = factory
|
|
55
|
+
}
|
|
56
|
+
export const createCircleDriver: CircleFactory = (container, views, options) => {
|
|
57
|
+
if (override) return override(container, views, options)
|
|
58
|
+
if (isIOS) {
|
|
59
|
+
if (typeof JoltCircleWorld === 'undefined')
|
|
60
|
+
throw new Error('Rebuild the native app to use physicsWorld().')
|
|
61
|
+
const native = JoltCircleWorld.createOptions(
|
|
62
|
+
container.nativeViewProtected,
|
|
63
|
+
JSON.stringify(options),
|
|
64
|
+
)
|
|
65
|
+
try {
|
|
66
|
+
if (typeof native.attachOptions !== 'function')
|
|
67
|
+
throw new Error('Rebuild the native app to use physics attachments.')
|
|
68
|
+
if (
|
|
69
|
+
options.bodies.some((b) => b.drag) &&
|
|
70
|
+
typeof native.supportsPointerSpring !== 'function'
|
|
71
|
+
)
|
|
72
|
+
throw new Error('Rebuild the native app to use spring dragging.')
|
|
73
|
+
views.forEach((v, i) => native.connectIndex(v.nativeViewProtected, i))
|
|
74
|
+
} catch (e) {
|
|
75
|
+
native.dispose()
|
|
76
|
+
throw e
|
|
77
|
+
}
|
|
78
|
+
return {
|
|
79
|
+
enabled: (v) => native.setEnabled(v),
|
|
80
|
+
resize: (w, h) => native.resizeHeight(w, h),
|
|
81
|
+
impulse: (i, x, y) => native.impulseXY(i, x, y),
|
|
82
|
+
attach: (i, options) => native.attachOptions(i, JSON.stringify(options)),
|
|
83
|
+
snapTo: (i, target) => native.snapToTarget(i, target),
|
|
84
|
+
reset: () => native.reset(),
|
|
85
|
+
snapshot: () => JSON.parse(native.snapshot()),
|
|
86
|
+
dispose: () => native.dispose(),
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
if (
|
|
90
|
+
typeof org === 'undefined' ||
|
|
91
|
+
typeof org.rafaelaugusto.jolt.CircleWorld !== 'function'
|
|
92
|
+
)
|
|
93
|
+
throw new Error('Rebuild the native app to use physicsWorld().')
|
|
94
|
+
const native = new org.rafaelaugusto.jolt.CircleWorld(
|
|
95
|
+
container.nativeViewProtected,
|
|
96
|
+
JSON.stringify(options),
|
|
97
|
+
)
|
|
98
|
+
try {
|
|
99
|
+
if (typeof native.attach !== 'function')
|
|
100
|
+
throw new Error('Rebuild the native app to use physics attachments.')
|
|
101
|
+
if (
|
|
102
|
+
options.bodies.some((b) => b.drag) &&
|
|
103
|
+
typeof native.supportsPointerSpring !== 'function'
|
|
104
|
+
)
|
|
105
|
+
throw new Error('Rebuild the native app to use spring dragging.')
|
|
106
|
+
views.forEach((v, i) => native.connect(v.nativeViewProtected, i))
|
|
107
|
+
} catch (e) {
|
|
108
|
+
native.dispose()
|
|
109
|
+
throw e
|
|
110
|
+
}
|
|
111
|
+
return {
|
|
112
|
+
enabled: (v) => native.setEnabled(v),
|
|
113
|
+
resize: (w, h) => native.resize(w, h),
|
|
114
|
+
impulse: (i, x, y) => native.impulse(i, x, y),
|
|
115
|
+
attach: (i, options) => native.attach(i, JSON.stringify(options)),
|
|
116
|
+
snapTo: (i, target) => native.snapTo(i, target),
|
|
117
|
+
reset: () => native.reset(),
|
|
118
|
+
snapshot: () => JSON.parse(native.snapshot()),
|
|
119
|
+
dispose: () => native.dispose(),
|
|
120
|
+
}
|
|
121
|
+
}
|
package/src/playback-group.ts
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
type ViewAnimation,
|
|
7
7
|
} from './engine.js'
|
|
8
8
|
import { getDriver } from './driver/index.js'
|
|
9
|
-
import { createClock, type PlaybackClock } from './playback.js'
|
|
9
|
+
import { createClock, registerPlayback, type PlaybackClock } from './playback.js'
|
|
10
10
|
import { validateProgress, type PlaybackAnimation } from './playback.js'
|
|
11
11
|
|
|
12
12
|
/** Staggered views share a finite time range. Shorter children remain seekable
|
|
@@ -17,6 +17,7 @@ export function playbackGroup(children: readonly ViewAnimation[]): PlaybackAnima
|
|
|
17
17
|
let finalProgress: number | undefined
|
|
18
18
|
let clock: PlaybackClock | undefined
|
|
19
19
|
let pendingProgress: number | undefined
|
|
20
|
+
let changed = () => {}
|
|
20
21
|
const duration = () => Math.max(0, ...children.map((child) => child.duration))
|
|
21
22
|
const ensureClock = () => {
|
|
22
23
|
if (clock || settled || children.some((child) => !child.ready)) return
|
|
@@ -44,6 +45,7 @@ export function playbackGroup(children: readonly ViewAnimation[]): PlaybackAnima
|
|
|
44
45
|
clock?.seek(total * value)
|
|
45
46
|
for (const child of children) child.seekTime(total * value)
|
|
46
47
|
finishIfIdle()
|
|
48
|
+
changed()
|
|
47
49
|
}
|
|
48
50
|
for (const child of children) {
|
|
49
51
|
child.onIdle(finishIfIdle)
|
|
@@ -52,6 +54,7 @@ export function playbackGroup(children: readonly ViewAnimation[]): PlaybackAnima
|
|
|
52
54
|
if (pendingProgress !== undefined && children.every((child) => child.ready))
|
|
53
55
|
seek(pendingProgress)
|
|
54
56
|
finishIfIdle()
|
|
57
|
+
changed()
|
|
55
58
|
})
|
|
56
59
|
}
|
|
57
60
|
const finished = Promise.all(children.map((child) => child.finished)).then(
|
|
@@ -63,6 +66,7 @@ export function playbackGroup(children: readonly ViewAnimation[]): PlaybackAnima
|
|
|
63
66
|
: 0
|
|
64
67
|
settled = true
|
|
65
68
|
clock?.cancel()
|
|
69
|
+
changed()
|
|
66
70
|
return results.every(Boolean)
|
|
67
71
|
},
|
|
68
72
|
)
|
|
@@ -91,6 +95,7 @@ export function playbackGroup(children: readonly ViewAnimation[]): PlaybackAnima
|
|
|
91
95
|
paused = true
|
|
92
96
|
clock?.pause()
|
|
93
97
|
children.forEach((child) => child.pause())
|
|
98
|
+
changed()
|
|
94
99
|
}
|
|
95
100
|
},
|
|
96
101
|
play() {
|
|
@@ -99,6 +104,7 @@ export function playbackGroup(children: readonly ViewAnimation[]): PlaybackAnima
|
|
|
99
104
|
clock?.play()
|
|
100
105
|
children.forEach((child) => child.play())
|
|
101
106
|
finishIfIdle()
|
|
107
|
+
changed()
|
|
102
108
|
}
|
|
103
109
|
},
|
|
104
110
|
stop() {
|
|
@@ -106,9 +112,19 @@ export function playbackGroup(children: readonly ViewAnimation[]): PlaybackAnima
|
|
|
106
112
|
settled = true
|
|
107
113
|
clock?.cancel()
|
|
108
114
|
children.forEach((child) => child.stop())
|
|
115
|
+
changed()
|
|
109
116
|
},
|
|
110
117
|
then: (onfulfilled, onrejected) => finished.then(onfulfilled, onrejected),
|
|
111
118
|
}
|
|
119
|
+
changed = registerPlayback(animation, () => ({
|
|
120
|
+
position: pendingProgress,
|
|
121
|
+
time: finalProgress === undefined ? (clock?.time() ?? 0) : finalProgress * duration(),
|
|
122
|
+
duration: duration(),
|
|
123
|
+
paused,
|
|
124
|
+
ready: children.every((child) => child.ready),
|
|
125
|
+
settled,
|
|
126
|
+
completed: finalProgress === 1,
|
|
127
|
+
}))
|
|
112
128
|
setArrival(animation, Promise.all(children.map(arrivalOf)))
|
|
113
129
|
const listeners = new Set<() => void>()
|
|
114
130
|
const timings = children.map((child) => arrivalTimingOf(child)!)
|
package/src/playback.ts
CHANGED
|
@@ -23,6 +23,47 @@ export interface PlaybackClock {
|
|
|
23
23
|
cancel(): void
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
/** Boundary notifications, never frame callbacks. Consumers sample this same clock. */
|
|
27
|
+
export interface PlaybackState {
|
|
28
|
+
readonly position?: number
|
|
29
|
+
readonly time: number
|
|
30
|
+
readonly duration: number
|
|
31
|
+
readonly paused: boolean
|
|
32
|
+
readonly ready: boolean
|
|
33
|
+
readonly settled: boolean
|
|
34
|
+
readonly completed: boolean
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const sources = new WeakMap<
|
|
38
|
+
Animation,
|
|
39
|
+
{
|
|
40
|
+
read(): PlaybackState
|
|
41
|
+
listeners: Set<() => void>
|
|
42
|
+
}
|
|
43
|
+
>()
|
|
44
|
+
|
|
45
|
+
export function registerPlayback(animation: Animation, read: () => PlaybackState) {
|
|
46
|
+
const source = { read, listeners: new Set<() => void>() }
|
|
47
|
+
sources.set(animation, source)
|
|
48
|
+
return () => {
|
|
49
|
+
for (const listener of [...source.listeners]) listener()
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function playbackSource(animation: Animation) {
|
|
54
|
+
const source = sources.get(animation)
|
|
55
|
+
if (!source) throw new TypeError('This animation does not expose a playback clock.')
|
|
56
|
+
return {
|
|
57
|
+
read: source.read,
|
|
58
|
+
subscribe(listener: () => void) {
|
|
59
|
+
source.listeners.add(listener)
|
|
60
|
+
return () => {
|
|
61
|
+
source.listeners.delete(listener)
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
26
67
|
/** Read only on user commands; there is no frame loop in JavaScript. */
|
|
27
68
|
export function createClock(now: () => number, initial = 0): PlaybackClock {
|
|
28
69
|
let offset = initial
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
import { isAndroid, Trace, type View } from '@nativescript/core'
|
|
2
|
+
import { nativeBackSessions } from './presentation.js'
|
|
3
|
+
import { onReducedMotion, reducedMotion, timeScale } from '../config.js'
|
|
4
|
+
import { springPhysics } from '../spring.js'
|
|
5
|
+
import { springs, type Spring } from '../transition.js'
|
|
6
|
+
|
|
7
|
+
export type PredictiveBackValues = Partial<
|
|
8
|
+
Record<
|
|
9
|
+
'x' | 'y' | 'scale' | 'scaleX' | 'scaleY' | 'opacity' | 'rotate',
|
|
10
|
+
readonly [number, number]
|
|
11
|
+
>
|
|
12
|
+
>
|
|
13
|
+
export type PredictiveBackState =
|
|
14
|
+
'idle' | 'tracking' | 'cancelling' | 'finishing' | 'committing' | 'disposed'
|
|
15
|
+
export interface PredictiveBackEvent {
|
|
16
|
+
state: PredictiveBackState
|
|
17
|
+
edge?: 'left' | 'right'
|
|
18
|
+
/** Release sample only; updates during the gesture stay native. Velocity is progress/second. */
|
|
19
|
+
release?: Readonly<{ progress: number; velocity: number }>
|
|
20
|
+
outcome?: 'completed' | 'cancelled'
|
|
21
|
+
reason?: 'rejected' | 'error' | 'timeout'
|
|
22
|
+
}
|
|
23
|
+
export interface PredictiveBackOptions {
|
|
24
|
+
/** Close the owned surface or navigate once. Return false to spring back after a guard rejects. */
|
|
25
|
+
commit: (options: { animated: false }) => boolean | void | Promise<boolean | void>
|
|
26
|
+
spring?:
|
|
27
|
+
| keyof typeof springs
|
|
28
|
+
| Pick<Spring, 'duration' | 'bounce' | 'stiffness' | 'damping' | 'mass'>
|
|
29
|
+
enabled?: boolean
|
|
30
|
+
/** Mirror x and rotate when starting at the right edge. Default true. */
|
|
31
|
+
mirrorX?: boolean
|
|
32
|
+
/** Maximum wait for commit, 1–10000 ms. Default 5000. Does not cancel the caller's promise. */
|
|
33
|
+
commitTimeout?: number
|
|
34
|
+
/** Lifecycle only; no per-frame JavaScript notifications. */
|
|
35
|
+
onState?: (event: PredictiveBackEvent) => void
|
|
36
|
+
}
|
|
37
|
+
export interface PredictiveBack {
|
|
38
|
+
/** Android 14+, attached view-tree dispatcher owner and the native plugin are required. */
|
|
39
|
+
readonly supported: boolean
|
|
40
|
+
readonly state: PredictiveBackState
|
|
41
|
+
/** Read on demand, never pushed through JavaScript on each frame. */
|
|
42
|
+
readonly progress: number
|
|
43
|
+
enabled: boolean
|
|
44
|
+
/** Accessible button/keyboard equivalent. Unsupported platforms call commit without motion. */
|
|
45
|
+
back(): void
|
|
46
|
+
/** Rolls back a held gesture. An OS release already committed continues. */
|
|
47
|
+
cancel(): void
|
|
48
|
+
dispose(): void
|
|
49
|
+
}
|
|
50
|
+
const owners = new WeakMap<View, PredictiveBack>()
|
|
51
|
+
|
|
52
|
+
/** Animate a dedicated surface with Android's system back gesture. Create after the view is attached. */
|
|
53
|
+
export function predictiveBack(
|
|
54
|
+
view: View,
|
|
55
|
+
values: PredictiveBackValues,
|
|
56
|
+
options: PredictiveBackOptions,
|
|
57
|
+
): PredictiveBack {
|
|
58
|
+
if (!options || typeof options.commit !== 'function')
|
|
59
|
+
throw new TypeError('predictiveBack requires a commit callback.')
|
|
60
|
+
if (!values || typeof values !== 'object' || !Object.keys(values).length)
|
|
61
|
+
throw new TypeError('predictiveBack requires at least one transform or opacity pair.')
|
|
62
|
+
const parsed: PredictiveBackValues = {}
|
|
63
|
+
for (const [key, pair] of Object.entries(values)) {
|
|
64
|
+
if (!['x', 'y', 'scale', 'scaleX', 'scaleY', 'opacity', 'rotate'].includes(key))
|
|
65
|
+
throw new TypeError(`Unsupported predictive back property: ${key}.`)
|
|
66
|
+
const neutral = key.startsWith('scale') || key === 'opacity' ? 1 : 0
|
|
67
|
+
if (
|
|
68
|
+
!Array.isArray(pair) ||
|
|
69
|
+
pair.length !== 2 ||
|
|
70
|
+
pair.some((v) => typeof v !== 'number' || !Number.isFinite(v)) ||
|
|
71
|
+
pair[0] !== neutral
|
|
72
|
+
)
|
|
73
|
+
throw new RangeError(`${key} requires two finite values starting at ${neutral}.`)
|
|
74
|
+
if (
|
|
75
|
+
(key.startsWith('scale') && pair[1]! <= 0) ||
|
|
76
|
+
(key === 'opacity' && (pair[1]! < 0 || pair[1]! > 1))
|
|
77
|
+
)
|
|
78
|
+
throw new RangeError(`Invalid ${key} endpoint.`)
|
|
79
|
+
parsed[key as keyof PredictiveBackValues] = [pair[0]!, pair[1]!]
|
|
80
|
+
}
|
|
81
|
+
if (parsed.scale && (parsed.scaleX || parsed.scaleY))
|
|
82
|
+
throw new TypeError('Use scale or scaleX/scaleY, not both.')
|
|
83
|
+
for (const key of ['enabled', 'mirrorX'] as const)
|
|
84
|
+
if (options[key] !== undefined && typeof options[key] !== 'boolean')
|
|
85
|
+
throw new TypeError(`${key} must be boolean.`)
|
|
86
|
+
const timeout = options.commitTimeout ?? 5000
|
|
87
|
+
if (!Number.isFinite(timeout) || timeout < 1 || timeout > 10000)
|
|
88
|
+
throw new RangeError('commitTimeout must be between 1 and 10000 ms.')
|
|
89
|
+
const input =
|
|
90
|
+
typeof options.spring === 'string'
|
|
91
|
+
? Object.hasOwn(springs, options.spring)
|
|
92
|
+
? springs[options.spring]
|
|
93
|
+
: undefined
|
|
94
|
+
: options.spring
|
|
95
|
+
if (options.spring !== undefined && !input)
|
|
96
|
+
throw new TypeError('Unknown predictive back spring.')
|
|
97
|
+
if (input !== undefined && (typeof input !== 'object' || Array.isArray(input)))
|
|
98
|
+
throw new TypeError('spring must be a named spring or a physics object.')
|
|
99
|
+
for (const [key, value] of Object.entries(input ?? {}) as [string, unknown][]) {
|
|
100
|
+
if (!['type', 'duration', 'bounce', 'stiffness', 'damping', 'mass'].includes(key))
|
|
101
|
+
throw new TypeError(`Unsupported spring option: ${key}.`)
|
|
102
|
+
if (key === 'type') {
|
|
103
|
+
if (value !== 'spring') throw new TypeError('A spring is required.')
|
|
104
|
+
continue
|
|
105
|
+
}
|
|
106
|
+
if (typeof value !== 'number' || !Number.isFinite(value))
|
|
107
|
+
throw new RangeError(`${key} must be finite.`)
|
|
108
|
+
if (['duration', 'stiffness', 'mass'].includes(key) && value <= 0)
|
|
109
|
+
throw new RangeError(`${key} must be positive.`)
|
|
110
|
+
if (key === 'damping' && value < 0)
|
|
111
|
+
throw new RangeError('damping must be nonnegative.')
|
|
112
|
+
}
|
|
113
|
+
const physics = springPhysics(input ?? springs.smooth)
|
|
114
|
+
if (Object.values(physics).some((v) => !Number.isFinite(v)))
|
|
115
|
+
throw new RangeError('Spring physics must be finite.')
|
|
116
|
+
if (owners.has(view))
|
|
117
|
+
throw new Error(
|
|
118
|
+
'This view already has a predictive back owner. Dispose it before rebinding.',
|
|
119
|
+
)
|
|
120
|
+
let native: org.rafaelaugusto.jolt.PredictiveBackSession | undefined
|
|
121
|
+
let supported = false,
|
|
122
|
+
enabled = options.enabled ?? true
|
|
123
|
+
let state: PredictiveBackState = 'idle',
|
|
124
|
+
edge: PredictiveBackEvent['edge']
|
|
125
|
+
let reason: PredictiveBackEvent['reason']
|
|
126
|
+
let generation = 0,
|
|
127
|
+
timer: ReturnType<typeof setTimeout> | undefined
|
|
128
|
+
let offMotion: (() => void) | undefined
|
|
129
|
+
const emit = (next: PredictiveBackState, extra: Partial<PredictiveBackEvent> = {}) => {
|
|
130
|
+
state = next
|
|
131
|
+
try {
|
|
132
|
+
options.onState?.({ state, ...(edge ? { edge } : {}), ...extra })
|
|
133
|
+
} catch (error) {
|
|
134
|
+
Trace.write(
|
|
135
|
+
`Predictive back observer failed: ${String(error)}`,
|
|
136
|
+
'Jolt',
|
|
137
|
+
Trace.messageType.error,
|
|
138
|
+
)
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
const clear = () => {
|
|
142
|
+
if (timer !== undefined) clearTimeout(timer)
|
|
143
|
+
timer = undefined
|
|
144
|
+
}
|
|
145
|
+
const finishCommit = (
|
|
146
|
+
token: number,
|
|
147
|
+
accepted: boolean,
|
|
148
|
+
why?: PredictiveBackEvent['reason'],
|
|
149
|
+
) => {
|
|
150
|
+
if (token !== generation || state !== 'committing') return
|
|
151
|
+
generation++
|
|
152
|
+
clear()
|
|
153
|
+
reason = why
|
|
154
|
+
if (native) native.completeCommit(accepted)
|
|
155
|
+
else {
|
|
156
|
+
emit('idle', {
|
|
157
|
+
outcome: accepted ? 'completed' : 'cancelled',
|
|
158
|
+
...(why ? { reason: why } : {}),
|
|
159
|
+
})
|
|
160
|
+
if (accepted) control.dispose()
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
const commit = () => {
|
|
164
|
+
const token = ++generation
|
|
165
|
+
emit('committing')
|
|
166
|
+
if (state !== 'committing') return
|
|
167
|
+
timer = setTimeout(() => finishCommit(token, false, 'timeout'), timeout)
|
|
168
|
+
try {
|
|
169
|
+
Promise.resolve(options.commit({ animated: false })).then(
|
|
170
|
+
(result) =>
|
|
171
|
+
finishCommit(
|
|
172
|
+
token,
|
|
173
|
+
result !== false,
|
|
174
|
+
result === false ? 'rejected' : undefined,
|
|
175
|
+
),
|
|
176
|
+
() => finishCommit(token, false, 'error'),
|
|
177
|
+
)
|
|
178
|
+
} catch {
|
|
179
|
+
finishCommit(token, false, 'error')
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
const cleanup = () => {
|
|
183
|
+
if (state === 'disposed') return
|
|
184
|
+
generation++
|
|
185
|
+
clear()
|
|
186
|
+
offMotion?.()
|
|
187
|
+
offMotion = undefined
|
|
188
|
+
view.off('unloaded', unload)
|
|
189
|
+
if (owners.get(view) === control) owners.delete(view)
|
|
190
|
+
native = undefined
|
|
191
|
+
nativeBackSessions.delete(control)
|
|
192
|
+
emit('disposed')
|
|
193
|
+
}
|
|
194
|
+
const unload = () => {
|
|
195
|
+
if (state !== 'committing') control.dispose()
|
|
196
|
+
}
|
|
197
|
+
const control: PredictiveBack = {
|
|
198
|
+
get supported() {
|
|
199
|
+
return supported
|
|
200
|
+
},
|
|
201
|
+
get state() {
|
|
202
|
+
return state
|
|
203
|
+
},
|
|
204
|
+
get progress() {
|
|
205
|
+
return native?.getProgress() ?? 0
|
|
206
|
+
},
|
|
207
|
+
get enabled() {
|
|
208
|
+
return enabled
|
|
209
|
+
},
|
|
210
|
+
set enabled(value) {
|
|
211
|
+
if (typeof value !== 'boolean') throw new TypeError('enabled must be boolean.')
|
|
212
|
+
if (state === 'disposed') return
|
|
213
|
+
enabled = value
|
|
214
|
+
native?.setInputEnabled(value)
|
|
215
|
+
},
|
|
216
|
+
back() {
|
|
217
|
+
if (
|
|
218
|
+
!enabled ||
|
|
219
|
+
state === 'disposed' ||
|
|
220
|
+
state === 'committing' ||
|
|
221
|
+
state === 'finishing'
|
|
222
|
+
)
|
|
223
|
+
return
|
|
224
|
+
if (native) native.handleOnBackPressed()
|
|
225
|
+
else commit()
|
|
226
|
+
},
|
|
227
|
+
cancel() {
|
|
228
|
+
native?.cancel()
|
|
229
|
+
},
|
|
230
|
+
dispose() {
|
|
231
|
+
native?.dispose()
|
|
232
|
+
cleanup()
|
|
233
|
+
},
|
|
234
|
+
}
|
|
235
|
+
if (
|
|
236
|
+
isAndroid &&
|
|
237
|
+
typeof org !== 'undefined' &&
|
|
238
|
+
org.rafaelaugusto?.jolt?.PredictiveBackSession
|
|
239
|
+
) {
|
|
240
|
+
const Native = org.rafaelaugusto.jolt.PredictiveBackSession
|
|
241
|
+
native =
|
|
242
|
+
Native.attach(
|
|
243
|
+
view.nativeViewProtected,
|
|
244
|
+
JSON.stringify({
|
|
245
|
+
values: parsed,
|
|
246
|
+
...physics,
|
|
247
|
+
mirrorX: options.mirrorX ?? true,
|
|
248
|
+
enabled,
|
|
249
|
+
reduced: reducedMotion(),
|
|
250
|
+
timeScale: timeScale(),
|
|
251
|
+
}),
|
|
252
|
+
new Native.Listener({
|
|
253
|
+
onState(code, progress, velocity, side) {
|
|
254
|
+
if (state === 'disposed') return
|
|
255
|
+
edge = side === 0 ? 'left' : side === 1 ? 'right' : undefined
|
|
256
|
+
if (code === 1) {
|
|
257
|
+
reason = undefined
|
|
258
|
+
emit('tracking')
|
|
259
|
+
} else if (code === 2 || code === 3)
|
|
260
|
+
emit(code === 2 ? 'cancelling' : 'finishing', {
|
|
261
|
+
release: { progress, velocity },
|
|
262
|
+
})
|
|
263
|
+
else if (code === 4) commit()
|
|
264
|
+
else if (code === 5) {
|
|
265
|
+
emit('idle', { outcome: 'cancelled', ...(reason ? { reason } : {}) })
|
|
266
|
+
reason = undefined
|
|
267
|
+
} else if (code === 6) emit('idle', { outcome: 'completed' })
|
|
268
|
+
else if (code === 7) cleanup()
|
|
269
|
+
},
|
|
270
|
+
}),
|
|
271
|
+
) ?? undefined
|
|
272
|
+
supported = !!native
|
|
273
|
+
if (native) nativeBackSessions.set(control, native)
|
|
274
|
+
}
|
|
275
|
+
owners.set(view, control)
|
|
276
|
+
view.on('unloaded', unload)
|
|
277
|
+
if (native)
|
|
278
|
+
offMotion = onReducedMotion((reduced) => native?.setMotion(reduced, timeScale()))
|
|
279
|
+
return control
|
|
280
|
+
}
|
package/src/press.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Color, type EventData, type TouchGestureEventData } from '@nativescript/core'
|
|
2
2
|
import { isColorProperty } from './color.js'
|
|
3
|
-
import { animate, startingValues, toView } from './animate.js'
|
|
3
|
+
import { animate, startingValues, stop, toView } from './animate.js'
|
|
4
|
+
import { identity } from './mixer.js'
|
|
4
5
|
import type { PlaybackAnimation } from './playback.js'
|
|
5
6
|
import { readValue } from './properties.js'
|
|
6
7
|
import type { SpringName, Transition } from './transition.js'
|
|
@@ -25,6 +26,7 @@ export function press(
|
|
|
25
26
|
): () => void {
|
|
26
27
|
const view = toView(target)
|
|
27
28
|
const properties = [...startingValues(pressed, options).keys()]
|
|
29
|
+
const layer = typeof options === 'object' ? options.layer : undefined
|
|
28
30
|
let rest: Keyframes | undefined
|
|
29
31
|
let active: PlaybackAnimation | undefined
|
|
30
32
|
|
|
@@ -34,7 +36,11 @@ export function press(
|
|
|
34
36
|
rest = Object.fromEntries(
|
|
35
37
|
properties.map((p) => [
|
|
36
38
|
p,
|
|
37
|
-
|
|
39
|
+
layer !== undefined
|
|
40
|
+
? identity(p)
|
|
41
|
+
: isColorProperty(p)
|
|
42
|
+
? new Color(readValue(view, p))
|
|
43
|
+
: readValue(view, p),
|
|
38
44
|
]),
|
|
39
45
|
)
|
|
40
46
|
active = animate(view, pressed, options ?? pressIn)
|
|
@@ -52,6 +58,8 @@ export function press(
|
|
|
52
58
|
|
|
53
59
|
const cancel = () => {
|
|
54
60
|
active?.stop()
|
|
61
|
+
// A completed press still holds its layer contribution until it is removed.
|
|
62
|
+
if (layer !== undefined) stop(view, properties, { layer })
|
|
55
63
|
active = undefined
|
|
56
64
|
rest = undefined
|
|
57
65
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Button, isIOS } from '@nativescript/core'
|
|
2
|
+
|
|
3
|
+
/** Focusable native handle: Alt/Option + ↑/↓ moves its current item. */
|
|
4
|
+
export class ReorderHandle extends Button {
|
|
5
|
+
override createNativeView(): ReturnType<Button['createNativeView']> {
|
|
6
|
+
if (isIOS) return JoltReorderHandle.new()
|
|
7
|
+
return new org.rafaelaugusto.jolt.ReorderHandle(this._context)
|
|
8
|
+
}
|
|
9
|
+
}
|