@gtkx/react 0.20.0 → 0.21.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 +26 -62
- package/dist/components/compound.d.ts +40 -0
- package/dist/components/compound.d.ts.map +1 -0
- package/dist/components/compound.js +46 -0
- package/dist/components/compound.js.map +1 -0
- package/dist/components/list.d.ts +42 -2
- package/dist/components/list.d.ts.map +1 -1
- package/dist/components/list.js +42 -1
- package/dist/components/list.js.map +1 -1
- package/dist/components/slot-widget.d.ts +15 -0
- package/dist/components/slot-widget.d.ts.map +1 -0
- package/dist/components/slot-widget.js +37 -0
- package/dist/components/slot-widget.js.map +1 -0
- package/dist/errors.d.ts +6 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +8 -6
- package/dist/errors.js.map +1 -1
- package/dist/generated/compounds.d.ts +2672 -0
- package/dist/generated/compounds.d.ts.map +1 -0
- package/dist/generated/compounds.js +2624 -0
- package/dist/generated/compounds.js.map +1 -0
- package/dist/generated/internal.d.ts +2 -2
- package/dist/generated/internal.d.ts.map +1 -1
- package/dist/generated/internal.js +2751 -4748
- package/dist/generated/internal.js.map +1 -1
- package/dist/generated/jsx.d.ts +2042 -4592
- package/dist/generated/jsx.d.ts.map +1 -1
- package/dist/generated/jsx.js +919 -3478
- package/dist/generated/jsx.js.map +1 -1
- package/dist/generated/registry.d.ts +1 -0
- package/dist/generated/registry.d.ts.map +1 -1
- package/dist/generated/registry.js +0 -1
- package/dist/generated/registry.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/jsx.d.ts +116 -414
- package/dist/jsx.d.ts.map +1 -1
- package/dist/jsx.js +5 -328
- package/dist/jsx.js.map +1 -1
- package/dist/metadata.d.ts +1 -1
- package/dist/metadata.d.ts.map +1 -1
- package/dist/metadata.js.map +1 -1
- package/dist/nodes/alert-dialog.d.ts +14 -0
- package/dist/nodes/alert-dialog.d.ts.map +1 -0
- package/dist/nodes/alert-dialog.js +41 -0
- package/dist/nodes/alert-dialog.js.map +1 -0
- package/dist/nodes/animation.d.ts +5 -4
- package/dist/nodes/animation.d.ts.map +1 -1
- package/dist/nodes/animation.js +65 -49
- package/dist/nodes/animation.js.map +1 -1
- package/dist/nodes/column-view-column.js +2 -2
- package/dist/nodes/column-view-column.js.map +1 -1
- package/dist/nodes/container-slot.d.ts +3 -1
- package/dist/nodes/container-slot.d.ts.map +1 -1
- package/dist/nodes/container-slot.js +28 -16
- package/dist/nodes/container-slot.js.map +1 -1
- package/dist/nodes/drawing-area.d.ts +3 -1
- package/dist/nodes/drawing-area.d.ts.map +1 -1
- package/dist/nodes/drawing-area.js +20 -22
- package/dist/nodes/drawing-area.js.map +1 -1
- package/dist/nodes/event-controller.d.ts.map +1 -1
- package/dist/nodes/event-controller.js +3 -7
- package/dist/nodes/event-controller.js.map +1 -1
- package/dist/nodes/fixed-child.d.ts +1 -0
- package/dist/nodes/fixed-child.d.ts.map +1 -1
- package/dist/nodes/fixed-child.js +13 -0
- package/dist/nodes/fixed-child.js.map +1 -1
- package/dist/nodes/grid-child.d.ts +1 -0
- package/dist/nodes/grid-child.d.ts.map +1 -1
- package/dist/nodes/grid-child.js +13 -0
- package/dist/nodes/grid-child.js.map +1 -1
- package/dist/nodes/internal/construct.js +2 -2
- package/dist/nodes/internal/construct.js.map +1 -1
- package/dist/nodes/internal/widget.d.ts.map +1 -1
- package/dist/nodes/internal/widget.js +5 -9
- package/dist/nodes/internal/widget.js.map +1 -1
- package/dist/nodes/list-item-node.d.ts +6 -6
- package/dist/nodes/list-item-node.d.ts.map +1 -1
- package/dist/nodes/list-item-node.js +27 -5
- package/dist/nodes/list-item-node.js.map +1 -1
- package/dist/nodes/notebook-page.js +2 -2
- package/dist/nodes/notebook-page.js.map +1 -1
- package/dist/nodes/overlay-child.d.ts +2 -0
- package/dist/nodes/overlay-child.d.ts.map +1 -1
- package/dist/nodes/overlay-child.js +29 -8
- package/dist/nodes/overlay-child.js.map +1 -1
- package/dist/nodes/spin-row.d.ts +14 -0
- package/dist/nodes/spin-row.d.ts.map +1 -0
- package/dist/nodes/spin-row.js +46 -0
- package/dist/nodes/spin-row.js.map +1 -0
- package/dist/nodes/switch-row.d.ts +11 -0
- package/dist/nodes/switch-row.d.ts.map +1 -0
- package/dist/nodes/switch-row.js +15 -0
- package/dist/nodes/switch-row.js.map +1 -0
- package/dist/nodes/text-anchor.d.ts.map +1 -1
- package/dist/nodes/text-anchor.js +10 -0
- package/dist/nodes/text-anchor.js.map +1 -1
- package/dist/nodes/text-tag.d.ts.map +1 -1
- package/dist/nodes/text-tag.js +45 -39
- package/dist/nodes/text-tag.js.map +1 -1
- package/dist/nodes/toggle-group.d.ts +12 -6
- package/dist/nodes/toggle-group.d.ts.map +1 -1
- package/dist/nodes/toggle-group.js +53 -4
- package/dist/nodes/toggle-group.js.map +1 -1
- package/dist/nodes/widget.d.ts.map +1 -1
- package/dist/nodes/widget.js +7 -14
- package/dist/nodes/widget.js.map +1 -1
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +7 -5
- package/dist/registry.js.map +1 -1
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/use-property.d.ts +29 -0
- package/dist/use-property.d.ts.map +1 -0
- package/dist/use-property.js +44 -0
- package/dist/use-property.js.map +1 -0
- package/dist/use-setting.d.ts +36 -0
- package/dist/use-setting.d.ts.map +1 -0
- package/dist/use-setting.js +68 -0
- package/dist/use-setting.js.map +1 -0
- package/package.json +3 -3
- package/src/components/compound.tsx +57 -0
- package/src/components/list.tsx +59 -2
- package/src/components/slot-widget.tsx +46 -0
- package/src/errors.ts +8 -7
- package/src/generated/compounds.ts +2741 -0
- package/src/generated/internal.ts +2752 -4754
- package/src/generated/jsx.ts +2495 -5012
- package/src/generated/registry.ts +2 -1
- package/src/index.ts +2 -0
- package/src/jsx.ts +121 -443
- package/src/metadata.ts +1 -1
- package/src/nodes/alert-dialog.ts +55 -0
- package/src/nodes/animation.ts +67 -60
- package/src/nodes/column-view-column.ts +2 -2
- package/src/nodes/container-slot.ts +30 -17
- package/src/nodes/drawing-area.ts +23 -32
- package/src/nodes/event-controller.ts +3 -7
- package/src/nodes/fixed-child.ts +13 -0
- package/src/nodes/grid-child.ts +13 -0
- package/src/nodes/internal/construct.ts +2 -2
- package/src/nodes/internal/widget.ts +6 -12
- package/src/nodes/list-item-node.ts +33 -9
- package/src/nodes/notebook-page.ts +2 -2
- package/src/nodes/overlay-child.ts +30 -9
- package/src/nodes/spin-row.ts +72 -0
- package/src/nodes/switch-row.ts +26 -0
- package/src/nodes/text-anchor.ts +9 -0
- package/src/nodes/text-tag.ts +45 -40
- package/src/nodes/toggle-group.ts +63 -9
- package/src/nodes/widget.ts +6 -13
- package/src/registry.ts +7 -5
- package/src/types.ts +1 -0
- package/src/use-property.ts +58 -0
- package/src/use-setting.ts +96 -0
package/src/jsx.ts
CHANGED
|
@@ -5,8 +5,7 @@ import type * as Gsk from "@gtkx/ffi/gsk";
|
|
|
5
5
|
import type * as Gtk from "@gtkx/ffi/gtk";
|
|
6
6
|
import type * as GtkSource from "@gtkx/ffi/gtksource";
|
|
7
7
|
import type * as Pango from "@gtkx/ffi/pango";
|
|
8
|
-
import type {
|
|
9
|
-
import { createElement } from "react";
|
|
8
|
+
import type { ReactNode } from "react";
|
|
10
9
|
import type { WidgetSlotNames } from "./generated/jsx.js";
|
|
11
10
|
|
|
12
11
|
/**
|
|
@@ -35,14 +34,41 @@ export type AnimatableProperties = {
|
|
|
35
34
|
skewY?: number;
|
|
36
35
|
};
|
|
37
36
|
|
|
37
|
+
/** @internal */
|
|
38
|
+
type AnimationBaseProps = {
|
|
39
|
+
/** Initial property values before animation starts, or `false` to skip initial state */
|
|
40
|
+
initial?: AnimatableProperties | false;
|
|
41
|
+
/** Target property values to animate towards */
|
|
42
|
+
animate?: AnimatableProperties;
|
|
43
|
+
/** Property values to animate to when the component unmounts */
|
|
44
|
+
exit?: AnimatableProperties;
|
|
45
|
+
/** Whether to animate from `initial` to `animate` when first mounted (default: false) */
|
|
46
|
+
animateOnMount?: boolean;
|
|
47
|
+
/** Callback fired when an animation begins */
|
|
48
|
+
onAnimationStart?: () => void;
|
|
49
|
+
/** Callback fired when an animation completes */
|
|
50
|
+
onAnimationComplete?: () => void;
|
|
51
|
+
/** The child widget to animate (must be a single GTK widget) */
|
|
52
|
+
children?: ReactNode;
|
|
53
|
+
};
|
|
54
|
+
|
|
38
55
|
/**
|
|
39
|
-
*
|
|
56
|
+
* Props for a timed (duration-based) animation using Adw.TimedAnimation.
|
|
40
57
|
*
|
|
41
|
-
* @
|
|
58
|
+
* @example
|
|
59
|
+
* ```tsx
|
|
60
|
+
* <AdwTimedAnimation
|
|
61
|
+
* initial={{ opacity: 0 }}
|
|
62
|
+
* animate={{ opacity: 1 }}
|
|
63
|
+
* duration={300}
|
|
64
|
+
* easing={Adw.Easing.EASE_OUT_CUBIC}
|
|
65
|
+
* animateOnMount
|
|
66
|
+
* >
|
|
67
|
+
* <GtkLabel label="Fade in" />
|
|
68
|
+
* </AdwTimedAnimation>
|
|
69
|
+
* ```
|
|
42
70
|
*/
|
|
43
|
-
export type
|
|
44
|
-
/** Discriminant: duration-based animation with easing curves */
|
|
45
|
-
mode: "timed";
|
|
71
|
+
export type AdwTimedAnimationProps = AnimationBaseProps & {
|
|
46
72
|
/** Animation duration in milliseconds (default: 300) */
|
|
47
73
|
duration?: number;
|
|
48
74
|
/** Easing function for the animation curve (default: EASE_OUT_CUBIC) */
|
|
@@ -58,16 +84,22 @@ export type TimedTransition = {
|
|
|
58
84
|
};
|
|
59
85
|
|
|
60
86
|
/**
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
* Spring animations simulate a mass attached to a spring, providing natural-feeling motion.
|
|
64
|
-
* The animation settles when the spring reaches equilibrium.
|
|
87
|
+
* Props for a spring (physics-based) animation using Adw.SpringAnimation.
|
|
65
88
|
*
|
|
66
|
-
* @
|
|
89
|
+
* @example
|
|
90
|
+
* ```tsx
|
|
91
|
+
* <AdwSpringAnimation
|
|
92
|
+
* initial={{ scale: 0.9, opacity: 0 }}
|
|
93
|
+
* animate={{ scale: 1, opacity: 1 }}
|
|
94
|
+
* damping={0.8}
|
|
95
|
+
* stiffness={200}
|
|
96
|
+
* animateOnMount
|
|
97
|
+
* >
|
|
98
|
+
* <GtkButton label="Spring in" />
|
|
99
|
+
* </AdwSpringAnimation>
|
|
100
|
+
* ```
|
|
67
101
|
*/
|
|
68
|
-
export type
|
|
69
|
-
/** Discriminant: physics-based spring animation */
|
|
70
|
-
mode: "spring";
|
|
102
|
+
export type AdwSpringAnimationProps = AnimationBaseProps & {
|
|
71
103
|
/** Damping ratio controlling oscillation decay (default: 1, critically damped) */
|
|
72
104
|
damping?: number;
|
|
73
105
|
/** Spring stiffness in N/m affecting animation speed (default: 100) */
|
|
@@ -83,51 +115,9 @@ export type SpringTransition = {
|
|
|
83
115
|
};
|
|
84
116
|
|
|
85
117
|
/**
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
* The `mode` field determines the animation type:
|
|
89
|
-
* - `"timed"`: Duration-based animation with easing curves (uses {@link Adw.TimedAnimation})
|
|
90
|
-
* - `"spring"`: Physics-based spring animation (uses {@link Adw.SpringAnimation})
|
|
118
|
+
* @internal Union type used by the AnimationNode internally.
|
|
91
119
|
*/
|
|
92
|
-
export type
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Props for the Animation component.
|
|
96
|
-
*
|
|
97
|
-
* Provides a declarative API for animating widget properties using either
|
|
98
|
-
* timed (duration-based) or spring (physics-based) animations.
|
|
99
|
-
*
|
|
100
|
-
* @example
|
|
101
|
-
* ```tsx
|
|
102
|
-
* <x.Animation
|
|
103
|
-
* initial={{ opacity: 0, translateY: -20 }}
|
|
104
|
-
* animate={{ opacity: 1, translateY: 0 }}
|
|
105
|
-
* exit={{ opacity: 0, translateY: 20 }}
|
|
106
|
-
* transition={{ mode: "spring", damping: 0.8, stiffness: 200 }}
|
|
107
|
-
* animateOnMount
|
|
108
|
-
* >
|
|
109
|
-
* <GtkLabel label="Animated content" />
|
|
110
|
-
* </x.Animation>
|
|
111
|
-
* ```
|
|
112
|
-
*/
|
|
113
|
-
export type AnimationProps = {
|
|
114
|
-
/** Initial property values before animation starts, or `false` to skip initial state */
|
|
115
|
-
initial?: AnimatableProperties | false;
|
|
116
|
-
/** Target property values to animate towards */
|
|
117
|
-
animate?: AnimatableProperties;
|
|
118
|
-
/** Property values to animate to when the component unmounts */
|
|
119
|
-
exit?: AnimatableProperties;
|
|
120
|
-
/** Transition configuration including animation mode and parameters */
|
|
121
|
-
transition?: AnimationTransition;
|
|
122
|
-
/** Whether to animate from `initial` to `animate` when first mounted (default: false) */
|
|
123
|
-
animateOnMount?: boolean;
|
|
124
|
-
/** Callback fired when an animation begins */
|
|
125
|
-
onAnimationStart?: () => void;
|
|
126
|
-
/** Callback fired when an animation completes */
|
|
127
|
-
onAnimationComplete?: () => void;
|
|
128
|
-
/** The child widget to animate (must be a single GTK widget) */
|
|
129
|
-
children?: ReactNode;
|
|
130
|
-
};
|
|
120
|
+
export type AnimationProps = AdwTimedAnimationProps | AdwSpringAnimationProps;
|
|
131
121
|
|
|
132
122
|
/**
|
|
133
123
|
* Props for the Shortcut virtual element.
|
|
@@ -334,7 +324,7 @@ export type LevelBarOffset = {
|
|
|
334
324
|
/**
|
|
335
325
|
* Props for slot-based child positioning.
|
|
336
326
|
*
|
|
337
|
-
*
|
|
327
|
+
* Used internally by compound components with slot props (e.g. `titleWidget` on `AdwHeaderBar`).
|
|
338
328
|
*/
|
|
339
329
|
export type SlotProps = {
|
|
340
330
|
/** The slot identifier */
|
|
@@ -343,22 +333,6 @@ export type SlotProps = {
|
|
|
343
333
|
children?: ReactNode;
|
|
344
334
|
};
|
|
345
335
|
|
|
346
|
-
/**
|
|
347
|
-
* Type mapping widgets to their valid container slot method names.
|
|
348
|
-
*
|
|
349
|
-
* Each key is a JSX element name and each value is a union of method names
|
|
350
|
-
* that can be used as the `id` prop on `x.ContainerSlot`.
|
|
351
|
-
*/
|
|
352
|
-
export type ContainerSlotNames = {
|
|
353
|
-
AdwActionRow: "addPrefix" | "addSuffix";
|
|
354
|
-
AdwEntryRow: "addPrefix" | "addSuffix";
|
|
355
|
-
AdwExpanderRow: "addPrefix" | "addSuffix" | "addRow" | "addAction";
|
|
356
|
-
AdwHeaderBar: "packStart" | "packEnd";
|
|
357
|
-
AdwToolbarView: "addTopBar" | "addBottomBar";
|
|
358
|
-
GtkActionBar: "packStart" | "packEnd";
|
|
359
|
-
GtkHeaderBar: "packStart" | "packEnd";
|
|
360
|
-
};
|
|
361
|
-
|
|
362
336
|
/**
|
|
363
337
|
* Props for method-based container slot child positioning.
|
|
364
338
|
*/
|
|
@@ -404,7 +378,7 @@ export type ListItem<T = unknown, S = unknown> =
|
|
|
404
378
|
/**
|
|
405
379
|
* Props for positioning children within a GtkGrid.
|
|
406
380
|
*
|
|
407
|
-
*
|
|
381
|
+
* Used by `GtkGrid.Child` compound component.
|
|
408
382
|
*/
|
|
409
383
|
export type GridChildProps = {
|
|
410
384
|
/** Content to place in the grid cell */
|
|
@@ -422,7 +396,7 @@ export type GridChildProps = {
|
|
|
422
396
|
/**
|
|
423
397
|
* Props for positioning children within a GtkFixed.
|
|
424
398
|
*
|
|
425
|
-
*
|
|
399
|
+
* Used by `GtkFixed.Child` compound component.
|
|
426
400
|
*/
|
|
427
401
|
export type FixedChildProps = {
|
|
428
402
|
/** Content to place in the fixed container */
|
|
@@ -440,7 +414,7 @@ export type FixedChildProps = {
|
|
|
440
414
|
*
|
|
441
415
|
* @typeParam T - The type of data for each row
|
|
442
416
|
*
|
|
443
|
-
*
|
|
417
|
+
* Used by `GtkColumnView.Column` compound component.
|
|
444
418
|
*/
|
|
445
419
|
export type ColumnViewColumnProps<T = unknown> = {
|
|
446
420
|
/** Column header text */
|
|
@@ -488,7 +462,7 @@ export type NotebookPageTabProps = {
|
|
|
488
462
|
/**
|
|
489
463
|
* Props for pages within a Stack or ViewStack.
|
|
490
464
|
*
|
|
491
|
-
*
|
|
465
|
+
* Used by `GtkStack.Page` and `AdwViewStack.Page` compound components.
|
|
492
466
|
*/
|
|
493
467
|
export type StackPageProps = {
|
|
494
468
|
/** Content to place in the stack page */
|
|
@@ -512,7 +486,7 @@ export type StackPageProps = {
|
|
|
512
486
|
/**
|
|
513
487
|
* Props for menu items.
|
|
514
488
|
*
|
|
515
|
-
*
|
|
489
|
+
* Used by menu compound components like `GtkMenuButton.MenuItem`.
|
|
516
490
|
*/
|
|
517
491
|
export type MenuItemProps = {
|
|
518
492
|
/** Unique identifier for this menu item */
|
|
@@ -593,7 +567,7 @@ export type ToggleProps = {
|
|
|
593
567
|
*
|
|
594
568
|
* Each response represents a button the user can click to dismiss the dialog.
|
|
595
569
|
*
|
|
596
|
-
*
|
|
570
|
+
* Used by `AdwAlertDialog.Response` compound component.
|
|
597
571
|
*/
|
|
598
572
|
export type AlertDialogResponseProps = {
|
|
599
573
|
/** Unique response ID (used in response signal and for default/close response) */
|
|
@@ -606,7 +580,11 @@ export type AlertDialogResponseProps = {
|
|
|
606
580
|
enabled?: boolean;
|
|
607
581
|
};
|
|
608
582
|
|
|
609
|
-
|
|
583
|
+
/**
|
|
584
|
+
* Base props shared by all navigation page declarations, regardless
|
|
585
|
+
* of the parent container (NavigationView or NavigationSplitView).
|
|
586
|
+
*/
|
|
587
|
+
export type NavigationPageBaseProps = {
|
|
610
588
|
/** Display title for the navigation page */
|
|
611
589
|
title?: string;
|
|
612
590
|
/** Whether the page can be popped from the navigation stack */
|
|
@@ -615,6 +593,22 @@ type NavigationPageBaseProps = {
|
|
|
615
593
|
children?: ReactNode;
|
|
616
594
|
};
|
|
617
595
|
|
|
596
|
+
/**
|
|
597
|
+
* Props for a navigation page inside an `AdwNavigationView`.
|
|
598
|
+
*
|
|
599
|
+
* The `id` serves as the page tag for navigation history.
|
|
600
|
+
*/
|
|
601
|
+
export type NavigationViewPageProps = NavigationPageBaseProps & { id: string };
|
|
602
|
+
|
|
603
|
+
/**
|
|
604
|
+
* Props for a navigation page inside an `AdwNavigationSplitView`.
|
|
605
|
+
*
|
|
606
|
+
* The `id` is narrowed to the valid slot positions of the split view.
|
|
607
|
+
*/
|
|
608
|
+
export type NavigationSplitViewPageProps = NavigationPageBaseProps & {
|
|
609
|
+
id: WidgetSlotNames["AdwNavigationSplitView"];
|
|
610
|
+
};
|
|
611
|
+
|
|
618
612
|
/**
|
|
619
613
|
* Props for the NavigationPage virtual element with type-safe targeting.
|
|
620
614
|
*
|
|
@@ -669,6 +663,7 @@ export type TextBufferProps = {
|
|
|
669
663
|
onCanRedoChanged?: ((canRedo: boolean) => void) | null;
|
|
670
664
|
};
|
|
671
665
|
|
|
666
|
+
/** @internal */
|
|
672
667
|
type BaseListViewProps = {
|
|
673
668
|
/** Estimated item height in pixels for virtualization */
|
|
674
669
|
estimatedItemHeight?: number;
|
|
@@ -682,6 +677,12 @@ type BaseListViewProps = {
|
|
|
682
677
|
selectionMode?: Gtk.SelectionMode | null;
|
|
683
678
|
};
|
|
684
679
|
|
|
680
|
+
/**
|
|
681
|
+
* Props for the {@link GtkListView} compound component.
|
|
682
|
+
*
|
|
683
|
+
* Extends the shared list-view base props with item data, a render
|
|
684
|
+
* callback, optional tree expansion, and section header rendering.
|
|
685
|
+
*/
|
|
685
686
|
export type ListViewProps<T = unknown, S = unknown> = BaseListViewProps & {
|
|
686
687
|
/** Data items to display in the list */
|
|
687
688
|
items?: ListItem<T, S>[];
|
|
@@ -693,6 +694,12 @@ export type ListViewProps<T = unknown, S = unknown> = BaseListViewProps & {
|
|
|
693
694
|
renderHeader?: ((item: S) => ReactNode) | null;
|
|
694
695
|
};
|
|
695
696
|
|
|
697
|
+
/**
|
|
698
|
+
* Props for the {@link GtkGridView} compound component.
|
|
699
|
+
*
|
|
700
|
+
* Extends the shared list-view base props with item data and a
|
|
701
|
+
* render callback for each grid cell.
|
|
702
|
+
*/
|
|
696
703
|
export type GridViewProps<T = unknown> = BaseListViewProps & {
|
|
697
704
|
/** Data items to display in the grid */
|
|
698
705
|
items?: ListItem<T>[];
|
|
@@ -751,361 +758,6 @@ export type AdjustableProps = {
|
|
|
751
758
|
onValueChanged?: ((value: number, self: Gtk.Range | Gtk.ScaleButton | Gtk.SpinButton | Adw.SpinRow) => void) | null;
|
|
752
759
|
};
|
|
753
760
|
|
|
754
|
-
/**
|
|
755
|
-
* GTKX-specific intrinsic elements and components.
|
|
756
|
-
*
|
|
757
|
-
* This namespace provides React components for GTK layout, lists, menus, and slots
|
|
758
|
-
* that are specific to GTKX (not direct GTK widget bindings).
|
|
759
|
-
*
|
|
760
|
-
* @example
|
|
761
|
-
* ```tsx
|
|
762
|
-
* import { x, GtkHeaderBar } from "@gtkx/react";
|
|
763
|
-
*
|
|
764
|
-
* <GtkHeaderBar>
|
|
765
|
-
* <x.Slot for={GtkHeaderBar} id="titleWidget">
|
|
766
|
-
* <GtkLabel label="App Title" />
|
|
767
|
-
* </x.Slot>
|
|
768
|
-
* </GtkHeaderBar>
|
|
769
|
-
* ```
|
|
770
|
-
*/
|
|
771
|
-
export const x = {
|
|
772
|
-
/**
|
|
773
|
-
* Type-safe slot component for placing children in named widget slots.
|
|
774
|
-
*
|
|
775
|
-
* GTK widgets often have named slots for specific child positions (e.g., titleWidget,
|
|
776
|
-
* startWidget). This component provides type-safe access to those slots.
|
|
777
|
-
*
|
|
778
|
-
* @example
|
|
779
|
-
* ```tsx
|
|
780
|
-
* <GtkHeaderBar>
|
|
781
|
-
* <x.Slot for={GtkHeaderBar} id="titleWidget">
|
|
782
|
-
* <GtkLabel label="App Title" />
|
|
783
|
-
* </x.Slot>
|
|
784
|
-
* </GtkHeaderBar>
|
|
785
|
-
* ```
|
|
786
|
-
*/
|
|
787
|
-
Slot<W extends keyof WidgetSlotNames>(props: {
|
|
788
|
-
for: W;
|
|
789
|
-
id: WidgetSlotNames[W];
|
|
790
|
-
children?: ReactNode;
|
|
791
|
-
}): ReactElement {
|
|
792
|
-
return createElement("Slot", { id: props.id }, props.children);
|
|
793
|
-
},
|
|
794
|
-
|
|
795
|
-
/**
|
|
796
|
-
* Element type for pages within a GtkStack or AdwViewStack.
|
|
797
|
-
*
|
|
798
|
-
* @example
|
|
799
|
-
* ```tsx
|
|
800
|
-
* <GtkStack page="page1">
|
|
801
|
-
* <x.StackPage id="page1" title="First Page">
|
|
802
|
-
* <GtkLabel label="Content 1" />
|
|
803
|
-
* </x.StackPage>
|
|
804
|
-
* </GtkStack>
|
|
805
|
-
* ```
|
|
806
|
-
*/
|
|
807
|
-
StackPage: "StackPage" as const,
|
|
808
|
-
|
|
809
|
-
/**
|
|
810
|
-
* Element type for positioning children within a GtkGrid.
|
|
811
|
-
*
|
|
812
|
-
* @example
|
|
813
|
-
* ```tsx
|
|
814
|
-
* <GtkGrid>
|
|
815
|
-
* <x.GridChild column={0} row={0}>
|
|
816
|
-
* <GtkLabel label="Top Left" />
|
|
817
|
-
* </x.GridChild>
|
|
818
|
-
* </GtkGrid>
|
|
819
|
-
* ```
|
|
820
|
-
*/
|
|
821
|
-
GridChild: "GridChild" as const,
|
|
822
|
-
|
|
823
|
-
/**
|
|
824
|
-
* Element type for positioning children within a GtkFixed.
|
|
825
|
-
*
|
|
826
|
-
* @example
|
|
827
|
-
* ```tsx
|
|
828
|
-
* <GtkFixed>
|
|
829
|
-
* <x.FixedChild x={20} y={30}>
|
|
830
|
-
* <GtkLabel label="Positioned at (20, 30)" />
|
|
831
|
-
* </x.FixedChild>
|
|
832
|
-
* </GtkFixed>
|
|
833
|
-
* ```
|
|
834
|
-
*/
|
|
835
|
-
FixedChild: "FixedChild" as const,
|
|
836
|
-
|
|
837
|
-
/**
|
|
838
|
-
* Element type for a page within a GtkNotebook (tabbed interface).
|
|
839
|
-
*
|
|
840
|
-
* @example
|
|
841
|
-
* ```tsx
|
|
842
|
-
* <GtkNotebook>
|
|
843
|
-
* <x.NotebookPage label="Tab 1">
|
|
844
|
-
* <GtkLabel label="Content 1" />
|
|
845
|
-
* </x.NotebookPage>
|
|
846
|
-
* </GtkNotebook>
|
|
847
|
-
* ```
|
|
848
|
-
*/
|
|
849
|
-
NotebookPage: "NotebookPage" as const,
|
|
850
|
-
|
|
851
|
-
/**
|
|
852
|
-
* Element type for a custom widget as the page tab label.
|
|
853
|
-
*/
|
|
854
|
-
NotebookPageTab: "NotebookPageTab" as const,
|
|
855
|
-
|
|
856
|
-
/**
|
|
857
|
-
* Component for defining columns in a ColumnView (table widget).
|
|
858
|
-
*
|
|
859
|
-
* @example
|
|
860
|
-
* ```tsx
|
|
861
|
-
* <GtkColumnView>
|
|
862
|
-
* <x.ColumnViewColumn
|
|
863
|
-
* id="name"
|
|
864
|
-
* title="Name"
|
|
865
|
-
* expand
|
|
866
|
-
* renderCell={(item) => <GtkLabel label={item?.name ?? ""} />}
|
|
867
|
-
* />
|
|
868
|
-
* </GtkColumnView>
|
|
869
|
-
* ```
|
|
870
|
-
*/
|
|
871
|
-
ColumnViewColumn<T = unknown>(props: ColumnViewColumnProps<T>): ReactElement {
|
|
872
|
-
return createElement("ColumnViewColumn", props, props.children);
|
|
873
|
-
},
|
|
874
|
-
|
|
875
|
-
/**
|
|
876
|
-
* Type-safe container slot for placing children via parent widget methods.
|
|
877
|
-
*
|
|
878
|
-
* Unlike `x.Slot` (which uses property setters for single-child slots),
|
|
879
|
-
* `x.ContainerSlot` calls attachment methods that support multiple children
|
|
880
|
-
* (e.g., `addPrefix()`, `packStart()`, `addTopBar()`).
|
|
881
|
-
*
|
|
882
|
-
* The `for` prop provides TypeScript type narrowing for the `id` prop
|
|
883
|
-
* and is not used at runtime.
|
|
884
|
-
*
|
|
885
|
-
* @example
|
|
886
|
-
* ```tsx
|
|
887
|
-
* <AdwToolbarView>
|
|
888
|
-
* <x.ContainerSlot for={AdwToolbarView} id="addTopBar">
|
|
889
|
-
* <AdwHeaderBar />
|
|
890
|
-
* </x.ContainerSlot>
|
|
891
|
-
* </AdwToolbarView>
|
|
892
|
-
*
|
|
893
|
-
* <GtkHeaderBar>
|
|
894
|
-
* <x.ContainerSlot for={GtkHeaderBar} id="packStart">
|
|
895
|
-
* <GtkButton label="Back" />
|
|
896
|
-
* </x.ContainerSlot>
|
|
897
|
-
* </GtkHeaderBar>
|
|
898
|
-
*
|
|
899
|
-
* <AdwActionRow title="Setting">
|
|
900
|
-
* <x.ContainerSlot for={AdwActionRow} id="addPrefix">
|
|
901
|
-
* <GtkCheckButton />
|
|
902
|
-
* </x.ContainerSlot>
|
|
903
|
-
* </AdwActionRow>
|
|
904
|
-
* ```
|
|
905
|
-
*/
|
|
906
|
-
ContainerSlot<W extends keyof ContainerSlotNames>(props: {
|
|
907
|
-
for: W;
|
|
908
|
-
id: ContainerSlotNames[W];
|
|
909
|
-
children?: ReactNode;
|
|
910
|
-
}): ReactElement {
|
|
911
|
-
return createElement("ContainerSlot", { id: props.id }, props.children);
|
|
912
|
-
},
|
|
913
|
-
|
|
914
|
-
/**
|
|
915
|
-
* Element type for overlay children positioned above the main content.
|
|
916
|
-
*
|
|
917
|
-
* @example
|
|
918
|
-
* ```tsx
|
|
919
|
-
* <GtkOverlay>
|
|
920
|
-
* <GtkImage file="background.png" />
|
|
921
|
-
* <x.OverlayChild>
|
|
922
|
-
* <GtkLabel label="Overlaid text" />
|
|
923
|
-
* </x.OverlayChild>
|
|
924
|
-
* </GtkOverlay>
|
|
925
|
-
* ```
|
|
926
|
-
*/
|
|
927
|
-
OverlayChild: "OverlayChild" as const,
|
|
928
|
-
|
|
929
|
-
/**
|
|
930
|
-
* A clickable menu item with action.
|
|
931
|
-
*
|
|
932
|
-
* @example
|
|
933
|
-
* ```tsx
|
|
934
|
-
* <GtkMenuButton>
|
|
935
|
-
* <x.MenuItem id="open" label="Open" onActivate={handleOpen} />
|
|
936
|
-
* </GtkMenuButton>
|
|
937
|
-
* ```
|
|
938
|
-
*/
|
|
939
|
-
MenuItem: "MenuItem" as const,
|
|
940
|
-
|
|
941
|
-
/**
|
|
942
|
-
* A section grouping related menu items.
|
|
943
|
-
*
|
|
944
|
-
* @example
|
|
945
|
-
* ```tsx
|
|
946
|
-
* <GtkMenuButton>
|
|
947
|
-
* <x.MenuSection label="File">
|
|
948
|
-
* <x.MenuItem id="open" label="Open" onActivate={handleOpen} />
|
|
949
|
-
* </x.MenuSection>
|
|
950
|
-
* </GtkMenuButton>
|
|
951
|
-
* ```
|
|
952
|
-
*/
|
|
953
|
-
MenuSection: "MenuSection" as const,
|
|
954
|
-
|
|
955
|
-
/**
|
|
956
|
-
* A submenu containing nested items.
|
|
957
|
-
*
|
|
958
|
-
* @example
|
|
959
|
-
* ```tsx
|
|
960
|
-
* <GtkMenuButton>
|
|
961
|
-
* <x.MenuSubmenu label="Export">
|
|
962
|
-
* <x.MenuItem id="pdf" label="As PDF" onActivate={exportPdf} />
|
|
963
|
-
* </x.MenuSubmenu>
|
|
964
|
-
* </GtkMenuButton>
|
|
965
|
-
* ```
|
|
966
|
-
*/
|
|
967
|
-
MenuSubmenu: "MenuSubmenu" as const,
|
|
968
|
-
|
|
969
|
-
/**
|
|
970
|
-
* Declarative text tag for styling text content.
|
|
971
|
-
*
|
|
972
|
-
* Wrap text content with a TextTag to apply styling. Tags can be nested.
|
|
973
|
-
*
|
|
974
|
-
* @example
|
|
975
|
-
* ```tsx
|
|
976
|
-
* <GtkTextView>
|
|
977
|
-
* Normal <x.TextTag id="bold" weight={Pango.Weight.BOLD}>
|
|
978
|
-
* bold <x.TextTag id="red" foreground="red">and red</x.TextTag>
|
|
979
|
-
* </x.TextTag> text.
|
|
980
|
-
* </GtkTextView>
|
|
981
|
-
* ```
|
|
982
|
-
*/
|
|
983
|
-
TextTag: "TextTag" as const,
|
|
984
|
-
|
|
985
|
-
/**
|
|
986
|
-
* Declarative anchor for embedding widgets in text flow.
|
|
987
|
-
*
|
|
988
|
-
* The anchor is placed at the current position in the text.
|
|
989
|
-
*
|
|
990
|
-
* @example
|
|
991
|
-
* ```tsx
|
|
992
|
-
* <GtkTextView>
|
|
993
|
-
* Click here: <x.TextAnchor>
|
|
994
|
-
* <GtkButton label="Click me" />
|
|
995
|
-
* </x.TextAnchor> to continue.
|
|
996
|
-
* </GtkTextView>
|
|
997
|
-
* ```
|
|
998
|
-
*/
|
|
999
|
-
TextAnchor: "TextAnchor" as const,
|
|
1000
|
-
|
|
1001
|
-
/**
|
|
1002
|
-
* Declarative inline paintable for embedding images/icons in text flow.
|
|
1003
|
-
*
|
|
1004
|
-
* The paintable is placed at the current position in the text.
|
|
1005
|
-
*
|
|
1006
|
-
* @example
|
|
1007
|
-
* ```tsx
|
|
1008
|
-
* <GtkTextView>
|
|
1009
|
-
* Click the icon <x.TextPaintable paintable={iconPaintable} /> to continue.
|
|
1010
|
-
* </GtkTextView>
|
|
1011
|
-
* ```
|
|
1012
|
-
*/
|
|
1013
|
-
TextPaintable: "TextPaintable" as const,
|
|
1014
|
-
|
|
1015
|
-
/**
|
|
1016
|
-
* A toggle button for an AdwToggleGroup.
|
|
1017
|
-
*
|
|
1018
|
-
* @example
|
|
1019
|
-
* ```tsx
|
|
1020
|
-
* <AdwToggleGroup>
|
|
1021
|
-
* <x.Toggle id="list" iconName="view-list-symbolic" />
|
|
1022
|
-
* <x.Toggle id="grid" iconName="view-grid-symbolic" />
|
|
1023
|
-
* </AdwToggleGroup>
|
|
1024
|
-
* ```
|
|
1025
|
-
*/
|
|
1026
|
-
Toggle: "Toggle" as const,
|
|
1027
|
-
|
|
1028
|
-
/**
|
|
1029
|
-
* A response button for an AdwAlertDialog.
|
|
1030
|
-
*
|
|
1031
|
-
* @example
|
|
1032
|
-
* ```tsx
|
|
1033
|
-
* <AdwAlertDialog
|
|
1034
|
-
* heading="Delete File?"
|
|
1035
|
-
* body="This cannot be undone."
|
|
1036
|
-
* defaultResponse="cancel"
|
|
1037
|
-
* closeResponse="cancel"
|
|
1038
|
-
* >
|
|
1039
|
-
* <x.AlertDialogResponse id="cancel" label="Cancel" />
|
|
1040
|
-
* <x.AlertDialogResponse id="delete" label="Delete" appearance={Adw.ResponseAppearance.DESTRUCTIVE} />
|
|
1041
|
-
* </AdwAlertDialog>
|
|
1042
|
-
* ```
|
|
1043
|
-
*/
|
|
1044
|
-
AlertDialogResponse: "AlertDialogResponse" as const,
|
|
1045
|
-
|
|
1046
|
-
/**
|
|
1047
|
-
* Type-safe page component for AdwNavigationView or AdwNavigationSplitView.
|
|
1048
|
-
*
|
|
1049
|
-
* The `for` prop is required and determines valid `id` values:
|
|
1050
|
-
* - `AdwNavigationView`: any string (page tags for navigation history)
|
|
1051
|
-
* - `AdwNavigationSplitView`: `"content"` or `"sidebar"` (slot positions)
|
|
1052
|
-
*
|
|
1053
|
-
* @example
|
|
1054
|
-
* ```tsx
|
|
1055
|
-
* // In NavigationView - id can be any string
|
|
1056
|
-
* <AdwNavigationView history={["home"]}>
|
|
1057
|
-
* <x.NavigationPage for={AdwNavigationView} id="home" title="Home">
|
|
1058
|
-
* <GtkLabel label="Welcome!" />
|
|
1059
|
-
* </x.NavigationPage>
|
|
1060
|
-
* </AdwNavigationView>
|
|
1061
|
-
*
|
|
1062
|
-
* // In NavigationSplitView - id is narrowed to "content" | "sidebar"
|
|
1063
|
-
* <AdwNavigationSplitView>
|
|
1064
|
-
* <x.NavigationPage for={AdwNavigationSplitView} id="sidebar" title="Sidebar">
|
|
1065
|
-
* <GtkLabel label="Sidebar" />
|
|
1066
|
-
* </x.NavigationPage>
|
|
1067
|
-
* <x.NavigationPage for={AdwNavigationSplitView} id="content" title="Content">
|
|
1068
|
-
* <GtkLabel label="Content" />
|
|
1069
|
-
* </x.NavigationPage>
|
|
1070
|
-
* </AdwNavigationSplitView>
|
|
1071
|
-
* ```
|
|
1072
|
-
*/
|
|
1073
|
-
NavigationPage: "NavigationPage" as const,
|
|
1074
|
-
|
|
1075
|
-
/**
|
|
1076
|
-
* A keyboard shortcut definition.
|
|
1077
|
-
*
|
|
1078
|
-
* Must be a child of `<GtkShortcutController>`.
|
|
1079
|
-
*
|
|
1080
|
-
* @example
|
|
1081
|
-
* ```tsx
|
|
1082
|
-
* <x.Shortcut trigger="<Control>s" onActivate={save} />
|
|
1083
|
-
* <x.Shortcut trigger={["F5", "<Control>r"]} onActivate={refresh} />
|
|
1084
|
-
* <x.Shortcut trigger="Escape" onActivate={cancel} disabled={!canCancel} />
|
|
1085
|
-
* ```
|
|
1086
|
-
*/
|
|
1087
|
-
Shortcut: "Shortcut" as const,
|
|
1088
|
-
|
|
1089
|
-
/**
|
|
1090
|
-
* Declarative animation wrapper using Adw.TimedAnimation or Adw.SpringAnimation.
|
|
1091
|
-
*
|
|
1092
|
-
* Provides framer-motion-inspired API for animating child widgets.
|
|
1093
|
-
*
|
|
1094
|
-
* @example
|
|
1095
|
-
* ```tsx
|
|
1096
|
-
* <x.Animation
|
|
1097
|
-
* initial={{ opacity: 0, scale: 0.9 }}
|
|
1098
|
-
* animate={{ opacity: 1, scale: 1 }}
|
|
1099
|
-
* transition={{ mode: "spring", damping: 0.8, stiffness: 200 }}
|
|
1100
|
-
* animateOnMount
|
|
1101
|
-
* >
|
|
1102
|
-
* <GtkButton label="Animated Button" />
|
|
1103
|
-
* </x.Animation>
|
|
1104
|
-
* ```
|
|
1105
|
-
*/
|
|
1106
|
-
Animation: "Animation" as const,
|
|
1107
|
-
};
|
|
1108
|
-
|
|
1109
761
|
interface StackProps {
|
|
1110
762
|
/** ID of the currently visible page */
|
|
1111
763
|
page?: string | null;
|
|
@@ -1115,8 +767,9 @@ declare global {
|
|
|
1115
767
|
namespace React {
|
|
1116
768
|
namespace JSX {
|
|
1117
769
|
interface IntrinsicElements {
|
|
1118
|
-
|
|
1119
|
-
|
|
770
|
+
Slot: SlotProps;
|
|
771
|
+
AdwTimedAnimation: AdwTimedAnimationProps;
|
|
772
|
+
AdwSpringAnimation: AdwSpringAnimationProps;
|
|
1120
773
|
ContainerSlot: ContainerSlotProps;
|
|
1121
774
|
ColumnViewColumn: ColumnViewColumnProps;
|
|
1122
775
|
FixedChild: FixedChildProps;
|
|
@@ -1132,7 +785,6 @@ declare global {
|
|
|
1132
785
|
TextTag: TextTagProps;
|
|
1133
786
|
|
|
1134
787
|
StackPage: StackPageProps;
|
|
1135
|
-
Toggle: ToggleProps;
|
|
1136
788
|
NavigationPage: NavigationPageProps;
|
|
1137
789
|
Shortcut: ShortcutProps;
|
|
1138
790
|
}
|
|
@@ -1140,6 +792,13 @@ declare global {
|
|
|
1140
792
|
}
|
|
1141
793
|
}
|
|
1142
794
|
|
|
795
|
+
/**
|
|
796
|
+
* Accessibility attribute props mixed into every widget.
|
|
797
|
+
*
|
|
798
|
+
* Maps to the GTK `GtkAccessible` interface properties, states,
|
|
799
|
+
* and relations, allowing assistive technologies to query widget
|
|
800
|
+
* semantics.
|
|
801
|
+
*/
|
|
1143
802
|
export type AccessibleProps = {
|
|
1144
803
|
accessibleAutocomplete?: Gtk.AccessibleAutocomplete;
|
|
1145
804
|
accessibleDescription?: string;
|
|
@@ -1220,6 +879,11 @@ declare module "./generated/jsx.js" {
|
|
|
1220
879
|
onValueChanged?: ((value: number, self: Adw.SpinRow) => void) | null;
|
|
1221
880
|
}
|
|
1222
881
|
|
|
882
|
+
interface AdwSwitchRowProps {
|
|
883
|
+
/** Callback fired when the switch row active state changes */
|
|
884
|
+
onActiveChanged?: ((active: boolean, self: Adw.SwitchRow) => void) | null;
|
|
885
|
+
}
|
|
886
|
+
|
|
1223
887
|
interface GtkCalendarProps {
|
|
1224
888
|
/** Array of day numbers (1-31) to display as marked */
|
|
1225
889
|
markedDays?: number[] | null;
|
|
@@ -1301,8 +965,8 @@ declare module "./generated/jsx.js" {
|
|
|
1301
965
|
}
|
|
1302
966
|
|
|
1303
967
|
interface GtkDrawingAreaProps {
|
|
1304
|
-
/**
|
|
1305
|
-
|
|
968
|
+
/** Render function called when the drawing area needs to be redrawn. Changing this reference automatically queues a redraw. */
|
|
969
|
+
render?: ((cr: cairo.Context, width: number, height: number, self: Gtk.DrawingArea) => void) | null;
|
|
1306
970
|
}
|
|
1307
971
|
|
|
1308
972
|
interface GtkColorDialogButtonProps extends DialogButtonProps {
|
|
@@ -1334,6 +998,13 @@ declare module "./generated/jsx.js" {
|
|
|
1334
998
|
interface AdwToggleGroupProps {
|
|
1335
999
|
/** Callback fired when the active toggle changes */
|
|
1336
1000
|
onActiveChanged?: ((active: number, activeName: string | null) => void) | null;
|
|
1001
|
+
/** Declarative toggle definitions for the group */
|
|
1002
|
+
toggles?: ToggleProps[];
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
interface AdwAlertDialogProps {
|
|
1006
|
+
/** Declarative response button definitions for the dialog */
|
|
1007
|
+
responses?: AlertDialogResponseProps[];
|
|
1337
1008
|
}
|
|
1338
1009
|
|
|
1339
1010
|
interface GtkDragSourceProps {
|
|
@@ -1352,4 +1023,11 @@ declare module "./generated/jsx.js" {
|
|
|
1352
1023
|
}
|
|
1353
1024
|
|
|
1354
1025
|
export { AdwComboRow, GtkColumnView, GtkDropDown, GtkGridView, GtkListView } from "./components/list.js";
|
|
1026
|
+
export * from "./generated/compounds.js";
|
|
1027
|
+
|
|
1028
|
+
/** JSX intrinsic element name for timed (duration-based) Adwaita animations. */
|
|
1029
|
+
export const AdwTimedAnimation = "AdwTimedAnimation" as const;
|
|
1030
|
+
/** JSX intrinsic element name for spring-physics-based Adwaita animations. */
|
|
1031
|
+
export const AdwSpringAnimation = "AdwSpringAnimation" as const;
|
|
1032
|
+
|
|
1355
1033
|
export * from "./generated/jsx.js";
|