@gtkx/react 0.14.0 → 0.16.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 (182) hide show
  1. package/README.md +28 -27
  2. package/dist/errors.js +3 -0
  3. package/dist/factory.d.ts +3 -2
  4. package/dist/factory.js +1 -1
  5. package/dist/generated/internal.d.ts +28 -1
  6. package/dist/generated/internal.js +93 -18
  7. package/dist/generated/jsx.d.ts +1712 -1516
  8. package/dist/generated/jsx.js +475 -0
  9. package/dist/host-config.d.ts +3 -1
  10. package/dist/host-config.js +31 -11
  11. package/dist/jsx.d.ts +147 -97
  12. package/dist/jsx.js +89 -21
  13. package/dist/node.d.ts +3 -1
  14. package/dist/node.js +5 -3
  15. package/dist/nodes/abstract/positional-child.d.ts +9 -0
  16. package/dist/nodes/abstract/positional-child.js +29 -0
  17. package/dist/nodes/abstract/positional-parent.d.ts +18 -0
  18. package/dist/nodes/abstract/positional-parent.js +48 -0
  19. package/dist/nodes/abstract/virtual-container.d.ts +17 -0
  20. package/dist/nodes/abstract/virtual-container.js +59 -0
  21. package/dist/nodes/abstract/virtual-single-child.d.ts +18 -0
  22. package/dist/nodes/abstract/virtual-single-child.js +54 -0
  23. package/dist/nodes/action-row-child.d.ts +0 -13
  24. package/dist/nodes/action-row-child.js +14 -12
  25. package/dist/nodes/action-row.d.ts +6 -1
  26. package/dist/nodes/action-row.js +4 -37
  27. package/dist/nodes/adjustable.d.ts +23 -0
  28. package/dist/nodes/adjustable.js +62 -0
  29. package/dist/nodes/alert-dialog-response.d.ts +1 -0
  30. package/dist/nodes/alert-dialog-response.js +86 -0
  31. package/dist/nodes/animation/animation-controller.d.ts +17 -0
  32. package/dist/nodes/animation/animation-controller.js +107 -0
  33. package/dist/nodes/animation/animation-factory.d.ts +15 -0
  34. package/dist/nodes/animation/animation-factory.js +25 -0
  35. package/dist/nodes/animation/animation-node.d.ts +9 -0
  36. package/dist/nodes/animation/animation-node.js +126 -0
  37. package/dist/nodes/animation/animation-style-sheet.d.ts +16 -0
  38. package/dist/nodes/animation/animation-style-sheet.js +74 -0
  39. package/dist/nodes/animation/index.d.ts +4 -0
  40. package/dist/nodes/animation/index.js +1 -0
  41. package/dist/nodes/animation/property-mapper.d.ts +11 -0
  42. package/dist/nodes/animation/property-mapper.js +36 -0
  43. package/dist/nodes/animation/transform-state.d.ts +11 -0
  44. package/dist/nodes/animation/transform-state.js +57 -0
  45. package/dist/nodes/animation/widget-registry.d.ts +5 -0
  46. package/dist/nodes/animation/widget-registry.js +42 -0
  47. package/dist/nodes/application.js +17 -7
  48. package/dist/nodes/autowrapped.js +37 -43
  49. package/dist/nodes/calendar.js +16 -55
  50. package/dist/nodes/color-dialog-button.d.ts +1 -0
  51. package/dist/nodes/color-dialog-button.js +70 -0
  52. package/dist/nodes/column-view-column.d.ts +4 -3
  53. package/dist/nodes/column-view-column.js +5 -1
  54. package/dist/nodes/column-view.js +40 -43
  55. package/dist/nodes/dialog.d.ts +11 -0
  56. package/dist/nodes/dialog.js +20 -0
  57. package/dist/nodes/drawing-area.d.ts +1 -0
  58. package/dist/nodes/drawing-area.js +36 -0
  59. package/dist/nodes/event-controller.d.ts +1 -0
  60. package/dist/nodes/event-controller.js +96 -0
  61. package/dist/nodes/expander-row-child.d.ts +0 -14
  62. package/dist/nodes/expander-row-child.js +14 -12
  63. package/dist/nodes/expander-row.d.ts +6 -1
  64. package/dist/nodes/expander-row.js +11 -47
  65. package/dist/nodes/fixed-child.js +48 -36
  66. package/dist/nodes/font-dialog-button.d.ts +1 -0
  67. package/dist/nodes/font-dialog-button.js +90 -0
  68. package/dist/nodes/grid-child.js +39 -45
  69. package/dist/nodes/grid.d.ts +1 -0
  70. package/dist/nodes/grid.js +41 -0
  71. package/dist/nodes/index.d.ts +22 -6
  72. package/dist/nodes/index.js +22 -6
  73. package/dist/nodes/internal/base-item-renderer.d.ts +29 -0
  74. package/dist/nodes/internal/base-item-renderer.js +88 -0
  75. package/dist/nodes/internal/base-store.d.ts +9 -0
  76. package/dist/nodes/internal/base-store.js +20 -0
  77. package/dist/nodes/internal/child-attachment.d.ts +26 -0
  78. package/dist/nodes/internal/child-attachment.js +48 -0
  79. package/dist/nodes/internal/deferred-action.d.ts +8 -0
  80. package/dist/nodes/internal/deferred-action.js +19 -0
  81. package/dist/nodes/internal/list-item-renderer.d.ts +14 -14
  82. package/dist/nodes/internal/list-item-renderer.js +49 -70
  83. package/dist/nodes/internal/list-store.d.ts +7 -6
  84. package/dist/nodes/internal/list-store.js +20 -24
  85. package/dist/nodes/internal/predicates.d.ts +28 -1
  86. package/dist/nodes/internal/predicates.js +53 -38
  87. package/dist/nodes/internal/selection-model.d.ts +30 -0
  88. package/dist/nodes/internal/selection-model.js +91 -0
  89. package/dist/nodes/internal/signal-store.d.ts +5 -3
  90. package/dist/nodes/internal/signal-store.js +30 -21
  91. package/dist/nodes/internal/simple-list-store.js +6 -9
  92. package/dist/nodes/internal/text-buffer-controller.d.ts +43 -0
  93. package/dist/nodes/internal/text-buffer-controller.js +287 -0
  94. package/dist/nodes/internal/text-tag-styles.d.ts +43 -0
  95. package/dist/nodes/internal/text-tag-styles.js +52 -0
  96. package/dist/nodes/internal/tree-list-item-renderer.d.ts +16 -14
  97. package/dist/nodes/internal/tree-list-item-renderer.js +88 -91
  98. package/dist/nodes/internal/tree-store.d.ts +10 -9
  99. package/dist/nodes/internal/tree-store.js +31 -35
  100. package/dist/nodes/internal/utils.d.ts +7 -4
  101. package/dist/nodes/internal/utils.js +50 -5
  102. package/dist/nodes/level-bar.js +18 -66
  103. package/dist/nodes/list-item.d.ts +6 -3
  104. package/dist/nodes/list-item.js +7 -4
  105. package/dist/nodes/list-view.js +19 -11
  106. package/dist/nodes/menu.d.ts +3 -3
  107. package/dist/nodes/menu.js +3 -3
  108. package/dist/nodes/models/list.d.ts +11 -13
  109. package/dist/nodes/models/list.js +16 -73
  110. package/dist/nodes/models/menu.d.ts +8 -7
  111. package/dist/nodes/models/menu.js +43 -50
  112. package/dist/nodes/models/tree-list.d.ts +6 -12
  113. package/dist/nodes/models/tree-list.js +30 -93
  114. package/dist/nodes/navigation-page.d.ts +1 -0
  115. package/dist/nodes/navigation-page.js +7 -3
  116. package/dist/nodes/navigation-view.js +17 -28
  117. package/dist/nodes/notebook-page-tab.d.ts +4 -3
  118. package/dist/nodes/notebook-page-tab.js +5 -2
  119. package/dist/nodes/notebook-page.d.ts +7 -5
  120. package/dist/nodes/notebook-page.js +39 -16
  121. package/dist/nodes/notebook.js +2 -2
  122. package/dist/nodes/overlay-child.js +90 -30
  123. package/dist/nodes/pack-child.d.ts +0 -13
  124. package/dist/nodes/pack-child.js +14 -12
  125. package/dist/nodes/pack.d.ts +6 -1
  126. package/dist/nodes/pack.js +4 -37
  127. package/dist/nodes/popover-menu.js +2 -2
  128. package/dist/nodes/scale.js +15 -58
  129. package/dist/nodes/scrolled-window.js +7 -5
  130. package/dist/nodes/search-bar.d.ts +1 -0
  131. package/dist/nodes/search-bar.js +40 -0
  132. package/dist/nodes/shortcut-controller.d.ts +1 -0
  133. package/dist/nodes/shortcut-controller.js +90 -0
  134. package/dist/nodes/shortcut.d.ts +39 -0
  135. package/dist/nodes/shortcut.js +52 -0
  136. package/dist/nodes/simple-list-view.js +2 -3
  137. package/dist/nodes/slot.d.ts +6 -9
  138. package/dist/nodes/slot.js +27 -42
  139. package/dist/nodes/source-view.d.ts +1 -0
  140. package/dist/nodes/source-view.js +93 -0
  141. package/dist/nodes/stack-page.js +17 -13
  142. package/dist/nodes/stack.js +19 -5
  143. package/dist/nodes/text-anchor.d.ts +41 -0
  144. package/dist/nodes/text-anchor.js +59 -0
  145. package/dist/nodes/text-content.d.ts +10 -0
  146. package/dist/nodes/text-content.js +1 -0
  147. package/dist/nodes/text-paintable.d.ts +17 -0
  148. package/dist/nodes/text-paintable.js +34 -0
  149. package/dist/nodes/text-segment.d.ts +15 -0
  150. package/dist/nodes/text-segment.js +29 -0
  151. package/dist/nodes/text-tag.d.ts +136 -0
  152. package/dist/nodes/text-tag.js +202 -0
  153. package/dist/nodes/text-view.d.ts +31 -0
  154. package/dist/nodes/text-view.js +73 -0
  155. package/dist/nodes/toggle-group.js +24 -32
  156. package/dist/nodes/toggle.d.ts +1 -15
  157. package/dist/nodes/toggle.js +40 -32
  158. package/dist/nodes/toolbar-child.js +14 -16
  159. package/dist/nodes/tree-list-item.d.ts +7 -5
  160. package/dist/nodes/tree-list-item.js +24 -36
  161. package/dist/nodes/tree-list-view.js +9 -4
  162. package/dist/nodes/virtual.d.ts +1 -1
  163. package/dist/nodes/widget.d.ts +3 -13
  164. package/dist/nodes/widget.js +117 -231
  165. package/dist/nodes/window.d.ts +9 -3
  166. package/dist/nodes/window.js +35 -19
  167. package/dist/registry.d.ts +1 -1
  168. package/dist/render.js +8 -6
  169. package/dist/scheduler.d.ts +11 -1
  170. package/dist/scheduler.js +16 -4
  171. package/dist/types.d.ts +2 -110
  172. package/package.json +3 -3
  173. package/dist/nodes/calendar-mark.d.ts +0 -15
  174. package/dist/nodes/calendar-mark.js +0 -29
  175. package/dist/nodes/internal/constants.d.ts +0 -1
  176. package/dist/nodes/internal/constants.js +0 -21
  177. package/dist/nodes/level-bar-offset.d.ts +0 -13
  178. package/dist/nodes/level-bar-offset.js +0 -35
  179. package/dist/nodes/scale-mark.d.ts +0 -17
  180. package/dist/nodes/scale-mark.js +0 -38
  181. package/dist/nodes/virtual-child.d.ts +0 -18
  182. package/dist/nodes/virtual-child.js +0 -62
package/dist/jsx.d.ts CHANGED
@@ -1,8 +1,28 @@
1
+ import type * as Adw from "@gtkx/ffi/adw";
2
+ import type * as Gsk from "@gtkx/ffi/gsk";
1
3
  import type * as Gtk from "@gtkx/ffi/gtk";
2
4
  import type { ReactElement, ReactNode } from "react";
5
+ import type { GtkGridViewProps as GeneratedGtkGridViewProps, GtkListViewProps as GeneratedGtkListViewProps, WidgetSlotNames } from "./generated/jsx.js";
6
+ import type { AnimationProps as AnimationNodeProps } from "./nodes/animation/index.js";
3
7
  import type { RenderItemFn } from "./nodes/internal/list-item-renderer.js";
4
8
  import type { TreeRenderItemFn } from "./nodes/internal/tree-list-item-renderer.js";
5
- export type { DragSourceProps, DropTargetProps, EventControllerProps } from "./types.js";
9
+ import type { ShortcutProps as ShortcutNodeProps } from "./nodes/shortcut.js";
10
+ import type { TextAnchorProps } from "./nodes/text-anchor.js";
11
+ import type { TextPaintableProps } from "./nodes/text-paintable.js";
12
+ import type { TextTagProps } from "./nodes/text-tag.js";
13
+ export type { AnimatableProperties, SpringTransition, TimedTransition, Transition } from "./nodes/animation/index.js";
14
+ export type { TextAnchorProps } from "./nodes/text-anchor.js";
15
+ export type { TextPaintableProps } from "./nodes/text-paintable.js";
16
+ export type { TextTagProps } from "./nodes/text-tag.js";
17
+ export type ScaleMark = {
18
+ value: number;
19
+ position?: Gtk.PositionType;
20
+ label?: string | null;
21
+ };
22
+ export type LevelBarOffset = {
23
+ id: string;
24
+ value: number;
25
+ };
6
26
  /**
7
27
  * Props for slot-based child positioning.
8
28
  *
@@ -87,6 +107,8 @@ export type FixedChildProps = VirtualSlotProps & {
87
107
  x?: number;
88
108
  /** Y coordinate in pixels */
