npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

fre-godot

v0.0.3

Published

Tiny Concurrent UI library with Fiber. For Godot with Javascript bindings.

Downloads

7

Readme

About

This is a fork of Fre, a small concurrent ui library, adapted for the Godot engine with javascript bindings.

Demo

You can find a demo project here.

Status

In no particular order.

  • [x] Proof of concept.
  • [ ] Create roadmap.
  • [ ] Implement jsx for nodes that maintain their own internal hierachy. i.e. Graphs, MenuButton, Tree, etc.
  • [ ] Add some better form of styling. Looking at the godot-css-theme for inspiration.
  • [ ] Better integration between GDScript and JSX classes. Not sure how as this probably requires modification of the ECMAScript module or Godot it self.
  • [ ] (Re)implement concurrent rendering.
  • [ ] Implement text nodes, maybe.
  • [ ] Create proper api and integration for classes.

Use

Godot Class

You need to create a godot class and have it import the app. Then,when the node is ready you can render the app. Note: you should be able to use all classes derived from Node.

Example:

import { render } from "fre-godot";
import App from './path/to/App'

export default class GodotFreApp extends godot.Control {

	constructor() {
		super();	
	}
	
	// Called when the node enters the scene tree for the first time.
	_ready() {
		render(<App />, this);
	}
	
}

Components

The component:

//App.jsx
import { render, useState } from 'fre-godot'

function App() {
  const [count, setCount] = useState(0)
  return 
  (
    <hbox>
      <label text={`${count}`} />
      <button on_pressed_={() => setCount(count + 1)} text={`+`} />
    </hbox>
  )
}

Classes

Note: These are not stable yet.

You can also use classes.

They need to inherit from a Control derived class. Fiber is set by Fre right after instantiation. You can access props through that member.

//App.jsx
import { IFiber } from 'fre-godot'

export default class TestClass extends godot.Control {

    //fre
    fiber: IFiber = null;

    constructor() {
        super();
    }

    _enter_tree() {
    }

    _ready() {
    }

    _render() {
        return (
            <vbox>
                <label text="Test Class Comp" />
                {this.fiber.props.children}
            </vbox>
        )
    }

}

Tag List

Most tags are not mapped to a different name. I did however map HBoxContainer and VBoxContainer to hbox and vbox respectivly.

Current List:

| Tag | Godot Class | |-----------------|-----------------| | control | Control | | label | Label | | panel | Panel | | vbox | VBoxContainer | | hbox | HBoxContainer | | panelcontainer | PanelContainer | | margincontainer | MarginContainer | | tabcontainer | TabContainer | | gridcontainer | GridContainer | | scrollcontainer | ScrollContainer | | centercontainer | CenterContainer | | button | Button | | optionbutton | OptionButton | | menubutton | MenuButton | | linkbutton | LinkButton | | textedit | TextEdit | | lineedit | LineEdit | | progressbar | ProgressBar | | spinbox | SpinBox | | hslider | HSlider | | vslider | VSlider | | colorpicker | ColorPicker | | hseperator | HSeparator | | vseperator | VSeparator |

Properties

You can set node properties through props.
They use snake case naming convention.
Like so:

<label text={'text'} />

Signals

Godot signals are the equivalent of dom event listeners.
They use snake case naming convention.

Use the following:

<button on_pressed={someFunction} />

Instead of:

<button onPressed={someFunction} />

Theme

There is a rudementry implementation of themes.

Note: StyleBox is not implemented.

The following example will produce a Label node with red text:

const theme = {
	Label:
	{
		color: {
			font_color: new godot.Color(1, 0, 0)
		}
	},
}

<label theme={theme} />