Skip to content

Genrate typescript types from slint ui files using tree sitter

Notifications You must be signed in to change notification settings

sigmaSd/slintgen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SlintGen

Generate typescript types from a Slint ui file using tree sitter.

Install

$ cargo install --git https://github.com/sigmaSd/slintgen

Usage

$ slintgen ui.slint
$ slintgen ui.slint > ui.ts

Example

ui.slint

struct CPUData {
    number: int,
    active: bool,
}

export component Window inherits Window {
    title: "BurnCPU";
    in-out property <[CPUData]> cpu-data: [];
    in property <int> active-cpus: 0;
    callback toggleCPU(int, bool) -> bool;
$ slintgen ui.slint > ui.ts

ui.ts

export interface CPUData {
  number: number;
  active: boolean;
}

export interface Window {
  title: any;
  cpu_data: CPUData[];
  active_cpus: number;
  toggleCPU: (arg0: number, arg1: boolean) => boolean;
  run: () => Promise<void>;
}

Deno Port

There is also a deno port of this tool (It uses tree-sitter wasm bindings).

$ deno run --reload --allow-read --allow-net https://raw.githubusercontent.com/sigmaSd/slintgen/master/deno/main.ts ui.slint > ui.ts

About

Genrate typescript types from slint ui files using tree sitter

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published