@gtkx/components 0.21.0 → 1.0.0-rc.2

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 (192) hide show
  1. package/LICENSE +373 -0
  2. package/README.md +173 -0
  3. package/dist/adw/index.d.ts +3 -0
  4. package/dist/adw/index.d.ts.map +1 -0
  5. package/dist/adw/index.js +2 -0
  6. package/dist/adw/index.js.map +1 -0
  7. package/dist/adw/toast.d.ts +10 -0
  8. package/dist/adw/toast.d.ts.map +1 -0
  9. package/dist/adw/toast.js +51 -0
  10. package/dist/adw/toast.js.map +1 -0
  11. package/dist/adw/types.d.ts +28 -0
  12. package/dist/adw/types.d.ts.map +1 -0
  13. package/dist/adw/types.js +2 -0
  14. package/dist/adw/types.js.map +1 -0
  15. package/dist/column-view.d.ts +6 -14
  16. package/dist/column-view.d.ts.map +1 -1
  17. package/dist/column-view.js +98 -100
  18. package/dist/column-view.js.map +1 -1
  19. package/dist/drop-down.d.ts +8 -37
  20. package/dist/drop-down.d.ts.map +1 -1
  21. package/dist/drop-down.js +109 -118
  22. package/dist/drop-down.js.map +1 -1
  23. package/dist/grid-view.d.ts +4 -11
  24. package/dist/grid-view.d.ts.map +1 -1
  25. package/dist/grid-view.js +25 -19
  26. package/dist/grid-view.js.map +1 -1
  27. package/dist/index.d.ts +6 -18
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js +2 -14
  30. package/dist/index.js.map +1 -1
  31. package/dist/internal/cells.d.ts +50 -0
  32. package/dist/internal/cells.d.ts.map +1 -0
  33. package/dist/internal/cells.js +185 -0
  34. package/dist/internal/cells.js.map +1 -0
  35. package/dist/internal/collection-index.d.ts +21 -0
  36. package/dist/internal/collection-index.d.ts.map +1 -0
  37. package/dist/internal/collection-index.js +106 -0
  38. package/dist/internal/collection-index.js.map +1 -0
  39. package/dist/internal/collection-model.d.ts +12 -0
  40. package/dist/internal/collection-model.d.ts.map +1 -0
  41. package/dist/internal/collection-model.js +164 -0
  42. package/dist/internal/collection-model.js.map +1 -0
  43. package/dist/internal/collection.d.ts +18 -0
  44. package/dist/internal/collection.d.ts.map +1 -0
  45. package/dist/internal/collection.js +64 -0
  46. package/dist/internal/collection.js.map +1 -0
  47. package/dist/internal/expansion.d.ts +9 -0
  48. package/dist/internal/expansion.d.ts.map +1 -0
  49. package/dist/internal/expansion.js +75 -0
  50. package/dist/internal/expansion.js.map +1 -0
  51. package/dist/internal/selection.d.ts +12 -0
  52. package/dist/internal/selection.d.ts.map +1 -0
  53. package/dist/internal/selection.js +99 -0
  54. package/dist/internal/selection.js.map +1 -0
  55. package/dist/internal/use-collection.d.ts +18 -0
  56. package/dist/internal/use-collection.d.ts.map +1 -0
  57. package/dist/internal/use-collection.js +42 -0
  58. package/dist/internal/use-collection.js.map +1 -0
  59. package/dist/internal/use-widget-ref.d.ts +4 -0
  60. package/dist/internal/use-widget-ref.d.ts.map +1 -0
  61. package/dist/internal/use-widget-ref.js +8 -0
  62. package/dist/internal/use-widget-ref.js.map +1 -0
  63. package/dist/list-view.d.ts +4 -11
  64. package/dist/list-view.d.ts.map +1 -1
  65. package/dist/list-view.js +32 -28
  66. package/dist/list-view.js.map +1 -1
  67. package/dist/size-group.d.ts +12 -0
  68. package/dist/size-group.d.ts.map +1 -0
  69. package/dist/size-group.js +41 -0
  70. package/dist/size-group.js.map +1 -0
  71. package/dist/types.d.ts +104 -161
  72. package/dist/types.d.ts.map +1 -1
  73. package/dist/types.js.map +1 -1
  74. package/package.json +62 -52
  75. package/src/adw/index.ts +2 -0
  76. package/src/adw/toast.tsx +74 -0
  77. package/src/adw/types.ts +32 -0
  78. package/src/column-view.tsx +184 -184
  79. package/src/drop-down.tsx +173 -227
  80. package/src/grid-view.tsx +29 -65
  81. package/src/index.ts +16 -25
  82. package/src/internal/cells.tsx +345 -0
  83. package/src/internal/collection-index.ts +168 -0
  84. package/src/internal/collection-model.ts +246 -0
  85. package/src/internal/collection.ts +104 -0
  86. package/src/internal/expansion.ts +123 -0
  87. package/src/internal/selection.tsx +159 -0
  88. package/src/internal/use-collection.tsx +70 -0
  89. package/src/internal/use-widget-ref.ts +11 -0
  90. package/src/list-view.tsx +45 -78
  91. package/src/size-group.tsx +77 -0
  92. package/src/types.ts +171 -191
  93. package/dist/collection-view.d.ts +0 -30
  94. package/dist/collection-view.d.ts.map +0 -1
  95. package/dist/collection-view.js +0 -52
  96. package/dist/collection-view.js.map +0 -1
  97. package/dist/column-view-column.d.ts +0 -17
  98. package/dist/column-view-column.d.ts.map +0 -1
  99. package/dist/column-view-column.js +0 -51
  100. package/dist/column-view-column.js.map +0 -1
  101. package/dist/constraint-layout-apply.d.ts +0 -6
  102. package/dist/constraint-layout-apply.d.ts.map +0 -1
  103. package/dist/constraint-layout-apply.js +0 -107
  104. package/dist/constraint-layout-apply.js.map +0 -1
  105. package/dist/constraint-layout.d.ts +0 -13
  106. package/dist/constraint-layout.d.ts.map +0 -1
  107. package/dist/constraint-layout.js +0 -85
  108. package/dist/constraint-layout.js.map +0 -1
  109. package/dist/contexts/column-view-context.d.ts +0 -17
  110. package/dist/contexts/column-view-context.d.ts.map +0 -1
  111. package/dist/contexts/column-view-context.js +0 -10
  112. package/dist/contexts/column-view-context.js.map +0 -1
  113. package/dist/hooks/use-drop-down-selection.d.ts +0 -15
  114. package/dist/hooks/use-drop-down-selection.d.ts.map +0 -1
  115. package/dist/hooks/use-drop-down-selection.js +0 -35
  116. package/dist/hooks/use-drop-down-selection.js.map +0 -1
  117. package/dist/hooks/use-header-menu.d.ts +0 -4
  118. package/dist/hooks/use-header-menu.d.ts.map +0 -1
  119. package/dist/hooks/use-header-menu.js +0 -32
  120. package/dist/hooks/use-header-menu.js.map +0 -1
  121. package/dist/hooks/use-list-model.d.ts +0 -20
  122. package/dist/hooks/use-list-model.d.ts.map +0 -1
  123. package/dist/hooks/use-list-model.js +0 -70
  124. package/dist/hooks/use-list-model.js.map +0 -1
  125. package/dist/hooks/use-model-installation.d.ts +0 -9
  126. package/dist/hooks/use-model-installation.d.ts.map +0 -1
  127. package/dist/hooks/use-model-installation.js +0 -20
  128. package/dist/hooks/use-model-installation.js.map +0 -1
  129. package/dist/hooks/use-realized-slots.d.ts +0 -20
  130. package/dist/hooks/use-realized-slots.d.ts.map +0 -1
  131. package/dist/hooks/use-realized-slots.js +0 -66
  132. package/dist/hooks/use-realized-slots.js.map +0 -1
  133. package/dist/hooks/use-selection-model.d.ts +0 -12
  134. package/dist/hooks/use-selection-model.d.ts.map +0 -1
  135. package/dist/hooks/use-selection-model.js +0 -111
  136. package/dist/hooks/use-selection-model.js.map +0 -1
  137. package/dist/hooks/use-sort-handler.d.ts +0 -12
  138. package/dist/hooks/use-sort-handler.d.ts.map +0 -1
  139. package/dist/hooks/use-sort-handler.js +0 -87
  140. package/dist/hooks/use-sort-handler.js.map +0 -1
  141. package/dist/list-portal-host.d.ts +0 -11
  142. package/dist/list-portal-host.d.ts.map +0 -1
  143. package/dist/list-portal-host.js +0 -8
  144. package/dist/list-portal-host.js.map +0 -1
  145. package/dist/list-slot.d.ts +0 -14
  146. package/dist/list-slot.d.ts.map +0 -1
  147. package/dist/list-slot.js +0 -29
  148. package/dist/list-slot.js.map +0 -1
  149. package/dist/menu-items.d.ts +0 -5
  150. package/dist/menu-items.d.ts.map +0 -1
  151. package/dist/menu-items.js +0 -48
  152. package/dist/menu-items.js.map +0 -1
  153. package/dist/menu.d.ts +0 -18
  154. package/dist/menu.d.ts.map +0 -1
  155. package/dist/menu.js +0 -26
  156. package/dist/menu.js.map +0 -1
  157. package/dist/utils/item-resolver.d.ts +0 -28
  158. package/dist/utils/item-resolver.d.ts.map +0 -1
  159. package/dist/utils/item-resolver.js +0 -111
  160. package/dist/utils/item-resolver.js.map +0 -1
  161. package/dist/utils/list-item-flatten.d.ts +0 -32
  162. package/dist/utils/list-item-flatten.d.ts.map +0 -1
  163. package/dist/utils/list-item-flatten.js +0 -88
  164. package/dist/utils/list-item-flatten.js.map +0 -1
  165. package/dist/utils/position-only-model.d.ts +0 -10
  166. package/dist/utils/position-only-model.d.ts.map +0 -1
  167. package/dist/utils/position-only-model.js +0 -83
  168. package/dist/utils/position-only-model.js.map +0 -1
  169. package/dist/utils/realized-slot-store.d.ts +0 -30
  170. package/dist/utils/realized-slot-store.d.ts.map +0 -1
  171. package/dist/utils/realized-slot-store.js +0 -103
  172. package/dist/utils/realized-slot-store.js.map +0 -1
  173. package/src/collection-view.tsx +0 -125
  174. package/src/column-view-column.tsx +0 -73
  175. package/src/constraint-layout-apply.ts +0 -121
  176. package/src/constraint-layout.tsx +0 -130
  177. package/src/contexts/column-view-context.ts +0 -28
  178. package/src/hooks/use-drop-down-selection.ts +0 -53
  179. package/src/hooks/use-header-menu.ts +0 -33
  180. package/src/hooks/use-list-model.ts +0 -145
  181. package/src/hooks/use-model-installation.ts +0 -25
  182. package/src/hooks/use-realized-slots.ts +0 -93
  183. package/src/hooks/use-selection-model.ts +0 -121
  184. package/src/hooks/use-sort-handler.ts +0 -102
  185. package/src/list-portal-host.tsx +0 -27
  186. package/src/list-slot.tsx +0 -56
  187. package/src/menu-items.ts +0 -48
  188. package/src/menu.tsx +0 -34
  189. package/src/utils/item-resolver.ts +0 -143
  190. package/src/utils/list-item-flatten.ts +0 -113
  191. package/src/utils/position-only-model.ts +0 -115
  192. package/src/utils/realized-slot-store.ts +0 -126
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-collection.js","sourceRoot":"","sources":["../../src/internal/use-collection.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAK3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,YAAY,EA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AAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,gBAAgB,EAAE,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAE3G,MAAM,SAAS,GAAG,YAAY,CAAC;QAC3B,UAAU;QACV,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,kBAAkB,EAAE,OAAO,CAAC,kBAAkB;QAC9C,aAAa,EAAE,OAAO,CAAC,aAAa;KACvC,CAAC,CAAC;IAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC;AACrC,CAAC;AAED,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAsD,CAAC","sourcesContent":["import type { ReactElement, RefObject } from \"react\";\nimport { useLayoutEffect, useMemo, useState } from \"react\";\nimport type { ExpansionProps, Item, Section, SelectionProps } from \"../types.js\";\nimport type { CollectionIndex } from \"./collection-index.js\";\nimport type { CollectionModel } from \"./collection-model.js\";\nimport type { Collection } from \"./collection.js\";\nimport { createCollectionIndex } from \"./collection-index.js\";\nimport { createCollectionModel } from \"./collection-model.js\";\nimport { createCollection } from \"./collection.js\";\nimport { useExpansion } from \"./expansion.js\";\nimport { useSelection } from \"./selection.js\";\n\ntype CollectionDataOptions = {\n items?: Item[] | undefined;\n sections?: Section[] | undefined;\n flat?: boolean | undefined;\n applying?: RefObject<boolean> | undefined;\n};\n\ntype CollectionOptions = CollectionDataOptions & SelectionProps & ExpansionProps;\n\ntype CollectionResult = {\n collection: Collection;\n selection: ReactElement;\n};\n\nfunction runSync(gtk: CollectionModel, index: CollectionIndex, applying: RefObject<boolean> | undefined): void {\n if (applying === undefined) {\n gtk.sync(index);\n\n return;\n }\n\n applying.current = true;\n\n try {\n gtk.sync(index);\n } finally {\n applying.current = false;\n }\n}\n\nfunction useCollectionData(options: CollectionDataOptions): Collection {\n const { items, sections, flat, applying } = options;\n const [gtk] = useState(createCollectionModel);\n const index = useMemo(() => createCollectionIndex(items, sections, flat === true), [items, sections, flat]);\n const collection = useMemo(() => createCollection(gtk, index), [gtk, index]);\n\n useLayoutEffect(() => {\n runSync(gtk, index, applying);\n }, [gtk, index, applying]);\n\n return collection;\n}\n\nfunction useCollection(options: CollectionOptions): CollectionResult {\n const collection = useCollectionData(options);\n useExpansion({ collection, expandedIds: options.expandedIds, onExpandedChange: options.onExpandedChange });\n\n const selection = useSelection({\n collection,\n selectedIds: options.selectedIds,\n onSelectionChanged: options.onSelectionChanged,\n selectionMode: options.selectionMode,\n });\n\n return { collection, selection };\n}\n\nexport { useCollection, useCollectionData, type CollectionDataOptions, type CollectionOptions };\n"]}
@@ -0,0 +1,4 @@
1
+ import type { Ref, RefCallback } from "react";
2
+ declare const useWidgetRef: <T>(external: Ref<T | null> | null | undefined) => [T | null, RefCallback<T | null>];
3
+ export { useWidgetRef };
4
+ //# sourceMappingURL=use-widget-ref.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-widget-ref.d.ts","sourceRoot":"","sources":["../../src/internal/use-widget-ref.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAI9C,QAAA,MAAM,YAAY,GAAI,CAAC,EAAE,UAAU,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,GAAG,SAAS,KAAG,CAAC,CAAC,GAAG,IAAI,EAAE,WAAW,CAAC,CAAC,GAAG,IAAI,CAAC,CAIrG,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { useMergedRef } from "@gtkx/react/internal";
2
+ import { useState } from "react";
3
+ const useWidgetRef = (external) => {
4
+ const [widget, setWidget] = useState(null);
5
+ return [widget, useMergedRef(external, setWidget)];
6
+ };
7
+ export { useWidgetRef };
8
+ //# sourceMappingURL=use-widget-ref.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-widget-ref.js","sourceRoot":"","sources":["../../src/internal/use-widget-ref.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,MAAM,YAAY,GAAG,CAAI,QAA0C,EAAqC,EAAE;IACtG,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAW,IAAI,CAAC,CAAC;IAErD,OAAO,CAAC,MAAM,EAAE,YAAY,CAAW,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC;AACjE,CAAC,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,CAAC","sourcesContent":["import type { Ref, RefCallback } from \"react\";\nimport { useMergedRef } from \"@gtkx/react/internal\";\nimport { useState } from \"react\";\n\nconst useWidgetRef = <T>(external: Ref<T | null> | null | undefined): [T | null, RefCallback<T | null>] => {\n const [widget, setWidget] = useState<T | null>(null);\n\n return [widget, useMergedRef<T | null>(external, setWidget)];\n};\n\nexport { useWidgetRef };\n"]}
@@ -1,16 +1,9 @@
1
- import { type GtkListViewProps } from "@gtkx/jsx/gtk";
2
1
  import type { ReactNode } from "react";
