@gtkx/react 0.19.0 → 0.20.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 (189) hide show
  1. package/dist/components/list.d.ts +35 -0
  2. package/dist/components/list.d.ts.map +1 -0
  3. package/dist/components/list.js +40 -0
  4. package/dist/components/list.js.map +1 -0
  5. package/dist/generated/internal.d.ts +5 -6
  6. package/dist/generated/internal.d.ts.map +1 -1
  7. package/dist/generated/internal.js +3473 -260
  8. package/dist/generated/internal.js.map +1 -1
  9. package/dist/generated/jsx.d.ts +0 -324
  10. package/dist/generated/jsx.d.ts.map +1 -1
  11. package/dist/generated/jsx.js +0 -324
  12. package/dist/generated/jsx.js.map +1 -1
  13. package/dist/host-config.d.ts.map +1 -1
  14. package/dist/host-config.js +2 -0
  15. package/dist/host-config.js.map +1 -1
  16. package/dist/jsx.d.ts +42 -105
  17. package/dist/jsx.d.ts.map +1 -1
  18. package/dist/jsx.js +2 -66
  19. package/dist/jsx.js.map +1 -1
  20. package/dist/metadata.d.ts.map +1 -1
  21. package/dist/metadata.js +7 -3
  22. package/dist/metadata.js.map +1 -1
  23. package/dist/node.d.ts +0 -4
  24. package/dist/node.d.ts.map +1 -1
  25. package/dist/node.js +19 -41
  26. package/dist/node.js.map +1 -1
  27. package/dist/nodes/application.d.ts.map +1 -1
  28. package/dist/nodes/application.js +4 -0
  29. package/dist/nodes/application.js.map +1 -1
  30. package/dist/nodes/column-view-column.d.ts +19 -19
  31. package/dist/nodes/column-view-column.d.ts.map +1 -1
  32. package/dist/nodes/column-view-column.js +130 -119
  33. package/dist/nodes/column-view-column.js.map +1 -1
  34. package/dist/nodes/event-controller.d.ts.map +1 -1
  35. package/dist/nodes/event-controller.js +3 -9
  36. package/dist/nodes/event-controller.js.map +1 -1
  37. package/dist/nodes/internal/accessible.d.ts.map +1 -1
  38. package/dist/nodes/internal/accessible.js.map +1 -1
  39. package/dist/nodes/internal/bound-item.d.ts +4 -0
  40. package/dist/nodes/internal/bound-item.d.ts.map +1 -0
  41. package/dist/nodes/internal/bound-item.js +2 -0
  42. package/dist/nodes/internal/bound-item.js.map +1 -0
  43. package/dist/nodes/internal/construct.d.ts +1 -8
  44. package/dist/nodes/internal/construct.d.ts.map +1 -1
  45. package/dist/nodes/internal/construct.js +30 -54
  46. package/dist/nodes/internal/construct.js.map +1 -1
  47. package/dist/nodes/internal/widget.d.ts.map +1 -1
  48. package/dist/nodes/internal/widget.js +4 -1
  49. package/dist/nodes/internal/widget.js.map +1 -1
  50. package/dist/nodes/list-item-node.d.ts +12 -0
  51. package/dist/nodes/list-item-node.d.ts.map +1 -0
  52. package/dist/nodes/list-item-node.js +23 -0
  53. package/dist/nodes/list-item-node.js.map +1 -0
  54. package/dist/nodes/list.d.ts +100 -0
  55. package/dist/nodes/list.d.ts.map +1 -0
  56. package/dist/nodes/list.js +950 -0
  57. package/dist/nodes/list.js.map +1 -0
  58. package/dist/nodes/notebook-page.d.ts.map +1 -1
  59. package/dist/nodes/notebook-page.js +4 -0
  60. package/dist/nodes/notebook-page.js.map +1 -1
  61. package/dist/nodes/widget.d.ts.map +1 -1
  62. package/dist/nodes/widget.js +9 -8
  63. package/dist/nodes/widget.js.map +1 -1
  64. package/dist/nodes/window.d.ts.map +1 -1
  65. package/dist/nodes/window.js +2 -2
  66. package/dist/nodes/window.js.map +1 -1
  67. package/dist/registry.d.ts +0 -2
  68. package/dist/registry.d.ts.map +1 -1
  69. package/dist/registry.js +4 -13
  70. package/dist/registry.js.map +1 -1
  71. package/dist/types.d.ts +2 -2
  72. package/dist/types.d.ts.map +1 -1
  73. package/package.json +5 -4
  74. package/src/components/list.tsx +83 -0
  75. package/src/generated/internal.ts +3479 -258
  76. package/src/generated/jsx.ts +0 -324
  77. package/src/host-config.ts +2 -0
  78. package/src/jsx.ts +49 -141
  79. package/src/metadata.ts +6 -3
  80. package/src/node.ts +23 -39
  81. package/src/nodes/application.ts +5 -0
  82. package/src/nodes/column-view-column.ts +125 -128
  83. package/src/nodes/event-controller.ts +3 -11
  84. package/src/nodes/internal/accessible.ts +0 -1
  85. package/src/nodes/internal/bound-item.ts +4 -0
  86. package/src/nodes/internal/construct.ts +38 -68
  87. package/src/nodes/internal/widget.ts +3 -1
  88. package/src/nodes/list-item-node.ts +29 -0
  89. package/src/nodes/list.ts +1082 -0
  90. package/src/nodes/notebook-page.ts +4 -0
  91. package/src/nodes/widget.ts +8 -13
  92. package/src/nodes/window.ts +2 -2
  93. package/src/registry.ts +11 -19
  94. package/src/types.ts +7 -2
  95. package/dist/fiber-root.d.ts +0 -4
  96. package/dist/fiber-root.d.ts.map +0 -1
  97. package/dist/fiber-root.js +0 -6
  98. package/dist/fiber-root.js.map +0 -1
  99. package/dist/nodes/column-view.d.ts +0 -37
  100. package/dist/nodes/column-view.d.ts.map +0 -1
  101. package/dist/nodes/column-view.js +0 -205
  102. package/dist/nodes/column-view.js.map +0 -1
  103. package/dist/nodes/drop-down.d.ts +0 -37
  104. package/dist/nodes/drop-down.d.ts.map +0 -1
  105. package/dist/nodes/drop-down.js +0 -231
  106. package/dist/nodes/drop-down.js.map +0 -1
  107. package/dist/nodes/grid-view.d.ts +0 -30
  108. package/dist/nodes/grid-view.d.ts.map +0 -1
  109. package/dist/nodes/grid-view.js +0 -90
  110. package/dist/nodes/grid-view.js.map +0 -1
  111. package/dist/nodes/internal/base-item-renderer.d.ts +0 -28
  112. package/dist/nodes/internal/base-item-renderer.d.ts.map +0 -1
  113. package/dist/nodes/internal/base-item-renderer.js +0 -85
  114. package/dist/nodes/internal/base-item-renderer.js.map +0 -1
  115. package/dist/nodes/internal/grid-item-renderer.d.ts +0 -20
  116. package/dist/nodes/internal/grid-item-renderer.d.ts.map +0 -1
  117. package/dist/nodes/internal/grid-item-renderer.js +0 -66
  118. package/dist/nodes/internal/grid-item-renderer.js.map +0 -1
  119. package/dist/nodes/internal/header-item-renderer.d.ts +0 -23
  120. package/dist/nodes/internal/header-item-renderer.d.ts.map +0 -1
  121. package/dist/nodes/internal/header-item-renderer.js +0 -87
  122. package/dist/nodes/internal/header-item-renderer.js.map +0 -1
  123. package/dist/nodes/internal/header-renderer-manager.d.ts +0 -13
  124. package/dist/nodes/internal/header-renderer-manager.d.ts.map +0 -1
  125. package/dist/nodes/internal/header-renderer-manager.js +0 -20
  126. package/dist/nodes/internal/header-renderer-manager.js.map +0 -1
  127. package/dist/nodes/internal/list-item-renderer.d.ts +0 -27
  128. package/dist/nodes/internal/list-item-renderer.d.ts.map +0 -1
  129. package/dist/nodes/internal/list-item-renderer.js +0 -131
  130. package/dist/nodes/internal/list-item-renderer.js.map +0 -1
  131. package/dist/nodes/internal/list-store.d.ts +0 -21
  132. package/dist/nodes/internal/list-store.d.ts.map +0 -1
  133. package/dist/nodes/internal/list-store.js +0 -90
  134. package/dist/nodes/internal/list-store.js.map +0 -1
  135. package/dist/nodes/internal/sectioned-list-store.d.ts +0 -50
  136. package/dist/nodes/internal/sectioned-list-store.d.ts.map +0 -1
  137. package/dist/nodes/internal/sectioned-list-store.js +0 -250
  138. package/dist/nodes/internal/sectioned-list-store.js.map +0 -1
  139. package/dist/nodes/internal/selection-helpers.d.ts +0 -12
  140. package/dist/nodes/internal/selection-helpers.d.ts.map +0 -1
  141. package/dist/nodes/internal/selection-helpers.js +0 -25
  142. package/dist/nodes/internal/selection-helpers.js.map +0 -1
  143. package/dist/nodes/internal/selection-model-controller.d.ts +0 -26
  144. package/dist/nodes/internal/selection-model-controller.d.ts.map +0 -1
  145. package/dist/nodes/internal/selection-model-controller.js +0 -82
  146. package/dist/nodes/internal/selection-model-controller.js.map +0 -1
  147. package/dist/nodes/internal/simple-list-store.d.ts +0 -15
  148. package/dist/nodes/internal/simple-list-store.d.ts.map +0 -1
  149. package/dist/nodes/internal/simple-list-store.js +0 -110
  150. package/dist/nodes/internal/simple-list-store.js.map +0 -1
  151. package/dist/nodes/internal/tree-store.d.ts +0 -37
  152. package/dist/nodes/internal/tree-store.d.ts.map +0 -1
  153. package/dist/nodes/internal/tree-store.js +0 -253
  154. package/dist/nodes/internal/tree-store.js.map +0 -1
  155. package/dist/nodes/list-item.d.ts +0 -24
  156. package/dist/nodes/list-item.d.ts.map +0 -1
  157. package/dist/nodes/list-item.js +0 -83
  158. package/dist/nodes/list-item.js.map +0 -1
  159. package/dist/nodes/list-section.d.ts +0 -27
  160. package/dist/nodes/list-section.d.ts.map +0 -1
  161. package/dist/nodes/list-section.js +0 -43
  162. package/dist/nodes/list-section.js.map +0 -1
  163. package/dist/nodes/list-view.d.ts +0 -32
  164. package/dist/nodes/list-view.d.ts.map +0 -1
  165. package/dist/nodes/list-view.js +0 -123
  166. package/dist/nodes/list-view.js.map +0 -1
  167. package/dist/nodes/models/list.d.ts +0 -39
  168. package/dist/nodes/models/list.d.ts.map +0 -1
  169. package/dist/nodes/models/list.js +0 -207
  170. package/dist/nodes/models/list.js.map +0 -1
  171. package/src/fiber-root.ts +0 -20
  172. package/src/nodes/column-view.ts +0 -262
  173. package/src/nodes/drop-down.ts +0 -284
  174. package/src/nodes/grid-view.ts +0 -119
  175. package/src/nodes/internal/base-item-renderer.ts +0 -107
  176. package/src/nodes/internal/grid-item-renderer.ts +0 -78
  177. package/src/nodes/internal/header-item-renderer.ts +0 -105
  178. package/src/nodes/internal/header-renderer-manager.ts +0 -33
  179. package/src/nodes/internal/list-item-renderer.ts +0 -162
  180. package/src/nodes/internal/list-store.ts +0 -107
  181. package/src/nodes/internal/sectioned-list-store.ts +0 -287
  182. package/src/nodes/internal/selection-helpers.ts +0 -35
  183. package/src/nodes/internal/selection-model-controller.ts +0 -119
  184. package/src/nodes/internal/simple-list-store.ts +0 -116
  185. package/src/nodes/internal/tree-store.ts +0 -289
  186. package/src/nodes/list-item.ts +0 -107
  187. package/src/nodes/list-section.ts +0 -64
  188. package/src/nodes/list-view.ts +0 -164
  189. package/src/nodes/models/list.ts +0 -250
