@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,365 @@
|
|
|
1
|
+
import { Application, GridLayout, ScrollView, Trace, isAndroid } from '@nativescript/core'
|
|
2
|
+
import {
|
|
3
|
+
createGestureDriver,
|
|
4
|
+
type GestureDriver,
|
|
5
|
+
type GestureSettings,
|
|
6
|
+
} from '../gesture-native.js'
|
|
7
|
+
import {
|
|
8
|
+
motionValue,
|
|
9
|
+
springValue,
|
|
10
|
+
type DerivedValue,
|
|
11
|
+
type SpringValueOptions,
|
|
12
|
+
} from '../motion-value.js'
|
|
13
|
+
|
|
14
|
+
/** A GridLayout that provides native gesture dispatch and nested-scroll consumption. */
|
|
15
|
+
export class GestureSurface extends GridLayout {
|
|
16
|
+
override createNativeView() {
|
|
17
|
+
if (isAndroid) {
|
|
18
|
+
if (typeof org.rafaelaugusto.jolt.GestureSurface !== 'function')
|
|
19
|
+
throw new Error('Rebuild the native app to use GestureSurface.')
|
|
20
|
+
return new org.rafaelaugusto.jolt.GestureSurface(this._context)
|
|
21
|
+
}
|
|
22
|
+
return super.createNativeView()
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export interface GesturePosition {
|
|
26
|
+
x: number
|
|
27
|
+
y: number
|
|
28
|
+
scale: number
|
|
29
|
+
rotate: number
|
|
30
|
+
}
|
|
31
|
+
export interface GestureEvent extends GesturePosition {
|
|
32
|
+
velocityX: number
|
|
33
|
+
velocityY: number
|
|
34
|
+
}
|
|
35
|
+
export interface GestureBounds {
|
|
36
|
+
left?: number
|
|
37
|
+
right?: number
|
|
38
|
+
top?: number
|
|
39
|
+
bottom?: number
|
|
40
|
+
}
|
|
41
|
+
export interface GesturesOptions {
|
|
42
|
+
pan?:
|
|
43
|
+
| boolean
|
|
44
|
+
| {
|
|
45
|
+
axis?: 'x' | 'y' | 'both'
|
|
46
|
+
threshold?: number
|
|
47
|
+
failOffset?: number
|
|
48
|
+
bounds?: GestureBounds
|
|
49
|
+
}
|
|
50
|
+
pinch?: boolean | { min?: number; max?: number }
|
|
51
|
+
rotate?: boolean
|
|
52
|
+
initial?: Partial<GesturePosition>
|
|
53
|
+
spring?: Pick<SpringValueOptions, 'stiffness' | 'damping' | 'mass'>
|
|
54
|
+
/** A descendant, vertical NativeScript ScrollView. Other list plugins are not supported. */
|
|
55
|
+
scrollView?: ScrollView
|
|
56
|
+
/** First contact, before pan recognition; useful when a touch interrupts a spring. */
|
|
57
|
+
onContactStart?: (event: GestureEvent) => void
|
|
58
|
+
/** Last contact released or cancelled, including a touch that never becomes a pan. */
|
|
59
|
+
onContactEnd?: (event: GestureEvent) => void
|
|
60
|
+
onStart?: (event: GestureEvent) => void
|
|
61
|
+
onEnd?: (event: GestureEvent) => void
|
|
62
|
+
onCancel?: (event: GestureEvent) => void
|
|
63
|
+
onTap?: (event: GestureEvent) => void
|
|
64
|
+
onDoubleTap?: (event: GestureEvent) => void
|
|
65
|
+
}
|
|
66
|
+
export interface Gestures {
|
|
67
|
+
readonly x: DerivedValue
|
|
68
|
+
readonly y: DerivedValue
|
|
69
|
+
readonly scale: DerivedValue
|
|
70
|
+
readonly rotate: DerivedValue
|
|
71
|
+
readonly position: GesturePosition
|
|
72
|
+
readonly active: boolean
|
|
73
|
+
readonly paused: boolean
|
|
74
|
+
readonly disposed: boolean
|
|
75
|
+
/** Spring toward a new position, carrying the last contact's velocity. */
|
|
76
|
+
settleTo(position: Partial<GesturePosition>): void
|
|
77
|
+
jumpTo(position: Partial<GesturePosition>): void
|
|
78
|
+
updateBounds(bounds: GestureBounds): void
|
|
79
|
+
cancel(): void
|
|
80
|
+
pause(): void
|
|
81
|
+
play(): void
|
|
82
|
+
dispose(): void
|
|
83
|
+
}
|
|
84
|
+
const owners = new WeakMap<GestureSurface, Gestures>()
|
|
85
|
+
const LIMIT = 1e9
|
|
86
|
+
function bounds(input: GestureBounds = {}) {
|
|
87
|
+
if (!input || typeof input !== 'object')
|
|
88
|
+
throw new TypeError('Gesture bounds must be an object.')
|
|
89
|
+
const result = {
|
|
90
|
+
minX: input.left ?? -LIMIT,
|
|
91
|
+
maxX: input.right ?? LIMIT,
|
|
92
|
+
minY: input.top ?? -LIMIT,
|
|
93
|
+
maxY: input.bottom ?? LIMIT,
|
|
94
|
+
}
|
|
95
|
+
if (
|
|
96
|
+
Object.values(result).some((value) => !Number.isFinite(value)) ||
|
|
97
|
+
result.minX > result.maxX ||
|
|
98
|
+
result.minY > result.maxY
|
|
99
|
+
)
|
|
100
|
+
throw new RangeError('Gesture bounds must be finite and ordered.')
|
|
101
|
+
return result
|
|
102
|
+
}
|
|
103
|
+
function settings(options: GesturesOptions): GestureSettings {
|
|
104
|
+
for (const key of ['pan', 'pinch'] as const)
|
|
105
|
+
if (
|
|
106
|
+
options[key] !== undefined &&
|
|
107
|
+
typeof options[key] !== 'boolean' &&
|
|
108
|
+
(!options[key] || typeof options[key] !== 'object')
|
|
109
|
+
)
|
|
110
|
+
throw new TypeError(`Gesture ${key} must be boolean or an options object.`)
|
|
111
|
+
if (options.rotate !== undefined && typeof options.rotate !== 'boolean')
|
|
112
|
+
throw new TypeError('Gesture rotate must be boolean.')
|
|
113
|
+
for (const key of [
|
|
114
|
+
'onStart',
|
|
115
|
+
'onEnd',
|
|
116
|
+
'onCancel',
|
|
117
|
+
'onTap',
|
|
118
|
+
'onDoubleTap',
|
|
119
|
+
'onContactStart',
|
|
120
|
+
'onContactEnd',
|
|
121
|
+
] as const)
|
|
122
|
+
if (options[key] !== undefined && typeof options[key] !== 'function')
|
|
123
|
+
throw new TypeError(`Gesture ${key} must be a function.`)
|
|
124
|
+
const pan = typeof options.pan === 'object' ? options.pan : {}
|
|
125
|
+
const pinch = typeof options.pinch === 'object' ? options.pinch : {}
|
|
126
|
+
const axis = pan.axis ?? 'both'
|
|
127
|
+
if (!['x', 'y', 'both'].includes(axis))
|
|
128
|
+
throw new TypeError('Gesture pan axis must be x, y or both.')
|
|
129
|
+
const result = {
|
|
130
|
+
...bounds(pan.bounds),
|
|
131
|
+
axis: options.pan ? (axis === 'x' ? 1 : axis === 'y' ? 2 : 3) : 0,
|
|
132
|
+
threshold: pan.threshold ?? 8,
|
|
133
|
+
failOffset: pan.failOffset ?? 12,
|
|
134
|
+
pinch: !!options.pinch,
|
|
135
|
+
rotate: !!options.rotate,
|
|
136
|
+
tap: !!options.onTap,
|
|
137
|
+
doubleTap: !!options.onDoubleTap,
|
|
138
|
+
contactEvents: !!(options.onContactStart || options.onContactEnd),
|
|
139
|
+
minScale: pinch.min ?? 0.25,
|
|
140
|
+
maxScale: pinch.max ?? 4,
|
|
141
|
+
}
|
|
142
|
+
if (
|
|
143
|
+
![result.threshold, result.failOffset, result.minScale, result.maxScale].every(
|
|
144
|
+
(value) => Number.isFinite(value) && value > 0,
|
|
145
|
+
) ||
|
|
146
|
+
result.minScale > result.maxScale
|
|
147
|
+
)
|
|
148
|
+
throw new RangeError(
|
|
149
|
+
'Gesture thresholds and scale limits must be positive and ordered.',
|
|
150
|
+
)
|
|
151
|
+
if (
|
|
152
|
+
options.scrollView &&
|
|
153
|
+
(!(options.scrollView instanceof ScrollView) ||
|
|
154
|
+
options.scrollView.orientation !== 'vertical' ||
|
|
155
|
+
result.axis !== 2)
|
|
156
|
+
)
|
|
157
|
+
throw new TypeError('Scroll handoff needs a vertical ScrollView and a y-axis pan.')
|
|
158
|
+
if (
|
|
159
|
+
options.scrollView &&
|
|
160
|
+
(pan.bounds?.top === undefined || pan.bounds?.bottom === undefined)
|
|
161
|
+
)
|
|
162
|
+
throw new TypeError('Scroll handoff needs explicit top and bottom pan bounds.')
|
|
163
|
+
return result
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/** Compose native pan/pinch/rotation and exclusive single/double taps on one surface. */
|
|
167
|
+
export function gestures(
|
|
168
|
+
surface: GestureSurface,
|
|
169
|
+
options: GesturesOptions = {},
|
|
170
|
+
): Gestures {
|
|
171
|
+
if (!(surface instanceof GestureSurface))
|
|
172
|
+
throw new TypeError('gestures() requires a GestureSurface.')
|
|
173
|
+
if (!options || typeof options !== 'object')
|
|
174
|
+
throw new TypeError('Gesture options must be an object.')
|
|
175
|
+
let config = settings(options)
|
|
176
|
+
if (options.scrollView) {
|
|
177
|
+
let ancestor = options.scrollView.parent
|
|
178
|
+
while (ancestor && ancestor !== surface) ancestor = ancestor.parent
|
|
179
|
+
if (ancestor !== surface)
|
|
180
|
+
throw new TypeError('The ScrollView must be inside the GestureSurface.')
|
|
181
|
+
}
|
|
182
|
+
const initial = { x: 0, y: 0, scale: 1, rotate: 0, ...options.initial }
|
|
183
|
+
if (Object.values(initial).some((value) => !Number.isFinite(value)))
|
|
184
|
+
throw new RangeError('Initial gesture values must be finite.')
|
|
185
|
+
if (
|
|
186
|
+
initial.x < config.minX ||
|
|
187
|
+
initial.x > config.maxX ||
|
|
188
|
+
initial.y < config.minY ||
|
|
189
|
+
initial.y > config.maxY ||
|
|
190
|
+
initial.scale < config.minScale ||
|
|
191
|
+
initial.scale > config.maxScale
|
|
192
|
+
)
|
|
193
|
+
throw new RangeError('Initial gesture values must be within their bounds.')
|
|
194
|
+
const keys = ['x', 'y', 'scale', 'rotate'] as const
|
|
195
|
+
const values = keys.map((key) => springValue(motionValue(initial[key]), options.spring))
|
|
196
|
+
let driver: GestureDriver | undefined,
|
|
197
|
+
ended = false,
|
|
198
|
+
held = false,
|
|
199
|
+
suspended = false,
|
|
200
|
+
disposing = false
|
|
201
|
+
const position = (): GesturePosition => ({
|
|
202
|
+
x: values[0]!.get(),
|
|
203
|
+
y: values[1]!.get(),
|
|
204
|
+
scale: values[2]!.get(),
|
|
205
|
+
rotate: values[3]!.get(),
|
|
206
|
+
})
|
|
207
|
+
const callback = (state: number, velocityX: number, velocityY: number) => {
|
|
208
|
+
if (ended) return
|
|
209
|
+
const event = { ...position(), velocityX, velocityY }
|
|
210
|
+
const handler = [
|
|
211
|
+
undefined,
|
|
212
|
+
options.onStart,
|
|
213
|
+
options.onEnd,
|
|
214
|
+
options.onCancel,
|
|
215
|
+
options.onTap,
|
|
216
|
+
options.onDoubleTap,
|
|
217
|
+
options.onContactStart,
|
|
218
|
+
options.onContactEnd,
|
|
219
|
+
][state]
|
|
220
|
+
try {
|
|
221
|
+
handler?.(event)
|
|
222
|
+
} catch (error) {
|
|
223
|
+
Trace.write(
|
|
224
|
+
`Jolt gesture callback failed: ${String(error)}`,
|
|
225
|
+
Trace.categories.Error,
|
|
226
|
+
Trace.messageType.error,
|
|
227
|
+
)
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
const detach = () => {
|
|
231
|
+
const previous = driver
|
|
232
|
+
driver = undefined
|
|
233
|
+
previous?.dispose()
|
|
234
|
+
}
|
|
235
|
+
const refreshEnabled = () =>
|
|
236
|
+
driver?.enabled(
|
|
237
|
+
!held &&
|
|
238
|
+
!suspended &&
|
|
239
|
+
surface.isEnabled !== false &&
|
|
240
|
+
surface.isUserInteractionEnabled !== false,
|
|
241
|
+
)
|
|
242
|
+
const attach = () => {
|
|
243
|
+
if (
|
|
244
|
+
ended ||
|
|
245
|
+
driver ||
|
|
246
|
+
!surface.isLoaded ||
|
|
247
|
+
!surface.nativeViewProtected ||
|
|
248
|
+
(options.scrollView && !options.scrollView.nativeViewProtected)
|
|
249
|
+
)
|
|
250
|
+
return
|
|
251
|
+
try {
|
|
252
|
+
driver = createGestureDriver(surface, options.scrollView, values, config, callback)
|
|
253
|
+
refreshEnabled()
|
|
254
|
+
} catch (error) {
|
|
255
|
+
control.dispose()
|
|
256
|
+
throw error
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
const suspend = () => {
|
|
260
|
+
suspended = true
|
|
261
|
+
driver?.enabled(false)
|
|
262
|
+
}
|
|
263
|
+
const resume = () => {
|
|
264
|
+
suspended = false
|
|
265
|
+
refreshEnabled()
|
|
266
|
+
}
|
|
267
|
+
const move = (next: Partial<GesturePosition>, animated: boolean) => {
|
|
268
|
+
if (ended) return
|
|
269
|
+
if (
|
|
270
|
+
!next ||
|
|
271
|
+
typeof next !== 'object' ||
|
|
272
|
+
Object.entries(next).some(
|
|
273
|
+
([key, value]) =>
|
|
274
|
+
!keys.includes(key as (typeof keys)[number]) || !Number.isFinite(value),
|
|
275
|
+
)
|
|
276
|
+
)
|
|
277
|
+
throw new TypeError(
|
|
278
|
+
'Gesture positions must contain finite x, y, scale or rotate values.',
|
|
279
|
+
)
|
|
280
|
+
if (!driver)
|
|
281
|
+
throw new Error('Load the GestureSurface before moving its gesture values.')
|
|
282
|
+
const target = { ...position(), ...next }
|
|
283
|
+
driver.settle(
|
|
284
|
+
keys.map((key) => target[key]),
|
|
285
|
+
animated,
|
|
286
|
+
)
|
|
287
|
+
}
|
|
288
|
+
const control: Gestures = {
|
|
289
|
+
x: values[0]!,
|
|
290
|
+
y: values[1]!,
|
|
291
|
+
scale: values[2]!,
|
|
292
|
+
rotate: values[3]!,
|
|
293
|
+
get position() {
|
|
294
|
+
return position()
|
|
295
|
+
},
|
|
296
|
+
get active() {
|
|
297
|
+
return driver?.active ?? false
|
|
298
|
+
},
|
|
299
|
+
get paused() {
|
|
300
|
+
return held
|
|
301
|
+
},
|
|
302
|
+
get disposed() {
|
|
303
|
+
return ended
|
|
304
|
+
},
|
|
305
|
+
settleTo: (next) => move(next, true),
|
|
306
|
+
jumpTo: (next) => move(next, false),
|
|
307
|
+
updateBounds(next) {
|
|
308
|
+
config = {
|
|
309
|
+
...config,
|
|
310
|
+
...bounds({
|
|
311
|
+
left: config.minX,
|
|
312
|
+
right: config.maxX,
|
|
313
|
+
top: config.minY,
|
|
314
|
+
bottom: config.maxY,
|
|
315
|
+
...next,
|
|
316
|
+
}),
|
|
317
|
+
}
|
|
318
|
+
driver?.bounds(config)
|
|
319
|
+
},
|
|
320
|
+
cancel() {
|
|
321
|
+
driver?.cancel()
|
|
322
|
+
},
|
|
323
|
+
pause() {
|
|
324
|
+
held = true
|
|
325
|
+
driver?.enabled(false)
|
|
326
|
+
},
|
|
327
|
+
play() {
|
|
328
|
+
held = false
|
|
329
|
+
refreshEnabled()
|
|
330
|
+
},
|
|
331
|
+
dispose() {
|
|
332
|
+
if (ended || disposing) return
|
|
333
|
+
disposing = true
|
|
334
|
+
detach()
|
|
335
|
+
ended = true
|
|
336
|
+
surface.off('loaded', attach)
|
|
337
|
+
surface.off('unloaded', detach)
|
|
338
|
+
surface.off('isEnabledChange', refreshEnabled)
|
|
339
|
+
surface.off('isUserInteractionEnabledChange', refreshEnabled)
|
|
340
|
+
options.scrollView?.off('loaded', attach)
|
|
341
|
+
options.scrollView?.off('unloaded', detach)
|
|
342
|
+
Application.off(Application.suspendEvent, suspend)
|
|
343
|
+
Application.off(Application.resumeEvent, resume)
|
|
344
|
+
values.forEach((value) => value.dispose())
|
|
345
|
+
if (owners.get(surface) === control) owners.delete(surface)
|
|
346
|
+
},
|
|
347
|
+
}
|
|
348
|
+
owners.get(surface)?.dispose()
|
|
349
|
+
owners.set(surface, control)
|
|
350
|
+
surface.on('loaded', attach)
|
|
351
|
+
surface.on('unloaded', detach)
|
|
352
|
+
surface.on('isEnabledChange', refreshEnabled)
|
|
353
|
+
surface.on('isUserInteractionEnabledChange', refreshEnabled)
|
|
354
|
+
options.scrollView?.on('loaded', attach)
|
|
355
|
+
options.scrollView?.on('unloaded', detach)
|
|
356
|
+
Application.on(Application.suspendEvent, suspend)
|
|
357
|
+
Application.on(Application.resumeEvent, resume)
|
|
358
|
+
try {
|
|
359
|
+
attach()
|
|
360
|
+
} catch (error) {
|
|
361
|
+
control.dispose()
|
|
362
|
+
throw error
|
|
363
|
+
}
|
|
364
|
+
return control
|
|
365
|
+
}
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { Color, GridLayout, View, isIOS, type ViewBase } from '@nativescript/core'
|
|
2
|
+
import { parseColor, type ColorValue } from '../color.js'
|
|
3
|
+
|
|
4
|
+
export type GlassBackend = 'liquid-glass' | 'blur' | 'none'
|
|
5
|
+
export type GlassStyle = 'regular' | 'clear'
|
|
6
|
+
export type GlassFallback = 'blur' | 'none'
|
|
7
|
+
export type GlassRadius = number | 'capsule'
|
|
8
|
+
|
|
9
|
+
/** Runtime capability, including the NativeScript metadata built into the app. */
|
|
10
|
+
export function supportsLiquidGlass(): boolean {
|
|
11
|
+
return (
|
|
12
|
+
isIOS &&
|
|
13
|
+
parseInt(UIDevice.currentDevice.systemVersion, 10) >= 26 &&
|
|
14
|
+
typeof UIGlassEffect !== 'undefined' &&
|
|
15
|
+
typeof UIGlassContainerEffect !== 'undefined'
|
|
16
|
+
)
|
|
17
|
+
}
|
|
18
|
+
function bounded(value: number | string, name: string, maximum: number) {
|
|
19
|
+
const number = typeof value === 'string' && value.trim() ? Number(value) : value
|
|
20
|
+
if (
|
|
21
|
+
typeof number !== 'number' ||
|
|
22
|
+
!Number.isFinite(number) ||
|
|
23
|
+
number < 0 ||
|
|
24
|
+
number > maximum
|
|
25
|
+
)
|
|
26
|
+
throw new RangeError(`${name} must be within 0..${maximum}.`)
|
|
27
|
+
return number
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** Shared native child routing. UIKit effect content belongs inside contentView. */
|
|
31
|
+
abstract class GlassLayout extends GridLayout {
|
|
32
|
+
private materialUnloaded = false
|
|
33
|
+
protected abstract configureMaterial(): void
|
|
34
|
+
protected get materialView(): UIVisualEffectView | undefined {
|
|
35
|
+
return isIOS && !this.materialUnloaded
|
|
36
|
+
? (this.nativeViewProtected as UIVisualEffectView | undefined)
|
|
37
|
+
: undefined
|
|
38
|
+
}
|
|
39
|
+
override createNativeView() {
|
|
40
|
+
return isIOS
|
|
41
|
+
? UIVisualEffectView.alloc().initWithEffect(null)
|
|
42
|
+
: super.createNativeView()
|
|
43
|
+
}
|
|
44
|
+
override initNativeView() {
|
|
45
|
+
super.initNativeView()
|
|
46
|
+
this.configureMaterial()
|
|
47
|
+
}
|
|
48
|
+
override onLoaded() {
|
|
49
|
+
this.materialUnloaded = false
|
|
50
|
+
super.onLoaded()
|
|
51
|
+
this.configureMaterial()
|
|
52
|
+
}
|
|
53
|
+
override onUnloaded() {
|
|
54
|
+
this.materialUnloaded = true
|
|
55
|
+
if (isIOS && this.nativeViewProtected)
|
|
56
|
+
(this.nativeViewProtected as UIVisualEffectView).effect = null
|
|
57
|
+
super.onUnloaded()
|
|
58
|
+
}
|
|
59
|
+
override disposeNativeView() {
|
|
60
|
+
this.materialUnloaded = true
|
|
61
|
+
if (isIOS && this.nativeViewProtected)
|
|
62
|
+
(this.nativeViewProtected as UIVisualEffectView).effect = null
|
|
63
|
+
super.disposeNativeView()
|
|
64
|
+
}
|
|
65
|
+
override _addViewToNativeVisualTree(child: ViewBase, atIndex?: number): boolean {
|
|
66
|
+
if (!isIOS) return super._addViewToNativeVisualTree(child, atIndex)
|
|
67
|
+
View.prototype._addViewToNativeVisualTree.call(this, child, atIndex)
|
|
68
|
+
const parent = (this.nativeViewProtected as UIVisualEffectView | undefined)
|
|
69
|
+
?.contentView
|
|
70
|
+
const native = child.nativeViewProtected as UIView | undefined
|
|
71
|
+
if (!parent || !native) return false
|
|
72
|
+
const index = Math.max(
|
|
73
|
+
0,
|
|
74
|
+
Math.min(atIndex ?? parent.subviews.count, parent.subviews.count),
|
|
75
|
+
)
|
|
76
|
+
parent.insertSubviewAtIndex(native, index)
|
|
77
|
+
const shadow = (native as UIView & { outerShadowContainerLayer?: CALayer })
|
|
78
|
+
.outerShadowContainerLayer
|
|
79
|
+
if (shadow && !shadow.superlayer)
|
|
80
|
+
parent.layer.insertSublayerBelow(shadow, native.layer)
|
|
81
|
+
return true
|
|
82
|
+
}
|
|
83
|
+
override _removeViewFromNativeVisualTree(child: ViewBase) {
|
|
84
|
+
if (!isIOS) {
|
|
85
|
+
super._removeViewFromNativeVisualTree(child)
|
|
86
|
+
return
|
|
87
|
+
}
|
|
88
|
+
View.prototype._removeViewFromNativeVisualTree.call(this, child)
|
|
89
|
+
const native = child.nativeViewProtected as
|
|
90
|
+
(UIView & { outerShadowContainerLayer?: CALayer }) | undefined
|
|
91
|
+
native?.outerShadowContainerLayer?.removeFromSuperlayer()
|
|
92
|
+
native?.removeFromSuperview()
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** GridLayout whose direct GlassView children share the native iOS 26 glass renderer. */
|
|
97
|
+
export class GlassContainer extends GlassLayout {
|
|
98
|
+
private spacing = 16
|
|
99
|
+
/** Distance in DIPs at which nearby native glass elements begin to blend. */
|
|
100
|
+
get glassSpacing(): number {
|
|
101
|
+
return this.spacing
|
|
102
|
+
}
|
|
103
|
+
set glassSpacing(value: number | string) {
|
|
104
|
+
this.spacing = bounded(value, 'glassSpacing', 200)
|
|
105
|
+
this.configureMaterial()
|
|
106
|
+
}
|
|
107
|
+
get glassBackend(): GlassBackend {
|
|
108
|
+
return supportsLiquidGlass() ? 'liquid-glass' : 'none'
|
|
109
|
+
}
|
|
110
|
+
protected configureMaterial() {
|
|
111
|
+
const view = this.materialView
|
|
112
|
+
if (!view) return
|
|
113
|
+
if (supportsLiquidGlass()) {
|
|
114
|
+
const effect = UIGlassContainerEffect.new()
|
|
115
|
+
effect.spacing = this.spacing
|
|
116
|
+
view.effect = effect
|
|
117
|
+
} else view.effect = null
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/** A regular NativeScript GridLayout with native glass behind its content. */
|
|
122
|
+
export class GlassView extends GlassLayout {
|
|
123
|
+
private materialStyle: GlassStyle = 'regular'
|
|
124
|
+
private fallback: GlassFallback = 'blur'
|
|
125
|
+
private radius: GlassRadius = 'capsule'
|
|
126
|
+
private tint?: number
|
|
127
|
+
private interactive = false
|
|
128
|
+
get glassStyle() {
|
|
129
|
+
return this.materialStyle
|
|
130
|
+
}
|
|
131
|
+
set glassStyle(value: GlassStyle) {
|
|
132
|
+
if (!['regular', 'clear'].includes(value))
|
|
133
|
+
throw new TypeError('glassStyle must be regular or clear.')
|
|
134
|
+
this.materialStyle = value
|
|
135
|
+
this.configureMaterial()
|
|
136
|
+
}
|
|
137
|
+
get glassFallback() {
|
|
138
|
+
return this.fallback
|
|
139
|
+
}
|
|
140
|
+
set glassFallback(value: GlassFallback) {
|
|
141
|
+
if (!['blur', 'none'].includes(value))
|
|
142
|
+
throw new TypeError('glassFallback must be blur or none.')
|
|
143
|
+
this.fallback = value
|
|
144
|
+
this.configureMaterial()
|
|
145
|
+
}
|
|
146
|
+
get glassRadius(): GlassRadius {
|
|
147
|
+
return this.radius
|
|
148
|
+
}
|
|
149
|
+
set glassRadius(value: GlassRadius | string) {
|
|
150
|
+
this.radius = value === 'capsule' ? value : bounded(value, 'glassRadius', 1000)
|
|
151
|
+
this.configureMaterial()
|
|
152
|
+
}
|
|
153
|
+
get glassTint(): number | undefined {
|
|
154
|
+
return this.tint
|
|
155
|
+
}
|
|
156
|
+
set glassTint(value: ColorValue | undefined | null) {
|
|
157
|
+
this.tint = value == null ? undefined : parseColor(value)
|
|
158
|
+
this.configureMaterial()
|
|
159
|
+
}
|
|
160
|
+
get glassInteractive(): boolean {
|
|
161
|
+
return this.interactive
|
|
162
|
+
}
|
|
163
|
+
set glassInteractive(value: boolean | string) {
|
|
164
|
+
if (![true, false, 'true', 'false'].includes(value))
|
|
165
|
+
throw new TypeError('glassInteractive must be boolean.')
|
|
166
|
+
this.interactive = value === true || value === 'true'
|
|
167
|
+
this.configureMaterial()
|
|
168
|
+
}
|
|
169
|
+
get glassBackend(): GlassBackend {
|
|
170
|
+
return supportsLiquidGlass()
|
|
171
|
+
? 'liquid-glass'
|
|
172
|
+
: isIOS && this.fallback === 'blur'
|
|
173
|
+
? 'blur'
|
|
174
|
+
: 'none'
|
|
175
|
+
}
|
|
176
|
+
protected configureMaterial() {
|
|
177
|
+
const view = this.materialView
|
|
178
|
+
if (!view) return
|
|
179
|
+
if (supportsLiquidGlass()) {
|
|
180
|
+
const effect = UIGlassEffect.effectWithStyle(
|
|
181
|
+
this.materialStyle === 'clear' ? 1 /* clear */ : 0 /* regular */,
|
|
182
|
+
)
|
|
183
|
+
effect.interactive = this.interactive
|
|
184
|
+
effect.tintColor = this.tint === undefined ? null : new Color(this.tint).ios
|
|
185
|
+
view.effect = effect
|
|
186
|
+
view.cornerConfiguration =
|
|
187
|
+
this.radius === 'capsule'
|
|
188
|
+
? UICornerConfiguration.capsuleConfiguration()
|
|
189
|
+
: UICornerConfiguration.configurationWithUniformRadius(
|
|
190
|
+
UICornerRadius.fixedRadius(this.radius),
|
|
191
|
+
)
|
|
192
|
+
} else {
|
|
193
|
+
view.effect =
|
|
194
|
+
this.fallback === 'blur'
|
|
195
|
+
? UIBlurEffect.effectWithStyle(6 /* system material */)
|
|
196
|
+
: null
|
|
197
|
+
this.updateFallbackCorners()
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
private updateFallbackCorners() {
|
|
201
|
+
if (!isIOS || supportsLiquidGlass() || !this.nativeViewProtected) return
|
|
202
|
+
const view = this.nativeViewProtected as UIVisualEffectView
|
|
203
|
+
view.layer.cornerRadius =
|
|
204
|
+
this.radius === 'capsule'
|
|
205
|
+
? Math.min(view.bounds.size.width, view.bounds.size.height) / 2
|
|
206
|
+
: this.radius
|
|
207
|
+
view.clipsToBounds = true
|
|
208
|
+
}
|
|
209
|
+
override _redrawNativeBackground(value: any) {
|
|
210
|
+
super._redrawNativeBackground(value)
|
|
211
|
+
// Core redraws CSS corners after onLayout; restore the material's own shape.
|
|
212
|
+
this.updateFallbackCorners()
|
|
213
|
+
}
|
|
214
|
+
override onLayout(left: number, top: number, right: number, bottom: number) {
|
|
215
|
+
super.onLayout(left, top, right, bottom)
|
|
216
|
+
this.updateFallbackCorners()
|
|
217
|
+
}
|
|
218
|
+
}
|