Documentation
¶
Overview ¶
Provides context for webx templates
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Static embed.FS
Functions ¶
func SecurityHeadersMiddleware ¶
SecurityHeadersMiddleware sets common security response headers.
func SessionMiddleware ¶
func SessionMiddleware(store SessionStore) func(http.Handler) http.Handler
SessionMiddleware reads or creates a session cookie, then populates WebXContext with the session ID and CSRF token from the store.
Types ¶
type BodyTag ¶ added in v0.0.3
type BodyTag struct {
Tag string // e.g. "<datastar-inspector></datastar-inspector>"
}
BodyTag represents a custom element to inject at the end of <body>.
type Script ¶ added in v0.0.3
type Script struct {
Src string // script src attribute
Type string // script type attribute (defaults to "module")
}
Script represents a <script> tag to inject in <head>.
type SessionStore ¶
type SessionStore interface {
Get(sessionID string, key string) (string, error)
Set(sessionID string, key string, value string) error
Delete(sessionID string) error
}
SessionStore provides session-scoped key/value storage. Implementations can back this with memory, NATS KV, Redis, etc.
type Stylesheet ¶ added in v0.0.3
type Stylesheet struct {
Href string
}
Stylesheet represents a <link rel="stylesheet"> tag to inject in <head>.
type WebXContext ¶
type WebXContext struct {
CSRFToken string
DevMode bool
SessionID string
BasePath string // prefix for all SSE handler routes (e.g. "/showcase")
Stylesheets []Stylesheet
Scripts []Script
BodyTags []BodyTag
}
func FromContext ¶
func FromContext(ctx context.Context) *WebXContext
func NewContext ¶
func NewContext(ctx context.Context) *WebXContext
func (*WebXContext) APIPath ¶
func (wctx *WebXContext) APIPath(path string) string
APIPath returns the full path for a component SSE handler by prepending the BasePath. For example, with BasePath "/showcase" and path "/api/calendar/navigate", it returns "/showcase/api/calendar/navigate".
func (*WebXContext) WithContext ¶
func (wctx *WebXContext) WithContext(ctx context.Context) context.Context
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
icongen
command
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
|
showcase
command
|
|
|
showcase/internal/layouts
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
showcase/internal/pages
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
Package ds provides typed helpers for Datastar HTML attributes.
|
Package ds provides typed helpers for Datastar HTML attributes. |
|
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
accordion
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
alert
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
avatar
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
badge
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
breadcrumbs
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
button
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
calendar
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
card
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
carousel
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
chat
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
dock
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
drawer
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
dropdown
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
fab
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
fieldset
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
fileinput
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
fileupload
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
filter
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
footer
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
form
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
hovergallery
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
indicator
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
join
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
kbd
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
label
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
link
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
list
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
loading
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
markdown
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
menu
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
mockupcode
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
modal
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
money
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
moneyinput
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
navbar
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
pagination
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
progress
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
radialprogress
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
radio
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
rangeinput
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
rating
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
selectinput
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
separator
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
skeleton
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
stack
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
stat
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
status
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
steps
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
tab
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
table
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
textarea
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
textrotate
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
themecontroller
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
timeline
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
toast
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
toggle
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
tooltip
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
validator
templ: version: v0.3.977
|
templ: version: v0.3.977 |