feat(ags4): write own ConstructProps to exclude props
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
bd6fa7ba28
commit
e7accbd7bd
19 changed files with 65 additions and 33 deletions
|
@ -108,6 +108,7 @@ export default <
|
|||
this.setChildren(this, children);
|
||||
}
|
||||
|
||||
|
||||
private _cursorName: Cursor = 'default';
|
||||
|
||||
@property(String)
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
import { Gtk } from 'astal/gtk4';
|
||||
import { Binding } from 'astal/binding';
|
||||
|
||||
import { EventController } from './controller';
|
||||
|
||||
// A mixin class must have a constructor with a single rest parameter of type 'any[]'
|
||||
// eslint-disable-next-line "@typescript-eslint/no-explicit-any"
|
||||
export type MixinParams = any[];
|
||||
|
@ -28,6 +30,30 @@ export interface AstalifyProps {
|
|||
cursorName: Cursor
|
||||
}
|
||||
|
||||
type SigHandler<
|
||||
W extends InstanceType<typeof Gtk.Widget>,
|
||||
Args extends unknown[],
|
||||
> = ((self: W, ...args: Args) => unknown) | string | string[];
|
||||
|
||||
export type ConstructProps<
|
||||
Self extends InstanceType<typeof Gtk.Widget>,
|
||||
Props extends Gtk.Widget.ConstructorProps,
|
||||
Signals extends Record<`on${string}`, unknown[]> = Record<`on${string}`, unknown[]>,
|
||||
> = Partial<{
|
||||
// @ts-expect-error can't assign to unknown, but it works as expected though
|
||||
[S in keyof Signals]: SigHandler<Self, Signals[S]>
|
||||
}> & Partial<Record<`on${string}`, SigHandler<Self, unknown[]>>> & Partial<BindableProps<Omit<
|
||||
Props,
|
||||
'cssName' | 'css_name' | 'cursor'
|
||||
>>> & {
|
||||
noImplicitDestroy?: true
|
||||
type?: string
|
||||
cssName?: string
|
||||
} & EventController<Self> & {
|
||||
onDestroy?: (self: Self) => unknown
|
||||
setup?: (self: Self) => void
|
||||
};
|
||||
|
||||
export type Cursor =
|
||||
| 'default'
|
||||
| 'help'
|
||||
|
|
|
@ -2,4 +2,9 @@ import astalify from './astalify';
|
|||
|
||||
export default astalify;
|
||||
|
||||
export { type AstalifyProps, type BindableProps, childType } from './generics';
|
||||
export {
|
||||
type AstalifyProps,
|
||||
type BindableProps,
|
||||
type ConstructProps,
|
||||
childType,
|
||||
} from './generics';
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { register } from 'astal';
|
||||
import { Astal, type ConstructProps, Gtk } from 'astal/gtk4';
|
||||
import { Astal, Gtk } from 'astal/gtk4';
|
||||
|
||||
import astalify, { type AstalifyProps } from '../astalify';
|
||||
import astalify, { type AstalifyProps, type ConstructProps } from '../astalify';
|
||||
|
||||
|
||||
export type BoxProps = ConstructProps<
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { register } from 'astal';
|
||||
import { Gtk, type ConstructProps } from 'astal/gtk4';
|
||||
import { Gtk } from 'astal/gtk4';
|
||||
|
||||
import astalify, { type AstalifyProps } from '../astalify';
|
||||
import astalify, { type AstalifyProps, type ConstructProps } from '../astalify';
|
||||
|
||||
|
||||
type ButtonSignals = Record<`on${string}`, unknown[]> & {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { register } from 'astal';
|
||||
import { Gtk, type ConstructProps } from 'astal/gtk4';
|
||||
import { Gtk } from 'astal/gtk4';
|
||||
|
||||
import astalify, { type AstalifyProps } from '../astalify';
|
||||
import astalify, { type AstalifyProps, type ConstructProps } from '../astalify';
|
||||
|
||||
|
||||
type CalendarSignals = Record<`on${string}`, unknown[]> & {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { register } from 'astal';
|
||||
import { Gtk, type ConstructProps } from 'astal/gtk4';
|
||||
import { Gtk } from 'astal/gtk4';
|
||||
|
||||
import astalify, { type AstalifyProps } from '../astalify';
|
||||
import astalify, { type AstalifyProps, type ConstructProps } from '../astalify';
|
||||
|
||||
|
||||
export type CenterBoxProps = ConstructProps<
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { register } from 'astal';
|
||||
import { Gtk, type ConstructProps } from 'astal/gtk4';
|
||||
import { Gtk } from 'astal/gtk4';
|
||||
|
||||
import astalify, { type AstalifyProps } from '../astalify';
|
||||
import astalify, { type AstalifyProps, type ConstructProps } from '../astalify';
|
||||
|
||||
|
||||
type EntrySignals = Record<`on${string}`, unknown[]> & {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { register } from 'astal';
|
||||
import { Gtk, type ConstructProps } from 'astal/gtk4';
|
||||
import { Gtk } from 'astal/gtk4';
|
||||
|
||||
import astalify, { type AstalifyProps } from '../astalify';
|
||||
import astalify, { type AstalifyProps, type ConstructProps } from '../astalify';
|
||||
|
||||
|
||||
export type ImageProps = ConstructProps<
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { register } from 'astal';
|
||||
import { Gtk, type ConstructProps } from 'astal/gtk4';
|
||||
import { Gtk } from 'astal/gtk4';
|
||||
|
||||
import astalify, { type AstalifyProps } from '../astalify';
|
||||
import astalify, { type AstalifyProps, type ConstructProps } from '../astalify';
|
||||
|
||||
|
||||
export type LabelProps = ConstructProps<
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { register } from 'astal';
|
||||
import { Gtk, type ConstructProps } from 'astal/gtk4';
|
||||
import { Gtk } from 'astal/gtk4';
|
||||
|
||||
import astalify, { type AstalifyProps } from '../astalify';
|
||||
import astalify, { type AstalifyProps, type ConstructProps } from '../astalify';
|
||||
|
||||
|
||||
export type LevelBarProps = ConstructProps<
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { register } from 'astal';
|
||||
import { Gtk, type ConstructProps } from 'astal/gtk4';
|
||||
import { Gtk } from 'astal/gtk4';
|
||||
|
||||
import astalify, { type AstalifyProps } from '../astalify';
|
||||
import astalify, { type AstalifyProps, type ConstructProps } from '../astalify';
|
||||
|
||||
|
||||
export type MenuButtonProps = ConstructProps<
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { register } from 'astal';
|
||||
import { Gtk, type ConstructProps } from 'astal/gtk4';
|
||||
import { Gtk } from 'astal/gtk4';
|
||||
|
||||
import astalify, { childType, type AstalifyProps } from '../astalify';
|
||||
import astalify, { childType, type AstalifyProps, type ConstructProps } from '../astalify';
|
||||
|
||||
|
||||
export type OverlayProps = ConstructProps<
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { register } from 'astal';
|
||||
import { Gtk, type ConstructProps } from 'astal/gtk4';
|
||||
import { Gtk } from 'astal/gtk4';
|
||||
|
||||
import astalify, { type AstalifyProps } from '../astalify';
|
||||
import astalify, { type AstalifyProps, type ConstructProps } from '../astalify';
|
||||
|
||||
|
||||
export type PopoverProps = ConstructProps<
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { register } from 'astal';
|
||||
import { Gtk, type ConstructProps } from 'astal/gtk4';
|
||||
import { Gtk } from 'astal/gtk4';
|
||||
|
||||
import astalify, { type AstalifyProps } from '../astalify';
|
||||
import astalify, { type AstalifyProps, type ConstructProps } from '../astalify';
|
||||
|
||||
|
||||
export type RevealerProps = ConstructProps<
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { register } from 'astal';
|
||||
import { Astal, type ConstructProps } from 'astal/gtk4';
|
||||
import { Astal } from 'astal/gtk4';
|
||||
|
||||
import astalify, { type AstalifyProps } from '../astalify';
|
||||
import astalify, { type AstalifyProps, type ConstructProps } from '../astalify';
|
||||
|
||||
|
||||
type SliderSignals = Record<`on${string}`, unknown[]> & {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { register } from 'astal';
|
||||
import { Gtk, type ConstructProps } from 'astal/gtk4';
|
||||
import { Gtk } from 'astal/gtk4';
|
||||
|
||||
import astalify, { type AstalifyProps } from '../astalify';
|
||||
import astalify, { type AstalifyProps, type ConstructProps } from '../astalify';
|
||||
|
||||
|
||||
export type StackProps = ConstructProps<
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { register } from 'astal';
|
||||
import { Gtk, type ConstructProps } from 'astal/gtk4';
|
||||
import { Gtk } from 'astal/gtk4';
|
||||
|
||||
import astalify, { type AstalifyProps } from '../astalify';
|
||||
import astalify, { type AstalifyProps, type ConstructProps } from '../astalify';
|
||||
|
||||
|
||||
export type SwitchProps = ConstructProps<
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { register } from 'astal';
|
||||
import { Astal, type ConstructProps } from 'astal/gtk4';
|
||||
import { Astal } from 'astal/gtk4';
|
||||
|
||||
import astalify, { type AstalifyProps } from '../astalify';
|
||||
import astalify, { type AstalifyProps, type ConstructProps } from '../astalify';
|
||||
|
||||
|
||||
export type WindowProps = ConstructProps<
|
||||
|
|
Loading…
Reference in a new issue