@@ -12575,73 +12575,6 @@ export const GtkColorChooserWidget = "GtkColorChooserWidget" as const;
12575
12575
  * it gets the .color style class.
12576
12576
  */
12577
12577
  export const GtkColorDialogButton = "GtkColorDialogButton" as const;
12578
- /**
12579
- * Presents a large dynamic list of items using multiple columns with headers.
12580
- *
12581
- * `GtkColumnView` uses the factories of its columns to generate a cell widget for
12582
- * each column, for each visible item and displays them together as the row for
12583
- * this item.
12584
- *
12585
- * The {@link Gtk.ColumnView.show-row-separators} and
12586
- * {@link Gtk.ColumnView.show-column-separators} properties offer a simple way
12587
- * to display separators between the rows or columns.
12588
- *
12589
- * `GtkColumnView` allows the user to select items according to the selection
12590
- * characteristics of the model. For models that allow multiple selected items,
12591
- * it is possible to turn on *rubberband selection*, using
12592
- * {@link Gtk.ColumnView.enable-rubberband}.
12593
- *
12594
- * The column view supports sorting that can be customized by the user by
12595
- * clicking on column headers. To set this up, the `GtkSorter` returned by
12596
- * {@link Gtk.ColumnView.get_sorter} must be attached to a sort model for the
12597
- * data that the view is showing, and the columns must have sorters attached to
12598
- * them by calling {@link Gtk.ColumnViewColumn.set_sorter}. The initial sort
12599
- * order can be set with {@link Gtk.ColumnView.sort_by_column}.
12600
- *
12601
- * The column view also supports interactive resizing and reordering of
12602
- * columns, via Drag-and-Drop of the column headers. This can be enabled or
12603
- * disabled with the {@link Gtk.ColumnView.reorderable} and
12604
- * {@link Gtk.ColumnViewColumn.resizable} properties.
12605
- *
12606
- * To learn more about the list widget framework, see the
12607
- * overview.
12608
- *
12609
- * # CSS nodes
12610
- *
12611
- * ```
12612
- * columnview[.column-separators][.rich-list][.navigation-sidebar][.data-table]
12613
- * ├── header
12614
- * │ ├── <column header>
12615
- * ┊ ┊
12616
- * │ ╰── <column header>
12617
- * │
12618
- * ├── listview
12619
- * │
12620
- * ┊
12621
- * ╰── [rubberband]
12622
- * ```
12623
- *
12624
- * `GtkColumnView` uses a single CSS node named columnview. It may carry the
12625
- * .column-separators style class, when {@link Gtk.ColumnView.show-column-separators}
12626
- * property is set. Header widgets appear below a node with name header.
12627
- * The rows are contained in a `GtkListView` widget, so there is a listview
12628
- * node with the same structure as for a standalone `GtkListView` widget.
12629
- * If {@link Gtk.ColumnView.show-row-separators} is set, it will be passed
12630
- * on to the list view, causing its CSS node to carry the .separators style class.
12631
- * For rubberband selection, a node with name rubberband is used.
12632
- *
12633
- * The main columnview node may also carry style classes to select
12634
- * the style of list presentation:
12635
- * .rich-list, .navigation-sidebar or .data-table.
12636
- *
12637
- * # Accessibility
12638
- *
12639
- * `GtkColumnView` uses the {@link Gtk.AccessibleRole.tree_grid} role, header title
12640
- * widgets are using the {@link Gtk.AccessibleRole.column_header} role. The row widgets
12641
- * are using the {@link Gtk.AccessibleRole.row} role, and individual cells are using
12642
- * the {@link Gtk.AccessibleRole.grid_cell} role
12643
- */
12644
- export const GtkColumnView = "GtkColumnView" as const;
12645
12578
  /**
12646
12579
  * A `GtkComboBox` is a widget that allows the user to choose from a list of
12647
12580
  * valid choices.
@@ -12763,53 +12696,6 @@ export const GtkComboBox = "GtkComboBox" as const;
12763
12696
  * children, and the .linked class to the node of its internal box.
12764
12697
  */
