Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Patch ¶
type Patch struct {
// Type is the type of patch operation
Type PatchType `json:"op"`
// Selector is the css selector for the element to patch
Selector *string `json:"selector,omitempty"`
// Value is the value for the patch operation
Value any `json:"value,omitempty"`
// EventSourceID is the id of the element that triggered the event
EventSourceID *string `json:"eid,omitempty"`
}
Patch is an interface for all patch operations
type PatchType ¶
type PatchType string
PatchType is the type of patch operation
const ( ReplaceElement PatchType = "replaceElement" ReplaceContent PatchType = "replaceContent" After PatchType = "after" Before PatchType = "before" Append PatchType = "append" Prepend PatchType = "prepend" Remove PatchType = "remove" Reload PatchType = "reload" Store PatchType = "store" ResetForm PatchType = "resetForm" DispatchEvent PatchType = "dispatchEvent" )
type Patcher ¶
type Patcher interface {
// ReplaceEl patches the dom element at the given selector with the rendered template
ReplaceEl(selector string, t TemplateRenderer) Patcher
// ReplaceContent patches the dom element content at the given selector with the rendered template
ReplaceContent(selector string, t TemplateRenderer) Patcher
// After patches the dom element after the given selector with the rendered template
AfterEl(selector string, t TemplateRenderer) Patcher
// Before patches the dom element before the given selector with the rendered template
BeforeEl(selector string, t TemplateRenderer) Patcher
// Append patches the dom element after the given selector with the rendered template
AppendEl(selector string, t TemplateRenderer) Patcher
// Prepend patches the dom element before the given selector with the rendered template
PrependEl(selector string, t TemplateRenderer) Patcher
// Remove patches the dom element to remove the given selector
RemoveEl(selector string) Patcher
// Reload patches the dom to reload the page
Reload() Patcher
// Store patches the dom to update the alpinejs store
Store(name string, data any) Patcher
// ResetForm patches the dom to reset the form
ResetForm(selector string) Patcher
Navigate(url string) Patcher
// DispatchEvent patches the dom to dispatch the given event
DispatchEvent(selector, eventSourceID string, t TemplateRenderer) Patcher
// Patchset returns the patchset
Patchset() Patchset
// Error satisfies the error interface so that Context can return a Patcher
Error() string
}
type TemplateRenderer ¶
TemplateRenderer is an interface for rendering partial templates
func NewTemplateRenderer ¶
func NewTemplateRenderer(name string, data any) TemplateRenderer
NewTemplateRenderer creates a new template renderer
Click to show internal directories.
Click to hide internal directories.