gs

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2018 License: MIT Imports: 5 Imported by: 0

README

gs

under active development

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DomRegistry

func DomRegistry() func() SheetObject

DomRegistry returns a function that returns SheetObject that operate on real dome stylesheets.

func ToString

func ToString(rule CSSRule, ts ...Transformer) string

Types

type CSSRule

type CSSRule interface {
	//we don't want users to implement this.
	Print(io.Writer) (int64, error)
	String() string
	// contains filtered or unexported methods
}

func CSS

func CSS(rules ...CSSRule) CSSRule

CSS defines a list of style rules. Nil values will be removed.

func Cond

func Cond(cond string, rules ...CSSRule) CSSRule

func Flattern

func Flattern(rule CSSRule) CSSRule

func FontFace

func FontFace(rules ...CSSRule) CSSRule

func If

func If(cond bool, c CSSRule) CSSRule

func KeyFrame

func KeyFrame(name string, rules ...CSSRule) CSSRule

func P

func P(key, value string) CSSRule

func Process

func Process(rule CSSRule, ts ...Transformer) CSSRule

Process this applies any transformation to the rule. It automatically flatterns the rule tree.

func S

func S(selector string, rules ...CSSRule) CSSRule

type ClassMap

type ClassMap map[string]string

func (ClassMap) Classes

func (c ClassMap) Classes() map[string]bool

Classes to be compatible with vecty.ClassMap

type Conditional

type Conditional struct {
	Key   string
	Rules RuleList
}

func (Conditional) Print

func (c Conditional) Print(o io.Writer) (int64, error)

func (Conditional) String

func (c Conditional) String() string

type Options

type Options struct {
	NoPretty bool
}

type Registry

type Registry interface {
	NewSheet() *Sheet
	Attach(*Sheet)
	Detach(*Sheet)
	// contains filtered or unexported methods
}

type RuleList

type RuleList []CSSRule

RuleList is a list of css style rules.

func (RuleList) Print

func (r RuleList) Print(o io.Writer) (int64, error)

func (RuleList) String

func (r RuleList) String() string

type Sheet

type Sheet struct {
	CLasses ClassMap
	// contains filtered or unexported fields
}

func NewSheet

func NewSheet(idGen func() string) *Sheet

func (*Sheet) AddRule

func (s *Sheet) AddRule(rules CSSRule) ClassMap

AddRule processes the rules are returns mapping of original classnames to the generated classnames.

The resulting class map is merged with the existing classmap, so added classes can always be acced by s.Classes[className] field. The processed rules are stored in the stylesheet, note that this doesn't attach the sheet to the dom. You need to explicitly call Attach method to attach the styles to the dom.

func (*Sheet) Attach

func (s *Sheet) Attach()

func (*Sheet) Detach

func (s *Sheet) Detach()

func (*Sheet) ListRules

func (s *Sheet) ListRules() []string

type SheetObject

type SheetObject interface {
	InsertRule(rule string)
	Detach()
}

SheetObject is an interface for managing stylesheets.

type SimpleRegistry

type SimpleRegistry struct {
	CreateSheetNode func() SheetObject
	// contains filtered or unexported fields
}

SimpleRegistry implements Registry interface.

func NewSimpleRegistry

func NewSimpleRegistry(fn func() SheetObject) *SimpleRegistry

func (*SimpleRegistry) Attach

func (m *SimpleRegistry) Attach(s *Sheet)

func (*SimpleRegistry) Detach

func (m *SimpleRegistry) Detach(s *Sheet)

func (*SimpleRegistry) NewSheet

func (m *SimpleRegistry) NewSheet() *Sheet

type SimpleRule

type SimpleRule struct {
	Key   string
	Value string
}

func (SimpleRule) Print

func (s SimpleRule) Print(o io.Writer) (int64, error)

func (SimpleRule) String

func (s SimpleRule) String() string

type StyleRule

type StyleRule struct {
	Selector string
	Rules    RuleList
}

func (StyleRule) Print

func (s StyleRule) Print(o io.Writer) (int64, error)

func (StyleRule) String

func (s StyleRule) String() string

type Transformer

type Transformer func(CSSRule) CSSRule

Directories

Path Synopsis
ciu
cmd
ciu
Package data contains generated prefix data.
Package data contains generated prefix data.

Jump to

Keyboard shortcuts

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