12765
12698
  export const GtkComboBoxText = "GtkComboBoxText" as const;
12766
- /**
12767
- * A {@link Gtk.ListBoxRow} used to choose from a list of items.
12768
- *
12769
- * ![combo-row](https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1-latest/combo-row.png)
12770
- *
12771
- * The `AdwComboRow` widget allows the user to choose from a list of valid
12772
- * choices. The row displays the selected choice. When activated, the row
12773
- * displays a popover which allows the user to make a new choice.
12774
- *
12775
- * Example of an `AdwComboRow` UI definition:
12776
- * ```xml
12777
- * <object class="AdwComboRow">
12778
- * <property name="title" translatable="yes">Combo Row</property>
12779
- * <property name="model">
12780
- * <object class="GtkStringList">
12781
- * <items>
12782
- * <item translatable="yes">Foo</item>
12783
- * <item translatable="yes">Bar</item>
12784
- * <item translatable="yes">Baz</item>
12785
- * </items>
12786
- * </object>
12787
- * </property>
12788
- * </object>
12789
- * ```
12790
- *
12791
- * The {@link ComboRow.selected} and {@link ComboRow.selected-item}
12792
- * properties can be used to keep track of the selected item and react to their
12793
- * changes.
12794
- *
12795
- * `AdwComboRow` mirrors {@link Gtk.DropDown}, see that widget for details.
12796
- *
12797
- * `AdwComboRow` is {@link Gtk.ListBoxRow.activatable} if a model is set.
12798
- *
12799
- * ## CSS nodes
12800
- *
12801
- * `AdwComboRow` has a main CSS node with name `row` and the `.combo` style
12802
- * class.
12803
- *
12804
- * Its popover has the node named `popover` with the `.menu` style class, it
12805
- * contains a {@link Gtk.ScrolledWindow}, which in turn contains a
12806
- * {@link Gtk.ListView}, both are accessible via their regular nodes.
12807
- *
12808
- * ## Accessibility
12809
- *
12810
- * `AdwComboRow` uses the `GTK_ACCESSIBLE_ROLE_COMBO_BOX` role.
12811
- */
12812
- export const AdwComboRow = "AdwComboRow" as const;
12813
12699
  /**
12814
12700
  * Widget for single cell of completion proposal.
12815
12701
  *
@@ -13101,64 +12987,6 @@ export const GtkDragIcon = "GtkDragIcon" as const;
13101
12987
  * creating your own `GtkWidget` subclass.
13102
12988
  */