89
109
  y?: number;
110
+ /** 3D transform to apply to the child (perspective, rotation, etc.) */
111
+ transform?: Gsk.Transform;
90
112
  };
91
113
  /**
92
114
  * Props for custom list view rendering.
@@ -131,7 +153,7 @@ export type ColumnViewRootProps<C extends string = string> = {
131
153
  /** Sort direction (ascending or descending) */
132
154
  sortOrder?: Gtk.SortType;
133
155
  /** Callback when sort changes */
134
- onSortChange?: (column: C | null, order: Gtk.SortType) => void;
156
+ onSortChanged?: (column: C | null, order: Gtk.SortType) => void;
135
157
  /** Estimated row height in pixels for proper virtualization before content loads */
136
158
  estimatedRowHeight?: number;
137
159
  };
@@ -141,6 +163,10 @@ export type ColumnViewRootProps<C extends string = string> = {
141
163
  export type NotebookPageProps = VirtualSlotProps & {
142
164
  /** Tab label text (optional when using Notebook.PageTab) */
143
165
  label?: string;
166
+ /** Whether the tab should expand to fill available space */
167
+ tabExpand?: boolean;
168
+ /** Whether the tab should fill its allocated space */
169
+ tabFill?: boolean;
144
170
  };
145
171
  /**
146
172
  * Props for custom notebook page tab widgets.
@@ -218,67 +244,6 @@ export type OverlayChildProps = VirtualSlotProps & {
218
244
  /** Whether to clip this overlay child to the main child bounds */
219
245
  clipOverlay?: boolean;
220
246
  };
