// Code generated by wa-generator. DO NOT EDIT. // Source: Web Awesome wa-resize-observer package wa import ( "github.com/a-h/templ" ) // The Resize Observer component offers a thin, declarative interface to the ResizeObserver API. // // Web Awesome component: // ResizeObserverProps holds all properties for the wa-resize-observer component type ResizeObserverProps struct { // Disables the observer. Disabled bool `attr:"disabled"` // Events // Emitted when the element is resized. OnResize string `attr:"x-on:wa-resize"` // Slots contains named slot content Slots ResizeObserverSlots // Attrs contains additional HTML attributes Attrs templ.Attributes } // ResizeObserverBuilder provides a fluent API for constructing ResizeObserverProps type ResizeObserverBuilder struct { props ResizeObserverProps } // NewResizeObserver creates a new builder for wa-resize-observer func NewResizeObserver() *ResizeObserverBuilder { return &ResizeObserverBuilder{} } // Disabled sets the disabled attribute // Disables the observer. func (b *ResizeObserverBuilder) Disabled(v bool) *ResizeObserverBuilder { b.props.Disabled = v return b } // OnResize sets the handler for wa-resize event // Emitted when the element is resized. func (b *ResizeObserverBuilder) OnResize(handler string) *ResizeObserverBuilder { b.props.OnResize = handler return b } // Attr adds a custom HTML attribute func (b *ResizeObserverBuilder) Attr(name, value string) *ResizeObserverBuilder { if b.props.Attrs == nil { b.props.Attrs = templ.Attributes{} } b.props.Attrs[name] = value return b } // Attrs merges multiple attributes func (b *ResizeObserverBuilder) Attrs(attrs templ.Attributes) *ResizeObserverBuilder { if b.props.Attrs == nil { b.props.Attrs = templ.Attributes{} } for k, v := range attrs { b.props.Attrs[k] = v } return b } // Props returns the built properties func (b *ResizeObserverBuilder) Props() ResizeObserverProps { return b.props } // Build returns the props (alias for Props for semantic clarity) func (b *ResizeObserverBuilder) Build() ResizeObserverProps { return b.props } // ResizeObserver renders the wa-resize-observer component templ ResizeObserver(props ResizeObserverProps) { { children... } } // ResizeObserverFunc renders with a builder function for inline configuration templ ResizeObserverFunc(fn func(*ResizeObserverBuilder)) { {{ b := NewResizeObserver(); fn(b) }} @ResizeObserver(b.Props()) { { children... } } }