dom

package
v0.0.0-...-6d3478e Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("Not found")

ErrNotFound returns when an item is not found.

Functions

func BoundingBox

func BoundingBox(elem dom.Element) (float64, float64, float64, float64)

BoundingBox returns the top,right,down,left corners of a dom.Element.

func ClientBox

func ClientBox() (float64, float64)

ClientBox returns the offset of the current page client box.

func Document

func Document() dom.Document

Document returns the current document attached to the window

func Expando

func Expando(prop string) []string

Expando expands a property period delimited string into its component parts.

func GetComputedStyle

func GetComputedStyle(elem dom.Element, ps string) (*dom.CSSStyleDeclaration, error)

GetComputedStyle returns the dom.Element computed css styles.

func GetComputedStylePriority

func GetComputedStylePriority(css *dom.CSSStyleDeclaration, prop string) (int, error)

GetComputedStylePriority retrieves the proritiy of the property from the computed style object.

func GetComputedStyleValue

func GetComputedStyleValue(elem dom.Element, psudo string, prop string) (*js.Object, error)

GetComputedStyleValue retrieves the value of the property from the computed style object.

func GetComputedStyleValueWith

func GetComputedStyleValueWith(css *dom.CSSStyleDeclaration, prop string) (*js.Object, error)

GetComputedStyleValueWith usings the CSSStyleDeclaration to retrieves the value of the property from the computed style object.

func GetProp

func GetProp(o *js.Object, prop string) (*js.Object, error)

GetProp retrieves the necessary property for this specific name.

func GetShadowRoot

func GetShadowRoot(elem dom.Node) (dom.DocumentFragment, bool)

GetShadowRoot retrieves the shadowRoot connected to the pass dom.Node, else returns false as the second argument if the node has no shadowRoot.

func HasShadowRoot

func HasShadowRoot(elem dom.Node) bool

HasShadowRoot returns true/false if the element type matches the [object shadowRoot].

func IsMatrix

func IsMatrix(data string) bool

IsMatrix returns true/false if the giving string is a matrix declaration.

func IsPerspective

func IsPerspective(data string) bool

IsPerspective checks wether the giving string is a css perspective directive.

func IsRotation

func IsRotation(data string) bool

IsRotation checks wether the giving string is a css rotation directive.

func IsScale

func IsScale(data string) bool

IsScale checks wether the giving string is a css scale directive.

func IsSimpleRotation

func IsSimpleRotation(data string) bool

IsSimpleRotation checks wether the giving string is a css rotation directive.

func IsSkew

func IsSkew(data string) bool

IsSkew checks wether the giving string is a css skew directive.

func IsTranslation

func IsTranslation(data string) bool

IsTranslation checks wether the giving string is a css translation directive.

func MatchProp

func MatchProp(o *js.Object, prop string, val string) bool

MatchProp matches the string value from a property val against a provided expected value.

func Offset

func Offset(elem dom.Element) (float64, float64)

Offset returns the top,left offset of a dom.Element.

func OffsetParent

func OffsetParent(elem dom.Element) *js.Object

OffsetParent returns the offset parent element for a specific element.

func PageBox

func PageBox() (float64, float64)

PageBox returns the offset of the current page bounding box.

func Position

func Position(elem dom.Element) (float64, float64)

Position returns the current position of the dom.Element.

func RemoveComputedStyleValue

func RemoveComputedStyleValue(css *dom.CSSStyleDeclaration, prop string)

RemoveComputedStyleValue removes the value of the property from the computed style object.

func RootElement

func RootElement(elem dom.Node) dom.Node

RootElement returns the root parent element that for the provided element.

func ShadowRootDocument

func ShadowRootDocument(elem dom.Node) dom.DocumentFragment

ShadowRootDocument returns the DocumentFragment interface for the provided shadowRoot.

func Unit

func Unit(u string) string

Unit returns a valid unit type in the browser, if the supplied unit is standard then it is return else 'px' is returned as default.

func Vendorize

func Vendorize(u string) []string

Vendorize returns a property name with the different versions known according browsers.

func Window

func Window() dom.Window

Window returns the root window for the current dom.

Types

type ComputedStyle

type ComputedStyle struct {
	Name       string
	VendorName string
	Value      string
	Values     []string
	Priority   bool // values between [0,1] to indicate use of '!important'
}

