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":"host.gtkx.js","sourceRoot":"","sources":["../../src/apis/host.gtkx.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,4EAA4E;AAC5E,wEAAwE;AAGxE,OAAO,EACL,GAAG,EACH,WAAW,EACX,GAAG,EACH,GAAG,EACH,GAAG,EACH,IAAI,EACJ,YAAY,EACZ,QAAQ,GACT,MAAM,sBAAsB,CAAA;AAQ7B,MAAM,gBAAgB,GAAe;IACnC,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,CAAC;IACT,KAAK,EAAE,CAAC;IACR,SAAS,EAAE,CAAC;CACb,CAAA;AAED,MAAM,cAAc,GAAG,GAA2B,EAAE,CAClD,GAAG,CAAC,WAAW,CAAC,UAAU,EAAuC,CAAA;AAEnE,MAAM,kBAAkB,GAAG,GAAsB,EAAE;IACjD,MAAM,GAAG,GAAG,cAAc,EAAE,CAAA;IAC5B,IAAI,CAAC,GAAG,IAAI,OAAO,GAAG,CAAC,eAAe,KAAK,UAAU,EAAE,CAAC;QACtD,OAAO,IAAI,CAAA;IACb,CAAC;IACD,OAAO,GAAG,CAAC,eAAe,EAAE,IAAI,IAAI,CAAA;AACtC,CAAC,CAAA;AAED,MAAM,QAAQ,GAAG,CAAC,KAAoB,EAAE,KAAa,EAAqB,EAAE,CAC1E,KAAK,CAAC,OAAO,CAAC,KAAK,CAAiC,CAAA;AAEtD,4EAA4E;AAC5E,2EAA2E;AAC3E,iEAAiE;AACjE,uEAAuE;AACvE,8EAA8E;AAC9E,4EAA4E;AAC5E,qBAAqB;AACrB,MAAM,YAAY,GAAG,CAAC,MAAkB,EAAW,EAAE,CACnD,MAAM,CAAC,eAAe,EAAE,KAAK,IAAI,CAAA;AAEnC,MAAM,aAAa,GAA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QAAQ,EAAE,iBAAiB;IAC3B,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,WAAW,CAAC,qBAAqB,EAAE,EAAE,EAAE,MAAM,CAAC;IAC1E,SAAS;IACT,SAAS;IACT,KAAK;IACL,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE;CACtB,CAAA","sourcesContent":["// Production host adapter: the ONLY module under src/apis/ allowed to import\n// the gtkx bridge. Everything GTK-specific lives here; the API modules stay\n// pure and receive this object (or a mock in unit tests) via injection.\n\nimport type { SubscriptionHandle } from \"../contracts\"\nimport {\n Adw,\n colorScheme,\n Gdk,\n Gio,\n Gtk,\n quit,\n styleManager,\n toNumber,\n} from \"../gtkx/bridge/index\"\nimport type {\n ColorSchemeName,\n Host,\n HostAlertRequest,\n ScaledSize,\n} from \"./host\"\n\nconst FALLBACK_METRICS: ScaledSize = {\n width: 0,\n height: 0,\n scale: 1,\n fontScale: 1,\n}\n\nconst getApplication = (): Gtk.Application | null =>\n Gio.Application.getDefault() as unknown as Gtk.Application | null\n\nconst getActiveAppWindow = (): Gtk.Window | null => {\n const app = getApplication()\n if (!app || typeof app.getActiveWindow !== \"function\") {\n return null\n }\n return app.getActiveWindow() ?? null\n}\n\nconst windowAt = (model: Gio.ListModel, index: number): Gtk.Window | null =>\n model.getItem(index) as unknown as Gtk.Window | null\n\n// The application's active window if any, otherwise the first toplevel. The\n// toplevel fallback covers the test harness, where windows exist without a\n// GtkApplication (`Gio.Application.getDefault()` is null there).\n// RN's Dimensions(\"window\") means the MAIN window: transient toplevels\n// (Modal → modal GtkWindow, dialogs) must never be resolved as \"the window\" —\n// an open modal becomes the active window and would shrink the app viewport\n// to the modal size.\nconst isMainWindow = (window: Gtk.Window): boolean =>\n window.getTransientFor() === null\n\nconst resolveWindow = (): Gtk.Window | null => {\n const active = getActiveAppWindow()\n if (active && isMainWindow(active)) {\n return active\n }\n const toplevels = Gtk.Window.getToplevels()\n const count = toNumber(toplevels.getNItems())\n let first: Gtk.Window | null = null\n for (let index = 0; index < count; index += 1) {\n const window = windowAt(toplevels, index)\n if (!window || !isMainWindow(window)) {\n continue\n }\n if (window.isActive()) {\n return window\n }\n first = first ?? window\n }\n return first\n}\n\nconst isAnyWindowActive = (): boolean => {\n const toplevels = Gtk.Window.getToplevels()\n const count = toNumber(toplevels.getNItems())\n for (let index = 0; index < count; index += 1) {\n if (windowAt(toplevels, index)?.isActive()) {\n return true\n }\n }\n return false\n}\n\nconst windowMetrics = (): ScaledSize => {\n const window = resolveWindow()\n if (!window) {\n return FALLBACK_METRICS\n }\n // RN's Dimensions(\"window\") is the app viewport: the window CHILD's\n // allocation (the content area under the headerbar), not the window widget\n // size. Falls back to the window size before the first allocation.\n const child = window.getChild()\n const childAllocation = child?.getAllocation()\n const allocatedWidth =\n childAllocation && childAllocation.width > 0\n ? toNumber(childAllocation.width)\n : toNumber(window.getWidth())\n const allocatedHeight =\n childAllocation && childAllocation.height > 0\n ? toNumber(childAllocation.height)\n : toNumber(window.getHeight())\n // Before the first allocation everything reports 0 — fall back to\n // the requested default size (which GTK4 also keeps updated on resize).\n const width =\n allocatedWidth > 0\n ? allocatedWidth\n : Math.max(toNumber(window.defaultWidth ?? 0), 0)\n const height =\n allocatedHeight > 0\n ? allocatedHeight\n : Math.max(toNumber(window.defaultHeight ?? 0), 0)\n return {\n width,\n height,\n scale: toNumber(window.getScaleFactor()),\n fontScale: 1,\n }\n}\n\nconst screenMetrics = (): ScaledSize => {\n const display = Gdk.Display.getDefault()\n if (!display) {\n return windowMetrics()\n }\n const monitors = display.getMonitors()\n if (toNumber(monitors.getNItems()) === 0) {\n return windowMetrics()\n }\n const monitor = monitors.getItem(0) as unknown as Gdk.Monitor | null\n if (!monitor) {\n return windowMetrics()\n }\n const geometry = monitor.getGeometry()\n return {\n width: toNumber(geometry.width),\n height: toNumber(geometry.height),\n scale: toNumber(monitor.getScaleFactor()),\n fontScale: 1,\n }\n}\n\n// GtkNative.getSurface is an interface method merged onto Gtk.Window at\n// runtime via mixins; accessed defensively to stay typecheckable either way.\nconst surfaceOf = (window: Gtk.Window): Gdk.Surface | null => {\n const native = window as unknown as { getSurface?: () => Gdk.Surface | null }\n return typeof native.getSurface === \"function\"\n ? (native.getSurface() ?? null)\n : null\n}\n\n// Tracks the \"current\" window across creation/destruction/focus moves:\n// listens on the given signals of the resolved window (and, when requested,\n// its GdkSurface) plus the toplevel list model, re-resolving and re-attaching\n// whenever the tracked window may have changed. Modules dedupe, so\n// over-notifying is fine.\n//\n// Why the surface: notify::default-width fires when setDefaultSize() is\n// called, i.e. before the compositor actually resizes the surface — the\n// allocated size (what Dimensions reports) only changes when the surface\n// does. And GdkSurface notify::width/height fires at configure time, still\n// before the widget allocation pass, so the \"layout\" signal is also needed:\n// it is emitted during the frame's layout phase and — because GTK's own\n// relayout handler is connected first — our handler observes the updated\n// allocation. The module dedupes, so early/no-op emissions cost nothing.\nconst watchWindow = (\n windowSignals: readonly string[],\n surfaceSignals: readonly string[],\n notify: () => void,\n): SubscriptionHandle => {\n let window: Gtk.Window | null = null\n let surface: Gdk.Surface | null = null\n\n const attachWindow = (): void => {\n if (!window) {\n return\n }\n for (const signal of windowSignals) {\n window.on(signal, onSignal)\n }\n }\n\n const detachWindow = (): void => {\n if (!window) {\n return\n }\n for (const signal of windowSignals) {\n window.off(signal, onSignal)\n }\n }\n\n const attachSurface = (): void => {\n if (!surface) {\n return\n }\n for (const signal of surfaceSignals) {\n surface.on(signal, onSignal)\n }\n }\n\n const detachSurface = (): void => {\n if (!surface) {\n return\n }\n for (const signal of surfaceSignals) {\n surface.off(signal, onSignal)\n }\n }\n\n const syncTargets = (): void => {\n const nextWindow = resolveWindow()\n if (nextWindow !== window) {\n detachWindow()\n window = nextWindow\n attachWindow()\n }\n const nextSurface =\n window && surfaceSignals.length > 0 ? surfaceOf(window) : null\n if (nextSurface !== surface) {\n detachSurface()\n surface = nextSurface\n attachSurface()\n }\n }\n\n const onSignal = (): void => {\n syncTargets()\n notify()\n }\n\n const toplevels = Gtk.Window.getToplevels()\n const onToplevelsChanged = (): void => {\n syncTargets()\n notify()\n }\n toplevels.on(\"items-changed\", onToplevelsChanged)\n syncTargets()\n\n return {\n remove: () => {\n detachWindow()\n detachSurface()\n window = null\n surface = null\n toplevels.off(\"items-changed\", onToplevelsChanged)\n },\n }\n}\n\n// realize/map re-run target resolution so the surface listeners attach as\n// soon as the surface exists.\nconst WINDOW_SIZE_SIGNALS = [\n \"notify::default-width\",\n \"notify::default-height\",\n \"realize\",\n \"map\",\n] as const\n\nconst SURFACE_SIZE_SIGNALS = [\n \"notify::width\",\n \"notify::height\",\n \"layout\",\n] as const\n\nconst WINDOW_ACTIVE_SIGNALS = [\"notify::is-active\"] as const\n\nconst gtkVersion = (): string =>\n `${toNumber(Gtk.getMajorVersion())}.${toNumber(Gtk.getMinorVersion())}.${toNumber(Gtk.getMicroVersion())}`\n\nconst setColorScheme = (scheme: ColorSchemeName | null): void => {\n const manager = styleManager()\n if (scheme === \"dark\") {\n manager.setColorScheme(Adw.ColorScheme.FORCE_DARK)\n } else if (scheme === \"light\") {\n manager.setColorScheme(Adw.ColorScheme.FORCE_LIGHT)\n } else {\n manager.setColorScheme(Adw.ColorScheme.DEFAULT)\n }\n // Our apps are GtkApplication (not AdwApplication), so Adwaita may not\n // restyle widgets: duplicate the request through the classic GTK setting,\n // which the theme always honors.\n const settings = Gtk.Settings.getDefault()\n if (settings) {\n if (scheme === null) {\n settings.resetProperty(\"gtk-application-prefer-dark-theme\")\n } else {\n settings.gtkApplicationPreferDarkTheme = scheme === \"dark\"\n }\n }\n}\n\nconst onColorSchemeChange = (notify: () => void): SubscriptionHandle => {\n const manager = styleManager()\n const listener = (): void => notify()\n manager.on(\"notify::dark\", listener)\n return { remove: () => manager.off(\"notify::dark\", listener) }\n}\n\nconst showAlert = async (request: HostAlertRequest): Promise<string | null> => {\n const dialog = new Adw.AlertDialog()\n dialog.setHeading(request.title)\n if (request.message !== undefined && request.message.length > 0) {\n dialog.setBody(request.message)\n }\n let closeResponse: string | null = null\n for (const button of request.buttons) {\n dialog.addResponse(button.id, button.label)\n if (button.style === \"destructive\") {\n dialog.setResponseAppearance(\n button.id,\n Adw.ResponseAppearance.DESTRUCTIVE,\n )\n }\n if (button.isPreferred) {\n dialog.setResponseAppearance(button.id, Adw.ResponseAppearance.SUGGESTED)\n dialog.setDefaultResponse(button.id)\n }\n if (button.style === \"cancel\") {\n closeResponse = button.id\n }\n }\n if (closeResponse !== null) {\n // Esc / close maps onto the cancel button, like RN's cancel semantics.\n dialog.setCloseResponse(closeResponse)\n } else if (!request.cancelable) {\n // No cancel button and not cancelable: block Esc-dismissal. Responses\n // still close the dialog (they bypass the can-close guard).\n dialog.setCanClose(false)\n }\n const response = await dialog.choose(resolveWindow())\n // Anything that is not one of our buttons (e.g. the built-in \"close\"\n // response) is a dismissal.\n return request.buttons.some((button) => button.id === response)\n ? response\n : null\n}\n\nconst launchUri = async (uri: string): Promise<void> => {\n const launcher = new Gtk.UriLauncher({ uri })\n // Promisified by the gi codegen; rejects with the GError on failure.\n await launcher.launch(resolveWindow())\n}\n\n// The default widget direction is GTK's read of the locale text direction.\nconst isRTL = (): boolean => {\n try {\n return Gtk.Widget.getDefaultDirection() === Gtk.TextDirection.RTL\n } catch {\n return false\n }\n}\n\nexport const gtkxHost: Host = {\n gtkVersion,\n getWindowMetrics: windowMetrics,\n getScreenMetrics: screenMetrics,\n onMetricsChange: (notify) =>\n watchWindow(WINDOW_SIZE_SIGNALS, SURFACE_SIZE_SIGNALS, notify),\n getColorScheme: () => colorScheme(),\n setColorScheme,\n onColorSchemeChange,\n isActive: isAnyWindowActive,\n onActiveChange: (notify) => watchWindow(WINDOW_ACTIVE_SIGNALS, [], notify),\n showAlert,\n launchUri,\n isRTL,\n exitApp: () => quit(),\n}\n"]}
|
|
1
|
+
{"version":3,"file":"host.gtkx.js","sourceRoot":"","sources":["../../src/apis/host.gtkx.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,4EAA4E;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A;AAED,MAAM,SAAS,GAAG,KAAK,EAAE,GAAW,EAAiB,EAAE;IACrD,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,WAAW,CAAC,EAAE,GAAG,EAAE,CAAC,CAAA;IAC7C,qEAAqE;IACrE,MAAM,QAAQ,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC,CAAA;AACxC,CAAC,CAAA;AAED,2EAA2E;AAC3E,MAAM,KAAK,GAAG,GAAY,EAAE;IAC1B,IAAI,CAAC;QACH,OAAO,GAAG,CAAC,MAAM,CAAC,mBAAmB,EAAE,KAAK,GAAG,CAAC,aAAa,CAAC,GAAG,CAAA;IACnE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAA;IACd,CAAC;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,QAAQ,GAAS;IAC5B,UAAU;IACV,gBAAgB,EAAE,aAAa;IAC/B,gBAAgB,EAAE,aAAa;IAC/B,eAAe,EAAE,CAAC,MAAM,EAAE,EAAE,CAC1B,WAAW,CAAC,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,CAAC;IAChE,cAAc,EAAE,GAAG,EAAE,CAAC,WAAW,EAAE;IACnC,cAAc;IACd,mBAAmB;IACnB,QAAQ,EAAE,iBAAiB;IAC3B,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,WAAW,CAAC,qBAAqB,EAAE,EAAE,EAAE,MAAM,CAAC;IAC1E,SAAS;IACT,SAAS;IACT,KAAK;IACL,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE;CACtB,CAAA","sourcesContent":["// Production host adapter: the ONLY module under src/apis/ allowed to import\n// the gtkx bridge. Everything GTK-specific lives here; the API modules stay\n// pure and receive this object (or a mock in unit tests) via injection.\n\nimport type { SubscriptionHandle } from \"../contracts\"\nimport {\n Adw,\n colorScheme,\n Gdk,\n Gio,\n Gtk,\n quit,\n styleManager,\n toNumber,\n} from \"../gtkx/bridge/index\"\nimport type {\n ColorSchemeName,\n Host,\n HostAlertRequest,\n ScaledSize,\n} from \"./host\"\n\nconst FALLBACK_METRICS: ScaledSize = {\n width: 0,\n height: 0,\n scale: 1,\n fontScale: 1,\n}\n\nconst getApplication = (): Gtk.Application | null =>\n Gio.Application.getDefault() as unknown as Gtk.Application | null\n\nconst getActiveAppWindow = (): Gtk.Window | null => {\n const app = getApplication()\n if (!app || typeof app.getActiveWindow !== \"function\") {\n return null\n }\n return app.getActiveWindow() ?? null\n}\n\nconst windowAt = (model: Gio.ListModel, index: number): Gtk.Window | null =>\n model.getItem(index) as unknown as Gtk.Window | null\n\n// The application's active window if any, otherwise the first toplevel. The\n// toplevel fallback covers the test harness, where windows exist without a\n// GtkApplication (`Gio.Application.getDefault()` is null there).\n// RN's Dimensions(\"window\") means the MAIN window: transient toplevels\n// (Modal → modal GtkWindow, dialogs) must never be resolved as \"the window\" —\n// an open modal becomes the active window and would shrink the app viewport\n// to the modal size.\nconst isMainWindow = (window: Gtk.Window): boolean =>\n window.getTransientFor() === null\n\nconst resolveWindow = (): Gtk.Window | null => {\n const active = getActiveAppWindow()\n if (active && isMainWindow(active)) {\n return active\n }\n const toplevels = Gtk.Window.getToplevels()\n const count = toNumber(toplevels.getNItems())\n let first: Gtk.Window | null = null\n for (let index = 0; index < count; index += 1) {\n const window = windowAt(toplevels, index)\n if (!window || !isMainWindow(window)) {\n continue\n }\n if (window.isActive()) {\n return window\n }\n first = first ?? window\n }\n return first\n}\n\nconst isAnyWindowActive = (): boolean => {\n const toplevels = Gtk.Window.getToplevels()\n const count = toNumber(toplevels.getNItems())\n for (let index = 0; index < count; index += 1) {\n if (windowAt(toplevels, index)?.isActive()) {\n return true\n }\n }\n return false\n}\n\nconst windowMetrics = (): ScaledSize => {\n const window = resolveWindow()\n if (!window) {\n return FALLBACK_METRICS\n }\n // RN's Dimensions(\"window\") is the app viewport: the window CHILD's\n // allocation (the content area under the headerbar), not the window widget\n // size. Falls back to the window size before the first allocation.\n const child = window.getChild()\n const childAllocation = child?.getAllocation()\n const allocatedWidth =\n childAllocation && childAllocation.width > 0\n ? toNumber(childAllocation.width)\n : toNumber(window.getWidth())\n const allocatedHeight =\n childAllocation && childAllocation.height > 0\n ? toNumber(childAllocation.height)\n : toNumber(window.getHeight())\n // Before the first allocation everything reports 0 — fall back to\n // the requested default size (which GTK4 also keeps updated on resize).\n const width =\n allocatedWidth > 0\n ? allocatedWidth\n : Math.max(toNumber(window.defaultWidth ?? 0), 0)\n const height =\n allocatedHeight > 0\n ? allocatedHeight\n : Math.max(toNumber(window.defaultHeight ?? 0), 0)\n return {\n width,\n height,\n scale: toNumber(window.getScaleFactor()),\n fontScale: 1,\n }\n}\n\nconst screenMetrics = (): ScaledSize => {\n const display = Gdk.Display.getDefault()\n if (!display) {\n return windowMetrics()\n }\n const monitors = display.getMonitors()\n if (toNumber(monitors.getNItems()) === 0) {\n return windowMetrics()\n }\n const monitor = monitors.getItem(0) as unknown as Gdk.Monitor | null\n if (!monitor) {\n return windowMetrics()\n }\n const geometry = monitor.getGeometry()\n return {\n width: toNumber(geometry.width),\n height: toNumber(geometry.height),\n scale: toNumber(monitor.getScaleFactor()),\n fontScale: 1,\n }\n}\n\n// GtkNative.getSurface is an interface method merged onto Gtk.Window at\n// runtime via mixins; accessed defensively to stay typecheckable either way.\nconst surfaceOf = (window: Gtk.Window): Gdk.Surface | null => {\n const native = window as unknown as { getSurface?: () => Gdk.Surface | null }\n return typeof native.getSurface === \"function\"\n ? (native.getSurface() ?? null)\n : null\n}\n\n// Tracks the \"current\" window across creation/destruction/focus moves:\n// listens on the given signals of the resolved window (and, when requested,\n// its GdkSurface) plus the toplevel list model, re-resolving and re-attaching\n// whenever the tracked window may have changed. Modules dedupe, so\n// over-notifying is fine.\n//\n// Why the surface: notify::default-width fires when setDefaultSize() is\n// called, i.e. before the compositor actually resizes the surface — the\n// allocated size (what Dimensions reports) only changes when the surface\n// does. And GdkSurface notify::width/height fires at configure time, still\n// before the widget allocation pass, so the \"layout\" signal is also needed:\n// it is emitted during the frame's layout phase and — because GTK's own\n// relayout handler is connected first — our handler observes the updated\n// allocation. The module dedupes, so early/no-op emissions cost nothing.\nconst watchWindow = (\n windowSignals: readonly string[],\n surfaceSignals: readonly string[],\n notify: () => void,\n): SubscriptionHandle => {\n let window: Gtk.Window | null = null\n let surface: Gdk.Surface | null = null\n\n const attachWindow = (): void => {\n if (!window) {\n return\n }\n for (const signal of windowSignals) {\n window.on(signal, onSignal)\n }\n }\n\n const detachWindow = (): void => {\n if (!window) {\n return\n }\n for (const signal of windowSignals) {\n window.off(signal, onSignal)\n }\n }\n\n const attachSurface = (): void => {\n if (!surface) {\n return\n }\n for (const signal of surfaceSignals) {\n surface.on(signal, onSignal)\n }\n }\n\n const detachSurface = (): void => {\n if (!surface) {\n return\n }\n for (const signal of surfaceSignals) {\n surface.off(signal, onSignal)\n }\n }\n\n const syncTargets = (): void => {\n const nextWindow = resolveWindow()\n if (nextWindow !== window) {\n detachWindow()\n window = nextWindow\n attachWindow()\n }\n const nextSurface =\n window && surfaceSignals.length > 0 ? surfaceOf(window) : null\n if (nextSurface !== surface) {\n detachSurface()\n surface = nextSurface\n attachSurface()\n }\n }\n\n const onSignal = (): void => {\n syncTargets()\n notify()\n }\n\n const toplevels = Gtk.Window.getToplevels()\n const onToplevelsChanged = (): void => {\n syncTargets()\n notify()\n }\n toplevels.on(\"items-changed\", onToplevelsChanged)\n syncTargets()\n\n return {\n remove: () => {\n detachWindow()\n detachSurface()\n window = null\n surface = null\n toplevels.off(\"items-changed\", onToplevelsChanged)\n },\n }\n}\n\n// realize/map re-run target resolution so the surface listeners attach as\n// soon as the surface exists.\nconst WINDOW_SIZE_SIGNALS = [\n \"notify::default-width\",\n \"notify::default-height\",\n \"realize\",\n \"map\",\n] as const\n\nconst SURFACE_SIZE_SIGNALS = [\n \"notify::width\",\n \"notify::height\",\n \"layout\",\n] as const\n\nconst WINDOW_ACTIVE_SIGNALS = [\"notify::is-active\"] as const\n\nconst gtkVersion = (): string =>\n `${toNumber(Gtk.getMajorVersion())}.${toNumber(Gtk.getMinorVersion())}.${toNumber(Gtk.getMicroVersion())}`\n\n// AdwStyleManager is the only thing that decides the palette here, and it is\n// enough on its own — appearance.test.tsx asserts that a real widget's\n// computed foreground flips with it. This used to also write the classic\n// GtkSettings:gtk-application-prefer-dark-theme, guarding against Adwaita\n// not restyling a GtkApplication (we do not use AdwApplication). Under\n// libadwaita that write is inert: adw_init() takes the color scheme over,\n// answers the setting with \"unsupported ... use AdwStyleManager:color-scheme\n// instead\" and keeps its own value, so all the duplicate ever produced was a\n// warning per call — seven per test run.\nconst setColorScheme = (scheme: ColorSchemeName | null): void => {\n const manager = styleManager()\n if (scheme === \"dark\") {\n manager.setColorScheme(Adw.ColorScheme.FORCE_DARK)\n } else if (scheme === \"light\") {\n manager.setColorScheme(Adw.ColorScheme.FORCE_LIGHT)\n } else {\n manager.setColorScheme(Adw.ColorScheme.DEFAULT)\n }\n}\n\nconst onColorSchemeChange = (notify: () => void): SubscriptionHandle => {\n const manager = styleManager()\n const listener = (): void => notify()\n manager.on(\"notify::dark\", listener)\n return { remove: () => manager.off(\"notify::dark\", listener) }\n}\n\nconst showAlert = async (request: HostAlertRequest): Promise<string | null> => {\n const dialog = new Adw.AlertDialog()\n dialog.setHeading(request.title)\n if (request.message !== undefined && request.message.length > 0) {\n dialog.setBody(request.message)\n }\n let closeResponse: string | null = null\n for (const button of request.buttons) {\n dialog.addResponse(button.id, button.label)\n if (button.style === \"destructive\") {\n dialog.setResponseAppearance(\n button.id,\n Adw.ResponseAppearance.DESTRUCTIVE,\n )\n }\n if (button.isPreferred) {\n dialog.setResponseAppearance(button.id, Adw.ResponseAppearance.SUGGESTED)\n dialog.setDefaultResponse(button.id)\n }\n if (button.style === \"cancel\") {\n closeResponse = button.id\n }\n }\n if (closeResponse !== null) {\n // Esc / close maps onto the cancel button, like RN's cancel semantics.\n dialog.setCloseResponse(closeResponse)\n } else if (!request.cancelable) {\n // No cancel button and not cancelable: block Esc-dismissal. Responses\n // still close the dialog (they bypass the can-close guard).\n dialog.setCanClose(false)\n }\n const response = await dialog.choose(resolveWindow())\n // Anything that is not one of our buttons (e.g. the built-in \"close\"\n // response) is a dismissal.\n return request.buttons.some((button) => button.id === response)\n ? response\n : null\n}\n\nconst launchUri = async (uri: string): Promise<void> => {\n const launcher = new Gtk.UriLauncher({ uri })\n // Promisified by the gi codegen; rejects with the GError on failure.\n await launcher.launch(resolveWindow())\n}\n\n// The default widget direction is GTK's read of the locale text direction.\nconst isRTL = (): boolean => {\n try {\n return Gtk.Widget.getDefaultDirection() === Gtk.TextDirection.RTL\n } catch {\n return false\n }\n}\n\nexport const gtkxHost: Host = {\n gtkVersion,\n getWindowMetrics: windowMetrics,\n getScreenMetrics: screenMetrics,\n onMetricsChange: (notify) =>\n watchWindow(WINDOW_SIZE_SIGNALS, SURFACE_SIZE_SIGNALS, notify),\n getColorScheme: () => colorScheme(),\n setColorScheme,\n onColorSchemeChange,\n isActive: isAnyWindowActive,\n onActiveChange: (notify) => watchWindow(WINDOW_ACTIVE_SIGNALS, [], notify),\n showAlert,\n launchUri,\n isRTL,\n exitApp: () => quit(),\n}\n"]}
|
package/dist/apis/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const Platform: {
|
|
2
|
-
OS: "
|
|
2
|
+
OS: import("./platform").PlatformOSType;
|
|
3
3
|
isTV: false;
|
|
4
4
|
isTesting: boolean;
|
|
5
5
|
readonly Version: string;
|
|
@@ -45,6 +45,8 @@ export declare const BackHandler: {
|
|
|
45
45
|
dispatchBackPress(): boolean;
|
|
46
46
|
};
|
|
47
47
|
export { DevSettings } from "./dev-settings";
|
|
48
|
+
export { Keyboard, type KeyboardEvent, type KeyboardEventName, } from "./keyboard";
|
|
49
|
+
export { LogBox, type LogBoxIgnorePattern } from "./log-box";
|
|
48
50
|
export { InteractionManager, type InteractionPromise, } from "./interaction-manager";
|
|
49
51
|
export declare const useWindowDimensions: () => import("./host").ScaledSize;
|
|
50
52
|
export declare const useColorScheme: () => import("./host").ColorSchemeName;
|
|
@@ -53,4 +55,4 @@ export type { AppStateEvent, AppStateStatus } from "./app-state";
|
|
|
53
55
|
export type { AppearancePreferences } from "./appearance";
|
|
54
56
|
export type { DimensionKey, DimensionsPayload } from "./dimensions";
|
|
55
57
|
export type { AlertButtonStyle, ColorSchemeName, ScaledSize } from "./host";
|
|
56
|
-
export type { PlatformSelectSpec } from "./platform";
|
|
58
|
+
export type { PlatformOSType, PlatformSelectSpec } from "./platform";
|
package/dist/apis/index.js
CHANGED
|
@@ -20,6 +20,8 @@ export const Linking = createLinking(gtkxHost);
|
|
|
20
20
|
export const I18nManager = createI18nManager(gtkxHost);
|
|
21
21
|
export const BackHandler = createBackHandler(gtkxHost);
|
|
22
22
|
export { DevSettings } from "./dev-settings";
|
|
23
|
+
export { Keyboard, } from "./keyboard";
|
|
24
|
+
export { LogBox } from "./log-box";
|
|
23
25
|
export { InteractionManager, } from "./interaction-manager";
|
|
24
26
|
export const useWindowDimensions = createUseWindowDimensions(Dimensions);
|
|
25
27
|
export const useColorScheme = createUseColorScheme(Appearance);
|
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"]}
|
package/dist/common/index.d.ts
CHANGED
|
@@ -2,4 +2,3 @@ export { NavigationStack, NavigationStackPage, type NavigationStackPageProps, ty
|
|
|
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
4
|
export { Icon, type IconProps } from "./icon";
|
|
5
|
-
export { List, ListRow, ListSeparator, rowPosition, type ListProps, type ListRowPosition, type ListRowProps, } from "./list";
|
package/dist/common/index.js
CHANGED
|
@@ -17,5 +17,28 @@ export { NavigationStack, NavigationStackPage, } from "./navigation-stack";
|
|
|
17
17
|
export { HeaderSlotContent, IntrinsicContent, SlotContent, WidgetContent, } from "./content";
|
|
18
18
|
export { useWidgetLayout, Widget, wrapReactNative, } from "./widget";
|
|
19
19
|
export { Icon } from "./icon";
|
|
20
|
-
|
|
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`.
|
|
21
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;AAEjB,OAAO,EAAE,IAAI,EAAkB,MAAM,QAAQ,CAAA;AAE7C,
|
|
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"]}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import { type ReactNode } from "react";
|
|
2
|
-
import
|
|
1
|
+
import { type ComponentProps, type ElementType, type ReactNode, type Ref } from "react";
|
|
2
|
+
import { type InsetProperty } from "../style/absolute-insets";
|
|
3
|
+
import { type SizeProperty } from "../style/animated-size";
|
|
4
|
+
import { type DriveableColorProperty } from "../style/imperative-css";
|
|
5
|
+
import type { DimensionValue, FlatStyle, PointerEventsValue, StyleProp, TransformPart } from "../contracts";
|
|
3
6
|
import type { ResponderProps } from "../responder/types";
|
|
7
|
+
import { type MeasureHandle } from "./measure";
|
|
4
8
|
import { type LayoutEvent } from "./use-layout-child";
|
|
5
9
|
type AnimatedValue = number | string;
|
|
6
10
|
type AnimatedNode = {
|
|
@@ -13,18 +17,78 @@ type AnimatedNode = {
|
|
|
13
17
|
type AnimatedTransformPart = {
|
|
14
18
|
[key: string]: number | string | AnimatedNode;
|
|
15
19
|
};
|
|
16
|
-
export type AnimatedViewStyle = Omit<FlatStyle, "opacity" | "transform"> & {
|
|
20
|
+
export type AnimatedViewStyle = Omit<FlatStyle, "opacity" | "zIndex" | "transform" | DriveableColorProperty | InsetProperty | SizeProperty> & {
|
|
17
21
|
opacity?: number | AnimatedNode;
|
|
22
|
+
zIndex?: number | AnimatedNode;
|
|
18
23
|
transform?: (TransformPart | AnimatedTransformPart)[];
|
|
19
|
-
}
|
|
24
|
+
} & Partial<Record<DriveableColorProperty, string | AnimatedNode>> & Partial<Record<InsetProperty, DimensionValue | AnimatedNode>> & Partial<Record<SizeProperty, DimensionValue | AnimatedNode>>;
|
|
25
|
+
/** What every animated component accepts as `style`, arrays and falsy included. */
|
|
26
|
+
export type AnimatedStyleProp = AnimatedViewStyle | readonly (AnimatedViewStyle | false | null | undefined)[];
|
|
20
27
|
export type AnimatedViewProps = ResponderProps & {
|
|
21
|
-
style?:
|
|
28
|
+
style?: AnimatedStyleProp;
|
|
22
29
|
children?: ReactNode;
|
|
23
30
|
onLayout?: (event: LayoutEvent) => void;
|
|
24
31
|
testID?: string;
|
|
32
|
+
pointerEvents?: PointerEventsValue;
|
|
33
|
+
animatedProps?: Record<string, unknown>;
|
|
34
|
+
ref?: Ref<MeasureHandle>;
|
|
35
|
+
};
|
|
36
|
+
/** @internal Test seam: the warning is once per property per session by design. */
|
|
37
|
+
export declare const resetAnimatedInsetWarnings: () => void;
|
|
38
|
+
/** @internal Test seam: the warning is once per property per session by design. */
|
|
39
|
+
export declare const resetAnimatedSizeWarnings: () => void;
|
|
40
|
+
/** Node-backed props from `useAnimatedProps`, spread onto the wrapped component. */
|
|
41
|
+
export type AnimatedPropsProp = Record<string, unknown>;
|
|
42
|
+
/** The props an animated wrapper adds on top of the component's own. */
|
|
43
|
+
export type AnimatedComponentExtraProps = {
|
|
44
|
+
style?: AnimatedStyleProp;
|
|
45
|
+
animatedProps?: AnimatedPropsProp;
|
|
25
46
|
};
|
|
47
|
+
export type AnimatedComponent<C extends ElementType> = (props: Partial<Omit<ComponentProps<C>, "style">> & AnimatedComponentExtraProps) => ReactNode;
|
|
48
|
+
/** @internal Test seam: the warning is once per component per session by design. */
|
|
49
|
+
export declare const resetAnimatedComponentWarnings: () => void;
|
|
50
|
+
/**
|
|
51
|
+
* Wraps a component so its `style`'s `opacity`/`transform` and its
|
|
52
|
+
* `animatedProps` can be driven imperatively — RN's own
|
|
53
|
+
* `Animated.createAnimatedComponent`.
|
|
54
|
+
*
|
|
55
|
+
* IT ADDS NO WIDGET. Wrapping in an `Animated.View` would have been three
|
|
56
|
+
* lines and would have been wrong: an extra box changes flex layout, changes
|
|
57
|
+
* what `measureLayout` is relative to, and changes which widget a parent's
|
|
58
|
+
* allocate walks. That is not a shim, it is a different tree. Instead the
|
|
59
|
+
* wrapper renders the component itself and reaches the widget through the
|
|
60
|
+
* handle the component already exposes (see measure.ts's `widgetOf`), so the
|
|
61
|
+
* rendered output is byte-for-byte what the unwrapped component produces.
|
|
62
|
+
*
|
|
63
|
+
* `animatedProps` are passed straight through as animated NODES rather than
|
|
64
|
+
* resolved to numbers, because the components that take them already accept
|
|
65
|
+
* one: the SVG shapes duck-type an animated node on every numeric geometry
|
|
66
|
+
* and paint prop and subscribe to it themselves (svg/animated-support.ts),
|
|
67
|
+
* redrawing through `queueDraw`. Nothing is resolved here that the receiver
|
|
68
|
+
* can resolve better.
|
|
69
|
+
*/
|
|
70
|
+
export declare const createAnimatedComponent: <C extends ElementType>(component: C) => AnimatedComponent<C>;
|
|
26
71
|
export declare const Animated: {
|
|
27
|
-
View: ({ style, children, onLayout, testID, ...responderProps }: AnimatedViewProps) => React.JSX.Element;
|
|
72
|
+
View: ({ style, children, onLayout, testID, ref, pointerEvents, animatedProps, ...responderProps }: AnimatedViewProps) => React.JSX.Element;
|
|
73
|
+
Text: AnimatedComponent<({ style, onLayout, numberOfLines, children, testID, ref, }: import("./text").TextProps) => React.JSX.Element>;
|
|
74
|
+
Image: AnimatedComponent<({ source, style, resizeMode, onLayout, onLoad, onError, testID, ref, }: import("./image").ImageProps) => React.JSX.Element>;
|
|
75
|
+
ScrollView: AnimatedComponent<React.ForwardRefExoticComponent<ResponderProps & {
|
|
76
|
+
style?: StyleProp;
|
|
77
|
+
contentContainerStyle?: StyleProp;
|
|
78
|
+
horizontal?: boolean;
|
|
79
|
+
stickyHeaderIndices?: readonly number[];
|
|
80
|
+
onScroll?: (event: import("./scroll-view").ScrollEvent) => void;
|
|
81
|
+
onScrollBeginDrag?: (event: import("./scroll-view").ScrollEvent) => void;
|
|
82
|
+
onScrollEndDrag?: (event: import("./scroll-view").ScrollEvent) => void;
|
|
83
|
+
onMomentumScrollBegin?: (event: import("./scroll-view").ScrollEvent) => void;
|
|
84
|
+
onMomentumScrollEnd?: (event: import("./scroll-view").ScrollEvent) => void;
|
|
85
|
+
onContentSizeChange?: (width: number, height: number) => void;
|
|
86
|
+
onLayout?: (event: LayoutEvent) => void;
|
|
87
|
+
children?: ReactNode;
|
|
88
|
+
testID?: string;
|
|
89
|
+
} & React.RefAttributes<import("./scroll-view").ScrollViewHandle>>>;
|
|
90
|
+
FlatList: (props: Record<string, unknown>) => never;
|
|
91
|
+
createAnimatedComponent: <C extends ElementType>(component: C) => AnimatedComponent<C>;
|
|
28
92
|
Value: typeof import("../animated/value").AnimatedValue;
|
|
29
93
|
ValueXY: typeof import("../animated/value-xy").AnimatedValueXY;
|
|
30
94
|
timing(value: import("../animated/value").AnimatedValue, config: import("../animated/types").TimingConfig): import("../animated/types").CompositeAnimation;
|