3
2
  import type { ListViewProps } from "./types.js";
4
3
  /**
5
- * Props for the {@link ListView} component: the raw `GtkListView` element
6
- * surface with its factory/model wiring replaced by the declarative
7
- * {@link ListViewProps} API.
4
+ * Renders a Gtk.ListView from declarative items or sections, with per-row rendering,
5
+ * controlled selection, controlled tree expansion, and estimated item sizing.
8
6
  */
9
- export type ListViewComponentProps<T = unknown, S = unknown> = Omit<GtkListViewProps, keyof ListViewProps<T, S>> & ListViewProps<T, S>;
10
- /**
11
- * A `GtkListView` driven by a declarative `items`/`renderItem` API with
12
- * optional controlled selection, section headers, and tree autoexpansion.
13
- * Supplying an external `model` switches to the uncontrolled form.
14
- */
15
- export declare const ListView: <T = unknown, S = unknown>(props: ListViewComponentProps<T, S>) => ReactNode;
7
+ declare function ListView<T = unknown, S = unknown>(props: ListViewProps<T, S>): ReactNode;
8
+ export { ListView };
16
9
  //# sourceMappingURL=list-view.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"list-view.d.ts","sourceRoot":"","sources":["../src/list-view.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAe,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,KAAK,EAAE,SAAS,EAAO,MAAM,OAAO,CAAC;AAG5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAgBhD;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,OAAO,IAAI,IAAI,CAAC,gBAAgB,EAAE,MAAM,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAC5G,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAExB;;;;GAIG;AACH,eAAO,MAAM,QAAQ,GAAI,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,OAAO,EAAE,OAAO,sBAAsB,CAAC,CAAC,EAAE,CAAC,CAAC,KAAG,SAiDxF,CAAC"}
