fx

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2026 License: Unlicense Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compress

func Compress(data []byte) []byte

Compress gzip-compresses data at maximum compression. Bundles are compressed once at build time and served directly with Content-Encoding: gzip.

func Encode

func Encode(values []*Value) []byte

Types

type Attr

type Attr map[string]string

Attr is a map of HTML attribute key-value pairs passed to any element builder.

type Forge

type Forge interface {
	Build(class string, elements ...*One)
	Builder(class string, elements ...*One) *One
	Frames(frame ...*One) [][]byte
	Markdown() *markdown.Markdown
	HTML(raw string) *One
	JS(js string) One
	CSS(css string) One
	Elem(tag, text string, attrs ...Attr) *One
	Block(tag string, attrs Attr, children ...*One) *One
	Void(tag string, attrs Attr) *One
}

func NewForge

func NewForge() Forge

type Fx

type Fx struct {
	*zero.Zero
	Forge
	Routes map[string][]byte
}

func NewFx

func NewFx(apiUrl string) *Fx

func (*Fx) App

func (fx *Fx) App(title, url string)

func (*Fx) Home

func (fx *Fx) Home(logo, heading string)

func (*Fx) Load

func (fx *Fx) Load(path string)

Load reads a file or directory at path, encodes and compresses the contents, and stores the bundle in Routes keyed by the base name of path. Raw data is freed from each Value after the bundle is stored.

func (fx *Fx) Logo(path string) template.HTML

func (*Fx) Slides

func (fx *Fx) Slides(dir string)

func (*Fx) Text

func (fx *Fx) Text(path string)

func (*Fx) ToBytes

func (fx *Fx) ToBytes(input string) ([]byte, error)

ToBytes fetches the content at input, either from an HTTP URL or a local file.

type One

type One template.HTML

type Value

type Value struct {
	Name string `json:"name,omitempty"`
	Type string `json:"type,omitempty"`
	Size uint32 `json:"size"`
	Data []byte `json:"-"`
}

Value is the unit of work for encoding. Name and Type populate the manifest; Data is the raw blob. Data is excluded from JSON and freed after encoding.

Jump to

Keyboard shortcuts

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