13103
12989
  export const GtkDrawingArea = "GtkDrawingArea" as const;
13104
- /**
13105
- * Allows the user to choose an item from a list of options.
13106
- *
13107
- * ![An example GtkDropDown](https://docs.gtk.org/gtk4/drop-down.png)
13108
- *
13109
- * The `GtkDropDown` displays the [selected]{@link Gtk.DropDown.selected}
13110
- * choice.
13111
- *
13112
- * The options are given to `GtkDropDown` in the form of `GListModel`
13113
- * and how the individual options are represented is determined by
13114
- * a {@link Gtk.ListItemFactory}. The default factory displays simple strings,
13115
- * and adds a checkmark to the selected item in the popup.
13116
- *
13117
- * To set your own factory, use {@link Gtk.DropDown.set_factory}. It is
13118
- * possible to use a separate factory for the items in the popup, with
13119
- * {@link Gtk.DropDown.set_list_factory}.
13120
- *
13121
- * `GtkDropDown` knows how to obtain strings from the items in a
13122
- * {@link Gtk.StringList}; for other models, you have to provide an expression
13123
- * to find the strings via {@link Gtk.DropDown.set_expression}.
13124
- *
13125
- * `GtkDropDown` can optionally allow search in the popup, which is
13126
- * useful if the list of options is long. To enable the search entry,
13127
- * use {@link Gtk.DropDown.set_enable_search}.
13128
- *
13129
- * Here is a UI definition example for `GtkDropDown` with a simple model:
13130
- *
13131
- * ```xml
13132
- * <object class="GtkDropDown">
13133
- * <property name="model">
13134
- * <object class="GtkStringList">
13135
- * <items>
13136
- * <item translatable="yes">Factory</item>
13137
- * <item translatable="yes">Home</item>
13138
- * <item translatable="yes">Subway</item>
13139
- * </items>
13140
- * </object>
13141
- * </property>
13142
- * </object>
13143
- * ```
13144
- *
13145
- * If a `GtkDropDown` is created in this manner, or with
13146
- * {@link Gtk.DropDown.new_from_strings}, for instance, the object returned from
13147
- * {@link Gtk.DropDown.get_selected_item} will be a {@link Gtk.StringObject}.
13148
- *
13149
- * To learn more about the list widget framework, see the
13150
- * overview.
13151
- *
13152
- * ## CSS nodes
13153
- *
13154
- * `GtkDropDown` has a single CSS node with name dropdown,
13155
- * with the button and popover nodes as children.
13156
- *
13157
- * ## Accessibility
13158
- *
13159
- * `GtkDropDown` uses the {@link Gtk.AccessibleRole.combo_box} role.
13160
- */
13161
- export const GtkDropDown = "GtkDropDown" as const;
13162
12990
  /**
13163
12991
  * Allows users to edit the displayed text by switching to an “edit mode”.
13164
12992
  *
@@ -14230,51 +14058,6 @@ export const GtkGraphicsOffload = "GtkGraphicsOffload" as const;
14230
14058
  * Starting from GTK 4.12, `GtkGrid` uses the {@link Gtk.AccessibleRole.generic} role.
14231
14059
  */
14232
14060
  export const GtkGrid = "GtkGrid" as const;
