@gtkx/components 1.0.0-rc.3 → 1.0.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 (104) hide show
  1. package/README.md +8 -9
  2. package/dist/adw/combo-row.d.ts +1 -0
  3. package/dist/adw/combo-row.d.ts.map +1 -1
  4. package/dist/adw/combo-row.js.map +1 -1
  5. package/dist/adw/types.d.ts +2 -1
  6. package/dist/adw/types.d.ts.map +1 -1
  7. package/dist/adw/types.js.map +1 -1
  8. package/dist/column-view.d.ts +2 -2
  9. package/dist/column-view.d.ts.map +1 -1
  10. package/dist/column-view.js +15 -13
  11. package/dist/column-view.js.map +1 -1
  12. package/dist/drop-down.d.ts +1 -0
  13. package/dist/drop-down.d.ts.map +1 -1
  14. package/dist/drop-down.js.map +1 -1
  15. package/dist/grid-view.js +2 -2
  16. package/dist/grid-view.js.map +1 -1
  17. package/dist/index.d.ts +1 -2
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/index.js +0 -1
  20. package/dist/index.js.map +1 -1
  21. package/dist/internal/cells.d.ts +32 -24
  22. package/dist/internal/cells.d.ts.map +1 -1
  23. package/dist/internal/cells.js +168 -77
  24. package/dist/internal/cells.js.map +1 -1
  25. package/dist/internal/collection-index.d.ts +9 -13
  26. package/dist/internal/collection-index.d.ts.map +1 -1
  27. package/dist/internal/collection-index.js +33 -70
  28. package/dist/internal/collection-index.js.map +1 -1
  29. package/dist/internal/collection-model.d.ts +23 -2
  30. package/dist/internal/collection-model.d.ts.map +1 -1
  31. package/dist/internal/collection-model.js +210 -98
  32. package/dist/internal/collection-model.js.map +1 -1
  33. package/dist/internal/collection.d.ts +9 -12
  34. package/dist/internal/collection.d.ts.map +1 -1
  35. package/dist/internal/collection.js +38 -49
  36. package/dist/internal/collection.js.map +1 -1
  37. package/dist/internal/controlled-sync.d.ts +11 -0
  38. package/dist/internal/controlled-sync.d.ts.map +1 -0
  39. package/dist/internal/controlled-sync.js +19 -0
  40. package/dist/internal/controlled-sync.js.map +1 -0
  41. package/dist/internal/drop-down.d.ts.map +1 -1
  42. package/dist/internal/drop-down.js +27 -15
  43. package/dist/internal/drop-down.js.map +1 -1
  44. package/dist/internal/expansion.d.ts +3 -2
  45. package/dist/internal/expansion.d.ts.map +1 -1
  46. package/dist/internal/expansion.js +80 -47
  47. package/dist/internal/expansion.js.map +1 -1
  48. package/dist/internal/keys.d.ts +5 -0
  49. package/dist/internal/keys.d.ts.map +1 -0
  50. package/dist/internal/keys.js +13 -0
  51. package/dist/internal/keys.js.map +1 -0
  52. package/dist/internal/selection.d.ts +3 -2
  53. package/dist/internal/selection.d.ts.map +1 -1
  54. package/dist/internal/selection.js +68 -35
  55. package/dist/internal/selection.js.map +1 -1
  56. package/dist/internal/slots.d.ts +10 -0
  57. package/dist/internal/slots.d.ts.map +1 -0
  58. package/dist/internal/slots.js +43 -0
  59. package/dist/internal/slots.js.map +1 -0
  60. package/dist/internal/tree-expansion.d.ts +20 -0
  61. package/dist/internal/tree-expansion.d.ts.map +1 -0
  62. package/dist/internal/tree-expansion.js +68 -0
  63. package/dist/internal/tree-expansion.js.map +1 -0
  64. package/dist/internal/tree-order.d.ts +27 -0
  65. package/dist/internal/tree-order.d.ts.map +1 -0
  66. package/dist/internal/tree-order.js +71 -0
  67. package/dist/internal/tree-order.js.map +1 -0
  68. package/dist/internal/use-collection.d.ts +5 -5
  69. package/dist/internal/use-collection.d.ts.map +1 -1
  70. package/dist/internal/use-collection.js +6 -6
  71. package/dist/internal/use-collection.js.map +1 -1
  72. package/dist/list-view.d.ts.map +1 -1
  73. package/dist/list-view.js +6 -6
  74. package/dist/list-view.js.map +1 -1
  75. package/dist/types.d.ts +127 -54
  76. package/dist/types.d.ts.map +1 -1
  77. package/dist/types.js.map +1 -1
  78. package/package.json +7 -7
  79. package/src/adw/combo-row.tsx +1 -0
  80. package/src/adw/types.ts +2 -1
  81. package/src/column-view.tsx +38 -35
  82. package/src/drop-down.tsx +1 -0
  83. package/src/grid-view.tsx +2 -2
  84. package/src/index.ts +10 -11
  85. package/src/internal/cells.tsx +345 -123
  86. package/src/internal/collection-index.ts +51 -99
  87. package/src/internal/collection-model.ts +259 -110
  88. package/src/internal/collection.ts +46 -68
  89. package/src/internal/controlled-sync.ts +34 -0
  90. package/src/internal/drop-down.tsx +44 -23
  91. package/src/internal/expansion.ts +104 -67
  92. package/src/internal/keys.ts +18 -0
  93. package/src/internal/selection.tsx +100 -51
  94. package/src/internal/slots.ts +67 -0
  95. package/src/internal/tree-expansion.ts +110 -0
  96. package/src/internal/tree-order.ts +138 -0
  97. package/src/internal/use-collection.tsx +11 -11
  98. package/src/list-view.tsx +14 -10
  99. package/src/types.ts +140 -65
  100. package/dist/size-group.d.ts +0 -12
  101. package/dist/size-group.d.ts.map +0 -1
  102. package/dist/size-group.js +0 -41
  103. package/dist/size-group.js.map +0 -1
  104. package/src/size-group.tsx +0 -77