221
- /**
222
- * Props for the ScaleMark virtual element.
223
- *
224
- * Used to declaratively add marks to a GtkScale slider.
225
- *
226
- * @example
227
- * ```tsx
228
- * <GtkScale>
229
- * <x.ScaleMark value={0} label="Min" />
230
- * <x.ScaleMark value={50} label="Mid" />
231
- * <x.ScaleMark value={100} label="Max" />
232
- * </GtkScale>
233
- * ```
234
- */
235
- export type ScaleMarkProps = {
236
- /** The value at which to place the mark */
237
- value: number;
238
- /** Position of the mark (TOP or BOTTOM for horizontal, LEFT or RIGHT for vertical) */
239
- position?: Gtk.PositionType;
240
- /** Optional label text (supports Pango markup) */
241
- label?: string | null;
242
- };
243
- /**
244
- * Props for the CalendarMark virtual element.
245
- *
246
- * Used to declaratively mark days on a GtkCalendar.
247
- *
248
- * @example
249
- * ```tsx
250
- * <GtkCalendar>
251
- * <x.CalendarMark day={15} />
252
- * <x.CalendarMark day={20} />
253
- * <x.CalendarMark day={25} />
254
- * </GtkCalendar>
255
- * ```
256
- */
257
- export type CalendarMarkProps = {
258
- /** The day of the month to mark (1-31) */
259
- day: number;
260
- };
261
- /**
262
- * Props for the LevelBarOffset virtual element.
263
- *
264
- * Used to declaratively add offset thresholds to a GtkLevelBar.
265
- * Each offset defines a named threshold that triggers visual style changes.
266
- *
267
- * @example
268
- * ```tsx
269
- * <GtkLevelBar>
270
- * <x.LevelBarOffset id="low" value={0.25} />
271
- * <x.LevelBarOffset id="high" value={0.75} />
272
- * <x.LevelBarOffset id="full" value={1.0} />
273
- * </GtkLevelBar>
274
- * ```
275
- */
276
- export type LevelBarOffsetProps = {
277
- /** Unique identifier for this offset (used for CSS styling) */
278
- id: string;
279
- /** The threshold value (0.0 to 1.0 for continuous mode, or integer for discrete) */
280
- value: number;
281
- };
282
247
  /**
283
248
  * Props for the Toggle virtual element.
284
249
  *
@@ -307,6 +272,16 @@ export type ToggleProps = {
307
272
  /** Whether underline in label indicates mnemonic */
308
273
  useUnderline?: boolean;
309
274
  };
275
+ export type AlertDialogResponseProps = {
276
+ /** Unique response ID (used in response signal and for default/close response) */
277
+ id: string;
278
+ /** Button label text */
279
+ label: string;
280
+ /** Visual appearance of the response button */
281
+ appearance?: Adw.ResponseAppearance;
282
+ /** Whether the response button is enabled */
283
+ enabled?: boolean;
284
+ };
310
285
  /**
311
286
  * Props for ExpanderRow child slots (Row and Action).
312
287
  */
@@ -319,6 +294,13 @@ type NavigationPageBaseProps = {
319
294
  canPop?: boolean;
320
295
  children?: ReactNode;
321
296
  };
297
+ export type { GtkShortcutControllerProps as ShortcutControllerProps } from "./generated/jsx.js";
298
+ /**
299
+ * Props for the Shortcut element in JSX.
300
+ *
301
+ * @see {@link x.Shortcut} for usage examples
302
+ */
303
+ export type ShortcutProps = ShortcutNodeProps;
322
304
  /**
323
305
  * Props for the NavigationPage virtual element with type-safe targeting.
324
306
  *
@@ -351,18 +333,15 @@ export type NavigationPageProps = (NavigationPageBaseProps & {
351
333
  id: string;
352
334
  }) | (NavigationPageBaseProps & {
353
335
  for: "AdwNavigationSplitView";
354
- id: import("./generated/jsx.js").WidgetSlotNames["AdwNavigationSplitView"];
336
+ id: WidgetSlotNames["AdwNavigationSplitView"];
355
337
  });
356
- /**
357
- * Type mapping widget names to their available slot IDs.
358
- */
359
- export type { WidgetSlotNames } from "./generated/jsx.js";
338
+ export type { WidgetSlotNames };
360
339
  /**
361
340
  * Props for the ListView component.
362
341
  *
363
342
  * @typeParam T - The type of items in the list
364
343
  */
