haiku

package module
v0.0.0-...-a33cf17 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 9, 2016 License: MIT Imports: 0 Imported by: 0

README

Haiku

GoDoc

Haiku is a view rendering framework(the V in MVC), built to render as fast as possible. Built on the solid foundation that Gopherjs provides. Haiku combines a virtual DOM rendering system to ensure the minimum work done in updating rendered elements whilst still allowing the freedom to decide how your elements are built and viewed.

DevNote

Haiku was an interesting experiment and a lot was learnt while developing it, but I have decided to separate out the pieces that provided the total functionality for Haiku into a central repository where you are free to pick which parts fits your needs, Haiku will still be useful but any further development will be done on those separate pieces.

You can find them at:

Install

go get -u github.com/influx6/haiku/...

Example


  package main

  import (
      "honnef.co/go/js/dom"
  	"github.com/influx6/haiku/trees"
  	"github.com/influx6/haiku/trees/attrs"
  	"github.com/influx6/haiku/trees/elems"
  )

  type videoList []map[string]string

  func (v videoList) Render(m ...string) trees.Markup {
  	dom := elems.Div()
  	for _, data := range v {
  		dom.Augment(elems.Video(
  			attrs.Src(data["src"]),
  			elems.Text(data["name"]),
  		))
  	}
  	return dom
  }

  func main() {

  	videos := NewView(videoList([]map[string]string{
  		map[string]string{
  			"src":  "https://youtube.com/xF5R32YF4",
  			"name": "Joyride Lewis!",
  		},
  		map[string]string{
  			"src":  "https://youtube.com/dox32YF4",
  			"name": "Wonderlust Bombs!",
  		},
  	}))

  	/*
  videos.RenderHTML() =>
    <div hash="fUPpf3XsV2"  uid="PkOaCB3C" style="">
      <video hash="TzmLsvA7j2"  uid="jq3Xl9gq" src="https://youtube.com/xF5R32YF4" style="">Joyride Lewis!</video>
      <video hash="t8jeXh1JrU"  uid="GSv22Nqb" src="https://youtube.com/dox32YF4" style="">Wonderlust Bombs!</video>
    </div>  
    */

  win := dom.GetWindow()
	doc := win.Document()

	body := doc.QuerySelector("body")


	video.Mount(body.Underlying())


Goals

  • Create simple and go idiomatic views.
  • Be fast and efficient even when compiled down with Gopherjs.

Current Features

  • State based view management using a state machines.
  • Pure string rendering of views with custom markup structures.
  • DOM Patching/Diffing mechanism

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package base provides core fundation types and structures for haiku.
Package base provides core fundation types and structures for haiku.
Package jsutils contains dom level helper functions for Haiku(https://github.com/influx6/haiku)
Package jsutils contains dom level helper functions for Haiku(https://github.com/influx6/haiku)
Package pub provides a functional reactive pubsub structure to leverage a pure function style reactive behaviour.
Package pub provides a functional reactive pubsub structure to leverage a pure function style reactive behaviour.
Package shared contains share coding that works between front and backend code
Package shared contains share coding that works between front and backend code
Trees contain the rendering structures that provide the markup generation for haiku
Trees contain the rendering structures that provide the markup generation for haiku
events
Package events defines the event binding system for Haiku(https://github.com/influx6/Haiku)
Package events defines the event binding system for Haiku(https://github.com/influx6/Haiku)
Package views contain the state machine and view system used by Haiku components
Package views contain the state machine and view system used by Haiku components

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL