stylis

package
v0.0.0-...-76d4100 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsNodesEmpty

func IsNodesEmpty(nodes []Node) bool

func ReplaceHolder

func ReplaceHolder(rule string, p string) string

func SplitRules

func SplitRules(s string) []string

func WalkRules

func WalkRules(rules []Node, parent string, each func(r Node))

Types

type AtRule

type AtRule struct {
	Name   string
	Params string
	Nodes  []Node
}

func (*AtRule) AppendNode

func (r *AtRule) AppendNode(n Node)

func (*AtRule) AtRule

func (r *AtRule) AtRule() string

func (*AtRule) FormatTo

func (r *AtRule) FormatTo(w io.Writer, opt *FormatOpt)

func (*AtRule) IsEmpty

func (r *AtRule) IsEmpty() bool

func (*AtRule) WithSelector

func (r *AtRule) WithSelector(parent string) (rules []Node)

type Declaration

type Declaration struct {
	Prop  string
	Value string
}

func (*Declaration) FormatTo

func (s *Declaration) FormatTo(w io.Writer, opt *FormatOpt)

func (*Declaration) IsEmpty

func (s *Declaration) IsEmpty() bool

func (*Declaration) IsVariable

func (s *Declaration) IsVariable() bool

type FormatOpt

type FormatOpt struct {
	Indent  string
	Depth   int
	OneLine bool
}

func (*FormatOpt) WriteIdent

func (opt *FormatOpt) WriteIdent(w io.Writer)

func (*FormatOpt) WriteLine

func (opt *FormatOpt) WriteLine(w io.Writer, s string)

type Node

type Node interface {
	IsEmpty() bool
	FormatTo(w io.Writer, opt *FormatOpt)
}

func Parse

func Parse(rule string) Node

func ParseBytes

func ParseBytes(rule []byte) Node

type NodeAppendable

type NodeAppendable interface {
	AppendNode(n Node)
}

type Root

type Root struct {
	Nodes []Node
}

func (*Root) AppendNode

func (r *Root) AppendNode(n Node)

func (*Root) FormatTo

func (r *Root) FormatTo(w io.Writer, opt *FormatOpt)

func (*Root) IsEmpty

func (r *Root) IsEmpty() bool

type Rule

type Rule struct {
	Selector string
	Nodes    []Node
}

func (*Rule) AppendNode

func (r *Rule) AppendNode(n Node)

func (*Rule) FormatTo

func (r *Rule) FormatTo(w io.Writer, opt *FormatOpt)

func (*Rule) IsEmpty

func (r *Rule) IsEmpty() bool

func (*Rule) WithSelector

func (r *Rule) WithSelector(parent string) (rules []Node)

type Tokenizer

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

func (*Tokenizer) Rules

func (t *Tokenizer) Rules(rule []byte) (rules []string)

func (*Tokenizer) Tokenize

func (t *Tokenizer) Tokenize(src []byte) (tokens []string)

type WithSelector

type WithSelector interface {
	WithSelector(parent string) []Node
}

Jump to

Keyboard shortcuts

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