@rafaelaugusto/jolt 0.1.0-beta.8 → 0.1.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +136 -15
- package/dist/animate.d.ts +25 -4
- package/dist/animate.d.ts.map +1 -1
- package/dist/animate.js +67 -26
- package/dist/animate.js.map +1 -1
- package/dist/blur/index.d.ts +6 -0
- package/dist/blur/index.d.ts.map +1 -0
- package/dist/blur/index.js +196 -0
- package/dist/blur/index.js.map +1 -0
- package/dist/blur/native.d.ts +17 -0
- package/dist/blur/native.d.ts.map +1 -0
- package/dist/blur/native.js +44 -0
- package/dist/blur/native.js.map +1 -0
- package/dist/blur/types.d.ts +32 -0
- package/dist/blur/types.d.ts.map +1 -0
- package/dist/blur/types.js +2 -0
- package/dist/blur/types.js.map +1 -0
- package/dist/bottom-sheet/geometry.d.ts +18 -0
- package/dist/bottom-sheet/geometry.d.ts.map +1 -0
- package/dist/bottom-sheet/geometry.js +51 -0
- package/dist/bottom-sheet/geometry.js.map +1 -0
- package/dist/bottom-sheet/index.d.ts +56 -0
- package/dist/bottom-sheet/index.d.ts.map +1 -0
- package/dist/bottom-sheet/index.js +462 -0
- package/dist/bottom-sheet/index.js.map +1 -0
- package/dist/bottom-sheet/native.d.ts +11 -0
- package/dist/bottom-sheet/native.d.ts.map +1 -0
- package/dist/bottom-sheet/native.js +173 -0
- package/dist/bottom-sheet/native.js.map +1 -0
- package/dist/config.d.ts +9 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +40 -1
- package/dist/config.js.map +1 -1
- package/dist/decay.d.ts +1 -0
- package/dist/decay.d.ts.map +1 -1
- package/dist/decay.js +7 -0
- package/dist/decay.js.map +1 -1
- package/dist/drag-physics.d.ts +6 -1
- package/dist/drag-physics.d.ts.map +1 -1
- package/dist/drag.d.ts +17 -3
- package/dist/drag.d.ts.map +1 -1
- package/dist/drag.js +34 -11
- package/dist/drag.js.map +1 -1
- package/dist/driver/android-gradient.d.ts +5 -0
- package/dist/driver/android-gradient.d.ts.map +1 -0
- package/dist/driver/android-gradient.js +99 -0
- package/dist/driver/android-gradient.js.map +1 -0
- package/dist/driver/android-particles.d.ts +6 -0
- package/dist/driver/android-particles.d.ts.map +1 -0
- package/dist/driver/android-particles.js +93 -0
- package/dist/driver/android-particles.js.map +1 -0
- package/dist/driver/android.d.ts.map +1 -1
- package/dist/driver/android.js +67 -1
- package/dist/driver/android.js.map +1 -1
- package/dist/driver/frame.d.ts +3 -0
- package/dist/driver/frame.d.ts.map +1 -0
- package/dist/driver/frame.js +7 -0
- package/dist/driver/frame.js.map +1 -0
- package/dist/driver/index.d.ts +14 -0
- package/dist/driver/index.d.ts.map +1 -1
- package/dist/driver/index.js.map +1 -1
- package/dist/driver/ios-gradient.d.ts +5 -0
- package/dist/driver/ios-gradient.d.ts.map +1 -0
- package/dist/driver/ios-gradient.js +131 -0
- package/dist/driver/ios-gradient.js.map +1 -0
- package/dist/driver/ios-layout.d.ts +9 -0
- package/dist/driver/ios-layout.d.ts.map +1 -0
- package/dist/driver/ios-layout.js +52 -0
- package/dist/driver/ios-layout.js.map +1 -0
- package/dist/driver/ios-scroll-delegate.d.ts +4 -0
- package/dist/driver/ios-scroll-delegate.d.ts.map +1 -0
- package/dist/driver/ios-scroll-delegate.js +26 -0
- package/dist/driver/ios-scroll-delegate.js.map +1 -0
- package/dist/driver/ios.d.ts.map +1 -1
- package/dist/driver/ios.js +57 -1
- package/dist/driver/ios.js.map +1 -1
- package/dist/easing.d.ts +3 -1
- package/dist/easing.d.ts.map +1 -1
- package/dist/easing.js +18 -1
- package/dist/easing.js.map +1 -1
- package/dist/engine.d.ts +35 -2
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +211 -42
- package/dist/engine.js.map +1 -1
- package/dist/gesture-native.d.ts +28 -0
- package/dist/gesture-native.d.ts.map +1 -0
- package/dist/gesture-native.js +61 -0
- package/dist/gesture-native.js.map +1 -0
- package/dist/gestures/index.d.ts +69 -0
- package/dist/gestures/index.d.ts.map +1 -0
- package/dist/gestures/index.js +262 -0
- package/dist/gestures/index.js.map +1 -0
- package/dist/glass/index.d.ts +55 -0
- package/dist/glass/index.d.ts.map +1 -0
- package/dist/glass/index.js +205 -0
- package/dist/glass/index.js.map +1 -0
- package/dist/gradient-binding.d.ts +38 -0
- package/dist/gradient-binding.d.ts.map +1 -0
- package/dist/gradient-binding.js +128 -0
- package/dist/gradient-binding.js.map +1 -0
- package/dist/gradient.d.ts +105 -0
- package/dist/gradient.d.ts.map +1 -0
- package/dist/gradient.js +514 -0
- package/dist/gradient.js.map +1 -0
- package/dist/gravity.d.ts +13 -0
- package/dist/gravity.d.ts.map +1 -0
- package/dist/gravity.js +84 -0
- package/dist/gravity.js.map +1 -0
- package/dist/haptics.d.ts.map +1 -1
- package/dist/haptics.js +101 -28
- package/dist/haptics.js.map +1 -1
- package/dist/image-effect.d.ts +1 -0
- package/dist/image-effect.d.ts.map +1 -1
- package/dist/image-effect.js +10 -2
- package/dist/image-effect.js.map +1 -1
- package/dist/index.d.ts +21 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -4
- package/dist/index.js.map +1 -1
- package/dist/inspector/index.d.ts +86 -0
- package/dist/inspector/index.d.ts.map +1 -0
- package/dist/inspector/index.js +419 -0
- package/dist/inspector/index.js.map +1 -0
- package/dist/inspector/plot.d.ts +4 -0
- package/dist/inspector/plot.d.ts.map +1 -0
- package/dist/inspector/plot.js +23 -0
- package/dist/inspector/plot.js.map +1 -0
- package/dist/inspector/probe.d.ts +19 -0
- package/dist/inspector/probe.d.ts.map +1 -0
- package/dist/inspector/probe.js +37 -0
- package/dist/inspector/probe.js.map +1 -0
- package/dist/inspector/tuning.d.ts +19 -0
- package/dist/inspector/tuning.d.ts.map +1 -0
- package/dist/inspector/tuning.js +37 -0
- package/dist/inspector/tuning.js.map +1 -0
- package/dist/interactive-navigation/index.d.ts +44 -0
- package/dist/interactive-navigation/index.d.ts.map +1 -0
- package/dist/interactive-navigation/index.js +314 -0
- package/dist/interactive-navigation/index.js.map +1 -0
- package/dist/keyboard.d.ts +24 -0
- package/dist/keyboard.d.ts.map +1 -1
- package/dist/keyboard.js +199 -6
- package/dist/keyboard.js.map +1 -1
- package/dist/layout.d.ts +13 -0
- package/dist/layout.d.ts.map +1 -0
- package/dist/layout.js +348 -0
- package/dist/layout.js.map +1 -0
- package/dist/live-spring-driver.d.ts +52 -0
- package/dist/live-spring-driver.d.ts.map +1 -0
- package/dist/live-spring-driver.js +104 -0
- package/dist/live-spring-driver.js.map +1 -0
- package/dist/mixer.d.ts +55 -0
- package/dist/mixer.d.ts.map +1 -0
- package/dist/mixer.js +278 -0
- package/dist/mixer.js.map +1 -0
- package/dist/motion-scope.d.ts +10 -2
- package/dist/motion-scope.d.ts.map +1 -1
- package/dist/motion-scope.js +30 -3
- package/dist/motion-scope.js.map +1 -1
- package/dist/motion-states.d.ts +19 -7
- package/dist/motion-states.d.ts.map +1 -1
- package/dist/motion-states.js +116 -26
- package/dist/motion-states.js.map +1 -1
- package/dist/motion-value.d.ts +227 -0
- package/dist/motion-value.d.ts.map +1 -0
- package/dist/motion-value.js +1074 -0
- package/dist/motion-value.js.map +1 -0
- package/dist/native/index.d.ts +10 -0
- package/dist/native/index.d.ts.map +1 -0
- package/dist/native/index.js +6 -0
- package/dist/native/index.js.map +1 -0
- package/dist/native-properties.d.ts +28 -0
- package/dist/native-properties.d.ts.map +1 -0
- package/dist/native-properties.js +154 -0
- package/dist/native-properties.js.map +1 -0
- package/dist/native-property-driver.d.ts +19 -0
- package/dist/native-property-driver.d.ts.map +1 -0
- package/dist/native-property-driver.js +69 -0
- package/dist/native-property-driver.js.map +1 -0
- package/dist/native-property.d.ts +37 -0
- package/dist/native-property.d.ts.map +1 -0
- package/dist/native-property.js +285 -0
- package/dist/native-property.js.map +1 -0
- package/dist/particles.d.ts +5 -2
- package/dist/particles.d.ts.map +1 -1
- package/dist/particles.js +16 -10
- package/dist/particles.js.map +1 -1
- package/dist/path.d.ts.map +1 -1
- package/dist/path.js +2 -2
- package/dist/path.js.map +1 -1
- package/dist/physics/index.d.ts +116 -0
- package/dist/physics/index.d.ts.map +1 -0
- package/dist/physics/index.js +306 -0
- package/dist/physics/index.js.map +1 -0
- package/dist/physics/native.d.ts +53 -0
- package/dist/physics/native.d.ts.map +1 -0
- package/dist/physics/native.js +58 -0
- package/dist/physics/native.js.map +1 -0
- package/dist/playback-group.d.ts.map +1 -1
- package/dist/playback-group.js +17 -1
- package/dist/playback-group.js.map +1 -1
- package/dist/playback.d.ts +15 -0
- package/dist/playback.d.ts.map +1 -1
- package/dist/playback.js +23 -0
- package/dist/playback.js.map +1 -1
- package/dist/predictive-back/index.d.ts +45 -0
- package/dist/predictive-back/index.d.ts.map +1 -0
- package/dist/predictive-back/index.js +220 -0
- package/dist/predictive-back/index.js.map +1 -0
- package/dist/predictive-back/presentation.d.ts +4 -0
- package/dist/predictive-back/presentation.d.ts.map +1 -0
- package/dist/predictive-back/presentation.js +3 -0
- package/dist/predictive-back/presentation.js.map +1 -0
- package/dist/reorder/handle.d.ts +6 -0
- package/dist/reorder/handle.d.ts.map +1 -0
- package/dist/reorder/handle.js +10 -0
- package/dist/reorder/handle.js.map +1 -0
- package/dist/reorder/index.d.ts +10 -0
- package/dist/reorder/index.d.ts.map +1 -0
- package/dist/reorder/index.js +233 -0
- package/dist/reorder/index.js.map +1 -0
- package/dist/reorder/list-view.d.ts +5 -0
- package/dist/reorder/list-view.d.ts.map +1 -0
- package/dist/reorder/list-view.js +238 -0
- package/dist/reorder/list-view.js.map +1 -0
- package/dist/reorder/model.d.ts +6 -0
- package/dist/reorder/model.d.ts.map +1 -0
- package/dist/reorder/model.js +30 -0
- package/dist/reorder/model.js.map +1 -0
- package/dist/reorder/surface.d.ts +6 -0
- package/dist/reorder/surface.d.ts.map +1 -0
- package/dist/reorder/surface.js +10 -0
- package/dist/reorder/surface.js.map +1 -0
- package/dist/reorder/types.d.ts +92 -0
- package/dist/reorder/types.d.ts.map +1 -0
- package/dist/reorder/types.js +2 -0
- package/dist/reorder/types.js.map +1 -0
- package/dist/sampling.d.ts +35 -0
- package/dist/sampling.d.ts.map +1 -0
- package/dist/sampling.js +123 -0
- package/dist/sampling.js.map +1 -0
- package/dist/scene-appearance.d.ts +14 -0
- package/dist/scene-appearance.d.ts.map +1 -0
- package/dist/scene-appearance.js +68 -0
- package/dist/scene-appearance.js.map +1 -0
- package/dist/scene-camera.d.ts +5 -0
- package/dist/scene-camera.d.ts.map +1 -0
- package/dist/scene-camera.js +23 -0
- package/dist/scene-camera.js.map +1 -0
- package/dist/scene-shader.d.ts +18 -0
- package/dist/scene-shader.d.ts.map +1 -0
- package/dist/scene-shader.js +76 -0
- package/dist/scene-shader.js.map +1 -0
- package/dist/scroll-header/geometry.d.ts +18 -0
- package/dist/scroll-header/geometry.d.ts.map +1 -0
- package/dist/scroll-header/geometry.js +46 -0
- package/dist/scroll-header/geometry.js.map +1 -0
- package/dist/scroll-header/index.d.ts +48 -0
- package/dist/scroll-header/index.d.ts.map +1 -0
- package/dist/scroll-header/index.js +373 -0
- package/dist/scroll-header/index.js.map +1 -0
- package/dist/scroll-header/native.d.ts +28 -0
- package/dist/scroll-header/native.d.ts.map +1 -0
- package/dist/scroll-header/native.js +43 -0
- package/dist/scroll-header/native.js.map +1 -0
- package/dist/sensors/index.d.ts +69 -0
- package/dist/sensors/index.d.ts.map +1 -0
- package/dist/sensors/index.js +149 -0
- package/dist/sensors/index.js.map +1 -0
- package/dist/sensors/native.d.ts +20 -0
- package/dist/sensors/native.d.ts.map +1 -0
- package/dist/sensors/native.js +48 -0
- package/dist/sensors/native.js.map +1 -0
- package/dist/sequence.d.ts +24 -0
- package/dist/sequence.d.ts.map +1 -1
- package/dist/sequence.js +181 -19
- package/dist/sequence.js.map +1 -1
- package/dist/shapes/android.d.ts +3 -0
- package/dist/shapes/android.d.ts.map +1 -0
- package/dist/shapes/android.js +51 -0
- package/dist/shapes/android.js.map +1 -0
- package/dist/shapes/index.d.ts +6 -0
- package/dist/shapes/index.d.ts.map +1 -0
- package/dist/shapes/index.js +238 -0
- package/dist/shapes/index.js.map +1 -0
- package/dist/shapes/ios.d.ts +3 -0
- package/dist/shapes/ios.d.ts.map +1 -0
- package/dist/shapes/ios.js +164 -0
- package/dist/shapes/ios.js.map +1 -0
- package/dist/shapes/native.d.ts +18 -0
- package/dist/shapes/native.d.ts.map +1 -0
- package/dist/shapes/native.js +10 -0
- package/dist/shapes/native.js.map +1 -0
- package/dist/shapes/path.d.ts +10 -0
- package/dist/shapes/path.d.ts.map +1 -0
- package/dist/shapes/path.js +106 -0
- package/dist/shapes/path.js.map +1 -0
- package/dist/shapes/types.d.ts +55 -0
- package/dist/shapes/types.d.ts.map +1 -0
- package/dist/shapes/types.js +11 -0
- package/dist/shapes/types.js.map +1 -0
- package/dist/shared-layout/index.d.ts +40 -0
- package/dist/shared-layout/index.d.ts.map +1 -0
- package/dist/shared-layout/index.js +267 -0
- package/dist/shared-layout/index.js.map +1 -0
- package/dist/shared-layout/native.d.ts +15 -0
- package/dist/shared-layout/native.d.ts.map +1 -0
- package/dist/shared-layout/native.js +79 -0
- package/dist/shared-layout/native.js.map +1 -0
- package/dist/shared-layout/timing.d.ts +9 -0
- package/dist/shared-layout/timing.d.ts.map +1 -0
- package/dist/shared-layout/timing.js +68 -0
- package/dist/shared-layout/timing.js.map +1 -0
- package/dist/shared-navigation/entry.d.ts +51 -0
- package/dist/shared-navigation/entry.d.ts.map +1 -0
- package/dist/shared-navigation/entry.js +619 -0
- package/dist/shared-navigation/entry.js.map +1 -0
- package/dist/shared-navigation/index.d.ts +58 -0
- package/dist/shared-navigation/index.d.ts.map +1 -0
- package/dist/shared-navigation/index.js +318 -0
- package/dist/shared-navigation/index.js.map +1 -0
- package/dist/shared-navigation/return-signal.d.ts +16 -0
- package/dist/shared-navigation/return-signal.d.ts.map +1 -0
- package/dist/shared-navigation/return-signal.js +35 -0
- package/dist/shared-navigation/return-signal.js.map +1 -0
- package/dist/shared-navigation/return-target.d.ts +32 -0
- package/dist/shared-navigation/return-target.d.ts.map +1 -0
- package/dist/shared-navigation/return-target.js +168 -0
- package/dist/shared-navigation/return-target.js.map +1 -0
- package/dist/shared-navigation/scope.d.ts +4 -0
- package/dist/shared-navigation/scope.d.ts.map +1 -0
- package/dist/shared-navigation/scope.js +2 -0
- package/dist/shared-navigation/scope.js.map +1 -0
- package/dist/shared-navigation/targets.d.ts +6 -0
- package/dist/shared-navigation/targets.d.ts.map +1 -0
- package/dist/shared-navigation/targets.js +36 -0
- package/dist/shared-navigation/targets.js.map +1 -0
- package/dist/size-layout.d.ts +19 -0
- package/dist/size-layout.d.ts.map +1 -0
- package/dist/size-layout.js +216 -0
- package/dist/size-layout.js.map +1 -0
- package/dist/size.d.ts +19 -0
- package/dist/size.d.ts.map +1 -0
- package/dist/size.js +251 -0
- package/dist/size.js.map +1 -0
- package/dist/spring.d.ts +2 -0
- package/dist/spring.d.ts.map +1 -1
- package/dist/spring.js +11 -0
- package/dist/spring.js.map +1 -1
- package/dist/svg-path.d.ts +18 -0
- package/dist/svg-path.d.ts.map +1 -1
- package/dist/svg-path.js +3 -2
- package/dist/svg-path.js.map +1 -1
- package/dist/testing/clock.d.ts +40 -0
- package/dist/testing/clock.d.ts.map +1 -0
- package/dist/testing/clock.js +116 -0
- package/dist/testing/clock.js.map +1 -0
- package/dist/testing/handoff-recorder.d.ts +8 -0
- package/dist/testing/handoff-recorder.d.ts.map +1 -0
- package/dist/testing/handoff-recorder.js +77 -0
- package/dist/testing/handoff-recorder.js.map +1 -0
- package/dist/testing/index.d.ts +5 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +5 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/native.d.ts +46 -0
- package/dist/testing/native.d.ts.map +1 -0
- package/dist/testing/native.js +313 -0
- package/dist/testing/native.js.map +1 -0
- package/dist/testing/presentation.d.ts +11 -0
- package/dist/testing/presentation.d.ts.map +1 -0
- package/dist/testing/presentation.js +45 -0
- package/dist/testing/presentation.js.map +1 -0
- package/dist/testing/replay.d.ts +39 -0
- package/dist/testing/replay.d.ts.map +1 -0
- package/dist/testing/replay.js +99 -0
- package/dist/testing/replay.js.map +1 -0
- package/dist/testing/scroll-handoff-native.d.ts +10 -0
- package/dist/testing/scroll-handoff-native.d.ts.map +1 -0
- package/dist/testing/scroll-handoff-native.js +151 -0
- package/dist/testing/scroll-handoff-native.js.map +1 -0
- package/dist/testing/scroll-handoff.d.ts +25 -0
- package/dist/testing/scroll-handoff.d.ts.map +1 -0
- package/dist/testing/scroll-handoff.js +127 -0
- package/dist/testing/scroll-handoff.js.map +1 -0
- package/dist/testing/sensors.d.ts +13 -0
- package/dist/testing/sensors.d.ts.map +1 -0
- package/dist/testing/sensors.js +26 -0
- package/dist/testing/sensors.js.map +1 -0
- package/dist/testing/trace.d.ts +101 -0
- package/dist/testing/trace.d.ts.map +1 -0
- package/dist/testing/trace.js +263 -0
- package/dist/testing/trace.js.map +1 -0
- package/dist/timed-animation.d.ts +38 -0
- package/dist/timed-animation.d.ts.map +1 -0
- package/dist/timed-animation.js +177 -0
- package/dist/timed-animation.js.map +1 -0
- package/dist/track.d.ts +3 -0
- package/dist/track.d.ts.map +1 -1
- package/dist/track.js +281 -40
- package/dist/track.js.map +1 -1
- package/dist/transition.d.ts +54 -2
- package/dist/transition.d.ts.map +1 -1
- package/dist/transition.js +128 -8
- package/dist/transition.js.map +1 -1
- package/dist/types.d.ts +10 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/value-observers.d.ts +22 -0
- package/dist/value-observers.d.ts.map +1 -0
- package/dist/value-observers.js +122 -0
- package/dist/value-observers.js.map +1 -0
- package/dist/value-track.d.ts +13 -0
- package/dist/value-track.d.ts.map +1 -0
- package/dist/value-track.js +59 -0
- package/dist/value-track.js.map +1 -0
- package/dist/vue/index.d.ts +33 -3
- package/dist/vue/index.d.ts.map +1 -1
- package/dist/vue/index.js +118 -3
- package/dist/vue/index.js.map +1 -1
- package/dist/zoomable.d.ts +1 -1
- package/dist/zoomable.d.ts.map +1 -1
- package/package.json +68 -3
- package/platforms/android/include.gradle +10 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/BlurEffect.java +89 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/CircleMath.java +151 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/CircleWorld.java +210 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/GestureSession.java +227 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/GestureSurface.java +54 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/GradientLayer.java +224 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/KeyboardFrame.java +53 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/KeyboardFrameFollower.java +57 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/KeyboardObserver.java +97 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/LiveSpring.java +277 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/MotionProbe.java +70 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/ParticleEmitter.java +192 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/ParticleSimulation.java +114 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/PredictiveBackSession.java +212 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/ReorderHandle.java +25 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/ReorderSession.java +213 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/ReorderSurface.java +27 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/ScrollHeader.java +84 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/SensorMath.java +28 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/SensorSource.java +217 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/ShapeLayer.java +120 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/SharedLayoutFlight.java +287 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/SharedNavigationScene.java +115 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/SpringState.java +39 -0
- package/platforms/android/proguard-rules.pro +20 -0
- package/platforms/ios/build.xcconfig +1 -1
- package/platforms/ios/src/JoltBlur.h +14 -0
- package/platforms/ios/src/JoltBlur.m +86 -0
- package/platforms/ios/src/JoltCircleMath.h +183 -0
- package/platforms/ios/src/JoltCircleWorld.h +17 -0
- package/platforms/ios/src/JoltCircleWorld.m +203 -0
- package/platforms/ios/src/JoltGestureSession.h +23 -0
- package/platforms/ios/src/JoltGestureSession.m +251 -0
- package/platforms/ios/src/JoltInteractiveNavigation.h +23 -0
- package/platforms/ios/src/JoltInteractiveNavigation.m +255 -0
- package/platforms/ios/src/JoltLiveSpring.h +29 -0
- package/platforms/ios/src/JoltLiveSpring.m +243 -0
- package/platforms/ios/src/JoltMotionProbe.h +9 -0
- package/platforms/ios/src/JoltMotionProbe.m +72 -0
- package/platforms/ios/src/JoltReorderSession.h +15 -0
- package/platforms/ios/src/JoltReorderSession.m +205 -0
- package/platforms/ios/src/JoltScrollHeader.h +13 -0
- package/platforms/ios/src/JoltScrollHeader.m +93 -0
- package/platforms/ios/src/JoltSensorMath.h +39 -0
- package/platforms/ios/src/JoltSensorSource.h +13 -0
- package/platforms/ios/src/JoltSensorSource.m +201 -0
- package/platforms/ios/src/JoltSharedLayoutFlight.h +19 -0
- package/platforms/ios/src/JoltSharedLayoutFlight.m +250 -0
- package/platforms/ios/src/JoltSpringState.h +35 -0
- package/platforms/ios/src/module.modulemap +10 -0
- package/src/android-plugin.d.ts +463 -0
- package/src/animate.ts +129 -15
- package/src/blur/index.ts +195 -0
- package/src/blur/native.ts +70 -0
- package/src/blur/types.ts +32 -0
- package/src/bottom-sheet/geometry.ts +84 -0
- package/src/bottom-sheet/index.ts +536 -0
- package/src/bottom-sheet/native.ts +214 -0
- package/src/config.ts +39 -1
- package/src/decay.ts +9 -0
- package/src/drag.ts +67 -21
- package/src/driver/android-gradient.ts +116 -0
- package/src/driver/android-particles.ts +118 -0
- package/src/driver/android.ts +69 -1
- package/src/driver/frame.ts +10 -0
- package/src/driver/index.ts +15 -0
- package/src/driver/ios-gradient.ts +136 -0
- package/src/driver/ios-layout.ts +63 -0
- package/src/driver/ios-scroll-delegate.ts +23 -0
- package/src/driver/ios.ts +70 -17
- package/src/easing.ts +21 -1
- package/src/engine.ts +226 -59
- package/src/gesture-native.ts +139 -0
- package/src/gestures/index.ts +365 -0
- package/src/glass/index.ts +218 -0
- package/src/gradient-binding.ts +158 -0
- package/src/gradient.ts +663 -0
- package/src/gravity.ts +107 -0
- package/src/haptics.ts +106 -28
- package/src/image-effect.ts +10 -2
- package/src/index.ts +59 -7
- package/src/inspector/index.ts +523 -0
- package/src/inspector/plot.ts +27 -0
- package/src/inspector/probe.ts +50 -0
- package/src/inspector/tuning.ts +51 -0
- package/src/interactive-navigation/index.ts +398 -0
- package/src/ios-plugin.d.ts +279 -0
- package/src/keyboard.ts +231 -7
- package/src/layout.ts +408 -0
- package/src/live-spring-driver.ts +181 -0
- package/src/mixer.ts +306 -0
- package/src/motion-scope.ts +53 -6
- package/src/motion-states.ts +149 -42
- package/src/motion-value.ts +1289 -0
- package/src/native/index.ts +30 -0
- package/src/native-properties.ts +188 -0
- package/src/native-property-driver.ts +123 -0
- package/src/native-property.ts +366 -0
- package/src/particles.ts +18 -17
- package/src/path.ts +2 -1
- package/src/physics/index.ts +443 -0
- package/src/physics/native.ts +110 -0
- package/src/playback-group.ts +17 -1
- package/src/playback.ts +41 -0
- package/src/predictive-back/index.ts +280 -0
- package/src/predictive-back/presentation.ts +6 -0
- package/src/reorder/handle.ts +9 -0
- package/src/reorder/index.ts +243 -0
- package/src/reorder/list-view.ts +262 -0
- package/src/reorder/model.ts +47 -0
- package/src/reorder/surface.ts +10 -0
- package/src/reorder/types.ts +87 -0
- package/src/sampling.ts +173 -0
- package/src/scene-appearance.ts +92 -0
- package/src/scene-camera.ts +30 -0
- package/src/scene-shader.ts +139 -0
- package/src/scroll-header/geometry.ts +88 -0
- package/src/scroll-header/index.ts +504 -0
- package/src/scroll-header/native.ts +89 -0
- package/src/sensors/index.ts +246 -0
- package/src/sensors/native.ts +72 -0
- package/src/sequence.ts +209 -20
- package/src/shapes/android.ts +63 -0
- package/src/shapes/index.ts +267 -0
- package/src/shapes/ios.ts +194 -0
- package/src/shapes/native.ts +27 -0
- package/src/shapes/path.ts +127 -0
- package/src/shapes/types.ts +63 -0
- package/src/shared-layout/index.ts +343 -0
- package/src/shared-layout/native.ts +138 -0
- package/src/shared-layout/timing.ts +87 -0
- package/src/shared-navigation/entry.ts +695 -0
- package/src/shared-navigation/index.ts +414 -0
- package/src/shared-navigation/return-signal.ts +41 -0
- package/src/shared-navigation/return-target.ts +197 -0
- package/src/shared-navigation/scope.ts +3 -0
- package/src/shared-navigation/targets.ts +38 -0
- package/src/size-layout.ts +237 -0
- package/src/size.ts +302 -0
- package/src/spring.ts +18 -0
- package/src/svg-path.ts +8 -3
- package/src/testing/clock.ts +128 -0
- package/src/testing/handoff-recorder.ts +98 -0
- package/src/testing/index.ts +4 -0
- package/src/testing/native.ts +386 -0
- package/src/testing/presentation.ts +46 -0
- package/src/testing/replay.ts +149 -0
- package/src/testing/scroll-handoff-native.ts +201 -0
- package/src/testing/scroll-handoff.ts +140 -0
- package/src/testing/sensors.ts +41 -0
- package/src/testing/trace.ts +340 -0
- package/src/timed-animation.ts +192 -0
- package/src/track.ts +334 -38
- package/src/transition.ts +197 -9
- package/src/types.ts +11 -1
- package/src/value-observers.ts +147 -0
- package/src/value-track.ts +71 -0
- package/src/vue/index.ts +147 -1
- package/src/zoomable.ts +1 -1
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ListView,
|
|
3
|
+
isIOS,
|
|
4
|
+
type EventData,
|
|
5
|
+
type ItemEventData,
|
|
6
|
+
type View,
|
|
7
|
+
} from '@nativescript/core'
|
|
8
|
+
import { sheetActions as viewActions } from '../bottom-sheet/native.js'
|
|
9
|
+
import type { ReorderAdapter, ReorderKey } from './types.js'
|
|
10
|
+
import { ReorderHandle } from './handle.js'
|
|
11
|
+
import { ReorderSurface } from './surface.js'
|
|
12
|
+
|
|
13
|
+
/** Flat Core ListView only. Sectioned lists and plugin collection views need another adapter. */
|
|
14
|
+
export function coreListAdapter<T>(list: ListView): ReorderAdapter<T> {
|
|
15
|
+
if (!(list instanceof ListView)) throw new TypeError('Expected a Core ListView.')
|
|
16
|
+
function validate() {
|
|
17
|
+
if (list.sectioned || list.stickyHeader || list.showSearch)
|
|
18
|
+
throw new TypeError(
|
|
19
|
+
'Reorder supports flat Core lists without built-in headers or search.',
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
validate()
|
|
23
|
+
return {
|
|
24
|
+
view: list,
|
|
25
|
+
items() {
|
|
26
|
+
validate()
|
|
27
|
+
const source = list.items
|
|
28
|
+
return Array.from({ length: source?.length ?? 0 }, (_, index) =>
|
|
29
|
+
Array.isArray(source) ? source[index] : source.getItem(index),
|
|
30
|
+
) as T[]
|
|
31
|
+
},
|
|
32
|
+
subscribe(changed) {
|
|
33
|
+
let source:
|
|
34
|
+
| {
|
|
35
|
+
on?(event: string, listener: () => void): void
|
|
36
|
+
off?(event: string, listener: () => void): void
|
|
37
|
+
}
|
|
38
|
+
| undefined
|
|
39
|
+
const replaced = () => {
|
|
40
|
+
source?.off?.('change', changed)
|
|
41
|
+
source = list.items as typeof source
|
|
42
|
+
source?.on?.('change', changed)
|
|
43
|
+
changed()
|
|
44
|
+
}
|
|
45
|
+
list.on('itemsChange', replaced)
|
|
46
|
+
replaced()
|
|
47
|
+
return () => {
|
|
48
|
+
list.off('itemsChange', replaced)
|
|
49
|
+
source?.off?.('change', changed)
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
attach(config) {
|
|
53
|
+
validate()
|
|
54
|
+
const options = JSON.stringify({
|
|
55
|
+
longPress: config.longPress,
|
|
56
|
+
edgeSize: config.edgeSize,
|
|
57
|
+
edgeSpeed: config.edgeSpeed,
|
|
58
|
+
reducedMotion: config.reducedMotion,
|
|
59
|
+
handles: config.handle !== undefined,
|
|
60
|
+
})
|
|
61
|
+
let draggedKey: ReorderKey | undefined
|
|
62
|
+
const event = (state: number, index: number, toIndex: number) => {
|
|
63
|
+
if (state === 1) {
|
|
64
|
+
config.event({ type: 'start', index })
|
|
65
|
+
draggedKey = config.keyAt(index)
|
|
66
|
+
} else if (state === 2) {
|
|
67
|
+
const key = draggedKey
|
|
68
|
+
draggedKey = undefined
|
|
69
|
+
config.event({ type: 'commit', index, toIndex })
|
|
70
|
+
if (key !== undefined) focusKey(key, false)
|
|
71
|
+
} else {
|
|
72
|
+
draggedKey = undefined
|
|
73
|
+
config.event({ type: 'cancel', geometryChanged: toIndex === 1 })
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
let native: {
|
|
77
|
+
registerHandle(view: any): void
|
|
78
|
+
setEnabled(value: boolean): void
|
|
79
|
+
setReducedMotion(value: boolean): void
|
|
80
|
+
cancel(): void
|
|
81
|
+
dispose(): void
|
|
82
|
+
}
|
|
83
|
+
if (isIOS) {
|
|
84
|
+
if (typeof JoltReorderSession === 'undefined')
|
|
85
|
+
throw new Error('Rebuild the native app to use reorder().')
|
|
86
|
+
native = JoltReorderSession.attachOptionsOnState(
|
|
87
|
+
list.nativeViewProtected,
|
|
88
|
+
options,
|
|
89
|
+
event,
|
|
90
|
+
)
|
|
91
|
+
} else {
|
|
92
|
+
if (
|
|
93
|
+
!(list.parent instanceof ReorderSurface) ||
|
|
94
|
+
list.parent.getChildrenCount() !== 1
|
|
95
|
+
)
|
|
96
|
+
throw new TypeError(
|
|
97
|
+
'On Android, make the Core ListView the only child of a ReorderSurface.',
|
|
98
|
+
)
|
|
99
|
+
if (typeof org.rafaelaugusto.jolt.ReorderSession === 'undefined')
|
|
100
|
+
throw new Error('Rebuild the native app to use reorder().')
|
|
101
|
+
native = new org.rafaelaugusto.jolt.ReorderSession(
|
|
102
|
+
list.parent.nativeViewProtected,
|
|
103
|
+
list.nativeViewProtected,
|
|
104
|
+
options,
|
|
105
|
+
new org.rafaelaugusto.jolt.ReorderSession.Listener({ onState: event }),
|
|
106
|
+
)
|
|
107
|
+
}
|
|
108
|
+
type Row = {
|
|
109
|
+
index: number
|
|
110
|
+
handle?: View
|
|
111
|
+
release(): void
|
|
112
|
+
timer?: ReturnType<typeof setTimeout>
|
|
113
|
+
}
|
|
114
|
+
const rows = new Map<View, Row>()
|
|
115
|
+
let ended = false
|
|
116
|
+
let focusTimer: ReturnType<typeof setTimeout> | undefined
|
|
117
|
+
function moveRow(row: Row, direction: -1 | 1, accessible: boolean) {
|
|
118
|
+
const key = config.move(row.index, direction)
|
|
119
|
+
if (key !== undefined) focusKey(key, accessible)
|
|
120
|
+
}
|
|
121
|
+
function reveal(index: number) {
|
|
122
|
+
// Run once after the app commits and Core rebinds. Estimated iOS heights
|
|
123
|
+
// can move the dropped row outside the viewport during reloadData.
|
|
124
|
+
if (isIOS) {
|
|
125
|
+
const table = list.nativeViewProtected as UITableView
|
|
126
|
+
table.layoutIfNeeded()
|
|
127
|
+
const path = NSIndexPath.indexPathForRowInSection(index, 0)
|
|
128
|
+
const rect = table.rectForRowAtIndexPath(path)
|
|
129
|
+
const top = table.bounds.origin.y + table.adjustedContentInset.top
|
|
130
|
+
const bottom =
|
|
131
|
+
table.bounds.origin.y +
|
|
132
|
+
table.bounds.size.height -
|
|
133
|
+
table.adjustedContentInset.bottom
|
|
134
|
+
// Keep the target away from an edge while UIKit resolves estimated heights.
|
|
135
|
+
if (rect.origin.y < top || rect.origin.y + rect.size.height > bottom)
|
|
136
|
+
table.scrollToRowAtIndexPathAtScrollPositionAnimated(path, 2, false)
|
|
137
|
+
} else {
|
|
138
|
+
const table = list.nativeViewProtected as android.widget.ListView
|
|
139
|
+
const cell = table.getChildAt(index - table.getFirstVisiblePosition())
|
|
140
|
+
if (!cell) list.scrollToIndex(index)
|
|
141
|
+
else {
|
|
142
|
+
const top = cell.getTop() - table.getPaddingTop()
|
|
143
|
+
const bottom = cell.getBottom() - table.getHeight() + table.getPaddingBottom()
|
|
144
|
+
if (top < 0) table.scrollListBy(top)
|
|
145
|
+
else if (bottom > 0) table.scrollListBy(bottom)
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
function focusKey(key: ReorderKey, accessible: boolean) {
|
|
150
|
+
if (ended) return
|
|
151
|
+
if (focusTimer !== undefined) clearTimeout(focusTimer)
|
|
152
|
+
let attempts = 0
|
|
153
|
+
const focus = () => {
|
|
154
|
+
focusTimer = undefined
|
|
155
|
+
if (ended) return
|
|
156
|
+
const index = config.indexOf(key)
|
|
157
|
+
if (index < 0) return
|
|
158
|
+
reveal(index)
|
|
159
|
+
const target = [...rows.values()].find(
|
|
160
|
+
(entry) => entry.index === index && entry.handle?.isLoaded,
|
|
161
|
+
)
|
|
162
|
+
if (target?.handle && list.isItemAtIndexVisible(index)) {
|
|
163
|
+
target.handle.focus()
|
|
164
|
+
if (accessible) target.handle.accessibilityScreenChanged()
|
|
165
|
+
} else if (attempts++ < 4) {
|
|
166
|
+
focusTimer = setTimeout(focus, 30)
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
// Core lays out recycled rows after Vue flushes its new items.
|
|
170
|
+
focusTimer = setTimeout(focus, 30)
|
|
171
|
+
}
|
|
172
|
+
function loaded(data: EventData) {
|
|
173
|
+
const args = data as ItemEventData
|
|
174
|
+
if (!args.view || ended) return
|
|
175
|
+
const view = args.view
|
|
176
|
+
let row = rows.get(view)
|
|
177
|
+
if (!row) {
|
|
178
|
+
row = { index: args.index, release() {} }
|
|
179
|
+
rows.set(view, row)
|
|
180
|
+
}
|
|
181
|
+
row.index = args.index
|
|
182
|
+
if (row.timer !== undefined) clearTimeout(row.timer)
|
|
183
|
+
const current = row
|
|
184
|
+
// Vue/Core finishes binding and creating native children after itemLoading.
|
|
185
|
+
row.timer = setTimeout(() => {
|
|
186
|
+
current.timer = undefined
|
|
187
|
+
if (ended) return
|
|
188
|
+
const handle =
|
|
189
|
+
typeof config.handle === 'function'
|
|
190
|
+
? config.handle(view)
|
|
191
|
+
: typeof config.handle === 'string'
|
|
192
|
+
? view.getViewById<View>(config.handle)
|
|
193
|
+
: view
|
|
194
|
+
if (!handle?.nativeViewProtected) return
|
|
195
|
+
if (current.handle !== handle) {
|
|
196
|
+
current.release()
|
|
197
|
+
current.handle = handle
|
|
198
|
+
const releaseActions = viewActions(handle, [
|
|
199
|
+
{
|
|
200
|
+
label: config.accessibility.moveUp,
|
|
201
|
+
run: () => moveRow(current, -1, true),
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
label: config.accessibility.moveDown,
|
|
205
|
+
run: () => moveRow(current, 1, true),
|
|
206
|
+
},
|
|
207
|
+
])
|
|
208
|
+
let releaseKeys = () => {}
|
|
209
|
+
if (handle instanceof ReorderHandle) {
|
|
210
|
+
const move = (direction: number) =>
|
|
211
|
+
moveRow(current, direction < 0 ? -1 : 1, false)
|
|
212
|
+
if (isIOS) {
|
|
213
|
+
const button = handle.nativeViewProtected as JoltReorderHandle
|
|
214
|
+
button.onMove = move
|
|
215
|
+
releaseKeys = () => {
|
|
216
|
+
button.onMove = null
|
|
217
|
+
}
|
|
218
|
+
} else {
|
|
219
|
+
const button =
|
|
220
|
+
handle.nativeViewProtected as org.rafaelaugusto.jolt.ReorderHandle
|
|
221
|
+
button.setMoveListener(
|
|
222
|
+
new org.rafaelaugusto.jolt.ReorderHandle.MoveListener({ move }),
|
|
223
|
+
)
|
|
224
|
+
releaseKeys = () => button.setMoveListener(null)
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
current.release = () => {
|
|
228
|
+
releaseKeys()
|
|
229
|
+
releaseActions()
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
native.registerHandle(handle.nativeViewProtected)
|
|
233
|
+
}, 0)
|
|
234
|
+
}
|
|
235
|
+
const driver = {
|
|
236
|
+
cancel: () => native.cancel(),
|
|
237
|
+
setEnabled: (value: boolean) => native.setEnabled(value),
|
|
238
|
+
setReducedMotion: (value: boolean) => native.setReducedMotion(value),
|
|
239
|
+
dispose() {
|
|
240
|
+
if (ended) return
|
|
241
|
+
ended = true
|
|
242
|
+
if (focusTimer !== undefined) clearTimeout(focusTimer)
|
|
243
|
+
list.off('itemLoading', loaded)
|
|
244
|
+
for (const row of rows.values()) {
|
|
245
|
+
if (row.timer !== undefined) clearTimeout(row.timer)
|
|
246
|
+
row.release()
|
|
247
|
+
}
|
|
248
|
+
rows.clear()
|
|
249
|
+
native.dispose()
|
|
250
|
+
},
|
|
251
|
+
}
|
|
252
|
+
list.on('itemLoading', loaded)
|
|
253
|
+
try {
|
|
254
|
+
list.refresh()
|
|
255
|
+
} catch (error) {
|
|
256
|
+
driver.dispose()
|
|
257
|
+
throw error
|
|
258
|
+
}
|
|
259
|
+
return driver
|
|
260
|
+
},
|
|
261
|
+
}
|
|
262
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { ReorderKey, ReorderMove } from './types.js'
|
|
2
|
+
|
|
3
|
+
export function itemKeys<T, K extends ReorderKey>(
|
|
4
|
+
items: readonly T[],
|
|
5
|
+
key: (item: T) => K,
|
|
6
|
+
): K[] {
|
|
7
|
+
const keys = items.map(key)
|
|
8
|
+
if (
|
|
9
|
+
keys.some(
|
|
10
|
+
(value) =>
|
|
11
|
+
(typeof value !== 'string' && typeof value !== 'number') ||
|
|
12
|
+
(typeof value === 'number' && !Number.isFinite(value)),
|
|
13
|
+
)
|
|
14
|
+
)
|
|
15
|
+
throw new TypeError('Reorder keys must be strings or finite numbers.')
|
|
16
|
+
if (new Set(keys).size !== keys.length)
|
|
17
|
+
throw new TypeError('Reorder keys must be unique and stable across recycling.')
|
|
18
|
+
return keys
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function sameKeys<K>(a: readonly K[], b: readonly K[]): boolean {
|
|
22
|
+
return a.length === b.length && a.every((key, index) => key === b[index])
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** toIndex is the final position, after removing the dragged item. */
|
|
26
|
+
export function moveAt<K extends ReorderKey>(
|
|
27
|
+
keys: readonly K[],
|
|
28
|
+
fromIndex: number,
|
|
29
|
+
toIndex: number,
|
|
30
|
+
): ReorderMove<K> | undefined {
|
|
31
|
+
if (
|
|
32
|
+
!Number.isInteger(fromIndex) ||
|
|
33
|
+
!Number.isInteger(toIndex) ||
|
|
34
|
+
fromIndex < 0 ||
|
|
35
|
+
toIndex < 0 ||
|
|
36
|
+
fromIndex >= keys.length ||
|
|
37
|
+
toIndex >= keys.length ||
|
|
38
|
+
fromIndex === toIndex
|
|
39
|
+
)
|
|
40
|
+
return undefined
|
|
41
|
+
return {
|
|
42
|
+
key: keys[fromIndex]!,
|
|
43
|
+
beforeKey: keys[toIndex < fromIndex ? toIndex : toIndex + 1] ?? null,
|
|
44
|
+
fromIndex,
|
|
45
|
+
toIndex,
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { GridLayout, isAndroid } from '@nativescript/core'
|
|
2
|
+
|
|
3
|
+
/** Android dispatch boundary: owns the drag after the source cell is recycled. */
|
|
4
|
+
export class ReorderSurface extends GridLayout {
|
|
5
|
+
override createNativeView(): ReturnType<GridLayout['createNativeView']> {
|
|
6
|
+
return isAndroid
|
|
7
|
+
? new org.rafaelaugusto.jolt.ReorderSurface(this._context)
|
|
8
|
+
: super.createNativeView()
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { View } from '@nativescript/core'
|
|
2
|
+
|
|
3
|
+
export type ReorderKey = string | number
|
|
4
|
+
export type ReorderCancelReason =
|
|
5
|
+
| 'cancelled'
|
|
6
|
+
| 'unchanged'
|
|
7
|
+
| 'data-changed'
|
|
8
|
+
| 'removed'
|
|
9
|
+
| 'unloaded'
|
|
10
|
+
| 'disposed'
|
|
11
|
+
| 'disabled'
|
|
12
|
+
| 'geometry-changed'
|
|
13
|
+
|
|
14
|
+
export interface ReorderMove<K extends ReorderKey = ReorderKey> {
|
|
15
|
+
key: K
|
|
16
|
+
/** Insert before this identity; null appends. The app owns the mutation. */
|
|
17
|
+
beforeKey: K | null
|
|
18
|
+
fromIndex: number
|
|
19
|
+
toIndex: number
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface ReorderOptions<T, K extends ReorderKey = ReorderKey> {
|
|
23
|
+
key(item: T): K
|
|
24
|
+
/** View id, or a resolver within a realized row. Omit to drag anywhere on the row. */
|
|
25
|
+
handle?: string | ((row: View) => View | undefined)
|
|
26
|
+
onCommit(move: ReorderMove<K>): void
|
|
27
|
+
onStart?: (key: K) => void
|
|
28
|
+
onCancel?: (event: { key: K; reason: ReorderCancelReason }) => void
|
|
29
|
+
/** Long-press activation in milliseconds; default 350. */
|
|
30
|
+
longPress?: number
|
|
31
|
+
/** Edge region in DIPs and maximum native autoscroll speed in DIPs/second. */
|
|
32
|
+
edge?: { size?: number; speed?: number }
|
|
33
|
+
accessibility?: { moveUp?: string; moveDown?: string }
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface Reorder<K extends ReorderKey = ReorderKey> {
|
|
37
|
+
readonly activeKey: K | undefined
|
|
38
|
+
readonly disposed: boolean
|
|
39
|
+
/** A keyboard/button alternative. Returns false for a missing key or unchanged order. */
|
|
40
|
+
move(key: K, beforeKey: K | null): boolean
|
|
41
|
+
moveUp(key: K): boolean
|
|
42
|
+
moveDown(key: K): boolean
|
|
43
|
+
cancel(): void
|
|
44
|
+
/** Call after in-place changes to a plain array or row geometry. */
|
|
45
|
+
refresh(): void
|
|
46
|
+
pause(): void
|
|
47
|
+
play(): void
|
|
48
|
+
dispose(): void
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export type ReorderNativeEvent =
|
|
52
|
+
| { type: 'start'; index: number }
|
|
53
|
+
| { type: 'commit'; index: number; toIndex: number }
|
|
54
|
+
| { type: 'cancel'; geometryChanged?: boolean }
|
|
55
|
+
|
|
56
|
+
export interface ReorderAdapterDriver {
|
|
57
|
+
cancel(): void
|
|
58
|
+
setEnabled(enabled: boolean): void
|
|
59
|
+
setReducedMotion(reduced: boolean): void
|
|
60
|
+
dispose(): void
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Optional list-plugin integration. Indices refer to the current items until a
|
|
65
|
+
* change invalidates the gesture. Drivers own native input, measured variable
|
|
66
|
+
* heights, snapshot overlays, recycled-cell restoration and edge scrolling.
|
|
67
|
+
* Emit only lifecycle events; do not bridge pointer/display frames to JS.
|
|
68
|
+
*/
|
|
69
|
+
export interface ReorderAdapter<T> {
|
|
70
|
+
readonly view: View
|
|
71
|
+
items(): readonly T[]
|
|
72
|
+
/** Notify synchronously when identities/order/content change. */
|
|
73
|
+
subscribe(changed: () => void): () => void
|
|
74
|
+
attach(config: {
|
|
75
|
+
handle: ReorderOptions<T>['handle']
|
|
76
|
+
longPress: number
|
|
77
|
+
edgeSize: number
|
|
78
|
+
edgeSpeed: number
|
|
79
|
+
reducedMotion: boolean
|
|
80
|
+
accessibility: { moveUp: string; moveDown: string }
|
|
81
|
+
event(event: ReorderNativeEvent): void
|
|
82
|
+
/** Returns the moved identity; resolve it again after the app updates data. */
|
|
83
|
+
move(index: number, direction: -1 | 1): ReorderKey | undefined
|
|
84
|
+
keyAt(index: number): ReorderKey | undefined
|
|
85
|
+
indexOf(key: ReorderKey): number
|
|
86
|
+
}): ReorderAdapterDriver
|
|
87
|
+
}
|
package/src/sampling.ts
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
/** Maximum linear interpolation error in property units, not screen pixels. */
|
|
2
|
+
export interface SamplingOptions {
|
|
3
|
+
duration: number
|
|
4
|
+
position(time: number): number
|
|
5
|
+
tolerance: number
|
|
6
|
+
/** Bound on linear interpolation error across this complete interval. */
|
|
7
|
+
errorBound?(start: number, end: number): number
|
|
8
|
+
/** Playback milliseconds per source millisecond. */
|
|
9
|
+
slowdown?: number
|
|
10
|
+
/** Unknown user functions retain at least 120 uniform intervals per second. */
|
|
11
|
+
custom?: boolean
|
|
12
|
+
/** Mandatory times in source milliseconds, including piecewise curve seams. */
|
|
13
|
+
breakpoints?: readonly number[]
|
|
14
|
+
/** Non-expansive property clamp and the values where its slope changes. */
|
|
15
|
+
projection?: { apply(value: number): number; breaks: readonly number[] }
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const MAX_SAMPLE_INTERVALS = 6000
|
|
19
|
+
const MAX_EVALUATIONS = 24000
|
|
20
|
+
const MAX_DEPTH = 24
|
|
21
|
+
const MAX_INTERVAL_MS = 100
|
|
22
|
+
const PROBES = [0.25, 0.5, 0.75] as const
|
|
23
|
+
const NO_BREAKS: readonly number[] = []
|
|
24
|
+
|
|
25
|
+
export interface SampledCurve {
|
|
26
|
+
times: number[]
|
|
27
|
+
values: number[]
|
|
28
|
+
sampling: {
|
|
29
|
+
method: 'adaptive' | 'uniform-fallback'
|
|
30
|
+
tolerance: number
|
|
31
|
+
/** Only true when every accepted interval passed an analytical bound. */
|
|
32
|
+
bounded: boolean
|
|
33
|
+
evaluations: number
|
|
34
|
+
reason?: 'sample-limit' | 'evaluation-limit' | 'invalid-bound'
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** Curves are sampled only at setup. Work and output are bounded independently. */
|
|
39
|
+
export function sampleCurve(options: SamplingOptions): SampledCurve {
|
|
40
|
+
const {
|
|
41
|
+
duration,
|
|
42
|
+
position,
|
|
43
|
+
tolerance,
|
|
44
|
+
errorBound,
|
|
45
|
+
custom = false,
|
|
46
|
+
slowdown = 1,
|
|
47
|
+
} = options
|
|
48
|
+
let evaluations = 0
|
|
49
|
+
const project = options.projection?.apply ?? ((value: number) => value)
|
|
50
|
+
const at = (time: number) => {
|
|
51
|
+
evaluations++
|
|
52
|
+
return position(time)
|
|
53
|
+
}
|
|
54
|
+
const maxInterval = (custom ? 1000 / 120 : MAX_INTERVAL_MS) / slowdown
|
|
55
|
+
const seeds = Math.max(1, Math.ceil(duration / maxInterval))
|
|
56
|
+
let reason: SampledCurve['sampling']['reason']
|
|
57
|
+
const initial = at(0)
|
|
58
|
+
const times = [0],
|
|
59
|
+
values = [project(initial)]
|
|
60
|
+
const append = (time: number, value: number) => {
|
|
61
|
+
if (times.length >= MAX_SAMPLE_INTERVALS + 1) {
|
|
62
|
+
reason = 'sample-limit'
|
|
63
|
+
return
|
|
64
|
+
}
|
|
65
|
+
times.push(duration > 0 ? time / duration : 1)
|
|
66
|
+
values.push(project(value))
|
|
67
|
+
}
|
|
68
|
+
const split = (a: number, b: number, va: number, vb: number, depth: number) => {
|
|
69
|
+
if (reason) return
|
|
70
|
+
if (evaluations >= MAX_EVALUATIONS) {
|
|
71
|
+
reason = 'evaluation-limit'
|
|
72
|
+
return
|
|
73
|
+
}
|
|
74
|
+
let accepted: boolean
|
|
75
|
+
if (errorBound) {
|
|
76
|
+
let bound = errorBound(a, b)
|
|
77
|
+
// Clamping is non-expansive, but clamping a chord's endpoints can create a
|
|
78
|
+
// different chord. Bound that extra error at each crossed clamp boundary.
|
|
79
|
+
let clampError = 0
|
|
80
|
+
for (const edge of options.projection?.breaks ?? NO_BREAKS) {
|
|
81
|
+
const fraction = (edge - va) / (vb - va)
|
|
82
|
+
if (fraction > 0 && fraction < 1)
|
|
83
|
+
clampError = Math.max(
|
|
84
|
+
clampError,
|
|
85
|
+
Math.abs(
|
|
86
|
+
project(edge) - (project(va) + (project(vb) - project(va)) * fraction),
|
|
87
|
+
),
|
|
88
|
+
)
|
|
89
|
+
}
|
|
90
|
+
bound += clampError
|
|
91
|
+
if (!Number.isFinite(bound) || bound < 0) {
|
|
92
|
+
reason = 'invalid-bound'
|
|
93
|
+
return
|
|
94
|
+
}
|
|
95
|
+
accepted = bound <= tolerance
|
|
96
|
+
} else {
|
|
97
|
+
// Three probes plus a safety margin, never a mathematical guarantee for a user function.
|
|
98
|
+
let error = 0
|
|
99
|
+
for (const fraction of PROBES)
|
|
100
|
+
error = Math.max(
|
|
101
|
+
error,
|
|
102
|
+
Math.abs(
|
|
103
|
+
project(at(a + (b - a) * fraction)) -
|
|
104
|
+
(project(va) + (project(vb) - project(va)) * fraction),
|
|
105
|
+
),
|
|
106
|
+
)
|
|
107
|
+
accepted = error <= tolerance * 0.5
|
|
108
|
+
}
|
|
109
|
+
if (accepted) {
|
|
110
|
+
append(b, vb)
|
|
111
|
+
return
|
|
112
|
+
}
|
|
113
|
+
const mid = (a + b) / 2
|
|
114
|
+
if (depth >= MAX_DEPTH || mid === a || mid === b) {
|
|
115
|
+
reason = 'sample-limit'
|
|
116
|
+
return
|
|
117
|
+
}
|
|
118
|
+
const vm = at(mid)
|
|
119
|
+
split(a, mid, va, vm, depth + 1)
|
|
120
|
+
split(mid, b, vm, vb, depth + 1)
|
|
121
|
+
}
|
|
122
|
+
if (seeds > MAX_SAMPLE_INTERVALS || !Number.isFinite(duration)) reason = 'sample-limit'
|
|
123
|
+
else if (duration === 0) append(0, at(0))
|
|
124
|
+
else {
|
|
125
|
+
const boundaries = [
|
|
126
|
+
...new Set([
|
|
127
|
+
...Array.from({ length: seeds + 1 }, (_, i) =>
|
|
128
|
+
i === seeds ? duration : (duration * i) / seeds,
|
|
129
|
+
),
|
|
130
|
+
...(options.breakpoints ?? []).filter((t) => t > 0 && t < duration),
|
|
131
|
+
]),
|
|
132
|
+
].sort((a, b) => a - b)
|
|
133
|
+
let previous = initial
|
|
134
|
+
for (let i = 0; i < boundaries.length - 1 && !reason; i++) {
|
|
135
|
+
const a = boundaries[i]!,
|
|
136
|
+
b = boundaries[i + 1]!
|
|
137
|
+
const value = at(b)
|
|
138
|
+
split(a, b, previous, value, 0)
|
|
139
|
+
previous = value
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
if (!reason)
|
|
143
|
+
return {
|
|
144
|
+
times,
|
|
145
|
+
values,
|
|
146
|
+
sampling: { method: 'adaptive', tolerance, bounded: !!errorBound, evaluations },
|
|
147
|
+
}
|
|
148
|
+
// Preserve the old capped 60 Hz representation if refinement cannot meet its budget.
|
|
149
|
+
// Explicit segment endpoints are still retained by the caller. No precision claim on fallback.
|
|
150
|
+
const steps = Math.max(
|
|
151
|
+
1,
|
|
152
|
+
Math.min(MAX_SAMPLE_INTERVALS, Math.ceil((duration * slowdown * 60) / 1000)),
|
|
153
|
+
)
|
|
154
|
+
const fallbackTimes = [
|
|
155
|
+
...new Set([
|
|
156
|
+
...Array.from({ length: steps + 1 }, (_, i) => i / steps),
|
|
157
|
+
...(options.breakpoints ?? [])
|
|
158
|
+
.filter((t) => t > 0 && t < duration)
|
|
159
|
+
.map((t) => t / duration),
|
|
160
|
+
]),
|
|
161
|
+
].sort((a, b) => a - b)
|
|
162
|
+
return {
|
|
163
|
+
times: fallbackTimes,
|
|
164
|
+
values: fallbackTimes.map((t) => project(at(t * duration))),
|
|
165
|
+
sampling: {
|
|
166
|
+
method: 'uniform-fallback',
|
|
167
|
+
tolerance,
|
|
168
|
+
bounded: false,
|
|
169
|
+
evaluations,
|
|
170
|
+
reason,
|
|
171
|
+
},
|
|
172
|
+
}
|
|
173
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/// <reference types="@nativescript/types-ios/lib/ios/objc-x86_64/objc!SceneKit" preserve="true" />
|
|
2
|
+
import { Color } from '@nativescript/core'
|
|
3
|
+
import { colorMixer, parseColor, type ColorValue } from './color.js'
|
|
4
|
+
import { registerNativeProperty, type NativeProperty } from './native-property.js'
|
|
5
|
+
|
|
6
|
+
const clamp = (n: number) => Math.max(0, Math.min(1, n))
|
|
7
|
+
function scalar(name: string, maximum: number, create: (target: object) => object) {
|
|
8
|
+
return registerNativeProperty<number>({
|
|
9
|
+
name: `jolt.scenekit/${name}`,
|
|
10
|
+
units: [
|
|
11
|
+
name === 'light-intensity'
|
|
12
|
+
? 'lumens (PBR); 1000 = unit multiplier otherwise'
|
|
13
|
+
: 'opacity fraction',
|
|
14
|
+
],
|
|
15
|
+
platforms: ['ios'],
|
|
16
|
+
encode: (value) => [value],
|
|
17
|
+
decode: (values) => values[0]!,
|
|
18
|
+
validate(value) {
|
|
19
|
+
if (!Number.isFinite(value) || value < 0 || value > maximum)
|
|
20
|
+
throw new RangeError(`${name} needs a finite value in 0..${maximum}.`)
|
|
21
|
+
},
|
|
22
|
+
interpolate: (a, b, t) => Math.max(0, Math.min(maximum, a + (b - a) * t)),
|
|
23
|
+
create,
|
|
24
|
+
})
|
|
25
|
+
}
|
|
26
|
+
function color(name: string, create: (target: object) => object) {
|
|
27
|
+
return registerNativeProperty<ColorValue>({
|
|
28
|
+
name: `jolt.scenekit/${name}`,
|
|
29
|
+
// Premultiply the sampled sRGB channels, so native linear interpolation also handles zero alpha.
|
|
30
|
+
units: [
|
|
31
|
+
'premultiplied sRGB red',
|
|
32
|
+
'premultiplied sRGB green',
|
|
33
|
+
'premultiplied sRGB blue',
|
|
34
|
+
'alpha',
|
|
35
|
+
],
|
|
36
|
+
platforms: ['ios'],
|
|
37
|
+
encode(value) {
|
|
38
|
+
const argb = parseColor(value),
|
|
39
|
+
alpha = (argb >>> 24) / 255
|
|
40
|
+
return [
|
|
41
|
+
(((argb >>> 16) & 255) / 255) * alpha,
|
|
42
|
+
(((argb >>> 8) & 255) / 255) * alpha,
|
|
43
|
+
((argb & 255) / 255) * alpha,
|
|
44
|
+
alpha,
|
|
45
|
+
]
|
|
46
|
+
},
|
|
47
|
+
decode(values) {
|
|
48
|
+
const alpha = clamp(values[3]!)
|
|
49
|
+
const channel = (i: number) =>
|
|
50
|
+
Math.round(clamp(alpha ? values[i]! / alpha : 0) * 255)
|
|
51
|
+
return new Color(
|
|
52
|
+
((Math.round(alpha * 255) << 24) |
|
|
53
|
+
(channel(0) << 16) |
|
|
54
|
+
(channel(1) << 8) |
|
|
55
|
+
channel(2)) >>>
|
|
56
|
+
0,
|
|
57
|
+
)
|
|
58
|
+
},
|
|
59
|
+
interpolate: (a, b, t) => new Color(colorMixer(parseColor(a), parseColor(b))(t)),
|
|
60
|
+
create,
|
|
61
|
+
})
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** SCNLight intensity, finite and nonnegative. Non-spatial: retains timing under reduced motion. */
|
|
65
|
+
export const sceneKitLightIntensity: (light: SCNLight) => NativeProperty<number> = scalar(
|
|
66
|
+
'light-intensity',
|
|
67
|
+
Infinity,
|
|
68
|
+
(target) => JoltReferenceProperties.sceneLightIntensity(target as NSObject),
|
|
69
|
+
)
|
|
70
|
+
/** Solid UIColor/CGColor light color. Returns a normalized sRGB Color from get(). */
|
|
71
|
+
export const sceneKitLightColor: (light: SCNLight) => NativeProperty<ColorValue> = color(
|
|
72
|
+
'light-color',
|
|
73
|
+
(target) => JoltReferenceProperties.sceneLightColor(target as NSObject),
|
|
74
|
+
)
|
|
75
|
+
/** SCNMaterial transparency in 0..1; does not change transparencyMode/transparent contents. */
|
|
76
|
+
export const sceneKitMaterialTransparency: (
|
|
77
|
+
material: SCNMaterial,
|
|
78
|
+
) => NativeProperty<number> = scalar('material-transparency', 1, (target) =>
|
|
79
|
+
JoltReferenceProperties.sceneMaterialTransparency(target as NSObject),
|
|
80
|
+
)
|
|
81
|
+
/** Solid color diffuse contents only; never converts a texture into a color. */
|
|
82
|
+
export const sceneKitMaterialDiffuse: (
|
|
83
|
+
material: SCNMaterial,
|
|
84
|
+
) => NativeProperty<ColorValue> = color('material-diffuse', (target) =>
|
|
85
|
+
JoltReferenceProperties.sceneMaterialDiffuse(target as NSObject),
|
|
86
|
+
)
|
|
87
|
+
/** Solid color emission contents only; does not make the material illuminate nearby geometry. */
|
|
88
|
+
export const sceneKitMaterialEmission: (
|
|
89
|
+
material: SCNMaterial,
|
|
90
|
+
) => NativeProperty<ColorValue> = color('material-emission', (target) =>
|
|
91
|
+
JoltReferenceProperties.sceneMaterialEmission(target as NSObject),
|
|
92
|
+
)
|