react-native-gtkx 0.3.0-alpha.1 → 0.4.0-alpha.3

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.
Files changed (169) hide show
  1. package/README.md +35 -96
  2. package/dist/adw/index.d.ts +3 -2
  3. package/dist/adw/index.js +24 -6
  4. package/dist/adw/index.js.map +1 -1
  5. package/dist/adw/widgets.generated.d.ts +1 -1
  6. package/dist/adw/widgets.generated.js +2 -2
  7. package/dist/adw/widgets.generated.js.map +1 -1
  8. package/dist/animated/create-animated.d.ts +2 -0
  9. package/dist/animated/create-animated.js +2 -0
  10. package/dist/animated/create-animated.js.map +1 -1
  11. package/dist/animated/event.d.ts +15 -0
  12. package/dist/animated/event.js +80 -0
  13. package/dist/animated/event.js.map +1 -0
  14. package/dist/animated/index.d.ts +4 -0
  15. package/dist/animated/index.js +8 -0
  16. package/dist/animated/index.js.map +1 -1
  17. package/dist/animated/spring.d.ts +10 -0
  18. package/dist/animated/spring.js +20 -6
  19. package/dist/animated/spring.js.map +1 -1
  20. package/dist/animated/timing.d.ts +10 -0
  21. package/dist/animated/timing.js +21 -13
  22. package/dist/animated/timing.js.map +1 -1
  23. package/dist/apis/host.gtkx.js +70 -11
  24. package/dist/apis/host.gtkx.js.map +1 -1
  25. package/dist/common/navigation-stack.d.ts +6 -3
  26. package/dist/common/navigation-stack.js +8 -1
  27. package/dist/common/navigation-stack.js.map +1 -1
  28. package/dist/common/widget.js +2 -11
  29. package/dist/common/widget.js.map +1 -1
  30. package/dist/components/animated.d.ts +1 -0
  31. package/dist/components/animated.js +28 -4
  32. package/dist/components/animated.js.map +1 -1
  33. package/dist/components/app-registry.js +32 -8
  34. package/dist/components/app-registry.js.map +1 -1
  35. package/dist/components/request-animation-frame.d.ts +33 -0
  36. package/dist/components/request-animation-frame.js +83 -0
  37. package/dist/components/request-animation-frame.js.map +1 -0
  38. package/dist/components/scroll-view.js +60 -2
  39. package/dist/components/scroll-view.js.map +1 -1
  40. package/dist/components/virtualized-list.js +1 -4
  41. package/dist/components/virtualized-list.js.map +1 -1
  42. package/dist/dnd/autoscroll.d.ts +44 -0
  43. package/dist/dnd/autoscroll.js +176 -0
  44. package/dist/dnd/autoscroll.js.map +1 -0
  45. package/dist/dnd/grid-order.d.ts +45 -0
  46. package/dist/dnd/grid-order.js +151 -0
  47. package/dist/dnd/grid-order.js.map +1 -0
  48. package/dist/dnd/grid.d.ts +44 -0
  49. package/dist/dnd/grid.js +397 -0
  50. package/dist/dnd/grid.js.map +1 -0
  51. package/dist/dnd/gtk-controllers.d.ts +16 -2
  52. package/dist/dnd/gtk-controllers.js +24 -4
  53. package/dist/dnd/gtk-controllers.js.map +1 -1
  54. package/dist/dnd/index.d.ts +4 -2
  55. package/dist/dnd/index.js +9 -2
  56. package/dist/dnd/index.js.map +1 -1
  57. package/dist/dnd/order-state.d.ts +14 -0
  58. package/dist/dnd/order-state.js +55 -0
  59. package/dist/dnd/order-state.js.map +1 -0
  60. package/dist/dnd/order.d.ts +19 -0
  61. package/dist/dnd/order.js +19 -0
  62. package/dist/dnd/order.js.map +1 -1
  63. package/dist/dnd/sortable.d.ts +29 -4
  64. package/dist/dnd/sortable.js +308 -115
  65. package/dist/dnd/sortable.js.map +1 -1
  66. package/dist/dnd/types.d.ts +236 -14
  67. package/dist/dnd/types.js +30 -0
  68. package/dist/dnd/types.js.map +1 -1
  69. package/dist/gesture-handler-compat/attach-context.d.ts +29 -0
  70. package/dist/gesture-handler-compat/attach-context.js +90 -0
  71. package/dist/gesture-handler-compat/attach-context.js.map +1 -0
  72. package/dist/gesture-handler-compat/detector-runtime.d.ts +14 -3
  73. package/dist/gesture-handler-compat/detector-runtime.js +15 -5
  74. package/dist/gesture-handler-compat/detector-runtime.js.map +1 -1
  75. package/dist/gesture-handler-compat/detector.js +57 -2
  76. package/dist/gesture-handler-compat/detector.js.map +1 -1
  77. package/dist/gesture-handler-compat/gesture-state-manager.d.ts +5 -0
  78. package/dist/gesture-handler-compat/gesture-state-manager.js +77 -0
  79. package/dist/gesture-handler-compat/gesture-state-manager.js.map +1 -0
  80. package/dist/gesture-handler-compat/index.d.ts +2 -2
  81. package/dist/gesture-handler-compat/index.js +38 -33
  82. package/dist/gesture-handler-compat/index.js.map +1 -1
  83. package/dist/gesture-handler-compat/recognizer.d.ts +12 -1
  84. package/dist/gesture-handler-compat/recognizer.js +23 -9
  85. package/dist/gesture-handler-compat/recognizer.js.map +1 -1
  86. package/dist/gesture-handler-compat/tag-registry.d.ts +14 -0
  87. package/dist/gesture-handler-compat/tag-registry.js +19 -0
  88. package/dist/gesture-handler-compat/tag-registry.js.map +1 -0
  89. package/dist/globals/index.d.ts +47 -0
  90. package/dist/globals/index.js +181 -0
  91. package/dist/globals/index.js.map +1 -0
  92. package/dist/globals/install.d.ts +1 -0
  93. package/dist/globals/install.js +14 -0
  94. package/dist/globals/install.js.map +1 -0
  95. package/dist/gtk/index.js +4 -3
  96. package/dist/gtk/index.js.map +1 -1
  97. package/dist/gtkx/bridge/adw-namespace.d.ts +2 -0
  98. package/dist/gtkx/bridge/adw-namespace.js +26 -0
  99. package/dist/gtkx/bridge/adw-namespace.js.map +1 -0
  100. package/dist/gtkx/bridge/adw.d.ts +23 -0
  101. package/dist/gtkx/bridge/adw.js +93 -0
  102. package/dist/gtkx/bridge/adw.js.map +1 -0
  103. package/dist/gtkx/bridge/color-scheme-parse.d.ts +11 -0
  104. package/dist/gtkx/bridge/color-scheme-parse.js +42 -0
  105. package/dist/gtkx/bridge/color-scheme-parse.js.map +1 -0
  106. package/dist/gtkx/bridge/color-scheme-portal.d.ts +24 -0
  107. package/dist/gtkx/bridge/color-scheme-portal.js +172 -0
  108. package/dist/gtkx/bridge/color-scheme-portal.js.map +1 -0
  109. package/dist/gtkx/bridge/core.d.ts +25 -0
  110. package/dist/gtkx/bridge/core.js +69 -0
  111. package/dist/gtkx/bridge/core.js.map +1 -0
  112. package/dist/gtkx/bridge/drag-layer.d.ts +27 -0
  113. package/dist/gtkx/bridge/drag-layer.js +177 -0
  114. package/dist/gtkx/bridge/drag-layer.js.map +1 -0
  115. package/dist/gtkx/bridge/index.d.ts +1 -27
  116. package/dist/gtkx/bridge/index.js +12 -71
  117. package/dist/gtkx/bridge/index.js.map +1 -1
  118. package/dist/gtkx/bridge/view-box.js +1 -1
  119. package/dist/gtkx/bridge/view-box.js.map +1 -1
  120. package/dist/gtkx/bridge/widgets.generated.adw.d.ts +1 -0
  121. package/dist/gtkx/bridge/widgets.generated.adw.js +16 -0
  122. package/dist/gtkx/bridge/widgets.generated.adw.js.map +1 -0
  123. package/dist/gtkx/bridge/widgets.generated.d.ts +0 -1
  124. package/dist/gtkx/bridge/widgets.generated.js +3 -3
  125. package/dist/gtkx/bridge/widgets.generated.js.map +1 -1
  126. package/dist/index.js +20 -0
  127. package/dist/index.js.map +1 -1
  128. package/dist/mcp/bin.js +1 -1
  129. package/dist/mcp/bin.js.map +1 -1
  130. package/dist/mcp/data/generated.d.ts +815 -481
  131. package/dist/mcp/data/generated.js +933 -513
  132. package/dist/mcp/data/generated.js.map +1 -1
  133. package/dist/mcp/resolve.d.ts +2 -2
  134. package/dist/mcp/resolve.js +2 -2
  135. package/dist/mcp/resolve.js.map +1 -1
  136. package/dist/mcp/server.js +2 -2
  137. package/dist/mcp/server.js.map +1 -1
  138. package/dist/metro/index.d.ts +1 -0
  139. package/dist/metro/index.js +12 -0
  140. package/dist/metro/index.js.map +1 -1
  141. package/dist/navigation/sidebar.js +2 -45
  142. package/dist/navigation/sidebar.js.map +1 -1
  143. package/dist/reanimated-compat/animatable-value.d.ts +158 -0
  144. package/dist/reanimated-compat/animatable-value.js +316 -0
  145. package/dist/reanimated-compat/animatable-value.js.map +1 -0
  146. package/dist/reanimated-compat/animation.d.ts +34 -13
  147. package/dist/reanimated-compat/animation.js +97 -25
  148. package/dist/reanimated-compat/animation.js.map +1 -1
  149. package/dist/reanimated-compat/mutable.js +6 -6
  150. package/dist/reanimated-compat/mutable.js.map +1 -1
  151. package/dist/reanimated-compat/updater-animations.js +32 -12
  152. package/dist/reanimated-compat/updater-animations.js.map +1 -1
  153. package/dist/runner/host-dev.js +5 -1
  154. package/dist/runner/host-dev.js.map +1 -1
  155. package/dist/runner/host.js +9 -1
  156. package/dist/runner/host.js.map +1 -1
  157. package/dist/sea/bundle.js +1 -1
  158. package/dist/sea/bundle.js.map +1 -1
  159. package/dist/sea/native-shim.js +3 -2
  160. package/dist/sea/native-shim.js.map +1 -1
  161. package/dist/vite/index.js +130 -0
  162. package/dist/vite/index.js.map +1 -1
  163. package/dist/vitest/index.d.ts +1 -1
  164. package/dist/vitest/index.js +1 -1
  165. package/dist/vitest/index.js.map +1 -1
  166. package/package.json +1 -1
  167. package/dist/gtkx/bridge/theme.d.ts +0 -4
  168. package/dist/gtkx/bridge/theme.js +0 -5
  169. package/dist/gtkx/bridge/theme.js.map +0 -1
@@ -118,13 +118,7 @@ export const useWidgetLayout = (ref, options = {}) => {
118
118
  // with nothing in the name or the GIR type to tell them apart — the answer
119
119
  // lives in the widget's own layout code. The boundary is what makes NOT
120
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 }) }));
121
+ const SlotBoundary = ({ location, children, }) => (_jsx(SlotContext.Provider, { value: location, children: _jsx(HostNodeContext.Provider, { value: null, children: children }) }));
128
122
  const holdsElement = (value) => isValidElement(value) || (Array.isArray(value) && value.some(holdsElement));
129
123
  // Puts every element-valued prop, and the children, behind a boundary.
130
124
  // `ref` is never content; anything that holds no element (a string child, a
@@ -141,10 +135,7 @@ const withSlotBoundaries = (props, widget) => {
141
135
  continue;
142
136
  }
143
137
  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 }));
138
+ bounded[key] = (_jsx(SlotBoundary, { location: { widget, slot: key === "children" ? null : key }, children: value }));
148
139
  }
149
140
  // The common case is a widget with no element-valued prop at all: return the
150
141
  // props object untouched rather than allocate a copy per render.
