Exemplo n.º 1
0
func testText() *wax.Part {
	t := `- write a ws pg that knows how to display multiple parts with
	  drag and drop and resizes. Play embedding just a chunk of html
	  and later play with embedding something from a different url

	- write a canvas ctl
	- port the old canvas text frame using the canvas ctl
	- write an terminal variant that simply honors In,Out,Err chans
	  on a text frame.
	- use local storage to save the layout editing state for errors
	  and to recover those if desired
	- make sure we can share an inner part with controls multiple times
	 (ie not just repeating controls, but parts with controls, although
	 for this we should probably use iframes)

	- use tls for conns to the registry and peers
	- put in place some kind of auth
	- make the registry a hierarchy, so that we can have
	  registry islands and they sync to each other
	  make it use broadcast to discover other machines nearby
	  and propagate island information

`
	if err := tTxt.Ins([]rune(t), 0); err != nil {
		dbg.Fatal("txt ins: %s", err)
	}
	p, err := wax.New("$txt$")
	if err != nil {
		dbg.Fatal("new part: %s", err)
	}
	p.SetEnv(map[string]interface{}{"txt": tTxt})
	return p

}
Exemplo n.º 2
0
func testFor() *wax.Part {
	forpg := `
		Trees:
		<ul>
		$for t in repl.Trees do$
			<li>
			Name: $t.Name$;
			Path: $t.Path$;
			Kind: $t.Sync$
			<ul>
			$for p in t.Peers do$
				<li>
				$p$
			$end$
			</ul>
		$end$
		</ul>
	`
	p, err := wax.New(forpg)
	if err != nil {
		dbg.Fatal("new part: %s", err)
	}
	tenv := map[string]interface{}{"repl": tRepl}
	p.SetEnv(tenv)
	return p
}
Exemplo n.º 3
0
func testCanvas() *wax.Part {
	p, err := wax.New("$tc$")
	if err != nil {
		dbg.Fatal("new part: %s", err)
	}
	p.SetEnv(map[string]interface{}{"tc": tCanvas})
	return p
}
Exemplo n.º 4
0
func testAdt() *wax.Part {
	p, err := wax.New(`$repl$`)
	if err != nil {
		dbg.Fatal("new part: %s", err)
	}
	p.SetEnv(map[string]interface{}{"repl": tRepl})
	return p
}
Exemplo n.º 5
0
func testTb() *wax.Part {
	tbpg := `
		<p> Single entry<br>
		$entry$
		<p>
		A tool bar:<br>
		$tb$
	`
	p, err := wax.New(tbpg)
	if err != nil {
		dbg.Fatal("new part: %s", err)
	}
	tenv := map[string]interface{}{
		"entry": tEntry,
		"tb":    tTb,
	}
	p.SetEnv(tenv)
	return p
}
Exemplo n.º 6
0
func zxwax() {
	ctrl := ctl.NewControl()
	ctrl.BoolFlag("Debug", &Debug)
	ctrl.CmdFlag("Exit", func() {
		dbg.Fatal("exiting at user request")
	})
	wax.ServeLogin("/", "/index")
	pg := `$tb$<p>$zx$<p>`
	part, err := wax.New(pg)
	if err != nil {
		dbg.Warn("wax new: %s", err)
		return
	}
	part.SetEnv(map[string]interface{}{
		"tb": ctrl.Bar("tb"),
		"zx": zxw,
	})
	part.Serve("/index")
	if err = wax.Serve(":" + wport); err != nil {
		dbg.Warn("wax serve: %s", err)
	}
}
Exemplo n.º 7
0
func testTreeTb() *wax.Part {
	treepg := `
		$tb$ <br>
		$t.Name$
		$t.Path$
		<ul>
		$for p in t.Peers do$
			<li>
			$p$
		$end$
		</ul>
	`
	p, err := wax.New(treepg)
	if err != nil {
		dbg.Fatal("new part: %s", err)
	}
	tenv := map[string]interface{}{
		"tb": tTb,
		"t":  tRepl.Trees[1],
	}
	p.SetEnv(tenv)
	return p
}