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
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
// The pure half of the `react-native-worklets` mirror: the whole surface, and
|
|
2
|
+
// the factory behind the thread functions.
|
|
3
|
+
//
|
|
4
|
+
// Split from index.ts because index.ts is the module both presets alias the
|
|
5
|
+
// PACKAGE NAME onto, and a unit test wants the surface without the name. Every
|
|
6
|
+
// export here is reachable from a machine with no GTK on it.
|
|
7
|
+
//
|
|
8
|
+
// THE RULE THIS FILE FOLLOWS, and it is the whole design: mirror upstream's
|
|
9
|
+
// own NON-NATIVE implementation — the `.ts` files next to its `.native.ts`
|
|
10
|
+
// ones, which are what react-native-windows and the web run. Where that file
|
|
11
|
+
// computes something, this one computes the same thing; where it throws, this
|
|
12
|
+
// one refuses by name. That is not a shortcut, it is the only boundary with a
|
|
13
|
+
// source of truth: a worklet runtime is structural, and upstream agrees.
|
|
14
|
+
// Measured against react-native-worklets 0.11.3.
|
|
15
|
+
//
|
|
16
|
+
// The one place that rule is deliberately NOT followed is HOW LATE a UI hop
|
|
17
|
+
// lands: upstream's non-native build waits for a `requestAnimationFrame` and
|
|
18
|
+
// this one does not. See reanimated-compat/threads.ts — the web's rAF stands
|
|
19
|
+
// in for a UI runtime it has not got, React Native's real one does not wait
|
|
20
|
+
// for a frame, and waiting here broke a measurement round trip.
|
|
21
|
+
import { createThreads } from "../reanimated-compat/threads";
|
|
22
|
+
import { createUnsupportedFactory } from "../unsupported-export";
|
|
23
|
+
/**
|
|
24
|
+
* The thread surface. `runOnUI`/`runOnJS`/`scheduleOnUI`/`scheduleOnRN` come
|
|
25
|
+
* from the same `createThreads` the Reanimated surface uses — index.ts hands
|
|
26
|
+
* both modules the SAME instance, so a job queued through either name lands
|
|
27
|
+
* in the same batch, as it does upstream where one package re-exports the
|
|
28
|
+
* other.
|
|
29
|
+
*/
|
|
30
|
+
export const createWorkletsSurface = () => {
|
|
31
|
+
const threads = createThreads();
|
|
32
|
+
/**
|
|
33
|
+
* Upstream's `runOnUIAsync` resolves with the worklet's return value when
|
|
34
|
+
* the UI hop runs it — the one thread API that hands anything back, because
|
|
35
|
+
* a promise crosses the deferral the others impose.
|
|
36
|
+
*/
|
|
37
|
+
const runOnUIAsync = (worklet, ...args) => new Promise((resolve) => {
|
|
38
|
+
threads.scheduleOnUI(() => {
|
|
39
|
+
resolve(worklet(...args));
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
return { ...threads, runOnUIAsync };
|
|
43
|
+
};
|
|
44
|
+
// --- the pure surface ----------------------------------------------------
|
|
45
|
+
export { isWorkletFunction } from "../reanimated-compat/threads";
|
|
46
|
+
/**
|
|
47
|
+
* Upstream's runtime taxonomy. There is one runtime here and it is the React
|
|
48
|
+
* Native one — GTK's main loop IS the JS thread — which is exactly what
|
|
49
|
+
* upstream's non-native path reports too: its initializer sets
|
|
50
|
+
* `__RUNTIME_KIND` to `ReactNative` and never changes it.
|
|
51
|
+
*/
|
|
52
|
+
export var RuntimeKind;
|
|
53
|
+
(function (RuntimeKind) {
|
|
54
|
+
RuntimeKind[RuntimeKind["ReactNative"] = 1] = "ReactNative";
|
|
55
|
+
RuntimeKind[RuntimeKind["UI"] = 2] = "UI";
|
|
56
|
+
RuntimeKind[RuntimeKind["Worker"] = 3] = "Worker";
|
|
57
|
+
})(RuntimeKind || (RuntimeKind = {}));
|
|
58
|
+
export const getRuntimeKind = () => RuntimeKind.ReactNative;
|
|
59
|
+
export const isRNRuntime = () => true;
|
|
60
|
+
export const isUIRuntime = () => false;
|
|
61
|
+
export const isWorkerRuntime = () => false;
|
|
62
|
+
export const isWorkletRuntime = () => false;
|
|
63
|
+
/** Mirrored as data, as upstream's non-native `runtimes.ts` does. */
|
|
64
|
+
export const UIRuntimeId = RuntimeKind.UI;
|
|
65
|
+
/**
|
|
66
|
+
* The serializer, which on a single-runtime path is a file of identity
|
|
67
|
+
* functions — a value never leaves the runtime it was made in, so there is
|
|
68
|
+
* nothing to clone and nothing to register.
|
|
69
|
+
*/
|
|
70
|
+
// The ones that ignore their argument are typed as a signature and
|
|
71
|
+
// implemented without parameters: the CALL shape is what matters to a
|
|
72
|
+
// consumer, and a named-but-unused parameter is only there to be linted.
|
|
73
|
+
export const createSerializable = (value) => value;
|
|
74
|
+
export const isSerializableRef = () => true;
|
|
75
|
+
export const registerCustomSerializable = () => { };
|
|
76
|
+
export const makeShareable = (value) => value;
|
|
77
|
+
export const makeShareableCloneRecursive = (value) => value;
|
|
78
|
+
export const makeShareableCloneOnUIRecursive = (value) => value;
|
|
79
|
+
/** @deprecated Upstream's former name for {@link isSerializableRef}. */
|
|
80
|
+
export const isShareableRef = isSerializableRef;
|
|
81
|
+
/** The mapping cache upstream keeps for the serializer, which has nothing to map. */
|
|
82
|
+
export const serializableMappingCache = {
|
|
83
|
+
set: () => { },
|
|
84
|
+
get: () => null,
|
|
85
|
+
};
|
|
86
|
+
/** @deprecated Upstream's former name for {@link serializableMappingCache}. */
|
|
87
|
+
export const shareableMappingCache = serializableMappingCache;
|
|
88
|
+
/** Deprecated and a documented no-op upstream, kept callable for source parity. */
|
|
89
|
+
export const callMicrotasks = () => { };
|
|
90
|
+
/** Structural checks, portable exactly as upstream writes them. */
|
|
91
|
+
export const isShareable = (value) => typeof value === "object" &&
|
|
92
|
+
value !== null &&
|
|
93
|
+
!!value.__shareableRef;
|
|
94
|
+
export const isSynchronizable = (value) => typeof value === "object" &&
|
|
95
|
+
value !== null &&
|
|
96
|
+
!!value.__synchronizableRef;
|
|
97
|
+
/**
|
|
98
|
+
* Bundle mode is a Babel/Metro transform of upstream's own plugin, which this
|
|
99
|
+
* platform never runs — so the honest answer is upstream's non-native one.
|
|
100
|
+
*/
|
|
101
|
+
export const isBundleModeEnabled = () => false;
|
|
102
|
+
/** A debug toggle for the UI runtime's clock, which is this platform's only clock. */
|
|
103
|
+
export const toggleSlowAnimationsOnUIRuntime = () => false;
|
|
104
|
+
/**
|
|
105
|
+
* Feature flags gate upstream's own native experiments. None of them exist
|
|
106
|
+
* here, so every flag reads false and setting one changes nothing — again
|
|
107
|
+
* upstream's non-native answer rather than an invention.
|
|
108
|
+
*/
|
|
109
|
+
export const getStaticFeatureFlag = () => false;
|
|
110
|
+
export const getDynamicFeatureFlag = () => false;
|
|
111
|
+
export const setDynamicFeatureFlag = () => { };
|
|
112
|
+
// --- the refusals --------------------------------------------------------
|
|
113
|
+
//
|
|
114
|
+
// Exactly the exports whose non-native implementation upstream ships as a
|
|
115
|
+
// `throw`. Enumerated by hand rather than produced by a Proxy over the module,
|
|
116
|
+
// because ESM named imports resolve statically: a symbol missing from the
|
|
117
|
+
// module fails at BUILD time with "no export named X", and only the names
|
|
118
|
+
// here can produce the descriptive runtime message.
|
|
119
|
+
const unsupported = createUnsupportedFactory("react-native-worklets", "Implemented here: runOnUI/scheduleOnUI/runOnJS/scheduleOnRN/runOnUIAsync, isWorkletFunction, " +
|
|
120
|
+
"the serializer (identity — nothing leaves this runtime) and the runtime-kind checks. " +
|
|
121
|
+
"What is not is a SECOND runtime: this platform has one thread, GTK's main loop, " +
|
|
122
|
+
"and upstream's own non-native build throws for these too. See docs/api.md.");
|
|
123
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
124
|
+
// --- a second runtime, which is structural by definition ---
|
|
125
|
+
export const createWorkletRuntime = unsupported("createWorkletRuntime");
|
|
126
|
+
export const runOnRuntime = unsupported("runOnRuntime");
|
|
127
|
+
export const runOnRuntimeAsync = unsupported("runOnRuntimeAsync");
|
|
128
|
+
export const runOnRuntimeAsyncWithId = unsupported("runOnRuntimeAsyncWithId");
|
|
129
|
+
export const runOnRuntimeSync = unsupported("runOnRuntimeSync");
|
|
130
|
+
export const runOnRuntimeSyncWithId = unsupported("runOnRuntimeSyncWithId");
|
|
131
|
+
export const scheduleOnRuntime = unsupported("scheduleOnRuntime");
|
|
132
|
+
export const scheduleOnRuntimeWithId = unsupported("scheduleOnRuntimeWithId");
|
|
133
|
+
export const getUIRuntimeHolder = unsupported("getUIRuntimeHolder");
|
|
134
|
+
export const getUISchedulerHolder = unsupported("getUISchedulerHolder");
|
|
135
|
+
// --- synchronous hops across a boundary that is not there ---
|
|
136
|
+
// Both are the "run it over there and give me the answer now" pair, and both
|
|
137
|
+
// throw upstream on every single-runtime build. Deferring instead would be
|
|
138
|
+
// worse than refusing: the caller wants the RETURN VALUE, and a deferred call
|
|
139
|
+
// has none.
|
|
140
|
+
export const runOnUISync = unsupported("runOnUISync");
|
|
141
|
+
export const executeOnUIRuntimeSync = unsupported("executeOnUIRuntimeSync");
|
|
142
|
+
// --- memory shared between runtimes ---
|
|
143
|
+
export const createShareable = unsupported("createShareable");
|
|
144
|
+
export const createSynchronizable = unsupported("createSynchronizable");
|
|
145
|
+
/**
|
|
146
|
+
* The TurboModule behind the whole package. Upstream's non-native build
|
|
147
|
+
* exports it as `null`, which fails as "cannot read properties of null" and
|
|
148
|
+
* names nothing; this refuses by name instead. The one deliberate deviation
|
|
149
|
+
* from the mirror rule above, and it can only ever turn a worse error into a
|
|
150
|
+
* better one — nothing that works against `null` works against a refusal.
|
|
151
|
+
*/
|
|
152
|
+
export const WorkletsModule = unsupported("WorkletsModule");
|
|
153
|
+
//# sourceMappingURL=surface.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"surface.js","sourceRoot":"","sources":["../../src/worklets-compat/surface.ts"],"names":[],"mappings":"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","sourcesContent":["// The pure half of the `react-native-worklets` mirror: the whole surface, and\n// the factory behind the thread functions.\n//\n// Split from index.ts because index.ts is the module both presets alias the\n// PACKAGE NAME onto, and a unit test wants the surface without the name. Every\n// export here is reachable from a machine with no GTK on it.\n//\n// THE RULE THIS FILE FOLLOWS, and it is the whole design: mirror upstream's\n// own NON-NATIVE implementation — the `.ts` files next to its `.native.ts`\n// ones, which are what react-native-windows and the web run. Where that file\n// computes something, this one computes the same thing; where it throws, this\n// one refuses by name. That is not a shortcut, it is the only boundary with a\n// source of truth: a worklet runtime is structural, and upstream agrees.\n// Measured against react-native-worklets 0.11.3.\n//\n// The one place that rule is deliberately NOT followed is HOW LATE a UI hop\n// lands: upstream's non-native build waits for a `requestAnimationFrame` and\n// this one does not. See reanimated-compat/threads.ts — the web's rAF stands\n// in for a UI runtime it has not got, React Native's real one does not wait\n// for a frame, and waiting here broke a measurement round trip.\nimport { createThreads } from \"../reanimated-compat/threads\"\nimport { createUnsupportedFactory } from \"../unsupported-export\"\n\n/** A function the Babel plugin processed. Never produced on this platform. */\nexport type WorkletFunction<\n Args extends unknown[] = unknown[],\n ReturnValue = unknown,\n> = ((...args: Args) => ReturnValue) & { __workletHash?: number }\n\n/** Upstream's handle for a runtime that cannot exist here — see the refusals. */\nexport type WorkletRuntime = { __workletRuntime: true }\n\n/** Upstream's serializer handle. Identity here: nothing leaves this runtime. */\nexport type SerializableRef<T = unknown> = T\n\n/** @deprecated Upstream's former name for {@link SerializableRef}. */\nexport type ShareableRef<T = unknown> = SerializableRef<T>\n\n/**\n * The thread surface. `runOnUI`/`runOnJS`/`scheduleOnUI`/`scheduleOnRN` come\n * from the same `createThreads` the Reanimated surface uses — index.ts hands\n * both modules the SAME instance, so a job queued through either name lands\n * in the same batch, as it does upstream where one package re-exports the\n * other.\n */\nexport const createWorkletsSurface = () => {\n const threads = createThreads()\n\n /**\n * Upstream's `runOnUIAsync` resolves with the worklet's return value when\n * the UI hop runs it — the one thread API that hands anything back, because\n * a promise crosses the deferral the others impose.\n */\n const runOnUIAsync = <A extends unknown[], R>(\n worklet: (...args: A) => R,\n ...args: A\n ): Promise<R> =>\n new Promise<R>((resolve) => {\n threads.scheduleOnUI(() => {\n resolve(worklet(...args))\n })\n })\n\n return { ...threads, runOnUIAsync }\n}\n\n// --- the pure surface ----------------------------------------------------\n\nexport { isWorkletFunction } from \"../reanimated-compat/threads\"\n\n/**\n * Upstream's runtime taxonomy. There is one runtime here and it is the React\n * Native one — GTK's main loop IS the JS thread — which is exactly what\n * upstream's non-native path reports too: its initializer sets\n * `__RUNTIME_KIND` to `ReactNative` and never changes it.\n */\nexport enum RuntimeKind {\n ReactNative = 1,\n UI = 2,\n Worker = 3,\n}\n\nexport const getRuntimeKind = (): RuntimeKind => RuntimeKind.ReactNative\nexport const isRNRuntime = (): boolean => true\nexport const isUIRuntime = (): boolean => false\nexport const isWorkerRuntime = (): boolean => false\nexport const isWorkletRuntime = (): boolean => false\n\n/** Mirrored as data, as upstream's non-native `runtimes.ts` does. */\nexport const UIRuntimeId: number = RuntimeKind.UI\n\n/**\n * The serializer, which on a single-runtime path is a file of identity\n * functions — a value never leaves the runtime it was made in, so there is\n * nothing to clone and nothing to register.\n */\n// The ones that ignore their argument are typed as a signature and\n// implemented without parameters: the CALL shape is what matters to a\n// consumer, and a named-but-unused parameter is only there to be linted.\nexport const createSerializable = <T>(value: T): SerializableRef<T> => value\nexport const isSerializableRef: (value: unknown) => boolean = () => true\nexport const registerCustomSerializable: (\n registration: unknown,\n) => void = () => {}\nexport const makeShareable = <T>(value: T): T => value\nexport const makeShareableCloneRecursive = <T>(value: T): SerializableRef<T> =>\n value\nexport const makeShareableCloneOnUIRecursive = <T>(\n value: T,\n): SerializableRef<T> => value\n/** @deprecated Upstream's former name for {@link isSerializableRef}. */\nexport const isShareableRef = isSerializableRef\n\n/** The mapping cache upstream keeps for the serializer, which has nothing to map. */\nexport const serializableMappingCache: {\n set(serializable: object, ref?: unknown): void\n get(key: object): unknown\n} = {\n set: () => {},\n get: () => null,\n}\n/** @deprecated Upstream's former name for {@link serializableMappingCache}. */\nexport const shareableMappingCache = serializableMappingCache\n\n/** Deprecated and a documented no-op upstream, kept callable for source parity. */\nexport const callMicrotasks = (): void => {}\n\n/** Structural checks, portable exactly as upstream writes them. */\nexport const isShareable = (value: unknown): boolean =>\n typeof value === \"object\" &&\n value !== null &&\n !!(value as Record<string, unknown>).__shareableRef\n\nexport const isSynchronizable = (value: unknown): boolean =>\n typeof value === \"object\" &&\n value !== null &&\n !!(value as Record<string, unknown>).__synchronizableRef\n\n/**\n * Bundle mode is a Babel/Metro transform of upstream's own plugin, which this\n * platform never runs — so the honest answer is upstream's non-native one.\n */\nexport const isBundleModeEnabled = (): boolean => false\n\n/** A debug toggle for the UI runtime's clock, which is this platform's only clock. */\nexport const toggleSlowAnimationsOnUIRuntime = (): boolean => false\n\n/**\n * Feature flags gate upstream's own native experiments. None of them exist\n * here, so every flag reads false and setting one changes nothing — again\n * upstream's non-native answer rather than an invention.\n */\nexport const getStaticFeatureFlag: (name: string) => boolean = () => false\nexport const getDynamicFeatureFlag: (name: string) => boolean = () => false\nexport const setDynamicFeatureFlag: (\n name: string,\n value: boolean,\n) => void = () => {}\n\n// --- the refusals --------------------------------------------------------\n//\n// Exactly the exports whose non-native implementation upstream ships as a\n// `throw`. Enumerated by hand rather than produced by a Proxy over the module,\n// because ESM named imports resolve statically: a symbol missing from the\n// module fails at BUILD time with \"no export named X\", and only the names\n// here can produce the descriptive runtime message.\n\nconst unsupported = createUnsupportedFactory(\n \"react-native-worklets\",\n \"Implemented here: runOnUI/scheduleOnUI/runOnJS/scheduleOnRN/runOnUIAsync, isWorkletFunction, \" +\n \"the serializer (identity — nothing leaves this runtime) and the runtime-kind checks. \" +\n \"What is not is a SECOND runtime: this platform has one thread, GTK's main loop, \" +\n \"and upstream's own non-native build throws for these too. See docs/api.md.\",\n)\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\n// --- a second runtime, which is structural by definition ---\nexport const createWorkletRuntime: any = unsupported(\"createWorkletRuntime\")\nexport const runOnRuntime: any = unsupported(\"runOnRuntime\")\nexport const runOnRuntimeAsync: any = unsupported(\"runOnRuntimeAsync\")\nexport const runOnRuntimeAsyncWithId: any = unsupported(\n \"runOnRuntimeAsyncWithId\",\n)\nexport const runOnRuntimeSync: any = unsupported(\"runOnRuntimeSync\")\nexport const runOnRuntimeSyncWithId: any = unsupported(\"runOnRuntimeSyncWithId\")\nexport const scheduleOnRuntime: any = unsupported(\"scheduleOnRuntime\")\nexport const scheduleOnRuntimeWithId: any = unsupported(\n \"scheduleOnRuntimeWithId\",\n)\nexport const getUIRuntimeHolder: any = unsupported(\"getUIRuntimeHolder\")\nexport const getUISchedulerHolder: any = unsupported(\"getUISchedulerHolder\")\n\n// --- synchronous hops across a boundary that is not there ---\n// Both are the \"run it over there and give me the answer now\" pair, and both\n// throw upstream on every single-runtime build. Deferring instead would be\n// worse than refusing: the caller wants the RETURN VALUE, and a deferred call\n// has none.\nexport const runOnUISync: any = unsupported(\"runOnUISync\")\nexport const executeOnUIRuntimeSync: any = unsupported(\"executeOnUIRuntimeSync\")\n\n// --- memory shared between runtimes ---\nexport const createShareable: any = unsupported(\"createShareable\")\nexport const createSynchronizable: any = unsupported(\"createSynchronizable\")\n\n/**\n * The TurboModule behind the whole package. Upstream's non-native build\n * exports it as `null`, which fails as \"cannot read properties of null\" and\n * names nothing; this refuses by name instead. The one deliberate deviation\n * from the mirror rule above, and it can only ever turn a worse error into a\n * better one — nothing that works against `null` works against a refusal.\n */\nexport const WorkletsModule: any = unsupported(\"WorkletsModule\")\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-gtkx",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0-alpha.1",
|
|
4
4
|
"description": "React Native components and APIs for Linux desktop, rendered as native GTK4 widgets via gtkx",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Anton Petrov <anton@itsmepetrov.com>",
|
|
@@ -63,6 +63,22 @@
|
|
|
63
63
|
"types": "./dist/common/index.d.ts",
|
|
64
64
|
"default": "./dist/common/index.js"
|
|
65
65
|
},
|
|
66
|
+
"./dnd": {
|
|
67
|
+
"types": "./dist/dnd/index.d.ts",
|
|
68
|
+
"default": "./dist/dnd/index.js"
|
|
69
|
+
},
|
|
70
|
+
"./gesture-handler": {
|
|
71
|
+
"types": "./dist/gesture-handler-compat/index.d.ts",
|
|
72
|
+
"default": "./dist/gesture-handler-compat/index.js"
|
|
73
|
+
},
|
|
74
|
+
"./reanimated": {
|
|
75
|
+
"types": "./dist/reanimated-compat/index.d.ts",
|
|
76
|
+
"default": "./dist/reanimated-compat/index.js"
|
|
77
|
+
},
|
|
78
|
+
"./worklets": {
|
|
79
|
+
"types": "./dist/worklets-compat/index.d.ts",
|
|
80
|
+
"default": "./dist/worklets-compat/index.js"
|
|
81
|
+
},
|
|
66
82
|
"./mcp": {
|
|
67
83
|
"types": "./dist/mcp/index.d.ts",
|
|
68
84
|
"default": "./dist/mcp/index.js"
|
|
@@ -110,14 +126,14 @@
|
|
|
110
126
|
}
|
|
111
127
|
},
|
|
112
128
|
"dependencies": {
|
|
113
|
-
"@gtkx/cli": "1.0.0-rc.
|
|
114
|
-
"@gtkx/codegen": "1.0.0-rc.
|
|
115
|
-
"@gtkx/config": "1.0.0-rc.
|
|
116
|
-
"@gtkx/css": "1.0.0-rc.
|
|
117
|
-
"@gtkx/react": "1.0.0-rc.
|
|
118
|
-
"@gtkx/runtime": "1.0.0-rc.
|
|
119
|
-
"@gtkx/testing": "1.0.0-rc.
|
|
120
|
-
"@gtkx/vitest": "1.0.0-rc.
|
|
129
|
+
"@gtkx/cli": "1.0.0-rc.4",
|
|
130
|
+
"@gtkx/codegen": "1.0.0-rc.4",
|
|
131
|
+
"@gtkx/config": "1.0.0-rc.4",
|
|
132
|
+
"@gtkx/css": "1.0.0-rc.4",
|
|
133
|
+
"@gtkx/react": "1.0.0-rc.4",
|
|
134
|
+
"@gtkx/runtime": "1.0.0-rc.4",
|
|
135
|
+
"@gtkx/testing": "1.0.0-rc.4",
|
|
136
|
+
"@gtkx/vitest": "1.0.0-rc.4",
|
|
121
137
|
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
122
138
|
"rolldown": "^1.1.5",
|
|
123
139
|
"yoga-layout": "^3.2.1",
|
package/types.d.ts
CHANGED
|
@@ -48,8 +48,17 @@ declare module "react-native" {
|
|
|
48
48
|
// OPTIONAL on purpose: an app sharing one component with ios/android
|
|
49
49
|
// gets `undefined` there, and the type should say so — write
|
|
50
50
|
// `hovered && styles.hovered`, which is correct on every platform.
|
|
51
|
+
//
|
|
52
|
+
// `focused` is here for the same reason and was missing: this platform
|
|
53
|
+
// reports it (GTK owns keyboard focus, and an activatable row draws
|
|
54
|
+
// Adwaita's focus ring from it — see docs/api.md), the stock type does
|
|
55
|
+
// not carry it, and an app that renders a focus ring in shared code had
|
|
56
|
+
// no way to name it. Found by moving `examples/tasks-nav`'s boxed list
|
|
57
|
+
// out of the platform package and into the app, where it stopped being
|
|
58
|
+
// typed by this package and started being typed by the stock types.
|
|
51
59
|
interface PressableStateCallbackType {
|
|
52
60
|
hovered?: boolean
|
|
61
|
+
focused?: boolean
|
|
53
62
|
}
|
|
54
63
|
}
|
|
55
64
|
|