composite

package
v0.2.2-alpha Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FragmentConfigGetName

func FragmentConfigGetName() string

FragmentConfigGetName returns the HyperBricks type associated with the FragmentConfig.

func GetTemplateFileContent

func GetTemplateFileContent(templatePath string) (string, error)

getTemplateFileContent attempts to retrieve the template content from the cache. If not found, it reads the file from disk, caches it, and returns the content.

func HeadConfigGetName

func HeadConfigGetName() string

HeadConfigGetName returns the HyperBricks type associated with the HeadConfig.

func HyperMediaConfigGetName

func HyperMediaConfigGetName() string

HyperMediaConfigGetName returns the HyperBricks type associated with the HyperMediaConfig.

func SetHeadersFromHxRequest

func SetHeadersFromHxRequest(config *HxResponse, writer http.ResponseWriter)

func SortCompositeErrors

func SortCompositeErrors(errors []error, sortedKeys []string) []error

func TemplateConfigGetName

func TemplateConfigGetName() string

func TreeRendererConfigGetName

func TreeRendererConfigGetName() string

Types

type FragmentConfig

type FragmentConfig struct {
	shared.Composite   `mapstructure:",squash"`
	HxResponse         `mapstructure:"response" description:"HTMX response header configuration." example:"{!{fragment-response.hyperbricks}}"`
	MetaDocDescription string                 `` /* 222-byte string literal not displayed */
	HxResponseWriter   http.ResponseWriter    `mapstructure:"hx_response" exclude:"true"`
	Title              string                 `mapstructure:"title" description:"The title of the fragment" example:"{!{fragment-title.hyperbricks}}"`
	Route              string                 `` /* 129-byte string literal not displayed */
	Section            string                 `mapstructure:"section" description:"The section the fragment belongs to" example:"{!{fragment-section.hyperbricks}}"`
	Items              map[string]interface{} `mapstructure:",remain"`
	Enclose            string                 `` /* 131-byte string literal not displayed */
	Template           map[string]interface{} `` /* 133-byte string literal not displayed */
	IsStatic           bool                   `mapstructure:"isstatic" exclude:"true"`
	Static             string                 `mapstructure:"static" description:"Static file path associated with the fragment" example:"{!{fragment-static.hyperbricks}}"`
	Index              int                    `` /* 194-byte string literal not displayed */
}

FragmentConfig represents configuration for a single fragment.

func (*FragmentConfig) Validate

func (fragment *FragmentConfig) Validate() []error

Validate ensures that the fragment has valid data.

type FragmentRenderer

type FragmentRenderer struct {
	renderer.CompositeRenderer
}

FragmentRenderer handles rendering of PAGE content.

func (*FragmentRenderer) Render

func (pr *FragmentRenderer) Render(instance interface{}) (string, []error)

Render implements the RenderComponent interface.

func (*FragmentRenderer) Types

func (r *FragmentRenderer) Types() []string

type HeadConfig

type HeadConfig struct {
	shared.Composite `mapstructure:",squash"`
	Title            string            `mapstructure:"title" description:"The title of the hypermedia document" example:"{!{head-title.hyperbricks}}"`
	Favicon          string            `mapstructure:"favicon" description:"Path to the favicon for the hypermedia document" example:"{!{head-favicon.hyperbricks}}"`
	MetaData         map[string]string `mapstructure:"meta" description:"Metadata for the head section" example:"{!{head-meta.hyperbricks}}"`
	Css              []string          `mapstructure:"css" description:"CSS files to include" example:"{!{head-css.hyperbricks}}"`
	Js               []string          `mapstructure:"js" description:"JavaScript files to include" example:"{!{head-js.hyperbricks}}"`
}

HeadConfig represents the configuration for the head section.

func (*HeadConfig) Validate

func (config *HeadConfig) Validate() []error

Validate ensures that the RENDER has valid data.

type HeadRenderer

type HeadRenderer struct {
	renderer.CompositeRenderer
}

HeadRenderer handles rendering of COA content.

func (*HeadRenderer) Render

func (cr *HeadRenderer) Render(instance interface{}) (string, []error)

Render implements the RenderComponent interface for COA.

func (*HeadRenderer) Types

func (r *HeadRenderer) Types() []string

type HxResponse

