@gtkx/react 0.9.4 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +55 -67
- package/dist/errors.d.ts +3 -3
- package/dist/errors.js +8 -8
- package/dist/factory.d.ts +3 -5
- package/dist/factory.js +18 -71
- package/dist/fiber-root.d.ts +1 -1
- package/dist/fiber-root.js +1 -2
- package/dist/generated/internal.d.ts +3 -6
- package/dist/generated/internal.js +10386 -13577
- package/dist/generated/jsx.d.ts +914 -808
- package/dist/generated/jsx.js +123 -358
- package/dist/generated/registry.d.ts +4 -0
- package/dist/generated/registry.js +13 -0
- package/dist/host-config.d.ts +7 -4
- package/dist/host-config.js +53 -18
- package/dist/index.d.ts +2 -22
- package/dist/index.js +2 -40
- package/dist/jsx.d.ts +719 -0
- package/dist/jsx.js +392 -0
- package/dist/node.d.ts +15 -32
- package/dist/node.js +20 -240
- package/dist/nodes/action-row-child.d.ts +21 -0
- package/dist/nodes/action-row-child.js +69 -0
- package/dist/nodes/action-row.js +33 -0
- package/dist/nodes/application.d.ts +1 -0
- package/dist/nodes/application.js +38 -0
- package/dist/nodes/autowrapped.d.ts +1 -0
- package/dist/nodes/autowrapped.js +109 -0
- package/dist/nodes/column-view-column.d.ts +16 -0
- package/dist/nodes/column-view-column.js +54 -0
- package/dist/nodes/column-view.d.ts +0 -59
- package/dist/nodes/column-view.js +107 -226
- package/dist/nodes/fixed-child.d.ts +1 -0
- package/dist/nodes/fixed-child.js +45 -0
- package/dist/nodes/grid-child.d.ts +1 -0
- package/dist/nodes/grid-child.js +54 -0
- package/dist/nodes/index.d.ts +34 -0
- package/dist/nodes/index.js +34 -0
- package/dist/nodes/internal/list-item-renderer.d.ts +18 -0
- package/dist/nodes/internal/list-item-renderer.js +67 -0
- package/dist/nodes/internal/list-store.d.ts +16 -0
- package/dist/nodes/internal/list-store.js +69 -0
- package/dist/nodes/internal/predicates.d.ts +26 -0
- package/dist/nodes/internal/predicates.js +36 -0
- package/dist/nodes/internal/signal-store.d.ts +9 -0
- package/dist/nodes/internal/signal-store.js +54 -0
- package/dist/nodes/internal/simple-list-store.d.ts +14 -0
- package/dist/nodes/internal/simple-list-store.js +60 -0
- package/dist/nodes/internal/tree-list-item-renderer.d.ts +18 -0
- package/dist/nodes/internal/tree-list-item-renderer.js +90 -0
- package/dist/nodes/internal/tree-store.d.ts +28 -0
- package/dist/nodes/internal/tree-store.js +153 -0
- package/dist/nodes/internal/utils.d.ts +3 -0
- package/dist/nodes/internal/utils.js +20 -0
- package/dist/nodes/list-item.d.ts +12 -0
- package/dist/nodes/list-item.js +24 -0
- package/dist/nodes/list-view.d.ts +0 -22
- package/dist/nodes/list-view.js +45 -38
- package/dist/nodes/menu.d.ts +6 -106
- package/dist/nodes/menu.js +16 -268
- package/dist/nodes/models/list.d.ts +24 -0
- package/dist/nodes/models/list.js +102 -0
- package/dist/nodes/models/menu.d.ts +45 -0
- package/dist/nodes/models/menu.js +265 -0
- package/dist/nodes/models/tree-list.d.ts +28 -0
- package/dist/nodes/models/tree-list.js +141 -0
- package/dist/nodes/navigation-page.d.ts +21 -0
- package/dist/nodes/navigation-page.js +95 -0
- package/dist/nodes/navigation-view.d.ts +1 -0
- package/dist/nodes/navigation-view.js +29 -0
- package/dist/nodes/notebook-page-tab.d.ts +15 -0
- package/dist/nodes/notebook-page-tab.js +42 -0
- package/dist/nodes/notebook-page.d.ts +23 -0
- package/dist/nodes/notebook-page.js +106 -0
- package/dist/nodes/notebook.d.ts +0 -32
- package/dist/nodes/notebook.js +20 -113
- package/dist/nodes/overlay-child.d.ts +1 -0
- package/dist/nodes/overlay-child.js +30 -0
- package/dist/nodes/pack-child.d.ts +21 -0
- package/dist/nodes/pack-child.js +68 -0
- package/dist/nodes/pack.d.ts +1 -0
- package/dist/nodes/pack.js +33 -0
- package/dist/nodes/popover-menu.d.ts +1 -0
- package/dist/nodes/popover-menu.js +58 -0
- package/dist/nodes/simple-list-item.d.ts +9 -0
- package/dist/nodes/simple-list-item.js +9 -0
- package/dist/nodes/simple-list-view.d.ts +1 -0
- package/dist/nodes/simple-list-view.js +75 -0
- package/dist/nodes/slot.d.ts +18 -10
- package/dist/nodes/slot.js +83 -51
- package/dist/nodes/stack-page.d.ts +1 -0
- package/dist/nodes/stack-page.js +80 -0
- package/dist/nodes/stack.d.ts +1 -22
- package/dist/nodes/stack.js +21 -60
- package/dist/nodes/toast-overlay.d.ts +1 -0
- package/dist/nodes/toast-overlay.js +35 -0
- package/dist/nodes/toast.d.ts +17 -0
- package/dist/nodes/toast.js +77 -0
- package/dist/nodes/toolbar-child.d.ts +9 -0
- package/dist/nodes/toolbar-child.js +33 -0
- package/dist/nodes/toolbar.d.ts +1 -0
- package/dist/nodes/toolbar.js +42 -0
- package/dist/nodes/tree-list-item.d.ts +20 -0
- package/dist/nodes/tree-list-item.js +102 -0
- package/dist/nodes/tree-list-view.d.ts +1 -0
- package/dist/nodes/tree-list-view.js +57 -0
- package/dist/nodes/virtual.d.ts +13 -0
- package/dist/nodes/virtual.js +21 -0
- package/dist/nodes/widget.d.ts +17 -3
- package/dist/nodes/widget.js +258 -2
- package/dist/nodes/window.d.ts +1 -12
- package/dist/nodes/window.js +66 -27
- package/dist/portal.d.ts +18 -13
- package/dist/portal.js +17 -14
- package/dist/reconciler.d.ts +0 -4
- package/dist/reconciler.js +1 -9
- package/dist/registry.d.ts +8 -0
- package/dist/registry.js +5 -0
- package/dist/render.d.ts +108 -12
- package/dist/render.js +140 -16
- package/dist/scheduler.d.ts +4 -0
- package/dist/scheduler.js +10 -0
- package/dist/types.d.ts +3 -136
- package/package.json +6 -6
- package/dist/batch.d.ts +0 -5
- package/dist/batch.js +0 -31
- package/dist/codegen/jsx-generator.d.ts +0 -56
- package/dist/codegen/jsx-generator.js +0 -959
- package/dist/containers.d.ts +0 -58
- package/dist/nodes/about-dialog.d.ts +0 -8
- package/dist/nodes/about-dialog.js +0 -16
- package/dist/nodes/action-bar.d.ts +0 -5
- package/dist/nodes/action-bar.js +0 -6
- package/dist/nodes/combo-row.d.ts +0 -5
- package/dist/nodes/combo-row.js +0 -6
- package/dist/nodes/drop-down.d.ts +0 -9
- package/dist/nodes/drop-down.js +0 -12
- package/dist/nodes/flow-box.d.ts +0 -10
- package/dist/nodes/flow-box.js +0 -41
- package/dist/nodes/grid.d.ts +0 -30
- package/dist/nodes/grid.js +0 -84
- package/dist/nodes/header-bar.d.ts +0 -43
- package/dist/nodes/header-bar.js +0 -116
- package/dist/nodes/indexed-child-container.d.ts +0 -16
- package/dist/nodes/indexed-child-container.js +0 -22
- package/dist/nodes/list-box.d.ts +0 -10
- package/dist/nodes/list-box.js +0 -48
- package/dist/nodes/list-item-factory.d.ts +0 -19
- package/dist/nodes/list-item-factory.js +0 -58
- package/dist/nodes/overlay.d.ts +0 -11
- package/dist/nodes/overlay.js +0 -50
- package/dist/nodes/paged-stack.d.ts +0 -31
- package/dist/nodes/paged-stack.js +0 -95
- package/dist/nodes/root.d.ts +0 -8
- package/dist/nodes/root.js +0 -13
- package/dist/nodes/selectable-list.d.ts +0 -45
- package/dist/nodes/selectable-list.js +0 -260
- package/dist/nodes/stack-page-props.d.ts +0 -11
- package/dist/nodes/stack-page-props.js +0 -23
- package/dist/nodes/string-list-container.d.ts +0 -34
- package/dist/nodes/string-list-container.js +0 -118
- package/dist/nodes/string-list-item.d.ts +0 -19
- package/dist/nodes/string-list-item.js +0 -50
- package/dist/nodes/string-list-store.d.ts +0 -13
- package/dist/nodes/string-list-store.js +0 -44
- package/dist/nodes/text-view.d.ts +0 -8
- package/dist/nodes/text-view.js +0 -16
- package/dist/nodes/toggle-button.d.ts +0 -14
- package/dist/nodes/toggle-button.js +0 -39
- package/dist/nodes/toolbar-view.d.ts +0 -14
- package/dist/nodes/toolbar-view.js +0 -78
- package/dist/nodes/view-stack.d.ts +0 -9
- package/dist/nodes/view-stack.js +0 -28
- package/dist/nodes/virtual-item.d.ts +0 -19
- package/dist/nodes/virtual-item.js +0 -48
- package/dist/nodes/virtual-slot.d.ts +0 -25
- package/dist/nodes/virtual-slot.js +0 -57
- package/dist/predicates.d.ts +0 -29
- package/dist/predicates.js +0 -37
- package/dist/props.d.ts +0 -7
- package/dist/props.js +0 -12
- /package/dist/{containers.js → nodes/action-row.d.ts} +0 -0
package/dist/jsx.d.ts
ADDED
|
@@ -0,0 +1,719 @@
|
|
|
1
|
+
import type * as Gdk from "@gtkx/ffi/gdk";
|
|
2
|
+
import type * as Gtk from "@gtkx/ffi/gtk";
|
|
3
|
+
import type { ReactElement, ReactNode } from "react";
|
|
4
|
+
import type { RenderItemFn } from "./nodes/internal/list-item-renderer.js";
|
|
5
|
+
import type { TreeRenderItemFn } from "./nodes/internal/tree-list-item-renderer.js";
|
|
6
|
+
/**
|
|
7
|
+
* Props for EventController-based event handlers.
|
|
8
|
+
*
|
|
9
|
+
* These props attach EventControllers to widgets for handling
|
|
10
|
+
* pointer motion, clicks, and keyboard events.
|
|
11
|
+
*/
|
|
12
|
+
export interface EventControllerProps {
|
|
13
|
+
/** Called when the pointer enters the widget */
|
|
14
|
+
onEnter?: (x: number, y: number) => void;
|
|
15
|
+
/** Called when the pointer leaves the widget */
|
|
16
|
+
onLeave?: () => void;
|
|
17
|
+
/** Called when the pointer moves over the widget */
|
|
18
|
+
onMotion?: (x: number, y: number) => void;
|
|
19
|
+
/** Called when a mouse button is pressed */
|
|
20
|
+
onPressed?: (nPress: number, x: number, y: number) => void;
|
|
21
|
+
/** Called when a mouse button is released */
|
|
22
|
+
onReleased?: (nPress: number, x: number, y: number) => void;
|
|
23
|
+
/** Called when a key is pressed (for focusable widgets) */
|
|
24
|
+
onKeyPressed?: (keyval: number, keycode: number, state: Gdk.ModifierType) => boolean;
|
|
25
|
+
/** Called when a key is released */
|
|
26
|
+
onKeyReleased?: (keyval: number, keycode: number, state: Gdk.ModifierType) => void;
|
|
27
|
+
/** Called when the widget is scrolled */
|
|
28
|
+
onScroll?: (dx: number, dy: number) => boolean;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Props for slot-based child positioning.
|
|
32
|
+
*
|
|
33
|
+
* @see {@link Slot} for type-safe slot usage
|
|
34
|
+
*/
|
|
35
|
+
export type SlotProps = {
|
|
36
|
+
/** The slot identifier */
|
|
37
|
+
id?: string;
|
|
38
|
+
/** Content to place in the slot */
|
|
39
|
+
children?: ReactNode;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Props for items in a {@link ListView} or {@link GridView}.
|
|
43
|
+
*
|
|
44
|
+
* @typeParam T - The type of data associated with this list item
|
|
45
|
+
*/
|
|
46
|
+
export type ListItemProps<T = unknown> = {
|
|
47
|
+
/** Unique identifier for this item */
|
|
48
|
+
id: string;
|
|
49
|
+
/** The data value for this item */
|
|
50
|
+
value: T;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Props for items in a {@link TreeListView}.
|
|
54
|
+
*
|
|
55
|
+
* @typeParam T - The type of data associated with this tree item
|
|
56
|
+
*/
|
|
57
|
+
export type TreeListItemProps<T = unknown> = {
|
|
58
|
+
/** Unique identifier for this item */
|
|
59
|
+
id: string;
|
|
60
|
+
/** The data value for this item */
|
|
61
|
+
value: T;
|
|
62
|
+
/** Whether to indent based on tree depth (default: true) */
|
|
63
|
+
indentForDepth?: boolean;
|
|
64
|
+
/** Whether to indent for expander icon width */
|
|
65
|
+
indentForIcon?: boolean;
|
|
66
|
+
/** Whether to hide the expand/collapse arrow */
|
|
67
|
+
hideExpander?: boolean;
|
|
68
|
+
/** Nested tree items (children of this item) */
|
|
69
|
+
children?: ReactNode;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Props for string-based list items.
|
|
73
|
+
*
|
|
74
|
+
* Use with `SimpleListItem` for simple string lists.
|
|
75
|
+
*/
|
|
76
|
+
export type StringListItemProps = {
|
|
77
|
+
/** Unique identifier for this item */
|
|
78
|
+
id: string;
|
|
79
|
+
/** The string value for this item */
|
|
80
|
+
value: string;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Props for positioning children within a GtkGrid.
|
|
84
|
+
*
|
|
85
|
+
* @see {@link GridChild} for usage
|
|
86
|
+
*/
|
|
87
|
+
export type GridChildProps = SlotProps & {
|
|
88
|
+
/** Column index (0-based) */
|
|
89
|
+
column?: number;
|
|
90
|
+
/** Row index (0-based) */
|
|
91
|
+
row?: number;
|
|
92
|
+
/** Number of columns to span */
|
|
93
|
+
columnSpan?: number;
|
|
94
|
+
/** Number of rows to span */
|
|
95
|
+
rowSpan?: number;
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* Props for positioning children within a GtkFixed.
|
|
99
|
+
*
|
|
100
|
+
* @see {@link FixedChild} for usage
|
|
101
|
+
*/
|
|
102
|
+
export type FixedChildProps = SlotProps & {
|
|
103
|
+
/** X coordinate in pixels */
|
|
104
|
+
x?: number;
|
|
105
|
+
/** Y coordinate in pixels */
|
|
106
|
+
y?: number;
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* Props for declarative toast notifications.
|
|
110
|
+
*
|
|
111
|
+
* @see {@link Toast} for usage
|
|
112
|
+
*/
|
|
113
|
+
export type ToastProps = {
|
|
114
|
+
/** The toast message text */
|
|
115
|
+
title: string;
|
|
116
|
+
/** Timeout in seconds (0 for indefinite) */
|
|
117
|
+
timeout?: number;
|
|
118
|
+
/** Priority level for interrupting other toasts */
|
|
119
|
+
priority?: import("@gtkx/ffi/adw").ToastPriority;
|
|
120
|
+
/** Label for the action button */
|
|
121
|
+
buttonLabel?: string;
|
|
122
|
+
/** Action name to trigger when button is clicked */
|
|
123
|
+
actionName?: string;
|
|
124
|
+
/** Whether to use Pango markup in the title */
|
|
125
|
+
useMarkup?: boolean;
|
|
126
|
+
/** Callback when the toast button is clicked */
|
|
127
|
+
onButtonClicked?: () => void;
|
|
128
|
+
/** Callback when the toast is dismissed */
|
|
129
|
+
onDismissed?: () => void;
|
|
130
|
+
};
|
|
131
|
+
/**
|
|
132
|
+
* Props for custom list view rendering.
|
|
133
|
+
*
|
|
134
|
+
* @typeParam T - The type of items in the list
|
|
135
|
+
*/
|
|
136
|
+
export type ListViewRenderProps<T = unknown> = {
|
|
137
|
+
/** Function to render each list item */
|
|
138
|
+
renderItem: RenderItemFn<T>;
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* Props for defining a column in a ColumnView (table).
|
|
142
|
+
*
|
|
143
|
+
* @typeParam T - The type of data for each row
|
|
144
|
+
*
|
|
145
|
+
* @see {@link ColumnViewColumn} for usage
|
|
146
|
+
*/
|
|
147
|
+
export type ColumnViewColumnProps<T = unknown> = {
|
|
148
|
+
/** Column header text */
|
|
149
|
+
title: string;
|
|
150
|
+
/** Whether the column expands to fill available space */
|
|
151
|
+
expand?: boolean;
|
|
152
|
+
/** Whether the column can be resized by the user */
|
|
153
|
+
resizable?: boolean;
|
|
154
|
+
/** Fixed width in pixels */
|
|
155
|
+
fixedWidth?: number;
|
|
156
|
+
/** Unique identifier for this column */
|
|
157
|
+
id: string;
|
|
158
|
+
/** Whether clicking the header sorts by this column */
|
|
159
|
+
sortable?: boolean;
|
|
160
|
+
/** Function to render the cell content for each row */
|
|
161
|
+
renderCell: (item: T | null) => ReactNode;
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* Props for the root ColumnView component.
|
|
165
|
+
*
|
|
166
|
+
* @typeParam C - String literal type for column IDs
|
|
167
|
+
*/
|
|
168
|
+
export type ColumnViewRootProps<C extends string = string> = {
|
|
169
|
+
/** Currently sorted column ID, or null for no sorting */
|
|
170
|
+
sortColumn?: C | null;
|
|
171
|
+
/** Sort direction (ascending or descending) */
|
|
172
|
+
sortOrder?: Gtk.SortType;
|
|
173
|
+
/** Callback when sort changes */
|
|
174
|
+
onSortChange?: (column: C | null, order: Gtk.SortType) => void;
|
|
175
|
+
};
|
|
176
|
+
/**
|
|
177
|
+
* Props for notebook (tabbed) pages.
|
|
178
|
+
*/
|
|
179
|
+
export type NotebookPageProps = SlotProps & {
|
|
180
|
+
/** Tab label text (optional when using Notebook.PageTab) */
|
|
181
|
+
label?: string;
|
|
182
|
+
};
|
|
183
|
+
/**
|
|
184
|
+
* Props for custom notebook page tab widgets.
|
|
185
|
+
*/
|
|
186
|
+
export type NotebookPageTabProps = SlotProps;
|
|
187
|
+
/**
|
|
188
|
+
* Props for the root Stack component.
|
|
189
|
+
*/
|
|
190
|
+
export type StackRootProps = SlotProps & {
|
|
191
|
+
/** Name of the currently visible child page */
|
|
192
|
+
visibleChildName?: string;
|
|
193
|
+
};
|
|
194
|
+
/**
|
|
195
|
+
* Props for pages within a Stack or ViewStack.
|
|
196
|
+
*
|
|
197
|
+
* @see {@link StackPage} for usage
|
|
198
|
+
*/
|
|
199
|
+
export type StackPageProps = SlotProps & {
|
|
200
|
+
/** Unique name for this page (used with visibleChildName) */
|
|
201
|
+
name?: string;
|
|
202
|
+
/** Display title shown in stack switchers */
|
|
203
|
+
title?: string;
|
|
204
|
+
/** Icon name from the icon theme */
|
|
205
|
+
iconName?: string;
|
|
206
|
+
/** Whether to show an attention indicator */
|
|
207
|
+
needsAttention?: boolean;
|
|
208
|
+
/** Whether this page is visible in switchers */
|
|
209
|
+
visible?: boolean;
|
|
210
|
+
/** Whether underscores in title indicate mnemonics */
|
|
211
|
+
useUnderline?: boolean;
|
|
212
|
+
/** Badge number shown on the page indicator */
|
|
213
|
+
badgeNumber?: number;
|
|
214
|
+
};
|
|
215
|
+
/**
|
|
216
|
+
* Props for menu items.
|
|
217
|
+
*
|
|
218
|
+
* @see {@link Menu} for building menus
|
|
219
|
+
*/
|
|
220
|
+
export type MenuItemProps = {
|
|
221
|
+
/** Unique identifier for this menu item */
|
|
222
|
+
id: string;
|
|
223
|
+
/** Display label */
|
|
224
|
+
label: string;
|
|
225
|
+
/** Callback when the item is activated */
|
|
226
|
+
onActivate: () => void;
|
|
227
|
+
/** Keyboard accelerator(s) (e.g., "\<Control\>q") */
|
|
228
|
+
accels?: string | string[];
|
|
229
|
+
};
|
|
230
|
+
/**
|
|
231
|
+
* Props for menu sections.
|
|
232
|
+
*
|
|
233
|
+
* Sections group related menu items with optional labels.
|
|
234
|
+
*/
|
|
235
|
+
export type MenuSectionProps = {
|
|
236
|
+
/** Optional section header label */
|
|
237
|
+
label?: string;
|
|
238
|
+
/** Menu items in this section */
|
|
239
|
+
children?: ReactNode;
|
|
240
|
+
};
|
|
241
|
+
/**
|
|
242
|
+
* Props for submenus.
|
|
243
|
+
*/
|
|
244
|
+
export type MenuSubmenuProps = {
|
|
245
|
+
/** Submenu label */
|
|
246
|
+
label: string;
|
|
247
|
+
/** Menu items in this submenu */
|
|
248
|
+
children?: ReactNode;
|
|
249
|
+
};
|
|
250
|
+
/**
|
|
251
|
+
* Props for children within an Overlay container.
|
|
252
|
+
*/
|
|
253
|
+
export type OverlayChildProps = SlotProps & {
|
|
254
|
+
/** Whether to include this child in size measurement */
|
|
255
|
+
measure?: boolean;
|
|
256
|
+
/** Whether to clip this overlay child to the main child bounds */
|
|
257
|
+
clipOverlay?: boolean;
|
|
258
|
+
};
|
|
259
|
+
/**
|
|
260
|
+
* Type mapping widget names to their available slot IDs.
|
|
261
|
+
*/
|
|
262
|
+
export type { WidgetSlotNames } from "./generated/jsx.js";
|
|
263
|
+
/**
|
|
264
|
+
* Type-safe slot component for placing children in named widget slots.
|
|
265
|
+
*
|
|
266
|
+
* GTK widgets often have named slots for specific child positions (e.g., titleWidget,
|
|
267
|
+
* startWidget). This component provides type-safe access to those slots.
|
|
268
|
+
*
|
|
269
|
+
* @typeParam W - The widget type containing the slot
|
|
270
|
+
*
|
|
271
|
+
* @param props.for - The widget component type (used for type inference)
|
|
272
|
+
* @param props.id - The slot identifier (type-checked against available slots)
|
|
273
|
+
* @param props.children - Content to place in the slot
|
|
274
|
+
*
|
|
275
|
+
* @example
|
|
276
|
+
* ```tsx
|
|
277
|
+
* <GtkHeaderBar>
|
|
278
|
+
* <Slot for={GtkHeaderBar} id="titleWidget">
|
|
279
|
+
* <GtkLabel label="App Title" />
|
|
280
|
+
* </Slot>
|
|
281
|
+
* </GtkHeaderBar>
|
|
282
|
+
* ```
|
|
283
|
+
*
|
|
284
|
+
* @internal
|
|
285
|
+
*/
|
|
286
|
+
export declare function Slot<W extends keyof import("./generated/jsx.js").WidgetSlotNames>(props: {
|
|
287
|
+
for: W;
|
|
288
|
+
id: import("./generated/jsx.js").WidgetSlotNames[W];
|
|
289
|
+
children?: ReactNode;
|
|
290
|
+
}): ReactElement;
|
|
291
|
+
/**
|
|
292
|
+
* Element type for pages within a GtkStack or AdwViewStack.
|
|
293
|
+
*
|
|
294
|
+
* @example
|
|
295
|
+
* ```tsx
|
|
296
|
+
* <GtkStack>
|
|
297
|
+
* <StackPage name="page1" title="First Page">
|
|
298
|
+
* <GtkLabel label="Content 1" />
|
|
299
|
+
* </StackPage>
|
|
300
|
+
* <StackPage name="page2" title="Second Page">
|
|
301
|
+
* <GtkLabel label="Content 2" />
|
|
302
|
+
* </StackPage>
|
|
303
|
+
* </GtkStack>
|
|
304
|
+
* ```
|
|
305
|
+
*/
|
|
306
|
+
export declare const StackPage: "StackPage";
|
|
307
|
+
/**
|
|
308
|
+
* Element type for positioning children within a GtkGrid.
|
|
309
|
+
*
|
|
310
|
+
* @example
|
|
311
|
+
* ```tsx
|
|
312
|
+
* <GtkGrid>
|
|
313
|
+
* <GridChild column={0} row={0}>
|
|
314
|
+
* <GtkLabel label="Top Left" />
|
|
315
|
+
* </GridChild>
|
|
316
|
+
* <GridChild column={1} row={0} columnSpan={2}>
|
|
317
|
+
* <GtkLabel label="Spans 2 columns" />
|
|
318
|
+
* </GridChild>
|
|
319
|
+
* </GtkGrid>
|
|
320
|
+
* ```
|
|
321
|
+
*/
|
|
322
|
+
export declare const GridChild: "GridChild";
|
|
323
|
+
/**
|
|
324
|
+
* Element type for positioning children within a GtkFixed.
|
|
325
|
+
*
|
|
326
|
+
* @example
|
|
327
|
+
* ```tsx
|
|
328
|
+
* <GtkFixed>
|
|
329
|
+
* <FixedChild x={20} y={30}>
|
|
330
|
+
* <GtkLabel label="Positioned at (20, 30)" />
|
|
331
|
+
* </FixedChild>
|
|
332
|
+
* <FixedChild x={100} y={50}>
|
|
333
|
+
* <GtkButton label="At (100, 50)" />
|
|
334
|
+
* </FixedChild>
|
|
335
|
+
* </GtkFixed>
|
|
336
|
+
* ```
|
|
337
|
+
*/
|
|
338
|
+
export declare const FixedChild: "FixedChild";
|
|
339
|
+
/**
|
|
340
|
+
* Element type for declarative toast notifications within an AdwToastOverlay.
|
|
341
|
+
*
|
|
342
|
+
* When mounted, shows the toast. When unmounted, the toast auto-dismisses.
|
|
343
|
+
* Toasts can have an optional action button and callbacks.
|
|
344
|
+
*
|
|
345
|
+
* @example
|
|
346
|
+
* ```tsx
|
|
347
|
+
* <AdwToastOverlay>
|
|
348
|
+
* <MyContent />
|
|
349
|
+
* {showToast && (
|
|
350
|
+
* <Toast
|
|
351
|
+
* title="File saved"
|
|
352
|
+
* timeout={3}
|
|
353
|
+
* buttonLabel="Undo"
|
|
354
|
+
* onButtonClicked={handleUndo}
|
|
355
|
+
* onDismissed={() => setShowToast(false)}
|
|
356
|
+
* />
|
|
357
|
+
* )}
|
|
358
|
+
* </AdwToastOverlay>
|
|
359
|
+
* ```
|
|
360
|
+
*/
|
|
361
|
+
export declare const Toast: "Toast";
|
|
362
|
+
/**
|
|
363
|
+
* Element types for pages within a GtkNotebook (tabbed interface).
|
|
364
|
+
*
|
|
365
|
+
* @example Simple text tabs
|
|
366
|
+
* ```tsx
|
|
367
|
+
* <GtkNotebook>
|
|
368
|
+
* <Notebook.Page label="Tab 1">
|
|
369
|
+
* <GtkLabel label="Content 1" />
|
|
370
|
+
* </Notebook.Page>
|
|
371
|
+
* <Notebook.Page label="Tab 2">
|
|
372
|
+
* <GtkLabel label="Content 2" />
|
|
373
|
+
* </Notebook.Page>
|
|
374
|
+
* </GtkNotebook>
|
|
375
|
+
* ```
|
|
376
|
+
*
|
|
377
|
+
* @example Custom tab widgets
|
|
378
|
+
* ```tsx
|
|
379
|
+
* <GtkNotebook>
|
|
380
|
+
* <Notebook.Page>
|
|
381
|
+
* <Notebook.PageTab>
|
|
382
|
+
* <GtkBox orientation={Gtk.Orientation.HORIZONTAL}>
|
|
383
|
+
* <GtkImage iconName="folder-symbolic" />
|
|
384
|
+
* <GtkLabel label="Files" />
|
|
385
|
+
* </GtkBox>
|
|
386
|
+
* </Notebook.PageTab>
|
|
387
|
+
* <GtkLabel label="Content" />
|
|
388
|
+
* </Notebook.Page>
|
|
389
|
+
* </GtkNotebook>
|
|
390
|
+
* ```
|
|
391
|
+
*/
|
|
392
|
+
export declare const Notebook: {
|
|
393
|
+
/** A page within the notebook */
|
|
394
|
+
Page: "Notebook.Page";
|
|
395
|
+
/** Custom widget for the page tab label */
|
|
396
|
+
PageTab: "Notebook.PageTab";
|
|
397
|
+
};
|
|
398
|
+
/**
|
|
399
|
+
* Element type for items in a ListView or GridView.
|
|
400
|
+
*
|
|
401
|
+
* @example
|
|
402
|
+
* ```tsx
|
|
403
|
+
* <ListView renderItem={(item) => <GtkLabel label={item.name} />}>
|
|
404
|
+
* <ListItem id="1" value={{ name: "Item 1" }} />
|
|
405
|
+
* <ListItem id="2" value={{ name: "Item 2" }} />
|
|
406
|
+
* </ListView>
|
|
407
|
+
* ```
|
|
408
|
+
*/
|
|
409
|
+
export declare const ListItem: "ListItem";
|
|
410
|
+
/**
|
|
411
|
+
* Component for defining columns in a ColumnView (table widget).
|
|
412
|
+
*
|
|
413
|
+
* @typeParam T - The type of row data
|
|
414
|
+
*
|
|
415
|
+
* @example
|
|
416
|
+
* ```tsx
|
|
417
|
+
* <GtkColumnView>
|
|
418
|
+
* <ColumnViewColumn
|
|
419
|
+
* id="name"
|
|
420
|
+
* title="Name"
|
|
421
|
+
* expand
|
|
422
|
+
* renderCell={(item) => <GtkLabel label={item?.name ?? ""} />}
|
|
423
|
+
* />
|
|
424
|
+
* <ColumnViewColumn
|
|
425
|
+
* id="status"
|
|
426
|
+
* title="Status"
|
|
427
|
+
* renderCell={(item) => <GtkLabel label={item?.status ?? ""} />}
|
|
428
|
+
* />
|
|
429
|
+
* </GtkColumnView>
|
|
430
|
+
* ```
|
|
431
|
+
*
|
|
432
|
+
* @internal
|
|
433
|
+
*/
|
|
434
|
+
export declare function ColumnViewColumn<T = unknown>(props: ColumnViewColumnProps<T>): ReactElement;
|
|
435
|
+
/**
|
|
436
|
+
* Props for the ListView component.
|
|
437
|
+
*
|
|
438
|
+
* @typeParam T - The type of items in the list
|
|
439
|
+
*/
|
|
440
|
+
export type ListViewProps<T = unknown> = Omit<import("./generated/jsx.js").GtkListViewProps, "renderItem"> & {
|
|
441
|
+
/** Function to render each list item */
|
|
442
|
+
renderItem: (item: T | null) => ReactNode;
|
|
443
|
+
};
|
|
444
|
+
/**
|
|
445
|
+
* Virtualized list component with custom item rendering.
|
|
446
|
+
*
|
|
447
|
+
* Efficiently renders large lists by only creating widgets for visible items.
|
|
448
|
+
*
|
|
449
|
+
* @typeParam T - The type of items in the list
|
|
450
|
+
*
|
|
451
|
+
* @example
|
|
452
|
+
* ```tsx
|
|
453
|
+
* const items = [{ id: "1", name: "Apple" }, { id: "2", name: "Banana" }];
|
|
454
|
+
*
|
|
455
|
+
* <ListView renderItem={(item) => <GtkLabel label={item?.name ?? ""} />}>
|
|
456
|
+
* {items.map((item) => (
|
|
457
|
+
* <ListItem key={item.id} id={item.id} value={item} />
|
|
458
|
+
* ))}
|
|
459
|
+
* </ListView>
|
|
460
|
+
* ```
|
|
461
|
+
*
|
|
462
|
+
* @internal
|
|
463
|
+
*/
|
|
464
|
+
export declare function ListView<T = unknown>(props: ListViewProps<T>): ReactElement;
|
|
465
|
+
/**
|
|
466
|
+
* Props for the GridView component.
|
|
467
|
+
*
|
|
468
|
+
* @typeParam T - The type of items in the grid
|
|
469
|
+
*/
|
|
470
|
+
export type GridViewProps<T = unknown> = Omit<import("./generated/jsx.js").GtkGridViewProps, "renderItem"> & {
|
|
471
|
+
/** Function to render each grid item */
|
|
472
|
+
renderItem: (item: T | null) => ReactNode;
|
|
473
|
+
};
|
|
474
|
+
/**
|
|
475
|
+
* Virtualized grid component with custom item rendering.
|
|
476
|
+
*
|
|
477
|
+
* Efficiently renders large grids by only creating widgets for visible items.
|
|
478
|
+
*
|
|
479
|
+
* @typeParam T - The type of items in the grid
|
|
480
|
+
*
|
|
481
|
+
* @example
|
|
482
|
+
* ```tsx
|
|
483
|
+
* <GridView renderItem={(item) => <GtkImage iconName={item?.icon ?? ""} />}>
|
|
484
|
+
* {icons.map((icon) => (
|
|
485
|
+
* <ListItem key={icon.id} id={icon.id} value={icon} />
|
|
486
|
+
* ))}
|
|
487
|
+
* </GridView>
|
|
488
|
+
* ```
|
|
489
|
+
*
|
|
490
|
+
* @internal
|
|
491
|
+
*/
|
|
492
|
+
export declare function GridView<T = unknown>(props: GridViewProps<T>): ReactElement;
|
|
493
|
+
/**
|
|
494
|
+
* Props for the TreeListView component.
|
|
495
|
+
*
|
|
496
|
+
* @typeParam T - The type of items in the tree
|
|
497
|
+
*/
|
|
498
|
+
export type TreeListViewProps<T = unknown> = Omit<import("./generated/jsx.js").GtkListViewProps, "renderItem"> & {
|
|
499
|
+
/** Function to render each tree item */
|
|
500
|
+
renderItem: TreeRenderItemFn<T>;
|
|
501
|
+
/** Whether to automatically expand new rows (default: false) */
|
|
502
|
+
autoexpand?: boolean;
|
|
503
|
+
/** Selection mode for the tree */
|
|
504
|
+
selectionMode?: Gtk.SelectionMode;
|
|
505
|
+
/** Currently selected item IDs */
|
|
506
|
+
selected?: string[];
|
|
507
|
+
/** Callback when selection changes */
|
|
508
|
+
onSelectionChanged?: (ids: string[]) => void;
|
|
509
|
+
};
|
|
510
|
+
/**
|
|
511
|
+
* Tree list component with hierarchical data and expand/collapse support.
|
|
512
|
+
*
|
|
513
|
+
* Renders a tree structure with expandable/collapsible rows using GTK's TreeListModel.
|
|
514
|
+
* Items are defined declaratively by nesting TreeListItem components.
|
|
515
|
+
*
|
|
516
|
+
* @typeParam T - The type of items in the tree
|
|
517
|
+
*
|
|
518
|
+
* @example
|
|
519
|
+
* ```tsx
|
|
520
|
+
* interface Category { name: string; }
|
|
521
|
+
* interface Setting { key: string; value: string; }
|
|
522
|
+
*
|
|
523
|
+
* <TreeListView<Category | Setting>
|
|
524
|
+
* renderItem={(item, row) => (
|
|
525
|
+
* <GtkLabel label={'name' in item ? item.name : item.key} />
|
|
526
|
+
* )}
|
|
527
|
+
* >
|
|
528
|
+
* {categories.map(cat => (
|
|
529
|
+
* <TreeListItem key={cat.name} id={cat.name} value={cat}>
|
|
530
|
+
* {cat.settings?.map(setting => (
|
|
531
|
+
* <TreeListItem key={setting.key} id={setting.key} value={setting} />
|
|
532
|
+
* ))}
|
|
533
|
+
* </TreeListItem>
|
|
534
|
+
* ))}
|
|
535
|
+
* </TreeListView>
|
|
536
|
+
* ```
|
|
537
|
+
*
|
|
538
|
+
* @internal
|
|
539
|
+
*/
|
|
540
|
+
export declare function TreeListView<T = unknown>(props: TreeListViewProps<T>): ReactElement;
|
|
541
|
+
/**
|
|
542
|
+
* Element type for items in a TreeListView.
|
|
543
|
+
*
|
|
544
|
+
* Nesting TreeListItem components defines the tree hierarchy.
|
|
545
|
+
*
|
|
546
|
+
* @example
|
|
547
|
+
* ```tsx
|
|
548
|
+
* <TreeListView renderItem={(item) => <GtkLabel label={item.name} />}>
|
|
549
|
+
* <TreeListItem id="parent" value={{ name: "Parent" }}>
|
|
550
|
+
* <TreeListItem id="child1" value={{ name: "Child 1" }} />
|
|
551
|
+
* <TreeListItem id="child2" value={{ name: "Child 2" }} />
|
|
552
|
+
* </TreeListItem>
|
|
553
|
+
* </TreeListView>
|
|
554
|
+
* ```
|
|
555
|
+
*/
|
|
556
|
+
export declare const TreeListItem: "TreeListItem";
|
|
557
|
+
/**
|
|
558
|
+
* Element type for simple string-based list items.
|
|
559
|
+
*
|
|
560
|
+
* Use when list items only need string values without complex data.
|
|
561
|
+
*
|
|
562
|
+
* @example
|
|
563
|
+
* ```tsx
|
|
564
|
+
* <GtkDropDown>
|
|
565
|
+
* <SimpleListItem id="opt1" value="Option 1" />
|
|
566
|
+
* <SimpleListItem id="opt2" value="Option 2" />
|
|
567
|
+
* </GtkDropDown>
|
|
568
|
+
* ```
|
|
569
|
+
*/
|
|
570
|
+
export declare const SimpleListItem: "SimpleListItem";
|
|
571
|
+
/**
|
|
572
|
+
* Slot positions for AdwActionRow, AdwEntryRow, and AdwExpanderRow widgets.
|
|
573
|
+
*
|
|
574
|
+
* @example
|
|
575
|
+
* ```tsx
|
|
576
|
+
* <AdwActionRow title="Setting">
|
|
577
|
+
* <ActionRow.Prefix>
|
|
578
|
+
* <GtkCheckButton />
|
|
579
|
+
* </ActionRow.Prefix>
|
|
580
|
+
* <ActionRow.Suffix>
|
|
581
|
+
* <GtkButton iconName="go-next-symbolic" />
|
|
582
|
+
* </ActionRow.Suffix>
|
|
583
|
+
* </AdwActionRow>
|
|
584
|
+
* ```
|
|
585
|
+
*/
|
|
586
|
+
export declare const ActionRow: {
|
|
587
|
+
/** Place child as a prefix (left side) of the row */
|
|
588
|
+
Prefix: "ActionRow.Prefix";
|
|
589
|
+
/** Place child as a suffix (right side) of the row */
|
|
590
|
+
Suffix: "ActionRow.Suffix";
|
|
591
|
+
};
|
|
592
|
+
/**
|
|
593
|
+
* Slot positions for HeaderBar and ActionBar widgets.
|
|
594
|
+
*
|
|
595
|
+
* @example
|
|
596
|
+
* ```tsx
|
|
597
|
+
* <GtkHeaderBar>
|
|
598
|
+
* <Pack.Start>
|
|
599
|
+
* <GtkButton label="Back" />
|
|
600
|
+
* </Pack.Start>
|
|
601
|
+
* <Pack.End>
|
|
602
|
+
* <GtkMenuButton />
|
|
603
|
+
* </Pack.End>
|
|
604
|
+
* </GtkHeaderBar>
|
|
605
|
+
* ```
|
|
606
|
+
*/
|
|
607
|
+
export declare const Pack: {
|
|
608
|
+
/** Place child at the start (left in LTR) of the bar */
|
|
609
|
+
Start: "Pack.Start";
|
|
610
|
+
/** Place child at the end (right in LTR) of the bar */
|
|
611
|
+
End: "Pack.End";
|
|
612
|
+
};
|
|
613
|
+
/**
|
|
614
|
+
* Slot positions for AdwToolbarView.
|
|
615
|
+
*
|
|
616
|
+
* @example
|
|
617
|
+
* ```tsx
|
|
618
|
+
* <AdwToolbarView>
|
|
619
|
+
* <Toolbar.Top>
|
|
620
|
+
* <AdwHeaderBar />
|
|
621
|
+
* </Toolbar.Top>
|
|
622
|
+
* <GtkLabel label="Content" />
|
|
623
|
+
* <Toolbar.Bottom>
|
|
624
|
+
* <GtkActionBar />
|
|
625
|
+
* </Toolbar.Bottom>
|
|
626
|
+
* </AdwToolbarView>
|
|
627
|
+
* ```
|
|
628
|
+
*/
|
|
629
|
+
export declare const Toolbar: {
|
|
630
|
+
/** Place toolbar at the top */
|
|
631
|
+
Top: "Toolbar.Top";
|
|
632
|
+
/** Place toolbar at the bottom */
|
|
633
|
+
Bottom: "Toolbar.Bottom";
|
|
634
|
+
};
|
|
635
|
+
/**
|
|
636
|
+
* Element type for GtkOverlay main child container.
|
|
637
|
+
*/
|
|
638
|
+
export declare const Overlay: "Overlay";
|
|
639
|
+
/**
|
|
640
|
+
* Element type for overlay children positioned above the main content.
|
|
641
|
+
*
|
|
642
|
+
* @example
|
|
643
|
+
* ```tsx
|
|
644
|
+
* <GtkOverlay>
|
|
645
|
+
* <Overlay>
|
|
646
|
+
* <GtkImage file="background.png" />
|
|
647
|
+
* </Overlay>
|
|
648
|
+
* <OverlayChild>
|
|
649
|
+
* <GtkLabel label="Overlaid text" cssClasses={["title-1"]} />
|
|
650
|
+
* </OverlayChild>
|
|
651
|
+
* </GtkOverlay>
|
|
652
|
+
* ```
|
|
653
|
+
*/
|
|
654
|
+
export declare const OverlayChild: "OverlayChild";
|
|
655
|
+
/**
|
|
656
|
+
* Element types for declarative menu construction.
|
|
657
|
+
*
|
|
658
|
+
* Build menus with items, sections, and submenus declaratively.
|
|
659
|
+
*
|
|
660
|
+
* @example
|
|
661
|
+
* ```tsx
|
|
662
|
+
* <GtkMenuButton>
|
|
663
|
+
* <Menu.Section>
|
|
664
|
+
* <Menu.Item id="open" label="Open" onActivate={handleOpen} accels="<Control>o" />
|
|
665
|
+
* <Menu.Item id="save" label="Save" onActivate={handleSave} accels="<Control>s" />
|
|
666
|
+
* </Menu.Section>
|
|
667
|
+
* <Menu.Submenu label="Export">
|
|
668
|
+
* <Menu.Item id="pdf" label="As PDF" onActivate={exportPdf} />
|
|
669
|
+
* <Menu.Item id="png" label="As PNG" onActivate={exportPng} />
|
|
670
|
+
* </Menu.Submenu>
|
|
671
|
+
* </GtkMenuButton>
|
|
672
|
+
* ```
|
|
673
|
+
*/
|
|
674
|
+
export declare const Menu: {
|
|
675
|
+
/** A clickable menu item with action */
|
|
676
|
+
Item: "Menu.Item";
|
|
677
|
+
/** A section grouping related menu items */
|
|
678
|
+
Section: "Menu.Section";
|
|
679
|
+
/** A submenu containing nested items */
|
|
680
|
+
Submenu: "Menu.Submenu";
|
|
681
|
+
};
|
|
682
|
+
declare global {
|
|
683
|
+
namespace React {
|
|
684
|
+
namespace JSX {
|
|
685
|
+
interface IntrinsicElements {
|
|
686
|
+
StackPage: StackPageProps;
|
|
687
|
+
GridChild: GridChildProps;
|
|
688
|
+
FixedChild: FixedChildProps;
|
|
689
|
+
Toast: ToastProps;
|
|
690
|
+
"Notebook.Page": NotebookPageProps;
|
|
691
|
+
"Notebook.PageTab": NotebookPageTabProps;
|
|
692
|
+
ListItem: ListItemProps;
|
|
693
|
+
TreeListItem: TreeListItemProps<any>;
|
|
694
|
+
ColumnViewColumn: ColumnViewColumnProps<any>;
|
|
695
|
+
SimpleListItem: StringListItemProps;
|
|
696
|
+
"ActionRow.Prefix": SlotProps;
|
|
697
|
+
"ActionRow.Suffix": SlotProps;
|
|
698
|
+
"Pack.Start": SlotProps;
|
|
699
|
+
"Pack.End": SlotProps;
|
|
700
|
+
"Toolbar.Top": SlotProps;
|
|
701
|
+
"Toolbar.Bottom": SlotProps;
|
|
702
|
+
OverlayChild: OverlayChildProps;
|
|
703
|
+
"Menu.Item": MenuItemProps;
|
|
704
|
+
"Menu.Section": MenuSectionProps;
|
|
705
|
+
"Menu.Submenu": MenuSubmenuProps;
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
export * from "./generated/jsx.js";
|
|
711
|
+
declare module "./generated/jsx.js" {
|
|
712
|
+
interface WidgetProps extends EventControllerProps {
|
|
713
|
+
/**
|
|
714
|
+
* Called when any property on this widget changes.
|
|
715
|
+
* @param propName - The name of the property that changed
|
|
716
|
+
*/
|
|
717
|
+
onNotify?: (propName: string) => void;
|
|
718
|
+
}
|
|
719
|
+
}
|