misc

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2023 License: GPL-2.0 Imports: 9 Imported by: 0

Documentation

Rendered for js/wasm

Index

Constants

This section is empty.

Variables

View Source
var Box = []string{
	"border-radius: 0 0 0.5rem 0.5rem",
	"box-shadow: 0 1rem 1rem 0 rgba(0,0,0,0.2)",
}
View Source
var Container = []string{
	"width: 80%",
	"margin: 1rem auto",
	"padding: 0 2%",
	"padding-bottom: 1rem",
}
View Source
var GridDelimiter = " "

Functions

func FancyHR

func FancyHR(opts *HR) *elements.Element

func GridNoOverflow

func GridNoOverflow(opts *GridOptions) *elements.Element

func JiggleText

func JiggleText(tag, text string, opts *JiggleOptions) *elements.Element

func Join

func Join(css ...[]string) []string

func NewGrid

func NewGrid(opts *GridOptions) *elements.Element

func RoadMap

func RoadMap(roadMap *RoadMapOptions) *elements.Element
func SearchBar(classPrefix, foregroundHex, background, text string) []*elements.Element

Search bar element with button Returns slice of elements [0]: search container, [1]: search bar, [2]: search bar submit button

Types

type ButtonType

type ButtonType int
const (
	Anchor ButtonType = 0
	Button ButtonType = 1
)

type Counter

type Counter struct {
	// contains filtered or unexported fields
}

func NewCounter

func NewCounter(elem *elements.Element) *Counter

func (*Counter) Add

func (c *Counter) Add(i int)

func (*Counter) Decrement

func (c *Counter) Decrement()

func (*Counter) Get

func (c *Counter) Get() int

func (*Counter) Increment

func (c *Counter) Increment()

func (*Counter) Reset

func (c *Counter) Reset()

func (*Counter) Set

func (c *Counter) Set(i int)

func (*Counter) Sub

func (c *Counter) Sub(i int)

type Grid

type Grid interface {
	Columns() []*elements.Element
	Rows() []*elements.Element
	Element() *elements.Element
	Render() jsext.Element
}

func GridFromPattern

func GridFromPattern(gridItemCallback func(row int, column int, index int) []*elements.Element, gridPattern ...string) Grid

Provide a grid based on a pattern. Returns the rows and columns of the grid.

type GridItem

type GridItem struct {
	Header *elements.Element
	Body   *elements.Element
	Footer *elements.Element
}

func (*GridItem) Container

func (g *GridItem) Container(className string) *elements.Element

type GridOptions

type GridOptions struct {
	// The grid items to display inside of the grid.
	GridItems []*GridItem
	// Grid width, 100%, etc.
	Width string
	// GridItemWidth grid width, 1fr, etc.
	GridItemWidth string
	// Amount of rows and columns in the grid.
	Columns int
	Rows    int
	// Column fractions
	GridColumnWidth []string
	// If there are too many grid items supplied, and ElementOnOverflow is not nil,
	// the last grid item will be replaced with the ElementOnOverflow when used in a supportive function.
	ElementOnOverflow *GridItem
	// ExtraCSS is a map with the following keys, to edit their respective elements css styles.
	// 	- grid
	// 	- grid-item
	ExtraCSS map[string]string
	// Class prefix for the grid, and its elements.
	ClassPrefix string
	// Function to be called for adding extra CSS.
	CSSFunc func(gridClass, itemClass, itemHeaderClass, itemBodyClass, itemFooterClass string) string
}

func (*GridOptions) Fractions

func (c *GridOptions) Fractions(fr ...string)

type HR

type HR struct {
	// Width and height of the HR
	Width, Height string
	// Main colors to use.
	BackCol, FadeCol string
	// Margin top and bottom.
	MarginTopBottom string
	// Border radius
	BorderRadius string
	// Fade direction, can be "left", "right", "top", "bottom"
	FadeDir string
	// Format strings for the colors
	// Example: "rgba(%d, %d, %d, 1)"
	BackColFormat string
	// Format strings for the colors
	// Example: "rgba(%d, %d, %d, 0.1)"
	FadeColFormat string
	// Animate
	Animate bool
}

type JiggleOptions

type JiggleOptions struct {
	ChangeColor string
	ClassPrefix string
	Words       bool
}

func (*JiggleOptions) MainElementClass

func (opts *JiggleOptions) MainElementClass() string

func (*JiggleOptions) SetDefaults

func (opts *JiggleOptions) SetDefaults()
type Modal elements.Element

func CreateModal

func CreateModal(opts ModalOptions) *Modal

func (*Modal) Button

func (m *Modal) Button(tag ButtonType, innerText string) *elements.Element

func (*Modal) CloseOnClickOf

func (m *Modal) CloseOnClickOf(e *elements.Element)

func (*Modal) Create

func (m *Modal) Create(appendToQuerySelector ...string)

func (*Modal) Delete

func (m *Modal) Delete()

func (*Modal) Hide

func (m *Modal) Hide()

func (*Modal) OpenOnClickOf

func (m *Modal) OpenOnClickOf(e *elements.Element)

func (*Modal) Render

func (m *Modal) Render() jsext.Element

func (*Modal) Show

func (m *Modal) Show()

type ModalOptions

type ModalOptions struct {
	Header           *elements.Element
	Body             *elements.Element
	Footer           *elements.Element
	Background       string
	ModalBackground  string
	BorderRadius     string
	Border           string
	Width            string
	Height           string
	ClassPrefix      string
	CloseButton      bool
	CloseButtonScale float64
	ZIndex           int
}

func (*ModalOptions) SetDefaults

func (opts *ModalOptions) SetDefaults()

type RoadMapItem

type RoadMapItem struct {
	Name         string
	Title        string
	TitleElement *elements.Element
	Description  string
	Tags         []string
	StartDate    string
	EndDate      string
}

type RoadMapOptions

type RoadMapOptions struct {
	Background          string
	ItemBackground      string
	TagBackgroundColors []string
	Color               string
	TitleColor          string
	TagColor            string
	DivisorColor        string
	DivisorWidth        string
	CardMargin          string
	CardBorderWidth     string
	CardBorderColor     string
	Width               string
	Items               []RoadMapItem

	Style        RoadMapStyle
	Translations Translations
	FontScale    float64
	// contains filtered or unexported fields
}

type RoadMapStyle

type RoadMapStyle int
const (
	RoadMapStyleOne RoadMapStyle = iota
	RoadMapStyleTwo
)

type TimeCounter

type TimeCounter struct {
	// contains filtered or unexported fields
}

func NewTimeCounter

func NewTimeCounter(elem *elements.Element) *TimeCounter

func (*TimeCounter) Add

func (c *TimeCounter) Add(t time.Duration)

func (*TimeCounter) Date

func (c *TimeCounter) Date(year int, month time.Month, day int, hour int, min int, sec int, nsec int)

func (*TimeCounter) Display

func (c *TimeCounter) Display(Time time.Time)

func (*TimeCounter) FormatFunc

func (c *TimeCounter) FormatFunc(f func(*convert.TimeTracker) string)

func (*TimeCounter) Get

func (c *TimeCounter) Get() time.Time

func (*TimeCounter) Increment

func (c *TimeCounter) Increment()

func (*TimeCounter) Live

func (c *TimeCounter) Live()

func (*TimeCounter) Reset

func (c *TimeCounter) Reset()

func (*TimeCounter) Set

func (c *TimeCounter) Set(t time.Time)

func (*TimeCounter) SetFormat

func (c *TimeCounter) SetFormat(format string)

func (*TimeCounter) StopLive

func (c *TimeCounter) StopLive()

func (*TimeCounter) Sub

func (c *TimeCounter) Sub(t time.Duration)

func (*TimeCounter) Tracker

func (c *TimeCounter) Tracker() *convert.TimeTracker

func (*TimeCounter) UpdateFunc

func (c *TimeCounter) UpdateFunc(f func(*convert.TimeTracker, *elements.Element))

type Translations

type Translations struct {
	To      string
	Present string
}

Jump to

Keyboard shortcuts

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