package/dist/list-view.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { GtkListView, GtkSignalListItemFactory } from "@gtkx/jsx/gtk";
3
3
  import { omit } from "@gtkx/utils";
4
- import { HeaderPortals, ItemPortals, useHeaderCells, useItemCells } from "./internal/cells.js";
4
+ import { ItemPortals, useItemCells, useSectionHeader } from "./internal/cells.js";
5
5
  import { useCollection } from "./internal/use-collection.js";
6
6
  const LIST_VIEW_PROPS = [
7
7
  "items",
@@ -13,6 +13,7 @@ const LIST_VIEW_PROPS = [
13
13
  "selectionMode",
14
14
  "expandedIds",
15
15
  "onExpandedChange",
16
+ "expanderDescriptions",
16
17
  "estimatedItemHeight",
17
18
  "estimatedItemWidth",
18
19
  ];
@@ -21,15 +22,14 @@ const LIST_VIEW_PROPS = [
21
22
  * controlled selection, controlled tree expansion, and estimated item sizing.
22
23
  */
23
24
  function ListView(props) {
24
- const { renderItem, renderHeader, expandedIds, estimatedItemHeight, estimatedItemWidth } = props;
25
+ const { renderItem, renderHeader, expandedIds, expanderDescriptions } = props;
26
+ const { estimatedItemHeight, estimatedItemWidth } = props;
25
27
  const rest = omit(props, LIST_VIEW_PROPS);
26
28
  const size = { width: estimatedItemWidth ?? -1, height: estimatedItemHeight ?? -1 };
27
29
  const { collection, selection } = useCollection(props);
28
30
  const itemCells = useItemCells(size);
29
- const headerCells = useHeaderCells(size);
30
- return (_jsxs(_Fragment, { children: [_jsx(GtkListView, { model: selection, factory: _jsx(GtkSignalListItemFactory, { ...itemCells.handlers }), ...(renderHeader != null && {
31
- headerFactory: _jsx(GtkSignalListItemFactory, { ...headerCells.handlers }),
32
- }), ...rest }), _jsx(ItemPortals, { store: itemCells, render: renderItem, collection: collection, expandedIds: expandedIds }), renderHeader != null && (_jsx(HeaderPortals, { store: headerCells, render: renderHeader, collection: collection }))] }));
31
+ const header = useSectionHeader(renderHeader, collection, size);
32
+ 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] }));
33
33
  }
34
34
  export { ListView };
35
35
  //# 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,aAAa,EAAE,WAAW,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC/F,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,MAAM,eAAe,GAAG;IACpB,OAAO;IACP,UAAU;IACV,YAAY;IACZ,cAAc;IACd,aAAa;IACb,oBAAoB;IACpB,e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jsx/gtk\";\nimport { omit } from \"@gtkx/utils\";\nimport type { ListViewProps } from \"./types.js\";\nimport { HeaderPortals, ItemPortals, useHeaderCells, useItemCells } from \"./internal/cells.js\";\nimport { useCollection } from \"./internal/use-collection.js\";\n\nconst LIST_VIEW_PROPS = [\n \"items\",\n \"sections\",\n \"renderItem\",\n \"renderHeader\",\n \"selectedIds\",\n \"onSelectionChanged\",\n \"selectionMode\",\n \"expandedIds\",\n \"onExpandedChange\",\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, 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 headerCells = useHeaderCells(size);\n\n return (\n <>\n <GtkListView\n model={selection}\n factory={<GtkSignalListItemFactory {...itemCells.handlers} />}\n {...(renderHeader != null && {\n headerFactory: <GtkSignalListItemFactory {...headerCells.handlers} />,\n })}\n {...rest}\n />\n <ItemPortals store={itemCells} render={renderItem} collection={collection} expandedIds={expandedIds} />\n {renderHeader != null && (\n <HeaderPortals store={headerCells} render={renderHeader} collection={collection} />\n )}\n </>\n );\n}\n\nexport { ListView };\n"]}
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,EA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cesContent":["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 \"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"]}
package/dist/types.d.ts CHANGED
@@ -1,103 +1,179 @@
1
1
  import type * as Gtk from "@gtkx/gi/gtk";
2
2
  import type { GtkColumnViewColumnProps, GtkColumnViewProps, GtkDropDownProps, GtkGridViewProps, GtkListViewProps } from "@gtkx/jsx/gtk";
3
- import type { ComponentPropsWithRef, ElementType, ReactNode, Ref } from "react";
4
- /** Props of a container's Child component: the widget to render and its own props. */
5
- type ChildProps<C extends ElementType> = {
6
- component: C;
7
- } & ComponentPropsWithRef<C>;
3
+ import type { ReactNode } from "react";
8
4
  /**
9
5
  * A single item in a collection model, identified by a stable id and holding an
10
6
  * arbitrary value. Nested items form a tree.
11
7
  */
