fix: parser types

This commit is contained in:
2026-01-01 14:45:25 -05:00
parent 4908605cf3
commit 34b4af5c81
3 changed files with 80 additions and 68 deletions

View File

@@ -2,7 +2,12 @@
package wa
import "github.com/a]h/templ"
import (
"sort"
"strings"
"github.com/a-h/templ"
)
// PropsBuilder is the interface all component builders implement
type PropsBuilder[T any] interface {
@@ -66,65 +71,65 @@ func WithData[B interface{ Attr(string, string) B }](b B, key, value string) B {
// Component registry for dynamic component creation
var componentRegistry = map[string]func() interface{}{
"wa-animated-image": func() interface{} { return NewAnimatedImage() },
"wa-animation": func() interface{} { return NewAnimation() },
"wa-avatar": func() interface{} { return NewAvatar() },
"wa-badge": func() interface{} { return NewBadge() },
"wa-breadcrumb-item": func() interface{} { return NewBreadcrumbItem() },
"wa-breadcrumb": func() interface{} { return NewBreadcrumb() },
"wa-button-group": func() interface{} { return NewButtonGroup() },
"wa-button": func() interface{} { return NewButton() },
"wa-callout": func() interface{} { return NewCallout() },
"wa-card": func() interface{} { return NewCard() },
"wa-carousel": func() interface{} { return NewCarousel() },
"wa-carousel-item": func() interface{} { return NewCarouselItem() },
"wa-checkbox": func() interface{} { return NewCheckbox() },
"wa-color-picker": func() interface{} { return NewColorPicker() },
"wa-combobox": func() interface{} { return NewCombobox() },
"wa-comparison": func() interface{} { return NewComparison() },
"wa-copy-button": func() interface{} { return NewCopyButton() },
"wa-details": func() interface{} { return NewDetails() },
"wa-dialog": func() interface{} { return NewDialog() },
"wa-divider": func() interface{} { return NewDivider() },
"wa-drawer": func() interface{} { return NewDrawer() },
"wa-dropdown": func() interface{} { return NewDropdown() },
"wa-dropdown-item": func() interface{} { return NewDropdownItem() },
"wa-format-bytes": func() interface{} { return NewFormatBytes() },
"wa-format-date": func() interface{} { return NewFormatDate() },
"wa-format-number": func() interface{} { return NewFormatNumber() },
"wa-icon": func() interface{} { return NewIcon() },
"wa-include": func() interface{} { return NewInclude() },
"wa-input": func() interface{} { return NewInput() },
"wa-animated-image": func() interface{} { return NewAnimatedImage() },
"wa-animation": func() interface{} { return NewAnimation() },
"wa-avatar": func() interface{} { return NewAvatar() },
"wa-badge": func() interface{} { return NewBadge() },
"wa-breadcrumb-item": func() interface{} { return NewBreadcrumbItem() },
"wa-breadcrumb": func() interface{} { return NewBreadcrumb() },
"wa-button-group": func() interface{} { return NewButtonGroup() },
"wa-button": func() interface{} { return NewButton() },
"wa-callout": func() interface{} { return NewCallout() },
"wa-card": func() interface{} { return NewCard() },
"wa-carousel": func() interface{} { return NewCarousel() },
"wa-carousel-item": func() interface{} { return NewCarouselItem() },
"wa-checkbox": func() interface{} { return NewCheckbox() },
"wa-color-picker": func() interface{} { return NewColorPicker() },
"wa-combobox": func() interface{} { return NewCombobox() },
"wa-comparison": func() interface{} { return NewComparison() },
"wa-copy-button": func() interface{} { return NewCopyButton() },
"wa-details": func() interface{} { return NewDetails() },
"wa-dialog": func() interface{} { return NewDialog() },
"wa-divider": func() interface{} { return NewDivider() },
"wa-drawer": func() interface{} { return NewDrawer() },
"wa-dropdown": func() interface{} { return NewDropdown() },
"wa-dropdown-item": func() interface{} { return NewDropdownItem() },
"wa-format-bytes": func() interface{} { return NewFormatBytes() },
"wa-format-date": func() interface{} { return NewFormatDate() },
"wa-format-number": func() interface{} { return NewFormatNumber() },
"wa-icon": func() interface{} { return NewIcon() },
"wa-include": func() interface{} { return NewInclude() },
"wa-input": func() interface{} { return NewInput() },
"wa-intersection-observer": func() interface{} { return NewIntersectionObserver() },
"wa-mutation-observer": func() interface{} { return NewMutationObserver() },
"wa-option": func() interface{} { return NewOption() },
"wa-page": func() interface{} { return NewPage() },
"wa-popover": func() interface{} { return NewPopover() },
"wa-popup": func() interface{} { return NewPopup() },
"wa-progress-bar": func() interface{} { return NewProgressBar() },
"wa-qr-code": func() interface{} { return NewQrCode() },
"wa-progress-ring": func() interface{} { return NewProgressRing() },
"wa-radio": func() interface{} { return NewRadio() },
"wa-radio-group": func() interface{} { return NewRadioGroup() },
"wa-rating": func() interface{} { return NewRating() },
"wa-relative-time": func() interface{} { return NewRelativeTime() },
"wa-resize-observer": func() interface{} { return NewResizeObserver() },
"wa-scroller": func() interface{} { return NewScroller() },
"wa-skeleton": func() interface{} { return NewSkeleton() },
"wa-select": func() interface{} { return NewSelect() },
"wa-slider": func() interface{} { return NewSlider() },
"wa-spinner": func() interface{} { return NewSpinner() },
"wa-split-panel": func() interface{} { return NewSplitPanel() },
"wa-switch": func() interface{} { return NewSwitch() },
"wa-tab": func() interface{} { return NewTab() },
"wa-tab-group": func() interface{} { return NewTabGroup() },
"wa-tab-panel": func() interface{} { return NewTabPanel() },
"wa-tag": func() interface{} { return NewTag() },
"wa-textarea": func() interface{} { return NewTextarea() },
"wa-tooltip": func() interface{} { return NewTooltip() },
"wa-tree": func() interface{} { return NewTree() },
"wa-tree-item": func() interface{} { return NewTreeItem() },
"wa-zoomable-frame": func() interface{} { return NewZoomableFrame() },
"wa-mutation-observer": func() interface{} { return NewMutationObserver() },
"wa-option": func() interface{} { return NewOption() },
"wa-page": func() interface{} { return NewPage() },
"wa-popover": func() interface{} { return NewPopover() },
"wa-popup": func() interface{} { return NewPopup() },
"wa-progress-bar": func() interface{} { return NewProgressBar() },
"wa-qr-code": func() interface{} { return NewQrCode() },
"wa-progress-ring": func() interface{} { return NewProgressRing() },
"wa-radio": func() interface{} { return NewRadio() },
"wa-radio-group": func() interface{} { return NewRadioGroup() },
"wa-rating": func() interface{} { return NewRating() },
"wa-relative-time": func() interface{} { return NewRelativeTime() },
"wa-resize-observer": func() interface{} { return NewResizeObserver() },
"wa-scroller": func() interface{} { return NewScroller() },
"wa-skeleton": func() interface{} { return NewSkeleton() },
"wa-select": func() interface{} { return NewSelect() },
"wa-slider": func() interface{} { return NewSlider() },
"wa-spinner": func() interface{} { return NewSpinner() },
"wa-split-panel": func() interface{} { return NewSplitPanel() },
"wa-switch": func() interface{} { return NewSwitch() },
"wa-tab": func() interface{} { return NewTab() },
"wa-tab-group": func() interface{} { return NewTabGroup() },
"wa-tab-panel": func() interface{} { return NewTabPanel() },
"wa-tag": func() interface{} { return NewTag() },
"wa-textarea": func() interface{} { return NewTextarea() },
"wa-tooltip": func() interface{} { return NewTooltip() },
"wa-tree": func() interface{} { return NewTree() },
"wa-tree-item": func() interface{} { return NewTreeItem() },
"wa-zoomable-frame": func() interface{} { return NewZoomableFrame() },
}
// GetBuilder returns a builder for the given component name

View File

@@ -2,6 +2,8 @@
package wa
import "fmt"
// Event names for Web Awesome components
// Use with Alpine.js x-on: directive or vanilla JS addEventListener
const (
@@ -21,9 +23,9 @@ const (
EventWaAfterCollapse = "wa-after-collapse"
// wa-after-expand - Emitted after the tree item expands and all animations are complete.
EventWaAfterExpand = "wa-after-expand"
// wa-after-hide -
// wa-after-hide -
EventWaAfterHide = "wa-after-hide"
// wa-after-show -
// wa-after-show -
EventWaAfterShow = "wa-after-show"
// wa-cancel - Emitted when the animation is canceled.
EventWaCancel = "wa-cancel"
@@ -39,7 +41,7 @@ const (
EventWaExpand = "wa-expand"
// wa-finish - Emitted when the animation finishes.
EventWaFinish = "wa-finish"
// wa-hide -
// wa-hide -
EventWaHide = "wa-hide"
// wa-hover - Emitted when the user hovers over a value. The phase property indicates when hovering starts, moves to a new value, o...
EventWaHover = "wa-hover"
@@ -67,7 +69,7 @@ const (
EventWaSelect = "wa-select"
// wa-selection-change - Emitted when a tree item is selected or deselected.
EventWaSelectionChange = "wa-selection-change"
// wa-show -
// wa-show -
EventWaShow = "wa-show"
// wa-slide-change - Emitted when the active slide changes.
EventWaSlideChange = "wa-slide-change"

View File

@@ -2,7 +2,12 @@
package wa
import "github.com/a]h/templ"
import (
"context"
"io"
"github.com/a-h/templ"
)
// Variant represents component theme variants
type Variant string
@@ -28,11 +33,11 @@ const (
type Appearance string
const (
AppearanceAccent Appearance = "accent"
AppearanceFilled Appearance = "filled"
AppearanceOutlined Appearance = "outlined"
AppearanceAccent Appearance = "accent"
AppearanceFilled Appearance = "filled"
AppearanceOutlined Appearance = "outlined"
AppearanceFilledOutlined Appearance = "filled-outlined"
AppearancePlain Appearance = "plain"
AppearancePlain Appearance = "plain"
)
// Orientation represents layout orientation