frame

package
v0.0.0-...-0564b78 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PageHashAttr     = "data-hlive-hash"
	PageHashAttrTmpl = "{data-hlive-hash}"
)
View Source
const (
	DiffApplyEvent         = "diffapply"
	DiffApplyAttributeName = "data-hlive-on-diffapply"
)
View Source
const FocusAttributeName = "data-hlive-focus"
View Source
const (
	PreemptDisableAttributeName = "data-hlive-pre-disable"
)
View Source
const PreventDefaultAttributeName = "data-hlive-pd"
View Source
const RedirectAttributeName = "data-redirect"
View Source
const ScrollTopAttributeName = "data-scrollTop"
View Source
const StopPropagationAttributeName = "data-hlive-sp"

Variables

View Source
var DiffApplyScript []byte
View Source
var ErrInvalidListAdd = errors.New("value is not valid for a list")
View Source
var FocusJavaScript []byte
View Source
var PreemptDisableOnClickJavaScript []byte
View Source
var PreventDefaultJavaScript []byte
View Source
var RedirectJavaScript []byte
View Source
var ScrollTopJavaScript []byte
View Source
var StopPropagationJavaScript []byte

Functions

func Focus

func Focus() engine.Attributer

func FocusRemove

func FocusRemove(tag engine.Adder)

func OnDiffApplyOnce

func OnDiffApplyOnce(handler engine.EventHandler) *engine.ElementGroup

TODO: how we remove the attribute once done?

func PageOptionCache

func PageOptionCache(cache Cache) func(*Page)

func PipelineProcessorRenderHashAndCache

func PipelineProcessorRenderHashAndCache(logger zerolog.Logger, renderer *engine.Renderer, cache Cache) *engine.PipelineProcessor

PipelineProcessorRenderHashAndCache that will cache the returned tree to support SSR

func PreemptDisableOn

func PreemptDisableOn(eb *engine.EventBinding) *engine.ElementGroup

TODO: Once?

func PreventDefaultRemove

func PreventDefaultRemove(tag engine.Adder)

func Redirect

func Redirect(url string) engine.Attributer

func ScrollTop

func ScrollTop(val int) engine.Attributer

func ScrollTopRemove

func ScrollTopRemove(tag engine.Adder)

func StopPropagation

func StopPropagation() engine.Attributer

func StopPropagationRemove

func StopPropagationRemove(tag engine.Adder)

Types

type Cache

type Cache interface {
	Get(key any) (value any, hit bool)
	Set(key any, value any)
}

Cache allow cache adapters to be used in HLive

type ComponentList

type ComponentList struct {
	*ComponentListSimple
}

ComponentList is a way to manage a dynamic collection of Teardowner Node values. For example, the rows of a table.

As the Node values in ComponentList are often added and removed there lies the possibility of memory leaks. To prevent this the items in the list must be Teardowner values. The list will call Teardown on each item as long as they are removed using its RemoveItem and RemoveAllItems functions.

See NewComponentMountable, CM, WrapMountable, and WM for help with creating Teardowner values.

func List

func List(name string, elements ...any) *ComponentList

List is a shortcut for NewComponentList.

func NewComponentList

func NewComponentList(name string, elements ...any) *ComponentList

NewComponentList returns a value of ComponentList

func (*ComponentList) Add

func (list *ComponentList) Add(elements ...any)

Add an element to this Component.

You can add Groups, Teardowner, EventBinding, or None Node Elements

func (*ComponentList) AddItem

func (list *ComponentList) AddItem(items ...engine.Teardowner)

AddItem allows you to add a node to the list

Add nodes are often added and removed nodes needed to be a Teardowner. See NewComponentMountable, CM, WrapMountable, and WM for help with creating Teardowner values.

func (*ComponentList) RemoveAllItems

func (list *ComponentList) RemoveAllItems()

RemoveAllItems empties the list of items and calls Teardown on each of them.

func (*ComponentList) RemoveItems

func (list *ComponentList) RemoveItems(items ...engine.Teardowner)

RemoveItems will remove a Teardowner can call its Teardown function.

type ComponentListSimple

type ComponentListSimple struct {
	*engine.ComponentMountable
	// contains filtered or unexported fields
}

ComponentListSimple is a version of ComponentList that doesn't have the Teardown logic

func NewComponentListSimple

func NewComponentListSimple(name string, elements ...any) *ComponentListSimple

NewComponentListSimple creates a ComponentListSimple value

func (*ComponentListSimple) Add

