Documentation ¶
Index ¶
- Constants
- func P(propName string, propVal any) map[string]any
- func UseAtom[T any](ctx context.Context, atomName string) (T, func(T))
- func UseEffect(ctx context.Context, fn func() func(), deps []any)
- func UseId(ctx context.Context) string
- func UseState[T any](ctx context.Context, initialVal T) (T, func(T))
- type Atom
- type CFunc
- type ChildKey
- type Component
- type DomRect
- type EffectWorkElem
- type Hook
- type RootElem
- func (r *RootElem) AddEffectWork(id string, effectIndex int)
- func (r *RootElem) AddRenderWork(id string)
- func (r *RootElem) Event(id string, propName string, data any)
- func (r *RootElem) GetAtom(name string) *Atom
- func (r *RootElem) GetAtomVal(name string) any
- func (r *RootElem) GetStateSync(full bool) []VDomStateSync
- func (r *RootElem) MakeVDom() *VDomElem
- func (r *RootElem) RegisterComponent(name string, cfunc CFunc)
- func (r *RootElem) Render(elem *VDomElem)
- func (r *RootElem) RunWork()
- func (r *RootElem) SetAtomVal(name string, val any, markDirty bool)
- func (r *RootElem) SetOuterCtx(ctx context.Context)
- type VDomAsyncInitiationRequest
- type VDomBackendOpts
- type VDomBackendUpdate
- type VDomBinding
- type VDomContextVal
- type VDomCreateContext
- type VDomElem
- type VDomEvent
- type VDomFrontendUpdate
- type VDomFunc
- type VDomKeyboardEvent
- type VDomMessage
- type VDomRef
- type VDomRefOperation
- type VDomRefPosition
- type VDomRefUpdate
- type VDomRenderContext
- type VDomRenderUpdate
- type VDomStateSync
- type VDomTarget
Constants ¶
View Source
const ( WorkType_Render = "render" WorkType_Effect = "effect" )
View Source
const BindTag = "#bind"
View Source
const ChildrenPropKey = "children"
View Source
const FragmentTag = "#fragment"
View Source
const Html_BindParamTagName = "bindparam"
View Source
const Html_BindPrefix = "#bind:"
View Source
const Html_BindTagName = "bind"
View Source
const Html_GlobalEventPrefix = "#globalevent"
View Source
const Html_ParamPrefix = "#param:"
View Source
const KeyPropKey = "key"
View Source
const ObjectType_Binding = "binding"
View Source
const ObjectType_Func = "func"
View Source
const ObjectType_Ref = "ref"
View Source
const TextTag = "#text"
View Source
const WaveNullTag = "wave:null"
View Source
const WaveTextTag = "wave:text"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type EffectWorkElem ¶
type Hook ¶
type Hook struct { Init bool // is initialized Idx int // index in the hook array Fn func() func() // for useEffect UnmountFn func() // for useEffect Val any // for useState, useMemo, useRef Deps []any }
generic hook structure
type RootElem ¶
type RootElem struct { OuterCtx context.Context Root *Component CFuncs map[string]CFunc CompMap map[string]*Component // component waveid -> component EffectWorkQueue []*EffectWorkElem NeedsRenderMap map[string]bool Atoms map[string]*Atom }
func (*RootElem) AddEffectWork ¶
func (*RootElem) AddRenderWork ¶
func (*RootElem) GetAtomVal ¶ added in v0.9.0
func (*RootElem) GetStateSync ¶ added in v0.9.0
func (r *RootElem) GetStateSync(full bool) []VDomStateSync
func (*RootElem) RegisterComponent ¶
func (*RootElem) RunWork ¶ added in v0.9.0
func (r *RootElem) RunWork()
this will be called by the frontend to say the DOM has been mounted it will eventually send any updated "refs" to the backend as well
func (*RootElem) SetAtomVal ¶ added in v0.9.0
func (*RootElem) SetOuterCtx ¶
type VDomAsyncInitiationRequest ¶ added in v0.9.0
type VDomAsyncInitiationRequest struct { Type string `json:"type" tstype:"\"asyncinitiationrequest\""` Ts int64 `json:"ts"` BlockId string `json:"blockid,omitempty"` }
func MakeAsyncInitiationRequest ¶ added in v0.9.0
func MakeAsyncInitiationRequest(blockId string) VDomAsyncInitiationRequest
type VDomBackendOpts ¶ added in v0.9.0
type VDomBackendUpdate ¶ added in v0.9.0
type VDomBackendUpdate struct { Type string `json:"type" tstype:"\"backendupdate\""` Ts int64 `json:"ts"` BlockId string `json:"blockid"` Opts *VDomBackendOpts `json:"opts,omitempty"` RenderUpdates []VDomRenderUpdate `json:"renderupdates,omitempty"` StateSync []VDomStateSync `json:"statesync,omitempty"` RefOperations []VDomRefOperation `json:"refoperations,omitempty"` Messages []VDomMessage `json:"messages,omitempty"` }
type VDomBinding ¶ added in v0.9.0
type VDomBinding struct { Type string `json:"type" tstype:"\"binding\""` Bind string `json:"bind"` }
used in props
type VDomContextVal ¶
type VDomCreateContext ¶ added in v0.9.0
type VDomCreateContext struct { Type string `json:"type" tstype:"\"createcontext\""` Ts int64 `json:"ts"` Meta waveobj.MetaMapType `json:"meta,omitempty"` Target *VDomTarget `json:"target,omitempty"` Persist bool `json:"persist,omitempty"` }
type VDomElem ¶ added in v0.9.0
type VDomElem struct { WaveId string `json:"waveid,omitempty"` // required, except for #text nodes Tag string `json:"tag"` Props map[string]any `json:"props,omitempty"` Children []VDomElem `json:"children,omitempty"` Text string `json:"text,omitempty"` }
vdom element
type VDomFrontendUpdate ¶ added in v0.9.0
type VDomFrontendUpdate struct { Type string `json:"type" tstype:"\"frontendupdate\""` Ts int64 `json:"ts"` BlockId string `json:"blockid"` CorrelationId string `json:"correlationid,omitempty"` Dispose bool `json:"dispose,omitempty"` // the vdom context was closed Resync bool `json:"resync,omitempty"` // resync (send all backend data). useful when the FE reloads RenderContext VDomRenderContext `json:"rendercontext,omitempty"` Events []VDomEvent `json:"events,omitempty"` StateSync []VDomStateSync `json:"statesync,omitempty"` RefUpdates []VDomRefUpdate `json:"refupdates,omitempty"` Messages []VDomMessage `json:"messages,omitempty"` }
type VDomFunc ¶ added in v0.9.0
type VDomFunc struct { Fn any `json:"-"` // server side function (called with reflection) Type string `json:"type" tstype:"\"func\""` StopPropagation bool `json:"stoppropagation,omitempty"` PreventDefault bool `json:"preventdefault,omitempty"` GlobalEvent string `json:"globalevent,omitempty"` Keys []string `json:"keys,omitempty"` // special for keyDown events a list of keys to "capture" }
used in props
type VDomKeyboardEvent ¶ added in v0.9.0
type VDomKeyboardEvent struct { Type string `json:"type"` Key string `json:"key"` Code string `json:"code"` Shift bool `json:"shift,omitempty"` Control bool `json:"ctrl,omitempty"` Alt bool `json:"alt,omitempty"` Meta bool `json:"meta,omitempty"` Cmd bool `json:"cmd,omitempty"` Option bool `json:"option,omitempty"` Repeat bool `json:"repeat,omitempty"` Location int `json:"location,omitempty"` }
matches WaveKeyboardEvent
type VDomMessage ¶ added in v0.9.0
type VDomRef ¶ added in v0.9.0
type VDomRef struct { Type string `json:"type" tstype:"\"ref\""` RefId string `json:"refid"` TrackPosition bool `json:"trackposition,omitempty"` Position *VDomRefPosition `json:"position,omitempty"` HasCurrent bool `json:"hascurrent,omitempty"` }
used in props
func UseVDomRef ¶ added in v0.9.0
type VDomRefOperation ¶ added in v0.9.0
type VDomRefPosition ¶ added in v0.9.0
type VDomRefUpdate ¶ added in v0.9.0
type VDomRefUpdate struct { RefId string `json:"refid"` HasCurrent bool `json:"hascurrent"` Position *VDomRefPosition `json:"position,omitempty"` }
type VDomRenderContext ¶ added in v0.9.0
type VDomRenderUpdate ¶ added in v0.9.0
type VDomStateSync ¶ added in v0.9.0
type VDomTarget ¶ added in v0.9.0
type VDomTarget struct { NewBlock bool `json:"newblock,omitempty"` Magnified bool `json:"magnified,omitempty"` }
target -- to support new targets in the future, like toolbars, partial blocks, splits, etc. default is vdom context inside of a terminal block
Click to show internal directories.
Click to hide internal directories.