gu: github.com/influx6/gu Index | Files | Directories

package gu

import "github.com/influx6/gu"

Package gu provides a UI framework for Go.

Index

Package Files

app.go appupdate_event.go gu.go viewupdate_event.go

func NewKey Uses

func NewKey() string

NewKey returns a new string key which is path of the incremental key which once initializes constantly increases.

type AppJSON Uses

type AppJSON struct {
    AppID         string             `json:"AppId"`
    Name          string             `json:"Name"`
    Title         string             `json:"Title"`
    Head          []ViewJSON         `json:"Head"`
    Body          []ViewJSON         `json:"Body"`
    HeadResources []trees.MarkupJSON `json:"HeadResources"`
    BodyResources []trees.MarkupJSON `json:"BodyResources"`
}

AppJSON defines a struct which holds the giving sets of tree changes to be rendered.

type AppUpdate Uses

type AppUpdate struct {
    App *NApp
}

AppUpdate defines a struct which is used to notify the need to update a App. @notification:event

type AppUpdateHandler Uses

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

AppUpdateHandler defines a structure type which implements the AppUpdateSubscriber interface and the EventDistributor interface.

func NewAppUpdateHandler Uses

func NewAppUpdateHandler(fn func(AppUpdate)) *AppUpdateHandler

NewAppUpdateHandler returns a new instance of a AppUpdateHandler.

func (*AppUpdateHandler) Handle Uses

func (sn *AppUpdateHandler) Handle(receive interface{})

Handle takes the giving value and asserts the expected value to match the AppUpdate type then passes it to the Receive method.

func (*AppUpdateHandler) Receive Uses

func (sn *AppUpdateHandler) Receive(elem AppUpdate)

Receive takes the giving value and execute it against the underline handler.

type AppUpdateNotification Uses

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

AppUpdateNotification defines a structure type which must be used to receive AppUpdate type has a event.

func NewAppUpdateNotification Uses

func NewAppUpdateNotification() *AppUpdateNotification

NewAppUpdateNotification returns a new instance of NewAppUpdateNotification.

func NewAppUpdateNotificationWith Uses

func NewAppUpdateNotificationWith(validation func(AppUpdate) bool) *AppUpdateNotification

NewAppUpdateNotificationWith returns a new instance of AppUpdateNotification.

func (*AppUpdateNotification) Handle Uses

func (sn *AppUpdateNotification) Handle(elem interface{})

Handle takes the giving value and asserts the expected value to be of the type and pass on to it's underline subscribers else ignoring the event.

func (*AppUpdateNotification) Notify Uses

func (sn *AppUpdateNotification) Notify(sub AppUpdateSubscriber)

Notify adds the given subscriber into the notification list and will await an update of a new event of the given AppUpdate type.

func (*AppUpdateNotification) UnNotify Uses

func (sn *AppUpdateNotification) UnNotify(sub AppUpdateSubscriber)

UnNotify removes the given subscriber from the notification's list if found from future events.

type AppUpdateSubscriber Uses

type AppUpdateSubscriber interface {
    Receive(AppUpdate)
}

AppUpdateSubscriber defines a interface that which is used to subscribe specifically for events AppUpdate type.

type ApplyView Uses

type ApplyView struct {
    Morph    bool
    Mounted  Subscriptions
    Rendered Subscriptions
    Content  trees.Appliable
    // contains filtered or unexported fields
}

ApplyView defines a MarkupRenderer implementing structure which returns its Content has its markup.

func ApplyStatic Uses

func ApplyStatic(tree trees.Appliable) *ApplyView

ApplyStatic defines a toplevel function which returns a new instance of a StaticView using the provided markup as its content.

func (*ApplyView) Render Uses

func (a *ApplyView) Render() *trees.Markup

Render returns the markup for the static view.

func (*ApplyView) RenderHTML Uses

func (a *ApplyView) RenderHTML() template.HTML

RenderHTML returns the html template version of the StaticView content.

func (*ApplyView) UUID Uses

func (a *ApplyView) UUID() string

UUID returns the RenderGroup UUID for identification.

type Component Uses

type Component struct {
    Reactive

    Target string

    Rendering Renderable
    Router    router.Resolver
    // contains filtered or unexported fields
}

Component defines a struct which

func (*Component) Render Uses

func (c *Component) Render() *trees.Markup

Render returns the markup corresponding to the internal Renderable.

func (Component) UUID Uses

func (c Component) UUID() string

UUID returns the identification for the giving component.