1
+ {"version":3,"file":"list-view.d.ts","sourceRoot":"","sources":["../src/list-view.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAkBhD;;;GAGG;AACH,iBAAS,QAAQ,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,OAAO,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,SAAS,CAwBjF;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC"}
package/dist/list-view.js CHANGED
@@ -1,31 +1,35 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { GtkListView } from "@gtkx/jsx/gtk";
3
- import { CollectionView } from "./collection-view.js";
4
- const factoryBinding = {
5
- install: (widget, factory) => widget.setFactory(factory),
6
- uninstall: (widget) => widget.setFactory(null),
7
- };
8
- const headerFactoryBinding = {
9
- install: (widget, factory) => widget.setHeaderFactory(factory),
10
- uninstall: (widget) => widget.setHeaderFactory(null),
11
- };
12
- const modelBinding = {
13
- install: (widget, model) => widget.setModel(model),
14
- };
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { GtkListView, GtkSignalListItemFactory } from "@gtkx/jsx/gtk";
3
+ import { omit } from "@gtkx/utils";
4
+ import { HeaderPortals, ItemPortals, useHeaderCells, useItemCells } from "./internal/cells.js";
5
+ import { useCollection } from "./internal/use-collection.js";
6
+ const LIST_VIEW_PROPS = [
7
+ "items",
8
+ "sections",
9
+ "renderItem",
10
+ "renderHeader",
11
+ "selectedIds",
12
+ "onSelectionChanged",
13
+ "selectionMode",
14
+ "expandedIds",
15
+ "onExpandedChange",
16
+ "estimatedItemHeight",
17
+ "estimatedItemWidth",
18
+ ];
15
19
  /**
16
- * A `GtkListView` driven by a declarative `items`/`renderItem` API with
17
- * optional controlled selection, section headers, and tree autoexpansion.
18
- * Supplying an external `model` switches to the uncontrolled form.
20
+ * Renders a Gtk.ListView from declarative items or sections, with per-row rendering,
21
+ * controlled selection, controlled tree expansion, and estimated item sizing.
19
22
  */
20
- export const ListView = (props) => {
21
- const { ref, items, model, renderItem, autoexpand, renderHeader, selected, selectionMode, onSelectionChanged, estimatedItemHeight, estimatedItemWidth, ...intrinsicProps } = props;
22
- const renderItemFn = renderItem;
23
- const slotRenderer = (value, treeRow, isHeader) => {
24
- if (isHeader)
25
- return null;
26
- return treeRow === null ? renderItemFn(value) : renderItemFn(value, treeRow);
27
- };
28
- const useHeader = model === undefined && typeof renderHeader === "function";
29
- return (_jsx(CollectionView, { element: GtkListView, intrinsicProps: intrinsicProps, ref: ref, items: model === undefined ? items : undefined, model: model, renderItem: slotRenderer, autoexpand: autoexpand, renderHeader: useHeader ? (value) => renderHeader?.(value) ?? null : undefined, estimatedHeight: estimatedItemHeight, estimatedWidth: estimatedItemWidth, selected: selected, selectionMode: selectionMode, onSelectionChanged: onSelectionChanged, factoryBinding: factoryBinding, headerFactoryBinding: useHeader ? headerFactoryBinding : undefined, modelBinding: modelBinding }));
30
- };
23
+ function ListView(props) {
24
+ const { renderItem, renderHeader, expandedIds, estimatedItemHeight, estimatedItemWidth } = props;
25
+ const rest = omit(props, LIST_VIEW_PROPS);
26
+ const size = { width: estimatedItemWidth ?? -1, height: estimatedItemHeight ?? -1 };
27
+ const { collection, selection } = useCollection(props);
28
+ 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 }))] }));
33
+ }
34
+ export { ListView };
31
35
  //# sourceMappingURL=list-view.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"list-view.js","sourceRoot":"","sources":["../src/list-view.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,WAAW,EAAyB,MAAM,eAAe,CAAC;AAEnE,OAAO,EAAE,cAAc,EAAqB,MAAM,sBAAsB,CAAC;AAIzE,MAAM,cAAc,GAAG;IACnB,OAAO,EAAE,CAAC,MAAoB,EAAE,OAAkC,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC;IACjG,SAAS,EAAE,CAAC,MAAoB,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC;CAC/D,CAAC;AAEF,MAAM,oBAAoB,GAAG;IACzB,OAAO,EAAE,CAAC,MAAoB,EAAE,OAAkC,EAAE,EAAE,CAAC,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC;IACvG,SAAS,EAAE,CAAC,MAAoB,EA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MAAM,SAAS,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IACrC,MAAM,WAAW,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;IAEzC,OAAO,CACH,8BACI,KAAC,WAAW,IACR,KAAK,EAAE,SAAS,EAChB,OAAO,EAAE,KAAC,wBAAwB,OAAK,SAAS,CAAC,QAAQ,GAAI,KACzD,CAAC,YAAY,IAAI,IAAI,IAAI;oBACzB,aAAa,EAAE,KAAC,wBAAwB,OAAK,WAAW,CAAC,QAAQ,GAAI;iBACxE,CAAC,KACE,IAAI,GACV,EACF,KAAC,WAAW,IAAC,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,GAAI,EACtG,YAAY,IAAI,IAAI,IAAI,CACrB,KAAC,aAAa,IAAC,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,GAAI,CACtF,IACF,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 { 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"]}
@@ -0,0 +1,12 @@
1
+ import type { ElementType, ReactNode } from "react";
2
+ import type { SizeGroupChildProps, SizeGroupProps } from "./types.js";
3
+ type SizeGroupComponent = ((props: SizeGroupProps) => ReactNode) & {
4
+ Child: <C extends ElementType>(props: SizeGroupChildProps<C>) => ReactNode;
5
+ };
6
+ /**
7
+ * Creates a Gtk.SizeGroup that keeps widgets joined through `SizeGroup.Child`
8
+ * at a common size in the given mode, without contributing a widget of its own.
9
+ */
10
+ declare const SizeGroup: SizeGroupComponent;
11
+ export { SizeGroup };
12
+ //# sourceMappingURL=size-group.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"size-group.d.ts","sourceRoot":"","sources":["../src/size-group.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAoB,MAAM,OAAO,CAAC;AAItE,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAStE,KAAK,kBAAkB,GAAG,CAAC,CAAC,KAAK,EAAE,cAAc,KAAK,SAAS,CAAC,GAAG;IAC/D,KAAK,EAAE,CAAC,CAAC,SAAS,WAAW,EAAE,KAAK,EAAE,mBAAmB,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC;CAC9E,CAAC;AAIF;;;GAGG;AACH,QAAA,MAAM,SAAS,EAAE,kBAA4E,CAAC;AAoD9F,OAAO,EAAE,SAAS,EAAE,CAAC"}
@@ -0,0 +1,41 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { GtkSizeGroup } from "@gtkx/jsx/gtk";
3
+ import { useMergedRef } from "@gtkx/react/internal";
4
+ import { createContext, useCallback, useContext, useState } from "react";
5
+ const SizeGroupContext = createContext(null);
6
+ const SizeGroupChild = SizeGroupChildImpl;
7
+ /**
8
+ * Creates a Gtk.SizeGroup that keeps widgets joined through `SizeGroup.Child`
9
+ * at a common size in the given mode, without contributing a widget of its own.
10
+ */
11
+ const SizeGroup = Object.assign(SizeGroupRoot, { Child: SizeGroupChild });
12
+ const useRegister = () => {
13
+ const register = useContext(SizeGroupContext);
14
+ if (register === null) {
15
+ throw new Error("<SizeGroup.Child> must be a child of <SizeGroup>");
16
+ }
17
+ return register;
18
+ };
19
+ function SizeGroupChildImpl(props) {
20
+ const { component: Component, ref, ...rest } = props;
21
+ const refCallback = useMergedRef(ref, useRegister());
22
+ return _jsx(Component, { ...rest, ref: refCallback });
23
+ }
24
+ const addWidget = (widgets, widget) => widgets.includes(widget) ? widgets : [...widgets, widget];
25
+ const removeWidget = (widgets, widget) => widgets.filter((entry) => entry !== widget);
26
+ function SizeGroupRoot(props) {
27
+ const { mode, ref, children } = props;
28
+ const [widgets, setWidgets] = useState([]);
29
+ const register = useCallback((widget) => {
30
+ if (widget === null) {
31
+ return;
32
+ }
33
+ setWidgets((previous) => addWidget(previous, widget));
34
+ return () => {
35
+ setWidgets((previous) => removeWidget(previous, widget));
36
+ };
37
+ }, [setWidgets]);
38
+ return (_jsxs(_Fragment, { children: [_jsx(GtkSizeGroup, { ref: ref, mode: mode, widgets: widgets }), _jsx(SizeGroupContext.Provider, { value: register, children: children })] }));
39
+ }
40
+ export { SizeGroup };
41
+ //# sour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,YAAY,GAAG,CAAC,OAAqB,EAAE,MAAkB,EAAgB,EAAE,CAC7E,OAAO,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,MAAM,CAAC,CAAC;AAEhD,SAAS,aAAa,CAAC,KAAqB;IACxC,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IACtC,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAe,EAAE,CAAC,CAAC;IAEzD,MAAM,QAAQ,GAAG,WAAW,CACxB,CAAC,MAAM,EAAE,EAAE;QACP,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;YAClB,OAAO;QACX,CAAC;QAED,UAAU,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;QAEtD,OAAO,GAAG,EAAE;YACR,UAAU,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;QAC7D,CAAC,CAAC;IACN,CAAC,EACD,CAAC,UAAU,CAAC,CACf,CAAC;IAEF,OAAO,CACH,8BACI,KAAC,YAAY,IAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,GAAI,EACxD,KAAC,gBAAgB,CAAC,QAAQ,IAAC,KAAK,EAAE,QAAQ,YAAG,QAAQ,GAA6B,IACnF,CACN,CAAC;AACN,CAAC;AAED,OAAO,EAAE,SAAS,EAAE,CAAC","sourcesContent":["import type * as Gtk from \"@gtkx/gi/gtk\";\nimport type { ElementType, ReactNode, Ref, RefCallback } from \"react\";\nimport { GtkSizeGroup } from \"@gtkx/jsx/gtk\";\nimport { useMergedRef } from \"@gtkx/react/internal\";\nimport { createContext, useCallback, useContext, useState } from \"react\";\nimport type { SizeGroupChildProps, SizeGroupProps } from \"./types.js\";\n\ntype Register = RefCallback<Gtk.Widget | null>;\n\ntype SizeGroupChildRuntimeProps = {\n component: ElementType;\n ref?: Ref<Gtk.Widget | null> | undefined;\n} & Record<string, unknown>;\n\ntype SizeGroupComponent = ((props: SizeGroupProps) => ReactNode) & {\n Child: <C extends ElementType>(props: SizeGroupChildProps<C>) => ReactNode;\n};\n\nconst SizeGroupContext = createContext<Register | null>(null);\nconst SizeGroupChild = SizeGroupChildImpl as <C extends ElementType>(props: SizeGroupChildProps<C>) => ReactNode;\n/**\n * Creates a Gtk.SizeGroup that keeps widgets joined through `SizeGroup.Child`\n * at a common size in the given mode, without contributing a widget of its own.\n */\nconst SizeGroup: SizeGroupComponent = Object.assign(SizeGroupRoot, { Child: SizeGroupChild });\n\nconst useRegister = (): Register => {\n const register = useContext(SizeGroupContext);\n\n if (register === null) {\n throw new Error(\"<SizeGroup.Child> must be a child of <SizeGroup>\");\n }\n\n return register;\n};\n\nfunction SizeGroupChildImpl(props: SizeGroupChildRuntimeProps): ReactNode {\n const { component: Component, ref, ...rest } = props;\n const refCallback = useMergedRef<Gtk.Widget | null>(ref, useRegister());\n\n return <Component {...rest} ref={refCallback} />;\n}\n\nconst addWidget = (widgets: Gtk.Widget[], widget: Gtk.Widget): Gtk.Widget[] =>\n widgets.includes(widget) ? widgets : [...widgets, widget];\n\nconst removeWidget = (widgets: Gtk.Widget[], widget: Gtk.Widget): Gtk.Widget[] =>\n widgets.filter((entry) => entry !== widget);\n\nfunction SizeGroupRoot(props: SizeGroupProps): ReactNode {\n const { mode, ref, children } = props;\n const [widgets, setWidgets] = useState<Gtk.Widget[]>([]);\n\n const register = useCallback<Register>(\n (widget) => {\n if (widget === null) {\n return;\n }\n\n setWidgets((previous) => addWidget(previous, widget));\n\n return () => {\n setWidgets((previous) => removeWidget(previous, widget));\n };\n },\n [setWidgets],\n );\n\n return (\n <>\n <GtkSizeGroup ref={ref} mode={mode} widgets={widgets} />\n <SizeGroupContext.Provider value={register}>{children}</SizeGroupContext.Provider>\n </>\n );\n}\n\nexport { SizeGroup };\n"]}
package/dist/types.d.ts CHANGED
@@ -1,198 +1,141 @@
1
- import type * as Gio from "@gtkx/gi/gio";
2
- import type * as GObject from "@gtkx/gi/gobject";
3
1
  import type * as Gtk from "@gtkx/gi/gtk";