type HxResponse struct {
	HxTemplateResult     string // just for output of the parsed template
	HxLocation           string `` /* 139-byte string literal not displayed */
	HxPushedUrl          string `mapstructure:"hx_push_url" header:"HX-Pushed-Url" description:"pushes a new url into the history stack"`
	HxRedirect           string `mapstructure:"hx_redirect" header:"HX-Redirect" description:"can be used to do a client-side redirect to a new location"`
	HxRefresh            string `` /* 127-byte string literal not displayed */
	HxReplaceUrl         string `mapstructure:"hx_replace_url" header:"HX-Replace-Url" description:"replaces the current url in the location bar"`
	HxReswap             string `mapstructure:"hx_reswap" header:"HX-Reswap" description:"allows you to specify how the response will be swapped"`
	HxRetarget           string `mapstructure:"hx_retarget" header:"HX-Retarget" description:"a css selector that updates the target of the content update"`
	HxReselect           string `` /* 154-byte string literal not displayed */
	HxTrigger            string `mapstructure:"hx_trigger" header:"HX-Trigger" description:"allows you to trigger client-side events"`
	HxTriggerafterSettle string `` /* 149-byte string literal not displayed */
	HxTriggerafterSwap   string `` /* 143-byte string literal not displayed */
}

type HyperMediaConfig

type HyperMediaConfig struct {
	shared.Composite   `mapstructure:",squash"`
	MetaDocDescription string                 `mapstructure:"@doc" description:"HYPERMEDIA description" example:"{!{hypermedia-@doc.hyperbricks}}"`
	Title              string                 `mapstructure:"title" description:"The title of the hypermedia site" example:"{!{hypermedia-title.hyperbricks}}"`
	Route              string                 `` /* 133-byte string literal not displayed */
	Section            string                 `` /* 177-byte string literal not displayed */
	Items              map[string]interface{} `mapstructure:",remain"`
	BodyTag            string                 `` /* 257-byte string literal not displayed */
	Enclose            string                 `` /* 127-byte string literal not displayed */
	Favicon            string                 `mapstructure:"favicon" description:"Path to the favicon for the hypermedia" example:"{!{hypermedia-favicon.hyperbricks}}"`
	Template           map[string]interface{} `` /* 177-byte string literal not displayed */
	IsStatic           bool                   `mapstructure:"isstatic" exclude:"true"`
	Static             string                 `` /* 179-byte string literal not displayed */
	Index              int                    `` /* 216-byte string literal not displayed */
	Doctype            string                 `mapstructure:"doctype" description:"Alternative Doctype for the HTML document" example:"{!{hypermedia-doctype.hyperbricks}}"`
	HtmlTag            string                 `mapstructure:"htmltag" description:"The opening HTML tag with attributes" example:"{!{hypermedia-htmltag.hyperbricks}}"`
	Head               map[string]interface{} `` /* 130-byte string literal not displayed */
}

HyperMediaConfig represents configuration hypermedia.

func (*HyperMediaConfig) Validate

func (hm *HyperMediaConfig) Validate() []error

Validate ensures that the page has valid data.

type HyperMediaRenderer

type HyperMediaRenderer struct {
	renderer.CompositeRenderer
}

HyperMediaRenderer handles rendering of PAGE content.

func (*HyperMediaRenderer) Render

func (pr *HyperMediaRenderer) Render(instance interface{}) (string, []error)

Render implements the RenderComponent interface.

func (*HyperMediaRenderer) Types

func (r *HyperMediaRenderer) Types() []string

type TemplateConfig

type TemplateConfig struct {
	shared.Composite   `mapstructure:",squash"`
	MetaDocDescription string `mapstructure:"@doc" description:"TEMPLATE description" example:"{!{template-@doc.hyperbricks}}"`
	Template           string `` /* 150-byte string literal not displayed */
	Inline             string `` /* 166-byte string literal not displayed */

	Values  map[string]interface{} `mapstructure:"values" description:"Key-value pairs for template rendering" example:"{!{template-values.hyperbricks}}"`
	Enclose string                 `` /* 132-byte string literal not displayed */
}

TemplateConfig represents the configuration for a TEMPLATE type.

func (*TemplateConfig) Validate

func (head *TemplateConfig) Validate() []error

type TemplateRenderer

type TemplateRenderer struct {
	renderer.CompositeRenderer
}

func (*TemplateRenderer) Render

func (tr *TemplateRenderer) Render(instance interface{}) (string, []error)

func (*TemplateRenderer) Types

func (r *TemplateRenderer) Types() []string

type TreeConfig

type TreeConfig struct {
	shared.Composite   `mapstructure:",squash"`
	MetaDocDescription string `` /* 170-byte string literal not displayed */
	Enclose            string `mapstructure:"enclose" description:"Wrapping property for the tree" example:"{!{tree-enclose.hyperbricks}}"`
}

TreeConfig

func (*TreeConfig) Validate

func (config *TreeConfig) Validate() []error

type TreeRenderer

type TreeRenderer struct {
	renderer.CompositeRenderer
}

func (*TreeRenderer) Render

func (r *TreeRenderer) Render(data interface{}) (string, []error)

Concurrent and Recursive Renderer and returns the result and errors. This function is a blueprint function for all concurent rendering of pages, render and template objects

func (*TreeRenderer) Types

func (r *TreeRenderer) Types() []string

Jump to

Keyboard shortcuts

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