ComputedStyle defines a style property item.

type ComputedStyleMap

type ComputedStyleMap map[string]ComputedStyle

ComputedStyleMap defines a map type of computed style properties and values.

func GetComputedStyleMap

func GetComputedStyleMap(elem dom.Element, ps string) (ComputedStyleMap, error)

GetComputedStyleMap returns a map of computed style properties and values. Also all vendored names are cleaned up to allow quick and easy access regardless of vendor.

func (ComputedStyleMap) Get

func (c ComputedStyleMap) Get(name string) (ComputedStyle, error)

Get retrieves the specific property if it exists.

func (ComputedStyleMap) Has

func (c ComputedStyleMap) Has(name string) bool

Has returns true/false if the property exists.

type CurvePoint

type CurvePoint struct {
	Length         int
	X              float64
	Y              float64
	Xd             float64
	Yd             float64
	SampleProgress float64
}

CurvePoint defines a area along a svg path for a specific progress and x value.

type Matrix

type Matrix struct {
	ScaleX    float64
	RotationX float64
	ScaleY    float64
	RotationY float64
	PositionX float64
	PositionY float64
	PositionZ float64
	ScaleZ    float64
	RotationZ float64
}

Matrix defines a transformation matrix generated from a transform directive.

func ToMatrix2D

func ToMatrix2D(data string) (*Matrix, error)

ToMatrix2D returns a matrix from the provided data (eg matrix(0,1,0,1,3,4)) else returns an error.

type Perspective

type Perspective struct {
	Range float64
}

Perspective provides a structure for storing current perspective data.

func ToPerspective

func ToPerspective(data string) (*Perspective, error)

ToPerspective returns the translation from the giving string else returns an error if it failed.

type Pointer

type Pointer struct {
	*js.Object
}

Pointer implements the Point interface.

func (*Pointer) GetPointAtLength

func (p *Pointer) GetPointAtLength(step float64) (float64, float64)

GetPointAtLength returns a giving point by the provide step value.

type Rotation

type Rotation struct {
	Angle float64
}

Rotation defines the concrete representation of the css3 skew transform property.

func ToRotation

func ToRotation(data string) (*Rotation, error)

ToRotation returns the rotation from the giving string else returns an error if it failed.

type SVGConfig

type SVGConfig struct {
	SVGPath      string
	Width        int
	Height       int
	SamplingSize int
}

SVGConfig defines a configuration object for the SVGPathEaser. WARNING: Requires to be loaded within the dom.

type SVGPathEaser

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

SVGPathEaser defines a easing provider using SVG Paths.

func NewSVGPathEaser

func NewSVGPathEaser(conf SVGConfig) *SVGPathEaser

NewSVGPathEaser returns a new instance of the SVGPathEaser.

func (*SVGPathEaser) Ease

func (svg *SVGPathEaser) Ease(t float64) float64

Ease returns the giving value of t(time) within the giving svg sample.

func (*SVGPathEaser) Sample

func (svg *SVGPathEaser) Sample(t float64) (CurvePoint, bool)

Sample for the giving t value between 0..1, we return a CurvePoint that is either at that range or within that specified range. Also returns a bool whether it was a success or failure.

func (*SVGPathEaser) Stats

func (svg *SVGPathEaser) Stats() (time.Duration, time.Time, time.Time)

Stats returns the giving time details taken to generate the samples.

type Scale

type Scale struct {
	X float64
	Y float64
}

Scale defines the concrete representation of the css3 scale transform property.

func ToScale

func ToScale(data string) (*Scale, error)

ToScale returns the translation from the giving string else returns an error if it failed.

type Skew

type Skew struct {
	X float64
	Y float64
}

Skew defines the concrete representation of the css3 skew transform property.

func ToSkew

func ToSkew(data string) (*Skew, error)

ToSkew returns the skew from the giving string else returns an error if it failed.

type Translation

type Translation struct {
	X float64
	Y float64
}

Translation defines the concrete representation of the css3 translation transform property.

func ToTranslation

func ToTranslation(data string) (*Translation, error)

ToTranslation returns the translation from the giving string else returns an error if it failed.

Jump to

Keyboard shortcuts

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