@@ -1 +1 @@
1
- {"version":3,"file":"widget.js","sourceRoot":"","sources":["../../src/common/widget.tsx"],"names":[],"mappings":";AAAA,wEAAwE;AACxE,EAAE;AACF,4EAA4E;AAC5E,2EAA2E;AAC3E,2EAA2E;AAC3E,8EAA8E;AAC9E,6EAA6E;AAC7E,8EAA8E;AAC9E,gDAAgD;AAChD,EAAE;AACF,4EAA4E;AAC5E,+CAA+C;AAC/C,OAAO,EACL,cAAc,EACd,UAAU,EACV,MAAM,GAGP,MAAM,OAAO,CAAA;AACd,OAAO,EACL,eAAe,EACf,WAAW,GAEZ,MAAM,yBAAyB,CAAA;AAChC,OAAO,EACL,cAAc,GAEf,MAAM,gCAAgC,CAAA;AAEvC,OAAO,EAAE,MAAM,EAAY,MAAM,sBAAsB,CAAA;AAYvD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAe,EAAE,EAAE;IAC3E,2EAA2E;IAC3E,0EAA0E;IAC1E,yDAAyD;IACzD,MAAM,MAAM,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAA;IAC3C,MAAM,EAAE,QAAQ,EAAE,GAAG,cAAc,CAAC,MAAM,EAAE;QAC1C,KAAK;QACL,QAAQ;QACR,sEAAsE;QACtE,6DAA6D;QAC7D,iBAAiB,EAAE,IAAI;KACxB,CAAC,CAAA;IAEF,OAAO,CACL,KAAC,MAAM,IACL,GAAG,E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A;YAChE,OAAO,IAAI,CAAC,KAAK,CAAA;YACjB,OAAO,IAAI,CAAC,QAAQ,CAAA;YACpB,OAAO,KAAC,SAAS,OAAM,IAAU,GAAI,CAAA;QACvC,CAAC;QACD,OAAO,KAAC,QAAQ,OAAK,SAAS,GAAI,CAAA;IACpC,CAAC,CAAA;IAED,QAAQ,CAAC,WAAW,GAAG,mBAAmB,IAAI,YAAY,CAAA;IAC1D,OAAO,CAAC,WAAW,GAAG,mBAAmB,IAAI,GAAG,CAAA;IAChD,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA","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"]}
1
+ {"version":3,"file":"widget.js","sourceRoot":"","sources":["../../src/common/widget.tsx"],"names":[],"mappings":";AAAA,wEAAwE;AACxE,EAAE;AACF,4EAA4E;AAC5E,2EAA2E;AAC3E,2EAA2E;AAC3E,8EAA8E;AAC9E,6EAA6E;AAC7E,8EAA8E;AAC9E,gDAAgD;AAChD,EAAE;AACF,4EAA4E;AAC5E,+CAA+C;AAC/C,OAAO,EACL,cAAc,EACd,UAAU,E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D,8CAA8C;gBAC9C,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,IAAI,EAC9B,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,IAAI,GAC9B,GACK,CACV,CAAA;IACH,CAAC,CAAA;IAED,MAAM,OAAO,GAAG,CAAC,KAAiC,EAAE,EAAE;QACpD,0EAA0E;QAC1E,0EAA0E;QAC1E,kCAAkC;QAClC,MAAM,SAAS,GAAG,kBAAkB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;QACjD,0EAA0E;QAC1E,sEAAsE;QACtE,yEAAyE;QACzE,+DAA+D;QAC/D,MAAM,IAAI,GAAG,UAAU,CAAC,eAAe,CAAC,CAAA;QACxC,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,wEAAwE;YACxE,gEAAgE;YAChE,MAAM,IAAI,GAAG,EAAE,GAAG,SAAS,EAAqC,CAAA;YAChE,OAAO,IAAI,CAAC,KAAK,CAAA;YACjB,OAAO,IAAI,CAAC,QAAQ,CAAA;YACpB,OAAO,KAAC,SAAS,OAAM,IAAU,GAAI,CAAA;QACvC,CAAC;QACD,OAAO,KAAC,QAAQ,OAAK,SAAS,GAAI,CAAA;IACpC,CAAC,CAAA;IAED,QAAQ,CAAC,WAAW,GAAG,mBAAmB,IAAI,YAAY,CAAA;IAC1D,OAAO,CAAC,WAAW,GAAG,mBAAmB,IAAI,GAAG,CAAA;IAChD,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA","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"]}
@@ -97,5 +97,6 @@ export declare const Animated: {
97
97
  parallel(animations: import("../animated/types").CompositeAnimation[], config?: import("../animated/types").ParallelConfig): import("../animated/types").CompositeAnimation;
98
98
  delay(ms: number): import("../animated/types").CompositeAnimation;
99
99
  loop(animation: import("../animated/types").CompositeAnimation, config?: import("../animated/types").LoopConfig): import("../animated/types").CompositeAnimation;
100
+ event(argMapping: readonly (import("../animated/event").EventMapping | null | undefined)[], config?: import("../animated/event").AnimatedEventConfig): (...args: unknown[]) => void;
100
101
  };
101
102
  export { Easing } from "../animated/index";
@@ -5,6 +5,7 @@ import { drivenSizeRefusal, SIZE_PROPERTIES, } from "../style/animated-size";
5
5
  import { DRIVEABLE_COLOR_PROPERTIES, driveableColorsToCss, } from "../style/imperative-css";
6
6
  import { StyleSheet } from "../style/index";
7
7
  import { createAnimated } from "../animated/index";
8
+ import { GestureAttachContext, mergeGestureHandlers, useGestureAttach, } from "../gesture-handler-compat/attach-context";
8
9
  import { createWidgetCss, GtkBox, queueAllocate, setBoxPassthrough, setPointerTarget, setZIndex, } from "../gtkx/bridge/index";
9
10
  import { useResponder } from "../responder/use-responder";
10
11
  import { applyDrivenSize, releaseDrivenSize } from "./driven-size";
@@ -513,7 +514,16 @@ const AnimatedView = ({ style, children, onLayout, testID, ref, pointerEvents, a
513
514
  onLayout,
514
515
  });
515
516
  useRnContainer(widgetRef, node);
516
- useResponder(widgetRef, responderProps);
517
+ // A gesture whose own GestureDetector could not reach a widget directly —
518
+ // its child was an opaque composite that renders this Animated.View but
519
+ // forwards neither a ref nor its own props onto it, react-native-sortables'
520
+ // ItemCell being the confirmed case (gesture-handler-compat/attach-context.ts)
521
+ // — claims this widget instead, through context rather than through the
522
+ // props ItemCell dropped.
523
+ const gestureAttach = useGestureAttach();
524
+ useResponder(widgetRef, gestureAttach
525
+ ? mergeGestureHandlers(responderProps, gestureAttach.handlers)
526
+ : responderProps);
517
527
  // `animatedProps` LAST, matching `createAnimatedComponent`'s
518
528
  // `{ ...rest, ...animatedProps }` — a value produced by the updater is the
519
529
  // live one and wins over the static prop. Only the picking mode is read
@@ -532,8 +542,18 @@ const AnimatedView = ({ style, children, onLayout, testID, ref, pointerEvents, a
532
542
  setBoxPassthrough(widget, mode === "box-none");
533
543
  }, [mode]);
534
544
  useImperativeHandle(ref, () => createMeasureHandle(widgetRef, node), [node]);
545
+ // Registers this widget as the fallback gesture's handle — the same
546
+ // `assignHandle` its GestureDetector would have put directly on the ref, had
547
+ // its child forwarded one. A fresh handle rather than reusing the one above:
548
+ // `useImperativeHandle`'s factory only runs when `ref` itself is non-null,
549
+ // which is not the case here (ItemCell passes none), so there is nothing to
550
+ // reuse — and a second handle for the same widget is harmless, `measure.ts`
551
+ // keys by handle identity, not by widget.
552
+ useLayoutEffect(() => {
553
+ gestureAttach?.assignHandle(createMeasureHandle(widgetRef, node));
554
+ }, [gestureAttach, node]);
535
555
  useAnimatedBinding(() => widgetRef.current, host, opacity, zIndex, slots, colors, sizes, node);
536
- return (_jsx(GtkBox, { ref: widgetRef, name: testID, cssClasses: cssClass ? [cssClass] : [], children: _jsx(HostNodeContext.Provider, { value: { engine: host.engine, node, widgetRef }, children: children }) }));
556
+ return (_jsx(GtkBox, { ref: widgetRef, name: testID, cssClasses: cssClass ? [cssClass] : [], children: _jsx(HostNodeContext.Provider, { value: { engine: host.engine, node, widgetRef }, children: _jsx(GestureAttachContext.Provider, { value: null, children: children }) }) }));
537
557
  };