type Identity Uses

type Identity interface {
    UUID() string
}

Identity defines an interface which expoese the identity of a giving object.

type Location Uses

type Location interface {
    // Current Location of the driver path.
    Location() router.PushEvent

    // Navigate the Driver to the provided path.
    Navigate(router.PushDirectiveEvent)
}

Location defines an interface which exposes a type which allows the retrieval and setting of the location of a given display.

type MarkupRenderer Uses

type MarkupRenderer interface {
    Renderable
    RenderHTML() template.HTML
}

MarkupRenderer provides a interface for a types capable of rendering dom markup.

type NApp Uses

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

NApp defines a struct which encapsulates all the core view management functions for views.

func App Uses

func App(title string, router *router.Router) *NApp

App creates a new app structure to rendering gu components.

func (*NApp) ActivateRoute Uses

func (app *NApp) ActivateRoute(es interface{})

ActivateRoute actives the views which are to be rendered.

func (*NApp) Active Uses

func (app *NApp) Active() bool

Active returns true/false if the giving app is active and has already received rendering.

func (*NApp) AddAsset Uses

func (app *NApp) AddAsset(asset *trees.Markup, target ViewTarget)

AddAsset adds giving tree.Markup has assets to be loaded either in the head or body based on the posiiton desired.

func (*NApp) Do Uses

func (app *NApp) Do(appFun func(*NApp)) *NApp

Do calls the giving function providing it with the NApp instance.

func (*NApp) InitApp Uses

func (app *NApp) InitApp(location Location)

InitApp sets the Location to be used by the NApp and it's views and components.

func (*NApp) Location Uses

func (app *NApp) Location() router.PushEvent

Location returns the current route. It stores all set routes and returns the last route else returning a

func (*NApp) Mounted Uses

func (app *NApp) Mounted()

Mounted notifies all active views that they have been mounted.

func (*NApp) Navigate Uses

func (app *NApp) Navigate(pe router.PushDirectiveEvent)

Navigate sets the giving app location and also sets the location of the NOOPLocation which returns that always.

func (*NApp) PushViews Uses

func (app *NApp) PushViews(event router.PushEvent) []*NView

PushViews returns a slice of views that match and pass the provided path.

func (*NApp) Render Uses

func (app *NApp) Render(es interface{}) *trees.Markup

Render returns the giving rendered tree of the app respective of the path found.

func (*NApp) RenderJSON Uses

func (app *NApp) RenderJSON(es interface{}) AppJSON

RenderJSON returns the giving rendered tree of the app respective of the path found as jons structure with markup content.

func (*NApp) Resources Uses

func (app *NApp) Resources() ([]*trees.Markup, []*trees.Markup)

Resources return the giving resource headers which relate with the view.

func (*NApp) UUID Uses

func (app *NApp) UUID() string

UUID returns the uuid specific to the giving view.

func (*NApp) View Uses

func (app *NApp) View(renderable interface{}, route string, target ViewTarget) *NView

View returns a new instance of the view object.

type NView Uses

type NView struct {
    Reactive
    // contains filtered or unexported fields
}

NView defines a structure to encapsulates all rendering component for a given view.

func (*NView) Component Uses

func (v *NView) Component(renderable interface{}, order RenderingOrder, route string, target string)

Component adds the provided component into the selected view.

func (*NView) Disabled Uses

func (v *NView) Disabled() bool

Disabled returns true/false if the giving view is disabled.

func (*NView) Mounted Uses

func (v *NView) Mounted()

Mounted publishes changes notifications that the view is mounted.

func (*NView) Render Uses

func (v *NView) Render() *trees.Markup

Render returns the markup for the giving views.

func (*NView) RenderJSON Uses

func (v *NView) RenderJSON() ViewJSON

RenderJSON returns the ViewJSON for the provided View and its current events and changes.

func (*NView) Rendered Uses

func (v *NView) Rendered()

Rendered publishes changes notifications that the view is rendered.

func (*NView) Services Uses

func (v *NView) Services() Services

Services return s a Service instance which contains fields used by the Components of a view to gain access to the specific functionality of it's app root.

func (*NView) Target Uses

func (v *NView) Target() ViewTarget

Target returns the associated view target.

func (*NView) UUID Uses

func (v *NView) UUID() string

UUID returns the uuid specific to the giving view.

func (*NView) Unmounted Uses

func (v *NView) Unmounted()

Unmounted publishes changes notifications that the view is unmounted.

func (*NView) Updated Uses

