@gtkx/components 2.0.0-beta.10 → 2.0.0-beta.12

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 (86) hide show
  1. package/README.md +8 -168
  2. package/dist/column-view.d.ts.map +1 -1
  3. package/dist/column-view.js +20 -10
  4. package/dist/column-view.js.map +1 -1
  5. package/dist/grid-view.js +1 -1
  6. package/dist/index.d.ts +4 -2
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +3 -1
  9. package/dist/index.js.map +1 -1
  10. package/dist/internal/cells.d.ts +10 -7
  11. package/dist/internal/cells.d.ts.map +1 -1
  12. package/dist/internal/cells.js +88 -51
  13. package/dist/internal/cells.js.map +1 -1
  14. package/dist/internal/collection-index.d.ts +3 -2
  15. package/dist/internal/collection-index.d.ts.map +1 -1
  16. package/dist/internal/collection-index.js +3 -3
  17. package/dist/internal/collection-index.js.map +1 -1
  18. package/dist/internal/collection-model.d.ts +23 -2
  19. package/dist/internal/collection-model.d.ts.map +1 -1
  20. package/dist/internal/collection-model.js +118 -98
  21. package/dist/internal/collection-model.js.map +1 -1
  22. package/dist/internal/collection.d.ts +5 -4
  23. package/dist/internal/collection.d.ts.map +1 -1
  24. package/dist/internal/collection.js +20 -21
  25. package/dist/internal/collection.js.map +1 -1
  26. package/dist/internal/controlled-sync.d.ts +6 -8
  27. package/dist/internal/controlled-sync.d.ts.map +1 -1
  28. package/dist/internal/controlled-sync.js +3 -3
  29. package/dist/internal/controlled-sync.js.map +1 -1
  30. package/dist/internal/drop-down.d.ts.map +1 -1
  31. package/dist/internal/drop-down.js +44 -45
  32. package/dist/internal/drop-down.js.map +1 -1
  33. package/dist/internal/expansion.js +4 -4
  34. package/dist/internal/expansion.js.map +1 -1
  35. package/dist/internal/keys.d.ts.map +1 -1
  36. package/dist/internal/selection.d.ts +1 -0
  37. package/dist/internal/selection.d.ts.map +1 -1
  38. package/dist/internal/selection.js +6 -6
  39. package/dist/internal/selection.js.map +1 -1
  40. package/dist/internal/tree-expansion.d.ts +1 -1
  41. package/dist/internal/tree-expansion.d.ts.map +1 -1
  42. package/dist/internal/tree-expansion.js +3 -12
  43. package/dist/internal/tree-expansion.js.map +1 -1
  44. package/dist/internal/tree-order.d.ts +1 -1
  45. package/dist/internal/tree-order.d.ts.map +1 -1
  46. package/dist/internal/tree-order.js +33 -77
  47. package/dist/internal/tree-order.js.map +1 -1
  48. package/dist/internal/use-collection.d.ts +5 -1
  49. package/dist/internal/use-collection.d.ts.map +1 -1
  50. package/dist/internal/use-collection.js +21 -7
  51. package/dist/internal/use-collection.js.map +1 -1
  52. package/dist/internal/use-widget-ref.d.ts.map +1 -1
  53. package/dist/list-item-factory.d.ts +10 -0
  54. package/dist/list-item-factory.d.ts.map +1 -0
  55. package/dist/list-item-factory.js +14 -0
  56. package/dist/list-item-factory.js.map +1 -0
  57. package/dist/list-view.js +1 -1
  58. package/dist/tab-collection.d.ts +9 -0
  59. package/dist/tab-collection.d.ts.map +1 -0
  60. package/dist/tab-collection.js +114 -0
  61. package/dist/tab-collection.js.map +1 -0
  62. package/dist/toast.d.ts +3 -5
  63. package/dist/toast.d.ts.map +1 -1
  64. package/dist/toast.js +3 -12
  65. package/dist/toast.js.map +1 -1
  66. package/dist/types.d.ts +67 -51
  67. package/dist/types.d.ts.map +1 -1
  68. package/dist/types.js.map +1 -1
  69. package/package.json +13 -21
  70. package/src/column-view.tsx +23 -12
  71. package/src/index.ts +7 -2
  72. package/src/internal/cells.tsx +155 -103
  73. package/src/internal/collection-index.ts +8 -6
  74. package/src/internal/collection-model.ts +156 -134
  75. package/src/internal/collection.ts +28 -24
  76. package/src/internal/controlled-sync.ts +9 -12
  77. package/src/internal/drop-down.tsx +63 -63
  78. package/src/internal/expansion.ts +4 -4
  79. package/src/internal/selection.tsx +8 -8
  80. package/src/internal/tree-expansion.ts +3 -23
  81. package/src/internal/tree-order.ts +34 -130
  82. package/src/internal/use-collection.tsx +29 -8
  83. package/src/list-item-factory.tsx +27 -0
  84. package/src/tab-collection.tsx +124 -0
  85. package/src/toast.tsx +4 -18
  86. package/src/types.ts +81 -55
package/README.md CHANGED
@@ -1,177 +1,17 @@
1
- <p align="center">
2
- <img src="https://raw.githubusercontent.com/gtkx-org/gtkx/main/logo.svg" alt="GTKX" width="100" />
3
- </p>
1
+ # @gtkx/components
4
2
 
5
- <h1 align="center">GTKX</h1>
3
+ Collection views, selection controls, tabs, and toasts for GTKX.
6
4
 
7
- <p align="center">
8
- The React framework for Linux.<br />
9
- Write native GNOME applications with React and TypeScript.
10
- Real Adwaita and GTK4 widgets with standard web tooling.
11
- </p>
5
+ Use `ListView`, `GridView`, and `ColumnView` with React data and render functions, or `DropDown` and `ComboRow` for selection controls. `createTabCollection` preserves tab state across windows. `ToastProvider` and `useToast` manage notifications.
12
6
 
13
- <p align="center">
14
- <a href="https://www.npmjs.com/package/create-gtkx"><img src="https://img.shields.io/npm/v/create-gtkx?color=cb3837&logo=npm&label=create-gtkx" alt="npm version" /></a>
15
- <a href="https://www.npmjs.com/package/create-gtkx"><img src="https://img.shields.io/npm/dm/create-gtkx?color=cb3837&logo=npm&label=downloads" alt="npm downloads" /></a>
16
- <img src="https://img.shields.io/badge/node-%E2%89%A526.7-339933?logo=node.js&logoColor=white" alt="Node >= 26.7" />
17
- <a href="https://github.com/gtkx-org/gtkx/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MPL--2.0-blue.svg" alt="License: MPL-2.0" /></a>
18
- <a href="https://github.com/gtkx-org/gtkx/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/gtkx-org/gtkx/ci.yml?branch=main&logo=github&label=CI" alt="CI status" /></a>
19
- <img src="https://img.shields.io/badge/TypeScript-strict-3178c6?logo=typescript&logoColor=white" alt="TypeScript" />
20
- </p>
21
-
22
- <p align="center">
23
- <a href="https://gtkx.dev">Homepage</a> &middot;
24
- <a href="https://gtkx.dev/guide/getting-started">Documentation</a> &middot;
25
- <a href="https://github.com/gtkx-org/gtkx/tree/main/examples">Examples</a> &middot;
26
- <a href="https://github.com/gtkx-org/gtkx/blob/main/CONTRIBUTING.md">Contributing</a>
27
- </p>
28
-
29
- ---
30
-
31
- <p align="center">
32
- <img src="https://raw.githubusercontent.com/gtkx-org/gtkx/main/examples/tutorial/assets/screenshot.png" alt="The Tasks app: an Adwaita window with a sidebar of smart views and colored lists on the left, and a boxed task list on the right." />
33
- </p>
34
-
35
- <p align="center">
36
- <em>The Tasks app you build in the <a href="https://gtkx.dev/tutorial/">tutorial</a>.</em>
37
- </p>
38
-
39
- ## Demo
40
-
41
- This app starts with an Adwaita application shell, renders native GTK4 widgets inside it, and uses ordinary React hooks and events:
42
-
43
- ```tsx
44
- import * as Gtk from "@gtkx/gi/gtk";
45
- import { AdwApplication, AdwApplicationWindow, AdwHeaderBar, AdwToolbarView } from "@gtkx/jsx/adw";
46
- import { GtkBox, GtkButton, GtkLabel } from "@gtkx/jsx/gtk";
47
- import { createRoot, quit } from "@gtkx/react";
48
- import { useState } from "react";
49
-
50
- const Counter = () => {
51
- const [count, setCount] = useState(0);
52
-
53
- return (
54
- <AdwApplicationWindow
55
- title="Hello GTKX"
56
- defaultWidth={400}
57
- defaultHeight={300}
58
- onCloseRequest={quit}
59
- >
60
- <AdwToolbarView topBar={<AdwHeaderBar />}>
61
- <GtkBox
62
- orientation={Gtk.Orientation.VERTICAL}
63
- spacing={20}
64
- marginTop={40}
65
- marginBottom={40}
66
- marginStart={40}
67
- marginEnd={40}
68
- valign={Gtk.Align.CENTER}
69
- halign={Gtk.Align.CENTER}
70
- >
71
- <GtkLabel cssClasses={["title-1"]}>Welcome to GTKX!</GtkLabel>
72
- <GtkLabel cssClasses={["title-2"]}>{`Count: ${String(count)}`}</GtkLabel>
73
- <GtkButton
74
- label="Increment"
75
- onClicked={() => setCount((c) => c + 1)}
76
- cssClasses={["suggested-action", "pill"]}
77
- />
78
- </GtkBox>
79
- </AdwToolbarView>
80
- </AdwApplicationWindow>
81
- );
82
- };
83
-
84
- const App = () => (
85
- <AdwApplication>
86
- <Counter />
87
- </AdwApplication>
88
- );
89
-
90
- createRoot().render(<App />);
91
- ```
92
-
93
- This is the [`hello-world`](https://github.com/gtkx-org/gtkx/tree/main/examples/hello-world) example, with `app.tsx` and `index.tsx` combined into a single snippet. `@gtkx/gi` and `@gtkx/jsx` are per-project bindings generated by the CLI, not packages you install from npm.
94
-
95
- ## Why GTKX
96
-
97
- ### Adwaita-first application development
98
-
99
- GTKX uses Adwaita as the foundation for applications, windows, navigation, dialogs, and adaptive layouts, with the complete GTK4 toolkit underneath. It adds a declarative React layer and an integrated TypeScript toolchain to the GNOME platform:
100
-
101
- - a React reconciler that exposes every GObject as a JSX element,
102
- - a CLI for scaffolding, development, and production builds,
103
- - a dev server with Fast Refresh that patches your running UI in place,
104
- - CSS-in-JS styling, React Hook Form-powered Adwaita controls, gettext-backed react-i18next localization, React Spring animations, React Navigation stack, tab, drawer, and split view navigators, and high-level list, grid, and dialog components,
105
- - a Testing Library-style API for querying and driving your widgets in tests,
106
- - and a Model Context Protocol (MCP) server that exposes your live app to AI agents.
107
-
108
- ### Native GNOME widgets, without a compatibility layer
109
-
110
- React Native and similar frameworks hide the native toolkit so one API can run everywhere. GTKX renders real Adwaita and GTK4 widgets and exposes any other GObject-Introspection library on your system. It is GNOME-native and Linux-only by design.
111
-
112
- ### Why Node.js, and why generated bindings
113
-
114
- GTKX runs on Node.js, which puts native modules, the npm ecosystem, and the tooling built for Node.js APIs within reach. GJS is GNOME's own runtime, built on SpiderMonkey rather than V8; node-gtk runs on Node.js but is lightly maintained, on the older nan/V8 ABI rather than N-API, and still centered on GTK3. The [Why GTKX guide](https://gtkx.dev/guide/why-gtkx) covers what running on Node.js means day to day.
115
-
116
- GTKX generates the TypeScript types and native FFI calls from the same GObject-Introspection data, so the types cannot drift from the calls they back. `Adw-1` is the sole default GIR root; its GIR include pulls in `Gtk-4.0`, so codegen covers both complete API surfaces. Neither belongs in a GTKX 2 `libraries` list.
117
-
118
- At runtime, the native Rust core calls straight into the system Adwaita, GTK4, and GLib libraries through libffi, without loading libgirepository at all.
119
-
120
- ## Quick start
121
-
122
- GTKX is Linux-only and needs Node.js 26.7 or later. See [Requirements](#requirements).
123
-
124
- Scaffold a new app with the `create-gtkx` initializer:
7
+ In an existing GTKX app:
125
8
 
126
9
  ```sh
127
- npm create gtkx@beta
10
+ npm install @gtkx/components@beta
128
11
  ```
129
12
 
130
- The same command works with other package managers: `pnpm create gtkx@beta` or `yarn create gtkx@beta`.
131
-
132
- Then run your new app:
133
-
134
- ```sh
135
- cd my-app
136
- npm run dev
137
- ```
138
-
139
- To go further, follow the [tutorial](https://gtkx.dev/tutorial/).
140
-
141
- ## Documentation
142
-
143
- The documentation at **[gtkx.dev](https://gtkx.dev)** includes a step-by-step tutorial that builds a complete GNOME app, from scaffolding to packaging and shipping, plus guides and a full API reference.
144
-
145
- **[Read the docs &rarr;](https://gtkx.dev/guide/why-gtkx)**
146
-
147
- ## Requirements
148
-
149
- GTKX is Linux-only. You need:
150
-
151
- - Linux with the Adwaita (1.8 or later), GTK4 (4.20 or later), and GLib development libraries
152
- - Node.js 26.7 or later
153
-
154
- The `@gtkx/native` addon ships prebuilt for x64 and arm64 glibc Linux; other targets need to build it from the GTKX repository, which requires a Rust toolchain.
155
-
156
- ## Examples
157
-
158
- Explore the [example apps](https://github.com/gtkx-org/gtkx/tree/main/examples):
159
-
160
- - [`hello-world`](https://github.com/gtkx-org/gtkx/tree/main/examples/hello-world): the Adwaita counter above.
161
- - [`gtk-demo`](https://github.com/gtkx-org/gtkx/tree/main/examples/gtk-demo): the official GTK4 widget showcase in an Adwaita application shell, covering lists, dialogs, gestures, CSS, and OpenGL.
162
- - [`browser`](https://github.com/gtkx-org/gtkx/tree/main/examples/browser): an Adwaita browser built around `WebKitWebView`.
163
- - [`animations`](https://github.com/gtkx-org/gtkx/tree/main/examples/animations): an Adwaita showcase for `@gtkx/animated`, with React Spring animations driven by the GTK frame clock.
164
- - [`navigation`](https://github.com/gtkx-org/gtkx/tree/main/examples/navigation): a tour of `@gtkx/navigation`, React Navigation's stack, tab, and drawer navigators rendered with libadwaita.
165
- - [`tutorial`](https://github.com/gtkx-org/gtkx/tree/main/examples/tutorial): the Tasks app the documentation builds.
166
-
167
- ## Status
168
-
169
- GTKX is stable and ready for production use.
170
-
171
- ## Contributing
172
-
173
- Contributions are welcome. See [CONTRIBUTING.md](https://github.com/gtkx-org/gtkx/blob/main/CONTRIBUTING.md), the [Code of Conduct](https://github.com/gtkx-org/gtkx/blob/main/CODE_OF_CONDUCT.md), and the [security policy](https://github.com/gtkx-org/gtkx/blob/main/SECURITY.md). Building the repo needs Node.js 26.7 or later, pnpm, and a Rust toolchain.
13
+ [Guide](https://gtkx.dev/v2/guide/components) · [API reference](https://gtkx.dev/v2/reference/@gtkx/components/) · [GTKX](https://gtkx.dev)
174
14
 
175
- ## License
15
+ GTKX requires Linux, Node.js, and the [native prerequisites](https://gtkx.dev/v2/guide/getting-started).
176
16
 
177
- GTKX is licensed under [MPL-2.0](https://github.com/gtkx-org/gtkx/blob/main/LICENSE).
17
+ [MPL-2.0](https://github.com/gtkx-org/gtkx/blob/main/LICENSE).
@@ -1 +1 @@
1
- {"version":3,"file":"column-view.d.ts","sourceRoot":"","sources":["../src/column-view.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAa,MAAM,OAAO,CAAC;AAQlD,OAAO,KAAK,EAAoB,eAAe,EAAmC,MAAM,YAAY,CAAC;AAiLrG;;;;GAIG;AACH,iBAAS,UAAU,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,OAAO,EAAE,KAAK,EAAE,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,SAAS,CAiCrF;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
1
+ {"version":3,"file":"column-view.d.ts","sourceRoot":"","sources":["../src/column-view.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAa,MAAM,OAAO,CAAC;AAQlD,OAAO,KAAK,EAAoB,eAAe,EAAmC,MAAM,YAAY,CAAC;AA4LrG;;;;GAIG;AACH,iBAAS,UAAU,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,OAAO,EAAE,KAAK,EAAE,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,SAAS,CAiCrF;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
@@ -1,10 +1,11 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import * as Gtk from "@gtkx/gi/gtk";
3
3
  import { GtkColumnView, GtkColumnViewColumn, GtkCustomSorter, GtkSignalListItemFactory } from "@gtkx/jsx/gtk";
4
4
  import { useSignal } from "@gtkx/react";
5
5
  import { omit } from "@gtkx/utils";
6
- import { useLayoutEffect, useRef } from "react";
6
+ import { useMemo, useRef } from "react";
7
7
  import { ItemPortals, useItemCells, useRowProps, useSectionHeader } from "./internal/cells.js";
8
+ import { useControlledSync } from "./internal/controlled-sync.js";
8
9
  import { useCollection } from "./internal/use-collection.js";
9
10
  import { useWidgetRef } from "./internal/use-widget-ref.js";
10
11
  const COLUMN_VIEW_PROPS = [
@@ -24,7 +25,6 @@ const COLUMN_VIEW_PROPS = [
24
25
  "sortOrder",
25
26
  "onSortChanged",
26
27
  "estimatedItemHeight",
27
- "children",
28
28
  "ref",
29
29
  ];
30
30
  const expanderIndexFor = (columns) => columns.findIndex((column) => column.visible !== false);
@@ -57,11 +57,12 @@ const applySort = (sorting, view, column, order) => {
57
57
  sorting.current = false;
58
58
  }
59
59
  };
60
- const emitSortChanged = (sorter, sorting, sort) => {
60
+ const didEmitSortChanged = (sorter, sorting, sort) => {
61
61
  if (sorter === null || sorting.current) {
62
- return;
62
+ return false;
63
63
  }
64
64
  sort.onSortChanged?.(sorter.getPrimarySortColumn()?.getId() ?? null, sorter.getPrimarySortOrder());
65
+ return true;
65
66
  };
66
67
  const syncSort = (sorting, view, sortColumn, sortOrder) => {
67
68
  const target = getSortTarget(view, sortColumn);
@@ -74,13 +75,22 @@ const useColumnSorting = (view, sort, columns) => {
74
75
  const sorting = useRef(false);
75
76
  const sorter = view?.getSorter() ?? null;
76
77
  const columnSorter = sorter instanceof Gtk.ColumnViewSorter ? sorter : null;
78
+ const { sortColumn, sortOrder } = sort;
79
+ const request = useMemo(() => ({ sortColumn, sortOrder }), [sortColumn, sortOrder]);
80
+ const markDrift = useControlledSync({
81
+ value: request,
82
+ source: columns,
83
+ target: view,
84
+ apply: (value) => {
85
+ syncSort(sorting, view, value.sortColumn, value.sortOrder);
86
+ },
87
+ });
77
88
  useSignal(columnSorter, "changed", () => {
78
- emitSortChanged(columnSorter, sorting, sort);
89
+ const didEmit = didEmitSortChanged(columnSorter, sorting, sort);
90
+ if (sortColumn !== undefined && didEmit) {
91
+ markDrift();
92
+ }
79
93
  });
80
- const { sortColumn, sortOrder } = sort;
81
- useLayoutEffect(() => {
82
- syncSort(sorting, view, sortColumn, sortOrder);
83
- }, [view, sortColumn, sortOrder, columns]);
84
94
  };
85
95
  const ColumnCells = ({ column, hasExpander, collection, expandedIds, expanderDescriptions, size, }) => {
86
96
  const cells = useItemCells(size);
@@ -1 +1 @@
1
- {"version":3,"file":"column-view.js","sourceRoot":"","sources":["../src/column-view.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAC9G,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAIhD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,WA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W,CAAC,GAAG,YAAY,CAAiB,GAAG,CAAC,CAAC;IAC9D,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;IACvD,MAAM,MAAM,GAAG,gBAAgB,CAAC,YAAY,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC;IAChE,MAAM,IAAI,GAAG,WAAW,CAAC,QAAQ,EAAE,UAAU,EAAE,WAAW,CAAC,CAAC;IAC5D,MAAM,UAAU,GAAG,OAAoC,CAAC;IACxD,gBAAgB,CAAC,IAAI,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,EAAE,UAAU,CAAC,CAAC;IAE7E,OAAO,CACH,8BACI,KAAC,aAAa,IACV,GAAG,EAAE,WAAW,EAChB,KAAK,EAAE,SAAS,KACZ,MAAM,CAAC,YAAY,KACnB,IAAI,CAAC,YAAY,KACjB,IAAI,YAER,KAAC,UAAU,IACP,OAAO,EAAE,UAAU,EACnB,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE,WAAW,EACxB,oBAAoB,EAAE,oBAAoB,EAC1C,IAAI,EAAE,IAAI,GACZ,GACU,EACf,MAAM,CAAC,OAAO,EACd,IAAI,CAAC,OAAO,IACd,CACN,CAAC;AACN,CAAC;AAED,OAAO,EAAE,UAAU,EAAE,CAAC","sourcesContent":["import type { ReactNode, RefObject } from \"react\";\nimport * as Gtk from \"@gtkx/gi/gtk\";\nimport { GtkColumnView, GtkColumnViewColumn, GtkCustomSorter, GtkSignalListItemFactory } from \"@gtkx/jsx/gtk\";\nimport { useSignal } from \"@gtkx/react\";\nimport { omit } from \"@gtkx/utils\";\nimport { useLayoutEffect, useRef } from \"react\";\nimport type { CellSize } from \"./internal/cells.js\";\nimport type { Collection } from \"./internal/collection.js\";\nimport type { ColumnViewColumn, ColumnViewProps, ExpanderDescriptions, SortProps } from \"./types.js\";\nimport { ItemPortals, useItemCells, useRowProps, useSectionHeader } from \"./internal/cells.js\";\nimport { useCollection } from \"./internal/use-collection.js\";\nimport { useWidgetRef } from \"./internal/use-widget-ref.js\";\n\ntype SortTarget = { view: Gtk.ColumnView; column: Gtk.ColumnViewColumn | null };\n\ntype ColumnCellsProps = {\n column: ColumnViewColumn<never>;\n hasExpander: boolean;\n collection: Collection;\n expandedIds: string[] | null | undefined;\n expanderDescriptions: ExpanderDescriptions | null | undefined;\n size: CellSize;\n};\n\ntype ColumnListProps = Omit<ColumnCellsProps, \"column\" | \"hasExpander\"> & {\n columns: ColumnViewColumn<never>[];\n};\n\nconst COLUMN_VIEW_PROPS = [\n \"items\",\n \"sections\",\n \"isFlat\",\n \"renderHeader\",\n \"rowProps\",\n \"columns\",\n \"selectedIds\",\n \"onSelectionChanged\",\n \"selectionMode\",\n \"expandedIds\",\n \"onExpandedChange\",\n \"expanderDescriptions\",\n \"sortColumn\",\n \"sortOrder\",\n \"onSortChanged\",\n \"estimatedItemHeight\",\n \"children\",\n \"ref\",\n] as const satisfies (keyof ColumnViewProps)[];\n\nconst expanderIndexFor = (columns: ColumnViewColumn<never>[]): number =>\n columns.findIndex((column) => column.visible !== false);\n\nconst columnById = (view: Gtk.ColumnView, id: string): Gtk.ColumnViewColumn | null => {\n const columns = view.getColumns();\n\n for (let index = 0; index < columns.getNItems(); index++) {\n const column = columns.getItem(index);\n\n if (column instanceof Gtk.ColumnViewColumn && column.getId() === id) {\n return column;\n }\n }\n\n return null;\n};\n\nconst getSortTarget = (view: Gtk.ColumnView | null, sortColumn: string | null | undefined): SortTarget | null => {\n if (view === null || sortColumn === undefined) {\n return null;\n }\n\n if (sortColumn === null) {\n return { view, column: null };\n }\n\n const column = columnById(view, sortColumn);\n\n return column === null ? null : { view, column };\n};\n\nconst applySort = (\n sorting: RefObject<boolean>,\n view: Gtk.ColumnView,\n column: Gtk.ColumnViewColumn | null,\n order: Gtk.SortType | null | undefined,\n): void => {\n sorting.current = true;\n\n try {\n view.sortByColumn(column, order ?? Gtk.SortType.ASCENDING);\n } finally {\n sorting.current = false;\n }\n};\n\nconst emitSortChanged = (\n sorter: Gtk.ColumnViewSorter | null,\n sorting: RefObject<boolean>,\n sort: SortProps,\n): void => {\n if (sorter === null || sorting.current) {\n return;\n }\n\n sort.onSortChanged?.(sorter.getPrimarySortColumn()?.getId() ?? null, sorter.getPrimarySortOrder());\n};\n\nconst syncSort = (\n sorting: RefObject<boolean>,\n view: Gtk.ColumnView | null,\n sortColumn: string | null | undefined,\n sortOrder: Gtk.SortType | null | undefined,\n): void => {\n const target = getSortTarget(view, sortColumn);\n\n if (target === null) {\n return;\n }\n\n applySort(sorting, target.view, target.column, sortOrder);\n};\n\nconst useColumnSorting = (view: Gtk.ColumnView | null, sort: SortProps, columns: ColumnViewColumn<never>[]): void => {\n const sorting = useRef(false);\n const sorter = view?.getSorter() ?? null;\n const columnSorter = sorter instanceof Gtk.ColumnViewSorter ? sorter : null;\n\n useSignal(columnSorter, \"changed\", (): void => {\n emitSortChanged(columnSorter, sorting, sort);\n });\n\n const { sortColumn, sortOrder } = sort;\n\n useLayoutEffect(() => {\n syncSort(sorting, view, sortColumn, sortOrder);\n }, [view, sortColumn, sortOrder, columns]);\n};\n\nconst ColumnCells = ({\n column,\n hasExpander,\n collection,\n expandedIds,\n expanderDescriptions,\n size,\n}: ColumnCellsProps): ReactNode => {\n const cells = useItemCells(size);\n const rest = omit(column, [\"id\", \"renderCell\", \"isSortable\"]);\n\n return (\n <>\n <GtkColumnViewColumn\n id={column.id}\n factory={<GtkSignalListItemFactory {...cells.handlers} />}\n sorter={column.isSortable === true ? <GtkCustomSorter /> : null}\n {...rest}\n />\n <ItemPortals\n registry={cells}\n render={column.renderCell}\n collection={collection}\n hasExpander={hasExpander}\n expandedIds={expandedIds}\n expanderDescriptions={expanderDescriptions}\n />\n </>\n );\n};\n\nconst ColumnList = ({ columns, collection, expandedIds, expanderDescriptions, size }: ColumnListProps): ReactNode => {\n const expanderIndex = expanderIndexFor(columns);\n\n return columns.map((column, index) => (\n <ColumnCells\n key={column.id}\n column={column}\n hasExpander={index === expanderIndex}\n collection={collection}\n expandedIds={expandedIds}\n expanderDescriptions={expanderDescriptions}\n size={size}\n />\n ));\n};\n\n/**\n * Renders a Gtk.ColumnView from declarative items or sections and a columns array,\n * with controlled selection, expansion, and sorting, per-column header menus,\n * section header rendering, and per-row props such as a screen-reader label.\n */\nfunction ColumnView<T = unknown, S = unknown>(props: ColumnViewProps<T, S>): ReactNode {\n const { renderHeader, rowProps, columns, expandedIds, expanderDescriptions } = props;\n const { sortColumn, sortOrder, onSortChanged, ref } = props;\n const rest = omit(props, COLUMN_VIEW_PROPS);\n const size = { width: -1, height: props.estimatedItemHeight ?? -1 };\n const [view, refCallback] = useWidgetRef<Gtk.ColumnView>(ref);\n const { collection, selection } = useCollection(props);\n const header = useSectionHeader(renderHeader, collection, size);\n const rows = useRowProps(rowProps, collection, expandedIds);\n const columnList = columns as ColumnViewColumn<never>[];\n useColumnSorting(view, { sortColumn, sortOrder, onSortChanged }, columnList);\n\n return (\n <>\n <GtkColumnView\n ref={refCallback}\n model={selection}\n {...header.factoryProps}\n {...rows.factoryProps}\n {...rest}\n >\n <ColumnList\n columns={columnList}\n collection={collection}\n expandedIds={expandedIds}\n expanderDescriptions={expanderDescriptions}\n size={size}\n />\n </GtkColumnView>\n {header.portals}\n {rows.portals}\n </>\n );\n}\n\nexport { ColumnView };\n"]}
1
+ {"version":3,"file":"column-view.js","sourceRoot":"","sources":["../src/column-view.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAC9G,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAIxC,OAAO,EAAE,WAAW,EAAE,YAAY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AO,EAAE,UAAU,EAAE,CAAC","sourcesContent":["import type { ReactNode, RefObject } from \"react\";\nimport * as Gtk from \"@gtkx/gi/gtk\";\nimport { GtkColumnView, GtkColumnViewColumn, GtkCustomSorter, GtkSignalListItemFactory } from \"@gtkx/jsx/gtk\";\nimport { useSignal } from \"@gtkx/react\";\nimport { omit } from \"@gtkx/utils\";\nimport { useMemo, useRef } from \"react\";\nimport type { CellSize } from \"./internal/cells.js\";\nimport type { Collection } from \"./internal/collection.js\";\nimport type { ColumnViewColumn, ColumnViewProps, ExpanderDescriptions, SortProps } from \"./types.js\";\nimport { ItemPortals, useItemCells, useRowProps, useSectionHeader } from \"./internal/cells.js\";\nimport { useControlledSync } from \"./internal/controlled-sync.js\";\nimport { useCollection } from \"./internal/use-collection.js\";\nimport { useWidgetRef } from \"./internal/use-widget-ref.js\";\n\ntype SortTarget = { view: Gtk.ColumnView; column: Gtk.ColumnViewColumn | null };\ntype SortRequest = Pick<SortProps, \"sortColumn\" | \"sortOrder\">;\n\ntype ColumnCellsProps = {\n column: ColumnViewColumn<never>;\n hasExpander: boolean;\n collection: Collection;\n expandedIds: string[] | null | undefined;\n expanderDescriptions: ExpanderDescriptions | null | undefined;\n size: CellSize;\n};\n\ntype ColumnListProps = Omit<ColumnCellsProps, \"column\" | \"hasExpander\"> & {\n columns: ColumnViewColumn<never>[];\n};\n\nconst COLUMN_VIEW_PROPS = [\n \"items\",\n \"sections\",\n \"isFlat\",\n \"renderHeader\",\n \"rowProps\",\n \"columns\",\n \"selectedIds\",\n \"onSelectionChanged\",\n \"selectionMode\",\n \"expandedIds\",\n \"onExpandedChange\",\n \"expanderDescriptions\",\n \"sortColumn\",\n \"sortOrder\",\n \"onSortChanged\",\n \"estimatedItemHeight\",\n \"ref\",\n] as const satisfies (keyof ColumnViewProps)[];\n\nconst expanderIndexFor = (columns: ColumnViewColumn<never>[]): number =>\n columns.findIndex((column) => column.visible !== false);\n\nconst columnById = (view: Gtk.ColumnView, id: string): Gtk.ColumnViewColumn | null => {\n const columns = view.getColumns();\n\n for (let index = 0; index < columns.getNItems(); index++) {\n const column = columns.getItem(index);\n\n if (column instanceof Gtk.ColumnViewColumn && column.getId() === id) {\n return column;\n }\n }\n\n return null;\n};\n\nconst getSortTarget = (view: Gtk.ColumnView | null, sortColumn: string | null | undefined): SortTarget | null => {\n if (view === null || sortColumn === undefined) {\n return null;\n }\n\n if (sortColumn === null) {\n return { view, column: null };\n }\n\n const column = columnById(view, sortColumn);\n\n return column === null ? null : { view, column };\n};\n\nconst applySort = (\n sorting: RefObject<boolean>,\n view: Gtk.ColumnView,\n column: Gtk.ColumnViewColumn | null,\n order: Gtk.SortType | null | undefined,\n): void => {\n sorting.current = true;\n\n try {\n view.sortByColumn(column, order ?? Gtk.SortType.ASCENDING);\n } finally {\n sorting.current = false;\n }\n};\n\nconst didEmitSortChanged = (\n sorter: Gtk.ColumnViewSorter | null,\n sorting: RefObject<boolean>,\n sort: SortProps,\n): boolean => {\n if (sorter === null || sorting.current) {\n return false;\n }\n\n sort.onSortChanged?.(sorter.getPrimarySortColumn()?.getId() ?? null, sorter.getPrimarySortOrder());\n\n return true;\n};\n\nconst syncSort = (\n sorting: RefObject<boolean>,\n view: Gtk.ColumnView | null,\n sortColumn: string | null | undefined,\n sortOrder: Gtk.SortType | null | undefined,\n): void => {\n const target = getSortTarget(view, sortColumn);\n\n if (target === null) {\n return;\n }\n\n applySort(sorting, target.view, target.column, sortOrder);\n};\n\nconst useColumnSorting = (view: Gtk.ColumnView | null, sort: SortProps, columns: ColumnViewColumn<never>[]): void => {\n const sorting = useRef(false);\n const sorter = view?.getSorter() ?? null;\n const columnSorter = sorter instanceof Gtk.ColumnViewSorter ? sorter : null;\n const { sortColumn, sortOrder } = sort;\n const request = useMemo<SortRequest>(() => ({ sortColumn, sortOrder }), [sortColumn, sortOrder]);\n const markDrift = useControlledSync({\n value: request,\n source: columns,\n target: view,\n apply: (value) => {\n syncSort(sorting, view, value.sortColumn, value.sortOrder);\n },\n });\n\n useSignal(columnSorter, \"changed\", (): void => {\n const didEmit = didEmitSortChanged(columnSorter, sorting, sort);\n\n if (sortColumn !== undefined && didEmit) {\n markDrift();\n }\n });\n};\n\nconst ColumnCells = ({\n column,\n hasExpander,\n collection,\n expandedIds,\n expanderDescriptions,\n size,\n}: ColumnCellsProps): ReactNode => {\n const cells = useItemCells(size);\n const rest = omit(column, [\"id\", \"renderCell\", \"isSortable\"]);\n\n return (\n <>\n <GtkColumnViewColumn\n id={column.id}\n factory={<GtkSignalListItemFactory {...cells.handlers} />}\n sorter={column.isSortable === true ? <GtkCustomSorter /> : null}\n {...rest}\n />\n <ItemPortals\n registry={cells}\n render={column.renderCell}\n collection={collection}\n hasExpander={hasExpander}\n expandedIds={expandedIds}\n expanderDescriptions={expanderDescriptions}\n />\n </>\n );\n};\n\nconst ColumnList = ({ columns, collection, expandedIds, expanderDescriptions, size }: ColumnListProps): ReactNode => {\n const expanderIndex = expanderIndexFor(columns);\n\n return columns.map((column, index) => (\n <ColumnCells\n key={column.id}\n column={column}\n hasExpander={index === expanderIndex}\n collection={collection}\n expandedIds={expandedIds}\n expanderDescriptions={expanderDescriptions}\n size={size}\n />\n ));\n};\n\n/**\n * Renders a Gtk.ColumnView from declarative items or sections and a columns array,\n * with controlled selection, expansion, and sorting, per-column header menus,\n * section header rendering, and per-row props such as a screen-reader label.\n */\nfunction ColumnView<T = unknown, S = unknown>(props: ColumnViewProps<T, S>): ReactNode {\n const { renderHeader, rowProps, columns, expandedIds, expanderDescriptions } = props;\n const { sortColumn, sortOrder, onSortChanged, ref } = props;\n const rest = omit(props, COLUMN_VIEW_PROPS);\n const size = { width: -1, height: props.estimatedItemHeight ?? -1 };\n const [view, refCallback] = useWidgetRef<Gtk.ColumnView>(ref);\n const { collection, selection } = useCollection(props);\n const header = useSectionHeader(renderHeader, collection, size);\n const rows = useRowProps(rowProps, collection, expandedIds);\n const columnList = columns as ColumnViewColumn<never>[];\n useColumnSorting(view, { sortColumn, sortOrder, onSortChanged }, columnList);\n\n return (\n <>\n <GtkColumnView\n ref={refCallback}\n model={selection}\n {...header.factoryProps}\n {...rows.factoryProps}\n {...rest}\n >\n <ColumnList\n columns={columnList}\n collection={collection}\n expandedIds={expandedIds}\n expanderDescriptions={expanderDescriptions}\n size={size}\n />\n </GtkColumnView>\n {header.portals}\n {rows.portals}\n </>\n );\n}\n\nexport { ColumnView };\n"]}
package/dist/grid-view.js CHANGED
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { GtkGridView, GtkSignalListItemFactory } from "@gtkx/jsx/gtk";
3
3
  import { omit } from "@gtkx/utils";
4
4
  import { ItemPortals, useItemCells } from "./internal/cells.js";
package/dist/index.d.ts CHANGED
@@ -2,7 +2,9 @@ export { ColumnView } from "./column-view.js";
2
2
  export { ComboRow } from "./combo-row.js";
3
3
  export { DropDown } from "./drop-down.js";
4
4
  export { GridView } from "./grid-view.js";
5
+ export { ListItemFactory } from "./list-item-factory.js";
5
6
  export { ListView } from "./list-view.js";
6
- export { ToastProvider, useToast, useToastOverlay } from "./toast.js";
7
- export type { ColumnViewColumn, ColumnViewProps, ComboRowProps, DropDownProps, ExpanderDescriptions, GridViewProps, ListItem, ListItemRenderArgs, ListItemRenderer, ListRowProps, ListRowPropsResolver, ListSection, ListSectionRenderArgs, ListSectionRenderer, ListViewProps, ToastController, ToastOptions, ToastOverlayController, ToastProviderProps, } from "./types.js";
7
+ export { ToastProvider, useToast } from "./toast.js";
8
+ export { createTabCollection } from "./tab-collection.js";
9
+ export type { ColumnViewColumn, ColumnViewProps, ComboRowProps, DropDownProps, ExpanderDescriptions, GridViewProps, ListItem, ListItemFactoryProps, ListItemRenderArgs, ListItemRenderer, ListRowProps, ListRowPropsResolver, ListSection, ListSectionRenderArgs, ListSectionRenderer, ListViewProps, ToastController, ToastOptions, ToastProviderProps, TabAppendOptions, TabCollection, TabCollectionOptions, } from "./types.js";
8
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AACtE,YAAY,EACR,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,aAAa,EACb,oBAAoB,EACpB,aAAa,EACb,QAAQ,EACR,kBAAkB,EAClB,gBAAgB,EAChB,YAAY,EACZ,oBAAoB,EACpB,WAAW,EACX,qBAAqB,EACrB,mBAAmB,EACnB,aAAa,EACb,eAAe,EACf,YAAY,EACZ,sBAAsB,EACtB,kBAAkB,GACrB,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,YAAY,EACR,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,aAAa,EACb,oBAAoB,EACpB,aAAa,EACb,QAAQ,EACR,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EAChB,YAAY,EACZ,oBAAoB,EACpB,WAAW,EACX,qBAAqB,EACrB,mBAAmB,EACnB,aAAa,EACb,eAAe,EACf,YAAY,EACZ,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,EACb,oBAAoB,GACvB,MAAM,YAAY,CAAC"}
package/dist/index.js CHANGED
@@ -2,6 +2,8 @@ export { ColumnView } from "./column-view.js";
2
2
  export { ComboRow } from "./combo-row.js";
3
3
  export { DropDown } from "./drop-down.js";
4
4
  export { GridView } from "./grid-view.js";
5
+ export { ListItemFactory } from "./list-item-factory.js";
5
6
  export { ListView } from "./list-view.js";
6
- export { ToastProvider, useToast, useToastOverlay } from "./toast.js";
7
+ export { ToastProvider, useToast } from "./toast.js";
8
+ export { createTabCollection } from "./tab-collection.js";
7
9
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC","sourcesContent":["export { ColumnView } from \"./column-view.js\";\nexport { ComboRow } from \"./combo-row.js\";\nexport { DropDown } from \"./drop-down.js\";\nexport { GridView } from \"./grid-view.js\";\nexport { ListView } from \"./list-view.js\";\nexport { ToastProvider, useToast, useToastOverlay } from \"./toast.js\";\nexport type {\n ColumnViewColumn,\n ColumnViewProps,\n ComboRowProps,\n DropDownProps,\n ExpanderDescriptions,\n GridViewProps,\n ListItem,\n ListItemRenderArgs,\n ListItemRenderer,\n ListRowProps,\n ListRowPropsResolver,\n ListSection,\n ListSectionRenderArgs,\n ListSectionRenderer,\n ListViewProps,\n ToastController,\n ToastOptions,\n ToastOverlayController,\n ToastProviderProps,\n} from \"./types.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC","sourcesContent":["export { ColumnView } from \"./column-view.js\";\nexport { ComboRow } from \"./combo-row.js\";\nexport { DropDown } from \"./drop-down.js\";\nexport { GridView } from \"./grid-view.js\";\nexport { ListItemFactory } from \"./list-item-factory.js\";\nexport { ListView } from \"./list-view.js\";\nexport { ToastProvider, useToast } from \"./toast.js\";\nexport { createTabCollection } from \"./tab-collection.js\";\nexport type {\n ColumnViewColumn,\n ColumnViewProps,\n ComboRowProps,\n DropDownProps,\n ExpanderDescriptions,\n GridViewProps,\n ListItem,\n ListItemFactoryProps,\n ListItemRenderArgs,\n ListItemRenderer,\n ListRowProps,\n ListRowPropsResolver,\n ListSection,\n ListSectionRenderArgs,\n ListSectionRenderer,\n ListViewProps,\n ToastController,\n ToastOptions,\n ToastProviderProps,\n TabAppendOptions,\n TabCollection,\n TabCollectionOptions,\n} from \"./types.js\";\n"]}
@@ -1,5 +1,5 @@
1
1
  import type * as GObject from "@gtkx/gi/gobject";
2
- import type { ReactElement, ReactNode } from "react";
2
+ import type { ReactElement, ReactNode, RefObject } from "react";
3
3
  import * as Gtk from "@gtkx/gi/gtk";
4
4
  import type { ExpanderDescriptions, ListItem, ListItemRenderer, ListRowPropsResolver, ListSectionRenderer } from "../types.js";
5
5
  import type { Collection } from "./collection.js";
@@ -13,7 +13,7 @@ type FactoryHost = GObject.Object & {
13
13
  type CellEntry<H extends FactoryHost> = {
14
14
  key: string;
15
15
  host: H;
16
- identity: ItemIdentityStore;
16
+ identity: RefObject<ItemIdentity | null>;
17
17
  };
18
18
  type FactoryHandlers = {
19
19
  onSetup: (host: GObject.Object) => void;
@@ -27,14 +27,11 @@ type CellRegistry<H extends FactoryHost> = {
27
27
  getEntries: () => CellEntry<H>[];
28
28
  };
29
29
  type ItemIdentity = {
30
+ itemKey: string;
30
31
  item: ListItem | undefined;
31
32
  position: number;
32
33
  isExpanded: boolean;
33
34
  };
34
- type ItemIdentityStore = {
35
- read: () => ItemIdentity | null;
36
- write: (identity: ItemIdentity) => void;
37
- };
38
35
  type ItemPortalsProps = {
39
36
  registry: CellRegistry<Gtk.ListItem>;
40
37
  render: ListItemRenderer<never>;
@@ -43,6 +40,11 @@ type ItemPortalsProps = {
43
40
  expandedIds?: string[] | null | undefined;
44
41
  expanderDescriptions?: ExpanderDescriptions | null | undefined;
45
42
  };
43
+ type NativeItemPortalsProps<T extends GObject.Object> = {
44
+ registry: CellRegistry<Gtk.ListItem>;
45
+ render: ListItemRenderer<T>;
46
+ size: CellSize;
47
+ };
46
48
  type SectionHeaderSlot = {
47
49
  factoryProps: {
48
50
  headerFactory?: ReactElement;
@@ -57,7 +59,8 @@ type RowSlot = {
57
59
  };
58
60
  declare function useItemCells(size: CellSize): CellRegistry<Gtk.ListItem>;
59
61
  declare const ItemPortals: ({ registry, render, collection, hasExpander, expandedIds, expanderDescriptions, }: ItemPortalsProps) => ReactNode;
62
+ declare function NativeItemPortals<T extends GObject.Object>({ registry, render, size }: NativeItemPortalsProps<T>): ReactNode;
60
63
  declare const useSectionHeader: (render: ListSectionRenderer<never> | null | undefined, collection: Collection, size: CellSize) => SectionHeaderSlot;
61
64
  declare const useRowProps: (rowProps: ListRowPropsResolver<never> | null | undefined, collection: Collection, expandedIds: string[] | null | undefined) => RowSlot;
62
- export { useItemCells, useRowProps, useSectionHeader, ItemPortals, type CellSize, };
65
+ export { useItemCells, useRowProps, useSectionHeader, ItemPortals, NativeItemPortals, type CellSize };
63
66
  //# sourceMappingURL=cells.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cells.d.ts","sourceRoot":"","sources":["../../src/internal/cells.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,OAAO,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AAKpC,OAAO,KAAK,EACR,oBAAoB,EACpB,QAAQ,EAER,gBAAgB,EAEhB,oBAAoB,EACpB,mBAAmB,EACtB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAGlD,KAAK,QAAQ,GAAG;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,KAAK,WAAW,GAAG,OAAO,CAAC,MAAM,GAAG;IAChC,OAAO,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;CACxC,CAAC;AAOF,KAAK,SAAS,CAAC,CAAC,SAAS,WAAW,IAAI;IACpC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,CAAC,CAAC;IACR,QAA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