Implemented strict linting standards and prettier formatting config. (#248)

* Implemented strict linting standards and prettier formatting config.

* More linter fixes and type updates.

* More linter updates and type fixes

* Remove noisy comments

* Linter and type updates

* Linter, formatting and type updates.

* Linter updates

* Type updates

* Type updates

* fixed all linter errors

* Fixed all linting, formatting and type issues.

* Resolve merge conflicts.
This commit is contained in:
Jas Singh
2024-09-14 16:20:05 -07:00
committed by GitHub
parent ff13e3dd3c
commit 2c72cc66d8
222 changed files with 13141 additions and 8433 deletions

View File

@@ -1,25 +1,32 @@
import { WINDOW_LAYOUTS } from "globals/window";
import { LayoutFunction, Layouts, PopupWindowProps } from "lib/types/popupwindow";
import { Exclusivity, Transition } from "lib/types/widget";
import { WINDOW_LAYOUTS } from 'globals/window';
import { LayoutFunction, Layouts, PopupWindowProps } from 'lib/types/popupwindow';
import { Attribute, Child, Exclusivity, GtkWidget, Transition } from 'lib/types/widget';
import Box from 'types/widgets/box';
import EventBox from 'types/widgets/eventbox';
import Window from 'types/widgets/window';
type Opts = {
className: string
vexpand: boolean
}
className: string;
vexpand: boolean;
};
export const Padding = (name: string, opts: Opts) =>
export const Padding = (name: string, opts: Opts): EventBox<Box<GtkWidget, Attribute>, unknown> =>
Widget.EventBox({
class_name: opts?.className || "",
class_name: opts?.className || '',
hexpand: true,
vexpand: typeof opts?.vexpand === "boolean" ? opts.vexpand : true,
vexpand: typeof opts?.vexpand === 'boolean' ? opts.vexpand : true,
can_focus: false,
child: Widget.Box(),
setup: (w) => w.on("button-press-event", () => App.toggleWindow(name)),
setup: (w) => w.on('button-press-event', () => App.toggleWindow(name)),
});
const PopupRevealer = (name: string, child: any, transition = "slide_down" as Transition) =>
const PopupRevealer = (
name: string,
child: GtkWidget,
transition = 'slide_down' as Transition,
): Box<Child, Attribute> =>
Widget.Box(
{ css: "padding: 1px;" },
{ css: 'padding: 1px;' },
Widget.Revealer({
transition,
child: Widget.Box({
@@ -34,7 +41,7 @@ const PopupRevealer = (name: string, child: any, transition = "slide_down" as Tr
}),
);
const Layout: LayoutFunction = (name: string, child: any, transition: Transition) => ({
const Layout: LayoutFunction = (name: string, child: GtkWidget, transition: Transition) => ({
center: () =>
Widget.CenterBox(
{},
@@ -51,14 +58,10 @@ const Layout: LayoutFunction = (name: string, child: any, transition: Transition
Widget.CenterBox(
{},
Padding(name, {} as Opts),
Widget.Box(
{ vertical: true },
PopupRevealer(name, child, transition),
Padding(name, {} as Opts),
),
Widget.Box({ vertical: true }, PopupRevealer(name, child, transition), Padding(name, {} as Opts)),
Padding(name, {} as Opts),
),
"top-right": () =>
'top-right': () =>
Widget.Box(
{},
Padding(name, {} as Opts),
@@ -69,13 +72,13 @@ const Layout: LayoutFunction = (name: string, child: any, transition: Transition
},
Padding(name, {
vexpand: false,
className: "event-top-padding",
className: 'event-top-padding',
}),
PopupRevealer(name, child, transition),
Padding(name, {} as Opts),
),
),
"top-center": () =>
'top-center': () =>
Widget.Box(
{},
Padding(name, {} as Opts),
@@ -86,14 +89,14 @@ const Layout: LayoutFunction = (name: string, child: any, transition: Transition
},
Padding(name, {
vexpand: false,
className: "event-top-padding",
className: 'event-top-padding',
}),
PopupRevealer(name, child, transition),
Padding(name, {} as Opts),
),
Padding(name, {} as Opts),
),
"top-left": () =>
'top-left': () =>
Widget.Box(
{},
Widget.Box(
@@ -103,14 +106,14 @@ const Layout: LayoutFunction = (name: string, child: any, transition: Transition
},
Padding(name, {
vexpand: false,
className: "event-top-padding",
className: 'event-top-padding',
}),
PopupRevealer(name, child, transition),
Padding(name, {} as Opts),
),
Padding(name, {} as Opts),
),
"bottom-left": () =>
'bottom-left': () =>
Widget.Box(
{},
Widget.Box(
@@ -123,7 +126,7 @@ const Layout: LayoutFunction = (name: string, child: any, transition: Transition
),
Padding(name, {} as Opts),
),
"bottom-center": () =>
'bottom-center': () =>
Widget.Box(
{},
Padding(name, {} as Opts),
@@ -137,7 +140,7 @@ const Layout: LayoutFunction = (name: string, child: any, transition: Transition
),
Padding(name, {} as Opts),
),
"bottom-right": () =>
'bottom-right': () =>
Widget.Box(
{},
Padding(name, {} as Opts),
@@ -159,25 +162,25 @@ const isValidLayout = (layout: string): layout is Layouts => {
export default ({
name,
child,
layout = "center",
layout = 'center',
transition,
exclusivity = "ignore" as Exclusivity,
exclusivity = 'ignore' as Exclusivity,
...props
}: PopupWindowProps) => {
const layoutFn = isValidLayout(layout) ? layout : "center";
}: PopupWindowProps): Window<Child, Attribute> => {
const layoutFn = isValidLayout(layout) ? layout : 'center';
const layoutWidget = Layout(name, child, transition)[layoutFn]();
return Widget.Window({
name,
class_names: [name, "popup-window"],
setup: (w) => w.keybind("Escape", () => App.closeWindow(name)),
class_names: [name, 'popup-window'],
setup: (w) => w.keybind('Escape', () => App.closeWindow(name)),
visible: false,
keymode: "on-demand",
keymode: 'on-demand',
exclusivity,
layer: "top",
anchor: ["top", "bottom", "right", "left"],
layer: 'top',
anchor: ['top', 'bottom', 'right', 'left'],
child: layoutWidget,
...props,
});
}
};