@gtkx/react 0.19.0 → 0.21.0

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 (289) hide show
  1. package/README.md +26 -62
  2. package/dist/components/compound.d.ts +40 -0
  3. package/dist/components/compound.d.ts.map +1 -0
  4. package/dist/components/compound.js +46 -0
  5. package/dist/components/compound.js.map +1 -0
  6. package/dist/components/list.d.ts +75 -0
  7. package/dist/components/list.d.ts.map +1 -0
  8. package/dist/components/list.js +81 -0
  9. package/dist/components/list.js.map +1 -0
  10. package/dist/components/slot-widget.d.ts +15 -0
  11. package/dist/components/slot-widget.d.ts.map +1 -0
  12. package/dist/components/slot-widget.js +37 -0
  13. package/dist/components/slot-widget.js.map +1 -0
  14. package/dist/errors.d.ts +6 -0
  15. package/dist/errors.d.ts.map +1 -1
  16. package/dist/errors.js +8 -6
  17. package/dist/errors.js.map +1 -1
  18. package/dist/generated/compounds.d.ts +2672 -0
  19. package/dist/generated/compounds.d.ts.map +1 -0
  20. package/dist/generated/compounds.js +2624 -0
  21. package/dist/generated/compounds.js.map +1 -0
  22. package/dist/generated/internal.d.ts +6 -7
  23. package/dist/generated/internal.d.ts.map +1 -1
  24. package/dist/generated/internal.js +3054 -1838
  25. package/dist/generated/internal.js.map +1 -1
  26. package/dist/generated/jsx.d.ts +2096 -4970
  27. package/dist/generated/jsx.d.ts.map +1 -1
  28. package/dist/generated/jsx.js +979 -3862
  29. package/dist/generated/jsx.js.map +1 -1
  30. package/dist/generated/registry.d.ts +1 -0
  31. package/dist/generated/registry.d.ts.map +1 -1
  32. package/dist/generated/registry.js +0 -1
  33. package/dist/generated/registry.js.map +1 -1
  34. package/dist/host-config.d.ts.map +1 -1
  35. package/dist/host-config.js +2 -0
  36. package/dist/host-config.js.map +1 -1
  37. package/dist/index.d.ts +2 -0
  38. package/dist/index.d.ts.map +1 -1
  39. package/dist/index.js +2 -0
  40. package/dist/index.js.map +1 -1
  41. package/dist/jsx.d.ts +157 -518
  42. package/dist/jsx.d.ts.map +1 -1
  43. package/dist/jsx.js +6 -393
  44. package/dist/jsx.js.map +1 -1
  45. package/dist/metadata.d.ts +1 -1
  46. package/dist/metadata.d.ts.map +1 -1
  47. package/dist/metadata.js +7 -3
  48. package/dist/metadata.js.map +1 -1
  49. package/dist/node.d.ts +0 -4
  50. package/dist/node.d.ts.map +1 -1
  51. package/dist/node.js +19 -41
  52. package/dist/node.js.map +1 -1
  53. package/dist/nodes/alert-dialog.d.ts +14 -0
  54. package/dist/nodes/alert-dialog.d.ts.map +1 -0
  55. package/dist/nodes/alert-dialog.js +41 -0
  56. package/dist/nodes/alert-dialog.js.map +1 -0
  57. package/dist/nodes/animation.d.ts +5 -4
  58. package/dist/nodes/animation.d.ts.map +1 -1
  59. package/dist/nodes/animation.js +65 -49
  60. package/dist/nodes/animation.js.map +1 -1
  61. package/dist/nodes/application.d.ts.map +1 -1
  62. package/dist/nodes/application.js +4 -0
  63. package/dist/nodes/application.js.map +1 -1
  64. package/dist/nodes/column-view-column.d.ts +19 -19
  65. package/dist/nodes/column-view-column.d.ts.map +1 -1
  66. package/dist/nodes/column-view-column.js +130 -119
  67. package/dist/nodes/column-view-column.js.map +1 -1
  68. package/dist/nodes/container-slot.d.ts +3 -1
  69. package/dist/nodes/container-slot.d.ts.map +1 -1
  70. package/dist/nodes/container-slot.js +28 -16
  71. package/dist/nodes/container-slot.js.map +1 -1
  72. package/dist/nodes/drawing-area.d.ts +3 -1
  73. package/dist/nodes/drawing-area.d.ts.map +1 -1
  74. package/dist/nodes/drawing-area.js +20 -22
  75. package/dist/nodes/drawing-area.js.map +1 -1
  76. package/dist/nodes/event-controller.d.ts.map +1 -1
  77. package/dist/nodes/event-controller.js +6 -16
  78. package/dist/nodes/event-controller.js.map +1 -1
  79. package/dist/nodes/fixed-child.d.ts +1 -0
  80. package/dist/nodes/fixed-child.d.ts.map +1 -1
  81. package/dist/nodes/fixed-child.js +13 -0
  82. package/dist/nodes/fixed-child.js.map +1 -1
  83. package/dist/nodes/grid-child.d.ts +1 -0
  84. package/dist/nodes/grid-child.d.ts.map +1 -1
  85. package/dist/nodes/grid-child.js +13 -0
  86. package/dist/nodes/grid-child.js.map +1 -1
  87. package/dist/nodes/internal/accessible.d.ts.map +1 -1
  88. package/dist/nodes/internal/accessible.js.map +1 -1
  89. package/dist/nodes/internal/bound-item.d.ts +4 -0
  90. package/dist/nodes/internal/bound-item.d.ts.map +1 -0
  91. package/dist/nodes/internal/bound-item.js +2 -0
  92. package/dist/nodes/internal/bound-item.js.map +1 -0
  93. package/dist/nodes/internal/construct.d.ts +1 -8
  94. package/dist/nodes/internal/construct.d.ts.map +1 -1
  95. package/dist/nodes/internal/construct.js +30 -54
  96. package/dist/nodes/internal/construct.js.map +1 -1
  97. package/dist/nodes/internal/widget.d.ts.map +1 -1
  98. package/dist/nodes/internal/widget.js +9 -10
  99. package/dist/nodes/internal/widget.js.map +1 -1
  100. package/dist/nodes/list-item-node.d.ts +12 -0
  101. package/dist/nodes/list-item-node.d.ts.map +1 -0
  102. package/dist/nodes/list-item-node.js +45 -0
  103. package/dist/nodes/list-item-node.js.map +1 -0
  104. package/dist/nodes/list.d.ts +100 -0
  105. package/dist/nodes/list.d.ts.map +1 -0
  106. package/dist/nodes/list.js +950 -0
  107. package/dist/nodes/list.js.map +1 -0
  108. package/dist/nodes/notebook-page.d.ts.map +1 -1
  109. package/dist/nodes/notebook-page.js +6 -2
  110. package/dist/nodes/notebook-page.js.map +1 -1
  111. package/dist/nodes/overlay-child.d.ts +2 -0
  112. package/dist/nodes/overlay-child.d.ts.map +1 -1
  113. package/dist/nodes/overlay-child.js +29 -8
  114. package/dist/nodes/overlay-child.js.map +1 -1
  115. package/dist/nodes/spin-row.d.ts +14 -0
  116. package/dist/nodes/spin-row.d.ts.map +1 -0
  117. package/dist/nodes/spin-row.js +46 -0
  118. package/dist/nodes/spin-row.js.map +1 -0
  119. package/dist/nodes/switch-row.d.ts +11 -0
  120. package/dist/nodes/switch-row.d.ts.map +1 -0
  121. package/dist/nodes/switch-row.js +15 -0
  122. package/dist/nodes/switch-row.js.map +1 -0
  123. package/dist/nodes/text-anchor.d.ts.map +1 -1
  124. package/dist/nodes/text-anchor.js +10 -0
  125. package/dist/nodes/text-anchor.js.map +1 -1
  126. package/dist/nodes/text-tag.d.ts.map +1 -1
  127. package/dist/nodes/text-tag.js +45 -39
  128. package/dist/nodes/text-tag.js.map +1 -1
  129. package/dist/nodes/toggle-group.d.ts +12 -6
  130. package/dist/nodes/toggle-group.d.ts.map +1 -1
  131. package/dist/nodes/toggle-group.js +53 -4
  132. package/dist/nodes/toggle-group.js.map +1 -1
  133. package/dist/nodes/widget.d.ts.map +1 -1
  134. package/dist/nodes/widget.js +16 -22
  135. package/dist/nodes/widget.js.map +1 -1
  136. package/dist/nodes/window.d.ts.map +1 -1
  137. package/dist/nodes/window.js +2 -2
  138. package/dist/nodes/window.js.map +1 -1
  139. package/dist/registry.d.ts +0 -2
  140. package/dist/registry.d.ts.map +1 -1
  141. package/dist/registry.js +11 -18
  142. package/dist/registry.js.map +1 -1
  143. package/dist/types.d.ts +3 -2
  144. package/dist/types.d.ts.map +1 -1
  145. package/dist/use-property.d.ts +29 -0
  146. package/dist/use-property.d.ts.map +1 -0
  147. package/dist/use-property.js +44 -0
  148. package/dist/use-property.js.map +1 -0
  149. package/dist/use-setting.d.ts +36 -0
  150. package/dist/use-setting.d.ts.map +1 -0
  151. package/dist/use-setting.js +68 -0
  152. package/dist/use-setting.js.map +1 -0
  153. package/package.json +5 -4
  154. package/src/components/compound.tsx +57 -0
  155. package/src/components/list.tsx +140 -0
  156. package/src/components/slot-widget.tsx +46 -0
  157. package/src/errors.ts +8 -7
  158. package/src/generated/compounds.ts +2741 -0
  159. package/src/generated/internal.ts +3059 -1840
  160. package/src/generated/jsx.ts +2509 -5350
  161. package/src/generated/registry.ts +2 -1
  162. package/src/host-config.ts +2 -0
  163. package/src/index.ts +2 -0
  164. package/src/jsx.ts +167 -581
  165. package/src/metadata.ts +7 -4
  166. package/src/node.ts +23 -39
  167. package/src/nodes/alert-dialog.ts +55 -0
  168. package/src/nodes/animation.ts +67 -60
  169. package/src/nodes/application.ts +5 -0
  170. package/src/nodes/column-view-column.ts +125 -128
  171. package/src/nodes/container-slot.ts +30 -17
  172. package/src/nodes/drawing-area.ts +23 -32
  173. package/src/nodes/event-controller.ts +6 -18
  174. package/src/nodes/fixed-child.ts +13 -0
  175. package/src/nodes/grid-child.ts +13 -0
  176. package/src/nodes/internal/accessible.ts +0 -1
  177. package/src/nodes/internal/bound-item.ts +4 -0
  178. package/src/nodes/internal/construct.ts +38 -68
  179. package/src/nodes/internal/widget.ts +9 -13
  180. package/src/nodes/list-item-node.ts +53 -0
  181. package/src/nodes/list.ts +1082 -0
  182. package/src/nodes/notebook-page.ts +6 -2
  183. package/src/nodes/overlay-child.ts +30 -9
  184. package/src/nodes/spin-row.ts +72 -0
  185. package/src/nodes/switch-row.ts +26 -0
  186. package/src/nodes/text-anchor.ts +9 -0
  187. package/src/nodes/text-tag.ts +45 -40
  188. package/src/nodes/toggle-group.ts +63 -9
  189. package/src/nodes/widget.ts +14 -26
  190. package/src/nodes/window.ts +2 -2
  191. package/src/registry.ts +18 -24
  192. package/src/types.ts +8 -2
  193. package/src/use-property.ts +58 -0
  194. package/src/use-setting.ts +96 -0
  195. package/dist/fiber-root.d.ts +0 -4
  196. package/dist/fiber-root.d.ts.map +0 -1
  197. package/dist/fiber-root.js +0 -6
  198. package/dist/fiber-root.js.map +0 -1
  199. package/dist/nodes/column-view.d.ts +0 -37
  200. package/dist/nodes/column-view.d.ts.map +0 -1
  201. package/dist/nodes/column-view.js +0 -205
  202. package/dist/nodes/column-view.js.map +0 -1
  203. package/dist/nodes/drop-down.d.ts +0 -37
  204. package/dist/nodes/drop-down.d.ts.map +0 -1
  205. package/dist/nodes/drop-down.js +0 -231
  206. package/dist/nodes/drop-down.js.map +0 -1
  207. package/dist/nodes/grid-view.d.ts +0 -30
  208. package/dist/nodes/grid-view.d.ts.map +0 -1
  209. package/dist/nodes/grid-view.js +0 -90
  210. package/dist/nodes/grid-view.js.map +0 -1
  211. package/dist/nodes/internal/base-item-renderer.d.ts +0 -28
  212. package/dist/nodes/internal/base-item-renderer.d.ts.map +0 -1
  213. package/dist/nodes/internal/base-item-renderer.js +0 -85
  214. package/dist/nodes/internal/base-item-renderer.js.map +0 -1
  215. package/dist/nodes/internal/grid-item-renderer.d.ts +0 -20
  216. package/dist/nodes/internal/grid-item-renderer.d.ts.map +0 -1
  217. package/dist/nodes/internal/grid-item-renderer.js +0 -66
  218. package/dist/nodes/internal/grid-item-renderer.js.map +0 -1
  219. package/dist/nodes/internal/header-item-renderer.d.ts +0 -23
  220. package/dist/nodes/internal/header-item-renderer.d.ts.map +0 -1
  221. package/dist/nodes/internal/header-item-renderer.js +0 -87
  222. package/dist/nodes/internal/header-item-renderer.js.map +0 -1
  223. package/dist/nodes/internal/header-renderer-manager.d.ts +0 -13
  224. package/dist/nodes/internal/header-renderer-manager.d.ts.map +0 -1
  225. package/dist/nodes/internal/header-renderer-manager.js +0 -20
  226. package/dist/nodes/internal/header-renderer-manager.js.map +0 -1
  227. package/dist/nodes/internal/list-item-renderer.d.ts +0 -27
  228. package/dist/nodes/internal/list-item-renderer.d.ts.map +0 -1
  229. package/dist/nodes/internal/list-item-renderer.js +0 -131
  230. package/dist/nodes/internal/list-item-renderer.js.map +0 -1
  231. package/dist/nodes/internal/list-store.d.ts +0 -21
  232. package/dist/nodes/internal/list-store.d.ts.map +0 -1
  233. package/dist/nodes/internal/list-store.js +0 -90
  234. package/dist/nodes/internal/list-store.js.map +0 -1
  235. package/dist/nodes/internal/sectioned-list-store.d.ts +0 -50
  236. package/dist/nodes/internal/sectioned-list-store.d.ts.map +0 -1
  237. package/dist/nodes/internal/sectioned-list-store.js +0 -250
  238. package/dist/nodes/internal/sectioned-list-store.js.map +0 -1
  239. package/dist/nodes/internal/selection-helpers.d.ts +0 -12
  240. package/dist/nodes/internal/selection-helpers.d.ts.map +0 -1
  241. package/dist/nodes/internal/selection-helpers.js +0 -25
  242. package/dist/nodes/internal/selection-helpers.js.map +0 -1
  243. package/dist/nodes/internal/selection-model-controller.d.ts +0 -26
  244. package/dist/nodes/internal/selection-model-controller.d.ts.map +0 -1
  245. package/dist/nodes/internal/selection-model-controller.js +0 -82
  246. package/dist/nodes/internal/selection-model-controller.js.map +0 -1
  247. package/dist/nodes/internal/simple-list-store.d.ts +0 -15
  248. package/dist/nodes/internal/simple-list-store.d.ts.map +0 -1
  249. package/dist/nodes/internal/simple-list-store.js +0 -110
  250. package/dist/nodes/internal/simple-list-store.js.map +0 -1
  251. package/dist/nodes/internal/tree-store.d.ts +0 -37
  252. package/dist/nodes/internal/tree-store.d.ts.map +0 -1
  253. package/dist/nodes/internal/tree-store.js +0 -253
  254. package/dist/nodes/internal/tree-store.js.map +0 -1
  255. package/dist/nodes/list-item.d.ts +0 -24
  256. package/dist/nodes/list-item.d.ts.map +0 -1
  257. package/dist/nodes/list-item.js +0 -83
  258. package/dist/nodes/list-item.js.map +0 -1
  259. package/dist/nodes/list-section.d.ts +0 -27
  260. package/dist/nodes/list-section.d.ts.map +0 -1
  261. package/dist/nodes/list-section.js +0 -43
  262. package/dist/nodes/list-section.js.map +0 -1
  263. package/dist/nodes/list-view.d.ts +0 -32
  264. package/dist/nodes/list-view.d.ts.map +0 -1
  265. package/dist/nodes/list-view.js +0 -123
  266. package/dist/nodes/list-view.js.map +0 -1
  267. package/dist/nodes/models/list.d.ts +0 -39
  268. package/dist/nodes/models/list.d.ts.map +0 -1
  269. package/dist/nodes/models/list.js +0 -207
  270. package/dist/nodes/models/list.js.map +0 -1
  271. package/src/fiber-root.ts +0 -20
  272. package/src/nodes/column-view.ts +0 -262
  273. package/src/nodes/drop-down.ts +0 -284
  274. package/src/nodes/grid-view.ts +0 -119
  275. package/src/nodes/internal/base-item-renderer.ts +0 -107
  276. package/src/nodes/internal/grid-item-renderer.ts +0 -78
  277. package/src/nodes/internal/header-item-renderer.ts +0 -105
  278. package/src/nodes/internal/header-renderer-manager.ts +0 -33
  279. package/src/nodes/internal/list-item-renderer.ts +0 -162
  280. package/src/nodes/internal/list-store.ts +0 -107
  281. package/src/nodes/internal/sectioned-list-store.ts +0 -287
  282. package/src/nodes/internal/selection-helpers.ts +0 -35
  283. package/src/nodes/internal/selection-model-controller.ts +0 -119
  284. package/src/nodes/internal/simple-list-store.ts +0 -116
  285. package/src/nodes/internal/tree-store.ts +0 -289
  286. package/src/nodes/list-item.ts +0 -107
  287. package/src/nodes/list-section.ts +0 -64
  288. package/src/nodes/list-view.ts +0 -164
  289. package/src/nodes/models/list.ts +0 -250
package/dist/jsx.d.ts CHANGED
@@ -5,8 +5,8 @@ import type * as Gsk from "@gtkx/ffi/gsk";
5
5
  import type * as Gtk from "@gtkx/ffi/gtk";
6
6
  import type * as GtkSource from "@gtkx/ffi/gtksource";
7
7
  import type * as Pango from "@gtkx/ffi/pango";
8
- import type { ReactElement, ReactNode } from "react";
9
- import type { AdwComboRowProps as IntrinsicAdwComboRowProps, GtkColumnViewProps as IntrinsicGtkColumnViewProps, GtkDropDownProps as IntrinsicGtkDropDownProps, GtkGridViewProps as IntrinsicGtkGridViewProps, GtkListViewProps as IntrinsicGtkListViewProps, WidgetSlotNames } from "./generated/jsx.js";
8
+ import type { ReactNode } from "react";
9
+ import type { WidgetSlotNames } from "./generated/jsx.js";
10
10
  /**
11
11
  * CSS properties that can be animated on a widget.
12
12
  *
@@ -32,14 +32,40 @@ export type AnimatableProperties = {
32
32
  /** Vertical skew angle in degrees */
33
33
  skewY?: number;
34
34
  };
35
+ /** @internal */
36
+ type AnimationBaseProps = {
37
+ /** Initial property values before animation starts, or `false` to skip initial state */
38
+ initial?: AnimatableProperties | false;
39
+ /** Target property values to animate towards */
40
+ animate?: AnimatableProperties;
41
+ /** Property values to animate to when the component unmounts */
42
+ exit?: AnimatableProperties;
43
+ /** Whether to animate from `initial` to `animate` when first mounted (default: false) */
44
+ animateOnMount?: boolean;
45
+ /** Callback fired when an animation begins */
46
+ onAnimationStart?: () => void;
47
+ /** Callback fired when an animation completes */
48
+ onAnimationComplete?: () => void;
49
+ /** The child widget to animate (must be a single GTK widget) */
50
+ children?: ReactNode;
51
+ };
35
52
  /**
36
- * Transition configuration for timed (duration-based) animations.
53
+ * Props for a timed (duration-based) animation using Adw.TimedAnimation.
37
54
  *
38
- * @see {@link https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.TimedAnimation.html Adw.TimedAnimation}
55
+ * @example
56
+ * ```tsx
57
+ * <AdwTimedAnimation
58
+ * initial={{ opacity: 0 }}
59
+ * animate={{ opacity: 1 }}
60
+ * duration={300}
61
+ * easing={Adw.Easing.EASE_OUT_CUBIC}
62
+ * animateOnMount
63
+ * >
64
+ * <GtkLabel label="Fade in" />
65
+ * </AdwTimedAnimation>
66
+ * ```
39
67
  */
