properties

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Overview

This package defines the types needed to handle the various CSS properties. There are 3 groups of types for a property, separated by 2 steps : cascading and computation. Thus the need of 3 types (see below). Schematically, the style computation is :

ValidatedProperty (ComputedFromCascaded)-> CascadedProperty (Compute)-> CssProperty

Index

Constants

View Source
const (
	True  = Bool(true)
	False = Bool(false)
)
View Source
const (
	// AutoF indicates a value specified as "auto", which will
	// be resolved during layout.
	AutoF special = true
)

Variables

View Source
var (
	ZeroPixels = Dimension{Unit: Px}

	CurrentColor = Color{Type: parser.ColorCurrentColor}
	// How many CSS pixels is one <unit>?
	// http://www.w3.org/TR/CSS21/syndata.html#length-units
	LengthsToPixels = map[Unit]Float{
		Px: 1,
		Pt: 1. / 0.75,
		Pc: 16.,
		In: 96.,
		Cm: 96. / 2.54,
		Mm: 96. / 25.4,
		Q:  96. / 25.4 / 4.,
	}

	// Value in pixels of font-size for <absolute-size> keywords: 12pt (16px) for
	// medium, and scaling factors given in CSS3 for others:
	// http://www.w3.org/TR/css3-fonts/#font-size-prop
	FontSizeKeywords = map[string]Float{
		"xx-small": InitialValues.GetFontSize().Value * 3 / 5,
		"x-small":  InitialValues.GetFontSize().Value * 3 / 4,
		"small":    InitialValues.GetFontSize().Value * 8 / 9,
		"medium":   InitialValues.GetFontSize().Value * 1 / 1,
		"large":    InitialValues.GetFontSize().Value * 6 / 5,
		"x-large":  InitialValues.GetFontSize().Value * 3 / 2,
		"xx-large": InitialValues.GetFontSize().Value * 2 / 1,
	}
	FontSizeKeywordsOrder = []string{"xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large"}

	// http://www.w3.org/TR/css3-page/#size
	PageSizes = map[string]Point{
		"a10":     {Dimension{Value: 26, Unit: Mm}, Dimension{Value: 37, Unit: Mm}},
		"a9":      {Dimension{Value: 37, Unit: Mm}, Dimension{Value: 52, Unit: Mm}},
		"a8":      {Dimension{Value: 52, Unit: Mm}, Dimension{Value: 74, Unit: Mm}},
		"a7":      {Dimension{Value: 74, Unit: Mm}, Dimension{Value: 105, Unit: Mm}},
		"a6":      {Dimension{Value: 105, Unit: Mm}, Dimension{Value: 148, Unit: Mm}},
		"a5":      {Dimension{Value: 148, Unit: Mm}, Dimension{Value: 210, Unit: Mm}},
		"a4":      A4,
		"a3":      {Dimension{Value: 297, Unit: Mm}, Dimension{Value: 420, Unit: Mm}},
		"a2":      {Dimension{Value: 420, Unit: Mm}, Dimension{Value: 594, Unit: Mm}},
		"a1":      {Dimension{Value: 594, Unit: Mm}, Dimension{Value: 841, Unit: Mm}},
		"a0":      {Dimension{Value: 841, Unit: Mm}, Dimension{Value: 1189, Unit: Mm}},
		"b10":     {Dimension{Value: 31, Unit: Mm}, Dimension{Value: 44, Unit: Mm}},
		"b9":      {Dimension{Value: 44, Unit: Mm}, Dimension{Value: 62, Unit: Mm}},
		"b8":      {Dimension{Value: 62, Unit: Mm}, Dimension{Value: 88, Unit: Mm}},
		"b7":      {Dimension{Value: 88, Unit: Mm}, Dimension{Value: 125, Unit: Mm}},
		"b6":      {Dimension{Value: 125, Unit: Mm}, Dimension{Value: 176, Unit: Mm}},
		"b5":      {Dimension{Value: 176, Unit: Mm}, Dimension{Value: 250, Unit: Mm}},
		"b4":      {Dimension{Value: 250, Unit: Mm}, Dimension{Value: 353, Unit: Mm}},
		"b3":      {Dimension{Value: 353, Unit: Mm}, Dimension{Value: 500, Unit: Mm}},
		"b2":      {Dimension{Value: 500, Unit: Mm}, Dimension{Value: 707, Unit: Mm}},
		"b1":      {Dimension{Value: 707, Unit: Mm}, Dimension{Value: 1000, Unit: Mm}},
		"b0":      {Dimension{Value: 1000, Unit: Mm}, Dimension{Value: 1414, Unit: Mm}},
		"c10":     {Dimension{Value: 28, Unit: Mm}, Dimension{Value: 40, Unit: Mm}},
		"c9":      {Dimension{Value: 40, Unit: Mm}, Dimension{Value: 57, Unit: Mm}},
		"c8":      {Dimension{Value: 57, Unit: Mm}, Dimension{Value: 81, Unit: Mm}},
		"c7":      {Dimension{Value: 81, Unit: Mm}, Dimension{Value: 114, Unit: Mm}},
		"c6":      {Dimension{Value: 114, Unit: Mm}, Dimension{Value: 162, Unit: Mm}},
		"c5":      {Dimension{Value: 162, Unit: Mm}, Dimension{Value: 229, Unit: Mm}},
		"c4":      {Dimension{Value: 229, Unit: Mm}, Dimension{Value: 324, Unit: Mm}},
		"c3":      {Dimension{Value: 324, Unit: Mm}, Dimension{Value: 458, Unit: Mm}},
		"c2":      {Dimension{Value: 458, Unit: Mm}, Dimension{Value: 648, Unit: Mm}},
		"c1":      {Dimension{Value: 648, Unit: Mm}, Dimension{Value: 917, Unit: Mm}},
		"c0":      {Dimension{Value: 917, Unit: Mm}, Dimension{Value: 1297, Unit: Mm}},
		"jis-b10": {Dimension{Value: 32, Unit: Mm}, Dimension{Value: 45, Unit: Mm}},
		"jis-b9":  {Dimension{Value: 45, Unit: Mm}, Dimension{Value: 64, Unit: Mm}},
		"jis-b8":  {Dimension{Value: 64, Unit: Mm}, Dimension{Value: 91, Unit: Mm}},
		"jis-b7":  {Dimension{Value: 91, Unit: Mm}, Dimension{Value: 128, Unit: Mm}},
		"jis-b6":  {Dimension{Value: 128, Unit: Mm}, Dimension{Value: 182, Unit: Mm}},
		"jis-b5":  {Dimension{Value: 182, Unit: Mm}, Dimension{Value: 257, Unit: Mm}},
		"jis-b4":  {Dimension{Value: 257, Unit: Mm}, Dimension{Value: 364, Unit: Mm}},
		"jis-b3":  {Dimension{Value: 364, Unit: Mm}, Dimension{Value: 515, Unit: Mm}},
		"jis-b2":  {Dimension{Value: 515, Unit: Mm}, Dimension{Value: 728, Unit: Mm}},
		"jis-b1":  {Dimension{Value: 728, Unit: Mm}, Dimension{Value: 1030, Unit: Mm}},
		"jis-b0":  {Dimension{Value: 1030, Unit: Mm}, Dimension{Value: 1456, Unit: Mm}},
		"letter":  {Dimension{Value: 8.5, Unit: In}, Dimension{Value: 11, Unit: In}},
		"legal":   {Dimension{Value: 8.5, Unit: In}, Dimension{Value: 14, Unit: In}},
		"ledger":  {Dimension{Value: 11, Unit: In}, Dimension{Value: 17, Unit: In}},
	}

	A4 = Point{Dimension{Value: 210, Unit: Mm}, Dimension{Value: 297, Unit: Mm}}

	KnownProperties = NewSetK()

	// Do not list shorthand properties here as we handle them before inheritance.
	//
	// Values inherited but not applicable to print are not included.
	//
	// text_decoration is not a really inherited, see
	// http://www.w3.org/TR/CSS2/text.html#propdef-text-decoration
	//
	// link: click events normally bubble up to link ancestors
	// See http://lists.w3.org/Archives/Public/www-style/2012Jun/0315.html
	Inherited = NewSetK(
		PBorderCollapse,
		PBorderSpacing,
		PCaptionSide,
		PColor,
		PDirection,
		PEmptyCells,
		PFontFamily,
		PFontFeatureSettings,
		PFontKerning,
		PFontLanguageOverride,
		PFontSize,
		PFontStyle,
		PFontStretch,
		PFontVariant,
		PFontVariantAlternates,
		PFontVariantCaps,
		PFontVariantEastAsian,
		PFontVariantLigatures,
		PFontVariantNumeric,
		PFontVariantPosition,
		PFontVariationSettings,
		PFontWeight,
		PHyphens,
		PHyphenateCharacter,
		PHyphenateLimitChars,
		PHyphenateLimitZone,
		PImageRendering,
		PImageResolution,
		PLang,
		PLetterSpacing,
		PLineHeight,
		PLink,
		PListStyleImage,
		PListStylePosition,
		PListStyleType,
		POrphans,
		POverflowWrap,
		PQuotes,
		PTabSize,
		PTextAlignAll,
		PTextAlignLast,
		PTextIndent,
		PTextTransform,
		PVisibility,
		PWhiteSpace,
		PWidows,
		PWordSpacing,
		PWordBreak,
	)

	// Not applicable to the print media
	NotPrintMedia = utils.NewSet(

		"azimuth",
		"cue",
		"cue-after",
		"cue-before",
		"elevation",
		"pause",
		"pause-after",
		"pause-before",
		"pitch-range",
		"pitch",
		"play-during",
		"richness",
		"speak-header",
		"speak-numeral",
		"speak-punctuation",
		"speak",
		"speech-rate",
		"stress",
		"voice-family",
		"volume",

		"cursor",

		"animation",
		"animation-delay",
		"animation-direction",
		"animation-duration",
		"animation-fill-mode",
		"animation-iteration-count",
		"animation-name",
		"animation-play-state",
		"animation-timing-function",
		"transition",
		"transition-delay",
		"transition-duration",
		"transition-property",
		"transition-timing-function",
	)

	// http://www.w3.org/TR/CSS21/tables.html#model
	// See also http://lists.w3.org/Archives/Public/www-style/2012Jun/0066.html
	// Only non-inherited properties need to be included here.
	TableWrapperBoxProperties = NewSetK(
		PBottom,
		PBreakAfter,
		PBreakBefore,
		PBreakInside,
		PClear,
		PCounterIncrement,
		PCounterReset,
		PCounterSet,
		PFloat,
		PLeft,
		PMarginTop,
		PMarginBottom,
		PMarginLeft,
		PMarginRight,
		POpacity,
		POverflow,
		PPosition,
		PRight,
		PTop,
		PTransform,
		PTransformOrigin,
		PVerticalAlign,
		PZIndex,
	)

	InitialNotComputed = NewSetK(
		PDisplay,
		PColumnGap,
		PBleedTop,
		PBleedLeft,
		PBleedBottom,
		PBleedRight,
		POutlineWidth,
		POutlineColor,
		PColumnRuleWidth,
		PColumnRuleColor,
		PBorderTopWidth,
		PBorderLeftWidth,
		PBorderBottomWidth,
		PBorderRightWidth,
		PBorderTopColor,
		PBorderLeftColor,
		PBorderBottomColor,
		PBorderRightColor,
	)
)
View Source
var Inf = Float(math.Inf(+1))
View Source
var InitialValues = Properties{}/* 159 elements not displayed */

