refactor(ags4): improve types and remove as many 'any' as possible
All checks were successful
Discord / discord commits (push) Has been skipped
All checks were successful
Discord / discord commits (push) Has been skipped
This commit is contained in:
parent
adb36c2b34
commit
c8485430b9
18 changed files with 144 additions and 126 deletions
|
@ -1,14 +1,44 @@
|
||||||
import { execAsync, Variable } from 'astal';
|
import { execAsync, Variable } from 'astal';
|
||||||
import { Gtk } from 'astal/gtk4';
|
import { type Gdk, type Gtk, type ConstructProps } from 'astal/gtk4';
|
||||||
import Binding, { Connectable, kebabify, snakeify, Subscribable } from 'astal/binding';
|
import { Binding, type Connectable, kebabify, snakeify, type Subscribable } from 'astal/binding';
|
||||||
|
|
||||||
|
export interface EventController<Self extends Gtk.Widget> {
|
||||||
|
onFocusEnter?: (self: Self) => void
|
||||||
|
onFocusLeave?: (self: Self) => void
|
||||||
|
|
||||||
|
onKeyPressed?: (self: Self, keyval: number, keycode: number, state: Gdk.ModifierType) => void
|
||||||
|
onKeyReleased?: (self: Self, keyval: number, keycode: number, state: Gdk.ModifierType) => void
|
||||||
|
onKeyModifier?: (self: Self, state: Gdk.ModifierType) => void
|
||||||
|
|
||||||
|
onLegacy?: (self: Self, event: Gdk.Event) => void
|
||||||
|
onButtonPressed?: (self: Self, state: Gdk.ButtonEvent) => void
|
||||||
|
onButtonReleased?: (self: Self, state: Gdk.ButtonEvent) => void
|
||||||
|
|
||||||
|
onHoverEnter?: (self: Self, x: number, y: number) => void
|
||||||
|
onHoverLeave?: (self: Self) => void
|
||||||
|
onMotion?: (self: Self, x: number, y: number) => void
|
||||||
|
|
||||||
|
onScroll?: (self: Self, dx: number, dy: number) => void
|
||||||
|
onScrollDecelerate?: (self: Self, vel_x: number, vel_y: number) => void
|
||||||
|
}
|
||||||
|
|
||||||
|
export type BindableProps<T> = {
|
||||||
|
[K in keyof T]: Binding<T[K]> | T[K];
|
||||||
|
};
|
||||||
|
|
||||||
|
export interface AstalifyProps {
|
||||||
|
css: string
|
||||||
|
child: Gtk.Widget
|
||||||
|
children: Gtk.Widget[]
|
||||||
|
}
|
||||||
|
|
||||||
export const noImplicitDestroy = Symbol('no no implicit destroy');
|
export const noImplicitDestroy = Symbol('no no implicit destroy');
|
||||||
export const setChildren = Symbol('children setter method');
|
export const setChildren = Symbol('children setter method');
|
||||||
|
|
||||||
const mergeBindings = <Value = unknown>(
|
const mergeBindings = <Value = unknown>(
|
||||||
array: (Value | Binding<Value>)[],
|
array: (Value | Binding<Value> | Binding<Value[]>)[],
|
||||||
): Value[] | Binding<Value[]> => {
|
): Value[] | Binding<Value[]> => {
|
||||||
const getValues = (...args: Value[]) => {
|
const getValues = (args: Value[]) => {
|
||||||
let i = 0;
|
let i = 0;
|
||||||
|
|
||||||
return array.map((value) => value instanceof Binding ?
|
return array.map((value) => value instanceof Binding ?
|
||||||
|
@ -23,26 +53,12 @@ const mergeBindings = <Value = unknown>(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bindings.length === 1) {
|
if (bindings.length === 1) {
|
||||||
return bindings[0].as(getValues);
|
return (bindings[0] as Binding<Value[]>).as(getValues);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Variable.derive(bindings, getValues)();
|
return Variable.derive(bindings, getValues)();
|
||||||
};
|
};
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
||||||
const setProp = (obj: any, prop: string, value: unknown) => {
|
|
||||||
try {
|
|
||||||
const setter = `set_${snakeify(prop)}`;
|
|
||||||
|
|
||||||
if (typeof obj[setter] === 'function') { return obj[setter](value); }
|
|
||||||
|
|
||||||
return (obj[prop] = value);
|
|
||||||
}
|
|
||||||
catch (error) {
|
|
||||||
console.error(`could not set property "${prop}" on ${obj}:`, error);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export const hook = <Widget extends Connectable>(
|
export const hook = <Widget extends Connectable>(
|
||||||
widget: Widget,
|
widget: Widget,
|
||||||
object: Connectable | Subscribable,
|
object: Connectable | Subscribable,
|
||||||
|
@ -67,64 +83,82 @@ export const hook = <Widget extends Connectable>(
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const construct = <Widget extends Connectable & {
|
export const construct = <
|
||||||
[setChildren]: (children: Gtk.Widget[]) => void
|
Self extends InstanceType<typeof Gtk.Widget> & {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
[setChildren]: (children: Gtk.Widget[]) => void
|
||||||
}>(widget: Widget, config: any) => {
|
},
|
||||||
// eslint-disable-next-line prefer-const
|
Props extends Gtk.Widget.ConstructorProps,
|
||||||
let { setup, child, children = [], ...props } = config;
|
>(
|
||||||
|
widget: Self,
|
||||||
|
props: Omit<
|
||||||
|
ConstructProps<Self, Props> & Partial<BindableProps<AstalifyProps>>,
|
||||||
|
keyof EventController<Self>
|
||||||
|
>,
|
||||||
|
) => {
|
||||||
|
type Key = keyof typeof props;
|
||||||
|
const keys = Object.keys(props) as Key[];
|
||||||
|
const entries = Object.entries(props) as [Key, unknown][];
|
||||||
|
|
||||||
if (children instanceof Binding) {
|
const setProp = (prop: Key, value: Self[keyof Self]) => {
|
||||||
children = [children];
|
try {
|
||||||
}
|
const setter = `set_${snakeify(prop.toString())}` as keyof Self;
|
||||||
|
|
||||||
if (child) {
|
if (typeof widget[setter] === 'function') {
|
||||||
children.unshift(child);
|
return widget[setter](value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (widget[prop as keyof Self] = value);
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
console.error(`could not set property "${prop.toString()}" on ${widget}:`, error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const children = props.children ?
|
||||||
|
props.children instanceof Binding ?
|
||||||
|
[props.children] as (Binding<Gtk.Widget[]> | Binding<Gtk.Widget> | Gtk.Widget)[] :
|
||||||
|
props.children as Gtk.Widget[] :
|
||||||
|
[];
|
||||||
|
|
||||||
|
if (props.child) {
|
||||||
|
children.unshift(props.child);
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove undefined values
|
// remove undefined values
|
||||||
for (const [key, value] of Object.entries(props)) {
|
for (const [key, value] of entries) {
|
||||||
if (typeof value === 'undefined') {
|
if (typeof value === 'undefined') {
|
||||||
delete props[key];
|
delete props[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// collect bindings
|
// collect bindings
|
||||||
const bindings: [string, Binding<unknown>][] = Object
|
const bindings: [Key, Binding<unknown>][] = [];
|
||||||
.keys(props)
|
|
||||||
.reduce((acc: [string, Binding<unknown>][], prop) => {
|
|
||||||
if (props[prop] instanceof Binding) {
|
|
||||||
const binding = props[prop];
|
|
||||||
|
|
||||||
delete props[prop];
|
for (const key of keys) {
|
||||||
|
if (props[key] instanceof Binding) {
|
||||||
return [...acc, [prop, binding]];
|
bindings.push([key, props[key]]);
|
||||||
}
|
delete props[key];
|
||||||
|
}
|
||||||
return acc;
|
}
|
||||||
}, []);
|
|
||||||
|
|
||||||
// collect signal handlers
|
// collect signal handlers
|
||||||
const onHandlers: [string, string | (() => unknown)][] = Object
|
const onHandlers: [string, string | (() => void)][] = [];
|
||||||
.keys(props)
|
|
||||||
.reduce((acc: [string, Binding<unknown>][], key) => {
|
|
||||||
if (key.startsWith('on')) {
|
|
||||||
const sig = kebabify(key).split('-').slice(1).join('-');
|
|
||||||
const handler = props[key];
|
|
||||||
|
|
||||||
delete props[key];
|
for (const key of keys) {
|
||||||
|
if (key.toString().startsWith('on')) {
|
||||||
|
const sig = kebabify(key.toString()).split('-').slice(1).join('-');
|
||||||
|
|
||||||
return [...acc, [sig, handler]];
|
onHandlers.push([sig, props[key] as string | (() => void)]);
|
||||||
}
|
delete props[key];
|
||||||
|
}
|
||||||
return acc;
|
}
|
||||||
}, []);
|
|
||||||
|
|
||||||
// set children
|
// set children
|
||||||
const mergedChildren = mergeBindings<Gtk.Widget>(children.flat(Infinity));
|
const mergedChildren = mergeBindings<Gtk.Widget>(children.flat(Infinity));
|
||||||
|
|
||||||
if (mergedChildren instanceof Binding) {
|
if (mergedChildren instanceof Binding) {
|
||||||
widget[setChildren](mergedChildren.get());
|
widget[setChildren](mergedChildren.get());
|
||||||
|
|
||||||
widget.connect('destroy', mergedChildren.subscribe((v) => {
|
widget.connect('destroy', mergedChildren.subscribe((v) => {
|
||||||
widget[setChildren](v);
|
widget[setChildren](v);
|
||||||
}));
|
}));
|
||||||
|
@ -156,20 +190,20 @@ export const construct = <Widget extends Connectable & {
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
widget.connect('destroy', binding.subscribe((v: unknown) => {
|
widget.connect('destroy', binding.subscribe((v: unknown) => {
|
||||||
setProp(widget, prop, v);
|
setProp(prop, v as Self[keyof Self]);
|
||||||
}));
|
}));
|
||||||
setProp(widget, prop, binding.get());
|
setProp(prop, binding.get() as Self[keyof Self]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// filter undefined values
|
// filter undefined values
|
||||||
for (const [key, value] of Object.entries(props)) {
|
for (const [key, value] of entries) {
|
||||||
if (typeof value === 'undefined') {
|
if (typeof value === 'undefined') {
|
||||||
delete props[key];
|
delete props[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Object.assign(widget, props);
|
Object.assign(widget, props);
|
||||||
setup?.(widget);
|
props.setup?.(widget);
|
||||||
|
|
||||||
return widget;
|
return widget;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,44 +1,26 @@
|
||||||
import Gdk from 'gi://Gdk?version=4.0';
|
// A mixin class must have a constructor with a single rest parameter of type 'any[]'
|
||||||
import Gtk from 'gi://Gtk?version=4.0';
|
/* eslint "@typescript-eslint/no-explicit-any": ["error", { "ignoreRestArgs": true }] */
|
||||||
|
|
||||||
import { property, register } from 'astal';
|
import { property, register } from 'astal';
|
||||||
|
import { Gdk, Gtk } from 'astal/gtk4';
|
||||||
import Binding, { type Connectable, type Subscribable } from 'astal/binding';
|
import Binding, { type Connectable, type Subscribable } from 'astal/binding';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
type EventController,
|
||||||
hook,
|
hook,
|
||||||
noImplicitDestroy,
|
noImplicitDestroy,
|
||||||
setChildren,
|
setChildren,
|
||||||
construct,
|
construct,
|
||||||
} from './_astal';
|
} from './_astal';
|
||||||
|
|
||||||
|
import { type AstalifyProps, type BindableProps } from './_astal';
|
||||||
|
export { type AstalifyProps, type BindableProps };
|
||||||
|
|
||||||
export type BindableChild = Gtk.Widget | Binding<Gtk.Widget>;
|
export type BindableChild = Gtk.Widget | Binding<Gtk.Widget>;
|
||||||
export interface AstalifyProps {
|
|
||||||
css: string
|
|
||||||
children: Gtk.Widget[]
|
|
||||||
}
|
|
||||||
|
|
||||||
export const type = Symbol('child type');
|
export const type = Symbol('child type');
|
||||||
const dummyBuilder = new Gtk.Builder();
|
const dummyBuilder = new Gtk.Builder();
|
||||||
|
|
||||||
interface EventController<Self extends Gtk.Widget> {
|
|
||||||
onFocusEnter?: (self: Self) => void
|
|
||||||
onFocusLeave?: (self: Self) => void
|
|
||||||
|
|
||||||
onKeyPressed?: (self: Self, keyval: number, keycode: number, state: Gdk.ModifierType) => void
|
|
||||||
onKeyReleased?: (self: Self, keyval: number, keycode: number, state: Gdk.ModifierType) => void
|
|
||||||
onKeyModifier?: (self: Self, state: Gdk.ModifierType) => void
|
|
||||||
|
|
||||||
onLegacy?: (self: Self, event: Gdk.Event) => void
|
|
||||||
onButtonPressed?: (self: Self, state: Gdk.ButtonEvent) => void
|
|
||||||
onButtonReleased?: (self: Self, state: Gdk.ButtonEvent) => void
|
|
||||||
|
|
||||||
onHoverEnter?: (self: Self, x: number, y: number) => void
|
|
||||||
onHoverLeave?: (self: Self) => void
|
|
||||||
onMotion?: (self: Self, x: number, y: number) => void
|
|
||||||
|
|
||||||
onScroll?: (self: Self, dx: number, dy: number) => void
|
|
||||||
onScrollDecelerate?: (self: Self, vel_x: number, vel_y: number) => void
|
|
||||||
}
|
|
||||||
|
|
||||||
const setupControllers = <T>(widget: Gtk.Widget, {
|
const setupControllers = <T>(widget: Gtk.Widget, {
|
||||||
onFocusEnter,
|
onFocusEnter,
|
||||||
onFocusLeave,
|
onFocusLeave,
|
||||||
|
@ -79,7 +61,9 @@ const setupControllers = <T>(widget: Gtk.Widget, {
|
||||||
onKeyReleased(widget, val, code, state));
|
onKeyReleased(widget, val, code, state));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (onKeyModifier) { key.connect('modifiers', (_, state) => onKeyModifier(widget, state)); }
|
if (onKeyModifier) {
|
||||||
|
key.connect('modifiers', (_, state) => onKeyModifier(widget, state));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (onLegacy || onButtonPressed || onButtonReleased) {
|
if (onLegacy || onButtonPressed || onButtonReleased) {
|
||||||
|
@ -105,11 +89,17 @@ const setupControllers = <T>(widget: Gtk.Widget, {
|
||||||
|
|
||||||
widget.add_controller(hover);
|
widget.add_controller(hover);
|
||||||
|
|
||||||
if (onHoverEnter) { hover.connect('enter', (_, x, y) => onHoverEnter(widget, x, y)); }
|
if (onHoverEnter) {
|
||||||
|
hover.connect('enter', (_, x, y) => onHoverEnter(widget, x, y));
|
||||||
|
}
|
||||||
|
|
||||||
if (onHoverLeave) { hover.connect('leave', () => onHoverLeave(widget)); }
|
if (onHoverLeave) {
|
||||||
|
hover.connect('leave', () => onHoverLeave(widget));
|
||||||
|
}
|
||||||
|
|
||||||
if (onMotion) { hover.connect('motion', (_, x, y) => onMotion(widget, x, y)); }
|
if (onMotion) {
|
||||||
|
hover.connect('motion', (_, x, y) => onMotion(widget, x, y));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (onScroll || onScrollDecelerate) {
|
if (onScroll || onScrollDecelerate) {
|
||||||
|
@ -117,7 +107,9 @@ const setupControllers = <T>(widget: Gtk.Widget, {
|
||||||
|
|
||||||
widget.add_controller(scroll);
|
widget.add_controller(scroll);
|
||||||
|
|
||||||
if (onScroll) { scroll.connect('scroll', (_, x, y) => onScroll(widget, x, y)); }
|
if (onScroll) {
|
||||||
|
scroll.connect('scroll', (_, x, y) => onScroll(widget, x, y));
|
||||||
|
}
|
||||||
|
|
||||||
if (onScrollDecelerate) {
|
if (onScrollDecelerate) {
|
||||||
scroll.connect('decelerate', (_, x, y) => onScrollDecelerate(widget, x, y));
|
scroll.connect('decelerate', (_, x, y) => onScrollDecelerate(widget, x, y));
|
||||||
|
@ -127,8 +119,10 @@ const setupControllers = <T>(widget: Gtk.Widget, {
|
||||||
return props;
|
return props;
|
||||||
};
|
};
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
export default <
|
||||||
export default <C extends new (...args: any[]) => Gtk.Widget>(
|
C extends new (...props: any[]) => Gtk.Widget,
|
||||||
|
ConstructorProps,
|
||||||
|
>(
|
||||||
cls: C,
|
cls: C,
|
||||||
clsName = cls.name,
|
clsName = cls.name,
|
||||||
) => {
|
) => {
|
||||||
|
@ -240,7 +234,6 @@ export default <C extends new (...args: any[]) => Gtk.Widget>(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
||||||
constructor(...params: any[]) {
|
constructor(...params: any[]) {
|
||||||
const props = params[0] || {};
|
const props = params[0] || {};
|
||||||
|
|
||||||
|
@ -264,5 +257,12 @@ export default <C extends new (...args: any[]) => Gtk.Widget>(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Widget;
|
type Constructor<Instance, Props> = new (...args: Props[]) => Instance;
|
||||||
|
|
||||||
|
type WidgetClass = Constructor<
|
||||||
|
Widget & Gtk.Widget & InstanceType<C>,
|
||||||
|
Partial<BindableProps<ConstructorProps>>
|
||||||
|
>;
|
||||||
|
|
||||||
|
return Widget as unknown as WidgetClass;
|
||||||
};
|
};
|
||||||
|
|
|
@ -12,8 +12,7 @@ export type BoxProps = ConstructProps<
|
||||||
@register({ GTypeName: 'Box' })
|
@register({ GTypeName: 'Box' })
|
||||||
export class BoxClass extends astalify(Astal.Box) {
|
export class BoxClass extends astalify(Astal.Box) {
|
||||||
constructor({ cssName = 'box', ...props }: BoxProps = {}) {
|
constructor({ cssName = 'box', ...props }: BoxProps = {}) {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
super({ cssName, ...props });
|
||||||
super({ cssName, ...props as any });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getChildren(self: BoxClass) {
|
getChildren(self: BoxClass) {
|
||||||
|
|
|
@ -16,8 +16,7 @@ export type ButtonProps = ConstructProps<
|
||||||
@register({ GTypeName: 'Button' })
|
@register({ GTypeName: 'Button' })
|
||||||
export class ButtonClass extends astalify(Gtk.Button) {
|
export class ButtonClass extends astalify(Gtk.Button) {
|
||||||
constructor({ cssName = 'button', ...props }: ButtonProps = {}) {
|
constructor({ cssName = 'button', ...props }: ButtonProps = {}) {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
super({ cssName, ...props });
|
||||||
super({ cssName, ...props as any });
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,8 +21,7 @@ export type CalendarProps = ConstructProps<
|
||||||
@register({ GTypeName: 'Calendar' })
|
@register({ GTypeName: 'Calendar' })
|
||||||
export class CalendarClass extends astalify(Gtk.Calendar) {
|
export class CalendarClass extends astalify(Gtk.Calendar) {
|
||||||
constructor({ cssName = 'calendar', ...props }: CalendarProps = {}) {
|
constructor({ cssName = 'calendar', ...props }: CalendarProps = {}) {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
super({ cssName, ...props });
|
||||||
super({ cssName, ...props as any });
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,7 @@ export type CenterBoxProps = ConstructProps<
|
||||||
@register({ GTypeName: 'CenterBox' })
|
@register({ GTypeName: 'CenterBox' })
|
||||||
export class CenterBoxClass extends astalify(Gtk.CenterBox) {
|
export class CenterBoxClass extends astalify(Gtk.CenterBox) {
|
||||||
constructor({ cssName = 'centerbox', ...props }: CenterBoxProps = {}) {
|
constructor({ cssName = 'centerbox', ...props }: CenterBoxProps = {}) {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
super({ cssName, ...props });
|
||||||
super({ cssName, ...props as any });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getChildren(box: CenterBoxClass) {
|
getChildren(box: CenterBoxClass) {
|
||||||
|
|
|
@ -17,8 +17,7 @@ export type EntryProps = ConstructProps<
|
||||||
@register({ GTypeName: 'Entry' })
|
@register({ GTypeName: 'Entry' })
|
||||||
export class EntryClass extends astalify(Gtk.Entry) {
|
export class EntryClass extends astalify(Gtk.Entry) {
|
||||||
constructor({ cssName = 'entry', ...props }: EntryProps = {}) {
|
constructor({ cssName = 'entry', ...props }: EntryProps = {}) {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
super({ cssName, ...props });
|
||||||
super({ cssName, ...props as any });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getChildren() { return []; }
|
getChildren() { return []; }
|
||||||
|
|
|
@ -12,8 +12,7 @@ export type ImageProps = ConstructProps<
|
||||||
@register({ GTypeName: 'Image' })
|
@register({ GTypeName: 'Image' })
|
||||||
export class ImageClass extends astalify(Gtk.Image) {
|
export class ImageClass extends astalify(Gtk.Image) {
|
||||||
constructor({ cssName = 'image', ...props }: ImageProps = {}) {
|
constructor({ cssName = 'image', ...props }: ImageProps = {}) {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
super({ cssName, ...props });
|
||||||
super({ cssName, ...props as any });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getChildren() { return []; }
|
getChildren() { return []; }
|
||||||
|
|
|
@ -12,8 +12,7 @@ export type LabelProps = ConstructProps<
|
||||||
@register({ GTypeName: 'Label' })
|
@register({ GTypeName: 'Label' })
|
||||||
export class LabelClass extends astalify(Gtk.Label) {
|
export class LabelClass extends astalify(Gtk.Label) {
|
||||||
constructor({ cssName = 'label', ...props }: LabelProps = {}) {
|
constructor({ cssName = 'label', ...props }: LabelProps = {}) {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
super({ cssName, ...props });
|
||||||
super({ cssName, ...props as any });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getChildren() { return []; }
|
getChildren() { return []; }
|
||||||
|
|
|
@ -12,8 +12,7 @@ export type LevelBarProps = ConstructProps<
|
||||||
@register({ GTypeName: 'LevelBar' })
|
@register({ GTypeName: 'LevelBar' })
|
||||||
export class LevelBarClass extends astalify(Gtk.LevelBar) {
|
export class LevelBarClass extends astalify(Gtk.LevelBar) {
|
||||||
constructor({ cssName = 'levelbar', ...props }: LevelBarProps = {}) {
|
constructor({ cssName = 'levelbar', ...props }: LevelBarProps = {}) {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
super({ cssName, ...props });
|
||||||
super({ cssName, ...props as any });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getChildren() { return []; }
|
getChildren() { return []; }
|
||||||
|
|
|
@ -12,8 +12,7 @@ export type MenuButtonProps = ConstructProps<
|
||||||
@register({ GTypeName: 'MenuButton' })
|
@register({ GTypeName: 'MenuButton' })
|
||||||
export class MenuButtonClass extends astalify(Gtk.MenuButton) {
|
export class MenuButtonClass extends astalify(Gtk.MenuButton) {
|
||||||
constructor({ cssName = 'menubutton', ...props }: MenuButtonProps = {}) {
|
constructor({ cssName = 'menubutton', ...props }: MenuButtonProps = {}) {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
super({ cssName, ...props });
|
||||||
super({ cssName, ...props as any });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getChildren(self: MenuButtonClass) {
|
getChildren(self: MenuButtonClass) {
|
||||||
|
|
|
@ -12,8 +12,7 @@ export type OverlayProps = ConstructProps<
|
||||||
@register({ GTypeName: 'Overlay' })
|
@register({ GTypeName: 'Overlay' })
|
||||||
export class OverlayClass extends astalify(Gtk.Overlay) {
|
export class OverlayClass extends astalify(Gtk.Overlay) {
|
||||||
constructor({ cssName = 'overlay', ...props }: OverlayProps = {}) {
|
constructor({ cssName = 'overlay', ...props }: OverlayProps = {}) {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
super({ cssName, ...props });
|
||||||
super({ cssName, ...props as any });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getChildren(self: OverlayClass) {
|
getChildren(self: OverlayClass) {
|
||||||
|
|
|
@ -12,8 +12,7 @@ export type PopoverProps = ConstructProps<
|
||||||
@register({ GTypeName: 'Popover' })
|
@register({ GTypeName: 'Popover' })
|
||||||
export class PopoverClass extends astalify(Gtk.Popover) {
|
export class PopoverClass extends astalify(Gtk.Popover) {
|
||||||
constructor({ cssName = 'popover', ...props }: PopoverProps = {}) {
|
constructor({ cssName = 'popover', ...props }: PopoverProps = {}) {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
super({ cssName, ...props });
|
||||||
super({ cssName, ...props as any });
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,7 @@ export type RevealerProps = ConstructProps<
|
||||||
@register({ GTypeName: 'Revealer' })
|
@register({ GTypeName: 'Revealer' })
|
||||||
export class RevealerClass extends astalify(Gtk.Revealer) {
|
export class RevealerClass extends astalify(Gtk.Revealer) {
|
||||||
constructor({ cssName = 'revealer', ...props }: RevealerProps = {}) {
|
constructor({ cssName = 'revealer', ...props }: RevealerProps = {}) {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
super({ cssName, ...props });
|
||||||
super({ cssName, ...props as any });
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,7 @@ export type SliderProps = ConstructProps<
|
||||||
@register({ GTypeName: 'Slider' })
|
@register({ GTypeName: 'Slider' })
|
||||||
export class SliderClass extends astalify(Astal.Slider) {
|
export class SliderClass extends astalify(Astal.Slider) {
|
||||||
constructor({ cssName = 'slider', ...props }: SliderProps = {}) {
|
constructor({ cssName = 'slider', ...props }: SliderProps = {}) {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
super({ cssName, ...props });
|
||||||
super({ cssName, ...props as any });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getChildren() { return []; }
|
getChildren() { return []; }
|
||||||
|
|
|
@ -12,8 +12,7 @@ export type StackProps = ConstructProps<
|
||||||
@register({ GTypeName: 'Stack' })
|
@register({ GTypeName: 'Stack' })
|
||||||
export class StackClass extends astalify(Gtk.Stack) {
|
export class StackClass extends astalify(Gtk.Stack) {
|
||||||
constructor({ cssName = 'stack', ...props }: StackProps = {}) {
|
constructor({ cssName = 'stack', ...props }: StackProps = {}) {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
super({ cssName, ...props });
|
||||||
super({ cssName, ...props as any });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setChildren(self: StackClass, children: Gtk.Widget[]) {
|
setChildren(self: StackClass, children: Gtk.Widget[]) {
|
||||||
|
|
|
@ -12,8 +12,7 @@ export type SwitchProps = ConstructProps<
|
||||||
@register({ GTypeName: 'Switch' })
|
@register({ GTypeName: 'Switch' })
|
||||||
export class SwitchClass extends astalify(Gtk.Switch) {
|
export class SwitchClass extends astalify(Gtk.Switch) {
|
||||||
constructor({ cssName = 'switch', ...props }: SwitchProps = {}) {
|
constructor({ cssName = 'switch', ...props }: SwitchProps = {}) {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
super({ cssName, ...props });
|
||||||
super({ cssName, ...props as any });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getChildren() { return []; }
|
getChildren() { return []; }
|
||||||
|
|
|
@ -12,8 +12,7 @@ export type WindowProps = ConstructProps<
|
||||||
@register({ GTypeName: 'Window' })
|
@register({ GTypeName: 'Window' })
|
||||||
export class WindowClass extends astalify(Astal.Window) {
|
export class WindowClass extends astalify(Astal.Window) {
|
||||||
constructor({ cssName = 'window', ...props }: WindowProps = {}) {
|
constructor({ cssName = 'window', ...props }: WindowProps = {}) {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
super({ cssName, ...props });
|
||||||
super({ cssName, ...props as any });
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue