media

package
v1.6.5 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2024 License: GPL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddableMedia

type AddableMedia interface {
	// AddJS adds a JS asset to the media.
	AddJS(js ...Asset)

	// AddCSS adds a CSS asset to the media.
	AddCSS(css ...Asset)
}

type Asset

type Asset interface {
	String() string
	Render() template.HTML
}

type CSS

type CSS string

func (CSS) Render

func (c CSS) Render() template.HTML

func (CSS) String

func (c CSS) String() string

type JS

type JS string

func (JS) Render

func (j JS) Render() template.HTML

func (JS) String

func (j JS) String() string

type JSAsset

type JSAsset struct {
	Type string
	URL  string
}

func (*JSAsset) Render

func (j *JSAsset) Render() template.HTML

func (*JSAsset) String

func (j *JSAsset) String() string

type Media

type Media interface {
	// Merge merges the media of the other Media object into this one.
	// It returns the merged Media object - it modifies the receiver.
	Merge(other Media) Media

	// A list of JS script tags to include.
	JS() []template.HTML

	// A list of CSS link tags to include.
	CSS() []template.HTML

	// The list of raw JS urls to include.
	JSList() []Asset

	// The list of raw CSS urls to include.
	CSSList() []Asset

	AddableMedia
}

type MediaDefiner

type MediaDefiner interface {
	Media() Media
}

type MediaObject

type MediaObject struct {
	Css *orderedmap.OrderedMap[string, Asset]
	Js  *orderedmap.OrderedMap[string, Asset]
}

func NewMedia

func NewMedia() *MediaObject

func (*MediaObject) AddCSS

func (m *MediaObject) AddCSS(list ...Asset)

func (*MediaObject) AddJS

func (m *MediaObject) AddJS(list ...Asset)

func (*MediaObject) CSS

func (m *MediaObject) CSS() []template.HTML

func (*MediaObject) CSSList

func (m *MediaObject) CSSList() []Asset

func (*MediaObject) JS

func (m *MediaObject) JS() []template.HTML

func (*MediaObject) JSList

func (m *MediaObject) JSList() []Asset

func (*MediaObject) Merge

func (m *MediaObject) Merge(other Media) Media

func (*MediaObject) String

func (m *MediaObject) String() string

Jump to

Keyboard shortcuts

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