@gtkx/react 0.15.0 → 0.17.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (172) hide show
  1. package/README.md +1 -0
  2. package/dist/animation/css-builder.d.ts +3 -0
  3. package/dist/animation/css-builder.js +53 -0
  4. package/dist/animation/types.d.ts +120 -0
  5. package/dist/errors.js +3 -0
  6. package/dist/factory.d.ts +3 -2
  7. package/dist/factory.js +1 -1
  8. package/dist/fiber-root.js +1 -1
  9. package/dist/generated/internal.d.ts +28 -1
  10. package/dist/generated/internal.js +93 -18
  11. package/dist/generated/jsx.d.ts +1672 -1483
  12. package/dist/generated/jsx.js +475 -0
  13. package/dist/host-config.d.ts +3 -1
  14. package/dist/host-config.js +26 -11
  15. package/dist/jsx.d.ts +136 -166
  16. package/dist/jsx.js +58 -69
  17. package/dist/node.d.ts +4 -1
  18. package/dist/node.js +14 -3
  19. package/dist/nodes/abstract/positional-child.d.ts +9 -0
  20. package/dist/nodes/abstract/positional-child.js +29 -0
  21. package/dist/nodes/abstract/virtual-container.d.ts +21 -0
  22. package/dist/nodes/abstract/virtual-container.js +68 -0
  23. package/dist/nodes/abstract/virtual-single-child.d.ts +18 -0
  24. package/dist/nodes/abstract/virtual-single-child.js +55 -0
  25. package/dist/nodes/action-row-child.d.ts +0 -13
  26. package/dist/nodes/action-row-child.js +22 -12
  27. package/dist/nodes/adjustable.d.ts +23 -0
  28. package/dist/nodes/adjustable.js +62 -0
  29. package/dist/nodes/alert-dialog-response.js +86 -0
  30. package/dist/nodes/animation.js +252 -0
  31. package/dist/nodes/application.js +17 -7
  32. package/dist/nodes/autowrapped.js +37 -43
  33. package/dist/nodes/calendar.js +17 -43
  34. package/dist/nodes/color-dialog-button.d.ts +1 -0
  35. package/dist/nodes/color-dialog-button.js +70 -0
  36. package/dist/nodes/column-view-column.d.ts +3 -3
  37. package/dist/nodes/column-view-column.js +1 -1
  38. package/dist/nodes/column-view.js +36 -39
  39. package/dist/nodes/dialog.d.ts +11 -0
  40. package/dist/nodes/dialog.js +20 -0
  41. package/dist/nodes/drawing-area.js +24 -7
  42. package/dist/nodes/event-controller.d.ts +22 -0
  43. package/dist/nodes/event-controller.js +96 -0
  44. package/dist/nodes/expander-row-child.d.ts +0 -14
  45. package/dist/nodes/expander-row-child.js +22 -12
  46. package/dist/nodes/fixed-child.js +52 -36
  47. package/dist/nodes/font-dialog-button.d.ts +1 -0
  48. package/dist/nodes/font-dialog-button.js +90 -0
  49. package/dist/nodes/grid-child.js +43 -45
  50. package/dist/nodes/grid.d.ts +1 -0
  51. package/dist/nodes/grid.js +41 -0
  52. package/dist/nodes/index.d.ts +18 -12
  53. package/dist/nodes/index.js +18 -12
  54. package/dist/nodes/internal/base-item-renderer.d.ts +29 -0
  55. package/dist/nodes/internal/base-item-renderer.js +88 -0
  56. package/dist/nodes/internal/child-attachment.d.ts +26 -0
  57. package/dist/nodes/internal/child-attachment.js +48 -0
  58. package/dist/nodes/internal/deferred-action.d.ts +9 -0
  59. package/dist/nodes/internal/deferred-action.js +22 -0
  60. package/dist/nodes/internal/list-item-renderer.d.ts +14 -15
  61. package/dist/nodes/internal/list-item-renderer.js +51 -77
  62. package/dist/nodes/internal/list-store.d.ts +5 -6
  63. package/dist/nodes/internal/list-store.js +29 -38
  64. package/dist/nodes/internal/predicates.d.ts +25 -2
  65. package/dist/nodes/internal/predicates.js +53 -41
  66. package/dist/nodes/internal/selection-model.d.ts +30 -0
  67. package/dist/nodes/internal/selection-model.js +87 -0
  68. package/dist/nodes/internal/signal-store.d.ts +9 -5
  69. package/dist/nodes/internal/signal-store.js +31 -31
  70. package/dist/nodes/internal/simple-list-store.js +6 -9
  71. package/dist/nodes/internal/text-buffer-controller.d.ts +43 -0
  72. package/dist/nodes/internal/text-buffer-controller.js +287 -0
  73. package/dist/nodes/internal/text-tag-styles.d.ts +43 -0
  74. package/dist/nodes/internal/text-tag-styles.js +52 -0
  75. package/dist/nodes/internal/tree-list-item-renderer.d.ts +15 -14
  76. package/dist/nodes/internal/tree-list-item-renderer.js +85 -96
  77. package/dist/nodes/internal/tree-store.d.ts +8 -11
  78. package/dist/nodes/internal/tree-store.js +70 -72
  79. package/dist/nodes/internal/utils.d.ts +7 -4
  80. package/dist/nodes/internal/utils.js +50 -5
  81. package/dist/nodes/level-bar.js +19 -54
  82. package/dist/nodes/list-item.d.ts +6 -3
  83. package/dist/nodes/list-item.js +7 -4
  84. package/dist/nodes/list-view.js +17 -12
  85. package/dist/nodes/menu.d.ts +3 -3
  86. package/dist/nodes/menu.js +3 -3
  87. package/dist/nodes/models/list.d.ts +11 -13
  88. package/dist/nodes/models/list.js +16 -73
  89. package/dist/nodes/models/menu.d.ts +8 -7
  90. package/dist/nodes/models/menu.js +43 -50
  91. package/dist/nodes/models/tree-list.d.ts +6 -12
  92. package/dist/nodes/models/tree-list.js +30 -93
  93. package/dist/nodes/navigation-page.d.ts +1 -0
  94. package/dist/nodes/navigation-page.js +27 -32
  95. package/dist/nodes/navigation-view.js +17 -28
  96. package/dist/nodes/notebook-page-tab.d.ts +3 -3
  97. package/dist/nodes/notebook-page-tab.js +11 -14
  98. package/dist/nodes/notebook-page.d.ts +7 -5
  99. package/dist/nodes/notebook-page.js +45 -25
  100. package/dist/nodes/notebook.js +2 -2
  101. package/dist/nodes/overlay-child.js +90 -30
  102. package/dist/nodes/pack-child.d.ts +0 -13
  103. package/dist/nodes/pack-child.js +22 -12
  104. package/dist/nodes/popover-menu.js +2 -2
  105. package/dist/nodes/scale.js +15 -45
  106. package/dist/nodes/scrolled-window.js +7 -6
  107. package/dist/nodes/search-bar.d.ts +1 -0
  108. package/dist/nodes/search-bar.js +40 -0
  109. package/dist/nodes/shortcut-controller.d.ts +1 -37
  110. package/dist/nodes/shortcut-controller.js +8 -47
  111. package/dist/nodes/shortcut.d.ts +5 -4
  112. package/dist/nodes/shortcut.js +11 -5
  113. package/dist/nodes/simple-list-view.js +2 -3
  114. package/dist/nodes/slot.d.ts +6 -9
  115. package/dist/nodes/slot.js +27 -42
  116. package/dist/nodes/source-view.js +80 -29
  117. package/dist/nodes/stack-page.js +20 -22
  118. package/dist/nodes/stack.js +19 -5
  119. package/dist/nodes/text-anchor.d.ts +41 -0
  120. package/dist/nodes/text-anchor.js +59 -0
  121. package/dist/nodes/text-content.d.ts +10 -0
  122. package/dist/nodes/text-content.js +1 -0
  123. package/dist/nodes/text-paintable.d.ts +17 -0
  124. package/dist/nodes/text-paintable.js +34 -0
  125. package/dist/nodes/text-segment.d.ts +15 -0
  126. package/dist/nodes/text-segment.js +29 -0
  127. package/dist/nodes/text-tag.d.ts +136 -0
  128. package/dist/nodes/text-tag.js +202 -0
  129. package/dist/nodes/text-view.d.ts +30 -0
  130. package/dist/nodes/text-view.js +49 -21
  131. package/dist/nodes/toggle-group.js +24 -32
  132. package/dist/nodes/toggle.d.ts +1 -15
  133. package/dist/nodes/toggle.js +40 -32
  134. package/dist/nodes/toolbar-child.js +22 -31
  135. package/dist/nodes/tree-list-item.d.ts +7 -5
  136. package/dist/nodes/tree-list-item.js +24 -36
  137. package/dist/nodes/tree-list-view.js +9 -7
  138. package/dist/nodes/virtual.d.ts +1 -1
  139. package/dist/nodes/web-view.d.ts +1 -0
  140. package/dist/nodes/web-view.js +29 -0
  141. package/dist/nodes/widget.d.ts +2 -16
  142. package/dist/nodes/widget.js +105 -294
  143. package/dist/nodes/window.d.ts +9 -3
  144. package/dist/nodes/window.js +29 -15
  145. package/dist/registry.d.ts +1 -1
  146. package/dist/render.js +9 -7
  147. package/dist/scheduler.d.ts +11 -1
  148. package/dist/scheduler.js +16 -4
  149. package/dist/types.d.ts +2 -136
  150. package/package.json +4 -4
  151. package/dist/nodes/action-row.js +0 -46
  152. package/dist/nodes/adjustment.d.ts +0 -48
  153. package/dist/nodes/adjustment.js +0 -70
  154. package/dist/nodes/calendar-mark.d.ts +0 -15
  155. package/dist/nodes/calendar-mark.js +0 -29
  156. package/dist/nodes/expander-row.js +0 -55
  157. package/dist/nodes/internal/constants.d.ts +0 -1
  158. package/dist/nodes/internal/constants.js +0 -24
  159. package/dist/nodes/level-bar-offset.d.ts +0 -13
  160. package/dist/nodes/level-bar-offset.js +0 -35
  161. package/dist/nodes/pack.js +0 -46
  162. package/dist/nodes/scale-mark.d.ts +0 -17
  163. package/dist/nodes/scale-mark.js +0 -38
  164. package/dist/nodes/source-buffer.d.ts +0 -73
  165. package/dist/nodes/source-buffer.js +0 -149
  166. package/dist/nodes/text-buffer.d.ts +0 -43
  167. package/dist/nodes/text-buffer.js +0 -81
  168. package/dist/nodes/virtual-child.d.ts +0 -18
  169. package/dist/nodes/virtual-child.js +0 -62
  170. /package/dist/{nodes/action-row.d.ts → animation/types.js} +0 -0
  171. /package/dist/nodes/{expander-row.d.ts → alert-dialog-response.d.ts} +0 -0
  172. /package/dist/nodes/{pack.d.ts → animation.d.ts} +0 -0
