react-native-gtkx 0.2.0-alpha.1 → 0.3.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -2
- package/dist/adw/widgets.generated.d.ts +4 -4
- package/dist/adw/widgets.generated.js +51 -51
- package/dist/adw/widgets.generated.js.map +1 -1
- package/dist/aliases/index.d.ts +84 -0
- package/dist/aliases/index.js +208 -0
- package/dist/aliases/index.js.map +1 -0
- package/dist/animated/create-animated.d.ts +2 -0
- package/dist/animated/create-animated.js +2 -0
- package/dist/animated/create-animated.js.map +1 -1
- package/dist/animated/index.d.ts +4 -0
- package/dist/animated/index.js +6 -0
- package/dist/animated/index.js.map +1 -1
- package/dist/animated/types.d.ts +1 -0
- package/dist/animated/types.js.map +1 -1
- package/dist/animated/value-animation.js +17 -4
- package/dist/animated/value-animation.js.map +1 -1
- package/dist/animated/value-xy.d.ts +41 -0
- package/dist/animated/value-xy.js +90 -0
- package/dist/animated/value-xy.js.map +1 -0
- package/dist/animated/value.d.ts +9 -0
- package/dist/animated/value.js +30 -2
- package/dist/animated/value.js.map +1 -1
- package/dist/apis/host.gtkx.js +9 -12
- package/dist/apis/host.gtkx.js.map +1 -1
- package/dist/apis/index.d.ts +4 -2
- package/dist/apis/index.js +2 -0
- package/dist/apis/index.js.map +1 -1
- package/dist/apis/keyboard.d.ts +60 -0
- package/dist/apis/keyboard.js +63 -0
- package/dist/apis/keyboard.js.map +1 -0
- package/dist/apis/log-box.d.ts +15 -0
- package/dist/apis/log-box.js +46 -0
- package/dist/apis/log-box.js.map +1 -0
- package/dist/apis/platform.d.ts +18 -1
- package/dist/apis/platform.js.map +1 -1
- package/dist/common/icon.d.ts +23 -0
- package/dist/common/icon.js +14 -0
- package/dist/common/icon.js.map +1 -0
- package/dist/common/index.d.ts +1 -0
- package/dist/common/index.js +25 -0
- package/dist/common/index.js.map +1 -1
- package/dist/common/widget.d.ts +1 -22
- package/dist/common/widget.js +75 -8
- package/dist/common/widget.js.map +1 -1
- package/dist/components/animated.d.ts +73 -7
- package/dist/components/animated.js +560 -45
- package/dist/components/animated.js.map +1 -1
- package/dist/components/app-registry.d.ts +26 -0
- package/dist/components/app-registry.js.map +1 -1
- package/dist/components/driven-size.d.ts +27 -0
- package/dist/components/driven-size.js +85 -0
- package/dist/components/driven-size.js.map +1 -0
- package/dist/components/find-node-handle.d.ts +11 -0
- package/dist/components/find-node-handle.js +53 -0
- package/dist/components/find-node-handle.js.map +1 -0
- package/dist/components/flat-list.d.ts +3 -2
- package/dist/components/flat-list.js.map +1 -1
- package/dist/components/frame-scheduler.d.ts +16 -0
- package/dist/components/frame-scheduler.js +37 -0
- package/dist/components/frame-scheduler.js.map +1 -0
- package/dist/components/host-node.d.ts +7 -0
- package/dist/components/host-node.js +26 -1
- package/dist/components/host-node.js.map +1 -1
- package/dist/components/image.d.ts +6 -1
- package/dist/components/image.js +15 -4
- package/dist/components/image.js.map +1 -1
- package/dist/components/index.d.ts +11 -5
- package/dist/components/index.js +7 -4
- package/dist/components/index.js.map +1 -1
- package/dist/components/measure.d.ts +63 -0
- package/dist/components/measure.js +150 -0
- package/dist/components/measure.js.map +1 -0
- package/dist/components/modal.d.ts +1 -1
- package/dist/components/press-event.d.ts +28 -0
- package/dist/components/press-event.js +46 -0
- package/dist/components/press-event.js.map +1 -0
- package/dist/components/pressable.d.ts +63 -7
- package/dist/components/pressable.js +165 -12
- package/dist/components/pressable.js.map +1 -1
- package/dist/components/rect-store.d.ts +58 -0
- package/dist/components/rect-store.js +124 -3
- package/dist/components/rect-store.js.map +1 -1
- package/dist/components/root.js +6 -1
- package/dist/components/root.js.map +1 -1
- package/dist/components/scroll-phase.d.ts +35 -0
- package/dist/components/scroll-phase.js +26 -0
- package/dist/components/scroll-phase.js.map +1 -0
- package/dist/components/scroll-view.d.ts +43 -3
- package/dist/components/scroll-view.js +386 -45
- package/dist/components/scroll-view.js.map +1 -1
- package/dist/components/text-input.js +9 -25
- package/dist/components/text-input.js.map +1 -1
- package/dist/components/text.d.ts +6 -2
- package/dist/components/text.js +68 -9
- package/dist/components/text.js.map +1 -1
- package/dist/components/use-focus.d.ts +27 -0
- package/dist/components/use-focus.js +116 -0
- package/dist/components/use-focus.js.map +1 -0
- package/dist/components/use-layout-child.d.ts +13 -1
- package/dist/components/use-layout-child.js +205 -19
- package/dist/components/use-layout-child.js.map +1 -1
- package/dist/components/view.d.ts +12 -4
- package/dist/components/view.js +25 -14
- package/dist/components/view.js.map +1 -1
- package/dist/components/virtualized-list.d.ts +45 -5
- package/dist/components/virtualized-list.js +90 -24
- package/dist/components/virtualized-list.js.map +1 -1
- package/dist/components/wheel-scroll-session.d.ts +7 -0
- package/dist/components/wheel-scroll-session.js +53 -0
- package/dist/components/wheel-scroll-session.js.map +1 -0
- package/dist/components/widget-retention.d.ts +35 -0
- package/dist/components/widget-retention.js +169 -0
- package/dist/components/widget-retention.js.map +1 -0
- package/dist/contracts.d.ts +23 -3
- package/dist/contracts.js.map +1 -1
- package/dist/dnd/context.d.ts +69 -0
- package/dist/dnd/context.js +149 -0
- package/dist/dnd/context.js.map +1 -0
- package/dist/dnd/draggable.d.ts +59 -0
- package/dist/dnd/draggable.js +149 -0
- package/dist/dnd/draggable.js.map +1 -0
- package/dist/dnd/droppable.d.ts +24 -0
- package/dist/dnd/droppable.js +74 -0
- package/dist/dnd/droppable.js.map +1 -0
- package/dist/dnd/gtk-controllers.d.ts +39 -0
- package/dist/dnd/gtk-controllers.js +110 -0
- package/dist/dnd/gtk-controllers.js.map +1 -0
- package/dist/dnd/index.d.ts +6 -0
- package/dist/dnd/index.js +31 -0
- package/dist/dnd/index.js.map +1 -0
- package/dist/dnd/order.d.ts +7 -0
- package/dist/dnd/order.js +20 -0
- package/dist/dnd/order.js.map +1 -0
- package/dist/dnd/payload.d.ts +14 -0
- package/dist/dnd/payload.js +41 -0
- package/dist/dnd/payload.js.map +1 -0
- package/dist/dnd/sortable.d.ts +49 -0
- package/dist/dnd/sortable.js +307 -0
- package/dist/dnd/sortable.js.map +1 -0
- package/dist/dnd/types.d.ts +290 -0
- package/dist/dnd/types.js +25 -0
- package/dist/dnd/types.js.map +1 -0
- package/dist/gesture-handler-compat/builder.d.ts +251 -0
- package/dist/gesture-handler-compat/builder.js +513 -0
- package/dist/gesture-handler-compat/builder.js.map +1 -0
- package/dist/gesture-handler-compat/composition.d.ts +23 -0
- package/dist/gesture-handler-compat/composition.js +111 -0
- package/dist/gesture-handler-compat/composition.js.map +1 -0
- package/dist/gesture-handler-compat/deciders.d.ts +3 -0
- package/dist/gesture-handler-compat/deciders.js +47 -0
- package/dist/gesture-handler-compat/deciders.js.map +1 -0
- package/dist/gesture-handler-compat/detector-runtime.d.ts +44 -0
- package/dist/gesture-handler-compat/detector-runtime.js +374 -0
- package/dist/gesture-handler-compat/detector-runtime.js.map +1 -0
- package/dist/gesture-handler-compat/detector.d.ts +22 -0
- package/dist/gesture-handler-compat/detector.js +104 -0
- package/dist/gesture-handler-compat/detector.js.map +1 -0
- package/dist/gesture-handler-compat/fling.d.ts +24 -0
- package/dist/gesture-handler-compat/fling.js +123 -0
- package/dist/gesture-handler-compat/fling.js.map +1 -0
- package/dist/gesture-handler-compat/force-touch.d.ts +13 -0
- package/dist/gesture-handler-compat/force-touch.js +40 -0
- package/dist/gesture-handler-compat/force-touch.js.map +1 -0
- package/dist/gesture-handler-compat/hooks.d.ts +157 -0
- package/dist/gesture-handler-compat/hooks.js +268 -0
- package/dist/gesture-handler-compat/hooks.js.map +1 -0
- package/dist/gesture-handler-compat/hover.d.ts +2 -0
- package/dist/gesture-handler-compat/hover.js +22 -0
- package/dist/gesture-handler-compat/hover.js.map +1 -0
- package/dist/gesture-handler-compat/index.d.ts +98 -0
- package/dist/gesture-handler-compat/index.js +255 -0
- package/dist/gesture-handler-compat/index.js.map +1 -0
- package/dist/gesture-handler-compat/long-press.d.ts +6 -0
- package/dist/gesture-handler-compat/long-press.js +21 -0
- package/dist/gesture-handler-compat/long-press.js.map +1 -0
- package/dist/gesture-handler-compat/manual.d.ts +2 -0
- package/dist/gesture-handler-compat/manual.js +18 -0
- package/dist/gesture-handler-compat/manual.js.map +1 -0
- package/dist/gesture-handler-compat/native.d.ts +7 -0
- package/dist/gesture-handler-compat/native.js +34 -0
- package/dist/gesture-handler-compat/native.js.map +1 -0
- package/dist/gesture-handler-compat/orchestrator.d.ts +77 -0
- package/dist/gesture-handler-compat/orchestrator.js +284 -0
- package/dist/gesture-handler-compat/orchestrator.js.map +1 -0
- package/dist/gesture-handler-compat/pan.d.ts +23 -0
- package/dist/gesture-handler-compat/pan.js +116 -0
- package/dist/gesture-handler-compat/pan.js.map +1 -0
- package/dist/gesture-handler-compat/recognizer.d.ts +268 -0
- package/dist/gesture-handler-compat/recognizer.js +1056 -0
- package/dist/gesture-handler-compat/recognizer.js.map +1 -0
- package/dist/gesture-handler-compat/relations.d.ts +43 -0
- package/dist/gesture-handler-compat/relations.js +128 -0
- package/dist/gesture-handler-compat/relations.js.map +1 -0
- package/dist/gesture-handler-compat/tap.d.ts +6 -0
- package/dist/gesture-handler-compat/tap.js +29 -0
- package/dist/gesture-handler-compat/tap.js.map +1 -0
- package/dist/gesture-handler-compat/touchpad.d.ts +41 -0
- package/dist/gesture-handler-compat/touchpad.js +64 -0
- package/dist/gesture-handler-compat/touchpad.js.map +1 -0
- package/dist/gesture-handler-compat/types.d.ts +441 -0
- package/dist/gesture-handler-compat/types.js +167 -0
- package/dist/gesture-handler-compat/types.js.map +1 -0
- package/dist/gtk/controllers.d.ts +39 -0
- package/dist/gtk/controllers.js +92 -0
- package/dist/gtk/controllers.js.map +1 -0
- package/dist/gtk/index.d.ts +3 -1
- package/dist/gtk/index.js +14 -1
- package/dist/gtk/index.js.map +1 -1
- package/dist/gtk/widgets.generated.d.ts +14 -14
- package/dist/gtk/widgets.generated.js +101 -102
- package/dist/gtk/widgets.generated.js.map +1 -1
- package/dist/gtk/window-actions.d.ts +77 -0
- package/dist/gtk/window-actions.js +193 -0
- package/dist/gtk/window-actions.js.map +1 -0
- package/dist/gtkx/bridge/geometry.d.ts +15 -0
- package/dist/gtkx/bridge/geometry.js +40 -0
- package/dist/gtkx/bridge/geometry.js.map +1 -0
- package/dist/gtkx/bridge/index.d.ts +7 -3
- package/dist/gtkx/bridge/index.js +12 -4
- package/dist/gtkx/bridge/index.js.map +1 -1
- package/dist/gtkx/bridge/slot-portal.d.ts +12 -0
- package/dist/gtkx/bridge/slot-portal.js +17 -0
- package/dist/gtkx/bridge/slot-portal.js.map +1 -0
- package/dist/gtkx/bridge/svg-node.js +10 -54
- package/dist/gtkx/bridge/svg-node.js.map +1 -1
- package/dist/gtkx/bridge/use-signal.js +2 -2
- package/dist/gtkx/bridge/use-signal.js.map +1 -1
- package/dist/gtkx/bridge/view-box.d.ts +56 -0
- package/dist/gtkx/bridge/view-box.js +394 -9
- package/dist/gtkx/bridge/view-box.js.map +1 -1
- package/dist/gtkx/bridge/widget-css.d.ts +17 -0
- package/dist/gtkx/bridge/widget-css.js +72 -0
- package/dist/gtkx/bridge/widget-css.js.map +1 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/layout/driven-size.d.ts +12 -0
- package/dist/layout/driven-size.js +70 -0
- package/dist/layout/driven-size.js.map +1 -0
- package/dist/layout/engine.d.ts +17 -1
- package/dist/layout/engine.js +3 -20
- package/dist/layout/engine.js.map +1 -1
- package/dist/layout/node.d.ts +13 -0
- package/dist/layout/node.js +14 -0
- package/dist/layout/node.js.map +1 -1
- package/dist/layout/yoga.d.ts +3 -2
- package/dist/layout/yoga.js +5 -2
- package/dist/layout/yoga.js.map +1 -1
- package/dist/mcp/data/generated.d.ts +310 -91
- package/dist/mcp/data/generated.js +365 -90
- package/dist/mcp/data/generated.js.map +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/mcp/server.js.map +1 -1
- package/dist/metro/index.d.ts +10 -0
- package/dist/metro/index.js +21 -12
- package/dist/metro/index.js.map +1 -1
- package/dist/navigation/sidebar.d.ts +47 -1
- package/dist/navigation/sidebar.js +77 -3
- package/dist/navigation/sidebar.js.map +1 -1
- package/dist/reanimated-compat/animated-ref.d.ts +32 -0
- package/dist/reanimated-compat/animated-ref.js +57 -0
- package/dist/reanimated-compat/animated-ref.js.map +1 -0
- package/dist/reanimated-compat/animation.d.ts +177 -0
- package/dist/reanimated-compat/animation.js +540 -0
- package/dist/reanimated-compat/animation.js.map +1 -0
- package/dist/reanimated-compat/color.d.ts +28 -0
- package/dist/reanimated-compat/color.js +249 -0
- package/dist/reanimated-compat/color.js.map +1 -0
- package/dist/reanimated-compat/decay.d.ts +39 -0
- package/dist/reanimated-compat/decay.js +96 -0
- package/dist/reanimated-compat/decay.js.map +1 -0
- package/dist/reanimated-compat/easing.d.ts +30 -0
- package/dist/reanimated-compat/easing.js +76 -0
- package/dist/reanimated-compat/easing.js.map +1 -0
- package/dist/reanimated-compat/hooks.d.ts +14 -0
- package/dist/reanimated-compat/hooks.js +217 -0
- package/dist/reanimated-compat/hooks.js.map +1 -0
- package/dist/reanimated-compat/index.d.ts +258 -0
- package/dist/reanimated-compat/index.js +464 -0
- package/dist/reanimated-compat/index.js.map +1 -0
- package/dist/reanimated-compat/interpolation.d.ts +18 -0
- package/dist/reanimated-compat/interpolation.js +122 -0
- package/dist/reanimated-compat/interpolation.js.map +1 -0
- package/dist/reanimated-compat/layout-animation-config.d.ts +43 -0
- package/dist/reanimated-compat/layout-animation-config.js +78 -0
- package/dist/reanimated-compat/layout-animation-config.js.map +1 -0
- package/dist/reanimated-compat/layout-animation-presets.d.ts +117 -0
- package/dist/reanimated-compat/layout-animation-presets.js +498 -0
- package/dist/reanimated-compat/layout-animation-presets.js.map +1 -0
- package/dist/reanimated-compat/layout-animation-runtime.d.ts +21 -0
- package/dist/reanimated-compat/layout-animation-runtime.js +311 -0
- package/dist/reanimated-compat/layout-animation-runtime.js.map +1 -0
- package/dist/reanimated-compat/layout-animation-view.d.ts +27 -0
- package/dist/reanimated-compat/layout-animation-view.js +266 -0
- package/dist/reanimated-compat/layout-animation-view.js.map +1 -0
- package/dist/reanimated-compat/layout-animation.d.ts +171 -0
- package/dist/reanimated-compat/layout-animation.js +469 -0
- package/dist/reanimated-compat/layout-animation.js.map +1 -0
- package/dist/reanimated-compat/layout-transitions.d.ts +83 -0
- package/dist/reanimated-compat/layout-transitions.js +350 -0
- package/dist/reanimated-compat/layout-transitions.js.map +1 -0
- package/dist/reanimated-compat/mutable.d.ts +29 -0
- package/dist/reanimated-compat/mutable.js +139 -0
- package/dist/reanimated-compat/mutable.js.map +1 -0
- package/dist/reanimated-compat/props.d.ts +18 -0
- package/dist/reanimated-compat/props.js +111 -0
- package/dist/reanimated-compat/props.js.map +1 -0
- package/dist/reanimated-compat/scroll-handler.d.ts +119 -0
- package/dist/reanimated-compat/scroll-handler.js +274 -0
- package/dist/reanimated-compat/scroll-handler.js.map +1 -0
- package/dist/reanimated-compat/scroll-offset.d.ts +12 -0
- package/dist/reanimated-compat/scroll-offset.js +104 -0
- package/dist/reanimated-compat/scroll-offset.js.map +1 -0
- package/dist/reanimated-compat/style.d.ts +90 -0
- package/dist/reanimated-compat/style.js +452 -0
- package/dist/reanimated-compat/style.js.map +1 -0
- package/dist/reanimated-compat/test-timers.d.ts +28 -0
- package/dist/reanimated-compat/test-timers.js +136 -0
- package/dist/reanimated-compat/test-timers.js.map +1 -0
- package/dist/reanimated-compat/threads.d.ts +13 -0
- package/dist/reanimated-compat/threads.js +41 -0
- package/dist/reanimated-compat/threads.js.map +1 -0
- package/dist/reanimated-compat/tracking.d.ts +41 -0
- package/dist/reanimated-compat/tracking.js +106 -0
- package/dist/reanimated-compat/tracking.js.map +1 -0
- package/dist/reanimated-compat/updater-animations.d.ts +36 -0
- package/dist/reanimated-compat/updater-animations.js +273 -0
- package/dist/reanimated-compat/updater-animations.js.map +1 -0
- package/dist/responder/system.d.ts +100 -0
- package/dist/responder/system.js +304 -0
- package/dist/responder/system.js.map +1 -0
- package/dist/responder/touch-history.d.ts +10 -0
- package/dist/responder/touch-history.js +78 -0
- package/dist/responder/touch-history.js.map +1 -0
- package/dist/responder/types.d.ts +63 -0
- package/dist/responder/types.js +29 -0
- package/dist/responder/types.js.map +1 -0
- package/dist/responder/use-responder.d.ts +23 -0
- package/dist/responder/use-responder.js +317 -0
- package/dist/responder/use-responder.js.map +1 -0
- package/dist/runner/host-dev.js +4 -2
- package/dist/runner/host-dev.js.map +1 -1
- package/dist/runner/host.js +6 -2
- package/dist/runner/host.js.map +1 -1
- package/dist/runner/index.js +3 -3
- package/dist/runner/index.js.map +1 -1
- package/dist/sea/gtkx-config-module.js +2 -2
- package/dist/sea/gtkx-config-module.js.map +1 -1
- package/dist/style/absolute-insets.d.ts +26 -0
- package/dist/style/absolute-insets.js +113 -0
- package/dist/style/absolute-insets.js.map +1 -0
- package/dist/style/animated-size.d.ts +25 -0
- package/dist/style/animated-size.js +225 -0
- package/dist/style/animated-size.js.map +1 -0
- package/dist/style/box-shadow.d.ts +7 -0
- package/dist/style/box-shadow.js +197 -0
- package/dist/style/box-shadow.js.map +1 -0
- package/dist/style/colors.d.ts +17 -0
- package/dist/style/colors.js +25 -6
- package/dist/style/colors.js.map +1 -1
- package/dist/style/imperative-css.d.ts +21 -0
- package/dist/style/imperative-css.js +63 -0
- package/dist/style/imperative-css.js.map +1 -0
- package/dist/style/index.d.ts +4 -1
- package/dist/style/index.js +4 -1
- package/dist/style/index.js.map +1 -1
- package/dist/style/split-style.d.ts +5 -2
- package/dist/style/split-style.js +36 -3
- package/dist/style/split-style.js.map +1 -1
- package/dist/style/text-decoration.d.ts +15 -0
- package/dist/style/text-decoration.js +26 -0
- package/dist/style/text-decoration.js.map +1 -0
- package/dist/style/visual-css.js +37 -1
- package/dist/style/visual-css.js.map +1 -1
- package/dist/svg/gradient-geometry.js +2 -5
- package/dist/svg/gradient-geometry.js.map +1 -1
- package/dist/testing/index.js.map +1 -1
- package/dist/unsupported-export.d.ts +8 -0
- package/dist/unsupported-export.js +66 -0
- package/dist/unsupported-export.js.map +1 -0
- package/dist/vendor/react-native/pan-responder.d.ts +102 -0
- package/dist/vendor/react-native/pan-responder.js +196 -0
- package/dist/vendor/react-native/pan-responder.js.map +1 -0
- package/dist/vendor/react-native/touch-history-math.d.ts +18 -0
- package/dist/vendor/react-native/touch-history-math.js +102 -0
- package/dist/vendor/react-native/touch-history-math.js.map +1 -0
- package/dist/vite/index.d.ts +21 -8
- package/dist/vite/index.js +127 -82
- package/dist/vite/index.js.map +1 -1
- package/dist/vitest/index.d.ts +2 -2
- package/dist/vitest/index.js.map +1 -1
- package/dist/worklets-compat/index.d.ts +4 -0
- package/dist/worklets-compat/index.js +28 -0
- package/dist/worklets-compat/index.js.map +1 -0
- package/dist/worklets-compat/surface.d.ts +110 -0
- package/dist/worklets-compat/surface.js +153 -0
- package/dist/worklets-compat/surface.js.map +1 -0
- package/package.json +25 -9
- package/types.d.ts +9 -0
package/dist/apis/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/apis/index.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,8EAA8E;AAC9E,0EAA0E;AAE1E,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAA;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAE3C,MAAM,CAAC,MAAM,QAAQ,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAA;AAChD,MAAM,CAAC,MAAM,UAAU,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAA;AACpD,MAAM,CAAC,MAAM,UAAU,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAA;AACpD,MAAM,CAAC,MAAM,QAAQ,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAA;AAChD,MAAM,CAAC,MAAM,KAAK,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAA;AAC1C,MAAM,CAAC,MAAM,OAAO,GAAG,aAAa,CAAC,QAAQ,CAAC,CAAA;AAC9C,MAAM,CAAC,MAAM,WAAW,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAA;AACtD,MAAM,CAAC,MAAM,WAAW,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAA;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EACL,kBAAkB,GAEnB,MAAM,uBAAuB,CAAA;AAE9B,MAAM,CAAC,MAAM,mBAAmB,GAAG,yBAAyB,CAAC,UAAU,CAAC,CAAA;AACxE,MAAM,CAAC,MAAM,cAAc,GAAG,oBAAoB,CAAC,UAAU,CAAC,CAAA","sourcesContent":["// Production wiring: singleton API modules bound to the gtkx host, exported\n// under their react-native names. Unit tests use the create* factories with a\n// mock host instead of importing this file (it pulls in the gtkx bridge).\n\nimport { createAlert } from \"./alert\"\nimport { createAppState } from \"./app-state\"\nimport { createAppearance } from \"./appearance\"\nimport { createBackHandler } from \"./back-handler\"\nimport { createDimensions } from \"./dimensions\"\nimport { createUseColorScheme, createUseWindowDimensions } from \"./hooks\"\nimport { gtkxHost } from \"./host.gtkx\"\nimport { createI18nManager } from \"./i18n-manager\"\nimport { createLinking } from \"./linking\"\nimport { createPlatform } from \"./platform\"\n\nexport const Platform = createPlatform(gtkxHost)\nexport const Dimensions = createDimensions(gtkxHost)\nexport const Appearance = createAppearance(gtkxHost)\nexport const AppState = createAppState(gtkxHost)\nexport const Alert = createAlert(gtkxHost)\nexport const Linking = createLinking(gtkxHost)\nexport const I18nManager = createI18nManager(gtkxHost)\nexport const BackHandler = createBackHandler(gtkxHost)\nexport { DevSettings } from \"./dev-settings\"\nexport {\n InteractionManager,\n type InteractionPromise,\n} from \"./interaction-manager\"\n\nexport const useWindowDimensions = createUseWindowDimensions(Dimensions)\nexport const useColorScheme = createUseColorScheme(Appearance)\n\nexport type { AlertButton, AlertOptions } from \"./alert\"\nexport type { AppStateEvent, AppStateStatus } from \"./app-state\"\nexport type { AppearancePreferences } from \"./appearance\"\nexport type { DimensionKey, DimensionsPayload } from \"./dimensions\"\nexport type { AlertButtonStyle, ColorSchemeName, ScaledSize } from \"./host\"\nexport type { PlatformSelectSpec } from \"./platform\"\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/apis/index.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,8EAA8E;AAC9E,0EAA0E;AAE1E,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAA;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAE3C,MAAM,CAAC,MAAM,QAAQ,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAA;AAChD,MAAM,CAAC,MAAM,UAAU,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAA;AACpD,MAAM,CAAC,MAAM,UAAU,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAA;AACpD,MAAM,CAAC,MAAM,QAAQ,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAA;AAChD,MAAM,CAAC,MAAM,KAAK,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAA;AAC1C,MAAM,CAAC,MAAM,OAAO,GAAG,aAAa,CAAC,QAAQ,CAAC,CAAA;AAC9C,MAAM,CAAC,MAAM,WAAW,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAA;AACtD,MAAM,CAAC,MAAM,WAAW,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAA;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EACL,QAAQ,GAGT,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,MAAM,EAA4B,MAAM,WAAW,CAAA;AAC5D,OAAO,EACL,kBAAkB,GAEnB,MAAM,uBAAuB,CAAA;AAE9B,MAAM,CAAC,MAAM,mBAAmB,GAAG,yBAAyB,CAAC,UAAU,CAAC,CAAA;AACxE,MAAM,CAAC,MAAM,cAAc,GAAG,oBAAoB,CAAC,UAAU,CAAC,CAAA","sourcesContent":["// Production wiring: singleton API modules bound to the gtkx host, exported\n// under their react-native names. Unit tests use the create* factories with a\n// mock host instead of importing this file (it pulls in the gtkx bridge).\n\nimport { createAlert } from \"./alert\"\nimport { createAppState } from \"./app-state\"\nimport { createAppearance } from \"./appearance\"\nimport { createBackHandler } from \"./back-handler\"\nimport { createDimensions } from \"./dimensions\"\nimport { createUseColorScheme, createUseWindowDimensions } from \"./hooks\"\nimport { gtkxHost } from \"./host.gtkx\"\nimport { createI18nManager } from \"./i18n-manager\"\nimport { createLinking } from \"./linking\"\nimport { createPlatform } from \"./platform\"\n\nexport const Platform = createPlatform(gtkxHost)\nexport const Dimensions = createDimensions(gtkxHost)\nexport const Appearance = createAppearance(gtkxHost)\nexport const AppState = createAppState(gtkxHost)\nexport const Alert = createAlert(gtkxHost)\nexport const Linking = createLinking(gtkxHost)\nexport const I18nManager = createI18nManager(gtkxHost)\nexport const BackHandler = createBackHandler(gtkxHost)\nexport { DevSettings } from \"./dev-settings\"\nexport {\n Keyboard,\n type KeyboardEvent,\n type KeyboardEventName,\n} from \"./keyboard\"\nexport { LogBox, type LogBoxIgnorePattern } from \"./log-box\"\nexport {\n InteractionManager,\n type InteractionPromise,\n} from \"./interaction-manager\"\n\nexport const useWindowDimensions = createUseWindowDimensions(Dimensions)\nexport const useColorScheme = createUseColorScheme(Appearance)\n\nexport type { AlertButton, AlertOptions } from \"./alert\"\nexport type { AppStateEvent, AppStateStatus } from \"./app-state\"\nexport type { AppearancePreferences } from \"./appearance\"\nexport type { DimensionKey, DimensionsPayload } from \"./dimensions\"\nexport type { AlertButtonStyle, ColorSchemeName, ScaledSize } from \"./host\"\nexport type { PlatformOSType, PlatformSelectSpec } from \"./platform\"\n"]}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { SubscriptionHandle } from "../contracts";
|
|
2
|
+
/** RN's keyboard event names. None of them can fire on this platform. */
|
|
3
|
+
export type KeyboardEventName = "keyboardWillShow" | "keyboardDidShow" | "keyboardWillHide" | "keyboardDidHide" | "keyboardWillChangeFrame" | "keyboardDidChangeFrame";
|
|
4
|
+
export type KeyboardEventEasing = "easeIn" | "easeInEaseOut" | "easeOut";
|
|
5
|
+
export type KeyboardEvent = {
|
|
6
|
+
duration: number;
|
|
7
|
+
easing: KeyboardEventEasing;
|
|
8
|
+
endCoordinates: {
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
screenX: number;
|
|
12
|
+
screenY: number;
|
|
13
|
+
};
|
|
14
|
+
startCoordinates?: KeyboardEvent["endCoordinates"];
|
|
15
|
+
isEventFromThisApp: boolean;
|
|
16
|
+
};
|
|
17
|
+
export declare const Keyboard: {
|
|
18
|
+
/**
|
|
19
|
+
* Honoured and never called. The subscription is real — `remove()` pairs
|
|
20
|
+
* with it and is idempotent — because the code that adds a listener also
|
|
21
|
+
* removes one on unmount, and a fake subscription object would turn a
|
|
22
|
+
* cleanup into a crash. What cannot happen is the callback running: see
|
|
23
|
+
* the note at the top of this file.
|
|
24
|
+
*/
|
|
25
|
+
addListener(_eventName: KeyboardEventName | string, handler: (event: KeyboardEvent) => void): SubscriptionHandle;
|
|
26
|
+
/** Drops every subscription for an event name. Nothing was going to fire. */
|
|
27
|
+
removeAllListeners(eventName?: KeyboardEventName | string): void;
|
|
28
|
+
/**
|
|
29
|
+
* A no-op, and deliberately not RN's implementation.
|
|
30
|
+
*
|
|
31
|
+
* RN's `dismiss()` blurs the focused text input, and it does that as the
|
|
32
|
+
* MEANS to an end: retracting the software keyboard is only possible by
|
|
33
|
+
* taking focus away from what summoned it. On a desktop the end does not
|
|
34
|
+
* exist and the means is a visible behaviour of its own — a caret
|
|
35
|
+
* disappearing out of the entry the user was typing in. Libraries call
|
|
36
|
+
* this on gestures (`@gorhom/bottom-sheet` does, from a pan, behind
|
|
37
|
+
* `enableBlurKeyboardOnGesture`), so implementing it as a blur would make
|
|
38
|
+
* dragging a sheet steal focus from a form on a platform where nothing
|
|
39
|
+
* asked for that.
|
|
40
|
+
*
|
|
41
|
+
* An app that wants a widget to lose focus has GTK's own focus model for
|
|
42
|
+
* it (`focusable`, `onFocus`/`onBlur` — see use-focus.ts).
|
|
43
|
+
*/
|
|
44
|
+
dismiss(): void;
|
|
45
|
+
/**
|
|
46
|
+
* RN's `isVisible()`: always false. There is no software keyboard, so it
|
|
47
|
+
* is never visible — this is a fact about the platform rather than a
|
|
48
|
+
* placeholder for state nobody wired up.
|
|
49
|
+
*/
|
|
50
|
+
isVisible(): boolean;
|
|
51
|
+
/** The occluded rectangle, which is always empty here. */
|
|
52
|
+
metrics(): undefined;
|
|
53
|
+
/**
|
|
54
|
+
* iOS-only upstream, and a no-op there on every other platform too:
|
|
55
|
+
* `scheduleLayoutAnimation` replays the keyboard's own show/hide easing
|
|
56
|
+
* into a LayoutAnimation. There is no keyboard event to take an easing
|
|
57
|
+
* from.
|
|
58
|
+
*/
|
|
59
|
+
scheduleLayoutAnimation(event: KeyboardEvent): void;
|
|
60
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
const listeners = new Set();
|
|
2
|
+
export const Keyboard = {
|
|
3
|
+
/**
|
|
4
|
+
* Honoured and never called. The subscription is real — `remove()` pairs
|
|
5
|
+
* with it and is idempotent — because the code that adds a listener also
|
|
6
|
+
* removes one on unmount, and a fake subscription object would turn a
|
|
7
|
+
* cleanup into a crash. What cannot happen is the callback running: see
|
|
8
|
+
* the note at the top of this file.
|
|
9
|
+
*/
|
|
10
|
+
addListener(_eventName, handler) {
|
|
11
|
+
const entry = { handler };
|
|
12
|
+
listeners.add(entry);
|
|
13
|
+
return {
|
|
14
|
+
remove: () => {
|
|
15
|
+
listeners.delete(entry);
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
},
|
|
19
|
+
/** Drops every subscription for an event name. Nothing was going to fire. */
|
|
20
|
+
removeAllListeners(eventName) {
|
|
21
|
+
void eventName;
|
|
22
|
+
listeners.clear();
|
|
23
|
+
},
|
|
24
|
+
/**
|
|
25
|
+
* A no-op, and deliberately not RN's implementation.
|
|
26
|
+
*
|
|
27
|
+
* RN's `dismiss()` blurs the focused text input, and it does that as the
|
|
28
|
+
* MEANS to an end: retracting the software keyboard is only possible by
|
|
29
|
+
* taking focus away from what summoned it. On a desktop the end does not
|
|
30
|
+
* exist and the means is a visible behaviour of its own — a caret
|
|
31
|
+
* disappearing out of the entry the user was typing in. Libraries call
|
|
32
|
+
* this on gestures (`@gorhom/bottom-sheet` does, from a pan, behind
|
|
33
|
+
* `enableBlurKeyboardOnGesture`), so implementing it as a blur would make
|
|
34
|
+
* dragging a sheet steal focus from a form on a platform where nothing
|
|
35
|
+
* asked for that.
|
|
36
|
+
*
|
|
37
|
+
* An app that wants a widget to lose focus has GTK's own focus model for
|
|
38
|
+
* it (`focusable`, `onFocus`/`onBlur` — see use-focus.ts).
|
|
39
|
+
*/
|
|
40
|
+
dismiss() { },
|
|
41
|
+
/**
|
|
42
|
+
* RN's `isVisible()`: always false. There is no software keyboard, so it
|
|
43
|
+
* is never visible — this is a fact about the platform rather than a
|
|
44
|
+
* placeholder for state nobody wired up.
|
|
45
|
+
*/
|
|
46
|
+
isVisible() {
|
|
47
|
+
return false;
|
|
48
|
+
},
|
|
49
|
+
/** The occluded rectangle, which is always empty here. */
|
|
50
|
+
metrics() {
|
|
51
|
+
return undefined;
|
|
52
|
+
},
|
|
53
|
+
/**
|
|
54
|
+
* iOS-only upstream, and a no-op there on every other platform too:
|
|
55
|
+
* `scheduleLayoutAnimation` replays the keyboard's own show/hide easing
|
|
56
|
+
* into a LayoutAnimation. There is no keyboard event to take an easing
|
|
57
|
+
* from.
|
|
58
|
+
*/
|
|
59
|
+
scheduleLayoutAnimation(event) {
|
|
60
|
+
void event;
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
//# sourceMappingURL=keyboard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyboard.js","sourceRoot":"","sources":["../../src/apis/keyboard.ts"],"names":[],"mappings":"AAqDA,MAAM,SAAS,GAAG,IAAI,GAAG,EAAU,CAAA;AAEnC,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB;;;;;;OAMG;IACH,WAAW,CACT,UAAsC,EACtC,OAAuC;QAEvC,MAAM,KAAK,GAAG,EAAE,OAAO,EAAE,CAAA;QACzB,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;QACpB,OAAO;YACL,MAAM,EAAE,GAAG,EAAE;gBACX,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;YACzB,CAAC;SACF,CAAA;IACH,CAAC;IAED,6EAA6E;IAC7E,kBAAkB,CAAC,SAAsC;QACvD,KAAK,SAAS,CAAA;QACd,SAAS,CAAC,KAAK,EAAE,CAAA;IACnB,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACH,OAAO,KAAU,CAAC;IAElB;;;;OAIG;IACH,SAAS;QACP,OAAO,KAAK,CAAA;IACd,CAAC;IAED,0DAA0D;IAC1D,OAAO;QACL,OAAO,SAAS,CAAA;IAClB,CAAC;IAED;;;;;OAKG;IACH,uBAAuB,CAAC,KAAoB;QAC1C,KAAK,KAAK,CAAA;IACZ,CAAC;CACF,CAAA","sourcesContent":["// react-native Keyboard — the SOFTWARE keyboard, not the hardware one.\n//\n// Every event it carries describes a panel sliding over the app and taking\n// screen space away from it: `keyboardDidShow` reports the height of the\n// rectangle the app just lost, and `keyboardWillChangeFrame` reports it\n// moving. A desktop has no such panel — the keyboard is a device, it occludes\n// nothing, and there is no rectangle to report. So the events cannot fire,\n// and a subscription that is honoured and never called is the truthful\n// answer rather than a shortcut.\n//\n// This is the same shape as BackHandler two files over (\"desktop has no\n// hardware back key, so no event fires today\"), and it is what the two\n// desktop-ish RN platforms do. react-native-windows ships RN core's own\n// `Keyboard`, whose emitter is constructed over `NativeKeyboardObserver`\n// only on iOS and Android — on Windows nothing ever emits into it, and the\n// module is left in place so that `addListener`/`remove` still pair up.\n// react-native-web is explicit about the same thing: its `Keyboard` is an\n// object of no-ops with a comment saying there is no keyboard to observe.\n//\n// The measured caller: `@gorhom/bottom-sheet` subscribes in its own\n// `useAnimatedKeyboard` and maps the event names through\n// `Platform.select({ios: …, android: …, default: ''})` — so on this platform\n// it subscribes to the empty string, which nothing could ever emit even if\n// something did. Its keyboard state stays `UNDETERMINED`, which is what the\n// sheet's own code paths already treat as \"no keyboard involved\".\n//\n// `dismiss()` is the one method with a decision in it — see below.\nimport type { SubscriptionHandle } from \"../contracts\"\n\n/** RN's keyboard event names. None of them can fire on this platform. */\nexport type KeyboardEventName =\n | \"keyboardWillShow\"\n | \"keyboardDidShow\"\n | \"keyboardWillHide\"\n | \"keyboardDidHide\"\n | \"keyboardWillChangeFrame\"\n | \"keyboardDidChangeFrame\"\n\nexport type KeyboardEventEasing = \"easeIn\" | \"easeInEaseOut\" | \"easeOut\"\n\nexport type KeyboardEvent = {\n duration: number\n easing: KeyboardEventEasing\n endCoordinates: {\n width: number\n height: number\n screenX: number\n screenY: number\n }\n startCoordinates?: KeyboardEvent[\"endCoordinates\"]\n isEventFromThisApp: boolean\n}\n\nconst listeners = new Set<object>()\n\nexport const Keyboard = {\n /**\n * Honoured and never called. The subscription is real — `remove()` pairs\n * with it and is idempotent — because the code that adds a listener also\n * removes one on unmount, and a fake subscription object would turn a\n * cleanup into a crash. What cannot happen is the callback running: see\n * the note at the top of this file.\n */\n addListener(\n _eventName: KeyboardEventName | string,\n handler: (event: KeyboardEvent) => void,\n ): SubscriptionHandle {\n const entry = { handler }\n listeners.add(entry)\n return {\n remove: () => {\n listeners.delete(entry)\n },\n }\n },\n\n /** Drops every subscription for an event name. Nothing was going to fire. */\n removeAllListeners(eventName?: KeyboardEventName | string): void {\n void eventName\n listeners.clear()\n },\n\n /**\n * A no-op, and deliberately not RN's implementation.\n *\n * RN's `dismiss()` blurs the focused text input, and it does that as the\n * MEANS to an end: retracting the software keyboard is only possible by\n * taking focus away from what summoned it. On a desktop the end does not\n * exist and the means is a visible behaviour of its own — a caret\n * disappearing out of the entry the user was typing in. Libraries call\n * this on gestures (`@gorhom/bottom-sheet` does, from a pan, behind\n * `enableBlurKeyboardOnGesture`), so implementing it as a blur would make\n * dragging a sheet steal focus from a form on a platform where nothing\n * asked for that.\n *\n * An app that wants a widget to lose focus has GTK's own focus model for\n * it (`focusable`, `onFocus`/`onBlur` — see use-focus.ts).\n */\n dismiss(): void {},\n\n /**\n * RN's `isVisible()`: always false. There is no software keyboard, so it\n * is never visible — this is a fact about the platform rather than a\n * placeholder for state nobody wired up.\n */\n isVisible(): boolean {\n return false\n },\n\n /** The occluded rectangle, which is always empty here. */\n metrics(): undefined {\n return undefined\n },\n\n /**\n * iOS-only upstream, and a no-op there on every other platform too:\n * `scheduleLayoutAnimation` replays the keyboard's own show/hide easing\n * into a LayoutAnimation. There is no keyboard event to take an easing\n * from.\n */\n scheduleLayoutAnimation(event: KeyboardEvent): void {\n void event\n },\n}\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** RN's ignore pattern: a substring, or a regular expression. */
|
|
2
|
+
export type LogBoxIgnorePattern = string | RegExp;
|
|
3
|
+
export declare const LogBox: {
|
|
4
|
+
/**
|
|
5
|
+
* Accepted and ignored — there is no overlay to keep these out of, and
|
|
6
|
+
* this call never filtered the console on RN either.
|
|
7
|
+
*/
|
|
8
|
+
ignoreLogs(patterns: readonly LogBoxIgnorePattern[]): void;
|
|
9
|
+
/** Accepted and ignored, for the same reason as {@link LogBox.ignoreLogs}. */
|
|
10
|
+
ignoreAllLogs(ignore?: boolean): void;
|
|
11
|
+
/** Accepted and ignored: there is no LogBox to install. */
|
|
12
|
+
install(): void;
|
|
13
|
+
/** Accepted and ignored: there is no LogBox to uninstall. */
|
|
14
|
+
uninstall(): void;
|
|
15
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// RN's LogBox — the full-screen dev overlay that shows warnings and errors
|
|
2
|
+
// on top of a running app, and the API for telling it which ones to skip.
|
|
3
|
+
//
|
|
4
|
+
// ACCEPTED AND IGNORED, and the reason is not "there was nothing better to
|
|
5
|
+
// do": it is that `ignoreLogs` never affected the console on RN either. RN's
|
|
6
|
+
// LogBox installs a *view*; ignoring a pattern keeps the yellow box from
|
|
7
|
+
// appearing and leaves `console.warn` output exactly where it was. A GTK app
|
|
8
|
+
// has no such overlay — a warning goes to stderr and stays there — so the
|
|
9
|
+
// console output after `LogBox.ignoreLogs([...])` here is already the console
|
|
10
|
+
// output RN would have. There is no behaviour to suppress, and no behaviour
|
|
11
|
+
// silently lost.
|
|
12
|
+
//
|
|
13
|
+
// That distinction is what separates this from the stand-ins in
|
|
14
|
+
// src/unsupported-export.ts. Those refuse because accepting would make
|
|
15
|
+
// something that visibly does work stop working — a `PanGestureHandler` that
|
|
16
|
+
// renders children with no gestures. Here the call is a request to hide
|
|
17
|
+
// something this platform never showed.
|
|
18
|
+
//
|
|
19
|
+
// The measured caller: `react-native-draggable-flatlist` calls
|
|
20
|
+
// `LogBox.ignoreLogs([...])` during the first render of every
|
|
21
|
+
// `NestableDraggableFlatList`, to silence RN's "VirtualizedLists should never
|
|
22
|
+
// be nested inside plain ScrollViews" warning. That warning does not exist on
|
|
23
|
+
// this platform either, which is the same fact from the other side.
|
|
24
|
+
//
|
|
25
|
+
// Not implemented, and the reason to build an overlay if one is ever wanted:
|
|
26
|
+
// RN's LogBox is also a UI. `install()`/`uninstall()` are how RN's own
|
|
27
|
+
// AppContainer turns it on and off, so they are accepted for source parity;
|
|
28
|
+
// there is nothing to turn on yet.
|
|
29
|
+
export const LogBox = {
|
|
30
|
+
/**
|
|
31
|
+
* Accepted and ignored — there is no overlay to keep these out of, and
|
|
32
|
+
* this call never filtered the console on RN either.
|
|
33
|
+
*/
|
|
34
|
+
ignoreLogs(patterns) {
|
|
35
|
+
void patterns;
|
|
36
|
+
},
|
|
37
|
+
/** Accepted and ignored, for the same reason as {@link LogBox.ignoreLogs}. */
|
|
38
|
+
ignoreAllLogs(ignore) {
|
|
39
|
+
void ignore;
|
|
40
|
+
},
|
|
41
|
+
/** Accepted and ignored: there is no LogBox to install. */
|
|
42
|
+
install() { },
|
|
43
|
+
/** Accepted and ignored: there is no LogBox to uninstall. */
|
|
44
|
+
uninstall() { },
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=log-box.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log-box.js","sourceRoot":"","sources":["../../src/apis/log-box.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,0EAA0E;AAC1E,EAAE;AACF,2EAA2E;AAC3E,6EAA6E;AAC7E,yEAAyE;AACzE,6EAA6E;AAC7E,0EAA0E;AAC1E,8EAA8E;AAC9E,4EAA4E;AAC5E,iBAAiB;AACjB,EAAE;AACF,gEAAgE;AAChE,uEAAuE;AACvE,6EAA6E;AAC7E,wEAAwE;AACxE,wCAAwC;AACxC,EAAE;AACF,+DAA+D;AAC/D,8DAA8D;AAC9D,8EAA8E;AAC9E,8EAA8E;AAC9E,oEAAoE;AACpE,EAAE;AACF,6EAA6E;AAC7E,uEAAuE;AACvE,4EAA4E;AAC5E,mCAAmC;AAKnC,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB;;;OAGG;IACH,UAAU,CAAC,QAAwC;QACjD,KAAK,QAAQ,CAAA;IACf,CAAC;IAED,8EAA8E;IAC9E,aAAa,CAAC,MAAgB;QAC5B,KAAK,MAAM,CAAA;IACb,CAAC;IAED,2DAA2D;IAC3D,OAAO,KAAU,CAAC;IAElB,6DAA6D;IAC7D,SAAS,KAAU,CAAC;CACrB,CAAA","sourcesContent":["// RN's LogBox — the full-screen dev overlay that shows warnings and errors\n// on top of a running app, and the API for telling it which ones to skip.\n//\n// ACCEPTED AND IGNORED, and the reason is not \"there was nothing better to\n// do\": it is that `ignoreLogs` never affected the console on RN either. RN's\n// LogBox installs a *view*; ignoring a pattern keeps the yellow box from\n// appearing and leaves `console.warn` output exactly where it was. A GTK app\n// has no such overlay — a warning goes to stderr and stays there — so the\n// console output after `LogBox.ignoreLogs([...])` here is already the console\n// output RN would have. There is no behaviour to suppress, and no behaviour\n// silently lost.\n//\n// That distinction is what separates this from the stand-ins in\n// src/unsupported-export.ts. Those refuse because accepting would make\n// something that visibly does work stop working — a `PanGestureHandler` that\n// renders children with no gestures. Here the call is a request to hide\n// something this platform never showed.\n//\n// The measured caller: `react-native-draggable-flatlist` calls\n// `LogBox.ignoreLogs([...])` during the first render of every\n// `NestableDraggableFlatList`, to silence RN's \"VirtualizedLists should never\n// be nested inside plain ScrollViews\" warning. That warning does not exist on\n// this platform either, which is the same fact from the other side.\n//\n// Not implemented, and the reason to build an overlay if one is ever wanted:\n// RN's LogBox is also a UI. `install()`/`uninstall()` are how RN's own\n// AppContainer turns it on and off, so they are accepted for source parity;\n// there is nothing to turn on yet.\n\n/** RN's ignore pattern: a substring, or a regular expression. */\nexport type LogBoxIgnorePattern = string | RegExp\n\nexport const LogBox = {\n /**\n * Accepted and ignored — there is no overlay to keep these out of, and\n * this call never filtered the console on RN either.\n */\n ignoreLogs(patterns: readonly LogBoxIgnorePattern[]): void {\n void patterns\n },\n\n /** Accepted and ignored, for the same reason as {@link LogBox.ignoreLogs}. */\n ignoreAllLogs(ignore?: boolean): void {\n void ignore\n },\n\n /** Accepted and ignored: there is no LogBox to install. */\n install(): void {},\n\n /** Accepted and ignored: there is no LogBox to uninstall. */\n uninstall(): void {},\n}\n"]}
|
package/dist/apis/platform.d.ts
CHANGED
|
@@ -1,11 +1,28 @@
|
|
|
1
1
|
import type { PlatformHost } from "./host";
|
|
2
|
+
/**
|
|
3
|
+
* RN's own `PlatformOSType`, plus `"linux"`.
|
|
4
|
+
*
|
|
5
|
+
* `OS` below is declared as this union rather than the literal `"linux"`,
|
|
6
|
+
* and the reason is RN's contract rather than ours: the whole purpose of
|
|
7
|
+
* `Platform.OS` is source shared across platforms, and every stock RN type
|
|
8
|
+
* declares it wide enough for `Platform.OS === "android"` to COMPILE on
|
|
9
|
+
* every target — it is a runtime question, not a type error. Narrowing it
|
|
10
|
+
* to `"linux"` made an ordinary cross-platform line
|
|
11
|
+
* (`paddingTop: Platform.OS === "android" ? 8 : 6`) fail to build on
|
|
12
|
+
* exactly the platform that most needs shared source, which
|
|
13
|
+
* `react-native-reanimated-dnd`'s example app hit eight times.
|
|
14
|
+
*
|
|
15
|
+
* The runtime value is unchanged and `Platform.OS === "linux"` still
|
|
16
|
+
* narrows, so nothing that reads it loses anything.
|
|
17
|
+
*/
|
|
18
|
+
export type PlatformOSType = "android" | "ios" | "linux" | "macos" | "native" | "web" | "windows";
|
|
2
19
|
export type PlatformSelectSpec<T> = {
|
|
3
20
|
linux?: T;
|
|
4
21
|
native?: T;
|
|
5
22
|
default?: T;
|
|
6
23
|
} & Record<string, T | undefined>;
|
|
7
24
|
export declare const createPlatform: (host: PlatformHost) => {
|
|
8
|
-
OS:
|
|
25
|
+
OS: PlatformOSType;
|
|
9
26
|
isTV: false;
|
|
10
27
|
isTesting: boolean;
|
|
11
28
|
readonly Version: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform.js","sourceRoot":"","sources":["../../src/apis/platform.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"platform.js","sourceRoot":"","sources":["../../src/apis/platform.ts"],"names":[],"mappings":"AA6BA,MAAM,aAAa,GAAG,GAAY,EAAE,CAClC,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,MAAM,KAAK,SAAS,CAAA;AAErE,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,IAAkB,EAAE,EAAE,CAAC,CAAC;IACrD,EAAE,EAAE,OAAyB;IAC7B,IAAI,EAAE,KAAc;IACpB,SAAS,EAAE,aAAa,EAAE;IAC1B,kEAAkE;IAClE,qDAAqD;IACrD,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,UAAU,EAAE,CAAA;IAC1B,CAAC;IACD,mEAAmE;IACnE,sEAAsE;IACtE,MAAM,CAAI,IAA2B;QACnC,IAAI,OAAO,IAAI,IAAI,EAAE,CAAC;YACpB,OAAO,IAAI,CAAC,KAAK,CAAA;QACnB,CAAC;QACD,IAAI,QAAQ,IAAI,IAAI,EAAE,CAAC;YACrB,OAAO,IAAI,CAAC,MAAM,CAAA;QACpB,CAAC;QACD,OAAO,IAAI,CAAC,OAAO,CAAA;IACrB,CAAC;CACF,CAAC,CAAA","sourcesContent":["import type { PlatformHost } from \"./host\"\n\n/**\n * RN's own `PlatformOSType`, plus `\"linux\"`.\n *\n * `OS` below is declared as this union rather than the literal `\"linux\"`,\n * and the reason is RN's contract rather than ours: the whole purpose of\n * `Platform.OS` is source shared across platforms, and every stock RN type\n * declares it wide enough for `Platform.OS === \"android\"` to COMPILE on\n * every target — it is a runtime question, not a type error. Narrowing it\n * to `\"linux\"` made an ordinary cross-platform line\n * (`paddingTop: Platform.OS === \"android\" ? 8 : 6`) fail to build on\n * exactly the platform that most needs shared source, which\n * `react-native-reanimated-dnd`'s example app hit eight times.\n *\n * The runtime value is unchanged and `Platform.OS === \"linux\"` still\n * narrows, so nothing that reads it loses anything.\n */\nexport type PlatformOSType =\n \"android\" | \"ios\" | \"linux\" | \"macos\" | \"native\" | \"web\" | \"windows\"\n\n// Cross-platform code may pass ios/android/... keys too; they are ignored on\n// linux, mirroring react-native's Platform.select fallback contract.\nexport type PlatformSelectSpec<T> = {\n linux?: T\n native?: T\n default?: T\n} & Record<string, T | undefined>\n\nconst detectTesting = (): boolean =>\n process.env.NODE_ENV === \"test\" || process.env.VITEST !== undefined\n\nexport const createPlatform = (host: PlatformHost) => ({\n OS: \"linux\" as PlatformOSType,\n isTV: false as const,\n isTesting: detectTesting(),\n // GTK runtime version, e.g. \"4.22.4\". Lazy getter: GTK may not be\n // initialized yet when the module graph is imported.\n get Version(): string {\n return host.gtkVersion()\n },\n // Same key-presence semantics as react-native: an explicit `linux:\n // undefined` wins over `default` (checked with `in`, not truthiness).\n select<T>(spec: PlatformSelectSpec<T>): T | undefined {\n if (\"linux\" in spec) {\n return spec.linux\n }\n if (\"native\" in spec) {\n return spec.native\n }\n return spec.default\n },\n})\n\nexport type PlatformModule = ReturnType<typeof createPlatform>\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { StyleProp } from "../contracts";
|
|
3
|
+
export type IconProps = {
|
|
4
|
+
/** Icon-theme name, e.g. `"starred-symbolic"`. Symbolic icons take their
|
|
5
|
+
* colour from the surrounding label colour. */
|
|
6
|
+
name: string;
|
|
7
|
+
/** Square size in RN units. Defaults to 16, the size Adwaita uses for icons
|
|
8
|
+
* inside list rows and flat buttons. */
|
|
9
|
+
size?: number;
|
|
10
|
+
/** React Native style. Sizing here wins over `size`. */
|
|
11
|
+
style?: StyleProp;
|
|
12
|
+
testID?: string;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* ```tsx
|
|
16
|
+
* <Icon name="starred-symbolic" size={16} />
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* Sized through `pixel-size` as well as through Yoga: GTK would otherwise pick
|
|
20
|
+
* the nearest theme size and paint at that, so a 16-unit box could hold a
|
|
21
|
+
* 24px icon scaled down.
|
|
22
|
+
*/
|
|
23
|
+
export declare const Icon: ({ name, size, style, testID, }: IconProps) => ReactNode;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { GtkImage } from "../gtkx/bridge/index";
|
|
3
|
+
import { Widget } from "./widget";
|
|
4
|
+
/**
|
|
5
|
+
* ```tsx
|
|
6
|
+
* <Icon name="starred-symbolic" size={16} />
|
|
7
|
+
* ```
|
|
8
|
+
*
|
|
9
|
+
* Sized through `pixel-size` as well as through Yoga: GTK would otherwise pick
|
|
10
|
+
* the nearest theme size and paint at that, so a 16-unit box could hold a
|
|
11
|
+
* 24px icon scaled down.
|
|
12
|
+
*/
|
|
13
|
+
export const Icon = ({ name, size = 16, style, testID, }) => (_jsx(Widget, { testID: testID, style: [{ width: size, height: size }, style], children: _jsx(GtkImage, { iconName: name, pixelSize: size }) }));
|
|
14
|
+
//# sourceMappingURL=icon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icon.js","sourceRoot":"","sources":["../../src/common/icon.tsx"],"names":[],"mappings":";AAeA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAcjC;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,EACnB,IAAI,EACJ,IAAI,GAAG,EAAE,EACT,KAAK,EACL,MAAM,GACI,EAAa,EAAE,CAAC,CAC1B,KAAC,MAAM,IACL,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,KAAK,CAAC,YAE7C,KAAC,QAAQ,IACP,QAAQ,EAAE,IAAI,EACd,SAAS,EAAE,IAAI,GACf,GACK,CACV,CAAA","sourcesContent":["// A named icon from the desktop icon theme, in React Native layout.\n//\n// WHY this is not `Image`. RN's `Image` takes a file path or a URI, because on\n// iOS and Android an icon is an asset the app ships. On the Linux desktop an\n// icon is a NAME resolved against the current icon theme at paint time —\n// `user-trash-symbolic` recolours itself with the label colour, follows the\n// user's theme, and has no file the app could point at. There is nothing in\n// RN's `Image` contract that can express that, and pretending a name is a URI\n// would break `onError`, `resizeMode` and the loading states along with it.\n//\n// So this is the same shape RN apps already reach for on every platform —\n// react-native-vector-icons' `<Icon name size color />` — with the desktop\n// icon theme behind it instead of a bundled font.\nimport type { ReactNode } from \"react\"\nimport type { StyleProp } from \"../contracts\"\nimport { GtkImage } from \"../gtkx/bridge/index\"\nimport { Widget } from \"./widget\"\n\nexport type IconProps = {\n /** Icon-theme name, e.g. `\"starred-symbolic\"`. Symbolic icons take their\n * colour from the surrounding label colour. */\n name: string\n /** Square size in RN units. Defaults to 16, the size Adwaita uses for icons\n * inside list rows and flat buttons. */\n size?: number\n /** React Native style. Sizing here wins over `size`. */\n style?: StyleProp\n testID?: string\n}\n\n/**\n * ```tsx\n * <Icon name=\"starred-symbolic\" size={16} />\n * ```\n *\n * Sized through `pixel-size` as well as through Yoga: GTK would otherwise pick\n * the nearest theme size and paint at that, so a 16-unit box could hold a\n * 24px icon scaled down.\n */\nexport const Icon = ({\n name,\n size = 16,\n style,\n testID,\n}: IconProps): ReactNode => (\n <Widget\n testID={testID}\n style={[{ width: size, height: size }, style]}\n >\n <GtkImage\n iconName={name}\n pixelSize={size}\n />\n </Widget>\n)\n"]}
|
package/dist/common/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { NavigationStack, NavigationStackPage, type NavigationStackPageProps, type NavigationStackProps, } from "./navigation-stack";
|
|
2
2
|
export { HeaderSlotContent, IntrinsicContent, SlotContent, WidgetContent, type IntrinsicContentProps, type SlotContentProps, } from "./content";
|
|
3
3
|
export { useWidgetLayout, Widget, wrapReactNative, type ReactNativeLayoutProps, type UseWidgetLayoutOptions, type WidgetProps, } from "./widget";
|
|
4
|
+
export { Icon, type IconProps } from "./icon";
|
package/dist/common/index.js
CHANGED
|
@@ -16,4 +16,29 @@
|
|
|
16
16
|
export { NavigationStack, NavigationStackPage, } from "./navigation-stack";
|
|
17
17
|
export { HeaderSlotContent, IntrinsicContent, SlotContent, WidgetContent, } from "./content";
|
|
18
18
|
export { useWidgetLayout, Widget, wrapReactNative, } from "./widget";
|
|
19
|
+
export { Icon } from "./icon";
|
|
20
|
+
// REMOVED: `List`, `ListRow`, `ListSeparator`, `rowPosition`.
|
|
21
|
+
//
|
|
22
|
+
// They were Adwaita's boxed list re-implemented in React Native, and the
|
|
23
|
+
// argument for shipping them was that a screen shared with iOS and Android
|
|
24
|
+
// could not import `react-native-gtkx/adw`. That argument does not hold —
|
|
25
|
+
// **this subpath does not resolve on iOS or Android either.** Either import
|
|
26
|
+
// needs a `.linux.tsx` split or a `Platform` check, so `List` bought a
|
|
27
|
+
// consumer nothing over `AdwActionRow`, while costing a hand-maintained copy
|
|
28
|
+
// of libadwaita's metrics that drifts with every release of it. And
|
|
29
|
+
// `AdwActionRow` is better where it works: real keynav, focus and
|
|
30
|
+
// accessibility, with the metrics coming from the system theme instead of
|
|
31
|
+
// numbers baked into our source. They had exactly one consumer.
|
|
32
|
+
//
|
|
33
|
+
// Want a native list → `react-native-gtkx/adw`. Want that LOOK written in
|
|
34
|
+
// React Native → `examples/tasks-nav/src/components/list.tsx`, which is the
|
|
35
|
+
// same file, to copy.
|
|
36
|
+
//
|
|
37
|
+
// What stays public is the part of #47 that mattered: `boxShadow`,
|
|
38
|
+
// `outline*` and `textDecorationLine` in the style layer, which are what
|
|
39
|
+
// made an Adwaita-looking list expressible in `StyleSheet` at all.
|
|
40
|
+
//
|
|
41
|
+
// Reorder went with them, and separately: `onReorder`/`reorderId` was a
|
|
42
|
+
// second, id-keyed entry point into the same module `Draggable` and
|
|
43
|
+
// `Sortable` come from. One way to drag now — `react-native-gtkx/dnd`.
|
|
19
44
|
//# sourceMappingURL=index.js.map
|
package/dist/common/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,EAAE;AACF,wEAAwE;AACxE,2EAA2E;AAC3E,wEAAwE;AACxE,mCAAmC;AACnC,EAAE;AACF,mEAAmE;AACnE,uEAAuE;AACvE,iEAAiE;AACjE,uEAAuE;AACvE,kEAAkE;AAClE,wEAAwE;AACxE,EAAE;AACF,yCAAyC;AAEzC,OAAO,EACL,eAAe,EACf,mBAAmB,GAGpB,MAAM,oBAAoB,CAAA;AAE3B,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,WAAW,EACX,aAAa,GAGd,MAAM,WAAW,CAAA;AAElB,OAAO,EACL,eAAe,EACf,MAAM,EACN,eAAe,GAIhB,MAAM,UAAU,CAAA","sourcesContent":["// react-native-gtkx/common — the parts of the platform layer we wrote.\n//\n// The other two subpaths are widget bindings: react-native-gtkx/gtk and\n// react-native-gtkx/adw re-export what gtkx generates, name for name. This\n// one holds what has no upstream counterpart, which is why nothing here\n// carries a `Gtk` or `Adw` prefix.\n//\n// Two jobs live here. Getting React Native content INTO a GTK slot\n// (SlotContent, IntrinsicContent), and getting a GTK widget INTO React\n// Native layout (Widget, wrapReactNative, useWidgetLayout). Plus\n// NavigationStack, which is a declarative component over an imperative\n// widget rather than a binding of one — a different contract from\n// Adw.NavigationView, which is why it has its own name and lives apart.\n//\n// Nothing here imports react-navigation.\n\nexport {\n NavigationStack,\n NavigationStackPage,\n type NavigationStackPageProps,\n type NavigationStackProps,\n} from \"./navigation-stack\"\n\nexport {\n HeaderSlotContent,\n IntrinsicContent,\n SlotContent,\n WidgetContent,\n type IntrinsicContentProps,\n type SlotContentProps,\n} from \"./content\"\n\nexport {\n useWidgetLayout,\n Widget,\n wrapReactNative,\n type ReactNativeLayoutProps,\n type UseWidgetLayoutOptions,\n type WidgetProps,\n} from \"./widget\"\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,EAAE;AACF,wEAAwE;AACxE,2EAA2E;AAC3E,wEAAwE;AACxE,mCAAmC;AACnC,EAAE;AACF,mEAAmE;AACnE,uEAAuE;AACvE,iEAAiE;AACjE,uEAAuE;AACvE,kEAAkE;AAClE,wEAAwE;AACxE,EAAE;AACF,yCAAyC;AAEzC,OAAO,EACL,eAAe,EACf,mBAAmB,GAGpB,MAAM,oBAAoB,CAAA;AAE3B,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,WAAW,EACX,aAAa,GAGd,MAAM,WAAW,CAAA;AAElB,OAAO,EACL,eAAe,EACf,MAAM,EACN,eAAe,GAIhB,MAAM,UAAU,CAAA;AAEjB,OAAO,EAAE,IAAI,EAAkB,MAAM,QAAQ,CAAA;AAE7C,8DAA8D;AAC9D,EAAE;AACF,yEAAyE;AACzE,2EAA2E;AAC3E,0EAA0E;AAC1E,4EAA4E;AAC5E,uEAAuE;AACvE,6EAA6E;AAC7E,oEAAoE;AACpE,kEAAkE;AAClE,0EAA0E;AAC1E,gEAAgE;AAChE,EAAE;AACF,0EAA0E;AAC1E,4EAA4E;AAC5E,sBAAsB;AACtB,EAAE;AACF,mEAAmE;AACnE,yEAAyE;AACzE,mEAAmE;AACnE,EAAE;AACF,wEAAwE;AACxE,oEAAoE;AACpE,uEAAuE","sourcesContent":["// react-native-gtkx/common — the parts of the platform layer we wrote.\n//\n// The other two subpaths are widget bindings: react-native-gtkx/gtk and\n// react-native-gtkx/adw re-export what gtkx generates, name for name. This\n// one holds what has no upstream counterpart, which is why nothing here\n// carries a `Gtk` or `Adw` prefix.\n//\n// Two jobs live here. Getting React Native content INTO a GTK slot\n// (SlotContent, IntrinsicContent), and getting a GTK widget INTO React\n// Native layout (Widget, wrapReactNative, useWidgetLayout). Plus\n// NavigationStack, which is a declarative component over an imperative\n// widget rather than a binding of one — a different contract from\n// Adw.NavigationView, which is why it has its own name and lives apart.\n//\n// Nothing here imports react-navigation.\n\nexport {\n NavigationStack,\n NavigationStackPage,\n type NavigationStackPageProps,\n type NavigationStackProps,\n} from \"./navigation-stack\"\n\nexport {\n HeaderSlotContent,\n IntrinsicContent,\n SlotContent,\n WidgetContent,\n type IntrinsicContentProps,\n type SlotContentProps,\n} from \"./content\"\n\nexport {\n useWidgetLayout,\n Widget,\n wrapReactNative,\n type ReactNativeLayoutProps,\n type UseWidgetLayoutOptions,\n type WidgetProps,\n} from \"./widget\"\n\nexport { Icon, type IconProps } from \"./icon\"\n\n// REMOVED: `List`, `ListRow`, `ListSeparator`, `rowPosition`.\n//\n// They were Adwaita's boxed list re-implemented in React Native, and the\n// argument for shipping them was that a screen shared with iOS and Android\n// could not import `react-native-gtkx/adw`. That argument does not hold —\n// **this subpath does not resolve on iOS or Android either.** Either import\n// needs a `.linux.tsx` split or a `Platform` check, so `List` bought a\n// consumer nothing over `AdwActionRow`, while costing a hand-maintained copy\n// of libadwaita's metrics that drifts with every release of it. And\n// `AdwActionRow` is better where it works: real keynav, focus and\n// accessibility, with the metrics coming from the system theme instead of\n// numbers baked into our source. They had exactly one consumer.\n//\n// Want a native list → `react-native-gtkx/adw`. Want that LOOK written in\n// React Native → `examples/tasks-nav/src/components/list.tsx`, which is the\n// same file, to copy.\n//\n// What stays public is the part of #47 that mattered: `boxShadow`,\n// `outline*` and `textDecorationLine` in the style layer, which are what\n// made an Adwaita-looking list expressible in `StyleSheet` at all.\n//\n// Reorder went with them, and separately: `onReorder`/`reorderId` was a\n// second, id-keyed entry point into the same module `Draggable` and\n// `Sortable` come from. One way to drag now — `react-native-gtkx/dnd`.\n"]}
|
package/dist/common/widget.d.ts
CHANGED
|
@@ -59,25 +59,4 @@ export type ReactNativeLayoutProps = {
|
|
|
59
59
|
style?: StyleProp;
|
|
60
60
|
onLayout?: (event: LayoutEvent) => void;
|
|
61
61
|
};
|
|
62
|
-
|
|
63
|
-
* Give a GTK component React Native layout, keeping every prop it already
|
|
64
|
-
* has.
|
|
65
|
-
*
|
|
66
|
-
* ```tsx
|
|
67
|
-
* const Button = wrapReactNative(GtkButton)
|
|
68
|
-
*
|
|
69
|
-
* <View style={{ flexDirection: "row", gap: 8 }}>
|
|
70
|
-
* <Button style={{ flex: 1 }} label="Save" onClicked={save} />
|
|
71
|
-
* </View>
|
|
72
|
-
* ```
|
|
73
|
-
*
|
|
74
|
-
* The result is generic in the wrapped component's props, so `label`,
|
|
75
|
-
* `onClicked` and everything else gtkx binds keep their types; `style` and
|
|
76
|
-
* `onLayout` are added on top.
|
|
77
|
-
*
|
|
78
|
-
* **Outside React Native layout it steps aside.** The same widget is often
|
|
79
|
-
* used in a pure GTK slot — a HeaderBar's `start`, a ToolbarView's `topBar` —
|
|
80
|
-
* where there is no Yoga tree to join. The wrapper detects that and renders
|
|
81
|
-
* the bare component, so one exported symbol works in both worlds.
|
|
82
|
-
*/
|
|
83
|
-
export declare const wrapReactNative: <P extends object>(Component: ComponentType<P>) => ComponentType<P & ReactNativeLayoutProps>;
|
|
62
|
+
export declare const wrapReactNative: <P extends object>(Component: ComponentType<P>, widgetName?: string) => ComponentType<P & ReactNativeLayoutProps>;
|
package/dist/common/widget.js
CHANGED
|
@@ -11,8 +11,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
11
11
|
//
|
|
12
12
|
// The visual half of the style (background, border, radius) is applied as a
|
|
13
13
|
// GTK CSS class, the same mechanism View uses.
|
|
14
|
-
import { useContext, useRef } from "react";
|
|
15
|
-
import { HostNodeContext } from "../components/host-node";
|
|
14
|
+
import { isValidElement, useContext, useRef, } from "react";
|
|
15
|
+
import { HostNodeContext, SlotContext, } from "../components/host-node";
|
|
16
16
|
import { useLayoutChild, } from "../components/use-layout-child";
|
|
17
17
|
import { GtkBox } from "../gtkx/bridge/index";
|
|
18
18
|
/**
|
|
@@ -92,7 +92,73 @@ export const useWidgetLayout = (ref, options = {}) => {
|
|
|
92
92
|
* where there is no Yoga tree to join. The wrapper detects that and renders
|
|
93
93
|
* the bare component, so one exported symbol works in both worlds.
|
|
94
94
|
*/
|
|
95
|
-
|
|
95
|
+
// A wrapped widget is a Yoga LEAF, so everything INSIDE it is GTK's
|
|
96
|
+
// territory — its children and its slots alike.
|
|
97
|
+
//
|
|
98
|
+
// A widget SLOT is a property that takes a widget (`titleWidget`, `sheet`,
|
|
99
|
+
// `sidebar`, `startChild`); a widget's content area is an ordinary child.
|
|
100
|
+
// The distinction is gtkx's, it moves between releases — rc.3 took the
|
|
101
|
+
// `content`/`child` props off single-child widgets and made that content a
|
|
102
|
+
// child — and it has never had anything to do with layout. Both keep
|
|
103
|
+
// rendering where they were written, so both keep seeing the enclosing React
|
|
104
|
+
// Native layout root even though GTK has parented them somewhere else
|
|
105
|
+
// entirely. Content then joins a Yoga tree whose viewport is the WINDOW
|
|
106
|
+
// while GTK gives it the widget's own rectangle: laid out against one box,
|
|
107
|
+
// drawn in another, and silently stealing space from a tree it was never
|
|
108
|
+
// meant to be in.
|
|
109
|
+
//
|
|
110
|
+
// So the boundary clears the layout root on the way in. The widgets a slot
|
|
111
|
+
// or a child usually holds want exactly that (it is what `WidgetContent`
|
|
112
|
+
// does by hand), and React Native content entering has to bring its own root
|
|
113
|
+
// — `SlotContent` to fill the area, `IntrinsicContent` to size the area to
|
|
114
|
+
// itself. Which of the two is right cannot be inferred, and measurement says
|
|
115
|
+
// so louder than argument: `AdwBottomSheet` alone FILLS in its content child
|
|
116
|
+
// but HUGS in both `sheet` (a bottom sheet rises to the height of its own
|
|
117
|
+
// contents) and `bottomBar`. One widget, three content areas, two answers,
|
|
118
|
+
// with nothing in the name or the GIR type to tell them apart — the answer
|
|
119
|
+
// lives in the widget's own layout code. The boundary is what makes NOT
|
|
120
|
+
// saying a readable error instead of a silent mislayout — see useHostNode.
|
|
121
|
+
const SlotBoundary = ({ location, children, }) => (
|
|
122
|
+
// Two providers, no widget: a context provider is invisible to the gtkx
|
|
123
|
+
// reconciler, so this is safe even on slots whose value is NOT a widget
|
|
124
|
+
// (`breakpoints`, `menuModel`, `buffer`, `adjustment` — the majority of
|
|
125
|
+
// element-valued props, in fact) — wrapping those in a real box would put
|
|
126
|
+
// a GtkBox where an AdwBreakpoint belongs.
|
|
127
|
+
_jsx(SlotContext.Provider, { value: location, children: _jsx(HostNodeContext.Provider, { value: null, children: children }) }));
|
|
128
|
+
const holdsElement = (value) => isValidElement(value) || (Array.isArray(value) && value.some(holdsElement));
|
|
129
|
+
// Puts every element-valued prop, and the children, behind a boundary.
|
|
130
|
+
// `ref` is never content; anything that holds no element (a string child, a
|
|
131
|
+
// number, an already-constructed GObject) is left exactly as it was, so the
|
|
132
|
+
// common widget pays nothing.
|
|
133
|
+
const withSlotBoundaries = (props, widget) => {
|
|
134
|
+
let bounded;
|
|
135
|
+
for (const key in props) {
|
|
136
|
+
if (key === "ref") {
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
const value = props[key];
|
|
140
|
+
if (!holdsElement(value)) {
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
bounded ??= {};
|
|
144
|
+
bounded[key] = (
|
|
145
|
+
// Children are not a named slot: the error says "inside AdwBottomSheet"
|
|
146
|
+
// rather than naming a property that does not exist.
|
|
147
|
+
_jsx(SlotBoundary, { location: { widget, slot: key === "children" ? null : key }, children: value }));
|
|
148
|
+
}
|
|
149
|
+
// The common case is a widget with no element-valued prop at all: return the
|
|
150
|
+
// props object untouched rather than allocate a copy per render.
|
|
151
|
+
return bounded ? { ...props, ...bounded } : props;
|
|
152
|
+
};
|
|
153
|
+
export const wrapReactNative = (Component,
|
|
154
|
+
// The widget's name, for error messages and React devtools. gtkx builds its
|
|
155
|
+
// components from a factory, so they carry no name of their own — the
|
|
156
|
+
// generated widget surface passes the class name it already knows.
|
|
157
|
+
widgetName) => {
|
|
158
|
+
const name = widgetName ||
|
|
159
|
+
Component.displayName ||
|
|
160
|
+
Component.name ||
|
|
161
|
+
"Widget";
|
|
96
162
|
const InLayout = (props) => {
|
|
97
163
|
const { style, onLayout, ...rest } = props;
|
|
98
164
|
const boxRef = useRef(null);
|
|
@@ -117,6 +183,10 @@ export const wrapReactNative = (Component) => {
|
|
|
117
183
|
hexpand: inner.hexpand ?? true, vexpand: inner.vexpand ?? true }) }));
|
|
118
184
|
};
|
|
119
185
|
const Wrapped = (props) => {
|
|
186
|
+
// Every slot this widget is given becomes GTK territory, in both branches
|
|
187
|
+
// below: whether the widget itself joined React Native layout has nothing
|
|
188
|
+
// to do with what its slots hold.
|
|
189
|
+
const withSlots = withSlotBoundaries(props, name);
|
|
120
190
|
// Read the context directly rather than through useHostNode, which throws
|
|
121
191
|
// by design: here its absence is a supported case, not a mistake. The
|
|
122
192
|
// same widget is often used in a pure GTK slot (a HeaderBar's `start`, a
|
|
@@ -125,16 +195,13 @@ export const wrapReactNative = (Component) => {
|
|
|
125
195
|
if (!host) {
|
|
126
196
|
// style/onLayout are meaningless without a Yoga tree — drop them rather
|
|
127
197
|
// than forward them onto a GObject that has no such properties.
|
|
128
|
-
const rest = { ...
|
|
198
|
+
const rest = { ...withSlots };
|
|
129
199
|
delete rest.style;
|
|
130
200
|
delete rest.onLayout;
|
|
131
201
|
return _jsx(Component, { ...rest });
|
|
132
202
|
}
|
|
133
|
-
return _jsx(InLayout, { ...
|
|
203
|
+
return _jsx(InLayout, { ...withSlots });
|
|
134
204
|
};
|
|
135
|
-
const name = Component.displayName ??
|
|
136
|
-
Component.name ??
|
|
137
|
-
"Widget";
|
|
138
205
|
InLayout.displayName = `wrapReactNative(${name}).InLayout`;
|
|
139
206
|
Wrapped.displayName = `wrapReactNative(${name})`;
|
|
140
207
|
return Wrapped;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"widget.js","sourceRoot":"","sources":["../../src/common/widget.tsx"],"names":[],"mappings":"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","sourcesContent":["// Making a raw GTK widget a first-class citizen of React Native layout.\n//\n// The widgets this subpath re-exports are real GTK widgets, and GTK widgets\n// know nothing about Yoga. Dropped into a <View> as-is they would never be\n// measured or positioned, which would make \"we export everything\" a hollow\n// promise. `Widget` closes that gap: it gives the widget a Yoga node, applies\n// the layout half of a React Native style to it, and — this is the part that\n// matters — measures the widget itself, so it lands at the size the GTK theme\n// actually wants instead of collapsing to zero.\n//\n// The visual half of the style (background, border, radius) is applied as a\n// GTK CSS class, the same mechanism View uses.\nimport { useContext, useRef, type ComponentType, type ReactNode } from \"react\"\nimport { HostNodeContext } from \"../components/host-node\"\nimport {\n useLayoutChild,\n type LayoutEvent,\n} from \"../components/use-layout-child\"\nimport type { StyleProp } from \"../contracts\"\nimport { GtkBox, type Gtk } from \"../gtkx/bridge/index\"\n\nexport type WidgetProps = {\n /** React Native style. The layout half drives Yoga, the visual half becomes\n * a GTK CSS class. Omit sizing and the widget's own natural size wins. */\n style?: StyleProp\n onLayout?: (event: LayoutEvent) => void\n /** The GTK widget(s) to lay out. Your own `ref` on them is untouched. */\n children: ReactNode\n testID?: string\n}\n\n/**\n * Put any GTK widget into React Native layout.\n *\n * ```tsx\n * <View style={{ flexDirection: \"row\", gap: 8, padding: 12 }}>\n * <Widget style={{ flex: 1 }}>\n * <GtkEntry placeholderText=\"Search\" />\n * </Widget>\n * <Widget>\n * <GtkButton iconName=\"edit-find-symbolic\" />\n * </Widget>\n * </View>\n * ```\n *\n * The entry flexes, the button takes its natural size, both sit in the row\n * exactly like React Native children — because to Yoga they now are.\n *\n * For the reverse direction (React Native content inside a GTK slot) see\n * `SlotContent` and `IntrinsicContent`.\n */\nexport const Widget = ({ style, onLayout, children, testID }: WidgetProps) => {\n // The wrapper box IS the Yoga leaf, and it is measured through GTK, so the\n // widget inside reports its natural size up to Yoga. Wrapping rather than\n // cloning keeps the child's own ref and props untouched.\n const boxRef = useRef<Gtk.Box | null>(null)\n const { cssClass } = useLayoutChild(boxRef, {\n style,\n onLayout,\n // Without this a widget with no explicit size would measure as zero —\n // the whole reason a naked GtkButton in a View looks broken.\n measureFromWidget: true,\n })\n\n return (\n <GtkBox\n ref={boxRef}\n name={testID}\n cssClasses={cssClass ? [cssClass] : undefined}\n >\n {children}\n </GtkBox>\n )\n}\n\nexport type UseWidgetLayoutOptions = {\n style?: StyleProp\n onLayout?: (event: LayoutEvent) => void\n}\n\n/**\n * The same thing as {@link Widget}, without the extra component — attach the\n * ref yourself when you already hold one.\n *\n * ```tsx\n * const ref = useRef<Gtk.Button | null>(null)\n * useWidgetLayout(ref, { style: { width: 40, height: 40 } })\n * return <GtkButton ref={ref} iconName=\"open-menu-symbolic\" />\n * ```\n *\n * Returns the GTK CSS class produced by the visual half of the style, or\n * null — pass it to the widget's `cssClasses` if you want backgrounds and\n * borders from the style to apply.\n */\nexport const useWidgetLayout = (\n ref: { current: Gtk.Widget | null },\n options: UseWidgetLayoutOptions = {},\n): string | null => {\n const { cssClass } = useLayoutChild(ref, {\n style: options.style,\n onLayout: options.onLayout,\n measureFromWidget: true,\n })\n return cssClass\n}\n\nexport type ReactNativeLayoutProps = {\n /** React Native style. The layout half drives Yoga, the visual half becomes\n * a GTK CSS class. Omit sizing and the widget's natural size wins. */\n style?: StyleProp\n onLayout?: (event: LayoutEvent) => void\n}\n\n/**\n * Give a GTK component React Native layout, keeping every prop it already\n * has.\n *\n * ```tsx\n * const Button = wrapReactNative(GtkButton)\n *\n * <View style={{ flexDirection: \"row\", gap: 8 }}>\n * <Button style={{ flex: 1 }} label=\"Save\" onClicked={save} />\n * </View>\n * ```\n *\n * The result is generic in the wrapped component's props, so `label`,\n * `onClicked` and everything else gtkx binds keep their types; `style` and\n * `onLayout` are added on top.\n *\n * **Outside React Native layout it steps aside.** The same widget is often\n * used in a pure GTK slot — a HeaderBar's `start`, a ToolbarView's `topBar` —\n * where there is no Yoga tree to join. The wrapper detects that and renders\n * the bare component, so one exported symbol works in both worlds.\n */\nexport const wrapReactNative = <P extends object>(\n Component: ComponentType<P>,\n): ComponentType<P & ReactNativeLayoutProps> => {\n const InLayout = (props: P & ReactNativeLayoutProps) => {\n const { style, onLayout, ...rest } = props\n const boxRef = useRef<Gtk.Box | null>(null)\n const { cssClass } = useLayoutChild(boxRef, {\n style,\n onLayout,\n // Without this a widget with no explicit size measures as zero — the\n // whole reason a naked GtkButton in a View looks broken.\n measureFromWidget: true,\n })\n const inner = rest as P & { cssClasses?: string[] } & {\n hexpand?: boolean\n vexpand?: boolean\n }\n return (\n <GtkBox ref={boxRef}>\n <Component\n {...inner}\n // The style's visual half lands on the WIDGET, not on the wrapper,\n // so backgrounds and borders colour the button itself. This is the\n // point: on this platform React Native style drives GTK.\n cssClasses={\n cssClass\n ? [...(inner.cssClasses ?? []), cssClass]\n : inner.cssClasses\n }\n // Fill the rect Yoga computed, so `flex: 1` and explicit sizes mean\n // what they mean everywhere else in React Native. An explicit\n // hexpand/vexpand from the caller still wins.\n hexpand={inner.hexpand ?? true}\n vexpand={inner.vexpand ?? true}\n />\n </GtkBox>\n )\n }\n\n const Wrapped = (props: P & ReactNativeLayoutProps) => {\n // Read the context directly rather than through useHostNode, which throws\n // by design: here its absence is a supported case, not a mistake. The\n // same widget is often used in a pure GTK slot (a HeaderBar's `start`, a\n // ToolbarView's `topBar`) where there is no Yoga tree to join.\n const host = useContext(HostNodeContext)\n if (!host) {\n // style/onLayout are meaningless without a Yoga tree — drop them rather\n // than forward them onto a GObject that has no such properties.\n const rest = { ...props } as Partial<ReactNativeLayoutProps>\n delete rest.style\n delete rest.onLayout\n return <Component {...(rest as P)} />\n }\n return <InLayout {...props} />\n }\n\n const name =\n (Component as { displayName?: string; name?: string }).displayName ??\n (Component as { name?: string }).name ??\n \"Widget\"\n InLayout.displayName = `wrapReactNative(${name}).InLayout`\n Wrapped.displayName = `wrapReactNative(${name})`\n return Wrapped\n}\n"]}
|
|
1
|
+
{"version":3,"file":"widget.js","sourceRoot":"","sources":["../../src/common/widget.tsx"],"names":[],"mappings":"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","sourcesContent":["// Making a raw GTK widget a first-class citizen of React Native layout.\n//\n// The widgets this subpath re-exports are real GTK widgets, and GTK widgets\n// know nothing about Yoga. Dropped into a <View> as-is they would never be\n// measured or positioned, which would make \"we export everything\" a hollow\n// promise. `Widget` closes that gap: it gives the widget a Yoga node, applies\n// the layout half of a React Native style to it, and — this is the part that\n// matters — measures the widget itself, so it lands at the size the GTK theme\n// actually wants instead of collapsing to zero.\n//\n// The visual half of the style (background, border, radius) is applied as a\n// GTK CSS class, the same mechanism View uses.\nimport {\n isValidElement,\n useContext,\n useRef,\n type ComponentType,\n type ReactNode,\n} from \"react\"\nimport {\n HostNodeContext,\n SlotContext,\n type SlotLocation,\n} from \"../components/host-node\"\nimport {\n useLayoutChild,\n type LayoutEvent,\n} from \"../components/use-layout-child\"\nimport type { StyleProp } from \"../contracts\"\nimport { GtkBox, type Gtk } from \"../gtkx/bridge/index\"\n\nexport type WidgetProps = {\n /** React Native style. The layout half drives Yoga, the visual half becomes\n * a GTK CSS class. Omit sizing and the widget's own natural size wins. */\n style?: StyleProp\n onLayout?: (event: LayoutEvent) => void\n /** The GTK widget(s) to lay out. Your own `ref` on them is untouched. */\n children: ReactNode\n testID?: string\n}\n\n/**\n * Put any GTK widget into React Native layout.\n *\n * ```tsx\n * <View style={{ flexDirection: \"row\", gap: 8, padding: 12 }}>\n * <Widget style={{ flex: 1 }}>\n * <GtkEntry placeholderText=\"Search\" />\n * </Widget>\n * <Widget>\n * <GtkButton iconName=\"edit-find-symbolic\" />\n * </Widget>\n * </View>\n * ```\n *\n * The entry flexes, the button takes its natural size, both sit in the row\n * exactly like React Native children — because to Yoga they now are.\n *\n * For the reverse direction (React Native content inside a GTK slot) see\n * `SlotContent` and `IntrinsicContent`.\n */\nexport const Widget = ({ style, onLayout, children, testID }: WidgetProps) => {\n // The wrapper box IS the Yoga leaf, and it is measured through GTK, so the\n // widget inside reports its natural size up to Yoga. Wrapping rather than\n // cloning keeps the child's own ref and props untouched.\n const boxRef = useRef<Gtk.Box | null>(null)\n const { cssClass } = useLayoutChild(boxRef, {\n style,\n onLayout,\n // Without this a widget with no explicit size would measure as zero —\n // the whole reason a naked GtkButton in a View looks broken.\n measureFromWidget: true,\n })\n\n return (\n <GtkBox\n ref={boxRef}\n name={testID}\n cssClasses={cssClass ? [cssClass] : undefined}\n >\n {children}\n </GtkBox>\n )\n}\n\nexport type UseWidgetLayoutOptions = {\n style?: StyleProp\n onLayout?: (event: LayoutEvent) => void\n}\n\n/**\n * The same thing as {@link Widget}, without the extra component — attach the\n * ref yourself when you already hold one.\n *\n * ```tsx\n * const ref = useRef<Gtk.Button | null>(null)\n * useWidgetLayout(ref, { style: { width: 40, height: 40 } })\n * return <GtkButton ref={ref} iconName=\"open-menu-symbolic\" />\n * ```\n *\n * Returns the GTK CSS class produced by the visual half of the style, or\n * null — pass it to the widget's `cssClasses` if you want backgrounds and\n * borders from the style to apply.\n */\nexport const useWidgetLayout = (\n ref: { current: Gtk.Widget | null },\n options: UseWidgetLayoutOptions = {},\n): string | null => {\n const { cssClass } = useLayoutChild(ref, {\n style: options.style,\n onLayout: options.onLayout,\n measureFromWidget: true,\n })\n return cssClass\n}\n\nexport type ReactNativeLayoutProps = {\n /** React Native style. The layout half drives Yoga, the visual half becomes\n * a GTK CSS class. Omit sizing and the widget's natural size wins. */\n style?: StyleProp\n onLayout?: (event: LayoutEvent) => void\n}\n\n/**\n * Give a GTK component React Native layout, keeping every prop it already\n * has.\n *\n * ```tsx\n * const Button = wrapReactNative(GtkButton)\n *\n * <View style={{ flexDirection: \"row\", gap: 8 }}>\n * <Button style={{ flex: 1 }} label=\"Save\" onClicked={save} />\n * </View>\n * ```\n *\n * The result is generic in the wrapped component's props, so `label`,\n * `onClicked` and everything else gtkx binds keep their types; `style` and\n * `onLayout` are added on top.\n *\n * **Outside React Native layout it steps aside.** The same widget is often\n * used in a pure GTK slot — a HeaderBar's `start`, a ToolbarView's `topBar` —\n * where there is no Yoga tree to join. The wrapper detects that and renders\n * the bare component, so one exported symbol works in both worlds.\n */\n// A wrapped widget is a Yoga LEAF, so everything INSIDE it is GTK's\n// territory — its children and its slots alike.\n//\n// A widget SLOT is a property that takes a widget (`titleWidget`, `sheet`,\n// `sidebar`, `startChild`); a widget's content area is an ordinary child.\n// The distinction is gtkx's, it moves between releases — rc.3 took the\n// `content`/`child` props off single-child widgets and made that content a\n// child — and it has never had anything to do with layout. Both keep\n// rendering where they were written, so both keep seeing the enclosing React\n// Native layout root even though GTK has parented them somewhere else\n// entirely. Content then joins a Yoga tree whose viewport is the WINDOW\n// while GTK gives it the widget's own rectangle: laid out against one box,\n// drawn in another, and silently stealing space from a tree it was never\n// meant to be in.\n//\n// So the boundary clears the layout root on the way in. The widgets a slot\n// or a child usually holds want exactly that (it is what `WidgetContent`\n// does by hand), and React Native content entering has to bring its own root\n// — `SlotContent` to fill the area, `IntrinsicContent` to size the area to\n// itself. Which of the two is right cannot be inferred, and measurement says\n// so louder than argument: `AdwBottomSheet` alone FILLS in its content child\n// but HUGS in both `sheet` (a bottom sheet rises to the height of its own\n// contents) and `bottomBar`. One widget, three content areas, two answers,\n// with nothing in the name or the GIR type to tell them apart — the answer\n// lives in the widget's own layout code. The boundary is what makes NOT\n// saying a readable error instead of a silent mislayout — see useHostNode.\nconst SlotBoundary = ({\n location,\n children,\n}: {\n location: SlotLocation\n children: ReactNode\n}) => (\n // Two providers, no widget: a context provider is invisible to the gtkx\n // reconciler, so this is safe even on slots whose value is NOT a widget\n // (`breakpoints`, `menuModel`, `buffer`, `adjustment` — the majority of\n // element-valued props, in fact) — wrapping those in a real box would put\n // a GtkBox where an AdwBreakpoint belongs.\n <SlotContext.Provider value={location}>\n <HostNodeContext.Provider value={null}>{children}</HostNodeContext.Provider>\n </SlotContext.Provider>\n)\n\nconst holdsElement = (value: unknown): boolean =>\n isValidElement(value) || (Array.isArray(value) && value.some(holdsElement))\n\n// Puts every element-valued prop, and the children, behind a boundary.\n// `ref` is never content; anything that holds no element (a string child, a\n// number, an already-constructed GObject) is left exactly as it was, so the\n// common widget pays nothing.\nconst withSlotBoundaries = <P extends object>(props: P, widget: string): P => {\n let bounded: Record<string, unknown> | undefined\n for (const key in props) {\n if (key === \"ref\") {\n continue\n }\n const value = (props as Record<string, unknown>)[key]\n if (!holdsElement(value)) {\n continue\n }\n bounded ??= {}\n bounded[key] = (\n // Children are not a named slot: the error says \"inside AdwBottomSheet\"\n // rather than naming a property that does not exist.\n <SlotBoundary\n location={{ widget, slot: key === \"children\" ? null : key }}\n >\n {value as ReactNode}\n </SlotBoundary>\n )\n }\n // The common case is a widget with no element-valued prop at all: return the\n // props object untouched rather than allocate a copy per render.\n return bounded ? ({ ...props, ...bounded } as P) : props\n}\n\nexport const wrapReactNative = <P extends object>(\n Component: ComponentType<P>,\n // The widget's name, for error messages and React devtools. gtkx builds its\n // components from a factory, so they carry no name of their own — the\n // generated widget surface passes the class name it already knows.\n widgetName?: string,\n): ComponentType<P & ReactNativeLayoutProps> => {\n const name =\n widgetName ||\n (Component as { displayName?: string; name?: string }).displayName ||\n (Component as { name?: string }).name ||\n \"Widget\"\n\n const InLayout = (props: P & ReactNativeLayoutProps) => {\n const { style, onLayout, ...rest } = props\n const boxRef = useRef<Gtk.Box | null>(null)\n const { cssClass } = useLayoutChild(boxRef, {\n style,\n onLayout,\n // Without this a widget with no explicit size measures as zero — the\n // whole reason a naked GtkButton in a View looks broken.\n measureFromWidget: true,\n })\n const inner = rest as P & { cssClasses?: string[] } & {\n hexpand?: boolean\n vexpand?: boolean\n }\n return (\n <GtkBox ref={boxRef}>\n <Component\n {...inner}\n // The style's visual half lands on the WIDGET, not on the wrapper,\n // so backgrounds and borders colour the button itself. This is the\n // point: on this platform React Native style drives GTK.\n cssClasses={\n cssClass\n ? [...(inner.cssClasses ?? []), cssClass]\n : inner.cssClasses\n }\n // Fill the rect Yoga computed, so `flex: 1` and explicit sizes mean\n // what they mean everywhere else in React Native. An explicit\n // hexpand/vexpand from the caller still wins.\n hexpand={inner.hexpand ?? true}\n vexpand={inner.vexpand ?? true}\n />\n </GtkBox>\n )\n }\n\n const Wrapped = (props: P & ReactNativeLayoutProps) => {\n // Every slot this widget is given becomes GTK territory, in both branches\n // below: whether the widget itself joined React Native layout has nothing\n // to do with what its slots hold.\n const withSlots = withSlotBoundaries(props, name)\n // Read the context directly rather than through useHostNode, which throws\n // by design: here its absence is a supported case, not a mistake. The\n // same widget is often used in a pure GTK slot (a HeaderBar's `start`, a\n // ToolbarView's `topBar`) where there is no Yoga tree to join.\n const host = useContext(HostNodeContext)\n if (!host) {\n // style/onLayout are meaningless without a Yoga tree — drop them rather\n // than forward them onto a GObject that has no such properties.\n const rest = { ...withSlots } as Partial<ReactNativeLayoutProps>\n delete rest.style\n delete rest.onLayout\n return <Component {...(rest as P)} />\n }\n return <InLayout {...withSlots} />\n }\n\n InLayout.displayName = `wrapReactNative(${name}).InLayout`\n Wrapped.displayName = `wrapReactNative(${name})`\n return Wrapped\n}\n"]}
|