@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
package/src/animate.ts
CHANGED
|
@@ -17,16 +17,26 @@ import { DEFAULT_FRICTION, solveDecay } from './decay.js'
|
|
|
17
17
|
import {
|
|
18
18
|
arrivalOf,
|
|
19
19
|
setArrival,
|
|
20
|
+
stopLayer,
|
|
20
21
|
stopView,
|
|
21
22
|
ViewAnimation,
|
|
22
23
|
type Animation,
|
|
23
24
|
type Plan,
|
|
24
25
|
} from './engine.js'
|
|
25
26
|
import { getPreset, type PresetName } from './presets.js'
|
|
27
|
+
import {
|
|
28
|
+
asRoot,
|
|
29
|
+
detachBindings,
|
|
30
|
+
isMotionValue,
|
|
31
|
+
type MotionValue,
|
|
32
|
+
type ValueAnimationOptions,
|
|
33
|
+
} from './motion-value.js'
|
|
26
34
|
import { resolveHaptic, type Haptic } from './haptics.js'
|
|
35
|
+
import { layerable } from './mixer.js'
|
|
27
36
|
import { isProperty, precision, type Property } from './properties.js'
|
|
28
37
|
import {
|
|
29
38
|
hasCurve,
|
|
39
|
+
fitTransition,
|
|
30
40
|
mergeTransitions,
|
|
31
41
|
resolveTransition,
|
|
32
42
|
springs,
|
|
@@ -42,6 +52,7 @@ import type {
|
|
|
42
52
|
KeyframeProperty,
|
|
43
53
|
Stagger,
|
|
44
54
|
Target,
|
|
55
|
+
Values,
|
|
45
56
|
} from './types.js'
|
|
46
57
|
|
|
47
58
|
interface Options {
|
|
@@ -50,24 +61,45 @@ interface Options {
|
|
|
50
61
|
stagger: number | Stagger | undefined
|
|
51
62
|
relative: boolean | undefined
|
|
52
63
|
haptic: Haptic | undefined
|
|
64
|
+
layer?: string
|
|
53
65
|
}
|
|
54
66
|
|
|
55
67
|
/**
|
|
56
68
|
* Animates one view, or several. Takes keyframes or the name of a preset,
|
|
57
|
-
* and a transition or the name of a spring.
|
|
69
|
+
* and a transition or the name of a spring. A motion value animates to a number.
|
|
58
70
|
*
|
|
59
71
|
* ```ts
|
|
60
72
|
* animate(card, 'fadeInUp')
|
|
61
73
|
* animate(card, { scale: 1.1, rotate: [0, 90] }, 'bouncy')
|
|
62
74
|
* animate(rows, 'fadeInUp', { stagger: 40 })
|
|
75
|
+
* animate(progress, 1, 'snappy')
|
|
63
76
|
* ```
|
|
64
77
|
*/
|
|
78
|
+
export function animate(
|
|
79
|
+
value: MotionValue,
|
|
80
|
+
to: number | readonly (number | null)[],
|
|
81
|
+
transition?: ValueAnimationOptions | SpringName,
|
|
82
|
+
): PlaybackAnimation
|
|
65
83
|
export function animate(
|
|
66
84
|
target: Target | readonly Target[],
|
|
67
85
|
animation: Keyframes | PresetName,
|
|
68
86
|
options?: AnimateOptions | SpringName,
|
|
69
|
-
): PlaybackAnimation
|
|
70
|
-
|
|
87
|
+
): PlaybackAnimation
|
|
88
|
+
export function animate(
|
|
89
|
+
target: Target | readonly Target[] | MotionValue,
|
|
90
|
+
animation: Keyframes | PresetName | number | readonly (number | null)[],
|
|
91
|
+
options?: AnimateOptions | SpringName,
|
|
92
|
+
): PlaybackAnimation | Animation {
|
|
93
|
+
if (isMotionValue(target))
|
|
94
|
+
return asRoot(target).animate(
|
|
95
|
+
animation as number | readonly (number | null)[],
|
|
96
|
+
options as ValueAnimationOptions | SpringName | undefined,
|
|
97
|
+
)
|
|
98
|
+
return prepareAnimation(
|
|
99
|
+
target as Target | readonly Target[],
|
|
100
|
+
animation as Keyframes | PresetName,
|
|
101
|
+
options,
|
|
102
|
+
)()
|
|
71
103
|
}
|
|
72
104
|
|
|
73
105
|
/** Validate and snapshot a complete animation before changing any view ownership. */
|
|
@@ -76,7 +108,7 @@ export function prepareAnimation(
|
|
|
76
108
|
animation: Keyframes | PresetName,
|
|
77
109
|
options?: AnimateOptions | SpringName,
|
|
78
110
|
): () => PlaybackAnimation {
|
|
79
|
-
const { keyframes, base, overrides, stagger, relative, haptic, path } = prepare(
|
|
111
|
+
const { keyframes, base, overrides, stagger, relative, haptic, path, layer } = prepare(
|
|
80
112
|
animation,
|
|
81
113
|
options,
|
|
82
114
|
)
|
|
@@ -87,8 +119,15 @@ export function prepareAnimation(
|
|
|
87
119
|
for (const property of Object.keys(keyframes))
|
|
88
120
|
if (isColorProperty(property)) validateColorTarget(view, property)
|
|
89
121
|
else if (isDecorationProperty(property)) validateDecorationTarget(view, property)
|
|
90
|
-
const plans = plan(keyframes, base, overrides, 0, relative, path)
|
|
91
|
-
return () =>
|
|
122
|
+
const plans = plan(keyframes, base, overrides, 0, relative, path, layer)
|
|
123
|
+
return () => {
|
|
124
|
+
if (layer === undefined)
|
|
125
|
+
detachBindings(
|
|
126
|
+
view,
|
|
127
|
+
plans.map(({ property }) => property),
|
|
128
|
+
)
|
|
129
|
+
return new ViewAnimation(view, plans, feedback)
|
|
130
|
+
}
|
|
92
131
|
}
|
|
93
132
|
|
|
94
133
|
const views = target.map(toView)
|
|
@@ -96,6 +135,7 @@ export function prepareAnimation(
|
|
|
96
135
|
for (const property of Object.keys(keyframes))
|
|
97
136
|
if (isColorProperty(property)) validateColorTarget(view, property)
|
|
98
137
|
else if (isDecorationProperty(property)) validateDecorationTarget(view, property)
|
|
138
|
+
const seed = Math.random()
|
|
99
139
|
const plans = views.map((_, index) =>
|
|
100
140
|
plan(
|
|
101
141
|
keyframes,
|
|
@@ -104,11 +144,20 @@ export function prepareAnimation(
|
|
|
104
144
|
staggerDelay(stagger, index, views.length),
|
|
105
145
|
relative,
|
|
106
146
|
path,
|
|
147
|
+
layer,
|
|
148
|
+
seed,
|
|
107
149
|
),
|
|
108
150
|
)
|
|
109
151
|
return () =>
|
|
110
152
|
playbackGroup(
|
|
111
|
-
views.map((view, index) =>
|
|
153
|
+
views.map((view, index) => {
|
|
154
|
+
if (layer === undefined)
|
|
155
|
+
detachBindings(
|
|
156
|
+
view,
|
|
157
|
+
plans[index]!.map(({ property }) => property),
|
|
158
|
+
)
|
|
159
|
+
return new ViewAnimation(view, plans[index]!, feedback, true)
|
|
160
|
+
}),
|
|
112
161
|
)
|
|
113
162
|
}
|
|
114
163
|
|
|
@@ -185,15 +234,63 @@ export function decay(
|
|
|
185
234
|
)
|
|
186
235
|
}
|
|
187
236
|
|
|
188
|
-
/**
|
|
237
|
+
/**
|
|
238
|
+
* Stops all or selected properties at their current values. `scale` stops both axes.
|
|
239
|
+
* A motion value stops where it is, and so do the views bound to it.
|
|
240
|
+
*/
|
|
241
|
+
export function stop(value: MotionValue, options?: { layer?: string }): void
|
|
189
242
|
export function stop(
|
|
190
243
|
target: Target | readonly Target[],
|
|
191
244
|
properties?: readonly KeyframeProperty[],
|
|
245
|
+
options?: { layer?: string },
|
|
246
|
+
): void
|
|
247
|
+
export function stop(
|
|
248
|
+
target: Target | readonly Target[] | MotionValue,
|
|
249
|
+
properties?: readonly KeyframeProperty[] | { layer?: string },
|
|
250
|
+
options?: { layer?: string },
|
|
192
251
|
) {
|
|
193
|
-
|
|
252
|
+
if (isMotionValue(target))
|
|
253
|
+
return asRoot(target).stop((properties as { layer?: string } | undefined)?.layer)
|
|
254
|
+
if (properties && !Array.isArray(properties))
|
|
255
|
+
throw new TypeError('View properties must be an array.')
|
|
256
|
+
const expanded = (
|
|
257
|
+
properties as readonly KeyframeProperty[] | undefined
|
|
258
|
+
)?.flatMap<Property>((property) =>
|
|
194
259
|
property === 'scale' ? ['scaleX', 'scaleY'] : [property],
|
|
195
260
|
)
|
|
196
|
-
for (const view of toViews(target
|
|
261
|
+
for (const view of toViews(target as Target | readonly Target[]))
|
|
262
|
+
if (options?.layer !== undefined) stopLayer(view, options.layer, expanded)
|
|
263
|
+
else stopView(view, expanded)
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Applies values at once, stopping whatever animates those properties.
|
|
268
|
+
* `scale` sets both axes. A view that isn't loaded yet gets them right away.
|
|
269
|
+
*
|
|
270
|
+
* ```ts
|
|
271
|
+
* set(logo, { opacity: 1, scale: 1, y: 0 })
|
|
272
|
+
* ```
|
|
273
|
+
*/
|
|
274
|
+
export function set(value: MotionValue, to: number): void
|
|
275
|
+
export function set(target: Target | readonly Target[], values: Values): void
|
|
276
|
+
export function set(
|
|
277
|
+
target: Target | readonly Target[] | MotionValue,
|
|
278
|
+
values: Values | number,
|
|
279
|
+
) {
|
|
280
|
+
if (isMotionValue(target)) return asRoot(target).set(values as number)
|
|
281
|
+
if (values === null || typeof values !== 'object' || Array.isArray(values))
|
|
282
|
+
throw new TypeError('set() takes an object of values.')
|
|
283
|
+
const keyframes: Record<string, unknown> = {}
|
|
284
|
+
for (const [key, value] of Object.entries(values)) {
|
|
285
|
+
if (value === undefined) continue
|
|
286
|
+
if (key !== 'scale' && !isProperty(key)) throw new Error(`Can't set "${key}".`)
|
|
287
|
+
if (value === null || Array.isArray(value))
|
|
288
|
+
throw new TypeError(
|
|
289
|
+
`set() takes one value per property, got ${String(value)} for "${key}".`,
|
|
290
|
+
)
|
|
291
|
+
keyframes[key] = [value, value]
|
|
292
|
+
}
|
|
293
|
+
animate(target as Target | readonly Target[], keyframes as Keyframes, { duration: 0 })
|
|
197
294
|
}
|
|
198
295
|
|
|
199
296
|
/** Plays several animations as one: finished once they all are, and stopped together. */
|
|
@@ -256,6 +353,7 @@ function resolveAnimation(
|
|
|
256
353
|
stagger: user.stagger ?? own.stagger,
|
|
257
354
|
relative: user.relative ?? own.relative,
|
|
258
355
|
haptic: user.haptic ?? own.haptic,
|
|
356
|
+
layer: user.layer,
|
|
259
357
|
}
|
|
260
358
|
}
|
|
261
359
|
|
|
@@ -282,16 +380,21 @@ function normalize(options: AnimateOptions | SpringName | undefined): Options {
|
|
|
282
380
|
let stagger: Options['stagger']
|
|
283
381
|
let relative: Options['relative']
|
|
284
382
|
let haptic: Options['haptic']
|
|
383
|
+
let layer: Options['layer']
|
|
285
384
|
for (const [key, value] of Object.entries(options)) {
|
|
286
385
|
if (value === undefined) continue
|
|
287
|
-
if (key === '
|
|
386
|
+
if (key === 'layer') {
|
|
387
|
+
if (typeof value !== 'string' || !value)
|
|
388
|
+
throw new TypeError('A layer is named by a nonempty string.')
|
|
389
|
+
layer = value
|
|
390
|
+
} else if (key === 'stagger') stagger = value as Options['stagger']
|
|
288
391
|
else if (key === 'relative') relative = value as Options['relative']
|
|
289
392
|
else if (key === 'haptic') haptic = value as Options['haptic']
|
|
290
393
|
else if (key === 'path' || key === 'scale' || isProperty(key)) {
|
|
291
394
|
overrides[key] = typeof value === 'string' ? spring(value as SpringName) : value
|
|
292
395
|
} else base[key] = value
|
|
293
396
|
}
|
|
294
|
-
return { base, overrides, stagger, relative, haptic }
|
|
397
|
+
return { base, overrides, stagger, relative, haptic, layer }
|
|
295
398
|
}
|
|
296
399
|
|
|
297
400
|
function plan(
|
|
@@ -301,8 +404,16 @@ function plan(
|
|
|
301
404
|
offset: number,
|
|
302
405
|
relative = false,
|
|
303
406
|
path?: PreparedPath,
|
|
407
|
+
layer?: string,
|
|
408
|
+
seed = Math.random(),
|
|
304
409
|
): Plan[] {
|
|
410
|
+
if (layer !== undefined && path)
|
|
411
|
+
throw new Error("A path owns x and y; it can't play on a layer.")
|
|
305
412
|
return expand(keyframes, path).map(([property, frames]) => {
|
|
413
|
+
if (layer !== undefined && !layerable(property))
|
|
414
|
+
throw new Error(
|
|
415
|
+
`Layers apply to x, y, scale, rotation and opacity; "${property}" has a single owner.`,
|
|
416
|
+
)
|
|
306
417
|
if (path?.properties.includes(property as 'x' | 'y' | 'rotate')) {
|
|
307
418
|
if (
|
|
308
419
|
!Number.isFinite(path.transition.delay + offset) ||
|
|
@@ -322,12 +433,13 @@ function plan(
|
|
|
322
433
|
const override =
|
|
323
434
|
overrides[property] ?? (property.startsWith('scale') ? overrides.scale : undefined)
|
|
324
435
|
const transition = resolveTransition(
|
|
325
|
-
override ? mergeTransitions(base, override) : base,
|
|
436
|
+
fitTransition(override ? mergeTransitions(base, override) : base, frames.length),
|
|
326
437
|
property,
|
|
327
438
|
frames.length,
|
|
328
439
|
)
|
|
329
440
|
transition.delay += offset
|
|
330
|
-
|
|
441
|
+
if (transition.seed !== undefined) transition.seed = seed
|
|
442
|
+
return { property, keyframes: frames, transition, relative, layer }
|
|
331
443
|
})
|
|
332
444
|
}
|
|
333
445
|
|
|
@@ -336,8 +448,10 @@ export function startingValues(
|
|
|
336
448
|
animation: Keyframes | PresetName,
|
|
337
449
|
options?: AnimateOptions | SpringName,
|
|
338
450
|
) {
|
|
339
|
-
const { keyframes, relative, path } = prepare(animation, options)
|
|
451
|
+
const { keyframes, relative, path, layer } = prepare(animation, options)
|
|
340
452
|
if (!keyframes) throw new Error(`Unknown preset "${animation}".`)
|
|
453
|
+
if (layer !== undefined)
|
|
454
|
+
return new Map(expand(keyframes, path).map(([property]) => [property, null]))
|
|
341
455
|
return new Map(
|
|
342
456
|
expand(keyframes, path).map(([property, [first]]) => [
|
|
343
457
|
property,
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { Application, type View } from '@nativescript/core'
|
|
2
|
+
import { toView } from '../animate.js'
|
|
3
|
+
import { onReducedMotion, reducedMotion } from '../config.js'
|
|
4
|
+
import { TimedAnimation } from '../timed-animation.js'
|
|
5
|
+
import { createTrack, instantTrack, type Track } from '../track.js'
|
|
6
|
+
import {
|
|
7
|
+
resolveTransition,
|
|
8
|
+
springs,
|
|
9
|
+
type Transition,
|
|
10
|
+
type SpringName,
|
|
11
|
+
} from '../transition.js'
|
|
12
|
+
import type { Target } from '../types.js'
|
|
13
|
+
import { createBlur, type BlurPainter } from './native.js'
|
|
14
|
+
import type { Blur, BlurOptions, BlurSnapshot } from './types.js'
|
|
15
|
+
export type { Blur, BlurOptions, BlurSnapshot } from './types.js'
|
|
16
|
+
|
|
17
|
+
const owners = new WeakMap<View, BlurOwner>()
|
|
18
|
+
function amount(value: number) {
|
|
19
|
+
if (!Number.isFinite(value) || value < 0 || value > 1)
|
|
20
|
+
throw new RangeError('Blur amount must be within 0..1.')
|
|
21
|
+
return value
|
|
22
|
+
}
|
|
23
|
+
/** Blur a dedicated content view after native layout. Keep sharp controls in a sibling. */
|
|
24
|
+
export function blur(target: Target, options: BlurOptions = {}): Blur {
|
|
25
|
+
if (!options || typeof options !== 'object')
|
|
26
|
+
throw new TypeError('Invalid blur options.')
|
|
27
|
+
const settings: Required<BlurOptions> = {
|
|
28
|
+
amount: amount(options.amount ?? 0),
|
|
29
|
+
radius: options.radius ?? 24,
|
|
30
|
+
style: options.style ?? 'system',
|
|
31
|
+
}
|
|
32
|
+
if (!Number.isFinite(settings.radius) || settings.radius < 1 || settings.radius > 64)
|
|
33
|
+
throw new RangeError('Blur radius must be within 1..64 DIPs.')
|
|
34
|
+
if (!['system', 'light', 'dark'].includes(settings.style))
|
|
35
|
+
throw new TypeError('Invalid blur style.')
|
|
36
|
+
const view = toView(target)
|
|
37
|
+
if (!view.isLoaded || !view.nativeViewProtected)
|
|
38
|
+
throw new Error('Create blur after native layout.')
|
|
39
|
+
if (owners.has(view)) throw new Error('This view already owns blur. Dispose it first.')
|
|
40
|
+
return new BlurOwner(view, settings)
|
|
41
|
+
}
|
|
42
|
+
class BlurOwner implements Blur {
|
|
43
|
+
disposed = false
|
|
44
|
+
private painter?: BlurPainter
|
|
45
|
+
private native?: object
|
|
46
|
+
private state: BlurSnapshot
|
|
47
|
+
private active?: { animation: TimedAnimation; track: Track; destination: number }
|
|
48
|
+
private suspended = false
|
|
49
|
+
private backgrounded = false
|
|
50
|
+
private offReduced: () => void
|
|
51
|
+
constructor(
|
|
52
|
+
private readonly view: View,
|
|
53
|
+
private readonly options: Required<BlurOptions>,
|
|
54
|
+
) {
|
|
55
|
+
this.attach(options.amount)
|
|
56
|
+
this.state = this.painter!.snapshot()
|
|
57
|
+
owners.set(view, this)
|
|
58
|
+
view.on('loaded', this.layout)
|
|
59
|
+
view.on('layoutChanged', this.layout)
|
|
60
|
+
view.on('unloaded', this.unload)
|
|
61
|
+
Application.on(Application.suspendEvent, this.background)
|
|
62
|
+
Application.on(Application.resumeEvent, this.foreground)
|
|
63
|
+
this.offReduced = onReducedMotion((value) => {
|
|
64
|
+
if (!value || !this.active) return
|
|
65
|
+
const destination = this.active.destination
|
|
66
|
+
this.set(destination)
|
|
67
|
+
})
|
|
68
|
+
}
|
|
69
|
+
private alive() {
|
|
70
|
+
if (this.disposed) throw new Error('Blur has been disposed.')
|
|
71
|
+
}
|
|
72
|
+
private attach(value: number) {
|
|
73
|
+
this.painter = createBlur(this.view, { ...this.options, amount: value })
|
|
74
|
+
this.native = this.view.nativeViewProtected
|
|
75
|
+
}
|
|
76
|
+
private layout = () => {
|
|
77
|
+
if (this.disposed || !this.view.isLoaded || !this.view.nativeViewProtected) return
|
|
78
|
+
if (this.native && this.native !== this.view.nativeViewProtected) this.unload()
|
|
79
|
+
if (!this.painter) {
|
|
80
|
+
this.attach(this.state.amount)
|
|
81
|
+
if (this.active) {
|
|
82
|
+
this.painter!.play(this.active.track)
|
|
83
|
+
this.painter!.control(this.active.animation.time, true)
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
this.painter!.resize()
|
|
87
|
+
if (!this.backgrounded && this.suspended) {
|
|
88
|
+
this.active?.animation.play()
|
|
89
|
+
this.suspended = false
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
private unload = () => {
|
|
93
|
+
if (!this.backgrounded || !this.active) this.stop()
|
|
94
|
+
this.state = this.snapshot()
|
|
95
|
+
this.painter?.dispose()
|
|
96
|
+
this.painter = undefined
|
|
97
|
+
this.native = undefined
|
|
98
|
+
}
|
|
99
|
+
private background = () => {
|
|
100
|
+
if (this.backgrounded) return
|
|
101
|
+
this.backgrounded = true
|
|
102
|
+
this.suspended = !!this.active && !this.active.animation.paused
|
|
103
|
+
if (this.suspended) this.active!.animation.pause()
|
|
104
|
+
}
|
|
105
|
+
private foreground = () => {
|
|
106
|
+
this.backgrounded = false
|
|
107
|
+
if (this.painter) {
|
|
108
|
+
if (this.suspended) this.active?.animation.play()
|
|
109
|
+
this.suspended = false
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
snapshot(): BlurSnapshot {
|
|
113
|
+
if (this.painter) this.state = this.painter.snapshot()
|
|
114
|
+
return {
|
|
115
|
+
...this.state,
|
|
116
|
+
attached: !!this.painter,
|
|
117
|
+
appliedAmount: this.painter ? this.state.appliedAmount : 0,
|
|
118
|
+
nativeAnimations: this.painter ? this.state.nativeAnimations : 0,
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
set(value: number) {
|
|
122
|
+
this.alive()
|
|
123
|
+
amount(value)
|
|
124
|
+
this.stop()
|
|
125
|
+
this.state.amount = value
|
|
126
|
+
this.painter?.paint(value)
|
|
127
|
+
}
|
|
128
|
+
animate(value: number, options: Transition | SpringName = {}) {
|
|
129
|
+
this.alive()
|
|
130
|
+
amount(value)
|
|
131
|
+
if (!this.painter || !this.view.isLoaded)
|
|
132
|
+
throw new Error('Load blur before animating.')
|
|
133
|
+
if (typeof options === 'string' && !Object.hasOwn(springs, options))
|
|
134
|
+
throw new TypeError('Unknown blur spring.')
|
|
135
|
+
const settings = typeof options === 'string' ? springs[options] : options
|
|
136
|
+
if ('layer' in settings)
|
|
137
|
+
throw new TypeError('Blur owns one animation; named layers are not supported.')
|
|
138
|
+
const transition = resolveTransition(settings, 'opacity', 2)
|
|
139
|
+
const from = this.snapshot().amount
|
|
140
|
+
const velocity =
|
|
141
|
+
this.active && !this.active.animation.paused
|
|
142
|
+
? this.active.track.velocityAt(this.active.animation.time)
|
|
143
|
+
: 0
|
|
144
|
+
const track =
|
|
145
|
+
reducedMotion() || this.state.backend === 'none'
|
|
146
|
+
? instantTrack('opacity', value)
|
|
147
|
+
: createTrack('opacity', [from, value], transition, velocity)
|
|
148
|
+
this.stop()
|
|
149
|
+
let animation: TimedAnimation
|
|
150
|
+
animation = new TimedAnimation(
|
|
151
|
+
track.end,
|
|
152
|
+
track.arrival,
|
|
153
|
+
(time, paused) => this.painter?.control(time, paused),
|
|
154
|
+
(completed) => {
|
|
155
|
+
const current = completed
|
|
156
|
+
? Math.max(0, Math.min(1, track.to))
|
|
157
|
+
: this.snapshot().amount
|
|
158
|
+
this.state.amount = current
|
|
159
|
+
this.painter?.paint(current)
|
|
160
|
+
if (this.active?.animation === animation) this.active = undefined
|
|
161
|
+
},
|
|
162
|
+
)
|
|
163
|
+
this.active = { animation, track, destination: value }
|
|
164
|
+
try {
|
|
165
|
+
if (track.end > 0) this.painter.play(track)
|
|
166
|
+
else this.painter.paint(value)
|
|
167
|
+
animation.start()
|
|
168
|
+
if (this.backgrounded && this.active) {
|
|
169
|
+
this.suspended = true
|
|
170
|
+
animation.pause()
|
|
171
|
+
}
|
|
172
|
+
} catch (e) {
|
|
173
|
+
animation.stop()
|
|
174
|
+
throw e
|
|
175
|
+
}
|
|
176
|
+
return animation
|
|
177
|
+
}
|
|
178
|
+
stop() {
|
|
179
|
+
this.active?.animation.stop()
|
|
180
|
+
this.suspended = false
|
|
181
|
+
}
|
|
182
|
+
dispose() {
|
|
183
|
+
if (this.disposed) return
|
|
184
|
+
this.stop()
|
|
185
|
+
this.unload()
|
|
186
|
+
this.disposed = true
|
|
187
|
+
this.offReduced()
|
|
188
|
+
this.view.off('loaded', this.layout)
|
|
189
|
+
this.view.off('layoutChanged', this.layout)
|
|
190
|
+
this.view.off('unloaded', this.unload)
|
|
191
|
+
Application.off(Application.suspendEvent, this.background)
|
|
192
|
+
Application.off(Application.resumeEvent, this.foreground)
|
|
193
|
+
owners.delete(this.view)
|
|
194
|
+
}
|
|
195
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { isIOS, type View } from '@nativescript/core'
|
|
2
|
+
import type { Track } from '../track.js'
|
|
3
|
+
import type { BlurOptions, BlurSnapshot } from './types.js'
|
|
4
|
+
|
|
5
|
+
export interface BlurPainter {
|
|
6
|
+
paint(amount: number): void
|
|
7
|
+
play(track: Track): void
|
|
8
|
+
control(time: number, paused: boolean): void
|
|
9
|
+
resize(): void
|
|
10
|
+
snapshot(): BlurSnapshot
|
|
11
|
+
dispose(): void
|
|
12
|
+
}
|
|
13
|
+
type Factory = (view: View, options: Required<BlurOptions>) => BlurPainter
|
|
14
|
+
let override: Factory | undefined
|
|
15
|
+
/** Internal seam for lifecycle tests. */
|
|
16
|
+
export function setBlurFactory(value: Factory | undefined) {
|
|
17
|
+
override = value
|
|
18
|
+
}
|
|
19
|
+
export const createBlur: Factory = (view, options) => {
|
|
20
|
+
if (override) return override(view, options)
|
|
21
|
+
let native: {
|
|
22
|
+
paint(value: number): void
|
|
23
|
+
play(program: string): void
|
|
24
|
+
resize(): void
|
|
25
|
+
snapshot(): string
|
|
26
|
+
dispose(): void
|
|
27
|
+
}
|
|
28
|
+
let control: (time: number, paused: boolean) => void
|
|
29
|
+
if (isIOS) {
|
|
30
|
+
if (typeof JoltBlur === 'undefined')
|
|
31
|
+
throw new Error('Rebuild the native app to install animated blur.')
|
|
32
|
+
const effect = JoltBlur.attachOptions(
|
|
33
|
+
view.nativeViewProtected,
|
|
34
|
+
JSON.stringify(options),
|
|
35
|
+
)
|
|
36
|
+
native = effect
|
|
37
|
+
control = (time, paused) => effect.controlPaused(time, paused)
|
|
38
|
+
} else {
|
|
39
|
+
if (
|
|
40
|
+
typeof org === 'undefined' ||
|
|
41
|
+
typeof org.rafaelaugusto.jolt.BlurEffect !== 'function'
|
|
42
|
+
)
|
|
43
|
+
throw new Error('Rebuild the native app to install animated blur.')
|
|
44
|
+
const effect = new org.rafaelaugusto.jolt.BlurEffect(
|
|
45
|
+
view.nativeViewProtected,
|
|
46
|
+
options.radius,
|
|
47
|
+
)
|
|
48
|
+
native = effect
|
|
49
|
+
control = (time, paused) => effect.control(time, paused)
|
|
50
|
+
}
|
|
51
|
+
native.paint(options.amount)
|
|
52
|
+
return {
|
|
53
|
+
paint: (amount) => native.paint(amount),
|
|
54
|
+
play: (track) =>
|
|
55
|
+
native.play(
|
|
56
|
+
JSON.stringify({
|
|
57
|
+
times: track.times,
|
|
58
|
+
values: track.values,
|
|
59
|
+
duration: track.duration,
|
|
60
|
+
delay: track.delay,
|
|
61
|
+
repeat: track.repeat === Infinity ? -1 : track.repeat,
|
|
62
|
+
reverse: track.reverse,
|
|
63
|
+
}),
|
|
64
|
+
),
|
|
65
|
+
control,
|
|
66
|
+
resize: () => native.resize(),
|
|
67
|
+
snapshot: () => JSON.parse(native.snapshot()),
|
|
68
|
+
dispose: () => native.dispose(),
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { PlaybackAnimation } from '../playback.js'
|
|
2
|
+
import type { SpringName, Transition } from '../transition.js'
|
|
3
|
+
|
|
4
|
+
export interface BlurOptions {
|
|
5
|
+
/** Initial intensity, 0..1. Defaults to 0 (clear). */
|
|
6
|
+
amount?: number
|
|
7
|
+
/** Android maximum radius in DIPs, 1..64. Defaults to 24. iOS uses a system material. */
|
|
8
|
+
radius?: number
|
|
9
|
+
/** iOS material. Defaults to system. Android ignores this option. */
|
|
10
|
+
style?: 'system' | 'light' | 'dark'
|
|
11
|
+
}
|
|
12
|
+
export interface BlurSnapshot {
|
|
13
|
+
amount: number
|
|
14
|
+
/** iOS animator fraction or Android radius/maxRadius; 0 for the unsupported fallback. */
|
|
15
|
+
appliedAmount: number
|
|
16
|
+
backend: 'ios-material' | 'android-render-effect' | 'none'
|
|
17
|
+
attached: boolean
|
|
18
|
+
nativeAnimations: number
|
|
19
|
+
frames: number
|
|
20
|
+
width: number
|
|
21
|
+
height: number
|
|
22
|
+
}
|
|
23
|
+
export interface Blur {
|
|
24
|
+
readonly disposed: boolean
|
|
25
|
+
/** Retarget from the displayed amount. One owner per view. */
|
|
26
|
+
animate(amount: number, transition?: Transition | SpringName): PlaybackAnimation
|
|
27
|
+
set(amount: number): void
|
|
28
|
+
stop(): void
|
|
29
|
+
snapshot(): BlurSnapshot
|
|
30
|
+
/** Remove the owned effect and lifecycle listeners. */
|
|
31
|
+
dispose(): void
|
|
32
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
export type SheetSnap = number | `${number}%` | 'content'
|
|
2
|
+
|
|
3
|
+
export interface SheetStop {
|
|
4
|
+
point: SheetSnap
|
|
5
|
+
height: number
|
|
6
|
+
y: number
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface SheetGeometry {
|
|
10
|
+
height: number
|
|
11
|
+
closedY: number
|
|
12
|
+
top: number
|
|
13
|
+
stops: SheetStop[]
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function validateSnaps(points: readonly SheetSnap[]): void {
|
|
17
|
+
if (!Array.isArray(points) || !points.length)
|
|
18
|
+
throw new TypeError('bottomSheet() needs at least one snap point.')
|
|
19
|
+
for (const point of points) {
|
|
20
|
+
if (point === 'content') continue
|
|
21
|
+
if (typeof point === 'number' && Number.isFinite(point) && point > 0) continue
|
|
22
|
+
if (typeof point === 'string' && /^(?:\d+(?:\.\d+)?|\.\d+)%$/.test(point)) {
|
|
23
|
+
const percent = Number.parseFloat(point)
|
|
24
|
+
if (percent > 0 && percent <= 100) continue
|
|
25
|
+
}
|
|
26
|
+
throw new RangeError(
|
|
27
|
+
'Sheet snaps must be positive DIPs, 0–100% (exclusive of 0), or content.',
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
if (new Set(points).size !== points.length)
|
|
31
|
+
throw new RangeError('Sheet snap points must not repeat.')
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** Keyboard overlap is relative to the host, so adjustResize is not subtracted twice. */
|
|
35
|
+
export function sheetGeometry(
|
|
36
|
+
points: readonly SheetSnap[],
|
|
37
|
+
hostHeight: number,
|
|
38
|
+
hostBottom: number,
|
|
39
|
+
windowHeight: number,
|
|
40
|
+
keyboardHeight: number,
|
|
41
|
+
safeTop: number,
|
|
42
|
+
safeBottom: number,
|
|
43
|
+
contentHeight: number,
|
|
44
|
+
): SheetGeometry {
|
|
45
|
+
const top = Math.max(0, safeTop)
|
|
46
|
+
const overlap = Math.max(
|
|
47
|
+
0,
|
|
48
|
+
Math.min(hostHeight, hostBottom - (windowHeight - keyboardHeight)),
|
|
49
|
+
)
|
|
50
|
+
const bottom = Math.max(Math.max(0, safeBottom), overlap)
|
|
51
|
+
const height = Math.max(1, hostHeight - top - bottom)
|
|
52
|
+
const closedY = Math.max(height, hostHeight - top)
|
|
53
|
+
const stops = points.map((point) => {
|
|
54
|
+
const desired =
|
|
55
|
+
point === 'content'
|
|
56
|
+
? contentHeight
|
|
57
|
+
: typeof point === 'number'
|
|
58
|
+
? point
|
|
59
|
+
: (Number.parseFloat(point) / 100) * height
|
|
60
|
+
const visible = Math.max(1, Math.min(height, desired))
|
|
61
|
+
return { point, height: visible, y: height - visible }
|
|
62
|
+
})
|
|
63
|
+
return { height, closedY, top, stops }
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** Projection selects a stop; the native spring retains the actual release velocity. */
|
|
67
|
+
export function releaseStop(
|
|
68
|
+
geometry: SheetGeometry,
|
|
69
|
+
y: number,
|
|
70
|
+
velocity: number,
|
|
71
|
+
dismissible: boolean,
|
|
72
|
+
): SheetStop | undefined {
|
|
73
|
+
const projected = y + Math.max(-4000, Math.min(4000, velocity)) * 0.2
|
|
74
|
+
let distance = dismissible ? Math.abs(projected - geometry.closedY) : Infinity
|
|
75
|
+
let result: SheetStop | undefined
|
|
76
|
+
for (const stop of geometry.stops) {
|
|
77
|
+
const next = Math.abs(projected - stop.y)
|
|
78
|
+
if (next <= distance) {
|
|
79
|
+
distance = next
|
|
80
|
+
result = stop
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return result
|
|
84
|
+
}
|