giocomp

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

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

Go to latest
Published: Dec 16, 2021 License: Unlicense Imports: 7 Imported by: 0

README

Experiments for Components in Gio UI

Gio is a great UI-framework in Go. It follows a paradigm of immediate mode UI, an approach which is supposed to make it easier to reason about state changes.

For more complex UI layouts it is advantageous to be able to factor the UI into manageable entities. Svelte, a recent framework for Javascript, does this for the reactive UI paradigm, and using it feels pretty comfortable. I like Svelte's approach for a couple of reasons:

  • Locality of code for behaviour and looks of a component
  • Direct correlation between view delegate objects and display
  • Sane event propagation model
  • All kinds of smart helpers

With Svelte, much of this is supported by a compiler, which produces efficient code to alter the DOM. In Go code-generation is common, but I prefer being able to write expressive code on top of smart base objects.

This repo is a test if expressive user-level UI-code can be written for Gio. This is a super rough first sketch, and I will eventually build upon it to grow it into something useful.

Examples

The user-level code resides in the examples folder, together with a description of what I learned implementing them.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(application Application, opts ...app.Option)

Types

type Application

type Application interface {
	HandleEvent(event.Event)
	Layout()
}

type ApplicationRunner

type ApplicationRunner struct {
	// contains filtered or unexported fields
}

func (ApplicationRunner) MainLoop

func (runner ApplicationRunner) MainLoop(w *app.Window, conn scheduler.Connection) error

type ConnectEvent

type ConnectEvent struct {
	// contains filtered or unexported fields
}

func (ConnectEvent) Connection

func (cev ConnectEvent) Connection() scheduler.Connection

func (ConnectEvent) ImplementsEvent

func (cev ConnectEvent) ImplementsEvent()

ImplementsEvent is a marker interface in io.event.

Directories

Path Synopsis
examples
css

Jump to

Keyboard shortcuts

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