css

package
v0.0.0-...-ada8b72 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2023 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// Flags for content dependent dimensions
	DimenContentMax uint32 = 0x0010
	DimenContentMin uint32 = 0x0020
	DimenContentFit uint32 = 0x0030
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DimenPatterns

type DimenPatterns[T any] struct {
	Auto    T
	Inherit T
	Initial T
	Just    T
	Default T
}

type DimenPatterns[T any] map[*MatchExpr[T]]T

type DimenT

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

DimenT is an option type for CSS dimensions.

func Auto

func Auto() DimenT

func DimenOption

func DimenOption(p style.Property) DimenT

DimenOption returns an optional dimension type from a property string. It will never return an error, even with illegal input, but instead will then return an unset dimension.

func Inherit

func Inherit() DimenT

func Initial

func Initial() DimenT

func JustDimen

func JustDimen(x dimen.DU) DimenT

JustDimen creates a CSS dimension with a fixed value of x.

func ParseDimen

func ParseDimen(s string) (DimenT, error)

ParseDimen parses a string to return an optional dimension. Syntax is CSS Unit. Valid dimensions are

15px
80%
-33rem

func Percentage

func Percentage(n Percent) DimenT

Percentage creates a CSS dimension with a %-relative value.

func (DimenT) IsAbsolute

func (d DimenT) IsAbsolute() bool

IsAbsolute returns true if d represents a valid absolute dimension.

func (DimenT) IsNone

func (d DimenT) IsNone() bool

IsNone returns true if d is unset.

func (DimenT) IsPercent

func (d DimenT) IsPercent() bool

IsPercent returns true if d represents a percentage dimension (`%`).

func (DimenT) IsRelative

func (d DimenT) IsRelative() bool

IsRelative returns true if d represents a valid relative dimension (`%`, `em`, etc.).

func (DimenT) Match

func (d DimenT) Match() *Matcher

func (DimenT) UnitString

func (o DimenT) UnitString() string

UnitString returns 'sp' (scaled points) for non-relative dimensions and a string denoting the defined unit for relative dimensions.

type MatchExpr

type MatchExpr[T any] struct {
	// contains filtered or unexported fields
}

func DimenPattern

func DimenPattern[T any](d DimenT) *MatchExpr[T]

func (*MatchExpr[T]) Const

func (m *MatchExpr[T]) Const(x T) T

func (*MatchExpr[T]) OneOf

func (m *MatchExpr[T]) OneOf(patterns DimenPatterns[T]) T

func (*MatchExpr[T]) With

func (m *MatchExpr[T]) With(du *dimen.DU) *MatchExpr[T]

type Matcher

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

func (*Matcher) IsKind

func (m *Matcher) IsKind(d DimenT) *Matcher

func (*Matcher) Just

func (m *Matcher) Just(du *dimen.DU) *Matcher

func (*Matcher) Percentage

func (m *Matcher) Percentage(p *Percent) *Matcher

Jump to

Keyboard shortcuts

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