// Code generated by templ - DO NOT EDIT. // templ: version: v0.3.960 // Code generated by wa-generator. DO NOT EDIT. // Source: Web Awesome wa-split-panel 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" ) // Split panels display two adjacent panels, allowing the user to reposition them. // // Web Awesome component: // SplitPanelProps holds all properties for the wa-split-panel component type SplitPanelProps struct { // The current position of the divider from the primary panel's edge as a percentage 0-100. Defaults to 50% of the Position float64 `attr:"position"` // The current position of the divider from the primary panel's edge in pixels. PositionInPixels float64 `attr:"position-in-pixels"` // Sets the split panel's orientation. // Valid values: "horizontal", "vertical" Orientation string `attr:"orientation"` // Disables resizing. Note that the position may still change as a result of resizing the host element. Disabled bool `attr:"disabled"` // If no primary panel is designated, both panels will resize proportionally when the host element is resized. If a // Valid values: "start", "end" Primary string `attr:"primary"` // One or more space-separated values at which the divider should snap. Values can be in pixels or percentages, e.g. Snap string `attr:"snap"` // How close the divider must be to a snap point until snapping occurs. SnapThreshold float64 `attr:"snap-threshold"` // Events // Emitted when the divider's position changes. OnReposition string `attr:"x-on:wa-reposition"` // Slots contains named slot content Slots SplitPanelSlots // Attrs contains additional HTML attributes Attrs templ.Attributes } // SplitPanelSlots holds named slot content for the component type SplitPanelSlots struct { // Content to place in the start panel. Start templ.Component // Content to place in the end panel. End templ.Component // The divider. Useful for slotting in a custom icon that renders as a handle. Divider templ.Component } // SplitPanelBuilder provides a fluent API for constructing SplitPanelProps type SplitPanelBuilder struct { props SplitPanelProps } // NewSplitPanel creates a new builder for wa-split-panel func NewSplitPanel() *SplitPanelBuilder { return &SplitPanelBuilder{} } // Position sets the position attribute // The current position of the divider from the primary panel's edge as a percentage 0-100. Defaults to 50% of the func (b *SplitPanelBuilder) Position(v float64) *SplitPanelBuilder { b.props.Position = v return b } // PositionInPixels sets the position-in-pixels attribute // The current position of the divider from the primary panel's edge in pixels. func (b *SplitPanelBuilder) PositionInPixels(v float64) *SplitPanelBuilder { b.props.PositionInPixels = v return b } // Orientation sets the orientation attribute // Sets the split panel's orientation. func (b *SplitPanelBuilder) Orientation(v string) *SplitPanelBuilder { b.props.Orientation = v return b } // Disabled sets the disabled attribute // Disables resizing. Note that the position may still change as a result of resizing the host element. func (b *SplitPanelBuilder) Disabled(v bool) *SplitPanelBuilder { b.props.Disabled = v return b } // Primary sets the primary attribute // If no primary panel is designated, both panels will resize proportionally when the host element is resized. If a func (b *SplitPanelBuilder) Primary(v string) *SplitPanelBuilder { b.props.Primary = v return b } // Snap sets the snap attribute // One or more space-separated values at which the divider should snap. Values can be in pixels or percentages, e.g. func (b *SplitPanelBuilder) Snap(v string) *SplitPanelBuilder { b.props.Snap = v return b } // SnapThreshold sets the snap-threshold attribute // How close the divider must be to a snap point until snapping occurs. func (b *SplitPanelBuilder) SnapThreshold(v float64) *SplitPanelBuilder { b.props.SnapThreshold = v return b } // OnReposition sets the handler for wa-reposition event // Emitted when the divider's position changes. func (b *SplitPanelBuilder) OnReposition(handler string) *SplitPanelBuilder { b.props.OnReposition = handler return b } // StartSlot sets the start slot content // Content to place in the start panel. func (b *SplitPanelBuilder) StartSlot(c templ.Component) *SplitPanelBuilder { b.props.Slots.Start = c return b } // EndSlot sets the end slot content // Content to place in the end panel. func (b *SplitPanelBuilder) EndSlot(c templ.Component) *SplitPanelBuilder { b.props.Slots.End = c return b } // DividerSlot sets the divider slot content // The divider. Useful for slotting in a custom icon that renders as a handle. func (b *SplitPanelBuilder) DividerSlot(c templ.Component) *SplitPanelBuilder { b.props.Slots.Divider = c return b } // Attr adds a custom HTML attribute func (b *SplitPanelBuilder) Attr(name, value string) *SplitPanelBuilder { if b.props.Attrs == nil { b.props.Attrs = templ.Attributes{} } b.props.Attrs[name] = value return b } // Attrs merges multiple attributes func (b *SplitPanelBuilder) Attrs(attrs templ.Attributes) *SplitPanelBuilder { 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 *SplitPanelBuilder) Props() SplitPanelProps { return b.props } // Build returns the props (alias for Props for semantic clarity) func (b *SplitPanelBuilder) Build() SplitPanelProps { return b.props } // SplitPanel renders the wa-split-panel component func SplitPanel(props SplitPanelProps) 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 } if props.Slots.Start != nil { templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } templ_7745c5c3_Err = props.Slots.Start.Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } if props.Slots.End != nil { templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 20, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } templ_7745c5c3_Err = props.Slots.End.Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 21, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } if props.Slots.Divider != nil { templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 22, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } templ_7745c5c3_Err = props.Slots.Divider.Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 23, "
") 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, 24, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } return nil }) } // SplitPanelFunc renders with a builder function for inline configuration func SplitPanelFunc(fn func(*SplitPanelBuilder)) 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_Var9 := templ.GetChildren(ctx) if templ_7745c5c3_Var9 == nil { templ_7745c5c3_Var9 = templ.NopComponent } ctx = templ.ClearChildren(ctx) b := NewSplitPanel() fn(b) templ_7745c5c3_Var10 := 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_Var9.Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } return nil }) templ_7745c5c3_Err = SplitPanel(b.Props()).Render(templ.WithChildren(ctx, templ_7745c5c3_Var10), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } return nil }) } var _ = templruntime.GeneratedTemplate