@gtkx/react 0.14.0 → 0.16.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 +28 -27
- package/dist/errors.js +3 -0
- package/dist/factory.d.ts +3 -2
- package/dist/factory.js +1 -1
- package/dist/generated/internal.d.ts +28 -1
- package/dist/generated/internal.js +93 -18
- package/dist/generated/jsx.d.ts +1712 -1516
- package/dist/generated/jsx.js +475 -0
- package/dist/host-config.d.ts +3 -1
- package/dist/host-config.js +31 -11
- package/dist/jsx.d.ts +147 -97
- package/dist/jsx.js +89 -21
- package/dist/node.d.ts +3 -1
- package/dist/node.js +5 -3
- package/dist/nodes/abstract/positional-child.d.ts +9 -0
- package/dist/nodes/abstract/positional-child.js +29 -0
- package/dist/nodes/abstract/positional-parent.d.ts +18 -0
- package/dist/nodes/abstract/positional-parent.js +48 -0
- package/dist/nodes/abstract/virtual-container.d.ts +17 -0
- package/dist/nodes/abstract/virtual-container.js +59 -0
- package/dist/nodes/abstract/virtual-single-child.d.ts +18 -0
- package/dist/nodes/abstract/virtual-single-child.js +54 -0
- package/dist/nodes/action-row-child.d.ts +0 -13
- package/dist/nodes/action-row-child.js +14 -12
- package/dist/nodes/action-row.d.ts +6 -1
- package/dist/nodes/action-row.js +4 -37
- package/dist/nodes/adjustable.d.ts +23 -0
- package/dist/nodes/adjustable.js +62 -0
- package/dist/nodes/alert-dialog-response.d.ts +1 -0
- package/dist/nodes/alert-dialog-response.js +86 -0
- package/dist/nodes/animation/animation-controller.d.ts +17 -0
- package/dist/nodes/animation/animation-controller.js +107 -0
- package/dist/nodes/animation/animation-factory.d.ts +15 -0
- package/dist/nodes/animation/animation-factory.js +25 -0
- package/dist/nodes/animation/animation-node.d.ts +9 -0
- package/dist/nodes/animation/animation-node.js +126 -0
- package/dist/nodes/animation/animation-style-sheet.d.ts +16 -0
- package/dist/nodes/animation/animation-style-sheet.js +74 -0
- package/dist/nodes/animation/index.d.ts +4 -0
- package/dist/nodes/animation/index.js +1 -0
- package/dist/nodes/animation/property-mapper.d.ts +11 -0
- package/dist/nodes/animation/property-mapper.js +36 -0
- package/dist/nodes/animation/transform-state.d.ts +11 -0
- package/dist/nodes/animation/transform-state.js +57 -0
- package/dist/nodes/animation/widget-registry.d.ts +5 -0
- package/dist/nodes/animation/widget-registry.js +42 -0
- package/dist/nodes/application.js +17 -7
- package/dist/nodes/autowrapped.js +37 -43
- package/dist/nodes/calendar.js +16 -55
- package/dist/nodes/color-dialog-button.d.ts +1 -0
- package/dist/nodes/color-dialog-button.js +70 -0
- package/dist/nodes/column-view-column.d.ts +4 -3
- package/dist/nodes/column-view-column.js +5 -1
- package/dist/nodes/column-view.js +40 -43
- package/dist/nodes/dialog.d.ts +11 -0
- package/dist/nodes/dialog.js +20 -0
- package/dist/nodes/drawing-area.d.ts +1 -0
- package/dist/nodes/drawing-area.js +36 -0
- package/dist/nodes/event-controller.d.ts +1 -0
- package/dist/nodes/event-controller.js +96 -0
- package/dist/nodes/expander-row-child.d.ts +0 -14
- package/dist/nodes/expander-row-child.js +14 -12
- package/dist/nodes/expander-row.d.ts +6 -1
- package/dist/nodes/expander-row.js +11 -47
- package/dist/nodes/fixed-child.js +48 -36
- package/dist/nodes/font-dialog-button.d.ts +1 -0
- package/dist/nodes/font-dialog-button.js +90 -0
- package/dist/nodes/grid-child.js +39 -45
- package/dist/nodes/grid.d.ts +1 -0
- package/dist/nodes/grid.js +41 -0
- package/dist/nodes/index.d.ts +22 -6
- package/dist/nodes/index.js +22 -6
- package/dist/nodes/internal/base-item-renderer.d.ts +29 -0
- package/dist/nodes/internal/base-item-renderer.js +88 -0
- package/dist/nodes/internal/base-store.d.ts +9 -0
- package/dist/nodes/internal/base-store.js +20 -0
- package/dist/nodes/internal/child-attachment.d.ts +26 -0
- package/dist/nodes/internal/child-attachment.js +48 -0
- package/dist/nodes/internal/deferred-action.d.ts +8 -0
- package/dist/nodes/internal/deferred-action.js +19 -0
- package/dist/nodes/internal/list-item-renderer.d.ts +14 -14
- package/dist/nodes/internal/list-item-renderer.js +49 -70
- package/dist/nodes/internal/list-store.d.ts +7 -6
- package/dist/nodes/internal/list-store.js +20 -24
- package/dist/nodes/internal/predicates.d.ts +28 -1
- package/dist/nodes/internal/predicates.js +53 -38
- package/dist/nodes/internal/selection-model.d.ts +30 -0
- package/dist/nodes/internal/selection-model.js +91 -0
- package/dist/nodes/internal/signal-store.d.ts +5 -3
- package/dist/nodes/internal/signal-store.js +30 -21
- package/dist/nodes/internal/simple-list-store.js +6 -9
- package/dist/nodes/internal/text-buffer-controller.d.ts +43 -0
- package/dist/nodes/internal/text-buffer-controller.js +287 -0
- package/dist/nodes/internal/text-tag-styles.d.ts +43 -0
- package/dist/nodes/internal/text-tag-styles.js +52 -0
- package/dist/nodes/internal/tree-list-item-renderer.d.ts +16 -14
- package/dist/nodes/internal/tree-list-item-renderer.js +88 -91
- package/dist/nodes/internal/tree-store.d.ts +10 -9
- package/dist/nodes/internal/tree-store.js +31 -35
- package/dist/nodes/internal/utils.d.ts +7 -4
- package/dist/nodes/internal/utils.js +50 -5
- package/dist/nodes/level-bar.js +18 -66
- package/dist/nodes/list-item.d.ts +6 -3
- package/dist/nodes/list-item.js +7 -4
- package/dist/nodes/list-view.js +19 -11
- package/dist/nodes/menu.d.ts +3 -3
- package/dist/nodes/menu.js +3 -3
- package/dist/nodes/models/list.d.ts +11 -13
- package/dist/nodes/models/list.js +16 -73
- package/dist/nodes/models/menu.d.ts +8 -7
- package/dist/nodes/models/menu.js +43 -50
- package/dist/nodes/models/tree-list.d.ts +6 -12
- package/dist/nodes/models/tree-list.js +30 -93
- package/dist/nodes/navigation-page.d.ts +1 -0
- package/dist/nodes/navigation-page.js +7 -3
- package/dist/nodes/navigation-view.js +17 -28
- package/dist/nodes/notebook-page-tab.d.ts +4 -3
- package/dist/nodes/notebook-page-tab.js +5 -2
- package/dist/nodes/notebook-page.d.ts +7 -5
- package/dist/nodes/notebook-page.js +39 -16
- package/dist/nodes/notebook.js +2 -2
- package/dist/nodes/overlay-child.js +90 -30
- package/dist/nodes/pack-child.d.ts +0 -13
- package/dist/nodes/pack-child.js +14 -12
- package/dist/nodes/pack.d.ts +6 -1
- package/dist/nodes/pack.js +4 -37
- package/dist/nodes/popover-menu.js +2 -2
- package/dist/nodes/scale.js +15 -58
- package/dist/nodes/scrolled-window.js +7 -5
- package/dist/nodes/search-bar.d.ts +1 -0
- package/dist/nodes/search-bar.js +40 -0
- package/dist/nodes/shortcut-controller.d.ts +1 -0
- package/dist/nodes/shortcut-controller.js +90 -0
- package/dist/nodes/shortcut.d.ts +39 -0
- package/dist/nodes/shortcut.js +52 -0
- package/dist/nodes/simple-list-view.js +2 -3
- package/dist/nodes/slot.d.ts +6 -9
- package/dist/nodes/slot.js +27 -42
- package/dist/nodes/source-view.d.ts +1 -0
- package/dist/nodes/source-view.js +93 -0
- package/dist/nodes/stack-page.js +17 -13
- package/dist/nodes/stack.js +19 -5
- package/dist/nodes/text-anchor.d.ts +41 -0
- package/dist/nodes/text-anchor.js +59 -0
- package/dist/nodes/text-content.d.ts +10 -0
- package/dist/nodes/text-content.js +1 -0
- package/dist/nodes/text-paintable.d.ts +17 -0
- package/dist/nodes/text-paintable.js +34 -0
- package/dist/nodes/text-segment.d.ts +15 -0
- package/dist/nodes/text-segment.js +29 -0
- package/dist/nodes/text-tag.d.ts +136 -0
- package/dist/nodes/text-tag.js +202 -0
- package/dist/nodes/text-view.d.ts +31 -0
- package/dist/nodes/text-view.js +73 -0
- package/dist/nodes/toggle-group.js +24 -32
- package/dist/nodes/toggle.d.ts +1 -15
- package/dist/nodes/toggle.js +40 -32
- package/dist/nodes/toolbar-child.js +14 -16
- package/dist/nodes/tree-list-item.d.ts +7 -5
- package/dist/nodes/tree-list-item.js +24 -36
- package/dist/nodes/tree-list-view.js +9 -4
- package/dist/nodes/virtual.d.ts +1 -1
- package/dist/nodes/widget.d.ts +3 -13
- package/dist/nodes/widget.js +117 -231
- package/dist/nodes/window.d.ts +9 -3
- package/dist/nodes/window.js +35 -19
- package/dist/registry.d.ts +1 -1
- package/dist/render.js +8 -6
- package/dist/scheduler.d.ts +11 -1
- package/dist/scheduler.js +16 -4
- package/dist/types.d.ts +2 -110
- package/package.json +3 -3
- package/dist/nodes/calendar-mark.d.ts +0 -15
- package/dist/nodes/calendar-mark.js +0 -29
- package/dist/nodes/internal/constants.d.ts +0 -1
- package/dist/nodes/internal/constants.js +0 -21
- package/dist/nodes/level-bar-offset.d.ts +0 -13
- package/dist/nodes/level-bar-offset.js +0 -35
- package/dist/nodes/scale-mark.d.ts +0 -17
- package/dist/nodes/scale-mark.js +0 -38
- package/dist/nodes/virtual-child.d.ts +0 -18
- package/dist/nodes/virtual-child.js +0 -62
package/dist/jsx.d.ts
CHANGED
|
@@ -1,8 +1,28 @@
|
|
|
1
|
+
import type * as Adw from "@gtkx/ffi/adw";
|
|
2
|
+
import type * as Gsk from "@gtkx/ffi/gsk";
|
|
1
3
|
import type * as Gtk from "@gtkx/ffi/gtk";
|
|
2
4
|
import type { ReactElement, ReactNode } from "react";
|
|
5
|
+
import type { GtkGridViewProps as GeneratedGtkGridViewProps, GtkListViewProps as GeneratedGtkListViewProps, WidgetSlotNames } from "./generated/jsx.js";
|
|
6
|
+
import type { AnimationProps as AnimationNodeProps } from "./nodes/animation/index.js";
|
|
3
7
|
import type { RenderItemFn } from "./nodes/internal/list-item-renderer.js";
|
|
4
8
|
import type { TreeRenderItemFn } from "./nodes/internal/tree-list-item-renderer.js";
|
|
5
|
-
|
|
9
|
+
import type { ShortcutProps as ShortcutNodeProps } from "./nodes/shortcut.js";
|
|
10
|
+
import type { TextAnchorProps } from "./nodes/text-anchor.js";
|
|
11
|
+
import type { TextPaintableProps } from "./nodes/text-paintable.js";
|
|
12
|
+
import type { TextTagProps } from "./nodes/text-tag.js";
|
|
13
|
+
export type { AnimatableProperties, SpringTransition, TimedTransition, Transition } from "./nodes/animation/index.js";
|
|
14
|
+
export type { TextAnchorProps } from "./nodes/text-anchor.js";
|
|
15
|
+
export type { TextPaintableProps } from "./nodes/text-paintable.js";
|
|
16
|
+
export type { TextTagProps } from "./nodes/text-tag.js";
|
|
17
|
+
export type ScaleMark = {
|
|
18
|
+
value: number;
|
|
19
|
+
position?: Gtk.PositionType;
|
|
20
|
+
label?: string | null;
|
|
21
|
+
};
|
|
22
|
+
export type LevelBarOffset = {
|
|
23
|
+
id: string;
|
|
24
|
+
value: number;
|
|
25
|
+
};
|
|
6
26
|
/**
|
|
7
27
|
* Props for slot-based child positioning.
|
|
8
28
|
*
|
|
@@ -87,6 +107,8 @@ export type FixedChildProps = VirtualSlotProps & {
|
|
|
87
107
|
x?: number;
|
|
88
108
|
/** Y coordinate in pixels */
|
|
89
109
|
y?: number;
|
|
110
|
+
/** 3D transform to apply to the child (perspective, rotation, etc.) */
|
|
111
|
+
transform?: Gsk.Transform;
|
|
90
112
|
};
|
|
91
113
|
/**
|
|
92
114
|
* Props for custom list view rendering.
|
|
@@ -131,7 +153,7 @@ export type ColumnViewRootProps<C extends string = string> = {
|
|
|
131
153
|
/** Sort direction (ascending or descending) */
|
|
132
154
|
sortOrder?: Gtk.SortType;
|
|
133
155
|
/** Callback when sort changes */
|
|
134
|
-
|
|
156
|
+
onSortChanged?: (column: C | null, order: Gtk.SortType) => void;
|
|
135
157
|
/** Estimated row height in pixels for proper virtualization before content loads */
|
|
136
158
|
estimatedRowHeight?: number;
|
|
137
159
|
};
|
|
@@ -141,6 +163,10 @@ export type ColumnViewRootProps<C extends string = string> = {
|
|
|
141
163
|
export type NotebookPageProps = VirtualSlotProps & {
|
|
142
164
|
/** Tab label text (optional when using Notebook.PageTab) */
|
|
143
165
|
label?: string;
|
|
166
|
+
/** Whether the tab should expand to fill available space */
|
|
167
|
+
tabExpand?: boolean;
|
|
168
|
+
/** Whether the tab should fill its allocated space */
|
|
169
|
+
tabFill?: boolean;
|
|
144
170
|
};
|
|
145
171
|
/**
|
|
146
172
|
* Props for custom notebook page tab widgets.
|
|
@@ -218,67 +244,6 @@ export type OverlayChildProps = VirtualSlotProps & {
|
|
|
218
244
|
/** Whether to clip this overlay child to the main child bounds */
|
|
219
245
|
clipOverlay?: boolean;
|
|
220
246
|
};
|
|
221
|
-
/**
|
|
222
|
-
* Props for the ScaleMark virtual element.
|
|
223
|
-
*
|
|
224
|
-
* Used to declaratively add marks to a GtkScale slider.
|
|
225
|
-
*
|
|
226
|
-
* @example
|
|
227
|
-
* ```tsx
|
|
228
|
-
* <GtkScale>
|
|
229
|
-
* <x.ScaleMark value={0} label="Min" />
|
|
230
|
-
* <x.ScaleMark value={50} label="Mid" />
|
|
231
|
-
* <x.ScaleMark value={100} label="Max" />
|
|
232
|
-
* </GtkScale>
|
|
233
|
-
* ```
|
|
234
|
-
*/
|
|
235
|
-
export type ScaleMarkProps = {
|
|
236
|
-
/** The value at which to place the mark */
|
|
237
|
-
value: number;
|
|
238
|
-
/** Position of the mark (TOP or BOTTOM for horizontal, LEFT or RIGHT for vertical) */
|
|
239
|
-
position?: Gtk.PositionType;
|
|
240
|
-
/** Optional label text (supports Pango markup) */
|
|
241
|
-
label?: string | null;
|
|
242
|
-
};
|
|
243
|
-
/**
|
|
244
|
-
* Props for the CalendarMark virtual element.
|
|
245
|
-
*
|
|
246
|
-
* Used to declaratively mark days on a GtkCalendar.
|
|
247
|
-
*
|
|
248
|
-
* @example
|
|
249
|
-
* ```tsx
|
|
250
|
-
* <GtkCalendar>
|
|
251
|
-
* <x.CalendarMark day={15} />
|
|
252
|
-
* <x.CalendarMark day={20} />
|
|
253
|
-
* <x.CalendarMark day={25} />
|
|
254
|
-
* </GtkCalendar>
|
|
255
|
-
* ```
|
|
256
|
-
*/
|
|
257
|
-
export type CalendarMarkProps = {
|
|
258
|
-
/** The day of the month to mark (1-31) */
|
|
259
|
-
day: number;
|
|
260
|
-
};
|
|
261
|
-
/**
|
|
262
|
-
* Props for the LevelBarOffset virtual element.
|
|
263
|
-
*
|
|
264
|
-
* Used to declaratively add offset thresholds to a GtkLevelBar.
|
|
265
|
-
* Each offset defines a named threshold that triggers visual style changes.
|
|
266
|
-
*
|
|
267
|
-
* @example
|
|
268
|
-
* ```tsx
|
|
269
|
-
* <GtkLevelBar>
|
|
270
|
-
* <x.LevelBarOffset id="low" value={0.25} />
|
|
271
|
-
* <x.LevelBarOffset id="high" value={0.75} />
|
|
272
|
-
* <x.LevelBarOffset id="full" value={1.0} />
|
|
273
|
-
* </GtkLevelBar>
|
|
274
|
-
* ```
|
|
275
|
-
*/
|
|
276
|
-
export type LevelBarOffsetProps = {
|
|
277
|
-
/** Unique identifier for this offset (used for CSS styling) */
|
|
278
|
-
id: string;
|
|
279
|
-
/** The threshold value (0.0 to 1.0 for continuous mode, or integer for discrete) */
|
|
280
|
-
value: number;
|
|
281
|
-
};
|
|
282
247
|
/**
|
|
283
248
|
* Props for the Toggle virtual element.
|
|
284
249
|
*
|
|
@@ -307,6 +272,16 @@ export type ToggleProps = {
|
|
|
307
272
|
/** Whether underline in label indicates mnemonic */
|
|
308
273
|
useUnderline?: boolean;
|
|
309
274
|
};
|
|
275
|
+
export type AlertDialogResponseProps = {
|
|
276
|
+
/** Unique response ID (used in response signal and for default/close response) */
|
|
277
|
+
id: string;
|
|
278
|
+
/** Button label text */
|
|
279
|
+
label: string;
|
|
280
|
+
/** Visual appearance of the response button */
|
|
281
|
+
appearance?: Adw.ResponseAppearance;
|
|
282
|
+
/** Whether the response button is enabled */
|
|
283
|
+
enabled?: boolean;
|
|
284
|
+
};
|
|
310
285
|
/**
|
|
311
286
|
* Props for ExpanderRow child slots (Row and Action).
|
|
312
287
|
*/
|
|
@@ -319,6 +294,13 @@ type NavigationPageBaseProps = {
|
|
|
319
294
|
canPop?: boolean;
|
|
320
295
|
children?: ReactNode;
|
|
321
296
|
};
|
|
297
|
+
export type { GtkShortcutControllerProps as ShortcutControllerProps } from "./generated/jsx.js";
|
|
298
|
+
/**
|
|
299
|
+
* Props for the Shortcut element in JSX.
|
|
300
|
+
*
|
|
301
|
+
* @see {@link x.Shortcut} for usage examples
|
|
302
|
+
*/
|
|
303
|
+
export type ShortcutProps = ShortcutNodeProps;
|
|
322
304
|
/**
|
|
323
305
|
* Props for the NavigationPage virtual element with type-safe targeting.
|
|
324
306
|
*
|
|
@@ -351,18 +333,15 @@ export type NavigationPageProps = (NavigationPageBaseProps & {
|
|
|
351
333
|
id: string;
|
|
352
334
|
}) | (NavigationPageBaseProps & {
|
|
353
335
|
for: "AdwNavigationSplitView";
|
|
354
|
-
id:
|
|
336
|
+
id: WidgetSlotNames["AdwNavigationSplitView"];
|
|
355
337
|
});
|
|
356
|
-
|
|
357
|
-
* Type mapping widget names to their available slot IDs.
|
|
358
|
-
*/
|
|
359
|
-
export type { WidgetSlotNames } from "./generated/jsx.js";
|
|
338
|
+
export type { WidgetSlotNames };
|
|
360
339
|
/**
|
|
361
340
|
* Props for the ListView component.
|
|
362
341
|
*
|
|
363
342
|
* @typeParam T - The type of items in the list
|
|
364
343
|
*/
|
|
365
|
-
export type ListViewProps<T = unknown> = Omit<
|
|
344
|
+
export type ListViewProps<T = unknown> = Omit<GeneratedGtkListViewProps, "renderItem"> & {
|
|
366
345
|
/** Function to render each list item */
|
|
367
346
|
renderItem: (item: T | null) => ReactNode;
|
|
368
347
|
/** Estimated item height in pixels for proper virtualization before content loads */
|
|
@@ -373,7 +352,7 @@ export type ListViewProps<T = unknown> = Omit<import("./generated/jsx.js").GtkLi
|
|
|
373
352
|
*
|
|
374
353
|
* @typeParam T - The type of items in the grid
|
|
375
354
|
*/
|
|
376
|
-
export type GridViewProps<T = unknown> = Omit<
|
|
355
|
+
export type GridViewProps<T = unknown> = Omit<GeneratedGtkGridViewProps, "renderItem"> & {
|
|
377
356
|
/** Function to render each grid item */
|
|
378
357
|
renderItem: (item: T | null) => ReactNode;
|
|
379
358
|
/** Estimated item height in pixels for proper virtualization before content loads */
|
|
@@ -384,7 +363,7 @@ export type GridViewProps<T = unknown> = Omit<import("./generated/jsx.js").GtkGr
|
|
|
384
363
|
*
|
|
385
364
|
* @typeParam T - The type of items in the tree
|
|
386
365
|
*/
|
|
387
|
-
export type TreeListViewProps<T = unknown> = Omit<
|
|
366
|
+
export type TreeListViewProps<T = unknown> = Omit<GeneratedGtkListViewProps, "renderItem"> & {
|
|
388
367
|
/** Function to render each tree item */
|
|
389
368
|
renderItem: TreeRenderItemFn<T>;
|
|
390
369
|
/** Estimated item height in pixels for proper virtualization before content loads */
|
|
@@ -436,9 +415,9 @@ export declare const x: {
|
|
|
436
415
|
* </GtkHeaderBar>
|
|
437
416
|
* ```
|
|
438
417
|
*/
|
|
439
|
-
Slot<W extends keyof
|
|
418
|
+
Slot<W extends keyof WidgetSlotNames>(props: {
|
|
440
419
|
for: W;
|
|
441
|
-
id:
|
|
420
|
+
id: WidgetSlotNames[W];
|
|
442
421
|
children?: ReactNode;
|
|
443
422
|
}): ReactElement;
|
|
444
423
|
/**
|
|
@@ -713,44 +692,48 @@ export declare const x: {
|
|
|
713
692
|
*/
|
|
714
693
|
MenuSubmenu: "MenuSubmenu";
|
|
715
694
|
/**
|
|
716
|
-
*
|
|
695
|
+
* Declarative text tag for styling text content.
|
|
696
|
+
*
|
|
697
|
+
* Wrap text content with a TextTag to apply styling. Tags can be nested.
|
|
717
698
|
*
|
|
718
699
|
* @example
|
|
719
700
|
* ```tsx
|
|
720
|
-
* <
|
|
721
|
-
*
|
|
722
|
-
*
|
|
723
|
-
*
|
|
724
|
-
* </
|
|
701
|
+
* <GtkTextView>
|
|
702
|
+
* Normal <x.TextTag id="bold" weight={Pango.Weight.BOLD}>
|
|
703
|
+
* bold <x.TextTag id="red" foreground="red">and red</x.TextTag>
|
|
704
|
+
* </x.TextTag> text.
|
|
705
|
+
* </GtkTextView>
|
|
725
706
|
* ```
|
|
726
707
|
*/
|
|
727
|
-
|
|
708
|
+
TextTag: "TextTag";
|
|
728
709
|
/**
|
|
729
|
-
*
|
|
710
|
+
* Declarative anchor for embedding widgets in text flow.
|
|
711
|
+
*
|
|
712
|
+
* The anchor is placed at the current position in the text.
|
|
730
713
|
*
|
|
731
714
|
* @example
|
|
732
715
|
* ```tsx
|
|
733
|
-
* <
|
|
734
|
-
*
|
|
735
|
-
*
|
|
736
|
-
*
|
|
737
|
-
* </
|
|
716
|
+
* <GtkTextView>
|
|
717
|
+
* Click here: <x.TextAnchor>
|
|
718
|
+
* <GtkButton label="Click me" />
|
|
719
|
+
* </x.TextAnchor> to continue.
|
|
720
|
+
* </GtkTextView>
|
|
738
721
|
* ```
|
|
739
722
|
*/
|
|
740
|
-
|
|
723
|
+
TextAnchor: "TextAnchor";
|
|
741
724
|
/**
|
|
742
|
-
*
|
|
725
|
+
* Declarative inline paintable for embedding images/icons in text flow.
|
|
726
|
+
*
|
|
727
|
+
* The paintable is placed at the current position in the text.
|
|
743
728
|
*
|
|
744
729
|
* @example
|
|
745
730
|
* ```tsx
|
|
746
|
-
* <
|
|
747
|
-
*
|
|
748
|
-
*
|
|
749
|
-
* <x.LevelBarOffset id="full" value={1.0} />
|
|
750
|
-
* </GtkLevelBar>
|
|
731
|
+
* <GtkTextView>
|
|
732
|
+
* Click the icon <x.TextPaintable paintable={iconPaintable} /> to continue.
|
|
733
|
+
* </GtkTextView>
|
|
751
734
|
* ```
|
|
752
735
|
*/
|
|
753
|
-
|
|
736
|
+
TextPaintable: "TextPaintable";
|
|
754
737
|
/**
|
|
755
738
|
* A toggle button for an AdwToggleGroup.
|
|
756
739
|
*
|
|
@@ -763,6 +746,23 @@ export declare const x: {
|
|
|
763
746
|
* ```
|
|
764
747
|
*/
|
|
765
748
|
Toggle: "Toggle";
|
|
749
|
+
/**
|
|
750
|
+
* A response button for an AdwAlertDialog.
|
|
751
|
+
*
|
|
752
|
+
* @example
|
|
753
|
+
* ```tsx
|
|
754
|
+
* <AdwAlertDialog
|
|
755
|
+
* heading="Delete File?"
|
|
756
|
+
* body="This cannot be undone."
|
|
757
|
+
* defaultResponse="cancel"
|
|
758
|
+
* closeResponse="cancel"
|
|
759
|
+
* >
|
|
760
|
+
* <x.AlertDialogResponse id="cancel" label="Cancel" />
|
|
761
|
+
* <x.AlertDialogResponse id="delete" label="Delete" appearance={Adw.ResponseAppearance.DESTRUCTIVE} />
|
|
762
|
+
* </AdwAlertDialog>
|
|
763
|
+
* ```
|
|
764
|
+
*/
|
|
765
|
+
AlertDialogResponse: "AlertDialogResponse";
|
|
766
766
|
/**
|
|
767
767
|
* Nested rows container for AdwExpanderRow.
|
|
768
768
|
*
|
|
@@ -818,6 +818,53 @@ export declare const x: {
|
|
|
818
818
|
* ```
|
|
819
819
|
*/
|
|
820
820
|
NavigationPage: "NavigationPage";
|
|
821
|
+
/**
|
|
822
|
+
* Declarative keyboard shortcut controller.
|
|
823
|
+
*
|
|
824
|
+
* Attach keyboard shortcuts to a widget. Must contain `x.Shortcut` children.
|
|
825
|
+
*
|
|
826
|
+
* @example
|
|
827
|
+
* ```tsx
|
|
828
|
+
* <GtkBox>
|
|
829
|
+
* <GtkShortcutController scope={Gtk.ShortcutScope.GLOBAL}>
|
|
830
|
+
* <x.Shortcut trigger="<Control>f" onActivate={() => setSearchMode(s => !s)} />
|
|
831
|
+
* <x.Shortcut trigger="<Control>q" onActivate={quit} />
|
|
832
|
+
* </GtkShortcutController>
|
|
833
|
+
* </GtkBox>
|
|
834
|
+
* ```
|
|
835
|
+
*/
|
|
836
|
+
ShortcutController: "GtkShortcutController";
|
|
837
|
+
/**
|
|
838
|
+
* A keyboard shortcut definition.
|
|
839
|
+
*
|
|
840
|
+
* Must be a child of `x.ShortcutController`.
|
|
841
|
+
*
|
|
842
|
+
* @example
|
|
843
|
+
* ```tsx
|
|
844
|
+
* <x.Shortcut trigger="<Control>s" onActivate={save} />
|
|
845
|
+
* <x.Shortcut trigger={["F5", "<Control>r"]} onActivate={refresh} />
|
|
846
|
+
* <x.Shortcut trigger="Escape" onActivate={cancel} disabled={!canCancel} />
|
|
847
|
+
* ```
|
|
848
|
+
*/
|
|
849
|
+
Shortcut: "Shortcut";
|
|
850
|
+
/**
|
|
851
|
+
* Declarative animation wrapper using libadwaita's animation primitives.
|
|
852
|
+
*
|
|
853
|
+
* Provides Framer Motion-like API for animating GTK widgets with spring
|
|
854
|
+
* or timed animations.
|
|
855
|
+
*
|
|
856
|
+
* @example
|
|
857
|
+
* ```tsx
|
|
858
|
+
* <x.Animation
|
|
859
|
+
* initial={{ opacity: 0, y: -20 }}
|
|
860
|
+
* animate={{ opacity: 1, y: 0 }}
|
|
861
|
+
* transition={{ type: "spring", stiffness: 300, damping: 20 }}
|
|
862
|
+
* >
|
|
863
|
+
* <GtkLabel label="Hello World" />
|
|
864
|
+
* </x.Animation>
|
|
865
|
+
* ```
|
|
866
|
+
*/
|
|
867
|
+
Animation: "Animation";
|
|
821
868
|
};
|
|
822
869
|
declare global {
|
|
823
870
|
namespace React {
|
|
@@ -825,13 +872,12 @@ declare global {
|
|
|
825
872
|
interface IntrinsicElements {
|
|
826
873
|
ActionRowPrefix: VirtualSlotProps;
|
|
827
874
|
ActionRowSuffix: VirtualSlotProps;
|
|
828
|
-
|
|
875
|
+
AlertDialogResponse: AlertDialogResponseProps;
|
|
829
876
|
ColumnViewColumn: ColumnViewColumnProps<any>;
|
|
830
877
|
ExpanderRowAction: ExpanderRowChildProps;
|
|
831
878
|
ExpanderRowRow: ExpanderRowChildProps;
|
|
832
879
|
FixedChild: FixedChildProps;
|
|
833
880
|
GridChild: GridChildProps;
|
|
834
|
-
LevelBarOffset: LevelBarOffsetProps;
|
|
835
881
|
ListItem: ListItemProps;
|
|
836
882
|
MenuItem: MenuItemProps;
|
|
837
883
|
MenuSection: MenuSectionProps;
|
|
@@ -841,7 +887,9 @@ declare global {
|
|
|
841
887
|
OverlayChild: OverlayChildProps;
|
|
842
888
|
PackEnd: VirtualSlotProps;
|
|
843
889
|
PackStart: VirtualSlotProps;
|
|
844
|
-
|
|
890
|
+
TextAnchor: TextAnchorProps;
|
|
891
|
+
TextPaintable: TextPaintableProps;
|
|
892
|
+
TextTag: TextTagProps;
|
|
845
893
|
SimpleListItem: StringListItemProps;
|
|
846
894
|
StackPage: StackPageProps;
|
|
847
895
|
Toggle: ToggleProps;
|
|
@@ -849,6 +897,8 @@ declare global {
|
|
|
849
897
|
ToolbarTop: VirtualSlotProps;
|
|
850
898
|
TreeListItem: TreeListItemProps<any>;
|
|
851
899
|
NavigationPage: NavigationPageProps;
|
|
900
|
+
Shortcut: ShortcutProps;
|
|
901
|
+
Animation: AnimationNodeProps;
|
|
852
902
|
}
|
|
853
903
|
}
|
|
854
904
|
}
|
package/dist/jsx.js
CHANGED
|
@@ -320,44 +320,48 @@ export const x = {
|
|
|
320
320
|
*/
|
|
321
321
|
MenuSubmenu: "MenuSubmenu",
|
|
322
322
|
/**
|
|
323
|
-
*
|
|
323
|
+
* Declarative text tag for styling text content.
|
|
324
|
+
*
|
|
325
|
+
* Wrap text content with a TextTag to apply styling. Tags can be nested.
|
|
324
326
|
*
|
|
325
327
|
* @example
|
|
326
328
|
* ```tsx
|
|
327
|
-
* <
|
|
328
|
-
*
|
|
329
|
-
*
|
|
330
|
-
*
|
|
331
|
-
* </
|
|
329
|
+
* <GtkTextView>
|
|
330
|
+
* Normal <x.TextTag id="bold" weight={Pango.Weight.BOLD}>
|
|
331
|
+
* bold <x.TextTag id="red" foreground="red">and red</x.TextTag>
|
|
332
|
+
* </x.TextTag> text.
|
|
333
|
+
* </GtkTextView>
|
|
332
334
|
* ```
|
|
333
335
|
*/
|
|
334
|
-
|
|
336
|
+
TextTag: "TextTag",
|
|
335
337
|
/**
|
|
336
|
-
*
|
|
338
|
+
* Declarative anchor for embedding widgets in text flow.
|
|
339
|
+
*
|
|
340
|
+
* The anchor is placed at the current position in the text.
|
|
337
341
|
*
|
|
338
342
|
* @example
|
|
339
343
|
* ```tsx
|
|
340
|
-
* <
|
|
341
|
-
*
|
|
342
|
-
*
|
|
343
|
-
*
|
|
344
|
-
* </
|
|
344
|
+
* <GtkTextView>
|
|
345
|
+
* Click here: <x.TextAnchor>
|
|
346
|
+
* <GtkButton label="Click me" />
|
|
347
|
+
* </x.TextAnchor> to continue.
|
|
348
|
+
* </GtkTextView>
|
|
345
349
|
* ```
|
|
346
350
|
*/
|
|
347
|
-
|
|
351
|
+
TextAnchor: "TextAnchor",
|
|
348
352
|
/**
|
|
349
|
-
*
|
|
353
|
+
* Declarative inline paintable for embedding images/icons in text flow.
|
|
354
|
+
*
|
|
355
|
+
* The paintable is placed at the current position in the text.
|
|
350
356
|
*
|
|
351
357
|
* @example
|
|
352
358
|
* ```tsx
|
|
353
|
-
* <
|
|
354
|
-
*
|
|
355
|
-
*
|
|
356
|
-
* <x.LevelBarOffset id="full" value={1.0} />
|
|
357
|
-
* </GtkLevelBar>
|
|
359
|
+
* <GtkTextView>
|
|
360
|
+
* Click the icon <x.TextPaintable paintable={iconPaintable} /> to continue.
|
|
361
|
+
* </GtkTextView>
|
|
358
362
|
* ```
|
|
359
363
|
*/
|
|
360
|
-
|
|
364
|
+
TextPaintable: "TextPaintable",
|
|
361
365
|
/**
|
|
362
366
|
* A toggle button for an AdwToggleGroup.
|
|
363
367
|
*
|
|
@@ -370,6 +374,23 @@ export const x = {
|
|
|
370
374
|
* ```
|
|
371
375
|
*/
|
|
372
376
|
Toggle: "Toggle",
|
|
377
|
+
/**
|
|
378
|
+
* A response button for an AdwAlertDialog.
|
|
379
|
+
*
|
|
380
|
+
* @example
|
|
381
|
+
* ```tsx
|
|
382
|
+
* <AdwAlertDialog
|
|
383
|
+
* heading="Delete File?"
|
|
384
|
+
* body="This cannot be undone."
|
|
385
|
+
* defaultResponse="cancel"
|
|
386
|
+
* closeResponse="cancel"
|
|
387
|
+
* >
|
|
388
|
+
* <x.AlertDialogResponse id="cancel" label="Cancel" />
|
|
389
|
+
* <x.AlertDialogResponse id="delete" label="Delete" appearance={Adw.ResponseAppearance.DESTRUCTIVE} />
|
|
390
|
+
* </AdwAlertDialog>
|
|
391
|
+
* ```
|
|
392
|
+
*/
|
|
393
|
+
AlertDialogResponse: "AlertDialogResponse",
|
|
373
394
|
/**
|
|
374
395
|
* Nested rows container for AdwExpanderRow.
|
|
375
396
|
*
|
|
@@ -425,5 +446,52 @@ export const x = {
|
|
|
425
446
|
* ```
|
|
426
447
|
*/
|
|
427
448
|
NavigationPage: "NavigationPage",
|
|
449
|
+
/**
|
|
450
|
+
* Declarative keyboard shortcut controller.
|
|
451
|
+
*
|
|
452
|
+
* Attach keyboard shortcuts to a widget. Must contain `x.Shortcut` children.
|
|
453
|
+
*
|
|
454
|
+
* @example
|
|
455
|
+
* ```tsx
|
|
456
|
+
* <GtkBox>
|
|
457
|
+
* <GtkShortcutController scope={Gtk.ShortcutScope.GLOBAL}>
|
|
458
|
+
* <x.Shortcut trigger="<Control>f" onActivate={() => setSearchMode(s => !s)} />
|
|
459
|
+
* <x.Shortcut trigger="<Control>q" onActivate={quit} />
|
|
460
|
+
* </GtkShortcutController>
|
|
461
|
+
* </GtkBox>
|
|
462
|
+
* ```
|
|
463
|
+
*/
|
|
464
|
+
ShortcutController: "GtkShortcutController",
|
|
465
|
+
/**
|
|
466
|
+
* A keyboard shortcut definition.
|
|
467
|
+
*
|
|
468
|
+
* Must be a child of `x.ShortcutController`.
|
|
469
|
+
*
|
|
470
|
+
* @example
|
|
471
|
+
* ```tsx
|
|
472
|
+
* <x.Shortcut trigger="<Control>s" onActivate={save} />
|
|
473
|
+
* <x.Shortcut trigger={["F5", "<Control>r"]} onActivate={refresh} />
|
|
474
|
+
* <x.Shortcut trigger="Escape" onActivate={cancel} disabled={!canCancel} />
|
|
475
|
+
* ```
|
|
476
|
+
*/
|
|
477
|
+
Shortcut: "Shortcut",
|
|
478
|
+
/**
|
|
479
|
+
* Declarative animation wrapper using libadwaita's animation primitives.
|
|
480
|
+
*
|
|
481
|
+
* Provides Framer Motion-like API for animating GTK widgets with spring
|
|
482
|
+
* or timed animations.
|
|
483
|
+
*
|
|
484
|
+
* @example
|
|
485
|
+
* ```tsx
|
|
486
|
+
* <x.Animation
|
|
487
|
+
* initial={{ opacity: 0, y: -20 }}
|
|
488
|
+
* animate={{ opacity: 1, y: 0 }}
|
|
489
|
+
* transition={{ type: "spring", stiffness: 300, damping: 20 }}
|
|
490
|
+
* >
|
|
491
|
+
* <GtkLabel label="Hello World" />
|
|
492
|
+
* </x.Animation>
|
|
493
|
+
* ```
|
|
494
|
+
*/
|
|
495
|
+
Animation: "Animation",
|
|
428
496
|
};
|
|
429
497
|
export * from "./generated/jsx.js";
|
package/dist/node.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type SignalStore } from "./nodes/internal/signal-store.js";
|
|
1
2
|
import type { Container, ContainerClass, Props } from "./types.js";
|
|
2
3
|
export declare class Node<T = unknown, P = Props> {
|
|
3
4
|
static priority: number;
|
|
@@ -5,7 +6,8 @@ export declare class Node<T = unknown, P = Props> {
|
|
|
5
6
|
static createContainer(_props: Props, _containerClass: ContainerClass, _rootContainer?: Container): unknown;
|
|
6
7
|
container: T;
|
|
7
8
|
typeName: string;
|
|
8
|
-
|
|
9
|
+
signalStore: SignalStore;
|
|
10
|
+
constructor(typeName: string, _props: P | undefined, container: T, rootContainer: Container);
|
|
9
11
|
appendChild(_child: Node): void;
|
|
10
12
|
removeChild(_child: Node): void;
|
|
11
13
|
insertBefore(_child: Node, _before: Node): void;
|
package/dist/node.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getSignalStore } from "./nodes/internal/signal-store.js";
|
|
2
2
|
export class Node {
|
|
3
3
|
static priority = 0;
|
|
4
4
|
static matches(_type, _containerOrClass) {
|
|
@@ -9,9 +9,11 @@ export class Node {
|
|
|
9
9
|
}
|
|
10
10
|
container;
|
|
11
11
|
typeName;
|
|
12
|
-
|
|
12
|
+
signalStore;
|
|
13
|
+
constructor(typeName, _props = {}, container, rootContainer) {
|
|
13
14
|
this.typeName = typeName;
|
|
14
15
|
this.container = container;
|
|
16
|
+
this.signalStore = getSignalStore(rootContainer);
|
|
15
17
|
}
|
|
16
18
|
appendChild(_child) { }
|
|
17
19
|
removeChild(_child) { }
|
|
@@ -19,6 +21,6 @@ export class Node {
|
|
|
19
21
|
updateProps(_oldProps, _newProps) { }
|
|
20
22
|
mount() { }
|
|
21
23
|
unmount() {
|
|
22
|
-
signalStore.clear(this);
|
|
24
|
+
this.signalStore.clear(this);
|
|
23
25
|
}
|
|
24
26
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type * as Gtk from "@gtkx/ffi/gtk";
|
|
2
|
+
import type { Props } from "../../types.js";
|
|
3
|
+
import { VirtualSingleChildNode } from "./virtual-single-child.js";
|
|
4
|
+
export declare abstract class PositionalChildNode<P extends Props = Props> extends VirtualSingleChildNode<P> {
|
|
5
|
+
protected abstract attachToParent(parent: Gtk.Widget, child: Gtk.Widget): void;
|
|
6
|
+
protected abstract detachFromParent(parent: Gtk.Widget, child: Gtk.Widget): void;
|
|
7
|
+
unmount(): void;
|
|
8
|
+
protected onChildChange(oldChild: Gtk.Widget | null): void;
|
|
9
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { isObjectEqual } from "@gtkx/ffi";
|
|
2
|
+
import { VirtualSingleChildNode } from "./virtual-single-child.js";
|
|
3
|
+
export class PositionalChildNode extends VirtualSingleChildNode {
|
|
4
|
+
unmount() {
|
|
5
|
+
if (this.parent && this.child) {
|
|
6
|
+
const parent = this.parent;
|
|
7
|
+
const oldChild = this.child;
|
|
8
|
+
this.child = null;
|
|
9
|
+
const parentOfOld = oldChild.getParent();
|
|
10
|
+
if (parentOfOld && isObjectEqual(parentOfOld, parent)) {
|
|
11
|
+
this.detachFromParent(parent, oldChild);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
this.parent = null;
|
|
15
|
+
super.unmount();
|
|
16
|
+
}
|
|
17
|
+
onChildChange(oldChild) {
|
|
18
|
+
const parent = this.getParent();
|
|
19
|
+
if (oldChild) {
|
|
20
|
+
const parentOfOld = oldChild.getParent();
|
|
21
|
+
if (parentOfOld && isObjectEqual(parentOfOld, parent)) {
|
|
22
|
+
this.detachFromParent(parent, oldChild);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (this.child) {
|
|
26
|
+
this.attachToParent(parent, this.child);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type * as Gtk from "@gtkx/ffi/gtk";
|
|
2
|
+
import type { Node } from "../../node.js";
|
|
3
|
+
import type { Props } from "../../types.js";
|
|
4
|
+
import { WidgetNode } from "../widget.js";
|
|
5
|
+
type PositionalChildParentWidget = Gtk.Widget & {
|
|
6
|
+
remove(child: Gtk.Widget): void;
|
|
7
|
+
};
|
|
8
|
+
export declare abstract class PositionalParentNode<T extends PositionalChildParentWidget = PositionalChildParentWidget, P extends Props = Props> extends WidgetNode<T, P> {
|
|
9
|
+
protected abstract acceptedPositionalChildTypes: Set<string>;
|
|
10
|
+
protected abstract containerTypeName: string;
|
|
11
|
+
private isPositionalChild;
|
|
12
|
+
private formatExpectedTypes;
|
|
13
|
+
private assertValidChild;
|
|
14
|
+
appendChild(child: Node): void;
|
|
15
|
+
insertBefore(child: Node, before: Node): void;
|
|
16
|
+
removeChild(child: Node): void;
|
|
17
|
+
}
|
|
18
|
+
export {};
|