@gtkx/react 0.18.0 → 0.18.2
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/dist/errors.d.ts +1 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +1 -0
- package/dist/errors.js.map +1 -0
- package/dist/factory.d.ts +1 -0
- package/dist/factory.d.ts.map +1 -0
- package/dist/factory.js +1 -0
- package/dist/factory.js.map +1 -0
- package/dist/fiber-root.d.ts +1 -0
- package/dist/fiber-root.d.ts.map +1 -0
- package/dist/fiber-root.js +1 -0
- package/dist/fiber-root.js.map +1 -0
- package/dist/generated/internal.d.ts +1 -0
- package/dist/generated/internal.d.ts.map +1 -0
- package/dist/generated/internal.js +1 -0
- package/dist/generated/internal.js.map +1 -0
- package/dist/generated/jsx.d.ts +1 -0
- package/dist/generated/jsx.d.ts.map +1 -0
- package/dist/generated/jsx.js +1 -0
- package/dist/generated/jsx.js.map +1 -0
- package/dist/generated/registry.d.ts +1 -0
- package/dist/generated/registry.d.ts.map +1 -0
- package/dist/generated/registry.js +1 -0
- package/dist/generated/registry.js.map +1 -0
- package/dist/host-config.d.ts +1 -0
- package/dist/host-config.d.ts.map +1 -0
- package/dist/host-config.js +1 -0
- package/dist/host-config.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -0
- package/dist/jsx.d.ts +1 -0
- package/dist/jsx.d.ts.map +1 -0
- package/dist/jsx.js +1 -0
- package/dist/jsx.js.map +1 -0
- package/dist/metadata.d.ts +1 -0
- package/dist/metadata.d.ts.map +1 -0
- package/dist/metadata.js +1 -0
- package/dist/metadata.js.map +1 -0
- package/dist/node.d.ts +1 -0
- package/dist/node.d.ts.map +1 -0
- package/dist/node.js +1 -0
- package/dist/node.js.map +1 -0
- package/dist/nodes/adjustable.d.ts +1 -0
- package/dist/nodes/adjustable.d.ts.map +1 -0
- package/dist/nodes/adjustable.js +1 -0
- package/dist/nodes/adjustable.js.map +1 -0
- package/dist/nodes/alert-dialog-response.d.ts +1 -0
- package/dist/nodes/alert-dialog-response.d.ts.map +1 -0
- package/dist/nodes/alert-dialog-response.js +1 -0
- package/dist/nodes/alert-dialog-response.js.map +1 -0
- package/dist/nodes/animation.d.ts +1 -0
- package/dist/nodes/animation.d.ts.map +1 -0
- package/dist/nodes/animation.js +1 -0
- package/dist/nodes/animation.js.map +1 -0
- package/dist/nodes/application.d.ts +1 -0
- package/dist/nodes/application.d.ts.map +1 -0
- package/dist/nodes/application.js +1 -0
- package/dist/nodes/application.js.map +1 -0
- package/dist/nodes/calendar.d.ts +1 -0
- package/dist/nodes/calendar.d.ts.map +1 -0
- package/dist/nodes/calendar.js +1 -0
- package/dist/nodes/calendar.js.map +1 -0
- package/dist/nodes/color-dialog-button.d.ts +1 -0
- package/dist/nodes/color-dialog-button.d.ts.map +1 -0
- package/dist/nodes/color-dialog-button.js +1 -0
- package/dist/nodes/color-dialog-button.js.map +1 -0
- package/dist/nodes/column-view-column.d.ts +1 -0
- package/dist/nodes/column-view-column.d.ts.map +1 -0
- package/dist/nodes/column-view-column.js +1 -0
- package/dist/nodes/column-view-column.js.map +1 -0
- package/dist/nodes/column-view.d.ts +1 -0
- package/dist/nodes/column-view.d.ts.map +1 -0
- package/dist/nodes/column-view.js +1 -0
- package/dist/nodes/column-view.js.map +1 -0
- package/dist/nodes/container-slot.d.ts +1 -0
- package/dist/nodes/container-slot.d.ts.map +1 -0
- package/dist/nodes/container-slot.js +1 -0
- package/dist/nodes/container-slot.js.map +1 -0
- package/dist/nodes/dialog.d.ts +1 -0
- package/dist/nodes/dialog.d.ts.map +1 -0
- package/dist/nodes/dialog.js +1 -0
- package/dist/nodes/dialog.js.map +1 -0
- package/dist/nodes/drawing-area.d.ts +1 -0
- package/dist/nodes/drawing-area.d.ts.map +1 -0
- package/dist/nodes/drawing-area.js +1 -0
- package/dist/nodes/drawing-area.js.map +1 -0
- package/dist/nodes/drop-down.d.ts +1 -0
- package/dist/nodes/drop-down.d.ts.map +1 -0
- package/dist/nodes/drop-down.js +1 -0
- package/dist/nodes/drop-down.js.map +1 -0
- package/dist/nodes/event-controller.d.ts +1 -0
- package/dist/nodes/event-controller.d.ts.map +1 -0
- package/dist/nodes/event-controller.js +1 -0
- package/dist/nodes/event-controller.js.map +1 -0
- package/dist/nodes/fixed-child.d.ts +1 -0
- package/dist/nodes/fixed-child.d.ts.map +1 -0
- package/dist/nodes/fixed-child.js +1 -0
- package/dist/nodes/fixed-child.js.map +1 -0
- package/dist/nodes/font-dialog-button.d.ts +1 -0
- package/dist/nodes/font-dialog-button.d.ts.map +1 -0
- package/dist/nodes/font-dialog-button.js +1 -0
- package/dist/nodes/font-dialog-button.js.map +1 -0
- package/dist/nodes/grid-child.d.ts +1 -0
- package/dist/nodes/grid-child.d.ts.map +1 -0
- package/dist/nodes/grid-child.js +1 -0
- package/dist/nodes/grid-child.js.map +1 -0
- package/dist/nodes/grid-view.d.ts +1 -0
- package/dist/nodes/grid-view.d.ts.map +1 -0
- package/dist/nodes/grid-view.js +1 -0
- package/dist/nodes/grid-view.js.map +1 -0
- package/dist/nodes/internal/base-item-renderer.d.ts +1 -0
- package/dist/nodes/internal/base-item-renderer.d.ts.map +1 -0
- package/dist/nodes/internal/base-item-renderer.js +1 -0
- package/dist/nodes/internal/base-item-renderer.js.map +1 -0
- package/dist/nodes/internal/grid-item-renderer.d.ts +1 -0
- package/dist/nodes/internal/grid-item-renderer.d.ts.map +1 -0
- package/dist/nodes/internal/grid-item-renderer.js +1 -0
- package/dist/nodes/internal/grid-item-renderer.js.map +1 -0
- package/dist/nodes/internal/list-item-renderer.d.ts +1 -0
- package/dist/nodes/internal/list-item-renderer.d.ts.map +1 -0
- package/dist/nodes/internal/list-item-renderer.js +1 -0
- package/dist/nodes/internal/list-item-renderer.js.map +1 -0
- package/dist/nodes/internal/list-store.d.ts +1 -0
- package/dist/nodes/internal/list-store.d.ts.map +1 -0
- package/dist/nodes/internal/list-store.js +1 -0
- package/dist/nodes/internal/list-store.js.map +1 -0
- package/dist/nodes/internal/predicates.d.ts +1 -0
- package/dist/nodes/internal/predicates.d.ts.map +1 -0
- package/dist/nodes/internal/predicates.js +1 -0
- package/dist/nodes/internal/predicates.js.map +1 -0
- package/dist/nodes/internal/props.d.ts +1 -0
- package/dist/nodes/internal/props.d.ts.map +1 -0
- package/dist/nodes/internal/props.js +1 -0
- package/dist/nodes/internal/props.js.map +1 -0
- package/dist/nodes/internal/selection-model-controller.d.ts +1 -0
- package/dist/nodes/internal/selection-model-controller.d.ts.map +1 -0
- package/dist/nodes/internal/selection-model-controller.js +1 -0
- package/dist/nodes/internal/selection-model-controller.js.map +1 -0
- package/dist/nodes/internal/signal-store.d.ts +1 -0
- package/dist/nodes/internal/signal-store.d.ts.map +1 -0
- package/dist/nodes/internal/signal-store.js +1 -0
- package/dist/nodes/internal/signal-store.js.map +1 -0
- package/dist/nodes/internal/simple-list-store.d.ts +1 -0
- package/dist/nodes/internal/simple-list-store.d.ts.map +1 -0
- package/dist/nodes/internal/simple-list-store.js +1 -0
- package/dist/nodes/internal/simple-list-store.js.map +1 -0
- package/dist/nodes/internal/text-buffer-controller.d.ts +1 -0
- package/dist/nodes/internal/text-buffer-controller.d.ts.map +1 -0
- package/dist/nodes/internal/text-buffer-controller.js +1 -0
- package/dist/nodes/internal/text-buffer-controller.js.map +1 -0
- package/dist/nodes/internal/tree-store.d.ts +1 -0
- package/dist/nodes/internal/tree-store.d.ts.map +1 -0
- package/dist/nodes/internal/tree-store.js +1 -0
- package/dist/nodes/internal/tree-store.js.map +1 -0
- package/dist/nodes/internal/widget.d.ts +1 -0
- package/dist/nodes/internal/widget.d.ts.map +1 -0
- package/dist/nodes/internal/widget.js +1 -0
- package/dist/nodes/internal/widget.js.map +1 -0
- package/dist/nodes/level-bar.d.ts +1 -0
- package/dist/nodes/level-bar.d.ts.map +1 -0
- package/dist/nodes/level-bar.js +1 -0
- package/dist/nodes/level-bar.js.map +1 -0
- package/dist/nodes/list-item.d.ts +1 -0
- package/dist/nodes/list-item.d.ts.map +1 -0
- package/dist/nodes/list-item.js +1 -0
- package/dist/nodes/list-item.js.map +1 -0
- package/dist/nodes/list-view.d.ts +1 -0
- package/dist/nodes/list-view.d.ts.map +1 -0
- package/dist/nodes/list-view.js +1 -0
- package/dist/nodes/list-view.js.map +1 -0
- package/dist/nodes/menu.d.ts +1 -0
- package/dist/nodes/menu.d.ts.map +1 -0
- package/dist/nodes/menu.js +1 -0
- package/dist/nodes/menu.js.map +1 -0
- package/dist/nodes/models/grid.d.ts +1 -0
- package/dist/nodes/models/grid.d.ts.map +1 -0
- package/dist/nodes/models/grid.js +1 -0
- package/dist/nodes/models/grid.js.map +1 -0
- package/dist/nodes/models/list.d.ts +1 -0
- package/dist/nodes/models/list.d.ts.map +1 -0
- package/dist/nodes/models/list.js +1 -0
- package/dist/nodes/models/list.js.map +1 -0
- package/dist/nodes/models/menu.d.ts +1 -0
- package/dist/nodes/models/menu.d.ts.map +1 -0
- package/dist/nodes/models/menu.js +1 -0
- package/dist/nodes/models/menu.js.map +1 -0
- package/dist/nodes/navigation-page.d.ts +1 -0
- package/dist/nodes/navigation-page.d.ts.map +1 -0
- package/dist/nodes/navigation-page.js +1 -0
- package/dist/nodes/navigation-page.js.map +1 -0
- package/dist/nodes/navigation-view.d.ts +1 -0
- package/dist/nodes/navigation-view.d.ts.map +1 -0
- package/dist/nodes/navigation-view.js +1 -0
- package/dist/nodes/navigation-view.js.map +1 -0
- package/dist/nodes/notebook-page-tab.d.ts +1 -0
- package/dist/nodes/notebook-page-tab.d.ts.map +1 -0
- package/dist/nodes/notebook-page-tab.js +1 -0
- package/dist/nodes/notebook-page-tab.js.map +1 -0
- package/dist/nodes/notebook-page.d.ts +1 -0
- package/dist/nodes/notebook-page.d.ts.map +1 -0
- package/dist/nodes/notebook-page.js +1 -0
- package/dist/nodes/notebook-page.js.map +1 -0
- package/dist/nodes/notebook.d.ts +1 -0
- package/dist/nodes/notebook.d.ts.map +1 -0
- package/dist/nodes/notebook.js +1 -0
- package/dist/nodes/notebook.js.map +1 -0
- package/dist/nodes/overlay-child.d.ts +1 -0
- package/dist/nodes/overlay-child.d.ts.map +1 -0
- package/dist/nodes/overlay-child.js +1 -0
- package/dist/nodes/overlay-child.js.map +1 -0
- package/dist/nodes/popover-menu.d.ts +1 -0
- package/dist/nodes/popover-menu.d.ts.map +1 -0
- package/dist/nodes/popover-menu.js +1 -0
- package/dist/nodes/popover-menu.js.map +1 -0
- package/dist/nodes/scale.d.ts +1 -0
- package/dist/nodes/scale.d.ts.map +1 -0
- package/dist/nodes/scale.js +1 -0
- package/dist/nodes/scale.js.map +1 -0
- package/dist/nodes/scrolled-window.d.ts +1 -0
- package/dist/nodes/scrolled-window.d.ts.map +1 -0
- package/dist/nodes/scrolled-window.js +1 -0
- package/dist/nodes/scrolled-window.js.map +1 -0
- package/dist/nodes/search-bar.d.ts +1 -0
- package/dist/nodes/search-bar.d.ts.map +1 -0
- package/dist/nodes/search-bar.js +1 -0
- package/dist/nodes/search-bar.js.map +1 -0
- package/dist/nodes/shortcut-controller.d.ts +1 -0
- package/dist/nodes/shortcut-controller.d.ts.map +1 -0
- package/dist/nodes/shortcut-controller.js +1 -0
- package/dist/nodes/shortcut-controller.js.map +1 -0
- package/dist/nodes/shortcut.d.ts +1 -0
- package/dist/nodes/shortcut.d.ts.map +1 -0
- package/dist/nodes/shortcut.js +1 -0
- package/dist/nodes/shortcut.js.map +1 -0
- package/dist/nodes/slot.d.ts +1 -0
- package/dist/nodes/slot.d.ts.map +1 -0
- package/dist/nodes/slot.js +1 -0
- package/dist/nodes/slot.js.map +1 -0
- package/dist/nodes/source-view.d.ts +1 -0
- package/dist/nodes/source-view.d.ts.map +1 -0
- package/dist/nodes/source-view.js +1 -0
- package/dist/nodes/source-view.js.map +1 -0
- package/dist/nodes/stack-page.d.ts +1 -0
- package/dist/nodes/stack-page.d.ts.map +1 -0
- package/dist/nodes/stack-page.js +1 -0
- package/dist/nodes/stack-page.js.map +1 -0
- package/dist/nodes/stack.d.ts +1 -0
- package/dist/nodes/stack.d.ts.map +1 -0
- package/dist/nodes/stack.js +1 -0
- package/dist/nodes/stack.js.map +1 -0
- package/dist/nodes/text-anchor.d.ts +1 -0
- package/dist/nodes/text-anchor.d.ts.map +1 -0
- package/dist/nodes/text-anchor.js +1 -0
- package/dist/nodes/text-anchor.js.map +1 -0
- package/dist/nodes/text-content.d.ts +1 -0
- package/dist/nodes/text-content.d.ts.map +1 -0
- package/dist/nodes/text-content.js +1 -0
- package/dist/nodes/text-content.js.map +1 -0
- package/dist/nodes/text-paintable.d.ts +1 -0
- package/dist/nodes/text-paintable.d.ts.map +1 -0
- package/dist/nodes/text-paintable.js +1 -0
- package/dist/nodes/text-paintable.js.map +1 -0
- package/dist/nodes/text-segment.d.ts +1 -0
- package/dist/nodes/text-segment.d.ts.map +1 -0
- package/dist/nodes/text-segment.js +1 -0
- package/dist/nodes/text-segment.js.map +1 -0
- package/dist/nodes/text-tag.d.ts +1 -0
- package/dist/nodes/text-tag.d.ts.map +1 -0
- package/dist/nodes/text-tag.js +1 -0
- package/dist/nodes/text-tag.js.map +1 -0
- package/dist/nodes/text-view.d.ts +1 -0
- package/dist/nodes/text-view.d.ts.map +1 -0
- package/dist/nodes/text-view.js +1 -0
- package/dist/nodes/text-view.js.map +1 -0
- package/dist/nodes/toggle-group.d.ts +1 -0
- package/dist/nodes/toggle-group.d.ts.map +1 -0
- package/dist/nodes/toggle-group.js +1 -0
- package/dist/nodes/toggle-group.js.map +1 -0
- package/dist/nodes/toggle.d.ts +1 -0
- package/dist/nodes/toggle.d.ts.map +1 -0
- package/dist/nodes/toggle.js +1 -0
- package/dist/nodes/toggle.js.map +1 -0
- package/dist/nodes/virtual.d.ts +1 -0
- package/dist/nodes/virtual.d.ts.map +1 -0
- package/dist/nodes/virtual.js +1 -0
- package/dist/nodes/virtual.js.map +1 -0
- package/dist/nodes/web-view.d.ts +1 -0
- package/dist/nodes/web-view.d.ts.map +1 -0
- package/dist/nodes/web-view.js +1 -0
- package/dist/nodes/web-view.js.map +1 -0
- package/dist/nodes/widget.d.ts +1 -0
- package/dist/nodes/widget.d.ts.map +1 -0
- package/dist/nodes/widget.js +1 -0
- package/dist/nodes/widget.js.map +1 -0
- package/dist/nodes/window.d.ts +1 -0
- package/dist/nodes/window.d.ts.map +1 -0
- package/dist/nodes/window.js +1 -0
- package/dist/nodes/window.js.map +1 -0
- package/dist/portal.d.ts +1 -0
- package/dist/portal.d.ts.map +1 -0
- package/dist/portal.js +1 -0
- package/dist/portal.js.map +1 -0
- package/dist/reconciler.d.ts +1 -0
- package/dist/reconciler.d.ts.map +1 -0
- package/dist/reconciler.js +1 -0
- package/dist/reconciler.js.map +1 -0
- package/dist/registry.d.ts +1 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +1 -0
- package/dist/registry.js.map +1 -0
- package/dist/render.d.ts +1 -0
- package/dist/render.d.ts.map +1 -0
- package/dist/render.js +1 -0
- package/dist/render.js.map +1 -0
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +1 -0
- package/dist/types.js.map +1 -0
- package/package.json +6 -4
- package/src/errors.ts +52 -0
- package/src/factory.ts +62 -0
- package/src/fiber-root.ts +20 -0
- package/src/generated/internal.ts +2134 -0
- package/src/generated/jsx.ts +20068 -0
- package/src/generated/registry.ts +16 -0
- package/src/host-config.ts +186 -0
- package/src/index.ts +11 -0
- package/src/jsx.ts +1294 -0
- package/src/metadata.ts +36 -0
- package/src/node.ts +109 -0
- package/src/nodes/adjustable.ts +68 -0
- package/src/nodes/alert-dialog-response.ts +78 -0
- package/src/nodes/animation.ts +402 -0
- package/src/nodes/application.ts +56 -0
- package/src/nodes/calendar.ts +38 -0
- package/src/nodes/color-dialog-button.ts +69 -0
- package/src/nodes/column-view-column.ts +84 -0
- package/src/nodes/column-view.ts +192 -0
- package/src/nodes/container-slot.ts +87 -0
- package/src/nodes/dialog.ts +25 -0
- package/src/nodes/drawing-area.ts +51 -0
- package/src/nodes/drop-down.ts +92 -0
- package/src/nodes/event-controller.ts +100 -0
- package/src/nodes/fixed-child.ts +108 -0
- package/src/nodes/font-dialog-button.ts +97 -0
- package/src/nodes/grid-child.ts +103 -0
- package/src/nodes/grid-view.ts +96 -0
- package/src/nodes/internal/base-item-renderer.ts +108 -0
- package/src/nodes/internal/grid-item-renderer.ts +71 -0
- package/src/nodes/internal/list-item-renderer.ts +155 -0
- package/src/nodes/internal/list-store.ts +105 -0
- package/src/nodes/internal/predicates.ts +80 -0
- package/src/nodes/internal/props.ts +51 -0
- package/src/nodes/internal/selection-model-controller.ts +115 -0
- package/src/nodes/internal/signal-store.ts +141 -0
- package/src/nodes/internal/simple-list-store.ts +99 -0
- package/src/nodes/internal/text-buffer-controller.ts +374 -0
- package/src/nodes/internal/tree-store.ts +237 -0
- package/src/nodes/internal/widget.ts +78 -0
- package/src/nodes/level-bar.ts +36 -0
- package/src/nodes/list-item.ts +107 -0
- package/src/nodes/list-view.ts +97 -0
- package/src/nodes/menu.ts +27 -0
- package/src/nodes/models/grid.ts +105 -0
- package/src/nodes/models/list.ts +140 -0
- package/src/nodes/models/menu.ts +310 -0
- package/src/nodes/navigation-page.ts +154 -0
- package/src/nodes/navigation-view.ts +58 -0
- package/src/nodes/notebook-page-tab.ts +55 -0
- package/src/nodes/notebook-page.ts +185 -0
- package/src/nodes/notebook.ts +28 -0
- package/src/nodes/overlay-child.ts +109 -0
- package/src/nodes/popover-menu.ts +59 -0
- package/src/nodes/scale.ts +28 -0
- package/src/nodes/scrolled-window.ts +23 -0
- package/src/nodes/search-bar.ts +27 -0
- package/src/nodes/shortcut-controller.ts +27 -0
- package/src/nodes/shortcut.ts +69 -0
- package/src/nodes/slot.ts +138 -0
- package/src/nodes/source-view.ts +130 -0
- package/src/nodes/stack-page.ts +170 -0
- package/src/nodes/stack.ts +35 -0
- package/src/nodes/text-anchor.ts +74 -0
- package/src/nodes/text-content.ts +14 -0
- package/src/nodes/text-paintable.ts +51 -0
- package/src/nodes/text-segment.ts +55 -0
- package/src/nodes/text-tag.ts +287 -0
- package/src/nodes/text-view.ts +93 -0
- package/src/nodes/toggle-group.ts +27 -0
- package/src/nodes/toggle.ts +72 -0
- package/src/nodes/virtual.ts +16 -0
- package/src/nodes/web-view.ts +22 -0
- package/src/nodes/widget.ts +398 -0
- package/src/nodes/window.ts +159 -0
- package/src/portal.ts +37 -0
- package/src/reconciler.ts +52 -0
- package/src/registry.ts +123 -0
- package/src/render.tsx +192 -0
- package/src/types.ts +7 -0
package/src/jsx.ts
ADDED
|
@@ -0,0 +1,1294 @@
|
|
|
1
|
+
import type * as Adw from "@gtkx/ffi/adw";
|
|
2
|
+
import type * as cairo from "@gtkx/ffi/cairo";
|
|
3
|
+
import type * as Gdk from "@gtkx/ffi/gdk";
|
|
4
|
+
import type * as Gsk from "@gtkx/ffi/gsk";
|
|
5
|
+
import type * as Gtk from "@gtkx/ffi/gtk";
|
|
6
|
+
import type * as GtkSource from "@gtkx/ffi/gtksource";
|
|
7
|
+
import type * as Pango from "@gtkx/ffi/pango";
|
|
8
|
+
import type { ReactElement, ReactNode } from "react";
|
|
9
|
+
import { createElement } from "react";
|
|
10
|
+
import type { WidgetSlotNames } from "./generated/jsx.js";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* CSS properties that can be animated on a widget.
|
|
14
|
+
*
|
|
15
|
+
* All transforms are applied via GTK CSS and rendered through the widget's style context.
|
|
16
|
+
*/
|
|
17
|
+
export type AnimatableProperties = {
|
|
18
|
+
/** Opacity from 0 (fully transparent) to 1 (fully opaque) */
|
|
19
|
+
opacity?: number;
|
|
20
|
+
/** Horizontal translation in pixels (positive moves right) */
|
|
21
|
+
translateX?: number;
|
|
22
|
+
/** Vertical translation in pixels (positive moves down) */
|
|
23
|
+
translateY?: number;
|
|
24
|
+
/** Uniform scale factor (1 = original size, 2 = double size) */
|
|
25
|
+
scale?: number;
|
|
26
|
+
/** Horizontal scale factor */
|
|
27
|
+
scaleX?: number;
|
|
28
|
+
/** Vertical scale factor */
|
|
29
|
+
scaleY?: number;
|
|
30
|
+
/** Rotation angle in degrees (positive rotates clockwise) */
|
|
31
|
+
rotate?: number;
|
|
32
|
+
/** Horizontal skew angle in degrees */
|
|
33
|
+
skewX?: number;
|
|
34
|
+
/** Vertical skew angle in degrees */
|
|
35
|
+
skewY?: number;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Transition configuration for timed (duration-based) animations.
|
|
40
|
+
*
|
|
41
|
+
* @see {@link https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.TimedAnimation.html Adw.TimedAnimation}
|
|
42
|
+
*/
|
|
43
|
+
export type TimedTransition = {
|
|
44
|
+
/** Discriminant: duration-based animation with easing curves */
|
|
45
|
+
mode: "timed";
|
|
46
|
+
/** Animation duration in milliseconds (default: 300) */
|
|
47
|
+
duration?: number;
|
|
48
|
+
/** Easing function for the animation curve (default: EASE_OUT_CUBIC) */
|
|
49
|
+
easing?: Adw.Easing;
|
|
50
|
+
/** Delay before starting the animation in milliseconds */
|
|
51
|
+
delay?: number;
|
|
52
|
+
/** Number of times to repeat the animation (0 = no repeat, -1 = infinite) */
|
|
53
|
+
repeat?: number;
|
|
54
|
+
/** Whether to play the animation in reverse */
|
|
55
|
+
reverse?: boolean;
|
|
56
|
+
/** Whether to alternate direction on each repeat */
|
|
57
|
+
alternate?: boolean;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Transition configuration for spring (physics-based) animations.
|
|
62
|
+
*
|
|
63
|
+
* Spring animations simulate a mass attached to a spring, providing natural-feeling motion.
|
|
64
|
+
* The animation settles when the spring reaches equilibrium.
|
|
65
|
+
*
|
|
66
|
+
* @see {@link https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.SpringAnimation.html Adw.SpringAnimation}
|
|
67
|
+
*/
|
|
68
|
+
export type SpringTransition = {
|
|
69
|
+
/** Discriminant: physics-based spring animation */
|
|
70
|
+
mode: "spring";
|
|
71
|
+
/** Damping ratio controlling oscillation decay (default: 1, critically damped) */
|
|
72
|
+
damping?: number;
|
|
73
|
+
/** Spring stiffness in N/m affecting animation speed (default: 100) */
|
|
74
|
+
stiffness?: number;
|
|
75
|
+
/** Virtual mass in kg affecting momentum (default: 1) */
|
|
76
|
+
mass?: number;
|
|
77
|
+
/** Initial velocity to apply at animation start */
|
|
78
|
+
initialVelocity?: number;
|
|
79
|
+
/** Whether to clamp the animation value to prevent overshooting */
|
|
80
|
+
clamp?: boolean;
|
|
81
|
+
/** Delay before starting the animation in milliseconds */
|
|
82
|
+
delay?: number;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Discriminated union of all transition configurations.
|
|
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})
|
|
91
|
+
*/
|
|
92
|
+
export type AnimationTransition = TimedTransition | SpringTransition;
|
|
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
|
+
};
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Props for the Shortcut virtual element.
|
|
134
|
+
*
|
|
135
|
+
* Defines a keyboard shortcut. Must be a child of `x.ShortcutController`.
|
|
136
|
+
*
|
|
137
|
+
* @example
|
|
138
|
+
* ```tsx
|
|
139
|
+
* <x.ShortcutController>
|
|
140
|
+
* <x.Shortcut trigger="<Control>s" onActivate={save} />
|
|
141
|
+
* <x.Shortcut trigger={["F5", "<Control>r"]} onActivate={refresh} />
|
|
142
|
+
* <x.Shortcut trigger="Escape" onActivate={cancel} disabled={!canCancel} />
|
|
143
|
+
* </x.ShortcutController>
|
|
144
|
+
* ```
|
|
145
|
+
*/
|
|
146
|
+
export type ShortcutProps = {
|
|
147
|
+
/** The trigger string(s) using GTK accelerator format (e.g., "\<Control\>s", "F1") */
|
|
148
|
+
trigger: string | string[];
|
|
149
|
+
/**
|
|
150
|
+
* Called when the shortcut is activated.
|
|
151
|
+
* Return false to indicate the shortcut was not handled; otherwise it is considered handled.
|
|
152
|
+
*/
|
|
153
|
+
// biome-ignore lint/suspicious/noConfusingVoidType: void is intentional to allow callbacks that don't return a value
|
|
154
|
+
onActivate: () => boolean | void;
|
|
155
|
+
/** Whether the shortcut is disabled */
|
|
156
|
+
disabled?: boolean;
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Props for the TextAnchor virtual element.
|
|
161
|
+
*
|
|
162
|
+
* Used to declaratively embed widgets within text content in a TextBuffer.
|
|
163
|
+
* The anchor is placed at the current position in the text flow.
|
|
164
|
+
*
|
|
165
|
+
* @example
|
|
166
|
+
* ```tsx
|
|
167
|
+
* <GtkTextView>
|
|
168
|
+
* <x.TextBuffer>
|
|
169
|
+
* Click here: <x.TextAnchor>
|
|
170
|
+
* <GtkButton label="Click me" />
|
|
171
|
+
* </x.TextAnchor> to continue.
|
|
172
|
+
* </x.TextBuffer>
|
|
173
|
+
* </GtkTextView>
|
|
174
|
+
* ```
|
|
175
|
+
*/
|
|
176
|
+
export type TextAnchorProps = {
|
|
177
|
+
/** The widget to embed at this anchor position */
|
|
178
|
+
children?: ReactNode;
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Props for the TextPaintable virtual element.
|
|
183
|
+
*
|
|
184
|
+
* Used to embed inline images or icons within text content in a GtkTextView.
|
|
185
|
+
*/
|
|
186
|
+
export type TextPaintableProps = {
|
|
187
|
+
/** The paintable (image, icon, etc.) to embed inline with the text */
|
|
188
|
+
paintable: Gdk.Paintable;
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Props for the TextTag virtual element.
|
|
193
|
+
*
|
|
194
|
+
* Used to declaratively define and apply text formatting to content within a TextBuffer.
|
|
195
|
+
*
|
|
196
|
+
* @example
|
|
197
|
+
* ```tsx
|
|
198
|
+
* <GtkTextView>
|
|
199
|
+
* <x.TextBuffer>
|
|
200
|
+
* Hello <x.TextTag id="bold" weight={Pango.Weight.BOLD}>bold</x.TextTag> world
|
|
201
|
+
* </x.TextBuffer>
|
|
202
|
+
* </GtkTextView>
|
|
203
|
+
* ```
|
|
204
|
+
*/
|
|
205
|
+
export type TextTagProps = {
|
|
206
|
+
/** Unique identifier for this tag in the tag table */
|
|
207
|
+
id: string;
|
|
208
|
+
/** Priority of this tag (higher wins when multiple tags affect same property) */
|
|
209
|
+
priority?: number;
|
|
210
|
+
/** Background color as a string (e.g., "red", "#ff0000") */
|
|
211
|
+
background?: string;
|
|
212
|
+
/** Whether the background fills the entire line height */
|
|
213
|
+
backgroundFullHeight?: boolean;
|
|
214
|
+
/** Foreground (text) color as a string */
|
|
215
|
+
foreground?: string;
|
|
216
|
+
/** Font family name (e.g., "Sans", "Monospace") */
|
|
217
|
+
family?: string;
|
|
218
|
+
/** Font description string (e.g., "Sans Italic 12") */
|
|
219
|
+
font?: string;
|
|
220
|
+
/** Font size in points */
|
|
221
|
+
sizePoints?: number;
|
|
222
|
+
/** Font size in Pango units */
|
|
223
|
+
size?: number;
|
|
224
|
+
/** Font size scale factor relative to default */
|
|
225
|
+
scale?: number;
|
|
226
|
+
/** Font weight (use Pango.Weight constants) */
|
|
227
|
+
weight?: Pango.Weight | number;
|
|
228
|
+
/** Font style (use Pango.Style constants) */
|
|
229
|
+
style?: Pango.Style;
|
|
230
|
+
/** Font stretch (use Pango.Stretch constants) */
|
|
231
|
+
stretch?: Pango.Stretch;
|
|
232
|
+
/** Font variant (use Pango.Variant constants) */
|
|
233
|
+
variant?: Pango.Variant;
|
|
234
|
+
/** Whether to strike through the text */
|
|
235
|
+
strikethrough?: boolean;
|
|
236
|
+
/** Underline style (use Pango.Underline constants) */
|
|
237
|
+
underline?: Pango.Underline;
|
|
238
|
+
/** Overline style (use Pango.Overline constants) */
|
|
239
|
+
overline?: Pango.Overline;
|
|
240
|
+
/** Offset of text above baseline in Pango units (negative = below) */
|
|
241
|
+
rise?: number;
|
|
242
|
+
/** Extra spacing between characters in Pango units */
|
|
243
|
+
letterSpacing?: number;
|
|
244
|
+
/** Factor to scale line height by */
|
|
245
|
+
lineHeight?: number;
|
|
246
|
+
/** Left margin in pixels */
|
|
247
|
+
leftMargin?: number;
|
|
248
|
+
/** Right margin in pixels */
|
|
249
|
+
rightMargin?: number;
|
|
250
|
+
/** Paragraph indent in pixels (negative = hanging) */
|
|
251
|
+
indent?: number;
|
|
252
|
+
/** Pixels of blank space above paragraphs */
|
|
253
|
+
pixelsAboveLines?: number;
|
|
254
|
+
/** Pixels of blank space below paragraphs */
|
|
255
|
+
pixelsBelowLines?: number;
|
|
256
|
+
/** Pixels of blank space between wrapped lines */
|
|
257
|
+
pixelsInsideWrap?: number;
|
|
258
|
+
/** Text justification */
|
|
259
|
+
justification?: Gtk.Justification;
|
|
260
|
+
/** Text direction */
|
|
261
|
+
direction?: Gtk.TextDirection;
|
|
262
|
+
/** Wrap mode for line breaks */
|
|
263
|
+
wrapMode?: Gtk.WrapMode;
|
|
264
|
+
/** Whether the text can be modified */
|
|
265
|
+
editable?: boolean;
|
|
266
|
+
/** Whether the text is invisible/hidden */
|
|
267
|
+
invisible?: boolean;
|
|
268
|
+
/** Whether breaks are allowed */
|
|
269
|
+
allowBreaks?: boolean;
|
|
270
|
+
/** Whether to insert hyphens at breaks */
|
|
271
|
+
insertHyphens?: boolean;
|
|
272
|
+
/** Whether font fallback is enabled */
|
|
273
|
+
fallback?: boolean;
|
|
274
|
+
/** Whether margins accumulate */
|
|
275
|
+
accumulativeMargin?: boolean;
|
|
276
|
+
/** Paragraph background color as a string */
|
|
277
|
+
paragraphBackground?: string;
|
|
278
|
+
/** How to render invisible characters */
|
|
279
|
+
showSpaces?: Pango.ShowFlags;
|
|
280
|
+
/** How to transform text for display */
|
|
281
|
+
textTransform?: Pango.TextTransform;
|
|
282
|
+
/** OpenType font features as a string */
|
|
283
|
+
fontFeatures?: string;
|
|
284
|
+
/** Language code (e.g., "en-US") */
|
|
285
|
+
language?: string;
|
|
286
|
+
/** Text content and nested TextTag children */
|
|
287
|
+
children?: ReactNode;
|
|
288
|
+
};
|
|
289
|
+
|
|
290
|
+
/** Props for the TextSegment virtual element.
|
|
291
|
+
*
|
|
292
|
+
* Represents a segment of text within a TextBuffer.
|
|
293
|
+
*/
|
|
294
|
+
export type TextSegmentProps = {
|
|
295
|
+
/** The text content of this segment */
|
|
296
|
+
text: string;
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Configuration for a mark on a GtkScale widget.
|
|
301
|
+
*
|
|
302
|
+
* Marks are visual indicators placed along the scale at specific values,
|
|
303
|
+
* optionally with text labels.
|
|
304
|
+
*
|
|
305
|
+
* @see {@link https://docs.gtk.org/gtk4/method.Scale.add_mark.html GtkScale.add_mark}
|
|
306
|
+
*/
|
|
307
|
+
export type ScaleMark = {
|
|
308
|
+
/** The value at which to place the mark */
|
|
309
|
+
value: number;
|
|
310
|
+
/** Position of the mark relative to the scale (default: BOTTOM) */
|
|
311
|
+
position?: Gtk.PositionType;
|
|
312
|
+
/** Optional text label to display at the mark */
|
|
313
|
+
label?: string | null;
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* Configuration for an offset threshold on a GtkLevelBar widget.
|
|
318
|
+
*
|
|
319
|
+
* Offsets define named value thresholds that change the bar's appearance
|
|
320
|
+
* (e.g., "low", "high", "full"). Built-in offsets include GTK_LEVEL_BAR_OFFSET_LOW,
|
|
321
|
+
* GTK_LEVEL_BAR_OFFSET_HIGH, and GTK_LEVEL_BAR_OFFSET_FULL.
|
|
322
|
+
*
|
|
323
|
+
* @see {@link https://docs.gtk.org/gtk4/method.LevelBar.add_offset_value.html GtkLevelBar.add_offset_value}
|
|
324
|
+
*/
|
|
325
|
+
export type LevelBarOffset = {
|
|
326
|
+
/** Unique identifier for this offset (e.g., "low", "high", "full") */
|
|
327
|
+
id: string;
|
|
328
|
+
/** The threshold value at which this offset applies */
|
|
329
|
+
value: number;
|
|
330
|
+
};
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* Props for slot-based child positioning.
|
|
334
|
+
*
|
|
335
|
+
* @see {@link Slot} for type-safe slot usage
|
|
336
|
+
*/
|
|
337
|
+
export type SlotProps = {
|
|
338
|
+
/** The slot identifier */
|
|
339
|
+
id?: string;
|
|
340
|
+
/** Content to place in the slot */
|
|
341
|
+
children?: ReactNode;
|
|
342
|
+
};
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* Type mapping widgets to their valid container slot method names.
|
|
346
|
+
*
|
|
347
|
+
* Each key is a JSX element name and each value is a union of method names
|
|
348
|
+
* that can be used as the `id` prop on `x.ContainerSlot`.
|
|
349
|
+
*/
|
|
350
|
+
export type ContainerSlotNames = {
|
|
351
|
+
AdwActionRow: "addPrefix" | "addSuffix";
|
|
352
|
+
AdwEntryRow: "addPrefix" | "addSuffix";
|
|
353
|
+
AdwExpanderRow: "addPrefix" | "addSuffix" | "addRow" | "addAction";
|
|
354
|
+
AdwHeaderBar: "packStart" | "packEnd";
|
|
355
|
+
AdwToolbarView: "addTopBar" | "addBottomBar";
|
|
356
|
+
GtkActionBar: "packStart" | "packEnd";
|
|
357
|
+
GtkHeaderBar: "packStart" | "packEnd";
|
|
358
|
+
};
|
|
359
|
+
|
|
360
|
+
/**
|
|
361
|
+
* Props for method-based container slot child positioning.
|
|
362
|
+
*
|
|
363
|
+
* @see {@link x.ContainerSlot} for type-safe usage
|
|
364
|
+
*/
|
|
365
|
+
export type ContainerSlotProps = {
|
|
366
|
+
/** The method name to call on the parent widget */
|
|
367
|
+
id: string;
|
|
368
|
+
/** Content to place in the container slot */
|
|
369
|
+
children?: ReactNode;
|
|
370
|
+
};
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* Props for items in a GtkListView, GtkGridView, or GtkColumnView.
|
|
374
|
+
*
|
|
375
|
+
* When used inside a GtkListView, items can be nested to create tree hierarchies.
|
|
376
|
+
* Tree-specific props (`indentForDepth`, `indentForIcon`, `hideExpander`) only
|
|
377
|
+
* apply when items are used inside a GtkListView with nested children.
|
|
378
|
+
*
|
|
379
|
+
* @typeParam T - The type of data associated with this list item
|
|
380
|
+
*/
|
|
381
|
+
export type ListItemProps<T = unknown> = {
|
|
382
|
+
/** Unique identifier for this item */
|
|
383
|
+
id: string;
|
|
384
|
+
/** The data value for this item */
|
|
385
|
+
value: T;
|
|
386
|
+
/** Whether to indent based on tree depth (default: true) */
|
|
387
|
+
indentForDepth?: boolean;
|
|
388
|
+
/** Whether to indent for expander icon width */
|
|
389
|
+
indentForIcon?: boolean;
|
|
390
|
+
/** Whether to hide the expand/collapse arrow */
|
|
391
|
+
hideExpander?: boolean;
|
|
392
|
+
/** Nested list items (children of this item in a tree) */
|
|
393
|
+
children?: ReactNode;
|
|
394
|
+
};
|
|
395
|
+
|
|
396
|
+
/**
|
|
397
|
+
* Props for positioning children within a GtkGrid.
|
|
398
|
+
*
|
|
399
|
+
* @see {@link GridChild} for usage
|
|
400
|
+
*/
|
|
401
|
+
export type GridChildProps = {
|
|
402
|
+
/** Content to place in the grid cell */
|
|
403
|
+
children?: ReactNode;
|
|
404
|
+
/** Column index (0-based) */
|
|
405
|
+
column?: number;
|
|
406
|
+
/** Row index (0-based) */
|
|
407
|
+
row?: number;
|
|
408
|
+
/** Number of columns to span */
|
|
409
|
+
columnSpan?: number;
|
|
410
|
+
/** Number of rows to span */
|
|
411
|
+
rowSpan?: number;
|
|
412
|
+
};
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* Props for positioning children within a GtkFixed.
|
|
416
|
+
*
|
|
417
|
+
* @see {@link FixedChild} for usage
|
|
418
|
+
*/
|
|
419
|
+
export type FixedChildProps = {
|
|
420
|
+
/** Content to place in the fixed container */
|
|
421
|
+
children?: ReactNode;
|
|
422
|
+
/** X coordinate in pixels */
|
|
423
|
+
x?: number;
|
|
424
|
+
/** Y coordinate in pixels */
|
|
425
|
+
y?: number;
|
|
426
|
+
/** 3D transform to apply to the child (perspective, rotation, etc.) */
|
|
427
|
+
transform?: Gsk.Transform;
|
|
428
|
+
};
|
|
429
|
+
|
|
430
|
+
/**
|
|
431
|
+
* Props for defining a column in a ColumnView (table).
|
|
432
|
+
*
|
|
433
|
+
* @typeParam T - The type of data for each row
|
|
434
|
+
*
|
|
435
|
+
* @see {@link ColumnViewColumn} for usage
|
|
436
|
+
*/
|
|
437
|
+
export type ColumnViewColumnProps<T = unknown> = {
|
|
438
|
+
/** Column header text */
|
|
439
|
+
title: string;
|
|
440
|
+
/** Whether the column expands to fill available space */
|
|
441
|
+
expand?: boolean;
|
|
442
|
+
/** Whether the column can be resized by the user */
|
|
443
|
+
resizable?: boolean;
|
|
444
|
+
/** Fixed width in pixels */
|
|
445
|
+
fixedWidth?: number;
|
|
446
|
+
/** Unique identifier for this column */
|
|
447
|
+
id: string;
|
|
448
|
+
/** Whether clicking the header sorts by this column */
|
|
449
|
+
sortable?: boolean;
|
|
450
|
+
/** Function to render the cell content for each row */
|
|
451
|
+
renderCell: (item: T | null) => ReactNode;
|
|
452
|
+
};
|
|
453
|
+
|
|
454
|
+
/**
|
|
455
|
+
* Props for notebook (tabbed) pages.
|
|
456
|
+
*/
|
|
457
|
+
export type NotebookPageProps = {
|
|
458
|
+
/** Content to place in the notebook page */
|
|
459
|
+
children?: ReactNode;
|
|
460
|
+
/** Tab label text (optional when using Notebook.PageTab) */
|
|
461
|
+
label?: string;
|
|
462
|
+
/** Whether the tab should expand to fill available space */
|
|
463
|
+
tabExpand?: boolean;
|
|
464
|
+
/** Whether the tab should fill its allocated space */
|
|
465
|
+
tabFill?: boolean;
|
|
466
|
+
};
|
|
467
|
+
|
|
468
|
+
/**
|
|
469
|
+
* Props for custom notebook page tab widgets.
|
|
470
|
+
*/
|
|
471
|
+
export type NotebookPageTabProps = {
|
|
472
|
+
/** Content to place in the notebook page tab */
|
|
473
|
+
children?: ReactNode;
|
|
474
|
+
};
|
|
475
|
+
|
|
476
|
+
/**
|
|
477
|
+
* Props for pages within a Stack or ViewStack.
|
|
478
|
+
*
|
|
479
|
+
* @see {@link StackPage} for usage
|
|
480
|
+
*/
|
|
481
|
+
export type StackPageProps = {
|
|
482
|
+
/** Content to place in the stack page */
|
|
483
|
+
children?: ReactNode;
|
|
484
|
+
/** Unique identifier for this page (used with page prop) */
|
|
485
|
+
id?: string;
|
|
486
|
+
/** Display title shown in stack switchers */
|
|
487
|
+
title?: string;
|
|
488
|
+
/** Icon name from the icon theme */
|
|
489
|
+
iconName?: string;
|
|
490
|
+
/** Whether to show an attention indicator */
|
|
491
|
+
needsAttention?: boolean;
|
|
492
|
+
/** Whether this page is visible in switchers */
|
|
493
|
+
visible?: boolean;
|
|
494
|
+
/** Whether underscores in title indicate mnemonics */
|
|
495
|
+
useUnderline?: boolean;
|
|
496
|
+
/** Badge number shown on the page indicator */
|
|
497
|
+
badgeNumber?: number;
|
|
498
|
+
};
|
|
499
|
+
|
|
500
|
+
/**
|
|
501
|
+
* Props for menu items.
|
|
502
|
+
*
|
|
503
|
+
* @see {@link Menu} for building menus
|
|
504
|
+
*/
|
|
505
|
+
export type MenuItemProps = {
|
|
506
|
+
/** Unique identifier for this menu item */
|
|
507
|
+
id: string;
|
|
508
|
+
/** Display label */
|
|
509
|
+
label: string;
|
|
510
|
+
/** Callback when the item is activated */
|
|
511
|
+
onActivate: () => void;
|
|
512
|
+
/** Keyboard accelerator(s) (e.g., "\<Control\>q") */
|
|
513
|
+
accels?: string | string[];
|
|
514
|
+
};
|
|
515
|
+
|
|
516
|
+
/**
|
|
517
|
+
* Props for menu sections.
|
|
518
|
+
*
|
|
519
|
+
* Sections group related menu items with optional labels.
|
|
520
|
+
*/
|
|
521
|
+
export type MenuSectionProps = {
|
|
522
|
+
/** Optional section header label */
|
|
523
|
+
label?: string;
|
|
524
|
+
/** Menu items in this section */
|
|
525
|
+
children?: ReactNode;
|
|
526
|
+
};
|
|
527
|
+
|
|
528
|
+
/**
|
|
529
|
+
* Props for submenus.
|
|
530
|
+
*/
|
|
531
|
+
export type MenuSubmenuProps = {
|
|
532
|
+
/** Submenu label */
|
|
533
|
+
label: string;
|
|
534
|
+
/** Menu items in this submenu */
|
|
535
|
+
children?: ReactNode;
|
|
536
|
+
};
|
|
537
|
+
|
|
538
|
+
/**
|
|
539
|
+
* Props for children within an Overlay container.
|
|
540
|
+
*/
|
|
541
|
+
export type OverlayChildProps = {
|
|
542
|
+
/** Content to place in the overlay child */
|
|
543
|
+
children?: ReactNode;
|
|
544
|
+
/** Whether to include this child in size measurement */
|
|
545
|
+
measure?: boolean;
|
|
546
|
+
/** Whether to clip this overlay child to the main child bounds */
|
|
547
|
+
clipOverlay?: boolean;
|
|
548
|
+
};
|
|
549
|
+
|
|
550
|
+
/**
|
|
551
|
+
* Props for the Toggle virtual element.
|
|
552
|
+
*
|
|
553
|
+
* Used to declaratively add toggles to an AdwToggleGroup.
|
|
554
|
+
*
|
|
555
|
+
* @example
|
|
556
|
+
* ```tsx
|
|
557
|
+
* <AdwToggleGroup>
|
|
558
|
+
* <x.Toggle id="view-list" iconName="view-list-symbolic" />
|
|
559
|
+
* <x.Toggle id="view-grid" iconName="view-grid-symbolic" />
|
|
560
|
+
* <x.Toggle id="view-flow" label="Flow" />
|
|
561
|
+
* </AdwToggleGroup>
|
|
562
|
+
* ```
|
|
563
|
+
*/
|
|
564
|
+
export type ToggleProps = {
|
|
565
|
+
/** Optional identifier for accessing toggle by id instead of index */
|
|
566
|
+
id?: string | null;
|
|
567
|
+
/** Label text to display */
|
|
568
|
+
label?: string | null;
|
|
569
|
+
/** Icon name to display */
|
|
570
|
+
iconName?: string | null;
|
|
571
|
+
/** Tooltip text (supports Pango markup) */
|
|
572
|
+
tooltip?: string;
|
|
573
|
+
/** Whether the toggle is enabled */
|
|
574
|
+
enabled?: boolean;
|
|
575
|
+
/** Whether underline in label indicates mnemonic */
|
|
576
|
+
useUnderline?: boolean;
|
|
577
|
+
};
|
|
578
|
+
|
|
579
|
+
/**
|
|
580
|
+
* Props for response buttons in an AdwAlertDialog.
|
|
581
|
+
*
|
|
582
|
+
* Each response represents a button the user can click to dismiss the dialog.
|
|
583
|
+
*
|
|
584
|
+
* @see {@link x.AlertDialogResponse} for usage
|
|
585
|
+
*/
|
|
586
|
+
export type AlertDialogResponseProps = {
|
|
587
|
+
/** Unique response ID (used in response signal and for default/close response) */
|
|
588
|
+
id: string;
|
|
589
|
+
/** Button label text */
|
|
590
|
+
label: string;
|
|
591
|
+
/** Visual appearance of the response button */
|
|
592
|
+
appearance?: Adw.ResponseAppearance;
|
|
593
|
+
/** Whether the response button is enabled */
|
|
594
|
+
enabled?: boolean;
|
|
595
|
+
};
|
|
596
|
+
|
|
597
|
+
type NavigationPageBaseProps = {
|
|
598
|
+
/** Display title for the navigation page */
|
|
599
|
+
title?: string;
|
|
600
|
+
/** Whether the page can be popped from the navigation stack */
|
|
601
|
+
canPop?: boolean;
|
|
602
|
+
/** Page content */
|
|
603
|
+
children?: ReactNode;
|
|
604
|
+
};
|
|
605
|
+
|
|
606
|
+
/**
|
|
607
|
+
* Props for the NavigationPage virtual element with type-safe targeting.
|
|
608
|
+
*
|
|
609
|
+
* The `for` prop is required and determines valid `id` values:
|
|
610
|
+
* - `AdwNavigationView`: `id` can be any string (page tags for navigation history)
|
|
611
|
+
* - `AdwNavigationSplitView`: `id` is narrowed to `"content" | "sidebar"` (slot positions)
|
|
612
|
+
*
|
|
613
|
+
* @example
|
|
614
|
+
* ```tsx
|
|
615
|
+
* // In NavigationView - id can be any string
|
|
616
|
+
* <AdwNavigationView history={["home", "details"]}>
|
|
617
|
+
* <x.NavigationPage for={AdwNavigationView} id="home" title="Home">
|
|
618
|
+
* <HomeContent />
|
|
619
|
+
* </x.NavigationPage>
|
|
620
|
+
* </AdwNavigationView>
|
|
621
|
+
*
|
|
622
|
+
* // In NavigationSplitView - id is narrowed to "content" | "sidebar"
|
|
623
|
+
* <AdwNavigationSplitView>
|
|
624
|
+
* <x.NavigationPage for={AdwNavigationSplitView} id="sidebar" title="Sidebar">
|
|
625
|
+
* <SidebarContent />
|
|
626
|
+
* </x.NavigationPage>
|
|
627
|
+
* <x.NavigationPage for={AdwNavigationSplitView} id="content" title="Content">
|
|
628
|
+
* <MainContent />
|
|
629
|
+
* </x.NavigationPage>
|
|
630
|
+
* </AdwNavigationSplitView>
|
|
631
|
+
* ```
|
|
632
|
+
*/
|
|
633
|
+
export type NavigationPageProps =
|
|
634
|
+
| (NavigationPageBaseProps & { for: "AdwNavigationView"; id: string })
|
|
635
|
+
| (NavigationPageBaseProps & {
|
|
636
|
+
for: "AdwNavigationSplitView";
|
|
637
|
+
id: WidgetSlotNames["AdwNavigationSplitView"];
|
|
638
|
+
});
|
|
639
|
+
|
|
640
|
+
/**
|
|
641
|
+
* Props shared by text buffer hosts (GtkTextView, GtkSourceView).
|
|
642
|
+
*
|
|
643
|
+
* Provides undo control and buffer mutation callbacks.
|
|
644
|
+
*/
|
|
645
|
+
export type TextBufferProps = {
|
|
646
|
+
/** Whether undo/redo is enabled on the text buffer */
|
|
647
|
+
enableUndo?: boolean;
|
|
648
|
+
/** Callback fired when the buffer content changes */
|
|
649
|
+
onBufferChanged?: ((buffer: Gtk.TextBuffer) => void) | null;
|
|
650
|
+
/** Callback fired when text is inserted into the buffer */
|
|
651
|
+
onTextInserted?: ((buffer: Gtk.TextBuffer, offset: number, text: string) => void) | null;
|
|
652
|
+
/** Callback fired when text is deleted from the buffer */
|
|
653
|
+
onTextDeleted?: ((buffer: Gtk.TextBuffer, startOffset: number, endOffset: number) => void) | null;
|
|
654
|
+
/** Callback fired when the undo availability changes */
|
|
655
|
+
onCanUndoChanged?: ((canUndo: boolean) => void) | null;
|
|
656
|
+
/** Callback fired when the redo availability changes */
|
|
657
|
+
onCanRedoChanged?: ((canRedo: boolean) => void) | null;
|
|
658
|
+
};
|
|
659
|
+
|
|
660
|
+
type BaseListViewProps = {
|
|
661
|
+
/** Estimated item height in pixels for virtualization */
|
|
662
|
+
estimatedItemHeight?: number;
|
|
663
|
+
/** Array of selected item IDs */
|
|
664
|
+
selected?: string[] | null;
|
|
665
|
+
/** Callback fired when the selection changes */
|
|
666
|
+
onSelectionChanged?: ((ids: string[]) => void) | null;
|
|
667
|
+
/** Selection behavior (single, multiple, none, etc.) */
|
|
668
|
+
selectionMode?: Gtk.SelectionMode | null;
|
|
669
|
+
};
|
|
670
|
+
|
|
671
|
+
export type ListViewProps = BaseListViewProps & {
|
|
672
|
+
/** Function to render each list item. The `row` parameter provides tree state for hierarchical lists. */
|
|
673
|
+
// biome-ignore lint/suspicious/noExplicitAny: contravariant parameter requires any for typed callbacks
|
|
674
|
+
renderItem: (item: any, row?: Gtk.TreeListRow | null) => ReactNode;
|
|
675
|
+
/** Whether to automatically expand new tree rows (default: false) */
|
|
676
|
+
autoexpand?: boolean;
|
|
677
|
+
};
|
|
678
|
+
|
|
679
|
+
export type GridViewProps = BaseListViewProps & {
|
|
680
|
+
/** Function to render each grid item */
|
|
681
|
+
// biome-ignore lint/suspicious/noExplicitAny: contravariant parameter requires any for typed callbacks
|
|
682
|
+
renderItem: (item: any) => ReactNode;
|
|
683
|
+
};
|
|
684
|
+
|
|
685
|
+
/**
|
|
686
|
+
* Props shared by single-selection dropdown widgets (GtkDropDown, AdwComboRow).
|
|
687
|
+
*/
|
|
688
|
+
export type DropDownProps = {
|
|
689
|
+
/** ID of the currently selected item */
|
|
690
|
+
selectedId?: string | null;
|
|
691
|
+
/** Callback fired when the selected item changes */
|
|
692
|
+
onSelectionChanged?: ((id: string) => void) | null;
|
|
693
|
+
};
|
|
694
|
+
|
|
695
|
+
/**
|
|
696
|
+
* Props shared by dialog button widgets (GtkColorDialogButton, GtkFontDialogButton).
|
|
697
|
+
*/
|
|
698
|
+
export type DialogButtonProps = {
|
|
699
|
+
/** Title for the chooser dialog */
|
|
700
|
+
title?: string;
|
|
701
|
+
/** Whether the dialog is modal */
|
|
702
|
+
modal?: boolean;
|
|
703
|
+
};
|
|
704
|
+
|
|
705
|
+
/**
|
|
706
|
+
* Props for widgets backed by a GtkAdjustment.
|
|
707
|
+
*
|
|
708
|
+
* Used by GtkRange, GtkScaleButton, GtkSpinButton, and AdwSpinRow
|
|
709
|
+
* to configure the adjustment bounds, increments, and value change callback.
|
|
710
|
+
*/
|
|
711
|
+
export type AdjustableProps = {
|
|
712
|
+
/** The current value of the adjustable */
|
|
713
|
+
value?: number;
|
|
714
|
+
/** The minimum allowed value */
|
|
715
|
+
lower?: number;
|
|
716
|
+
/** The maximum allowed value */
|
|
717
|
+
upper?: number;
|
|
718
|
+
/** The step increment for small adjustments */
|
|
719
|
+
stepIncrement?: number;
|
|
720
|
+
/** The page increment for larger adjustments */
|
|
721
|
+
pageIncrement?: number;
|
|
722
|
+
/** The size of the visible portion (for scrollbars) */
|
|
723
|
+
pageSize?: number;
|
|
724
|
+
/** Callback fired when the adjustable value changes */
|
|
725
|
+
onValueChanged?: ((value: number, self: Gtk.Range | Gtk.ScaleButton | Gtk.SpinButton | Adw.SpinRow) => void) | null;
|
|
726
|
+
};
|
|
727
|
+
|
|
728
|
+
/**
|
|
729
|
+
* GTKX-specific intrinsic elements and components.
|
|
730
|
+
*
|
|
731
|
+
* This namespace provides React components for GTK layout, lists, menus, and slots
|
|
732
|
+
* that are specific to GTKX (not direct GTK widget bindings).
|
|
733
|
+
*
|
|
734
|
+
* @example
|
|
735
|
+
* ```tsx
|
|
736
|
+
* import { x, GtkHeaderBar, GtkDropDown } from "@gtkx/react";
|
|
737
|
+
*
|
|
738
|
+
* <GtkHeaderBar>
|
|
739
|
+
* <x.Slot for={GtkHeaderBar} id="titleWidget">
|
|
740
|
+
* <GtkLabel label="App Title" />
|
|
741
|
+
* </x.Slot>
|
|
742
|
+
* </GtkHeaderBar>
|
|
743
|
+
*
|
|
744
|
+
* <GtkDropDown>
|
|
745
|
+
* <x.ListItem id="opt1" value="Option 1" />
|
|
746
|
+
* <x.ListItem id="opt2" value="Option 2" />
|
|
747
|
+
* </GtkDropDown>
|
|
748
|
+
* ```
|
|
749
|
+
*/
|
|
750
|
+
export const x = {
|
|
751
|
+
/**
|
|
752
|
+
* Type-safe slot component for placing children in named widget slots.
|
|
753
|
+
*
|
|
754
|
+
* GTK widgets often have named slots for specific child positions (e.g., titleWidget,
|
|
755
|
+
* startWidget). This component provides type-safe access to those slots.
|
|
756
|
+
*
|
|
757
|
+
* @example
|
|
758
|
+
* ```tsx
|
|
759
|
+
* <GtkHeaderBar>
|
|
760
|
+
* <x.Slot for={GtkHeaderBar} id="titleWidget">
|
|
761
|
+
* <GtkLabel label="App Title" />
|
|
762
|
+
* </x.Slot>
|
|
763
|
+
* </GtkHeaderBar>
|
|
764
|
+
* ```
|
|
765
|
+
*/
|
|
766
|
+
Slot<W extends keyof WidgetSlotNames>(props: {
|
|
767
|
+
for: W;
|
|
768
|
+
id: WidgetSlotNames[W];
|
|
769
|
+
children?: ReactNode;
|
|
770
|
+
}): ReactElement {
|
|
771
|
+
return createElement("Slot", { id: props.id }, props.children);
|
|
772
|
+
},
|
|
773
|
+
|
|
774
|
+
/**
|
|
775
|
+
* Element type for pages within a GtkStack or AdwViewStack.
|
|
776
|
+
*
|
|
777
|
+
* @example
|
|
778
|
+
* ```tsx
|
|
779
|
+
* <GtkStack page="page1">
|
|
780
|
+
* <x.StackPage id="page1" title="First Page">
|
|
781
|
+
* <GtkLabel label="Content 1" />
|
|
782
|
+
* </x.StackPage>
|
|
783
|
+
* </GtkStack>
|
|
784
|
+
* ```
|
|
785
|
+
*/
|
|
786
|
+
StackPage: "StackPage" as const,
|
|
787
|
+
|
|
788
|
+
/**
|
|
789
|
+
* Element type for positioning children within a GtkGrid.
|
|
790
|
+
*
|
|
791
|
+
* @example
|
|
792
|
+
* ```tsx
|
|
793
|
+
* <GtkGrid>
|
|
794
|
+
* <x.GridChild column={0} row={0}>
|
|
795
|
+
* <GtkLabel label="Top Left" />
|
|
796
|
+
* </x.GridChild>
|
|
797
|
+
* </GtkGrid>
|
|
798
|
+
* ```
|
|
799
|
+
*/
|
|
800
|
+
GridChild: "GridChild" as const,
|
|
801
|
+
|
|
802
|
+
/**
|
|
803
|
+
* Element type for positioning children within a GtkFixed.
|
|
804
|
+
*
|
|
805
|
+
* @example
|
|
806
|
+
* ```tsx
|
|
807
|
+
* <GtkFixed>
|
|
808
|
+
* <x.FixedChild x={20} y={30}>
|
|
809
|
+
* <GtkLabel label="Positioned at (20, 30)" />
|
|
810
|
+
* </x.FixedChild>
|
|
811
|
+
* </GtkFixed>
|
|
812
|
+
* ```
|
|
813
|
+
*/
|
|
814
|
+
FixedChild: "FixedChild" as const,
|
|
815
|
+
|
|
816
|
+
/**
|
|
817
|
+
* Element type for a page within a GtkNotebook (tabbed interface).
|
|
818
|
+
*
|
|
819
|
+
* @example
|
|
820
|
+
* ```tsx
|
|
821
|
+
* <GtkNotebook>
|
|
822
|
+
* <x.NotebookPage label="Tab 1">
|
|
823
|
+
* <GtkLabel label="Content 1" />
|
|
824
|
+
* </x.NotebookPage>
|
|
825
|
+
* </GtkNotebook>
|
|
826
|
+
* ```
|
|
827
|
+
*/
|
|
828
|
+
NotebookPage: "NotebookPage" as const,
|
|
829
|
+
|
|
830
|
+
/**
|
|
831
|
+
* Element type for a custom widget as the page tab label.
|
|
832
|
+
*/
|
|
833
|
+
NotebookPageTab: "NotebookPageTab" as const,
|
|
834
|
+
|
|
835
|
+
/**
|
|
836
|
+
* Element type for items in a GtkListView, GtkGridView, or GtkColumnView.
|
|
837
|
+
*
|
|
838
|
+
* Items can be nested to create tree hierarchies inside a GtkListView.
|
|
839
|
+
*
|
|
840
|
+
* @example
|
|
841
|
+
* ```tsx
|
|
842
|
+
* // Flat list
|
|
843
|
+
* <GtkListView renderItem={(item) => <GtkLabel label={item.name} />}>
|
|
844
|
+
* <x.ListItem id="1" value={{ name: "Item 1" }} />
|
|
845
|
+
* </GtkListView>
|
|
846
|
+
*
|
|
847
|
+
* // Tree list (nested items)
|
|
848
|
+
* <GtkListView renderItem={(item, row) => <GtkLabel label={item.name} />} autoexpand>
|
|
849
|
+
* <x.ListItem id="parent" value={{ name: "Parent" }}>
|
|
850
|
+
* <x.ListItem id="child" value={{ name: "Child" }} />
|
|
851
|
+
* </x.ListItem>
|
|
852
|
+
* </GtkListView>
|
|
853
|
+
* ```
|
|
854
|
+
*/
|
|
855
|
+
ListItem: "ListItem" as const,
|
|
856
|
+
|
|
857
|
+
/**
|
|
858
|
+
* Component for defining columns in a ColumnView (table widget).
|
|
859
|
+
*
|
|
860
|
+
* @example
|
|
861
|
+
* ```tsx
|
|
862
|
+
* <GtkColumnView>
|
|
863
|
+
* <x.ColumnViewColumn
|
|
864
|
+
* id="name"
|
|
865
|
+
* title="Name"
|
|
866
|
+
* expand
|
|
867
|
+
* renderCell={(item) => <GtkLabel label={item?.name ?? ""} />}
|
|
868
|
+
* />
|
|
869
|
+
* </GtkColumnView>
|
|
870
|
+
* ```
|
|
871
|
+
*/
|
|
872
|
+
ColumnViewColumn<T = unknown>(props: ColumnViewColumnProps<T>): ReactElement {
|
|
873
|
+
return createElement("ColumnViewColumn", props);
|
|
874
|
+
},
|
|
875
|
+
|
|
876
|
+
/**
|
|
877
|
+
* Type-safe container slot for placing children via parent widget methods.
|
|
878
|
+
*
|
|
879
|
+
* Unlike `x.Slot` (which uses property setters for single-child slots),
|
|
880
|
+
* `x.ContainerSlot` calls attachment methods that support multiple children
|
|
881
|
+
* (e.g., `addPrefix()`, `packStart()`, `addTopBar()`).
|
|
882
|
+
*
|
|
883
|
+
* The `for` prop provides TypeScript type narrowing for the `id` prop
|
|
884
|
+
* and is not used at runtime.
|
|
885
|
+
*
|
|
886
|
+
* @example
|
|
887
|
+
* ```tsx
|
|
888
|
+
* <AdwToolbarView>
|
|
889
|
+
* <x.ContainerSlot for={AdwToolbarView} id="addTopBar">
|
|
890
|
+
* <AdwHeaderBar />
|
|
891
|
+
* </x.ContainerSlot>
|
|
892
|
+
* </AdwToolbarView>
|
|
893
|
+
*
|
|
894
|
+
* <GtkHeaderBar>
|
|
895
|
+
* <x.ContainerSlot for={GtkHeaderBar} id="packStart">
|
|
896
|
+
* <GtkButton label="Back" />
|
|
897
|
+
* </x.ContainerSlot>
|
|
898
|
+
* </GtkHeaderBar>
|
|
899
|
+
*
|
|
900
|
+
* <AdwActionRow title="Setting">
|
|
901
|
+
* <x.ContainerSlot for={AdwActionRow} id="addPrefix">
|
|
902
|
+
* <GtkCheckButton />
|
|
903
|
+
* </x.ContainerSlot>
|
|
904
|
+
* </AdwActionRow>
|
|
905
|
+
* ```
|
|
906
|
+
*/
|
|
907
|
+
ContainerSlot<W extends keyof ContainerSlotNames>(props: {
|
|
908
|
+
for: W;
|
|
909
|
+
id: ContainerSlotNames[W];
|
|
910
|
+
children?: ReactNode;
|
|
911
|
+
}): ReactElement {
|
|
912
|
+
return createElement("ContainerSlot", { id: props.id }, props.children);
|
|
913
|
+
},
|
|
914
|
+
|
|
915
|
+
/**
|
|
916
|
+
* Element type for overlay children positioned above the main content.
|
|
917
|
+
*
|
|
918
|
+
* @example
|
|
919
|
+
* ```tsx
|
|
920
|
+
* <GtkOverlay>
|
|
921
|
+
* <GtkImage file="background.png" />
|
|
922
|
+
* <x.OverlayChild>
|
|
923
|
+
* <GtkLabel label="Overlaid text" />
|
|
924
|
+
* </x.OverlayChild>
|
|
925
|
+
* </GtkOverlay>
|
|
926
|
+
* ```
|
|
927
|
+
*/
|
|
928
|
+
OverlayChild: "OverlayChild" as const,
|
|
929
|
+
|
|
930
|
+
/**
|
|
931
|
+
* A clickable menu item with action.
|
|
932
|
+
*
|
|
933
|
+
* @example
|
|
934
|
+
* ```tsx
|
|
935
|
+
* <GtkMenuButton>
|
|
936
|
+
* <x.MenuItem id="open" label="Open" onActivate={handleOpen} />
|
|
937
|
+
* </GtkMenuButton>
|
|
938
|
+
* ```
|
|
939
|
+
*/
|
|
940
|
+
MenuItem: "MenuItem" as const,
|
|
941
|
+
|
|
942
|
+
/**
|
|
943
|
+
* A section grouping related menu items.
|
|
944
|
+
*
|
|
945
|
+
* @example
|
|
946
|
+
* ```tsx
|
|
947
|
+
* <GtkMenuButton>
|
|
948
|
+
* <x.MenuSection label="File">
|
|
949
|
+
* <x.MenuItem id="open" label="Open" onActivate={handleOpen} />
|
|
950
|
+
* </x.MenuSection>
|
|
951
|
+
* </GtkMenuButton>
|
|
952
|
+
* ```
|
|
953
|
+
*/
|
|
954
|
+
MenuSection: "MenuSection" as const,
|
|
955
|
+
|
|
956
|
+
/**
|
|
957
|
+
* A submenu containing nested items.
|
|
958
|
+
*
|
|
959
|
+
* @example
|
|
960
|
+
* ```tsx
|
|
961
|
+
* <GtkMenuButton>
|
|
962
|
+
* <x.MenuSubmenu label="Export">
|
|
963
|
+
* <x.MenuItem id="pdf" label="As PDF" onActivate={exportPdf} />
|
|
964
|
+
* </x.MenuSubmenu>
|
|
965
|
+
* </GtkMenuButton>
|
|
966
|
+
* ```
|
|
967
|
+
*/
|
|
968
|
+
MenuSubmenu: "MenuSubmenu" as const,
|
|
969
|
+
|
|
970
|
+
/**
|
|
971
|
+
* Declarative text tag for styling text content.
|
|
972
|
+
*
|
|
973
|
+
* Wrap text content with a TextTag to apply styling. Tags can be nested.
|
|
974
|
+
*
|
|
975
|
+
* @example
|
|
976
|
+
* ```tsx
|
|
977
|
+
* <GtkTextView>
|
|
978
|
+
* Normal <x.TextTag id="bold" weight={Pango.Weight.BOLD}>
|
|
979
|
+
* bold <x.TextTag id="red" foreground="red">and red</x.TextTag>
|
|
980
|
+
* </x.TextTag> text.
|
|
981
|
+
* </GtkTextView>
|
|
982
|
+
* ```
|
|
983
|
+
*/
|
|
984
|
+
TextTag: "TextTag" as const,
|
|
985
|
+
|
|
986
|
+
/**
|
|
987
|
+
* Declarative anchor for embedding widgets in text flow.
|
|
988
|
+
*
|
|
989
|
+
* The anchor is placed at the current position in the text.
|
|
990
|
+
*
|
|
991
|
+
* @example
|
|
992
|
+
* ```tsx
|
|
993
|
+
* <GtkTextView>
|
|
994
|
+
* Click here: <x.TextAnchor>
|
|
995
|
+
* <GtkButton label="Click me" />
|
|
996
|
+
* </x.TextAnchor> to continue.
|
|
997
|
+
* </GtkTextView>
|
|
998
|
+
* ```
|
|
999
|
+
*/
|
|
1000
|
+
TextAnchor: "TextAnchor" as const,
|
|
1001
|
+
|
|
1002
|
+
/**
|
|
1003
|
+
* Declarative inline paintable for embedding images/icons in text flow.
|
|
1004
|
+
*
|
|
1005
|
+
* The paintable is placed at the current position in the text.
|
|
1006
|
+
*
|
|
1007
|
+
* @example
|
|
1008
|
+
* ```tsx
|
|
1009
|
+
* <GtkTextView>
|
|
1010
|
+
* Click the icon <x.TextPaintable paintable={iconPaintable} /> to continue.
|
|
1011
|
+
* </GtkTextView>
|
|
1012
|
+
* ```
|
|
1013
|
+
*/
|
|
1014
|
+
TextPaintable: "TextPaintable" as const,
|
|
1015
|
+
|
|
1016
|
+
/**
|
|
1017
|
+
* A toggle button for an AdwToggleGroup.
|
|
1018
|
+
*
|
|
1019
|
+
* @example
|
|
1020
|
+
* ```tsx
|
|
1021
|
+
* <AdwToggleGroup>
|
|
1022
|
+
* <x.Toggle id="list" iconName="view-list-symbolic" />
|
|
1023
|
+
* <x.Toggle id="grid" iconName="view-grid-symbolic" />
|
|
1024
|
+
* </AdwToggleGroup>
|
|
1025
|
+
* ```
|
|
1026
|
+
*/
|
|
1027
|
+
Toggle: "Toggle" as const,
|
|
1028
|
+
|
|
1029
|
+
/**
|
|
1030
|
+
* A response button for an AdwAlertDialog.
|
|
1031
|
+
*
|
|
1032
|
+
* @example
|
|
1033
|
+
* ```tsx
|
|
1034
|
+
* <AdwAlertDialog
|
|
1035
|
+
* heading="Delete File?"
|
|
1036
|
+
* body="This cannot be undone."
|
|
1037
|
+
* defaultResponse="cancel"
|
|
1038
|
+
* closeResponse="cancel"
|
|
1039
|
+
* >
|
|
1040
|
+
* <x.AlertDialogResponse id="cancel" label="Cancel" />
|
|
1041
|
+
* <x.AlertDialogResponse id="delete" label="Delete" appearance={Adw.ResponseAppearance.DESTRUCTIVE} />
|
|
1042
|
+
* </AdwAlertDialog>
|
|
1043
|
+
* ```
|
|
1044
|
+
*/
|
|
1045
|
+
AlertDialogResponse: "AlertDialogResponse" as const,
|
|
1046
|
+
|
|
1047
|
+
/**
|
|
1048
|
+
* Type-safe page component for AdwNavigationView or AdwNavigationSplitView.
|
|
1049
|
+
*
|
|
1050
|
+
* The `for` prop is required and determines valid `id` values:
|
|
1051
|
+
* - `AdwNavigationView`: any string (page tags for navigation history)
|
|
1052
|
+
* - `AdwNavigationSplitView`: `"content"` or `"sidebar"` (slot positions)
|
|
1053
|
+
*
|
|
1054
|
+
* @example
|
|
1055
|
+
* ```tsx
|
|
1056
|
+
* // In NavigationView - id can be any string
|
|
1057
|
+
* <AdwNavigationView history={["home"]}>
|
|
1058
|
+
* <x.NavigationPage for={AdwNavigationView} id="home" title="Home">
|
|
1059
|
+
* <GtkLabel label="Welcome!" />
|
|
1060
|
+
* </x.NavigationPage>
|
|
1061
|
+
* </AdwNavigationView>
|
|
1062
|
+
*
|
|
1063
|
+
* // In NavigationSplitView - id is narrowed to "content" | "sidebar"
|
|
1064
|
+
* <AdwNavigationSplitView>
|
|
1065
|
+
* <x.NavigationPage for={AdwNavigationSplitView} id="sidebar" title="Sidebar">
|
|
1066
|
+
* <GtkLabel label="Sidebar" />
|
|
1067
|
+
* </x.NavigationPage>
|
|
1068
|
+
* <x.NavigationPage for={AdwNavigationSplitView} id="content" title="Content">
|
|
1069
|
+
* <GtkLabel label="Content" />
|
|
1070
|
+
* </x.NavigationPage>
|
|
1071
|
+
* </AdwNavigationSplitView>
|
|
1072
|
+
* ```
|
|
1073
|
+
*/
|
|
1074
|
+
NavigationPage: "NavigationPage" as const,
|
|
1075
|
+
|
|
1076
|
+
/**
|
|
1077
|
+
* A keyboard shortcut definition.
|
|
1078
|
+
*
|
|
1079
|
+
* Must be a child of `x.ShortcutController`.
|
|
1080
|
+
*
|
|
1081
|
+
* @example
|
|
1082
|
+
* ```tsx
|
|
1083
|
+
* <x.Shortcut trigger="<Control>s" onActivate={save} />
|
|
1084
|
+
* <x.Shortcut trigger={["F5", "<Control>r"]} onActivate={refresh} />
|
|
1085
|
+
* <x.Shortcut trigger="Escape" onActivate={cancel} disabled={!canCancel} />
|
|
1086
|
+
* ```
|
|
1087
|
+
*/
|
|
1088
|
+
Shortcut: "Shortcut" as const,
|
|
1089
|
+
|
|
1090
|
+
/**
|
|
1091
|
+
* Declarative animation wrapper using Adw.TimedAnimation or Adw.SpringAnimation.
|
|
1092
|
+
*
|
|
1093
|
+
* Provides framer-motion-inspired API for animating child widgets.
|
|
1094
|
+
*
|
|
1095
|
+
* @example
|
|
1096
|
+
* ```tsx
|
|
1097
|
+
* <x.Animation
|
|
1098
|
+
* initial={{ opacity: 0, scale: 0.9 }}
|
|
1099
|
+
* animate={{ opacity: 1, scale: 1 }}
|
|
1100
|
+
* transition={{ mode: "spring", damping: 0.8, stiffness: 200 }}
|
|
1101
|
+
* animateOnMount
|
|
1102
|
+
* >
|
|
1103
|
+
* <GtkButton label="Animated Button" />
|
|
1104
|
+
* </x.Animation>
|
|
1105
|
+
* ```
|
|
1106
|
+
*/
|
|
1107
|
+
Animation: "Animation" as const,
|
|
1108
|
+
};
|
|
1109
|
+
|
|
1110
|
+
interface StackProps {
|
|
1111
|
+
/** ID of the currently visible page */
|
|
1112
|
+
page?: string | null;
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
declare global {
|
|
1116
|
+
namespace React {
|
|
1117
|
+
namespace JSX {
|
|
1118
|
+
interface IntrinsicElements {
|
|
1119
|
+
AlertDialogResponse: AlertDialogResponseProps;
|
|
1120
|
+
Animation: AnimationProps;
|
|
1121
|
+
ContainerSlot: ContainerSlotProps;
|
|
1122
|
+
ColumnViewColumn: ColumnViewColumnProps;
|
|
1123
|
+
FixedChild: FixedChildProps;
|
|
1124
|
+
GridChild: GridChildProps;
|
|
1125
|
+
ListItem: ListItemProps;
|
|
1126
|
+
MenuItem: MenuItemProps;
|
|
1127
|
+
MenuSection: MenuSectionProps;
|
|
1128
|
+
MenuSubmenu: MenuSubmenuProps;
|
|
1129
|
+
NotebookPage: NotebookPageProps;
|
|
1130
|
+
NotebookPageTab: NotebookPageTabProps;
|
|
1131
|
+
OverlayChild: OverlayChildProps;
|
|
1132
|
+
TextAnchor: TextAnchorProps;
|
|
1133
|
+
TextPaintable: TextPaintableProps;
|
|
1134
|
+
TextTag: TextTagProps;
|
|
1135
|
+
|
|
1136
|
+
StackPage: StackPageProps;
|
|
1137
|
+
Toggle: ToggleProps;
|
|
1138
|
+
NavigationPage: NavigationPageProps;
|
|
1139
|
+
Shortcut: ShortcutProps;
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
1144
|
+
|
|
1145
|
+
declare module "./generated/jsx.js" {
|
|
1146
|
+
interface GtkRangeProps extends Omit<AdjustableProps, "onValueChanged"> {
|
|
1147
|
+
/** Callback fired when the range value changes */
|
|
1148
|
+
onValueChanged?: ((value: number, self: Gtk.Range) => void) | null;
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1151
|
+
interface GtkScaleProps {
|
|
1152
|
+
/** Visual marks placed along the scale at specific values */
|
|
1153
|
+
marks?: Array<{ value: number; position?: Gtk.PositionType; label?: string | null }> | null;
|
|
1154
|
+
}
|
|
1155
|
+
|
|
1156
|
+
interface GtkScaleButtonProps extends Omit<AdjustableProps, "value" | "onValueChanged"> {
|
|
1157
|
+
/** Callback fired when the scale button value changes */
|
|
1158
|
+
onValueChanged?: ((value: number, self: Gtk.ScaleButton) => void) | null;
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1161
|
+
interface GtkSpinButtonProps extends Omit<AdjustableProps, "value" | "onValueChanged"> {
|
|
1162
|
+
/** Callback fired when the spin button value changes */
|
|
1163
|
+
onValueChanged?: ((value: number, self: Gtk.SpinButton) => void) | null;
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1166
|
+
interface AdwSpinRowProps extends Omit<AdjustableProps, "value" | "onValueChanged"> {
|
|
1167
|
+
/** Callback fired when the spin row value changes */
|
|
1168
|
+
onValueChanged?: ((value: number, self: Adw.SpinRow) => void) | null;
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1171
|
+
interface GtkCalendarProps {
|
|
1172
|
+
/** Array of day numbers (1-31) to display as marked */
|
|
1173
|
+
markedDays?: number[] | null;
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
interface GtkLevelBarProps {
|
|
1177
|
+
/** Named offset thresholds that change the bar's appearance */
|
|
1178
|
+
offsets?: Array<{ id: string; value: number }> | null;
|
|
1179
|
+
}
|
|
1180
|
+
|
|
1181
|
+
interface GtkTextViewProps extends TextBufferProps {}
|
|
1182
|
+
|
|
1183
|
+
interface GtkSourceViewProps extends TextBufferProps {
|
|
1184
|
+
/** Language for syntax highlighting (ID string or Language object) */
|
|
1185
|
+
language?: string | GtkSource.Language;
|
|
1186
|
+
/** Color scheme for syntax highlighting (ID string or StyleScheme object) */
|
|
1187
|
+
styleScheme?: string | GtkSource.StyleScheme;
|
|
1188
|
+
/** Whether syntax highlighting is enabled */
|
|
1189
|
+
highlightSyntax?: boolean;
|
|
1190
|
+
/** Whether matching brackets are highlighted */
|
|
1191
|
+
highlightMatchingBrackets?: boolean;
|
|
1192
|
+
/** Whether the buffer has an implicit trailing newline */
|
|
1193
|
+
implicitTrailingNewline?: boolean;
|
|
1194
|
+
/** Callback fired when the cursor position changes */
|
|
1195
|
+
onCursorMoved?: (() => void) | null;
|
|
1196
|
+
/** Callback fired when the highlighted region is updated */
|
|
1197
|
+
onHighlightUpdated?: ((start: Gtk.TextIter, end: Gtk.TextIter) => void) | null;
|
|
1198
|
+
}
|
|
1199
|
+
|
|
1200
|
+
interface GtkListViewProps extends ListViewProps {}
|
|
1201
|
+
|
|
1202
|
+
interface GtkGridViewProps extends GridViewProps {}
|
|
1203
|
+
|
|
1204
|
+
interface GtkColumnViewProps {
|
|
1205
|
+
/** Array of selected row IDs */
|
|
1206
|
+
selected?: string[] | null;
|
|
1207
|
+
/** Callback fired when the selection changes */
|
|
1208
|
+
onSelectionChanged?: ((ids: string[]) => void) | null;
|
|
1209
|
+
/** Selection behavior (single, multiple, none, etc.) */
|
|
1210
|
+
selectionMode?: Gtk.SelectionMode | null;
|
|
1211
|
+
/** ID of the currently sorted column, or null for no sorting */
|
|
1212
|
+
sortColumn?: string | null;
|
|
1213
|
+
/** Sort direction (ascending or descending) */
|
|
1214
|
+
sortOrder?: Gtk.SortType | null;
|
|
1215
|
+
/** Callback fired when the sort column or order changes */
|
|
1216
|
+
onSortChanged?: ((column: string | null, order: Gtk.SortType) => void) | null;
|
|
1217
|
+
/** Estimated row height in pixels for virtualization */
|
|
1218
|
+
estimatedRowHeight?: number | null;
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1221
|
+
interface GtkDropDownProps extends DropDownProps {}
|
|
1222
|
+
|
|
1223
|
+
interface AdwComboRowProps extends DropDownProps {}
|
|
1224
|
+
|
|
1225
|
+
interface GtkStackProps extends StackProps {
|
|
1226
|
+
/** Callback fired when the visible page changes */
|
|
1227
|
+
onPageChanged?: ((page: string | null, self: Gtk.Stack) => void) | null;
|
|
1228
|
+
}
|
|
1229
|
+
|
|
1230
|
+
interface AdwViewStackProps extends StackProps {
|
|
1231
|
+
/** Callback fired when the visible page changes */
|
|
1232
|
+
onPageChanged?: ((page: string | null, self: Adw.ViewStack) => void) | null;
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1235
|
+
interface AdwNavigationViewProps {
|
|
1236
|
+
/** Ordered list of page tags representing the navigation stack */
|
|
1237
|
+
history?: string[] | null;
|
|
1238
|
+
/** Callback fired when the navigation history changes */
|
|
1239
|
+
onHistoryChanged?: ((history: string[]) => void) | null;
|
|
1240
|
+
}
|
|
1241
|
+
|
|
1242
|
+
interface GtkWindowProps {
|
|
1243
|
+
/** Callback fired when the window close button is clicked */
|
|
1244
|
+
onClose?: (() => void) | null;
|
|
1245
|
+
}
|
|
1246
|
+
|
|
1247
|
+
interface GtkDrawingAreaProps {
|
|
1248
|
+
/** Callback fired when the drawing area needs to be redrawn */
|
|
1249
|
+
onDraw?: ((self: Gtk.DrawingArea, cr: cairo.Context, width: number, height: number) => void) | null;
|
|
1250
|
+
}
|
|
1251
|
+
|
|
1252
|
+
interface GtkColorDialogButtonProps extends DialogButtonProps {
|
|
1253
|
+
/** Callback fired when the selected color changes */
|
|
1254
|
+
onRgbaChanged?: ((rgba: Gdk.RGBA) => void) | null;
|
|
1255
|
+
/** Whether to show an alpha (opacity) channel */
|
|
1256
|
+
withAlpha?: boolean;
|
|
1257
|
+
}
|
|
1258
|
+
|
|
1259
|
+
interface GtkFontDialogButtonProps extends DialogButtonProps {
|
|
1260
|
+
/** Callback fired when the selected font changes */
|
|
1261
|
+
onFontDescChanged?: ((fontDesc: Pango.FontDescription) => void) | null;
|
|
1262
|
+
}
|
|
1263
|
+
|
|
1264
|
+
interface GtkAboutDialogProps {
|
|
1265
|
+
/** Additional credit sections with names and lists of people */
|
|
1266
|
+
creditSections?: Array<{ name: string; people: string[] }>;
|
|
1267
|
+
}
|
|
1268
|
+
|
|
1269
|
+
interface GtkSearchBarProps {
|
|
1270
|
+
/** Callback fired when search mode is toggled */
|
|
1271
|
+
onSearchModeChanged?: ((searchMode: boolean) => void) | null;
|
|
1272
|
+
}
|
|
1273
|
+
|
|
1274
|
+
interface AdwToggleGroupProps {
|
|
1275
|
+
/** Callback fired when the active toggle changes */
|
|
1276
|
+
onActiveChanged?: ((active: number, activeName: string | null) => void) | null;
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1279
|
+
interface GtkDragSourceProps {
|
|
1280
|
+
/** Paintable to use as the drag icon */
|
|
1281
|
+
icon?: Gdk.Paintable | null;
|
|
1282
|
+
/** X offset of the hotspot within the drag icon */
|
|
1283
|
+
iconHotX?: number;
|
|
1284
|
+
/** Y offset of the hotspot within the drag icon */
|
|
1285
|
+
iconHotY?: number;
|
|
1286
|
+
}
|
|
1287
|
+
|
|
1288
|
+
interface GtkDropTargetProps {
|
|
1289
|
+
/** GType values for accepted drop content types */
|
|
1290
|
+
types?: number[];
|
|
1291
|
+
}
|
|
1292
|
+
}
|
|
1293
|
+
|
|
1294
|
+
export * from "./generated/jsx.js";
|