40
- export type TimedTransition = {
41
- /** Discriminant: duration-based animation with easing curves */
42
- mode: "timed";
68
+ export type AdwTimedAnimationProps = AnimationBaseProps & {
43
69
  /** Animation duration in milliseconds (default: 300) */
44
70
  duration?: number;
45
71
  /** Easing function for the animation curve (default: EASE_OUT_CUBIC) */
@@ -54,16 +80,22 @@ export type TimedTransition = {
54
80
  alternate?: boolean;
55
81
  };
56
82
  /**
57
- * Transition configuration for spring (physics-based) animations.
58
- *
59
- * Spring animations simulate a mass attached to a spring, providing natural-feeling motion.
60
- * The animation settles when the spring reaches equilibrium.
83
+ * Props for a spring (physics-based) animation using Adw.SpringAnimation.
61
84
  *
62
- * @see {@link https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.SpringAnimation.html Adw.SpringAnimation}
85
+ * @example
86
+ * ```tsx
87
+ * <AdwSpringAnimation
88
+ * initial={{ scale: 0.9, opacity: 0 }}
89
+ * animate={{ scale: 1, opacity: 1 }}
90
+ * damping={0.8}
91
+ * stiffness={200}
92
+ * animateOnMount
93
+ * >
94
+ * <GtkButton label="Spring in" />
95
+ * </AdwSpringAnimation>
96
+ * ```
63
97
  */
64
- export type SpringTransition = {
65
- /** Discriminant: physics-based spring animation */
66
- mode: "spring";
98
+ export type AdwSpringAnimationProps = AnimationBaseProps & {
67
99
  /** Damping ratio controlling oscillation decay (default: 1, critically damped) */
68
100
  damping?: number;
69
101
  /** Spring stiffness in N/m affecting animation speed (default: 100) */
@@ -78,50 +110,9 @@ export type SpringTransition = {
78
110
  delay?: number;
79
111
  };
80
112
  /**
81
- * Discriminated union of all transition configurations.
82
- *
83
- * The `mode` field determines the animation type:
84
- * - `"timed"`: Duration-based animation with easing curves (uses {@link Adw.TimedAnimation})
85
- * - `"spring"`: Physics-based spring animation (uses {@link Adw.SpringAnimation})
86
- */
87
- export type AnimationTransition = TimedTransition | SpringTransition;
88
- /**
89
- * Props for the Animation component.
90
- *
91
- * Provides a declarative API for animating widget properties using either
92
- * timed (duration-based) or spring (physics-based) animations.
93
- *
94
- * @example
95
- * ```tsx
96
- * <x.Animation
97
- * initial={{ opacity: 0, translateY: -20 }}
98
- * animate={{ opacity: 1, translateY: 0 }}
99
- * exit={{ opacity: 0, translateY: 20 }}
100
- * transition={{ mode: "spring", damping: 0.8, stiffness: 200 }}
101
- * animateOnMount
102
- * >
103
- * <GtkLabel label="Animated content" />
104
- * </x.Animation>
105
- * ```
113
+ * @internal Union type used by the AnimationNode internally.
106
114
  */
107
- export type AnimationProps = {
108
- /** Initial property values before animation starts, or `false` to skip initial state */
109
- initial?: AnimatableProperties | false;
110
- /** Target property values to animate towards */
111
- animate?: AnimatableProperties;
112
- /** Property values to animate to when the component unmounts */
113
- exit?: AnimatableProperties;
114
- /** Transition configuration including animation mode and parameters */
115
- transition?: AnimationTransition;
116
- /** Whether to animate from `initial` to `animate` when first mounted (default: false) */
117
- animateOnMount?: boolean;
118
- /** Callback fired when an animation begins */
119
- onAnimationStart?: () => void;
120
- /** Callback fired when an animation completes */
121
- onAnimationComplete?: () => void;
122
- /** The child widget to animate (must be a single GTK widget) */
123
- children?: ReactNode;
124
- };
115
+ export type AnimationProps = AdwTimedAnimationProps | AdwSpringAnimationProps;
125
116
  /**
126
117
  * Props for the Shortcut virtual element.
127
118
  *
@@ -319,7 +310,7 @@ export type LevelBarOffset = {
319
310
  /**
320
311
  * Props for slot-based child positioning.
321
312
  *
322
- * @see {@link Slot} for type-safe slot usage
313
+ * Used internally by compound components with slot props (e.g. `titleWidget` on `AdwHeaderBar`).
323
314
  */
324
315
  export type SlotProps = {
325
316
  /** The slot identifier */
@@ -327,21 +318,6 @@ export type SlotProps = {
327
318
  /** Content to place in the slot */
328
319
  children?: ReactNode;
329
320
  };
330
- /**
331
- * Type mapping widgets to their valid container slot method names.
332
- *
333
- * Each key is a JSX element name and each value is a union of method names
334
- * that can be used as the `id` prop on `x.ContainerSlot`.
335
- */
336
- export type ContainerSlotNames = {
337
- AdwActionRow: "addPrefix" | "addSuffix";
338
- AdwEntryRow: "addPrefix" | "addSuffix";
339
- AdwExpanderRow: "addPrefix" | "addSuffix" | "addRow" | "addAction";
340
- AdwHeaderBar: "packStart" | "packEnd";
341
- AdwToolbarView: "addTopBar" | "addBottomBar";
342
- GtkActionBar: "packStart" | "packEnd";
343
- GtkHeaderBar: "packStart" | "packEnd";
344
- };
345
321
  /**
346
322
  * Props for method-based container slot child positioning.
347
323
  */
@@ -352,48 +328,38 @@ export type ContainerSlotProps = {
352
328
  children?: ReactNode;
353
329
  };
354
330
  /**
355
- * Props for items in a GtkListView, GtkGridView, or GtkColumnView.
331
+ * A data item for list/grid/column views and dropdowns.
332
+ *
333
+ * Uses a discriminated union on the `section` field:
334
+ * - Regular items have `value: T` and optional tree-mode properties
335
+ * - Section headers have `value: S`, `section: true`, and required `children`
356
336
  *
357
- * When used inside a GtkListView, items can be nested to create tree hierarchies.
358
- * Tree-specific props (`indentForDepth`, `indentForIcon`, `hideExpander`) only
359
- * apply when items are used inside a GtkListView with nested children.
337
+ * Mode is detected from data shape:
338
+ * - Any item has `section: true` → section mode
339
+ * - Any item has non-empty `children` (without `section`) tree mode
340
+ * - Otherwise → flat mode
360
341
  *
361
- * @typeParam T - The type of data associated with this list item
342
+ * @typeParam T - The type of data for regular items
343
+ * @typeParam S - The type of data for section headers
362
344
  */
363
- export type ListItemProps<T = unknown> = {
364
- /** Unique identifier for this item */
345
+ export type ListItem<T = unknown, S = unknown> = {
365
346
  id: string;
366
- /** The data value for this item */
367
347
  value: T;
368
- /** Whether to indent based on tree depth (default: true) */
348
+ section?: false | undefined;
349
+ children?: ListItem<T, S>[];
350
+ hideExpander?: boolean;
369
351
  indentForDepth?: boolean;
370
- /** Whether to indent for expander icon width */
371
352
  indentForIcon?: boolean;
372
- /** Whether to hide the expand/collapse arrow */
373
- hideExpander?: boolean;
374
- /** Nested list items (children of this item in a tree) */
375
- children?: ReactNode;
376
- };
377
- /**
378
- * Props for section headers in a GtkListView, GtkGridView, or GtkColumnView.
379
- *
380
- * Wraps ListItems to group them into sections. When used with `renderHeader`,
381
- * the view displays a header at the top of each section.
382
- *
383
- * @typeParam T - The type of data associated with this section header
384
- */
385
- export type ListSectionProps<T = unknown> = {
386
- /** Unique identifier for this section */
353
+ } | {
387
354
  id: string;
388
- /** The data value passed to `renderHeader` for this section */
389
- value: T;
390
- /** ListItem children belonging to this section */
391
- children?: ReactNode;
355
+ value: S;
356
+ section: true;
357
+ children: ListItem<T, S>[];
392
358
  };
393
359
  /**
394
360
  * Props for positioning children within a GtkGrid.
395
361
  *
396
- * @see {@link GridChild} for usage
362
+ * Used by `GtkGrid.Child` compound component.
397
363
  */
398
364
  export type GridChildProps = {
399
365
  /** Content to place in the grid cell */
@@ -410,7 +376,7 @@ export type GridChildProps = {
410
376
  /**
411
377
  * Props for positioning children within a GtkFixed.
412
378
  *
413
- * @see {@link FixedChild} for usage
379
+ * Used by `GtkFixed.Child` compound component.
414
380
  */
415
381
  export type FixedChildProps = {
416
382
  /** Content to place in the fixed container */
@@ -427,7 +393,7 @@ export type FixedChildProps = {
427
393
  *
428
394
  * @typeParam T - The type of data for each row
429
395
  *
430
- * @see {@link ColumnViewColumn} for usage
396
+ * Used by `GtkColumnView.Column` compound component.
431
397
  */
432
398
  export type ColumnViewColumnProps<T = unknown> = {
433
399
  /** Column header text */
@@ -445,7 +411,7 @@ export type ColumnViewColumnProps<T = unknown> = {
445
411
  /** Whether this column is visible */
446
412
  visible?: boolean;
447
413
  /** Function to render the cell content for each row */
448
- renderCell: (item: T | null) => ReactNode;
414
+ renderCell: (item: T) => ReactNode;
449
415
  /** Menu items for the column header context menu */
450
416
  children?: ReactNode;
451
417
  };
@@ -472,7 +438,7 @@ export type NotebookPageTabProps = {
472
438
  /**
473
439
  * Props for pages within a Stack or ViewStack.
474
440
  *
475
- * @see {@link StackPage} for usage
441
+ * Used by `GtkStack.Page` and `AdwViewStack.Page` compound components.
476
442
  */
477
443
  export type StackPageProps = {
478
444
  /** Content to place in the stack page */
@@ -495,7 +461,7 @@ export type StackPageProps = {
495
461
  /**
496
462
  * Props for menu items.
497
463
  *
498
- * @see {@link Menu} for building menus
464
+ * Used by menu compound components like `GtkMenuButton.MenuItem`.
499
465
  */
500
466
  export type MenuItemProps = {
501
467
  /** Unique identifier for this menu item */
@@ -571,7 +537,7 @@ export type ToggleProps = {
571
537
  *
572
538
  * Each response represents a button the user can click to dismiss the dialog.
573
539
  *
574
- * @see {@link x.AlertDialogResponse} for usage
540
+ * Used by `AdwAlertDialog.Response` compound component.
575
541
  */
576
542
  export type AlertDialogResponseProps = {
577
543
  /** Unique response ID (used in response signal and for default/close response) */
@@ -583,7 +549,11 @@ export type AlertDialogResponseProps = {
583
549
  /** Whether the response button is enabled */
584
550
  enabled?: boolean;
585
551
  };
586
- type NavigationPageBaseProps = {
552
+ /**
553
+ * Base props shared by all navigation page declarations, regardless
554
+ * of the parent container (NavigationView or NavigationSplitView).
555
+ */
556
+ export type NavigationPageBaseProps = {
587
557
  /** Display title for the navigation page */
588
558
  title?: string;
589
559
  /** Whether the page can be popped from the navigation stack */
@@ -591,6 +561,22 @@ type NavigationPageBaseProps = {
591
561
  /** Page content */
592
562
  children?: ReactNode;
593
563
  };
564
+ /**
565
+ * Props for a navigation page inside an `AdwNavigationView`.
566
+ *
567
+ * The `id` serves as the page tag for navigation history.
568
+ */
569
+ export type NavigationViewPageProps = NavigationPageBaseProps & {
570
+ id: string;
571
+ };
572
+ /**
573
+ * Props for a navigation page inside an `AdwNavigationSplitView`.
574
+ *
575
+ * The `id` is narrowed to the valid slot positions of the split view.
576
+ */
577
+ export type NavigationSplitViewPageProps = NavigationPageBaseProps & {
578
+ id: WidgetSlotNames["AdwNavigationSplitView"];
579
+ };
594
580
  /**
595
581
  * Props for the NavigationPage virtual element with type-safe targeting.
596
582
  *
@@ -644,9 +630,12 @@ export type TextBufferProps = {
644
630
  /** Callback fired when the redo availability changes */
645
631
  onCanRedoChanged?: ((canRedo: boolean) => void) | null;
646
632
  };
633
+ /** @internal */
647
634
  type BaseListViewProps = {
648
635
  /** Estimated item height in pixels for virtualization */
649
636
  estimatedItemHeight?: number;
637
+ /** Estimated item width in pixels for virtualization */
638
+ estimatedItemWidth?: number;
650
639
  /** Array of selected item IDs */
651
640
  selected?: string[] | null;
652
641
  /** Callback fired when the selection changes */
@@ -654,32 +643,50 @@ type BaseListViewProps = {
654
643
  /** Selection behavior (single, multiple, none, etc.) */
655
644
  selectionMode?: Gtk.SelectionMode | null;
656
645
  };
646
+ /**
647
+ * Props for the {@link GtkListView} compound component.
648
+ *
649
+ * Extends the shared list-view base props with item data, a render
650
+ * callback, optional tree expansion, and section header rendering.
651
+ */
657
652
  export type ListViewProps<T = unknown, S = unknown> = BaseListViewProps & {
653
+ /** Data items to display in the list */
654
+ items?: ListItem<T, S>[];
658
655
  /** Function to render each list item. The `row` parameter provides tree state for hierarchical lists. */
659
- renderItem: (item: T | null, row?: Gtk.TreeListRow | null) => ReactNode;
656
+ renderItem: (item: T, row?: Gtk.TreeListRow | null) => ReactNode;
660
657
  /** Whether to automatically expand new tree rows (default: false) */
661
658
  autoexpand?: boolean;
662
- /** Function to render section headers when using ListSection children */
663
- renderHeader?: ((item: S | null) => ReactNode) | null;
659
+ /** Function to render section headers when items contain section entries */
660
+ renderHeader?: ((item: S) => ReactNode) | null;
664
661
  };
662
+ /**
663
+ * Props for the {@link GtkGridView} compound component.
664
+ *
665
+ * Extends the shared list-view base props with item data and a
666
+ * render callback for each grid cell.
667
+ */
665
668
  export type GridViewProps<T = unknown> = BaseListViewProps & {
669
+ /** Data items to display in the grid */
670
+ items?: ListItem<T>[];
666
671
  /** Function to render each grid item */
667
- renderItem: (item: T | null) => ReactNode;
672
+ renderItem: (item: T) => ReactNode;
668
673
  };
669
674
  /**
670
675
  * Props shared by single-selection dropdown widgets (GtkDropDown, AdwComboRow).
671
676
  */
672
677
  export type DropDownProps<T = unknown, S = unknown> = {
678
+ /** Data items to display in the dropdown */
679
+ items?: ListItem<T, S>[];
673
680
  /** ID of the currently selected item */
674
681
  selectedId?: string | null;
675
682
  /** Callback fired when the selected item changes */
676
683
  onSelectionChanged?: ((id: string) => void) | null;
677
684
  /** Function to render each item. Sets the primary factory, used for both button and popup list unless overridden by renderListItem. */
678
- renderItem?: ((item: T | null) => ReactNode) | null;
685
+ renderItem?: ((item: T) => ReactNode) | null;
679
686
  /** Function to render items in the popup list only, overriding renderItem for the list. */
680
- renderListItem?: ((item: T | null) => ReactNode) | null;
681
- /** Function to render section headers when using ListSection children */
682
- renderHeader?: ((item: S | null) => ReactNode) | null;
687
+ renderListItem?: ((item: T) => ReactNode) | null;
688
+ /** Function to render section headers when items contain section entries */
689
+ renderHeader?: ((item: S) => ReactNode) | null;
683
690
  };
684
691
  /**
685
692
  * Props shared by dialog button widgets (GtkColorDialogButton, GtkFontDialogButton).
@@ -712,381 +719,6 @@ export type AdjustableProps = {
712
719
  /** Callback fired when the adjustable value changes */
713
720
  onValueChanged?: ((value: number, self: Gtk.Range | Gtk.ScaleButton | Gtk.SpinButton | Adw.SpinRow) => void) | null;
714
721
  };
715
- /**
716
- * GTKX-specific intrinsic elements and components.
717
- *
718
- * This namespace provides React components for GTK layout, lists, menus, and slots
719
- * that are specific to GTKX (not direct GTK widget bindings).
720
- *
721
- * @example
722
- * ```tsx
723
- * import { x, GtkHeaderBar, GtkDropDown } from "@gtkx/react";
724
- *
725
- * <GtkHeaderBar>
726
- * <x.Slot for={GtkHeaderBar} id="titleWidget">
727
- * <GtkLabel label="App Title" />
728
- * </x.Slot>
729
- * </GtkHeaderBar>
730
- *
731
- * <GtkDropDown>
732
- * <x.ListItem id="opt1" value="Option 1" />
733
- * <x.ListItem id="opt2" value="Option 2" />
734
- * </GtkDropDown>
735
- * ```
736
- */
737
- export declare const x: {
738
- /**
739
- * Type-safe slot component for placing children in named widget slots.
740
- *
741
- * GTK widgets often have named slots for specific child positions (e.g., titleWidget,
742
- * startWidget). This component provides type-safe access to those slots.
743
- *
744
- * @example
745
- * ```tsx
746
- * <GtkHeaderBar>
747
- * <x.Slot for={GtkHeaderBar} id="titleWidget">
748
- * <GtkLabel label="App Title" />
749
- * </x.Slot>
750
- * </GtkHeaderBar>
751
- * ```
752
- */
753
- Slot<W extends keyof WidgetSlotNames>(props: {
754
- for: W;
755
- id: WidgetSlotNames[W];
756
- children?: ReactNode;
757
- }): ReactElement;
758
- /**
759
- * Element type for pages within a GtkStack or AdwViewStack.
760
- *
761
- * @example
762
- * ```tsx
763
- * <GtkStack page="page1">
764
- * <x.StackPage id="page1" title="First Page">
765
- * <GtkLabel label="Content 1" />
766
- * </x.StackPage>
767
- * </GtkStack>
768
- * ```
769
- */
770
- StackPage: "StackPage";
771
- /**
772
- * Element type for positioning children within a GtkGrid.
773
- *
774
- * @example
775
- * ```tsx
776
- * <GtkGrid>
777
- * <x.GridChild column={0} row={0}>
778
- * <GtkLabel label="Top Left" />
779
- * </x.GridChild>
780
- * </GtkGrid>
781
- * ```
782
- */
783
- GridChild: "GridChild";
784
- /**
785
- * Element type for positioning children within a GtkFixed.
786
- *
787
- * @example
788
- * ```tsx
789
- * <GtkFixed>
790
- * <x.FixedChild x={20} y={30}>
791
- * <GtkLabel label="Positioned at (20, 30)" />
792
- * </x.FixedChild>
793
- * </GtkFixed>
794
- * ```
795
- */
796
- FixedChild: "FixedChild";
797
- /**
798
- * Element type for a page within a GtkNotebook (tabbed interface).
799
- *
800
- * @example
801
- * ```tsx
802
- * <GtkNotebook>
803
- * <x.NotebookPage label="Tab 1">
804
- * <GtkLabel label="Content 1" />
805
- * </x.NotebookPage>
806
- * </GtkNotebook>
807
- * ```
808
- */
809
- NotebookPage: "NotebookPage";
810
- /**
811
- * Element type for a custom widget as the page tab label.
812
- */
813
- NotebookPageTab: "NotebookPageTab";
814
- /**
815
- * Element type for items in a GtkListView, GtkGridView, or GtkColumnView.
816
- *
817
- * Items can be nested to create tree hierarchies inside a GtkListView.
818
- *
819
- * @example
820
- * ```tsx
821
- * // Flat list
822
- * <GtkListView renderItem={(item) => <GtkLabel label={item.name} />}>
823
- * <x.ListItem id="1" value={{ name: "Item 1" }} />
824
- * </GtkListView>
825
- *
826
- * // Tree list (nested items)
827
- * <GtkListView renderItem={(item, row) => <GtkLabel label={item.name} />} autoexpand>
828
- * <x.ListItem id="parent" value={{ name: "Parent" }}>
829
- * <x.ListItem id="child" value={{ name: "Child" }} />
830
- * </x.ListItem>
831
- * </GtkListView>
832
- * ```
833
- */
834
- ListItem<T = unknown>(props: ListItemProps<T>): ReactElement;
835
- /**
836
- * Component for defining section headers in list/grid views.
837
- *
838
- * Wraps ListItems to group them into sections with headers.
839
- * Requires `renderHeader` on the parent view to render the header content.
840
- *
841
- * @example
842
- * ```tsx
843
- * <GtkGridView
844
- * renderItem={(item) => <GtkLabel label={item.name} />}
845
- * renderHeader={(header) => <GtkLabel label={header.title} />}
846
- * >
847
- * <x.ListSection id="section1" value={{ title: "Section 1" }}>
848
- * <x.ListItem id="a" value={{ name: "Item A" }} />
849
- * <x.ListItem id="b" value={{ name: "Item B" }} />
850
- * </x.ListSection>
851
- * </GtkGridView>
852
- * ```
853
- */
854
- ListSection<T = unknown>(props: ListSectionProps<T>): ReactElement;
855
- /**
856
- * Component for defining columns in a ColumnView (table widget).
857
- *
858
- * @example
859
- * ```tsx
860
- * <GtkColumnView>
861
- * <x.ColumnViewColumn
862
- * id="name"
863
- * title="Name"
864
- * expand
865
- * renderCell={(item) => <GtkLabel label={item?.name ?? ""} />}
866
- * />
867
- * </GtkColumnView>
868
- * ```
869
- */
870
- ColumnViewColumn<T = unknown>(props: ColumnViewColumnProps<T>): ReactElement;
871
- /**
872
- * Type-safe container slot for placing children via parent widget methods.
873
- *
874
- * Unlike `x.Slot` (which uses property setters for single-child slots),
875
- * `x.ContainerSlot` calls attachment methods that support multiple children
876
- * (e.g., `addPrefix()`, `packStart()`, `addTopBar()`).
877
- *
878
- * The `for` prop provides TypeScript type narrowing for the `id` prop
879
- * and is not used at runtime.
880
- *
881
- * @example
882
- * ```tsx
883
- * <AdwToolbarView>
884
- * <x.ContainerSlot for={AdwToolbarView} id="addTopBar">
885
- * <AdwHeaderBar />
886
- * </x.ContainerSlot>
887
- * </AdwToolbarView>
888
- *
889
- * <GtkHeaderBar>
890
- * <x.ContainerSlot for={GtkHeaderBar} id="packStart">
891
- * <GtkButton label="Back" />
892
- * </x.ContainerSlot>
893
- * </GtkHeaderBar>
894
- *
895
- * <AdwActionRow title="Setting">
896
- * <x.ContainerSlot for={AdwActionRow} id="addPrefix">
897
- * <GtkCheckButton />
898
- * </x.ContainerSlot>
899
- * </AdwActionRow>
900
- * ```
901
- */
902
- ContainerSlot<W extends keyof ContainerSlotNames>(props: {
903
- for: W;
904
- id: ContainerSlotNames[W];
905
- children?: ReactNode;
906
- }): ReactElement;
907
- /**
908
- * Element type for overlay children positioned above the main content.
909
- *
910
- * @example
911
- * ```tsx
912
- * <GtkOverlay>
913
- * <GtkImage file="background.png" />
914
- * <x.OverlayChild>
915
- * <GtkLabel label="Overlaid text" />
916
- * </x.OverlayChild>
917
- * </GtkOverlay>
918
- * ```
919
- */
920
- OverlayChild: "OverlayChild";
921
- /**
922
- * A clickable menu item with action.
923
- *
924
- * @example
925
- * ```tsx
926
- * <GtkMenuButton>
927
- * <x.MenuItem id="open" label="Open" onActivate={handleOpen} />
928
- * </GtkMenuButton>
929
- * ```
930
- */
931
- MenuItem: "MenuItem";
932
- /**
933
- * A section grouping related menu items.
934
- *
935
- * @example
936
- * ```tsx
937
- * <GtkMenuButton>
938
- * <x.MenuSection label="File">
939
- * <x.MenuItem id="open" label="Open" onActivate={handleOpen} />
940
- * </x.MenuSection>
941
- * </GtkMenuButton>
942
- * ```
943
- */
944
- MenuSection: "MenuSection";
945
- /**
946
- * A submenu containing nested items.
947
- *
948
- * @example
949
- * ```tsx
950
- * <GtkMenuButton>
951
- * <x.MenuSubmenu label="Export">
952
- * <x.MenuItem id="pdf" label="As PDF" onActivate={exportPdf} />
953
- * </x.MenuSubmenu>
954
- * </GtkMenuButton>
955
- * ```
956
- */
957
- MenuSubmenu: "MenuSubmenu";
958
- /**
959
- * Declarative text tag for styling text content.
960
- *
961
- * Wrap text content with a TextTag to apply styling. Tags can be nested.
962
- *
963
- * @example
964
- * ```tsx
965
- * <GtkTextView>
966
- * Normal <x.TextTag id="bold" weight={Pango.Weight.BOLD}>
967
- * bold <x.TextTag id="red" foreground="red">and red</x.TextTag>
968
- * </x.TextTag> text.
969
- * </GtkTextView>
970
- * ```
971
- */
972
- TextTag: "TextTag";
973
- /**
974
- * Declarative anchor for embedding widgets in text flow.
975
- *
976
- * The anchor is placed at the current position in the text.
977
- *
978
- * @example
979
- * ```tsx
980
- * <GtkTextView>
981
- * Click here: <x.TextAnchor>
982
- * <GtkButton label="Click me" />
983
- * </x.TextAnchor> to continue.
984
- * </GtkTextView>
985
- * ```
986
- */
987
- TextAnchor: "TextAnchor";
988
- /**
989
- * Declarative inline paintable for embedding images/icons in text flow.
990
- *
991
- * The paintable is placed at the current position in the text.
992
- *
993
- * @example
994
- * ```tsx
995
- * <GtkTextView>
996
- * Click the icon <x.TextPaintable paintable={iconPaintable} /> to continue.
997
- * </GtkTextView>
998
- * ```
999
- */
1000
- TextPaintable: "TextPaintable";
1001
- /**
1002
- * A toggle button for an AdwToggleGroup.
1003
- *
1004
- * @example
1005
- * ```tsx
1006
- * <AdwToggleGroup>
1007
- * <x.Toggle id="list" iconName="view-list-symbolic" />
1008
- * <x.Toggle id="grid" iconName="view-grid-symbolic" />
1009
- * </AdwToggleGroup>
1010
- * ```
1011
- */
1012
- Toggle: "Toggle";
1013
- /**
1014
- * A response button for an AdwAlertDialog.
1015
- *
1016
- * @example
1017
- * ```tsx
1018
- * <AdwAlertDialog
1019
- * heading="Delete File?"
1020
- * body="This cannot be undone."
1021
- * defaultResponse="cancel"
1022
- * closeResponse="cancel"
1023
- * >
1024
- * <x.AlertDialogResponse id="cancel" label="Cancel" />
1025
- * <x.AlertDialogResponse id="delete" label="Delete" appearance={Adw.ResponseAppearance.DESTRUCTIVE} />
1026
- * </AdwAlertDialog>
1027
- * ```
1028
- */
1029
- AlertDialogResponse: "AlertDialogResponse";
1030
- /**
1031
- * Type-safe page component for AdwNavigationView or AdwNavigationSplitView.
1032
- *
1033
- * The `for` prop is required and determines valid `id` values:
1034
- * - `AdwNavigationView`: any string (page tags for navigation history)
1035
- * - `AdwNavigationSplitView`: `"content"` or `"sidebar"` (slot positions)
1036
- *
1037
- * @example
1038
- * ```tsx
1039
- * // In NavigationView - id can be any string
1040
- * <AdwNavigationView history={["home"]}>
1041
- * <x.NavigationPage for={AdwNavigationView} id="home" title="Home">
1042
- * <GtkLabel label="Welcome!" />
1043
- * </x.NavigationPage>
1044
- * </AdwNavigationView>
1045
- *
1046
- * // In NavigationSplitView - id is narrowed to "content" | "sidebar"
1047
- * <AdwNavigationSplitView>
1048
- * <x.NavigationPage for={AdwNavigationSplitView} id="sidebar" title="Sidebar">
1049
- * <GtkLabel label="Sidebar" />
1050
- * </x.NavigationPage>
1051
- * <x.NavigationPage for={AdwNavigationSplitView} id="content" title="Content">
1052
- * <GtkLabel label="Content" />
1053
- * </x.NavigationPage>
1054
- * </AdwNavigationSplitView>
1055
- * ```
1056
- */
1057
- NavigationPage: "NavigationPage";
1058
- /**
1059
- * A keyboard shortcut definition.
1060
- *
1061
- * Must be a child of `<GtkShortcutController>`.
1062
- *
1063
- * @example
1064
- * ```tsx
1065
- * <x.Shortcut trigger="<Control>s" onActivate={save} />
1066
- * <x.Shortcut trigger={["F5", "<Control>r"]} onActivate={refresh} />
1067
- * <x.Shortcut trigger="Escape" onActivate={cancel} disabled={!canCancel} />
1068
- * ```
1069
- */
1070
- Shortcut: "Shortcut";
1071
- /**
1072
- * Declarative animation wrapper using Adw.TimedAnimation or Adw.SpringAnimation.
1073
- *
1074
- * Provides framer-motion-inspired API for animating child widgets.
1075
- *
1076
- * @example
1077
- * ```tsx
1078
- * <x.Animation
1079
- * initial={{ opacity: 0, scale: 0.9 }}
1080
- * animate={{ opacity: 1, scale: 1 }}
1081
- * transition={{ mode: "spring", damping: 0.8, stiffness: 200 }}
1082
- * animateOnMount
1083
- * >
1084
- * <GtkButton label="Animated Button" />
1085
- * </x.Animation>
1086
- * ```
1087
- */
1088
- Animation: "Animation";
1089
- };
1090
722
  interface StackProps {
1091
723
  /** ID of the currently visible page */
1092
724
  page?: string | null;
@@ -1095,14 +727,13 @@ declare global {
1095
727
  namespace React {
1096
728
  namespace JSX {
1097
729
  interface IntrinsicElements {
1098
- AlertDialogResponse: AlertDialogResponseProps;
1099
- Animation: AnimationProps;
730
+ Slot: SlotProps;
731
+ AdwTimedAnimation: AdwTimedAnimationProps;
732
+ AdwSpringAnimation: AdwSpringAnimationProps;
1100
733
  ContainerSlot: ContainerSlotProps;
1101
734
  ColumnViewColumn: ColumnViewColumnProps;
1102
735
  FixedChild: FixedChildProps;
1103
736
  GridChild: GridChildProps;
1104
- ListItem: ListItemProps;
1105
- ListSection: ListSectionProps;
1106
737
  MenuItem: MenuItemProps;
1107
738
  MenuSection: MenuSectionProps;
1108
739
  MenuSubmenu: MenuSubmenuProps;
@@ -1113,13 +744,19 @@ declare global {
1113
744
  TextPaintable: TextPaintableProps;
1114
745
  TextTag: TextTagProps;
1115
746
  StackPage: StackPageProps;
1116
- Toggle: ToggleProps;
1117
747
  NavigationPage: NavigationPageProps;
1118
748
  Shortcut: ShortcutProps;
1119
749
  }
1120
750
  }
1121
751
  }
1122
752
  }
753
+ /**
754
+ * Accessibility attribute props mixed into every widget.
755
+ *
756
+ * Maps to the GTK `GtkAccessible` interface properties, states,
757
+ * and relations, allowing assistive technologies to query widget
758
+ * semantics.
759
+ */
1123
760
  export type AccessibleProps = {
1124
761
  accessibleAutocomplete?: Gtk.AccessibleAutocomplete;
1125
762
  accessibleDescription?: string;
@@ -1196,6 +833,10 @@ declare module "./generated/jsx.js" {
1196
833
  /** Callback fired when the spin row value changes */
1197
834
  onValueChanged?: ((value: number, self: Adw.SpinRow) => void) | null;
1198
835
  }
836
+ interface AdwSwitchRowProps {
837
+ /** Callback fired when the switch row active state changes */
838
+ onActiveChanged?: ((active: boolean, self: Adw.SwitchRow) => void) | null;
839
+ }
1199
840
  interface GtkCalendarProps {
1200
841
  /** Array of day numbers (1-31) to display as marked */
1201
842
  markedDays?: number[] | null;
@@ -1230,6 +871,8 @@ declare module "./generated/jsx.js" {
1230
871
  interface GtkGridViewProps extends GridViewProps {
1231
872
  }
1232
873
  interface GtkColumnViewProps {
874
+ /** Data items to display in the column view */
875
+ items?: ListItem[];
1233
876
  /** Array of selected row IDs */
1234
877
  selected?: string[] | null;
1235
878
  /** Callback fired when the selection changes */
@@ -1244,7 +887,7 @@ declare module "./generated/jsx.js" {
1244
887
  onSortChanged?: ((column: string | null, order: Gtk.SortType) => void) | null;
1245
888
  /** Estimated row height in pixels for virtualization */
1246
889
  estimatedRowHeight?: number | null;
1247
- /** Function to render section headers when using ListSection children */
890
+ /** Function to render section headers when items contain section entries */
1248
891
  renderHeader?: ((item: unknown) => ReactNode) | null;
1249
892
  }
1250
893
  interface GtkDropDownProps extends DropDownProps {
@@ -1270,8 +913,8 @@ declare module "./generated/jsx.js" {
1270
913
  onClose?: (() => void) | null;
1271
914
  }
1272
915
  interface GtkDrawingAreaProps {
1273
- /** Callback fired when the drawing area needs to be redrawn */
1274
- onDraw?: ((cr: cairo.Context, width: number, height: number, self: Gtk.DrawingArea) => void) | null;
916
+ /** Render function called when the drawing area needs to be redrawn. Changing this reference automatically queues a redraw. */
917
+ render?: ((cr: cairo.Context, width: number, height: number, self: Gtk.DrawingArea) => void) | null;
1275
918
  }
1276
919
  interface GtkColorDialogButtonProps extends DialogButtonProps {
1277
920
  /** Callback fired when the selected color changes */
@@ -1301,6 +944,12 @@ declare module "./generated/jsx.js" {
1301
944
  interface AdwToggleGroupProps {
1302
945
  /** Callback fired when the active toggle changes */
1303
946
  onActiveChanged?: ((active: number, activeName: string | null) => void) | null;
947
+ /** Declarative toggle definitions for the group */
948
+ toggles?: ToggleProps[];
949
+ }
950
+ interface AdwAlertDialogProps {
951
+ /** Declarative response button definitions for the dialog */
952
+ responses?: AlertDialogResponseProps[];
1304
953
  }
1305
954
  interface GtkDragSourceProps {
1306
955
  /** Paintable to use as the drag icon */
@@ -1315,21 +964,11 @@ declare module "./generated/jsx.js" {
1315
964
  types?: number[];
1316
965
  }
1317
966
  }
1318
- export declare function GtkListView<T = unknown, S = unknown>(props: Omit<IntrinsicGtkListViewProps, keyof ListViewProps> & ListViewProps<T, S> & {
1319
- children?: ReactNode;
1320
- }): ReactElement;
1321
- export declare function GtkGridView<T = unknown>(props: Omit<IntrinsicGtkGridViewProps, keyof GridViewProps> & GridViewProps<T> & {
1322
- children?: ReactNode;
1323
- }): ReactElement;
1324
- export declare function GtkDropDown<T = unknown, S = unknown>(props: Omit<IntrinsicGtkDropDownProps, keyof DropDownProps> & DropDownProps<T, S> & {
1325
- children?: ReactNode;
1326
- }): ReactElement;
1327
- export declare function AdwComboRow<T = unknown, S = unknown>(props: Omit<IntrinsicAdwComboRowProps, keyof DropDownProps> & DropDownProps<T, S> & {
1328
- children?: ReactNode;
1329
- }): ReactElement;
1330
- export declare function GtkColumnView<T = unknown>(props: Omit<IntrinsicGtkColumnViewProps, "renderHeader"> & {
1331
- renderHeader?: ((item: T | null) => ReactNode) | null;
1332
- children?: ReactNode;
1333
- }): ReactElement;
967
+ export { AdwComboRow, GtkColumnView, GtkDropDown, GtkGridView, GtkListView } from "./components/list.js";
968
+ export * from "./generated/compounds.js";
969
+ /** JSX intrinsic element name for timed (duration-based) Adwaita animations. */
970
+ export declare const AdwTimedAnimation: "AdwTimedAnimation";
971
+ /** JSX intrinsic element name for spring-physics-based Adwaita animations. */
972
+ export declare const AdwSpringAnimation: "AdwSpringAnimation";
1334
973
  export * from "./generated/jsx.js";
1335
974
  //# sourceMappingURL=jsx.d.ts.map