12
- type Item<T = unknown> = {
13
- /** Stable identifier used to track the item across updates and selection. */
8
+ type ListItem<T = unknown> = {
9
+ /** Stable identifier used to track the item across updates and selection, naming every row that carries it. */
14
10
  id: string;
11
+ /** Payload handed to the cell renderer as `ListItemRenderArgs.item`. */
15
12
  value: T;
16
- children?: Item<T>[] | undefined;
17
- /** Hides the tree expander arrow even when the item has children. */
18
- hideExpander?: boolean | undefined;
19
- /** Adds indentation matching the item's depth in the tree. */
20
- indentForDepth?: boolean | undefined;
21
- /** Reserves indentation space for an expander icon. */
22
- indentForIcon?: boolean | undefined;
13
+ /** Child items nested under this one, which turn a plain item list into a tree. */
14
+ children?: ListItem<T>[] | undefined;
15
+ /** Hides the tree expander arrow even when the item has children, through `hide-expander`. */
16
+ shouldHideExpander?: boolean | undefined;
17
+ /** Adds indentation matching the item's depth in the tree, through `indent-for-depth`. */
18
+ shouldIndentForDepth?: boolean | undefined;
19
+ /** Reserves indentation space for an expander icon, through `indent-for-icon`. */
20
+ shouldIndentForIcon?: boolean | undefined;
23
21
  };
24
22
  /** A group of items rendered under a shared section header. */
25
- type Section<S = unknown, T = unknown> = {
23
+ type ListSection<S = unknown, T = unknown> = {
26
24
  /** Stable identifier used to track the section across updates. */
27
25
  id: string;
26
+ /** Payload handed to the section header renderer as `ListSectionRenderArgs.section`. */
28
27
  value: S;
29
28
  /** Items belonging to this section. */
30
- data: Item<T>[];
29
+ data: ListItem<T>[];
31
30
  };
32
- /** Arguments passed to an {@link ItemRenderer} when rendering one cell. */
33
- type RenderItemArgs<T> = {
31
+ /** Arguments passed to a {@link ListItemRenderer} when rendering one cell. */
32
+ type ListItemRenderArgs<T> = {
33
+ /** Value of the `ListItem` being rendered. */
34
34
  item: T;
35
+ /** Position of the item in the flattened item list, which excludes section headers and collapsed tree rows. */
35
36
  index: number;
36
37
  /** Depth of the item within a tree, starting at zero for top-level items. */
37
38
  depth?: number | undefined;
38
39
  /** Whether the item is currently expanded in a tree view. */
39
40
  isExpanded?: boolean | undefined;
40
41
  };
41
- /** Arguments passed to a {@link HeaderRenderer} when rendering one section header. */
42
- type RenderHeaderArgs<S> = {
42
+ /**
43
+ * Properties applied to the row that carries one item's cells. A Gtk.ColumnViewRow is not a widget, so
44
+ * these are the only handles it offers; anything omitted falls back to the row's own default, which
45
+ * leaves the accessibility strings unset rather than setting them to an empty string.
46
+ */
47
+ type ListRowProps = {
48
+ /** Name a screen reader announces for the row, through `accessible-label`. */
49
+ accessibleLabel?: string | undefined;
50
+ /** Longer description a screen reader announces for the row, through `accessible-description`. */
51
+ accessibleDescription?: string | undefined;
52
+ /** Whether activating the row emits the view's `activate` signal; rows are activatable by default. */
53
+ isActivatable?: boolean | undefined;
54
+ /** Whether the row takes keyboard focus; rows are focusable by default. */
55
+ isFocusable?: boolean | undefined;
56
+ /** Whether clicking or keying the row tries to select it; rows are selectable by default. */
57
+ isSelectable?: boolean | undefined;
58
+ };
59
+ /** Arguments passed to a {@link ListSectionRenderer} when rendering one section header. */
60
+ type ListSectionRenderArgs<S> = {
61
+ /** Value of the `ListSection` whose header is being rendered. */
43
62
  section: S;
44
63
  };
45
64
  /** Renders the contents of one cell of a collection view. */
46
- type ItemRenderer<T> = (args: RenderItemArgs<T>) => ReactNode;
65
+ type ListItemRenderer<T> = (args: ListItemRenderArgs<T>) => ReactNode;
47
66
  /** Renders the contents of one section header of a collection view. */
48
- type HeaderRenderer<S> = (args: RenderHeaderArgs<S>) => ReactNode;
67
+ type ListSectionRenderer<S> = (args: ListSectionRenderArgs<S>) => ReactNode;
68
+ /** Returns the {@link ListRowProps} to apply to the row displaying one item, re-run whenever the item renders. */
69
+ type ListRowPropsResolver<T> = (args: ListItemRenderArgs<T>) => ListRowProps;
70
+ /** Size a collection view requests for each cell before its contents render, keeping scroll estimates steady. */
49
71
  type ItemSizeProps = {
72
+ /** Height in pixels every cell asks for until its contents render; unset lets each cell size itself. */
50
73
  estimatedItemHeight?: number | undefined;
74
+ /** Width in pixels every cell asks for until its contents render; unset lets each cell size itself. */
51
75
  estimatedItemWidth?: number | undefined;
52
76
  };
77
+ /** Controlled selection shared by the multi-item collection views. */
53
78
  type SelectionProps = {
79
+ /**
80
+ * Ids of the items to keep selected; omitting it keeps nothing selected, and `onSelectionChanged` is how a
81
+ * user's selection is adopted into it. An id repeated in several branches of a tree names every matching row,
82
+ * and a single-selection view takes the first of them.
83
+ */
54
84
  selectedIds?: string[] | null | undefined;
85
+ /** Called with one id per selected row whenever the selection changes, and once on mount. */
55
86
  onSelectionChanged?: ((ids: string[]) => void) | null | undefined;
87
+ /** How much the user may select, one item at a time unless `MULTIPLE` or `NONE` is given. */
56
88
  selectionMode?: Gtk.SelectionMode | null | undefined;
57
89
  };
90
+ /**
91
+ * Wording a screen reader announces for the control that expands and collapses a row. GTK names that control
92
+ * after the row's own content and reports whether it is expanded, but says nothing about what activating it
93
+ * does, so these strings supply that and belong in the application's own language.
94
+ */
95
+ type ExpanderDescriptions = {
96
+ /** Announced while the row is collapsed, such as "Expand". */
97
+ expand: string;
98
+ /** Announced while the row is expanded, such as "Collapse". */
99
+ collapse: string;
100
+ };
101
+ /** Controlled expansion for the views that turn nested `ListItem.children` into a tree. */
58
102
  type ExpansionProps = {
103
+ /**
104
+ * Ids of the items to keep expanded; omitting it keeps every row collapsed, and `onExpandedChange` is how a
105
+ * user's expansion is adopted into it. An id repeated in several branches names every matching row, so all of
106
+ * them expand together.
107
+ */
59
108
  expandedIds?: string[] | null | undefined;
109
+ /** Called with one id per expanded row, in visible order, whenever expansion changes. */
60
110
  onExpandedChange?: ((ids: string[]) => void) | null | undefined;
111
+ /**
112
+ * Wording announced for the expander of every row that can expand, describing what activating it does.
113
+ * Omitting it leaves those expanders described only by the row they carry, and rows that cannot expand or
114
+ * that hide their expander are never described.
115
+ */
116
+ expanderDescriptions?: ExpanderDescriptions | null | undefined;
61
117
  };
118
+ /** Controlled sorting for the views whose headers can sort the collection. */
119
+ type SortProps = {
120
+ /** Id of the column the view is sorted by, making sorting controlled. */
121
+ sortColumn?: string | null | undefined;
122
+ /** Direction `sortColumn` is sorted in, defaulting to ascending. */
123
+ sortOrder?: Gtk.SortType | null | undefined;
124
+ /** Called when the user sorts from a header, with the primary column's id, or null, and its order. */
125
+ onSortChanged?: ((column: string | null, order: Gtk.SortType) => void) | null | undefined;
126
+ };
127
+ /** The data a collection view renders, either as a plain item list or grouped into sections. */
62
128
  type SourceProps<T, S> = {
63
- items?: Item<T>[] | undefined;
64
- sections?: Section<S, T>[] | undefined;
129
+ /** Items to render, nesting through `ListItem.children` for a tree; ignored once `sections` is given. */
130
+ items?: ListItem<T>[] | undefined;
131
+ /** Items grouped under section headers, rendered in place of `items`. */
132
+ sections?: ListSection<S, T>[] | undefined;
65
133
  };
66
134
  /** One column of a {@link ColumnView}, pairing Gtk.ColumnViewColumn props with a cell renderer. */
67
- type Column<T = unknown> = Omit<GtkColumnViewColumnProps, "factory" | "sorter" | "id" | "title"> & {
135
+ type ColumnViewColumn<T = unknown> = Omit<GtkColumnViewColumnProps, "factory" | "sorter" | "id" | "title"> & {
68
136
  /** Stable identifier, also used to address the column through sorting props. */
69
137
  id: string;
138
+ /** Text shown in the column header. */
70
139
  title: string;
71
- renderCell: ItemRenderer<T>;
72
- /** Whether clicking the column header sorts by it. */
73
- sortable?: boolean | undefined;
140
+ /** Renders the contents of this column's cell for one item. */
141
+ renderCell: ListItemRenderer<T>;
142
+ /** Makes the column header clickable, reporting the choice through `onSortChanged`. */
143
+ isSortable?: boolean | undefined;
144
+ /** Menu element popped up as the column header's context menu, on a right-click. */
74
145
  headerMenu?: ReactNode;
75
146
  };
76
- type ColumnViewOwnProps<T, S> = SelectionProps & ExpansionProps & SourceProps<T, S> & Omit<ItemSizeProps, "estimatedItemWidth"> & {
77
- columns: Column<T>[];
78
- renderHeader?: HeaderRenderer<S> | null | undefined;
79
- /** Id of the column the view is sorted by, making sorting controlled. */
80
- sortColumn?: string | null | undefined;
81
- sortOrder?: Gtk.SortType | null | undefined;
82
- onSortChanged?: ((column: string | null, order: Gtk.SortType) => void) | null | undefined;
147
+ /** The declarative collection props {@link ColumnView} adds on top of Gtk.ColumnView's own. */
148
+ type ColumnViewOwnProps<T, S> = SelectionProps & ExpansionProps & SortProps & SourceProps<T, S> & Omit<ItemSizeProps, "estimatedItemWidth"> & {
149
+ /** Columns to render, in order; each carries its own cell renderer. */
150
+ columns: ColumnViewColumn<T>[];
151
+ /** Renders the header shown above each section. */
152
+ renderHeader?: ListSectionRenderer<S> | null | undefined;
153
+ /** Resolves the props of the row carrying one item's cells, such as its screen-reader label. */
154
+ rowProps?: ListRowPropsResolver<T> | null | undefined;
83
155
  };
84
156
  /**
85
157
  * Props for {@link ColumnView}. Combines the underlying Gtk.ColumnView props with
86
158
  * declarative collection props: flat items or grouped sections, controlled selection
87
159
  * and expansion, sorting (sortColumn, sortOrder, onSortChanged), an optional section
88
- * header renderer, and the columns to render.
160
+ * header renderer, per-row props, and the columns to render.
89
161
  */
90
- type ColumnViewProps<T = unknown, S = unknown> = Omit<GtkColumnViewProps, "columns" | "model" | "headerFactory" | keyof ColumnViewOwnProps<T, S>> & ColumnViewOwnProps<T, S>;
162
+ type ColumnViewProps<T = unknown, S = unknown> = Omit<GtkColumnViewProps, "columns" | "model" | "headerFactory" | "rowFactory" | keyof ColumnViewOwnProps<T, S>> & ColumnViewOwnProps<T, S>;
163
+ /** The declarative collection props {@link DropDown} and `ComboRow` add on top of their widget's own. */
91
164
  type DropDownOwnProps<T, S> = SourceProps<T, S> & {
92
165
  /** Id of the currently selected item, making the selection controlled. */
93
166
  selectedId?: string | null | undefined;
167
+ /** Called with the id of the item that became selected. */
94
168
  onSelectionChanged?: ((id: string) => void) | null | undefined;
95
- renderItem?: ItemRenderer<T> | null | undefined;
169
+ /** Renders the collapsed display, and the popup rows too unless `renderListItem` is given. */
170
+ renderItem?: ListItemRenderer<T> | null | undefined;
96
171
  /** Renderer for items in the open popup list, falling back to renderItem when omitted. */
97
- renderListItem?: ItemRenderer<T> | null | undefined;
172
+ renderListItem?: ListItemRenderer<T> | null | undefined;
98
173
  /** Renderer for section headers in the popup list. */
99
- renderHeader?: HeaderRenderer<S> | null | undefined;
174
+ renderHeader?: ListSectionRenderer<S> | null | undefined;
100
175
  };
176
+ /** A drop-down-shaped widget's props with its model and factories swapped for the declarative collection props. */
101
177
  type DropDownWidgetProps<Widget, T, S> = Omit<Widget, "model" | "factory" | "listFactory" | "headerFactory" | keyof DropDownOwnProps<T, S>> & DropDownOwnProps<T, S>;
102
178
  /**
103
179
  * Props for {@link DropDown}. Combines the underlying Gtk.DropDown props with the declarative
@@ -105,9 +181,12 @@ type DropDownWidgetProps<Widget, T, S> = Omit<Widget, "model" | "factory" | "lis
105
181
  * for the collapsed display, popup rows, and popup section headers.
106
182
  */
107
183
  type DropDownProps<T = unknown, S = unknown> = DropDownWidgetProps<GtkDropDownProps, T, S>;
184
+ /** The declarative collection props {@link GridView} adds on top of Gtk.GridView's own. */
108
185
  type GridViewOwnProps<T> = ItemSizeProps & SelectionProps & {
109
- items?: Item<T>[] | undefined;
110
- renderItem: ItemRenderer<T>;
186
+ /** Items to render as cells; a grid is always flat, so `ListItem.children` is ignored. */
187
+ items?: ListItem<T>[] | undefined;
188
+ /** Renders the contents of one cell. */
189
+ renderItem: ListItemRenderer<T>;
111
190
  };
112
191
  /**
113
192
  * Props for {@link GridView}. Combines the underlying Gtk.GridView props with
@@ -115,9 +194,12 @@ type GridViewOwnProps<T> = ItemSizeProps & SelectionProps & {
115
194
  * and estimated item sizing.
116
195
  */
117
196
  type GridViewProps<T = unknown> = Omit<GtkGridViewProps, "model" | "factory" | keyof GridViewOwnProps<T>> & GridViewOwnProps<T>;
197
+ /** The declarative collection props {@link ListView} adds on top of Gtk.ListView's own. */
118
198
  type ListViewOwnProps<T, S> = ItemSizeProps & SelectionProps & ExpansionProps & SourceProps<T, S> & {
119
- renderItem: ItemRenderer<T>;
120
- renderHeader?: HeaderRenderer<S> | null | undefined;
199
+ /** Renders the contents of one row. */
200
+ renderItem: ListItemRenderer<T>;
201
+ /** Renders the header shown above each section. */
202
+ renderHeader?: ListSectionRenderer<S> | null | undefined;
121
203
  };
122
204
  /**
123
205
  * Props for {@link ListView}. Combines the underlying Gtk.ListView props with
@@ -126,14 +208,5 @@ type ListViewOwnProps<T, S> = ItemSizeProps & SelectionProps & ExpansionProps &
126
208
  * estimated item sizing.
127
209
  */
128
210
  type ListViewProps<T = unknown, S = unknown> = Omit<GtkListViewProps, "model" | "factory" | "headerFactory" | keyof ListViewOwnProps<T, S>> & ListViewOwnProps<T, S>;
129
- /** Props for {@link SizeGroup}. */
130
- type SizeGroupProps = {
131
- /** How the group equalizes sizes: horizontal, vertical, or both. */
132
- mode?: Gtk.SizeGroupMode | null | undefined;
133
- ref?: Ref<Gtk.SizeGroup | null>;
134
- children?: ReactNode;
135
- };
136
- /** Adds a single widget, rendered by the given component, to the enclosing {@link SizeGroup}. */
137
- type SizeGroupChildProps<C extends ElementType> = ChildProps<C>;
138
- export { type SelectionProps, type ExpansionProps, type ChildProps, type DropDownOwnProps, type DropDownWidgetProps, type Item, type Section, type RenderItemArgs, type RenderHeaderArgs, type ItemRenderer, type HeaderRenderer, type Column, type ColumnViewProps, type DropDownProps, type GridViewProps, type ListViewProps, type SizeGroupProps, type SizeGroupChildProps, };
211
+ export { type SelectionProps, type ExpanderDescriptions, type ExpansionProps, type SortProps, type DropDownOwnProps, type DropDownWidgetProps, type ListItem, type ListSection, type ListItemRenderArgs, type ListRowProps, type ListSectionRenderArgs, type ListItemRenderer, type ListRowPropsResolver, type ListSectionRenderer, type ColumnViewColumn, type ColumnViewProps, type DropDownProps, type GridViewProps, type ListViewProps, };
139
212
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1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KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,aAAa,GACrB,CAAC"}
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AA0LA,OAAO,EAmBN,CAAC","sourcesContent":["import type * as Gtk from \"@gtkx/gi/gtk\";\nimport type {\n GtkColumnViewColumnProps,\n GtkColumnViewProps,\n GtkDropDownProps,\n GtkGridViewProps,\n GtkListViewProps,\n} from \"@gtkx/jsx/gtk\";\nimport type { ComponentPropsWithRef, ElementType, ReactNode, Ref } from \"react\";\n\n/** Props of a container's Child component: the widget to render and its own props. */\ntype ChildProps<C extends ElementType> = {\n component: C;\n} & ComponentPropsWithRef<C>;\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 Item<T = unknown> = {\n /** Stable identifier used to track the item across updates and selection. */\n id: string;\n value: T;\n children?: Item<T>[] | undefined;\n /** Hides the tree expander arrow even when the item has children. */\n hideExpander?: boolean | undefined;\n /** Adds indentation matching the item's depth in the tree. */\n indentForDepth?: boolean | undefined;\n /** Reserves indentation space for an expander icon. */\n indentForIcon?: boolean | undefined;\n};\n\n/** A group of items rendered under a shared section header. */\ntype Section<S = unknown, T = unknown> = {\n /** Stable identifier used to track the section across updates. */\n id: string;\n value: S;\n /** Items belonging to this section. */\n data: Item<T>[];\n};\n\n/** Arguments passed to an {@link ItemRenderer} when rendering one cell. */\ntype RenderItemArgs<T> = {\n item: T;\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/** Arguments passed to a {@link HeaderRenderer} when rendering one section header. */\ntype RenderHeaderArgs<S> = {\n section: S;\n};\n\n/** Renders the contents of one cell of a collection view. */\ntype ItemRenderer<T> = (args: RenderItemArgs<T>) => ReactNode;\n/** Renders the contents of one section header of a collection view. */\ntype HeaderRenderer<S> = (args: RenderHeaderArgs<S>) => ReactNode;\n\ntype ItemSizeProps = {\n estimatedItemHeight?: number | undefined;\n estimatedItemWidth?: number | undefined;\n};\n\ntype SelectionProps = {\n selectedIds?: string[] | null | undefined;\n onSelectionChanged?: ((ids: string[]) => void) | null | undefined;\n selectionMode?: Gtk.SelectionMode | null | undefined;\n};\n\ntype ExpansionProps = {\n expandedIds?: string[] | null | undefined;\n onExpandedChange?: ((ids: string[]) => void) | null | undefined;\n};\n\ntype SourceProps<T, S> = {\n items?: Item<T>[] | undefined;\n sections?: Section<S, T>[] | undefined;\n};\n\n/** One column of a {@link ColumnView}, pairing Gtk.ColumnViewColumn props with a cell renderer. */\ntype Column<T = unknown> = Omit<GtkColumnViewColumnProps, \"factory\" | \"sorter\" | \"id\" | \"title\"> & {\n /** Stable identifier, also used to address the column through sorting props. */\n id: string;\n title: string;\n renderCell: ItemRenderer<T>;\n /** Whether clicking the column header sorts by it. */\n sortable?: boolean | undefined;\n headerMenu?: ReactNode;\n};\n\ntype ColumnViewOwnProps<T, S> = SelectionProps &\n ExpansionProps &\n SourceProps<T, S> &\n Omit<ItemSizeProps, \"estimatedItemWidth\"> & {\n columns: Column<T>[];\n renderHeader?: HeaderRenderer<S> | null | undefined;\n /** Id of the column the view is sorted by, making sorting controlled. */\n sortColumn?: string | null | undefined;\n sortOrder?: Gtk.SortType | null | undefined;\n onSortChanged?: ((column: string | null, order: Gtk.SortType) => void) | null | undefined;\n };\n\n/**\n * Props for {@link ColumnView}. Combines the underlying Gtk.ColumnView props with\n * declarative collection props: flat items or grouped sections, controlled selection\n * and expansion, sorting (sortColumn, sortOrder, onSortChanged), an optional section\n * header renderer, and the columns to render.\n */\ntype ColumnViewProps<T = unknown, S = unknown> = Omit<\n GtkColumnViewProps,\n \"columns\" | \"model\" | \"headerFactory\" | keyof ColumnViewOwnProps<T, S>\n> &\nColumnViewOwnProps<T, S>;\n\ntype DropDownOwnProps<T, S> = SourceProps<T, S> & {\n /** Id of the currently selected item, making the selection controlled. */\n selectedId?: string | null | undefined;\n onSelectionChanged?: ((id: string) => void) | null | undefined;\n renderItem?: ItemRenderer<T> | null | undefined;\n /** Renderer for items in the open popup list, falling back to renderItem when omitted. */\n renderListItem?: ItemRenderer<T> | null | undefined;\n /** Renderer for section headers in the popup list. */\n renderHeader?: HeaderRenderer<S> | null | undefined;\n};\n\ntype DropDownWidgetProps<Widget, T, S> = Omit<\n Widget,\n \"model\" | \"factory\" | \"listFactory\" | \"headerFactory\" | keyof DropDownOwnProps<T, S>\n> &\nDropDownOwnProps<T, S>;\n\n/**\n * Props for {@link DropDown}. Combines the underlying Gtk.DropDown props with the declarative\n * collection props: flat items or grouped sections, controlled single selection, and renderers\n * for the collapsed display, popup rows, and popup section headers.\n */\ntype DropDownProps<T = unknown, S = unknown> = DropDownWidgetProps<GtkDropDownProps, T, S>;\n\ntype GridViewOwnProps<T> = ItemSizeProps &\n SelectionProps & {\n items?: Item<T>[] | undefined;\n renderItem: ItemRenderer<T>;\n };\n\n/**\n * Props for {@link GridView}. Combines the underlying Gtk.GridView props with\n * declarative collection props: items, a per-cell renderItem, controlled selection,\n * and estimated item sizing.\n */\ntype GridViewProps<T = unknown> = Omit<GtkGridViewProps, \"model\" | \"factory\" | keyof GridViewOwnProps<T>> &\n GridViewOwnProps<T>;\n\ntype ListViewOwnProps<T, S> = ItemSizeProps &\n SelectionProps &\n ExpansionProps &\n SourceProps<T, S> & {\n renderItem: ItemRenderer<T>;\n renderHeader?: HeaderRenderer<S> | null | undefined;\n };\n\n/**\n * Props for {@link ListView}. Combines the underlying Gtk.ListView props with\n * declarative collection props: flat items or grouped sections, a per-row renderItem,\n * an optional section header renderer, controlled selection and expansion, and\n * estimated item 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/** Props for {@link SizeGroup}. */\ntype SizeGroupProps = {\n /** How the group equalizes sizes: horizontal, vertical, or both. */\n mode?: Gtk.SizeGroupMode | null | undefined;\n ref?: Ref<Gtk.SizeGroup | null>;\n children?: ReactNode;\n};\n\n/** Adds a single widget, rendered by the given component, to the enclosing {@link SizeGroup}. */\ntype SizeGroupChildProps<C extends ElementType> = ChildProps<C>;\n\nexport {\n type SelectionProps,\n type ExpansionProps,\n type ChildProps,\n type DropDownOwnProps,\n type DropDownWidgetProps,\n type Item,\n type Section,\n type RenderItemArgs,\n type RenderHeaderArgs,\n type ItemRenderer,\n type HeaderRenderer,\n type Column,\n type ColumnViewProps,\n type DropDownProps,\n type GridViewProps,\n type ListViewProps,\n type SizeGroupProps,\n type SizeGroupChildProps,\n};\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAoQA,OAAO,EAoBN,CAAC","sourcesContent":["import type * as Gtk from \"@gtkx/gi/gtk\";\nimport type {\n GtkColumnViewColumnProps,\n GtkColumnViewProps,\n GtkDropDownProps,\n GtkGridViewProps,\n GtkListViewProps,\n} from \"@gtkx/jsx/gtk\";\nimport type { ReactNode } 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 used to track the item across updates and selection, naming every row that carries it. */\n id: string;\n /** Payload handed to the cell renderer as `ListItemRenderArgs.item`. */\n value: T;\n /** Child items nested under this one, which turn a plain item list into a tree. */\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 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\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. An id repeated in several branches of a tree names every matching row,\n * and a single-selection view takes the first of them.\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. An id repeated in several branches names every matching row, so all of\n * them expand together.\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; ignored once `sections` is given. */\n items?: ListItem<T>[] | undefined;\n /** Items grouped under section headers, rendered in place of `items`. */\n sections?: ListSection<S, T>[] | undefined;\n};\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 Omit<ItemSizeProps, \"estimatedItemWidth\"> & {\n /** Columns to render, in order; each carries its own cell renderer. */\n columns: ColumnViewColumn<T>[];\n /** Renders the header shown above each section. */\n renderHeader?: ListSectionRenderer<S> | null | undefined;\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 * Props for {@link ColumnView}. Combines the underlying Gtk.ColumnView props with\n * declarative collection props: flat items or grouped sections, controlled selection\n * and expansion, sorting (sortColumn, sortOrder, onSortChanged), an optional section\n * header renderer, per-row props, and the columns to render.\n */\ntype ColumnViewProps<T = unknown, S = unknown> = Omit<\n GtkColumnViewProps,\n \"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 | null | undefined;\n /** Called with the id of the item that became selected. */\n onSelectionChanged?: ((id: string) => void) | null | undefined;\n /** Renders the collapsed display, and the popup rows too unless `renderListItem` is given. */\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 /** Renderer for section headers in the popup list. */\n renderHeader?: ListSectionRenderer<S> | 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\n/**\n * Props for {@link DropDown}. Combines the underlying Gtk.DropDown props with the declarative\n * collection props: flat items or grouped sections, controlled single selection, and renderers\n * for the collapsed display, popup rows, and popup section headers.\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 * Props for {@link GridView}. Combines the underlying Gtk.GridView props with\n * declarative collection props: items, a per-cell renderItem, controlled selection,\n * and estimated item 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 /** Renders the contents of one row. */\n renderItem: ListItemRenderer<T>;\n /** Renders the header shown above each section. */\n renderHeader?: ListSectionRenderer<S> | null | undefined;\n };\n\n/**\n * Props for {@link ListView}. Combines the underlying Gtk.ListView props with\n * declarative collection props: flat items or grouped sections, a per-row renderItem,\n * an optional section header renderer, controlled selection and expansion, and\n * estimated item sizing.\n */\ntype ListViewProps<T = unknown, S = unknown> = Omit<\n GtkListViewProps,\n \"model\" | \"factory\" | \"headerFactory\" | keyof ListViewOwnProps<T, S>\n> &\nListViewOwnProps<T, S>;\n\nexport {\n type SelectionProps,\n type ExpanderDescriptions,\n type ExpansionProps,\n type SortProps,\n type DropDownOwnProps,\n type DropDownWidgetProps,\n type ListItem,\n type ListSection,\n type ListItemRenderArgs,\n type ListRowProps,\n type ListSectionRenderArgs,\n type ListItemRenderer,\n type ListRowPropsResolver,\n type ListSectionRenderer,\n type ColumnViewColumn,\n type ColumnViewProps,\n type DropDownProps,\n type GridViewProps,\n type ListViewProps,\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gtkx/components",
3
- "version": "1.0.0-rc.3",
3
+ "version": "1.0.0",
4
4
  "description": "High-level GTKX components for declarative collection views, menus, and containers with attach-time placement",
5
5
  "keywords": [
6
6
  "gtkx",
@@ -44,8 +44,9 @@
44
44
  "node": ">=24"
45
45
  },
46
46
  "dependencies": {
47
- "@gtkx/react": "1.0.0-rc.3",
48
- "@gtkx/utils": "1.0.0-rc.3"
47
+ "@gtkx/react": "1.0.0",
48
+ "@gtkx/utils": "1.0.0",
49
+ "@gtkx/runtime": "1.0.0"
49
50
  },
50
51
  "peerDependencies": {
51
52
  "react": "^19.2"
@@ -53,10 +54,9 @@
53
54
  "devDependencies": {
54
55
  "@codspeed/vitest-plugin": "^5.7.1",
55
56
  "vitest": "^4.1.10",
56
- "@gtkx/config": "1.0.0-rc.3",
57
- "@gtkx/runtime": "1.0.0-rc.3",
58
- "@gtkx/testing": "1.0.0-rc.3",
59
- "@gtkx/vitest": "1.0.0-rc.3"
57
+ "@gtkx/config": "1.0.0",
58
+ "@gtkx/testing": "1.0.0",
59
+ "@gtkx/vitest": "1.0.0"
60
60
  },
61
61
  "scripts": {
62
62
  "bench": "NODE_ENV=production vitest bench --run --config vitest.bench.config.ts",
@@ -4,6 +4,7 @@ import type { DropDownBaseProps } from "../internal/drop-down.js";
4
4
  import type { ComboRowProps } from "./types.js";
5
5
  import { DropDownBase } from "../internal/drop-down.js";
6
6
 
7
+ /** Call signature of {@link ComboRow}, generic in the item and section value types. */
7
8
  type ComboRowComponent = <T = unknown, S = unknown>(props: ComboRowProps<T, S>) => ReactNode;
8
9
 
9
10
  /**
package/src/adw/types.ts CHANGED
@@ -19,7 +19,7 @@ type ToastOptions = Adw.ToastConstructorProps & Pick<AdwToastProps, "onButtonCli
19
19
  type ToastController = {
20
20
  /** Builds a toast, shows it through the overlay, and returns it. */
21
21
  show: (options?: ToastOptions) => Adw.Toast;
22
- /** Dismisses a single toast, typically one returned by {@link ToastController.show}. */
22
+ /** Dismisses a single toast, typically one returned by `ToastController.show`. */
23
23
  dismiss: (toast: Adw.Toast) => void;
24
24
  };
25
25
 
@@ -33,6 +33,7 @@ type ToastOverlayController = {
33
33
  type ToastProviderProps = {
34
34
  /** Ref also given to the `AdwToastOverlay` the toasts appear over. */
35
35
  overlayRef: RefObject<Adw.ToastOverlay | null>;
36
+ /** Subtree whose `useToast` and `useToastOverlay` calls target that overlay. */
36
37
  children?: ReactNode | undefined;
37
38
  };
38
39