InitialValues stores the default values for the CSS properties.

View Source
var PropsFromNames = map[string]KnownProp{}/* 159 elements not displayed */

PropsFromNames maps CSS property names to internal enum tags.

Functions

func Is

func Is(m MaybeFloat) bool

Return true except for 0 or nil

Types

type AttrData

type AttrData struct {
	Fallback   CssProperty
	Name       string
	TypeOrUnit string
}

func (AttrData) IsNone

func (v AttrData) IsNone() bool

type Bool

type Bool bool

type BoolString

type BoolString struct {
	String string
	Bool   bool
}

func (BoolString) IsNone

func (v BoolString) IsNone() bool

type CascadedProperty

type CascadedProperty struct {
	Default DefaultKind
	// contains filtered or unexported fields
}

CascadedProperty is the second form of a CSS input : var() calls have been resolved and the remaining raw properties have been checked. It is thus either a plain CSS property, or a default value.

func AsCascaded

func AsCascaded(prop CssProperty) CascadedProperty

func (CascadedProperty) AsValidated

func (c CascadedProperty) AsValidated() ValidatedProperty

AsValidated wraps the property into a ValidatedProperty

func (CascadedProperty) IsNone

func (v CascadedProperty) IsNone() bool

func (CascadedProperty) ToCSS

func (c CascadedProperty) ToCSS() CssProperty

ToCSS will panic if c.Default is not 0.

type Center

type Center struct {
	OriginX string
	OriginY string
	Pos     Point
}

func (Center) IsNone

func (v Center) IsNone() bool

type Centers

type Centers []Center

func (Centers) Repeat

func (bs Centers) Repeat(n int) CssProperty

type Color

type Color parser.Color

func NewColor

func NewColor(r, g, b, a Fl) Color

type ColorStop

type ColorStop struct {
	Color    Color
	Position Dimension
}

func (ColorStop) IsNone

func (v ColorStop) IsNone() bool

type ColorsStops

type ColorsStops []ColorStop

type ContentProperties

type ContentProperties []ContentProperty

type ContentProperty

type ContentProperty struct {
	// SStrings for type STRING, attr or string, counter, counters
	// Quote for type QUOTE
	// Url for URI
	// String for leader()
	Content InnerContent

	Type string
}

func (ContentProperty) AsCounter

func (c ContentProperty) AsCounter() (counterName string, counterStyle CounterStyleID)

func (ContentProperty) AsCounters

func (c ContentProperty) AsCounters() (counterName, separator string, counterStyle CounterStyleID)

func (ContentProperty) AsLeader

func (c ContentProperty) AsLeader() string

func (ContentProperty) AsQuote

func (c ContentProperty) AsQuote() Quote

func (ContentProperty) AsString

func (c ContentProperty) AsString() (value string)

func (ContentProperty) AsStrings

func (c ContentProperty) AsStrings() []string

func (ContentProperty) AsTargetCounter

func (c ContentProperty) AsTargetCounter() (anchorToken ContentProperty, counterName, counterStyle string)

func (ContentProperty) AsTargetCounters

func (c ContentProperty) AsTargetCounters() (anchorToken ContentProperty, counterName string, separator ContentProperty, counterStyle string)

func (ContentProperty) AsTargetText

func (c ContentProperty) AsTargetText() (anchorToken ContentProperty, textStyle string)

func (ContentProperty) IsNone

func (v ContentProperty) IsNone() bool

type CounterStyleID

type CounterStyleID struct {
	Type    string // one of symbols(), string, or empty for an identifier
	Name    string
	Symbols Strings
}

func (CounterStyleID) IsNone

func (v CounterStyleID) IsNone() bool

type Counters

type Counters struct {
	Name      string
	Separator string // optional, only valid for counters()
	Style     CounterStyleID
}

Counters store a counter() or counters() attribute

func (Counters) IsNone

func (v Counters) IsNone() bool

type CssProperty

type CssProperty interface {
	// contains filtered or unexported methods
}

type Decorations

type Decorations utils.Set

func (Decorations) IsNone

func (v Decorations) IsNone() bool

func (Decorations) Union added in v0.0.3

func (dec Decorations) Union(other Decorations) Decorations

Union return the union of [s] and [other]

type DefaultKind

type DefaultKind uint8
const (
	Inherit DefaultKind = iota + 1
	Initial
)

func (DefaultKind) AsCascaded

func (d DefaultKind) AsCascaded() CascadedProperty

AsCascaded wraps the default to a CascadedProperty

type Dimension

type Dimension struct {
	Unit  Unit
	Value Float
}

Dimension without unit is interpreted as float

func FToD

func FToD(f Fl) Dimension

func (Dimension) IsNone

func (v Dimension) IsNone() bool

func (Dimension) ToPixels

func (d Dimension) ToPixels() Dimension

func (Dimension) ToValue

func (d Dimension) ToValue() Value

ToValue wraps `d` to a Value object.

type Dimensions

type Dimensions []Dimension

type DirectionType

type DirectionType struct {
	Corner string
	Angle  Fl
}

func (DirectionType) IsNone

func (v DirectionType) IsNone() bool

type Display

type Display [3]string

func (Display) Has

func (d Display) Has(v string) bool

Has returns `true` is v is one of the three elements.

type ElementStyle

type ElementStyle interface {
	StyleAccessor

	// Set is the generic method to set an arbitrary property.
	// Type accessors should be used when possible.
	Set(key PropKey, value CssProperty)

	// Get is the generic method to access an arbitrary property.
	// Type accessors should be used when possible.
	Get(key PropKey) CssProperty

	// Copy returns a deep copy of the style.
	Copy() ElementStyle

	ParentStyle() ElementStyle
	Variables() map[string]ValidatedProperty

	Specified() SpecifiedAttributes

	Cache() TextRatioCache
}

ElementStyle defines a common interface to access style properties. Implementations will typically compute the property on the fly and cache the result.

type Fl

type Fl = utils.Fl

type Float

type Float Fl

func Abs

func Abs(x Float) Float

func Floor

func Floor(x Float) Float

func Hypot

func Hypot(a, b Float) Float

func Max

func Max(x, y Float) Float

func Maxs

func Maxs(values ...Float) Float

func MaybeFloatToFloat added in v0.0.2

func MaybeFloatToFloat(mf MaybeFloat) Float

MaybeFloatToFloat is the same as MaybeFloat.V(), but handles nil values

func Min

func Min(x, y Float) Float

func Mins

func Mins(values ...Float) Float

