gox

package module
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2026 License: MIT Imports: 9 Imported by: 1

README

GoX — JSX for Go

  • Introduces HTML syntax as a first-class Go expression.
  • LSP-first: proxies gopls with additional capabilities; works on the fly with no extra commands.
  • Compiles HTML into a stream of meaningful jobs, enabling mid-render mutation for extreme flexibility.
  • Compatible with templ.

Status

Work in progress. Not yet available.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Release added in v0.0.5

func Release(r Releaser)

Types

type Attr

type Attr = *attr

func (Attr) Append

func (a Attr) Append(value string)

func (Attr) AppendObject

func (a Attr) AppendObject(value any)

func (Attr) IsSet

func (a Attr) IsSet() bool

func (Attr) Name

func (a Attr) Name() string

func (Attr) ReadBool

func (a Attr) ReadBool() (bool, bool)

func (Attr) ReadObject

func (a Attr) ReadObject() (any, bool)

func (Attr) ReadObjectArray

func (a Attr) ReadObjectArray() ([]any, bool)

func (Attr) ReadString

func (a Attr) ReadString() (string, bool)

func (Attr) Render

func (a Attr) Render(w io.Writer) error

func (Attr) Set

func (a Attr) Set(value string)

func (Attr) SetBool

func (a Attr) SetBool(value bool)

func (Attr) SetObject

func (a Attr) SetObject(value any)

type AttrMod added in v0.0.4

type AttrMod interface {
	Apply(ctx context.Context, attrs Attrs) error
}

type Attrs

type Attrs = *attrs

func NewAttrs

func NewAttrs(ctx context.Context) Attrs

func (Attrs) Clone

func (a Attrs) Clone(ctx context.Context) Attrs

func (Attrs) Ctx

func (a Attrs) Ctx() context.Context

func (Attrs) Get

func (a Attrs) Get(name string) Attr

func (Attrs) List

func (a Attrs) List() []Attr

func (Attrs) Mutate

func (a Attrs) Mutate(mut AttrMod) error

type Comp

type Comp interface {
	Main() Elem
}

type Context

type Context = context.Context

type Cursor

type Cursor = *cursor

func NewCursor

func NewCursor(ctx context.Context, printer Printer) Cursor

func (Cursor) Any added in v0.0.7

func (c Cursor) Any(ctx context.Context, any any) error

func (Cursor) AttrAppend

func (c Cursor) AttrAppend(name string, value string) error

func (Cursor) AttrAppendObject

func (c Cursor) AttrAppendObject(name string, value any) error

func (Cursor) AttrMod

func (c Cursor) AttrMod(mut ...AttrMod) error

func (Cursor) AttrSet

func (c Cursor) AttrSet(name string, value string) error

func (Cursor) AttrSetAny

func (c Cursor) AttrSetAny(name string, value any) error

func (Cursor) AttrSetBool

func (c Cursor) AttrSetBool(name string, value bool) error

func (Cursor) AttrSetObject

func (c Cursor) AttrSetObject(name string, value any) error

func (Cursor) Close added in v0.0.7

func (c Cursor) Close() error

func (Cursor) Comp added in v0.0.7

func (c Cursor) Comp(ctx context.Context, comp Comp) error

func (Cursor) Fprint added in v0.0.7

func (c Cursor) Fprint(any any) error

func (Cursor) Func added in v0.0.7

func (c Cursor) Func(f func(w io.Writer) error) error

func (Cursor) Init added in v0.0.7

func (c Cursor) Init(tag string) error

func (Cursor) InitVoid added in v0.0.7

func (c Cursor) InitVoid(tag string) error

func (Cursor) Job added in v0.0.7

func (c Cursor) Job(job Job) error

func (Cursor) Noop added in v0.0.5

func (c Cursor) Noop(any)

func (Cursor) Provider added in v0.0.7

func (c Cursor) Provider(provider Provider) error

func (Cursor) Proxy added in v0.0.7

func (c Cursor) Proxy(proxy ...Proxy)

func (Cursor) Raw added in v0.0.7

func (c Cursor) Raw(text string) error

func (Cursor) Submit added in v0.0.7

func (c Cursor) Submit() error

func (Cursor) Templ added in v0.0.7

func (c Cursor) Templ(templ Templ) error

