ShanaMaid / app

Package to build GUI apps with Go, HTML and CSS.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

app

Build Status Go Report Card Coverage Status awesome-go GoDoc

A multi-platform UI framework that uses Go, HTML and CSS.

ui demo

Table of Contents

Install

# Install:
go get -u -v github.com/murlokswarm/app/...

# Update:
goapp update -v

Supported platforms

Platform Status
MacOS
Web
Windows 🔨
Linux

Hello world

Setup

# Go to your repository:
cd YOUR_REPO

# Init the repo:
goapp mac init

Code

// YOUR_REPO/main.go

// Hello compo.
type Hello struct {
    Name string
}

func (h *Hello) Render() string {
    return `
<div class="Hello">
    <h1>
        Hello
        {{if .Name}}
            {{.Name}}
        {{else}}
            world
        {{end}}!
    </h1>
    <input value="{{.Name}}" placeholder="Write a name..." onchange="Name" autofocus>
</div>
    `
}

func main() {
    app.Import(&Hello{})

    // Use mac driver with Hello compo.
    app.Run(&mac.Driver{
        URL: "/hello",
    })
}

Build and run

# Build and run with debug mode:
goapp mac run -d

View full example.

Architecture

ui architecture

Elem

An elem represents an UI element to be displayed. Some can be customized with HTML content:

Others are simple:

Compo

A compo represents an independent and reusable piece of UI. It exposes an HTML representation of the UI that can be customized by the template syntax defined in the Go standard library. Compos are loaded into elems that support HTML customization.

Driver

A driver represents the app backend. It exposes Go operations to create/modify the UI and calls their platform specific implementations.

Goapp

Goapp is a CLI tool to build and run apps built with the app package.

Depending on the platform, apps must be packaged in order to be deployed and distributed. Packaged applications are usually not managed by a terminal, which can be an issue when we want to monitor the logs or stop their execution with system signals.

Goapp can package apps and allows to run them while keeping logs and managing their lyfecycle within the terminal.

Examples:

goapp -h         # Help.
goapp mac -h     # Help for MasOS commands.
goapp mac run -h # Help for MasOS run command.

goapp mac run    # Run MacOS .app.
goapp mac run -d # Run MacOS .app with debug.

goapp web run    # Run a web server.
goapp web run -b # Run a web server and launch the main page in the default browser.

Documentation

Donate

If this project helps you build awesome UI, you can help me grow my cryptos :)

Crypto Address
Ethereum (ETH) 0x789D63B8869783a15bbFb43331a192DdeC4bDE53
Bitcoin (BTC) 3PRMM9fj7yq9gHxgk2svewWF9BkzzGPa1b

About

Package to build GUI apps with Go, HTML and CSS.

License:MIT License


Languages

Language:Go 78.8%Language:Objective-C 19.0%Language:JavaScript 1.9%Language:HTML 0.2%