// Code generated by templ - DO NOT EDIT. // templ: version: v0.3.960 // Code generated by wa-generator. DO NOT EDIT. // Source: Web Awesome wa-animation package wa //lint:file-ignore SA4006 This context is only used if a nested component is present. import "github.com/a-h/templ" import templruntime "github.com/a-h/templ/runtime" import ( "github.com/a-h/templ" ) // Animate elements declaratively with nearly 100 baked-in presets, or roll your own with custom keyframes. Powered by t... // // Web Awesome component: // AnimationProps holds all properties for the wa-animation component type AnimationProps struct { // The name of the built-in animation to use. For custom animations, use the keyframes prop. Name string `attr:"name"` // Plays the animation. When omitted, the animation will be paused. This attribute will be automatically removed when Play bool `attr:"play"` // The number of milliseconds to delay the start of the animation. Delay float64 `attr:"delay"` // Determines the direction of playback as well as the behavior when reaching the end of an iteration. Direction string `attr:"direction"` // The number of milliseconds each iteration of the animation takes to complete. Duration float64 `attr:"duration"` // The easing function to use for the animation. This can be a Web Awesome easing function or a custom easing function Easing string `attr:"easing"` // The number of milliseconds to delay after the active period of an animation sequence. EndDelay float64 `attr:"end-delay"` // Sets how the animation applies styles to its target before and after its execution. Fill string `attr:"fill"` // The number of iterations to run before the animation completes. Defaults to Infinity, which loops. Iterations float64 `attr:"iterations"` // The offset at which to start the animation, usually between 0 (start) and 1 (end). IterationStart float64 `attr:"iteration-start"` // Sets the animation's playback rate. The default is 1, which plays the animation at a normal speed. Setting this PlaybackRate float64 `attr:"playback-rate"` // Events // Emitted when the animation is canceled. OnCancel string `attr:"x-on:wa-cancel"` // Emitted when the animation finishes. OnFinish string `attr:"x-on:wa-finish"` // Emitted when the animation starts or restarts. OnStart string `attr:"x-on:wa-start"` // Slots contains named slot content Slots AnimationSlots // Attrs contains additional HTML attributes Attrs templ.Attributes } // AnimationBuilder provides a fluent API for constructing AnimationProps type AnimationBuilder struct { props AnimationProps } // NewAnimation creates a new builder for wa-animation func NewAnimation() *AnimationBuilder { return &AnimationBuilder{} } // Name sets the name attribute // The name of the built-in animation to use. For custom animations, use the keyframes prop. func (b *AnimationBuilder) Name(v string) *AnimationBuilder { b.props.Name = v return b } // Play sets the play attribute // Plays the animation. When omitted, the animation will be paused. This attribute will be automatically removed when func (b *AnimationBuilder) Play(v bool) *AnimationBuilder { b.props.Play = v return b } // Delay sets the delay attribute // The number of milliseconds to delay the start of the animation. func (b *AnimationBuilder) Delay(v float64) *AnimationBuilder { b.props.Delay = v return b } // Direction sets the direction attribute // Determines the direction of playback as well as the behavior when reaching the end of an iteration. func (b *AnimationBuilder) Direction(v string) *AnimationBuilder { b.props.Direction = v return b } // Duration sets the duration attribute // The number of milliseconds each iteration of the animation takes to complete. func (b *AnimationBuilder) Duration(v float64) *AnimationBuilder { b.props.Duration = v return b } // Easing sets the easing attribute // The easing function to use for the animation. This can be a Web Awesome easing function or a custom easing function func (b *AnimationBuilder) Easing(v string) *AnimationBuilder { b.props.Easing = v return b } // EndDelay sets the end-delay attribute // The number of milliseconds to delay after the active period of an animation sequence. func (b *AnimationBuilder) EndDelay(v float64) *AnimationBuilder { b.props.EndDelay = v return b } // Fill sets the fill attribute // Sets how the animation applies styles to its target before and after its execution. func (b *AnimationBuilder) Fill(v string) *AnimationBuilder { b.props.Fill = v return b } // Iterations sets the iterations attribute // The number of iterations to run before the animation completes. Defaults to Infinity, which loops. func (b *AnimationBuilder) Iterations(v float64) *AnimationBuilder { b.props.Iterations = v return b } // IterationStart sets the iteration-start attribute // The offset at which to start the animation, usually between 0 (start) and 1 (end). func (b *AnimationBuilder) IterationStart(v float64) *AnimationBuilder { b.props.IterationStart = v return b } // PlaybackRate sets the playback-rate attribute // Sets the animation's playback rate. The default is 1, which plays the animation at a normal speed. Setting this func (b *AnimationBuilder) PlaybackRate(v float64) *AnimationBuilder { b.props.PlaybackRate = v return b } // OnCancel sets the handler for wa-cancel event // Emitted when the animation is canceled. func (b *AnimationBuilder) OnCancel(handler string) *AnimationBuilder { b.props.OnCancel = handler return b } // OnFinish sets the handler for wa-finish event // Emitted when the animation finishes. func (b *AnimationBuilder) OnFinish(handler string) *AnimationBuilder { b.props.OnFinish = handler return b } // OnStart sets the handler for wa-start event // Emitted when the animation starts or restarts. func (b *AnimationBuilder) OnStart(handler string) *AnimationBuilder { b.props.OnStart = handler return b } // Attr adds a custom HTML attribute func (b *AnimationBuilder) Attr(name, value string) *AnimationBuilder { if b.props.Attrs == nil { b.props.Attrs = templ.Attributes{} } b.props.Attrs[name] = value return b } // Attrs merges multiple attributes func (b *AnimationBuilder) Attrs(attrs templ.Attributes) *AnimationBuilder { 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 *AnimationBuilder) Props() AnimationProps { return b.props } // Build returns the props (alias for Props for semantic clarity) func (b *AnimationBuilder) Build() AnimationProps { return b.props } // Animation renders the wa-animation component func Animation(props AnimationProps) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { return templ_7745c5c3_CtxErr } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) if templ_7745c5c3_Err == nil { templ_7745c5c3_Err = templ_7745c5c3_BufErr } }() } ctx = templ.InitializeContext(ctx) templ_7745c5c3_Var1 := templ.GetChildren(ctx) if templ_7745c5c3_Var1 == nil { templ_7745c5c3_Var1 = templ.NopComponent } ctx = templ.ClearChildren(ctx) templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } templ_7745c5c3_Err = templ_7745c5c3_Var1.Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 30, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } return nil }) } // AnimationFunc renders with a builder function for inline configuration func AnimationFunc(fn func(*AnimationBuilder)) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { return templ_7745c5c3_CtxErr } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) if templ_7745c5c3_Err == nil { templ_7745c5c3_Err = templ_7745c5c3_BufErr } }() } ctx = templ.InitializeContext(ctx) templ_7745c5c3_Var15 := templ.GetChildren(ctx) if templ_7745c5c3_Var15 == nil { templ_7745c5c3_Var15 = templ.NopComponent } ctx = templ.ClearChildren(ctx) b := NewAnimation() fn(b) templ_7745c5c3_Var16 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) if templ_7745c5c3_Err == nil { templ_7745c5c3_Err = templ_7745c5c3_BufErr } }() } ctx = templ.InitializeContext(ctx) templ_7745c5c3_Err = templ_7745c5c3_Var15.Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } return nil }) templ_7745c5c3_Err = Animation(b.Props()).Render(templ.WithChildren(ctx, templ_7745c5c3_Var16), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } return nil }) } var _ = templruntime.GeneratedTemplate