538
558
  const displayNameOf = (component) => {
539
559
  if (typeof component === "string") {
@@ -649,8 +669,12 @@ export const createAnimatedComponent = (component) => {
649
669
  * scrolled window through two layers that exist to hide it.
650
670
  *
651
671
  * Upstream's `Animated.FlatList` mostly exists so `onScroll` can be an
652
- * `Animated.event`/`useAnimatedScrollHandler`, and neither of those is
653
- * implemented here either. So this throws where it is used, naming itself and
672
+ * `Animated.event`/`useAnimatedScrollHandler` both work on this platform
673
+ * (../animated/event.ts, ../reanimated-compat/scroll-handler.ts) which is
674
+ * exactly why the refusal survives without taking that with it: either one
675
+ * still reaches the widget through the plain `FlatList`'s own `onScroll`
676
+ * (forwarded straight to the windowed core's `ScrollView`) or through
677
+ * `Animated.ScrollView`. So this throws where it is used, naming itself and
654
678
  * naming the two things that do work.
655
679
  */
656
680
  const AnimatedFlatList = () => {
@@ -1 +1 @@
1
- {"version":3,"file":"animated.js","sourceRoot":"","sources":["../../src/components/animated.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,MAAM,EACN,QAAQ,GAMT,MAAM,OAAO,CAAA;AAEd,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,GAEjB,MAAM,0BAA0B,CAAA;AACjC,OAAO,EACL,iBAAiB,EACjB,eAAe,GAEhB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EACL,0BAA0B,EAC1B,oBAAoB,GAErB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAQlD,OAAO,EACL,eAAe,EACf,MAAM,EACN,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,SAAS,GAGV,MAAM,sBAAsB,CAAA;AAE7B,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AACzD,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAE,eAAe,EAAE,WAA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B,CAAA;AAED,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA","sourcesContent":["import {\n useImperativeHandle,\n useLayoutEffect,\n useRef,\n useState,\n type ComponentProps,\n type ComponentType,\n type ElementType,\n type ReactNode,\n type Ref,\n} from \"react\"\nimport type { DrivenSize } from \"../layout/driven-size\"\nimport {\n INSET_PROPERTIES,\n insetRefusalReason,\n insetTranslation,\n type InsetProperty,\n} from \"../style/absolute-insets\"\nimport {\n drivenSizeRefusal,\n SIZE_PROPERTIES,\n type SizeProperty,\n} from \"../style/animated-size\"\nimport {\n DRIVEABLE_COLOR_PROPERTIES,\n driveableColorsToCss,\n type DriveableColorProperty,\n} from \"../style/imperative-css\"\nimport { StyleSheet } from \"../style/index\"\nimport { createAnimated } from \"../animated/index\"\nimport type {\n DimensionValue,\n FlatStyle,\n PointerEventsValue,\n StyleProp,\n TransformPart,\n} from \"../contracts\"\nimport {\n createWidgetCss,\n GtkBox,\n queueAllocate,\n setBoxPassthrough,\n setPointerTarget,\n setZIndex,\n type Gtk,\n type WidgetCss,\n} from \"../gtkx/bridge/index\"\nimport type { ResponderProps } from \"../responder/types\"\nimport { useResponder } from \"../responder/use-responder\"\nimport { applyDrivenSize, releaseDrivenSize } from \"./driven-size\"\nimport { glibScheduler } from \"./frame-scheduler\"\nimport { HostNodeContext, useHostNode, type HostNode } from \"./host-node\"\nimport { Image } from \"./image\"\nimport {\n createMeasureHandle,\n widgetForHandle,\n type MeasureHandle,\n} from \"./measure\"\nimport { setStoredTransform } from \"./rect-store\"\nimport { ScrollView } from \"./scroll-view\"\nimport { Text } from \"./text\"\nimport {\n nodeForWidget,\n useLayoutChild,\n useRnContainer,\n type LayoutEvent,\n} from \"./use-layout-child\"\n\nconst api = createAnimated(glibScheduler)\n\n// Interpolations produce suffixed strings (\"45deg\"), so a driven value is\n// not necessarily a number — `rotate` is normally an interpolate() with a\n// deg outputRange.\ntype AnimatedValue = number | string\n\ntype AnimatedNode = {\n addListener(callback: (state: { value: AnimatedValue }) => void): string\n removeListener(id: string): void\n __getValue(): AnimatedValue\n}\n\nconst isAnimatedNode = (value: unknown): value is AnimatedNode =>\n typeof value === \"object\" &&\n value !== null &&\n typeof (value as AnimatedNode).addListener === \"function\" &&\n typeof (value as AnimatedNode).__getValue === \"function\"\n\ntype AnimatedTransformPart = { [key: string]: number | string | AnimatedNode }\n\n// One entry of the style's transform array, kept in source order. The array\n// order IS the composition order in RN, so an animated entry updates its own\n// slot in place instead of being lifted out of the list — that is what makes\n// [{rotate}, {translateX}] compose differently from the reverse, as in RN.\ntype TransformSlot = {\n key: string\n node: AnimatedNode | null\n value: AnimatedValue\n // Set only on a slot DERIVED from an animated inset (`top`/`left`/`right`/\n // `bottom` on a node whose own position is absolute). The slot then carries\n // `sign * (inset - base)`, where `base` is the inset value Yoga was given at\n // the last React commit — see splitAnimated.\n inset?: { base: number; sign: 1 | -1 }\n}\n\nconst toNumber = (value: AnimatedValue): number =>\n typeof value === \"number\" ? value : Number.parseFloat(value)\n\n// What a slot actually writes into the transform array. An ordinary slot\n// writes its value; a derived inset slot writes its offset from the committed\n// base, which is what makes an absolute `top` a translation.\nconst slotValue = (\n slot: TransformSlot,\n value: AnimatedValue,\n): AnimatedValue => {\n if (!slot.inset) {\n return value\n }\n const numeric = toNumber(value)\n // A non-numeric inset (a percentage produced mid-animation) has no offset\n // from a point base. Holding the last position beats jumping to NaN, and\n // the leaf never becomes driveable in the first place unless it starts\n // numeric — see style/absolute-insets.ts and reanimated-compat/style.ts.\n return Number.isFinite(numeric)\n ? slot.inset.sign * (numeric - slot.inset.base)\n : 0\n}\n\n// Stable per-node identity for the effect's dependency key: Animated nodes\n// are objects, and the bindings must be rebuilt when the node behind a slot\n// changes — not on every render that rebuilds an equal-looking array.\nlet nextNodeId = 1\nconst nodeIds = new WeakMap<object, number>()\nconst nodeId = (value: object): number => {\n let id = nodeIds.get(value)\n if (id === undefined) {\n id = nextNodeId++\n nodeIds.set(value, id)\n }\n return id\n}\n\n// Omit, not plain intersection: intersecting would AND the animated transform\n// with FlatStyle's numeric one, rejecting Animated.Value entries.\nexport type AnimatedViewStyle = Omit<\n FlatStyle,\n | \"opacity\"\n | \"zIndex\"\n | \"transform\"\n | DriveableColorProperty\n | InsetProperty\n | SizeProperty\n> & {\n opacity?: number | AnimatedNode\n zIndex?: number | AnimatedNode\n transform?: (TransformPart | AnimatedTransformPart)[]\n} & Partial<Record<DriveableColorProperty, string | AnimatedNode>> &\n Partial<Record<InsetProperty, DimensionValue | AnimatedNode>> &\n Partial<Record<SizeProperty, DimensionValue | AnimatedNode>>\n\n/** What every animated component accepts as `style`, arrays and falsy included. */\nexport type AnimatedStyleProp =\n AnimatedViewStyle | readonly (AnimatedViewStyle | false | null | undefined)[]\n\n// Animated.View is where a PanResponder drag lands in idiomatic RN — the\n// dragged box is animated by definition — so it takes the responder props\n// exactly as View does.\nexport type AnimatedViewProps = ResponderProps & {\n style?: AnimatedStyleProp\n children?: ReactNode\n onLayout?: (event: LayoutEvent) => void\n testID?: string\n // Reanimated's `Animated.View` IS `createAnimatedComponent(View)` upstream,\n // so it takes every View prop — `pointerEvents` included. Dropping it made\n // an invisible full-screen overlay swallow every press underneath it, which\n // is exactly how `react-native-drawer-layout`'s `Overlay` is built\n // (opacity 0 plus `pointerEvents: \"none\"`): the drawer's own edge swipe\n // worked and NOTHING inside the app did.\n pointerEvents?: PointerEventsValue\n // The other half of the same parity gap. `useAnimatedProps` returns an\n // object of current values, and `createAnimatedComponent` already spreads\n // it — but `Animated.View` is written by hand here rather than produced by\n // that factory, so it has to spread it too. Upstream's `Overlay` sets\n // `pointerEvents` through THIS channel, not as a static prop.\n animatedProps?: Record<string, unknown>\n // Same handle a plain View exposes. RN gives every host component the\n // imperative geometry methods, and Reanimated's `useAnimatedRef` +\n // `measure()` is written against an Animated.View having them — without\n // this, measuring an animated view means wrapping it in a plain one.\n ref?: Ref<MeasureHandle>\n}\n\n// One driven colour property. Unlike transforms these do not compose, so each\n// is simply the latest value of its own declaration.\ntype ColorSlot = {\n property: DriveableColorProperty\n node: AnimatedNode\n}\n\n// One driven size. `base` is the value Yoga was given at the last React\n// commit, which is what the rebase moves and what the committed rect the\n// override sits on top of was laid out at.\ntype SizeSlot = {\n property: SizeProperty\n node: AnimatedNode\n base: number\n}\n\n// One warning per inset property per session, like every other channel here.\nconst warnedInsets = new Set<string>()\n\nconst insetTranslationOf = (property: InsetProperty): string =>\n property === \"top\" || property === \"bottom\" ? \"translateY\" : \"translateX\"\n\nconst warnInsetNotTranslatable = (\n property: InsetProperty,\n reason: string | null,\n): void => {\n if (warnedInsets.has(property)) {\n return\n }\n warnedInsets.add(property)\n const isProduction =\n typeof process !== \"undefined\" && process.env.NODE_ENV === \"production\"\n if (isProduction) {\n return\n }\n const spec = insetTranslationOf(property)\n console.warn(\n `react-native-gtkx: an animated \\`${property}\\` cannot be driven here. ` +\n (reason\n ? `The node IS absolutely positioned, but ${reason}, so there is no translation that reproduces it. `\n : \"`top`/`left`/`right`/`bottom` are driven at frame rate only on a node whose own `position` is \" +\n '\"absolute\", where moving it is exactly a translation and touches no sibling. Anything else needs a ' +\n \"Yoga pass over the container plus its commit walk, which costs what the CONTAINER costs (71 µs at \" +\n \"five children, 509 µs at three hundred) against a transform's 0.12 µs. \") +\n `Animate \\`transform: [{ ${spec}: … }]\\` instead. ` +\n \"The value is still applied on the next React render. See docs/api.md.\",\n )\n}\n\n/** @internal Test seam: the warning is once per property per session by design. */\nexport const resetAnimatedInsetWarnings = (): void => {\n warnedInsets.clear()\n}\n\n// Same policy for sizes: once per property per session, and the reason is the\n// actionable part — the rule refuses for one of eight named reasons and each\n// of them has a different fix.\nconst warnedSizes = new Set<string>()\n\nconst warnSizeNotDriveable = (property: SizeProperty, reason: string): void => {\n if (warnedSizes.has(property)) {\n return\n }\n warnedSizes.add(property)\n const isProduction =\n typeof process !== \"undefined\" && process.env.NODE_ENV === \"production\"\n if (isProduction) {\n return\n }\n const scale = property === \"width\" ? \"scaleX\" : \"scaleY\"\n console.warn(\n `react-native-gtkx: an animated \\`${property}\\` cannot be driven here, because ${reason}. ` +\n `\\`width\\`/\\`height\\` run at frame rate only where the change stops at the node that owns it — the ` +\n \"node's own subtree is then re-laid-out pinned to the driven value (7.1 µs for a leaf, 21.7 µs with \" +\n \"wrapped text, the same at five children and at three hundred) and one allocation puts it on screen. \" +\n \"Anything else needs a Yoga pass over the container plus its commit walk, which costs what the \" +\n \"CONTAINER costs: 71 µs at five children, 509 µs at three hundred, against a transform's 0.6 µs. \" +\n `The closest transform is \\`transform: [{ ${scale}: … }]\\`, but it is NOT the same thing — a scale ` +\n \"grows about the view's centre, so the box moves as it grows, and it scales the content with the box \" +\n \"instead of re-laying it out, so text stretches rather than re-wrapping. \" +\n \"The new value is applied on the next React render either way. See docs/api.md.\",\n )\n}\n\n/** @internal Test seam: the warning is once per property per session by design. */\nexport const resetAnimatedSizeWarnings = (): void => {\n warnedSizes.clear()\n}\n\nconst splitAnimated = (\n style: AnimatedStyleProp | false | null | undefined,\n): {\n staticStyle: StyleProp\n opacity: AnimatedNode | null\n zIndex: AnimatedNode | null\n slots: TransformSlot[]\n colors: ColorSlot[]\n sizes: SizeSlot[]\n} => {\n const flat: Record<string, unknown> = {}\n const collect = (\n entry: AnimatedStyleProp | false | null | undefined,\n ): void => {\n if (!entry) {\n return\n }\n if (Array.isArray(entry)) {\n entry.forEach(collect)\n return\n }\n Object.assign(flat, entry)\n }\n collect(style)\n\n let opacity: AnimatedNode | null = null\n let zIndex: AnimatedNode | null = null\n const slots: TransformSlot[] = []\n const colors: ColorSlot[] = []\n const sizes: SizeSlot[] = []\n\n if (isAnimatedNode(flat.opacity)) {\n opacity = flat.opacity\n delete flat.opacity\n }\n // `zIndex` is in `useSortable`'s style object on every frame and changes\n // value about twice per drag. It takes the same door opacity does — one\n // widget-level write, no Yoga, no CSS — so there is nothing to refuse.\n if (isAnimatedNode(flat.zIndex)) {\n zIndex = flat.zIndex\n delete flat.zIndex\n }\n for (const property of DRIVEABLE_COLOR_PROPERTIES) {\n const value = flat[property]\n if (isAnimatedNode(value)) {\n colors.push({ property, node: value })\n // Removed from the static style so the shared class registry never sees\n // a per-frame value: its memoisation stays keyed on styles that change\n // when React renders, which is the only thing it is good at.\n delete flat[property]\n }\n }\n if (Array.isArray(flat.transform)) {\n for (const part of flat.transform as AnimatedTransformPart[]) {\n const key = Object.keys(part)[0]\n if (key === undefined) {\n continue\n }\n const value = part[key]\n slots.push(\n isAnimatedNode(value)\n ? { key, node: value, value: value.__getValue() }\n : { key, node: null, value: value as AnimatedValue },\n )\n }\n // The whole array is owned here from now on, static entries included:\n // leaving them in the style would make useLayoutChild write the same\n // rect-store slot from the other side, and the two would overwrite\n // each other every render.\n delete flat.transform\n }\n\n // Slice 2b: an animated inset on an absolutely positioned node becomes a\n // derived translate. It is the one layout property with an exact transform\n // equivalent, because an out-of-flow node's position affects nothing but\n // where it is drawn — see src/style/absolute-insets.ts for the measured\n // rule and for the configurations where the equivalence does NOT hold.\n //\n // Three things happen here at once, and all three are load-bearing:\n //\n // - THE BASE. The inset's current value is written back into the static\n // style as a plain number, so Yoga is given a real position and the\n // committed rect the parent's allocate reads is the base the offset is\n // measured from. Nothing about the shadow tree changes.\n // - THE REBASE. This runs on every render, so when React commits a layout\n // with a different inset, the base moves and the offset is recomputed\n // against it in the SAME commit — the Yoga write and the offset write\n // are both layout effects, and the engine's flush is a microtask, so GTK\n // never gets a frame in between and there is no jump.\n // - THE ORDER. Derived slots go FIRST. The array's leftmost entry is the\n // outermost matrix (style/transform.ts), so a derived translate is\n // applied to the point LAST — it moves the already-rotated, already-\n // scaled box in the parent's coordinates, exactly as a layout position\n // does. Appending instead would put the user's scale on the OUTSIDE and\n // multiply the offset by it.\n const insetSlots: TransformSlot[] = []\n for (const property of INSET_PROPERTIES) {\n const value = flat[property]\n if (!isAnimatedNode(value)) {\n continue\n }\n const base = toNumber(value.__getValue())\n const translation = Number.isFinite(base)\n ? insetTranslation(flat, property)\n : null\n if (!translation) {\n // Not an equivalence. Resolve to the current value so the static style\n // is at least correct on this render, and keep slice 2's refusal loud.\n flat[property] = Number.isFinite(base) ? base : undefined\n warnInsetNotTranslatable(property, insetRefusalReason(flat, property))\n continue\n }\n flat[property] = base\n insetSlots.push({\n key: translation.transform,\n node: value,\n value: 0,\n inset: { base, sign: translation.sign },\n })\n }\n\n // Slice 3: an animated `width`/`height` where the change is confined to the\n // node that owns it. Unlike an inset this is NOT re-expressed as a\n // transform — there is no transform that reproduces a size change, which\n // docs/research/animated-size.md §6 measured rather than assumed — so the\n // slot carries the property itself and the view layer drives it through a\n // pinned pass over the node's own subtree.\n //\n // THE REBASE, exactly as above and for the same reason: the driven value is\n // written back into the static style as a plain number, so Yoga is given the\n // size the animation is currently showing and the committed rect the\n // override sits on catches up in the SAME commit. Both writes are layout\n // effects and the engine's flush is a microtask, so GTK never gets a frame\n // in between.\n //\n // WHETHER it can be driven is not decided here. The answer depends on the\n // CONTAINER's `flexDirection`, its `alignItems` and where its own size comes\n // from, none of which are in this style object or in this component's props\n // — it is asked of the layout tree in useAnimatedBinding, which is the only\n // place the tree exists.\n for (const property of SIZE_PROPERTIES) {\n const value = flat[property]\n if (!isAnimatedNode(value)) {\n continue\n }\n const base = toNumber(value.__getValue())\n if (!Number.isFinite(base)) {\n // A percentage produced mid-animation has no point base to lay out at.\n // Dropped rather than driven, and the leaf never becomes driveable in\n // the first place unless it starts numeric — reanimated-compat/style.ts.\n flat[property] = undefined\n continue\n }\n flat[property] = base\n sizes.push({ property, node: value, base })\n }\n\n return {\n staticStyle: flat as StyleProp,\n opacity,\n zIndex,\n slots: insetSlots.length > 0 ? [...insetSlots, ...slots] : slots,\n colors,\n sizes,\n }\n}\n\n/**\n * The imperative write path, and the whole of it.\n *\n * Animated values bypass React entirely: listeners write straight to the\n * widget (opacity), to the rect store (the transform applied by the parent's\n * allocate) on top of the engine-committed base rect, and to a CSS provider\n * private to the widget (colours). Animation frames never touch Yoga, and\n * never touch the shared stylesheet.\n *\n * Nothing here is View-specific, which is why it is a hook rather than a\n * paragraph inside `AnimatedView`: it needs the CHILD's widget (for\n * `setOpacity` and the rect store) and its PARENT's (for `queueAllocate`),\n * and any component that can produce those two can be animated. The child is\n * reached through a getter rather than a ref because a wrapper does not own\n * the widget — it reads it back out of whatever handle the wrapped component\n * exposed, which may only exist after that component's own layout effects.\n */\nconst useAnimatedBinding = (\n getWidget: () => Gtk.Widget | null,\n host: HostNode,\n opacity: AnimatedNode | null,\n zIndex: AnimatedNode | null,\n slots: TransformSlot[],\n colors: ColorSlot[],\n sizes: SizeSlot[],\n // Anything else that must force a rebind. `AnimatedView` passes its layout\n // node; the generic wrapper has nothing to add.\n rebindKey?: unknown,\n): void => {\n // The effect reads the slots of the render that (re)armed it; the values\n // inside are then owned by the listeners.\n const slotsRef = useRef<TransformSlot[]>(slots)\n slotsRef.current = slots\n const colorsRef = useRef<ColorSlot[]>(colors)\n colorsRef.current = colors\n const sizesRef = useRef<SizeSlot[]>(sizes)\n sizesRef.current = sizes\n const getWidgetRef = useRef(getWidget)\n getWidgetRef.current = getWidget\n const hostRef = useRef(host)\n hostRef.current = host\n const parentWidgetRef = host.widgetRef\n\n // Rebind on a change of shape (which transforms, in which order), of the\n // node behind an animated entry, or of a static entry's value — not on\n // every render that rebuilds an equal-looking array.\n //\n // A derived inset slot adds its BASE to the key, and that is what makes the\n // rebase happen: React committing a new `top` moves the base, which re-arms\n // this effect in the same commit that gives Yoga the new position.\n const bindingKey =\n (opacity ? `opacity#${nodeId(opacity)}` : \"\") +\n (zIndex ? `zIndex#${nodeId(zIndex)}` : \"\") +\n slots\n .map((slot) => {\n const inset = slot.inset ? `~${slot.inset.sign}:${slot.inset.base}` : \"\"\n return slot.node\n ? `|${slot.key}#${nodeId(slot.node)}${inset}`\n : `|${slot.key}=${String(slot.value)}`\n })\n .join(\"\") +\n colors.map((slot) => `|${slot.property}#${nodeId(slot.node)}`).join(\"\") +\n // The base is in the key for the same reason a derived inset's is: React\n // committing a new size moves it, and re-arming here is what hands the\n // override back to the engine in the same commit that gives Yoga the new\n // value.\n sizes\n .map((slot) => `|${slot.property}#${nodeId(slot.node)}~${slot.base}`)\n .join(\"\")\n\n useLayoutEffect(() => {\n const widget = getWidgetRef.current()\n if (!widget) {\n return\n }\n // Captured for the CLEANUP only: by then the ref may already have been\n // detached, and the container to re-allocate is the one this binding was\n // made against. Every live write below re-reads the ref instead.\n const boundParentWidget = parentWidgetRef.current\n\n // The live transform array, mutated in place: an Animated write must\n // stay one numeric store plus one queued allocation — no React render,\n // no Yoga pass, no allocation per frame beyond the composed matrix.\n //\n // RN transform semantics: this is paint-only. The result goes to the\n // rect store unclamped — the parent's measure ignores children, so a\n // transformed child draws past the boundary over its neighbors without\n // moving a single ancestor.\n const parts = slotsRef.current.map(\n (slot) =>\n ({\n [slot.key]: slot.node\n ? slotValue(slot, slot.node.__getValue())\n : slot.value,\n }) as Record<string, AnimatedValue>,\n )\n\n const flush = (): void => {\n const widget = getWidgetRef.current()\n if (!widget) {\n return\n }\n setStoredTransform(widget, parts as unknown as TransformPart[])\n const parentWidget = parentWidgetRef.current\n if (parentWidget) {\n queueAllocate(parentWidget)\n }\n }\n\n const subscriptions: { node: AnimatedNode; id: string }[] = []\n slotsRef.current.forEach((slot, index) => {\n if (!slot.node) {\n return\n }\n const part = parts[index]!\n subscriptions.push({\n node: slot.node,\n id: slot.node.addListener(({ value }) => {\n part[slot.key] = slotValue(slot, value)\n flush()\n }),\n })\n })\n\n if (opacity) {\n const applyOpacity = (value: AnimatedValue): void => {\n const numeric = typeof value === \"number\" ? value : parseFloat(value)\n getWidgetRef.current()?.setOpacity(Math.min(1, Math.max(0, numeric)))\n }\n subscriptions.push({\n node: opacity,\n id: opacity.addListener(({ value }) => {\n applyOpacity(value)\n }),\n })\n applyOpacity(opacity.__getValue())\n }\n\n // The container's paint and pick order (gtkx/bridge/view-box.ts). The\n // write drops the container's cached order and queues a redraw; nothing\n // is re-measured and nothing is re-allocated, because zIndex changes\n // neither.\n if (zIndex) {\n const applyZIndex = (value: AnimatedValue): void => {\n const widget = getWidgetRef.current()\n if (!widget) {\n return\n }\n const numeric = typeof value === \"number\" ? value : parseFloat(value)\n setZIndex(widget, Number.isFinite(numeric) ? Math.round(numeric) : 0)\n }\n subscriptions.push({\n node: zIndex,\n id: zIndex.addListener(({ value }) => {\n applyZIndex(value)\n }),\n })\n applyZIndex(zIndex.__getValue())\n }\n\n // Colours take the other imperative door: a CSS provider private to this\n // widget, replaced in place. Deliberately NOT the shared class registry —\n // that one memoises by CSS text, so a driven colour would mint a class per\n // frame into a document GTK re-parses whole and that is never pruned\n // (docs/research/animated-colors.md). All driven colours share one\n // provider and one declaration block: two properties animating together\n // are one write, not two.\n const colorSlots = colorsRef.current\n let widgetCss: WidgetCss | null = null\n if (colorSlots.length > 0) {\n const css = createWidgetCss(widget)\n widgetCss = css\n const values: Record<string, unknown> = {}\n const writeColors = (): void => {\n css.set(driveableColorsToCss(values))\n }\n for (const slot of colorSlots) {\n values[slot.property] = slot.node.__getValue()\n subscriptions.push({\n node: slot.node,\n id: slot.node.addListener(({ value }) => {\n values[slot.property] = value\n writeColors()\n }),\n })\n }\n writeColors()\n }\n\n // Sizes take the third door, and it is the only one that runs Yoga.\n //\n // Nothing is written at BIND time on purpose: the render that armed this\n // effect put the current value into the static style, so the engine is\n // already committing exactly this size and an override would be a copy of\n // it. The first write happens when a frame asks for something else.\n const sizeSlots = sizesRef.current\n const drivenWidgets: Gtk.Widget[] = []\n if (sizeSlots.length > 0) {\n const layoutNode = nodeForWidget(widget)\n const driven: DrivenSize = {}\n const driveable = new Set<SizeProperty>()\n let decided = false\n // Deferred to the first frame that actually asks for a new size, and\n // that is not laziness: the rule is asked of the CONTAINER's Yoga node,\n // and on a first mount a container's own layout effects run AFTER its\n // children's — so at bind time the container may still be carrying the\n // defaults rather than its style. By the first frame the tree has been\n // laid out at least once and the answer is the real one.\n const decide = (): void => {\n decided = true\n if (!layoutNode) {\n return\n }\n const context = {\n node: layoutNode,\n rootIsContentSized: hostRef.current.engine.contentSized,\n }\n for (const slot of sizeSlots) {\n const reason = drivenSizeRefusal(context, slot.property)\n if (reason === null) {\n driveable.add(slot.property)\n } else {\n warnSizeNotDriveable(slot.property, reason)\n }\n }\n }\n for (const slot of sizeSlots) {\n subscriptions.push({\n node: slot.node,\n id: slot.node.addListener(({ value }) => {\n const numeric = toNumber(value)\n if (!Number.isFinite(numeric)) {\n return\n }\n if (!decided) {\n decide()\n }\n if (!driveable.has(slot.property) || !layoutNode) {\n return\n }\n driven[slot.property] = numeric\n const target = getWidgetRef.current()\n if (target) {\n applyDrivenSize(\n layoutNode,\n target,\n parentWidgetRef.current,\n driven,\n drivenWidgets,\n )\n }\n }),\n })\n }\n }\n\n flush()\n\n return () => {\n for (const { node: animated, id } of subscriptions) {\n animated.removeListener(id)\n }\n widgetCss?.dispose()\n // Every widget this binding was driving goes back to the rect the\n // engine committed. On a REBASE that is the whole point: the render\n // that re-armed this effect handed Yoga the size the animation is\n // showing, so the committed rect is about to become the driven one and\n // holding an override on top of it would be holding a stale copy.\n if (drivenWidgets.length > 0) {\n releaseDrivenSize(drivenWidgets)\n if (boundParentWidget) {\n queueAllocate(boundParentWidget)\n }\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [bindingKey, rebindKey])\n}\n\nconst AnimatedView = ({\n style,\n children,\n onLayout,\n testID,\n ref,\n pointerEvents,\n animatedProps,\n ...responderProps\n}: AnimatedViewProps) => {\n const widgetRef = useRef<Gtk.Box | null>(null)\n const { staticStyle, opacity, zIndex, slots, colors, sizes } =\n splitAnimated(style)\n\n const { host, node, cssClass } = useLayoutChild(widgetRef, {\n style: staticStyle,\n onLayout,\n })\n useRnContainer(widgetRef, node)\n useResponder(widgetRef, responderProps)\n\n // `animatedProps` LAST, matching `createAnimatedComponent`'s\n // `{ ...rest, ...animatedProps }` — a value produced by the updater is the\n // live one and wins over the static prop. Only the picking mode is read\n // here: a numeric animated prop has no meaning on a View, and the SVG\n // shapes that do take them go through `createAnimatedComponent` already.\n const mode: PointerEventsValue =\n (animatedProps?.pointerEvents as PointerEventsValue | undefined) ??\n pointerEvents ??\n StyleSheet.flatten(staticStyle)?.pointerEvents ??\n \"auto\"\n\n useLayoutEffect(() => {\n const widget = widgetRef.current\n if (!widget) {\n return\n }\n setPointerTarget(widget, mode !== \"none\")\n setBoxPassthrough(widget, mode === \"box-none\")\n }, [mode])\n\n useImperativeHandle(ref, () => createMeasureHandle(widgetRef, node), [node])\n\n useAnimatedBinding(\n () => widgetRef.current,\n host,\n opacity,\n zIndex,\n slots,\n colors,\n sizes,\n node,\n )\n\n return (\n <GtkBox\n ref={widgetRef}\n name={testID}\n cssClasses={cssClass ? [cssClass] : []}\n >\n <HostNodeContext.Provider\n value={{ engine: host.engine, node, widgetRef }}\n >\n {children}\n </HostNodeContext.Provider>\n </GtkBox>\n )\n}\n\n// --- createAnimatedComponent ---------------------------------------------\n\n/** Node-backed props from `useAnimatedProps`, spread onto the wrapped component. */\nexport type AnimatedPropsProp = Record<string, unknown>\n\n/** The props an animated wrapper adds on top of the component's own. */\nexport type AnimatedComponentExtraProps = {\n style?: AnimatedStyleProp\n animatedProps?: AnimatedPropsProp\n}\n\n// `Partial`, as upstream's own `AnimatedProps<Props>` effectively is: a prop\n// supplied through `animatedProps` is invisible to the type system here, so\n// insisting on the wrapped component's required props would reject exactly\n// the call the feature exists for (`<AnimatedCircle animatedProps={{ r }} />`).\nexport type AnimatedComponent<C extends ElementType> = (\n props: Partial<Omit<ComponentProps<C>, \"style\">> &\n AnimatedComponentExtraProps,\n) => ReactNode\n\nconst displayNameOf = (component: unknown): string => {\n if (typeof component === \"string\") {\n return component\n }\n const named = component as { displayName?: string; name?: string }\n return named?.displayName ?? named?.name ?? \"Component\"\n}\n\n// One warning per wrapped component per session — a mapper runs at frame\n// rate, and the name is the actionable part.\nconst warnedWithoutWidget = new Set<string>()\n\nconst warnNoWidget = (name: string): void => {\n if (warnedWithoutWidget.has(name)) {\n return\n }\n warnedWithoutWidget.add(name)\n const isProduction =\n typeof process !== \"undefined\" && process.env.NODE_ENV === \"production\"\n if (!isProduction) {\n console.warn(\n `react-native-gtkx: createAnimatedComponent(${name}) was given an animated \\`opacity\\`, ` +\n \"`transform`, colour or size, but the component exposed no ref carrying a widget, so there is nothing to write \" +\n \"to. Give it a `ref?: Ref<MeasureHandle>` built with the platform's own measure handle, or wrap \" +\n \"it in an `Animated.View`. See docs/api.md.\",\n )\n }\n}\n\n/** @internal Test seam: the warning is once per component per session by design. */\nexport const resetAnimatedComponentWarnings = (): void => {\n warnedWithoutWidget.clear()\n}\n\n/**\n * Wraps a component so its `style`'s `opacity`/`transform` and its\n * `animatedProps` can be driven imperatively — RN's own\n * `Animated.createAnimatedComponent`.\n *\n * IT ADDS NO WIDGET. Wrapping in an `Animated.View` would have been three\n * lines and would have been wrong: an extra box changes flex layout, changes\n * what `measureLayout` is relative to, and changes which widget a parent's\n * allocate walks. That is not a shim, it is a different tree. Instead the\n * wrapper renders the component itself and reaches the widget through the\n * handle the component already exposes (see measure.ts's `widgetOf`), so the\n * rendered output is byte-for-byte what the unwrapped component produces.\n *\n * `animatedProps` are passed straight through as animated NODES rather than\n * resolved to numbers, because the components that take them already accept\n * one: the SVG shapes duck-type an animated node on every numeric geometry\n * and paint prop and subscribe to it themselves (svg/animated-support.ts),\n * redrawing through `queueDraw`. Nothing is resolved here that the receiver\n * can resolve better.\n */\nexport const createAnimatedComponent = <C extends ElementType>(\n component: C,\n): AnimatedComponent<C> => {\n const name = displayNameOf(component)\n\n const AnimatedWrapper = ({\n style,\n animatedProps,\n ref,\n ...rest\n }: AnimatedComponentExtraProps & {\n ref?: Ref<unknown>\n [key: string]: unknown\n }) => {\n // The PARENT's widget, for `queueAllocate` — the wrapper is not a host\n // node itself, so this is the container the wrapped component is laid out\n // by, exactly as it would be without the wrapper.\n const host = useHostNode()\n const handleRef = useRef<unknown>(null)\n const { staticStyle, opacity, zIndex, slots, colors, sizes } =\n splitAnimated(style)\n const driven =\n opacity !== null ||\n zIndex !== null ||\n slots.length > 0 ||\n colors.length > 0 ||\n sizes.length > 0\n\n // Stable identity: a fresh callback ref every render would detach and\n // reattach the wrapped component's handle on every render.\n const forwardedRef = useRef<Ref<unknown> | undefined>(ref)\n forwardedRef.current = ref\n const [assignHandle] = useState(() => (instance: unknown) => {\n handleRef.current = instance\n const target = forwardedRef.current\n if (typeof target === \"function\") {\n target(instance)\n } else if (target) {\n ;(target as { current: unknown }).current = instance\n }\n // No return value: React 19 reads one as a callback-ref cleanup.\n })\n\n useAnimatedBinding(\n () => widgetForHandle(handleRef.current),\n host,\n opacity,\n zIndex,\n slots,\n colors,\n sizes,\n )\n\n // A silent no-op is the failure this repo refuses. Checked after the\n // wrapped component's own layout effects have run, which is where its\n // `useImperativeHandle` publishes the handle.\n useLayoutEffect(() => {\n if (driven && widgetForHandle(handleRef.current) === null) {\n warnNoWidget(name)\n }\n })\n\n const targetProps: Record<string, unknown> = { ...rest, ...animatedProps }\n // Only when there is something to attach: a component that takes no ref\n // (the SVG shapes) would otherwise get one in its rest props.\n if (driven || ref) {\n targetProps.ref = assignHandle\n }\n // Likewise `style`: passing `{}` to a component that has no style prop\n // would push an empty object into whatever collects its rest props.\n if (style !== undefined) {\n targetProps.style = staticStyle\n }\n\n const Target = component as ComponentType<Record<string, unknown>>\n return <Target {...targetProps} />\n }\n AnimatedWrapper.displayName = `Animated(${name})`\n\n return AnimatedWrapper as AnimatedComponent<C>\n}\n\n/**\n * `Animated.FlatList` is deliberately absent, and this is the refusal.\n *\n * FlatList is a COMPOSITE, not a host component: it renders the windowed\n * VirtualizedList core, which renders a ScrollView, which is the only thing\n * in that chain owning a widget. Its ref is a scroll API by contract\n * (`scrollToIndex`/`scrollToItem`/`scrollToOffset`), so there is no handle to\n * read a widget back out of — and giving it one would mean publishing the\n * scrolled window through two layers that exist to hide it.\n *\n * Upstream's `Animated.FlatList` mostly exists so `onScroll` can be an\n * `Animated.event`/`useAnimatedScrollHandler`, and neither of those is\n * implemented here either. So this throws where it is used, naming itself and\n * naming the two things that do work.\n */\nconst AnimatedFlatList = (): never => {\n throw new Error(\n \"react-native-gtkx: `Animated.FlatList` is not implemented. FlatList is a composite — the windowed \" +\n \"core over a ScrollView — and its ref is a scroll API, so there is no host widget for an animated \" +\n \"style to write to. Put the animated style on an `Animated.View` wrapping the list, or use \" +\n \"`Animated.ScrollView` if the list does not need virtualization. See docs/api.md.\",\n )\n}\nAnimatedFlatList.displayName = \"Animated.FlatList\"\n\n/**\n * `Text`, `Image` and `ScrollView` are the generic wrapper over the\n * platform's own components — no subclass, no special case, and no widget\n * added to the tree. They are animatable at all because those three now\n * expose a ref carrying their widget, which is RN parity in its own right.\n */\nconst AnimatedText = createAnimatedComponent(Text)\nconst AnimatedImage = createAnimatedComponent(Image)\nconst AnimatedScrollView = createAnimatedComponent(ScrollView)\n\nexport const Animated = {\n ...api,\n View: AnimatedView,\n Text: AnimatedText,\n Image: AnimatedImage,\n ScrollView: AnimatedScrollView,\n // Typed as taking the props it refuses, so the failure is at RUNTIME with\n // the message above rather than at compile time with \"no overload matches\n // this call\" — an app porting from mobile deserves the sentence, not a\n // type puzzle.\n FlatList: AnimatedFlatList as (props: Record<string, unknown>) => never,\n createAnimatedComponent,\n}\n\nexport { Easing } from \"../animated/index\"\n"]}
1
+ {"version":3,"file":"animated.js","sourceRoot":"","sources":["../../src/components/animated.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,MAAM,EACN,QAAQ,GAMT,MAAM,OAAO,CAAA;AAEd,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,GAEjB,MAAM,0BAA0B,CAAA;AACjC,OAAO,EACL,iBAAiB,EACjB,eAAe,GAEhB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EACL,0BAA0B,EAC1B,oBAAoB,GAErB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CA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,YAAY,CAAA;QAChC,CAAC;QACD,uEAAuE;QACvE,oEAAoE;QACpE,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,WAAW,CAAC,KAAK,GAAG,WAAW,CAAA;QACjC,CAAC;QAED,MAAM,MAAM,GAAG,SAAmD,CAAA;QAClE,OAAO,KAAC,MAAM,OAAK,WAAW,GAAI,CAAA;IACpC,CAAC,CAAA;IACD,eAAe,CAAC,WAAW,GAAG,YAAY,IAAI,GAAG,CAAA;IAEjD,OAAO,eAAuC,CAAA;AAChD,CAAC,CAAA;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,gBAAgB,GAAG,GAAU,EAAE;IACnC,MAAM,IAAI,KAAK,CACb,oGAAoG;QAClG,mGAAmG;QACnG,4FAA4F;QAC5F,kFAAkF,CACrF,CAAA;AACH,CAAC,CAAA;AACD,gBAAgB,CAAC,WAAW,GAAG,mBAAmB,CAAA;AAElD;;;;;GAKG;AACH,MAAM,YAAY,GAAG,uBAAuB,CAAC,IAAI,CAAC,CAAA;AAClD,MAAM,aAAa,GAAG,uBAAuB,CAAC,KAAK,CAAC,CAAA;AACpD,MAAM,kBAAkB,GAAG,uBAAuB,CAAC,UAAU,CAAC,CAAA;AAE9D,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,GAAG,GAAG;IACN,IAAI,EAAE,YAAY;IAClB,IAAI,EAAE,YAAY;IAClB,KAAK,EAAE,aAAa;IACpB,UAAU,EAAE,kBAAkB;IAC9B,0EAA0E;IAC1E,0EAA0E;IAC1E,uEAAuE;IACvE,eAAe;IACf,QAAQ,EAAE,gBAA6D;IACvE,uBAAuB;CACxB,CAAA;AAED,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA","sourcesContent":["import {\n useImperativeHandle,\n useLayoutEffect,\n useRef,\n useState,\n type ComponentProps,\n type ComponentType,\n type ElementType,\n type ReactNode,\n type Ref,\n} from \"react\"\nimport type { DrivenSize } from \"../layout/driven-size\"\nimport {\n INSET_PROPERTIES,\n insetRefusalReason,\n insetTranslation,\n type InsetProperty,\n} from \"../style/absolute-insets\"\nimport {\n drivenSizeRefusal,\n SIZE_PROPERTIES,\n type SizeProperty,\n} from \"../style/animated-size\"\nimport {\n DRIVEABLE_COLOR_PROPERTIES,\n driveableColorsToCss,\n type DriveableColorProperty,\n} from \"../style/imperative-css\"\nimport { StyleSheet } from \"../style/index\"\nimport { createAnimated } from \"../animated/index\"\nimport type {\n DimensionValue,\n FlatStyle,\n PointerEventsValue,\n StyleProp,\n TransformPart,\n} from \"../contracts\"\nimport {\n GestureAttachContext,\n mergeGestureHandlers,\n useGestureAttach,\n} from \"../gesture-handler-compat/attach-context\"\nimport {\n createWidgetCss,\n GtkBox,\n queueAllocate,\n setBoxPassthrough,\n setPointerTarget,\n setZIndex,\n type Gtk,\n type WidgetCss,\n} from \"../gtkx/bridge/index\"\nimport type { ResponderProps } from \"../responder/types\"\nimport { useResponder } from \"../responder/use-responder\"\nimport { applyDrivenSize, releaseDrivenSize } from \"./driven-size\"\nimport { glibScheduler } from \"./frame-scheduler\"\nimport { HostNodeContext, useHostNode, type HostNode } from \"./host-node\"\nimport { Image } from \"./image\"\nimport {\n createMeasureHandle,\n widgetForHandle,\n type MeasureHandle,\n} from \"./measure\"\nimport { setStoredTransform } from \"./rect-store\"\nimport { ScrollView } from \"./scroll-view\"\nimport { Text } from \"./text\"\nimport {\n nodeForWidget,\n useLayoutChild,\n useRnContainer,\n type LayoutEvent,\n} from \"./use-layout-child\"\n\nconst api = createAnimated(glibScheduler)\n\n// Interpolations produce suffixed strings (\"45deg\"), so a driven value is\n// not necessarily a number — `rotate` is normally an interpolate() with a\n// deg outputRange.\ntype AnimatedValue = number | string\n\ntype AnimatedNode = {\n addListener(callback: (state: { value: AnimatedValue }) => void): string\n removeListener(id: string): void\n __getValue(): AnimatedValue\n}\n\nconst isAnimatedNode = (value: unknown): value is AnimatedNode =>\n typeof value === \"object\" &&\n value !== null &&\n typeof (value as AnimatedNode).addListener === \"function\" &&\n typeof (value as AnimatedNode).__getValue === \"function\"\n\ntype AnimatedTransformPart = { [key: string]: number | string | AnimatedNode }\n\n// One entry of the style's transform array, kept in source order. The array\n// order IS the composition order in RN, so an animated entry updates its own\n// slot in place instead of being lifted out of the list — that is what makes\n// [{rotate}, {translateX}] compose differently from the reverse, as in RN.\ntype TransformSlot = {\n key: string\n node: AnimatedNode | null\n value: AnimatedValue\n // Set only on a slot DERIVED from an animated inset (`top`/`left`/`right`/\n // `bottom` on a node whose own position is absolute). The slot then carries\n // `sign * (inset - base)`, where `base` is the inset value Yoga was given at\n // the last React commit — see splitAnimated.\n inset?: { base: number; sign: 1 | -1 }\n}\n\nconst toNumber = (value: AnimatedValue): number =>\n typeof value === \"number\" ? value : Number.parseFloat(value)\n\n// What a slot actually writes into the transform array. An ordinary slot\n// writes its value; a derived inset slot writes its offset from the committed\n// base, which is what makes an absolute `top` a translation.\nconst slotValue = (\n slot: TransformSlot,\n value: AnimatedValue,\n): AnimatedValue => {\n if (!slot.inset) {\n return value\n }\n const numeric = toNumber(value)\n // A non-numeric inset (a percentage produced mid-animation) has no offset\n // from a point base. Holding the last position beats jumping to NaN, and\n // the leaf never becomes driveable in the first place unless it starts\n // numeric — see style/absolute-insets.ts and reanimated-compat/style.ts.\n return Number.isFinite(numeric)\n ? slot.inset.sign * (numeric - slot.inset.base)\n : 0\n}\n\n// Stable per-node identity for the effect's dependency key: Animated nodes\n// are objects, and the bindings must be rebuilt when the node behind a slot\n// changes — not on every render that rebuilds an equal-looking array.\nlet nextNodeId = 1\nconst nodeIds = new WeakMap<object, number>()\nconst nodeId = (value: object): number => {\n let id = nodeIds.get(value)\n if (id === undefined) {\n id = nextNodeId++\n nodeIds.set(value, id)\n }\n return id\n}\n\n// Omit, not plain intersection: intersecting would AND the animated transform\n// with FlatStyle's numeric one, rejecting Animated.Value entries.\nexport type AnimatedViewStyle = Omit<\n FlatStyle,\n | \"opacity\"\n | \"zIndex\"\n | \"transform\"\n | DriveableColorProperty\n | InsetProperty\n | SizeProperty\n> & {\n opacity?: number | AnimatedNode\n zIndex?: number | AnimatedNode\n transform?: (TransformPart | AnimatedTransformPart)[]\n} & Partial<Record<DriveableColorProperty, string | AnimatedNode>> &\n Partial<Record<InsetProperty, DimensionValue | AnimatedNode>> &\n Partial<Record<SizeProperty, DimensionValue | AnimatedNode>>\n\n/** What every animated component accepts as `style`, arrays and falsy included. */\nexport type AnimatedStyleProp =\n AnimatedViewStyle | readonly (AnimatedViewStyle | false | null | undefined)[]\n\n// Animated.View is where a PanResponder drag lands in idiomatic RN — the\n// dragged box is animated by definition — so it takes the responder props\n// exactly as View does.\nexport type AnimatedViewProps = ResponderProps & {\n style?: AnimatedStyleProp\n children?: ReactNode\n onLayout?: (event: LayoutEvent) => void\n testID?: string\n // Reanimated's `Animated.View` IS `createAnimatedComponent(View)` upstream,\n // so it takes every View prop — `pointerEvents` included. Dropping it made\n // an invisible full-screen overlay swallow every press underneath it, which\n // is exactly how `react-native-drawer-layout`'s `Overlay` is built\n // (opacity 0 plus `pointerEvents: \"none\"`): the drawer's own edge swipe\n // worked and NOTHING inside the app did.\n pointerEvents?: PointerEventsValue\n // The other half of the same parity gap. `useAnimatedProps` returns an\n // object of current values, and `createAnimatedComponent` already spreads\n // it — but `Animated.View` is written by hand here rather than produced by\n // that factory, so it has to spread it too. Upstream's `Overlay` sets\n // `pointerEvents` through THIS channel, not as a static prop.\n animatedProps?: Record<string, unknown>\n // Same handle a plain View exposes. RN gives every host component the\n // imperative geometry methods, and Reanimated's `useAnimatedRef` +\n // `measure()` is written against an Animated.View having them — without\n // this, measuring an animated view means wrapping it in a plain one.\n ref?: Ref<MeasureHandle>\n}\n\n// One driven colour property. Unlike transforms these do not compose, so each\n// is simply the latest value of its own declaration.\ntype ColorSlot = {\n property: DriveableColorProperty\n node: AnimatedNode\n}\n\n// One driven size. `base` is the value Yoga was given at the last React\n// commit, which is what the rebase moves and what the committed rect the\n// override sits on top of was laid out at.\ntype SizeSlot = {\n property: SizeProperty\n node: AnimatedNode\n base: number\n}\n\n// One warning per inset property per session, like every other channel here.\nconst warnedInsets = new Set<string>()\n\nconst insetTranslationOf = (property: InsetProperty): string =>\n property === \"top\" || property === \"bottom\" ? \"translateY\" : \"translateX\"\n\nconst warnInsetNotTranslatable = (\n property: InsetProperty,\n reason: string | null,\n): void => {\n if (warnedInsets.has(property)) {\n return\n }\n warnedInsets.add(property)\n const isProduction =\n typeof process !== \"undefined\" && process.env.NODE_ENV === \"production\"\n if (isProduction) {\n return\n }\n const spec = insetTranslationOf(property)\n console.warn(\n `react-native-gtkx: an animated \\`${property}\\` cannot be driven here. ` +\n (reason\n ? `The node IS absolutely positioned, but ${reason}, so there is no translation that reproduces it. `\n : \"`top`/`left`/`right`/`bottom` are driven at frame rate only on a node whose own `position` is \" +\n '\"absolute\", where moving it is exactly a translation and touches no sibling. Anything else needs a ' +\n \"Yoga pass over the container plus its commit walk, which costs what the CONTAINER costs (71 µs at \" +\n \"five children, 509 µs at three hundred) against a transform's 0.12 µs. \") +\n `Animate \\`transform: [{ ${spec}: … }]\\` instead. ` +\n \"The value is still applied on the next React render. See docs/api.md.\",\n )\n}\n\n/** @internal Test seam: the warning is once per property per session by design. */\nexport const resetAnimatedInsetWarnings = (): void => {\n warnedInsets.clear()\n}\n\n// Same policy for sizes: once per property per session, and the reason is the\n// actionable part — the rule refuses for one of eight named reasons and each\n// of them has a different fix.\nconst warnedSizes = new Set<string>()\n\nconst warnSizeNotDriveable = (property: SizeProperty, reason: string): void => {\n if (warnedSizes.has(property)) {\n return\n }\n warnedSizes.add(property)\n const isProduction =\n typeof process !== \"undefined\" && process.env.NODE_ENV === \"production\"\n if (isProduction) {\n return\n }\n const scale = property === \"width\" ? \"scaleX\" : \"scaleY\"\n console.warn(\n `react-native-gtkx: an animated \\`${property}\\` cannot be driven here, because ${reason}. ` +\n `\\`width\\`/\\`height\\` run at frame rate only where the change stops at the node that owns it — the ` +\n \"node's own subtree is then re-laid-out pinned to the driven value (7.1 µs for a leaf, 21.7 µs with \" +\n \"wrapped text, the same at five children and at three hundred) and one allocation puts it on screen. \" +\n \"Anything else needs a Yoga pass over the container plus its commit walk, which costs what the \" +\n \"CONTAINER costs: 71 µs at five children, 509 µs at three hundred, against a transform's 0.6 µs. \" +\n `The closest transform is \\`transform: [{ ${scale}: … }]\\`, but it is NOT the same thing — a scale ` +\n \"grows about the view's centre, so the box moves as it grows, and it scales the content with the box \" +\n \"instead of re-laying it out, so text stretches rather than re-wrapping. \" +\n \"The new value is applied on the next React render either way. See docs/api.md.\",\n )\n}\n\n/** @internal Test seam: the warning is once per property per session by design. */\nexport const resetAnimatedSizeWarnings = (): void => {\n warnedSizes.clear()\n}\n\nconst splitAnimated = (\n style: AnimatedStyleProp | false | null | undefined,\n): {\n staticStyle: StyleProp\n opacity: AnimatedNode | null\n zIndex: AnimatedNode | null\n slots: TransformSlot[]\n colors: ColorSlot[]\n sizes: SizeSlot[]\n} => {\n const flat: Record<string, unknown> = {}\n const collect = (\n entry: AnimatedStyleProp | false | null | undefined,\n ): void => {\n if (!entry) {\n return\n }\n if (Array.isArray(entry)) {\n entry.forEach(collect)\n return\n }\n Object.assign(flat, entry)\n }\n collect(style)\n\n let opacity: AnimatedNode | null = null\n let zIndex: AnimatedNode | null = null\n const slots: TransformSlot[] = []\n const colors: ColorSlot[] = []\n const sizes: SizeSlot[] = []\n\n if (isAnimatedNode(flat.opacity)) {\n opacity = flat.opacity\n delete flat.opacity\n }\n // `zIndex` is in `useSortable`'s style object on every frame and changes\n // value about twice per drag. It takes the same door opacity does — one\n // widget-level write, no Yoga, no CSS — so there is nothing to refuse.\n if (isAnimatedNode(flat.zIndex)) {\n zIndex = flat.zIndex\n delete flat.zIndex\n }\n for (const property of DRIVEABLE_COLOR_PROPERTIES) {\n const value = flat[property]\n if (isAnimatedNode(value)) {\n colors.push({ property, node: value })\n // Removed from the static style so the shared class registry never sees\n // a per-frame value: its memoisation stays keyed on styles that change\n // when React renders, which is the only thing it is good at.\n delete flat[property]\n }\n }\n if (Array.isArray(flat.transform)) {\n for (const part of flat.transform as AnimatedTransformPart[]) {\n const key = Object.keys(part)[0]\n if (key === undefined) {\n continue\n }\n const value = part[key]\n slots.push(\n isAnimatedNode(value)\n ? { key, node: value, value: value.__getValue() }\n : { key, node: null, value: value as AnimatedValue },\n )\n }\n // The whole array is owned here from now on, static entries included:\n // leaving them in the style would make useLayoutChild write the same\n // rect-store slot from the other side, and the two would overwrite\n // each other every render.\n delete flat.transform\n }\n\n // Slice 2b: an animated inset on an absolutely positioned node becomes a\n // derived translate. It is the one layout property with an exact transform\n // equivalent, because an out-of-flow node's position affects nothing but\n // where it is drawn — see src/style/absolute-insets.ts for the measured\n // rule and for the configurations where the equivalence does NOT hold.\n //\n // Three things happen here at once, and all three are load-bearing:\n //\n // - THE BASE. The inset's current value is written back into the static\n // style as a plain number, so Yoga is given a real position and the\n // committed rect the parent's allocate reads is the base the offset is\n // measured from. Nothing about the shadow tree changes.\n // - THE REBASE. This runs on every render, so when React commits a layout\n // with a different inset, the base moves and the offset is recomputed\n // against it in the SAME commit — the Yoga write and the offset write\n // are both layout effects, and the engine's flush is a microtask, so GTK\n // never gets a frame in between and there is no jump.\n // - THE ORDER. Derived slots go FIRST. The array's leftmost entry is the\n // outermost matrix (style/transform.ts), so a derived translate is\n // applied to the point LAST — it moves the already-rotated, already-\n // scaled box in the parent's coordinates, exactly as a layout position\n // does. Appending instead would put the user's scale on the OUTSIDE and\n // multiply the offset by it.\n const insetSlots: TransformSlot[] = []\n for (const property of INSET_PROPERTIES) {\n const value = flat[property]\n if (!isAnimatedNode(value)) {\n continue\n }\n const base = toNumber(value.__getValue())\n const translation = Number.isFinite(base)\n ? insetTranslation(flat, property)\n : null\n if (!translation) {\n // Not an equivalence. Resolve to the current value so the static style\n // is at least correct on this render, and keep slice 2's refusal loud.\n flat[property] = Number.isFinite(base) ? base : undefined\n warnInsetNotTranslatable(property, insetRefusalReason(flat, property))\n continue\n }\n flat[property] = base\n insetSlots.push({\n key: translation.transform,\n node: value,\n value: 0,\n inset: { base, sign: translation.sign },\n })\n }\n\n // Slice 3: an animated `width`/`height` where the change is confined to the\n // node that owns it. Unlike an inset this is NOT re-expressed as a\n // transform — there is no transform that reproduces a size change, which\n // docs/research/animated-size.md §6 measured rather than assumed — so the\n // slot carries the property itself and the view layer drives it through a\n // pinned pass over the node's own subtree.\n //\n // THE REBASE, exactly as above and for the same reason: the driven value is\n // written back into the static style as a plain number, so Yoga is given the\n // size the animation is currently showing and the committed rect the\n // override sits on catches up in the SAME commit. Both writes are layout\n // effects and the engine's flush is a microtask, so GTK never gets a frame\n // in between.\n //\n // WHETHER it can be driven is not decided here. The answer depends on the\n // CONTAINER's `flexDirection`, its `alignItems` and where its own size comes\n // from, none of which are in this style object or in this component's props\n // — it is asked of the layout tree in useAnimatedBinding, which is the only\n // place the tree exists.\n for (const property of SIZE_PROPERTIES) {\n const value = flat[property]\n if (!isAnimatedNode(value)) {\n continue\n }\n const base = toNumber(value.__getValue())\n if (!Number.isFinite(base)) {\n // A percentage produced mid-animation has no point base to lay out at.\n // Dropped rather than driven, and the leaf never becomes driveable in\n // the first place unless it starts numeric — reanimated-compat/style.ts.\n flat[property] = undefined\n continue\n }\n flat[property] = base\n sizes.push({ property, node: value, base })\n }\n\n return {\n staticStyle: flat as StyleProp,\n opacity,\n zIndex,\n slots: insetSlots.length > 0 ? [...insetSlots, ...slots] : slots,\n colors,\n sizes,\n }\n}\n\n/**\n * The imperative write path, and the whole of it.\n *\n * Animated values bypass React entirely: listeners write straight to the\n * widget (opacity), to the rect store (the transform applied by the parent's\n * allocate) on top of the engine-committed base rect, and to a CSS provider\n * private to the widget (colours). Animation frames never touch Yoga, and\n * never touch the shared stylesheet.\n *\n * Nothing here is View-specific, which is why it is a hook rather than a\n * paragraph inside `AnimatedView`: it needs the CHILD's widget (for\n * `setOpacity` and the rect store) and its PARENT's (for `queueAllocate`),\n * and any component that can produce those two can be animated. The child is\n * reached through a getter rather than a ref because a wrapper does not own\n * the widget — it reads it back out of whatever handle the wrapped component\n * exposed, which may only exist after that component's own layout effects.\n */\nconst useAnimatedBinding = (\n getWidget: () => Gtk.Widget | null,\n host: HostNode,\n opacity: AnimatedNode | null,\n zIndex: AnimatedNode | null,\n slots: TransformSlot[],\n colors: ColorSlot[],\n sizes: SizeSlot[],\n // Anything else that must force a rebind. `AnimatedView` passes its layout\n // node; the generic wrapper has nothing to add.\n rebindKey?: unknown,\n): void => {\n // The effect reads the slots of the render that (re)armed it; the values\n // inside are then owned by the listeners.\n const slotsRef = useRef<TransformSlot[]>(slots)\n slotsRef.current = slots\n const colorsRef = useRef<ColorSlot[]>(colors)\n colorsRef.current = colors\n const sizesRef = useRef<SizeSlot[]>(sizes)\n sizesRef.current = sizes\n const getWidgetRef = useRef(getWidget)\n getWidgetRef.current = getWidget\n const hostRef = useRef(host)\n hostRef.current = host\n const parentWidgetRef = host.widgetRef\n\n // Rebind on a change of shape (which transforms, in which order), of the\n // node behind an animated entry, or of a static entry's value — not on\n // every render that rebuilds an equal-looking array.\n //\n // A derived inset slot adds its BASE to the key, and that is what makes the\n // rebase happen: React committing a new `top` moves the base, which re-arms\n // this effect in the same commit that gives Yoga the new position.\n const bindingKey =\n (opacity ? `opacity#${nodeId(opacity)}` : \"\") +\n (zIndex ? `zIndex#${nodeId(zIndex)}` : \"\") +\n slots\n .map((slot) => {\n const inset = slot.inset ? `~${slot.inset.sign}:${slot.inset.base}` : \"\"\n return slot.node\n ? `|${slot.key}#${nodeId(slot.node)}${inset}`\n : `|${slot.key}=${String(slot.value)}`\n })\n .join(\"\") +\n colors.map((slot) => `|${slot.property}#${nodeId(slot.node)}`).join(\"\") +\n // The base is in the key for the same reason a derived inset's is: React\n // committing a new size moves it, and re-arming here is what hands the\n // override back to the engine in the same commit that gives Yoga the new\n // value.\n sizes\n .map((slot) => `|${slot.property}#${nodeId(slot.node)}~${slot.base}`)\n .join(\"\")\n\n useLayoutEffect(() => {\n const widget = getWidgetRef.current()\n if (!widget) {\n return\n }\n // Captured for the CLEANUP only: by then the ref may already have been\n // detached, and the container to re-allocate is the one this binding was\n // made against. Every live write below re-reads the ref instead.\n const boundParentWidget = parentWidgetRef.current\n\n // The live transform array, mutated in place: an Animated write must\n // stay one numeric store plus one queued allocation — no React render,\n // no Yoga pass, no allocation per frame beyond the composed matrix.\n //\n // RN transform semantics: this is paint-only. The result goes to the\n // rect store unclamped — the parent's measure ignores children, so a\n // transformed child draws past the boundary over its neighbors without\n // moving a single ancestor.\n const parts = slotsRef.current.map(\n (slot) =>\n ({\n [slot.key]: slot.node\n ? slotValue(slot, slot.node.__getValue())\n : slot.value,\n }) as Record<string, AnimatedValue>,\n )\n\n const flush = (): void => {\n const widget = getWidgetRef.current()\n if (!widget) {\n return\n }\n setStoredTransform(widget, parts as unknown as TransformPart[])\n const parentWidget = parentWidgetRef.current\n if (parentWidget) {\n queueAllocate(parentWidget)\n }\n }\n\n const subscriptions: { node: AnimatedNode; id: string }[] = []\n slotsRef.current.forEach((slot, index) => {\n if (!slot.node) {\n return\n }\n const part = parts[index]!\n subscriptions.push({\n node: slot.node,\n id: slot.node.addListener(({ value }) => {\n part[slot.key] = slotValue(slot, value)\n flush()\n }),\n })\n })\n\n if (opacity) {\n const applyOpacity = (value: AnimatedValue): void => {\n const numeric = typeof value === \"number\" ? value : parseFloat(value)\n getWidgetRef.current()?.setOpacity(Math.min(1, Math.max(0, numeric)))\n }\n subscriptions.push({\n node: opacity,\n id: opacity.addListener(({ value }) => {\n applyOpacity(value)\n }),\n })\n applyOpacity(opacity.__getValue())\n }\n\n // The container's paint and pick order (gtkx/bridge/view-box.ts). The\n // write drops the container's cached order and queues a redraw; nothing\n // is re-measured and nothing is re-allocated, because zIndex changes\n // neither.\n if (zIndex) {\n const applyZIndex = (value: AnimatedValue): void => {\n const widget = getWidgetRef.current()\n if (!widget) {\n return\n }\n const numeric = typeof value === \"number\" ? value : parseFloat(value)\n setZIndex(widget, Number.isFinite(numeric) ? Math.round(numeric) : 0)\n }\n subscriptions.push({\n node: zIndex,\n id: zIndex.addListener(({ value }) => {\n applyZIndex(value)\n }),\n })\n applyZIndex(zIndex.__getValue())\n }\n\n // Colours take the other imperative door: a CSS provider private to this\n // widget, replaced in place. Deliberately NOT the shared class registry —\n // that one memoises by CSS text, so a driven colour would mint a class per\n // frame into a document GTK re-parses whole and that is never pruned\n // (docs/research/animated-colors.md). All driven colours share one\n // provider and one declaration block: two properties animating together\n // are one write, not two.\n const colorSlots = colorsRef.current\n let widgetCss: WidgetCss | null = null\n if (colorSlots.length > 0) {\n const css = createWidgetCss(widget)\n widgetCss = css\n const values: Record<string, unknown> = {}\n const writeColors = (): void => {\n css.set(driveableColorsToCss(values))\n }\n for (const slot of colorSlots) {\n values[slot.property] = slot.node.__getValue()\n subscriptions.push({\n node: slot.node,\n id: slot.node.addListener(({ value }) => {\n values[slot.property] = value\n writeColors()\n }),\n })\n }\n writeColors()\n }\n\n // Sizes take the third door, and it is the only one that runs Yoga.\n //\n // Nothing is written at BIND time on purpose: the render that armed this\n // effect put the current value into the static style, so the engine is\n // already committing exactly this size and an override would be a copy of\n // it. The first write happens when a frame asks for something else.\n const sizeSlots = sizesRef.current\n const drivenWidgets: Gtk.Widget[] = []\n if (sizeSlots.length > 0) {\n const layoutNode = nodeForWidget(widget)\n const driven: DrivenSize = {}\n const driveable = new Set<SizeProperty>()\n let decided = false\n // Deferred to the first frame that actually asks for a new size, and\n // that is not laziness: the rule is asked of the CONTAINER's Yoga node,\n // and on a first mount a container's own layout effects run AFTER its\n // children's — so at bind time the container may still be carrying the\n // defaults rather than its style. By the first frame the tree has been\n // laid out at least once and the answer is the real one.\n const decide = (): void => {\n decided = true\n if (!layoutNode) {\n return\n }\n const context = {\n node: layoutNode,\n rootIsContentSized: hostRef.current.engine.contentSized,\n }\n for (const slot of sizeSlots) {\n const reason = drivenSizeRefusal(context, slot.property)\n if (reason === null) {\n driveable.add(slot.property)\n } else {\n warnSizeNotDriveable(slot.property, reason)\n }\n }\n }\n for (const slot of sizeSlots) {\n subscriptions.push({\n node: slot.node,\n id: slot.node.addListener(({ value }) => {\n const numeric = toNumber(value)\n if (!Number.isFinite(numeric)) {\n return\n }\n if (!decided) {\n decide()\n }\n if (!driveable.has(slot.property) || !layoutNode) {\n return\n }\n driven[slot.property] = numeric\n const target = getWidgetRef.current()\n if (target) {\n applyDrivenSize(\n layoutNode,\n target,\n parentWidgetRef.current,\n driven,\n drivenWidgets,\n )\n }\n }),\n })\n }\n }\n\n flush()\n\n return () => {\n for (const { node: animated, id } of subscriptions) {\n animated.removeListener(id)\n }\n widgetCss?.dispose()\n // Every widget this binding was driving goes back to the rect the\n // engine committed. On a REBASE that is the whole point: the render\n // that re-armed this effect handed Yoga the size the animation is\n // showing, so the committed rect is about to become the driven one and\n // holding an override on top of it would be holding a stale copy.\n if (drivenWidgets.length > 0) {\n releaseDrivenSize(drivenWidgets)\n if (boundParentWidget) {\n queueAllocate(boundParentWidget)\n }\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [bindingKey, rebindKey])\n}\n\nconst AnimatedView = ({\n style,\n children,\n onLayout,\n testID,\n ref,\n pointerEvents,\n animatedProps,\n ...responderProps\n}: AnimatedViewProps) => {\n const widgetRef = useRef<Gtk.Box | null>(null)\n const { staticStyle, opacity, zIndex, slots, colors, sizes } =\n splitAnimated(style)\n\n const { host, node, cssClass } = useLayoutChild(widgetRef, {\n style: staticStyle,\n onLayout,\n })\n useRnContainer(widgetRef, node)\n\n // A gesture whose own GestureDetector could not reach a widget directly —\n // its child was an opaque composite that renders this Animated.View but\n // forwards neither a ref nor its own props onto it, react-native-sortables'\n // ItemCell being the confirmed case (gesture-handler-compat/attach-context.ts)\n // — claims this widget instead, through context rather than through the\n // props ItemCell dropped.\n const gestureAttach = useGestureAttach()\n useResponder(\n widgetRef,\n gestureAttach\n ? mergeGestureHandlers(responderProps, gestureAttach.handlers)\n : responderProps,\n )\n\n // `animatedProps` LAST, matching `createAnimatedComponent`'s\n // `{ ...rest, ...animatedProps }` — a value produced by the updater is the\n // live one and wins over the static prop. Only the picking mode is read\n // here: a numeric animated prop has no meaning on a View, and the SVG\n // shapes that do take them go through `createAnimatedComponent` already.\n const mode: PointerEventsValue =\n (animatedProps?.pointerEvents as PointerEventsValue | undefined) ??\n pointerEvents ??\n StyleSheet.flatten(staticStyle)?.pointerEvents ??\n \"auto\"\n\n useLayoutEffect(() => {\n const widget = widgetRef.current\n if (!widget) {\n return\n }\n setPointerTarget(widget, mode !== \"none\")\n setBoxPassthrough(widget, mode === \"box-none\")\n }, [mode])\n\n useImperativeHandle(ref, () => createMeasureHandle(widgetRef, node), [node])\n\n // Registers this widget as the fallback gesture's handle — the same\n // `assignHandle` its GestureDetector would have put directly on the ref, had\n // its child forwarded one. A fresh handle rather than reusing the one above:\n // `useImperativeHandle`'s factory only runs when `ref` itself is non-null,\n // which is not the case here (ItemCell passes none), so there is nothing to\n // reuse — and a second handle for the same widget is harmless, `measure.ts`\n // keys by handle identity, not by widget.\n useLayoutEffect(() => {\n gestureAttach?.assignHandle(createMeasureHandle(widgetRef, node))\n }, [gestureAttach, node])\n\n useAnimatedBinding(\n () => widgetRef.current,\n host,\n opacity,\n zIndex,\n slots,\n colors,\n sizes,\n node,\n )\n\n return (\n <GtkBox\n ref={widgetRef}\n name={testID}\n cssClasses={cssClass ? [cssClass] : []}\n >\n <HostNodeContext.Provider\n value={{ engine: host.engine, node, widgetRef }}\n >\n {/* Claimed here (or never offered at all) either way — a nested\n Animated.View further down must not claim the same gesture again. */}\n <GestureAttachContext.Provider value={null}>\n {children}\n </GestureAttachContext.Provider>\n </HostNodeContext.Provider>\n </GtkBox>\n )\n}\n\n// --- createAnimatedComponent ---------------------------------------------\n\n/** Node-backed props from `useAnimatedProps`, spread onto the wrapped component. */\nexport type AnimatedPropsProp = Record<string, unknown>\n\n/** The props an animated wrapper adds on top of the component's own. */\nexport type AnimatedComponentExtraProps = {\n style?: AnimatedStyleProp\n animatedProps?: AnimatedPropsProp\n}\n\n// `Partial`, as upstream's own `AnimatedProps<Props>` effectively is: a prop\n// supplied through `animatedProps` is invisible to the type system here, so\n// insisting on the wrapped component's required props would reject exactly\n// the call the feature exists for (`<AnimatedCircle animatedProps={{ r }} />`).\nexport type AnimatedComponent<C extends ElementType> = (\n props: Partial<Omit<ComponentProps<C>, \"style\">> &\n AnimatedComponentExtraProps,\n) => ReactNode\n\nconst displayNameOf = (component: unknown): string => {\n if (typeof component === \"string\") {\n return component\n }\n const named = component as { displayName?: string; name?: string }\n return named?.displayName ?? named?.name ?? \"Component\"\n}\n\n// One warning per wrapped component per session — a mapper runs at frame\n// rate, and the name is the actionable part.\nconst warnedWithoutWidget = new Set<string>()\n\nconst warnNoWidget = (name: string): void => {\n if (warnedWithoutWidget.has(name)) {\n return\n }\n warnedWithoutWidget.add(name)\n const isProduction =\n typeof process !== \"undefined\" && process.env.NODE_ENV === \"production\"\n if (!isProduction) {\n console.warn(\n `react-native-gtkx: createAnimatedComponent(${name}) was given an animated \\`opacity\\`, ` +\n \"`transform`, colour or size, but the component exposed no ref carrying a widget, so there is nothing to write \" +\n \"to. Give it a `ref?: Ref<MeasureHandle>` built with the platform's own measure handle, or wrap \" +\n \"it in an `Animated.View`. See docs/api.md.\",\n )\n }\n}\n\n/** @internal Test seam: the warning is once per component per session by design. */\nexport const resetAnimatedComponentWarnings = (): void => {\n warnedWithoutWidget.clear()\n}\n\n/**\n * Wraps a component so its `style`'s `opacity`/`transform` and its\n * `animatedProps` can be driven imperatively — RN's own\n * `Animated.createAnimatedComponent`.\n *\n * IT ADDS NO WIDGET. Wrapping in an `Animated.View` would have been three\n * lines and would have been wrong: an extra box changes flex layout, changes\n * what `measureLayout` is relative to, and changes which widget a parent's\n * allocate walks. That is not a shim, it is a different tree. Instead the\n * wrapper renders the component itself and reaches the widget through the\n * handle the component already exposes (see measure.ts's `widgetOf`), so the\n * rendered output is byte-for-byte what the unwrapped component produces.\n *\n * `animatedProps` are passed straight through as animated NODES rather than\n * resolved to numbers, because the components that take them already accept\n * one: the SVG shapes duck-type an animated node on every numeric geometry\n * and paint prop and subscribe to it themselves (svg/animated-support.ts),\n * redrawing through `queueDraw`. Nothing is resolved here that the receiver\n * can resolve better.\n */\nexport const createAnimatedComponent = <C extends ElementType>(\n component: C,\n): AnimatedComponent<C> => {\n const name = displayNameOf(component)\n\n const AnimatedWrapper = ({\n style,\n animatedProps,\n ref,\n ...rest\n }: AnimatedComponentExtraProps & {\n ref?: Ref<unknown>\n [key: string]: unknown\n }) => {\n // The PARENT's widget, for `queueAllocate` — the wrapper is not a host\n // node itself, so this is the container the wrapped component is laid out\n // by, exactly as it would be without the wrapper.\n const host = useHostNode()\n const handleRef = useRef<unknown>(null)\n const { staticStyle, opacity, zIndex, slots, colors, sizes } =\n splitAnimated(style)\n const driven =\n opacity !== null ||\n zIndex !== null ||\n slots.length > 0 ||\n colors.length > 0 ||\n sizes.length > 0\n\n // Stable identity: a fresh callback ref every render would detach and\n // reattach the wrapped component's handle on every render.\n const forwardedRef = useRef<Ref<unknown> | undefined>(ref)\n forwardedRef.current = ref\n const [assignHandle] = useState(() => (instance: unknown) => {\n handleRef.current = instance\n const target = forwardedRef.current\n if (typeof target === \"function\") {\n target(instance)\n } else if (target) {\n ;(target as { current: unknown }).current = instance\n }\n // No return value: React 19 reads one as a callback-ref cleanup.\n })\n\n useAnimatedBinding(\n () => widgetForHandle(handleRef.current),\n host,\n opacity,\n zIndex,\n slots,\n colors,\n sizes,\n )\n\n // A silent no-op is the failure this repo refuses. Checked after the\n // wrapped component's own layout effects have run, which is where its\n // `useImperativeHandle` publishes the handle.\n useLayoutEffect(() => {\n if (driven && widgetForHandle(handleRef.current) === null) {\n warnNoWidget(name)\n }\n })\n\n const targetProps: Record<string, unknown> = { ...rest, ...animatedProps }\n // Only when there is something to attach: a component that takes no ref\n // (the SVG shapes) would otherwise get one in its rest props.\n if (driven || ref) {\n targetProps.ref = assignHandle\n }\n // Likewise `style`: passing `{}` to a component that has no style prop\n // would push an empty object into whatever collects its rest props.\n if (style !== undefined) {\n targetProps.style = staticStyle\n }\n\n const Target = component as ComponentType<Record<string, unknown>>\n return <Target {...targetProps} />\n }\n AnimatedWrapper.displayName = `Animated(${name})`\n\n return AnimatedWrapper as AnimatedComponent<C>\n}\n\n/**\n * `Animated.FlatList` is deliberately absent, and this is the refusal.\n *\n * FlatList is a COMPOSITE, not a host component: it renders the windowed\n * VirtualizedList core, which renders a ScrollView, which is the only thing\n * in that chain owning a widget. Its ref is a scroll API by contract\n * (`scrollToIndex`/`scrollToItem`/`scrollToOffset`), so there is no handle to\n * read a widget back out of — and giving it one would mean publishing the\n * scrolled window through two layers that exist to hide it.\n *\n * Upstream's `Animated.FlatList` mostly exists so `onScroll` can be an\n * `Animated.event`/`useAnimatedScrollHandler` — both work on this platform\n * (../animated/event.ts, ../reanimated-compat/scroll-handler.ts) — which is\n * exactly why the refusal survives without taking that with it: either one\n * still reaches the widget through the plain `FlatList`'s own `onScroll`\n * (forwarded straight to the windowed core's `ScrollView`) or through\n * `Animated.ScrollView`. So this throws where it is used, naming itself and\n * naming the two things that do work.\n */\nconst AnimatedFlatList = (): never => {\n throw new Error(\n \"react-native-gtkx: `Animated.FlatList` is not implemented. FlatList is a composite — the windowed \" +\n \"core over a ScrollView — and its ref is a scroll API, so there is no host widget for an animated \" +\n \"style to write to. Put the animated style on an `Animated.View` wrapping the list, or use \" +\n \"`Animated.ScrollView` if the list does not need virtualization. See docs/api.md.\",\n )\n}\nAnimatedFlatList.displayName = \"Animated.FlatList\"\n\n/**\n * `Text`, `Image` and `ScrollView` are the generic wrapper over the\n * platform's own components — no subclass, no special case, and no widget\n * added to the tree. They are animatable at all because those three now\n * expose a ref carrying their widget, which is RN parity in its own right.\n */\nconst AnimatedText = createAnimatedComponent(Text)\nconst AnimatedImage = createAnimatedComponent(Image)\nconst AnimatedScrollView = createAnimatedComponent(ScrollView)\n\nexport const Animated = {\n ...api,\n View: AnimatedView,\n Text: AnimatedText,\n Image: AnimatedImage,\n ScrollView: AnimatedScrollView,\n // Typed as taking the props it refuses, so the failure is at RUNTIME with\n // the message above rather than at compile time with \"no overload matches\n // this call\" — an app porting from mobile deserves the sentence, not a\n // type puzzle.\n FlatList: AnimatedFlatList as (props: Record<string, unknown>) => never,\n createAnimatedComponent,\n}\n\nexport { Easing } from \"../animated/index\"\n"]}
@@ -1,6 +1,8 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useLayoutEffect } from "react";
3
- import { AdwApplicationWindow, createRoot, Gtk, GtkApplication, GtkApplicationWindow, quit, } from "../gtkx/bridge/index";
3
+ import { warnOnce } from "../style/dev-warning";
4
+ import { adwAvailable, requireAdwJsx } from "../gtkx/bridge/adw";
5
+ import { createRoot, Gtk, GtkApplication, GtkApplicationWindow, quit, } from "../gtkx/bridge/index";
4
6
  import { Root } from "./root";
5
7
  const registry = new Map();
6
8
  // The chrome the running app was started with — read by the navigation
@@ -69,14 +71,36 @@ export const AppRegistry = {
69
71
  const width = params.width ?? 800;
70
72
  const height = params.height ?? 600;
71
73
  const contentChrome = params.chrome === "content";
72
- activeChrome = contentChrome ? "content" : "system";
73
- if (process.env.NODE_ENV !== "production" &&
74
- params.breakpoints &&
75
- !contentChrome) {
76
- console.warn('[react-native-gtkx] breakpoints was passed to runApplication without chrome: "content" — GtkApplicationWindow (the "system" chrome default) has no breakpoints concept, so it is ignored.');
74
+ // What chrome: "content" actually gets: AdwApplicationWindow needs Adw
75
+ // itself, so a plain-GTK app (no "Adw-1" in gtkx.config.ts) falls back to
76
+ // exactly the "system" chrome path — same window type, same content
77
+ // wrapper — rather than throwing, per
78
+ // .claude/epics/adw-optional/002.md. The Adw profile is unaffected:
79
+ // adwAvailable() is true there, so useAdwChrome === contentChrome always,
80
+ // and every branch below takes the same route it did before this probe
81
+ // existed.
82
+ const useAdwChrome = contentChrome && adwAvailable();
83
+ activeChrome = useAdwChrome ? "content" : "system";
84
+ if (process.env.NODE_ENV !== "production" && params.breakpoints) {
85
+ if (!contentChrome) {
86
+ console.warn('[react-native-gtkx] breakpoints was passed to runApplication without chrome: "content" — GtkApplicationWindow (the "system" chrome default) has no breakpoints concept, so it is ignored.');
87
+ }
88
+ else if (!useAdwChrome) {
89
+ // Once, not every run: contentChrome apps in a long-lived dev loop
90
+ // (Fast Refresh) would otherwise re-warn on every reload.
91
+ warnOnce("app-registry:breakpoints-no-adw", '[react-native-gtkx] breakpoints was passed to runApplication with chrome: "content", but this app has no "Adw-1" in its gtkx.config.ts `libraries` — falling back to GtkApplicationWindow, which has no breakpoints concept, so it is ignored.');
92
+ }
77
93
  }
78
- const content = contentChrome ? (_jsx(ContentChrome, { App: App, initialProps: params.initialProps ?? {} })) : (_jsx(WindowContent, { App: App, initialProps: params.initialProps ?? {}, initialWidth: width, initialHeight: height }));
79
- const AppWindow = () => contentChrome ? (_jsx(AdwApplicationWindow, { title: params.title ?? appKey, defaultWidth: width, defaultHeight: height, onCloseRequest: quit, actions: params.windowActions, controllers: params.windowControllers, breakpoints: params.breakpoints, children: content })) : (_jsx(GtkApplicationWindow, { title: params.title ?? appKey, defaultWidth: width, defaultHeight: height, onCloseRequest: quit, actions: params.windowActions, controllers: params.windowControllers, children: content }));
94
+ const content = useAdwChrome ? (_jsx(ContentChrome, { App: App, initialProps: params.initialProps ?? {} })) : (_jsx(WindowContent, { App: App, initialProps: params.initialProps ?? {}, initialWidth: width, initialHeight: height }));
95
+ // Adw is reached ONLY here, and only when chrome: "content" was actually
96
+ // requested AND this app's codegen store actually has it — chrome:
97
+ // "system" (the default), and a plain-GTK app's chrome: "content", never
98
+ // touch it, which is what lets an app with no Adw-1 declared run at all
99
+ // (see .claude/epics/adw-optional/001.md and 002.md for the fallback).
100
+ const AppWindow = () => useAdwChrome ? ((() => {
101
+ const { AdwApplicationWindow } = requireAdwJsx('chrome: "content"');
102
+ return (_jsx(AdwApplicationWindow, { title: params.title ?? appKey, defaultWidth: width, defaultHeight: height, onCloseRequest: quit, actions: params.windowActions, controllers: params.windowControllers, breakpoints: params.breakpoints, children: content }));
103
+ })()) : (_jsx(GtkApplicationWindow, { title: params.title ?? appKey, defaultWidth: width, defaultHeight: height, onCloseRequest: quit, actions: params.windowActions, controllers: params.windowControllers, children: content }));
80
104
  createRoot().render(_jsx(GtkApplication, { actions: params.applicationActions, actionAccels: params.actionAccels, children: _jsx(AppWindow, {}) }));
81
105
  },
82
106
  };