784 lines
30 KiB
Go
784 lines
30 KiB
Go
// Code generated by templ - DO NOT EDIT.
|
|
|
|
// templ: version: v0.3.977
|
|
// Code generated by wa-generator. DO NOT EDIT.
|
|
|
|
// Source: Web Awesome wa-popup
|
|
|
|
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"
|
|
)
|
|
|
|
// Popup is a utility that lets you declaratively anchor "popup" containers to another element.
|
|
//
|
|
// Web Awesome component: <wa-popup>
|
|
|
|
// PopupProps holds all properties for the wa-popup component
|
|
type PopupProps struct {
|
|
// The element the popup will be anchored to. If the anchor lives outside of the popup, you can provide the anchor
|
|
Anchor string `attr:"anchor"`
|
|
// Activates the positioning logic and shows the popup. When this attribute is removed, the positioning logic is torn
|
|
Active bool `attr:"active"`
|
|
// The preferred placement of the popup. Note that the actual placement will vary as configured to keep the
|
|
// Valid values: "top", "top-start", "top-end", "bottom", "bottom-start", "bottom-end", "right", "right-start", "right-end", "left", "left-start", "left-end"
|
|
Placement string `attr:"placement"`
|
|
// The bounding box to use for flipping, shifting, and auto-sizing.
|
|
// Valid values: "viewport", "scroll"
|
|
Boundary string `attr:"boundary"`
|
|
// The distance in pixels from which to offset the panel away from its anchor.
|
|
Distance float64 `attr:"distance"`
|
|
// The distance in pixels from which to offset the panel along its anchor.
|
|
Skidding float64 `attr:"skidding"`
|
|
// Attaches an arrow to the popup. The arrow's size and color can be customized using the --arrow-size and
|
|
Arrow bool `attr:"arrow"`
|
|
// The placement of the arrow. The default is anchor, which will align the arrow as close to the center of the
|
|
// Valid values: "start", "end", "center", "anchor"
|
|
ArrowPlacement string `attr:"arrow-placement"`
|
|
// The amount of padding between the arrow and the edges of the popup. If the popup has a border-radius, for example,
|
|
ArrowPadding float64 `attr:"arrow-padding"`
|
|
// When set, placement of the popup will flip to the opposite site to keep it in view. You can use
|
|
Flip bool `attr:"flip"`
|
|
// If the preferred placement doesn't fit, popup will be tested in these fallback placements until one fits. Must be a
|
|
FlipFallbackPlacements string `attr:"flip-fallback-placements"`
|
|
// When neither the preferred placement nor the fallback placements fit, this value will be used to determine whether
|
|
// Valid values: "best-fit", "initial"
|
|
FlipFallbackStrategy string `attr:"flip-fallback-strategy"`
|
|
// The flip boundary describes clipping element(s) that overflow will be checked relative to when flipping. By
|
|
FlipBoundary string `attr:"flipBoundary"`
|
|
// The amount of padding, in pixels, to exceed before the flip behavior will occur.
|
|
FlipPadding float64 `attr:"flip-padding"`
|
|
// Moves the popup along the axis to keep it in view when clipped.
|
|
Shift bool `attr:"shift"`
|
|
// The shift boundary describes clipping element(s) that overflow will be checked relative to when shifting. By
|
|
ShiftBoundary string `attr:"shiftBoundary"`
|
|
// The amount of padding, in pixels, to exceed before the shift behavior will occur.
|
|
ShiftPadding float64 `attr:"shift-padding"`
|
|
// When set, this will cause the popup to automatically resize itself to prevent it from overflowing.
|
|
// Valid values: "horizontal", "vertical", "both"
|
|
AutoSize string `attr:"auto-size"`
|
|
// Syncs the popup's width or height to that of the anchor element.
|
|
// Valid values: "width", "height", "both"
|
|
Sync string `attr:"sync"`
|
|
// The auto-size boundary describes clipping element(s) that overflow will be checked relative to when resizing. By
|
|
AutoSizeBoundary string `attr:"autoSizeBoundary"`
|
|
// The amount of padding, in pixels, to exceed before the auto-size behavior will occur.
|
|
AutoSizePadding float64 `attr:"auto-size-padding"`
|
|
// When a gap exists between the anchor and the popup element, this option will add a "hover bridge" that fills the
|
|
HoverBridge bool `attr:"hover-bridge"`
|
|
|
|
// Events
|
|
// Emitted when the popup is repositioned. This event can fire a lot, so avoid putting expensive operations in your list...
|
|
OnReposition string `attr:"x-on:wa-reposition"`
|
|
|
|
// Slots contains named slot content
|
|
Slots PopupSlots
|
|
|
|
// Attrs contains additional HTML attributes
|
|
Attrs templ.Attributes
|
|
}
|
|
|
|
// PopupSlots holds named slot content for the component
|
|
type PopupSlots struct {
|
|
// The element the popup will be anchored to. If the anchor lives outside of the popup, you can use the anchor attribute...
|
|
Anchor templ.Component
|
|
}
|
|
|
|
// PopupBuilder provides a fluent API for constructing PopupProps
|
|
type PopupBuilder struct {
|
|
props PopupProps
|
|
}
|
|
|
|
// NewPopup creates a new builder for wa-popup
|
|
func NewPopup() *PopupBuilder {
|
|
return &PopupBuilder{}
|
|
}
|
|
|
|
// Anchor sets the anchor attribute
|
|
// The element the popup will be anchored to. If the anchor lives outside of the popup, you can provide the anchor
|
|
func (b *PopupBuilder) Anchor(v string) *PopupBuilder {
|
|
b.props.Anchor = v
|
|
return b
|
|
}
|
|
|
|
// Active sets the active attribute
|
|
// Activates the positioning logic and shows the popup. When this attribute is removed, the positioning logic is torn
|
|
func (b *PopupBuilder) Active(v bool) *PopupBuilder {
|
|
b.props.Active = v
|
|
return b
|
|
}
|
|
|
|
// Placement sets the placement attribute
|
|
// The preferred placement of the popup. Note that the actual placement will vary as configured to keep the
|
|
func (b *PopupBuilder) Placement(v string) *PopupBuilder {
|
|
b.props.Placement = v
|
|
return b
|
|
}
|
|
|
|
// Boundary sets the boundary attribute
|
|
// The bounding box to use for flipping, shifting, and auto-sizing.
|
|
func (b *PopupBuilder) Boundary(v string) *PopupBuilder {
|
|
b.props.Boundary = v
|
|
return b
|
|
}
|
|
|
|
// Distance sets the distance attribute
|
|
// The distance in pixels from which to offset the panel away from its anchor.
|
|
func (b *PopupBuilder) Distance(v float64) *PopupBuilder {
|
|
b.props.Distance = v
|
|
return b
|
|
}
|
|
|
|
// Skidding sets the skidding attribute
|
|
// The distance in pixels from which to offset the panel along its anchor.
|
|
func (b *PopupBuilder) Skidding(v float64) *PopupBuilder {
|
|
b.props.Skidding = v
|
|
return b
|
|
}
|
|
|
|
// Arrow sets the arrow attribute
|
|
// Attaches an arrow to the popup. The arrow's size and color can be customized using the --arrow-size and
|
|
func (b *PopupBuilder) Arrow(v bool) *PopupBuilder {
|
|
b.props.Arrow = v
|
|
return b
|
|
}
|
|
|
|
// ArrowPlacement sets the arrow-placement attribute
|
|
// The placement of the arrow. The default is anchor, which will align the arrow as close to the center of the
|
|
func (b *PopupBuilder) ArrowPlacement(v string) *PopupBuilder {
|
|
b.props.ArrowPlacement = v
|
|
return b
|
|
}
|
|
|
|
// ArrowPadding sets the arrow-padding attribute
|
|
// The amount of padding between the arrow and the edges of the popup. If the popup has a border-radius, for example,
|
|
func (b *PopupBuilder) ArrowPadding(v float64) *PopupBuilder {
|
|
b.props.ArrowPadding = v
|
|
return b
|
|
}
|
|
|
|
// Flip sets the flip attribute
|
|
// When set, placement of the popup will flip to the opposite site to keep it in view. You can use
|
|
func (b *PopupBuilder) Flip(v bool) *PopupBuilder {
|
|
b.props.Flip = v
|
|
return b
|
|
}
|
|
|
|
// FlipFallbackPlacements sets the flip-fallback-placements attribute
|
|
// If the preferred placement doesn't fit, popup will be tested in these fallback placements until one fits. Must be a
|
|
func (b *PopupBuilder) FlipFallbackPlacements(v string) *PopupBuilder {
|
|
b.props.FlipFallbackPlacements = v
|
|
return b
|
|
}
|
|
|
|
// FlipFallbackStrategy sets the flip-fallback-strategy attribute
|
|
// When neither the preferred placement nor the fallback placements fit, this value will be used to determine whether
|
|
func (b *PopupBuilder) FlipFallbackStrategy(v string) *PopupBuilder {
|
|
b.props.FlipFallbackStrategy = v
|
|
return b
|
|
}
|
|
|
|
// FlipBoundary sets the flipBoundary attribute
|
|
// The flip boundary describes clipping element(s) that overflow will be checked relative to when flipping. By
|
|
func (b *PopupBuilder) FlipBoundary(v string) *PopupBuilder {
|
|
b.props.FlipBoundary = v
|
|
return b
|
|
}
|
|
|
|
// FlipPadding sets the flip-padding attribute
|
|
// The amount of padding, in pixels, to exceed before the flip behavior will occur.
|
|
func (b *PopupBuilder) FlipPadding(v float64) *PopupBuilder {
|
|
b.props.FlipPadding = v
|
|
return b
|
|
}
|
|
|
|
// Shift sets the shift attribute
|
|
// Moves the popup along the axis to keep it in view when clipped.
|
|
func (b *PopupBuilder) Shift(v bool) *PopupBuilder {
|
|
b.props.Shift = v
|
|
return b
|
|
}
|
|
|
|
// ShiftBoundary sets the shiftBoundary attribute
|
|
// The shift boundary describes clipping element(s) that overflow will be checked relative to when shifting. By
|
|
func (b *PopupBuilder) ShiftBoundary(v string) *PopupBuilder {
|
|
b.props.ShiftBoundary = v
|
|
return b
|
|
}
|
|
|
|
// ShiftPadding sets the shift-padding attribute
|
|
// The amount of padding, in pixels, to exceed before the shift behavior will occur.
|
|
func (b *PopupBuilder) ShiftPadding(v float64) *PopupBuilder {
|
|
b.props.ShiftPadding = v
|
|
return b
|
|
}
|
|
|
|
// AutoSize sets the auto-size attribute
|
|
// When set, this will cause the popup to automatically resize itself to prevent it from overflowing.
|
|
func (b *PopupBuilder) AutoSize(v string) *PopupBuilder {
|
|
b.props.AutoSize = v
|
|
return b
|
|
}
|
|
|
|
// Sync sets the sync attribute
|
|
// Syncs the popup's width or height to that of the anchor element.
|
|
func (b *PopupBuilder) Sync(v string) *PopupBuilder {
|
|
b.props.Sync = v
|
|
return b
|
|
}
|
|
|
|
// AutoSizeBoundary sets the autoSizeBoundary attribute
|
|
// The auto-size boundary describes clipping element(s) that overflow will be checked relative to when resizing. By
|
|
func (b *PopupBuilder) AutoSizeBoundary(v string) *PopupBuilder {
|
|
b.props.AutoSizeBoundary = v
|
|
return b
|
|
}
|
|
|
|
// AutoSizePadding sets the auto-size-padding attribute
|
|
// The amount of padding, in pixels, to exceed before the auto-size behavior will occur.
|
|
func (b *PopupBuilder) AutoSizePadding(v float64) *PopupBuilder {
|
|
b.props.AutoSizePadding = v
|
|
return b
|
|
}
|
|
|
|
// HoverBridge sets the hover-bridge attribute
|
|
// When a gap exists between the anchor and the popup element, this option will add a "hover bridge" that fills the
|
|
func (b *PopupBuilder) HoverBridge(v bool) *PopupBuilder {
|
|
b.props.HoverBridge = v
|
|
return b
|
|
}
|
|
|
|
// OnReposition sets the handler for wa-reposition event
|
|
// Emitted when the popup is repositioned. This event can fire a lot, so avoid putting expensive operations in your list...
|
|
func (b *PopupBuilder) OnReposition(handler string) *PopupBuilder {
|
|
b.props.OnReposition = handler
|
|
return b
|
|
}
|
|
|
|
// AnchorSlot sets the anchor slot content
|
|
// The element the popup will be anchored to. If the anchor lives outside of the popup, you can use the anchor attribute...
|
|
func (b *PopupBuilder) AnchorSlot(c templ.Component) *PopupBuilder {
|
|
b.props.Slots.Anchor = c
|
|
return b
|
|
}
|
|
|
|
// Attr adds a custom HTML attribute
|
|
func (b *PopupBuilder) Attr(name, value string) *PopupBuilder {
|
|
if b.props.Attrs == nil {
|
|
b.props.Attrs = templ.Attributes{}
|
|
}
|
|
b.props.Attrs[name] = value
|
|
return b
|
|
}
|
|
|
|
// Attrs merges multiple attributes
|
|
func (b *PopupBuilder) Attrs(attrs templ.Attributes) *PopupBuilder {
|
|
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 *PopupBuilder) Props() PopupProps {
|
|
return b.props
|
|
}
|
|
|
|
// Build returns the props (alias for Props for semantic clarity)
|
|
func (b *PopupBuilder) Build() PopupProps {
|
|
return b.props
|
|
}
|
|
|
|
// Popup renders the wa-popup component
|
|
func Popup(props PopupProps) 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, "<wa-popup")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
if props.Anchor != "" {
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, " anchor=\"")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
var templ_7745c5c3_Var2 string
|
|
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(props.Anchor)
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/popup.templ`, Line: 296, Col: 24}
|
|
}
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "\"")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
}
|
|
if props.Active {
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, " active")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
}
|
|
if props.Placement != "" {
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, " placement=\"")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
var templ_7745c5c3_Var3 string
|
|
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(props.Placement)
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/popup.templ`, Line: 302, Col: 30}
|
|
}
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "\"")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
}
|
|
if props.Boundary != "" {
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, " boundary=\"")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
var templ_7745c5c3_Var4 string
|
|
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(props.Boundary)
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/popup.templ`, Line: 305, Col: 28}
|
|
}
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, "\"")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
}
|
|
if props.Distance != 0 {
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, " distance=\"")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
var templ_7745c5c3_Var5 string
|
|
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(templ.Sprintf("%v", props.Distance))
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/popup.templ`, Line: 308, Col: 49}
|
|
}
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, "\"")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
}
|
|
if props.Skidding != 0 {
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, " skidding=\"")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
var templ_7745c5c3_Var6 string
|
|
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(templ.Sprintf("%v", props.Skidding))
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/popup.templ`, Line: 311, Col: 49}
|
|
}
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, "\"")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
}
|
|
if props.Arrow {
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, " arrow")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
}
|
|
if props.ArrowPlacement != "" {
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, " arrow-placement=\"")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
var templ_7745c5c3_Var7 string
|
|
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(props.ArrowPlacement)
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/popup.templ`, Line: 317, Col: 41}
|
|
}
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "\"")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
}
|
|
if props.ArrowPadding != 0 {
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, " arrow-padding=\"")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
var templ_7745c5c3_Var8 string
|
|
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(templ.Sprintf("%v", props.ArrowPadding))
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/popup.templ`, Line: 320, Col: 58}
|
|
}
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "\"")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
}
|
|
if props.Flip {
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, " flip")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
}
|
|
if props.FlipFallbackPlacements != "" {
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, " flip-fallback-placements=\"")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
var templ_7745c5c3_Var9 string
|
|
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(props.FlipFallbackPlacements)
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/popup.templ`, Line: 326, Col: 58}
|
|
}
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 20, "\"")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
}
|
|
if props.FlipFallbackStrategy != "" {
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 21, " flip-fallback-strategy=\"")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
var templ_7745c5c3_Var10 string
|
|
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(props.FlipFallbackStrategy)
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/popup.templ`, Line: 329, Col: 54}
|
|
}
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10))
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 22, "\"")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
}
|
|
if props.FlipBoundary != "" {
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 23, " flipBoundary=\"")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
var templ_7745c5c3_Var11 string
|
|
templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(props.FlipBoundary)
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/popup.templ`, Line: 332, Col: 36}
|
|
}
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11))
|
|
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
|
|
}
|
|
}
|
|
if props.FlipPadding != 0 {
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 25, " flip-padding=\"")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
var templ_7745c5c3_Var12 string
|
|
templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(templ.Sprintf("%v", props.FlipPadding))
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/popup.templ`, Line: 335, Col: 56}
|
|
}
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12))
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 26, "\"")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
}
|
|
if props.Shift {
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 27, " shift")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
}
|
|
if props.ShiftBoundary != "" {
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 28, " shiftBoundary=\"")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
var templ_7745c5c3_Var13 string
|
|
templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(props.ShiftBoundary)
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/popup.templ`, Line: 341, Col: 38}
|
|
}
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13))
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 29, "\"")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
}
|
|
if props.ShiftPadding != 0 {
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 30, " shift-padding=\"")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
var templ_7745c5c3_Var14 string
|
|
templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(templ.Sprintf("%v", props.ShiftPadding))
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/popup.templ`, Line: 344, Col: 58}
|
|
}
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14))
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 31, "\"")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
}
|
|
if props.AutoSize != "" {
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 32, " auto-size=\"")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
var templ_7745c5c3_Var15 string
|
|
templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(props.AutoSize)
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/popup.templ`, Line: 347, Col: 29}
|
|
}
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15))
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 33, "\"")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
}
|
|
if props.Sync != "" {
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 34, " sync=\"")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
var templ_7745c5c3_Var16 string
|
|
templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(props.Sync)
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/popup.templ`, Line: 350, Col: 20}
|
|
}
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16))
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 35, "\"")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
}
|
|
if props.AutoSizeBoundary != "" {
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 36, " autoSizeBoundary=\"")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
var templ_7745c5c3_Var17 string
|
|
templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(props.AutoSizeBoundary)
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/popup.templ`, Line: 353, Col: 44}
|
|
}
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17))
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 37, "\"")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
}
|
|
if props.AutoSizePadding != 0 {
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 38, " auto-size-padding=\"")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
var templ_7745c5c3_Var18 string
|
|
templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs(templ.Sprintf("%v", props.AutoSizePadding))
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/popup.templ`, Line: 356, Col: 65}
|
|
}
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var18))
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 39, "\"")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
}
|
|
if props.HoverBridge {
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 40, " hover-bridge")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
}
|
|
if props.OnReposition != "" {
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 41, " x-on:wa-reposition=\"")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
var templ_7745c5c3_Var19 string
|
|
templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinStringErrs(props.OnReposition)
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/popup.templ`, Line: 362, Col: 42}
|
|
}
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var19))
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 42, "\"")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
}
|
|
templ_7745c5c3_Err = templ.RenderAttributes(ctx, templ_7745c5c3_Buffer, props.Attrs)
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 43, ">")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
if props.Slots.Anchor != nil {
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 44, "<div slot=\"anchor\">")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
templ_7745c5c3_Err = props.Slots.Anchor.Render(ctx, templ_7745c5c3_Buffer)
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 45, "</div>")
|
|
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, 46, "</wa-popup>")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// PopupFunc renders with a builder function for inline configuration
|
|
func PopupFunc(fn func(*PopupBuilder)) 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_Var20 := templ.GetChildren(ctx)
|
|
if templ_7745c5c3_Var20 == nil {
|
|
templ_7745c5c3_Var20 = templ.NopComponent
|
|
}
|
|
ctx = templ.ClearChildren(ctx)
|
|
b := NewPopup()
|
|
fn(b)
|
|
templ_7745c5c3_Var21 := 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_Var20.Render(ctx, templ_7745c5c3_Buffer)
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
return nil
|
|
})
|
|
templ_7745c5c3_Err = Popup(b.Props()).Render(templ.WithChildren(ctx, templ_7745c5c3_Var21), templ_7745c5c3_Buffer)
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
var _ = templruntime.GeneratedTemplate
|