Documentation
¶
Overview ¶
Provides context for webx templates
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Static embed.FS
Functions ¶
func Middleware ¶ added in v0.0.30
func Middleware(cfg MiddlewareConfig) func(http.Handler) http.Handler
Middleware reads or creates session/CSRF/theme cookies and populates Context on each request. On mutating methods it validates the signed double-submit CSRF token.
Types ¶
type Context ¶ added in v0.0.30
type Context struct {
SessionID string
CSRFToken string
Theme string
BasePath string // prefix for all SSE handler routes (e.g. "/showcase")
StreamURL string // URL for the reactive SSE stream endpoint (e.g. "/showcase/stream")
Watchers []Watcher // reactive scope watchers accumulated during render
// contains filtered or unexported fields
}
Context carries request-scoped state through the middleware chain and into templ components. Retrieve it with FromContext.
func FromContext ¶
FromContext extracts the webx Context from a context.Context. If none is present, a new empty Context is returned.
func (*Context) APIPath ¶ added in v0.0.30
APIPath returns the full path for a component SSE handler by prepending the BasePath. For example, with BasePath "/showcase" and path "/calendar/navigate", it returns "/showcase/calendar/navigate".
func (*Context) WatchScope ¶ added in v0.0.30
WatchScope registers a scope watcher and returns its unique signal key. Multiple components can watch the same scope — each gets a distinct key so their data-effects don't interfere with each other.
type MiddlewareConfig ¶ added in v0.0.30
type MiddlewareConfig struct {
Secret []byte // HMAC-SHA256 key, minimum 32 bytes — panics if shorter
Secure bool // Secure flag on cookies (true for HTTPS / production)
}
MiddlewareConfig configures the webx middleware.
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/components
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
showcase/internal/handlers
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
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 |
|
Package pubsub defines the interface for publish/subscribe messaging used by the stream package.
|
Package pubsub defines the interface for publish/subscribe messaging used by the stream package. |
|
chanpubsub
Package chanpubsub provides an in-process PubSub implementation backed by Go channels.
|
Package chanpubsub provides an in-process PubSub implementation backed by Go channels. |
|
natspubsub
Package natspubsub adapts a *nats.Conn to the pubsub.PubSub interface.
|
Package natspubsub adapts a *nats.Conn to the pubsub.PubSub interface. |
|
pubsubtest
Package pubsubtest provides a conformance test suite for PubSub implementations.
|
Package pubsubtest provides a conformance test suite for PubSub implementations. |
|
redispubsub
Package redispubsub adapts a Redis client to the pubsub.PubSub interface using PUBLISH / SUBSCRIBE / PSUBSCRIBE.
|
Package redispubsub adapts a Redis client to the pubsub.PubSub interface using PUBLISH / SUBSCRIBE / PSUBSCRIBE. |
|
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
accordion
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
aichat
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 |
|
briefing
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 |
|
codeview
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
commandbar
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 |
|
feed
templ: version: v0.3.977
|
templ: version: v0.3.977 |
|
feeditem
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 |
|
jsonview
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 |
|
scrollstrip
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 |
|
sparkline
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 |
|
yamltree
templ: version: v0.3.977
|
templ: version: v0.3.977 |