@gtkx/components 2.0.0-beta.11 → 2.0.0-beta.13

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 (92) hide show
  1. package/README.md +4 -4
  2. package/dist/column-view.d.ts.map +1 -1
  3. package/dist/column-view.js +8 -4
  4. package/dist/column-view.js.map +1 -1
  5. package/dist/combo-row.d.ts.map +1 -1
  6. package/dist/combo-row.js +3 -1
  7. package/dist/combo-row.js.map +1 -1
  8. package/dist/grid-view.d.ts.map +1 -1
  9. package/dist/grid-view.js +4 -3
  10. package/dist/grid-view.js.map +1 -1
  11. package/dist/internal/cells.d.ts +8 -9
  12. package/dist/internal/cells.d.ts.map +1 -1
  13. package/dist/internal/cells.js +98 -83
  14. package/dist/internal/cells.js.map +1 -1
  15. package/dist/internal/collection-index.d.ts +3 -5
  16. package/dist/internal/collection-index.d.ts.map +1 -1
  17. package/dist/internal/collection-index.js +3 -7
  18. package/dist/internal/collection-index.js.map +1 -1
  19. package/dist/internal/collection-model.d.ts +15 -4
  20. package/dist/internal/collection-model.d.ts.map +1 -1
  21. package/dist/internal/collection-model.js +154 -73
  22. package/dist/internal/collection-model.js.map +1 -1
  23. package/dist/internal/collection.d.ts +3 -3
  24. package/dist/internal/collection.d.ts.map +1 -1
  25. package/dist/internal/collection.js +11 -9
  26. package/dist/internal/collection.js.map +1 -1
  27. package/dist/internal/controlled-sync.d.ts +2 -1
  28. package/dist/internal/controlled-sync.d.ts.map +1 -1
  29. package/dist/internal/controlled-sync.js +6 -1
  30. package/dist/internal/controlled-sync.js.map +1 -1
  31. package/dist/internal/drop-down.d.ts +10 -4
  32. package/dist/internal/drop-down.d.ts.map +1 -1
  33. package/dist/internal/drop-down.js +61 -9
  34. package/dist/internal/drop-down.js.map +1 -1
  35. package/dist/internal/expansion.d.ts.map +1 -1
  36. package/dist/internal/expansion.js +46 -19
  37. package/dist/internal/expansion.js.map +1 -1
  38. package/dist/internal/first-header.d.ts +11 -0
  39. package/dist/internal/first-header.d.ts.map +1 -0
  40. package/dist/internal/first-header.js +21 -0
  41. package/dist/internal/first-header.js.map +1 -0
  42. package/dist/internal/keys.d.ts.map +1 -1
  43. package/dist/internal/level-splice.d.ts +27 -0
  44. package/dist/internal/level-splice.d.ts.map +1 -0
  45. package/dist/internal/level-splice.js +98 -0
  46. package/dist/internal/level-splice.js.map +1 -0
  47. package/dist/internal/selection.d.ts.map +1 -1
  48. package/dist/internal/selection.js +23 -16
  49. package/dist/internal/selection.js.map +1 -1
  50. package/dist/internal/tree-expansion.d.ts +3 -1
  51. package/dist/internal/tree-expansion.d.ts.map +1 -1
  52. package/dist/internal/tree-expansion.js +31 -2
  53. package/dist/internal/tree-expansion.js.map +1 -1
  54. package/dist/internal/tree-order.d.ts +2 -1
  55. package/dist/internal/tree-order.d.ts.map +1 -1
  56. package/dist/internal/tree-order.js +3 -2
  57. package/dist/internal/tree-order.js.map +1 -1
  58. package/dist/internal/use-collection.d.ts +1 -0
  59. package/dist/internal/use-collection.d.ts.map +1 -1
  60. package/dist/internal/use-collection.js +6 -2
  61. package/dist/internal/use-collection.js.map +1 -1
  62. package/dist/internal/use-widget-ref.d.ts.map +1 -1
  63. package/dist/list-item-factory.d.ts +1 -1
  64. package/dist/list-item-factory.d.ts.map +1 -1
  65. package/dist/list-item-factory.js +3 -3
  66. package/dist/list-item-factory.js.map +1 -1
  67. package/dist/list-view.d.ts.map +1 -1
  68. package/dist/list-view.js +9 -4
  69. package/dist/list-view.js.map +1 -1
  70. package/dist/types.d.ts +35 -12
  71. package/dist/types.d.ts.map +1 -1
  72. package/dist/types.js.map +1 -1
  73. package/package.json +10 -20
  74. package/src/column-view.tsx +8 -4
  75. package/src/combo-row.tsx +4 -1
  76. package/src/grid-view.tsx +3 -2
  77. package/src/internal/cells.tsx +174 -151
  78. package/src/internal/collection-index.ts +7 -14
  79. package/src/internal/collection-model.ts +211 -76
  80. package/src/internal/collection.ts +14 -13
  81. package/src/internal/controlled-sync.ts +8 -1
  82. package/src/internal/drop-down.tsx +112 -19
  83. package/src/internal/expansion.ts +52 -20
  84. package/src/internal/first-header.ts +23 -0
  85. package/src/internal/level-splice.ts +157 -0
  86. package/src/internal/selection.tsx +24 -19
  87. package/src/internal/tree-expansion.ts +43 -1
  88. package/src/internal/tree-order.ts +4 -10
  89. package/src/internal/use-collection.tsx +8 -2
  90. package/src/list-item-factory.tsx +2 -1
  91. package/src/list-view.tsx +10 -2
  92. package/src/types.ts +54 -24
package/dist/list-view.js CHANGED
@@ -1,14 +1,17 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { GtkListView, GtkSignalListItemFactory } from "@gtkx/jsx/gtk";
3
3
  import { omit } from "@gtkx/utils";
4
4
  import { ItemPortals, useItemCells, useSectionHeader } from "./internal/cells.js";
5
+ import { showFirstHeader } from "./internal/first-header.js";
5
6
  import { useCollection } from "./internal/use-collection.js";
