@rafaelaugusto/jolt 0.1.0-beta.9 → 0.1.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +167 -21
- package/dist/animate.d.ts +25 -4
- package/dist/animate.d.ts.map +1 -1
- package/dist/animate.js +67 -26
- package/dist/animate.js.map +1 -1
- package/dist/blur/index.d.ts +6 -0
- package/dist/blur/index.d.ts.map +1 -0
- package/dist/blur/index.js +196 -0
- package/dist/blur/index.js.map +1 -0
- package/dist/blur/native.d.ts +17 -0
- package/dist/blur/native.d.ts.map +1 -0
- package/dist/blur/native.js +44 -0
- package/dist/blur/native.js.map +1 -0
- package/dist/blur/types.d.ts +32 -0
- package/dist/blur/types.d.ts.map +1 -0
- package/dist/blur/types.js +2 -0
- package/dist/blur/types.js.map +1 -0
- package/dist/bottom-sheet/geometry.d.ts +18 -0
- package/dist/bottom-sheet/geometry.d.ts.map +1 -0
- package/dist/bottom-sheet/geometry.js +51 -0
- package/dist/bottom-sheet/geometry.js.map +1 -0
- package/dist/bottom-sheet/index.d.ts +56 -0
- package/dist/bottom-sheet/index.d.ts.map +1 -0
- package/dist/bottom-sheet/index.js +462 -0
- package/dist/bottom-sheet/index.js.map +1 -0
- package/dist/bottom-sheet/native.d.ts +11 -0
- package/dist/bottom-sheet/native.d.ts.map +1 -0
- package/dist/bottom-sheet/native.js +173 -0
- package/dist/bottom-sheet/native.js.map +1 -0
- package/dist/config.d.ts +9 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +40 -1
- package/dist/config.js.map +1 -1
- package/dist/decay.d.ts +1 -0
- package/dist/decay.d.ts.map +1 -1
- package/dist/decay.js +7 -0
- package/dist/decay.js.map +1 -1
- package/dist/drag-physics.d.ts +6 -1
- package/dist/drag-physics.d.ts.map +1 -1
- package/dist/drag.d.ts +17 -3
- package/dist/drag.d.ts.map +1 -1
- package/dist/drag.js +34 -11
- package/dist/drag.js.map +1 -1
- package/dist/driver/android-gradient.d.ts +5 -0
- package/dist/driver/android-gradient.d.ts.map +1 -0
- package/dist/driver/android-gradient.js +99 -0
- package/dist/driver/android-gradient.js.map +1 -0
- package/dist/driver/android-particles.d.ts +6 -0
- package/dist/driver/android-particles.d.ts.map +1 -0
- package/dist/driver/android-particles.js +93 -0
- package/dist/driver/android-particles.js.map +1 -0
- package/dist/driver/android.d.ts.map +1 -1
- package/dist/driver/android.js +27 -1
- package/dist/driver/android.js.map +1 -1
- package/dist/driver/frame.d.ts +3 -0
- package/dist/driver/frame.d.ts.map +1 -0
- package/dist/driver/frame.js +7 -0
- package/dist/driver/frame.js.map +1 -0
- package/dist/driver/index.d.ts +4 -0
- package/dist/driver/index.d.ts.map +1 -1
- package/dist/driver/index.js.map +1 -1
- package/dist/driver/ios-gradient.d.ts +5 -0
- package/dist/driver/ios-gradient.d.ts.map +1 -0
- package/dist/driver/ios-gradient.js +131 -0
- package/dist/driver/ios-gradient.js.map +1 -0
- package/dist/driver/ios-scroll-delegate.d.ts +4 -0
- package/dist/driver/ios-scroll-delegate.d.ts.map +1 -0
- package/dist/driver/ios-scroll-delegate.js +26 -0
- package/dist/driver/ios-scroll-delegate.js.map +1 -0
- package/dist/driver/ios.d.ts.map +1 -1
- package/dist/driver/ios.js +9 -0
- package/dist/driver/ios.js.map +1 -1
- package/dist/easing.d.ts +3 -1
- package/dist/easing.d.ts.map +1 -1
- package/dist/easing.js +18 -1
- package/dist/easing.js.map +1 -1
- package/dist/engine.d.ts +31 -2
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +194 -42
- package/dist/engine.js.map +1 -1
- package/dist/gesture-native.d.ts +28 -0
- package/dist/gesture-native.d.ts.map +1 -0
- package/dist/gesture-native.js +61 -0
- package/dist/gesture-native.js.map +1 -0
- package/dist/gestures/index.d.ts +69 -0
- package/dist/gestures/index.d.ts.map +1 -0
- package/dist/gestures/index.js +262 -0
- package/dist/gestures/index.js.map +1 -0
- package/dist/glass/index.d.ts +55 -0
- package/dist/glass/index.d.ts.map +1 -0
- package/dist/glass/index.js +205 -0
- package/dist/glass/index.js.map +1 -0
- package/dist/gradient-binding.d.ts +38 -0
- package/dist/gradient-binding.d.ts.map +1 -0
- package/dist/gradient-binding.js +128 -0
- package/dist/gradient-binding.js.map +1 -0
- package/dist/gradient.d.ts +105 -0
- package/dist/gradient.d.ts.map +1 -0
- package/dist/gradient.js +514 -0
- package/dist/gradient.js.map +1 -0
- package/dist/gravity.d.ts +13 -0
- package/dist/gravity.d.ts.map +1 -0
- package/dist/gravity.js +84 -0
- package/dist/gravity.js.map +1 -0
- package/dist/haptics.d.ts.map +1 -1
- package/dist/haptics.js +101 -28
- package/dist/haptics.js.map +1 -1
- package/dist/image-effect.d.ts +1 -0
- package/dist/image-effect.d.ts.map +1 -1
- package/dist/image-effect.js +10 -2
- package/dist/image-effect.js.map +1 -1
- package/dist/index.d.ts +19 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -4
- package/dist/index.js.map +1 -1
- package/dist/inspector/index.d.ts +86 -0
- package/dist/inspector/index.d.ts.map +1 -0
- package/dist/inspector/index.js +419 -0
- package/dist/inspector/index.js.map +1 -0
- package/dist/inspector/plot.d.ts +4 -0
- package/dist/inspector/plot.d.ts.map +1 -0
- package/dist/inspector/plot.js +23 -0
- package/dist/inspector/plot.js.map +1 -0
- package/dist/inspector/probe.d.ts +19 -0
- package/dist/inspector/probe.d.ts.map +1 -0
- package/dist/inspector/probe.js +37 -0
- package/dist/inspector/probe.js.map +1 -0
- package/dist/inspector/tuning.d.ts +19 -0
- package/dist/inspector/tuning.d.ts.map +1 -0
- package/dist/inspector/tuning.js +37 -0
- package/dist/inspector/tuning.js.map +1 -0
- package/dist/interactive-navigation/index.d.ts +44 -0
- package/dist/interactive-navigation/index.d.ts.map +1 -0
- package/dist/interactive-navigation/index.js +350 -0
- package/dist/interactive-navigation/index.js.map +1 -0
- package/dist/keyboard.d.ts +24 -0
- package/dist/keyboard.d.ts.map +1 -1
- package/dist/keyboard.js +199 -6
- package/dist/keyboard.js.map +1 -1
- package/dist/live-spring-driver.d.ts +52 -0
- package/dist/live-spring-driver.d.ts.map +1 -0
- package/dist/live-spring-driver.js +104 -0
- package/dist/live-spring-driver.js.map +1 -0
- package/dist/mixer.d.ts +55 -0
- package/dist/mixer.d.ts.map +1 -0
- package/dist/mixer.js +286 -0
- package/dist/mixer.js.map +1 -0
- package/dist/motion-scope.d.ts +8 -2
- package/dist/motion-scope.d.ts.map +1 -1
- package/dist/motion-scope.js +24 -3
- package/dist/motion-scope.js.map +1 -1
- package/dist/motion-states.d.ts +19 -7
- package/dist/motion-states.d.ts.map +1 -1
- package/dist/motion-states.js +116 -26
- package/dist/motion-states.js.map +1 -1
- package/dist/motion-value.d.ts +227 -0
- package/dist/motion-value.d.ts.map +1 -0
- package/dist/motion-value.js +1074 -0
- package/dist/motion-value.js.map +1 -0
- package/dist/native/index.d.ts +10 -0
- package/dist/native/index.d.ts.map +1 -0
- package/dist/native/index.js +6 -0
- package/dist/native/index.js.map +1 -0
- package/dist/native-properties.d.ts +28 -0
- package/dist/native-properties.d.ts.map +1 -0
- package/dist/native-properties.js +154 -0
- package/dist/native-properties.js.map +1 -0
- package/dist/native-property-driver.d.ts +19 -0
- package/dist/native-property-driver.d.ts.map +1 -0
- package/dist/native-property-driver.js +69 -0
- package/dist/native-property-driver.js.map +1 -0
- package/dist/native-property.d.ts +37 -0
- package/dist/native-property.d.ts.map +1 -0
- package/dist/native-property.js +285 -0
- package/dist/native-property.js.map +1 -0
- package/dist/particles.d.ts +5 -2
- package/dist/particles.d.ts.map +1 -1
- package/dist/particles.js +16 -10
- package/dist/particles.js.map +1 -1
- package/dist/path.d.ts.map +1 -1
- package/dist/path.js +2 -2
- package/dist/path.js.map +1 -1
- package/dist/physics/index.d.ts +139 -0
- package/dist/physics/index.d.ts.map +1 -0
- package/dist/physics/index.js +316 -0
- package/dist/physics/index.js.map +1 -0
- package/dist/physics/native.d.ts +54 -0
- package/dist/physics/native.d.ts.map +1 -0
- package/dist/physics/native.js +64 -0
- package/dist/physics/native.js.map +1 -0
- package/dist/playback-group.d.ts.map +1 -1
- package/dist/playback-group.js +17 -1
- package/dist/playback-group.js.map +1 -1
- package/dist/playback.d.ts +15 -0
- package/dist/playback.d.ts.map +1 -1
- package/dist/playback.js +23 -0
- package/dist/playback.js.map +1 -1
- package/dist/predictive-back/index.d.ts +45 -0
- package/dist/predictive-back/index.d.ts.map +1 -0
- package/dist/predictive-back/index.js +220 -0
- package/dist/predictive-back/index.js.map +1 -0
- package/dist/predictive-back/presentation.d.ts +4 -0
- package/dist/predictive-back/presentation.d.ts.map +1 -0
- package/dist/predictive-back/presentation.js +3 -0
- package/dist/predictive-back/presentation.js.map +1 -0
- package/dist/press.d.ts.map +1 -1
- package/dist/press.js +11 -2
- package/dist/press.js.map +1 -1
- package/dist/reorder/handle.d.ts +6 -0
- package/dist/reorder/handle.d.ts.map +1 -0
- package/dist/reorder/handle.js +10 -0
- package/dist/reorder/handle.js.map +1 -0
- package/dist/reorder/index.d.ts +10 -0
- package/dist/reorder/index.d.ts.map +1 -0
- package/dist/reorder/index.js +233 -0
- package/dist/reorder/index.js.map +1 -0
- package/dist/reorder/list-view.d.ts +5 -0
- package/dist/reorder/list-view.d.ts.map +1 -0
- package/dist/reorder/list-view.js +238 -0
- package/dist/reorder/list-view.js.map +1 -0
- package/dist/reorder/model.d.ts +6 -0
- package/dist/reorder/model.d.ts.map +1 -0
- package/dist/reorder/model.js +30 -0
- package/dist/reorder/model.js.map +1 -0
- package/dist/reorder/surface.d.ts +6 -0
- package/dist/reorder/surface.d.ts.map +1 -0
- package/dist/reorder/surface.js +10 -0
- package/dist/reorder/surface.js.map +1 -0
- package/dist/reorder/types.d.ts +92 -0
- package/dist/reorder/types.d.ts.map +1 -0
- package/dist/reorder/types.js +2 -0
- package/dist/reorder/types.js.map +1 -0
- package/dist/sampling.d.ts +35 -0
- package/dist/sampling.d.ts.map +1 -0
- package/dist/sampling.js +123 -0
- package/dist/sampling.js.map +1 -0
- package/dist/scene-appearance.d.ts +14 -0
- package/dist/scene-appearance.d.ts.map +1 -0
- package/dist/scene-appearance.js +68 -0
- package/dist/scene-appearance.js.map +1 -0
- package/dist/scene-camera.d.ts +5 -0
- package/dist/scene-camera.d.ts.map +1 -0
- package/dist/scene-camera.js +23 -0
- package/dist/scene-camera.js.map +1 -0
- package/dist/scene-shader.d.ts +18 -0
- package/dist/scene-shader.d.ts.map +1 -0
- package/dist/scene-shader.js +76 -0
- package/dist/scene-shader.js.map +1 -0
- package/dist/scroll-header/geometry.d.ts +18 -0
- package/dist/scroll-header/geometry.d.ts.map +1 -0
- package/dist/scroll-header/geometry.js +46 -0
- package/dist/scroll-header/geometry.js.map +1 -0
- package/dist/scroll-header/index.d.ts +48 -0
- package/dist/scroll-header/index.d.ts.map +1 -0
- package/dist/scroll-header/index.js +399 -0
- package/dist/scroll-header/index.js.map +1 -0
- package/dist/scroll-header/native.d.ts +28 -0
- package/dist/scroll-header/native.d.ts.map +1 -0
- package/dist/scroll-header/native.js +43 -0
- package/dist/scroll-header/native.js.map +1 -0
- package/dist/sensors/index.d.ts +69 -0
- package/dist/sensors/index.d.ts.map +1 -0
- package/dist/sensors/index.js +149 -0
- package/dist/sensors/index.js.map +1 -0
- package/dist/sensors/native.d.ts +20 -0
- package/dist/sensors/native.d.ts.map +1 -0
- package/dist/sensors/native.js +48 -0
- package/dist/sensors/native.js.map +1 -0
- package/dist/sequence.d.ts +24 -0
- package/dist/sequence.d.ts.map +1 -1
- package/dist/sequence.js +181 -19
- package/dist/sequence.js.map +1 -1
- package/dist/shapes/android.d.ts +3 -0
- package/dist/shapes/android.d.ts.map +1 -0
- package/dist/shapes/android.js +51 -0
- package/dist/shapes/android.js.map +1 -0
- package/dist/shapes/index.d.ts +6 -0
- package/dist/shapes/index.d.ts.map +1 -0
- package/dist/shapes/index.js +238 -0
- package/dist/shapes/index.js.map +1 -0
- package/dist/shapes/ios.d.ts +3 -0
- package/dist/shapes/ios.d.ts.map +1 -0
- package/dist/shapes/ios.js +164 -0
- package/dist/shapes/ios.js.map +1 -0
- package/dist/shapes/native.d.ts +18 -0
- package/dist/shapes/native.d.ts.map +1 -0
- package/dist/shapes/native.js +10 -0
- package/dist/shapes/native.js.map +1 -0
- package/dist/shapes/path.d.ts +10 -0
- package/dist/shapes/path.d.ts.map +1 -0
- package/dist/shapes/path.js +106 -0
- package/dist/shapes/path.js.map +1 -0
- package/dist/shapes/types.d.ts +55 -0
- package/dist/shapes/types.d.ts.map +1 -0
- package/dist/shapes/types.js +11 -0
- package/dist/shapes/types.js.map +1 -0
- package/dist/shared-layout/index.d.ts +40 -0
- package/dist/shared-layout/index.d.ts.map +1 -0
- package/dist/shared-layout/index.js +267 -0
- package/dist/shared-layout/index.js.map +1 -0
- package/dist/shared-layout/native.d.ts +15 -0
- package/dist/shared-layout/native.d.ts.map +1 -0
- package/dist/shared-layout/native.js +79 -0
- package/dist/shared-layout/native.js.map +1 -0
- package/dist/shared-layout/timing.d.ts +9 -0
- package/dist/shared-layout/timing.d.ts.map +1 -0
- package/dist/shared-layout/timing.js +68 -0
- package/dist/shared-layout/timing.js.map +1 -0
- package/dist/shared-navigation/entry.d.ts +51 -0
- package/dist/shared-navigation/entry.d.ts.map +1 -0
- package/dist/shared-navigation/entry.js +619 -0
- package/dist/shared-navigation/entry.js.map +1 -0
- package/dist/shared-navigation/index.d.ts +58 -0
- package/dist/shared-navigation/index.d.ts.map +1 -0
- package/dist/shared-navigation/index.js +318 -0
- package/dist/shared-navigation/index.js.map +1 -0
- package/dist/shared-navigation/return-signal.d.ts +16 -0
- package/dist/shared-navigation/return-signal.d.ts.map +1 -0
- package/dist/shared-navigation/return-signal.js +35 -0
- package/dist/shared-navigation/return-signal.js.map +1 -0
- package/dist/shared-navigation/return-target.d.ts +32 -0
- package/dist/shared-navigation/return-target.d.ts.map +1 -0
- package/dist/shared-navigation/return-target.js +168 -0
- package/dist/shared-navigation/return-target.js.map +1 -0
- package/dist/shared-navigation/scope.d.ts +4 -0
- package/dist/shared-navigation/scope.d.ts.map +1 -0
- package/dist/shared-navigation/scope.js +2 -0
- package/dist/shared-navigation/scope.js.map +1 -0
- package/dist/shared-navigation/targets.d.ts +6 -0
- package/dist/shared-navigation/targets.d.ts.map +1 -0
- package/dist/shared-navigation/targets.js +36 -0
- package/dist/shared-navigation/targets.js.map +1 -0
- package/dist/size-layout.d.ts +19 -0
- package/dist/size-layout.d.ts.map +1 -0
- package/dist/size-layout.js +216 -0
- package/dist/size-layout.js.map +1 -0
- package/dist/size.d.ts +19 -0
- package/dist/size.d.ts.map +1 -0
- package/dist/size.js +251 -0
- package/dist/size.js.map +1 -0
- package/dist/spring.d.ts +2 -0
- package/dist/spring.d.ts.map +1 -1
- package/dist/spring.js +11 -0
- package/dist/spring.js.map +1 -1
- package/dist/svg-path.d.ts +18 -0
- package/dist/svg-path.d.ts.map +1 -1
- package/dist/svg-path.js +3 -2
- package/dist/svg-path.js.map +1 -1
- package/dist/testing/clock.d.ts +40 -0
- package/dist/testing/clock.d.ts.map +1 -0
- package/dist/testing/clock.js +116 -0
- package/dist/testing/clock.js.map +1 -0
- package/dist/testing/handoff-recorder.d.ts +8 -0
- package/dist/testing/handoff-recorder.d.ts.map +1 -0
- package/dist/testing/handoff-recorder.js +77 -0
- package/dist/testing/handoff-recorder.js.map +1 -0
- package/dist/testing/index.d.ts +5 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +5 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/native.d.ts +46 -0
- package/dist/testing/native.d.ts.map +1 -0
- package/dist/testing/native.js +313 -0
- package/dist/testing/native.js.map +1 -0
- package/dist/testing/presentation.d.ts +11 -0
- package/dist/testing/presentation.d.ts.map +1 -0
- package/dist/testing/presentation.js +45 -0
- package/dist/testing/presentation.js.map +1 -0
- package/dist/testing/replay.d.ts +39 -0
- package/dist/testing/replay.d.ts.map +1 -0
- package/dist/testing/replay.js +99 -0
- package/dist/testing/replay.js.map +1 -0
- package/dist/testing/scroll-handoff-native.d.ts +10 -0
- package/dist/testing/scroll-handoff-native.d.ts.map +1 -0
- package/dist/testing/scroll-handoff-native.js +151 -0
- package/dist/testing/scroll-handoff-native.js.map +1 -0
- package/dist/testing/scroll-handoff.d.ts +25 -0
- package/dist/testing/scroll-handoff.d.ts.map +1 -0
- package/dist/testing/scroll-handoff.js +127 -0
- package/dist/testing/scroll-handoff.js.map +1 -0
- package/dist/testing/sensors.d.ts +13 -0
- package/dist/testing/sensors.d.ts.map +1 -0
- package/dist/testing/sensors.js +26 -0
- package/dist/testing/sensors.js.map +1 -0
- package/dist/testing/trace.d.ts +101 -0
- package/dist/testing/trace.d.ts.map +1 -0
- package/dist/testing/trace.js +263 -0
- package/dist/testing/trace.js.map +1 -0
- package/dist/timed-animation.d.ts +38 -0
- package/dist/timed-animation.d.ts.map +1 -0
- package/dist/timed-animation.js +177 -0
- package/dist/timed-animation.js.map +1 -0
- package/dist/track.d.ts +3 -0
- package/dist/track.d.ts.map +1 -1
- package/dist/track.js +281 -40
- package/dist/track.js.map +1 -1
- package/dist/transition.d.ts +54 -2
- package/dist/transition.d.ts.map +1 -1
- package/dist/transition.js +128 -8
- package/dist/transition.js.map +1 -1
- package/dist/types.d.ts +10 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/value-observers.d.ts +22 -0
- package/dist/value-observers.d.ts.map +1 -0
- package/dist/value-observers.js +122 -0
- package/dist/value-observers.js.map +1 -0
- package/dist/value-track.d.ts +13 -0
- package/dist/value-track.d.ts.map +1 -0
- package/dist/value-track.js +59 -0
- package/dist/value-track.js.map +1 -0
- package/dist/vue/index.d.ts +33 -3
- package/dist/vue/index.d.ts.map +1 -1
- package/dist/vue/index.js +118 -3
- package/dist/vue/index.js.map +1 -1
- package/dist/zoomable.d.ts +1 -1
- package/dist/zoomable.d.ts.map +1 -1
- package/package.json +68 -3
- package/platforms/android/include.gradle +10 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/BlurEffect.java +89 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/CircleMath.java +158 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/CircleWorld.java +221 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/GestureSession.java +227 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/GestureSurface.java +54 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/GradientLayer.java +224 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/KeyboardFrame.java +53 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/KeyboardFrameFollower.java +57 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/KeyboardObserver.java +97 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/LiveSpring.java +277 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/MotionProbe.java +70 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/ParticleEmitter.java +192 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/ParticleSimulation.java +114 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/PredictiveBackSession.java +212 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/ReorderHandle.java +25 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/ReorderSession.java +213 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/ReorderSurface.java +27 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/ScrollHeader.java +84 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/SensorMath.java +28 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/SensorSource.java +217 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/ShapeLayer.java +120 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/SharedLayoutFlight.java +287 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/SharedNavigationScene.java +115 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/SpringState.java +39 -0
- package/platforms/android/proguard-rules.pro +20 -0
- package/platforms/ios/build.xcconfig +1 -1
- package/platforms/ios/src/JoltBlur.h +14 -0
- package/platforms/ios/src/JoltBlur.m +86 -0
- package/platforms/ios/src/JoltCircleMath.h +191 -0
- package/platforms/ios/src/JoltCircleWorld.h +18 -0
- package/platforms/ios/src/JoltCircleWorld.m +218 -0
- package/platforms/ios/src/JoltGestureSession.h +23 -0
- package/platforms/ios/src/JoltGestureSession.m +251 -0
- package/platforms/ios/src/JoltInteractiveNavigation.h +23 -0
- package/platforms/ios/src/JoltInteractiveNavigation.m +255 -0
- package/platforms/ios/src/JoltLiveSpring.h +29 -0
- package/platforms/ios/src/JoltLiveSpring.m +243 -0
- package/platforms/ios/src/JoltMotionProbe.h +9 -0
- package/platforms/ios/src/JoltMotionProbe.m +72 -0
- package/platforms/ios/src/JoltReorderSession.h +15 -0
- package/platforms/ios/src/JoltReorderSession.m +205 -0
- package/platforms/ios/src/JoltScrollHeader.h +13 -0
- package/platforms/ios/src/JoltScrollHeader.m +101 -0
- package/platforms/ios/src/JoltSensorMath.h +39 -0
- package/platforms/ios/src/JoltSensorSource.h +13 -0
- package/platforms/ios/src/JoltSensorSource.m +201 -0
- package/platforms/ios/src/JoltSharedLayoutFlight.h +19 -0
- package/platforms/ios/src/JoltSharedLayoutFlight.m +250 -0
- package/platforms/ios/src/JoltSpringState.h +35 -0
- package/platforms/ios/src/module.modulemap +10 -0
- package/src/android-plugin.d.ts +464 -0
- package/src/animate.ts +129 -15
- package/src/blur/index.ts +195 -0
- package/src/blur/native.ts +70 -0
- package/src/blur/types.ts +32 -0
- package/src/bottom-sheet/geometry.ts +84 -0
- package/src/bottom-sheet/index.ts +536 -0
- package/src/bottom-sheet/native.ts +214 -0
- package/src/config.ts +39 -1
- package/src/decay.ts +9 -0
- package/src/drag.ts +67 -21
- package/src/driver/android-gradient.ts +116 -0
- package/src/driver/android-particles.ts +118 -0
- package/src/driver/android.ts +31 -1
- package/src/driver/frame.ts +10 -0
- package/src/driver/index.ts +4 -0
- package/src/driver/ios-gradient.ts +136 -0
- package/src/driver/ios-scroll-delegate.ts +23 -0
- package/src/driver/ios.ts +10 -0
- package/src/easing.ts +21 -1
- package/src/engine.ts +209 -60
- package/src/gesture-native.ts +139 -0
- package/src/gestures/index.ts +365 -0
- package/src/glass/index.ts +218 -0
- package/src/gradient-binding.ts +158 -0
- package/src/gradient.ts +663 -0
- package/src/gravity.ts +107 -0
- package/src/haptics.ts +106 -28
- package/src/image-effect.ts +10 -2
- package/src/index.ts +56 -7
- package/src/inspector/index.ts +523 -0
- package/src/inspector/plot.ts +27 -0
- package/src/inspector/probe.ts +50 -0
- package/src/inspector/tuning.ts +51 -0
- package/src/interactive-navigation/index.ts +427 -0
- package/src/ios-plugin.d.ts +280 -0
- package/src/keyboard.ts +231 -7
- package/src/live-spring-driver.ts +181 -0
- package/src/mixer.ts +312 -0
- package/src/motion-scope.ts +39 -6
- package/src/motion-states.ts +149 -42
- package/src/motion-value.ts +1289 -0
- package/src/native/index.ts +30 -0
- package/src/native-properties.ts +188 -0
- package/src/native-property-driver.ts +123 -0
- package/src/native-property.ts +366 -0
- package/src/particles.ts +18 -17
- package/src/path.ts +2 -1
- package/src/physics/index.ts +476 -0
- package/src/physics/native.ts +121 -0
- package/src/playback-group.ts +17 -1
- package/src/playback.ts +41 -0
- package/src/predictive-back/index.ts +280 -0
- package/src/predictive-back/presentation.ts +6 -0
- package/src/press.ts +10 -2
- package/src/reorder/handle.ts +9 -0
- package/src/reorder/index.ts +243 -0
- package/src/reorder/list-view.ts +262 -0
- package/src/reorder/model.ts +47 -0
- package/src/reorder/surface.ts +10 -0
- package/src/reorder/types.ts +87 -0
- package/src/sampling.ts +173 -0
- package/src/scene-appearance.ts +92 -0
- package/src/scene-camera.ts +30 -0
- package/src/scene-shader.ts +139 -0
- package/src/scroll-header/geometry.ts +88 -0
- package/src/scroll-header/index.ts +530 -0
- package/src/scroll-header/native.ts +89 -0
- package/src/sensors/index.ts +246 -0
- package/src/sensors/native.ts +72 -0
- package/src/sequence.ts +209 -20
- package/src/shapes/android.ts +63 -0
- package/src/shapes/index.ts +267 -0
- package/src/shapes/ios.ts +194 -0
- package/src/shapes/native.ts +27 -0
- package/src/shapes/path.ts +127 -0
- package/src/shapes/types.ts +63 -0
- package/src/shared-layout/index.ts +343 -0
- package/src/shared-layout/native.ts +138 -0
- package/src/shared-layout/timing.ts +87 -0
- package/src/shared-navigation/entry.ts +695 -0
- package/src/shared-navigation/index.ts +414 -0
- package/src/shared-navigation/return-signal.ts +41 -0
- package/src/shared-navigation/return-target.ts +197 -0
- package/src/shared-navigation/scope.ts +3 -0
- package/src/shared-navigation/targets.ts +38 -0
- package/src/size-layout.ts +237 -0
- package/src/size.ts +302 -0
- package/src/spring.ts +18 -0
- package/src/svg-path.ts +8 -3
- package/src/testing/clock.ts +128 -0
- package/src/testing/handoff-recorder.ts +98 -0
- package/src/testing/index.ts +4 -0
- package/src/testing/native.ts +386 -0
- package/src/testing/presentation.ts +46 -0
- package/src/testing/replay.ts +149 -0
- package/src/testing/scroll-handoff-native.ts +201 -0
- package/src/testing/scroll-handoff.ts +140 -0
- package/src/testing/sensors.ts +41 -0
- package/src/testing/trace.ts +340 -0
- package/src/timed-animation.ts +192 -0
- package/src/track.ts +334 -38
- package/src/transition.ts +197 -9
- package/src/types.ts +11 -1
- package/src/value-observers.ts +147 -0
- package/src/value-track.ts +71 -0
- package/src/vue/index.ts +147 -1
- package/src/zoomable.ts +1 -1
package/src/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
|
+
)
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/// <reference types="@nativescript/types-ios/lib/ios/objc-x86_64/objc!SceneKit" preserve="true" />
|
|
2
|
+
import { registerNativeProperty, type NativeProperty } from './native-property.js'
|
|
3
|
+
|
|
4
|
+
/** Perspective SCNCamera field of view in degrees (1..179), on its projectionDirection axis. */
|
|
5
|
+
export const sceneKitFieldOfView: (camera: SCNCamera) => NativeProperty<number> =
|
|
6
|
+
registerNativeProperty<number>({
|
|
7
|
+
name: 'jolt.scenekit/field-of-view',
|
|
8
|
+
units: ['degrees on the camera projectionDirection axis'],
|
|
9
|
+
platforms: ['ios'],
|
|
10
|
+
spatial: true,
|
|
11
|
+
encode: (value) => [value],
|
|
12
|
+
decode: (values) => values[0]!,
|
|
13
|
+
validate(value) {
|
|
14
|
+
if (!Number.isFinite(value) || value < 1 || value > 179)
|
|
15
|
+
throw new RangeError(
|
|
16
|
+
'SceneKit field of view needs a finite angle in 1..179 degrees.',
|
|
17
|
+
)
|
|
18
|
+
},
|
|
19
|
+
interpolate: (a, b, t) => Math.max(1, Math.min(179, a + (b - a) * t)),
|
|
20
|
+
create(target) {
|
|
21
|
+
if (
|
|
22
|
+
typeof JoltReferenceProperties === 'undefined' ||
|
|
23
|
+
typeof JoltReferenceProperties.sceneFieldOfView !== 'function'
|
|
24
|
+
)
|
|
25
|
+
throw new Error(
|
|
26
|
+
'SceneKit field of view requires an updated @rafaelaugusto/jolt-native plugin. Update both packages and rebuild the native app.',
|
|
27
|
+
)
|
|
28
|
+
return JoltReferenceProperties.sceneFieldOfView(target as NSObject)
|
|
29
|
+
},
|
|
30
|
+
})
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/// <reference types="@nativescript/types-ios/lib/ios/objc-x86_64/objc!SceneKit" preserve="true" />
|
|
2
|
+
import {
|
|
3
|
+
nativePropertyTarget,
|
|
4
|
+
registerNativeProperty,
|
|
5
|
+
type NativeProperty,
|
|
6
|
+
} from './native-property.js'
|
|
7
|
+
|
|
8
|
+
export type SceneUniformType = 'float' | 'float2' | 'float3' | 'float4'
|
|
9
|
+
export type SceneUniformValue<T extends SceneUniformType> = T extends 'float'
|
|
10
|
+
? number
|
|
11
|
+
: T extends 'float2'
|
|
12
|
+
? readonly [number, number]
|
|
13
|
+
: T extends 'float3'
|
|
14
|
+
? readonly [number, number, number]
|
|
15
|
+
: readonly [number, number, number, number]
|
|
16
|
+
export interface SceneUniformOptions<T extends SceneUniformType> {
|
|
17
|
+
type: T
|
|
18
|
+
/** Finite inclusive limits applied to every component; spring overshoot is clamped. */
|
|
19
|
+
range: readonly [number, number]
|
|
20
|
+
/** One application-defined unit per component. Vectors have no implicit color conversion. */
|
|
21
|
+
units: readonly string[]
|
|
22
|
+
/** Spatial uniforms jump under Reduced Motion; appearance uniforms keep their timing. */
|
|
23
|
+
motion: 'spatial' | 'appearance'
|
|
24
|
+
}
|
|
25
|
+
function runtime() {
|
|
26
|
+
if (typeof JoltSceneShaderProperties === 'undefined')
|
|
27
|
+
throw new Error(
|
|
28
|
+
'Update @rafaelaugusto/jolt-native and rebuild the native app to use SceneKit environment and shader adapters.',
|
|
29
|
+
)
|
|
30
|
+
return JoltSceneShaderProperties
|
|
31
|
+
}
|
|
32
|
+
function sink(
|
|
33
|
+
create: (error: interop.Reference<NSError>) => JoltPropertySink | null,
|
|
34
|
+
): JoltPropertySink {
|
|
35
|
+
const error = new interop.Reference<NSError>()
|
|
36
|
+
const result = create(error)
|
|
37
|
+
if (!result)
|
|
38
|
+
throw new Error(
|
|
39
|
+
error.value?.localizedDescription ??
|
|
40
|
+
'Invalid SceneKit property target or shader schema.',
|
|
41
|
+
)
|
|
42
|
+
return result
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** Scene environment multiplier, nonnegative; leaves the environment/background images untouched. */
|
|
46
|
+
export const sceneKitEnvironmentIntensity: (scene: SCNScene) => NativeProperty<number> =
|
|
47
|
+
registerNativeProperty<number>({
|
|
48
|
+
name: 'jolt.scenekit/environment-intensity',
|
|
49
|
+
units: ['environment illumination multiplier'],
|
|
50
|
+
platforms: ['ios'],
|
|
51
|
+
encode: (value) => [value],
|
|
52
|
+
decode: (values) => values[0]!,
|
|
53
|
+
validate(value) {
|
|
54
|
+
if (!Number.isFinite(value) || value < 0)
|
|
55
|
+
throw new RangeError('Environment intensity must be finite and nonnegative.')
|
|
56
|
+
},
|
|
57
|
+
interpolate: (a, b, t) => Math.max(0, a + (b - a) * t),
|
|
58
|
+
create: (target) =>
|
|
59
|
+
sink((error) => runtime().environmentError(target as NSObject, error)),
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
/** Declared Metal shaderModifiers input, initialized by the application before attachment. */
|
|
63
|
+
export function sceneKitUniform<T extends SceneUniformType>(
|
|
64
|
+
target: SCNMaterial | SCNGeometry,
|
|
65
|
+
name: string,
|
|
66
|
+
options: SceneUniformOptions<T>,
|
|
67
|
+
): NativeProperty<SceneUniformValue<T>> {
|
|
68
|
+
if (
|
|
69
|
+
typeof name !== 'string' ||
|
|
70
|
+
!/^[A-Za-z][A-Za-z0-9_]*$/.test(name) ||
|
|
71
|
+
/^(u_|a_|v_|scn_)/.test(name)
|
|
72
|
+
)
|
|
73
|
+
throw new TypeError(
|
|
74
|
+
'Use a declared custom uniform identifier without a reserved SceneKit prefix or KVC path.',
|
|
75
|
+
)
|
|
76
|
+
if (!options || !['float', 'float2', 'float3', 'float4'].includes(options.type))
|
|
77
|
+
throw new TypeError('Shader uniforms support float, float2, float3 and float4.')
|
|
78
|
+
const count = options.type === 'float' ? 1 : Number(options.type.slice(-1))
|
|
79
|
+
const range = options.range
|
|
80
|
+
if (
|
|
81
|
+
!Array.isArray(range) ||
|
|
82
|
+
range.length !== 2 ||
|
|
83
|
+
!range.every((n) => Number.isFinite(n) && Math.abs(n) <= 3.4028234663852886e38) ||
|
|
84
|
+
range[0] >= range[1]
|
|
85
|
+
)
|
|
86
|
+
throw new RangeError('Declare an ordered finite range for the shader components.')
|
|
87
|
+
if (
|
|
88
|
+
!Array.isArray(options.units) ||
|
|
89
|
+
options.units.length !== count ||
|
|
90
|
+
options.units.some((unit) => typeof unit !== 'string' || !unit.trim())
|
|
91
|
+
)
|
|
92
|
+
throw new TypeError('Declare one nonempty unit for each shader component.')
|
|
93
|
+
if (!['spatial', 'appearance'].includes(options.motion))
|
|
94
|
+
throw new TypeError('Declare whether the shader motion is spatial or appearance.')
|
|
95
|
+
// Copy the schema: caller mutation cannot change an already attached native sink.
|
|
96
|
+
const [low, high] = range,
|
|
97
|
+
type = options.type,
|
|
98
|
+
units = [...options.units]
|
|
99
|
+
const vector = (value: SceneUniformValue<T>): number[] => {
|
|
100
|
+
const values = type === 'float' ? [value] : value
|
|
101
|
+
if (
|
|
102
|
+
!Array.isArray(values) ||
|
|
103
|
+
values.length !== count ||
|
|
104
|
+
values.some(
|
|
105
|
+
(n) => typeof n !== 'number' || !Number.isFinite(n) || n < low || n > high,
|
|
106
|
+
)
|
|
107
|
+
)
|
|
108
|
+
throw new RangeError(
|
|
109
|
+
`${name} needs ${count} finite component(s) in ${low}..${high}.`,
|
|
110
|
+
)
|
|
111
|
+
return [...values] as number[]
|
|
112
|
+
}
|
|
113
|
+
return nativePropertyTarget(target, {
|
|
114
|
+
name: `jolt.scenekit/uniform-${name}`,
|
|
115
|
+
units,
|
|
116
|
+
platforms: ['ios'],
|
|
117
|
+
spatial: options.motion === 'spatial',
|
|
118
|
+
encode: vector,
|
|
119
|
+
decode: (values) =>
|
|
120
|
+
(type === 'float' ? values[0]! : [...values]) as SceneUniformValue<T>,
|
|
121
|
+
interpolate(a, b, t) {
|
|
122
|
+
const first = vector(a),
|
|
123
|
+
last = vector(b)
|
|
124
|
+
const result = first.map((value, i) =>
|
|
125
|
+
Math.max(low, Math.min(high, value + (last[i]! - value) * t)),
|
|
126
|
+
)
|
|
127
|
+
return (type === 'float' ? result[0]! : result) as SceneUniformValue<T>
|
|
128
|
+
},
|
|
129
|
+
create: (object) =>
|
|
130
|
+
sink((error) =>
|
|
131
|
+
runtime().uniformNameConfigurationError(
|
|
132
|
+
object as NSObject,
|
|
133
|
+
name,
|
|
134
|
+
JSON.stringify({ type, low, high }),
|
|
135
|
+
error,
|
|
136
|
+
),
|
|
137
|
+
),
|
|
138
|
+
})
|
|
139
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
export interface ScrollHeaderGeometry {
|
|
2
|
+
expanded: number
|
|
3
|
+
minimum: number
|
|
4
|
+
section: number
|
|
5
|
+
range: number
|
|
6
|
+
spacer: number
|
|
7
|
+
rowHeight: number
|
|
8
|
+
parallax: number
|
|
9
|
+
divider: number
|
|
10
|
+
handoff: number
|
|
11
|
+
titleFade: readonly [number, number]
|
|
12
|
+
toolbarFade: readonly [number, number]
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function headerGeometry(
|
|
16
|
+
expanded: number,
|
|
17
|
+
minimum: number,
|
|
18
|
+
section: number,
|
|
19
|
+
rowHeight: number,
|
|
20
|
+
parallax: number,
|
|
21
|
+
divider = 0,
|
|
22
|
+
titleFade: readonly [number, number] = [0, 0.7],
|
|
23
|
+
toolbarFade: readonly [number, number] = [0.55, 0.95],
|
|
24
|
+
): ScrollHeaderGeometry {
|
|
25
|
+
if (
|
|
26
|
+
![expanded, minimum, section, rowHeight, parallax, divider].every(Number.isFinite) ||
|
|
27
|
+
divider < 0 ||
|
|
28
|
+
minimum <= 0 ||
|
|
29
|
+
expanded <= minimum ||
|
|
30
|
+
section < 0 ||
|
|
31
|
+
rowHeight <= 0 ||
|
|
32
|
+
parallax < 0 ||
|
|
33
|
+
parallax > expanded - minimum
|
|
34
|
+
)
|
|
35
|
+
throw new RangeError(
|
|
36
|
+
'scrollHeader needs expanded > minimum > 0, a positive rowHeight, and parallax within the collapse range.',
|
|
37
|
+
)
|
|
38
|
+
for (const interval of [titleFade, toolbarFade]) {
|
|
39
|
+
if (
|
|
40
|
+
!Array.isArray(interval) ||
|
|
41
|
+
interval.length !== 2 ||
|
|
42
|
+
!interval.every(Number.isFinite) ||
|
|
43
|
+
interval[0] < 0 ||
|
|
44
|
+
interval[1] > 1 ||
|
|
45
|
+
interval[0] >= interval[1]
|
|
46
|
+
)
|
|
47
|
+
throw new RangeError('Fade intervals must increase within [0, 1].')
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
divider,
|
|
51
|
+
handoff: (toolbarFade[0] + toolbarFade[1]) / 2,
|
|
52
|
+
titleFade: [...titleFade],
|
|
53
|
+
toolbarFade: [...toolbarFade],
|
|
54
|
+
expanded,
|
|
55
|
+
minimum,
|
|
56
|
+
section,
|
|
57
|
+
rowHeight,
|
|
58
|
+
parallax,
|
|
59
|
+
range: expanded - minimum,
|
|
60
|
+
spacer: expanded + section,
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** Keep the visible rows anchored when late artwork/text changes the header height. */
|
|
65
|
+
export function resizedOffset(
|
|
66
|
+
offset: number,
|
|
67
|
+
before: ScrollHeaderGeometry,
|
|
68
|
+
after: ScrollHeaderGeometry,
|
|
69
|
+
) {
|
|
70
|
+
return offset <= 0 ? 0 : Math.max(0, offset + after.spacer - before.spacer)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export function restoredOffset(
|
|
74
|
+
offset: number,
|
|
75
|
+
before: ScrollHeaderGeometry,
|
|
76
|
+
after: ScrollHeaderGeometry,
|
|
77
|
+
previousIndex: number,
|
|
78
|
+
nextIndex: number,
|
|
79
|
+
) {
|
|
80
|
+
if (offset <= 0) return 0
|
|
81
|
+
return Math.max(
|
|
82
|
+
0,
|
|
83
|
+
offset +
|
|
84
|
+
after.spacer -
|
|
85
|
+
before.spacer +
|
|
86
|
+
(nextIndex - previousIndex) * (after.rowHeight + after.divider),
|
|
87
|
+
)
|
|
88
|
+
}
|