Module

Stylesheet

Package
purescript-stylesheet
Repository
danieljharvey/purescript-stylesheet

Re-exports from Stylesheet.Internal.AddStyle

#addStyle Source

addStyle :: forall props p. Stylesheet p -> CSSRuleSet props -> props -> Effect (Array CSSSelector)

This is the top level big dog of a function, as such We provide the big Stylesheet doing-things-lump a function from props -> Styles some props and we get back a bunch of CSSSelectors (classes)

Re-exports from Stylesheet.Internal.DomActions

#unpackRule Source

unpackRule :: IndexedRule CSSStyleRule -> Effect (UnpackedRule CSSStyleRule)

This takes an item and returns the selector and declaration text Useful for diffing etc

#insertRule Source

insertRule :: forall a. HasRuleList a => a -> InsertRule -> Effect Unit

Insert new rule into stylesheet, deleting old one if name matches

#insertRecursive Source

#getUnpackedStyleRules Source

getUnpackedStyleRules :: CSSRuleList -> Effect (Array (UnpackedRule CSSStyleRule))

Gets style rules for a rule list and fetches basic data about them

#getStyleRuleSelectorText Source

getStyleRuleSelectorText :: CSSStyleRule -> Effect CSSSelector

Get the selector text of a CSSStyleRule

#getStyleRuleDeclarationText Source

getStyleRuleDeclarationText :: CSSStyleRule -> Effect CSSText

Get the Style Declaration of a CSSStyleRule

#getMediaRuleMediaText Source

getMediaRuleMediaText :: CSSMediaRule -> Effect MediaQueryText

Get the rule from the Media Rule

#getFilteredRuleList Source

getFilteredRuleList :: CSSRuleList -> Effect CSSRules

Get all the rules of a stylesheet, split by type

Re-exports from Stylesheet.Internal.ProcessStyles

#processStyle Source

processStyle :: forall props. CSSRuleSet props -> props -> StyleRuleSet

#keep Source

keep :: StyleRuleSet -> Array InsertMediaRule

This commits the rendered StyleRuleSet into InsertMediaRules that we can store and apply to the CSSOM

#getClasses Source

getClasses :: InsertMediaRule -> Array CSSSelector

Get the generated CSS classes from the CSS. These are generated from hashes of the content

#createHashedInsertRule Source

createHashedInsertRule :: CSSText -> InsertRule

This creates a unique hash of the CSS that we'll use to make the classname

Re-exports from Stylesheet.Types.CSSRuleSet

#CSSRuleSet Source

newtype CSSRuleSet p

CSSRuleSet is what we build up for a style

Constructors

Instances

#str Source

str :: forall props. String -> CSSRuleSet props

Create a rule that takes no props

#media Source

media :: forall props. String -> CSSRuleSet props -> CSSRuleSet props

Create a media query

#fun Source

fun :: forall props. (props -> String) -> CSSRuleSet props

Create a rule that receives the props

Re-exports from Stylesheet.Types.Primitives

#UnpackedRule Source

type UnpackedRule a = { id :: Int, item :: a, ruleText :: CSSText, selector :: CSSSelector }

#UnpackedMediaRule Source

type UnpackedMediaRule a = { id :: Int, item :: a, query :: MediaQueryText }

#StylesheetId Source

newtype StylesheetId

Unique ID for stylesheet in DOM

Constructors

#InsertRule Source

data InsertRule

Data structure used internally to describe a single CSS rule

Constructors

Instances

#InsertMediaRule Source

data InsertMediaRule

A complete single rule or nested media rule

Constructors

#CSSSelector Source

data CSSSelector

CSS Selectors used in DOM, currently we only use class selectors

Constructors

Instances

Re-exports from Stylesheet.Types.StyleRuleSet

Re-exports from Stylesheet.Types.Stylesheet

#Stylesheet Source

#readVirtualStylesheet Source

#getCSSStylesheet Source

#createBlankStylesheet Source

createBlankStylesheet :: forall p. IsSymbol p => Effect (Stylesheet p)

Create a StyleSheet in the DOM along with an empty VirtualStylesheet to record it's contents

Re-exports from Stylesheet.Types.VirtualStylesheet

#getStylesheetId Source