func (list *ComponentListSimple) Add(elements ...any)

Add an element to this ComponentListSimple.

You can add Groups, UniqueTagger, EventBinding, or None Node Elements

func (*ComponentListSimple) AddItems

func (list *ComponentListSimple) AddItems(items ...engine.UniqueTagger)

func (*ComponentListSimple) GetComponent

func (list *ComponentListSimple) GetComponent() engine.Componenter

func (*ComponentListSimple) GetNodes

func (list *ComponentListSimple) GetNodes() *engine.NodeGroup

GetNodes returns the list of items.

func (*ComponentListSimple) RemoveAllItems

func (list *ComponentListSimple) RemoveAllItems()

func (*ComponentListSimple) RemoveItems

func (list *ComponentListSimple) RemoveItems(items ...engine.UniqueTagger)

type DOM

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

func NewDOM

func NewDOM() DOM

func (DOM) Body

func (dom DOM) Body(children ...engine.UberChild) *engine.UberElement

func (DOM) DocType

func (dom DOM) DocType() engine.HTML

func (DOM) HTML

func (dom DOM) HTML() *engine.UberElement

func (DOM) Head

func (dom DOM) Head(children ...engine.UberChild) *engine.UberElement

func (DOM) Meta

func (dom DOM) Meta(children ...engine.UberChild) *engine.UberElement

func (DOM) Title

func (dom DOM) Title() *engine.UberElement

type DiffApplyAttribute

type DiffApplyAttribute struct {
	*engine.Attribute
	// contains filtered or unexported fields
}

func (*DiffApplyAttribute) Initialize

func (a *DiffApplyAttribute) Initialize(page engine.Pager)

func (*DiffApplyAttribute) InitializeSSR

func (a *DiffApplyAttribute) InitializeSSR(page engine.Pager)

type FocusAttribute

type FocusAttribute struct {
	*engine.Attribute
	// contains filtered or unexported fields
}

func (*FocusAttribute) Initialize

func (a *FocusAttribute) Initialize(page engine.Pager)

func (*FocusAttribute) InitializeSSR

func (a *FocusAttribute) InitializeSSR(page engine.Pager)

type Page

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

func NewPage

func NewPage() *Page

TODO: Sam should this be private since its exposed in engine with the same name?

func (*Page) DOM

func (p *Page) DOM() DOM

func (*Page) GetCache

func (p *Page) GetCache() engine.Cache

func (*Page) GetPage

func (p *Page) GetPage() *engine.Page

type PreemptDisableAttribute

type PreemptDisableAttribute struct {
	*engine.Attribute
	// contains filtered or unexported fields
}

func (*PreemptDisableAttribute) Initialize

func (a *PreemptDisableAttribute) Initialize(page engine.Pager)

func (*PreemptDisableAttribute) InitializeSSR

func (a *PreemptDisableAttribute) InitializeSSR(pager engine.Pager)

type PreventDefaultAttribute

type PreventDefaultAttribute struct {
	*engine.Attribute
}

func PreventDefault

func PreventDefault() *PreventDefaultAttribute

func (*PreventDefaultAttribute) Initialize

func (a *PreventDefaultAttribute) Initialize(page engine.Pager)

func (*PreventDefaultAttribute) InitializeSSR

func (a *PreventDefaultAttribute) InitializeSSR(page engine.Pager)

type RedirectAttribute

type RedirectAttribute struct {
	*engine.Attribute
	// contains filtered or unexported fields
}

func (*RedirectAttribute) Initialize

func (a *RedirectAttribute) Initialize(page engine.Pager)

func (*RedirectAttribute) InitializeSSR

func (a *RedirectAttribute) InitializeSSR(page engine.Pager)

type ScrollTopAttribute

type ScrollTopAttribute struct {
	*engine.Attribute
	// contains filtered or unexported fields
}

func (*ScrollTopAttribute) Initialize

func (a *ScrollTopAttribute) Initialize(page engine.Pager)

func (*ScrollTopAttribute) InitializeSSR

func (a *ScrollTopAttribute) InitializeSSR(page engine.Pager)

type StopPropagationAttribute

type StopPropagationAttribute struct {
	*engine.Attribute
}

func (*StopPropagationAttribute) Initialize

func (a *StopPropagationAttribute) Initialize(pager engine.Pager)

func (*StopPropagationAttribute) InitializeSSR

func (a *StopPropagationAttribute) InitializeSSR(pager engine.Pager)

Jump to

Keyboard shortcuts

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