react-native-gtkx 0.2.0-alpha.1 → 0.3.0-alpha.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 +14 -2
- package/dist/adw/widgets.generated.d.ts +4 -4
- package/dist/adw/widgets.generated.js +51 -51
- package/dist/adw/widgets.generated.js.map +1 -1
- package/dist/aliases/index.d.ts +84 -0
- package/dist/aliases/index.js +208 -0
- package/dist/aliases/index.js.map +1 -0
- package/dist/animated/create-animated.d.ts +2 -0
- package/dist/animated/create-animated.js +2 -0
- package/dist/animated/create-animated.js.map +1 -1
- package/dist/animated/index.d.ts +4 -0
- package/dist/animated/index.js +6 -0
- package/dist/animated/index.js.map +1 -1
- package/dist/animated/types.d.ts +1 -0
- package/dist/animated/types.js.map +1 -1
- package/dist/animated/value-animation.js +17 -4
- package/dist/animated/value-animation.js.map +1 -1
- package/dist/animated/value-xy.d.ts +41 -0
- package/dist/animated/value-xy.js +90 -0
- package/dist/animated/value-xy.js.map +1 -0
- package/dist/animated/value.d.ts +9 -0
- package/dist/animated/value.js +30 -2
- package/dist/animated/value.js.map +1 -1
- package/dist/apis/host.gtkx.js +9 -12
- package/dist/apis/host.gtkx.js.map +1 -1
- package/dist/apis/index.d.ts +4 -2
- package/dist/apis/index.js +2 -0
- package/dist/apis/index.js.map +1 -1
- package/dist/apis/keyboard.d.ts +60 -0
- package/dist/apis/keyboard.js +63 -0
- package/dist/apis/keyboard.js.map +1 -0
- package/dist/apis/log-box.d.ts +15 -0
- package/dist/apis/log-box.js +46 -0
- package/dist/apis/log-box.js.map +1 -0
- package/dist/apis/platform.d.ts +18 -1
- package/dist/apis/platform.js.map +1 -1
- package/dist/common/icon.d.ts +23 -0
- package/dist/common/icon.js +14 -0
- package/dist/common/icon.js.map +1 -0
- package/dist/common/index.d.ts +1 -0
- package/dist/common/index.js +25 -0
- package/dist/common/index.js.map +1 -1
- package/dist/common/widget.d.ts +1 -22
- package/dist/common/widget.js +75 -8
- package/dist/common/widget.js.map +1 -1
- package/dist/components/animated.d.ts +73 -7
- package/dist/components/animated.js +560 -45
- package/dist/components/animated.js.map +1 -1
- package/dist/components/app-registry.d.ts +26 -0
- package/dist/components/app-registry.js.map +1 -1
- package/dist/components/driven-size.d.ts +27 -0
- package/dist/components/driven-size.js +85 -0
- package/dist/components/driven-size.js.map +1 -0
- package/dist/components/find-node-handle.d.ts +11 -0
- package/dist/components/find-node-handle.js +53 -0
- package/dist/components/find-node-handle.js.map +1 -0
- package/dist/components/flat-list.d.ts +3 -2
- package/dist/components/flat-list.js.map +1 -1
- package/dist/components/frame-scheduler.d.ts +16 -0
- package/dist/components/frame-scheduler.js +37 -0
- package/dist/components/frame-scheduler.js.map +1 -0
- package/dist/components/host-node.d.ts +7 -0
- package/dist/components/host-node.js +26 -1
- package/dist/components/host-node.js.map +1 -1
- package/dist/components/image.d.ts +6 -1
- package/dist/components/image.js +15 -4
- package/dist/components/image.js.map +1 -1
- package/dist/components/index.d.ts +11 -5
- package/dist/components/index.js +7 -4
- package/dist/components/index.js.map +1 -1
- package/dist/components/measure.d.ts +63 -0
- package/dist/components/measure.js +150 -0
- package/dist/components/measure.js.map +1 -0
- package/dist/components/modal.d.ts +1 -1
- package/dist/components/press-event.d.ts +28 -0
- package/dist/components/press-event.js +46 -0
- package/dist/components/press-event.js.map +1 -0
- package/dist/components/pressable.d.ts +63 -7
- package/dist/components/pressable.js +165 -12
- package/dist/components/pressable.js.map +1 -1
- package/dist/components/rect-store.d.ts +58 -0
- package/dist/components/rect-store.js +124 -3
- package/dist/components/rect-store.js.map +1 -1
- package/dist/components/root.js +6 -1
- package/dist/components/root.js.map +1 -1
- package/dist/components/scroll-phase.d.ts +35 -0
- package/dist/components/scroll-phase.js +26 -0
- package/dist/components/scroll-phase.js.map +1 -0
- package/dist/components/scroll-view.d.ts +43 -3
- package/dist/components/scroll-view.js +386 -45
- package/dist/components/scroll-view.js.map +1 -1
- package/dist/components/text-input.js +9 -25
- package/dist/components/text-input.js.map +1 -1
- package/dist/components/text.d.ts +6 -2
- package/dist/components/text.js +68 -9
- package/dist/components/text.js.map +1 -1
- package/dist/components/use-focus.d.ts +27 -0
- package/dist/components/use-focus.js +116 -0
- package/dist/components/use-focus.js.map +1 -0
- package/dist/components/use-layout-child.d.ts +13 -1
- package/dist/components/use-layout-child.js +205 -19
- package/dist/components/use-layout-child.js.map +1 -1
- package/dist/components/view.d.ts +12 -4
- package/dist/components/view.js +25 -14
- package/dist/components/view.js.map +1 -1
- package/dist/components/virtualized-list.d.ts +45 -5
- package/dist/components/virtualized-list.js +90 -24
- package/dist/components/virtualized-list.js.map +1 -1
- package/dist/components/wheel-scroll-session.d.ts +7 -0
- package/dist/components/wheel-scroll-session.js +53 -0
- package/dist/components/wheel-scroll-session.js.map +1 -0
- package/dist/components/widget-retention.d.ts +35 -0
- package/dist/components/widget-retention.js +169 -0
- package/dist/components/widget-retention.js.map +1 -0
- package/dist/contracts.d.ts +23 -3
- package/dist/contracts.js.map +1 -1
- package/dist/dnd/context.d.ts +69 -0
- package/dist/dnd/context.js +149 -0
- package/dist/dnd/context.js.map +1 -0
- package/dist/dnd/draggable.d.ts +59 -0
- package/dist/dnd/draggable.js +149 -0
- package/dist/dnd/draggable.js.map +1 -0
- package/dist/dnd/droppable.d.ts +24 -0
- package/dist/dnd/droppable.js +74 -0
- package/dist/dnd/droppable.js.map +1 -0
- package/dist/dnd/gtk-controllers.d.ts +39 -0
- package/dist/dnd/gtk-controllers.js +110 -0
- package/dist/dnd/gtk-controllers.js.map +1 -0
- package/dist/dnd/index.d.ts +6 -0
- package/dist/dnd/index.js +31 -0
- package/dist/dnd/index.js.map +1 -0
- package/dist/dnd/order.d.ts +7 -0
- package/dist/dnd/order.js +20 -0
- package/dist/dnd/order.js.map +1 -0
- package/dist/dnd/payload.d.ts +14 -0
- package/dist/dnd/payload.js +41 -0
- package/dist/dnd/payload.js.map +1 -0
- package/dist/dnd/sortable.d.ts +49 -0
- package/dist/dnd/sortable.js +307 -0
- package/dist/dnd/sortable.js.map +1 -0
- package/dist/dnd/types.d.ts +290 -0
- package/dist/dnd/types.js +25 -0
- package/dist/dnd/types.js.map +1 -0
- package/dist/gesture-handler-compat/builder.d.ts +251 -0
- package/dist/gesture-handler-compat/builder.js +513 -0
- package/dist/gesture-handler-compat/builder.js.map +1 -0
- package/dist/gesture-handler-compat/composition.d.ts +23 -0
- package/dist/gesture-handler-compat/composition.js +111 -0
- package/dist/gesture-handler-compat/composition.js.map +1 -0
- package/dist/gesture-handler-compat/deciders.d.ts +3 -0
- package/dist/gesture-handler-compat/deciders.js +47 -0
- package/dist/gesture-handler-compat/deciders.js.map +1 -0
- package/dist/gesture-handler-compat/detector-runtime.d.ts +44 -0
- package/dist/gesture-handler-compat/detector-runtime.js +374 -0
- package/dist/gesture-handler-compat/detector-runtime.js.map +1 -0
- package/dist/gesture-handler-compat/detector.d.ts +22 -0
- package/dist/gesture-handler-compat/detector.js +104 -0
- package/dist/gesture-handler-compat/detector.js.map +1 -0
- package/dist/gesture-handler-compat/fling.d.ts +24 -0
- package/dist/gesture-handler-compat/fling.js +123 -0
- package/dist/gesture-handler-compat/fling.js.map +1 -0
- package/dist/gesture-handler-compat/force-touch.d.ts +13 -0
- package/dist/gesture-handler-compat/force-touch.js +40 -0
- package/dist/gesture-handler-compat/force-touch.js.map +1 -0
- package/dist/gesture-handler-compat/hooks.d.ts +157 -0
- package/dist/gesture-handler-compat/hooks.js +268 -0
- package/dist/gesture-handler-compat/hooks.js.map +1 -0
- package/dist/gesture-handler-compat/hover.d.ts +2 -0
- package/dist/gesture-handler-compat/hover.js +22 -0
- package/dist/gesture-handler-compat/hover.js.map +1 -0
- package/dist/gesture-handler-compat/index.d.ts +98 -0
- package/dist/gesture-handler-compat/index.js +255 -0
- package/dist/gesture-handler-compat/index.js.map +1 -0
- package/dist/gesture-handler-compat/long-press.d.ts +6 -0
- package/dist/gesture-handler-compat/long-press.js +21 -0
- package/dist/gesture-handler-compat/long-press.js.map +1 -0
- package/dist/gesture-handler-compat/manual.d.ts +2 -0
- package/dist/gesture-handler-compat/manual.js +18 -0
- package/dist/gesture-handler-compat/manual.js.map +1 -0
- package/dist/gesture-handler-compat/native.d.ts +7 -0
- package/dist/gesture-handler-compat/native.js +34 -0
- package/dist/gesture-handler-compat/native.js.map +1 -0
- package/dist/gesture-handler-compat/orchestrator.d.ts +77 -0
- package/dist/gesture-handler-compat/orchestrator.js +284 -0
- package/dist/gesture-handler-compat/orchestrator.js.map +1 -0
- package/dist/gesture-handler-compat/pan.d.ts +23 -0
- package/dist/gesture-handler-compat/pan.js +116 -0
- package/dist/gesture-handler-compat/pan.js.map +1 -0
- package/dist/gesture-handler-compat/recognizer.d.ts +268 -0
- package/dist/gesture-handler-compat/recognizer.js +1056 -0
- package/dist/gesture-handler-compat/recognizer.js.map +1 -0
- package/dist/gesture-handler-compat/relations.d.ts +43 -0
- package/dist/gesture-handler-compat/relations.js +128 -0
- package/dist/gesture-handler-compat/relations.js.map +1 -0
- package/dist/gesture-handler-compat/tap.d.ts +6 -0
- package/dist/gesture-handler-compat/tap.js +29 -0
- package/dist/gesture-handler-compat/tap.js.map +1 -0
- package/dist/gesture-handler-compat/touchpad.d.ts +41 -0
- package/dist/gesture-handler-compat/touchpad.js +64 -0
- package/dist/gesture-handler-compat/touchpad.js.map +1 -0
- package/dist/gesture-handler-compat/types.d.ts +441 -0
- package/dist/gesture-handler-compat/types.js +167 -0
- package/dist/gesture-handler-compat/types.js.map +1 -0
- package/dist/gtk/controllers.d.ts +39 -0
- package/dist/gtk/controllers.js +92 -0
- package/dist/gtk/controllers.js.map +1 -0
- package/dist/gtk/index.d.ts +3 -1
- package/dist/gtk/index.js +14 -1
- package/dist/gtk/index.js.map +1 -1
- package/dist/gtk/widgets.generated.d.ts +14 -14
- package/dist/gtk/widgets.generated.js +101 -102
- package/dist/gtk/widgets.generated.js.map +1 -1
- package/dist/gtk/window-actions.d.ts +77 -0
- package/dist/gtk/window-actions.js +193 -0
- package/dist/gtk/window-actions.js.map +1 -0
- package/dist/gtkx/bridge/geometry.d.ts +15 -0
- package/dist/gtkx/bridge/geometry.js +40 -0
- package/dist/gtkx/bridge/geometry.js.map +1 -0
- package/dist/gtkx/bridge/index.d.ts +7 -3
- package/dist/gtkx/bridge/index.js +12 -4
- package/dist/gtkx/bridge/index.js.map +1 -1
- package/dist/gtkx/bridge/slot-portal.d.ts +12 -0
- package/dist/gtkx/bridge/slot-portal.js +17 -0
- package/dist/gtkx/bridge/slot-portal.js.map +1 -0
- package/dist/gtkx/bridge/svg-node.js +10 -54
- package/dist/gtkx/bridge/svg-node.js.map +1 -1
- package/dist/gtkx/bridge/use-signal.js +2 -2
- package/dist/gtkx/bridge/use-signal.js.map +1 -1
- package/dist/gtkx/bridge/view-box.d.ts +56 -0
- package/dist/gtkx/bridge/view-box.js +394 -9
- package/dist/gtkx/bridge/view-box.js.map +1 -1
- package/dist/gtkx/bridge/widget-css.d.ts +17 -0
- package/dist/gtkx/bridge/widget-css.js +72 -0
- package/dist/gtkx/bridge/widget-css.js.map +1 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/layout/driven-size.d.ts +12 -0
- package/dist/layout/driven-size.js +70 -0
- package/dist/layout/driven-size.js.map +1 -0
- package/dist/layout/engine.d.ts +17 -1
- package/dist/layout/engine.js +3 -20
- package/dist/layout/engine.js.map +1 -1
- package/dist/layout/node.d.ts +13 -0
- package/dist/layout/node.js +14 -0
- package/dist/layout/node.js.map +1 -1
- package/dist/layout/yoga.d.ts +3 -2
- package/dist/layout/yoga.js +5 -2
- package/dist/layout/yoga.js.map +1 -1
- package/dist/mcp/data/generated.d.ts +310 -91
- package/dist/mcp/data/generated.js +365 -90
- package/dist/mcp/data/generated.js.map +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/mcp/server.js.map +1 -1
- package/dist/metro/index.d.ts +10 -0
- package/dist/metro/index.js +21 -12
- package/dist/metro/index.js.map +1 -1
- package/dist/navigation/sidebar.d.ts +47 -1
- package/dist/navigation/sidebar.js +77 -3
- package/dist/navigation/sidebar.js.map +1 -1
- package/dist/reanimated-compat/animated-ref.d.ts +32 -0
- package/dist/reanimated-compat/animated-ref.js +57 -0
- package/dist/reanimated-compat/animated-ref.js.map +1 -0
- package/dist/reanimated-compat/animation.d.ts +177 -0
- package/dist/reanimated-compat/animation.js +540 -0
- package/dist/reanimated-compat/animation.js.map +1 -0
- package/dist/reanimated-compat/color.d.ts +28 -0
- package/dist/reanimated-compat/color.js +249 -0
- package/dist/reanimated-compat/color.js.map +1 -0
- package/dist/reanimated-compat/decay.d.ts +39 -0
- package/dist/reanimated-compat/decay.js +96 -0
- package/dist/reanimated-compat/decay.js.map +1 -0
- package/dist/reanimated-compat/easing.d.ts +30 -0
- package/dist/reanimated-compat/easing.js +76 -0
- package/dist/reanimated-compat/easing.js.map +1 -0
- package/dist/reanimated-compat/hooks.d.ts +14 -0
- package/dist/reanimated-compat/hooks.js +217 -0
- package/dist/reanimated-compat/hooks.js.map +1 -0
- package/dist/reanimated-compat/index.d.ts +258 -0
- package/dist/reanimated-compat/index.js +464 -0
- package/dist/reanimated-compat/index.js.map +1 -0
- package/dist/reanimated-compat/interpolation.d.ts +18 -0
- package/dist/reanimated-compat/interpolation.js +122 -0
- package/dist/reanimated-compat/interpolation.js.map +1 -0
- package/dist/reanimated-compat/layout-animation-config.d.ts +43 -0
- package/dist/reanimated-compat/layout-animation-config.js +78 -0
- package/dist/reanimated-compat/layout-animation-config.js.map +1 -0
- package/dist/reanimated-compat/layout-animation-presets.d.ts +117 -0
- package/dist/reanimated-compat/layout-animation-presets.js +498 -0
- package/dist/reanimated-compat/layout-animation-presets.js.map +1 -0
- package/dist/reanimated-compat/layout-animation-runtime.d.ts +21 -0
- package/dist/reanimated-compat/layout-animation-runtime.js +311 -0
- package/dist/reanimated-compat/layout-animation-runtime.js.map +1 -0
- package/dist/reanimated-compat/layout-animation-view.d.ts +27 -0
- package/dist/reanimated-compat/layout-animation-view.js +266 -0
- package/dist/reanimated-compat/layout-animation-view.js.map +1 -0
- package/dist/reanimated-compat/layout-animation.d.ts +171 -0
- package/dist/reanimated-compat/layout-animation.js +469 -0
- package/dist/reanimated-compat/layout-animation.js.map +1 -0
- package/dist/reanimated-compat/layout-transitions.d.ts +83 -0
- package/dist/reanimated-compat/layout-transitions.js +350 -0
- package/dist/reanimated-compat/layout-transitions.js.map +1 -0
- package/dist/reanimated-compat/mutable.d.ts +29 -0
- package/dist/reanimated-compat/mutable.js +139 -0
- package/dist/reanimated-compat/mutable.js.map +1 -0
- package/dist/reanimated-compat/props.d.ts +18 -0
- package/dist/reanimated-compat/props.js +111 -0
- package/dist/reanimated-compat/props.js.map +1 -0
- package/dist/reanimated-compat/scroll-handler.d.ts +119 -0
- package/dist/reanimated-compat/scroll-handler.js +274 -0
- package/dist/reanimated-compat/scroll-handler.js.map +1 -0
- package/dist/reanimated-compat/scroll-offset.d.ts +12 -0
- package/dist/reanimated-compat/scroll-offset.js +104 -0
- package/dist/reanimated-compat/scroll-offset.js.map +1 -0
- package/dist/reanimated-compat/style.d.ts +90 -0
- package/dist/reanimated-compat/style.js +452 -0
- package/dist/reanimated-compat/style.js.map +1 -0
- package/dist/reanimated-compat/test-timers.d.ts +28 -0
- package/dist/reanimated-compat/test-timers.js +136 -0
- package/dist/reanimated-compat/test-timers.js.map +1 -0
- package/dist/reanimated-compat/threads.d.ts +13 -0
- package/dist/reanimated-compat/threads.js +41 -0
- package/dist/reanimated-compat/threads.js.map +1 -0
- package/dist/reanimated-compat/tracking.d.ts +41 -0
- package/dist/reanimated-compat/tracking.js +106 -0
- package/dist/reanimated-compat/tracking.js.map +1 -0
- package/dist/reanimated-compat/updater-animations.d.ts +36 -0
- package/dist/reanimated-compat/updater-animations.js +273 -0
- package/dist/reanimated-compat/updater-animations.js.map +1 -0
- package/dist/responder/system.d.ts +100 -0
- package/dist/responder/system.js +304 -0
- package/dist/responder/system.js.map +1 -0
- package/dist/responder/touch-history.d.ts +10 -0
- package/dist/responder/touch-history.js +78 -0
- package/dist/responder/touch-history.js.map +1 -0
- package/dist/responder/types.d.ts +63 -0
- package/dist/responder/types.js +29 -0
- package/dist/responder/types.js.map +1 -0
- package/dist/responder/use-responder.d.ts +23 -0
- package/dist/responder/use-responder.js +317 -0
- package/dist/responder/use-responder.js.map +1 -0
- package/dist/runner/host-dev.js +4 -2
- package/dist/runner/host-dev.js.map +1 -1
- package/dist/runner/host.js +6 -2
- package/dist/runner/host.js.map +1 -1
- package/dist/runner/index.js +3 -3
- package/dist/runner/index.js.map +1 -1
- package/dist/sea/gtkx-config-module.js +2 -2
- package/dist/sea/gtkx-config-module.js.map +1 -1
- package/dist/style/absolute-insets.d.ts +26 -0
- package/dist/style/absolute-insets.js +113 -0
- package/dist/style/absolute-insets.js.map +1 -0
- package/dist/style/animated-size.d.ts +25 -0
- package/dist/style/animated-size.js +225 -0
- package/dist/style/animated-size.js.map +1 -0
- package/dist/style/box-shadow.d.ts +7 -0
- package/dist/style/box-shadow.js +197 -0
- package/dist/style/box-shadow.js.map +1 -0
- package/dist/style/colors.d.ts +17 -0
- package/dist/style/colors.js +25 -6
- package/dist/style/colors.js.map +1 -1
- package/dist/style/imperative-css.d.ts +21 -0
- package/dist/style/imperative-css.js +63 -0
- package/dist/style/imperative-css.js.map +1 -0
- package/dist/style/index.d.ts +4 -1
- package/dist/style/index.js +4 -1
- package/dist/style/index.js.map +1 -1
- package/dist/style/split-style.d.ts +5 -2
- package/dist/style/split-style.js +36 -3
- package/dist/style/split-style.js.map +1 -1
- package/dist/style/text-decoration.d.ts +15 -0
- package/dist/style/text-decoration.js +26 -0
- package/dist/style/text-decoration.js.map +1 -0
- package/dist/style/visual-css.js +37 -1
- package/dist/style/visual-css.js.map +1 -1
- package/dist/svg/gradient-geometry.js +2 -5
- package/dist/svg/gradient-geometry.js.map +1 -1
- package/dist/testing/index.js.map +1 -1
- package/dist/unsupported-export.d.ts +8 -0
- package/dist/unsupported-export.js +66 -0
- package/dist/unsupported-export.js.map +1 -0
- package/dist/vendor/react-native/pan-responder.d.ts +102 -0
- package/dist/vendor/react-native/pan-responder.js +196 -0
- package/dist/vendor/react-native/pan-responder.js.map +1 -0
- package/dist/vendor/react-native/touch-history-math.d.ts +18 -0
- package/dist/vendor/react-native/touch-history-math.js +102 -0
- package/dist/vendor/react-native/touch-history-math.js.map +1 -0
- package/dist/vite/index.d.ts +21 -8
- package/dist/vite/index.js +127 -82
- package/dist/vite/index.js.map +1 -1
- package/dist/vitest/index.d.ts +2 -2
- package/dist/vitest/index.js.map +1 -1
- package/dist/worklets-compat/index.d.ts +4 -0
- package/dist/worklets-compat/index.js +28 -0
- package/dist/worklets-compat/index.js.map +1 -0
- package/dist/worklets-compat/surface.d.ts +110 -0
- package/dist/worklets-compat/surface.js +153 -0
- package/dist/worklets-compat/surface.js.map +1 -0
- package/package.json +25 -9
- package/types.d.ts +9 -0
|
@@ -5,8 +5,10 @@ import { createDelay, loop, parallel, sequence } from "./composite";
|
|
|
5
5
|
import { createSpring } from "./spring";
|
|
6
6
|
import { createTiming } from "./timing";
|
|
7
7
|
import { AnimatedValue } from "./value";
|
|
8
|
+
import { AnimatedValueXY } from "./value-xy";
|
|
8
9
|
export const createAnimated = (scheduler) => ({
|
|
9
10
|
Value: AnimatedValue,
|
|
11
|
+
ValueXY: AnimatedValueXY,
|
|
10
12
|
timing: (value, config) => createTiming(scheduler, value, config),
|
|
11
13
|
spring: (value, config) => createSpring(scheduler, value, config),
|
|
12
14
|
sequence,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-animated.js","sourceRoot":"","sources":["../../src/animated/create-animated.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,gDAAgD;AAChD,0DAA0D;AAE1D,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AASvC,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"create-animated.js","sourceRoot":"","sources":["../../src/animated/create-animated.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,gDAAgD;AAChD,0DAA0D;AAE1D,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AASvC,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAgB5C,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,SAAyB,EAAe,EAAE,CAAC,CAAC;IACzE,KAAK,EAAE,aAAa;IACpB,OAAO,EAAE,eAAe;IACxB,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,YAAY,CAAC,SAAS,EAAE,KAAK,EAAE,MAAM,CAAC;IACjE,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,YAAY,CAAC,SAAS,EAAE,KAAK,EAAE,MAAM,CAAC;IACjE,QAAQ;IACR,QAAQ;IACR,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,WAAW,CAAC,SAAS,EAAE,EAAE,CAAC;IACzC,IAAI;CACL,CAAC,CAAA","sourcesContent":["// Factory wiring the frame driver into the whole Animated API. The GTK side\n// passes a scheduler backed by the frame clock;\n// tests pass a manual scheduler and drive frames by hand.\n\nimport { createDelay, loop, parallel, sequence } from \"./composite\"\nimport { createSpring } from \"./spring\"\nimport { createTiming } from \"./timing\"\nimport type {\n CompositeAnimation,\n FrameScheduler,\n LoopConfig,\n ParallelConfig,\n SpringConfig,\n TimingConfig,\n} from \"./types\"\nimport { AnimatedValue } from \"./value\"\nimport { AnimatedValueXY } from \"./value-xy\"\n\nexport type AnimatedApi = {\n Value: typeof AnimatedValue\n ValueXY: typeof AnimatedValueXY\n timing(value: AnimatedValue, config: TimingConfig): CompositeAnimation\n spring(value: AnimatedValue, config: SpringConfig): CompositeAnimation\n sequence(animations: CompositeAnimation[]): CompositeAnimation\n parallel(\n animations: CompositeAnimation[],\n config?: ParallelConfig,\n ): CompositeAnimation\n delay(ms: number): CompositeAnimation\n loop(animation: CompositeAnimation, config?: LoopConfig): CompositeAnimation\n}\n\nexport const createAnimated = (scheduler: FrameScheduler): AnimatedApi => ({\n Value: AnimatedValue,\n ValueXY: AnimatedValueXY,\n timing: (value, config) => createTiming(scheduler, value, config),\n spring: (value, config) => createSpring(scheduler, value, config),\n sequence,\n parallel,\n delay: (ms) => createDelay(scheduler, ms),\n loop,\n})\n"]}
|
package/dist/animated/index.d.ts
CHANGED
|
@@ -4,3 +4,7 @@ export type { EasingFunction } from "./easing";
|
|
|
4
4
|
export { Easing } from "./easing";
|
|
5
5
|
export type { CompositeAnimation, EndCallback, EndResult, ExtrapolateType, FrameScheduler, InterpolationConfig, InterpolationListener, LoopConfig, ParallelConfig, SpringConfig, TimingConfig, ValueListener, } from "./types";
|
|
6
6
|
export { AnimatedInterpolation, AnimatedValue } from "./value";
|
|
7
|
+
export { createValueAnimation } from "./value-animation";
|
|
8
|
+
export type { MakeStep, StepFn, StepResult } from "./value-animation";
|
|
9
|
+
export { AnimatedValueXY } from "./value-xy";
|
|
10
|
+
export type { ValueXYListener, ValueXYLiteral } from "./value-xy";
|
package/dist/animated/index.js
CHANGED
|
@@ -4,4 +4,10 @@
|
|
|
4
4
|
export { createAnimated } from "./create-animated";
|
|
5
5
|
export { Easing } from "./easing";
|
|
6
6
|
export { AnimatedInterpolation, AnimatedValue } from "./value";
|
|
7
|
+
// The frame-driven lifecycle every single-value animation shares. Not part of
|
|
8
|
+
// `AnimatedApi` — RN's `Animated` has no such method and this object is spread
|
|
9
|
+
// into the public one — but exported because a layer built ON this engine may
|
|
10
|
+
// need a per-frame step RN itself does not have: `withDecay` is the first.
|
|
11
|
+
export { createValueAnimation } from "./value-animation";
|
|
12
|
+
export { AnimatedValueXY } from "./value-xy";
|
|
7
13
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/animated/index.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,uEAAuE;AACvE,mCAAmC;AAGnC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAElD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAejC,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA","sourcesContent":["// Animated module entry point. Pure by contract: everything is driven by an\n// injected FrameScheduler — the GTK frame clock is connected where the\n// Animated.* components are built.\n\nexport type { AnimatedApi } from \"./create-animated\"\nexport { createAnimated } from \"./create-animated\"\nexport type { EasingFunction } from \"./easing\"\nexport { Easing } from \"./easing\"\nexport type {\n CompositeAnimation,\n EndCallback,\n EndResult,\n ExtrapolateType,\n FrameScheduler,\n InterpolationConfig,\n InterpolationListener,\n LoopConfig,\n ParallelConfig,\n SpringConfig,\n TimingConfig,\n ValueListener,\n} from \"./types\"\nexport { AnimatedInterpolation, AnimatedValue } from \"./value\"\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/animated/index.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,uEAAuE;AACvE,mCAAmC;AAGnC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAElD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAejC,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAC9D,8EAA8E;AAC9E,+EAA+E;AAC/E,8EAA8E;AAC9E,2EAA2E;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAA;AAExD,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA","sourcesContent":["// Animated module entry point. Pure by contract: everything is driven by an\n// injected FrameScheduler — the GTK frame clock is connected where the\n// Animated.* components are built.\n\nexport type { AnimatedApi } from \"./create-animated\"\nexport { createAnimated } from \"./create-animated\"\nexport type { EasingFunction } from \"./easing\"\nexport { Easing } from \"./easing\"\nexport type {\n CompositeAnimation,\n EndCallback,\n EndResult,\n ExtrapolateType,\n FrameScheduler,\n InterpolationConfig,\n InterpolationListener,\n LoopConfig,\n ParallelConfig,\n SpringConfig,\n TimingConfig,\n ValueListener,\n} from \"./types\"\nexport { AnimatedInterpolation, AnimatedValue } from \"./value\"\n// The frame-driven lifecycle every single-value animation shares. Not part of\n// `AnimatedApi` — RN's `Animated` has no such method and this object is spread\n// into the public one — but exported because a layer built ON this engine may\n// need a per-frame step RN itself does not have: `withDecay` is the first.\nexport { createValueAnimation } from \"./value-animation\"\nexport type { MakeStep, StepFn, StepResult } from \"./value-animation\"\nexport { AnimatedValueXY } from \"./value-xy\"\nexport type { ValueXYListener, ValueXYLiteral } from \"./value-xy\"\n"]}
|
package/dist/animated/types.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/animated/types.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,wEAAwE;AACxE,4EAA4E;AAC5E,mCAAmC","sourcesContent":["// Public contracts of the Animated module. The module is pure: no bridge or\n// gtkx imports, no timers, no Date — time only ever arrives through the\n// injected FrameScheduler, so the GTK frame clock (production) and a manual\n// test driver are interchangeable.\n\nimport type { EasingFunction } from \"./easing\"\n\n// Frame driver injected by the host (GTK frame clock in production, a manual\n// scheduler in tests). schedule() books a one-shot callback for the next\n// frame — re-book from inside the callback to keep ticking — and returns an\n// unsubscribe that cancels the pending callback.\nexport type FrameScheduler = {\n schedule(cb: (timeMs: number) => void): () => void\n}\n\nexport type EndResult = { finished: boolean }\n\nexport type EndCallback = (result: EndResult) => void\n\n// RN CompositeAnimation subset, plus reset() which loop() relies on to snap\n// values back before each iteration (RN has it too).\nexport type CompositeAnimation = {\n start(callback?: EndCallback): void\n stop(): void\n reset(): void\n}\n\nexport type ValueListener = (event: { value: number }) => void\n\nexport type InterpolationListener = (event: { value: number | string }) => void\n\nexport type ExtrapolateType = \"extend\" | \"clamp\" | \"identity\"\n\nexport type InterpolationConfig = {\n inputRange: number[]\n outputRange: number[] | string[]\n // Applied to both sides of the input range (RN's extrapolateLeft/Right are\n // not split out in this subset). Default: \"extend\".\n extrapolate?: ExtrapolateType\n}\n\nexport type TimingConfig = {\n toValue: number\n duration?: number\n delay?: number\n easing?: EasingFunction\n // Accepted for RN source compatibility; the GTK backend has no native\n // driver (everything already runs on the direct frame-clock path), so the\n // flag is ignored with a single dev warning per session.\n useNativeDriver?: boolean\n}\n\nexport type SpringConfig = {\n toValue: number\n stiffness?: number\n damping?: number\n mass?: number\n initialVelocity?: number\n overshootClamping?: boolean\n restDisplacementThreshold?: number\n restSpeedThreshold?: number\n delay?: number\n useNativeDriver?: boolean\n}\n\nexport type ParallelConfig = {\n // Like RN: when one child ends unfinished, stop the remaining ones too.\n // Default: true.\n stopTogether?: boolean\n}\n\nexport type LoopConfig = {\n // -1 (default) loops forever.\n iterations?: number\n // Snap the child animation back to its starting value before every\n // iteration (RN default: true).\n resetBeforeIteration?: boolean\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/animated/types.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,wEAAwE;AACxE,4EAA4E;AAC5E,mCAAmC","sourcesContent":["// Public contracts of the Animated module. The module is pure: no bridge or\n// gtkx imports, no timers, no Date — time only ever arrives through the\n// injected FrameScheduler, so the GTK frame clock (production) and a manual\n// test driver are interchangeable.\n\nimport type { EasingFunction } from \"./easing\"\n\n// Frame driver injected by the host (GTK frame clock in production, a manual\n// scheduler in tests). schedule() books a one-shot callback for the next\n// frame — re-book from inside the callback to keep ticking — and returns an\n// unsubscribe that cancels the pending callback.\n//\n// `now()` reads the SAME clock the frame callback is stamped with, off-frame.\n// It is what lets an animation anchor t = 0 to the moment it was started\n// rather than to the first frame that happens to arrive — see\n// value-animation.ts, which explains why that distinction is worth a method.\n// Optional so a driver that only has frame stamps still satisfies the type.\nexport type FrameScheduler = {\n schedule(cb: (timeMs: number) => void): () => void\n now?(): number\n}\n\nexport type EndResult = { finished: boolean }\n\nexport type EndCallback = (result: EndResult) => void\n\n// RN CompositeAnimation subset, plus reset() which loop() relies on to snap\n// values back before each iteration (RN has it too).\nexport type CompositeAnimation = {\n start(callback?: EndCallback): void\n stop(): void\n reset(): void\n}\n\nexport type ValueListener = (event: { value: number }) => void\n\nexport type InterpolationListener = (event: { value: number | string }) => void\n\nexport type ExtrapolateType = \"extend\" | \"clamp\" | \"identity\"\n\nexport type InterpolationConfig = {\n inputRange: number[]\n outputRange: number[] | string[]\n // Applied to both sides of the input range (RN's extrapolateLeft/Right are\n // not split out in this subset). Default: \"extend\".\n extrapolate?: ExtrapolateType\n}\n\nexport type TimingConfig = {\n toValue: number\n duration?: number\n delay?: number\n easing?: EasingFunction\n // Accepted for RN source compatibility; the GTK backend has no native\n // driver (everything already runs on the direct frame-clock path), so the\n // flag is ignored with a single dev warning per session.\n useNativeDriver?: boolean\n}\n\nexport type SpringConfig = {\n toValue: number\n stiffness?: number\n damping?: number\n mass?: number\n initialVelocity?: number\n overshootClamping?: boolean\n restDisplacementThreshold?: number\n restSpeedThreshold?: number\n delay?: number\n useNativeDriver?: boolean\n}\n\nexport type ParallelConfig = {\n // Like RN: when one child ends unfinished, stop the remaining ones too.\n // Default: true.\n stopTogether?: boolean\n}\n\nexport type LoopConfig = {\n // -1 (default) loops forever.\n iterations?: number\n // Snap the child animation back to its starting value before every\n // iteration (RN default: true).\n resetBeforeIteration?: boolean\n}\n"]}
|
|
@@ -2,15 +2,28 @@
|
|
|
2
2
|
// spring). Implements the RN semantics: a value runs at most one animation —
|
|
3
3
|
// a newer start() preempts the previous one with { finished: false }; natural
|
|
4
4
|
// completion reports { finished: true }; a finished or stopped run drops its
|
|
5
|
-
// frame subscription immediately (no idle ticks).
|
|
6
|
-
//
|
|
7
|
-
//
|
|
5
|
+
// frame subscription immediately (no idle ticks).
|
|
6
|
+
//
|
|
7
|
+
// t = 0 IS THE MOMENT start() WAS CALLED, read off the scheduler's own clock.
|
|
8
|
+
// It used to be the first frame that arrived, which cost every animation on
|
|
9
|
+
// this platform a frame it never used: the first callback lands ~16 ms after
|
|
10
|
+
// start(), evaluates step(0) — the start value by definition — and writes it
|
|
11
|
+
// back unchanged, so nothing MOVES until the second frame, ~32 ms in. A 300 ms
|
|
12
|
+
// fade also RAN for 316 ms rather than 300. Anchoring at start() is what RN's
|
|
13
|
+
// own TimingAnimation (`_startTime = Date.now()` inside start()) and
|
|
14
|
+
// Reanimated both do, and it is time-based in the way a stalled main loop
|
|
15
|
+
// demands: a late frame resumes the curve where the clock says, instead of
|
|
16
|
+
// stretching the animation by the length of the stall.
|
|
17
|
+
//
|
|
18
|
+
// There is still no wall clock in this module — `scheduler.now()` reads the
|
|
19
|
+
// same clock the frame stamps come from, so `timeMs - startTime` stays
|
|
20
|
+
// coherent. A scheduler that offers no clock keeps the first-frame anchoring.
|
|
8
21
|
import { createFrameLoop } from "./frame-loop";
|
|
9
22
|
export const createValueAnimation = (scheduler, value, makeStep) => {
|
|
10
23
|
let stopActiveRun = null;
|
|
11
24
|
const start = (callback) => {
|
|
12
25
|
const step = makeStep(value.__getValue());
|
|
13
|
-
let startTime = null;
|
|
26
|
+
let startTime = scheduler.now?.() ?? null;
|
|
14
27
|
let ended = false;
|
|
15
28
|
const loop = createFrameLoop(scheduler, (timeMs) => {
|
|
16
29
|
if (ended) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"value-animation.js","sourceRoot":"","sources":["../../src/animated/value-animation.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,6EAA6E;AAC7E,8EAA8E;AAC9E,6EAA6E;AAC7E,
|
|
1
|
+
{"version":3,"file":"value-animation.js","sourceRoot":"","sources":["../../src/animated/value-animation.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,6EAA6E;AAC7E,8EAA8E;AAC9E,6EAA6E;AAC7E,kDAAkD;AAClD,EAAE;AACF,8EAA8E;AAC9E,4EAA4E;AAC5E,6EAA6E;AAC7E,6EAA6E;AAC7E,+EAA+E;AAC/E,8EAA8E;AAC9E,qEAAqE;AACrE,0EAA0E;AAC1E,2EAA2E;AAC3E,uDAAuD;AACvD,EAAE;AACF,4EAA4E;AAC5E,uEAAuE;AACvE,8EAA8E;AAE9E,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAa9C,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,SAAyB,EACzB,KAAoB,EACpB,QAAkB,EACE,EAAE;IACtB,IAAI,aAAa,GAAwB,IAAI,CAAA;IAE7C,MAAM,KAAK,GAAG,CAAC,QAAsB,EAAQ,EAAE;QAC7C,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC,CAAA;QACzC,IAAI,SAAS,GAAkB,SAAS,CAAC,GAAG,EAAE,EAAE,IAAI,IAAI,CAAA;QACxD,IAAI,KAAK,GAAG,KAAK,CAAA;QAEjB,MAAM,IAAI,GAAG,eAAe,CAAC,SAAS,EAAE,CAAC,MAAM,EAAE,EAAE;YACjD,IAAI,KAAK,EAAE,CAAC;gBACV,OAAO,KAAK,CAAA;YACd,CAAC;YACD,IAAI,SAAS,KAAK,IAAI,EAAE,CAAC;gBACvB,SAAS,GAAG,MAAM,CAAA;YACpB,CAAC;YACD,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;YACnD,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;gBACtB,KAAK,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAA;YAC/B,CAAC;YACD,IAAI,IAAI,EAAE,CAAC;gBACT,GAAG,CAAC,IAAI,CAAC,CAAA;gBACT,OAAO,KAAK,CAAA;YACd,CAAC;YACD,OAAO,IAAI,CAAA;QACb,CAAC,CAAC,CAAA;QAEF,MAAM,MAAM,GAAG,EAAE,IAAI,EAAE,GAAS,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAA;QAE/C,MAAM,GAAG,GAAG,CAAC,QAAiB,EAAQ,EAAE;YACtC,IAAI,KAAK,EAAE,CAAC;gBACV,OAAM;YACR,CAAC;YACD,KAAK,GAAG,IAAI,CAAA;YACZ,IAAI,CAAC,IAAI,EAAE,CAAA;YACX,IAAI,aAAa,KAAK,MAAM,CAAC,IAAI,EAAE,CAAC;gBAClC,aAAa,GAAG,IAAI,CAAA;YACtB,CAAC;YACD,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAA;YAC5B,QAAQ,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAA;QAC1B,CAAC,CAAA;QAED,aAAa,GAAG,MAAM,CAAC,IAAI,CAAA;QAC3B,yEAAyE;QACzE,2EAA2E;QAC3E,KAAK,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAA;QAC9B,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,IAAI,CAAC,KAAK,EAAE,CAAA;QACd,CAAC;IACH,CAAC,CAAA;IAED,OAAO;QACL,KAAK;QACL,IAAI,EAAE,GAAG,EAAE;YACT,aAAa,EAAE,EAAE,CAAA;QACnB,CAAC;QACD,uEAAuE;QACvE,0EAA0E;QAC1E,KAAK,EAAE,GAAG,EAAE;YACV,KAAK,CAAC,cAAc,EAAE,CAAA;QACxB,CAAC;KACF,CAAA;AACH,CAAC,CAAA","sourcesContent":["// Shared lifecycle for animations that drive a single AnimatedValue (timing,\n// spring). Implements the RN semantics: a value runs at most one animation —\n// a newer start() preempts the previous one with { finished: false }; natural\n// completion reports { finished: true }; a finished or stopped run drops its\n// frame subscription immediately (no idle ticks).\n//\n// t = 0 IS THE MOMENT start() WAS CALLED, read off the scheduler's own clock.\n// It used to be the first frame that arrived, which cost every animation on\n// this platform a frame it never used: the first callback lands ~16 ms after\n// start(), evaluates step(0) — the start value by definition — and writes it\n// back unchanged, so nothing MOVES until the second frame, ~32 ms in. A 300 ms\n// fade also RAN for 316 ms rather than 300. Anchoring at start() is what RN's\n// own TimingAnimation (`_startTime = Date.now()` inside start()) and\n// Reanimated both do, and it is time-based in the way a stalled main loop\n// demands: a late frame resumes the curve where the clock says, instead of\n// stretching the animation by the length of the stall.\n//\n// There is still no wall clock in this module — `scheduler.now()` reads the\n// same clock the frame stamps come from, so `timeMs - startTime` stays\n// coherent. A scheduler that offers no clock keeps the first-frame anchoring.\n\nimport { createFrameLoop } from \"./frame-loop\"\nimport type { CompositeAnimation, EndCallback, FrameScheduler } from \"./types\"\nimport type { AnimatedValue } from \"./value\"\n\n// Per-frame step: elapsed ms since the first frame of this run → the next\n// position (null while waiting out a delay: the value is not touched) and\n// whether the run is done. makeStep is invoked on every start() with the\n// value captured at that moment, so restarts pick up from wherever the value\n// currently is.\nexport type StepResult = { position: number | null; done: boolean }\nexport type StepFn = (elapsedMs: number) => StepResult\nexport type MakeStep = (startValue: number) => StepFn\n\nexport const createValueAnimation = (\n scheduler: FrameScheduler,\n value: AnimatedValue,\n makeStep: MakeStep,\n): CompositeAnimation => {\n let stopActiveRun: (() => void) | null = null\n\n const start = (callback?: EndCallback): void => {\n const step = makeStep(value.__getValue())\n let startTime: number | null = scheduler.now?.() ?? null\n let ended = false\n\n const loop = createFrameLoop(scheduler, (timeMs) => {\n if (ended) {\n return false\n }\n if (startTime === null) {\n startTime = timeMs\n }\n const { position, done } = step(timeMs - startTime)\n if (position !== null) {\n value.__updateValue(position)\n }\n if (done) {\n end(true)\n return false\n }\n return true\n })\n\n const handle = { stop: (): void => end(false) }\n\n const end = (finished: boolean): void => {\n if (ended) {\n return\n }\n ended = true\n loop.stop()\n if (stopActiveRun === handle.stop) {\n stopActiveRun = null\n }\n value.__endAnimation(handle)\n callback?.({ finished })\n }\n\n stopActiveRun = handle.stop\n // Attaching preempts whatever ran on this value before (this animation's\n // own previous run included) — the preempted run ends { finished: false }.\n value.__startAnimation(handle)\n if (!ended) {\n loop.start()\n }\n }\n\n return {\n start,\n stop: () => {\n stopActiveRun?.()\n },\n // RN parity: composite reset stops the run and snaps the value back to\n // its construction-time value (loop() relies on this between iterations).\n reset: () => {\n value.resetAnimation()\n },\n }\n}\n"]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { AnimatedValue } from "./value";
|
|
2
|
+
export type ValueXYLiteral = {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
};
|
|
6
|
+
export type ValueXYListener = (value: ValueXYLiteral) => void;
|
|
7
|
+
export declare class AnimatedValueXY {
|
|
8
|
+
readonly x: AnimatedValue;
|
|
9
|
+
readonly y: AnimatedValue;
|
|
10
|
+
private readonly _listeners;
|
|
11
|
+
private _nextListenerId;
|
|
12
|
+
constructor(value?: ValueXYLiteral);
|
|
13
|
+
setValue(value: ValueXYLiteral): void;
|
|
14
|
+
setOffset(offset: ValueXYLiteral): void;
|
|
15
|
+
flattenOffset(): void;
|
|
16
|
+
extractOffset(): void;
|
|
17
|
+
/**
|
|
18
|
+
* Fires on movement of EITHER axis, with both current values — RN's
|
|
19
|
+
* contract. Both subscriptions are kept so removeListener can undo them.
|
|
20
|
+
*/
|
|
21
|
+
addListener(listener: ValueXYListener): string;
|
|
22
|
+
removeListener(id: string): void;
|
|
23
|
+
removeAllListeners(): void;
|
|
24
|
+
stopAnimation(callback?: (value: ValueXYLiteral) => void): void;
|
|
25
|
+
resetAnimation(callback?: (value: ValueXYLiteral) => void): void;
|
|
26
|
+
/** RN's absolute-positioning helper. */
|
|
27
|
+
getLayout(): {
|
|
28
|
+
left: AnimatedValue;
|
|
29
|
+
top: AnimatedValue;
|
|
30
|
+
};
|
|
31
|
+
/** The transform array a dragged view spreads into its style. */
|
|
32
|
+
getTranslateTransform(): [
|
|
33
|
+
{
|
|
34
|
+
translateX: AnimatedValue;
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
translateY: AnimatedValue;
|
|
38
|
+
}
|
|
39
|
+
];
|
|
40
|
+
__getValue(): ValueXYLiteral;
|
|
41
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
// Animated.ValueXY — two Animated.Values that move together.
|
|
2
|
+
//
|
|
3
|
+
// It exists because it is the other half of PanResponder: essentially every
|
|
4
|
+
// React Native drag in the wild is `new Animated.ValueXY()` plus
|
|
5
|
+
// `pan.setValue({ x: gesture.dx, y: gesture.dy })`, and the transform comes
|
|
6
|
+
// from `getTranslateTransform()`. Shipping the responder system without this
|
|
7
|
+
// meant portable drag code still did not run — which the gallery found the
|
|
8
|
+
// moment it was pointed at a real screen.
|
|
9
|
+
//
|
|
10
|
+
// There is no new machinery here: every method delegates to the two values,
|
|
11
|
+
// which is exactly how RN implements it.
|
|
12
|
+
import { AnimatedValue } from "./value";
|
|
13
|
+
export class AnimatedValueXY {
|
|
14
|
+
x;
|
|
15
|
+
y;
|
|
16
|
+
_listeners = new Map();
|
|
17
|
+
_nextListenerId = 1;
|
|
18
|
+
constructor(value = { x: 0, y: 0 }) {
|
|
19
|
+
this.x = new AnimatedValue(value.x);
|
|
20
|
+
this.y = new AnimatedValue(value.y);
|
|
21
|
+
}
|
|
22
|
+
setValue(value) {
|
|
23
|
+
this.x.setValue(value.x);
|
|
24
|
+
this.y.setValue(value.y);
|
|
25
|
+
}
|
|
26
|
+
setOffset(offset) {
|
|
27
|
+
this.x.setOffset(offset.x);
|
|
28
|
+
this.y.setOffset(offset.y);
|
|
29
|
+
}
|
|
30
|
+
flattenOffset() {
|
|
31
|
+
this.x.flattenOffset();
|
|
32
|
+
this.y.flattenOffset();
|
|
33
|
+
}
|
|
34
|
+
extractOffset() {
|
|
35
|
+
this.x.extractOffset();
|
|
36
|
+
this.y.extractOffset();
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Fires on movement of EITHER axis, with both current values — RN's
|
|
40
|
+
* contract. Both subscriptions are kept so removeListener can undo them.
|
|
41
|
+
*/
|
|
42
|
+
addListener(listener) {
|
|
43
|
+
const id = String(this._nextListenerId++);
|
|
44
|
+
const emit = () => {
|
|
45
|
+
listener({ x: this.x.__getValue(), y: this.y.__getValue() });
|
|
46
|
+
};
|
|
47
|
+
this._listeners.set(id, {
|
|
48
|
+
x: this.x.addListener(emit),
|
|
49
|
+
y: this.y.addListener(emit),
|
|
50
|
+
listener,
|
|
51
|
+
});
|
|
52
|
+
return id;
|
|
53
|
+
}
|
|
54
|
+
removeListener(id) {
|
|
55
|
+
const entry = this._listeners.get(id);
|
|
56
|
+
if (!entry) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
this.x.removeListener(entry.x);
|
|
60
|
+
this.y.removeListener(entry.y);
|
|
61
|
+
this._listeners.delete(id);
|
|
62
|
+
}
|
|
63
|
+
removeAllListeners() {
|
|
64
|
+
for (const id of [...this._listeners.keys()]) {
|
|
65
|
+
this.removeListener(id);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
stopAnimation(callback) {
|
|
69
|
+
this.x.stopAnimation();
|
|
70
|
+
this.y.stopAnimation();
|
|
71
|
+
callback?.(this.__getValue());
|
|
72
|
+
}
|
|
73
|
+
resetAnimation(callback) {
|
|
74
|
+
this.x.resetAnimation();
|
|
75
|
+
this.y.resetAnimation();
|
|
76
|
+
callback?.(this.__getValue());
|
|
77
|
+
}
|
|
78
|
+
/** RN's absolute-positioning helper. */
|
|
79
|
+
getLayout() {
|
|
80
|
+
return { left: this.x, top: this.y };
|
|
81
|
+
}
|
|
82
|
+
/** The transform array a dragged view spreads into its style. */
|
|
83
|
+
getTranslateTransform() {
|
|
84
|
+
return [{ translateX: this.x }, { translateY: this.y }];
|
|
85
|
+
}
|
|
86
|
+
__getValue() {
|
|
87
|
+
return { x: this.x.__getValue(), y: this.y.__getValue() };
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=value-xy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"value-xy.js","sourceRoot":"","sources":["../../src/animated/value-xy.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,EAAE;AACF,4EAA4E;AAC5E,iEAAiE;AACjE,4EAA4E;AAC5E,6EAA6E;AAC7E,2EAA2E;AAC3E,0CAA0C;AAC1C,EAAE;AACF,4EAA4E;AAC5E,yCAAyC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAMvC,MAAM,OAAO,eAAe;IACjB,CAAC,CAAe;IAChB,CAAC,CAAe;IACR,UAAU,GAAG,IAAI,GAAG,EAGlC,CAAA;IACK,eAAe,GAAG,CAAC,CAAA;IAE3B,YAAY,QAAwB,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;QAChD,IAAI,CAAC,CAAC,GAAG,IAAI,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;QACnC,IAAI,CAAC,CAAC,GAAG,IAAI,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;IACrC,CAAC;IAED,QAAQ,CAAC,KAAqB;QAC5B,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;QACxB,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;IAC1B,CAAC;IAED,SAAS,CAAC,MAAsB;QAC9B,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;QAC1B,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;IAC5B,CAAC;IAED,aAAa;QAC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AU,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC;YAC7C,IAAI,CAAC,cAAc,CAAC,EAAE,CAAC,CAAA;QACzB,CAAC;IACH,CAAC;IAED,aAAa,CAAC,QAA0C;QACtD,IAAI,CAAC,CAAC,CAAC,aAAa,EAAE,CAAA;QACtB,IAAI,CAAC,CAAC,CAAC,aAAa,EAAE,CAAA;QACtB,QAAQ,EAAE,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAA;IAC/B,CAAC;IAED,cAAc,CAAC,QAA0C;QACvD,IAAI,CAAC,CAAC,CAAC,cAAc,EAAE,CAAA;QACvB,IAAI,CAAC,CAAC,CAAC,cAAc,EAAE,CAAA;QACvB,QAAQ,EAAE,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAA;IAC/B,CAAC;IAED,wCAAwC;IACxC,SAAS;QACP,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC,EAAE,CAAA;IACtC,CAAC;IAED,iEAAiE;IACjE,qBAAqB;QAInB,OAAO,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC,CAAA;IACzD,CAAC;IAED,UAAU;QACR,OAAO,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,UAAU,EAAE,EAAE,CAAA;IAC3D,CAAC;CACF","sourcesContent":["// Animated.ValueXY — two Animated.Values that move together.\n//\n// It exists because it is the other half of PanResponder: essentially every\n// React Native drag in the wild is `new Animated.ValueXY()` plus\n// `pan.setValue({ x: gesture.dx, y: gesture.dy })`, and the transform comes\n// from `getTranslateTransform()`. Shipping the responder system without this\n// meant portable drag code still did not run — which the gallery found the\n// moment it was pointed at a real screen.\n//\n// There is no new machinery here: every method delegates to the two values,\n// which is exactly how RN implements it.\nimport { AnimatedValue } from \"./value\"\n\nexport type ValueXYLiteral = { x: number; y: number }\n\nexport type ValueXYListener = (value: ValueXYLiteral) => void\n\nexport class AnimatedValueXY {\n readonly x: AnimatedValue\n readonly y: AnimatedValue\n private readonly _listeners = new Map<\n string,\n { x: string; y: string; listener: ValueXYListener }\n >()\n private _nextListenerId = 1\n\n constructor(value: ValueXYLiteral = { x: 0, y: 0 }) {\n this.x = new AnimatedValue(value.x)\n this.y = new AnimatedValue(value.y)\n }\n\n setValue(value: ValueXYLiteral): void {\n this.x.setValue(value.x)\n this.y.setValue(value.y)\n }\n\n setOffset(offset: ValueXYLiteral): void {\n this.x.setOffset(offset.x)\n this.y.setOffset(offset.y)\n }\n\n flattenOffset(): void {\n this.x.flattenOffset()\n this.y.flattenOffset()\n }\n\n extractOffset(): void {\n this.x.extractOffset()\n this.y.extractOffset()\n }\n\n /**\n * Fires on movement of EITHER axis, with both current values — RN's\n * contract. Both subscriptions are kept so removeListener can undo them.\n */\n addListener(listener: ValueXYListener): string {\n const id = String(this._nextListenerId++)\n const emit = (): void => {\n listener({ x: this.x.__getValue(), y: this.y.__getValue() })\n }\n this._listeners.set(id, {\n x: this.x.addListener(emit),\n y: this.y.addListener(emit),\n listener,\n })\n return id\n }\n\n removeListener(id: string): void {\n const entry = this._listeners.get(id)\n if (!entry) {\n return\n }\n this.x.removeListener(entry.x)\n this.y.removeListener(entry.y)\n this._listeners.delete(id)\n }\n\n removeAllListeners(): void {\n for (const id of [...this._listeners.keys()]) {\n this.removeListener(id)\n }\n }\n\n stopAnimation(callback?: (value: ValueXYLiteral) => void): void {\n this.x.stopAnimation()\n this.y.stopAnimation()\n callback?.(this.__getValue())\n }\n\n resetAnimation(callback?: (value: ValueXYLiteral) => void): void {\n this.x.resetAnimation()\n this.y.resetAnimation()\n callback?.(this.__getValue())\n }\n\n /** RN's absolute-positioning helper. */\n getLayout(): { left: AnimatedValue; top: AnimatedValue } {\n return { left: this.x, top: this.y }\n }\n\n /** The transform array a dragged view spreads into its style. */\n getTranslateTransform(): [\n { translateX: AnimatedValue },\n { translateY: AnimatedValue },\n ] {\n return [{ translateX: this.x }, { translateY: this.y }]\n }\n\n __getValue(): ValueXYLiteral {\n return { x: this.x.__getValue(), y: this.y.__getValue() }\n }\n}\n"]}
|
package/dist/animated/value.d.ts
CHANGED
|
@@ -9,12 +9,19 @@ type InterpolationParent = {
|
|
|
9
9
|
};
|
|
10
10
|
export declare class AnimatedValue {
|
|
11
11
|
private _value;
|
|
12
|
+
private _offset;
|
|
12
13
|
private readonly _startingValue;
|
|
13
14
|
private readonly _listeners;
|
|
14
15
|
private _nextListenerId;
|
|
15
16
|
private _animation;
|
|
16
17
|
constructor(value: number);
|
|
17
18
|
setValue(value: number): void;
|
|
19
|
+
/** Sets the static part. The animated part is left where it is. */
|
|
20
|
+
setOffset(offset: number): void;
|
|
21
|
+
/** Folds the offset into the value, leaving the sum unchanged. */
|
|
22
|
+
flattenOffset(): void;
|
|
23
|
+
/** The mirror of flattenOffset: moves the value into the offset. */
|
|
24
|
+
extractOffset(): void;
|
|
18
25
|
addListener(listener: ValueListener): string;
|
|
19
26
|
removeListener(id: string): void;
|
|
20
27
|
removeAllListeners(): void;
|
|
@@ -24,6 +31,8 @@ export declare class AnimatedValue {
|
|
|
24
31
|
__getValue(): number;
|
|
25
32
|
/** @internal Called by the animation runner on every frame. */
|
|
26
33
|
__updateValue(value: number): void;
|
|
34
|
+
/** @internal Publishes the current sum to every listener. */
|
|
35
|
+
private __notify;
|
|
27
36
|
/** @internal Registers a running animation, preempting the previous one. */
|
|
28
37
|
__startAnimation(handle: AnimationHandle): void;
|
|
29
38
|
/** @internal */
|
package/dist/animated/value.js
CHANGED
|
@@ -9,6 +9,12 @@ import { createInterpolator } from "./interpolate";
|
|
|
9
9
|
const numeric = (value) => typeof value === "number" ? value : parseFloat(value);
|
|
10
10
|
export class AnimatedValue {
|
|
11
11
|
_value;
|
|
12
|
+
// RN splits a value into an animated part and a static offset: a drag sets
|
|
13
|
+
// the offset to where the last gesture ended, so dx/dy can keep starting
|
|
14
|
+
// from zero. Everything observable is the SUM; the animation runner only
|
|
15
|
+
// ever drives `_value`, so an untouched offset (0) leaves behaviour
|
|
16
|
+
// byte-identical to before it existed.
|
|
17
|
+
_offset = 0;
|
|
12
18
|
_startingValue;
|
|
13
19
|
_listeners = new Map();
|
|
14
20
|
_nextListenerId = 1;
|
|
@@ -23,6 +29,23 @@ export class AnimatedValue {
|
|
|
23
29
|
this._animation?.stop();
|
|
24
30
|
this.__updateValue(value);
|
|
25
31
|
}
|
|
32
|
+
/** Sets the static part. The animated part is left where it is. */
|
|
33
|
+
setOffset(offset) {
|
|
34
|
+
this._offset = offset;
|
|
35
|
+
this.__notify();
|
|
36
|
+
}
|
|
37
|
+
/** Folds the offset into the value, leaving the sum unchanged. */
|
|
38
|
+
flattenOffset() {
|
|
39
|
+
this._value += this._offset;
|
|
40
|
+
this._offset = 0;
|
|
41
|
+
this.__notify();
|
|
42
|
+
}
|
|
43
|
+
/** The mirror of flattenOffset: moves the value into the offset. */
|
|
44
|
+
extractOffset() {
|
|
45
|
+
this._offset += this._value;
|
|
46
|
+
this._value = 0;
|
|
47
|
+
this.__notify();
|
|
48
|
+
}
|
|
26
49
|
addListener(listener) {
|
|
27
50
|
const id = String(this._nextListenerId++);
|
|
28
51
|
this._listeners.set(id, listener);
|
|
@@ -39,7 +62,7 @@ export class AnimatedValue {
|
|
|
39
62
|
// { finished: false }.
|
|
40
63
|
stopAnimation(callback) {
|
|
41
64
|
this._animation?.stop();
|
|
42
|
-
callback?.(this.
|
|
65
|
+
callback?.(this.__getValue());
|
|
43
66
|
}
|
|
44
67
|
// Stops any running animation, then snaps back to the construction-time
|
|
45
68
|
// value. Unlike RN we do notify listeners about the snap-back: the direct
|
|
@@ -53,11 +76,16 @@ export class AnimatedValue {
|
|
|
53
76
|
return new AnimatedInterpolation(this, config);
|
|
54
77
|
}
|
|
55
78
|
__getValue() {
|
|
56
|
-
return this._value;
|
|
79
|
+
return this._value + this._offset;
|
|
57
80
|
}
|
|
58
81
|
/** @internal Called by the animation runner on every frame. */
|
|
59
82
|
__updateValue(value) {
|
|
60
83
|
this._value = value;
|
|
84
|
+
this.__notify();
|
|
85
|
+
}
|
|
86
|
+
/** @internal Publishes the current sum to every listener. */
|
|
87
|
+
__notify() {
|
|
88
|
+
const value = this.__getValue();
|
|
61
89
|
for (const listener of [...this._listeners.values()]) {
|
|
62
90
|
listener({ value });
|
|
63
91
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"value.js","sourceRoot":"","sources":["../../src/animated/value.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,0EAA0E;AAC1E,8EAA8E;AAC9E,6EAA6E;AAC7E,oEAAoE;AAEpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAoBlD,2EAA2E;AAC3E,gBAAgB;AAChB,MAAM,OAAO,GAAG,CAAC,KAAsB,EAAU,EAAE,CACjD,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAA;AAEvD,MAAM,OAAO,aAAa;IAChB,MAAM,CAAQ;IACL,cAAc,CAAQ;IACtB,UAAU,GAAG,IAAI,GAAG,EAAyB,CAAA;IACtD,eAAe,GAAG,CAAC,CAAA;IACnB,UAAU,GAA2B,IAAI,CAAA;IAEjD,YAAY,KAAa;QACvB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAA;QACnB,IAAI,CAAC,cAAc,GAAG,KAAK,CAAA;IAC7B,CAAC;IAED,4EAA4E;IAC5E,kCAAkC;IAClC,QAAQ,CAAC,KAAa;QACpB,IAAI,CAAC,UAAU,EAAE,IAAI,EAAE,CAAA;QACvB,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA;IAC3B,CAAC;IAED,WAAW,CAAC,QAAuB;QACjC,MAAM,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,eAA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AU,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC;oBAClD,KAAK,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAA;gBAC1B,CAAC;YACH,CAAC,CAAC,CAAA;QACJ,CAAC;QACD,OAAO,EAAE,CAAA;IACX,CAAC;IAED,cAAc,CAAC,EAAU;QACvB,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC;YAChC,OAAM;QACR,CAAC;QACD,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;YAC/B,IAAI,CAAC,iBAAiB,EAAE,CAAA;QAC1B,CAAC;IACH,CAAC;IAED,kBAAkB;QAChB,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAA;QACvB,IAAI,CAAC,iBAAiB,EAAE,CAAA;IAC1B,CAAC;IAED,WAAW,CAAC,MAA2B;QACrC,OAAO,IAAI,qBAAqB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;IAChD,CAAC;IAEO,iBAAiB;QACvB,IAAI,IAAI,CAAC,mBAAmB,KAAK,IAAI,EAAE,CAAC;YACtC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAA;YACrD,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAA;QACjC,CAAC;IACH,CAAC;CACF","sourcesContent":["// Animated.Value and the read-only interpolation node. Values are observable\n// numbers; the animation runner (value-animation.ts) drives them frame by\n// frame through the __-prefixed internal hooks. Interpolation nodes subscribe\n// to their parent lazily (only while they have listeners themselves) and can\n// be interpolated again, cascading from the parent's numeric value.\n\nimport { createInterpolator } from \"./interpolate\"\nimport type {\n InterpolationConfig,\n InterpolationListener,\n ValueListener,\n} from \"./types\"\n\n// Internal handle a running animation registers on its value; the value calls\n// stop() to preempt it when a newer animation (or setValue) takes over — the\n// preempted animation ends with { finished: false }, matching RN.\nexport type AnimationHandle = { stop(): void }\n\n// Minimal parent protocol shared by AnimatedValue and AnimatedInterpolation,\n// enabling cascaded interpolate() chains over either kind of node.\ntype InterpolationParent = {\n __getValue(): number | string\n addListener(listener: InterpolationListener): string\n removeListener(id: string): void\n}\n\n// Cascading from a string-producing parent (\"45deg\") interpolates over its\n// numeric part.\nconst numeric = (value: number | string): number =>\n typeof value === \"number\" ? value : parseFloat(value)\n\nexport class AnimatedValue {\n private _value: number\n private readonly _startingValue: number\n private readonly _listeners = new Map<string, ValueListener>()\n private _nextListenerId = 1\n private _animation: AnimationHandle | null = null\n\n constructor(value: number) {\n this._value = value\n this._startingValue = value\n }\n\n // Stops the running animation (its callback gets { finished: false }, as in\n // RN) and jumps to the new value.\n setValue(value: number): void {\n this._animation?.stop()\n this.__updateValue(value)\n }\n\n addListener(listener: ValueListener): string {\n const id = String(this._nextListenerId++)\n this._listeners.set(id, listener)\n return id\n }\n\n removeListener(id: string): void {\n this._listeners.delete(id)\n }\n\n removeAllListeners(): void {\n this._listeners.clear()\n }\n\n // Stops the running animation where it stands and reports the current value\n // to the callback. The stopped animation's own callback gets\n // { finished: false }.\n stopAnimation(callback?: (value: number) => void): void {\n this._animation?.stop()\n callback?.(this._value)\n }\n\n // Stops any running animation, then snaps back to the construction-time\n // value. Unlike RN we do notify listeners about the snap-back: the direct\n // GTK path renders from listener events, so a silent reset would leave\n // widgets stale until the next animation frame.\n resetAnimation(callback?: (value: number) => void): void {\n this.stopAnimation(callback)\n this.__updateValue(this._startingValue)\n }\n\n interpolate(config: InterpolationConfig): AnimatedInterpolation {\n return new AnimatedInterpolation(this, config)\n }\n\n __getValue(): number {\n return this._value\n }\n\n /** @internal Called by the animation runner on every frame. */\n __updateValue(value: number): void {\n this._value = value\n for (const listener of [...this._listeners.values()]) {\n listener({ value })\n }\n }\n\n /** @internal Registers a running animation, preempting the previous one. */\n __startAnimation(handle: AnimationHandle): void {\n const previous = this._animation\n this._animation = handle\n if (previous && previous !== handle) {\n previous.stop()\n }\n }\n\n /** @internal */\n __endAnimation(handle: AnimationHandle): void {\n if (this._animation === handle) {\n this._animation = null\n }\n }\n}\n\nexport class AnimatedInterpolation {\n private readonly _parent: InterpolationParent\n private readonly _interpolator: (input: number) => number | string\n private readonly _listeners = new Map<string, InterpolationListener>()\n private _nextListenerId = 1\n private _parentSubscription: string | null = null\n\n constructor(parent: InterpolationParent, config: InterpolationConfig) {\n this._parent = parent\n this._interpolator = createInterpolator(config)\n }\n\n __getValue(): number | string {\n return this._interpolator(numeric(this._parent.__getValue()))\n }\n\n addListener(listener: InterpolationListener): string {\n const id = String(this._nextListenerId++)\n this._listeners.set(id, listener)\n if (this._parentSubscription === null) {\n // Lazy upstream subscription (same leak policy as the API emitters):\n // attach with the first listener, detach with the last one.\n this._parentSubscription = this._parent.addListener(({ value }) => {\n const output = this._interpolator(numeric(value))\n for (const entry of [...this._listeners.values()]) {\n entry({ value: output })\n }\n })\n }\n return id\n }\n\n removeListener(id: string): void {\n if (!this._listeners.delete(id)) {\n return\n }\n if (this._listeners.size === 0) {\n this._detachFromParent()\n }\n }\n\n removeAllListeners(): void {\n this._listeners.clear()\n this._detachFromParent()\n }\n\n interpolate(config: InterpolationConfig): AnimatedInterpolation {\n return new AnimatedInterpolation(this, config)\n }\n\n private _detachFromParent(): void {\n if (this._parentSubscription !== null) {\n this._parent.removeListener(this._parentSubscription)\n this._parentSubscription = null\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"value.js","sourceRoot":"","sources":["../../src/animated/value.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,0EAA0E;AAC1E,8EAA8E;AAC9E,6EAA6E;AAC7E,oEAAoE;AAEpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAoBlD,2EAA2E;AAC3E,gBAAgB;AAChB,MAAM,OAAO,GAAG,CAAC,KAAsB,EAAU,EAAE,CACjD,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,KA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AM,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC;oBAClD,KAAK,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAA;gBAC1B,CAAC;YACH,CAAC,CAAC,CAAA;QACJ,CAAC;QACD,OAAO,EAAE,CAAA;IACX,CAAC;IAED,cAAc,CAAC,EAAU;QACvB,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC;YAChC,OAAM;QACR,CAAC;QACD,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;YAC/B,IAAI,CAAC,iBAAiB,EAAE,CAAA;QAC1B,CAAC;IACH,CAAC;IAED,kBAAkB;QAChB,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAA;QACvB,IAAI,CAAC,iBAAiB,EAAE,CAAA;IAC1B,CAAC;IAED,WAAW,CAAC,MAA2B;QACrC,OAAO,IAAI,qBAAqB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;IAChD,CAAC;IAEO,iBAAiB;QACvB,IAAI,IAAI,CAAC,mBAAmB,KAAK,IAAI,EAAE,CAAC;YACtC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAA;YACrD,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAA;QACjC,CAAC;IACH,CAAC;CACF","sourcesContent":["// Animated.Value and the read-only interpolation node. Values are observable\n// numbers; the animation runner (value-animation.ts) drives them frame by\n// frame through the __-prefixed internal hooks. Interpolation nodes subscribe\n// to their parent lazily (only while they have listeners themselves) and can\n// be interpolated again, cascading from the parent's numeric value.\n\nimport { createInterpolator } from \"./interpolate\"\nimport type {\n InterpolationConfig,\n InterpolationListener,\n ValueListener,\n} from \"./types\"\n\n// Internal handle a running animation registers on its value; the value calls\n// stop() to preempt it when a newer animation (or setValue) takes over — the\n// preempted animation ends with { finished: false }, matching RN.\nexport type AnimationHandle = { stop(): void }\n\n// Minimal parent protocol shared by AnimatedValue and AnimatedInterpolation,\n// enabling cascaded interpolate() chains over either kind of node.\ntype InterpolationParent = {\n __getValue(): number | string\n addListener(listener: InterpolationListener): string\n removeListener(id: string): void\n}\n\n// Cascading from a string-producing parent (\"45deg\") interpolates over its\n// numeric part.\nconst numeric = (value: number | string): number =>\n typeof value === \"number\" ? value : parseFloat(value)\n\nexport class AnimatedValue {\n private _value: number\n // RN splits a value into an animated part and a static offset: a drag sets\n // the offset to where the last gesture ended, so dx/dy can keep starting\n // from zero. Everything observable is the SUM; the animation runner only\n // ever drives `_value`, so an untouched offset (0) leaves behaviour\n // byte-identical to before it existed.\n private _offset = 0\n private readonly _startingValue: number\n private readonly _listeners = new Map<string, ValueListener>()\n private _nextListenerId = 1\n private _animation: AnimationHandle | null = null\n\n constructor(value: number) {\n this._value = value\n this._startingValue = value\n }\n\n // Stops the running animation (its callback gets { finished: false }, as in\n // RN) and jumps to the new value.\n setValue(value: number): void {\n this._animation?.stop()\n this.__updateValue(value)\n }\n\n /** Sets the static part. The animated part is left where it is. */\n setOffset(offset: number): void {\n this._offset = offset\n this.__notify()\n }\n\n /** Folds the offset into the value, leaving the sum unchanged. */\n flattenOffset(): void {\n this._value += this._offset\n this._offset = 0\n this.__notify()\n }\n\n /** The mirror of flattenOffset: moves the value into the offset. */\n extractOffset(): void {\n this._offset += this._value\n this._value = 0\n this.__notify()\n }\n\n addListener(listener: ValueListener): string {\n const id = String(this._nextListenerId++)\n this._listeners.set(id, listener)\n return id\n }\n\n removeListener(id: string): void {\n this._listeners.delete(id)\n }\n\n removeAllListeners(): void {\n this._listeners.clear()\n }\n\n // Stops the running animation where it stands and reports the current value\n // to the callback. The stopped animation's own callback gets\n // { finished: false }.\n stopAnimation(callback?: (value: number) => void): void {\n this._animation?.stop()\n callback?.(this.__getValue())\n }\n\n // Stops any running animation, then snaps back to the construction-time\n // value. Unlike RN we do notify listeners about the snap-back: the direct\n // GTK path renders from listener events, so a silent reset would leave\n // widgets stale until the next animation frame.\n resetAnimation(callback?: (value: number) => void): void {\n this.stopAnimation(callback)\n this.__updateValue(this._startingValue)\n }\n\n interpolate(config: InterpolationConfig): AnimatedInterpolation {\n return new AnimatedInterpolation(this, config)\n }\n\n __getValue(): number {\n return this._value + this._offset\n }\n\n /** @internal Called by the animation runner on every frame. */\n __updateValue(value: number): void {\n this._value = value\n this.__notify()\n }\n\n /** @internal Publishes the current sum to every listener. */\n private __notify(): void {\n const value = this.__getValue()\n for (const listener of [...this._listeners.values()]) {\n listener({ value })\n }\n }\n\n /** @internal Registers a running animation, preempting the previous one. */\n __startAnimation(handle: AnimationHandle): void {\n const previous = this._animation\n this._animation = handle\n if (previous && previous !== handle) {\n previous.stop()\n }\n }\n\n /** @internal */\n __endAnimation(handle: AnimationHandle): void {\n if (this._animation === handle) {\n this._animation = null\n }\n }\n}\n\nexport class AnimatedInterpolation {\n private readonly _parent: InterpolationParent\n private readonly _interpolator: (input: number) => number | string\n private readonly _listeners = new Map<string, InterpolationListener>()\n private _nextListenerId = 1\n private _parentSubscription: string | null = null\n\n constructor(parent: InterpolationParent, config: InterpolationConfig) {\n this._parent = parent\n this._interpolator = createInterpolator(config)\n }\n\n __getValue(): number | string {\n return this._interpolator(numeric(this._parent.__getValue()))\n }\n\n addListener(listener: InterpolationListener): string {\n const id = String(this._nextListenerId++)\n this._listeners.set(id, listener)\n if (this._parentSubscription === null) {\n // Lazy upstream subscription (same leak policy as the API emitters):\n // attach with the first listener, detach with the last one.\n this._parentSubscription = this._parent.addListener(({ value }) => {\n const output = this._interpolator(numeric(value))\n for (const entry of [...this._listeners.values()]) {\n entry({ value: output })\n }\n })\n }\n return id\n }\n\n removeListener(id: string): void {\n if (!this._listeners.delete(id)) {\n return\n }\n if (this._listeners.size === 0) {\n this._detachFromParent()\n }\n }\n\n removeAllListeners(): void {\n this._listeners.clear()\n this._detachFromParent()\n }\n\n interpolate(config: InterpolationConfig): AnimatedInterpolation {\n return new AnimatedInterpolation(this, config)\n }\n\n private _detachFromParent(): void {\n if (this._parentSubscription !== null) {\n this._parent.removeListener(this._parentSubscription)\n this._parentSubscription = null\n }\n }\n}\n"]}
|
package/dist/apis/host.gtkx.js
CHANGED
|
@@ -214,6 +214,15 @@ const SURFACE_SIZE_SIGNALS = [
|
|
|
214
214
|
];
|
|
215
215
|
const WINDOW_ACTIVE_SIGNALS = ["notify::is-active"];
|
|
216
216
|
const gtkVersion = () => `${toNumber(Gtk.getMajorVersion())}.${toNumber(Gtk.getMinorVersion())}.${toNumber(Gtk.getMicroVersion())}`;
|
|
217
|
+
// AdwStyleManager is the only thing that decides the palette here, and it is
|
|
218
|
+
// enough on its own — appearance.test.tsx asserts that a real widget's
|
|
219
|
+
// computed foreground flips with it. This used to also write the classic
|
|
220
|
+
// GtkSettings:gtk-application-prefer-dark-theme, guarding against Adwaita
|
|
221
|
+
// not restyling a GtkApplication (we do not use AdwApplication). Under
|
|
222
|
+
// libadwaita that write is inert: adw_init() takes the color scheme over,
|
|
223
|
+
// answers the setting with "unsupported ... use AdwStyleManager:color-scheme
|
|
224
|
+
// instead" and keeps its own value, so all the duplicate ever produced was a
|
|
225
|
+
// warning per call — seven per test run.
|
|
217
226
|
const setColorScheme = (scheme) => {
|
|
218
227
|
const manager = styleManager();
|
|
219
228
|
if (scheme === "dark") {
|
|
@@ -225,18 +234,6 @@ const setColorScheme = (scheme) => {
|
|
|
225
234
|
else {
|
|
226
235
|
manager.setColorScheme(Adw.ColorScheme.DEFAULT);
|
|
227
236
|
}
|
|
228
|
-
// Our apps are GtkApplication (not AdwApplication), so Adwaita may not
|
|
229
|
-
// restyle widgets: duplicate the request through the classic GTK setting,
|
|
230
|
-
// which the theme always honors.
|
|
231
|
-
const settings = Gtk.Settings.getDefault();
|
|
232
|
-
if (settings) {
|
|
233
|
-
if (scheme === null) {
|
|
234
|
-
settings.resetProperty("gtk-application-prefer-dark-theme");
|
|
235
|
-
}
|
|
236
|
-
else {
|
|
237
|
-
settings.gtkApplicationPreferDarkTheme = scheme === "dark";
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
237
|
};
|
|
241
238
|
const onColorSchemeChange = (notify) => {
|
|
242
239
|
const manager = styleManager();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host.gtkx.js","sourceRoot":"","sources":["../../src/apis/host.gtkx.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,4EAA4E;AAC5E,wEAAwE;AAGxE,OAAO,EACL,GAAG,EACH,WAAW,EACX,GAAG,EACH,GAAG,EACH,GAAG,EACH,IAAI,EACJ,YAAY,EACZ,QAAQ,GACT,MAAM,sBAAsB,CAAA;AAQ7B,MAAM,gBAAgB,GAAe;IACnC,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,CAAC;IACT,KAAK,EAAE,CAAC;IACR,SAAS,EAAE,CAAC;CACb,CAAA;AAED,MAAM,cAAc,GAAG,GAA2B,EAAE,CAClD,GAAG,CAAC,WAAW,CAAC,UAAU,EAAuC,CAAA;AAEnE,MAAM,kBAAkB,GAAG,GAAsB,EAAE;IACjD,MAAM,GAAG,GAAG,cAAc,EAAE,CAAA;IAC5B,IAAI,CAAC,GAAG,IAAI,OAAO,GAAG,CAAC,eAAe,KAAK,UAAU,EAAE,CAAC;QACtD,OAAO,IAAI,CAAA;IACb,CAAC;IACD,OAAO,GAAG,CAAC,eAAe,EAAE,IAAI,IAAI,CAAA;AACtC,CAAC,CAAA;AAED,MAAM,QAAQ,GAAG,CAAC,KAAoB,EAAE,KAAa,EAAqB,EAAE,CAC1E,KAAK,CAAC,OAAO,CAAC,KAAK,CAAiC,CAAA;AAEtD,4EAA4E;AAC5E,2EAA2E;AAC3E,iEAAiE;AACjE,uEAAuE;AACvE,8EAA8E;AAC9E,4EAA4E;AAC5E,qBAAqB;AACrB,MAAM,YAAY,GAAG,CAAC,MAAkB,EAAW,EAAE,CACnD,MAAM,CAAC,eAAe,EAAE,KAAK,IA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;IACnC,cAAc;IACd,mBAAmB;IACnB,QAAQ,EAAE,iBAAiB;IAC3B,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,WAAW,CAAC,qBAAqB,EAAE,EAAE,EAAE,MAAM,CAAC;IAC1E,SAAS;IACT,SAAS;IACT,KAAK;IACL,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE;CACtB,CAAA","sourcesContent":["// Production host adapter: the ONLY module under src/apis/ allowed to import\n// the gtkx bridge. Everything GTK-specific lives here; the API modules stay\n// pure and receive this object (or a mock in unit tests) via injection.\n\nimport type { SubscriptionHandle } from \"../contracts\"\nimport {\n Adw,\n colorScheme,\n Gdk,\n Gio,\n Gtk,\n quit,\n styleManager,\n toNumber,\n} from \"../gtkx/bridge/index\"\nimport type {\n ColorSchemeName,\n Host,\n HostAlertRequest,\n ScaledSize,\n} from \"./host\"\n\nconst FALLBACK_METRICS: ScaledSize = {\n width: 0,\n height: 0,\n scale: 1,\n fontScale: 1,\n}\n\nconst getApplication = (): Gtk.Application | null =>\n Gio.Application.getDefault() as unknown as Gtk.Application | null\n\nconst getActiveAppWindow = (): Gtk.Window | null => {\n const app = getApplication()\n if (!app || typeof app.getActiveWindow !== \"function\") {\n return null\n }\n return app.getActiveWindow() ?? null\n}\n\nconst windowAt = (model: Gio.ListModel, index: number): Gtk.Window | null =>\n model.getItem(index) as unknown as Gtk.Window | null\n\n// The application's active window if any, otherwise the first toplevel. The\n// toplevel fallback covers the test harness, where windows exist without a\n// GtkApplication (`Gio.Application.getDefault()` is null there).\n// RN's Dimensions(\"window\") means the MAIN window: transient toplevels\n// (Modal → modal GtkWindow, dialogs) must never be resolved as \"the window\" —\n// an open modal becomes the active window and would shrink the app viewport\n// to the modal size.\nconst isMainWindow = (window: Gtk.Window): boolean =>\n window.getTransientFor() === null\n\nconst resolveWindow = (): Gtk.Window | null => {\n const active = getActiveAppWindow()\n if (active && isMainWindow(active)) {\n return active\n }\n const toplevels = Gtk.Window.getToplevels()\n const count = toNumber(toplevels.getNItems())\n let first: Gtk.Window | null = null\n for (let index = 0; index < count; index += 1) {\n const window = windowAt(toplevels, index)\n if (!window || !isMainWindow(window)) {\n continue\n }\n if (window.isActive()) {\n return window\n }\n first = first ?? window\n }\n return first\n}\n\nconst isAnyWindowActive = (): boolean => {\n const toplevels = Gtk.Window.getToplevels()\n const count = toNumber(toplevels.getNItems())\n for (let index = 0; index < count; index += 1) {\n if (windowAt(toplevels, index)?.isActive()) {\n return true\n }\n }\n return false\n}\n\nconst windowMetrics = (): ScaledSize => {\n const window = resolveWindow()\n if (!window) {\n return FALLBACK_METRICS\n }\n // RN's Dimensions(\"window\") is the app viewport: the window CHILD's\n // allocation (the content area under the headerbar), not the window widget\n // size. Falls back to the window size before the first allocation.\n const child = window.getChild()\n const childAllocation = child?.getAllocation()\n const allocatedWidth =\n childAllocation && childAllocation.width > 0\n ? toNumber(childAllocation.width)\n : toNumber(window.getWidth())\n const allocatedHeight =\n childAllocation && childAllocation.height > 0\n ? toNumber(childAllocation.height)\n : toNumber(window.getHeight())\n // Before the first allocation everything reports 0 — fall back to\n // the requested default size (which GTK4 also keeps updated on resize).\n const width =\n allocatedWidth > 0\n ? allocatedWidth\n : Math.max(toNumber(window.defaultWidth ?? 0), 0)\n const height =\n allocatedHeight > 0\n ? allocatedHeight\n : Math.max(toNumber(window.defaultHeight ?? 0), 0)\n return {\n width,\n height,\n scale: toNumber(window.getScaleFactor()),\n fontScale: 1,\n }\n}\n\nconst screenMetrics = (): ScaledSize => {\n const display = Gdk.Display.getDefault()\n if (!display) {\n return windowMetrics()\n }\n const monitors = display.getMonitors()\n if (toNumber(monitors.getNItems()) === 0) {\n return windowMetrics()\n }\n const monitor = monitors.getItem(0) as unknown as Gdk.Monitor | null\n if (!monitor) {\n return windowMetrics()\n }\n const geometry = monitor.getGeometry()\n return {\n width: toNumber(geometry.width),\n height: toNumber(geometry.height),\n scale: toNumber(monitor.getScaleFactor()),\n fontScale: 1,\n }\n}\n\n// GtkNative.getSurface is an interface method merged onto Gtk.Window at\n// runtime via mixins; accessed defensively to stay typecheckable either way.\nconst surfaceOf = (window: Gtk.Window): Gdk.Surface | null => {\n const native = window as unknown as { getSurface?: () => Gdk.Surface | null }\n return typeof native.getSurface === \"function\"\n ? (native.getSurface() ?? null)\n : null\n}\n\n// Tracks the \"current\" window across creation/destruction/focus moves:\n// listens on the given signals of the resolved window (and, when requested,\n// its GdkSurface) plus the toplevel list model, re-resolving and re-attaching\n// whenever the tracked window may have changed. Modules dedupe, so\n// over-notifying is fine.\n//\n// Why the surface: notify::default-width fires when setDefaultSize() is\n// called, i.e. before the compositor actually resizes the surface — the\n// allocated size (what Dimensions reports) only changes when the surface\n// does. And GdkSurface notify::width/height fires at configure time, still\n// before the widget allocation pass, so the \"layout\" signal is also needed:\n// it is emitted during the frame's layout phase and — because GTK's own\n// relayout handler is connected first — our handler observes the updated\n// allocation. The module dedupes, so early/no-op emissions cost nothing.\nconst watchWindow = (\n windowSignals: readonly string[],\n surfaceSignals: readonly string[],\n notify: () => void,\n): SubscriptionHandle => {\n let window: Gtk.Window | null = null\n let surface: Gdk.Surface | null = null\n\n const attachWindow = (): void => {\n if (!window) {\n return\n }\n for (const signal of windowSignals) {\n window.on(signal, onSignal)\n }\n }\n\n const detachWindow = (): void => {\n if (!window) {\n return\n }\n for (const signal of windowSignals) {\n window.off(signal, onSignal)\n }\n }\n\n const attachSurface = (): void => {\n if (!surface) {\n return\n }\n for (const signal of surfaceSignals) {\n surface.on(signal, onSignal)\n }\n }\n\n const detachSurface = (): void => {\n if (!surface) {\n return\n }\n for (const signal of surfaceSignals) {\n surface.off(signal, onSignal)\n }\n }\n\n const syncTargets = (): void => {\n const nextWindow = resolveWindow()\n if (nextWindow !== window) {\n detachWindow()\n window = nextWindow\n attachWindow()\n }\n const nextSurface =\n window && surfaceSignals.length > 0 ? surfaceOf(window) : null\n if (nextSurface !== surface) {\n detachSurface()\n surface = nextSurface\n attachSurface()\n }\n }\n\n const onSignal = (): void => {\n syncTargets()\n notify()\n }\n\n const toplevels = Gtk.Window.getToplevels()\n const onToplevelsChanged = (): void => {\n syncTargets()\n notify()\n }\n toplevels.on(\"items-changed\", onToplevelsChanged)\n syncTargets()\n\n return {\n remove: () => {\n detachWindow()\n detachSurface()\n window = null\n surface = null\n toplevels.off(\"items-changed\", onToplevelsChanged)\n },\n }\n}\n\n// realize/map re-run target resolution so the surface listeners attach as\n// soon as the surface exists.\nconst WINDOW_SIZE_SIGNALS = [\n \"notify::default-width\",\n \"notify::default-height\",\n \"realize\",\n \"map\",\n] as const\n\nconst SURFACE_SIZE_SIGNALS = [\n \"notify::width\",\n \"notify::height\",\n \"layout\",\n] as const\n\nconst WINDOW_ACTIVE_SIGNALS = [\"notify::is-active\"] as const\n\nconst gtkVersion = (): string =>\n `${toNumber(Gtk.getMajorVersion())}.${toNumber(Gtk.getMinorVersion())}.${toNumber(Gtk.getMicroVersion())}`\n\nconst setColorScheme = (scheme: ColorSchemeName | null): void => {\n const manager = styleManager()\n if (scheme === \"dark\") {\n manager.setColorScheme(Adw.ColorScheme.FORCE_DARK)\n } else if (scheme === \"light\") {\n manager.setColorScheme(Adw.ColorScheme.FORCE_LIGHT)\n } else {\n manager.setColorScheme(Adw.ColorScheme.DEFAULT)\n }\n // Our apps are GtkApplication (not AdwApplication), so Adwaita may not\n // restyle widgets: duplicate the request through the classic GTK setting,\n // which the theme always honors.\n const settings = Gtk.Settings.getDefault()\n if (settings) {\n if (scheme === null) {\n settings.resetProperty(\"gtk-application-prefer-dark-theme\")\n } else {\n settings.gtkApplicationPreferDarkTheme = scheme === \"dark\"\n }\n }\n}\n\nconst onColorSchemeChange = (notify: () => void): SubscriptionHandle => {\n const manager = styleManager()\n const listener = (): void => notify()\n manager.on(\"notify::dark\", listener)\n return { remove: () => manager.off(\"notify::dark\", listener) }\n}\n\nconst showAlert = async (request: HostAlertRequest): Promise<string | null> => {\n const dialog = new Adw.AlertDialog()\n dialog.setHeading(request.title)\n if (request.message !== undefined && request.message.length > 0) {\n dialog.setBody(request.message)\n }\n let closeResponse: string | null = null\n for (const button of request.buttons) {\n dialog.addResponse(button.id, button.label)\n if (button.style === \"destructive\") {\n dialog.setResponseAppearance(\n button.id,\n Adw.ResponseAppearance.DESTRUCTIVE,\n )\n }\n if (button.isPreferred) {\n dialog.setResponseAppearance(button.id, Adw.ResponseAppearance.SUGGESTED)\n dialog.setDefaultResponse(button.id)\n }\n if (button.style === \"cancel\") {\n closeResponse = button.id\n }\n }\n if (closeResponse !== null) {\n // Esc / close maps onto the cancel button, like RN's cancel semantics.\n dialog.setCloseResponse(closeResponse)\n } else if (!request.cancelable) {\n // No cancel button and not cancelable: block Esc-dismissal. Responses\n // still close the dialog (they bypass the can-close guard).\n dialog.setCanClose(false)\n }\n const response = await dialog.choose(resolveWindow())\n // Anything that is not one of our buttons (e.g. the built-in \"close\"\n // response) is a dismissal.\n return request.buttons.some((button) => button.id === response)\n ? response\n : null\n}\n\nconst launchUri = async (uri: string): Promise<void> => {\n const launcher = new Gtk.UriLauncher({ uri })\n // Promisified by the gi codegen; rejects with the GError on failure.\n await launcher.launch(resolveWindow())\n}\n\n// The default widget direction is GTK's read of the locale text direction.\nconst isRTL = (): boolean => {\n try {\n return Gtk.Widget.getDefaultDirection() === Gtk.TextDirection.RTL\n } catch {\n return false\n }\n}\n\nexport const gtkxHost: Host = {\n gtkVersion,\n getWindowMetrics: windowMetrics,\n getScreenMetrics: screenMetrics,\n onMetricsChange: (notify) =>\n watchWindow(WINDOW_SIZE_SIGNALS, SURFACE_SIZE_SIGNALS, notify),\n getColorScheme: () => colorScheme(),\n setColorScheme,\n onColorSchemeChange,\n isActive: isAnyWindowActive,\n onActiveChange: (notify) => watchWindow(WINDOW_ACTIVE_SIGNALS, [], notify),\n showAlert,\n launchUri,\n isRTL,\n exitApp: () => quit(),\n}\n"]}
|
|
1
|
+
{"version":3,"file":"host.gtkx.js","sourceRoot":"","sources":["../../src/apis/host.gtkx.ts"],"names":[],"mappings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CAAC,IAAI,CAAA;AACV,CAAC,CAAA;AAED,MAAM,SAAS,GAAG,KAAK,EAAE,GAAW,EAAiB,EAAE;IACrD,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,WAAW,CAAC,EAAE,GAAG,EAAE,CAAC,CAAA;IAC7C,qEAAqE;IACrE,MAAM,QAAQ,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC,CAAA;AACxC,CAAC,CAAA;AAED,2EAA2E;AAC3E,MAAM,KAAK,GAAG,GAAY,EAAE;IAC1B,IAAI,CAAC;QACH,OAAO,GAAG,CAAC,MAAM,CAAC,mBAAmB,EAAE,KAAK,GAAG,CAAC,aAAa,CAAC,GAAG,CAAA;IACnE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAA;IACd,CAAC;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,QAAQ,GAAS;IAC5B,UAAU;IACV,gBAAgB,EAAE,aAAa;IAC/B,gBAAgB,EAAE,aAAa;IAC/B,eAAe,EAAE,CAAC,MAAM,EAAE,EAAE,CAC1B,WAAW,CAAC,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,CAAC;IAChE,cAAc,EAAE,GAAG,EAAE,CAAC,WAAW,EAAE;IACnC,cAAc;IACd,mBAAmB;IACnB,QAAQ,EAAE,iBAAiB;IAC3B,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,WAAW,CAAC,qBAAqB,EAAE,EAAE,EAAE,MAAM,CAAC;IAC1E,SAAS;IACT,SAAS;IACT,KAAK;IACL,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE;CACtB,CAAA","sourcesContent":["// Production host adapter: the ONLY module under src/apis/ allowed to import\n// the gtkx bridge. Everything GTK-specific lives here; the API modules stay\n// pure and receive this object (or a mock in unit tests) via injection.\n\nimport type { SubscriptionHandle } from \"../contracts\"\nimport {\n Adw,\n colorScheme,\n Gdk,\n Gio,\n Gtk,\n quit,\n styleManager,\n toNumber,\n} from \"../gtkx/bridge/index\"\nimport type {\n ColorSchemeName,\n Host,\n HostAlertRequest,\n ScaledSize,\n} from \"./host\"\n\nconst FALLBACK_METRICS: ScaledSize = {\n width: 0,\n height: 0,\n scale: 1,\n fontScale: 1,\n}\n\nconst getApplication = (): Gtk.Application | null =>\n Gio.Application.getDefault() as unknown as Gtk.Application | null\n\nconst getActiveAppWindow = (): Gtk.Window | null => {\n const app = getApplication()\n if (!app || typeof app.getActiveWindow !== \"function\") {\n return null\n }\n return app.getActiveWindow() ?? null\n}\n\nconst windowAt = (model: Gio.ListModel, index: number): Gtk.Window | null =>\n model.getItem(index) as unknown as Gtk.Window | null\n\n// The application's active window if any, otherwise the first toplevel. The\n// toplevel fallback covers the test harness, where windows exist without a\n// GtkApplication (`Gio.Application.getDefault()` is null there).\n// RN's Dimensions(\"window\") means the MAIN window: transient toplevels\n// (Modal → modal GtkWindow, dialogs) must never be resolved as \"the window\" —\n// an open modal becomes the active window and would shrink the app viewport\n// to the modal size.\nconst isMainWindow = (window: Gtk.Window): boolean =>\n window.getTransientFor() === null\n\nconst resolveWindow = (): Gtk.Window | null => {\n const active = getActiveAppWindow()\n if (active && isMainWindow(active)) {\n return active\n }\n const toplevels = Gtk.Window.getToplevels()\n const count = toNumber(toplevels.getNItems())\n let first: Gtk.Window | null = null\n for (let index = 0; index < count; index += 1) {\n const window = windowAt(toplevels, index)\n if (!window || !isMainWindow(window)) {\n continue\n }\n if (window.isActive()) {\n return window\n }\n first = first ?? window\n }\n return first\n}\n\nconst isAnyWindowActive = (): boolean => {\n const toplevels = Gtk.Window.getToplevels()\n const count = toNumber(toplevels.getNItems())\n for (let index = 0; index < count; index += 1) {\n if (windowAt(toplevels, index)?.isActive()) {\n return true\n }\n }\n return false\n}\n\nconst windowMetrics = (): ScaledSize => {\n const window = resolveWindow()\n if (!window) {\n return FALLBACK_METRICS\n }\n // RN's Dimensions(\"window\") is the app viewport: the window CHILD's\n // allocation (the content area under the headerbar), not the window widget\n // size. Falls back to the window size before the first allocation.\n const child = window.getChild()\n const childAllocation = child?.getAllocation()\n const allocatedWidth =\n childAllocation && childAllocation.width > 0\n ? toNumber(childAllocation.width)\n : toNumber(window.getWidth())\n const allocatedHeight =\n childAllocation && childAllocation.height > 0\n ? toNumber(childAllocation.height)\n : toNumber(window.getHeight())\n // Before the first allocation everything reports 0 — fall back to\n // the requested default size (which GTK4 also keeps updated on resize).\n const width =\n allocatedWidth > 0\n ? allocatedWidth\n : Math.max(toNumber(window.defaultWidth ?? 0), 0)\n const height =\n allocatedHeight > 0\n ? allocatedHeight\n : Math.max(toNumber(window.defaultHeight ?? 0), 0)\n return {\n width,\n height,\n scale: toNumber(window.getScaleFactor()),\n fontScale: 1,\n }\n}\n\nconst screenMetrics = (): ScaledSize => {\n const display = Gdk.Display.getDefault()\n if (!display) {\n return windowMetrics()\n }\n const monitors = display.getMonitors()\n if (toNumber(monitors.getNItems()) === 0) {\n return windowMetrics()\n }\n const monitor = monitors.getItem(0) as unknown as Gdk.Monitor | null\n if (!monitor) {\n return windowMetrics()\n }\n const geometry = monitor.getGeometry()\n return {\n width: toNumber(geometry.width),\n height: toNumber(geometry.height),\n scale: toNumber(monitor.getScaleFactor()),\n fontScale: 1,\n }\n}\n\n// GtkNative.getSurface is an interface method merged onto Gtk.Window at\n// runtime via mixins; accessed defensively to stay typecheckable either way.\nconst surfaceOf = (window: Gtk.Window): Gdk.Surface | null => {\n const native = window as unknown as { getSurface?: () => Gdk.Surface | null }\n return typeof native.getSurface === \"function\"\n ? (native.getSurface() ?? null)\n : null\n}\n\n// Tracks the \"current\" window across creation/destruction/focus moves:\n// listens on the given signals of the resolved window (and, when requested,\n// its GdkSurface) plus the toplevel list model, re-resolving and re-attaching\n// whenever the tracked window may have changed. Modules dedupe, so\n// over-notifying is fine.\n//\n// Why the surface: notify::default-width fires when setDefaultSize() is\n// called, i.e. before the compositor actually resizes the surface — the\n// allocated size (what Dimensions reports) only changes when the surface\n// does. And GdkSurface notify::width/height fires at configure time, still\n// before the widget allocation pass, so the \"layout\" signal is also needed:\n// it is emitted during the frame's layout phase and — because GTK's own\n// relayout handler is connected first — our handler observes the updated\n// allocation. The module dedupes, so early/no-op emissions cost nothing.\nconst watchWindow = (\n windowSignals: readonly string[],\n surfaceSignals: readonly string[],\n notify: () => void,\n): SubscriptionHandle => {\n let window: Gtk.Window | null = null\n let surface: Gdk.Surface | null = null\n\n const attachWindow = (): void => {\n if (!window) {\n return\n }\n for (const signal of windowSignals) {\n window.on(signal, onSignal)\n }\n }\n\n const detachWindow = (): void => {\n if (!window) {\n return\n }\n for (const signal of windowSignals) {\n window.off(signal, onSignal)\n }\n }\n\n const attachSurface = (): void => {\n if (!surface) {\n return\n }\n for (const signal of surfaceSignals) {\n surface.on(signal, onSignal)\n }\n }\n\n const detachSurface = (): void => {\n if (!surface) {\n return\n }\n for (const signal of surfaceSignals) {\n surface.off(signal, onSignal)\n }\n }\n\n const syncTargets = (): void => {\n const nextWindow = resolveWindow()\n if (nextWindow !== window) {\n detachWindow()\n window = nextWindow\n attachWindow()\n }\n const nextSurface =\n window && surfaceSignals.length > 0 ? surfaceOf(window) : null\n if (nextSurface !== surface) {\n detachSurface()\n surface = nextSurface\n attachSurface()\n }\n }\n\n const onSignal = (): void => {\n syncTargets()\n notify()\n }\n\n const toplevels = Gtk.Window.getToplevels()\n const onToplevelsChanged = (): void => {\n syncTargets()\n notify()\n }\n toplevels.on(\"items-changed\", onToplevelsChanged)\n syncTargets()\n\n return {\n remove: () => {\n detachWindow()\n detachSurface()\n window = null\n surface = null\n toplevels.off(\"items-changed\", onToplevelsChanged)\n },\n }\n}\n\n// realize/map re-run target resolution so the surface listeners attach as\n// soon as the surface exists.\nconst WINDOW_SIZE_SIGNALS = [\n \"notify::default-width\",\n \"notify::default-height\",\n \"realize\",\n \"map\",\n] as const\n\nconst SURFACE_SIZE_SIGNALS = [\n \"notify::width\",\n \"notify::height\",\n \"layout\",\n] as const\n\nconst WINDOW_ACTIVE_SIGNALS = [\"notify::is-active\"] as const\n\nconst gtkVersion = (): string =>\n `${toNumber(Gtk.getMajorVersion())}.${toNumber(Gtk.getMinorVersion())}.${toNumber(Gtk.getMicroVersion())}`\n\n// AdwStyleManager is the only thing that decides the palette here, and it is\n// enough on its own — appearance.test.tsx asserts that a real widget's\n// computed foreground flips with it. This used to also write the classic\n// GtkSettings:gtk-application-prefer-dark-theme, guarding against Adwaita\n// not restyling a GtkApplication (we do not use AdwApplication). Under\n// libadwaita that write is inert: adw_init() takes the color scheme over,\n// answers the setting with \"unsupported ... use AdwStyleManager:color-scheme\n// instead\" and keeps its own value, so all the duplicate ever produced was a\n// warning per call — seven per test run.\nconst setColorScheme = (scheme: ColorSchemeName | null): void => {\n const manager = styleManager()\n if (scheme === \"dark\") {\n manager.setColorScheme(Adw.ColorScheme.FORCE_DARK)\n } else if (scheme === \"light\") {\n manager.setColorScheme(Adw.ColorScheme.FORCE_LIGHT)\n } else {\n manager.setColorScheme(Adw.ColorScheme.DEFAULT)\n }\n}\n\nconst onColorSchemeChange = (notify: () => void): SubscriptionHandle => {\n const manager = styleManager()\n const listener = (): void => notify()\n manager.on(\"notify::dark\", listener)\n return { remove: () => manager.off(\"notify::dark\", listener) }\n}\n\nconst showAlert = async (request: HostAlertRequest): Promise<string | null> => {\n const dialog = new Adw.AlertDialog()\n dialog.setHeading(request.title)\n if (request.message !== undefined && request.message.length > 0) {\n dialog.setBody(request.message)\n }\n let closeResponse: string | null = null\n for (const button of request.buttons) {\n dialog.addResponse(button.id, button.label)\n if (button.style === \"destructive\") {\n dialog.setResponseAppearance(\n button.id,\n Adw.ResponseAppearance.DESTRUCTIVE,\n )\n }\n if (button.isPreferred) {\n dialog.setResponseAppearance(button.id, Adw.ResponseAppearance.SUGGESTED)\n dialog.setDefaultResponse(button.id)\n }\n if (button.style === \"cancel\") {\n closeResponse = button.id\n }\n }\n if (closeResponse !== null) {\n // Esc / close maps onto the cancel button, like RN's cancel semantics.\n dialog.setCloseResponse(closeResponse)\n } else if (!request.cancelable) {\n // No cancel button and not cancelable: block Esc-dismissal. Responses\n // still close the dialog (they bypass the can-close guard).\n dialog.setCanClose(false)\n }\n const response = await dialog.choose(resolveWindow())\n // Anything that is not one of our buttons (e.g. the built-in \"close\"\n // response) is a dismissal.\n return request.buttons.some((button) => button.id === response)\n ? response\n : null\n}\n\nconst launchUri = async (uri: string): Promise<void> => {\n const launcher = new Gtk.UriLauncher({ uri })\n // Promisified by the gi codegen; rejects with the GError on failure.\n await launcher.launch(resolveWindow())\n}\n\n// The default widget direction is GTK's read of the locale text direction.\nconst isRTL = (): boolean => {\n try {\n return Gtk.Widget.getDefaultDirection() === Gtk.TextDirection.RTL\n } catch {\n return false\n }\n}\n\nexport const gtkxHost: Host = {\n gtkVersion,\n getWindowMetrics: windowMetrics,\n getScreenMetrics: screenMetrics,\n onMetricsChange: (notify) =>\n watchWindow(WINDOW_SIZE_SIGNALS, SURFACE_SIZE_SIGNALS, notify),\n getColorScheme: () => colorScheme(),\n setColorScheme,\n onColorSchemeChange,\n isActive: isAnyWindowActive,\n onActiveChange: (notify) => watchWindow(WINDOW_ACTIVE_SIGNALS, [], notify),\n showAlert,\n launchUri,\n isRTL,\n exitApp: () => quit(),\n}\n"]}
|
package/dist/apis/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const Platform: {
|
|
2
|
-
OS: "
|
|
2
|
+
OS: import("./platform").PlatformOSType;
|
|
3
3
|
isTV: false;
|
|
4
4
|
isTesting: boolean;
|
|
5
5
|
readonly Version: string;
|
|
@@ -45,6 +45,8 @@ export declare const BackHandler: {
|
|
|
45
45
|
dispatchBackPress(): boolean;
|
|
46
46
|
};
|
|
47
47
|
export { DevSettings } from "./dev-settings";
|
|
48
|
+
export { Keyboard, type KeyboardEvent, type KeyboardEventName, } from "./keyboard";
|
|
49
|
+
export { LogBox, type LogBoxIgnorePattern } from "./log-box";
|
|
48
50
|
export { InteractionManager, type InteractionPromise, } from "./interaction-manager";
|
|
49
51
|
export declare const useWindowDimensions: () => import("./host").ScaledSize;
|
|
50
52
|
export declare const useColorScheme: () => import("./host").ColorSchemeName;
|
|
@@ -53,4 +55,4 @@ export type { AppStateEvent, AppStateStatus } from "./app-state";
|
|
|
53
55
|
export type { AppearancePreferences } from "./appearance";
|
|
54
56
|
export type { DimensionKey, DimensionsPayload } from "./dimensions";
|
|
55
57
|
export type { AlertButtonStyle, ColorSchemeName, ScaledSize } from "./host";
|
|
56
|
-
export type { PlatformSelectSpec } from "./platform";
|
|
58
|
+
export type { PlatformOSType, PlatformSelectSpec } from "./platform";
|
package/dist/apis/index.js
CHANGED
|
@@ -20,6 +20,8 @@ export const Linking = createLinking(gtkxHost);
|
|
|
20
20
|
export const I18nManager = createI18nManager(gtkxHost);
|
|
21
21
|
export const BackHandler = createBackHandler(gtkxHost);
|
|
22
22
|
export { DevSettings } from "./dev-settings";
|
|
23
|
+
export { Keyboard, } from "./keyboard";
|
|
24
|
+
export { LogBox } from "./log-box";
|
|
23
25
|
export { InteractionManager, } from "./interaction-manager";
|
|
24
26
|
export const useWindowDimensions = createUseWindowDimensions(Dimensions);
|
|
25
27
|
export const useColorScheme = createUseColorScheme(Appearance);
|