func (Float) ToValue

func (f Float) ToValue() Value

func (Float) V

func (f Float) V() Float

type FloatString added in v0.0.3

type FloatString struct {
	String string
	Float  Fl
}

type GradientSize

type GradientSize struct {
	Keyword  string
	Explicit Point
}

func (GradientSize) IsExplicit

func (s GradientSize) IsExplicit() bool

func (GradientSize) IsNone

func (v GradientSize) IsNone() bool

type Image

type Image interface {
	// InnerContent
	CssProperty
	// contains filtered or unexported methods
}

Might be an existing image or a gradient

type Images

type Images []Image

func (Images) Repeat

func (bs Images) Repeat(n int) CssProperty

type InnerContent

type InnerContent interface {
	// contains filtered or unexported methods
}

guard for possible content properties

type Int

type Int int

type IntNamedString

type IntNamedString struct {
	NamedString
	Int int
}

func (IntNamedString) IsNone

func (v IntNamedString) IsNone() bool

type IntString

type IntString struct {
	String string
	Int    int
}

func (IntString) IsNone

func (v IntString) IsNone() bool

type IntStrings

type IntStrings []IntString

type Ints3

type Ints3 [3]int

func (Ints3) IsNone

func (v Ints3) IsNone() bool

type KnownProp added in v0.0.5

type KnownProp uint8

KnownProp efficiently encode a known CSS property

const (

	// the following properties are grouped by side,
	// in the [bottom, left, right, top] order,
	// so that, if side in an index (0, 1, 2 or 3),
	// the property is a PBorderBottomColor + side * 5
	// DO NOT CHANGE the order, because
	PBorderBottomColor KnownProp
	PBorderBottomStyle
	PBorderBottomWidth
	PMarginBottom
	PPaddingBottom

	PBorderLeftColor
	PBorderLeftStyle
	PBorderLeftWidth
	PMarginLeft
	PPaddingLeft

	PBorderRightColor
	PBorderRightStyle
	PBorderRightWidth
	PMarginRight
	PPaddingRight

	PBorderTopColor
	PBorderTopStyle
	PBorderTopWidth
	PMarginTop
	PPaddingTop

	// min-XXX is at +2, max-XXX is a + 4
	PWidth
	PHeight
	PMinWidth
	PMinHeight
	PMaxWidth
	PMaxHeight

	PColor
	PDirection
	PDisplay
	PFloat
	PLineHeight

	PPosition
	PTableLayout
	PTop
	PUnicodeBidi
	PVerticalAlign
	PVisibility
	PZIndex

	PBorderBottomLeftRadius
	PBorderBottomRightRadius
	PBorderTopLeftRadius
	PBorderTopRightRadius

	POpacity

	PColumnRuleStyle
	PColumnRuleWidth
	PColumnCount
	PColumnWidth

	PFontFamily
	PFontFeatureSettings
	PFontKerning
	PFontLanguageOverride
	PFontSize
	PFontStretch
	PFontStyle
	PFontVariantAlternates
	PFontVariantCaps
	PFontVariantEastAsian
	PFontVariantLigatures
	PFontVariantNumeric
	PFontVariantPosition
	PFontWeight
	PFontVariationSettings

	PHyphenateCharacter
	PHyphenateLimitChars
	PHyphens
	PLetterSpacing
	PTextAlignAll
	PTextAlignLast
	PTextIndent
	PTextTransform
	PWhiteSpace
	PWordBreak
	PWordSpacing
	PTransform

	PContinue
	PMaxLines
	POverflow
	POverflowWrap
	PCounterIncrement
	PCounterReset
	PCounterSet

	PAnchor
	PLink
	PLang

	PBoxDecorationBreak

	PBookmarkLabel
	PBookmarkLevel
	PBookmarkState
	PContent

	PStringSet
	PImageOrientation

	PPage
	PAppearance
	POutlineColor
	POutlineStyle
	POutlineWidth
	PBoxSizing

	// The following properties are all background related,
	// in the order expected by expandBackground
	PBackgroundColor
	PBackgroundImage
	PBackgroundRepeat
	PBackgroundAttachment
	PBackgroundPosition
	PBackgroundSize
	PBackgroundClip
	PBackgroundOrigin

	// text-decoration-XXX
	PTextDecorationLine
	PTextDecorationColor
	PTextDecorationStyle

	PBreakAfter
	PBreakBefore
	PBreakInside

	PAlignContent
	PAlignItems
	PAlignSelf
	PFlexBasis
	PFlexDirection
	PFlexGrow
	PFlexShrink
	PFlexWrap
	PJustifyContent
	POrder

	PBottom
	PCaptionSide
	PClear
	PClip
	PEmptyCells
	PLeft
	PRight

	PListStyleImage
	PListStylePosition
	PListStyleType

	PTextOverflow
	PBlockEllipsis
	PBorderCollapse
	PBorderSpacing

	PTransformOrigin

	PFontVariant

	PTabSize

	PMarginBreak
	POrphans
	PWidows

	PFootnoteDisplay
	PFootnotePolicy
	PQuotes

	PImageResolution
	PImageRendering

	PColumnGap
	PColumnFill
	PColumnSpan
	PColumnRuleColor

	PSize
	PBleedLeft
	PBleedRight
	PBleedTop
	PBleedBottom
	PMarks

	PObjectFit
	PObjectPosition

	PHyphenateLimitZone

	NbProperties
)

func (KnownProp) IsTextDecoration added in v0.0.5

func (pr KnownProp) IsTextDecoration() bool

func (KnownProp) Key added in v0.0.5

func (p KnownProp) Key() PropKey

func (KnownProp) String added in v0.0.5

func (p KnownProp) String() string

type LinearGradient

type LinearGradient struct {
	ColorStops ColorsStops
	Direction  DirectionType
	Repeating  bool
}

func (LinearGradient) IsNone

func (v LinearGradient) IsNone() bool

type Marks

type Marks struct {
	Crop  bool
	Cross bool
}

func (Marks) IsNone

func (v Marks) IsNone() bool

type MaybeBool

type MaybeBool interface {
	// contains filtered or unexported methods
}

MaybeBool stores a tree state boolean : true, false or nil

type MaybeFloat

type MaybeFloat interface {
	V() Float
}

func ResoudPercentage

func ResoudPercentage(value Value, referTo Float) MaybeFloat

Return the percentage of the reference value, or the value unchanged. “referTo“ is the length for 100%. If “referTo“ is not a number, it just replaces percentages.

type NamedProperties

type NamedProperties []NamedProperty

type NamedProperty

type NamedProperty struct {
	Name     PropKey
	Property ValidatedProperty
}

func (NamedProperty) IsNone

func (v NamedProperty) IsNone() bool

type NamedString

type NamedString struct {
	Name   string
	String string
}

func (NamedString) IsNone

func (v NamedString) IsNone() bool

type NoneImage

type NoneImage struct{}

type OptionalRanges

type OptionalRanges struct {
	Ranges [][2]int
	Auto   bool
}

OptionalRanges is either 'auto' or a slice of ranges.

func (OptionalRanges) IsNone

func (v OptionalRanges) IsNone() bool

type Page

type Page struct {
	String string
	Valid  bool
	Page   int
}

func (Page) IsNone

func (v Page) IsNone() bool

type Point

type Point [2]Dimension

func (Point) IsNone

func (v Point) IsNone() bool

func (Point) ToPixels

func (p Point) ToPixels() Point

func (Point) ToSlice

func (p Point) ToSlice() []Dimension

type PropKey added in v0.0.5

type PropKey struct {
	KnownProp
	Var string // with leading --
}

PropKey stores a CSS property name, supporting variables.

func (PropKey) String added in v0.0.5

func (pr PropKey) String() string

type Properties

type Properties map[KnownProp]CssProperty

Properties is the general container for validated, cascaded and computed properties. In addition to the generic acces, an attempt to provide a "type safe" way is provided through the GetXXX and SetXXX methods. It relies on the convention than all the keys should be present, and values never be nil. "None" values are then encoded by the zero value of the concrete type.

func (Properties) Copy

func (p Properties) Copy() Properties

Copy return a shallow copy.

func (Properties) GetAlignContent

func (s Properties) GetAlignContent() String

func (Properties) GetAlignItems

func (s Properties) GetAlignItems() String

func (Properties) GetAlignSelf

func (s Properties) GetAlignSelf() String

func (Properties) GetAnchor

func (s Properties) GetAnchor() String

func (Properties) GetAppearance added in v0.0.3

func (s Properties) GetAppearance() String

func (Properties) GetBackgroundAttachment

func (s Properties) GetBackgroundAttachment() Strings

func (Properties) GetBackgroundClip

func (s Properties) GetBackgroundClip() Strings

func (Properties) GetBackgroundColor

func (s Properties) GetBackgroundColor() Color

func (Properties) GetBackgroundImage

func (s Properties) GetBackgroundImage() Images

func (Properties) GetBackgroundOrigin

func (s Properties) GetBackgroundOrigin() Strings

