nixos-configs/modules/ags/gtk4/widget/subclasses/button.ts
matt1432 adb36c2b34
All checks were successful
Discord / discord commits (push) Has been skipped
refactor(ags4): use agsV1 syntax
2025-01-13 10:51:02 -05:00

24 lines
717 B
TypeScript

import { register } from 'astal';
import { Gtk, type ConstructProps } from 'astal/gtk4';
import astalify, { type AstalifyProps } from './astalify';
type ButtonSignals = Record<`on${string}`, unknown[]> & {
onClicked: []
};
export type ButtonProps = ConstructProps<
ButtonClass,
Gtk.Button.ConstructorProps & AstalifyProps,
ButtonSignals
>;
@register({ GTypeName: 'Button' })
export class ButtonClass extends astalify(Gtk.Button) {
constructor({ cssName = 'button', ...props }: ButtonProps = {}) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
super({ cssName, ...props as any });
}
}
export const Button = (props?: ButtonProps) => new ButtonClass(props);