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
insertRecursive :: forall a. HasRuleList a => a -> InsertMediaRule -> Effect Unit
#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
#findRuleBySelector Source
findRuleBySelector :: CSSRuleList -> CSSSelector -> Effect (Maybe (UnpackedRule CSSStyleRule))
#createAndReturnCSSMediaRule Source
createAndReturnCSSMediaRule :: forall a. HasRuleList a => a -> MediaQueryText -> Effect (Maybe (UnpackedMediaRule CSSMediaRule))
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
CSSRuleSet (Array (CSSRule p))
Instances
Semigroup (CSSRuleSet p)
Monoid (CSSRuleSet p)
#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 }
#MediaQueryText Source
#InsertRule Source
#InsertMediaRule Source
#CSSSelector Source
data CSSSelector
CSS Selectors used in DOM, currently we only use class selectors
Constructors
Instances
Re-exports from Stylesheet.Types.StyleRuleSet
#StyleRuleSet Source
Re-exports from Stylesheet.Types.Stylesheet
#readVirtualStylesheet Source
readVirtualStylesheet :: forall p. Stylesheet p -> Effect (VirtualStylesheet p)
#getCSSStylesheet Source
getCSSStylesheet :: forall p. Stylesheet p -> CSSStyleSheet
#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
#VirtualStylesheet Source
#getStylesheetId Source
getStylesheetId :: forall s. IsSymbol s => VirtualStylesheet s -> StylesheetId