themes

package
v0.26.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 4, 2026 License: MIT Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Template

type Template struct {
	bun.BaseModel `bun:"table:templates,alias:tp"`

	ID           uuid.UUID                 `bun:",pk,type:uuid" json:"id"`
	ThemeID      uuid.UUID                 `bun:"theme_id,notnull,type:uuid" json:"theme_id"`
	Name         string                    `bun:"name,notnull" json:"name"`
	Slug         string                    `bun:"slug,notnull" json:"slug"`
	Description  *string                   `bun:"description" json:"description,omitempty"`
	TemplatePath string                    `bun:"template_path,notnull" json:"template_path"`
	Regions      map[string]TemplateRegion `bun:"regions,type:jsonb,notnull" json:"regions"`
	Metadata     map[string]any            `bun:"metadata,type:jsonb" json:"metadata,omitempty"`
	CreatedAt    time.Time                 `bun:"created_at,nullzero,default:current_timestamp" json:"created_at"`
	UpdatedAt    time.Time                 `bun:"updated_at,nullzero,default:current_timestamp" json:"updated_at"`

	Theme *Theme `bun:"rel:belongs-to,join:theme_id=id" json:"theme,omitempty"`
}

Template defines the layout surface for pages within a theme.

type TemplateRegion

type TemplateRegion struct {
	Name            string   `json:"name"`
	Description     *string  `json:"description,omitempty"`
	AcceptsWidgets  bool     `json:"accepts_widgets"`
	AcceptsBlocks   bool     `json:"accepts_blocks"`
	FallbackRegions []string `json:"fallback_regions,omitempty"`
}

TemplateRegion describes an individual block/widget surface exposed by a template.

type Theme

type Theme struct {
	bun.BaseModel `bun:"table:themes,alias:t"`

	ID          uuid.UUID   `bun:",pk,type:uuid" json:"id"`
	Name        string      `bun:"name,notnull,unique" json:"name"`
	Description *string     `bun:"description" json:"description,omitempty"`
	Version     string      `bun:"version,notnull" json:"version"`
	Author      *string     `bun:"author" json:"author,omitempty"`
	IsActive    bool        `bun:"is_active,notnull,default:false" json:"is_active"`
	ThemePath   string      `bun:"theme_path,notnull" json:"theme_path"`
	Config      ThemeConfig `bun:"config,type:jsonb" json:"config"`
	CreatedAt   time.Time   `bun:"created_at,nullzero,default:current_timestamp" json:"created_at"`
	UpdatedAt   time.Time   `bun:"updated_at,nullzero,default:current_timestamp" json:"updated_at"`

	Templates []*Template `bun:"rel:has-many,join:id=theme_id" json:"templates,omitempty"`
}

Theme captures a complete site design (templates, assets, metadata).

type ThemeAssets

type ThemeAssets struct {
	BasePath *string  `json:"base_path,omitempty"`
	Styles   []string `json:"styles,omitempty"`
	Scripts  []string `json:"scripts,omitempty"`
	Images   []string `json:"images,omitempty"`
}

ThemeAssets references static files associated with the theme

type ThemeConfig

type ThemeConfig struct {
	WidgetAreas   []ThemeWidgetArea   `json:"widget_areas,omitempty"`
	MenuLocations []ThemeMenuLocation `json:"menu_locations,omitempty"`
	Assets        *ThemeAssets        `json:"assets,omitempty"`
	Metadata      map[string]any      `json:"metadata,omitempty"`
}

ThemeConfig records manifest level details parsed from theme descriptors.

type ThemeMenuLocation

type ThemeMenuLocation struct {
	Code        string  `json:"code"`
	Name        string  `json:"name"`
	Description *string `json:"description,omitempty"`
}

ThemeMenuLocation links menus to theme-defined regions

type ThemeWidgetArea

type ThemeWidgetArea struct {
	Code        string  `json:"code"`
	Name        string  `json:"name"`
	Description *string `json:"description,omitempty"`
	Scope       string  `json:"scope,omitempty"` // e.g. "global", "template", "page"
}

ThemeWidgetArea declares widget placements injected by a theme.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL