Documentation
¶
Index ¶
- Variables
- func BuilderButton(basePath string, appID string) g.Node
- func BuilderIntegrationCard() g.Node
- func ExampleComplexLayout()
- func ExampleCreateTemplate()
- func ExampleModifyTemplate()
- func ExampleSerialization()
- func ExampleUseSampleTemplate()
- func ExampleValidation()
- func ListSampleTemplates() []string
- func RenderTemplate(doc *Document, variables map[string]any) (string, error)
- func RunAllExamples()
- func SampleTemplatesCompact(basePath string, currentApp *app.App) g.Node
- func SampleTemplatesGallery(basePath string, currentApp *app.App) g.Node
- func TemplatePreviewCard(template *Document, name, description, category string) g.Node
- func TemplateSelector(basePath string, currentApp *app.App) g.Node
- type AvatarBlockData
- type AvatarBlockProps
- type Block
- type BlockStyle
- type BlockType
- type BuilderUI
- type ButtonBlockData
- type ButtonBlockProps
- type ColumnBlockData
- type ColumnBlockProps
- type ColumnsBlockData
- type ColumnsBlockProps
- type ContainerBlockData
- type ContainerBlockProps
- type DividerBlockData
- type DividerBlockProps
- type Document
- type EmailLayoutData
- type HTMLBlockData
- type HTMLBlockProps
- type HeadingBlockData
- type HeadingBlockProps
- type ImageBlockData
- type ImageBlockProps
- type Padding
- type Renderer
- type SpacerBlockData
- type SpacerBlockProps
- type TemplateInfo
- type TextBlockData
- type TextBlockProps
Constants ¶
This section is empty.
Variables ¶
var SampleTemplates = map[string]*Document{}
SampleTemplates provides pre-built email templates.
Functions ¶
func BuilderButton ¶
BuilderButton returns a button component to launch the builder.
func BuilderIntegrationCard ¶
BuilderIntegrationCard renders an info card about the builder.
func ExampleComplexLayout ¶
func ExampleComplexLayout()
ExampleComplexLayout shows how to create a complex layout with columns.
func ExampleCreateTemplate ¶
func ExampleCreateTemplate()
ExampleCreateTemplate shows how to create a template from scratch.
func ExampleModifyTemplate ¶
func ExampleModifyTemplate()
ExampleModifyTemplate shows how to modify an existing template.
func ExampleSerialization ¶
func ExampleSerialization()
ExampleSerialization shows how to save and load documents.
func ExampleUseSampleTemplate ¶
func ExampleUseSampleTemplate()
ExampleUseSampleTemplate shows how to use a sample template.
func ExampleValidation ¶
func ExampleValidation()
ExampleValidation shows how to validate a document.
func ListSampleTemplates ¶
func ListSampleTemplates() []string
ListSampleTemplates returns list of available sample templates.
func RenderTemplate ¶
RenderTemplate is a helper to render a template to HTML.
func SampleTemplatesCompact ¶
SampleTemplatesCompact renders a compact version for sidebars/modals.
func SampleTemplatesGallery ¶
SampleTemplatesGallery renders a gallery of sample templates.
func TemplatePreviewCard ¶
TemplatePreviewCard renders a preview card for a template.
Types ¶
type AvatarBlockData ¶
type AvatarBlockData struct {
Style BlockStyle `json:"style"`
Props AvatarBlockProps `json:"props"`
}
AvatarBlockData represents avatar block configuration.
type AvatarBlockProps ¶
type BlockStyle ¶
type BlockStyle struct {
BackgroundColor string `json:"backgroundColor,omitempty"`
Color string `json:"color,omitempty"`
FontFamily string `json:"fontFamily,omitempty"`
FontSize int `json:"fontSize,omitempty"`
FontWeight string `json:"fontWeight,omitempty"`
TextAlign string `json:"textAlign,omitempty"`
Padding *Padding `json:"padding,omitempty"`
}
BlockStyle represents common style properties for blocks.
type BlockType ¶
type BlockType string
BlockType represents the type of email block.
const ( BlockTypeEmailLayout BlockType = "EmailLayout" BlockTypeText BlockType = "Text" BlockTypeHeading BlockType = "Heading" BlockTypeButton BlockType = "Button" BlockTypeImage BlockType = "Image" BlockTypeDivider BlockType = "Divider" BlockTypeSpacer BlockType = "Spacer" BlockTypeContainer BlockType = "Container" BlockTypeColumns BlockType = "Columns" BlockTypeColumn BlockType = "Column" BlockTypeHTML BlockType = "HTML" BlockTypeAvatar BlockType = "Avatar" )
type BuilderUI ¶
type BuilderUI struct {
// contains filtered or unexported fields
}
BuilderUI renders the visual email builder interface.
func NewBuilderUI ¶
NewBuilderUI creates a new builder UI instance.
func NewBuilderUIWithAutosave ¶
func NewBuilderUIWithAutosave(doc *Document, previewURL, saveURL, backURL, templateID string) *BuilderUI
NewBuilderUIWithAutosave creates a new builder UI instance with autosave enabled.
type ButtonBlockData ¶
type ButtonBlockData struct {
Style BlockStyle `json:"style"`
Props ButtonBlockProps `json:"props"`
}
ButtonBlockData represents button block configuration.
type ButtonBlockProps ¶
type ColumnBlockData ¶
type ColumnBlockData struct {
Style BlockStyle `json:"style"`
Props ColumnBlockProps `json:"props"`
ChildrenIDs []string `json:"childrenIds"`
}
ColumnBlockData represents a single column in columns block.
type ColumnBlockProps ¶
type ColumnBlockProps struct {
Width string `json:"width,omitempty"` // Can be percentage or auto
}
type ColumnsBlockData ¶
type ColumnsBlockData struct {
Style BlockStyle `json:"style"`
Props ColumnsBlockProps `json:"props"`
ChildrenIDs []string `json:"childrenIds"` // Column IDs
}
ColumnsBlockData represents columns block configuration.
type ColumnsBlockProps ¶
type ContainerBlockData ¶
type ContainerBlockData struct {
Style BlockStyle `json:"style"`
Props ContainerBlockProps `json:"props"`
ChildrenIDs []string `json:"childrenIds"`
}
ContainerBlockData represents container block configuration.
type ContainerBlockProps ¶
type ContainerBlockProps struct {
BackgroundColor string `json:"backgroundColor,omitempty"`
}
type DividerBlockData ¶
type DividerBlockData struct {
Style BlockStyle `json:"style"`
Props DividerBlockProps `json:"props"`
}
DividerBlockData represents divider block configuration.
type DividerBlockProps ¶
type Document ¶
Document represents the email builder document structure.
func GetSampleTemplate ¶
GetSampleTemplate returns a sample template by name.
func (*Document) AddBlock ¶
func (d *Document) AddBlock(blockType BlockType, data map[string]any, parentID string) (string, error)
AddBlock adds a block to the document and returns its ID.
func (*Document) RemoveBlock ¶
RemoveBlock removes a block from the document.
type EmailLayoutData ¶
type EmailLayoutData struct {
BackdropColor string `json:"backdropColor"`
CanvasColor string `json:"canvasColor"`
TextColor string `json:"textColor"`
LinkColor string `json:"linkColor"`
FontFamily string `json:"fontFamily"`
ChildrenIDs []string `json:"childrenIds"`
}
EmailLayoutData represents the root email layout configuration.
type HTMLBlockData ¶
type HTMLBlockData struct {
Style BlockStyle `json:"style"`
Props HTMLBlockProps `json:"props"`
}
HTMLBlockData represents raw HTML block configuration.
type HTMLBlockProps ¶
type HTMLBlockProps struct {
HTML string `json:"html"`
}
type HeadingBlockData ¶
type HeadingBlockData struct {
Style BlockStyle `json:"style"`
Props HeadingBlockProps `json:"props"`
}
HeadingBlockData represents heading block configuration.
type HeadingBlockProps ¶
type ImageBlockData ¶
type ImageBlockData struct {
Style BlockStyle `json:"style"`
Props ImageBlockProps `json:"props"`
}
ImageBlockData represents image block configuration.
type ImageBlockProps ¶
type Padding ¶
type Padding struct {
Top int `json:"top"`
Right int `json:"right"`
Bottom int `json:"bottom"`
Left int `json:"left"`
}
Padding represents padding configuration.
type Renderer ¶
type Renderer struct {
// contains filtered or unexported fields
}
Renderer converts email builder documents to HTML.
func NewRenderer ¶
NewRenderer creates a new renderer for the given document.
func (*Renderer) RenderToHTML ¶
RenderToHTML renders the document to HTML string.
type SpacerBlockData ¶
type SpacerBlockData struct {
Style BlockStyle `json:"style"`
Props SpacerBlockProps `json:"props"`
}
SpacerBlockData represents spacer block configuration.
type SpacerBlockProps ¶
type SpacerBlockProps struct {
Height int `json:"height"`
}
type TemplateInfo ¶
TemplateInfo holds metadata about sample templates.
func GetAllTemplateInfo ¶
func GetAllTemplateInfo() []TemplateInfo
GetAllTemplateInfo returns info about all available templates.
type TextBlockData ¶
type TextBlockData struct {
Style BlockStyle `json:"style"`
Props TextBlockProps `json:"props"`
}
TextBlockData represents text block configuration.
type TextBlockProps ¶
type TextBlockProps struct {
Text string `json:"text"`
}