import type Gtk from "gi://Gtk"; import type { GjsContext } from "../../../reconciler/gjs-renderer"; import type { HostContext } from "../../../reconciler/host-context"; import { BaseElement, type GjsElement } from "../../gjs-element"; import { ElementLifecycleController } from "../../utils/element-extenders/element-lifecycle-controller"; import type { DiffedProps } from "../../utils/element-extenders/map-properties"; import type { TextNode } from "../text-node"; export interface ICustomWidget

{ /** * Should return a Gtk Widget that can be attached to a Container * and displayed. * * The root widget should not have any parent set. */ getRootWidget(): Gtk.Widget; /** * This function ic called whenever any of the props passed to * changes. * * @param props Dictionary containing props that have changed since * last update. */ updateProps(props: Partial

): void; /** * This function is called when the CustomWidget is removed from the * React tree. Any cleanup should be done here, including destroying * the root widget. */ unmount(): void; } export type CustomWidgetProps

= P & { widget: new (props: P) => ICustomWidget

; }; export declare class CustomWidgetElement extends BaseElement implements GjsElement<"CUSTOM_WIDGET", Gtk.Widget> { static getContext(currentContext: HostContext): HostContext; readonly kind = "CUSTOM_WIDGET"; readonly customWidget: ICustomWidget; protected readonly widget: Gtk.Widget; protected parent: GjsElement | null; protected readonly lifecycle: ElementLifecycleController; protected handlers: null; protected propsMapper: null; protected currentProps: Record; constructor(props: DiffedProps); getCustomWidget>(): CW; updateProps(props: DiffedProps): void; appendChild(child: GjsElement | TextNode): void; insertBefore(newChild: GjsElement | TextNode, beforeChild: GjsElement): void; remove(parent: GjsElement): void; render(): void; notifyWillMountTo(parent: GjsElement): boolean; notifyMounted(): void; notifyChildWillUnmount(child: GjsElement): void; show(): void; hide(): void; getWidget(): Gtk.Widget; getParentElement(): GjsElement | null; addEventListener(signal: string, callback: Rg.GjsElementEventListenerCallback): void; removeEventListener(signal: string, callback: Rg.GjsElementEventListenerCallback): void; }