7
+ import { useWidgetRef } from "./internal/use-widget-ref.js";
6
8
  const LIST_VIEW_PROPS = [
7
9
  "items",
8
10
  "sections",
9
11
  "isFlat",
10
12
  "renderItem",
11
13
  "renderHeader",
14
+ "rowProps",
12
15
  "selectedIds",
13
16
  "onSelectionChanged",
14
17
  "selectionMode",
@@ -17,20 +20,22 @@ const LIST_VIEW_PROPS = [
17
20
  "expanderDescriptions",
18
21
  "estimatedItemHeight",
19
22
  "estimatedItemWidth",
23
+ "ref",
20
24
  ];
21
25
  /**
22
26
  * Renders a Gtk.ListView from declarative items or sections, with per-row rendering,
23
27
  * controlled selection, controlled tree expansion, and estimated item sizing.
24
28
  */
25
29
  function ListView(props) {
26
- const { renderItem, renderHeader, expandedIds, expanderDescriptions } = props;
30
+ const { renderItem, renderHeader, rowProps, expandedIds, expanderDescriptions, ref } = props;
27
31
  const { estimatedItemHeight, estimatedItemWidth } = props;
28
32
  const rest = omit(props, LIST_VIEW_PROPS);
29
33
  const size = { width: estimatedItemWidth ?? -1, height: estimatedItemHeight ?? -1 };
30
- const { collection, selection } = useCollection(props);
34
+ const [view, refCallback] = useWidgetRef(ref);
35
+ const { collection, selection } = useCollection({ ...props, onSectionsFilled: () => showFirstHeader(view) });
31
36
  const itemCells = useItemCells(size);
32
37
  const header = useSectionHeader(renderHeader, collection, size);
33
- return (_jsxs(_Fragment, { children: [_jsx(GtkListView, { model: selection, factory: _jsx(GtkSignalListItemFactory, { ...itemCells.handlers }), ...header.factoryProps, ...rest }), _jsx(ItemPortals, { registry: itemCells, render: renderItem, collection: collection, expandedIds: expandedIds, expanderDescriptions: expanderDescriptions }), header.portals] }));
38
+ return (_jsxs(_Fragment, { children: [_jsx(GtkListView, { ref: refCallback, model: selection, factory: _jsx(GtkSignalListItemFactory, { ...itemCells.handlers }), ...header.factoryProps, ...rest }), _jsx(ItemPortals, { registry: itemCells, render: renderItem, rowProps: rowProps, collection: collection, expandedIds: expandedIds, expanderDescriptions: expanderDescriptions }), header.portals] }));
34
39
  }
35
40
  export { ListView };
36
41
  //# sourceMappingURL=list-view.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"list-view.js","sourceRoot":"","sources":["../src/list-view.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AACtE,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAClF,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,MAAM,eAAe,GAAG;IACpB,OAAO;IACP,UAAU;IACV,QAAQ;IACR,YAAY;IACZ,cAAc;IACd,aAAa;IACb,oBAAoB;IACpB,eAAe;IACf,aAAa;IACb,kBAAkB;IAClB,sBAAsB;IACtB,qBAAqB;IACrB,oBAAoB;CACoB,CAAC;AAE7C;;;GAGG;AACH,SAAS,QAAQ,CAA2B,KAA0B;IAClE,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,oBAAoB,EAAE,GAAG,KAAK,CAAC;IAC9E,MAAM,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,GAAG,KAAK,CAAC;IAC1D,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC;IAC1C,MAAM,IAAI,GAAG,EAAE,KAAK,EAAE,kBAAkB,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,mBAAmB,IAAI,CAAC,CAAC,EAAE,CAAC;IACpF,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;IACvD,MAAM,SAAS,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IACrC,MAAM,MAAM,GAAG,gBAAgB,CAAC,YAAY,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC;IAEhE,OAAO,CACH,8BACI,KAAC,WAAW,IACR,KAAK,EAAE,SAAS,EAChB,OAAO,EAAE,KAAC,wBAAwB,OAAK,SAAS,CAAC,QAAQ,GAAI,KACzD,MAAM,CAAC,YAAY,KACnB,IAAI,GACV,EACF,KAAC,WAAW,IACR,QAAQ,EAAE,SAAS,EACnB,MAAM,EAAE,UAAU,EAClB,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE,WAAW,EACxB,oBAAoB,EAAE,oBAAoB,GAC5C,EACD,MAAM,CAAC,OAAO,IAChB,CACN,CAAC;AACN,CAAC;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC","sourcesContent":["import type { ReactNode } from \"react\";\nimport { GtkListView, GtkSignalListItemFactory } from \"@gtkx/jsx/gtk\";\nimport { omit } from \"@gtkx/utils\";\nimport type { ListViewProps } from \"./types.js\";\nimport { ItemPortals, useItemCells, useSectionHeader } from \"./internal/cells.js\";\nimport { useCollection } from \"./internal/use-collection.js\";\n\nconst LIST_VIEW_PROPS = [\n \"items\",\n \"sections\",\n \"isFlat\",\n \"renderItem\",\n \"renderHeader\",\n \"selectedIds\",\n \"onSelectionChanged\",\n \"selectionMode\",\n \"expandedIds\",\n \"onExpandedChange\",\n \"expanderDescriptions\",\n \"estimatedItemHeight\",\n \"estimatedItemWidth\",\n] as const satisfies (keyof ListViewProps)[];\n\n/**\n * Renders a Gtk.ListView from declarative items or sections, with per-row rendering,\n * controlled selection, controlled tree expansion, and estimated item sizing.\n */\nfunction ListView<T = unknown, S = unknown>(props: ListViewProps<T, S>): ReactNode {\n const { renderItem, renderHeader, expandedIds, expanderDescriptions } = props;\n const { estimatedItemHeight, estimatedItemWidth } = props;\n const rest = omit(props, LIST_VIEW_PROPS);\n const size = { width: estimatedItemWidth ?? -1, height: estimatedItemHeight ?? -1 };\n const { collection, selection } = useCollection(props);\n const itemCells = useItemCells(size);\n const header = useSectionHeader(renderHeader, collection, size);\n\n return (\n <>\n <GtkListView\n model={selection}\n factory={<GtkSignalListItemFactory {...itemCells.handlers} />}\n {...header.factoryProps}\n {...rest}\n />\n <ItemPortals\n registry={itemCells}\n render={renderItem}\n collection={collection}\n expandedIds={expandedIds}\n expanderDescriptions={expanderDescriptions}\n />\n {header.portals}\n </>\n );\n}\n\nexport { ListView };\n"]}
1
+ {"version":3,"file":"list-view.js","sourceRoot":"","sources":["../src/list-view.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,WAAW,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AACtE,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE5D,MAAM,eAAe,GAAG;IACpB,OAAO;IACP,U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AAQ,EAAE,QAAQ,EAClB,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE,WAAW,EACxB,oBAAoB,EAAE,oBAAoB,GAC5C,EACD,MAAM,CAAC,OAAO,IAChB,CACN,CAAC;AACN,CAAC;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC","sourcesContent":["import type * as Gtk from \"@gtkx/gi/gtk\";\nimport type { ReactNode } from \"react\";\nimport { GtkListView, GtkSignalListItemFactory } from \"@gtkx/jsx/gtk\";\nimport { omit } from \"@gtkx/utils\";\nimport type { ListViewProps } from \"./types.js\";\nimport { ItemPortals, useItemCells, useSectionHeader } from \"./internal/cells.js\";\nimport { showFirstHeader } from \"./internal/first-header.js\";\nimport { useCollection } from \"./internal/use-collection.js\";\nimport { useWidgetRef } from \"./internal/use-widget-ref.js\";\n\nconst LIST_VIEW_PROPS = [\n \"items\",\n \"sections\",\n \"isFlat\",\n \"renderItem\",\n \"renderHeader\",\n \"rowProps\",\n \"selectedIds\",\n \"onSelectionChanged\",\n \"selectionMode\",\n \"expandedIds\",\n \"onExpandedChange\",\n \"expanderDescriptions\",\n \"estimatedItemHeight\",\n \"estimatedItemWidth\",\n \"ref\",\n] as const satisfies (keyof ListViewProps)[];\n\n/**\n * Renders a Gtk.ListView from declarative items or sections, with per-row rendering,\n * controlled selection, controlled tree expansion, and estimated item sizing.\n */\nfunction ListView<T = unknown, S = unknown>(props: ListViewProps<T, S>): ReactNode {\n const { renderItem, renderHeader, rowProps, expandedIds, expanderDescriptions, ref } = props;\n const { estimatedItemHeight, estimatedItemWidth } = props;\n const rest = omit(props, LIST_VIEW_PROPS);\n const size = { width: estimatedItemWidth ?? -1, height: estimatedItemHeight ?? -1 };\n const [view, refCallback] = useWidgetRef<Gtk.ListView>(ref);\n const { collection, selection } = useCollection({ ...props, onSectionsFilled: () => showFirstHeader(view) });\n const itemCells = useItemCells(size);\n const header = useSectionHeader(renderHeader, collection, size);\n\n return (\n <>\n <GtkListView\n ref={refCallback}\n model={selection}\n factory={<GtkSignalListItemFactory {...itemCells.handlers} />}\n {...header.factoryProps}\n {...rest}\n />\n <ItemPortals\n registry={itemCells}\n render={renderItem}\n rowProps={rowProps}\n collection={collection}\n expandedIds={expandedIds}\n expanderDescriptions={expanderDescriptions}\n />\n {header.portals}\n </>\n );\n}\n\nexport { ListView };\n"]}
package/dist/types.d.ts CHANGED
@@ -10,7 +10,10 @@ import type { ReactNode, RefObject } from "react";
10
10
  * arbitrary value. Nested items form a tree.
11
11
  */
12
12
  type ListItem<T = unknown> = {
13
- /** Stable identifier, unique across the collection, used to preserve identity across updates and selection. */
13
+ /**
14
+ * Stable identifier that names the item in selection and expansion, so keep it unique across the collection.
15
+ * A row keeps its component state while its id stays among the same siblings.
16
+ */
14
17
  id: string;
15
18
  /** Payload handed to the cell renderer as `ListItemRenderArgs.item`. */
16
19
  value: T;
@@ -36,7 +39,10 @@ type ListSection<S = unknown, T = unknown> = {
36
39
  type ListItemRenderArgs<T> = {
37
40
  /** Value of the `ListItem` being rendered. */
38
41
  item: T;
39
- /** Position of the item in the flattened item list, which excludes section headers and collapsed tree rows. */
42
+ /**
43
+ * Position of the item in the flattened item list, which excludes section headers and collapsed tree rows.
44
+ * A drop-down popup filtered by `enableSearch` still passes this position, not the row's place in the results.
45
+ */
40
46
  index: number;
41
47
  /** Depth of the item within a tree, starting at zero for top-level items. */
42
48
  depth?: number | undefined;
@@ -44,9 +50,10 @@ type ListItemRenderArgs<T> = {
44
50
  isExpanded?: boolean | undefined;
45
51
  };
46
52
  /**
47
- * Properties applied to the row that carries one item's cells. A Gtk.ColumnViewRow is not a widget, so
48
- * these are the only handles it offers; anything omitted falls back to the row's own default, which
49
- * leaves the accessibility strings unset rather than setting them to an empty string.
53
+ * Properties applied to the row that carries one item: the Gtk.ListItem of a list or grid, or the
54
+ * Gtk.ColumnViewRow of a table. Neither is a widget, so these are the only handles they offer; anything
55
+ * omitted falls back to the row's own default, which leaves the accessibility strings unset rather than
56
+ * setting them to an empty string.
50
57
  */
51
58
  type ListRowProps = {
52
59
  /** Name a screen reader announces for the row, through `accessible-label`. */
@@ -80,6 +87,13 @@ type ItemSizeProps = {
80
87
  };
81
88
  type ListItemFactoryProps<T extends GObject.Object> = ItemSizeProps & {
82
89
  renderItem: ListItemRenderer<T>;
90
+ /** Resolves the props of the row carrying one model object, such as its screen-reader label. */
91
+ rowProps?: ListRowPropsResolver<T> | null | undefined;
92
+ };
93
+ /** Per-row properties shared by the collection views. */
94
+ type RowPropsProps<T> = {
95
+ /** Resolves the props of the row carrying one item, such as its screen-reader label. */
96
+ rowProps?: ListRowPropsResolver<T> | null | undefined;
83
97
  };
84
98
  /** The flat-collection hint shared by {@link ListView} and {@link ColumnView}. */
85
99
  type FlatnessProps = {
@@ -97,7 +111,10 @@ type SelectionProps = {
97
111
  * user's selection is adopted into it.
98
112
  */
99
113
  selectedIds?: string[] | null | undefined;
100
- /** Called with one id per selected row whenever the selection changes, and once on mount. */
114
+ /**
115
+ * Called with one id per selected row when the user or the widget changes the selection, or when an item
116
+ * `selectedIds` names is not in the collection; a `selectedIds` change is not reported back.
117
+ */
101
118
  onSelectionChanged?: ((ids: string[]) => void) | null | undefined;
102
119
  /** How much the user may select, one item at a time unless `MULTIPLE` or `NONE` is given. */
103
120
  selectionMode?: Gtk.SelectionMode | null | undefined;
@@ -120,7 +137,10 @@ type ExpansionProps = {
120
137
  * user's expansion is adopted into it.
121
138
  */
122
139
  expandedIds?: string[] | null | undefined;
123
- /** Called with one id per expanded row, in visible order, whenever expansion changes. */
140
+ /**
141
+ * Called with one id per expanded row, in visible order, when the user or the widget changes expansion, or
142
+ * when a row `expandedIds` names cannot expand; an `expandedIds` change is not reported back.
143
+ */
124
144
  onExpandedChange?: ((ids: string[]) => void) | null | undefined;
125
145
  /**
126
146
  * Wording announced for the expander of every row that can expand, describing what activating it does.
@@ -158,15 +178,18 @@ type ColumnViewColumn<T = unknown> = Omit<GtkColumnViewColumnProps, "factory" |
158
178
  renderCell: ListItemRenderer<T>;
159
179
  /** Makes the column header clickable, reporting the choice through `onSortChanged`. */
160
180
  isSortable?: boolean | undefined;
181
+ /**
182
+ * Draws the tree expander and depth indentation in this column. Without a visible column marked this way,
183
+ * the first visible column draws them.
184
+ */
185
+ hasExpander?: boolean | undefined;
161
186
  /** Menu element popped up as the column header's context menu, on a right-click. */
162
187
  headerMenu?: ReactNode;
163
188
  };
164
189
  /** The declarative collection props {@link ColumnView} adds on top of Gtk.ColumnView's own. */
165
- type ColumnViewOwnProps<T, S> = SelectionProps & ExpansionProps & SortProps & SourceProps<T, S> & FlatnessProps & Omit<ItemSizeProps, "estimatedItemWidth"> & {
190
+ type ColumnViewOwnProps<T, S> = SelectionProps & ExpansionProps & SortProps & SourceProps<T, S> & FlatnessProps & RowPropsProps<T> & Omit<ItemSizeProps, "estimatedItemWidth"> & {
166
191
  /** Columns to render, in order; each carries its own cell renderer. */
167
192
  columns: ColumnViewColumn<T>[];
168
- /** Resolves the props of the row carrying one item's cells, such as its screen-reader label. */
169
- rowProps?: ListRowPropsResolver<T> | null | undefined;
170
193
  };
171
194
  /**
172
195
  * Native `Gtk.ColumnView` props with declarative columns and collections, controlled selection, expansion, and sorting.
@@ -190,7 +213,7 @@ type DropDownWidgetProps<Widget, T, S> = Omit<Widget, "model" | "factory" | "lis
190
213
  */
191
214
  type DropDownProps<T = unknown, S = unknown> = DropDownWidgetProps<GtkDropDownProps, T, S>;
192
215
  /** The declarative collection props {@link GridView} adds on top of Gtk.GridView's own. */
193
- type GridViewOwnProps<T> = ItemSizeProps & SelectionProps & {
216
+ type GridViewOwnProps<T> = ItemSizeProps & SelectionProps & RowPropsProps<T> & {
194
217
  /** Items to render as cells; a grid is always flat, so `ListItem.children` is ignored. */
195
218
  items?: ListItem<T>[] | undefined;
196
219
  /** Renders the contents of one cell. */
@@ -201,7 +224,7 @@ type GridViewOwnProps<T> = ItemSizeProps & SelectionProps & {
201
224
  */
202
225
  type GridViewProps<T = unknown> = Omit<GtkGridViewProps, "model" | "factory" | keyof GridViewOwnProps<T>> & GridViewOwnProps<T>;
203
226
  /** The declarative collection props {@link ListView} adds on top of Gtk.ListView's own. */
204
- type ListViewOwnProps<T, S> = ItemSizeProps & SelectionProps & ExpansionProps & SourceProps<T, S> & FlatnessProps & {
227
+ type ListViewOwnProps<T, S> = ItemSizeProps & SelectionProps & ExpansionProps & SourceProps<T, S> & FlatnessProps & RowPropsProps<T> & {
205
228
  /** Renders the contents of one row. */
206
229
  renderItem: ListItemRenderer<T>;
207
230
  };
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,KAAK,OAAO,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,KAAK,GAAG,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,KAAK,EACR,wBAAwB,EACxB,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EACnB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElD;;;GAGG;AACH,KAAK,QAAQ,CAAC,CAAC,GAAG,OAAO,IAAI;IACzB,+GAA+G;IAC/G,EAAE,EAAE,MAAM,CAAC;IACX,wEAAwE;IACxE,KAAK,EAAE,CAAC,CAAC;IACT,mEAAmE;IACnE,QAAQ,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,SAAS,CAAC;IACrC,8FAA8F;IAC9F,kBAAkB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACzC,0FAA0F;IAC1F,oBAAoB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC3C,kFAAkF;IAClF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CAAC,EAAE,YAAY,KAAK,GAAG,CAAC,KAAK,CAAC;IAC5C,sDAAsD;IACtD,UAAU,EAAE,MAAM,IAAI,CAAC;CAC1B,CAAC;AAEF,uCAAuC;AACvC,KAAK,kBAAkB,GAAG;IACtB,sEAAsE;IACtE,UAAU,EAAE,SAAS,CAAC,GAAG,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;IAC/C,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;CACpC,CAAC;AAEF,OAAO,EACH,KAAK,cAAc,EACnB,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACnB,KAAK,SAAS,EACd,KAAK,gBAAgB,EACrB,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,KAAK,YAAY,EACjB,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,kBAAkB,GAC1B,CAAC"}
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAqSA,OAAO,EAwBN,CAAC","sourcesContent":["import type * as Adw from \"@gtkx/gi/adw\";\nimport type * as GObject from \"@gtkx/gi/gobject\";\nimport type * as Gtk from \"@gtkx/gi/gtk\";\nimport type { AdwComboRowProps, AdwToastProps } from \"@gtkx/jsx/adw\";\nimport type {\n GtkColumnViewColumnProps,\n GtkColumnViewProps,\n GtkDropDownProps,\n GtkGridViewProps,\n GtkListViewProps,\n} from \"@gtkx/jsx/gtk\";\nimport type { Primitive } from \"@gtkx/utils\";\nimport type { ReactNode, RefObject } from \"react\";\n\n/**\n * A single item in a collection model, identified by a stable id and holding an\n * arbitrary value. Nested items form a tree.\n */\ntype ListItem<T = unknown> = {\n /** Stable identifier, unique across the collection, used to preserve identity across updates and selection. */\n id: string;\n /** Payload handed to the cell renderer as `ListItemRenderArgs.item`. */\n value: T;\n /** Child items in an acyclic tree, read only as rows are drawn. */\n children?: ListItem<T>[] | undefined;\n /** Hides the tree expander arrow even when the item has children, through `hide-expander`. */\n shouldHideExpander?: boolean | undefined;\n /** Adds indentation matching the item's depth in the tree, through `indent-for-depth`. */\n shouldIndentForDepth?: boolean | undefined;\n /** Reserves indentation space for an expander icon, through `indent-for-icon`. */\n shouldIndentForIcon?: boolean | undefined;\n};\n\n/** A group of items rendered under a shared section header. */\ntype ListSection<S = unknown, T = unknown> = {\n /** Stable identifier, unique among sections, used to track the section across updates. */\n id: string;\n /** Payload handed to the section header renderer as `ListSectionRenderArgs.section`. */\n value: S;\n /** Items belonging to this section. */\n data: ListItem<T>[];\n};\n\n/** Arguments passed to a {@link ListItemRenderer} when rendering one cell. */\ntype ListItemRenderArgs<T> = {\n /** Value of the `ListItem` being rendered. */\n item: T;\n /** Position of the item in the flattened item list, which excludes section headers and collapsed tree rows. */\n index: number;\n /** Depth of the item within a tree, starting at zero for top-level items. */\n depth?: number | undefined;\n /** Whether the item is currently expanded in a tree view. */\n isExpanded?: boolean | undefined;\n};\n\n/**\n * Properties applied to the row that carries one item's cells. A Gtk.ColumnViewRow is not a widget, so\n * these are the only handles it offers; anything omitted falls back to the row's own default, which\n * leaves the accessibility strings unset rather than setting them to an empty string.\n */\ntype ListRowProps = {\n /** Name a screen reader announces for the row, through `accessible-label`. */\n accessibleLabel?: string | undefined;\n /** Longer description a screen reader announces for the row, through `accessible-description`. */\n accessibleDescription?: string | undefined;\n /** Whether activating the row emits the view's `activate` signal; rows are activatable by default. */\n isActivatable?: boolean | undefined;\n /** Whether the row takes keyboard focus; rows are focusable by default. */\n isFocusable?: boolean | undefined;\n /** Whether clicking or keying the row tries to select it; rows are selectable by default. */\n isSelectable?: boolean | undefined;\n};\n\n/** Arguments passed to a {@link ListSectionRenderer} when rendering one section header. */\ntype ListSectionRenderArgs<S> = {\n /** Value of the `ListSection` whose header is being rendered. */\n section: S;\n};\n\n/** Renders the contents of one cell of a collection view. */\ntype ListItemRenderer<T> = (args: ListItemRenderArgs<T>) => ReactNode;\n/** Renders the contents of one section header of a collection view. */\ntype ListSectionRenderer<S> = (args: ListSectionRenderArgs<S>) => ReactNode;\n/** Returns the {@link ListRowProps} to apply to the row displaying one item, re-run whenever the item renders. */\ntype ListRowPropsResolver<T> = (args: ListItemRenderArgs<T>) => ListRowProps;\n\n/** Size a collection view requests for each cell before its contents render, keeping scroll estimates steady. */\ntype ItemSizeProps = {\n /** Height in pixels every cell asks for until its contents render; unset lets each cell size itself. */\n estimatedItemHeight?: number | undefined;\n /** Width in pixels every cell asks for until its contents render; unset lets each cell size itself. */\n estimatedItemWidth?: number | undefined;\n};\n\ntype ListItemFactoryProps<T extends GObject.Object> = ItemSizeProps & {\n renderItem: ListItemRenderer<T>;\n};\n\n/** The flat-collection hint shared by {@link ListView} and {@link ColumnView}. */\ntype FlatnessProps = {\n /**\n * Declares every item a leaf, so the view skips tree discovery when synchronising a large collection\n * instead of scanning each item for `children`. Must not be set when any item has children: those\n * items would render as plain rows that never expand.\n */\n isFlat?: boolean | undefined;\n};\n\n/** Controlled selection shared by the multi-item collection views. */\ntype SelectionProps = {\n /**\n * Ids of the items to keep selected; omitting it keeps nothing selected, and `onSelectionChanged` is how a\n * user's selection is adopted into it.\n */\n selectedIds?: string[] | null | undefined;\n /** Called with one id per selected row whenever the selection changes, and once on mount. */\n onSelectionChanged?: ((ids: string[]) => void) | null | undefined;\n /** How much the user may select, one item at a time unless `MULTIPLE` or `NONE` is given. */\n selectionMode?: Gtk.SelectionMode | null | undefined;\n};\n\n/**\n * Wording a screen reader announces for the control that expands and collapses a row. GTK names that control\n * after the row's own content and reports whether it is expanded, but says nothing about what activating it\n * does, so these strings supply that and belong in the application's own language.\n */\ntype ExpanderDescriptions = {\n /** Announced while the row is collapsed, such as \"Expand\". */\n expand: string;\n /** Announced while the row is expanded, such as \"Collapse\". */\n collapse: string;\n};\n\n/** Controlled expansion for the views that turn nested `ListItem.children` into a tree. */\ntype ExpansionProps = {\n /**\n * Ids of the items to keep expanded; omitting it keeps every row collapsed, and `onExpandedChange` is how a\n * user's expansion is adopted into it.\n */\n expandedIds?: string[] | null | undefined;\n /** Called with one id per expanded row, in visible order, whenever expansion changes. */\n onExpandedChange?: ((ids: string[]) => void) | null | undefined;\n /**\n * Wording announced for the expander of every row that can expand, describing what activating it does.\n * Omitting it leaves those expanders described only by the row they carry, and rows that cannot expand or\n * that hide their expander are never described.\n */\n expanderDescriptions?: ExpanderDescriptions | null | undefined;\n};\n\n/** Controlled sorting for the views whose headers can sort the collection. */\ntype SortProps = {\n /** Id of the column the view is sorted by, making sorting controlled. */\n sortColumn?: string | null | undefined;\n /** Direction `sortColumn` is sorted in, defaulting to ascending. */\n sortOrder?: Gtk.SortType | null | undefined;\n /** Called when the user sorts from a header, with the primary column's id, or null, and its order. */\n onSortChanged?: ((column: string | null, order: Gtk.SortType) => void) | null | undefined;\n};\n\n/** The data a collection view renders, either as a plain item list or grouped into sections. */\ntype SourceProps<T, S> = ({\n /** Items to render, nesting through `ListItem.children` for a tree. */\n items?: ListItem<T>[] | undefined;\n} & Partial<Record<\"sections\", undefined>> & Partial<Record<\"renderHeader\", null | undefined>>) | ({\n /** Items grouped under section headers. */\n sections: ListSection<S, T>[];\n /** Renders the header shown above each section. */\n renderHeader?: ListSectionRenderer<S> | null | undefined;\n} & Partial<Record<\"items\", undefined>>);\n\n/** One column of a {@link ColumnView}, pairing Gtk.ColumnViewColumn props with a cell renderer. */\ntype ColumnViewColumn<T = unknown> = Omit<GtkColumnViewColumnProps, \"factory\" | \"sorter\" | \"id\" | \"title\"> & {\n /** Stable identifier, also used to address the column through sorting props. */\n id: string;\n /** Text shown in the column header. */\n title: string;\n /** Renders the contents of this column's cell for one item. */\n renderCell: ListItemRenderer<T>;\n /** Makes the column header clickable, reporting the choice through `onSortChanged`. */\n isSortable?: boolean | undefined;\n /** Menu element popped up as the column header's context menu, on a right-click. */\n headerMenu?: ReactNode;\n};\n\n/** The declarative collection props {@link ColumnView} adds on top of Gtk.ColumnView's own. */\ntype ColumnViewOwnProps<T, S> = SelectionProps &\n ExpansionProps &\n SortProps &\n SourceProps<T, S> &\n FlatnessProps &\n Omit<ItemSizeProps, \"estimatedItemWidth\"> & {\n /** Columns to render, in order; each carries its own cell renderer. */\n columns: ColumnViewColumn<T>[];\n /** Resolves the props of the row carrying one item's cells, such as its screen-reader label. */\n rowProps?: ListRowPropsResolver<T> | null | undefined;\n };\n\n/**\n * Native `Gtk.ColumnView` props with declarative columns and collections, controlled selection, expansion, and sorting.\n */\ntype ColumnViewProps<T = unknown, S = unknown> = Omit<\n GtkColumnViewProps,\n \"children\" | \"columns\" | \"model\" | \"headerFactory\" | \"rowFactory\" | keyof ColumnViewOwnProps<T, S>\n> &\nColumnViewOwnProps<T, S>;\n\n/** The declarative collection props {@link DropDown} and `ComboRow` add on top of their widget's own. */\ntype DropDownOwnProps<T, S> = SourceProps<T, S> & {\n /** Id of the currently selected item, making the selection controlled. */\n selectedId?: string | undefined;\n /** Called with the selected id, or `null` when the model becomes empty. */\n onSelectionChanged?: ((id: string | null) => void) | null | undefined;\n /** Renders the collapsed display and, unless overridden, the popup rows. Required for non-primitive values. */\n renderItem?: ListItemRenderer<T> | null | undefined;\n /** Renderer for items in the open popup list, falling back to renderItem when omitted. */\n renderListItem?: ListItemRenderer<T> | null | undefined;\n};\n\n/** A drop-down-shaped widget's props with its model and factories swapped for the declarative collection props. */\ntype DropDownWidgetProps<Widget, T, S> = Omit<\n Widget,\n \"model\" | \"factory\" | \"listFactory\" | \"headerFactory\" | keyof DropDownOwnProps<T, S>\n> &\nDropDownOwnProps<T, S> &\n(SourceProps<T & Primitive, S> | Record<\"renderItem\", ListItemRenderer<T>>);\n\n/**\n * Native `Gtk.DropDown` props with declarative collections, controlled selection, and display/popup renderers.\n */\ntype DropDownProps<T = unknown, S = unknown> = DropDownWidgetProps<GtkDropDownProps, T, S>;\n\n/** The declarative collection props {@link GridView} adds on top of Gtk.GridView's own. */\ntype GridViewOwnProps<T> = ItemSizeProps &\n SelectionProps & {\n /** Items to render as cells; a grid is always flat, so `ListItem.children` is ignored. */\n items?: ListItem<T>[] | undefined;\n /** Renders the contents of one cell. */\n renderItem: ListItemRenderer<T>;\n };\n\n/**\n * Native `Gtk.GridView` props with declarative cells, controlled selection, and estimated sizing.\n */\ntype GridViewProps<T = unknown> = Omit<GtkGridViewProps, \"model\" | \"factory\" | keyof GridViewOwnProps<T>> &\n GridViewOwnProps<T>;\n\n/** The declarative collection props {@link ListView} adds on top of Gtk.ListView's own. */\ntype ListViewOwnProps<T, S> = ItemSizeProps &\n SelectionProps &\n ExpansionProps &\n SourceProps<T, S> &\n FlatnessProps & {\n /** Renders the contents of one row. */\n renderItem: ListItemRenderer<T>;\n };\n\n/**\n * Native `Gtk.ListView` props with declarative rows and sections, controlled selection and expansion,\n * and estimated sizing.\n */\ntype ListViewProps<T = unknown, S = unknown> = Omit<\n GtkListViewProps,\n \"model\" | \"factory\" | \"headerFactory\" | keyof ListViewOwnProps<T, S>\n> &\nListViewOwnProps<T, S>;\n\n/**\n * Native `Adw.ComboRow` props with declarative collections, controlled selection, and display/popup renderers.\n */\ntype ComboRowProps<T = unknown, S = unknown> = DropDownWidgetProps<AdwComboRowProps, T, S>;\n/**\n * Describes a toast raised through {@link useToast}: the construct-time properties of an\n * `Adw.Toast` plus its `button-clicked` and `dismissed` handlers.\n */\ntype ToastOptions = Adw.ToastConstructorProps & Pick<AdwToastProps, \"onButtonClicked\" | \"onDismissed\">;\n\n/** Imperative controls for toasts, returned by {@link useToast}. */\ntype ToastController = {\n /** Builds a toast, shows it through the overlay, and returns it. */\n show: (options?: ToastOptions) => Adw.Toast;\n /** Dismisses the shown toast and every queued one. */\n dismissAll: () => void;\n};\n\n/** Props for {@link ToastProvider}. */\ntype ToastProviderProps = {\n /** Ref also given to the `AdwToastOverlay` the toasts appear over. */\n overlayRef: RefObject<Adw.ToastOverlay | null>;\n /** Subtree whose `useToast` calls target that overlay. */\n children?: ReactNode | undefined;\n};\n\nexport {\n type SelectionProps,\n type ExpanderDescriptions,\n type ExpansionProps,\n type SortProps,\n type DropDownOwnProps,\n type ListItem,\n type ListSection,\n type ListItemRenderArgs,\n type ListRowProps,\n type ListSectionRenderArgs,\n type ListItemRenderer,\n type ListItemFactoryProps,\n type ListRowPropsResolver,\n type ListSectionRenderer,\n type ColumnViewColumn,\n type ColumnViewProps,\n type DropDownProps,\n type GridViewProps,\n type ListViewProps,\n type ComboRowProps,\n type ToastOptions,\n type ToastController,\n type ToastProviderProps,\n};\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAmUA,OAAO,EAwBN,CAAC","sourcesContent":["import type * as Adw from \"@gtkx/gi/adw\";\nimport type * as GObject from \"@gtkx/gi/gobject\";\nimport type * as Gtk from \"@gtkx/gi/gtk\";\nimport type { AdwComboRowProps, AdwToastProps } from \"@gtkx/jsx/adw\";\nimport type {\n GtkColumnViewColumnProps,\n GtkColumnViewProps,\n GtkDropDownProps,\n GtkGridViewProps,\n GtkListViewProps,\n} from \"@gtkx/jsx/gtk\";\nimport type { Primitive } from \"@gtkx/utils\";\nimport type { ReactNode, RefObject } from \"react\";\n\n/**\n * A single item in a collection model, identified by a stable id and holding an\n * arbitrary value. Nested items form a tree.\n */\ntype ListItem<T = unknown> = {\n /**\n * Stable identifier that names the item in selection and expansion, so keep it unique across the collection.\n * A row keeps its component state while its id stays among the same siblings.\n */\n id: string;\n /** Payload handed to the cell renderer as `ListItemRenderArgs.item`. */\n value: T;\n /** Child items in an acyclic tree, read only as rows are drawn. */\n children?: ListItem<T>[] | undefined;\n /** Hides the tree expander arrow even when the item has children, through `hide-expander`. */\n shouldHideExpander?: boolean | undefined;\n /** Adds indentation matching the item's depth in the tree, through `indent-for-depth`. */\n shouldIndentForDepth?: boolean | undefined;\n /** Reserves indentation space for an expander icon, through `indent-for-icon`. */\n shouldIndentForIcon?: boolean | undefined;\n};\n\n/** A group of items rendered under a shared section header. */\ntype ListSection<S = unknown, T = unknown> = {\n /** Stable identifier, unique among sections, used to track the section across updates. */\n id: string;\n /** Payload handed to the section header renderer as `ListSectionRenderArgs.section`. */\n value: S;\n /** Items belonging to this section. */\n data: ListItem<T>[];\n};\n\n/** Arguments passed to a {@link ListItemRenderer} when rendering one cell. */\ntype ListItemRenderArgs<T> = {\n /** Value of the `ListItem` being rendered. */\n item: T;\n /**\n * Position of the item in the flattened item list, which excludes section headers and collapsed tree rows.\n * A drop-down popup filtered by `enableSearch` still passes this position, not the row's place in the results.\n */\n index: number;\n /** Depth of the item within a tree, starting at zero for top-level items. */\n depth?: number | undefined;\n /** Whether the item is currently expanded in a tree view. */\n isExpanded?: boolean | undefined;\n};\n\n/**\n * Properties applied to the row that carries one item: the Gtk.ListItem of a list or grid, or the\n * Gtk.ColumnViewRow of a table. Neither is a widget, so these are the only handles they offer; anything\n * omitted falls back to the row's own default, which leaves the accessibility strings unset rather than\n * setting them to an empty string.\n */\ntype ListRowProps = {\n /** Name a screen reader announces for the row, through `accessible-label`. */\n accessibleLabel?: string | undefined;\n /** Longer description a screen reader announces for the row, through `accessible-description`. */\n accessibleDescription?: string | undefined;\n /** Whether activating the row emits the view's `activate` signal; rows are activatable by default. */\n isActivatable?: boolean | undefined;\n /** Whether the row takes keyboard focus; rows are focusable by default. */\n isFocusable?: boolean | undefined;\n /** Whether clicking or keying the row tries to select it; rows are selectable by default. */\n isSelectable?: boolean | undefined;\n};\n\n/** Arguments passed to a {@link ListSectionRenderer} when rendering one section header. */\ntype ListSectionRenderArgs<S> = {\n /** Value of the `ListSection` whose header is being rendered. */\n section: S;\n};\n\n/** Renders the contents of one cell of a collection view. */\ntype ListItemRenderer<T> = (args: ListItemRenderArgs<T>) => ReactNode;\n/** Renders the contents of one section header of a collection view. */\ntype ListSectionRenderer<S> = (args: ListSectionRenderArgs<S>) => ReactNode;\n/** Returns the {@link ListRowProps} to apply to the row displaying one item, re-run whenever the item renders. */\ntype ListRowPropsResolver<T> = (args: ListItemRenderArgs<T>) => ListRowProps;\n\n/** Size a collection view requests for each cell before its contents render, keeping scroll estimates steady. */\ntype ItemSizeProps = {\n /** Height in pixels every cell asks for until its contents render; unset lets each cell size itself. */\n estimatedItemHeight?: number | undefined;\n /** Width in pixels every cell asks for until its contents render; unset lets each cell size itself. */\n estimatedItemWidth?: number | undefined;\n};\n\ntype ListItemFactoryProps<T extends GObject.Object> = ItemSizeProps & {\n renderItem: ListItemRenderer<T>;\n /** Resolves the props of the row carrying one model object, such as its screen-reader label. */\n rowProps?: ListRowPropsResolver<T> | null | undefined;\n};\n\n/** Per-row properties shared by the collection views. */\ntype RowPropsProps<T> = {\n /** Resolves the props of the row carrying one item, such as its screen-reader label. */\n rowProps?: ListRowPropsResolver<T> | null | undefined;\n};\n\n/** The flat-collection hint shared by {@link ListView} and {@link ColumnView}. */\ntype FlatnessProps = {\n /**\n * Declares every item a leaf, so the view skips tree discovery when synchronising a large collection\n * instead of scanning each item for `children`. Must not be set when any item has children: those\n * items would render as plain rows that never expand.\n */\n isFlat?: boolean | undefined;\n};\n\n/** Controlled selection shared by the multi-item collection views. */\ntype SelectionProps = {\n /**\n * Ids of the items to keep selected; omitting it keeps nothing selected, and `onSelectionChanged` is how a\n * user's selection is adopted into it.\n */\n selectedIds?: string[] | null | undefined;\n /**\n * Called with one id per selected row when the user or the widget changes the selection, or when an item\n * `selectedIds` names is not in the collection; a `selectedIds` change is not reported back.\n */\n onSelectionChanged?: ((ids: string[]) => void) | null | undefined;\n /** How much the user may select, one item at a time unless `MULTIPLE` or `NONE` is given. */\n selectionMode?: Gtk.SelectionMode | null | undefined;\n};\n\n/**\n * Wording a screen reader announces for the control that expands and collapses a row. GTK names that control\n * after the row's own content and reports whether it is expanded, but says nothing about what activating it\n * does, so these strings supply that and belong in the application's own language.\n */\ntype ExpanderDescriptions = {\n /** Announced while the row is collapsed, such as \"Expand\". */\n expand: string;\n /** Announced while the row is expanded, such as \"Collapse\". */\n collapse: string;\n};\n\n/** Controlled expansion for the views that turn nested `ListItem.children` into a tree. */\ntype ExpansionProps = {\n /**\n * Ids of the items to keep expanded; omitting it keeps every row collapsed, and `onExpandedChange` is how a\n * user's expansion is adopted into it.\n */\n expandedIds?: string[] | null | undefined;\n /**\n * Called with one id per expanded row, in visible order, when the user or the widget changes expansion, or\n * when a row `expandedIds` names cannot expand; an `expandedIds` change is not reported back.\n */\n onExpandedChange?: ((ids: string[]) => void) | null | undefined;\n /**\n * Wording announced for the expander of every row that can expand, describing what activating it does.\n * Omitting it leaves those expanders described only by the row they carry, and rows that cannot expand or\n * that hide their expander are never described.\n */\n expanderDescriptions?: ExpanderDescriptions | null | undefined;\n};\n\n/** Controlled sorting for the views whose headers can sort the collection. */\ntype SortProps = {\n /** Id of the column the view is sorted by, making sorting controlled. */\n sortColumn?: string | null | undefined;\n /** Direction `sortColumn` is sorted in, defaulting to ascending. */\n sortOrder?: Gtk.SortType | null | undefined;\n /** Called when the user sorts from a header, with the primary column's id, or null, and its order. */\n onSortChanged?: ((column: string | null, order: Gtk.SortType) => void) | null | undefined;\n};\n\n/** The data a collection view renders, either as a plain item list or grouped into sections. */\ntype SourceProps<T, S> =\n | ({\n /** Items to render, nesting through `ListItem.children` for a tree. */\n items?: ListItem<T>[] | undefined;\n } & Partial<Record<\"sections\", undefined>> &\n Partial<Record<\"renderHeader\", null | undefined>>)\n | ({\n /** Items grouped under section headers. */\n sections: ListSection<S, T>[];\n /** Renders the header shown above each section. */\n renderHeader?: ListSectionRenderer<S> | null | undefined;\n } & Partial<Record<\"items\", undefined>>);\n\n/** One column of a {@link ColumnView}, pairing Gtk.ColumnViewColumn props with a cell renderer. */\ntype ColumnViewColumn<T = unknown> = Omit<GtkColumnViewColumnProps, \"factory\" | \"sorter\" | \"id\" | \"title\"> & {\n /** Stable identifier, also used to address the column through sorting props. */\n id: string;\n /** Text shown in the column header. */\n title: string;\n /** Renders the contents of this column's cell for one item. */\n renderCell: ListItemRenderer<T>;\n /** Makes the column header clickable, reporting the choice through `onSortChanged`. */\n isSortable?: boolean | undefined;\n /**\n * Draws the tree expander and depth indentation in this column. Without a visible column marked this way,\n * the first visible column draws them.\n */\n hasExpander?: boolean | undefined;\n /** Menu element popped up as the column header's context menu, on a right-click. */\n headerMenu?: ReactNode;\n};\n\n/** The declarative collection props {@link ColumnView} adds on top of Gtk.ColumnView's own. */\ntype ColumnViewOwnProps<T, S> = SelectionProps &\n ExpansionProps &\n SortProps &\n SourceProps<T, S> &\n FlatnessProps &\n RowPropsProps<T> &\n Omit<ItemSizeProps, \"estimatedItemWidth\"> & {\n /** Columns to render, in order; each carries its own cell renderer. */\n columns: ColumnViewColumn<T>[];\n };\n\n/**\n * Native `Gtk.ColumnView` props with declarative columns and collections, controlled selection, expansion, and sorting.\n */\ntype ColumnViewProps<T = unknown, S = unknown> = Omit<\n GtkColumnViewProps,\n \"children\" | \"columns\" | \"model\" | \"headerFactory\" | \"rowFactory\" | keyof ColumnViewOwnProps<T, S>\n> &\n ColumnViewOwnProps<T, S>;\n\n/** The declarative collection props {@link DropDown} and `ComboRow` add on top of their widget's own. */\ntype DropDownOwnProps<T, S> = SourceProps<T, S> & {\n /** Id of the currently selected item, making the selection controlled. */\n selectedId?: string | undefined;\n /** Called with the selected id, or `null` when the model becomes empty. */\n onSelectionChanged?: ((id: string | null) => void) | null | undefined;\n /** Renders the collapsed display and, unless overridden, the popup rows. Required for non-primitive values. */\n renderItem?: ListItemRenderer<T> | null | undefined;\n /** Renderer for items in the open popup list, falling back to renderItem when omitted. */\n renderListItem?: ListItemRenderer<T> | null | undefined;\n};\n\n/** A drop-down-shaped widget's props with its model and factories swapped for the declarative collection props. */\ntype DropDownWidgetProps<Widget, T, S> = Omit<\n Widget,\n \"model\" | \"factory\" | \"listFactory\" | \"headerFactory\" | keyof DropDownOwnProps<T, S>\n> &\n DropDownOwnProps<T, S> &\n (SourceProps<T & Primitive, S> | Record<\"renderItem\", ListItemRenderer<T>>);\n\n/**\n * Native `Gtk.DropDown` props with declarative collections, controlled selection, and display/popup renderers.\n */\ntype DropDownProps<T = unknown, S = unknown> = DropDownWidgetProps<GtkDropDownProps, T, S>;\n\n/** The declarative collection props {@link GridView} adds on top of Gtk.GridView's own. */\ntype GridViewOwnProps<T> = ItemSizeProps &\n SelectionProps &\n RowPropsProps<T> & {\n /** Items to render as cells; a grid is always flat, so `ListItem.children` is ignored. */\n items?: ListItem<T>[] | undefined;\n /** Renders the contents of one cell. */\n renderItem: ListItemRenderer<T>;\n };\n\n/**\n * Native `Gtk.GridView` props with declarative cells, controlled selection, and estimated sizing.\n */\ntype GridViewProps<T = unknown> = Omit<GtkGridViewProps, \"model\" | \"factory\" | keyof GridViewOwnProps<T>> &\n GridViewOwnProps<T>;\n\n/** The declarative collection props {@link ListView} adds on top of Gtk.ListView's own. */\ntype ListViewOwnProps<T, S> = ItemSizeProps &\n SelectionProps &\n ExpansionProps &\n SourceProps<T, S> &\n FlatnessProps &\n RowPropsProps<T> & {\n /** Renders the contents of one row. */\n renderItem: ListItemRenderer<T>;\n };\n\n/**\n * Native `Gtk.ListView` props with declarative rows and sections, controlled selection and expansion,\n * and estimated sizing.\n */\ntype ListViewProps<T = unknown, S = unknown> = Omit<\n GtkListViewProps,\n \"model\" | \"factory\" | \"headerFactory\" | keyof ListViewOwnProps<T, S>\n> &\n ListViewOwnProps<T, S>;\n\n/**\n * Native `Adw.ComboRow` props with declarative collections, controlled selection, and display/popup renderers.\n */\ntype ComboRowProps<T = unknown, S = unknown> = DropDownWidgetProps<AdwComboRowProps, T, S>;\n/**\n * Describes a toast raised through {@link useToast}: the construct-time properties of an\n * `Adw.Toast` plus its `button-clicked` and `dismissed` handlers.\n */\ntype ToastOptions = Adw.ToastConstructorProps & Pick<AdwToastProps, \"onButtonClicked\" | \"onDismissed\">;\n\n/** Imperative controls for toasts, returned by {@link useToast}. */\ntype ToastController = {\n /** Builds a toast, shows it through the overlay, and returns it. */\n show: (options?: ToastOptions) => Adw.Toast;\n /** Dismisses the shown toast and every queued one. */\n dismissAll: () => void;\n};\n\n/** Props for {@link ToastProvider}. */\ntype ToastProviderProps = {\n /** Ref also given to the `AdwToastOverlay` the toasts appear over. */\n overlayRef: RefObject<Adw.ToastOverlay | null>;\n /** Subtree whose `useToast` calls target that overlay. */\n children?: ReactNode | undefined;\n};\n\nexport {\n type SelectionProps,\n type ExpanderDescriptions,\n type ExpansionProps,\n type SortProps,\n type DropDownOwnProps,\n type ListItem,\n type ListSection,\n type ListItemRenderArgs,\n type ListRowProps,\n type ListSectionRenderArgs,\n type ListItemRenderer,\n type ListItemFactoryProps,\n type ListRowPropsResolver,\n type ListSectionRenderer,\n type ColumnViewColumn,\n type ColumnViewProps,\n type DropDownProps,\n type GridViewProps,\n type ListViewProps,\n type ComboRowProps,\n type ToastOptions,\n type ToastController,\n type ToastProviderProps,\n};\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gtkx/components",
3
- "version": "2.0.0-beta.11",
4
- "description": "Collection views, selection controls, and toasts for GTKX.",
3
+ "version": "2.0.0-beta.13",
4
+ "description": "Collection views, selection controls, tabs, and toasts for GTKX.",
5
5
  "keywords": [
6
6
  "gtkx",
7
7
  "gtk",
@@ -39,36 +39,26 @@
39
39
  "dist",
40
40
  "src"
41
41
  ],
42
- "nx": {
43
- "targets": {
44
- "lint": {
45
- "options": {
46
- "cwd": ".",
47
- "command": "eslint {projectRoot}"
48
- }
49
- }
50
- }
51
- },
52
42
  "engines": {
53
43
  "node": ">=26.7.0"
54
44
  },
55
45
  "dependencies": {
56
- "@gtkx/react": "2.0.0-beta.11",
57
- "@gtkx/runtime": "2.0.0-beta.11",
58
- "@gtkx/utils": "2.0.0-beta.11"
46
+ "@gtkx/react": "^2.0.0-beta.13",
47
+ "@gtkx/runtime": "^2.0.0-beta.13",
48
+ "@gtkx/utils": "^2.0.0-beta.13"
59
49
  },
60
50
  "peerDependencies": {
61
51
  "@types/react": "^19.3",
62
52
  "react": "^19.3"
63
53
  },
64
54
  "devDependencies": {
65
- "@gtkx/config": "2.0.0-beta.11",
66
- "@gtkx/testing": "2.0.0-beta.11",
67
- "@gtkx/vitest": "2.0.0-beta.11",
55
+ "@gtkx/config": "2.0.0-beta.13",
56
+ "@gtkx/testing": "2.0.0-beta.13",
57
+ "@gtkx/vitest": "2.0.0-beta.13",
68
58
  "@types/react": "^19.3.0",
69
- "vitest": "^5.0.1"
59
+ "vitest": "5.1.0"
70
60
  },
71
61
  "scripts": {
72
- "release": "tsx ../../scripts/release-package.ts"
62
+ "release": "node ../../scripts/release/publish-package.ts"
73
63
  }
74
64
  }
@@ -10,6 +10,7 @@ import type { ColumnViewColumn, ColumnViewProps, ExpanderDescriptions, SortProps
10
10
  import { ItemPortals, useItemCells, useRowProps, useSectionHeader } from "./internal/cells.js";
11
11
  import { useControlledSync } from "./internal/controlled-sync.js";
12
12
  import { useCollection } from "./internal/use-collection.js";
13
+ import { showFirstHeader } from "./internal/first-header.js";
13
14
  import { useWidgetRef } from "./internal/use-widget-ref.js";
14
15
 
15
16
  type SortTarget = { view: Gtk.ColumnView; column: Gtk.ColumnViewColumn | null };
@@ -48,8 +49,11 @@ const COLUMN_VIEW_PROPS = [
48
49
  "ref",
49
50
  ] as const satisfies (keyof ColumnViewProps)[];
50
51
 
51
- const expanderIndexFor = (columns: ColumnViewColumn<never>[]): number =>
52
- columns.findIndex((column) => column.visible !== false);
52
+ const expanderIndexFor = (columns: ColumnViewColumn<never>[]): number => {
53
+ const marked = columns.findIndex((column) => column.hasExpander === true && column.visible !== false);
54
+
55
+ return marked === -1 ? columns.findIndex((column) => column.visible !== false) : marked;
56
+ };
53
57
 
54
58
  const columnById = (view: Gtk.ColumnView, id: string): Gtk.ColumnViewColumn | null => {
55
59
  const columns = view.getColumns();
@@ -156,7 +160,7 @@ const ColumnCells = ({
156
160
  size,
157
161
  }: ColumnCellsProps): ReactNode => {
158
162
  const cells = useItemCells(size);
159
- const rest = omit(column, ["id", "renderCell", "isSortable"]);
163
+ const rest = omit(column, ["id", "renderCell", "isSortable", "hasExpander"]);
160
164
 
161
165
  return (
162
166
  <>
@@ -205,7 +209,7 @@ function ColumnView<T = unknown, S = unknown>(props: ColumnViewProps<T, S>): Rea
205
209
  const rest = omit(props, COLUMN_VIEW_PROPS);
206
210
  const size = { width: -1, height: props.estimatedItemHeight ?? -1 };
207
211
  const [view, refCallback] = useWidgetRef<Gtk.ColumnView>(ref);
208
- const { collection, selection } = useCollection(props);
212
+ const { collection, selection } = useCollection({ ...props, onSectionsFilled: () => showFirstHeader(view) });
209
213
  const header = useSectionHeader(renderHeader, collection, size);
210
214
  const rows = useRowProps(rowProps, collection, expandedIds);
211
215
  const columnList = columns as ColumnViewColumn<never>[];
package/src/combo-row.tsx CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { ReactNode } from "react";
2
+ import * as Pango from "@gtkx/gi/pango";
2
3
  import { AdwComboRow } from "@gtkx/jsx/adw";
3
4
  import type { DropDownBaseProps } from "./internal/drop-down.js";
4
5
  import type { ComboRowProps } from "./types.js";
@@ -14,8 +15,10 @@ type ComboRowComponent = <T = unknown, S = unknown>(props: ComboRowProps<T, S>)
14
15
  */
15
16
  const ComboRow: ComboRowComponent = ComboRowImpl as ComboRowComponent;
16
17
 
18
+ const ITEM_LABEL = { ellipsize: Pango.EllipsizeMode.END, maxWidthChars: 20, widthChars: 1 };
19
+
17
20
  function ComboRowImpl(props: DropDownBaseProps): ReactNode {
18
- return <DropDownBase {...props} component={AdwComboRow} />;
21
+ return <DropDownBase {...props} component={AdwComboRow} itemLabel={ITEM_LABEL} />;
19
22
  }
20
23
 
21
24
  export { ComboRow };
package/src/grid-view.tsx CHANGED
@@ -8,6 +8,7 @@ import { useCollection } from "./internal/use-collection.js";
8
8
  const GRID_VIEW_PROPS = [
9
9
  "items",
10
10
  "renderItem",
11
+ "rowProps",
11
12
  "selectedIds",
12
13
  "onSelectionChanged",
13
14
  "selectionMode",
@@ -20,7 +21,7 @@ const GRID_VIEW_PROPS = [
20
21
  * rendering, controlled selection, and estimated item sizing.
21
22
  */
22
23
  function GridView<T = unknown>(props: GridViewProps<T>): ReactNode {
23
- const { renderItem, estimatedItemHeight, estimatedItemWidth } = props;
24
+ const { renderItem, rowProps, estimatedItemHeight, estimatedItemWidth } = props;
24
25
  const rest = omit(props, GRID_VIEW_PROPS);
25
26
  const size = { width: estimatedItemWidth ?? -1, height: estimatedItemHeight ?? -1 };
26
27
  const { collection, selection } = useCollection({ ...props, isFlat: true });
@@ -29,7 +30,7 @@ function GridView<T = unknown>(props: GridViewProps<T>): ReactNode {
29
30
  return (
30
31
  <>
31
32
  <GtkGridView model={selection} factory={<GtkSignalListItemFactory {...itemCells.handlers} />} {...rest} />
32
- <ItemPortals registry={itemCells} render={renderItem} collection={collection} />
33
+ <ItemPortals registry={itemCells} render={renderItem} rowProps={rowProps} collection={collection} />
33
34
  </>
34
35
  );
35
36
  }