14233
- /**
14234
- * Presents a large dynamic grid of items.
14235
- *
14236
- * `GtkGridView` uses its factory to generate one child widget for each
14237
- * visible item and shows them in a grid. The orientation of the grid view
14238
- * determines if the grid reflows vertically or horizontally.
14239
- *
14240
- * `GtkGridView` allows the user to select items according to the selection
14241
- * characteristics of the model. For models that allow multiple selected items,
14242
- * it is possible to turn on _rubberband selection_, using
14243
- * {@link Gtk.GridView.enable-rubberband}.
14244
- *
14245
- * To learn more about the list widget framework, see the
14246
- * overview.
14247
- *
14248
- * # Actions
14249
- *
14250
- * `GtkGridView` defines a set of built-in actions:
14251
- *
14252
- * - `list.activate-item` activates the item at given position by emitting the
14253
- * the {@link Gtk.GridView.:activate} signal.
14254
- *
14255
- * # CSS nodes
14256
- *
14257
- * ```
14258
- * gridview
14259
- * ├── child[.activatable]
14260
- * │
14261
- * ├── child[.activatable]
14262
- * │
14263
- * ┊
14264
- * ╰── [rubberband]
14265
- * ```
14266
- *
14267
- * `GtkGridView` uses a single CSS node with name `gridview`. Each child uses
14268
- * a single CSS node with name `child`. If the {@link Gtk.ListItem.activatable}
14269
- * property is set, the corresponding row will have the `.activatable` style
14270
- * class. For rubberband selection, a subnode with name `rubberband` is used.
14271
- *
14272
- * # Accessibility
14273
- *
14274
- * `GtkGridView` uses the {@link Gtk.AccessibleRole.grid} role, and the items
14275
- * use the {@link Gtk.AccessibleRole.grid_cell} role.
14276
- */
14277
- export const GtkGridView = "GtkGridView" as const;
14278
14061
  /**
14279
14062
  * Gutter object for {@link View}.
14280
14063
  *
@@ -15235,113 +15018,6 @@ export const GtkListBox = "GtkListBox" as const;
15235
15018
  * when necessary.
15236
15019
  */
15237
15020
  export const GtkListBoxRow = "GtkListBoxRow" as const;