package/README.md CHANGED
@@ -71,6 +71,7 @@ render(<App />, "com.example.counter");
71
71
  - **React 19** — Hooks, concurrent features, and the component model you know
72
72
  - **Native GTK4 widgets** — Real native controls, not web components in a webview
73
73
  - **Adwaita support** — Modern GNOME styling with Libadwaita components
74
+ - **Declarative animations** — Framer Motion-like API using native Adwaita animations
74
75
  - **Hot Module Replacement** — Fast refresh during development
75
76
  - **TypeScript first** — Full type safety with auto-generated bindings
76
77
  - **CSS-in-JS styling** — Familiar styling patterns adapted for GTK
@@ -0,0 +1,3 @@
1
+ import type { AnimatableProperties } from "./types.js";
2
+ export declare const interpolate: (from: AnimatableProperties, to: AnimatableProperties, progress: number) => AnimatableProperties;
3
+ export declare const buildCss: (className: string, props: AnimatableProperties) => string;
@@ -0,0 +1,53 @@
1
+ const getDefaultValue = (property) => {
2
+ switch (property) {
3
+ case "opacity":
4
+ case "scale":
5
+ case "scaleX":
6
+ case "scaleY":
7
+ return 1;
8
+ default:
9
+ return 0;
10
+ }
11
+ };
12
+ export const interpolate = (from, to, progress) => {
13
+ const result = {};
14
+ const allKeys = new Set([...Object.keys(from), ...Object.keys(to)]);
15
+ for (const key of allKeys) {
16
+ const fromVal = from[key] ?? getDefaultValue(key);
17
+ const toVal = to[key] ?? getDefaultValue(key);
18
+ result[key] = fromVal + (toVal - fromVal) * progress;
19
+ }
20
+ return result;
21
+ };
22
+ export const buildCss = (className, props) => {
23
+ const parts = [];
24
+ const transforms = [];
25
+ if (props.opacity !== undefined) {
26
+ parts.push(`opacity: ${props.opacity}`);
27
+ }
28
+ if (props.translateX !== undefined || props.translateY !== undefined) {
29
+ transforms.push(`translate(${props.translateX ?? 0}px, ${props.translateY ?? 0}px)`);
30
+ }
31
+ if (props.scale !== undefined) {
32
+ transforms.push(`scale(${props.scale})`);
33
+ }
34
+ else if (props.scaleX !== undefined || props.scaleY !== undefined) {
35
+ transforms.push(`scale(${props.scaleX ?? 1}, ${props.scaleY ?? 1})`);
36
+ }
37
+ if (props.rotate !== undefined) {
38
+ transforms.push(`rotate(${props.rotate}deg)`);
39
+ }
40
+ if (props.skewX !== undefined) {
41
+ transforms.push(`skewX(${props.skewX}deg)`);
42
+ }
43
+ if (props.skewY !== undefined) {
44
+ transforms.push(`skewY(${props.skewY}deg)`);
45
+ }
46
+ if (transforms.length > 0) {
47
+ parts.push(`transform: ${transforms.join(" ")}`);
48
+ }
49
+ if (parts.length === 0) {
50
+ return "";
51
+ }
52
+ return `.${className} { ${parts.join("; ")}; }`;
53
+ };
@@ -0,0 +1,120 @@
1
+ import type { Easing } from "@gtkx/ffi/adw";
2
+ import type { ReactNode } from "react";
3
+ /**
4
+ * The type of animation to use.
5
+ *
6
+ * - `"timed"`: Duration-based animation with easing curves (uses {@link Adw.TimedAnimation})
7
+ * - `"spring"`: Physics-based spring animation (uses {@link Adw.SpringAnimation})
8
+ */
9
+ export type AnimationMode = "timed" | "spring";
10
+ /**
11
+ * A numeric value that can be animated.
12
+ */
13
+ export type AnimatableValue = number;
14
+ /**
15
+ * CSS properties that can be animated on a widget.
16
+ *
17
+ * All transforms are applied via GTK CSS and rendered through the widget's style context.
18
+ */
19
+ export type AnimatableProperties = {
20
+ /** Opacity from 0 (fully transparent) to 1 (fully opaque) */
21
+ opacity?: AnimatableValue;
22
+ /** Horizontal translation in pixels (positive moves right) */
23
+ translateX?: AnimatableValue;
24
+ /** Vertical translation in pixels (positive moves down) */
25
+ translateY?: AnimatableValue;
26
+ /** Uniform scale factor (1 = original size, 2 = double size) */
27
+ scale?: AnimatableValue;
28
+ /** Horizontal scale factor */
29
+ scaleX?: AnimatableValue;
30
+ /** Vertical scale factor */
31
+ scaleY?: AnimatableValue;
32
+ /** Rotation angle in degrees (positive rotates clockwise) */
33
+ rotate?: AnimatableValue;
34
+ /** Horizontal skew angle in degrees */
35
+ skewX?: AnimatableValue;
36
+ /** Vertical skew angle in degrees */
37
+ skewY?: AnimatableValue;
38
+ };
39
+ /**
40
+ * Transition configuration for timed (duration-based) animations.
41
+ *
42
+ * @see {@link https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.TimedAnimation.html Adw.TimedAnimation}
43
+ */
44
+ export type TimedTransition = {
45
+ /** Animation duration in milliseconds (default: 300) */
46
+ duration?: number;
47
+ /** Easing function for the animation curve (default: EASE_OUT_CUBIC) */
48
+ easing?: Easing;
49
+ /** Delay before starting the animation in milliseconds */
50
+ delay?: number;
51
+ /** Number of times to repeat the animation (0 = no repeat, -1 = infinite) */
52
+ repeat?: number;
53
+ /** Whether to play the animation in reverse */
54
+ reverse?: boolean;
55
+ /** Whether to alternate direction on each repeat */
56
+ alternate?: boolean;
57
+ };
58
+ /**
59
+ * Transition configuration for spring (physics-based) animations.
60
+ *
61
+ * Spring animations simulate a mass attached to a spring, providing natural-feeling motion.
62
+ * The animation settles when the spring reaches equilibrium.
63
+ *
64
+ * @see {@link https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.SpringAnimation.html Adw.SpringAnimation}
65
+ */
66
+ export type SpringTransition = {
67
+ /** Damping ratio controlling oscillation decay (default: 1, critically damped) */
68
+ damping?: number;
69
+ /** Spring stiffness in N/m affecting animation speed (default: 100) */
70
+ stiffness?: number;
71
+ /** Virtual mass in kg affecting momentum (default: 1) */
72
+ mass?: number;
73
+ /** Initial velocity to apply at animation start */
74
+ initialVelocity?: number;
75
+ /** Whether to clamp the animation value to prevent overshooting */
76
+ clamp?: boolean;
77
+ /** Delay before starting the animation in milliseconds */
78
+ delay?: number;
79
+ };
80
+ /**
81
+ * Props for the Animation component.
82
+ *
83
+ * Provides a declarative API for animating widget properties using either
84
+ * timed (duration-based) or spring (physics-based) animations.
85
+ *
86
+ * @typeParam M - The animation mode, either `"timed"` or `"spring"`
87
+ *
88
+ * @example
89
+ * ```tsx
90
+ * <x.Animation
91
+ * mode="spring"
92
+ * initial={{ opacity: 0, translateY: -20 }}
93
+ * animate={{ opacity: 1, translateY: 0 }}
94
+ * exit={{ opacity: 0, translateY: 20 }}
95
+ * animateOnMount
96
+ * >
97
+ * <GtkLabel label="Animated content" />
98
+ * </x.Animation>
99
+ * ```
100
+ */
101
+ export type AnimationProps<M extends AnimationMode = AnimationMode> = {
102
+ /** Animation type: `"timed"` for duration-based or `"spring"` for physics-based */
103
+ mode: M;
104
+ /** Initial property values before animation starts, or `false` to skip initial state */
105
+ initial?: AnimatableProperties | false;
106
+ /** Target property values to animate towards */
107
+ animate?: AnimatableProperties;
108
+ /** Property values to animate to when the component unmounts */
109
+ exit?: AnimatableProperties;
110
+ /** Transition configuration (type depends on mode) */
111
+ transition?: M extends "timed" ? TimedTransition : SpringTransition;
112
+ /** Whether to animate from `initial` to `animate` when first mounted (default: false) */
113
+ animateOnMount?: boolean;
114
+ /** Callback fired when an animation begins */
115
+ onAnimationStart?: () => void;
116
+ /** Callback fired when an animation completes */
117
+ onAnimationComplete?: () => void;
118
+ /** The child widget to animate (must be a single GTK widget) */
119
+ children?: ReactNode;
120
+ };
package/dist/errors.js CHANGED
@@ -25,6 +25,9 @@ export function formatRenderError(error, widgetType) {
25
25
  if (error instanceof GtkxError) {
26
26
  return error;
27
27
  }
28
+ if (error instanceof Error) {
29
+ console.error("[formatRenderError] Original error stack:", error.stack);
30
+ }
28
31
  const message = error instanceof Error ? error.message : String(error);
29
32
  const formattedMessage = widgetType ? `Failed to render ${widgetType}: ${message}` : `Render error: ${message}`;
30
33
  return new GtkxError(formattedMessage, widgetType);
package/dist/factory.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { Node } from "./node.js";
2
- import type { Container, Props } from "./types.js";
2
+ import type { Container, ContainerClass, Props } from "./types.js";
3
3
  import "./nodes/index.js";
4
- export declare const createNode: (typeName: string, props: Props, existingContainer?: Container, rootContainer?: Container) => Node;
4
+ export declare const resolveContainerClass: (type: string) => ContainerClass | null;
5
+ export declare const createNode: (typeName: string, props: Props, existingContainer: Container | undefined, rootContainer: Container) => Node;
package/dist/factory.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { NAMESPACE_REGISTRY } from "./generated/registry.js";
2
2
  import { NODE_CLASSES } from "./registry.js";
3
3
  import "./nodes/index.js";
4
- const resolveContainerClass = (type) => {
4
+ export const resolveContainerClass = (type) => {
5
5
  for (const [prefix, namespace] of NAMESPACE_REGISTRY) {
6
6
  if (type.startsWith(prefix)) {
7
7
  const className = type.slice(prefix.length);
@@ -1,5 +1,5 @@
1
1
  import { reconciler } from "./reconciler.js";
2
2
  export const createFiberRoot = (container) => {
3
3
  const instance = reconciler.getInstance();
4
- return instance.createContainer(container, 1, null, false, null, "", (error) => console.error("Fiber root render error:", error), () => { }, () => { }, () => { }, null);
4
+ return instance.createContainer(container, 1, null, false, null, "", (error) => console.error("Fiber root render error:", error), () => { }, () => { }, () => { });
5
5
  };
@@ -23,8 +23,35 @@ export declare const POPOVER_MENU_CLASSES: readonly [typeof Gtk.MenuButton, type
23
23
  export declare const PACK_INTERFACE_METHODS: string[];
24
24
  /** Methods that define the prefix/suffix interface (Adwaita action rows). */
25
25
  export declare const PREFIX_SUFFIX_INTERFACE_METHODS: string[];
26
+ /** Methods that define the adjustable interface (widgets with GtkAdjustment). */
27
+ export declare const ADJUSTABLE_INTERFACE_METHODS: string[];
26
28
  /** Constructor parameters for each widget type, derived from GIR analysis. */
27
29
  export declare const CONSTRUCTOR_PROPS: Record<string, string[]>;
28
30
  export declare const PROPS: Record<string, Record<string, [string | null, string]>>;
29
- /** Signal names for each widget type, derived from CodegenWidgetMeta. */
31
+ /** Signal names for widgets and controllers, derived from CodegenMeta. */
30
32
  export declare const SIGNALS: Record<string, Set<string>>;
33
+ /** Map from JSX element name to controller class. */
34
+ export declare const CONTROLLER_CLASSES: {
35
+ GtkDragSource: typeof Gtk.DragSource;
36
+ GtkDropControllerMotion: typeof Gtk.DropControllerMotion;
37
+ GtkDropTarget: typeof Gtk.DropTarget;
38
+ GtkDropTargetAsync: typeof Gtk.DropTargetAsync;
39
+ GtkEventControllerFocus: typeof Gtk.EventControllerFocus;
40
+ GtkEventControllerKey: typeof Gtk.EventControllerKey;
41
+ GtkEventControllerLegacy: typeof Gtk.EventControllerLegacy;
42
+ GtkEventControllerMotion: typeof Gtk.EventControllerMotion;
43
+ GtkEventControllerScroll: typeof Gtk.EventControllerScroll;
44
+ GtkGestureClick: typeof Gtk.GestureClick;
45
+ GtkGestureDrag: typeof Gtk.GestureDrag;
46
+ GtkGestureLongPress: typeof Gtk.GestureLongPress;
47
+ GtkGesturePan: typeof Gtk.GesturePan;
48
+ GtkGestureRotate: typeof Gtk.GestureRotate;
49
+ GtkGestureSingle: typeof Gtk.GestureSingle;
50
+ GtkGestureStylus: typeof Gtk.GestureStylus;
51
+ GtkGestureSwipe: typeof Gtk.GestureSwipe;
52
+ GtkGestureZoom: typeof Gtk.GestureZoom;
53
+ GtkPadController: typeof Gtk.PadController;
54
+ GtkShortcutController: typeof Gtk.ShortcutController;
55
+ };
56
+ /** Constructor props for controllers that require them. */
57
+ export declare const CONTROLLER_CONSTRUCTOR_PROPS: Record<string, string[]>;
@@ -23,6 +23,8 @@ export const POPOVER_MENU_CLASSES = [Gtk.MenuButton, Gtk.PopoverMenu, Gtk.Popove
23
23
  export const PACK_INTERFACE_METHODS = ["packStart", "packEnd", "remove"];
24
24
  /** Methods that define the prefix/suffix interface (Adwaita action rows). */
25
25
  export const PREFIX_SUFFIX_INTERFACE_METHODS = ["addPrefix", "addSuffix", "remove"];
26
+ /** Methods that define the adjustable interface (widgets with GtkAdjustment). */
27
+ export const ADJUSTABLE_INTERFACE_METHODS = ["getAdjustment", "setAdjustment", "getValue"];
26
28
  /** Constructor parameters for each widget type, derived from GIR analysis. */
27
29
  export const CONSTRUCTOR_PROPS = {
28
30
  AdwAlertDialog: ["heading", "body"],
@@ -399,7 +401,6 @@ export const PROPS = {
399
401
  GtkColumnView: {
400
402
  enableRubberband: ["getEnableRubberband", "setEnableRubberband"],
401
403
  headerFactory: ["getHeaderFactory", "setHeaderFactory"],
402
- model: ["getModel", "setModel"],
403
404
  reorderable: ["getReorderable", "setReorderable"],
404
405
  rowFactory: ["getRowFactory", "setRowFactory"],
405
406
  showColumnSeparators: ["getShowColumnSeparators", "setShowColumnSeparators"],
@@ -429,7 +430,6 @@ export const PROPS = {
429
430
  factory: ["getFactory", "setFactory"],
430
431
  headerFactory: ["getHeaderFactory", "setHeaderFactory"],
431
432
  listFactory: ["getListFactory", "setListFactory"],
432
- model: ["getModel", "setModel"],
433
433
  searchMatchMode: ["getSearchMatchMode", "setSearchMatchMode"],
434
434
  selected: ["getSelected", "setSelected"],
435
435
  useSubtitle: ["getUseSubtitle", "setUseSubtitle"],
@@ -464,7 +464,6 @@ export const PROPS = {
464
464
  factory: ["getFactory", "setFactory"],
465
465
  headerFactory: ["getHeaderFactory", "setHeaderFactory"],
466
466
  listFactory: ["getListFactory", "setListFactory"],
467
- model: ["getModel", "setModel"],
468
467
  searchMatchMode: ["getSearchMatchMode", "setSearchMatchMode"],
469
468
  selected: ["getSelected", "setSelected"],
470
469
  showArrow: ["getShowArrow", "setShowArrow"],
@@ -653,7 +652,6 @@ export const PROPS = {
653
652
  },
654
653
  GtkGraphicsOffload: {
655
654
  blackBackground: ["getBlackBackground", "setBlackBackground"],
656
- child: ["getChild", "setChild"],
657
655
  enabled: ["getEnabled", "setEnabled"],
658
656
  },
659
657
  GtkGrid: {
@@ -666,10 +664,8 @@ export const PROPS = {
666
664
  },
667
665
  GtkGridView: {
668
666
  enableRubberband: ["getEnableRubberband", "setEnableRubberband"],
669
- factory: ["getFactory", "setFactory"],
670
667
  maxColumns: ["getMaxColumns", "setMaxColumns"],
671
668
  minColumns: ["getMinColumns", "setMinColumns"],
672
- model: ["getModel", "setModel"],
673
669
  singleClickActivate: ["getSingleClickActivate", "setSingleClickActivate"],
674
670
  tabBehavior: ["getTabBehavior", "setTabBehavior"],
675
671
  },
@@ -831,9 +827,7 @@ export const PROPS = {
831
827
  },
832
828
  GtkListView: {
833
829
  enableRubberband: ["getEnableRubberband", "setEnableRubberband"],
834
- factory: ["getFactory", "setFactory"],
835
830
  headerFactory: ["getHeaderFactory", "setHeaderFactory"],
836
- model: ["getModel", "setModel"],
837
831
  showSeparators: ["getShowSeparators", "setShowSeparators"],
838
832
  singleClickActivate: ["getSingleClickActivate", "setSingleClickActivate"],
839
833
  tabBehavior: ["getTabBehavior", "setTabBehavior"],
@@ -888,7 +882,6 @@ export const PROPS = {
888
882
  },
889
883
  AdwNavigationPage: {
890
884
  canPop: ["getCanPop", "setCanPop"],
891
- child: ["getChild", "setChild"],
892
885
  tag: ["getTag", "setTag"],
893
886
  title: ["getTitle", "setTitle"],
894
887
  },
@@ -1035,7 +1028,6 @@ export const PROPS = {
1035
1028
  orientation: ["getOrientation", "setOrientation"],
1036
1029
  },
1037
1030
  GtkRange: {
1038
- adjustment: ["getAdjustment", "setAdjustment"],
1039
1031
  fillLevel: ["getFillLevel", "setFillLevel"],
1040
1032
  inverted: ["getInverted", "setInverted"],
1041
1033
  restrictToFillLevel: ["getRestrictToFillLevel", "setRestrictToFillLevel"],
@@ -1056,7 +1048,6 @@ export const PROPS = {
1056
1048
  valuePos: ["getValuePos", "setValuePos"],
1057
1049
  },
1058
1050
  GtkScaleButton: {
1059
- adjustment: ["getAdjustment", "setAdjustment"],
1060
1051
  hasFrame: ["getHasFrame", "setHasFrame"],
1061
1052
  icons: [null, "setIcons"],
1062
1053
  value: ["getValue", "setValue"],
@@ -1144,7 +1135,6 @@ export const PROPS = {
1144
1135
  },
1145
1136
  GtkSpinButton: {
1146
1137
  activatesDefault: ["getActivatesDefault", "setActivatesDefault"],
1147
- adjustment: ["getAdjustment", "setAdjustment"],
1148
1138
  climbRate: ["getClimbRate", "setClimbRate"],
1149
1139
  digits: ["getDigits", "setDigits"],
1150
1140
  numeric: ["getNumeric", "setNumeric"],
@@ -1210,8 +1200,6 @@ export const PROPS = {
1210
1200
  transitionDuration: ["getTransitionDuration", "setTransitionDuration"],
1211
1201
  transitionType: ["getTransitionType", "setTransitionType"],
1212
1202
  vhomogeneous: ["getVhomogeneous", "setVhomogeneous"],
1213
- visibleChild: ["getVisibleChild", "setVisibleChild"],
1214
- visibleChildName: ["getVisibleChildName", "setVisibleChildName"],
1215
1203
  },
1216
1204
  GtkStackSidebar: {
1217
1205
  stack: ["getStack", "setStack"],
@@ -1349,7 +1337,6 @@ export const PROPS = {
1349
1337
  GtkTextView: {
1350
1338
  acceptsTab: ["getAcceptsTab", "setAcceptsTab"],
1351
1339
  bottomMargin: ["getBottomMargin", "setBottomMargin"],
1352
- buffer: ["getBuffer", "setBuffer"],
1353
1340
  cursorVisible: ["getCursorVisible", "setCursorVisible"],
1354
1341
  editable: ["getEditable", "setEditable"],
1355
1342
  extraMenu: ["getExtraMenu", "setExtraMenu"],
@@ -1463,8 +1450,6 @@ export const PROPS = {
1463
1450
  hhomogeneous: ["getHhomogeneous", "setHhomogeneous"],
1464
1451
  transitionDuration: ["getTransitionDuration", "setTransitionDuration"],
1465
1452
  vhomogeneous: ["getVhomogeneous", "setVhomogeneous"],
1466
- visibleChild: ["getVisibleChild", "setVisibleChild"],
1467
- visibleChildName: ["getVisibleChildName", "setVisibleChildName"],
1468
1453
  },
1469
1454
  AdwViewSwitcher: {
1470
1455
  policy: ["getPolicy", "setPolicy"],
@@ -1520,8 +1505,46 @@ export const PROPS = {
1520
1505
  wrapReverse: ["getWrapReverse", "setWrapReverse"],
1521
1506
  orientation: ["getOrientation", "setOrientation"],
1522
1507
  },
1508
+ GtkDragSource: {
1509
+ actions: ["getActions", "setActions"],
1510
+ content: ["getContent", "setContent"],
1511
+ },
1512
+ GtkDropTarget: {
1513
+ actions: ["getActions", "setActions"],
1514
+ preload: ["getPreload", "setPreload"],
1515
+ },
1516
+ GtkDropTargetAsync: {
1517
+ actions: ["getActions", "setActions"],
1518
+ formats: ["getFormats", "setFormats"],
1519
+ },
1520
+ GtkEventController: {
1521
+ name: ["getName", "setName"],
1522
+ propagationLimit: ["getPropagationLimit", "setPropagationLimit"],
1523
+ propagationPhase: ["getPropagationPhase", "setPropagationPhase"],
1524
+ },
1525
+ GtkEventControllerScroll: {
1526
+ flags: ["getFlags", "setFlags"],
1527
+ },
1528
+ GtkGestureLongPress: {
1529
+ delayFactor: ["getDelayFactor", "setDelayFactor"],
1530
+ },
1531
+ GtkGesturePan: {
1532
+ orientation: ["getOrientation", "setOrientation"],
1533
+ },
1534
+ GtkGestureSingle: {
1535
+ button: ["getButton", "setButton"],
1536
+ exclusive: ["getExclusive", "setExclusive"],
1537
+ touchOnly: ["getTouchOnly", "setTouchOnly"],
1538
+ },
1539
+ GtkGestureStylus: {
1540
+ stylusOnly: ["getStylusOnly", "setStylusOnly"],
1541
+ },
1542
+ GtkShortcutController: {
1543
+ mnemonicModifiers: ["getMnemonicsModifiers", "setMnemonicsModifiers"],
1544
+ scope: ["getScope", "setScope"],
1545
+ },
1523
1546
  };
1524
- /** Signal names for each widget type, derived from CodegenWidgetMeta. */
1547
+ /** Signal names for widgets and controllers, derived from CodegenMeta. */
1525
1548
  export const SIGNALS = {
1526
1549
  GtkWidget: new Set([
1527
1550
  "destroy",
@@ -1537,6 +1560,7 @@ export const SIGNALS = {
1537
1560
  "state-flags-changed",
1538
1561
  "unmap",
1539
1562
  "unrealize",
1563
+ "notify",
1540
1564
  ]),
1541
1565
  GtkWindow: new Set(["activate-default", "activate-focus", "close-request", "enable-debugging", "keys-changed"]),
1542
1566
  AdwAboutDialog: new Set(["activate-link"]),
@@ -1842,4 +1866,55 @@ export const SIGNALS = {
1842
1866
  "user-message-received",
1843
1867
  "web-process-terminated",
1844
1868
  ]),
1869
+ GtkDragSource: new Set(["drag-begin", "drag-cancel", "drag-end", "prepare"]),
1870
+ GtkDropControllerMotion: new Set(["enter", "leave", "motion"]),
1871
+ GtkDropTarget: new Set(["accept", "drop", "enter", "leave", "motion"]),
1872
+ GtkDropTargetAsync: new Set(["accept", "drag-enter", "drag-leave", "drag-motion", "drop"]),
1873
+ GtkEventController: new Set(["notify"]),
1874
+ GtkEventControllerFocus: new Set(["enter", "leave"]),
1875
+ GtkEventControllerKey: new Set(["im-update", "key-pressed", "key-released", "modifiers"]),
1876
+ GtkEventControllerLegacy: new Set(["event"]),
1877
+ GtkEventControllerMotion: new Set(["enter", "leave", "motion"]),
1878
+ GtkEventControllerScroll: new Set(["decelerate", "scroll", "scroll-begin", "scroll-end"]),
1879
+ GtkGesture: new Set(["begin", "cancel", "end", "sequence-state-changed", "update"]),
1880
+ GtkGestureClick: new Set(["pressed", "released", "stopped", "unpaired-release"]),
1881
+ GtkGestureDrag: new Set(["drag-begin", "drag-end", "drag-update"]),
1882
+ GtkGestureLongPress: new Set(["cancelled", "pressed"]),
1883
+ GtkGesturePan: new Set(["pan"]),
1884
+ GtkGestureRotate: new Set(["angle-changed"]),
1885
+ GtkGestureStylus: new Set(["down", "motion", "proximity", "up"]),
1886
+ GtkGestureSwipe: new Set(["swipe"]),
1887
+ GtkGestureZoom: new Set(["scale-changed"]),
1888
+ GtkShortcutController: new Set(["items-changed"]),
1889
+ };
1890
+ /** Map from JSX element name to controller class. */
1891
+ export const CONTROLLER_CLASSES = {
1892
+ GtkDragSource: Gtk.DragSource,
1893
+ GtkDropControllerMotion: Gtk.DropControllerMotion,
1894
+ GtkDropTarget: Gtk.DropTarget,
1895
+ GtkDropTargetAsync: Gtk.DropTargetAsync,
1896
+ GtkEventControllerFocus: Gtk.EventControllerFocus,
1897
+ GtkEventControllerKey: Gtk.EventControllerKey,
1898
+ GtkEventControllerLegacy: Gtk.EventControllerLegacy,
1899
+ GtkEventControllerMotion: Gtk.EventControllerMotion,
1900
+ GtkEventControllerScroll: Gtk.EventControllerScroll,
1901
+ GtkGestureClick: Gtk.GestureClick,
1902
+ GtkGestureDrag: Gtk.GestureDrag,
1903
+ GtkGestureLongPress: Gtk.GestureLongPress,
1904
+ GtkGesturePan: Gtk.GesturePan,
1905
+ GtkGestureRotate: Gtk.GestureRotate,
1906
+ GtkGestureSingle: Gtk.GestureSingle,
1907
+ GtkGestureStylus: Gtk.GestureStylus,
1908
+ GtkGestureSwipe: Gtk.GestureSwipe,
1909
+ GtkGestureZoom: Gtk.GestureZoom,
1910
+ GtkPadController: Gtk.PadController,
1911
+ GtkShortcutController: Gtk.ShortcutController,
1912
+ };
1913
+ /** Constructor props for controllers that require them. */
1914
+ export const CONTROLLER_CONSTRUCTOR_PROPS = {
1915
+ GtkDropTarget: ["actions"],
1916
+ GtkDropTargetAsync: ["actions", "formats"],
1917
+ GtkEventControllerScroll: ["flags"],
1918
+ GtkGesturePan: ["orientation"],
1919
+ GtkPadController: ["pad"],
1845
1920
  };