func (Properties) GetBackgroundPosition

func (s Properties) GetBackgroundPosition() Centers

func (Properties) GetBackgroundRepeat

func (s Properties) GetBackgroundRepeat() Repeats

func (Properties) GetBackgroundSize

func (s Properties) GetBackgroundSize() Sizes

func (Properties) GetBleedBottom

func (s Properties) GetBleedBottom() Value

func (Properties) GetBleedLeft

func (s Properties) GetBleedLeft() Value

func (Properties) GetBleedRight

func (s Properties) GetBleedRight() Value

func (Properties) GetBleedTop

func (s Properties) GetBleedTop() Value

func (Properties) GetBlockEllipsis

func (s Properties) GetBlockEllipsis() TaggedString

func (Properties) GetBookmarkLabel

func (s Properties) GetBookmarkLabel() ContentProperties

func (Properties) GetBookmarkLevel

func (s Properties) GetBookmarkLevel() IntString

func (Properties) GetBookmarkState

func (s Properties) GetBookmarkState() String

func (Properties) GetBorderBottomColor

func (s Properties) GetBorderBottomColor() Color

func (Properties) GetBorderBottomLeftRadius

func (s Properties) GetBorderBottomLeftRadius() Point

func (Properties) GetBorderBottomRightRadius

func (s Properties) GetBorderBottomRightRadius() Point

func (Properties) GetBorderBottomStyle

func (s Properties) GetBorderBottomStyle() String

func (Properties) GetBorderBottomWidth

func (s Properties) GetBorderBottomWidth() Value

func (Properties) GetBorderCollapse

func (s Properties) GetBorderCollapse() String

func (Properties) GetBorderLeftColor

func (s Properties) GetBorderLeftColor() Color

func (Properties) GetBorderLeftStyle

func (s Properties) GetBorderLeftStyle() String

func (Properties) GetBorderLeftWidth

func (s Properties) GetBorderLeftWidth() Value

func (Properties) GetBorderRightColor

func (s Properties) GetBorderRightColor() Color

func (Properties) GetBorderRightStyle

func (s Properties) GetBorderRightStyle() String

func (Properties) GetBorderRightWidth

func (s Properties) GetBorderRightWidth() Value

func (Properties) GetBorderSpacing

func (s Properties) GetBorderSpacing() Point

func (Properties) GetBorderTopColor

func (s Properties) GetBorderTopColor() Color

func (Properties) GetBorderTopLeftRadius

func (s Properties) GetBorderTopLeftRadius() Point

func (Properties) GetBorderTopRightRadius

func (s Properties) GetBorderTopRightRadius() Point

func (Properties) GetBorderTopStyle

func (s Properties) GetBorderTopStyle() String

func (Properties) GetBorderTopWidth

func (s Properties) GetBorderTopWidth() Value

func (Properties) GetBottom

func (s Properties) GetBottom() Value

func (Properties) GetBoxDecorationBreak

func (s Properties) GetBoxDecorationBreak() String

func (Properties) GetBoxSizing

func (s Properties) GetBoxSizing() String

func (Properties) GetBreakAfter

func (s Properties) GetBreakAfter() String

func (Properties) GetBreakBefore

func (s Properties) GetBreakBefore() String

func (Properties) GetBreakInside

func (s Properties) GetBreakInside() String

func (Properties) GetCaptionSide

func (s Properties) GetCaptionSide() String

func (Properties) GetClear

func (s Properties) GetClear() String

func (Properties) GetClip

func (s Properties) GetClip() Values

func (Properties) GetColor

func (s Properties) GetColor() Color

func (Properties) GetColumnCount

func (s Properties) GetColumnCount() IntString

func (Properties) GetColumnFill

func (s Properties) GetColumnFill() String

func (Properties) GetColumnGap

func (s Properties) GetColumnGap() Value

func (Properties) GetColumnRuleColor

func (s Properties) GetColumnRuleColor() Color

func (Properties) GetColumnRuleStyle

func (s Properties) GetColumnRuleStyle() String

func (Properties) GetColumnRuleWidth

func (s Properties) GetColumnRuleWidth() Value

func (Properties) GetColumnSpan

func (s Properties) GetColumnSpan() String

func (Properties) GetColumnWidth

func (s Properties) GetColumnWidth() Value

func (Properties) GetContent

func (s Properties) GetContent() SContent

func (Properties) GetContinue

func (s Properties) GetContinue() String

func (Properties) GetCounterIncrement

func (s Properties) GetCounterIncrement() SIntStrings

func (Properties) GetCounterReset

func (s Properties) GetCounterReset() SIntStrings

func (Properties) GetCounterSet

func (s Properties) GetCounterSet() SIntStrings

func (Properties) GetDirection

func (s Properties) GetDirection() String

func (Properties) GetDisplay

func (s Properties) GetDisplay() Display

func (Properties) GetEmptyCells

func (s Properties) GetEmptyCells() String

func (Properties) GetFlexBasis

func (s Properties) GetFlexBasis() Value

func (Properties) GetFlexDirection

func (s Properties) GetFlexDirection() String

func (Properties) GetFlexGrow

func (s Properties) GetFlexGrow() Float

func (Properties) GetFlexShrink

func (s Properties) GetFlexShrink() Float

func (Properties) GetFlexWrap

func (s Properties) GetFlexWrap() String

func (Properties) GetFloat

func (s Properties) GetFloat() String

func (Properties) GetFontFamily

func (s Properties) GetFontFamily() Strings

func (Properties) GetFontFeatureSettings

func (s Properties) GetFontFeatureSettings() SIntStrings

func (Properties) GetFontKerning

func (s Properties) GetFontKerning() String

func (Properties) GetFontLanguageOverride

func (s Properties) GetFontLanguageOverride() String

func (Properties) GetFontSize

func (s Properties) GetFontSize() Value

func (Properties) GetFontStretch

func (s Properties) GetFontStretch() String

func (Properties) GetFontStyle

func (s Properties) GetFontStyle() String

func (Properties) GetFontVariant

func (s Properties) GetFontVariant() String

func (Properties) GetFontVariantAlternates

func (s Properties) GetFontVariantAlternates() String

func (Properties) GetFontVariantCaps

func (s Properties) GetFontVariantCaps() String

func (Properties) GetFontVariantEastAsian

func (s Properties) GetFontVariantEastAsian() SStrings

func (Properties) GetFontVariantLigatures

func (s Properties) GetFontVariantLigatures() SStrings

func (Properties) GetFontVariantNumeric

func (s Properties) GetFontVariantNumeric() SStrings

func (Properties) GetFontVariantPosition

func (s Properties) GetFontVariantPosition() String

func (Properties) GetFontVariationSettings added in v0.0.3

func (s Properties) GetFontVariationSettings() SFloatStrings

func (Properties) GetFontWeight

func (s Properties) GetFontWeight() IntString

func (Properties) GetFootnoteDisplay added in v0.0.2

func (s Properties) GetFootnoteDisplay() String

func (Properties) GetFootnotePolicy added in v0.0.2

func (s Properties) GetFootnotePolicy() String

func (Properties) GetHeight

func (s Properties) GetHeight() Value

func (Properties) GetHyphenateCharacter

func (s Properties) GetHyphenateCharacter() String

func (Properties) GetHyphenateLimitChars

func (s Properties) GetHyphenateLimitChars() Ints3

func (Properties) GetHyphenateLimitZone

func (s Properties) GetHyphenateLimitZone() Value

func (Properties) GetHyphens

func (s Properties) GetHyphens() String

func (Properties) GetImageOrientation added in v0.0.3

func (s Properties) GetImageOrientation() SBoolFloat

func (Properties) GetImageRendering

func (s Properties) GetImageRendering() String

func (Properties) GetImageResolution

func (s Properties) GetImageResolution() Value

func (Properties) GetJustifyContent

func (s Properties) GetJustifyContent() String

func (Properties) GetLang

func (s Properties) GetLang() NamedString

func (Properties) GetLeft

func (s Properties) GetLeft() Value

func (Properties) GetLetterSpacing

func (s Properties) GetLetterSpacing() Value

func (Properties) GetLineHeight

func (s Properties) GetLineHeight() Value
func (s Properties) GetLink() NamedString

func (Properties) GetListStyleImage

func (s Properties) GetListStyleImage() Image

func (Properties) GetListStylePosition

func (s Properties) GetListStylePosition() String

func (Properties) GetListStyleType

func (s Properties) GetListStyleType() CounterStyleID

func (Properties) GetMarginBottom

func (s Properties) GetMarginBottom() Value

func (Properties) GetMarginBreak

func (s Properties) GetMarginBreak() String

func (Properties) GetMarginLeft

func (s Properties) GetMarginLeft() Value

func (Properties) GetMarginRight

func (s Properties) GetMarginRight() Value

func (Properties) GetMarginTop

func (s Properties) GetMarginTop() Value

func (Properties) GetMarks

func (s Properties) GetMarks() Marks

func (Properties) GetMaxHeight

func (s Properties) GetMaxHeight() Value

