rpctypes

package
v0.12.4 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertElemsToTransferElems

func ConvertElemsToTransferElems(elems []RenderedElem) ([]VDomTransferElem, []VDomText)

Types

type ModalConfig

type ModalConfig struct {
	ModalId    string `json:"modalid"`              // Unique identifier for the modal
	ModalType  string `json:"modaltype"`            // "alert" or "confirm"
	Icon       string `json:"icon,omitempty"`       // Optional icon to display (emoji or icon name)
	Title      string `json:"title"`                // Modal title
	Text       string `json:"text,omitempty"`       // Optional body text
	OkText     string `json:"oktext,omitempty"`     // Optional OK button text (defaults to "OK")
	CancelText string `json:"canceltext,omitempty"` // Optional Cancel button text for confirm modals (defaults to "Cancel")
}

ModalConfig contains all configuration options for modals

type ModalResult

type ModalResult struct {
	ModalId string `json:"modalid"` // ID of the modal
	Confirm bool   `json:"confirm"` // true = confirmed/ok, false = cancelled
}

ModalResult contains the result of a modal interaction

type RenderedElem

type RenderedElem struct {
	WaveId   string         `json:"waveid,omitempty"` // required, except for #text nodes
	Tag      string         `json:"tag"`
	Props    map[string]any `json:"props,omitempty"`
	Children []RenderedElem `json:"children,omitempty"`
	Text     string         `json:"text,omitempty"`
}

rendered element (output from rendering pipeline)

type VDomBackendOpts

type VDomBackendOpts struct {
	Title                string `json:"title,omitempty"`
	ShortDesc            string `json:"shortdesc,omitempty"`
	GlobalKeyboardEvents bool   `json:"globalkeyboardevents,omitempty"`
	FaviconPath          string `json:"faviconpath,omitempty"`
}

type VDomBackendUpdate

type VDomBackendUpdate struct {
	Type          string                  `json:"type" tstype:"\"backendupdate\""`
	Ts            int64                   `json:"ts"`
	ServerId      string                  `json:"serverid"`
	Opts          *VDomBackendOpts        `json:"opts,omitempty"`
	HasWork       bool                    `json:"haswork,omitempty"`
	FullUpdate    bool                    `json:"fullupdate,omitempty"`
	RenderUpdates []VDomRenderUpdate      `json:"renderupdates,omitempty"`
	TransferElems []VDomTransferElem      `json:"transferelems,omitempty"`
	TransferText  []VDomText              `json:"transfertext,omitempty"`
	RefOperations []vdom.VDomRefOperation `json:"refoperations,omitempty"`
	Messages      []VDomMessage           `json:"messages,omitempty"`
}

func (*VDomBackendUpdate) CreateTransferElems

func (beUpdate *VDomBackendUpdate) CreateTransferElems()

type VDomFrontendUpdate

type VDomFrontendUpdate struct {
	Type          string            `json:"type" tstype:"\"frontendupdate\""`
	Ts            int64             `json:"ts"`
	ClientId      string            `json:"clientid"`
	ForceTakeover bool              `json:"forcetakeover,omitempty"`
	CorrelationId string            `json:"correlationid,omitempty"`
	Reason        string            `json:"reason,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        []vdom.VDomEvent  `json:"events,omitempty"`
	RefUpdates    []VDomRefUpdate   `json:"refupdates,omitempty"`
	Messages      []VDomMessage     `json:"messages,omitempty"`
}

type VDomMessage

type VDomMessage struct {
	MessageType string `json:"messagetype"`
	Message     string `json:"message"`
	StackTrace  string `json:"stacktrace,omitempty"`
	Params      []any  `json:"params,omitempty"`
}

type VDomRefUpdate

type VDomRefUpdate struct {
	RefId      string                `json:"refid"`
	HasCurrent bool                  `json:"hascurrent"`
	Position   *vdom.VDomRefPosition `json:"position,omitempty"`
}

type VDomRenderContext

type VDomRenderContext struct {
	Focused    bool   `json:"focused"`
	Width      int    `json:"width"`
	Height     int    `json:"height"`
	RootRefId  string `json:"rootrefid"`
	Background bool   `json:"background,omitempty"`
}

type VDomRenderUpdate

type VDomRenderUpdate struct {
	UpdateType string        `json:"updatetype" tstype:"\"root\"|\"append\"|\"replace\"|\"remove\"|\"insert\""`
	WaveId     string        `json:"waveid,omitempty"`
	VDomWaveId string        `json:"vdomwaveid,omitempty"`
	VDom       *RenderedElem `json:"vdom,omitempty"` // these get removed for transfer (encoded to transferelems)
	Index      *int          `json:"index,omitempty"`
}

type VDomText

type VDomText struct {
	Id   int    `json:"id"`
	Text string `json:"text"`
}

type VDomTransferElem

type VDomTransferElem struct {
	WaveId   string         `json:"waveid,omitempty"` // required, except for #text nodes
	Tag      string         `json:"tag"`
	Props    map[string]any `json:"props,omitempty"`
	Children []string       `json:"children,omitempty"`
	Text     string         `json:"text,omitempty"`
}

the over the wire format for a vdom element

func DedupTransferElems

func DedupTransferElems(elems []VDomTransferElem) []VDomTransferElem

type VDomUrlRequestResponse

type VDomUrlRequestResponse struct {
	StatusCode int               `json:"statuscode,omitempty"`
	Headers    map[string]string `json:"headers,omitempty"`
	Body       []byte            `json:"body,omitempty"`
}

Jump to

Keyboard shortcuts

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