15238
- /**
15239
- * Presents a large dynamic list of items.
15240
- *
15241
- * `GtkListView` uses its factory to generate one row widget for each visible
15242
- * item and shows them in a linear display, either vertically or horizontally.
15243
- *
15244
- * The {@link Gtk.ListView.show-separators} property offers a simple way to
15245
- * display separators between the rows.
15246
- *
15247
- * `GtkListView` allows the user to select items according to the selection
15248
- * characteristics of the model. For models that allow multiple selected items,
15249
- * it is possible to turn on _rubberband selection_, using
15250
- * {@link Gtk.ListView.enable-rubberband}.
15251
- *
15252
- * If you need multiple columns with headers, see {@link Gtk.ColumnView}.
15253
- *
15254
- * To learn more about the list widget framework, see the
15255
- * overview.
15256
- *
15257
- * An example of using `GtkListView`:
15258
- * ```c
15259
- * static void
15260
- * setup_listitem_cb (GtkListItemFactory *factory,
15261
- * GtkListItem *list_item)
15262
- * {
15263
- * GtkWidget *image;
15264
- *
15265
- * image = gtk_image_new ();
15266
- * gtk_image_set_icon_size (GTK_IMAGE (image), GTK_ICON_SIZE_LARGE);
15267
- * gtk_list_item_set_child (list_item, image);
15268
- * }
15269
- *
15270
- * static void
15271
- * bind_listitem_cb (GtkListItemFactory *factory,
15272
- * GtkListItem *list_item)
15273
- * {
15274
- * GtkWidget *image;
15275
- * GAppInfo *app_info;
15276
- *
15277
- * image = gtk_list_item_get_child (list_item);
15278
- * app_info = gtk_list_item_get_item (list_item);
15279
- * gtk_image_set_from_gicon (GTK_IMAGE (image), g_app_info_get_icon (app_info));
15280
- * }
15281
- *
15282
- * static void
15283
- * activate_cb (GtkListView *list,
15284
- * guint position,
15285
- * gpointer unused)
15286
- * {
15287
- * GAppInfo *app_info;
15288
- *
15289
- * app_info = g_list_model_get_item (G_LIST_MODEL (gtk_list_view_get_model (list)), position);
15290
- * g_app_info_launch (app_info, NULL, NULL, NULL);
15291
- * g_object_unref (app_info);
15292
- * }
15293
- *
15294
- * ...
15295
- *
15296
- * model = create_application_list ();
15297
- *
15298
- * factory = gtk_signal_list_item_factory_new ();
15299
- * g_signal_connect (factory, "setup", G_CALLBACK (setup_listitem_cb), NULL);
15300
- * g_signal_connect (factory, "bind", G_CALLBACK (bind_listitem_cb), NULL);
15301
- *
15302
- * list = gtk_list_view_new (GTK_SELECTION_MODEL (gtk_single_selection_new (model)), factory);
15303
- *
15304
- * g_signal_connect (list, "activate", G_CALLBACK (activate_cb), NULL);
15305
- *
15306
- * gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), list);
15307
- * ```
15308
- *
15309
- * # Actions
15310
- *
15311
- * `GtkListView` defines a set of built-in actions:
15312
- *
15313
- * - `list.activate-item` activates the item at given position by emitting
15314
- * the {@link Gtk.ListView.:activate} signal.
15315
- *
15316
- * # CSS nodes
15317
- *
15318
- * ```
15319
- * listview[.separators][.rich-list][.navigation-sidebar][.data-table]
15320
- * ├── row[.activatable]
15321
- * │
15322
- * ├── row[.activatable]
15323
- * │
15324
- * ┊
15325
- * ╰── [rubberband]
15326
- * ```
15327
- *
15328
- * `GtkListView` uses a single CSS node named `listview`. It may carry the
15329
- * `.separators` style class, when {@link Gtk.ListView.show-separators}
15330
- * property is set. Each child widget uses a single CSS node named `row`.
15331
- * If the {@link Gtk.ListItem.activatable} property is set, the
15332
- * corresponding row will have the `.activatable` style class. For
15333
- * rubberband selection, a node with name `rubberband` is used.
15334
- *
15335
- * The main listview node may also carry style classes to select
15336
- * the style of list presentation:
15337
- * .rich-list, .navigation-sidebar or .data-table.
15338
- *
15339
- * # Accessibility
15340
- *
15341
- * `GtkListView` uses the {@link Gtk.AccessibleRole.list} role, and the list
15342
- * items use the {@link Gtk.AccessibleRole.list_item} role.
15343
- */
15344
- export const GtkListView = "GtkListView" as const;
15345
15021
  /**
15346
15022
  * `GtkLockButton` is a widget to obtain and revoke authorizations
15347
15023
  * needed to operate the controls.
@@ -73,6 +73,8 @@ export function createHostConfig(): HostConfig {
73
73
  supportsMutation: true,
74
74
  supportsPersistence: false,
75
75
  supportsHydration: false,
76
+ supportsMicrotasks: true,
77
+ scheduleMicrotask: (fn: () => unknown) => queueMicrotask(fn),
76
78
  isPrimaryRenderer: true,
77
79
  noTimeout: -1,
78
80
  getRootHostContext: () => ({}),
package/src/jsx.ts CHANGED
@@ -7,14 +7,7 @@ import type * as GtkSource from "@gtkx/ffi/gtksource";
7
7
  import type * as Pango from "@gtkx/ffi/pango";
8
8
  import type { ReactElement, ReactNode } from "react";
9
9
  import { createElement } from "react";
10
- import type {
11
- AdwComboRowProps as IntrinsicAdwComboRowProps,
12
- GtkColumnViewProps as IntrinsicGtkColumnViewProps,
13
- GtkDropDownProps as IntrinsicGtkDropDownProps,
14
- GtkGridViewProps as IntrinsicGtkGridViewProps,
15
- GtkListViewProps as IntrinsicGtkListViewProps,
16
- WidgetSlotNames,
17
- } from "./generated/jsx.js";
10
+ import type { WidgetSlotNames } from "./generated/jsx.js";
18
11
 
19
12
  /**
20
13
  * CSS properties that can be animated on a widget.
@@ -377,45 +370,36 @@ export type ContainerSlotProps = {
377
370
  };
378
371
 
379
372
  /**
380
- * Props for items in a GtkListView, GtkGridView, or GtkColumnView.
373
+ * A data item for list/grid/column views and dropdowns.
381
374
  *
382
- * When used inside a GtkListView, items can be nested to create tree hierarchies.
383
- * Tree-specific props (`indentForDepth`, `indentForIcon`, `hideExpander`) only
384
- * apply when items are used inside a GtkListView with nested children.
375
+ * Uses a discriminated union on the `section` field:
376
+ * - Regular items have `value: T` and optional tree-mode properties
377
+ * - Section headers have `value: S`, `section: true`, and required `children`
385
378
  *
386
- * @typeParam T - The type of data associated with this list item
387
- */
388
- export type ListItemProps<T = unknown> = {
389
- /** Unique identifier for this item */
390
- id: string;
391
- /** The data value for this item */
392
- value: T;
393
- /** Whether to indent based on tree depth (default: true) */
394
- indentForDepth?: boolean;
395
- /** Whether to indent for expander icon width */
396
- indentForIcon?: boolean;
397
- /** Whether to hide the expand/collapse arrow */
398
- hideExpander?: boolean;
399
- /** Nested list items (children of this item in a tree) */
400
- children?: ReactNode;
401
- };
402
-
403
- /**
404
- * Props for section headers in a GtkListView, GtkGridView, or GtkColumnView.
379
+ * Mode is detected from data shape:
380
+ * - Any item has `section: true` → section mode
381
+ * - Any item has non-empty `children` (without `section`) → tree mode
382
+ * - Otherwise flat mode
405
383
  *
406
- * Wraps ListItems to group them into sections. When used with `renderHeader`,
407
- * the view displays a header at the top of each section.
408
- *
409
- * @typeParam T - The type of data associated with this section header
384
+ * @typeParam T - The type of data for regular items
385
+ * @typeParam S - The type of data for section headers
410
386
  */
411
- export type ListSectionProps<T = unknown> = {
412
- /** Unique identifier for this section */
413
- id: string;
414
- /** The data value passed to `renderHeader` for this section */
415
- value: T;
416
- /** ListItem children belonging to this section */
417
- children?: ReactNode;
418
- };
387
+ export type ListItem<T = unknown, S = unknown> =
388
+ | {
389
+ id: string;
390
+ value: T;
391
+ section?: false | undefined;
392
+ children?: ListItem<T, S>[];
393
+ hideExpander?: boolean;
394
+ indentForDepth?: boolean;
395
+ indentForIcon?: boolean;
396
+ }
397
+ | {
398
+ id: string;
399
+ value: S;
400
+ section: true;
401
+ children: ListItem<T, S>[];
402
+ };
419
403
 
420
404
  /**
421
405
  * Props for positioning children within a GtkGrid.
@@ -474,7 +458,7 @@ export type ColumnViewColumnProps<T = unknown> = {
474
458
  /** Whether this column is visible */
475
459
  visible?: boolean;
476
460
  /** Function to render the cell content for each row */