func (Properties) GetMaxLines

func (s Properties) GetMaxLines() TaggedInt

func (Properties) GetMaxWidth

func (s Properties) GetMaxWidth() Value

func (Properties) GetMinHeight

func (s Properties) GetMinHeight() Value

func (Properties) GetMinWidth

func (s Properties) GetMinWidth() Value

func (Properties) GetObjectFit

func (s Properties) GetObjectFit() String

func (Properties) GetObjectPosition

func (s Properties) GetObjectPosition() Center

func (Properties) GetOpacity

func (s Properties) GetOpacity() Float

func (Properties) GetOrder

func (s Properties) GetOrder() Int

func (Properties) GetOrphans

func (s Properties) GetOrphans() Int

func (Properties) GetOutlineColor

func (s Properties) GetOutlineColor() Color

func (Properties) GetOutlineStyle

func (s Properties) GetOutlineStyle() String

func (Properties) GetOutlineWidth

func (s Properties) GetOutlineWidth() Value

func (Properties) GetOverflow

func (s Properties) GetOverflow() String

func (Properties) GetOverflowWrap

func (s Properties) GetOverflowWrap() String

func (Properties) GetPaddingBottom

func (s Properties) GetPaddingBottom() Value

func (Properties) GetPaddingLeft

func (s Properties) GetPaddingLeft() Value

func (Properties) GetPaddingRight

func (s Properties) GetPaddingRight() Value

func (Properties) GetPaddingTop

func (s Properties) GetPaddingTop() Value

func (Properties) GetPage

func (s Properties) GetPage() Page

func (Properties) GetPosition

func (s Properties) GetPosition() BoolString

func (Properties) GetQuotes

func (s Properties) GetQuotes() Quotes

func (Properties) GetRight

func (s Properties) GetRight() Value

func (Properties) GetSize

func (s Properties) GetSize() Point

func (Properties) GetStringSet

func (s Properties) GetStringSet() StringSet

func (Properties) GetTabSize

func (s Properties) GetTabSize() Value

func (Properties) GetTableLayout

func (s Properties) GetTableLayout() String

func (Properties) GetTextAlignAll

func (s Properties) GetTextAlignAll() String

func (Properties) GetTextAlignLast

func (s Properties) GetTextAlignLast() String

func (Properties) GetTextDecorationColor

func (s Properties) GetTextDecorationColor() Color

func (Properties) GetTextDecorationLine

func (s Properties) GetTextDecorationLine() Decorations

func (Properties) GetTextDecorationStyle

func (s Properties) GetTextDecorationStyle() String

func (Properties) GetTextIndent

func (s Properties) GetTextIndent() Value

func (Properties) GetTextOverflow

func (s Properties) GetTextOverflow() String

func (Properties) GetTextTransform

func (s Properties) GetTextTransform() String

func (Properties) GetTop

func (s Properties) GetTop() Value

func (Properties) GetTransform

func (s Properties) GetTransform() Transforms

func (Properties) GetTransformOrigin

func (s Properties) GetTransformOrigin() Point

func (Properties) GetUnicodeBidi

func (s Properties) GetUnicodeBidi() String

func (Properties) GetVerticalAlign

func (s Properties) GetVerticalAlign() Value

func (Properties) GetVisibility

func (s Properties) GetVisibility() String

func (Properties) GetWhiteSpace

func (s Properties) GetWhiteSpace() String

func (Properties) GetWidows

func (s Properties) GetWidows() Int

func (Properties) GetWidth

func (s Properties) GetWidth() Value

func (Properties) GetWordBreak added in v0.0.2

func (s Properties) GetWordBreak() String

func (Properties) GetWordSpacing

func (s Properties) GetWordSpacing() Value

func (Properties) GetZIndex

func (s Properties) GetZIndex() IntString

func (Properties) SetAlignContent

func (s Properties) SetAlignContent(v String)

func (Properties) SetAlignItems

func (s Properties) SetAlignItems(v String)

func (Properties) SetAlignSelf

func (s Properties) SetAlignSelf(v String)

func (Properties) SetAnchor

func (s Properties) SetAnchor(v String)

func (Properties) SetAppearance added in v0.0.3

func (s Properties) SetAppearance(v String)

func (Properties) SetBackgroundAttachment

func (s Properties) SetBackgroundAttachment(v Strings)

func (Properties) SetBackgroundClip

func (s Properties) SetBackgroundClip(v Strings)

func (Properties) SetBackgroundColor

func (s Properties) SetBackgroundColor(v Color)

func (Properties) SetBackgroundImage

func (s Properties) SetBackgroundImage(v Images)

func (Properties) SetBackgroundOrigin

func (s Properties) SetBackgroundOrigin(v Strings)

func (Properties) SetBackgroundPosition

func (s Properties) SetBackgroundPosition(v Centers)

func (Properties) SetBackgroundRepeat

func (s Properties) SetBackgroundRepeat(v Repeats)

func (Properties) SetBackgroundSize

func (s Properties) SetBackgroundSize(v Sizes)

func (Properties) SetBleedBottom

func (s Properties) SetBleedBottom(v Value)

func (Properties) SetBleedLeft

func (s Properties) SetBleedLeft(v Value)

func (Properties) SetBleedRight

func (s Properties) SetBleedRight(v Value)

func (Properties) SetBleedTop

func (s Properties) SetBleedTop(v Value)

func (Properties) SetBlockEllipsis

func (s Properties) SetBlockEllipsis(v TaggedString)

func (Properties) SetBookmarkLabel

func (s Properties) SetBookmarkLabel(v ContentProperties)

func (Properties) SetBookmarkLevel

func (s Properties) SetBookmarkLevel(v IntString)

func (Properties) SetBookmarkState

func (s Properties) SetBookmarkState(v String)

func (Properties) SetBorderBottomColor

func (s Properties) SetBorderBottomColor(v Color)

func (Properties) SetBorderBottomLeftRadius

func (s Properties) SetBorderBottomLeftRadius(v Point)

func (Properties) SetBorderBottomRightRadius

func (s Properties) SetBorderBottomRightRadius(v Point)

func (Properties) SetBorderBottomStyle

func (s Properties) SetBorderBottomStyle(v String)

func (Properties) SetBorderBottomWidth

func (s Properties) SetBorderBottomWidth(v Value)

func (Properties) SetBorderCollapse

func (s Properties) SetBorderCollapse(v String)

func (Properties) SetBorderLeftColor

func (s Properties) SetBorderLeftColor(v Color)

func (Properties) SetBorderLeftStyle

func (s Properties) SetBorderLeftStyle(v String)

func (Properties) SetBorderLeftWidth

func (s Properties) SetBorderLeftWidth(v Value)

func (Properties) SetBorderRightColor

func (s Properties) SetBorderRightColor(v Color)

func (Properties) SetBorderRightStyle

func (s Properties) SetBorderRightStyle(v String)

func (Properties) SetBorderRightWidth

func (s Properties) SetBorderRightWidth(v Value)

func (Properties) SetBorderSpacing

func (s Properties) SetBorderSpacing(v Point)

func (Properties) SetBorderTopColor

func (s Properties) SetBorderTopColor(v Color)

func (Properties) SetBorderTopLeftRadius

func (s Properties) SetBorderTopLeftRadius(v Point)

func (Properties) SetBorderTopRightRadius

func (s Properties) SetBorderTopRightRadius(v Point)

func (Properties) SetBorderTopStyle

func (s Properties) SetBorderTopStyle(v String)

func (Properties) SetBorderTopWidth

func (s Properties) SetBorderTopWidth(v Value)

func (Properties) SetBottom

func (s Properties) SetBottom(v Value)

func (Properties) SetBoxDecorationBreak

func (s Properties) SetBoxDecorationBreak(v String)

func (Properties) SetBoxSizing

func (s Properties) SetBoxSizing(v String)

func (Properties) SetBreakAfter

func (s Properties) SetBreakAfter(v String)

func (Properties) SetBreakBefore

func (s Properties) SetBreakBefore(v String)

func (Properties) SetBreakInside

func (s Properties) SetBreakInside(v String)

func (Properties) SetCaptionSide

func (s Properties) SetCaptionSide(v String)

func (Properties) SetClear

func (s Properties) SetClear(v String)

func (Properties) SetClip

func (s Properties) SetClip(v Values)

func (Properties) SetColor

func (s Properties) SetColor(v Color)

func (Properties) SetColumnCount

func (s Properties) SetColumnCount(v IntString)

func (Properties) SetColumnFill

func (s Properties) SetColumnFill(v String)

func (Properties) SetColumnGap

func (s Properties) SetColumnGap(v Value)

func (Properties) SetColumnRuleColor

func (s Properties) SetColumnRuleColor(v Color)

func (Properties) SetColumnRuleStyle

func (s Properties) SetColumnRuleStyle(v String)

func (Properties) SetColumnRuleWidth

func (s Properties) SetColumnRuleWidth(v Value)

func (Properties) SetColumnSpan

func (s Properties) SetColumnSpan(v String)

