~alcinnz/haskell-stylist

768a480d006a0bb80d3f56e5ebdaee42af15fa7e — Adrian Cochrane 5 years ago 2881aec
Cascade CSS properties.
1 files changed, 11 insertions(+), 0 deletions(-)

M src/Stylish/Style/Selector.hs
M src/Stylish/Style/Selector.hs => src/Stylish/Style/Selector.hs +11 -0
@@ 11,6 11,9 @@ import Stylish.Style.Selector.Common

import Stylish.Parse (StyleSheet(..))

-- TODO do performance tests to decide beside between strict/lazy.
import Data.HashMap.Strict

ruleStore = ImportanceSplitter $ OrderedRuleStore (InterpretedRuleStore styleIndex) 0

data QueryableStyleSheet store = QueryableStyleSheet {


@@ 26,3 29,11 @@ instance RuleStore s => StyleSheet (QueryableStyleSheet s) where
        }

queryRules (QueryableStyleSheet store _) el = lookupRules store el

--------
---- Cascade
--------

cascadeRules rules = cascadeProperties $ concat $ Prelude.map properties rules

cascadeProperties ((name, value):props) = insert name value $ cascadeProperties props