/yues-gui-components-js

A set of JS-native components for YueS

Primary LanguageTypeScriptMIT LicenseMIT

Support Ukraine ukraine

While you're reading this text we're suffering from russia's bombs. Please help us to stand against russia's invasion and prevent World War III. It's pretty easy with UNITED24 fundraising platform. Thank you!

YueS GUI components for Node.js and Deno

Basic set of GUI components for YueS GUI server (intended to be used with Node.js or Deno libs). Follows original components API as close as possible. Therefore you may use original docs.
Written in Typescript without external dependencies.
It's meant to be used as a dependency while creating your own high-level GUI libraries. It's recommended not to use this library directly in your apps.
Builds itself using tsup.

Basics

Requires calling init(server: Server, EventEmitter: typeof EventEmitter) method before creating any components and destroy(childProcessTimeout?: number) after you've finished your work. You don't need to init or destroy the server you're passing to init call, this lib will do it for you. All you need is passing server instance (new Server()) imported from your platform-dependent implementation of YueS client and EventEmitter constructor. For Node.js the client is located on NPM as yues-client, for Deno or Bun there is no implemented clients yet.
For any underlaying client lib, the initialization/destroy of this lib should look the same:

// for Deno, replace imports with links
import { Server } from 'yues-client';
import { init, destroy, Window } from 'yues-gui-components';
import { EventEmitter } from 'node:events';

await init(new Server(), EventEmitter);

async function createSample() {
    // create window
    const window = new Window({});
    // make sure window component's initialized before calling any method
    await window.initialized;
    // destroy all the suff after window has been closed
    window.once('close', () => destroy());
    // call any methods
    await window.center();
    await window.activate();
}

Implemented components

* A lot of original components may be missing yet

Specific components

Components you may construct and use directly

Implemented basic components

Components that can't be constructed but they're the basics for more complex components
* A lot of original components may be missing yet