react-native-gtkx 0.2.0-alpha.2 → 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 +5 -2
- 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/index.d.ts +2 -0
- package/dist/animated/index.js +5 -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/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/index.d.ts +0 -1
- package/dist/common/index.js +24 -1
- package/dist/common/index.js.map +1 -1
- package/dist/components/animated.d.ts +70 -6
- package/dist/components/animated.js +559 -46
- package/dist/components/animated.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/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 +7 -5
- package/dist/components/index.js +5 -3
- package/dist/components/index.js.map +1 -1
- package/dist/components/measure.d.ts +51 -1
- package/dist/components/measure.js +101 -2
- package/dist/components/measure.js.map +1 -1
- package/dist/components/pressable.d.ts +61 -1
- package/dist/components/pressable.js +151 -4
- 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 +39 -3
- package/dist/components/scroll-view.js +378 -43
- 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 +43 -8
- 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 +188 -5
- package/dist/components/use-layout-child.js.map +1 -1
- package/dist/components/view.d.ts +5 -2
- package/dist/components/view.js +18 -13
- 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 +4 -0
- 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 +2 -1
- package/dist/gtk/index.js +7 -1
- package/dist/gtk/index.js.map +1 -1
- package/dist/gtkx/bridge/geometry.js +6 -4
- package/dist/gtkx/bridge/geometry.js.map +1 -1
- package/dist/gtkx/bridge/index.d.ts +5 -3
- package/dist/gtkx/bridge/index.js +6 -3
- package/dist/gtkx/bridge/index.js.map +1 -1
- package/dist/gtkx/bridge/slot-portal.js.map +1 -1
- package/dist/gtkx/bridge/use-signal.js +1 -1
- 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 +257 -60
- package/dist/mcp/data/generated.js +306 -62
- package/dist/mcp/data/generated.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 +16 -0
- package/dist/navigation/sidebar.js +65 -1
- 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 +80 -7
- package/dist/responder/system.js +143 -23
- package/dist/responder/system.js.map +1 -1
- package/dist/responder/use-responder.d.ts +11 -0
- package/dist/responder/use-responder.js +225 -6
- package/dist/responder/use-responder.js.map +1 -1
- package/dist/runner/host-dev.js +1 -1
- package/dist/runner/host-dev.js.map +1 -1
- package/dist/runner/host.js +1 -1
- 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 +1 -1
- 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/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 +2 -1
- package/dist/style/index.js +2 -1
- package/dist/style/index.js.map +1 -1
- package/dist/style/split-style.js +5 -0
- package/dist/style/split-style.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/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
- package/dist/common/list.d.ts +0 -82
- package/dist/common/list.js +0 -166
- package/dist/common/list.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-responder.js","sourceRoot":"","sources":["../../src/responder/use-responder.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,8CAA8C;AAC9C,EAAE;AACF,uEAAuE;AACvE,2EAA2E;AAC3E,4EAA4E;AAC5E,6DAA6D;AAC7D,4EAA4E;AAC5E,2EAA2E;AAC3E,gEAAgE;AAChE,2EAA2E;AAC3E,qDAAqD;AACrD,EAAE;AACF,uEAAuE;AACvE,0EAA0E;AAC1E,4EAA4E;AAC5E,4DAA4D;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,EAAkB,MAAM,OAAO,CAAA;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AACvD,OAAO,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAC1C,OAAO,EAAE,qBAAqB,EAAsB,MAAM,UAAU,CAAA;AACpE,OAAO,EAAE,iBAAiB,EAAuB,MAAM,SAAS,CAAA;AAEhE,4EAA4E;AAC5E,8BAA8B;AAC9B,MAAM,QAAQ,GAAG,IAAI,OAAO,EAA8B,CAAA;AAE1D;;;;;GAKG;AACH,MAAM,eAAe,GAAG,qBAAqB,CAAC;IAC5C,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE,CAAE,IAAmB,CAAC,SAAS,EAAE;IACpD,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;QAChB,yEAAyE;QACzE,sEAAsE;QACtE,qDAAqD;QACrD,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,GAAG,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAA;IAC9D,CAAC;CACF,CAAC,CAAA;AAEF,+DAA+D;AAC/D,MAAM,CAAC,MAAM,mBAAmB,GA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,EAAE,CAAC,OAAe,EAAE,OAAe,EAAE,EAAE;YAC1D,eAAe,CAAC,SAAS,CACvB,MAAM,EACN,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,CACxD,CAAA;QACH,CAAC,CAAC,CAAA;QACF,IAAI,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,OAAe,EAAE,OAAe,EAAE,EAAE;YACvD,eAAe,CAAC,QAAQ,CACtB,MAAM,EACN,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,CACxD,CAAA;QACH,CAAC,CAAC,CAAA;QACF,sEAAsE;QACtE,sEAAsE;QACtE,2CAA2C;QAC3C,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;YACrB,eAAe,CAAC,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;QAC1E,CAAC,CAAC,CAAA;QAEF,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAA;QAE1B,OAAO,GAAG,EAAE;YACV,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAA;YAC7B,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;YACvB,UAAU,EAAE,CAAA;QACd,CAAC,CAAA;QACD,uDAAuD;IACzD,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAA;AACd,CAAC,CAAA","sourcesContent":["// The platform half of the responder system: GTK carries the events, the\n// pure module in ./system owns the algorithm.\n//\n// Shape and why (docs/research/gestures.md, \"Verifiability decides the\n// implementation shape\"): the architecturally cleanest source would be one\n// GtkEventControllerLegacy on the toplevel doing its own hit-testing, which\n// is react-native-web's design. It is also untestable here —\n// @gtkx/testing's userEvent emits GtkGesture SIGNALS on the widget you name\n// and never produces a GdkEvent, so a raw tap could not be driven in CI at\n// all. A gesture per responder-declaring View is drivable today\n// (`userEvent.drag`), and GTK's own bubble chain still delivers a press to\n// every ancestor's gesture, so the path is not lost.\n//\n// One GtkGestureDrag per View covers press, move and release: it emits\n// drag-begin on press with no threshold of its own, which is exactly what\n// RN wants — the responder system has no threshold either, and PanResponder\n// users apply their own inside onMoveShouldSetPanResponder.\nimport { useLayoutEffect, useRef, type RefObject } from \"react\"\nimport { createTouch } from \"../components/press-event\"\nimport { Gtk } from \"../gtkx/bridge/index\"\nimport { createResponderSystem, type ResponderHost } from \"./system\"\nimport { hasResponderProps, type ResponderProps } from \"./types\"\n\n// The gesture that reported each registered widget, so a grant can make the\n// GTK claim on the right one.\nconst gestures = new WeakMap<ResponderHost, Gtk.Gesture>()\n\n/**\n * One lock for the process, as in RN. What is island-scoped is the\n * negotiation PATH, not the lock: `parentOf` walks the GTK widget tree and\n * simply finds nothing registered above a layout Root, so an RN island\n * inside a native widget tree negotiates among its own views and no others.\n */\nconst responderSystem = createResponderSystem({\n parentOf: (host) => (host as Gtk.Widget).getParent(),\n onGrant: (host) => {\n // GTK's only arbitration primitive, used the only way it can honestly be\n // used: a final one-way declaration AFTER JS has decided. There is no\n // un-claim, so nothing may depend on taking it back.\n gestures.get(host)?.setState(Gtk.EventSequenceState.CLAIMED)\n },\n})\n\n/** Exposed for tests and for future ScrollView arbitration. */\nexport const getCurrentResponder = (): ResponderHost | null =>\n responderSystem.getResponder()\n\n/**\n * Attaches the responder event source to a component's widget, but only when\n * it actually declares responder props — RN never asks a view without\n * handlers, so a controller on every View would be pure cost.\n */\nexport const useResponder = (\n widgetRef: RefObject<Gtk.Widget | null>,\n props: ResponderProps,\n): void => {\n // Handlers are read through a ref so a re-render never detaches and\n // re-adds the gesture mid-drag (the same reasoning as Pressable's). The\n // ref is refreshed in an effect rather than during render: a render-phase\n // write is not safe under concurrent rendering, and this effect is\n // declared BEFORE the registration effect so the handlers are already\n // current the first time the gesture can fire.\n const propsRef = useRef(props)\n useLayoutEffect(() => {\n propsRef.current = props\n })\n const active = hasResponderProps(props)\n\n useLayoutEffect(() => {\n const widget = widgetRef.current\n if (!widget || !active) {\n return\n }\n\n const unregister = responderSystem.register(widget, () => propsRef.current)\n\n const drag = new Gtk.GestureDrag()\n gestures.set(widget, drag)\n\n // drag-update/end report offsets FROM the start point, not absolute\n // coordinates — the start has to be carried.\n let startX = 0\n let startY = 0\n\n drag.on(\"drag-begin\", (x: number, y: number) => {\n startX = x\n startY = y\n responderSystem.touchStart(widget, createTouch(widget, x, y))\n })\n drag.on(\"drag-update\", (offsetX: number, offsetY: number) => {\n responderSystem.touchMove(\n widget,\n createTouch(widget, startX + offsetX, startY + offsetY),\n )\n })\n drag.on(\"drag-end\", (offsetX: number, offsetY: number) => {\n responderSystem.touchEnd(\n widget,\n createTouch(widget, startX + offsetX, startY + offsetY),\n )\n })\n // GTK cancels a sequence when something upstream claims it — a native\n // ancestor scrolling, say. RN calls that a termination, and it is the\n // one termination trigger we get for free.\n drag.on(\"cancel\", () => {\n responderSystem.touchCancel(widget, createTouch(widget, startX, startY))\n })\n\n widget.addController(drag)\n\n return () => {\n widget.removeController(drag)\n gestures.delete(widget)\n unregister()\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [active])\n}\n"]}
|
|
1
|
+
{"version":3,"file":"use-responder.js","sourceRoot":"","sources":["../../src/responder/use-responder.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,8CAA8C;AAC9C,EAAE;AACF,uEAAuE;AACvE,2EAA2E;AAC3E,4EAA4E;AAC5E,6DAA6D;AAC7D,4EAA4E;AAC5E,2EAA2E;AAC3E,gEAAgE;AAChE,2EAA2E;AAC3E,qDAAqD;AACrD,EAAE;AACF,uEAAuE;AACvE,0EAA0E;AAC1E,4EAA4E;AAC5E,4DAA4D;AAC5D,EAAE;AACF,0EAA0E;AAC1E,4EAA4E;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,EAAkB,MAAM,OAAO,CAAA;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,C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AE,MAAM,GAAG,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,CACxD,CAAA;QACH,CAAC,CAAC,CAAA;QACF,IAAI,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,OAAe,EAAE,OAAe,EAAE,EAAE;YACvD,MAAM,KAAK,GAAG,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,CAAA;YACrE,iEAAiE;YACjE,kEAAkE;YAClE,gDAAgD;YAChD,IAAI,MAAM,EAAE,CAAC;gBACX,eAAe,CAAC,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;YAC5C,CAAC;iBAAM,CAAC;gBACN,eAAe,CAAC,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;YACzC,CAAC;YACD,cAAc,EAAE,CAAA;QAClB,CAAC,CAAC,CAAA;QACF,wEAAwE;QACxE,yEAAyE;QACzE,yEAAyE;QACzE,wEAAwE;QACxE,iEAAiE;QACjE,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;YACrB,eAAe,CAAC,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;YACxE,cAAc,EAAE,CAAA;QAClB,CAAC,CAAC,CAAA;QAEF,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAA;QAE1B,OAAO,GAAG,EAAE;YACV,cAAc,EAAE,CAAA;YAChB,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAA;YAC7B,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;YACvB,UAAU,EAAE,CAAA;QACd,CAAC,CAAA;QACD,uDAAuD;IACzD,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAA;AACd,CAAC,CAAA","sourcesContent":["// The platform half of the responder system: GTK carries the events, the\n// pure module in ./system owns the algorithm.\n//\n// Shape and why (docs/research/gestures.md, \"Verifiability decides the\n// implementation shape\"): the architecturally cleanest source would be one\n// GtkEventControllerLegacy on the toplevel doing its own hit-testing, which\n// is react-native-web's design. It is also untestable here —\n// @gtkx/testing's userEvent emits GtkGesture SIGNALS on the widget you name\n// and never produces a GdkEvent, so a raw tap could not be driven in CI at\n// all. A gesture per responder-declaring View is drivable today\n// (`userEvent.drag`), and GTK's own bubble chain still delivers a press to\n// every ancestor's gesture, so the path is not lost.\n//\n// One GtkGestureDrag per View covers press, move and release: it emits\n// drag-begin on press with no threshold of its own, which is exactly what\n// RN wants — the responder system has no threshold either, and PanResponder\n// users apply their own inside onMoveShouldSetPanResponder.\n//\n// The terminations that are not pointer events (watchTerminations, below)\n// were expected to need that raw tap after all. Measurement said otherwise.\nimport { useLayoutEffect, useRef, type RefObject } from \"react\"\nimport { createTouch } from \"../components/press-event\"\nimport { Gtk } from \"../gtkx/bridge/index\"\nimport { createResponderSystem, type ResponderHost } from \"./system\"\nimport { hasResponderProps, type ResponderProps } from \"./types\"\n\n// The gesture that reported each registered widget, so a grant can make the\n// GTK claim on the right one.\nconst gestures = new WeakMap<ResponderHost, Gtk.Gesture>()\n\n/** Whether `widget` is `ancestor` or sits underneath it. */\nconst contains = (ancestor: Gtk.Widget, widget: object): boolean => {\n for (\n let current = widget as Gtk.Widget | null;\n current !== null;\n current = current.getParent()\n ) {\n if (current === ancestor) {\n return true\n }\n }\n return false\n}\n\n/**\n * Every `GtkScrolledWindow` above `source`, innermost first. Nested\n * scrollers are rare but real, and stopping only the innermost would let an\n * outer one take the drag instead.\n */\nconst enclosingScrollers = (source: Gtk.Widget): Gtk.ScrolledWindow[] => {\n const found: Gtk.ScrolledWindow[] = []\n for (\n let widget = source.getParent();\n widget !== null;\n widget = widget.getParent()\n ) {\n if (widget instanceof Gtk.ScrolledWindow) {\n found.push(widget)\n }\n }\n return found\n}\n\n/**\n * `setIsJSResponder`, which is what every RN platform calls the message\n * \"JavaScript has taken this interaction, native scroller stop stealing the\n * drag\". iOS cancels the `UIScrollView` pan when the responder is a\n * descendant; Android has a `JSResponderHandler`; react-native-windows\n * punted on it in 2017, shipped a `manipulationModes` prop instead, and its\n * tracking issues are still open.\n *\n * On GTK the message is `kinetic-scrolling`. Measured on GTK 4 rather than\n * inferred (tests/gtk/components/scroll-arbitration.gtk.test.tsx):\n * `GtkScrolledWindow` installs exactly four gestures of its own —\n * `GestureLongPress`, `GestureSwipe`, `GesturePan`, `GestureDrag`, all\n * touch-only, all in the CAPTURE phase — and turning kinetic scrolling off\n * puts those four, and only those four, into `GTK_PHASE_NONE`. Setting a\n * controller's phase to NONE resets it, so a scroll that had already begun\n * stops there; the wheel and the motion controllers are untouched, so\n * scrolling with a mouse keeps working while a child pans.\n *\n * Why this is needed at all when the `CLAIMED` declaration above already\n * denies ancestor gestures: it is a race, and only sometimes ours.\n * `GtkScrolledWindow` does not claim on press — it claims in `drag-update`,\n * once movement passes `gtk-dnd-drag-threshold` (8 px). A view that claims\n * on press beats it. A view that claims on a MOVE — which is what\n * `onMoveShouldSetPanResponder` does, and it is the commonest shape there\n * is — usually does not, and `CLAIMED` cannot be taken back once the\n * scroller has it. So the claim is not enough on its own, and this is the\n * part that makes a child pan reachable inside a scrolling list.\n *\n * Restores the previous value rather than assuming `true`: an app that\n * turned kinetic scrolling off itself must not have it turned back on.\n */\nconst suspendEnclosingScrollers = (source: Gtk.Widget): (() => void) => {\n const suspended = enclosingScrollers(source).filter((scroller) =>\n scroller.getKineticScrolling(),\n )\n for (const scroller of suspended) {\n scroller.setKineticScrolling(false)\n }\n return () => {\n for (const scroller of suspended) {\n scroller.setKineticScrolling(true)\n }\n }\n}\n\n/**\n * The scroller suspension for the interaction currently under way. Module\n * scope because it is set when the responder is granted and undone when the\n * interaction ends, which are two different events on two different\n * objects; there is only ever one interaction, which is the same assumption\n * the responder system itself is built on (one pointer, one session).\n */\nlet restoreScrollers: (() => void) | null = null\n\n/**\n * One lock for the process, as in RN. What is island-scoped is the\n * negotiation PATH, not the lock: `parentOf` walks the GTK widget tree and\n * simply finds nothing registered above a layout Root, so an RN island\n * inside a native widget tree negotiates among its own views and no others.\n */\nconst responderSystem = createResponderSystem({\n parentOf: (host) => (host as Gtk.Widget).getParent(),\n onClaim: (source) => {\n // GTK's only arbitration primitive, used the only way it can honestly be\n // used: a final one-way declaration AFTER JS has decided. There is no\n // un-claim, so nothing may depend on taking it back.\n //\n // On the SOURCE's gesture — the one the interaction is arriving through\n // — never on the granted view's. Claiming denies the sequence on every\n // gesture above the claimer and cancels it on everything below, so\n // claiming on an ancestor kills the source and the drag goes silent\n // after the grant. Slice 2 did exactly that, and the common\n // onMoveShouldSetPanResponder shape never received a single move.\n gestures.get(source)?.setState(Gtk.EventSequenceState.CLAIMED)\n // A ResponderHost is deliberately opaque to the pure module; on this\n // platform it is always the Gtk.Widget that registered it.\n restoreScrollers = suspendEnclosingScrollers(source as Gtk.Widget)\n },\n})\n\n/**\n * Everything that ends a gesture without being a pointer event, connected\n * for the length of one interaction and torn down with it.\n *\n * The plan for this task called for a single `GtkEventControllerLegacy` on\n * the toplevel in the capture phase — react-native-web's shape, on the\n * reasoning that a raw event tap is the only way to see terminations that\n * are not pointer events. Measured against GTK, it buys nothing here. Each\n * of the two triggers that survive has a first-class signal that says\n * exactly what we need to know and nothing else, and the rest of RNW's list\n * turned out to arrive as an ordinary gesture `::cancel` (see\n * `TerminationReason`). A legacy controller would have re-derived all of it\n * from a stream of raw events, and its one advantage — hearing events on a\n * sequence GTK has already denied us — matters only for triggers that no\n * longer exist.\n */\nconst watchTerminations = (source: Gtk.Widget): (() => void) => {\n const disposers: (() => void)[] = []\n\n // Window blur. GTK's `is-active` on the toplevel is the same thing the DOM\n // reports as a window `blur` — the window stopped being the active one,\n // which on a desktop usually means the user alt-tabbed mid-drag.\n const root = source.getRoot()\n if (root instanceof Gtk.Window) {\n const onActive = (): void => {\n if (!root.isActive()) {\n responderSystem.terminate(\"blur\")\n }\n }\n root.on(\"notify::is-active\", onActive)\n disposers.push(() => {\n root.off(\"notify::is-active\", onActive)\n })\n }\n\n // An ancestor scrolling. RNW's rule exactly: the scroller has to CONTAIN\n // the responder and not BE it — a ScrollView that holds the responder\n // itself keeps it, and a sibling list scrolling is none of our business.\n // Watching the adjustments rather than a scroll controller is what makes\n // that precise: it fires for a wheel, for a keyboard scroll and for\n // kinetic deceleration alike, and only for this scroller.\n for (const scroller of enclosingScrollers(source)) {\n const onScrolled = (): void => {\n const holder = responderSystem.getResponder()\n if (\n holder !== null &&\n holder !== scroller &&\n contains(scroller, holder)\n ) {\n responderSystem.terminate(\"scroll\")\n }\n }\n for (const adjustment of [\n scroller.getHadjustment(),\n scroller.getVadjustment(),\n ]) {\n adjustment.on(\"value-changed\", onScrolled)\n disposers.push(() => {\n adjustment.off(\"value-changed\", onScrolled)\n })\n }\n }\n\n return () => {\n for (const dispose of disposers) {\n dispose()\n }\n }\n}\n\n/** Exposed for tests and for future ScrollView arbitration. */\nexport const getCurrentResponder = (): ResponderHost | null =>\n responderSystem.getResponder()\n\n/**\n * The out-of-event grant channel, for a recognizer whose mind was changed by\n * a timer rather than by a pointer (`activateAfterLongPress`). See\n * `ResponderSystem.requestResponder` for what it does and\n * docs/research/gestures.md for why the model is extended at all.\n *\n * @internal Not part of the RN surface: an app writes responder props, and\n * nothing in RN asks for the responder from outside an event. This exists for\n * `GestureDetector`, whose recognizers do.\n */\nexport const requestResponder = (widget: Gtk.Widget): boolean =>\n responderSystem.requestResponder(widget)\n\n/**\n * Attaches the responder event source to a component's widget, but only when\n * it actually declares responder props — RN never asks a view without\n * handlers, so a controller on every View would be pure cost.\n */\nexport const useResponder = (\n widgetRef: RefObject<Gtk.Widget | null>,\n props: ResponderProps,\n): void => {\n // Handlers are read through a ref so a re-render never detaches and\n // re-adds the gesture mid-drag (the same reasoning as Pressable's). The\n // ref is refreshed in an effect rather than during render: a render-phase\n // write is not safe under concurrent rendering, and this effect is\n // declared BEFORE the registration effect so the handlers are already\n // current the first time the gesture can fire.\n const propsRef = useRef(props)\n useLayoutEffect(() => {\n propsRef.current = props\n })\n const active = hasResponderProps(props)\n\n useLayoutEffect(() => {\n const widget = widgetRef.current\n if (!widget || !active) {\n return\n }\n\n const unregister = responderSystem.register(widget, () => propsRef.current)\n\n const drag = new Gtk.GestureDrag()\n gestures.set(widget, drag)\n\n // drag-update/end report offsets FROM the start point, not absolute\n // coordinates — the start has to be carried.\n let startX = 0\n let startY = 0\n let stopWatching: (() => void) | null = null\n // Whether this sequence was taken from us by something above. See the\n // `sequence-state-changed` handler below.\n let denied = false\n\n const endInteraction = (): void => {\n stopWatching?.()\n stopWatching = null\n restoreScrollers?.()\n restoreScrollers = null\n }\n\n // THE ONE SIGNAL THAT TELLS A THEFT FROM AN ENDING.\n //\n // GTK's claim propagation is asymmetric, and measuring it on 4.22.4\n // corrected `docs/research/gestures.md`, which had it backwards. A claim\n // by a DESCENDANT cancels the ancestor's gesture — `::cancel` then\n // `::end`, and no state transition at all, which the `cancel` handler\n // below already turns into a termination. A claim by an ANCESTOR is the\n // dangerous direction: it DENIES the descendant's sequence and then ends\n // it with an ordinary `drag-end`, exactly the signal a finger lifting\n // produces. Without this handler a native ancestor stealing the drag\n // mid-gesture reaches JS as `onResponderRelease` — a CLEAN RELEASE,\n // indistinguishable from the user letting go, so a drag would commit\n // itself at whatever position the theft happened at.\n //\n // `->DENIED` is the only thing that separates the two, which is why the\n // sequence state has to be watched rather than just the drag signals.\n // Nothing else here can produce it: this module never sets DENIED, and\n // our own CLAIMED is always made on the source, which cancels ancestors\n // rather than denying them.\n drag.on(\n \"sequence-state-changed\",\n (_sequence: unknown, state: Gtk.EventSequenceState) => {\n if (state === Gtk.EventSequenceState.DENIED) {\n denied = true\n }\n },\n )\n\n drag.on(\"drag-begin\", (x: number, y: number) => {\n startX = x\n startY = y\n // A `GtkGestureSingle` denies its own sequence when a press arrives on\n // the wrong button and nothing is down yet, so the flag can survive from\n // before this press. Every interaction starts clean.\n denied = false\n responderSystem.touchStart(widget, createTouch(widget, x, y))\n // Every ancestor's gesture reports the same press; only the one that\n // opened the interaction owns it, and asking the system afterwards is\n // the cheapest way to find out which that was.\n if (responderSystem.getSource() === widget) {\n stopWatching = watchTerminations(widget)\n }\n })\n drag.on(\"drag-update\", (offsetX: number, offsetY: number) => {\n responderSystem.touchMove(\n widget,\n createTouch(widget, startX + offsetX, startY + offsetY),\n )\n })\n drag.on(\"drag-end\", (offsetX: number, offsetY: number) => {\n const touch = createTouch(widget, startX + offsetX, startY + offsetY)\n // A denied sequence ends with this same signal, and it is not an\n // ending: the interaction was taken away. RN's word for that is a\n // termination, so it goes down the cancel path.\n if (denied) {\n responderSystem.touchCancel(widget, touch)\n } else {\n responderSystem.touchEnd(widget, touch)\n }\n endInteraction()\n })\n // GTK cancels a sequence when something takes it away from us: a native\n // ancestor claiming it, a `GtkDragSource` attached through `Controllers`\n // reaching its threshold, a second mouse button going down for a context\n // menu. RN calls all of that a termination, and unlike RNW we never get\n // to ask first — by the time GTK tells us, the sequence is gone.\n drag.on(\"cancel\", () => {\n responderSystem.touchCancel(widget, createTouch(widget, startX, startY))\n endInteraction()\n })\n\n widget.addController(drag)\n\n return () => {\n endInteraction()\n widget.removeController(drag)\n gestures.delete(widget)\n unregister()\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [active])\n}\n"]}
|
package/dist/runner/host-dev.js
CHANGED
|
@@ -66,7 +66,7 @@ if (gtkxConfig.elements !== null) {
|
|
|
66
66
|
}
|
|
67
67
|
const configModuleUrl = new URL("./__virtual-gtkx-config.mjs", import.meta.url)
|
|
68
68
|
.href;
|
|
69
|
-
const lazyElements = Object.fromEntries(gtkxConfig.lazyElements.map((type) => [type, {
|
|
69
|
+
const lazyElements = Object.fromEntries(gtkxConfig.lazyElements.map((type) => [type, { isLazy: true }]));
|
|
70
70
|
const configModuleSource = [
|
|
71
71
|
`export * from "@gtkx/jsx/metadata";`,
|
|
72
72
|
`export const applicationId = ${JSON.stringify(gtkxConfig.applicationId)};`,
|
|
@@ -1 +1 @@
|
|
|
1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AO,EAAE,IAAI,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,MAAM,CAAC,CAC9D,CAAA;AACD,MAAM,CAAC,IAAI,CACT,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,sBAAsB,EAAE,WAAW,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,CAC3E,CAAA;AACD,MAAM,CAAC,MAAM,EAAE,CAAA;AACf,MAAM,CAAC,EAAE,CAAC,aAAa,EAAE,GAAG,EAAE;IAC5B,OAAO,CAAC,IAAI,CAAC,wCAAwC,CAAC,CAAA;AACxD,CAAC,CAAC,CAAA;AACF,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;IAC1B,OAAO,CAAC,KAAK,CACX,oCAAoC,IAAI,EAAE,IAAI,IAAI,SAAS,OAAO,IAAI,EAAE,OAAO,IAAI,EAAE,EAAE,CACxF,CAAA;AACH,CAAC,CAAC,CAAA;AACF,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;IACtB,OAAO,CAAC,IAAI,CACV,0FAA0F,CAC3F,CAAA;AACH,CAAC,CAAC,CAAA","sourcesContent":["// The DEV host: fetch the dev bundle from a Metro dev server, execute it,\n// subscribe to HMR updates and let react-refresh re-render through the\n// @gtkx/react reconciler with component state preserved. Spawned by\n// `run-linux --dev` as `node dist/runner/host-dev.js <bundle-url>`; exits\n// with code 65 when a full refresh is required — the supervisor restarts.\n//\n// Division of labor (validated by spike/rn-platform, FINDINGS-dev.md):\n// metro-runtime's dev require scopes the react-refresh registration per\n// module and applies hot updates once global.__ReactRefresh exists; its\n// HMRClient speaks the /hot websocket protocol verbatim over Node's\n// global WebSocket. This file only adds the dev pieces on top of the\n// release host (./host.ts — deliberately self-contained twins: both must\n// stay runnable under bare Node, so they cannot share a relative\n// extensionless import).\nimport { createRequire, registerHooks } from \"node:module\"\nimport { join } from \"node:path\"\nimport { pathToFileURL } from \"node:url\"\nimport vm from \"node:vm\"\nimport { HOST_MODULE_EXTERNALS } from \"react-native-gtkx/metro\"\n\ntype HostModule = Record<string, unknown>\n\nconst fail = (message: string): never => {\n console.error(`[react-native-gtkx] ${message}`)\n process.exit(1)\n}\n\nif (typeof registerHooks !== \"function\") {\n fail(\n `Node ${process.version} lacks module.registerHooks — the linux host needs Node >= 24.`,\n )\n}\n\n// react and the reconciler must run their DEV builds for react-refresh.\nprocess.env.NODE_ENV = process.env.NODE_ENV ?? \"development\"\n\nconst bundleUrl = process.argv[2]\nif (!bundleUrl) {\n fail(\"usage: node host-dev.js <metro-dev-bundle-url>\")\n}\n\n// Resolution anchors: react-refresh and metro-runtime ship with the APP's\n// react-native; @gtkx/* resolve as this package's dependencies; react must\n// be the exact instance the reconciler sees (see host.ts).\nconst fromApp = createRequire(join(process.cwd(), \"package.json\"))\nconst fromPackage = createRequire(import.meta.url)\nconst fromGtkxReact = createRequire(fromPackage.resolve(\"@gtkx/react\"))\n\n// --- react-refresh: inject BEFORE @gtkx/react loads (the reconciler\n// registers into the patched devtools hook).\nconst RefreshRuntime = fromApp(\"react-refresh/runtime\") as Record<\n string,\n unknown\n> & { injectIntoGlobalHook(target: unknown): void }\nRefreshRuntime.injectIntoGlobalHook(globalThis)\nglobalThis.$RefreshReg$ = () => {}\nglobalThis.$RefreshSig$ = () => (type: unknown) => type\nglobalThis.__ReactRefresh = {\n ...RefreshRuntime,\n performFullRefresh(reason: string) {\n console.warn(\n `[react-native-gtkx] full refresh required (${reason}) — restarting`,\n )\n process.exit(65)\n },\n}\n\n// --- virtual:gtkx-config (same mechanism and same module shape as the\n// release host — see host.ts for why each export is needed).\nconst CONFIG_REQUIRED =\n \"gtkx.config.ts with an applicationId is required in the app root \" +\n '(export default defineConfig({ applicationId: \"...\", libraries: [...] })).'\nconst { createConfigLoader } = await import(\n pathToFileURL(fromPackage.resolve(\"@gtkx/config/internal\")).href\n)\nconst gtkxConfig = await createConfigLoader()\n .resolve(process.cwd())\n .catch((error: unknown) => fail(`${CONFIG_REQUIRED}\\n${String(error)}`))\nif (!gtkxConfig.applicationId) {\n fail(CONFIG_REQUIRED)\n}\nif (gtkxConfig.elements !== null) {\n fail(\n \"gtkx.config.ts `elements.behaviors` is not supported on the linux \" +\n \"platform — react-native-gtkx owns element behaviors.\",\n )\n}\nconst configModuleUrl = new URL(\"./__virtual-gtkx-config.mjs\", import.meta.url)\n .href\nconst lazyElements = Object.fromEntries(\n gtkxConfig.lazyElements.map((type: string) => [type, { lazy: true }]),\n)\nconst configModuleSource = [\n `export * from \"@gtkx/jsx/metadata\";`,\n `export const applicationId = ${JSON.stringify(gtkxConfig.applicationId)};`,\n `export const userEventSignals = ${JSON.stringify(gtkxConfig.userEventSignals)};`,\n `export const elements = ${JSON.stringify(lazyElements)};`,\n].join(\"\\n\")\nregisterHooks({\n resolve(specifier, context, nextResolve) {\n if (specifier === \"virtual:gtkx-config\") {\n return { url: configModuleUrl, shortCircuit: true }\n }\n return nextResolve(specifier, context)\n },\n load(url, context, nextLoad) {\n if (url === configModuleUrl) {\n return {\n format: \"module\",\n source: configModuleSource,\n shortCircuit: true,\n }\n }\n return nextLoad(url, context)\n },\n})\n\n// --- host modules (same interop merging as the release host).\nconst resolveExternal = (name: string): string =>\n name === \"react\" || name.startsWith(\"react/\")\n ? fromGtkxReact.resolve(name)\n : fromPackage.resolve(name)\n\nconst load = async (name: string): Promise<HostModule> => {\n const namespace: HostModule = await import(\n pathToFileURL(resolveExternal(name)).href\n )\n const merged: HostModule = { __esModule: true, ...namespace }\n if (!(\"default\" in namespace)) {\n merged.default = namespace\n }\n return merged\n}\n\nglobalThis.__hostModules = {}\nfor (const name of HOST_MODULE_EXTERNALS) {\n try {\n globalThis.__hostModules[name] = await load(name)\n } catch (error) {\n fail(\n `failed to load host module \"${name}\" — is the codegen store in ` +\n `place (npx gtkx codegen) and GTK4/libadwaita installed?\\n${String(error)}`,\n )\n }\n}\nglobalThis.__hostRequire = createRequire(import.meta.url)\n\n// --- Dev Menu (Ctrl+Shift+D, the react-native-windows precedent).\n// Installed before the bundle runs so DevSettings.reload works from app\n// code; the key controller attaches once the app window exists.\nconst requestReload = (reason?: string): never => {\n console.warn(\n `[react-native-gtkx] reload requested${reason ? ` (${reason})` : \"\"} — restarting`,\n )\n return process.exit(65)\n}\nglobalThis.__rnGtkxDevHost = { reload: requestReload }\n\n// Structural slices of the GTK wrappers the menu touches — the host talks\n// to codegen namespaces through __hostModules, untyped by design.\ntype DevMenuWindow = { addController(controller: unknown): void }\ntype DevMenuDialog = {\n setHeading(heading: string): void\n setBody(body: string): void\n addResponse(id: string, label: string): void\n setResponseAppearance(id: string, appearance: unknown): void\n setDefaultResponse(id: string): void\n setCloseResponse(id: string): void\n choose(parent: DevMenuWindow): Promise<string>\n}\n\nconst installDevMenu = (): void => {\n const gtk = globalThis.__hostModules[\"@gtkx/gi/gtk\"] as {\n EventControllerKey: new () => {\n on(signal: string, handler: (...args: unknown[]) => unknown): void\n }\n }\n const gdk = globalThis.__hostModules[\"@gtkx/gi/gdk\"] as {\n ModifierType: { CONTROL_MASK: number; SHIFT_MASK: number }\n }\n const adw = globalThis.__hostModules[\"@gtkx/gi/adw\"] as {\n AlertDialog: new () => DevMenuDialog\n ResponseAppearance: { SUGGESTED: unknown }\n }\n const gio = globalThis.__hostModules[\"@gtkx/gi/gio\"] as {\n Application: {\n getDefault():\n { getActiveWindow?: () => DevMenuWindow | null } | null | undefined\n }\n }\n // GDK keysyms for latin letters equal their ASCII codes.\n const KEY_UPPER_D = 0x44\n const KEY_LOWER_D = 0x64\n\n let menuOpen = false\n const openDevMenu = async (window: DevMenuWindow): Promise<void> => {\n if (menuOpen) {\n return\n }\n menuOpen = true\n try {\n const items = globalThis.__rnGtkxDevMenuItems ?? []\n const dialog = new adw.AlertDialog()\n dialog.setHeading(\"React Native Dev Menu\")\n dialog.setBody(bundleUrl!)\n dialog.addResponse(\"cancel\", \"Cancel\")\n items.forEach((item, index) => {\n dialog.addResponse(`custom-${index}`, item.title)\n })\n dialog.addResponse(\"reload\", \"Reload\")\n dialog.setResponseAppearance(\"reload\", adw.ResponseAppearance.SUGGESTED)\n dialog.setDefaultResponse(\"reload\")\n dialog.setCloseResponse(\"cancel\")\n const response = await dialog.choose(window)\n if (response === \"reload\") {\n requestReload()\n }\n const custom = /^custom-(\\d+)$/.exec(response)\n if (custom) {\n items[Number(custom[1])]?.handler()\n }\n } catch (error) {\n console.error(`[react-native-gtkx] dev menu failed: ${String(error)}`)\n } finally {\n menuOpen = false\n }\n }\n\n const attach = (): void => {\n const window = gio.Application.getDefault()?.getActiveWindow?.()\n if (!window) {\n // The bundle opens the window asynchronously (application activate).\n setTimeout(attach, 200)\n return\n }\n const controller = new gtk.EventControllerKey()\n controller.on(\"key-pressed\", (keyval, _keycode, state) => {\n const modifiers = state as number\n const wanted =\n (modifiers & gdk.ModifierType.CONTROL_MASK) !== 0 &&\n (modifiers & gdk.ModifierType.SHIFT_MASK) !== 0 &&\n (keyval === KEY_UPPER_D || keyval === KEY_LOWER_D)\n if (wanted) {\n void openDevMenu(window)\n return true\n }\n return false\n })\n window.addController(controller)\n console.warn(\"[react-native-gtkx] dev menu ready (Ctrl+Shift+D)\")\n }\n attach()\n}\n\n// --- fetch and run the dev bundle.\nlet response: Response\ntry {\n response = await fetch(bundleUrl!)\n} catch {\n fail(`Metro dev server is not reachable (${bundleUrl}).`)\n throw new Error(\"unreachable\")\n}\nif (!response.ok) {\n fail(\n `Metro returned ${response.status} for the dev bundle:\\n${await response.text()}`,\n )\n}\nvm.runInThisContext(await response.text(), { filename: bundleUrl })\ninstallDevMenu()\n\n// --- HMR: metro-runtime's own client (ships with react-native).\ntype HmrErrorBody = { type?: string; message?: string }\ntype HmrClient = {\n send(message: string): void\n enable(): void\n on(event: string, listener: (body?: HmrErrorBody) => void): void\n}\nconst HMRClient = fromApp(\"metro-runtime/src/modules/HMRClient\") as new (\n url: string,\n) => HmrClient\nconst client = new HMRClient(\n bundleUrl!.replace(/^http/, \"ws\").replace(/\\/[^/]*$/, \"/hot\"),\n)\nclient.send(\n JSON.stringify({ type: \"register-entrypoints\", entryPoints: [bundleUrl] }),\n)\nclient.enable()\nclient.on(\"update-done\", () => {\n console.warn(\"[react-native-gtkx] hot update applied\")\n})\nclient.on(\"error\", (body) => {\n console.error(\n `[react-native-gtkx] Metro error (${body?.type ?? \"unknown\"}):\\n${body?.message ?? \"\"}`,\n )\n})\nclient.on(\"close\", () => {\n console.warn(\n \"[react-native-gtkx] HMR connection closed (the window keeps running without hot updates)\",\n )\n})\n"]}
|
|
1
|
+
{"version":3,"file":"host-dev.js","sourceRoot":"","sources":["../../src/runner/host-dev.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,uEAAuE;AACvE,oEAAoE;AACpE,0EAA0E;AAC1E,0EAA0E;AAC1E,EAAE;AACF,uEAAuE;AACvE,wEAAwE;AACxE,wEAAwE;AACxE,oEAAoE;AACpE,qEAAqE;AACrE,yEAAyE;AACzE,iEAAiE;AACjE,yBAAyB;AACzB,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,EAAE,MAAM,SAAS,CAAA;AACxB,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAI/D,MAAM,IAAI,GAAG,CAAC,OAAe,EAAS,EAAE;IACtC,OAAO,CAAC,KAAK,CAAC,uBAAuB,OAAO,EAAE,CAAC,CAAA;IAC/C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,CAAC,CAAA;AAED,IAAI,OAAO,aAAa,KAAK,UAAU,EAAE,CAAC;IACxC,IAAI,CACF,QAAQ,OAAO,CAAC,OAAO,gEAAgE,CACxF,CAAA;AACH,CAAC;AAED,wEAAwE;AACxE,OAAO,CAAC,GAAG,CAAC,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,QA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yB,MAAM,QAAQ,CAAC,IAAI,EAAE,EAAE,CAClF,CAAA;AACH,CAAC;AACD,EAAE,CAAC,gBAAgB,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,CAAA;AACnE,cAAc,EAAE,CAAA;AAShB,MAAM,SAAS,GAAG,OAAO,CAAC,qCAAqC,CAEjD,CAAA;AACd,MAAM,MAAM,GAAG,IAAI,SAAS,CAC1B,SAAU,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,MAAM,CAAC,CAC9D,CAAA;AACD,MAAM,CAAC,IAAI,CACT,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,sBAAsB,EAAE,WAAW,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,CAC3E,CAAA;AACD,MAAM,CAAC,MAAM,EAAE,CAAA;AACf,MAAM,CAAC,EAAE,CAAC,aAAa,EAAE,GAAG,EAAE;IAC5B,OAAO,CAAC,IAAI,CAAC,wCAAwC,CAAC,CAAA;AACxD,CAAC,CAAC,CAAA;AACF,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;IAC1B,OAAO,CAAC,KAAK,CACX,oCAAoC,IAAI,EAAE,IAAI,IAAI,SAAS,OAAO,IAAI,EAAE,OAAO,IAAI,EAAE,EAAE,CACxF,CAAA;AACH,CAAC,CAAC,CAAA;AACF,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;IACtB,OAAO,CAAC,IAAI,CACV,0FAA0F,CAC3F,CAAA;AACH,CAAC,CAAC,CAAA","sourcesContent":["// The DEV host: fetch the dev bundle from a Metro dev server, execute it,\n// subscribe to HMR updates and let react-refresh re-render through the\n// @gtkx/react reconciler with component state preserved. Spawned by\n// `run-linux --dev` as `node dist/runner/host-dev.js <bundle-url>`; exits\n// with code 65 when a full refresh is required — the supervisor restarts.\n//\n// Division of labor (validated by spike/rn-platform, FINDINGS-dev.md):\n// metro-runtime's dev require scopes the react-refresh registration per\n// module and applies hot updates once global.__ReactRefresh exists; its\n// HMRClient speaks the /hot websocket protocol verbatim over Node's\n// global WebSocket. This file only adds the dev pieces on top of the\n// release host (./host.ts — deliberately self-contained twins: both must\n// stay runnable under bare Node, so they cannot share a relative\n// extensionless import).\nimport { createRequire, registerHooks } from \"node:module\"\nimport { join } from \"node:path\"\nimport { pathToFileURL } from \"node:url\"\nimport vm from \"node:vm\"\nimport { HOST_MODULE_EXTERNALS } from \"react-native-gtkx/metro\"\n\ntype HostModule = Record<string, unknown>\n\nconst fail = (message: string): never => {\n console.error(`[react-native-gtkx] ${message}`)\n process.exit(1)\n}\n\nif (typeof registerHooks !== \"function\") {\n fail(\n `Node ${process.version} lacks module.registerHooks — the linux host needs Node >= 24.`,\n )\n}\n\n// react and the reconciler must run their DEV builds for react-refresh.\nprocess.env.NODE_ENV = process.env.NODE_ENV ?? \"development\"\n\nconst bundleUrl = process.argv[2]\nif (!bundleUrl) {\n fail(\"usage: node host-dev.js <metro-dev-bundle-url>\")\n}\n\n// Resolution anchors: react-refresh and metro-runtime ship with the APP's\n// react-native; @gtkx/* resolve as this package's dependencies; react must\n// be the exact instance the reconciler sees (see host.ts).\nconst fromApp = createRequire(join(process.cwd(), \"package.json\"))\nconst fromPackage = createRequire(import.meta.url)\nconst fromGtkxReact = createRequire(fromPackage.resolve(\"@gtkx/react\"))\n\n// --- react-refresh: inject BEFORE @gtkx/react loads (the reconciler\n// registers into the patched devtools hook).\nconst RefreshRuntime = fromApp(\"react-refresh/runtime\") as Record<\n string,\n unknown\n> & { injectIntoGlobalHook(target: unknown): void }\nRefreshRuntime.injectIntoGlobalHook(globalThis)\nglobalThis.$RefreshReg$ = () => {}\nglobalThis.$RefreshSig$ = () => (type: unknown) => type\nglobalThis.__ReactRefresh = {\n ...RefreshRuntime,\n performFullRefresh(reason: string) {\n console.warn(\n `[react-native-gtkx] full refresh required (${reason}) — restarting`,\n )\n process.exit(65)\n },\n}\n\n// --- virtual:gtkx-config (same mechanism and same module shape as the\n// release host — see host.ts for why each export is needed).\nconst CONFIG_REQUIRED =\n \"gtkx.config.ts with an applicationId is required in the app root \" +\n '(export default defineConfig({ applicationId: \"...\", libraries: [...] })).'\nconst { createConfigLoader } = await import(\n pathToFileURL(fromPackage.resolve(\"@gtkx/config/internal\")).href\n)\nconst gtkxConfig = await createConfigLoader()\n .resolve(process.cwd())\n .catch((error: unknown) => fail(`${CONFIG_REQUIRED}\\n${String(error)}`))\nif (!gtkxConfig.applicationId) {\n fail(CONFIG_REQUIRED)\n}\nif (gtkxConfig.elements !== null) {\n fail(\n \"gtkx.config.ts `elements.behaviors` is not supported on the linux \" +\n \"platform — react-native-gtkx owns element behaviors.\",\n )\n}\nconst configModuleUrl = new URL(\"./__virtual-gtkx-config.mjs\", import.meta.url)\n .href\nconst lazyElements = Object.fromEntries(\n gtkxConfig.lazyElements.map((type: string) => [type, { isLazy: true }]),\n)\nconst configModuleSource = [\n `export * from \"@gtkx/jsx/metadata\";`,\n `export const applicationId = ${JSON.stringify(gtkxConfig.applicationId)};`,\n `export const userEventSignals = ${JSON.stringify(gtkxConfig.userEventSignals)};`,\n `export const elements = ${JSON.stringify(lazyElements)};`,\n].join(\"\\n\")\nregisterHooks({\n resolve(specifier, context, nextResolve) {\n if (specifier === \"virtual:gtkx-config\") {\n return { url: configModuleUrl, shortCircuit: true }\n }\n return nextResolve(specifier, context)\n },\n load(url, context, nextLoad) {\n if (url === configModuleUrl) {\n return {\n format: \"module\",\n source: configModuleSource,\n shortCircuit: true,\n }\n }\n return nextLoad(url, context)\n },\n})\n\n// --- host modules (same interop merging as the release host).\nconst resolveExternal = (name: string): string =>\n name === \"react\" || name.startsWith(\"react/\")\n ? fromGtkxReact.resolve(name)\n : fromPackage.resolve(name)\n\nconst load = async (name: string): Promise<HostModule> => {\n const namespace: HostModule = await import(\n pathToFileURL(resolveExternal(name)).href\n )\n const merged: HostModule = { __esModule: true, ...namespace }\n if (!(\"default\" in namespace)) {\n merged.default = namespace\n }\n return merged\n}\n\nglobalThis.__hostModules = {}\nfor (const name of HOST_MODULE_EXTERNALS) {\n try {\n globalThis.__hostModules[name] = await load(name)\n } catch (error) {\n fail(\n `failed to load host module \"${name}\" — is the codegen store in ` +\n `place (npx gtkx codegen) and GTK4/libadwaita installed?\\n${String(error)}`,\n )\n }\n}\nglobalThis.__hostRequire = createRequire(import.meta.url)\n\n// --- Dev Menu (Ctrl+Shift+D, the react-native-windows precedent).\n// Installed before the bundle runs so DevSettings.reload works from app\n// code; the key controller attaches once the app window exists.\nconst requestReload = (reason?: string): never => {\n console.warn(\n `[react-native-gtkx] reload requested${reason ? ` (${reason})` : \"\"} — restarting`,\n )\n return process.exit(65)\n}\nglobalThis.__rnGtkxDevHost = { reload: requestReload }\n\n// Structural slices of the GTK wrappers the menu touches — the host talks\n// to codegen namespaces through __hostModules, untyped by design.\ntype DevMenuWindow = { addController(controller: unknown): void }\ntype DevMenuDialog = {\n setHeading(heading: string): void\n setBody(body: string): void\n addResponse(id: string, label: string): void\n setResponseAppearance(id: string, appearance: unknown): void\n setDefaultResponse(id: string): void\n setCloseResponse(id: string): void\n choose(parent: DevMenuWindow): Promise<string>\n}\n\nconst installDevMenu = (): void => {\n const gtk = globalThis.__hostModules[\"@gtkx/gi/gtk\"] as {\n EventControllerKey: new () => {\n on(signal: string, handler: (...args: unknown[]) => unknown): void\n }\n }\n const gdk = globalThis.__hostModules[\"@gtkx/gi/gdk\"] as {\n ModifierType: { CONTROL_MASK: number; SHIFT_MASK: number }\n }\n const adw = globalThis.__hostModules[\"@gtkx/gi/adw\"] as {\n AlertDialog: new () => DevMenuDialog\n ResponseAppearance: { SUGGESTED: unknown }\n }\n const gio = globalThis.__hostModules[\"@gtkx/gi/gio\"] as {\n Application: {\n getDefault():\n { getActiveWindow?: () => DevMenuWindow | null } | null | undefined\n }\n }\n // GDK keysyms for latin letters equal their ASCII codes.\n const KEY_UPPER_D = 0x44\n const KEY_LOWER_D = 0x64\n\n let menuOpen = false\n const openDevMenu = async (window: DevMenuWindow): Promise<void> => {\n if (menuOpen) {\n return\n }\n menuOpen = true\n try {\n const items = globalThis.__rnGtkxDevMenuItems ?? []\n const dialog = new adw.AlertDialog()\n dialog.setHeading(\"React Native Dev Menu\")\n dialog.setBody(bundleUrl!)\n dialog.addResponse(\"cancel\", \"Cancel\")\n items.forEach((item, index) => {\n dialog.addResponse(`custom-${index}`, item.title)\n })\n dialog.addResponse(\"reload\", \"Reload\")\n dialog.setResponseAppearance(\"reload\", adw.ResponseAppearance.SUGGESTED)\n dialog.setDefaultResponse(\"reload\")\n dialog.setCloseResponse(\"cancel\")\n const response = await dialog.choose(window)\n if (response === \"reload\") {\n requestReload()\n }\n const custom = /^custom-(\\d+)$/.exec(response)\n if (custom) {\n items[Number(custom[1])]?.handler()\n }\n } catch (error) {\n console.error(`[react-native-gtkx] dev menu failed: ${String(error)}`)\n } finally {\n menuOpen = false\n }\n }\n\n const attach = (): void => {\n const window = gio.Application.getDefault()?.getActiveWindow?.()\n if (!window) {\n // The bundle opens the window asynchronously (application activate).\n setTimeout(attach, 200)\n return\n }\n const controller = new gtk.EventControllerKey()\n controller.on(\"key-pressed\", (keyval, _keycode, state) => {\n const modifiers = state as number\n const wanted =\n (modifiers & gdk.ModifierType.CONTROL_MASK) !== 0 &&\n (modifiers & gdk.ModifierType.SHIFT_MASK) !== 0 &&\n (keyval === KEY_UPPER_D || keyval === KEY_LOWER_D)\n if (wanted) {\n void openDevMenu(window)\n return true\n }\n return false\n })\n window.addController(controller)\n console.warn(\"[react-native-gtkx] dev menu ready (Ctrl+Shift+D)\")\n }\n attach()\n}\n\n// --- fetch and run the dev bundle.\nlet response: Response\ntry {\n response = await fetch(bundleUrl!)\n} catch {\n fail(`Metro dev server is not reachable (${bundleUrl}).`)\n throw new Error(\"unreachable\")\n}\nif (!response.ok) {\n fail(\n `Metro returned ${response.status} for the dev bundle:\\n${await response.text()}`,\n )\n}\nvm.runInThisContext(await response.text(), { filename: bundleUrl })\ninstallDevMenu()\n\n// --- HMR: metro-runtime's own client (ships with react-native).\ntype HmrErrorBody = { type?: string; message?: string }\ntype HmrClient = {\n send(message: string): void\n enable(): void\n on(event: string, listener: (body?: HmrErrorBody) => void): void\n}\nconst HMRClient = fromApp(\"metro-runtime/src/modules/HMRClient\") as new (\n url: string,\n) => HmrClient\nconst client = new HMRClient(\n bundleUrl!.replace(/^http/, \"ws\").replace(/\\/[^/]*$/, \"/hot\"),\n)\nclient.send(\n JSON.stringify({ type: \"register-entrypoints\", entryPoints: [bundleUrl] }),\n)\nclient.enable()\nclient.on(\"update-done\", () => {\n console.warn(\"[react-native-gtkx] hot update applied\")\n})\nclient.on(\"error\", (body) => {\n console.error(\n `[react-native-gtkx] Metro error (${body?.type ?? \"unknown\"}):\\n${body?.message ?? \"\"}`,\n )\n})\nclient.on(\"close\", () => {\n console.warn(\n \"[react-native-gtkx] HMR connection closed (the window keeps running without hot updates)\",\n )\n})\n"]}
|
package/dist/runner/host.js
CHANGED
|
@@ -65,7 +65,7 @@ if (gtkxConfig.elements !== null) {
|
|
|
65
65
|
}
|
|
66
66
|
const configModuleUrl = new URL("./__virtual-gtkx-config.mjs", import.meta.url)
|
|
67
67
|
.href;
|
|
68
|
-
const lazyElements = Object.fromEntries(gtkxConfig.lazyElements.map((type) => [type, {
|
|
68
|
+
const lazyElements = Object.fromEntries(gtkxConfig.lazyElements.map((type) => [type, { isLazy: true }]));
|
|
69
69
|
const configModuleSource = [
|
|
70
70
|
`export * from "@gtkx/jsx/metadata";`,
|
|
71
71
|
`export const applicationId = ${JSON.stringify(gtkxConfig.applicationId)};`,
|
package/dist/runner/host.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host.js","sourceRoot":"","sources":["../../src/runner/host.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,gDAAgD;AAChD,yEAAyE;AACzE,iDAAiD;A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AAM,IAAI,CAAC,IAAI,CAAC,CAAA;IACnD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,CACF,+BAA+B,IAAI,8BAA8B;YAC/D,4DAA4D,MAAM,CAAC,KAAK,CAAC,EAAE,CAC9E,CAAA;IACH,CAAC;AACH,CAAC;AACD,sEAAsE;AACtE,UAAU,CAAC,aAAa,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAEzD,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AAClC,IAAI,CAAC,UAAU,EAAE,CAAC;IAChB,IAAI,CAAC,6CAA6C,CAAC,CAAA;AACrD,CAAC;AACD,IAAI,MAAc,CAAA;AAClB,IAAI,CAAC;IACH,MAAM,GAAG,YAAY,CAAC,UAAW,EAAE,MAAM,CAAC,CAAA;AAC5C,CAAC;AAAC,MAAM,CAAC;IACP,IAAI,CAAC,uBAAuB,UAAU,gCAAgC,CAAC,CAAA;IACvE,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC,CAAA;AAChC,CAAC;AACD,0EAA0E;AAC1E,mEAAmE;AACnE,EAAE,CAAC,gBAAgB,CAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC,CAAA","sourcesContent":["// The Node+GTK host: executes a Metro jsbundle built for the linux\n// platform. Spawned by the run-linux command as\n// `node dist/runner/host.js <bundle>`; the bundle's externalized proxies\n// (see ../metro) read the modules injected here.\n//\n// This file must stay runnable under BARE Node: no extensionless relative\n// imports — only builtins, bare dependency specifiers and the package\n// self-reference (resolved through the exports map).\nimport { readFileSync } from \"node:fs\"\nimport { createRequire, registerHooks } from \"node:module\"\nimport { pathToFileURL } from \"node:url\"\nimport vm from \"node:vm\"\nimport { HOST_MODULE_EXTERNALS } from \"react-native-gtkx/metro\"\n\ntype HostModule = Record<string, unknown>\n\nconst fail = (message: string): never => {\n console.error(`[react-native-gtkx] ${message}`)\n process.exit(1)\n}\n\nif (typeof registerHooks !== \"function\") {\n fail(\n `Node ${process.version} lacks module.registerHooks — the linux host needs Node >= 24.`,\n )\n}\n\n// Resolution anchors. @gtkx/* and @gtkx/config resolve as THIS package's\n// dependencies; react resolves FROM @gtkx/react's real location — the\n// reconciler and the app must share one React instance, and anchoring at\n// the app could pick up a second copy installed by npm peer auto-install.\nconst fromPackage = createRequire(import.meta.url)\nconst fromGtkxReact = createRequire(fromPackage.resolve(\"@gtkx/react\"))\n\nconst resolveExternal = (name: string): string =>\n name === \"react\" || name.startsWith(\"react/\")\n ? fromGtkxReact.resolve(name)\n : fromPackage.resolve(name)\n\n// import() handles both ESM and CJS; merge a `default` for Babel's\n// default-import interop when the module has none of its own.\nconst load = async (name: string): Promise<HostModule> => {\n const namespace: HostModule = await import(\n pathToFileURL(resolveExternal(name)).href\n )\n const merged: HostModule = { __esModule: true, ...namespace }\n if (!(\"default\" in namespace)) {\n merged.default = namespace\n }\n return merged\n}\n\n// @gtkx/react imports `virtual:gtkx-config` — JSX metadata plus the values\n// resolved from gtkx.config.ts (applicationId for the GApplication, the\n// userEventSignals suppressed during commits and the elements config the\n// reconciler registry is primed with). In the vite path the gtkx CLI plugin\n// serves it; replicate it with a loader hook, mirroring @gtkx/config's own\n// renderConfigModule. The fake module URL is anchored inside this package so\n// the re-exported bare specifier resolves through node_modules.\nconst CONFIG_REQUIRED =\n \"gtkx.config.ts with an applicationId is required in the app root \" +\n '(export default defineConfig({ applicationId: \"...\", libraries: [...] })).'\nconst { createConfigLoader } = await import(\"@gtkx/config/internal\")\n// The loader validates the config, so a missing or malformed one throws.\n// rc.3 turned the loader from a bare function into `{ load, resolve }`;\n// `resolve` is the runtime projection this module needs.\nconst gtkxConfig = await createConfigLoader()\n .resolve(process.cwd())\n .catch((error: unknown) => fail(`${CONFIG_REQUIRED}\\n${String(error)}`))\nif (!gtkxConfig.applicationId) {\n fail(CONFIG_REQUIRED)\n}\n// A behaviors module would have to be bundled and merged through\n// @gtkx/react/config; the react-native surface owns element behaviors, so no\n// app declares one — refuse rather than silently drop it.\nif (gtkxConfig.elements !== null) {\n fail(\n \"gtkx.config.ts `elements.behaviors` is not supported on the linux \" +\n \"platform — react-native-gtkx owns element behaviors.\",\n )\n}\nconst configModuleUrl = new URL(\"./__virtual-gtkx-config.mjs\", import.meta.url)\n .href\nconst lazyElements = Object.fromEntries(\n gtkxConfig.lazyElements.map((type) => [type, { isLazy: true }]),\n)\nconst configModuleSource = [\n `export * from \"@gtkx/jsx/metadata\";`,\n `export const applicationId = ${JSON.stringify(gtkxConfig.applicationId)};`,\n `export const userEventSignals = ${JSON.stringify(gtkxConfig.userEventSignals)};`,\n `export const elements = ${JSON.stringify(lazyElements)};`,\n].join(\"\\n\")\nregisterHooks({\n resolve(specifier, context, nextResolve) {\n if (specifier === \"virtual:gtkx-config\") {\n return { url: configModuleUrl, shortCircuit: true }\n }\n return nextResolve(specifier, context)\n },\n load(url, context, nextLoad) {\n if (url === configModuleUrl) {\n return {\n format: \"module\",\n source: configModuleSource,\n shortCircuit: true,\n }\n }\n return nextLoad(url, context)\n },\n})\n\nglobalThis.__hostModules = {}\nfor (const name of HOST_MODULE_EXTERNALS) {\n try {\n globalThis.__hostModules[name] = await load(name)\n } catch (error) {\n fail(\n `failed to load host module \"${name}\" — is the codegen store in ` +\n `place (npx gtkx codegen) and GTK4/libadwaita installed?\\n${String(error)}`,\n )\n }\n}\n// Node builtin proxies resolve lazily through the host's own require.\nglobalThis.__hostRequire = createRequire(import.meta.url)\n\nconst bundlePath = process.argv[2]\nif (!bundlePath) {\n fail(\"usage: node host.js <path/to/main.jsbundle>\")\n}\nlet source: string\ntry {\n source = readFileSync(bundlePath!, \"utf8\")\n} catch {\n fail(`bundle not found at ${bundlePath} — run react-native run-linux.`)\n throw new Error(\"unreachable\")\n}\n// The entry calls AppRegistry.runApplication itself (the react-native-web\n// pattern); the GLib main loop keeps the process alive afterwards.\nvm.runInThisContext(source, { filename: bundlePath })\n"]}
|
package/dist/runner/index.js
CHANGED
|
@@ -34,8 +34,8 @@ const reactSubexportsOf = (manifest) => Object.keys(manifest.exports ?? {})
|
|
|
34
34
|
.filter((key) => key.startsWith("./") && key !== "./package.json")
|
|
35
35
|
.map((key) => key.slice(2));
|
|
36
36
|
// @gtkx/cli is meant for apps: its `codegen` command resolves gtkx.config.ts
|
|
37
|
-
// from a cwd and trusts a freshness stamp, which is what the
|
|
38
|
-
// this replaced was dodging (running from a reconstructed "project that owns
|
|
37
|
+
// from a cwd and trusts a freshness stamp, which is what the retired rc.2-era
|
|
38
|
+
// workaround this replaced was dodging (running from a reconstructed "project that owns
|
|
39
39
|
// the hosting node_modules" purely to keep that cwd resolution honest — see
|
|
40
40
|
// gtkx-org/gtkx#468, #470). A library generating bindings on a consumer's
|
|
41
41
|
// behalf should use the programmatic @gtkx/codegen API instead: it takes the
|
|
@@ -84,7 +84,7 @@ const ensureCodegenStore = async (root) => {
|
|
|
84
84
|
},
|
|
85
85
|
reactSubexports: reactSubexportsOf(react),
|
|
86
86
|
});
|
|
87
|
-
console.warn(result.
|
|
87
|
+
console.warn(result.isRegenerated
|
|
88
88
|
? "[react-native-gtkx] codegen: regenerated stale bindings"
|
|
89
89
|
: "[react-native-gtkx] codegen: bindings up to date");
|
|
90
90
|
}
|
package/dist/runner/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/runner/index.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,2EAA2E;AAC3E,yEAAyE;AACzE,uEAAuE;AACvE,oEAAoE;AACpE,uEAAuE;AACvE,4CAA4C;AAC5C,EAAE;AACF,kEAAkE;AAClE,qCAAqC;AACrC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAqB,MAAM,oBAAoB,CAAA;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAA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AE;YACP;gBACE,IAAI,EAAE,qBAAqB;gBAC3B,WAAW,EAAE,4BAA4B;gBACzC,OAAO,EAAE,UAAU;aACpB;YACD;gBACE,IAAI,EAAE,wBAAwB;gBAC9B,WAAW,EACT,mEAAmE;aACtE;YACD;gBACE,IAAI,EAAE,cAAc;gBACpB,WAAW,EACT,iEAAiE;oBACjE,8CAA8C;aACjD;YACD;gBACE,IAAI,EAAE,OAAO;gBACb,WAAW,EACT,kEAAkE;oBAClE,2DAA2D;oBAC3D,wCAAwC;aAC3C;YACD;gBACE,IAAI,EAAE,qBAAqB;gBAC3B,WAAW,EACT,mDAAmD;oBACnD,sCAAsC;aACzC;SACF;QACD,IAAI,EAAE,UAAU;KACjB;CACF,CAAA","sourcesContent":["// The `run-linux` CLI command (registered through the package's\n// react-native.config.js, the react-native-windows model): ensure the gtkx\n// codegen store, then either build a release jsbundle with Metro and run\n// it in the Node+GTK host (./host.ts), or — with --dev — start/reuse a\n// Metro dev server and supervise the DEV host (./host-dev.ts): Fast\n// Refresh applies edits to the live window, and a full-refresh request\n// (exit code 65) restarts the host process.\n//\n// Like the hosts, this module must stay runnable under bare Node:\n// builtins and bare specifiers only.\nimport { spawn, spawnSync, type ChildProcess } from \"node:child_process\"\nimport { mkdirSync } from \"node:fs\"\nimport { createRequire } from \"node:module\"\nimport { basename, dirname, extname, join } from \"node:path\"\nimport { fileURLToPath } from \"node:url\"\n\ntype CliConfig = { root: string }\ntype RunLinuxArgs = {\n entryFile: string\n bundleOutput?: string\n skipBundling?: boolean\n dev?: boolean\n port?: string\n}\ntype BuildLinuxArgs = {\n entryFile: string\n bundleOutput?: string\n standalone?: boolean\n sea?: boolean\n seaOutput?: string\n}\n\n/** Exit code host-dev.ts uses to request a supervisor restart. */\nconst FULL_REFRESH_EXIT_CODE = 65\n\nconst run = (command: string, args: string[], cwd: string): number => {\n const result = spawnSync(command, args, { cwd, stdio: \"inherit\" })\n return result.status ?? 1\n}\n\n/** Resolve an executable script shipped by a dependency's bin field. */\nconst binOf = (\n requireFrom: NodeJS.Require,\n packageName: string,\n binName: string,\n): string => {\n const packageJsonPath = requireFrom.resolve(`${packageName}/package.json`)\n const manifest = requireFrom(`${packageName}/package.json`) as {\n bin?: string | Record<string, string>\n }\n const bin =\n typeof manifest.bin === \"string\" ? manifest.bin : manifest.bin?.[binName]\n if (!bin) {\n throw new Error(`${packageName} does not expose a \"${binName}\" binary`)\n }\n return join(dirname(packageJsonPath), bin)\n}\n\ntype PackageManifest = { version: string; exports?: Record<string, unknown> }\n\n/** The `@gtkx/react` subpath exports (its own `exports` map, minus `.` and `./package.json`). */\nconst reactSubexportsOf = (manifest: PackageManifest): string[] =>\n Object.keys(manifest.exports ?? {})\n .filter((key) => key.startsWith(\"./\") && key !== \"./package.json\")\n .map((key) => key.slice(2))\n\n// @gtkx/cli is meant for apps: its `codegen` command resolves gtkx.config.ts\n// from a cwd and trusts a freshness stamp, which is what the RC3-WORKAROUND\n// this replaced was dodging (running from a reconstructed \"project that owns\n// the hosting node_modules\" purely to keep that cwd resolution honest — see\n// gtkx-org/gtkx#468, #470). A library generating bindings on a consumer's\n// behalf should use the programmatic @gtkx/codegen API instead: it takes the\n// GIR libraries and store paths directly, so there is no cwd to get wrong and\n// no stamp to misread — and it runs its own fingerprint-based freshness\n// check in-process, so a missing/pruned store is regenerated rather than\n// misreported as \"up to date\".\n//\n// `root` (the app's real project root, resolved by the react-native CLI, not\n// us) is the right place to resolve gtkx.config.ts from, but NOT necessarily\n// where @gtkx/* actually lives on disk: in a workspace, npm hoists them to an\n// ancestor's node_modules, so `root/node_modules` can be a directory with no\n// @gtkx/* in it at all (confirmed against this repo's own examples/, which\n// are workspace members with nothing hoisted locally). The store — and the\n// @gtkx/gi and @gtkx/jsx links every other @gtkx/* package resolves through\n// its OWN up-the-tree lookup — must live in whichever node_modules actually\n// hosts @gtkx/runtime, so that's resolved rather than assumed.\nconst ensureCodegenStore = async (root: string): Promise<void> => {\n console.warn(\"[react-native-gtkx] ensuring gtkx codegen store…\")\n try {\n const [{ runCodegen, resolveGirPath, resolveLibraries }, { loadConfig }] =\n await Promise.all([import(\"@gtkx/codegen\"), import(\"@gtkx/config\")])\n const { config } = await loadConfig(root)\n if (config.codegen === false) {\n console.warn(\n \"[react-native-gtkx] codegen: disabled for this project (gtkx.config.ts)\",\n )\n return\n }\n const girPath = resolveGirPath(config.girPath)\n const libraries = resolveLibraries(config.libraries, girPath)\n const appRequire = createRequire(join(root, \"package.json\"))\n const runtimePackageJsonPath = appRequire.resolve(\n \"@gtkx/runtime/package.json\",\n )\n const nodeModules = dirname(dirname(dirname(runtimePackageJsonPath)))\n const runtime = appRequire(runtimePackageJsonPath) as PackageManifest\n const react = appRequire(\"@gtkx/react/package.json\") as PackageManifest\n const result = await runCodegen({\n libraries,\n girPath,\n gi: {\n storeDir: join(nodeModules, \".gtkx\", \"gi\"),\n linkDir: join(nodeModules, \"@gtkx\", \"gi\"),\n version: runtime.version,\n },\n jsx: {\n storeDir: join(nodeModules, \".gtkx\", \"jsx\"),\n linkDir: join(nodeModules, \"@gtkx\", \"jsx\"),\n version: react.version,\n },\n reactSubexports: reactSubexportsOf(react),\n })\n console.warn(\n result.regenerated\n ? \"[react-native-gtkx] codegen: regenerated stale bindings\"\n : \"[react-native-gtkx] codegen: bindings up to date\",\n )\n } catch (error) {\n console.error(\n \"[react-native-gtkx] gtkx codegen failed — are GTK4/libadwaita \" +\n \"development files installed?\",\n )\n console.error(error)\n process.exit(1)\n }\n}\n\nconst bundle = (root: string, entryFile: string, output: string): void => {\n const appRequire = createRequire(join(root, \"package.json\"))\n const status = run(\n process.execPath,\n [\n binOf(appRequire, \"react-native\", \"react-native\"),\n \"bundle\",\n \"--platform\",\n \"linux\",\n \"--dev\",\n \"false\",\n \"--entry-file\",\n entryFile,\n \"--bundle-output\",\n output,\n ],\n root,\n )\n if (status !== 0) {\n process.exit(status)\n }\n}\n\nconst isMetroRunning = async (server: string): Promise<boolean> => {\n try {\n const response = await fetch(`${server}/status`)\n return (await response.text()).includes(\"packager-status:running\")\n } catch {\n return false\n }\n}\n\nconst waitForMetro = async (server: string): Promise<void> => {\n for (let attempt = 0; attempt < 120; attempt += 1) {\n if (await isMetroRunning(server)) {\n return\n }\n await new Promise((resolve) => setTimeout(resolve, 500))\n }\n console.error(\n `[react-native-gtkx] Metro dev server never came up (${server}).`,\n )\n process.exit(1)\n}\n\nlet activeHost: ChildProcess | null = null\n\nconst spawnHost = (\n script: string,\n argument: string,\n cwd: string,\n): Promise<number> =>\n new Promise((resolve) => {\n // join over `new URL(script, import.meta.url)`: the global URL and the\n // node:url URL come from different type copies when the dependency tree\n // splits @types/node, and the two structurally diverge.\n const hostPath = join(dirname(fileURLToPath(import.meta.url)), script)\n const child = spawn(process.execPath, [hostPath, argument], {\n cwd,\n stdio: \"inherit\",\n })\n activeHost = child\n child.on(\"exit\", (code) => {\n activeHost = null\n resolve(code ?? 1)\n })\n })\n\nconst runLinuxDev = async (\n config: CliConfig,\n args: RunLinuxArgs,\n): Promise<never> => {\n const port = args.port ?? \"8081\"\n const server = `http://localhost:${port}`\n let metro: ChildProcess | null = null\n if (await isMetroRunning(server)) {\n console.warn(\n `[react-native-gtkx] reusing the Metro dev server at ${server}`,\n )\n } else {\n console.warn(\n `[react-native-gtkx] starting the Metro dev server at ${server}…`,\n )\n const appRequire = createRequire(join(config.root, \"package.json\"))\n metro = spawn(\n process.execPath,\n [\n binOf(appRequire, \"react-native\", \"react-native\"),\n \"start\",\n \"--port\",\n port,\n ],\n { cwd: config.root, stdio: \"inherit\" },\n )\n await waitForMetro(server)\n }\n const entry = basename(args.entryFile, extname(args.entryFile))\n const bundleUrl = `${server}/${entry}.bundle?platform=linux&dev=true&minify=false`\n const shutdown = (code: number): never => {\n activeHost?.kill()\n metro?.kill()\n process.exit(code)\n }\n process.on(\"SIGINT\", () => shutdown(0))\n process.on(\"SIGTERM\", () => shutdown(0))\n // Supervisor: a full-refresh request restarts the host with the window\n // reopening on the fresh bundle; any other exit ends the session.\n for (;;) {\n const code = await spawnHost(\"./host-dev.js\", bundleUrl, config.root)\n if (code !== FULL_REFRESH_EXIT_CODE) {\n shutdown(code)\n }\n console.warn(\"[react-native-gtkx] restarting the app after a full refresh…\")\n }\n}\n\nconst runLinux = async (\n _argv: string[],\n config: CliConfig,\n args: RunLinuxArgs,\n): Promise<void> => {\n await ensureCodegenStore(config.root)\n if (args.dev) {\n await runLinuxDev(config, args)\n return\n }\n const output =\n args.bundleOutput ??\n join(config.root, \"node_modules\", \".react-native-gtkx\", \"main.jsbundle\")\n if (!args.skipBundling) {\n mkdirSync(dirname(output), { recursive: true })\n bundle(config.root, args.entryFile, output)\n }\n const status = await spawnHost(\"./host.js\", output, config.root)\n process.exit(status)\n}\n\n/**\n * The executable name a `--sea` build defaults to: the app's package name\n * without its scope, so the artifact is `dist/hn-app`, not `dist/app`.\n */\nconst appBinaryName = (root: string): string => {\n try {\n const manifest = createRequire(join(root, \"package.json\"))(\n \"./package.json\",\n ) as { name?: string }\n const name = manifest.name?.split(\"/\").pop()\n return name && /^[\\w.-]+$/.test(name) ? name : \"app\"\n } catch {\n return \"app\"\n }\n}\n\n// The android/ios counterpart to run-linux's dev-only bundling: bundle for\n// distribution and stop, the way a release APK/IPA build does not launch\n// the app it produces. Deliberately skips ensureCodegenStore() — codegen\n// generates the @gtkx/gi bindings host.js imports to talk to GTK at RUN\n// time; bundling never touches them (Metro only reads/transforms JS, and\n// the GTK/react/yoga modules are proxied rather than imported — see\n// ../metro's HOST_MODULE_EXTERNALS). A machine that only builds never needs\n// GTK dev headers installed.\n//\n// --standalone and --sea are the exception: both inline\n// \"virtual:gtkx-config\", which re-exports @gtkx/jsx/metadata — a codegen\n// product — so they DO need the store, and therefore GTK dev headers.\n// Only those paths ensure it.\n//\n// The three artifacts, cheapest to heaviest, are deliberately one command\n// with flags rather than three commands: they share the Metro bundle step,\n// and the choice between them is a distribution question, not a different\n// build.\n// (default) main.jsbundle + a runtime node_modules + a system node\n// --standalone one .cjs file, no node_modules, + a system node\n// --sea one executable, nothing preinstalled at all\nconst buildLinux = async (\n _argv: string[],\n config: CliConfig,\n args: BuildLinuxArgs,\n): Promise<void> => {\n if (args.sea || args.standalone) {\n await ensureCodegenStore(config.root)\n }\n const output = args.bundleOutput ?? join(config.root, \"dist\", \"main.jsbundle\")\n mkdirSync(dirname(output), { recursive: true })\n bundle(config.root, args.entryFile, output)\n console.warn(`[react-native-gtkx] wrote the release bundle to ${output}`)\n if (!args.sea && !args.standalone) {\n return\n }\n const name = appBinaryName(config.root)\n const seaOutput =\n args.seaOutput ?? join(config.root, \"dist\", args.sea ? name : `${name}.cjs`)\n // Dynamically imported so the bundler is never loaded on the ordinary\n // jsbundle path.\n const { assembleSea, bundleStandalone } = await import(\"../sea/assemble.js\")\n const bytes = args.sea\n ? await assembleSea({\n appRoot: config.root,\n jsbundlePath: output,\n outFile: seaOutput,\n })\n : await bundleStandalone({\n appRoot: config.root,\n jsbundlePath: output,\n outFile: seaOutput,\n })\n const megabytes = (bytes / 1024 / 1024).toFixed(0)\n console.warn(\n args.sea\n ? `[react-native-gtkx] wrote the single executable to ${seaOutput} ` +\n `(${megabytes} MB — Node itself is most of it)`\n : `[react-native-gtkx] wrote the standalone script to ${seaOutput} ` +\n `(${megabytes} MB — run it with \\`node ${seaOutput}\\`)`,\n )\n}\n\n/** Commands contributed to the RN CLI by the package's react-native.config.js. */\nexport const commands = [\n {\n name: \"run-linux\",\n description:\n \"Bundle the app with Metro for the linux platform and run it in the Node+GTK host\",\n options: [\n {\n name: \"--entry-file <path>\",\n description: \"Path to the app entry file\",\n default: \"index.js\",\n },\n {\n name: \"--bundle-output <path>\",\n description:\n \"Where to write the jsbundle (default: node_modules/.react-native-gtkx/main.jsbundle)\",\n },\n {\n name: \"--skip-bundling\",\n description: \"Reuse the existing bundle at --bundle-output\",\n },\n {\n name: \"--dev\",\n description:\n \"Development mode: Metro dev server + Fast Refresh (edits apply to the live window)\",\n },\n {\n name: \"--port <number>\",\n description: \"Metro dev server port for --dev (default: 8081)\",\n },\n ],\n func: runLinux,\n },\n {\n name: \"build-linux\",\n description:\n \"Bundle the app with Metro for the linux platform for distribution, without running it\",\n options: [\n {\n name: \"--entry-file <path>\",\n description: \"Path to the app entry file\",\n default: \"index.js\",\n },\n {\n name: \"--bundle-output <path>\",\n description:\n \"Where to write the release jsbundle (default: dist/main.jsbundle)\",\n },\n {\n name: \"--standalone\",\n description:\n \"Also produce one self-contained .cjs — no node_modules, run it \" +\n \"with a system node (dist/<package name>.cjs)\",\n },\n {\n name: \"--sea\",\n description:\n \"Also produce a single executable (Node SEA): one file that runs \" +\n \"with no node_modules and no system Node — at the cost of \" +\n \"carrying a whole Node binary (~120 MB)\",\n },\n {\n name: \"--sea-output <path>\",\n description:\n \"Where to write the --sea / --standalone artifact \" +\n \"(default: dist/<package name>[.cjs])\",\n },\n ],\n func: buildLinux,\n },\n]\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/runner/index.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,2EAA2E;AAC3E,yEAAyE;AACzE,uEAAuE;AACvE,oEAAoE;AACpE,uEAAuE;AACvE,4CAA4C;AAC5C,EAAE;AACF,kEAAkE;AAClE,qCAAqC;AACrC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAqB,MAAM,oBAAoB,CAAA;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAkBxC,kEAAkE;AAClE,MAAM,sBAAsB,GAAG,EAAE,CAAA;AAEjC,MAAM,GAAG,GAAG,CAAC,OAAe,EAAE,IAAc,EAAE,GAAW,EAAU,EAAE;IACnE,MAAM,MAAM,GAAG,SAAS,CAAC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EAAkE;oBAClE,2DAA2D;oBAC3D,wCAAwC;aAC3C;YACD;gBACE,IAAI,EAAE,qBAAqB;gBAC3B,WAAW,EACT,mDAAmD;oBACnD,sCAAsC;aACzC;SACF;QACD,IAAI,EAAE,UAAU;KACjB;CACF,CAAA","sourcesContent":["// The `run-linux` CLI command (registered through the package's\n// react-native.config.js, the react-native-windows model): ensure the gtkx\n// codegen store, then either build a release jsbundle with Metro and run\n// it in the Node+GTK host (./host.ts), or — with --dev — start/reuse a\n// Metro dev server and supervise the DEV host (./host-dev.ts): Fast\n// Refresh applies edits to the live window, and a full-refresh request\n// (exit code 65) restarts the host process.\n//\n// Like the hosts, this module must stay runnable under bare Node:\n// builtins and bare specifiers only.\nimport { spawn, spawnSync, type ChildProcess } from \"node:child_process\"\nimport { mkdirSync } from \"node:fs\"\nimport { createRequire } from \"node:module\"\nimport { basename, dirname, extname, join } from \"node:path\"\nimport { fileURLToPath } from \"node:url\"\n\ntype CliConfig = { root: string }\ntype RunLinuxArgs = {\n entryFile: string\n bundleOutput?: string\n skipBundling?: boolean\n dev?: boolean\n port?: string\n}\ntype BuildLinuxArgs = {\n entryFile: string\n bundleOutput?: string\n standalone?: boolean\n sea?: boolean\n seaOutput?: string\n}\n\n/** Exit code host-dev.ts uses to request a supervisor restart. */\nconst FULL_REFRESH_EXIT_CODE = 65\n\nconst run = (command: string, args: string[], cwd: string): number => {\n const result = spawnSync(command, args, { cwd, stdio: \"inherit\" })\n return result.status ?? 1\n}\n\n/** Resolve an executable script shipped by a dependency's bin field. */\nconst binOf = (\n requireFrom: NodeJS.Require,\n packageName: string,\n binName: string,\n): string => {\n const packageJsonPath = requireFrom.resolve(`${packageName}/package.json`)\n const manifest = requireFrom(`${packageName}/package.json`) as {\n bin?: string | Record<string, string>\n }\n const bin =\n typeof manifest.bin === \"string\" ? manifest.bin : manifest.bin?.[binName]\n if (!bin) {\n throw new Error(`${packageName} does not expose a \"${binName}\" binary`)\n }\n return join(dirname(packageJsonPath), bin)\n}\n\ntype PackageManifest = { version: string; exports?: Record<string, unknown> }\n\n/** The `@gtkx/react` subpath exports (its own `exports` map, minus `.` and `./package.json`). */\nconst reactSubexportsOf = (manifest: PackageManifest): string[] =>\n Object.keys(manifest.exports ?? {})\n .filter((key) => key.startsWith(\"./\") && key !== \"./package.json\")\n .map((key) => key.slice(2))\n\n// @gtkx/cli is meant for apps: its `codegen` command resolves gtkx.config.ts\n// from a cwd and trusts a freshness stamp, which is what the retired rc.2-era\n// workaround this replaced was dodging (running from a reconstructed \"project that owns\n// the hosting node_modules\" purely to keep that cwd resolution honest — see\n// gtkx-org/gtkx#468, #470). A library generating bindings on a consumer's\n// behalf should use the programmatic @gtkx/codegen API instead: it takes the\n// GIR libraries and store paths directly, so there is no cwd to get wrong and\n// no stamp to misread — and it runs its own fingerprint-based freshness\n// check in-process, so a missing/pruned store is regenerated rather than\n// misreported as \"up to date\".\n//\n// `root` (the app's real project root, resolved by the react-native CLI, not\n// us) is the right place to resolve gtkx.config.ts from, but NOT necessarily\n// where @gtkx/* actually lives on disk: in a workspace, npm hoists them to an\n// ancestor's node_modules, so `root/node_modules` can be a directory with no\n// @gtkx/* in it at all (confirmed against this repo's own examples/, which\n// are workspace members with nothing hoisted locally). The store — and the\n// @gtkx/gi and @gtkx/jsx links every other @gtkx/* package resolves through\n// its OWN up-the-tree lookup — must live in whichever node_modules actually\n// hosts @gtkx/runtime, so that's resolved rather than assumed.\nconst ensureCodegenStore = async (root: string): Promise<void> => {\n console.warn(\"[react-native-gtkx] ensuring gtkx codegen store…\")\n try {\n const [{ runCodegen, resolveGirPath, resolveLibraries }, { loadConfig }] =\n await Promise.all([import(\"@gtkx/codegen\"), import(\"@gtkx/config\")])\n const { config } = await loadConfig(root)\n if (config.codegen === false) {\n console.warn(\n \"[react-native-gtkx] codegen: disabled for this project (gtkx.config.ts)\",\n )\n return\n }\n const girPath = resolveGirPath(config.girPath)\n const libraries = resolveLibraries(config.libraries, girPath)\n const appRequire = createRequire(join(root, \"package.json\"))\n const runtimePackageJsonPath = appRequire.resolve(\n \"@gtkx/runtime/package.json\",\n )\n const nodeModules = dirname(dirname(dirname(runtimePackageJsonPath)))\n const runtime = appRequire(runtimePackageJsonPath) as PackageManifest\n const react = appRequire(\"@gtkx/react/package.json\") as PackageManifest\n const result = await runCodegen({\n libraries,\n girPath,\n gi: {\n storeDir: join(nodeModules, \".gtkx\", \"gi\"),\n linkDir: join(nodeModules, \"@gtkx\", \"gi\"),\n version: runtime.version,\n },\n jsx: {\n storeDir: join(nodeModules, \".gtkx\", \"jsx\"),\n linkDir: join(nodeModules, \"@gtkx\", \"jsx\"),\n version: react.version,\n },\n reactSubexports: reactSubexportsOf(react),\n })\n console.warn(\n result.isRegenerated\n ? \"[react-native-gtkx] codegen: regenerated stale bindings\"\n : \"[react-native-gtkx] codegen: bindings up to date\",\n )\n } catch (error) {\n console.error(\n \"[react-native-gtkx] gtkx codegen failed — are GTK4/libadwaita \" +\n \"development files installed?\",\n )\n console.error(error)\n process.exit(1)\n }\n}\n\nconst bundle = (root: string, entryFile: string, output: string): void => {\n const appRequire = createRequire(join(root, \"package.json\"))\n const status = run(\n process.execPath,\n [\n binOf(appRequire, \"react-native\", \"react-native\"),\n \"bundle\",\n \"--platform\",\n \"linux\",\n \"--dev\",\n \"false\",\n \"--entry-file\",\n entryFile,\n \"--bundle-output\",\n output,\n ],\n root,\n )\n if (status !== 0) {\n process.exit(status)\n }\n}\n\nconst isMetroRunning = async (server: string): Promise<boolean> => {\n try {\n const response = await fetch(`${server}/status`)\n return (await response.text()).includes(\"packager-status:running\")\n } catch {\n return false\n }\n}\n\nconst waitForMetro = async (server: string): Promise<void> => {\n for (let attempt = 0; attempt < 120; attempt += 1) {\n if (await isMetroRunning(server)) {\n return\n }\n await new Promise((resolve) => setTimeout(resolve, 500))\n }\n console.error(\n `[react-native-gtkx] Metro dev server never came up (${server}).`,\n )\n process.exit(1)\n}\n\nlet activeHost: ChildProcess | null = null\n\nconst spawnHost = (\n script: string,\n argument: string,\n cwd: string,\n): Promise<number> =>\n new Promise((resolve) => {\n // join over `new URL(script, import.meta.url)`: the global URL and the\n // node:url URL come from different type copies when the dependency tree\n // splits @types/node, and the two structurally diverge.\n const hostPath = join(dirname(fileURLToPath(import.meta.url)), script)\n const child = spawn(process.execPath, [hostPath, argument], {\n cwd,\n stdio: \"inherit\",\n })\n activeHost = child\n child.on(\"exit\", (code) => {\n activeHost = null\n resolve(code ?? 1)\n })\n })\n\nconst runLinuxDev = async (\n config: CliConfig,\n args: RunLinuxArgs,\n): Promise<never> => {\n const port = args.port ?? \"8081\"\n const server = `http://localhost:${port}`\n let metro: ChildProcess | null = null\n if (await isMetroRunning(server)) {\n console.warn(\n `[react-native-gtkx] reusing the Metro dev server at ${server}`,\n )\n } else {\n console.warn(\n `[react-native-gtkx] starting the Metro dev server at ${server}…`,\n )\n const appRequire = createRequire(join(config.root, \"package.json\"))\n metro = spawn(\n process.execPath,\n [\n binOf(appRequire, \"react-native\", \"react-native\"),\n \"start\",\n \"--port\",\n port,\n ],\n { cwd: config.root, stdio: \"inherit\" },\n )\n await waitForMetro(server)\n }\n const entry = basename(args.entryFile, extname(args.entryFile))\n const bundleUrl = `${server}/${entry}.bundle?platform=linux&dev=true&minify=false`\n const shutdown = (code: number): never => {\n activeHost?.kill()\n metro?.kill()\n process.exit(code)\n }\n process.on(\"SIGINT\", () => shutdown(0))\n process.on(\"SIGTERM\", () => shutdown(0))\n // Supervisor: a full-refresh request restarts the host with the window\n // reopening on the fresh bundle; any other exit ends the session.\n for (;;) {\n const code = await spawnHost(\"./host-dev.js\", bundleUrl, config.root)\n if (code !== FULL_REFRESH_EXIT_CODE) {\n shutdown(code)\n }\n console.warn(\"[react-native-gtkx] restarting the app after a full refresh…\")\n }\n}\n\nconst runLinux = async (\n _argv: string[],\n config: CliConfig,\n args: RunLinuxArgs,\n): Promise<void> => {\n await ensureCodegenStore(config.root)\n if (args.dev) {\n await runLinuxDev(config, args)\n return\n }\n const output =\n args.bundleOutput ??\n join(config.root, \"node_modules\", \".react-native-gtkx\", \"main.jsbundle\")\n if (!args.skipBundling) {\n mkdirSync(dirname(output), { recursive: true })\n bundle(config.root, args.entryFile, output)\n }\n const status = await spawnHost(\"./host.js\", output, config.root)\n process.exit(status)\n}\n\n/**\n * The executable name a `--sea` build defaults to: the app's package name\n * without its scope, so the artifact is `dist/hn-app`, not `dist/app`.\n */\nconst appBinaryName = (root: string): string => {\n try {\n const manifest = createRequire(join(root, \"package.json\"))(\n \"./package.json\",\n ) as { name?: string }\n const name = manifest.name?.split(\"/\").pop()\n return name && /^[\\w.-]+$/.test(name) ? name : \"app\"\n } catch {\n return \"app\"\n }\n}\n\n// The android/ios counterpart to run-linux's dev-only bundling: bundle for\n// distribution and stop, the way a release APK/IPA build does not launch\n// the app it produces. Deliberately skips ensureCodegenStore() — codegen\n// generates the @gtkx/gi bindings host.js imports to talk to GTK at RUN\n// time; bundling never touches them (Metro only reads/transforms JS, and\n// the GTK/react/yoga modules are proxied rather than imported — see\n// ../metro's HOST_MODULE_EXTERNALS). A machine that only builds never needs\n// GTK dev headers installed.\n//\n// --standalone and --sea are the exception: both inline\n// \"virtual:gtkx-config\", which re-exports @gtkx/jsx/metadata — a codegen\n// product — so they DO need the store, and therefore GTK dev headers.\n// Only those paths ensure it.\n//\n// The three artifacts, cheapest to heaviest, are deliberately one command\n// with flags rather than three commands: they share the Metro bundle step,\n// and the choice between them is a distribution question, not a different\n// build.\n// (default) main.jsbundle + a runtime node_modules + a system node\n// --standalone one .cjs file, no node_modules, + a system node\n// --sea one executable, nothing preinstalled at all\nconst buildLinux = async (\n _argv: string[],\n config: CliConfig,\n args: BuildLinuxArgs,\n): Promise<void> => {\n if (args.sea || args.standalone) {\n await ensureCodegenStore(config.root)\n }\n const output = args.bundleOutput ?? join(config.root, \"dist\", \"main.jsbundle\")\n mkdirSync(dirname(output), { recursive: true })\n bundle(config.root, args.entryFile, output)\n console.warn(`[react-native-gtkx] wrote the release bundle to ${output}`)\n if (!args.sea && !args.standalone) {\n return\n }\n const name = appBinaryName(config.root)\n const seaOutput =\n args.seaOutput ?? join(config.root, \"dist\", args.sea ? name : `${name}.cjs`)\n // Dynamically imported so the bundler is never loaded on the ordinary\n // jsbundle path.\n const { assembleSea, bundleStandalone } = await import(\"../sea/assemble.js\")\n const bytes = args.sea\n ? await assembleSea({\n appRoot: config.root,\n jsbundlePath: output,\n outFile: seaOutput,\n })\n : await bundleStandalone({\n appRoot: config.root,\n jsbundlePath: output,\n outFile: seaOutput,\n })\n const megabytes = (bytes / 1024 / 1024).toFixed(0)\n console.warn(\n args.sea\n ? `[react-native-gtkx] wrote the single executable to ${seaOutput} ` +\n `(${megabytes} MB — Node itself is most of it)`\n : `[react-native-gtkx] wrote the standalone script to ${seaOutput} ` +\n `(${megabytes} MB — run it with \\`node ${seaOutput}\\`)`,\n )\n}\n\n/** Commands contributed to the RN CLI by the package's react-native.config.js. */\nexport const commands = [\n {\n name: \"run-linux\",\n description:\n \"Bundle the app with Metro for the linux platform and run it in the Node+GTK host\",\n options: [\n {\n name: \"--entry-file <path>\",\n description: \"Path to the app entry file\",\n default: \"index.js\",\n },\n {\n name: \"--bundle-output <path>\",\n description:\n \"Where to write the jsbundle (default: node_modules/.react-native-gtkx/main.jsbundle)\",\n },\n {\n name: \"--skip-bundling\",\n description: \"Reuse the existing bundle at --bundle-output\",\n },\n {\n name: \"--dev\",\n description:\n \"Development mode: Metro dev server + Fast Refresh (edits apply to the live window)\",\n },\n {\n name: \"--port <number>\",\n description: \"Metro dev server port for --dev (default: 8081)\",\n },\n ],\n func: runLinux,\n },\n {\n name: \"build-linux\",\n description:\n \"Bundle the app with Metro for the linux platform for distribution, without running it\",\n options: [\n {\n name: \"--entry-file <path>\",\n description: \"Path to the app entry file\",\n default: \"index.js\",\n },\n {\n name: \"--bundle-output <path>\",\n description:\n \"Where to write the release jsbundle (default: dist/main.jsbundle)\",\n },\n {\n name: \"--standalone\",\n description:\n \"Also produce one self-contained .cjs — no node_modules, run it \" +\n \"with a system node (dist/<package name>.cjs)\",\n },\n {\n name: \"--sea\",\n description:\n \"Also produce a single executable (Node SEA): one file that runs \" +\n \"with no node_modules and no system Node — at the cost of \" +\n \"carrying a whole Node binary (~120 MB)\",\n },\n {\n name: \"--sea-output <path>\",\n description:\n \"Where to write the --sea / --standalone artifact \" +\n \"(default: dist/<package name>[.cjs])\",\n },\n ],\n func: buildLinux,\n },\n]\n"]}
|
|
@@ -38,7 +38,7 @@ export const buildGtkxConfigModule = async (appRoot) => {
|
|
|
38
38
|
throw new Error("gtkx.config.ts `elements.behaviors` is not supported on the linux " +
|
|
39
39
|
"platform — react-native-gtkx owns element behaviors.");
|
|
40
40
|
}
|
|
41
|
-
const lazyElements = Object.fromEntries(config.lazyElements.map((type) => [type, {
|
|
41
|
+
const lazyElements = Object.fromEntries(config.lazyElements.map((type) => [type, { isLazy: true }]));
|
|
42
42
|
return [
|
|
43
43
|
`export * from "@gtkx/jsx/metadata";`,
|
|
44
44
|
`export const applicationId = ${JSON.stringify(config.applicationId)};`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gtkx-config-module.js","sourceRoot":"","sources":["../../src/sea/gtkx-config-module.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,wEAAwE;AACxE,0EAA0E;AAC1E,mEAAmE;AACnE,mEAAmE;AACnE,qEAAqE;AACrE,mEAAmE;AACnE,0EAA0E;AAC1E,yEAAyE;AACzE,EAAE;AACF,mEAAmE;AACnE,sEAAsE;AACtE,0EAA0E;AAC1E,yEAAyE;AACzE,yEAAyE;AACzE,oEAAoE;AACpE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAG1D,MAAM,CAAC,MAAM,eAAe,GAC1B,mEAAmE;IACnE,4EAA4E,CAAA;AAE9E;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,KAAK,EACxC,O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BAAsB,CAAC,CAAA;IACtD,OAAO;QACL,IAAI,EAAE,qBAAqB;QAC3B,SAAS,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,KAAK,qBAAqB,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC;QAC3E,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC;KACtD,CAAA;AACH,CAAC,CAAA","sourcesContent":["// @gtkx/react imports the bare specifier \"virtual:gtkx-config\" for JSX\n// metadata plus the app's applicationId/userEventSignals/lazy elements.\n// runner/host.ts resolves it at every process start through a loader hook\n// (registerHooks), reading gtkx.config.ts from the current working\n// directory. A SEA has no \"app root\" to read a config file from at\n// runtime — there is no cwd convention once the app is a single file\n// copied anywhere — so this bakes the same values in at BUILD time\n// instead, the same way the vite path already does (its CLI plugin serves\n// virtual:gtkx-config from the build-time config, never a runtime read).\n//\n// Deliberately duplicated validation logic rather than shared with\n// host.ts: see host-dev.ts's header comment for why the hosts in this\n// package are self-contained twins rather than sharing relative imports —\n// this is a third twin, for the same reason (host.ts must keep resolving\n// its config at runtime for ordinary `run-linux`/installed-app use; this\n// one resolves it once, at bundle time, for the SEA artifact only).\nimport { join } from \"node:path\"\nimport { createConfigLoader } from \"@gtkx/config/internal\"\nimport type { Plugin } from \"rolldown\"\n\nexport const CONFIG_REQUIRED =\n \"gtkx.config.ts with an applicationId is required in the app root \" +\n '(export default defineConfig({ applicationId: \"...\", libraries: [...] })).'\n\n/**\n * Loads and validates the app's gtkx.config.ts, returning the source of a\n * virtual:gtkx-config module with the resolved values baked in as literals.\n */\nexport const buildGtkxConfigModule = async (\n appRoot: string,\n): Promise<string> => {\n const loader = createConfigLoader()\n const config = await loader.resolve(appRoot).catch((error: unknown) => {\n throw new Error(`${CONFIG_REQUIRED}\\n${String(error)}`)\n })\n if (!config.applicationId) {\n throw new Error(CONFIG_REQUIRED)\n }\n // A behaviors module would have to be bundled and merged through\n // @gtkx/react/config; the react-native surface owns element behaviors,\n // so no app declares one — refuse rather than silently drop it (mirrors\n // host.ts's runtime check).\n if (config.elements !== null) {\n throw new Error(\n \"gtkx.config.ts `elements.behaviors` is not supported on the linux \" +\n \"platform — react-native-gtkx owns element behaviors.\",\n )\n }\n const lazyElements = Object.fromEntries(\n config.lazyElements.map((type) => [type, { isLazy: true }]),\n )\n return [\n `export * from \"@gtkx/jsx/metadata\";`,\n `export const applicationId = ${JSON.stringify(config.applicationId)};`,\n `export const userEventSignals = ${JSON.stringify(config.userEventSignals)};`,\n `export const elements = ${JSON.stringify(lazyElements)};`,\n ].join(\"\\n\")\n}\n\n/**\n * Resolves the bare \"virtual:gtkx-config\" specifier @gtkx/react imports to\n * the module source built by {@link buildGtkxConfigModule}, so the bundler\n * can inline it like any other static import — no runtime loader hook\n * needed.\n *\n * The module is given an id inside `appRoot` rather than a `\\0`-prefixed\n * virtual one because it re-exports \"@gtkx/jsx/metadata\": that bare\n * specifier needs a real directory to resolve from.\n */\nexport const virtualConfigModulePlugin = (\n moduleSource: string,\n appRoot: string,\n): Plugin => {\n const configId = join(appRoot, \"__gtkx-sea-config.js\")\n return {\n name: \"gtkx-virtual-config\",\n resolveId: (source) => (source === \"virtual:gtkx-config\" ? configId : null),\n load: (id) => (id === configId ? moduleSource : null),\n }\n}\n"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type InsetProperty = "top" | "bottom" | "left" | "right";
|
|
2
|
+
export declare const INSET_PROPERTIES: readonly InsetProperty[];
|
|
3
|
+
export type InsetTranslation = {
|
|
4
|
+
/** The transform slot this inset is expressed as. */
|
|
5
|
+
transform: "translateX" | "translateY";
|
|
6
|
+
/**
|
|
7
|
+
* How the inset's delta maps onto that slot. `right` and `bottom` measure
|
|
8
|
+
* INWARD from the opposite edge, so a larger value moves the node the other
|
|
9
|
+
* way.
|
|
10
|
+
*/
|
|
11
|
+
sign: 1 | -1;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Whether animating `property` on `style` is exactly a translation, and which
|
|
15
|
+
* one. Returns null when it is not — the caller must then keep slice 2's
|
|
16
|
+
* refusal, unweakened.
|
|
17
|
+
*
|
|
18
|
+
* `style` is the FLATTENED style of the node itself: `position` is the node's
|
|
19
|
+
* own resolved value, never an ancestor's.
|
|
20
|
+
*/
|
|
21
|
+
export declare const insetTranslation: (style: Readonly<Record<string, unknown>>, property: InsetProperty) => InsetTranslation | null;
|
|
22
|
+
/**
|
|
23
|
+
* Why an inset on an ALREADY absolutely-positioned node still could not be
|
|
24
|
+
* translated — the sentence a warning needs, or null when it can be.
|
|
25
|
+
*/
|
|
26
|
+
export declare const insetRefusalReason: (style: Readonly<Record<string, unknown>>, property: InsetProperty) => string | null;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
// The one layout case that has an exact transform equivalent.
|
|
2
|
+
//
|
|
3
|
+
// `width`, `flex`, `margin` and `padding` change what the SIBLINGS get, so
|
|
4
|
+
// animating them needs a Yoga pass and is refused by measurement
|
|
5
|
+
// (docs/research/animated-colors.md §4). An inset on a node whose own
|
|
6
|
+
// `position` is `"absolute"` is different in kind: the node is out of flow, so
|
|
7
|
+
// moving it changes nothing but where it is drawn — and "draw it somewhere
|
|
8
|
+
// else" is exactly what the transform path already does, at 0.12 µs instead
|
|
9
|
+
// of 63.9–496.3 µs.
|
|
10
|
+
//
|
|
11
|
+
// The equivalence is NOT universal across the four insets, and the shape of
|
|
12
|
+
// the exception was measured rather than assumed (Yoga 3, our own tree, the
|
|
13
|
+
// table in docs/research/absolute-insets.md):
|
|
14
|
+
//
|
|
15
|
+
// top only, +40 → moved (0, +40), size unchanged
|
|
16
|
+
// left only, +40 → moved (+40, 0), size unchanged
|
|
17
|
+
// right only, +40 → moved (-40, 0), size unchanged
|
|
18
|
+
// bottom only, +40 → moved (0, -40), size unchanged
|
|
19
|
+
// left+right, no width, left +40 → moved (+40, 0), width -40 ← a RESIZE
|
|
20
|
+
// top+bottom, no height, top +40 → moved (0, +40), height -40 ← a RESIZE
|
|
21
|
+
// left+right, width 80, left +40 → moved (+40, 0), size unchanged
|
|
22
|
+
// left+right, width 80, right+40 → did not move at all ← IGNORED
|
|
23
|
+
//
|
|
24
|
+
// So: an inset is a pure translation when its axis is anchored by ONE edge.
|
|
25
|
+
// When both edges are set the axis has two anchors, and Yoga either stretches
|
|
26
|
+
// between them (no explicit size) or honours the start edge and drops the end
|
|
27
|
+
// one (explicit size). Neither is a translation, and translating anyway would
|
|
28
|
+
// produce motion a real layout pass would not — the failure this module
|
|
29
|
+
// exists to refuse.
|
|
30
|
+
//
|
|
31
|
+
// The engine lays out `Direction.LTR` unconditionally (layout/engine.ts), so
|
|
32
|
+
// `left` is always the start edge and there is no RTL case to fold in here.
|
|
33
|
+
export const INSET_PROPERTIES = [
|
|
34
|
+
"top",
|
|
35
|
+
"bottom",
|
|
36
|
+
"left",
|
|
37
|
+
"right",
|
|
38
|
+
];
|
|
39
|
+
const AXIS = {
|
|
40
|
+
top: {
|
|
41
|
+
transform: "translateY",
|
|
42
|
+
sign: 1,
|
|
43
|
+
opposite: "bottom",
|
|
44
|
+
size: "height",
|
|
45
|
+
start: true,
|
|
46
|
+
},
|
|
47
|
+
bottom: {
|
|
48
|
+
transform: "translateY",
|
|
49
|
+
sign: -1,
|
|
50
|
+
opposite: "top",
|
|
51
|
+
size: "height",
|
|
52
|
+
start: false,
|
|
53
|
+
},
|
|
54
|
+
left: {
|
|
55
|
+
transform: "translateX",
|
|
56
|
+
sign: 1,
|
|
57
|
+
opposite: "right",
|
|
58
|
+
size: "width",
|
|
59
|
+
start: true,
|
|
60
|
+
},
|
|
61
|
+
right: {
|
|
62
|
+
transform: "translateX",
|
|
63
|
+
sign: -1,
|
|
64
|
+
opposite: "left",
|
|
65
|
+
size: "width",
|
|
66
|
+
start: false,
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
const isDefinite = (value) => value !== undefined && value !== null && value !== "auto";
|
|
70
|
+
/**
|
|
71
|
+
* Whether animating `property` on `style` is exactly a translation, and which
|
|
72
|
+
* one. Returns null when it is not — the caller must then keep slice 2's
|
|
73
|
+
* refusal, unweakened.
|
|
74
|
+
*
|
|
75
|
+
* `style` is the FLATTENED style of the node itself: `position` is the node's
|
|
76
|
+
* own resolved value, never an ancestor's.
|
|
77
|
+
*/
|
|
78
|
+
export const insetTranslation = (style, property) => {
|
|
79
|
+
if (style.position !== "absolute") {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
const axis = AXIS[property];
|
|
83
|
+
if (!isDefinite(style[axis.opposite])) {
|
|
84
|
+
return { transform: axis.transform, sign: axis.sign };
|
|
85
|
+
}
|
|
86
|
+
// Both edges are set. Without an explicit size the node stretches between
|
|
87
|
+
// them, so the inset resizes it; with one, Yoga honours the start edge and
|
|
88
|
+
// ignores the end edge entirely.
|
|
89
|
+
if (!axis.start || !isDefinite(style[axis.size])) {
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
return { transform: axis.transform, sign: axis.sign };
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* Why an inset on an ALREADY absolutely-positioned node still could not be
|
|
96
|
+
* translated — the sentence a warning needs, or null when it can be.
|
|
97
|
+
*/
|
|
98
|
+
export const insetRefusalReason = (style, property) => {
|
|
99
|
+
if (style.position !== "absolute") {
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
if (insetTranslation(style, property) !== null) {
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
const axis = AXIS[property];
|
|
106
|
+
if (axis.start) {
|
|
107
|
+
return (`both \`${property}\` and \`${axis.opposite}\` are set with no \`${axis.size}\`, so the node is ` +
|
|
108
|
+
`stretched between the two edges and changing one RESIZES it rather than moving it`);
|
|
109
|
+
}
|
|
110
|
+
return (`\`${axis.opposite}\` is set as well, and with a definite \`${axis.size}\` Yoga honours the start ` +
|
|
111
|
+
`edge and ignores \`${property}\` — so there is no movement to reproduce`);
|
|
112
|
+
};
|
|
113
|
+
//# sourceMappingURL=absolute-insets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"absolute-insets.js","sourceRoot":"","sources":["../../src/style/absolute-insets.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,EAAE;AACF,2EAA2E;AAC3E,iEAAiE;AACjE,sEAAsE;AACtE,+EAA+E;AAC/E,2EAA2E;AAC3E,4EAA4E;AAC5E,oBAAoB;AACpB,EAAE;AACF,4EAA4E;AAC5E,4EAA4E;AAC5E,8CAA8C;AAC9C,EAAE;AACF,oEAAoE;AACpE,oEAAoE;AACpE,oEAAoE;AACpE,oEAAoE;AACpE,4EAA4E;AAC5E,4EAA4E;AAC5E,oEAAoE;AACpE,2EAA2E;AAC3E,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,8EAA8E;AAC9E,8EAA8E;AAC9E,wEAAwE;AACxE,oBAAoB;AACpB,EAAE;AACF,6EAA6E;AAC7E,4EAA4E;AAI5E,MAAM,CAAC,MAAM,gBAAgB,GAA6B;IACxD,KAAK;IACL,QAAQ;IACR,MAAM;IACN,OAAO;CACR,CAAA;AAsBD,MAAM,IAAI,GAAoC;IAC5C,GAAG,EAAE;QACH,SAAS,EAAE,YAAY;QACvB,IAAI,EAAE,CAAC;QACP,QAAQ,EAAE,QAAQ;QAClB,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,IAAI;KACZ;IACD,MAAM,EAAE;QACN,SAAS,EAAE,YAAY;QACvB,IAAI,EAAE,CAAC,CAAC;QACR,QAAQ,EAAE,KAAK;QACf,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,KAAK;KACb;IACD,IAAI,EAAE;QACJ,SAAS,EAAE,YAAY;QACvB,IAAI,EAAE,CAAC;QACP,QAAQ,EAAE,OAAO;QACjB,IAAI,EAAE,OAAO;QACb,KAAK,EAAE,IAAI;KACZ;IACD,K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AE,QAAQ,CAAC,KAAK,IAAI,EAAE,CAAC;QAC/C,OAAO,IAAI,CAAA;IACb,CAAC;IACD,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAA;IAC3B,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;QACf,OAAO,CACL,UAAU,QAAQ,YAAY,IAAI,CAAC,QAAQ,wBAAwB,IAAI,CAAC,IAAI,qBAAqB;YACjG,mFAAmF,CACpF,CAAA;IACH,CAAC;IACD,OAAO,CACL,KAAK,IAAI,CAAC,QAAQ,4CAA4C,IAAI,CAAC,IAAI,4BAA4B;QACnG,sBAAsB,QAAQ,2CAA2C,CAC1E,CAAA;AACH,CAAC,CAAA","sourcesContent":["// The one layout case that has an exact transform equivalent.\n//\n// `width`, `flex`, `margin` and `padding` change what the SIBLINGS get, so\n// animating them needs a Yoga pass and is refused by measurement\n// (docs/research/animated-colors.md §4). An inset on a node whose own\n// `position` is `\"absolute\"` is different in kind: the node is out of flow, so\n// moving it changes nothing but where it is drawn — and \"draw it somewhere\n// else\" is exactly what the transform path already does, at 0.12 µs instead\n// of 63.9–496.3 µs.\n//\n// The equivalence is NOT universal across the four insets, and the shape of\n// the exception was measured rather than assumed (Yoga 3, our own tree, the\n// table in docs/research/absolute-insets.md):\n//\n// top only, +40 → moved (0, +40), size unchanged\n// left only, +40 → moved (+40, 0), size unchanged\n// right only, +40 → moved (-40, 0), size unchanged\n// bottom only, +40 → moved (0, -40), size unchanged\n// left+right, no width, left +40 → moved (+40, 0), width -40 ← a RESIZE\n// top+bottom, no height, top +40 → moved (0, +40), height -40 ← a RESIZE\n// left+right, width 80, left +40 → moved (+40, 0), size unchanged\n// left+right, width 80, right+40 → did not move at all ← IGNORED\n//\n// So: an inset is a pure translation when its axis is anchored by ONE edge.\n// When both edges are set the axis has two anchors, and Yoga either stretches\n// between them (no explicit size) or honours the start edge and drops the end\n// one (explicit size). Neither is a translation, and translating anyway would\n// produce motion a real layout pass would not — the failure this module\n// exists to refuse.\n//\n// The engine lays out `Direction.LTR` unconditionally (layout/engine.ts), so\n// `left` is always the start edge and there is no RTL case to fold in here.\n\nexport type InsetProperty = \"top\" | \"bottom\" | \"left\" | \"right\"\n\nexport const INSET_PROPERTIES: readonly InsetProperty[] = [\n \"top\",\n \"bottom\",\n \"left\",\n \"right\",\n]\n\nexport type InsetTranslation = {\n /** The transform slot this inset is expressed as. */\n transform: \"translateX\" | \"translateY\"\n /**\n * How the inset's delta maps onto that slot. `right` and `bottom` measure\n * INWARD from the opposite edge, so a larger value moves the node the other\n * way.\n */\n sign: 1 | -1\n}\n\ntype AxisSpec = InsetTranslation & {\n /** The other inset on the same axis. */\n opposite: InsetProperty\n /** The size property that decides the axis when both edges are set. */\n size: \"width\" | \"height\"\n /** Whether this is the edge Yoga honours when both are set with a size. */\n start: boolean\n}\n\nconst AXIS: Record<InsetProperty, AxisSpec> = {\n top: {\n transform: \"translateY\",\n sign: 1,\n opposite: \"bottom\",\n size: \"height\",\n start: true,\n },\n bottom: {\n transform: \"translateY\",\n sign: -1,\n opposite: \"top\",\n size: \"height\",\n start: false,\n },\n left: {\n transform: \"translateX\",\n sign: 1,\n opposite: \"right\",\n size: \"width\",\n start: true,\n },\n right: {\n transform: \"translateX\",\n sign: -1,\n opposite: \"left\",\n size: \"width\",\n start: false,\n },\n}\n\nconst isDefinite = (value: unknown): boolean =>\n value !== undefined && value !== null && value !== \"auto\"\n\n/**\n * Whether animating `property` on `style` is exactly a translation, and which\n * one. Returns null when it is not — the caller must then keep slice 2's\n * refusal, unweakened.\n *\n * `style` is the FLATTENED style of the node itself: `position` is the node's\n * own resolved value, never an ancestor's.\n */\nexport const insetTranslation = (\n style: Readonly<Record<string, unknown>>,\n property: InsetProperty,\n): InsetTranslation | null => {\n if (style.position !== \"absolute\") {\n return null\n }\n const axis = AXIS[property]\n if (!isDefinite(style[axis.opposite])) {\n return { transform: axis.transform, sign: axis.sign }\n }\n // Both edges are set. Without an explicit size the node stretches between\n // them, so the inset resizes it; with one, Yoga honours the start edge and\n // ignores the end edge entirely.\n if (!axis.start || !isDefinite(style[axis.size])) {\n return null\n }\n return { transform: axis.transform, sign: axis.sign }\n}\n\n/**\n * Why an inset on an ALREADY absolutely-positioned node still could not be\n * translated — the sentence a warning needs, or null when it can be.\n */\nexport const insetRefusalReason = (\n style: Readonly<Record<string, unknown>>,\n property: InsetProperty,\n): string | null => {\n if (style.position !== \"absolute\") {\n return null\n }\n if (insetTranslation(style, property) !== null) {\n return null\n }\n const axis = AXIS[property]\n if (axis.start) {\n return (\n `both \\`${property}\\` and \\`${axis.opposite}\\` are set with no \\`${axis.size}\\`, so the node is ` +\n `stretched between the two edges and changing one RESIZES it rather than moving it`\n )\n }\n return (\n `\\`${axis.opposite}\\` is set as well, and with a definite \\`${axis.size}\\` Yoga honours the start ` +\n `edge and ignores \\`${property}\\` — so there is no movement to reproduce`\n )\n}\n"]}
|