From 58fa1ab9be7ee8fd4a8e96865121a54d613978cc Mon Sep 17 00:00:00 2001 From: Aylur Date: Sat, 25 May 2024 14:44:50 +0200 Subject: separate node and gjs into its own package --- js/node/widgets.ts | 63 ------------------------------------------------------ 1 file changed, 63 deletions(-) delete mode 100644 js/node/widgets.ts (limited to 'js/node/widgets.ts') diff --git a/js/node/widgets.ts b/js/node/widgets.ts deleted file mode 100644 index 914821d..0000000 --- a/js/node/widgets.ts +++ /dev/null @@ -1,63 +0,0 @@ -/* eslint-disable max-len */ -import gi from "node-gtk" -import proxy, { type ConstructProps, type Widget } from "../src/astalify.js" -import type GtkT from "@girs/node-gtk-3.0/node-gtk-3.0" -import type AstalT from "@girs/node-astal-0.1/node-astal-0.1" - -const Astal = gi.require("Astal", "0.1") -const Gtk = gi.require("Gtk", "3.0") - -const proxify = proxy(Gtk, - prop => `set${prop.charAt(0).toUpperCase() + prop.slice(1)}`, - { - cssGetter: Astal.widgetGetCss, - cssSetter: Astal.widgetSetCss, - classGetter: Astal.widgetGetClassNames, - classSetter: Astal.widgetSetClassNames, - cursorGetter: Astal.widgetGetCursor, - cursorSetter: Astal.widgetSetCursor, - }) - -export function astalify< - C extends typeof Gtk.Widget, - P extends Record, - N extends string = "Widget", ->(klass: C) { - // eslint-disable-next-line @typescript-eslint/no-unused-vars - type Astal = Omit & { - new(props: P, ...children: GtkT.Widget[]): Widget - (props: P, ...children: GtkT.Widget[]): Widget - } - - return proxify(klass) as unknown as Astal -} - -// Label -export const Label = astalify(Gtk.Label) -export type LabelProps = ConstructProps - -// Icon -export const Icon = astalify(Astal.Icon) -export type IconProps = ConstructProps - -// Button -export const Button = astalify(Astal.Button) -export type ButtonProps = ConstructProps) => void -}> - -// Window -export const Window = astalify(Astal.Window) -export type WindowProps = ConstructProps - -// Box -export const Box = astalify(Astal.Box) -export type BoxProps = ConstructProps - -// CenterBox -export const CenterBox = astalify(Astal.CenterBox) -export type CenterBoxProps = ConstructProps - -// EventBox -export const EventBox = astalify(Astal.EventBox) -export type EventBoxProps = ConstructProps -- cgit v1.2.3