@gtkx/react 0.13.3 → 0.15.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 +8 -7
- package/dist/generated/internal.js +98 -0
- package/dist/generated/jsx.d.ts +908 -1572
- package/dist/host-config.js +2 -2
- package/dist/jsx.d.ts +176 -36
- package/dist/jsx.js +96 -5
- package/dist/nodes/adjustment.d.ts +48 -0
- package/dist/nodes/adjustment.js +70 -0
- package/dist/nodes/application.js +6 -6
- package/dist/nodes/calendar.js +3 -16
- package/dist/nodes/column-view-column.d.ts +1 -0
- package/dist/nodes/column-view-column.js +4 -0
- package/dist/nodes/column-view.js +6 -6
- package/dist/nodes/drawing-area.d.ts +1 -0
- package/dist/nodes/drawing-area.js +19 -0
- package/dist/nodes/expander-row.js +1 -0
- package/dist/nodes/index.d.ts +9 -0
- package/dist/nodes/index.js +9 -0
- package/dist/nodes/internal/constants.js +14 -0
- package/dist/nodes/internal/list-item-renderer.d.ts +1 -0
- package/dist/nodes/internal/list-item-renderer.js +6 -1
- package/dist/nodes/internal/predicates.d.ts +4 -0
- package/dist/nodes/internal/predicates.js +3 -0
- package/dist/nodes/internal/signal-store.d.ts +1 -0
- package/dist/nodes/internal/signal-store.js +7 -0
- package/dist/nodes/internal/tree-list-item-renderer.d.ts +1 -0
- package/dist/nodes/internal/tree-list-item-renderer.js +9 -1
- package/dist/nodes/level-bar.js +3 -16
- package/dist/nodes/list-view.js +11 -2
- package/dist/nodes/models/list.d.ts +6 -1
- package/dist/nodes/models/list.js +21 -6
- package/dist/nodes/models/tree-list.d.ts +6 -1
- package/dist/nodes/models/tree-list.js +21 -7
- package/dist/nodes/navigation-page.js +32 -23
- package/dist/nodes/notebook-page-tab.d.ts +1 -0
- package/dist/nodes/notebook-page-tab.js +15 -9
- package/dist/nodes/notebook-page.js +9 -6
- package/dist/nodes/scale.js +3 -16
- package/dist/nodes/scrolled-window.d.ts +1 -0
- package/dist/nodes/scrolled-window.js +22 -0
- package/dist/nodes/shortcut-controller.d.ts +37 -0
- package/dist/nodes/shortcut-controller.js +74 -0
- package/dist/nodes/shortcut.d.ts +38 -0
- package/dist/nodes/shortcut.js +46 -0
- package/dist/nodes/slot.js +11 -2
- package/dist/nodes/source-buffer.d.ts +73 -0
- package/dist/nodes/source-buffer.js +149 -0
- package/dist/nodes/source-view.d.ts +1 -0
- package/dist/nodes/source-view.js +42 -0
- package/dist/nodes/stack-page.js +15 -9
- package/dist/nodes/text-buffer.d.ts +43 -0
- package/dist/nodes/text-buffer.js +81 -0
- package/dist/nodes/text-view.d.ts +1 -0
- package/dist/nodes/text-view.js +45 -0
- package/dist/nodes/tree-list-view.js +11 -2
- package/dist/nodes/widget.d.ts +9 -0
- package/dist/nodes/widget.js +166 -13
- package/dist/nodes/window.js +7 -5
- package/dist/render.d.ts +14 -14
- package/dist/render.js +14 -14
- package/dist/types.d.ts +110 -1
- package/package.json +3 -3
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type * as Gdk from "@gtkx/ffi/gdk";
|
|
2
|
+
import type * as GObject from "@gtkx/ffi/gobject";
|
|
2
3
|
import type * as Gtk from "@gtkx/ffi/gtk";
|
|
3
4
|
export type Container = Gtk.Widget | Gtk.Application;
|
|
4
5
|
export type Props = Record<string, unknown>;
|
|
@@ -7,7 +8,7 @@ export type ContainerClass = typeof Gtk.Widget | typeof Gtk.Application;
|
|
|
7
8
|
* Props for EventController-based event handlers.
|
|
8
9
|
*
|
|
9
10
|
* These props attach EventControllers to widgets for handling
|
|
10
|
-
* pointer motion, clicks,
|
|
11
|
+
* pointer motion, clicks, keyboard events, and drag-and-drop.
|
|
11
12
|
*/
|
|
12
13
|
export interface EventControllerProps {
|
|
13
14
|
/** Called when the pointer enters the widget */
|
|
@@ -27,3 +28,111 @@ export interface EventControllerProps {
|
|
|
27
28
|
/** Called when the widget is scrolled */
|
|
28
29
|
onScroll?: (dx: number, dy: number) => boolean;
|
|
29
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Props for DragSource controller.
|
|
33
|
+
*
|
|
34
|
+
* Enables dragging content from a widget. Attach a DragSource to make
|
|
35
|
+
* a widget draggable.
|
|
36
|
+
*/
|
|
37
|
+
export interface DragSourceProps {
|
|
38
|
+
/**
|
|
39
|
+
* Called when a drag is about to start. Return a ContentProvider with the data
|
|
40
|
+
* to be dragged, or null to cancel the drag.
|
|
41
|
+
* @param x - X coordinate where drag started
|
|
42
|
+
* @param y - Y coordinate where drag started
|
|
43
|
+
*/
|
|
44
|
+
onDragPrepare?: (x: number, y: number) => Gdk.ContentProvider | null;
|
|
45
|
+
/**
|
|
46
|
+
* Called when the drag operation begins.
|
|
47
|
+
* @param drag - The Gdk.Drag object representing the ongoing drag
|
|
48
|
+
*/
|
|
49
|
+
onDragBegin?: (drag: Gdk.Drag) => void;
|
|
50
|
+
/**
|
|
51
|
+
* Called when the drag operation ends.
|
|
52
|
+
* @param drag - The Gdk.Drag object
|
|
53
|
+
* @param deleteData - Whether the data should be deleted (for move operations)
|
|
54
|
+
*/
|
|
55
|
+
onDragEnd?: (drag: Gdk.Drag, deleteData: boolean) => void;
|
|
56
|
+
/**
|
|
57
|
+
* Called when the drag operation is cancelled.
|
|
58
|
+
* @param drag - The Gdk.Drag object
|
|
59
|
+
* @param reason - The reason for cancellation
|
|
60
|
+
* @returns true if the cancel was handled
|
|
61
|
+
*/
|
|
62
|
+
onDragCancel?: (drag: Gdk.Drag, reason: Gdk.DragCancelReason) => boolean;
|
|
63
|
+
/**
|
|
64
|
+
* The allowed drag actions (COPY, MOVE, LINK, ASK).
|
|
65
|
+
* Defaults to Gdk.DragAction.COPY if not specified.
|
|
66
|
+
*/
|
|
67
|
+
dragActions?: Gdk.DragAction;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Props for DropTarget controller.
|
|
71
|
+
*
|
|
72
|
+
* Enables dropping content onto a widget. Attach a DropTarget to make
|
|
73
|
+
* a widget accept drops.
|
|
74
|
+
*/
|
|
75
|
+
export interface DropTargetProps {
|
|
76
|
+
/**
|
|
77
|
+
* Called when content is dropped on the widget.
|
|
78
|
+
* @param value - The dropped value (use value.getTypeName() to check type, then extract)
|
|
79
|
+
* @param x - X coordinate of drop
|
|
80
|
+
* @param y - Y coordinate of drop
|
|
81
|
+
* @returns true if the drop was accepted
|
|
82
|
+
*/
|
|
83
|
+
onDrop?: (value: GObject.Value, x: number, y: number) => boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Called when a drag enters the widget bounds.
|
|
86
|
+
* @param x - X coordinate
|
|
87
|
+
* @param y - Y coordinate
|
|
88
|
+
* @returns The preferred action, or 0 to reject
|
|
89
|
+
*/
|
|
90
|
+
onDropEnter?: (x: number, y: number) => Gdk.DragAction;
|
|
91
|
+
/**
|
|
92
|
+
* Called when a drag leaves the widget bounds.
|
|
93
|
+
*/
|
|
94
|
+
onDropLeave?: () => void;
|
|
95
|
+
/**
|
|
96
|
+
* Called when a drag moves within the widget bounds.
|
|
97
|
+
* @param x - X coordinate
|
|
98
|
+
* @param y - Y coordinate
|
|
99
|
+
* @returns The preferred action, or 0 to reject
|
|
100
|
+
*/
|
|
101
|
+
onDropMotion?: (x: number, y: number) => Gdk.DragAction;
|
|
102
|
+
/**
|
|
103
|
+
* The allowed drop actions (COPY, MOVE, LINK, ASK).
|
|
104
|
+
* Defaults to Gdk.DragAction.COPY if not specified.
|
|
105
|
+
*/
|
|
106
|
+
dropActions?: Gdk.DragAction;
|
|
107
|
+
/**
|
|
108
|
+
* Array of GTypes that this drop target accepts.
|
|
109
|
+
* Use typeFromName() to get GType values (e.g., typeFromName("gchararray") for strings).
|
|
110
|
+
*/
|
|
111
|
+
dropTypes?: number[];
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Props for GestureDrag controller.
|
|
115
|
+
*
|
|
116
|
+
* Enables tracking drag gestures (mouse/touch drag movements) on a widget.
|
|
117
|
+
* Use this for drawing, panning, or any interaction that tracks movement from a start point.
|
|
118
|
+
*/
|
|
119
|
+
export interface GestureDragProps {
|
|
120
|
+
/**
|
|
121
|
+
* Called when a drag gesture begins.
|
|
122
|
+
* @param startX - X coordinate where the drag started
|
|
123
|
+
* @param startY - Y coordinate where the drag started
|
|
124
|
+
*/
|
|
125
|
+
onGestureDragBegin?: (startX: number, startY: number) => void;
|
|
126
|
+
/**
|
|
127
|
+
* Called as the drag gesture continues.
|
|
128
|
+
* @param offsetX - Horizontal offset from the start point
|
|
129
|
+
* @param offsetY - Vertical offset from the start point
|
|
130
|
+
*/
|
|
131
|
+
onGestureDragUpdate?: (offsetX: number, offsetY: number) => void;
|
|
132
|
+
/**
|
|
133
|
+
* Called when the drag gesture ends.
|
|
134
|
+
* @param offsetX - Final horizontal offset from the start point
|
|
135
|
+
* @param offsetY - Final vertical offset from the start point
|
|
136
|
+
*/
|
|
137
|
+
onGestureDragEnd?: (offsetX: number, offsetY: number) => void;
|
|
138
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gtkx/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"description": "Build GTK4 desktop applications with React and TypeScript",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"gtkx",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"react-reconciler": "^0.33.0",
|
|
40
|
-
"@gtkx/gir": "0.
|
|
41
|
-
"@gtkx/ffi": "0.
|
|
40
|
+
"@gtkx/gir": "0.15.0",
|
|
41
|
+
"@gtkx/ffi": "0.15.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@types/react-reconciler": "^0.32.3"
|