render

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2024 License: MIT Imports: 26 Imported by: 1

Documentation

Overview

templ: version: v0.2.793

templ: version: v0.2.793

templ: version: v0.2.793

templ: version: v0.2.793

templ: version: v0.2.793

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(props *Props) templ.Component

func Component

func Component(rx *Context, value any, path Path) (out []templ.Component)

Component renders the object into a list of components for each field.

func ListOf

func ListOf(obj any, property string) []string

ListOf returns the list of strings for the property.

func ListenAndServe

func ListenAndServe(port int, registry folio.Registry, db folio.Storage) error

ListenAndServe starts the server on the given port.

func Number

func Number(props *Props) templ.Component

func Object

func Object(rx *Context, obj folio.Object) (out []templ.Component)

Object renders the object into a list of components for each field.

func Range

func Range(props *Props, min, max, step float64) templ.Component

func Select

func Select(props *Props, lookup Lookup) templ.Component

func Slice

func Slice(props *Props) templ.Component

func String

func String(props *Props) templ.Component

func StringOf

func StringOf(obj any, property string) string

StringOf returns the string representation of the property.

func Strings added in v0.0.3

func Strings(props *Props) templ.Component

func Struct

func Struct(props *Props, children []templ.Component) templ.Component

func StructPtr

func StructPtr(props *Props) templ.Component

func TitleOf

func TitleOf(obj any) string

TitleOf returns the title of the object.

Types

type ButtonDropdownProps

type ButtonDropdownProps struct {
	ID      string
	Primary templ.Component
	Options templ.Component
}

type Context

type Context struct {
	Mode      Mode
	Path      Path
	Kind      folio.Kind
	Type      folio.Type
	URN       folio.URN
	Store     folio.Storage
	Registry  folio.Registry
	Query     folio.Query
	Namespace string
}

Context represents the rendering context.

type Lookup

type Lookup interface {
	Init(*Props) bool
	Choices() iter.Seq2[string, string]
	Current() (string, string)
	Len() int
}

Lookup represents a lookup for a field.

type Mode

type Mode int

Mode represents the rendering mode.

const (
	ModeView Mode = iota
	ModeEdit
	ModeCreate
)

func (Mode) String

func (m Mode) String() string

type Path

type Path = folio.Path

type Props

type Props struct {
	*Context                     // Context of the editor
	Name     Path                // Name of the field (or the JSON tag)
	Label    string              // Label of the field, Title Case
	Desc     string              // Description of the field, used for placeholder & tooltip
	Value    reflect.Value       // Value of the field
	Parent   folio.Object        // Object to which the field belongs
	Field    reflect.StructField // Field of the object
}

Props represents the properties of the editor use to render the field.

func (*Props) ID

func (p *Props) ID(prefix string) string

type Renderer

type Renderer interface {
	Render(*Props) templ.Component
}

type Response

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

func (*Response) Render

func (r *Response) Render(template templ.Component) error

Render renders the given template

func (*Response) RenderWith

func (r *Response) RenderWith(template templ.Component, fn func(htmx.Response) htmx.Response) error

RenderWith renders the given template with custom htmx response

Jump to

Keyboard shortcuts

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