477
- renderCell: (item: T | null) => ReactNode;
461
+ renderCell: (item: T) => ReactNode;
478
462
  /** Menu items for the column header context menu */
479
463
  children?: ReactNode;
480
464
  };
@@ -688,6 +672,8 @@ export type TextBufferProps = {
688
672
  type BaseListViewProps = {
689
673
  /** Estimated item height in pixels for virtualization */
690
674
  estimatedItemHeight?: number;
675
+ /** Estimated item width in pixels for virtualization */
676
+ estimatedItemWidth?: number;
691
677
  /** Array of selected item IDs */
692
678
  selected?: string[] | null;
693
679
  /** Callback fired when the selection changes */
@@ -697,33 +683,39 @@ type BaseListViewProps = {
697
683
  };
698
684
 
699
685
  export type ListViewProps<T = unknown, S = unknown> = BaseListViewProps & {
686
+ /** Data items to display in the list */
687
+ items?: ListItem<T, S>[];
700
688
  /** Function to render each list item. The `row` parameter provides tree state for hierarchical lists. */
701
- renderItem: (item: T | null, row?: Gtk.TreeListRow | null) => ReactNode;
689
+ renderItem: (item: T, row?: Gtk.TreeListRow | null) => ReactNode;
702
690
  /** Whether to automatically expand new tree rows (default: false) */
703
691
  autoexpand?: boolean;
704
- /** Function to render section headers when using ListSection children */
705
- renderHeader?: ((item: S | null) => ReactNode) | null;
692
+ /** Function to render section headers when items contain section entries */
693
+ renderHeader?: ((item: S) => ReactNode) | null;
706
694
  };
707
695
 
708
696
  export type GridViewProps<T = unknown> = BaseListViewProps & {
697
+ /** Data items to display in the grid */
698
+ items?: ListItem<T>[];
709
699
  /** Function to render each grid item */
710
- renderItem: (item: T | null) => ReactNode;
700
+ renderItem: (item: T) => ReactNode;
711
701
  };
712
702
 
713
703
  /**
714
704
  * Props shared by single-selection dropdown widgets (GtkDropDown, AdwComboRow).
715
705
  */
716
706
  export type DropDownProps<T = unknown, S = unknown> = {
707
+ /** Data items to display in the dropdown */
708
+ items?: ListItem<T, S>[];
717
709
  /** ID of the currently selected item */
718
710
  selectedId?: string | null;
719
711
  /** Callback fired when the selected item changes */
720
712
  onSelectionChanged?: ((id: string) => void) | null;
721
713
  /** Function to render each item. Sets the primary factory, used for both button and popup list unless overridden by renderListItem. */
722
- renderItem?: ((item: T | null) => ReactNode) | null;
714
+ renderItem?: ((item: T) => ReactNode) | null;
723
715
  /** Function to render items in the popup list only, overriding renderItem for the list. */
724
- renderListItem?: ((item: T | null) => ReactNode) | null;
725
- /** Function to render section headers when using ListSection children */
726
- renderHeader?: ((item: S | null) => ReactNode) | null;
716
+ renderListItem?: ((item: T) => ReactNode) | null;
717
+ /** Function to render section headers when items contain section entries */
718
+ renderHeader?: ((item: S) => ReactNode) | null;
727
719
  };
728
720
 
729
721
  /**
@@ -767,18 +759,13 @@ export type AdjustableProps = {
767
759
  *
768
760
  * @example
769
761
  * ```tsx
770
- * import { x, GtkHeaderBar, GtkDropDown } from "@gtkx/react";
762
+ * import { x, GtkHeaderBar } from "@gtkx/react";
771
763
  *
772
764
  * <GtkHeaderBar>
773
765
  * <x.Slot for={GtkHeaderBar} id="titleWidget">
774
766
  * <GtkLabel label="App Title" />
775
767
  * </x.Slot>
776
768
  * </GtkHeaderBar>
777
- *
778
- * <GtkDropDown>
779
- * <x.ListItem id="opt1" value="Option 1" />
780
- * <x.ListItem id="opt2" value="Option 2" />
781
- * </GtkDropDown>
782
769
  * ```
783
770
  */
784
771
  export const x = {
@@ -866,53 +853,6 @@ export const x = {
866
853
  */
867
854
  NotebookPageTab: "NotebookPageTab" as const,
868
855
 
869
- /**
870
- * Element type for items in a GtkListView, GtkGridView, or GtkColumnView.
871
- *
872
- * Items can be nested to create tree hierarchies inside a GtkListView.
873
- *
874
- * @example
875
- * ```tsx
876
- * // Flat list
877
- * <GtkListView renderItem={(item) => <GtkLabel label={item.name} />}>
878
- * <x.ListItem id="1" value={{ name: "Item 1" }} />
879
- * </GtkListView>
880
- *
881
- * // Tree list (nested items)
882
- * <GtkListView renderItem={(item, row) => <GtkLabel label={item.name} />} autoexpand>
883
- * <x.ListItem id="parent" value={{ name: "Parent" }}>
884
- * <x.ListItem id="child" value={{ name: "Child" }} />
885
- * </x.ListItem>
886
- * </GtkListView>
887
- * ```
888
- */
889
- ListItem<T = unknown>(props: ListItemProps<T>): ReactElement {
890
- return createElement("ListItem", props, props.children);
891
- },
892
-
893
- /**
894
- * Component for defining section headers in list/grid views.
895
- *
896
- * Wraps ListItems to group them into sections with headers.
897
- * Requires `renderHeader` on the parent view to render the header content.
898
- *
899
- * @example
900
- * ```tsx
901
- * <GtkGridView
902
- * renderItem={(item) => <GtkLabel label={item.name} />}
903
- * renderHeader={(header) => <GtkLabel label={header.title} />}
904
- * >
905
- * <x.ListSection id="section1" value={{ title: "Section 1" }}>
906
- * <x.ListItem id="a" value={{ name: "Item A" }} />
907
- * <x.ListItem id="b" value={{ name: "Item B" }} />
908
- * </x.ListSection>
909
- * </GtkGridView>
910
- * ```
911
- */
912
- ListSection<T = unknown>(props: ListSectionProps<T>): ReactElement {
913
- return createElement("ListSection", props, props.children);
914
- },
915
-
916
856
  /**
917
857
  * Component for defining columns in a ColumnView (table widget).
918
858
  *
@@ -1181,8 +1121,6 @@ declare global {
1181
1121
  ColumnViewColumn: ColumnViewColumnProps;
1182
1122
  FixedChild: FixedChildProps;
1183
1123
  GridChild: GridChildProps;
1184
- ListItem: ListItemProps;
1185
- ListSection: ListSectionProps;
1186
1124
  MenuItem: MenuItemProps;
1187
1125
  MenuSection: MenuSectionProps;
1188
1126
  MenuSubmenu: MenuSubmenuProps;
@@ -1316,6 +1254,8 @@ declare module "./generated/jsx.js" {
1316
1254
  interface GtkGridViewProps extends GridViewProps {}
1317
1255
 
1318
1256
  interface GtkColumnViewProps {
1257
+ /** Data items to display in the column view */
1258
+ items?: ListItem[];
1319
1259
  /** Array of selected row IDs */
1320
1260
  selected?: string[] | null;
1321
1261
  /** Callback fired when the selection changes */
@@ -1330,7 +1270,7 @@ declare module "./generated/jsx.js" {
1330
1270
  onSortChanged?: ((column: string | null, order: Gtk.SortType) => void) | null;
1331
1271
  /** Estimated row height in pixels for virtualization */
1332
1272
  estimatedRowHeight?: number | null;
1333
- /** Function to render section headers when using ListSection children */
1273
+ /** Function to render section headers when items contain section entries */
1334
1274
  renderHeader?: ((item: unknown) => ReactNode) | null;
1335
1275
  }
1336
1276
 
@@ -1411,37 +1351,5 @@ declare module "./generated/jsx.js" {
1411
1351
  }
1412
1352
  }
1413
1353
 
1414
- export function GtkListView<T = unknown, S = unknown>(
1415
- props: Omit<IntrinsicGtkListViewProps, keyof ListViewProps> & ListViewProps<T, S> & { children?: ReactNode },
1416
- ): ReactElement {
1417
- return createElement("GtkListView", props);
1418
- }
1419
-
1420
- export function GtkGridView<T = unknown>(
1421
- props: Omit<IntrinsicGtkGridViewProps, keyof GridViewProps> & GridViewProps<T> & { children?: ReactNode },
1422
- ): ReactElement {
1423
- return createElement("GtkGridView", props);
1424
- }
1425
-
1426
- export function GtkDropDown<T = unknown, S = unknown>(
1427
- props: Omit<IntrinsicGtkDropDownProps, keyof DropDownProps> & DropDownProps<T, S> & { children?: ReactNode },
1428
- ): ReactElement {
1429
- return createElement("GtkDropDown", props);
1430
- }
1431
-
1432
- export function AdwComboRow<T = unknown, S = unknown>(
1433
- props: Omit<IntrinsicAdwComboRowProps, keyof DropDownProps> & DropDownProps<T, S> & { children?: ReactNode },
1434
- ): ReactElement {
1435
- return createElement("AdwComboRow", props);
1436
- }
1437
-
1438
- export function GtkColumnView<T = unknown>(
1439
- props: Omit<IntrinsicGtkColumnViewProps, "renderHeader"> & {
1440
- renderHeader?: ((item: T | null) => ReactNode) | null;
1441
- children?: ReactNode;
1442
- },
1443
- ): ReactElement {
1444
- return createElement("GtkColumnView", props);
1445
- }
1446
-
1354
+ export { AdwComboRow, GtkColumnView, GtkDropDown, GtkGridView, GtkListView } from "./components/list.js";
1447
1355
  export * from "./generated/jsx.js";
package/src/metadata.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { NativeClass } from "@gtkx/ffi";
2
- import { CONSTRUCT_ONLY_PROPS, PROPS, SIGNALS } from "./generated/internal.js";
2
+ import { CONSTRUCTION_META, PROPS, SIGNALS } from "./generated/internal.js";
3
3
  import type { Container } from "./types.js";
4
4
 
5
5
  const walkPrototypeChain = <T>(instance: Container, lookup: (typeName: string) => T | null): T | null => {
@@ -31,8 +31,11 @@ export const resolvePropMeta = (instance: Container, key: string): [string | nul
31
31
  walkPrototypeChain(instance, (typeName) => PROPS[typeName]?.[key] ?? null);
32
32
 
33
33
  export const isConstructOnlyProp = (instance: Container, key: string): boolean =>
34
- walkPrototypeChain(instance, (typeName) => (CONSTRUCT_ONLY_PROPS[typeName]?.[key] !== undefined ? true : null)) ??
35
- false;
34
+ walkPrototypeChain(instance, (typeName) => {
35
+ const meta = CONSTRUCTION_META[typeName];
36
+ if (!meta || !(key in meta)) return null;
37
+ return meta[key]?.constructOnly === true;
38
+ }) ?? false;
36
39
 
37
40
  export const resolveSignal = (instance: Container, propName: string): string | null => {
38
41
  if (propName === "onNotify") return "notify";