func (Cursor) Text added in v0.0.7

func (c Cursor) Text(text string) error

type Elem

type Elem func(ctx context.Context, cursor Cursor) error

func (Elem) Main

func (e Elem) Main() Elem

func (Elem) Print

func (e Elem) Print(ctx context.Context, printer Printer) error

func (Elem) Render

func (e Elem) Render(ctx context.Context, w io.Writer) error

type HeadError

type HeadError string

func (HeadError) Error

func (e HeadError) Error() string

type HeadKind

type HeadKind int
const (
	KindRegular HeadKind = iota
	KindVoid
)

func (HeadKind) IsVoid

func (k HeadKind) IsVoid() bool

type Job

type Job interface {
	Context() context.Context
	Output(w io.Writer) error
}

type JobComp

type JobComp struct {
	Comp Comp
	Ctx  context.Context
}

func (*JobComp) Context

func (j *JobComp) Context() context.Context

func (*JobComp) Output

func (j *JobComp) Output(w io.Writer) error

type JobError

type JobError string

func (JobError) Error

func (e JobError) Error() string

type JobFprint

type JobFprint struct {
	Ctx context.Context
	Any any
}

func (*JobFprint) Context

func (j *JobFprint) Context() context.Context

func (*JobFprint) Output

func (j *JobFprint) Output(w io.Writer) error

type JobFunc

type JobFunc struct {
	Ctx  context.Context
	Func func(w io.Writer) error
}

func (*JobFunc) Context

func (j *JobFunc) Context() context.Context

func (*JobFunc) Output

func (j *JobFunc) Output(w io.Writer) error

type JobHeadClose

type JobHeadClose struct {
	Id   uint64
	Kind HeadKind
	Tag  string
	Ctx  context.Context
}

func NewJobHeadClose

func NewJobHeadClose(id uint64, kind HeadKind, tag string, ctx context.Context) *JobHeadClose

func (*JobHeadClose) Context

func (j *JobHeadClose) Context() context.Context

func (*JobHeadClose) Output

func (j *JobHeadClose) Output(w io.Writer) error

type JobHeadOpen

type JobHeadOpen struct {
	Id    uint64
	Kind  HeadKind
	Tag   string
	Ctx   context.Context
	Attrs Attrs
}

func NewJobHeadOpen

func NewJobHeadOpen(id uint64, kind HeadKind, tag string, ctx context.Context, attrs Attrs) *JobHeadOpen

func (*JobHeadOpen) Context

func (j *JobHeadOpen) Context() context.Context

func (*JobHeadOpen) Output

func (j *JobHeadOpen) Output(w io.Writer) error

type JobRaw

type JobRaw struct {
	Ctx  context.Context
	Text string
}

func NewJobRaw

func NewJobRaw(ctx context.Context, text string) *JobRaw

func (*JobRaw) Context

func (j *JobRaw) Context() context.Context

func (*JobRaw) Output

func (j *JobRaw) Output(w io.Writer) error

type JobTempl

type JobTempl struct {
	Ctx   context.Context
	Templ Templ
}

func (*JobTempl) Context

func (j *JobTempl) Context() context.Context

func (*JobTempl) Output

func (j *JobTempl) Output(w io.Writer) error

type JobText

type JobText struct {
	Ctx  context.Context
	Text string
}

func (*JobText) Context

func (j *JobText) Context() context.Context

func (*JobText) Output

func (j *JobText) Output(w io.Writer) error

type Printer

type Printer interface {
	Send(j Job) error
}

func NewPrinter

func NewPrinter(w io.Writer) Printer

type Provider added in v0.0.7

type Provider interface {
	Job(ctx context.Context) Job
}

type Proxy

type Proxy interface {
	Init(ctx context.Context, p Printer) (add bool)
	Terminate()
	Send(j Job) (done bool, err error)
}

type Releaser added in v0.0.5

type Releaser interface {
	// contains filtered or unexported methods
}

type Templ

type Templ interface {
	Render(ctx context.Context, w io.Writer) error
}

Directories

Path Synopsis
cmd
gox command
internal
jsonrpc
Package jsonrpc2 is a minimal implementation of the JSON RPC 2 spec.
Package jsonrpc2 is a minimal implementation of the JSON RPC 2 spec.
lsp

Jump to

Keyboard shortcuts

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