365
- export type ListViewProps<T = unknown> = Omit<import("./generated/jsx.js").GtkListViewProps, "renderItem"> & {
344
+ export type ListViewProps<T = unknown> = Omit<GeneratedGtkListViewProps, "renderItem"> & {
366
345
  /** Function to render each list item */
367
346
  renderItem: (item: T | null) => ReactNode;
368
347
  /** Estimated item height in pixels for proper virtualization before content loads */
@@ -373,7 +352,7 @@ export type ListViewProps<T = unknown> = Omit<import("./generated/jsx.js").GtkLi
373
352
  *
374
353
  * @typeParam T - The type of items in the grid
375
354
  */
376
- export type GridViewProps<T = unknown> = Omit<import("./generated/jsx.js").GtkGridViewProps, "renderItem"> & {
355
+ export type GridViewProps<T = unknown> = Omit<GeneratedGtkGridViewProps, "renderItem"> & {
377
356
  /** Function to render each grid item */
378
357
  renderItem: (item: T | null) => ReactNode;
379
358
  /** Estimated item height in pixels for proper virtualization before content loads */
@@ -384,7 +363,7 @@ export type GridViewProps<T = unknown> = Omit<import("./generated/jsx.js").GtkGr
384
363
  *
385
364
  * @typeParam T - The type of items in the tree
386
365
  */
387
- export type TreeListViewProps<T = unknown> = Omit<import("./generated/jsx.js").GtkListViewProps, "renderItem"> & {
366
+ export type TreeListViewProps<T = unknown> = Omit<GeneratedGtkListViewProps, "renderItem"> & {
388
367
  /** Function to render each tree item */
389
368
  renderItem: TreeRenderItemFn<T>;
390
369
  /** Estimated item height in pixels for proper virtualization before content loads */
@@ -436,9 +415,9 @@ export declare const x: {
436
415
  * </GtkHeaderBar>
437
416
  * ```
438
417
  */
439
- Slot<W extends keyof import("./generated/jsx.js").WidgetSlotNames>(props: {
418
+ Slot<W extends keyof WidgetSlotNames>(props: {
440
419
  for: W;
441
- id: import("./generated/jsx.js").WidgetSlotNames[W];
420
+ id: WidgetSlotNames[W];
442
421
  children?: ReactNode;
443
422
  }): ReactElement;
444
423
  /**
@@ -713,44 +692,48 @@ export declare const x: {
713
692
  */
714
693
  MenuSubmenu: "MenuSubmenu";
715
694
  /**
716
- * A mark to display on a GtkScale slider.
695
+ * Declarative text tag for styling text content.
696
+ *
697
+ * Wrap text content with a TextTag to apply styling. Tags can be nested.
717
698
  *
718
699
  * @example
719
700
  * ```tsx
720
- * <GtkScale>
721
- * <x.ScaleMark value={0} label="Min" />
722
- * <x.ScaleMark value={50} />
723
- * <x.ScaleMark value={100} label="Max" />
724
- * </GtkScale>
701
+ * <GtkTextView>
702
+ * Normal <x.TextTag id="bold" weight={Pango.Weight.BOLD}>
703
+ * bold <x.TextTag id="red" foreground="red">and red</x.TextTag>
704
+ * </x.TextTag> text.
705
+ * </GtkTextView>
725
706
  * ```
726
707
  */
727
- ScaleMark: "ScaleMark";
708
+ TextTag: "TextTag";
728
709
  /**
729
- * A day mark on a GtkCalendar.
710
+ * Declarative anchor for embedding widgets in text flow.
711
+ *
712
+ * The anchor is placed at the current position in the text.
730
713
  *
731
714
  * @example
732
715
  * ```tsx
733
- * <GtkCalendar>
734
- * <x.CalendarMark day={15} />
735
- * <x.CalendarMark day={20} />
736
- * <x.CalendarMark day={25} />
737
- * </GtkCalendar>
716
+ * <GtkTextView>
717
+ * Click here: <x.TextAnchor>
718
+ * <GtkButton label="Click me" />
719
+ * </x.TextAnchor> to continue.
720
+ * </GtkTextView>
738
721
  * ```
739
722
  */
740
- CalendarMark: "CalendarMark";
723
+ TextAnchor: "TextAnchor";
741
724
  /**
742
- * An offset threshold for a GtkLevelBar.
725
+ * Declarative inline paintable for embedding images/icons in text flow.
726
+ *
727
+ * The paintable is placed at the current position in the text.
743
728
  *
744
729
  * @example
745
730
  * ```tsx
746
- * <GtkLevelBar>
747
- * <x.LevelBarOffset id="low" value={0.25} />
748
- * <x.LevelBarOffset id="high" value={0.75} />
749
- * <x.LevelBarOffset id="full" value={1.0} />
750
- * </GtkLevelBar>
731
+ * <GtkTextView>
732
+ * Click the icon <x.TextPaintable paintable={iconPaintable} /> to continue.
733
+ * </GtkTextView>
751
734
  * ```
752
735
  */
753
- LevelBarOffset: "LevelBarOffset";
736
+ TextPaintable: "TextPaintable";
754
737
  /**
755
738
  * A toggle button for an AdwToggleGroup.
756
739
  *
@@ -763,6 +746,23 @@ export declare const x: {
763
746
  * ```
764
747
  */
765
748
  Toggle: "Toggle";
749
+ /**
750
+ * A response button for an AdwAlertDialog.
751
+ *
752
+ * @example
753
+ * ```tsx
754
+ * <AdwAlertDialog
755
+ * heading="Delete File?"
756
+ * body="This cannot be undone."
757
+ * defaultResponse="cancel"
758
+ * closeResponse="cancel"
759
+ * >
760
+ * <x.AlertDialogResponse id="cancel" label="Cancel" />
761
+ * <x.AlertDialogResponse id="delete" label="Delete" appearance={Adw.ResponseAppearance.DESTRUCTIVE} />
762
+ * </AdwAlertDialog>
763
+ * ```
764
+ */
765
+ AlertDialogResponse: "AlertDialogResponse";
766
766
  /**
767
767
  * Nested rows container for AdwExpanderRow.
768
768
  *
@@ -818,6 +818,53 @@ export declare const x: {
818
818
  * ```
819
819
  */
820
820
  NavigationPage: "NavigationPage";
821
+ /**
822
+ * Declarative keyboard shortcut controller.
823
+ *
824
+ * Attach keyboard shortcuts to a widget. Must contain `x.Shortcut` children.
825
+ *
826
+ * @example
827
+ * ```tsx
828
+ * <GtkBox>
829
+ * <GtkShortcutController scope={Gtk.ShortcutScope.GLOBAL}>
830
+ * <x.Shortcut trigger="<Control>f" onActivate={() => setSearchMode(s => !s)} />
831
+ * <x.Shortcut trigger="<Control>q" onActivate={quit} />
832
+ * </GtkShortcutController>
833
+ * </GtkBox>
834
+ * ```
835
+ */
836
+ ShortcutController: "GtkShortcutController";
837
+ /**
838
+ * A keyboard shortcut definition.
839
+ *
840
+ * Must be a child of `x.ShortcutController`.
841
+ *
842
+ * @example
843
+ * ```tsx
844
+ * <x.Shortcut trigger="<Control>s" onActivate={save} />
845
+ * <x.Shortcut trigger={["F5", "<Control>r"]} onActivate={refresh} />
846
+ * <x.Shortcut trigger="Escape" onActivate={cancel} disabled={!canCancel} />
847
+ * ```
848
+ */
849
+ Shortcut: "Shortcut";
850
+ /**
851
+ * Declarative animation wrapper using libadwaita's animation primitives.
852
+ *
853
+ * Provides Framer Motion-like API for animating GTK widgets with spring
854
+ * or timed animations.
855
+ *
856
+ * @example
857
+ * ```tsx
858
+ * <x.Animation
859
+ * initial={{ opacity: 0, y: -20 }}
860
+ * animate={{ opacity: 1, y: 0 }}
861
+ * transition={{ type: "spring", stiffness: 300, damping: 20 }}
862
+ * >
863
+ * <GtkLabel label="Hello World" />
864
+ * </x.Animation>
865
+ * ```
866
+ */
867
+ Animation: "Animation";
821
868
  };
822
869
  declare global {
823
870
  namespace React {
@@ -825,13 +872,12 @@ declare global {
825
872
  interface IntrinsicElements {
826
873
  ActionRowPrefix: VirtualSlotProps;
827
874
  ActionRowSuffix: VirtualSlotProps;
828
- CalendarMark: CalendarMarkProps;
875
+ AlertDialogResponse: AlertDialogResponseProps;
829
876
  ColumnViewColumn: ColumnViewColumnProps<any>;
830
877
  ExpanderRowAction: ExpanderRowChildProps;
831
878
  ExpanderRowRow: ExpanderRowChildProps;
832
879
  FixedChild: FixedChildProps;
833
880
  GridChild: GridChildProps;
834
- LevelBarOffset: LevelBarOffsetProps;
835
881
  ListItem: ListItemProps;
836
882
  MenuItem: MenuItemProps;
837
883
  MenuSection: MenuSectionProps;
@@ -841,7 +887,9 @@ declare global {
841
887
  OverlayChild: OverlayChildProps;
842
888
  PackEnd: VirtualSlotProps;
843
889
  PackStart: VirtualSlotProps;
844
- ScaleMark: ScaleMarkProps;
890
+ TextAnchor: TextAnchorProps;
891
+ TextPaintable: TextPaintableProps;
892
+ TextTag: TextTagProps;
845
893
  SimpleListItem: StringListItemProps;
846
894
  StackPage: StackPageProps;
847
895
  Toggle: ToggleProps;
@@ -849,6 +897,8 @@ declare global {
849
897
  ToolbarTop: VirtualSlotProps;
850
898
  TreeListItem: TreeListItemProps<any>;
851
899
  NavigationPage: NavigationPageProps;
900
+ Shortcut: ShortcutProps;
901
+ Animation: AnimationNodeProps;
852
902
  }
853
903
  }
854
904
  }
package/dist/jsx.js CHANGED
@@ -320,44 +320,48 @@ export const x = {
320
320
  */
321
321
  MenuSubmenu: "MenuSubmenu",
322
322
  /**
323
- * A mark to display on a GtkScale slider.
323
+ * Declarative text tag for styling text content.
324
+ *
325
+ * Wrap text content with a TextTag to apply styling. Tags can be nested.
324
326
  *
325
327
  * @example
326
328
  * ```tsx
327
- * <GtkScale>
328
- * <x.ScaleMark value={0} label="Min" />
329
- * <x.ScaleMark value={50} />
330
- * <x.ScaleMark value={100} label="Max" />
331
- * </GtkScale>
329
+ * <GtkTextView>
330
+ * Normal <x.TextTag id="bold" weight={Pango.Weight.BOLD}>
331
+ * bold <x.TextTag id="red" foreground="red">and red</x.TextTag>
332
+ * </x.TextTag> text.
333
+ * </GtkTextView>
332
334
  * ```
333
335
  */
334
- ScaleMark: "ScaleMark",
336
+ TextTag: "TextTag",
335
337
  /**
336
- * A day mark on a GtkCalendar.
338
+ * Declarative anchor for embedding widgets in text flow.
339
+ *
340
+ * The anchor is placed at the current position in the text.
337
341
  *
338
342
  * @example
339
343
  * ```tsx
340
- * <GtkCalendar>
341
- * <x.CalendarMark day={15} />
342
- * <x.CalendarMark day={20} />
343
- * <x.CalendarMark day={25} />
344
- * </GtkCalendar>
344
+ * <GtkTextView>
345
+ * Click here: <x.TextAnchor>
346
+ * <GtkButton label="Click me" />
347
+ * </x.TextAnchor> to continue.
348
+ * </GtkTextView>
345
349
  * ```
346
350
  */
347
- CalendarMark: "CalendarMark",
351
+ TextAnchor: "TextAnchor",
348
352
  /**
349
- * An offset threshold for a GtkLevelBar.
353
+ * Declarative inline paintable for embedding images/icons in text flow.
354
+ *
355
+ * The paintable is placed at the current position in the text.
350
356
  *
351
357
  * @example
352
358
  * ```tsx
353
- * <GtkLevelBar>
354
- * <x.LevelBarOffset id="low" value={0.25} />
355
- * <x.LevelBarOffset id="high" value={0.75} />
356
- * <x.LevelBarOffset id="full" value={1.0} />
357
- * </GtkLevelBar>
359
+ * <GtkTextView>
360
+ * Click the icon <x.TextPaintable paintable={iconPaintable} /> to continue.
361
+ * </GtkTextView>
358
362
  * ```
359
363
  */
360
- LevelBarOffset: "LevelBarOffset",
364
+ TextPaintable: "TextPaintable",
361
365
  /**
362
366
  * A toggle button for an AdwToggleGroup.
363
367
  *
@@ -370,6 +374,23 @@ export const x = {
370
374
  * ```
371
375
  */
372
376
  Toggle: "Toggle",
377
+ /**
378
+ * A response button for an AdwAlertDialog.
379
+ *
380
+ * @example
381
+ * ```tsx
382
+ * <AdwAlertDialog
383
+ * heading="Delete File?"
384
+ * body="This cannot be undone."
385
+ * defaultResponse="cancel"
386
+ * closeResponse="cancel"
387
+ * >
388
+ * <x.AlertDialogResponse id="cancel" label="Cancel" />
389
+ * <x.AlertDialogResponse id="delete" label="Delete" appearance={Adw.ResponseAppearance.DESTRUCTIVE} />
390
+ * </AdwAlertDialog>
391
+ * ```
392
+ */
393
+ AlertDialogResponse: "AlertDialogResponse",
373
394
  /**
374
395
  * Nested rows container for AdwExpanderRow.
375
396
  *
@@ -425,5 +446,52 @@ export const x = {
425
446
  * ```
426
447
  */
427
448
  NavigationPage: "NavigationPage",
449
+ /**
450
+ * Declarative keyboard shortcut controller.
451
+ *
452
+ * Attach keyboard shortcuts to a widget. Must contain `x.Shortcut` children.
453
+ *
454
+ * @example
455
+ * ```tsx
456
+ * <GtkBox>
457
+ * <GtkShortcutController scope={Gtk.ShortcutScope.GLOBAL}>
458
+ * <x.Shortcut trigger="<Control>f" onActivate={() => setSearchMode(s => !s)} />
459
+ * <x.Shortcut trigger="<Control>q" onActivate={quit} />
460
+ * </GtkShortcutController>
461
+ * </GtkBox>
462
+ * ```
463
+ */
464
+ ShortcutController: "GtkShortcutController",
465
+ /**
466
+ * A keyboard shortcut definition.
467
+ *
468
+ * Must be a child of `x.ShortcutController`.
469
+ *
470
+ * @example
471
+ * ```tsx
472
+ * <x.Shortcut trigger="<Control>s" onActivate={save} />
473
+ * <x.Shortcut trigger={["F5", "<Control>r"]} onActivate={refresh} />
474
+ * <x.Shortcut trigger="Escape" onActivate={cancel} disabled={!canCancel} />
475
+ * ```
476
+ */
477
+ Shortcut: "Shortcut",
478
+ /**
479
+ * Declarative animation wrapper using libadwaita's animation primitives.
480
+ *
481
+ * Provides Framer Motion-like API for animating GTK widgets with spring
482
+ * or timed animations.
483
+ *
484
+ * @example
485
+ * ```tsx
486
+ * <x.Animation
487
+ * initial={{ opacity: 0, y: -20 }}
488
+ * animate={{ opacity: 1, y: 0 }}
489
+ * transition={{ type: "spring", stiffness: 300, damping: 20 }}
490
+ * >
491
+ * <GtkLabel label="Hello World" />
492
+ * </x.Animation>
493
+ * ```
494
+ */
495
+ Animation: "Animation",
428
496
  };
429
497
  export * from "./generated/jsx.js";
package/dist/node.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { type SignalStore } from "./nodes/internal/signal-store.js";
1
2
  import type { Container, ContainerClass, Props } from "./types.js";
2
3
  export declare class Node<T = unknown, P = Props> {
3
4
  static priority: number;
@@ -5,7 +6,8 @@ export declare class Node<T = unknown, P = Props> {
5
6
  static createContainer(_props: Props, _containerClass: ContainerClass, _rootContainer?: Container): unknown;
6
7
  container: T;
7
8
  typeName: string;
8
- constructor(typeName: string, _props: P | undefined, container: T, _rootContainer?: Container);
9
+ signalStore: SignalStore;
10
+ constructor(typeName: string, _props: P | undefined, container: T, rootContainer: Container);
9
11
  appendChild(_child: Node): void;
10
12
  removeChild(_child: Node): void;
11
13
  insertBefore(_child: Node, _before: Node): void;
package/dist/node.js CHANGED
@@ -1,4 +1,4 @@
1
- import { signalStore } from "./nodes/internal/signal-store.js";
1
+ import { getSignalStore } from "./nodes/internal/signal-store.js";
2
2
  export class Node {
3
3
  static priority = 0;
4
4
  static matches(_type, _containerOrClass) {
@@ -9,9 +9,11 @@ export class Node {
9
9
  }
10
10
  container;
11
11
  typeName;
12
- constructor(typeName, _props = {}, container, _rootContainer) {
12
+ signalStore;
13
+ constructor(typeName, _props = {}, container, rootContainer) {
13
14
  this.typeName = typeName;
14
15
  this.container = container;
16
+ this.signalStore = getSignalStore(rootContainer);
15
17
  }
16
18
  appendChild(_child) { }
17
19
  removeChild(_child) { }
@@ -19,6 +21,6 @@ export class Node {
19
21
  updateProps(_oldProps, _newProps) { }
20
22
  mount() { }
21
23
  unmount() {
22
- signalStore.clear(this);
24
+ this.signalStore.clear(this);
23
25
  }
24
26
  }
@@ -0,0 +1,9 @@
1
+ import type * as Gtk from "@gtkx/ffi/gtk";
2
+ import type { Props } from "../../types.js";
3
+ import { VirtualSingleChildNode } from "./virtual-single-child.js";
4
+ export declare abstract class PositionalChildNode<P extends Props = Props> extends VirtualSingleChildNode<P> {
5
+ protected abstract attachToParent(parent: Gtk.Widget, child: Gtk.Widget): void;
6
+ protected abstract detachFromParent(parent: Gtk.Widget, child: Gtk.Widget): void;
7
+ unmount(): void;
8
+ protected onChildChange(oldChild: Gtk.Widget | null): void;
9
+ }
@@ -0,0 +1,29 @@
1
+ import { isObjectEqual } from "@gtkx/ffi";
2
+ import { VirtualSingleChildNode } from "./virtual-single-child.js";
3
+ export class PositionalChildNode extends VirtualSingleChildNode {
4
+ unmount() {
5
+ if (this.parent && this.child) {
6
+ const parent = this.parent;
7
+ const oldChild = this.child;
8
+ this.child = null;
9
+ const parentOfOld = oldChild.getParent();
10
+ if (parentOfOld && isObjectEqual(parentOfOld, parent)) {
11
+ this.detachFromParent(parent, oldChild);
12
+ }
13
+ }
14
+ this.parent = null;
15
+ super.unmount();
16
+ }
17
+ onChildChange(oldChild) {
18
+ const parent = this.getParent();
19
+ if (oldChild) {
20
+ const parentOfOld = oldChild.getParent();
21
+ if (parentOfOld && isObjectEqual(parentOfOld, parent)) {
22
+ this.detachFromParent(parent, oldChild);
23
+ }
24
+ }
25
+ if (this.child) {
26
+ this.attachToParent(parent, this.child);
27
+ }
28
+ }
29
+ }
@@ -0,0 +1,18 @@
1
+ import type * as Gtk from "@gtkx/ffi/gtk";
2
+ import type { Node } from "../../node.js";
3
+ import type { Props } from "../../types.js";
4
+ import { WidgetNode } from "../widget.js";
5
+ type PositionalChildParentWidget = Gtk.Widget & {
6
+ remove(child: Gtk.Widget): void;
7
+ };
8
+ export declare abstract class PositionalParentNode<T extends PositionalChildParentWidget = PositionalChildParentWidget, P extends Props = Props> extends WidgetNode<T, P> {
9
+ protected abstract acceptedPositionalChildTypes: Set<string>;
10
+ protected abstract containerTypeName: string;
11
+ private isPositionalChild;
12
+ private formatExpectedTypes;
13
+ private assertValidChild;
14
+ appendChild(child: Node): void;
15
+ insertBefore(child: Node, before: Node): void;
16
+ removeChild(child: Node): void;
17
+ }
18
+ export {};