func (Properties) SetColumnWidth

func (s Properties) SetColumnWidth(v Value)

func (Properties) SetContent

func (s Properties) SetContent(v SContent)

func (Properties) SetContinue

func (s Properties) SetContinue(v String)

func (Properties) SetCounterIncrement

func (s Properties) SetCounterIncrement(v SIntStrings)

func (Properties) SetCounterReset

func (s Properties) SetCounterReset(v SIntStrings)

func (Properties) SetCounterSet

func (s Properties) SetCounterSet(v SIntStrings)

func (Properties) SetDirection

func (s Properties) SetDirection(v String)

func (Properties) SetDisplay

func (s Properties) SetDisplay(v Display)

func (Properties) SetEmptyCells

func (s Properties) SetEmptyCells(v String)

func (Properties) SetFlexBasis

func (s Properties) SetFlexBasis(v Value)

func (Properties) SetFlexDirection

func (s Properties) SetFlexDirection(v String)

func (Properties) SetFlexGrow

func (s Properties) SetFlexGrow(v Float)

func (Properties) SetFlexShrink

func (s Properties) SetFlexShrink(v Float)

func (Properties) SetFlexWrap

func (s Properties) SetFlexWrap(v String)

func (Properties) SetFloat

func (s Properties) SetFloat(v String)

func (Properties) SetFontFamily

func (s Properties) SetFontFamily(v Strings)

func (Properties) SetFontFeatureSettings

func (s Properties) SetFontFeatureSettings(v SIntStrings)

func (Properties) SetFontKerning

func (s Properties) SetFontKerning(v String)

func (Properties) SetFontLanguageOverride

func (s Properties) SetFontLanguageOverride(v String)

func (Properties) SetFontSize

func (s Properties) SetFontSize(v Value)

func (Properties) SetFontStretch

func (s Properties) SetFontStretch(v String)

func (Properties) SetFontStyle

func (s Properties) SetFontStyle(v String)

func (Properties) SetFontVariant

func (s Properties) SetFontVariant(v String)

func (Properties) SetFontVariantAlternates

func (s Properties) SetFontVariantAlternates(v String)

func (Properties) SetFontVariantCaps

func (s Properties) SetFontVariantCaps(v String)

func (Properties) SetFontVariantEastAsian

func (s Properties) SetFontVariantEastAsian(v SStrings)

func (Properties) SetFontVariantLigatures

func (s Properties) SetFontVariantLigatures(v SStrings)

func (Properties) SetFontVariantNumeric

func (s Properties) SetFontVariantNumeric(v SStrings)

func (Properties) SetFontVariantPosition

func (s Properties) SetFontVariantPosition(v String)

func (Properties) SetFontVariationSettings added in v0.0.3

func (s Properties) SetFontVariationSettings(v SFloatStrings)

func (Properties) SetFontWeight

func (s Properties) SetFontWeight(v IntString)

func (Properties) SetFootnoteDisplay added in v0.0.2

func (s Properties) SetFootnoteDisplay(v String)

func (Properties) SetFootnotePolicy added in v0.0.2

func (s Properties) SetFootnotePolicy(v String)

func (Properties) SetHeight

func (s Properties) SetHeight(v Value)

func (Properties) SetHyphenateCharacter

func (s Properties) SetHyphenateCharacter(v String)

func (Properties) SetHyphenateLimitChars

func (s Properties) SetHyphenateLimitChars(v Ints3)

func (Properties) SetHyphenateLimitZone

func (s Properties) SetHyphenateLimitZone(v Value)

func (Properties) SetHyphens

func (s Properties) SetHyphens(v String)

func (Properties) SetImageOrientation added in v0.0.3

func (s Properties) SetImageOrientation(v SBoolFloat)

func (Properties) SetImageRendering

func (s Properties) SetImageRendering(v String)

func (Properties) SetImageResolution

func (s Properties) SetImageResolution(v Value)

func (Properties) SetJustifyContent

func (s Properties) SetJustifyContent(v String)

func (Properties) SetLang

func (s Properties) SetLang(v NamedString)

func (Properties) SetLeft

func (s Properties) SetLeft(v Value)

func (Properties) SetLetterSpacing

func (s Properties) SetLetterSpacing(v Value)

func (Properties) SetLineHeight

func (s Properties) SetLineHeight(v Value)
func (s Properties) SetLink(v NamedString)

func (Properties) SetListStyleImage

func (s Properties) SetListStyleImage(v Image)

func (Properties) SetListStylePosition

func (s Properties) SetListStylePosition(v String)

func (Properties) SetListStyleType

func (s Properties) SetListStyleType(v CounterStyleID)

func (Properties) SetMarginBottom

func (s Properties) SetMarginBottom(v Value)

func (Properties) SetMarginBreak

func (s Properties) SetMarginBreak(v String)

func (Properties) SetMarginLeft

func (s Properties) SetMarginLeft(v Value)

func (Properties) SetMarginRight

func (s Properties) SetMarginRight(v Value)

func (Properties) SetMarginTop

func (s Properties) SetMarginTop(v Value)

func (Properties) SetMarks

func (s Properties) SetMarks(v Marks)

func (Properties) SetMaxHeight

func (s Properties) SetMaxHeight(v Value)

func (Properties) SetMaxLines

func (s Properties) SetMaxLines(v TaggedInt)

func (Properties) SetMaxWidth

func (s Properties) SetMaxWidth(v Value)

func (Properties) SetMinHeight

func (s Properties) SetMinHeight(v Value)

func (Properties) SetMinWidth

func (s Properties) SetMinWidth(v Value)

func (Properties) SetObjectFit

func (s Properties) SetObjectFit(v String)

func (Properties) SetObjectPosition

func (s Properties) SetObjectPosition(v Center)

func (Properties) SetOpacity

func (s Properties) SetOpacity(v Float)

func (Properties) SetOrder

func (s Properties) SetOrder(v Int)

func (Properties) SetOrphans

func (s Properties) SetOrphans(v Int)

func (Properties) SetOutlineColor

func (s Properties) SetOutlineColor(v Color)

func (Properties) SetOutlineStyle

func (s Properties) SetOutlineStyle(v String)

func (Properties) SetOutlineWidth

func (s Properties) SetOutlineWidth(v Value)

func (Properties) SetOverflow

func (s Properties) SetOverflow(v String)

func (Properties) SetOverflowWrap

func (s Properties) SetOverflowWrap(v String)

func (Properties) SetPaddingBottom

func (s Properties) SetPaddingBottom(v Value)

func (Properties) SetPaddingLeft

func (s Properties) SetPaddingLeft(v Value)

func (Properties) SetPaddingRight

func (s Properties) SetPaddingRight(v Value)

func (Properties) SetPaddingTop

func (s Properties) SetPaddingTop(v Value)

func (Properties) SetPage

func (s Properties) SetPage(v Page)

func (Properties) SetPosition

func (s Properties) SetPosition(v BoolString)

func (Properties) SetQuotes

func (s Properties) SetQuotes(v Quotes)

func (Properties) SetRight

func (s Properties) SetRight(v Value)

func (Properties) SetSize

func (s Properties) SetSize(v Point)

func (Properties) SetStringSet

func (s Properties) SetStringSet(v StringSet)

func (Properties) SetTabSize

func (s Properties) SetTabSize(v Value)

func (Properties) SetTableLayout

func (s Properties) SetTableLayout(v String)

func (Properties) SetTextAlignAll

func (s Properties) SetTextAlignAll(v String)

func (Properties) SetTextAlignLast

func (s Properties) SetTextAlignLast(v String)

func (Properties) SetTextDecorationColor

func (s Properties) SetTextDecorationColor(v Color)

func (Properties) SetTextDecorationLine

func (s Properties) SetTextDecorationLine(v Decorations)

func (Properties) SetTextDecorationStyle

func (s Properties) SetTextDecorationStyle(v String)

func (Properties) SetTextIndent

func (s Properties) SetTextIndent(v Value)

func (Properties) SetTextOverflow

func (s Properties) SetTextOverflow(v String)

func (Properties) SetTextTransform

func (s Properties) SetTextTransform(v String)

func (Properties) SetTop

func (s Properties) SetTop(v Value)

func (Properties) SetTransform

func (s Properties) SetTransform(v Transforms)

func (Properties) SetTransformOrigin

func (s Properties) SetTransformOrigin(v Point)

func (Properties) SetUnicodeBidi

func (s Properties) SetUnicodeBidi(v String)

func (Properties) SetVerticalAlign

func (s Properties) SetVerticalAlign(v Value)

func (Properties) SetVisibility

func (s Properties) SetVisibility(v String)

func (Properties) SetWhiteSpace

func (s Properties) SetWhiteSpace(v String)

func (Properties) SetWidows

func (s Properties) SetWidows(v Int)

func (Properties) SetWidth

func (s Properties) SetWidth(v Value)

func (Properties) SetWordBreak added in v0.0.2

func (s Properties) SetWordBreak(v String)

func (Properties) SetWordSpacing