func (v *NView) Updated()

Updated publishes changes notifications that the view is updated.

type NoopLocation Uses

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

NoopLocation defines a basic struct which implements the Location interface and is used to stand in for a app when not provided one.

func NewNoopLocation Uses

func NewNoopLocation(app *NApp) *NoopLocation

NewNoopLocation returns a new instance of a NoopLocation.

func (*NoopLocation) Location Uses

func (n *NoopLocation) Location() router.PushEvent

Location returns the current route. It stores all set routes and returns the last route else returning a

func (*NoopLocation) Navigate Uses

func (n *NoopLocation) Navigate(pe router.PushDirectiveEvent)

Navigate sets the giving app location and also sets the location of the NOOPLocation which returns that always.

type Properties Uses

type Properties interface {
    Get(string) interface{}
}

Properties defines a type which exposes a single method to retrieve values from.

type Reactive Uses

type Reactive interface {
    Reactor
    Publish()
}

Reactive extends the ReactiveRenderable by exposing a Publish method which allows calling the update notifications list of a ReactiveRenderable.

func NewReactive Uses

func NewReactive() Reactive

NewReactive returns an instance of a Reactive struct.

type Reactor Uses

type Reactor interface {
    React(func())
}

Reactor defines an interface for functions subscribing for notifications to react.

type RenderCommand Uses

type RenderCommand struct {
    Command string   `json:"Command"`
    App     AppJSON  `json:"App,omitempty"`
    View    ViewJSON `json:"View,omitempty"`
}

RenderCommand defines a struct to hold a giving command for the rendering of a App or View using the JSON format.

func AppRenderCommand Uses

func AppRenderCommand(app *NApp, route interface{}) RenderCommand

AppRenderCommand returns a new RenderCommand for rendering a app.

func ViewRenderCommand Uses

func ViewRenderCommand(view *NView) RenderCommand

ViewRenderCommand returns a new RenderCommand for rendering a view.

type Renderable Uses

type Renderable interface {
    Render() *trees.Markup
}

Renderable provides a interface for a renderable type.

type RenderableData Uses

type RenderableData struct {
    Name string
    Pkg  string
}

RenderableData defines a struct which contains the name of a giving renderable and it's package.

type Renderables Uses

type Renderables []Renderable

Renderables defines a lists of Renderable structures.

type RenderingOrder Uses

type RenderingOrder int

RenderingOrder defines a type used to define the order which rendering is to be done for a resource.

const (
    // FirstOrder defines that rendering be first in order.
    FirstOrder RenderingOrder = iota

    // AnyOrder defines that rendering be middle in order.
    AnyOrder

    // LastOrder defines that rendering be last in order.
    LastOrder
)

type Services Uses

type Services struct {
    AppUUID   string
    Location  Location
    Mounted   Subscriptions
    Rendered  Subscriptions
    Updated   Subscriptions
    Unmounted Subscriptions
    Router    *router.Router
    ViewRoute router.Resolver
}

Services defines a struct which exposes certain fields to be accessible to others.

type StaticView Uses

type StaticView struct {
    Content  *trees.Markup
    Mounted  Subscriptions
    Rendered Subscriptions
    Morph    bool
    // contains filtered or unexported fields
}

StaticView defines a MarkupRenderer implementing structure which returns its Content has its markup.

func Static Uses

func Static(tree *trees.Markup) *StaticView

Static defines a toplevel function which returns a new instance of a StaticView using the provided markup as its content.

func (*StaticView) Render Uses

func (s *StaticView) Render() *trees.Markup

Render returns the markup for the static view.

func (*StaticView) RenderHTML Uses

func (s *StaticView) RenderHTML() template.HTML

RenderHTML returns the html template version of the StaticView content.

func (*StaticView) UUID Uses

func (s *StaticView) UUID() string

UUID returns the RenderGroup UUID for identification.

type Subscription Uses

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

Subscription defines a baseline structure that can be composed into any struct to provide a reactive view.

func NewSubscriptions Uses

func NewSubscriptions() *Subscription

NewSubscriptions returns an instance of a Subscription pointer.

func (*Subscription) Clear Uses

func (r *Subscription) Clear()

Clear destroys all subscribers in the lists.

func (*Subscription) Publish Uses

func (r *Subscription) Publish()

Publish runs a through the subscription list and calls the registerd functions.

func (*Subscription) React Uses

func (r *Subscription) React(sub func())

React adds a function into the subscription list for this reactor.

func (*Subscription) Reset Uses

