@gtkx/react 0.1.47 → 0.1.49

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 (43) hide show
  1. package/README.md +8 -0
  2. package/dist/codegen/jsx-generator.js +9 -19
  3. package/dist/container-interfaces.d.ts +51 -0
  4. package/dist/container-interfaces.js +5 -0
  5. package/dist/factory.d.ts +1 -1
  6. package/dist/factory.js +17 -3
  7. package/dist/generated/jsx.d.ts +9 -11
  8. package/dist/node.d.ts +4 -4
  9. package/dist/node.js +7 -6
  10. package/dist/nodes/about-dialog.d.ts +9 -0
  11. package/dist/nodes/about-dialog.js +14 -0
  12. package/dist/nodes/action-bar.d.ts +9 -0
  13. package/dist/nodes/action-bar.js +15 -0
  14. package/dist/nodes/column-view.d.ts +32 -7
  15. package/dist/nodes/column-view.js +217 -34
  16. package/dist/nodes/dropdown.d.ts +7 -17
  17. package/dist/nodes/dropdown.js +17 -10
  18. package/dist/nodes/flow-box.d.ts +9 -0
  19. package/dist/nodes/flow-box.js +25 -0
  20. package/dist/nodes/grid.d.ts +6 -3
  21. package/dist/nodes/grid.js +28 -26
  22. package/dist/nodes/list-box.d.ts +9 -0
  23. package/dist/nodes/list-box.js +21 -0
  24. package/dist/nodes/list.d.ts +4 -3
  25. package/dist/nodes/list.js +8 -7
  26. package/dist/nodes/notebook.d.ts +7 -3
  27. package/dist/nodes/notebook.js +31 -14
  28. package/dist/nodes/overlay.d.ts +2 -1
  29. package/dist/nodes/root.d.ts +2 -3
  30. package/dist/nodes/root.js +3 -3
  31. package/dist/nodes/slot.d.ts +1 -2
  32. package/dist/nodes/slot.js +2 -2
  33. package/dist/nodes/text-view.d.ts +2 -7
  34. package/dist/nodes/text-view.js +10 -49
  35. package/dist/nodes/widget.d.ts +6 -5
  36. package/dist/nodes/widget.js +9 -149
  37. package/dist/nodes/window.d.ts +11 -0
  38. package/dist/nodes/window.js +37 -0
  39. package/dist/props.d.ts +5 -0
  40. package/dist/props.js +10 -0
  41. package/dist/reconciler.js +4 -5
  42. package/dist/types.d.ts +22 -2
  43. package/package.json +3 -3
package/dist/types.d.ts CHANGED
@@ -1,4 +1,9 @@
1
+ import type { SortType } from "@gtkx/ffi/gtk";
1
2
  import type { ReactElement, ReactNode } from "react";
3
+ /**
4
+ * Props for slot components that accept children.
5
+ * Used by container widgets that render child elements in designated slots.
6
+ */
2
7
  export interface SlotProps {
3
8
  children?: ReactNode;
4
9
  }
@@ -19,17 +24,32 @@ export type RenderItemFn<T> = (item: T | null) => ReactElement;
19
24
  export interface ListViewRenderProps<T = unknown> {
20
25
  renderItem: RenderItemFn<T>;
21
26
  }
22
- export interface ColumnViewColumnProps {
27
+ /**
28
+ * Comparison function for sorting items by column.
29
+ * Returns negative if a < b, 0 if a === b, positive if a > b.
30
+ * @param a - First item to compare
31
+ * @param b - Second item to compare
32
+ * @param columnId - The ID of the column being sorted
33
+ */
34
+ export type ColumnSortFn<T, C extends string = string> = (a: T, b: T, columnId: C) => number;
35
+ export interface ColumnViewColumnProps<T = unknown> {
23
36
  title?: string;
24
37
  expand?: boolean;
25
38
  resizable?: boolean;
26
39
  fixedWidth?: number;
40
+ id?: string;
27
41
  /**
28
42
  * Render function for column cells.
29
43
  * Called with null during setup (for loading state) and with the actual item during bind.
30
44
  * Always annotate your callback parameter type to include null, e.g.: `(item: MyItem | null) => ...`
31
45
  */
32
- renderCell: (item: any) => ReactElement;
46
+ renderCell: (item: T | null) => ReactElement;
47
+ }
48
+ export interface ColumnViewRootProps<T = unknown, C extends string = string> {
49
+ sortColumn?: C | null;
50
+ sortOrder?: SortType;
51
+ onSortChange?: (column: C | null, order: SortType) => void;
52
+ sortFn?: ColumnSortFn<T, C>;
33
53
  }
34
54
  export interface NotebookPageProps extends SlotProps {
35
55
  label: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gtkx/react",
3
- "version": "0.1.47",
3
+ "version": "0.1.49",
4
4
  "description": "Build GTK4 desktop applications with React and TypeScript",
5
5
  "keywords": [
6
6
  "gtk",
@@ -36,10 +36,10 @@
36
36
  ],
37
37
  "dependencies": {
38
38
  "react-reconciler": "0.33.0",
39
- "@gtkx/ffi": "0.1.47"
39
+ "@gtkx/ffi": "0.1.49"
40
40
  },
41
41
  "devDependencies": {
42
- "@gtkx/gir": "0.1.47"
42
+ "@gtkx/gir": "0.1.49"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "react": "^19"