func (s Properties) SetWordSpacing(v Value)

func (Properties) SetZIndex

func (s Properties) SetZIndex(v IntString)

func (Properties) UpdateWith

func (p Properties) UpdateWith(other Properties)

UpdateWith merge the entries from `other` to `p`.

type Quote

type Quote struct {
	Open   bool
	Insert bool
}

func (Quote) IsNone

func (v Quote) IsNone() bool

type Quotes

type Quotes struct {
	Open  Strings
	Close Strings
}

func (Quotes) IsNone

func (v Quotes) IsNone() bool

type RadialGradient

type RadialGradient struct {
	ColorStops ColorsStops
	Shape      string
	Size       GradientSize
	Center     Center
	Repeating  bool
}

func (RadialGradient) IsNone

func (v RadialGradient) IsNone() bool

type RawTokens

type RawTokens []parser.Token

---------------------- helpers types -----------------------------------

type Rectangle

type Rectangle [4]Float

func (Rectangle) IsNone

func (r Rectangle) IsNone() bool

func (Rectangle) ToFloat

func (r Rectangle) ToFloat() [4]Fl

func (Rectangle) Unpack

func (r Rectangle) Unpack() (x, y, w, h Fl)

func (Rectangle) Unpack2

func (r Rectangle) Unpack2() (x, y, w, h Float)

type Repeats

type Repeats [][2]string

func (Repeats) Repeat

func (bs Repeats) Repeat(n int) CssProperty

type SBoolFloat added in v0.0.3

type SBoolFloat struct {
	String string
	Bool   bool
	Float  Fl
}

type SContent

type SContent struct {
	String   string
	Contents ContentProperties
}

func (SContent) IsNone

func (v SContent) IsNone() bool

type SContentProp

type SContentProp struct {
	ContentProperty ContentProperty
	String          string
}

func (SContentProp) IsNone

func (v SContentProp) IsNone() bool

type SContentProps

type SContentProps []SContentProp

type SContents

type SContents []SContent

type SDimensions

type SDimensions struct {
	String     string
	Dimensions Dimensions
}

func (SDimensions) IsNone

func (v SDimensions) IsNone() bool

type SFloatStrings added in v0.0.3

type SFloatStrings struct {
	String string
	Values []FloatString
}

SFloatStrings is either a string or a list of (string, float) pairs

type SIntStrings

type SIntStrings struct {
	String string
	Values IntStrings
}

func (SIntStrings) IsNone

func (v SIntStrings) IsNone() bool

type SStrings

type SStrings struct {
	String  string
	Strings Strings
}

func (SStrings) IsNone

func (v SStrings) IsNone() bool

type SetK added in v0.0.5

type SetK map[KnownProp]struct{}

func NewSetK added in v0.0.5

func NewSetK(values ...KnownProp) SetK

func (SetK) Add added in v0.0.5

func (s SetK) Add(key KnownProp)

func (SetK) Copy added in v0.0.5

func (s SetK) Copy() SetK

Copy returns a deepcopy.

func (SetK) Equal added in v0.0.5

func (s SetK) Equal(other SetK) bool

func (SetK) Extend added in v0.0.5

func (s SetK) Extend(keys []KnownProp)

func (SetK) Has added in v0.0.5

func (s SetK) Has(key KnownProp) bool

func (SetK) IsNone added in v0.0.5

func (s SetK) IsNone() bool

type Size

type Size struct {
	String string
	Width  Value
	Height Value
}

Dimension or "auto" or "cover" or "contain"

func (Size) IsNone

func (v Size) IsNone() bool

type Sizes

type Sizes []Size

func (Sizes) Repeat

func (bs Sizes) Repeat(n int) CssProperty

type SpecifiedAttributes

type SpecifiedAttributes struct {
	Float    String
	Display  Display
	Position BoolString
}

SpecifiedAttributes stores the value of CSS properties as specified.

type String

type String string

type StringSet

type StringSet struct {
	String   string
	Contents SContents
}

func (StringSet) IsNone

func (v StringSet) IsNone() bool

type Strings

type Strings []string

func (Strings) Repeat

func (bs Strings) Repeat(n int) CssProperty

type StyleAccessor