4
- import type { ReactNode } from "react";
2
+ import type { GtkColumnViewColumnProps, GtkColumnViewProps, GtkDropDown, 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>;
8
+ /** Props of a component whose backing widget defaults to one type but can be swapped through `component`. */
9
+ type WidgetProps<C extends ElementType, Own = unknown, ExtraOmit extends string = never> = Own & {
10
+ component?: C;
11
+ } & Omit<ComponentPropsWithRef<C>, ExtraOmit | keyof Own>;
5
12
  /**
6
- * A declarative item rendered by the {@link ListView}, {@link GridView},
7
- * {@link ColumnView}, and {@link DropDown} components.
8
- *
9
- * A non-section item carries an arbitrary value of type `T` and may declare
10
- * tree `children`. A section item carries a value of type `S` and groups a list
11
- * of child items underneath a header.
13
+ * A single item in a collection model, identified by a stable id and holding an
14
+ * arbitrary value. Nested items form a tree.
12
15
  */
13
- export type ListItem<T = unknown, S = unknown> = {
16
+ type Item<T = unknown> = {
17
+ /** Stable identifier used to track the item across updates and selection. */
14
18
  id: string;
15
19
  value: T;
16
- section?: false | undefined;
17
- children?: ListItem<T, S>[] | undefined;
20
+ children?: Item<T>[] | undefined;
21
+ /** Hides the tree expander arrow even when the item has children. */
18
22
  hideExpander?: boolean | undefined;
23
+ /** Adds indentation matching the item's depth in the tree. */
19
24
  indentForDepth?: boolean | undefined;
25
+ /** Reserves indentation space for an expander icon. */
20
26
  indentForIcon?: boolean | undefined;
21
- } | {
27
+ };
28
+ /** A group of items rendered under a shared section header. */
29
+ type Section<S = unknown, T = unknown> = {
30
+ /** Stable identifier used to track the section across updates. */
22
31
  id: string;
23
32
  value: S;
24
- section: true;
25
- children: ListItem<T, S>[];
33
+ /** Items belonging to this section. */
34
+ data: Item<T>[];
35
+ };
36
+ /** Arguments passed to an {@link ItemRenderer} when rendering one cell. */
37
+ type RenderItemArgs<T> = {
38
+ item: T;
39
+ index: number;
40
+ /** Depth of the item within a tree, starting at zero for top-level items. */
41
+ depth?: number | undefined;
42
+ /** Whether the item is currently expanded in a tree view. */
43
+ isExpanded?: boolean | undefined;
26
44
  };
27
- type ListViewSharedProps = {
45
+ /** Arguments passed to a {@link HeaderRenderer} when rendering one section header. */
46
+ type RenderHeaderArgs<S> = {
47
+ section: S;
48
+ };
49
+ /** Renders the contents of one cell of a collection view. */
50
+ type ItemRenderer<T> = (args: RenderItemArgs<T>) => ReactNode;
51
+ /** Renders the contents of one section header of a collection view. */
52
+ type HeaderRenderer<S> = (args: RenderHeaderArgs<S>) => ReactNode;
53
+ type ItemSizeProps = {
28
54
  estimatedItemHeight?: number | undefined;
29
55
  estimatedItemWidth?: number | undefined;
30
56
  };
31
- type ListViewControlledSelectionProps = {
32
- selected?: string[] | null | undefined;
57
+ type SelectionProps = {
58
+ selectedIds?: string[] | null | undefined;
33
59
  onSelectionChanged?: ((ids: string[]) => void) | null | undefined;
34
60
  selectionMode?: Gtk.SelectionMode | null | undefined;
35
61
  };
36
- type UncontrolledItemType<T> = [T] extends [GObject.Object] ? T : GObject.Object;
37
- /**
38
- * Props for the {@link ListView} component, replacing the raw `GtkListView`
39
- * factory/model surface with a declarative `items`/`renderItem` API, optional
40
- * controlled selection, section headers, and tree autoexpansion. Supplying an
41
- * external `model` switches to the uncontrolled form.
42
- */
43
- export type ListViewProps<T = unknown, S = unknown> = ListViewSharedProps & ((ListViewControlledSelectionProps & {
44
- items?: ListItem<T, S>[] | undefined;
45
- renderItem: (item: T, row?: Gtk.TreeListRow | null) => ReactNode;
46
- autoexpand?: boolean | undefined;
47
- renderHeader?: ((item: S) => ReactNode) | null | undefined;
48
- model?: never;
49
- }) | {
50
- model: Gio.ListModel;
51
- renderItem: (item: UncontrolledItemType<T>) => ReactNode;
52
- items?: never;
53
- autoexpand?: never;
54
- renderHeader?: never;
55
- selected?: never;
56
- onSelectionChanged?: never;
57
- selectionMode?: never;
58
- });
59
- /**
60
- * Props for the {@link GridView} component, replacing the raw `GtkGridView`
61
- * factory/model surface with a declarative `items`/`renderItem` API and
62
- * optional controlled selection. Supplying an external `model` switches to the
63
- * uncontrolled form.
64
- */
65
- export type GridViewProps<T = unknown> = ListViewSharedProps & ((ListViewControlledSelectionProps & {
66
- items?: ListItem<T>[] | undefined;
67
- renderItem: (item: T) => ReactNode;
68
- model?: never;
69
- }) | {
70
- model: Gio.ListModel;
71
- renderItem: (item: UncontrolledItemType<T>) => ReactNode;
72
- items?: never;
73
- selected?: never;
74
- onSelectionChanged?: never;
75
- selectionMode?: never;
76
- });
77
- type ColumnViewSortProps = {
78
- sortColumn?: string | null | undefined;
79
- sortOrder?: Gtk.SortType | null | undefined;
80
- onSortChanged?: ((column: string | null, order: Gtk.SortType) => void) | null | undefined;
81
- estimatedRowHeight?: number | null | undefined;
62
+ type ExpansionProps = {
63
+ expandedIds?: string[] | null | undefined;
64
+ onExpandedChange?: ((ids: string[]) => void) | null | undefined;
82
65
  };
83
- /**
84
- * Props for the {@link ColumnView} component, replacing the raw `GtkColumnView`
85
- * surface with a declarative `items` model, optional controlled selection,
86
- * controlled sorting, and section headers. Columns are declared as
87
- * {@link ColumnViewColumn} children. Supplying an external `model` switches to
88
- * the uncontrolled form.
89
- */
90
- export type ColumnViewProps<T = unknown, S = unknown> = ColumnViewSortProps & ((ListViewControlledSelectionProps & {
91
- items?: ListItem<T, S>[] | undefined;
92
- renderHeader?: ((item: S) => ReactNode) | null | undefined;
93
- model?: never;
94
- }) | {
95
- model: Gio.ListModel;
96
- items?: never;
97
- renderHeader?: never;
98
- selected?: never;
99
- onSelectionChanged?: never;
100
- selectionMode?: never;
101
- });
102
- /**
103
- * Props for a single {@link ColumnViewColumn} of a {@link ColumnView},
104
- * replacing the raw `GtkColumnViewColumn` factory/sorter surface with a
105
- * declarative `renderCell` callback and an optional header context menu.
106
- */
107
- export type ColumnViewColumnProps<T = unknown> = {
108
- title: string;
109
- expand?: boolean | undefined;
110
- resizable?: boolean | undefined;
111
- fixedWidth?: number | undefined;
66
+ type SourceProps<T, S> = {
67
+ items?: Item<T>[] | undefined;
68
+ sections?: Section<S, T>[] | undefined;
69
+ };
70
+ /** One column of a {@link ColumnView}, pairing Gtk.ColumnViewColumn props with a cell renderer. */
71
+ type Column<T = unknown> = Omit<GtkColumnViewColumnProps, "factory" | "sorter" | "id" | "title"> & {
72
+ /** Stable identifier, also used to address the column through sorting props. */
112
73
  id: string;
74
+ title: string;
75
+ renderCell: ItemRenderer<T>;
76
+ /** Whether clicking the column header sorts by it. */
113
77
  sortable?: boolean | undefined;
114
- visible?: boolean | undefined;
115
- renderCell: (item: T) => ReactNode;
116
78
  headerMenu?: ReactNode;
117
79
  };
80
+ type ColumnViewOwnProps<T, S> = SelectionProps & ExpansionProps & SourceProps<T, S> & Omit<ItemSizeProps, "estimatedItemWidth"> & {
81
+ columns: Column<T>[];
82
+ renderHeader?: HeaderRenderer<S> | null | undefined;
83
+ /** Id of the column the view is sorted by, making sorting controlled. */
84
+ sortColumn?: string | null | undefined;
85
+ sortOrder?: Gtk.SortType | null | undefined;
86
+ onSortChanged?: ((column: string | null, order: Gtk.SortType) => void) | null | undefined;
87
+ };
118
88
  /**
119
- * Props shared by the {@link DropDown} and {@link ComboRow} components,
120
- * replacing the raw factory/model surface with declarative `items`, controlled
121
- * `selectedId`, and per-slot renderers for the selected face, the popup list,
122
- * and section headers. Supplying an external `model` switches to the
123
- * uncontrolled form.
89
+ * Props for {@link ColumnView}. Combines the underlying Gtk.ColumnView props with
90
+ * declarative collection props: flat items or grouped sections, controlled selection
91
+ * and expansion, sorting (sortColumn, sortOrder, onSortChanged), an optional section
92
+ * header renderer, and the columns to render.
124
93
  */
125
- export type DropDownProps<T = unknown, S = unknown> = {
126
- items?: ListItem<T, S>[] | undefined;
94
+ type ColumnViewProps<T = unknown, S = unknown> = Omit<GtkColumnViewProps, "columns" | "model" | "headerFactory" | keyof ColumnViewOwnProps<T, S>> & ColumnViewOwnProps<T, S>;
95
+ type DropDownOwnProps<T, S> = SourceProps<T, S> & {
96
+ /** Id of the currently selected item, making the selection controlled. */
127
97
  selectedId?: string | null | undefined;
128
98
  onSelectionChanged?: ((id: string) => void) | null | undefined;
129
- renderItem?: ((item: T) => ReactNode) | null | undefined;
130
- renderListItem?: ((item: T) => ReactNode) | null | undefined;
131
- renderHeader?: ((item: S) => ReactNode) | null | undefined;
132
- model?: never;
133
- } | {
134
- model: Gio.ListModel;
135
- renderItem?: ((item: UncontrolledItemType<T>) => ReactNode) | null | undefined;
136
- renderListItem?: ((item: UncontrolledItemType<T>) => ReactNode) | null | undefined;
137
- items?: never;
138
- selectedId?: never;
139
- onSelectionChanged?: never;
140
- renderHeader?: never;
99
+ renderItem?: ItemRenderer<T> | null | undefined;
100
+ /** Renderer for items in the open popup list, falling back to renderItem when omitted. */
101
+ renderListItem?: ItemRenderer<T> | null | undefined;
102
+ /** Renderer for section headers in the popup list. */
103
+ renderHeader?: HeaderRenderer<S> | null | undefined;
141
104
  };
142
105
  /**
143
- * A single declarative entry in a {@link Menu} model. An entry is a plain item
144
- * (`label` plus `action`), a `submenu`, or a `section` of nested entries.
106
+ * Props for {@link DropDown}. The backing widget is chosen through the `component` prop, defaulting to
107
+ * GtkDropDown, and its own props combine with the declarative collection props.
145
108
  */
146
- export type MenuEntry = {
147
- label?: string | undefined;
148
- action?: string | undefined;
149
- submenu?: MenuEntry[] | undefined;
150
- section?: MenuEntry[] | undefined;
109
+ type DropDownProps<T = unknown, S = unknown, C extends ElementType = typeof GtkDropDown> = WidgetProps<C, DropDownOwnProps<T, S>, "model" | "factory" | "listFactory" | "headerFactory">;
110
+ type GridViewOwnProps<T> = ItemSizeProps & SelectionProps & {
111
+ items?: Item<T>[] | undefined;
112
+ renderItem: ItemRenderer<T>;
151
113
  };
152
114
  /**
153
- * The declarative menu-model surface added by the {@link Menu} component on top
154
- * of the raw `GMenu` element.
115
+ * Props for {@link GridView}. Combines the underlying Gtk.GridView props with
116
+ * declarative collection props: items, a per-cell renderItem, controlled selection,
117
+ * and estimated item sizing.
155
118
  */
156
- export type MenuItemsProps = {
157
- items?: MenuEntry[] | null | undefined;
158
- };
159
- /**
160
- * Props for a `<ConstraintLayout.Constraint>` declaring a single relation
161
- * between a target attribute and a source attribute within a
162
- * {@link ConstraintLayout}.
163
- */
164
- export type ConstraintProps = {
165
- target?: string;
166
- targetAttribute: Gtk.ConstraintAttribute;
167
- relation?: Gtk.ConstraintRelation;
168
- source?: string;
169
- sourceAttribute?: Gtk.ConstraintAttribute;
170
- multiplier?: number;
171
- constant?: number;
172
- strength?: number;
173
- };
174
- /**
175
- * Props for a `<ConstraintLayout.Guide>` declaring an invisible layout guide
176
- * that other constraints can reference by `id` within a {@link ConstraintLayout}.
177
- */
178
- export type ConstraintGuideProps = {
179
- id: string;
180
- minWidth?: number;
181
- minHeight?: number;
182
- natWidth?: number;
183
- natHeight?: number;
184
- maxWidth?: number;
185
- maxHeight?: number;
186
- strength?: Gtk.ConstraintStrength;
119
+ type GridViewProps<T = unknown> = Omit<GtkGridViewProps, "model" | "factory" | keyof GridViewOwnProps<T>> & GridViewOwnProps<T>;
120
+ type ListViewOwnProps<T, S> = ItemSizeProps & SelectionProps & ExpansionProps & SourceProps<T, S> & {
121
+ renderItem: ItemRenderer<T>;
122
+ renderHeader?: HeaderRenderer<S> | null | undefined;
187
123
  };
188
124
  /**
189
- * Props for a `<ConstraintLayout.Vfl>` declaring constraints through the GTK
190
- * Visual Format Language within a {@link ConstraintLayout}.
125
+ * Props for {@link ListView}. Combines the underlying Gtk.ListView props with
126
+ * declarative collection props: flat items or grouped sections, a per-row renderItem,
127
+ * an optional section header renderer, controlled selection and expansion, and
128
+ * estimated item sizing.
191
129
  */
192
- export type ConstraintVflProps = {
193
- lines: string[];
194
- hspacing?: number;
195
- vspacing?: number;
130
+ type ListViewProps<T = unknown, S = unknown> = Omit<GtkListViewProps, "model" | "factory" | "headerFactory" | keyof ListViewOwnProps<T, S>> & ListViewOwnProps<T, S>;
131
+ /** Props for {@link SizeGroup}. */
132
+ type SizeGroupProps = {
133
+ /** How the group equalizes sizes: horizontal, vertical, or both. */
134
+ mode?: Gtk.SizeGroupMode | null | undefined;
135
+ ref?: Ref<Gtk.SizeGroup | null>;
136
+ children?: ReactNode;
196
137
  };
197
- export {};
138
+ /** Adds a single widget, rendered by the given component, to the enclosing {@link SizeGroup}. */
139
+ type SizeGroupChildProps<C extends ElementType> = ChildProps<C>;
140
+ export { type SelectionProps, type ExpansionProps, type ChildProps, type WidgetProps, 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, };
198
141
  //# sourceMappingURL=types.d.ts.map
@@ -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,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC;;;;;;;GAOG;AACH,MAAM,MAAM,QAAQ,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,OAAO,IACvC;IACI,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,CAAC,CAAC;IACT,OAAO,CAAC,EAAE,KAAK,GAAG,SAAS,CAAC;IAC5B,QAAQ,CAAC,EAAE,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,GAA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CAAC;AAEF,iGAAiG;AACjG,KAAK,mBAAmB,CAAC,CAAC,SAAS,WAAW,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC;AAEhE,OAAO,EACH,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,IAAI,EACT,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,MAAM,EACX,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,mBAAmB,GAC3B,CAAC"}
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AA4LA,OAAO,EAkBN,CAAC","sourcesContent":["import type * as Gtk from \"@gtkx/gi/gtk\";\nimport type {\n GtkColumnViewColumnProps,\n GtkColumnViewProps,\n GtkDropDown,\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/** Props of a component whose backing widget defaults to one type but can be swapped through `component`. */\ntype WidgetProps<C extends ElementType, Own = unknown, ExtraOmit extends string = never> = Own & {\n component?: C;\n} & Omit<ComponentPropsWithRef<C>, ExtraOmit | keyof Own>;\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\n/**\n * Props for {@link DropDown}. The backing widget is chosen through the `component` prop, defaulting to\n * GtkDropDown, and its own props combine with the declarative collection props.\n */\ntype DropDownProps<T = unknown, S = unknown, C extends ElementType = typeof GtkDropDown> = WidgetProps<\n C,\n DropDownOwnProps<T, S>,\n \"model\" | \"factory\" | \"listFactory\" | \"headerFactory\"\n>;\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 WidgetProps,\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"]}