Esempio n. 1
0
        protected List <CssNamespace> GetCombinedNamespaces()
        {
            if (AddedStyleSheets?.Count == 0 &&
                InheritedStyleSheets?.Count == 0)
            {
                return(LocalNamespaces);
            }

            return(InheritedStyleSheets
                   .Select(x => x.Namespaces)
                   .Concat(AddedStyleSheets.Select(x => x.Namespaces))
                   .Aggregate((a, b) => a.Concat(b).ToList())
                   .Concat(LocalNamespaces)
                   .GroupBy(x => x.Alias)
                   .Select(x => x.Last())
                   .ToList());
        }
Esempio n. 2
0
        protected List <StyleRule> GetCombinedStyleRules()
        {
            if (AddedStyleSheets?.Count == 0 &&
                InheritedStyleSheets?.Count == 0)
            {
                return(LocalRules);
            }

            return(InheritedStyleSheets
                   .Select(x => x.Rules.ToList())
                   .Concat(AddedStyleSheets.Select(x => x.Rules.ToList()))
                   .Aggregate((a, b) => a.Concat(b).ToList())
                   .Concat(LocalRules)
                   .GroupBy(x => x.SelectorString)
                   .Select(x => new StyleRule
            {
                SelectorString = x.Key,
                Selectors = x.First().Selectors,
                SelectorType = x.First().SelectorType,
                DeclarationBlock = new StyleDeclarationBlock(GetMergedStyleDeclarations(x.ToList()), x.SelectMany(y => y.DeclarationBlock.Triggers))
            })
                   .ToList());
        }