type StyleAccessor interface {
	GetAlignContent() String
	SetAlignContent(v String)

	GetAlignItems() String
	SetAlignItems(v String)

	GetAlignSelf() String
	SetAlignSelf(v String)

	GetAnchor() String
	SetAnchor(v String)

	GetAppearance() String
	SetAppearance(v String)

	GetBackgroundAttachment() Strings
	SetBackgroundAttachment(v Strings)

	GetBackgroundClip() Strings
	SetBackgroundClip(v Strings)

	GetBackgroundColor() Color
	SetBackgroundColor(v Color)

	GetBackgroundImage() Images
	SetBackgroundImage(v Images)

	GetBackgroundOrigin() Strings
	SetBackgroundOrigin(v Strings)

	GetBackgroundPosition() Centers
	SetBackgroundPosition(v Centers)

	GetBackgroundRepeat() Repeats
	SetBackgroundRepeat(v Repeats)

	GetBackgroundSize() Sizes
	SetBackgroundSize(v Sizes)

	GetBleedBottom() Value
	SetBleedBottom(v Value)

	GetBleedLeft() Value
	SetBleedLeft(v Value)

	GetBleedRight() Value
	SetBleedRight(v Value)

	GetBleedTop() Value
	SetBleedTop(v Value)

	GetBlockEllipsis() TaggedString
	SetBlockEllipsis(v TaggedString)

	GetBookmarkLabel() ContentProperties
	SetBookmarkLabel(v ContentProperties)

	GetBookmarkLevel() IntString
	SetBookmarkLevel(v IntString)

	GetBookmarkState() String
	SetBookmarkState(v String)

	GetBorderBottomColor() Color
	SetBorderBottomColor(v Color)

	GetBorderBottomLeftRadius() Point
	SetBorderBottomLeftRadius(v Point)

	GetBorderBottomRightRadius() Point
	SetBorderBottomRightRadius(v Point)

	GetBorderBottomStyle() String
	SetBorderBottomStyle(v String)

	GetBorderBottomWidth() Value
	SetBorderBottomWidth(v Value)

	GetBorderCollapse() String
	SetBorderCollapse(v String)

	GetBorderLeftColor() Color
	SetBorderLeftColor(v Color)

	GetBorderLeftStyle() String
	SetBorderLeftStyle(v String)

	GetBorderLeftWidth() Value
	SetBorderLeftWidth(v Value)

	GetBorderRightColor() Color
	SetBorderRightColor(v Color)

	GetBorderRightStyle() String
	SetBorderRightStyle(v String)

	GetBorderRightWidth() Value
	SetBorderRightWidth(v Value)

	GetBorderSpacing() Point
	SetBorderSpacing(v Point)

	GetBorderTopColor() Color
	SetBorderTopColor(v Color)

	GetBorderTopLeftRadius() Point
	SetBorderTopLeftRadius(v Point)

	GetBorderTopRightRadius() Point
	SetBorderTopRightRadius(v Point)

	GetBorderTopStyle() String
	SetBorderTopStyle(v String)

	GetBorderTopWidth() Value
	SetBorderTopWidth(v Value)

	GetBottom() Value
	SetBottom(v Value)

	GetBoxDecorationBreak() String
	SetBoxDecorationBreak(v String)

	GetBoxSizing() String
	SetBoxSizing(v String)

	GetBreakAfter() String
	SetBreakAfter(v String)

	GetBreakBefore() String
	SetBreakBefore(v String)

	GetBreakInside() String
	SetBreakInside(v String)

	GetCaptionSide() String
	SetCaptionSide(v String)

	GetClear() String
	SetClear(v String)

	GetClip() Values
	SetClip(v Values)

	GetColor() Color
	SetColor(v Color)

	GetColumnCount() IntString
	SetColumnCount(v IntString)

	GetColumnFill() String
	SetColumnFill(v String)

	GetColumnGap() Value
	SetColumnGap(v Value)

	GetColumnRuleColor() Color
	SetColumnRuleColor(v Color)

	GetColumnRuleStyle() String
	SetColumnRuleStyle(v String)

	GetColumnRuleWidth() Value
	SetColumnRuleWidth(v Value)

	GetColumnSpan() String
	SetColumnSpan(v String)

	GetColumnWidth() Value
	SetColumnWidth(v Value)

	GetContent() SContent
	SetContent(v SContent)

	GetContinue() String
	SetContinue(v String)

	GetCounterIncrement() SIntStrings
	SetCounterIncrement(v SIntStrings)

	GetCounterReset() SIntStrings
	SetCounterReset(v SIntStrings)

	GetCounterSet() SIntStrings
	SetCounterSet(v SIntStrings)

	GetDirection() String
	SetDirection(v String)

	GetDisplay() Display
	SetDisplay(v Display)

	GetEmptyCells() String
	SetEmptyCells(v String)

	GetFlexBasis() Value
	SetFlexBasis(v Value)

	GetFlexDirection() String
	SetFlexDirection(v String)

	GetFlexGrow() Float
	SetFlexGrow(v Float)

	GetFlexShrink() Float
	SetFlexShrink(v Float)

	GetFlexWrap() String
	SetFlexWrap(v String)

	GetFloat() String
	SetFloat(v String)

	GetFontFamily() Strings
	SetFontFamily(v Strings)

	GetFontFeatureSettings() SIntStrings
	SetFontFeatureSettings(v SIntStrings)

	GetFontKerning() String
	SetFontKerning(v String)

	GetFontLanguageOverride() String
	SetFontLanguageOverride(v String)

	GetFontSize() Value
	SetFontSize(v Value)

	GetFontStretch() String
	SetFontStretch(v String)

	GetFontStyle() String
	SetFontStyle(v String)

	GetFontVariant() String
	SetFontVariant(v String)

	GetFontVariantAlternates() String
	SetFontVariantAlternates(v String)

	GetFontVariantCaps() String
	SetFontVariantCaps(v String)

	GetFontVariantEastAsian() SStrings
	SetFontVariantEastAsian(v SStrings)

	GetFontVariantLigatures() SStrings
	SetFontVariantLigatures(v SStrings)

	GetFontVariantNumeric() SStrings
	SetFontVariantNumeric(v SStrings)

	GetFontVariantPosition() String
	SetFontVariantPosition(v String)

	GetFontVariationSettings() SFloatStrings
	SetFontVariationSettings(v SFloatStrings)

	GetFontWeight() IntString
	SetFontWeight(v IntString)

	GetFootnoteDisplay() String
	SetFootnoteDisplay(v String)

	GetFootnotePolicy() String
	SetFootnotePolicy(v String)

	GetHeight() Value
	SetHeight(v Value)

	GetHyphenateCharacter() String
	SetHyphenateCharacter(v String)

	GetHyphenateLimitChars() Ints3
	SetHyphenateLimitChars(v Ints3)

	GetHyphenateLimitZone() Value
	SetHyphenateLimitZone(v Value)

	GetHyphens() String
	SetHyphens(v String)

	GetImageOrientation() SBoolFloat
	SetImageOrientation(v SBoolFloat)

	GetImageRendering() String
	SetImageRendering(v String)

	GetImageResolution() Value
	SetImageResolution(v Value)

	GetJustifyContent() String
	SetJustifyContent(v String)

	GetLang() NamedString
	SetLang(v NamedString)

	GetLeft() Value
	SetLeft(v Value)

	GetLetterSpacing() Value
	SetLetterSpacing(v Value)

	GetLineHeight() Value
	SetLineHeight(v Value)

	GetLink() NamedString
	SetLink(v NamedString)

	GetListStyleImage() Image
	SetListStyleImage(v Image)

	GetListStylePosition() String
	SetListStylePosition(v String)

	GetListStyleType() CounterStyleID
	SetListStyleType(v CounterStyleID)

	GetMarginBottom() Value
	SetMarginBottom(v Value)

	GetMarginBreak() String
	SetMarginBreak(v String)

	GetMarginLeft() Value
	SetMarginLeft(v Value)

	GetMarginRight() Value
	SetMarginRight(v Value)

	GetMarginTop() Value
	SetMarginTop(v Value)

	GetMarks() Marks
	SetMarks(v Marks)

	GetMaxHeight() Value
	SetMaxHeight(v Value)

	GetMaxLines() TaggedInt
	SetMaxLines(v TaggedInt)

	GetMaxWidth() Value
	SetMaxWidth(v Value)

	GetMinHeight() Value
	SetMinHeight(v Value)

	GetMinWidth() Value
	SetMinWidth(v Value)

	GetObjectFit() String
	SetObjectFit(v String)

	GetObjectPosition() Center
	SetObjectPosition(v Center)

	GetOpacity() Float
	SetOpacity(v Float)

	GetOrder() Int
	SetOrder(v Int)

	GetOrphans() Int
	SetOrphans(v Int)

	GetOutlineColor() Color
	SetOutlineColor(v Color)

	GetOutlineStyle() String
	SetOutlineStyle(v String)

	GetOutlineWidth() Value
	SetOutlineWidth(v Value)

	GetOverflow() String
	SetOverflow(v String)

	GetOverflowWrap() String
	SetOverflowWrap(v String)

	GetPaddingBottom() Value
	SetPaddingBottom(v Value)

	GetPaddingLeft() Value
	SetPaddingLeft(v Value)

	GetPaddingRight() Value
	SetPaddingRight(v Value)

	GetPaddingTop() Value
	SetPaddingTop(v Value)

	GetPage() Page
	SetPage(v Page)

	GetPosition() BoolString
	SetPosition(v BoolString)

	GetQuotes() Quotes
	SetQuotes(v Quotes)

	GetRight() Value
	SetRight(v Value)

	GetSize() Point
	SetSize(v Point)

	GetStringSet() StringSet
	SetStringSet(v StringSet)

	GetTabSize() Value
	SetTabSize(v Value)

	GetTableLayout() String
	SetTableLayout(v String)

	GetTextAlignAll() String
	SetTextAlignAll(v String)

	GetTextAlignLast() String
	SetTextAlignLast(v String)

	GetTextDecorationColor() Color
	SetTextDecorationColor(v Color)

	GetTextDecorationLine() Decorations
	SetTextDecorationLine(v Decorations)

	GetTextDecorationStyle() String
	SetTextDecorationStyle(v String)

	GetTextIndent() Value
	SetTextIndent(v Value)

	GetTextOverflow() String
	SetTextOverflow(v String)

	GetTextTransform() String
	SetTextTransform(v String)

	GetTop() Value
	SetTop(v Value)

	GetTransform() Transforms
	SetTransform(v Transforms)

	GetTransformOrigin() Point
	SetTransformOrigin(v Point)

	GetUnicodeBidi() String
	SetUnicodeBidi(v String)

	GetVerticalAlign() Value
	SetVerticalAlign(v Value)

	GetVisibility() String
	SetVisibility(v String)

	GetWhiteSpace() String
	SetWhiteSpace(v String)

	GetWidows() Int
	SetWidows(v Int)

	GetWidth() Value
	SetWidth(v Value)

	GetWordBreak() String
	SetWordBreak(v String)

	GetWordSpacing() Value
	SetWordSpacing(v Value)

	GetZIndex() IntString
	SetZIndex(v IntString)
}

type Tag added in v0.0.2

type Tag uint8

Tag is a flag indicating special values, such as "none" or "auto".

const (
	Auto Tag // "auto"
	None     // "none"
)

type TaggedInt added in v0.0.2

type TaggedInt struct {
	I   int
	Tag Tag
}

type TaggedString added in v0.0.2

type TaggedString struct {
	S   string
	Tag Tag
}

type TextRatioCache added in v0.0.3

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

TextRatioCache stores the 1ex/font_size or 1ch/font_size ratios, for each font.

func NewTextRatioCache added in v0.0.3

func NewTextRatioCache() TextRatioCache

func (TextRatioCache) Get added in v0.0.3

func (tr TextRatioCache) Get(fontKey string, isCh bool) (f Float, ok bool)

func (TextRatioCache) Set added in v0.0.3

func (tr TextRatioCache) Set(fontKey string, isCh bool, f Float)

type Transforms

type Transforms []SDimensions

type Unit

type Unit uint8
const (
	Scalar Unit = iota + 1 // means no unit, but a valid value
	Perc                   // percentage (%)
	Ex
	Em
	Ch
	Rem
	Px
	Pt
	Pc
	In
	Cm
	Mm
	Q

	Rad
	Turn
	Deg
	Grad
)

type UrlImage

type UrlImage string

type ValidatedProperty

type ValidatedProperty struct {
	SpecialProperty specialProperty
	// contains filtered or unexported fields
}

ValidatedProperty is the most general CSS input for a property. It covers the following cases:

  • a plain CSS value, including "initial" or "inherited" special cases (CssProperty)
  • a var() call (VarData)
  • an input not yet validated, used as definition of variable (RawTokens)

func AsValidated

func AsValidated(spe specialProperty) ValidatedProperty

func (ValidatedProperty) IsNone

func (c ValidatedProperty) IsNone() bool

func (ValidatedProperty) ToCascaded

func (c ValidatedProperty) ToCascaded() CascadedProperty

ToCascaded will panic if c.SpecialProperty is not nil.

type Value

type Value struct {
	String string
	Dimension
}

func FToPx

func FToPx(f Float) Value

FToPx returns `f` as pixels.

func FToV

func FToV(f Fl) Value

func MaybeFloatToValue

func MaybeFloatToValue(mf MaybeFloat) Value

func SToV

func SToV(s string) Value

func (Value) IsNone

func (v Value) IsNone() bool

func (Value) ToMaybeFloat

func (v Value) ToMaybeFloat() MaybeFloat

type Values

type Values []Value

type VarData

type VarData struct {
	Name    string // name of a custom property
	Default RawTokens
}

func (VarData) IsNone

func (v VarData) IsNone() bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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