Versions in this module Expand all Collapse all v0 v0.2.546 Jan 29, 2024 Changes in this version + const FailedSanitizationURL + var NopComponent = ComponentFunc(func(ctx context.Context, w io.Writer) error { ... }) + func Bool(value bool) bool + func CSSID(name string, css string) string + func ClearChildren(ctx context.Context) context.Context + func EscapeString(s string) string + func GetBuffer() *bytes.Buffer + func InitializeContext(ctx context.Context) context.Context + func JoinStringErrs(s string, errs ...error) (string, error) + func ReleaseBuffer(b *bytes.Buffer) + func RenderAttributes(ctx context.Context, w io.Writer, attributes Attributes) (err error) + func RenderCSSItems(ctx context.Context, w io.Writer, classes ...any) (err error) + func RenderScriptItems(ctx context.Context, w io.Writer, scripts ...ComponentScript) (err error) + func SafeScript(functionName string, params ...any) string + func SafeScriptInline(functionName string, params ...any) string + func ToGoHTML(ctx context.Context, c Component) (s template.HTML, err error) + func Version() string + func WithChildren(ctx context.Context, children Component) context.Context + func WithContentType(contentType string) func(*ComponentHandler) + func WithErrorHandler(eh func(r *http.Request, err error) http.Handler) func(*ComponentHandler) + func WithStatus(status int) func(*ComponentHandler) + func WriteWatchModeString(w *bytes.Buffer, lineNum int) error + type Attributes map[string]any + type CSSClass interface + ClassName func() string + func Class(name string) CSSClass + func SafeClass(name string) CSSClass + type CSSClasses []any + func Classes(classes ...any) CSSClasses + func (classes CSSClasses) String() string + type CSSHandler struct + Classes []ComponentCSSClass + Logger func(err error) + func NewCSSHandler(classes ...CSSClass) CSSHandler + func (cssh CSSHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) + type CSSMiddleware struct + CSSHandler CSSHandler + Next http.Handler + Path string + func NewCSSMiddleware(next http.Handler, classes ...CSSClass) CSSMiddleware + func (cssm CSSMiddleware) ServeHTTP(w http.ResponseWriter, r *http.Request) + type Component interface + Render func(ctx context.Context, w io.Writer) error + func FromGoHTML(t *template.Template, data any) Component + func GetChildren(ctx context.Context) Component + func Raw[T ~string](html T, errs ...error) Component + type ComponentCSSClass struct + Class SafeCSS + ID string + func (css ComponentCSSClass) ClassName() string + type ComponentFunc func(ctx context.Context, w io.Writer) error + func (cf ComponentFunc) Render(ctx context.Context, w io.Writer) error + type ComponentHandler struct + Component Component + ContentType string + ErrorHandler func(r *http.Request, err error) http.Handler + Status int + func Handler(c Component, options ...func(*ComponentHandler)) *ComponentHandler + func (ch ComponentHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) + type ComponentScript struct + Call string + CallInline string + Function string + Name string + func (c ComponentScript) Render(ctx context.Context, w io.Writer) error + type ConstantCSSClass string + func (css ConstantCSSClass) ClassName() string + type Error struct + Col int + Err error + FileName string + Line int + func (e Error) Error() string + func (e Error) Unwrap() error + type KeyValue struct + Key TKey + Value TValue + func KV[TKey comparable, TValue any](key TKey, value TValue) KeyValue[TKey, TValue] + type SafeCSS string + func SanitizeCSS(property, value string) SafeCSS + type SafeURL string + func URL(s string) SafeURL