func (r *Subscription) Reset()

Reset resets the subscription has unused.

func (*Subscription) Used Uses

func (r *Subscription) Used() bool

Used returns true/false if the subscription has been called to publish.

type Subscriptions Uses

type Subscriptions interface {
    Reactive
    Clear()
    Reset()
    Used() bool
}

Subscriptions exposes an interface which combines a Reactive type and a clear function to dispose of subscribers.

type ViewJSON Uses

type ViewJSON struct {
    AppID  string           `json:"AppID"`
    ViewID string           `json:"ViewID"`
    Tree   trees.MarkupJSON `json:"Tree"`
}

ViewJSON defines a struct which holds the giving sets of view changes to be rendered.

type ViewTarget Uses

type ViewTarget int

ViewTarget defines a concrete type to define where the view should be rendered.

const (

    // BodyTarget defines the view target where the view is rendered in the body.
    BodyTarget ViewTarget = iota

    // HeadTarget defines the view target where the view is rendered in the head.
    HeadTarget

    // AfterBodyTarget defines the view target where the view is rendered after
    // body views content. Generally the browser moves anything outside of the body
    // into the body as last elements. So this will be the last elements rendered
    // in the border accordingly in the order they are added into the respective app.
    AfterBodyTarget
)

type ViewUpdate Uses

type ViewUpdate struct {
    App  *NApp
    View *NView
}

ViewUpdate defines a struct which is used to notify the need to update a App and a given view. @notification:event

type ViewUpdateHandler Uses

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

ViewUpdateHandler defines a structure type which implements the ViewUpdateSubscriber interface and the EventDistributor interface.

func NewViewUpdateHandler Uses

func NewViewUpdateHandler(fn func(ViewUpdate)) *ViewUpdateHandler

NewViewUpdateHandler returns a new instance of a ViewUpdateHandler.

func (*ViewUpdateHandler) Handle Uses

func (sn *ViewUpdateHandler) Handle(receive interface{})

Handle takes the giving value and asserts the expected value to match the ViewUpdate type then passes it to the Receive method.

func (*ViewUpdateHandler) Receive Uses

func (sn *ViewUpdateHandler) Receive(elem ViewUpdate)

Receive takes the giving value and execute it against the underline handler.

type ViewUpdateNotification Uses

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

ViewUpdateNotification defines a structure type which must be used to receive ViewUpdate type has a event.

func NewViewUpdateNotification Uses

func NewViewUpdateNotification() *ViewUpdateNotification

NewViewUpdateNotification returns a new instance of NewViewUpdateNotification.

func NewViewUpdateNotificationWith Uses

func NewViewUpdateNotificationWith(validation func(ViewUpdate) bool) *ViewUpdateNotification

NewViewUpdateNotificationWith returns a new instance of ViewUpdateNotification.

func (*ViewUpdateNotification) Handle Uses

func (sn *ViewUpdateNotification) Handle(elem interface{})

Handle takes the giving value and asserts the expected value to be of the type and pass on to it's underline subscribers else ignoring the event.

func (*ViewUpdateNotification) Notify Uses

func (sn *ViewUpdateNotification) Notify(sub ViewUpdateSubscriber)

Notify adds the given subscriber into the notification list and will await an update of a new event of the given ViewUpdate type.

func (*ViewUpdateNotification) UnNotify Uses

func (sn *ViewUpdateNotification) UnNotify(sub ViewUpdateSubscriber)

UnNotify removes the given subscriber from the notification's list if found from future events.

type ViewUpdateSubscriber Uses

type ViewUpdateSubscriber interface {
    Receive(ViewUpdate)
}

ViewUpdateSubscriber defines a interface that which is used to subscribe specifically for events ViewUpdate type.

Directories

PathSynopsis
assets
assets/packers
common
drivers
drivers/core
eventxPackage eventx attempts to provide a concrete go type for different events related to the DOM.
generators
generators/data
notifications
router
router/cache
router/cache/localcache
router/cache/memorycache
router/cache/webcache
treesPackage trees is a work inspired by a experiemental package by now authors of Vecty(github.com/gopherjs/vecty), although the provide similar API, the underline nature of how gutrees behave and function is heavily different from its original.
trees/css
trees/elems
trees/eventsPackage events defines the event binding system that combines different libraries to create a interesting event system.
trees/property
utils

Package gu imports 9 packages (graph). Updated 2019-02-20. Refresh now. Tools for package owners. This is a dead-end fork (no commits since the fork).