GithubHelp home page GithubHelp logo

dao12dao / app Goto Github PK

View Code? Open in Web Editor NEW

This project forked from maxence-charriere/go-app

0.0 2.0 0.0 25.12 MB

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

License: MIT License

Go 78.56% Objective-C 19.16% HTML 0.28% JavaScript 2.00%

app's Introduction

ui demo

app

Build Status Go Report Card Coverage Status awesome-go GoDoc Donate with Bitcoin Donate with Ethereum

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

Table of Contents

Install

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

# Update:
goapp update -v

Supported platforms

Platform Minimum OS Minimum Go version Status
MacOS MacOS 10.11 (El Capitan) 1.11
Web MacOS 10.11, Windows 10 (April 2018 Update) or Linux 1.11
Windows Windows 10 (April 2018 Update) 1.11 🔨
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 :)

Donate with Bitcoin

Donate with Ethereum

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.