@gtkx/react 0.19.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 +75 -0
- package/dist/components/list.d.ts.map +1 -0
- package/dist/components/list.js +81 -0
- package/dist/components/list.js.map +1 -0
- 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 +6 -7
- package/dist/generated/internal.d.ts.map +1 -1
- package/dist/generated/internal.js +3054 -1838
- package/dist/generated/internal.js.map +1 -1
- package/dist/generated/jsx.d.ts +2096 -4970
- package/dist/generated/jsx.d.ts.map +1 -1
- package/dist/generated/jsx.js +979 -3862
- 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/host-config.d.ts.map +1 -1
- package/dist/host-config.js +2 -0
- package/dist/host-config.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 +157 -518
- package/dist/jsx.d.ts.map +1 -1
- package/dist/jsx.js +6 -393
- 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 +7 -3
- package/dist/metadata.js.map +1 -1
- package/dist/node.d.ts +0 -4
- package/dist/node.d.ts.map +1 -1
- package/dist/node.js +19 -41
- package/dist/node.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/application.d.ts.map +1 -1
- package/dist/nodes/application.js +4 -0
- package/dist/nodes/application.js.map +1 -1
- package/dist/nodes/column-view-column.d.ts +19 -19
- package/dist/nodes/column-view-column.d.ts.map +1 -1
- package/dist/nodes/column-view-column.js +130 -119
- 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 +6 -16
- 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/accessible.d.ts.map +1 -1
- package/dist/nodes/internal/accessible.js.map +1 -1
- package/dist/nodes/internal/bound-item.d.ts +4 -0
- package/dist/nodes/internal/bound-item.d.ts.map +1 -0
- package/dist/nodes/internal/bound-item.js +2 -0
- package/dist/nodes/internal/bound-item.js.map +1 -0
- package/dist/nodes/internal/construct.d.ts +1 -8
- package/dist/nodes/internal/construct.d.ts.map +1 -1
- package/dist/nodes/internal/construct.js +30 -54
- 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 +9 -10
- package/dist/nodes/internal/widget.js.map +1 -1
- package/dist/nodes/list-item-node.d.ts +12 -0
- package/dist/nodes/list-item-node.d.ts.map +1 -0
- package/dist/nodes/list-item-node.js +45 -0
- package/dist/nodes/list-item-node.js.map +1 -0
- package/dist/nodes/list.d.ts +100 -0
- package/dist/nodes/list.d.ts.map +1 -0
- package/dist/nodes/list.js +950 -0
- package/dist/nodes/list.js.map +1 -0
- package/dist/nodes/notebook-page.d.ts.map +1 -1
- package/dist/nodes/notebook-page.js +6 -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 +16 -22
- package/dist/nodes/widget.js.map +1 -1
- package/dist/nodes/window.d.ts.map +1 -1
- package/dist/nodes/window.js +2 -2
- package/dist/nodes/window.js.map +1 -1
- package/dist/registry.d.ts +0 -2
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +11 -18
- package/dist/registry.js.map +1 -1
- package/dist/types.d.ts +3 -2
- 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 +5 -4
- package/src/components/compound.tsx +57 -0
- package/src/components/list.tsx +140 -0
- 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 +3059 -1840
- package/src/generated/jsx.ts +2509 -5350
- package/src/generated/registry.ts +2 -1
- package/src/host-config.ts +2 -0
- package/src/index.ts +2 -0
- package/src/jsx.ts +167 -581
- package/src/metadata.ts +7 -4
- package/src/node.ts +23 -39
- package/src/nodes/alert-dialog.ts +55 -0
- package/src/nodes/animation.ts +67 -60
- package/src/nodes/application.ts +5 -0
- package/src/nodes/column-view-column.ts +125 -128
- package/src/nodes/container-slot.ts +30 -17
- package/src/nodes/drawing-area.ts +23 -32
- package/src/nodes/event-controller.ts +6 -18
- package/src/nodes/fixed-child.ts +13 -0
- package/src/nodes/grid-child.ts +13 -0
- package/src/nodes/internal/accessible.ts +0 -1
- package/src/nodes/internal/bound-item.ts +4 -0
- package/src/nodes/internal/construct.ts +38 -68
- package/src/nodes/internal/widget.ts +9 -13
- package/src/nodes/list-item-node.ts +53 -0
- package/src/nodes/list.ts +1082 -0
- package/src/nodes/notebook-page.ts +6 -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 +14 -26
- package/src/nodes/window.ts +2 -2
- package/src/registry.ts +18 -24
- package/src/types.ts +8 -2
- package/src/use-property.ts +58 -0
- package/src/use-setting.ts +96 -0
- package/dist/fiber-root.d.ts +0 -4
- package/dist/fiber-root.d.ts.map +0 -1
- package/dist/fiber-root.js +0 -6
- package/dist/fiber-root.js.map +0 -1
- package/dist/nodes/column-view.d.ts +0 -37
- package/dist/nodes/column-view.d.ts.map +0 -1
- package/dist/nodes/column-view.js +0 -205
- package/dist/nodes/column-view.js.map +0 -1
- package/dist/nodes/drop-down.d.ts +0 -37
- package/dist/nodes/drop-down.d.ts.map +0 -1
- package/dist/nodes/drop-down.js +0 -231
- package/dist/nodes/drop-down.js.map +0 -1
- package/dist/nodes/grid-view.d.ts +0 -30
- package/dist/nodes/grid-view.d.ts.map +0 -1
- package/dist/nodes/grid-view.js +0 -90
- package/dist/nodes/grid-view.js.map +0 -1
- package/dist/nodes/internal/base-item-renderer.d.ts +0 -28
- package/dist/nodes/internal/base-item-renderer.d.ts.map +0 -1
- package/dist/nodes/internal/base-item-renderer.js +0 -85
- package/dist/nodes/internal/base-item-renderer.js.map +0 -1
- package/dist/nodes/internal/grid-item-renderer.d.ts +0 -20
- package/dist/nodes/internal/grid-item-renderer.d.ts.map +0 -1
- package/dist/nodes/internal/grid-item-renderer.js +0 -66
- package/dist/nodes/internal/grid-item-renderer.js.map +0 -1
- package/dist/nodes/internal/header-item-renderer.d.ts +0 -23
- package/dist/nodes/internal/header-item-renderer.d.ts.map +0 -1
- package/dist/nodes/internal/header-item-renderer.js +0 -87
- package/dist/nodes/internal/header-item-renderer.js.map +0 -1
- package/dist/nodes/internal/header-renderer-manager.d.ts +0 -13
- package/dist/nodes/internal/header-renderer-manager.d.ts.map +0 -1
- package/dist/nodes/internal/header-renderer-manager.js +0 -20
- package/dist/nodes/internal/header-renderer-manager.js.map +0 -1
- package/dist/nodes/internal/list-item-renderer.d.ts +0 -27
- package/dist/nodes/internal/list-item-renderer.d.ts.map +0 -1
- package/dist/nodes/internal/list-item-renderer.js +0 -131
- package/dist/nodes/internal/list-item-renderer.js.map +0 -1
- package/dist/nodes/internal/list-store.d.ts +0 -21
- package/dist/nodes/internal/list-store.d.ts.map +0 -1
- package/dist/nodes/internal/list-store.js +0 -90
- package/dist/nodes/internal/list-store.js.map +0 -1
- package/dist/nodes/internal/sectioned-list-store.d.ts +0 -50
- package/dist/nodes/internal/sectioned-list-store.d.ts.map +0 -1
- package/dist/nodes/internal/sectioned-list-store.js +0 -250
- package/dist/nodes/internal/sectioned-list-store.js.map +0 -1
- package/dist/nodes/internal/selection-helpers.d.ts +0 -12
- package/dist/nodes/internal/selection-helpers.d.ts.map +0 -1
- package/dist/nodes/internal/selection-helpers.js +0 -25
- package/dist/nodes/internal/selection-helpers.js.map +0 -1
- package/dist/nodes/internal/selection-model-controller.d.ts +0 -26
- package/dist/nodes/internal/selection-model-controller.d.ts.map +0 -1
- package/dist/nodes/internal/selection-model-controller.js +0 -82
- package/dist/nodes/internal/selection-model-controller.js.map +0 -1
- package/dist/nodes/internal/simple-list-store.d.ts +0 -15
- package/dist/nodes/internal/simple-list-store.d.ts.map +0 -1
- package/dist/nodes/internal/simple-list-store.js +0 -110
- package/dist/nodes/internal/simple-list-store.js.map +0 -1
- package/dist/nodes/internal/tree-store.d.ts +0 -37
- package/dist/nodes/internal/tree-store.d.ts.map +0 -1
- package/dist/nodes/internal/tree-store.js +0 -253
- package/dist/nodes/internal/tree-store.js.map +0 -1
- package/dist/nodes/list-item.d.ts +0 -24
- package/dist/nodes/list-item.d.ts.map +0 -1
- package/dist/nodes/list-item.js +0 -83
- package/dist/nodes/list-item.js.map +0 -1
- package/dist/nodes/list-section.d.ts +0 -27
- package/dist/nodes/list-section.d.ts.map +0 -1
- package/dist/nodes/list-section.js +0 -43
- package/dist/nodes/list-section.js.map +0 -1
- package/dist/nodes/list-view.d.ts +0 -32
- package/dist/nodes/list-view.d.ts.map +0 -1
- package/dist/nodes/list-view.js +0 -123
- package/dist/nodes/list-view.js.map +0 -1
- package/dist/nodes/models/list.d.ts +0 -39
- package/dist/nodes/models/list.d.ts.map +0 -1
- package/dist/nodes/models/list.js +0 -207
- package/dist/nodes/models/list.js.map +0 -1
- package/src/fiber-root.ts +0 -20
- package/src/nodes/column-view.ts +0 -262
- package/src/nodes/drop-down.ts +0 -284
- package/src/nodes/grid-view.ts +0 -119
- package/src/nodes/internal/base-item-renderer.ts +0 -107
- package/src/nodes/internal/grid-item-renderer.ts +0 -78
- package/src/nodes/internal/header-item-renderer.ts +0 -105
- package/src/nodes/internal/header-renderer-manager.ts +0 -33
- package/src/nodes/internal/list-item-renderer.ts +0 -162
- package/src/nodes/internal/list-store.ts +0 -107
- package/src/nodes/internal/sectioned-list-store.ts +0 -287
- package/src/nodes/internal/selection-helpers.ts +0 -35
- package/src/nodes/internal/selection-model-controller.ts +0 -119
- package/src/nodes/internal/simple-list-store.ts +0 -116
- package/src/nodes/internal/tree-store.ts +0 -289
- package/src/nodes/list-item.ts +0 -107
- package/src/nodes/list-section.ts +0 -64
- package/src/nodes/list-view.ts +0 -164
- package/src/nodes/models/list.ts +0 -250
package/src/jsx.ts
CHANGED
|
@@ -5,16 +5,8 @@ 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 {
|
|
10
|
-
import type {
|
|
11
|
-
AdwComboRowProps as IntrinsicAdwComboRowProps,
|
|
12
|
-
GtkColumnViewProps as IntrinsicGtkColumnViewProps,
|
|
13
|
-
GtkDropDownProps as IntrinsicGtkDropDownProps,
|
|
14
|
-
GtkGridViewProps as IntrinsicGtkGridViewProps,
|
|
15
|
-
GtkListViewProps as IntrinsicGtkListViewProps,
|
|
16
|
-
WidgetSlotNames,
|
|
17
|
-
} from "./generated/jsx.js";
|
|
8
|
+
import type { ReactNode } from "react";
|
|
9
|
+
import type { WidgetSlotNames } from "./generated/jsx.js";
|
|
18
10
|
|
|
19
11
|
/**
|
|
20
12
|
* CSS properties that can be animated on a widget.
|
|
@@ -42,14 +34,41 @@ export type AnimatableProperties = {
|
|
|
42
34
|
skewY?: number;
|
|
43
35
|
};
|
|
44
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
|
+
|
|
45
55
|
/**
|
|
46
|
-
*
|
|
56
|
+
* Props for a timed (duration-based) animation using Adw.TimedAnimation.
|
|
47
57
|
*
|
|
48
|
-
* @
|
|
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
|
+
* ```
|
|
49
70
|
*/
|
|
50
|
-
export type
|
|
51
|
-
/** Discriminant: duration-based animation with easing curves */
|
|
52
|
-
mode: "timed";
|
|
71
|
+
export type AdwTimedAnimationProps = AnimationBaseProps & {
|
|
53
72
|
/** Animation duration in milliseconds (default: 300) */
|
|
54
73
|
duration?: number;
|
|
55
74
|
/** Easing function for the animation curve (default: EASE_OUT_CUBIC) */
|
|
@@ -65,16 +84,22 @@ export type TimedTransition = {
|
|
|
65
84
|
};
|
|
66
85
|
|
|
67
86
|
/**
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
* Spring animations simulate a mass attached to a spring, providing natural-feeling motion.
|
|
71
|
-
* The animation settles when the spring reaches equilibrium.
|
|
87
|
+
* Props for a spring (physics-based) animation using Adw.SpringAnimation.
|
|
72
88
|
*
|
|
73
|
-
* @
|
|
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
|
+
* ```
|
|
74
101
|
*/
|
|
75
|
-
export type
|
|
76
|
-
/** Discriminant: physics-based spring animation */
|
|
77
|
-
mode: "spring";
|
|
102
|
+
export type AdwSpringAnimationProps = AnimationBaseProps & {
|
|
78
103
|
/** Damping ratio controlling oscillation decay (default: 1, critically damped) */
|
|
79
104
|
damping?: number;
|
|
80
105
|
/** Spring stiffness in N/m affecting animation speed (default: 100) */
|
|
@@ -90,51 +115,9 @@ export type SpringTransition = {
|
|
|
90
115
|
};
|
|
91
116
|
|
|
92
117
|
/**
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
* The `mode` field determines the animation type:
|
|
96
|
-
* - `"timed"`: Duration-based animation with easing curves (uses {@link Adw.TimedAnimation})
|
|
97
|
-
* - `"spring"`: Physics-based spring animation (uses {@link Adw.SpringAnimation})
|
|
98
|
-
*/
|
|
99
|
-
export type AnimationTransition = TimedTransition | SpringTransition;
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Props for the Animation component.
|
|
103
|
-
*
|
|
104
|
-
* Provides a declarative API for animating widget properties using either
|
|
105
|
-
* timed (duration-based) or spring (physics-based) animations.
|
|
106
|
-
*
|
|
107
|
-
* @example
|
|
108
|
-
* ```tsx
|
|
109
|
-
* <x.Animation
|
|
110
|
-
* initial={{ opacity: 0, translateY: -20 }}
|
|
111
|
-
* animate={{ opacity: 1, translateY: 0 }}
|
|
112
|
-
* exit={{ opacity: 0, translateY: 20 }}
|
|
113
|
-
* transition={{ mode: "spring", damping: 0.8, stiffness: 200 }}
|
|
114
|
-
* animateOnMount
|
|
115
|
-
* >
|
|
116
|
-
* <GtkLabel label="Animated content" />
|
|
117
|
-
* </x.Animation>
|
|
118
|
-
* ```
|
|
118
|
+
* @internal Union type used by the AnimationNode internally.
|
|
119
119
|
*/
|
|
120
|
-
export type AnimationProps =
|
|
121
|
-
/** Initial property values before animation starts, or `false` to skip initial state */
|
|
122
|
-
initial?: AnimatableProperties | false;
|
|
123
|
-
/** Target property values to animate towards */
|
|
124
|
-
animate?: AnimatableProperties;
|
|
125
|
-
/** Property values to animate to when the component unmounts */
|
|
126
|
-
exit?: AnimatableProperties;
|
|
127
|
-
/** Transition configuration including animation mode and parameters */
|
|
128
|
-
transition?: AnimationTransition;
|
|
129
|
-
/** Whether to animate from `initial` to `animate` when first mounted (default: false) */
|
|
130
|
-
animateOnMount?: boolean;
|
|
131
|
-
/** Callback fired when an animation begins */
|
|
132
|
-
onAnimationStart?: () => void;
|
|
133
|
-
/** Callback fired when an animation completes */
|
|
134
|
-
onAnimationComplete?: () => void;
|
|
135
|
-
/** The child widget to animate (must be a single GTK widget) */
|
|
136
|
-
children?: ReactNode;
|
|
137
|
-
};
|
|
120
|
+
export type AnimationProps = AdwTimedAnimationProps | AdwSpringAnimationProps;
|
|
138
121
|
|
|
139
122
|
/**
|
|
140
123
|
* Props for the Shortcut virtual element.
|
|
@@ -341,7 +324,7 @@ export type LevelBarOffset = {
|
|
|
341
324
|
/**
|
|
342
325
|
* Props for slot-based child positioning.
|
|
343
326
|
*
|
|
344
|
-
*
|
|
327
|
+
* Used internally by compound components with slot props (e.g. `titleWidget` on `AdwHeaderBar`).
|
|
345
328
|
*/
|
|
346
329
|
export type SlotProps = {
|
|
347
330
|
/** The slot identifier */
|
|
@@ -350,22 +333,6 @@ export type SlotProps = {
|
|
|
350
333
|
children?: ReactNode;
|
|
351
334
|
};
|
|
352
335
|
|
|
353
|
-
/**
|
|
354
|
-
* Type mapping widgets to their valid container slot method names.
|
|
355
|
-
*
|
|
356
|
-
* Each key is a JSX element name and each value is a union of method names
|
|
357
|
-
* that can be used as the `id` prop on `x.ContainerSlot`.
|
|
358
|
-
*/
|
|
359
|
-
export type ContainerSlotNames = {
|
|
360
|
-
AdwActionRow: "addPrefix" | "addSuffix";
|
|
361
|
-
AdwEntryRow: "addPrefix" | "addSuffix";
|
|
362
|
-
AdwExpanderRow: "addPrefix" | "addSuffix" | "addRow" | "addAction";
|
|
363
|
-
AdwHeaderBar: "packStart" | "packEnd";
|
|
364
|
-
AdwToolbarView: "addTopBar" | "addBottomBar";
|
|
365
|
-
GtkActionBar: "packStart" | "packEnd";
|
|
366
|
-
GtkHeaderBar: "packStart" | "packEnd";
|
|
367
|
-
};
|
|
368
|
-
|
|
369
336
|
/**
|
|
370
337
|
* Props for method-based container slot child positioning.
|
|
371
338
|
*/
|
|
@@ -377,50 +344,41 @@ export type ContainerSlotProps = {
|
|
|
377
344
|
};
|
|
378
345
|
|
|
379
346
|
/**
|
|
380
|
-
*
|
|
347
|
+
* A data item for list/grid/column views and dropdowns.
|
|
381
348
|
*
|
|
382
|
-
*
|
|
383
|
-
*
|
|
384
|
-
*
|
|
349
|
+
* Uses a discriminated union on the `section` field:
|
|
350
|
+
* - Regular items have `value: T` and optional tree-mode properties
|
|
351
|
+
* - Section headers have `value: S`, `section: true`, and required `children`
|
|
385
352
|
*
|
|
386
|
-
*
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
id: string;
|
|
391
|
-
/** The data value for this item */
|
|
392
|
-
value: T;
|
|
393
|
-
/** Whether to indent based on tree depth (default: true) */
|
|
394
|
-
indentForDepth?: boolean;
|
|
395
|
-
/** Whether to indent for expander icon width */
|
|
396
|
-
indentForIcon?: boolean;
|
|
397
|
-
/** Whether to hide the expand/collapse arrow */
|
|
398
|
-
hideExpander?: boolean;
|
|
399
|
-
/** Nested list items (children of this item in a tree) */
|
|
400
|
-
children?: ReactNode;
|
|
401
|
-
};
|
|
402
|
-
|
|
403
|
-
/**
|
|
404
|
-
* Props for section headers in a GtkListView, GtkGridView, or GtkColumnView.
|
|
353
|
+
* Mode is detected from data shape:
|
|
354
|
+
* - Any item has `section: true` → section mode
|
|
355
|
+
* - Any item has non-empty `children` (without `section`) → tree mode
|
|
356
|
+
* - Otherwise → flat mode
|
|
405
357
|
*
|
|
406
|
-
*
|
|
407
|
-
*
|
|
408
|
-
*
|
|
409
|
-
* @typeParam T - The type of data associated with this section header
|
|
358
|
+
* @typeParam T - The type of data for regular items
|
|
359
|
+
* @typeParam S - The type of data for section headers
|
|
410
360
|
*/
|
|
411
|
-
export type
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
361
|
+
export type ListItem<T = unknown, S = unknown> =
|
|
362
|
+
| {
|
|
363
|
+
id: string;
|
|
364
|
+
value: T;
|
|
365
|
+
section?: false | undefined;
|
|
366
|
+
children?: ListItem<T, S>[];
|
|
367
|
+
hideExpander?: boolean;
|
|
368
|
+
indentForDepth?: boolean;
|
|
369
|
+
indentForIcon?: boolean;
|
|
370
|
+
}
|
|
371
|
+
| {
|
|
372
|
+
id: string;
|
|
373
|
+
value: S;
|
|
374
|
+
section: true;
|
|
375
|
+
children: ListItem<T, S>[];
|
|
376
|
+
};
|
|
419
377
|
|
|
420
378
|
/**
|
|
421
379
|
* Props for positioning children within a GtkGrid.
|
|
422
380
|
*
|
|
423
|
-
*
|
|
381
|
+
* Used by `GtkGrid.Child` compound component.
|
|
424
382
|
*/
|
|
425
383
|
export type GridChildProps = {
|
|
426
384
|
/** Content to place in the grid cell */
|
|
@@ -438,7 +396,7 @@ export type GridChildProps = {
|
|
|
438
396
|
/**
|
|
439
397
|
* Props for positioning children within a GtkFixed.
|
|
440
398
|
*
|
|
441
|
-
*
|
|
399
|
+
* Used by `GtkFixed.Child` compound component.
|
|
442
400
|
*/
|
|
443
401
|
export type FixedChildProps = {
|
|
444
402
|
/** Content to place in the fixed container */
|
|
@@ -456,7 +414,7 @@ export type FixedChildProps = {
|
|
|
456
414
|
*
|
|
457
415
|
* @typeParam T - The type of data for each row
|
|
458
416
|
*
|
|
459
|
-
*
|
|
417
|
+
* Used by `GtkColumnView.Column` compound component.
|
|
460
418
|
*/
|
|
461
419
|
export type ColumnViewColumnProps<T = unknown> = {
|
|
462
420
|
/** Column header text */
|
|
@@ -474,7 +432,7 @@ export type ColumnViewColumnProps<T = unknown> = {
|
|
|
474
432
|
/** Whether this column is visible */
|
|
475
433
|
visible?: boolean;
|
|
476
434
|
/** Function to render the cell content for each row */
|
|
477
|
-
renderCell: (item: T
|
|
435
|
+
renderCell: (item: T) => ReactNode;
|
|
478
436
|
/** Menu items for the column header context menu */
|
|
479
437
|
children?: ReactNode;
|
|
480
438
|
};
|
|
@@ -504,7 +462,7 @@ export type NotebookPageTabProps = {
|
|
|
504
462
|
/**
|
|
505
463
|
* Props for pages within a Stack or ViewStack.
|
|
506
464
|
*
|
|
507
|
-
*
|
|
465
|
+
* Used by `GtkStack.Page` and `AdwViewStack.Page` compound components.
|
|
508
466
|
*/
|
|
509
467
|
export type StackPageProps = {
|
|
510
468
|
/** Content to place in the stack page */
|
|
@@ -528,7 +486,7 @@ export type StackPageProps = {
|
|
|
528
486
|
/**
|
|
529
487
|
* Props for menu items.
|
|
530
488
|
*
|
|
531
|
-
*
|
|
489
|
+
* Used by menu compound components like `GtkMenuButton.MenuItem`.
|
|
532
490
|
*/
|
|
533
491
|
export type MenuItemProps = {
|
|
534
492
|
/** Unique identifier for this menu item */
|
|
@@ -609,7 +567,7 @@ export type ToggleProps = {
|
|
|
609
567
|
*
|
|
610
568
|
* Each response represents a button the user can click to dismiss the dialog.
|
|
611
569
|
*
|
|
612
|
-
*
|
|
570
|
+
* Used by `AdwAlertDialog.Response` compound component.
|
|
613
571
|
*/
|
|
614
572
|
export type AlertDialogResponseProps = {
|
|
615
573
|
/** Unique response ID (used in response signal and for default/close response) */
|
|
@@ -622,7 +580,11 @@ export type AlertDialogResponseProps = {
|
|
|
622
580
|
enabled?: boolean;
|
|
623
581
|
};
|
|
624
582
|
|
|
625
|
-
|
|
583
|
+
/**
|
|
584
|
+
* Base props shared by all navigation page declarations, regardless
|
|
585
|
+
* of the parent container (NavigationView or NavigationSplitView).
|
|
586
|
+
*/
|
|
587
|
+
export type NavigationPageBaseProps = {
|
|
626
588
|
/** Display title for the navigation page */
|
|
627
589
|
title?: string;
|
|
628
590
|
/** Whether the page can be popped from the navigation stack */
|
|
@@ -631,6 +593,22 @@ type NavigationPageBaseProps = {
|
|
|
631
593
|
children?: ReactNode;
|
|
632
594
|
};
|
|
633
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
|
+
|
|
634
612
|
/**
|
|
635
613
|
* Props for the NavigationPage virtual element with type-safe targeting.
|
|
636
614
|
*
|
|
@@ -685,9 +663,12 @@ export type TextBufferProps = {
|
|
|
685
663
|
onCanRedoChanged?: ((canRedo: boolean) => void) | null;
|
|
686
664
|
};
|
|
687
665
|
|
|
666
|
+
/** @internal */
|
|
688
667
|
type BaseListViewProps = {
|
|
689
668
|
/** Estimated item height in pixels for virtualization */
|
|
690
669
|
estimatedItemHeight?: number;
|
|
670
|
+
/** Estimated item width in pixels for virtualization */
|
|
671
|
+
estimatedItemWidth?: number;
|
|
691
672
|
/** Array of selected item IDs */
|
|
692
673
|
selected?: string[] | null;
|
|
693
674
|
/** Callback fired when the selection changes */
|
|
@@ -696,34 +677,52 @@ type BaseListViewProps = {
|
|
|
696
677
|
selectionMode?: Gtk.SelectionMode | null;
|
|
697
678
|
};
|
|
698
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
|
+
*/
|
|
699
686
|
export type ListViewProps<T = unknown, S = unknown> = BaseListViewProps & {
|
|
687
|
+
/** Data items to display in the list */
|
|
688
|
+
items?: ListItem<T, S>[];
|
|
700
689
|
/** Function to render each list item. The `row` parameter provides tree state for hierarchical lists. */
|
|
701
|
-
renderItem: (item: T
|
|
690
|
+
renderItem: (item: T, row?: Gtk.TreeListRow | null) => ReactNode;
|
|
702
691
|
/** Whether to automatically expand new tree rows (default: false) */
|
|
703
692
|
autoexpand?: boolean;
|
|
704
|
-
/** Function to render section headers when
|
|
705
|
-
renderHeader?: ((item: S
|
|
693
|
+
/** Function to render section headers when items contain section entries */
|
|
694
|
+
renderHeader?: ((item: S) => ReactNode) | null;
|
|
706
695
|
};
|
|
707
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
|
+
*/
|
|
708
703
|
export type GridViewProps<T = unknown> = BaseListViewProps & {
|
|
704
|
+
/** Data items to display in the grid */
|
|
705
|
+
items?: ListItem<T>[];
|
|
709
706
|
/** Function to render each grid item */
|
|
710
|
-
renderItem: (item: T
|
|
707
|
+
renderItem: (item: T) => ReactNode;
|
|
711
708
|
};
|
|
712
709
|
|
|
713
710
|
/**
|
|
714
711
|
* Props shared by single-selection dropdown widgets (GtkDropDown, AdwComboRow).
|
|
715
712
|
*/
|
|
716
713
|
export type DropDownProps<T = unknown, S = unknown> = {
|
|
714
|
+
/** Data items to display in the dropdown */
|
|
715
|
+
items?: ListItem<T, S>[];
|
|
717
716
|
/** ID of the currently selected item */
|
|
718
717
|
selectedId?: string | null;
|
|
719
718
|
/** Callback fired when the selected item changes */
|
|
720
719
|
onSelectionChanged?: ((id: string) => void) | null;
|
|
721
720
|
/** Function to render each item. Sets the primary factory, used for both button and popup list unless overridden by renderListItem. */
|
|
722
|
-
renderItem?: ((item: T
|
|
721
|
+
renderItem?: ((item: T) => ReactNode) | null;
|
|
723
722
|
/** Function to render items in the popup list only, overriding renderItem for the list. */
|
|
724
|
-
renderListItem?: ((item: T
|
|
725
|
-
/** Function to render section headers when
|
|
726
|
-
renderHeader?: ((item: S
|
|
723
|
+
renderListItem?: ((item: T) => ReactNode) | null;
|
|
724
|
+
/** Function to render section headers when items contain section entries */
|
|
725
|
+
renderHeader?: ((item: S) => ReactNode) | null;
|
|
727
726
|
};
|
|
728
727
|
|
|
729
728
|
/**
|
|
@@ -759,413 +758,6 @@ export type AdjustableProps = {
|
|
|
759
758
|
onValueChanged?: ((value: number, self: Gtk.Range | Gtk.ScaleButton | Gtk.SpinButton | Adw.SpinRow) => void) | null;
|
|
760
759
|
};
|
|
761
760
|
|
|
762
|
-
/**
|
|
763
|
-
* GTKX-specific intrinsic elements and components.
|
|
764
|
-
*
|
|
765
|
-
* This namespace provides React components for GTK layout, lists, menus, and slots
|
|
766
|
-
* that are specific to GTKX (not direct GTK widget bindings).
|
|
767
|
-
*
|
|
768
|
-
* @example
|
|
769
|
-
* ```tsx
|
|
770
|
-
* import { x, GtkHeaderBar, GtkDropDown } from "@gtkx/react";
|
|
771
|
-
*
|
|
772
|
-
* <GtkHeaderBar>
|
|
773
|
-
* <x.Slot for={GtkHeaderBar} id="titleWidget">
|
|
774
|
-
* <GtkLabel label="App Title" />
|
|
775
|
-
* </x.Slot>
|
|
776
|
-
* </GtkHeaderBar>
|
|
777
|
-
*
|
|
778
|
-
* <GtkDropDown>
|
|
779
|
-
* <x.ListItem id="opt1" value="Option 1" />
|
|
780
|
-
* <x.ListItem id="opt2" value="Option 2" />
|
|
781
|
-
* </GtkDropDown>
|
|
782
|
-
* ```
|
|
783
|
-
*/
|
|
784
|
-
export const x = {
|
|
785
|
-
/**
|
|
786
|
-
* Type-safe slot component for placing children in named widget slots.
|
|
787
|
-
*
|
|
788
|
-
* GTK widgets often have named slots for specific child positions (e.g., titleWidget,
|
|
789
|
-
* startWidget). This component provides type-safe access to those slots.
|
|
790
|
-
*
|
|
791
|
-
* @example
|
|
792
|
-
* ```tsx
|
|
793
|
-
* <GtkHeaderBar>
|
|
794
|
-
* <x.Slot for={GtkHeaderBar} id="titleWidget">
|
|
795
|
-
* <GtkLabel label="App Title" />
|
|
796
|
-
* </x.Slot>
|
|
797
|
-
* </GtkHeaderBar>
|
|
798
|
-
* ```
|
|
799
|
-
*/
|
|
800
|
-
Slot<W extends keyof WidgetSlotNames>(props: {
|
|
801
|
-
for: W;
|
|
802
|
-
id: WidgetSlotNames[W];
|
|
803
|
-
children?: ReactNode;
|
|
804
|
-
}): ReactElement {
|
|
805
|
-
return createElement("Slot", { id: props.id }, props.children);
|
|
806
|
-
},
|
|
807
|
-
|
|
808
|
-
/**
|
|
809
|
-
* Element type for pages within a GtkStack or AdwViewStack.
|
|
810
|
-
*
|
|
811
|
-
* @example
|
|
812
|
-
* ```tsx
|
|
813
|
-
* <GtkStack page="page1">
|
|
814
|
-
* <x.StackPage id="page1" title="First Page">
|
|
815
|
-
* <GtkLabel label="Content 1" />
|
|
816
|
-
* </x.StackPage>
|
|
817
|
-
* </GtkStack>
|
|
818
|
-
* ```
|
|
819
|
-
*/
|
|
820
|
-
StackPage: "StackPage" as const,
|
|
821
|
-
|
|
822
|
-
/**
|
|
823
|
-
* Element type for positioning children within a GtkGrid.
|
|
824
|
-
*
|
|
825
|
-
* @example
|
|
826
|
-
* ```tsx
|
|
827
|
-
* <GtkGrid>
|
|
828
|
-
* <x.GridChild column={0} row={0}>
|
|
829
|
-
* <GtkLabel label="Top Left" />
|
|
830
|
-
* </x.GridChild>
|
|
831
|
-
* </GtkGrid>
|
|
832
|
-
* ```
|
|
833
|
-
*/
|
|
834
|
-
GridChild: "GridChild" as const,
|
|
835
|
-
|
|
836
|
-
/**
|
|
837
|
-
* Element type for positioning children within a GtkFixed.
|
|
838
|
-
*
|
|
839
|
-
* @example
|
|
840
|
-
* ```tsx
|
|
841
|
-
* <GtkFixed>
|
|
842
|
-
* <x.FixedChild x={20} y={30}>
|
|
843
|
-
* <GtkLabel label="Positioned at (20, 30)" />
|
|
844
|
-
* </x.FixedChild>
|
|
845
|
-
* </GtkFixed>
|
|
846
|
-
* ```
|
|
847
|
-
*/
|
|
848
|
-
FixedChild: "FixedChild" as const,
|
|
849
|
-
|
|
850
|
-
/**
|
|
851
|
-
* Element type for a page within a GtkNotebook (tabbed interface).
|
|
852
|
-
*
|
|
853
|
-
* @example
|
|
854
|
-
* ```tsx
|
|
855
|
-
* <GtkNotebook>
|
|
856
|
-
* <x.NotebookPage label="Tab 1">
|
|
857
|
-
* <GtkLabel label="Content 1" />
|
|
858
|
-
* </x.NotebookPage>
|
|
859
|
-
* </GtkNotebook>
|
|
860
|
-
* ```
|
|
861
|
-
*/
|
|
862
|
-
NotebookPage: "NotebookPage" as const,
|
|
863
|
-
|
|
864
|
-
/**
|
|
865
|
-
* Element type for a custom widget as the page tab label.
|
|
866
|
-
*/
|
|
867
|
-
NotebookPageTab: "NotebookPageTab" as const,
|
|
868
|
-
|
|
869
|
-
/**
|
|
870
|
-
* Element type for items in a GtkListView, GtkGridView, or GtkColumnView.
|
|
871
|
-
*
|
|
872
|
-
* Items can be nested to create tree hierarchies inside a GtkListView.
|
|
873
|
-
*
|
|
874
|
-
* @example
|
|
875
|
-
* ```tsx
|
|
876
|
-
* // Flat list
|
|
877
|
-
* <GtkListView renderItem={(item) => <GtkLabel label={item.name} />}>
|
|
878
|
-
* <x.ListItem id="1" value={{ name: "Item 1" }} />
|
|
879
|
-
* </GtkListView>
|
|
880
|
-
*
|
|
881
|
-
* // Tree list (nested items)
|
|
882
|
-
* <GtkListView renderItem={(item, row) => <GtkLabel label={item.name} />} autoexpand>
|
|
883
|
-
* <x.ListItem id="parent" value={{ name: "Parent" }}>
|
|
884
|
-
* <x.ListItem id="child" value={{ name: "Child" }} />
|
|
885
|
-
* </x.ListItem>
|
|
886
|
-
* </GtkListView>
|
|
887
|
-
* ```
|
|
888
|
-
*/
|
|
889
|
-
ListItem<T = unknown>(props: ListItemProps<T>): ReactElement {
|
|
890
|
-
return createElement("ListItem", props, props.children);
|
|
891
|
-
},
|
|
892
|
-
|
|
893
|
-
/**
|
|
894
|
-
* Component for defining section headers in list/grid views.
|
|
895
|
-
*
|
|
896
|
-
* Wraps ListItems to group them into sections with headers.
|
|
897
|
-
* Requires `renderHeader` on the parent view to render the header content.
|
|
898
|
-
*
|
|
899
|
-
* @example
|
|
900
|
-
* ```tsx
|
|
901
|
-
* <GtkGridView
|
|
902
|
-
* renderItem={(item) => <GtkLabel label={item.name} />}
|
|
903
|
-
* renderHeader={(header) => <GtkLabel label={header.title} />}
|
|
904
|
-
* >
|
|
905
|
-
* <x.ListSection id="section1" value={{ title: "Section 1" }}>
|
|
906
|
-
* <x.ListItem id="a" value={{ name: "Item A" }} />
|
|
907
|
-
* <x.ListItem id="b" value={{ name: "Item B" }} />
|
|
908
|
-
* </x.ListSection>
|
|
909
|
-
* </GtkGridView>
|
|
910
|
-
* ```
|
|
911
|
-
*/
|
|
912
|
-
ListSection<T = unknown>(props: ListSectionProps<T>): ReactElement {
|
|
913
|
-
return createElement("ListSection", props, props.children);
|
|
914
|
-
},
|
|
915
|
-
|
|
916
|
-
/**
|
|
917
|
-
* Component for defining columns in a ColumnView (table widget).
|
|
918
|
-
*
|
|
919
|
-
* @example
|
|
920
|
-
* ```tsx
|
|
921
|
-
* <GtkColumnView>
|
|
922
|
-
* <x.ColumnViewColumn
|
|
923
|
-
* id="name"
|
|
924
|
-
* title="Name"
|
|
925
|
-
* expand
|
|
926
|
-
* renderCell={(item) => <GtkLabel label={item?.name ?? ""} />}
|
|
927
|
-
* />
|
|
928
|
-
* </GtkColumnView>
|
|
929
|
-
* ```
|
|
930
|
-
*/
|
|
931
|
-
ColumnViewColumn<T = unknown>(props: ColumnViewColumnProps<T>): ReactElement {
|
|
932
|
-
return createElement("ColumnViewColumn", props, props.children);
|
|
933
|
-
},
|
|
934
|
-
|
|
935
|
-
/**
|
|
936
|
-
* Type-safe container slot for placing children via parent widget methods.
|
|
937
|
-
*
|
|
938
|
-
* Unlike `x.Slot` (which uses property setters for single-child slots),
|
|
939
|
-
* `x.ContainerSlot` calls attachment methods that support multiple children
|
|
940
|
-
* (e.g., `addPrefix()`, `packStart()`, `addTopBar()`).
|
|
941
|
-
*
|
|
942
|
-
* The `for` prop provides TypeScript type narrowing for the `id` prop
|
|
943
|
-
* and is not used at runtime.
|
|
944
|
-
*
|
|
945
|
-
* @example
|
|
946
|
-
* ```tsx
|
|
947
|
-
* <AdwToolbarView>
|
|
948
|
-
* <x.ContainerSlot for={AdwToolbarView} id="addTopBar">
|
|
949
|
-
* <AdwHeaderBar />
|
|
950
|
-
* </x.ContainerSlot>
|
|
951
|
-
* </AdwToolbarView>
|
|
952
|
-
*
|
|
953
|
-
* <GtkHeaderBar>
|
|
954
|
-
* <x.ContainerSlot for={GtkHeaderBar} id="packStart">
|
|
955
|
-
* <GtkButton label="Back" />
|
|
956
|
-
* </x.ContainerSlot>
|
|
957
|
-
* </GtkHeaderBar>
|
|
958
|
-
*
|
|
959
|
-
* <AdwActionRow title="Setting">
|
|
960
|
-
* <x.ContainerSlot for={AdwActionRow} id="addPrefix">
|
|
961
|
-
* <GtkCheckButton />
|
|
962
|
-
* </x.ContainerSlot>
|
|
963
|
-
* </AdwActionRow>
|
|
964
|
-
* ```
|
|
965
|
-
*/
|
|
966
|
-
ContainerSlot<W extends keyof ContainerSlotNames>(props: {
|
|
967
|
-
for: W;
|
|
968
|
-
id: ContainerSlotNames[W];
|
|
969
|
-
children?: ReactNode;
|
|
970
|
-
}): ReactElement {
|
|
971
|
-
return createElement("ContainerSlot", { id: props.id }, props.children);
|
|
972
|
-
},
|
|
973
|
-
|
|
974
|
-
/**
|
|
975
|
-
* Element type for overlay children positioned above the main content.
|
|
976
|
-
*
|
|
977
|
-
* @example
|
|
978
|
-
* ```tsx
|
|
979
|
-
* <GtkOverlay>
|
|
980
|
-
* <GtkImage file="background.png" />
|
|
981
|
-
* <x.OverlayChild>
|
|
982
|
-
* <GtkLabel label="Overlaid text" />
|
|
983
|
-
* </x.OverlayChild>
|
|
984
|
-
* </GtkOverlay>
|
|
985
|
-
* ```
|
|
986
|
-
*/
|
|
987
|
-
OverlayChild: "OverlayChild" as const,
|
|
988
|
-
|
|
989
|
-
/**
|
|
990
|
-
* A clickable menu item with action.
|
|
991
|
-
*
|
|
992
|
-
* @example
|
|
993
|
-
* ```tsx
|
|
994
|
-
* <GtkMenuButton>
|
|
995
|
-
* <x.MenuItem id="open" label="Open" onActivate={handleOpen} />
|
|
996
|
-
* </GtkMenuButton>
|
|
997
|
-
* ```
|
|
998
|
-
*/
|
|
999
|
-
MenuItem: "MenuItem" as const,
|
|
1000
|
-
|
|
1001
|
-
/**
|
|
1002
|
-
* A section grouping related menu items.
|
|
1003
|
-
*
|
|
1004
|
-
* @example
|
|
1005
|
-
* ```tsx
|
|
1006
|
-
* <GtkMenuButton>
|
|
1007
|
-
* <x.MenuSection label="File">
|
|
1008
|
-
* <x.MenuItem id="open" label="Open" onActivate={handleOpen} />
|
|
1009
|
-
* </x.MenuSection>
|
|
1010
|
-
* </GtkMenuButton>
|
|
1011
|
-
* ```
|
|
1012
|
-
*/
|
|
1013
|
-
MenuSection: "MenuSection" as const,
|
|
1014
|
-
|
|
1015
|
-
/**
|
|
1016
|
-
* A submenu containing nested items.
|
|
1017
|
-
*
|
|
1018
|
-
* @example
|
|
1019
|
-
* ```tsx
|
|
1020
|
-
* <GtkMenuButton>
|
|
1021
|
-
* <x.MenuSubmenu label="Export">
|
|
1022
|
-
* <x.MenuItem id="pdf" label="As PDF" onActivate={exportPdf} />
|
|
1023
|
-
* </x.MenuSubmenu>
|
|
1024
|
-
* </GtkMenuButton>
|
|
1025
|
-
* ```
|
|
1026
|
-
*/
|
|
1027
|
-
MenuSubmenu: "MenuSubmenu" as const,
|
|
1028
|
-
|
|
1029
|
-
/**
|
|
1030
|
-
* Declarative text tag for styling text content.
|
|
1031
|
-
*
|
|
1032
|
-
* Wrap text content with a TextTag to apply styling. Tags can be nested.
|
|
1033
|
-
*
|
|
1034
|
-
* @example
|
|
1035
|
-
* ```tsx
|
|
1036
|
-
* <GtkTextView>
|
|
1037
|
-
* Normal <x.TextTag id="bold" weight={Pango.Weight.BOLD}>
|
|
1038
|
-
* bold <x.TextTag id="red" foreground="red">and red</x.TextTag>
|
|
1039
|
-
* </x.TextTag> text.
|
|
1040
|
-
* </GtkTextView>
|
|
1041
|
-
* ```
|
|
1042
|
-
*/
|
|
1043
|
-
TextTag: "TextTag" as const,
|
|
1044
|
-
|
|
1045
|
-
/**
|
|
1046
|
-
* Declarative anchor for embedding widgets in text flow.
|
|
1047
|
-
*
|
|
1048
|
-
* The anchor is placed at the current position in the text.
|
|
1049
|
-
*
|
|
1050
|
-
* @example
|
|
1051
|
-
* ```tsx
|
|
1052
|
-
* <GtkTextView>
|
|
1053
|
-
* Click here: <x.TextAnchor>
|
|
1054
|
-
* <GtkButton label="Click me" />
|
|
1055
|
-
* </x.TextAnchor> to continue.
|
|
1056
|
-
* </GtkTextView>
|
|
1057
|
-
* ```
|
|
1058
|
-
*/
|
|
1059
|
-
TextAnchor: "TextAnchor" as const,
|
|
1060
|
-
|
|
1061
|
-
/**
|
|
1062
|
-
* Declarative inline paintable for embedding images/icons in text flow.
|
|
1063
|
-
*
|
|
1064
|
-
* The paintable is placed at the current position in the text.
|
|
1065
|
-
*
|
|
1066
|
-
* @example
|
|
1067
|
-
* ```tsx
|
|
1068
|
-
* <GtkTextView>
|
|
1069
|
-
* Click the icon <x.TextPaintable paintable={iconPaintable} /> to continue.
|
|
1070
|
-
* </GtkTextView>
|
|
1071
|
-
* ```
|
|
1072
|
-
*/
|
|
1073
|
-
TextPaintable: "TextPaintable" as const,
|
|
1074
|
-
|
|
1075
|
-
/**
|
|
1076
|
-
* A toggle button for an AdwToggleGroup.
|
|
1077
|
-
*
|
|
1078
|
-
* @example
|
|
1079
|
-
* ```tsx
|
|
1080
|
-
* <AdwToggleGroup>
|
|
1081
|
-
* <x.Toggle id="list" iconName="view-list-symbolic" />
|
|
1082
|
-
* <x.Toggle id="grid" iconName="view-grid-symbolic" />
|
|
1083
|
-
* </AdwToggleGroup>
|
|
1084
|
-
* ```
|
|
1085
|
-
*/
|
|
1086
|
-
Toggle: "Toggle" as const,
|
|
1087
|
-
|
|
1088
|
-
/**
|
|
1089
|
-
* A response button for an AdwAlertDialog.
|
|
1090
|
-
*
|
|
1091
|
-
* @example
|
|
1092
|
-
* ```tsx
|
|
1093
|
-
* <AdwAlertDialog
|
|
1094
|
-
* heading="Delete File?"
|
|
1095
|
-
* body="This cannot be undone."
|
|
1096
|
-
* defaultResponse="cancel"
|
|
1097
|
-
* closeResponse="cancel"
|
|
1098
|
-
* >
|
|
1099
|
-
* <x.AlertDialogResponse id="cancel" label="Cancel" />
|
|
1100
|
-
* <x.AlertDialogResponse id="delete" label="Delete" appearance={Adw.ResponseAppearance.DESTRUCTIVE} />
|
|
1101
|
-
* </AdwAlertDialog>
|
|
1102
|
-
* ```
|
|
1103
|
-
*/
|
|
1104
|
-
AlertDialogResponse: "AlertDialogResponse" as const,
|
|
1105
|
-
|
|
1106
|
-
/**
|
|
1107
|
-
* Type-safe page component for AdwNavigationView or AdwNavigationSplitView.
|
|
1108
|
-
*
|
|
1109
|
-
* The `for` prop is required and determines valid `id` values:
|
|
1110
|
-
* - `AdwNavigationView`: any string (page tags for navigation history)
|
|
1111
|
-
* - `AdwNavigationSplitView`: `"content"` or `"sidebar"` (slot positions)
|
|
1112
|
-
*
|
|
1113
|
-
* @example
|
|
1114
|
-
* ```tsx
|
|
1115
|
-
* // In NavigationView - id can be any string
|
|
1116
|
-
* <AdwNavigationView history={["home"]}>
|
|
1117
|
-
* <x.NavigationPage for={AdwNavigationView} id="home" title="Home">
|
|
1118
|
-
* <GtkLabel label="Welcome!" />
|
|
1119
|
-
* </x.NavigationPage>
|
|
1120
|
-
* </AdwNavigationView>
|
|
1121
|
-
*
|
|
1122
|
-
* // In NavigationSplitView - id is narrowed to "content" | "sidebar"
|
|
1123
|
-
* <AdwNavigationSplitView>
|
|
1124
|
-
* <x.NavigationPage for={AdwNavigationSplitView} id="sidebar" title="Sidebar">
|
|
1125
|
-
* <GtkLabel label="Sidebar" />
|
|
1126
|
-
* </x.NavigationPage>
|
|
1127
|
-
* <x.NavigationPage for={AdwNavigationSplitView} id="content" title="Content">
|
|
1128
|
-
* <GtkLabel label="Content" />
|
|
1129
|
-
* </x.NavigationPage>
|
|
1130
|
-
* </AdwNavigationSplitView>
|
|
1131
|
-
* ```
|
|
1132
|
-
*/
|
|
1133
|
-
NavigationPage: "NavigationPage" as const,
|
|
1134
|
-
|
|
1135
|
-
/**
|
|
1136
|
-
* A keyboard shortcut definition.
|
|
1137
|
-
*
|
|
1138
|
-
* Must be a child of `<GtkShortcutController>`.
|
|
1139
|
-
*
|
|
1140
|
-
* @example
|
|
1141
|
-
* ```tsx
|
|
1142
|
-
* <x.Shortcut trigger="<Control>s" onActivate={save} />
|
|
1143
|
-
* <x.Shortcut trigger={["F5", "<Control>r"]} onActivate={refresh} />
|
|
1144
|
-
* <x.Shortcut trigger="Escape" onActivate={cancel} disabled={!canCancel} />
|
|
1145
|
-
* ```
|
|
1146
|
-
*/
|
|
1147
|
-
Shortcut: "Shortcut" as const,
|
|
1148
|
-
|
|
1149
|
-
/**
|
|
1150
|
-
* Declarative animation wrapper using Adw.TimedAnimation or Adw.SpringAnimation.
|
|
1151
|
-
*
|
|
1152
|
-
* Provides framer-motion-inspired API for animating child widgets.
|
|
1153
|
-
*
|
|
1154
|
-
* @example
|
|
1155
|
-
* ```tsx
|
|
1156
|
-
* <x.Animation
|
|
1157
|
-
* initial={{ opacity: 0, scale: 0.9 }}
|
|
1158
|
-
* animate={{ opacity: 1, scale: 1 }}
|
|
1159
|
-
* transition={{ mode: "spring", damping: 0.8, stiffness: 200 }}
|
|
1160
|
-
* animateOnMount
|
|
1161
|
-
* >
|
|
1162
|
-
* <GtkButton label="Animated Button" />
|
|
1163
|
-
* </x.Animation>
|
|
1164
|
-
* ```
|
|
1165
|
-
*/
|
|
1166
|
-
Animation: "Animation" as const,
|
|
1167
|
-
};
|
|
1168
|
-
|
|
1169
761
|
interface StackProps {
|
|
1170
762
|
/** ID of the currently visible page */
|
|
1171
763
|
page?: string | null;
|
|
@@ -1175,14 +767,13 @@ declare global {
|
|
|
1175
767
|
namespace React {
|
|
1176
768
|
namespace JSX {
|
|
1177
769
|
interface IntrinsicElements {
|
|
1178
|
-
|
|
1179
|
-
|
|
770
|
+
Slot: SlotProps;
|
|
771
|
+
AdwTimedAnimation: AdwTimedAnimationProps;
|
|
772
|
+
AdwSpringAnimation: AdwSpringAnimationProps;
|
|
1180
773
|
ContainerSlot: ContainerSlotProps;
|
|
1181
774
|
ColumnViewColumn: ColumnViewColumnProps;
|
|
1182
775
|
FixedChild: FixedChildProps;
|
|
1183
776
|
GridChild: GridChildProps;
|
|
1184
|
-
ListItem: ListItemProps;
|
|
1185
|
-
ListSection: ListSectionProps;
|
|
1186
777
|
MenuItem: MenuItemProps;
|
|
1187
778
|
MenuSection: MenuSectionProps;
|
|
1188
779
|
MenuSubmenu: MenuSubmenuProps;
|
|
@@ -1194,7 +785,6 @@ declare global {
|
|
|
1194
785
|
TextTag: TextTagProps;
|
|
1195
786
|
|
|
1196
787
|
StackPage: StackPageProps;
|
|
1197
|
-
Toggle: ToggleProps;
|
|
1198
788
|
NavigationPage: NavigationPageProps;
|
|
1199
789
|
Shortcut: ShortcutProps;
|
|
1200
790
|
}
|
|
@@ -1202,6 +792,13 @@ declare global {
|
|
|
1202
792
|
}
|
|
1203
793
|
}
|
|
1204
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
|
+
*/
|
|
1205
802
|
export type AccessibleProps = {
|
|
1206
803
|
accessibleAutocomplete?: Gtk.AccessibleAutocomplete;
|
|
1207
804
|
accessibleDescription?: string;
|
|
@@ -1282,6 +879,11 @@ declare module "./generated/jsx.js" {
|
|
|
1282
879
|
onValueChanged?: ((value: number, self: Adw.SpinRow) => void) | null;
|
|
1283
880
|
}
|
|
1284
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
|
+
|
|
1285
887
|
interface GtkCalendarProps {
|
|
1286
888
|
/** Array of day numbers (1-31) to display as marked */
|
|
1287
889
|
markedDays?: number[] | null;
|
|
@@ -1316,6 +918,8 @@ declare module "./generated/jsx.js" {
|
|
|
1316
918
|
interface GtkGridViewProps extends GridViewProps {}
|
|
1317
919
|
|
|
1318
920
|
interface GtkColumnViewProps {
|
|
921
|
+
/** Data items to display in the column view */
|
|
922
|
+
items?: ListItem[];
|
|
1319
923
|
/** Array of selected row IDs */
|
|
1320
924
|
selected?: string[] | null;
|
|
1321
925
|
/** Callback fired when the selection changes */
|
|
@@ -1330,7 +934,7 @@ declare module "./generated/jsx.js" {
|
|
|
1330
934
|
onSortChanged?: ((column: string | null, order: Gtk.SortType) => void) | null;
|
|
1331
935
|
/** Estimated row height in pixels for virtualization */
|
|
1332
936
|
estimatedRowHeight?: number | null;
|
|
1333
|
-
/** Function to render section headers when
|
|
937
|
+
/** Function to render section headers when items contain section entries */
|
|
1334
938
|
renderHeader?: ((item: unknown) => ReactNode) | null;
|
|
1335
939
|
}
|
|
1336
940
|
|
|
@@ -1361,8 +965,8 @@ declare module "./generated/jsx.js" {
|
|
|
1361
965
|
}
|
|
1362
966
|
|
|
1363
967
|
interface GtkDrawingAreaProps {
|
|
1364
|
-
/**
|
|
1365
|
-
|
|
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;
|
|
1366
970
|
}
|
|
1367
971
|
|
|
1368
972
|
interface GtkColorDialogButtonProps extends DialogButtonProps {
|
|
@@ -1394,6 +998,13 @@ declare module "./generated/jsx.js" {
|
|
|
1394
998
|
interface AdwToggleGroupProps {
|
|
1395
999
|
/** Callback fired when the active toggle changes */
|
|
1396
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[];
|
|
1397
1008
|
}
|
|
1398
1009
|
|
|
1399
1010
|
interface GtkDragSourceProps {
|
|
@@ -1411,37 +1022,12 @@ declare module "./generated/jsx.js" {
|
|
|
1411
1022
|
}
|
|
1412
1023
|
}
|
|
1413
1024
|
|
|
1414
|
-
export
|
|
1415
|
-
|
|
1416
|
-
): ReactElement {
|
|
1417
|
-
return createElement("GtkListView", props);
|
|
1418
|
-
}
|
|
1419
|
-
|
|
1420
|
-
export function GtkGridView<T = unknown>(
|
|
1421
|
-
props: Omit<IntrinsicGtkGridViewProps, keyof GridViewProps> & GridViewProps<T> & { children?: ReactNode },
|
|
1422
|
-
): ReactElement {
|
|
1423
|
-
return createElement("GtkGridView", props);
|
|
1424
|
-
}
|
|
1025
|
+
export { AdwComboRow, GtkColumnView, GtkDropDown, GtkGridView, GtkListView } from "./components/list.js";
|
|
1026
|
+
export * from "./generated/compounds.js";
|
|
1425
1027
|
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
}
|
|
1431
|
-
|
|
1432
|
-
export function AdwComboRow<T = unknown, S = unknown>(
|
|
1433
|
-
props: Omit<IntrinsicAdwComboRowProps, keyof DropDownProps> & DropDownProps<T, S> & { children?: ReactNode },
|
|
1434
|
-
): ReactElement {
|
|
1435
|
-
return createElement("AdwComboRow", props);
|
|
1436
|
-
}
|
|
1437
|
-
|
|
1438
|
-
export function GtkColumnView<T = unknown>(
|
|
1439
|
-
props: Omit<IntrinsicGtkColumnViewProps, "renderHeader"> & {
|
|
1440
|
-
renderHeader?: ((item: T | null) => ReactNode) | null;
|
|
1441
|
-
children?: ReactNode;
|
|
1442
|
-
},
|
|
1443
|
-
): ReactElement {
|
|
1444
|
-
return createElement("GtkColumnView", props);
|
|
1445
|
-
}
|
|
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;
|
|
1446
1032
|
|
|
1447
1033
|
export * from "./generated/jsx.js";
|