gox

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 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

This section is empty.

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 AttrMut

type AttrMut 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 AttrMut) error

type Comp

type Comp interface {
	Main() Elem
}

type Context

type Context = context.Context

type Cursor

type Cursor = *cursor

func NewCursor

func NewCursor(printer Printer) Cursor

func (Cursor) AddProxy

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

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 ...AttrMut) 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) HeadClose

func (c Cursor) HeadClose(ctx context.Context) error

func (Cursor) HeadInit

func (c Cursor) HeadInit(ctx context.Context, tag string) error

func (Cursor) HeadInitVoid

func (c Cursor) HeadInitVoid(ctx context.Context, tag string) error

func (Cursor) HeadSubmit

func (c Cursor) HeadSubmit(ctx context.Context) error

func (Cursor) WriteAny

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

func (Cursor) WriteComp

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

func (Cursor) WriteElem

func (c Cursor) WriteElem(ctx context.Context, elem Elem) error

func (Cursor) WriteFprint

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

func (Cursor) WriteFunc

func (c Cursor) WriteFunc(ctx context.Context, f func(w io.Writer) error) error

func (Cursor) WriteJob

func (c Cursor) WriteJob(job Job) error

func (Cursor) WriteRaw

func (c Cursor) WriteRaw(ctx context.Context, text string) error

func (Cursor) WriteTempl

func (c Cursor) WriteTempl(ctx context.Context, templ Templ) error

func (Cursor) WriteText

func (c Cursor) WriteText(ctx context.Context, 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 JobElem

type JobElem struct {
	Elem Elem
	Ctx  context.Context
}

func (*JobElem) Context

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

func (*JobElem) Output

func (j *JobElem) 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(job Job) error
}

func NewPrinter

func NewPrinter(w io.Writer) Printer

type Proxy

type Proxy interface {
	Init(p Printer)
	Terminate()
	Send(job Job) (done bool, err error)
}

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