Versions in this module Expand all Collapse all v0 v0.1.0 Nov 15, 2026 Changes in this version + const CSRFFormField + const CSRFHeader + const CSRFMetaName + const DefaultAssetsBase + const DefaultRefreshDebounce + const EventCustom + const EventNativeNavigate + const EventPatchElements + const EventPatchSignals + const EventRedirect + const EventRefresh + const HeaderBoosted + const HeaderCSRF + const HeaderCacheEvict + const HeaderCacheExpire + const HeaderCurrentURL + const HeaderGroup + const HeaderHistoryRestore + const HeaderLayer + const HeaderLocation + const HeaderNative + const HeaderOpenLayer + const HeaderPrompt + const HeaderPushURL + const HeaderRedirect + const HeaderRefresh + const HeaderReplaceURL + const HeaderRequest + const HeaderRequestType + const HeaderReselect + const HeaderReswap + const HeaderRetarget + const HeaderRobotsTag + const HeaderSource + const HeaderTarget + const HeaderTrigger + const HeaderTriggerAfterSettle + const HeaderTriggerAfterSwap + const HeaderValidate + const MaxSignalsBytes + const MinKeyBytes + const NativePathConfigPath + const NativeUserAgentToken + const NavigateAdvance + const NavigateReplace + const NavigateRestore + const RobotsNoIndex + const SignalsParam + const SignatureSignal + var ErrCSRFInvalid = errors.New("ypy: CSRF token invalid") + var ErrCSRFMissing = errors.New("ypy: CSRF token missing") + var ErrCSRFOrigin = errors.New("ypy: cross-origin request refused") + var ErrModelDone = errors.New("ypy: model stream finished") + var ErrModelLimit = errors.New("ypy: model answer is over its byte cap") + var ErrNoSignals = errors.New("ypy: request carries no signals") + var ErrSignalsTooLarge = errors.New("ypy: signals document too large") + var ErrSignatureInvalid = errors.New("ypy: signature does not match") + var ErrSignatureMissing = errors.New("ypy: signature missing") + var ErrStreamClosed = errors.New("ypy: stream closed") + var ErrWeakKey = errors.New("ypy: signing key too short") + func AtomicGroup(w http.ResponseWriter) + func EvictCache(w http.ResponseWriter, patterns ...string) error + func ExpireCache(w http.ResponseWriter, patterns ...string) error + func Fragment(w http.ResponseWriter, markup string, opts ...FragmentOption) error + func FragmentStatus(w http.ResponseWriter, status int, markup string, opts ...FragmentOption) error + func KeepCache(w http.ResponseWriter) + func Location(w http.ResponseWriter, loc LocationOptions) error + func Middleware(next http.Handler) http.Handler + func NativeMiddleware(next http.Handler) http.Handler + func NativeNavigate(w http.ResponseWriter, url, action string) error + func NewMiddleware(opts ...FragmentOption) func(http.Handler) http.Handler + func NoContent(w http.ResponseWriter) + func OpenLayer(w http.ResponseWriter, url string, opts ...LayerOptions) error + func OpenLayerHTML(w http.ResponseWriter, markup string, opts ...LayerOptions) error + func Partial(w http.ResponseWriter, spec PartialSpec, markup string, opts ...FragmentOption) error + func PatchSignals(w http.ResponseWriter, patch any) error + func PatchSignedSignals(w http.ResponseWriter, s *Signer, patch any, names ...string) error + func PushURL(w http.ResponseWriter, url string) + func RawSignals(r *http.Request) ([]byte, error) + func ReadSignals[T any](r *http.Request) (T, error) + func ReadSignedSignals[T any](r *http.Request, s *Signer, names ...string) (T, error) + func Redirect(w http.ResponseWriter, r *http.Request, url string) + func Refresh(w http.ResponseWriter) + func ReplaceURL(w http.ResponseWriter, url string) + func Reselect(w http.ResponseWriter, selector string) + func Reswap(w http.ResponseWriter, swap string) + func Retarget(w http.ResponseWriter, selector string) + func SeeOther(w http.ResponseWriter, url string) + func StreamFunc(fn func(s *Stream, r *http.Request) error, opts ...StreamOption) http.Handler + func Trigger(w http.ResponseWriter, name string, payload any) error + func TriggerAfterSettle(w http.ResponseWriter, name string, payload any) error + func TriggerAfterSwap(w http.ResponseWriter, name string, payload any) error + func ValidationError(w http.ResponseWriter, markup string, opts ...FragmentOption) error + func VaryNative(w http.ResponseWriter) + type Asset struct + CSS string + JS string + type BlockRenderer interface + Blocks func(text string) (closed string, consumed int, open string, err error) + type Broadcaster struct + func NewBroadcaster(opts ...BroadcasterOption) *Broadcaster + func (b *Broadcaster) Close() + func (b *Broadcaster) Event(name string, detail any, opts ...CustomOption) error + func (b *Broadcaster) Len() int + func (b *Broadcaster) PatchElements(markup string, opts ...ElementsOption) error + func (b *Broadcaster) PatchSignals(patch any, opts ...SignalsOption) error + func (b *Broadcaster) Publish(ev Event) int + func (b *Broadcaster) Redirect(url string, opts ...RedirectOption) error + func (b *Broadcaster) Refresh(opts ...RefreshOption) error + func (b *Broadcaster) ServeHTTP(w http.ResponseWriter, r *http.Request) + type BroadcasterOption func(*broadcasterConfig) + func WithBuffer(n int) BroadcasterOption + func WithSnapshot(fn func(r *http.Request) ([]Event, error)) BroadcasterOption + func WithStreamOptions(opts ...StreamOption) BroadcasterOption + type CSRF struct + func NewCSRF(key []byte, opts ...CSRFOption) (*CSRF, error) + func (c *CSRF) Check(r *http.Request) error + func (c *CSRF) Field(r *http.Request) template.HTML + func (c *CSRF) Meta(r *http.Request) template.HTML + func (c *CSRF) Middleware(next http.Handler) http.Handler + func (c *CSRF) Renew(w http.ResponseWriter, r *http.Request) + func (c *CSRF) RenewFor(w http.ResponseWriter, session string) + func (c *CSRF) Token(r *http.Request) string + func (c *CSRF) TokenFor(session string) string + type CSRFOption func(*CSRF) + func CSRFHeaderName(name string) CSRFOption + func CSRFOnFailure(fn func(w http.ResponseWriter, r *http.Request, err error)) CSRFOption + func CSRFPreviousKeys(keys ...[]byte) CSRFOption + func CSRFSecure() CSRFOption + func CSRFSession(fn func(*http.Request) string) CSRFOption + func CSRFTrustedOrigins(origins ...string) CSRFOption + type Context string + const ContextDefault + const ContextModal + type CustomOption func(*customConfig) + func WithEventTarget(selector string) CustomOption + type ElementsOption func(*elementsConfig) + func WithKey(attr string) ElementsOption + func WithLimit(n int) ElementsOption + func WithMode(m PatchMode) ElementsOption + func WithNamespace(ns Namespace) ElementsOption + func WithSelector(sel string) ElementsOption + func WithViewTransition() ElementsOption + type Event struct + Data []string + ID string + Name string + func CustomEvent(name string, detail any, opts ...CustomOption) (Event, error) + func PatchElementsEvent(markup string, opts ...ElementsOption) (Event, error) + func PatchSignalsEvent(patch any, opts ...SignalsOption) (Event, error) + func RedirectEvent(url string, opts ...RedirectOption) (Event, error) + func RefreshEvent(opts ...RefreshOption) (Event, error) + func (e Event) Bytes() []byte + func (e Event) WithID(id string) (Event, error) + type FragmentOption func(*fragmentConfig) + func AllowIndex() FragmentOption + type LayerMode string + const LayerDrawer + const LayerModal + const LayerPopup + type LayerOptions struct + Class string + CloseOn []string + CloseOnFragment string + CloseOnURL []string + Escape *bool + HTML string + History *bool + Label string + Mode LayerMode + Outside *bool + Side LayerSide + URL string + type LayerSide string + const SideBottom + const SideEnd + const SideStart + const SideTop + type LocationOptions struct + Headers map[string]string + Path string + Push string + Replace string + Select string + Swap string + Target string + Values map[string]any + type Manifest struct + func LoadManifest(fsys fs.FS, manifestPath string) (*Manifest, error) + func (m *Manifest) Assets(origin string, nonce ...string) template.HTML + func (m *Manifest) FuncMap() template.FuncMap + func (m *Manifest) Handler() http.Handler + func (m *Manifest) Integrity(file string) (string, bool) + func (m *Manifest) Lookup(origin string) (Asset, bool) + func (m *Manifest) Origins() []string + func (m *Manifest) WithBase(base string) *Manifest + type ModalStyle string + const ModalDrawer + const ModalFull + const ModalLarge + const ModalMedium + type ModelOption func(*modelConfig) + func WithAnnounce(start, ready, stopped, failed string) ModelOption + func WithAnswerID(id string) ModelOption + func WithFailText(s string) ModelOption + func WithFlushBytes(n int) ModelOption + func WithFlushInterval(d time.Duration) ModelOption + func WithFollow() ModelOption + func WithMaxBytes(n int) ModelOption + func WithModelTarget(selector string, mode PatchMode) ModelOption + func WithPlainText() ModelOption + func WithRenderer(r Renderer) ModelOption + func WithShortAnswer() ModelOption + func WithStopText(s string) ModelOption + type ModelStream struct + func NewModelStream(s *Stream, opts ...ModelOption) (*ModelStream, error) + func (m *ModelStream) Cancel() error + func (m *ModelStream) Close() error + func (m *ModelStream) Context() context.Context + func (m *ModelStream) Fail() error + func (m *ModelStream) Flush() error + func (m *ModelStream) ID() string + func (m *ModelStream) Text() string + func (m *ModelStream) Write(p []byte) (int, error) + func (m *ModelStream) WriteString(s string) (int, error) + type Namespace string + const NamespaceHTML + const NamespaceMathML + const NamespaceSVG + type Native struct + Platform string + Version int + func NewNative(platform string, version int, caps ...string) Native + func ParseNative(value string) (Native, bool) + func (n Native) Caps() []string + func (n Native) Has(capability string) bool + func (n Native) IsApp() bool + type PartialSpec struct + ID string + Swap string + Target string + func (p PartialSpec) HTML(markup string) (string, error) + type PatchMode string + const ModeAfter + const ModeAppend + const ModeBefore + const ModeInner + const ModeOuter + const ModePrepend + const ModeRemove + const ModeReplace + type PathConfig struct + Rules []PathRule + Settings PathSettings + Version int + func (c PathConfig) Handler() (http.Handler, error) + func (c PathConfig) Validate() error + type PathProperties struct + Context Context + ModalStyle ModalStyle + Presentation Presentation + PullToRefresh *bool + QueryString QueryString + View string + type PathRule struct + Patterns []string + Properties PathProperties + type PathSettings struct + BridgeOrigins []string + Tabs []PathTab + type PathTab struct + Path string + Title string + type Presentation string + const PresentNone + const PresentPop + const PresentPush + const PresentRefresh + const PresentReplace + const PresentReplaceRoot + type QueryString string + const QueryIgnore + const QueryKeep + type RedirectMode string + const RedirectHard + const RedirectNavigate + const RedirectReplace + type RedirectOption func(*RedirectMode) + func WithRedirectMode(m RedirectMode) RedirectOption + type RefreshOption func(*refreshConfig) + func WithRefreshDebounce(d time.Duration) RefreshOption + func WithRefreshJitter(d time.Duration) RefreshOption + func WithRefreshSelector(selector string) RefreshOption + type Renderer interface + Render func(markdown string) (html string, err error) + type Request struct + Boosted bool + CurrentURL string + HistoryRestore bool + IsYPY bool + Layer string + Native Native + Prompt string + RequestType RequestType + Source string + Target string + Validate string + func FromContext(ctx context.Context) Request + func FromRequest(r *http.Request) Request + func (q Request) InLayer() bool + func (q Request) IsNative() bool + func (q Request) IsPartial() bool + func (q Request) IsValidation() bool + type RequestType string + const RequestFull + const RequestPartial + type SignalsOption func(*signalsConfig) + func WithOnlyIfMissing() SignalsOption + type SignatureError struct + Detail string + Err error + Signal string + func (e *SignatureError) Error() string + func (e *SignatureError) Unwrap() error + type Signer struct + func NewSigner(key []byte, previous ...[]byte) (*Signer, error) + func (s *Signer) Bind(binding string) *Signer + func (s *Signer) Declaration(values any, names ...string) (string, error) + func (s *Signer) Sign(name string, value any) (string, error) + func (s *Signer) SignPatch(patch any, names ...string) (map[string]any, error) + func (s *Signer) Verify(name string, value any, signature string) error + func (s *Signer) VerifySignals(doc []byte, names ...string) error + type Stream struct + func NewStream(w http.ResponseWriter, r *http.Request, opts ...StreamOption) (*Stream, error) + func (s *Stream) Close() + func (s *Stream) Context() context.Context + func (s *Stream) Done() <-chan struct{} + func (s *Stream) Event(name string, detail any, opts ...CustomOption) error + func (s *Stream) PatchElements(markup string, opts ...ElementsOption) error + func (s *Stream) PatchSignals(patch any, opts ...SignalsOption) error + func (s *Stream) Redirect(url string, opts ...RedirectOption) error + func (s *Stream) Refresh(opts ...RefreshOption) error + func (s *Stream) Send(ev Event) error + func (s *Stream) SendBatch(evs ...Event) error + type StreamOption func(*streamConfig) + func WithKeepAlive(d time.Duration) StreamOption + func WithRetry(d time.Duration) StreamOption + func WithWriteTimeout(d time.Duration) StreamOption