- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - pull though a stack of styles
518176
function stack(items) {
		var mw = core.base();
		mw.enabled = true;
		mw.stack = (isArray(items) ? items : Array.prototype.slice.call(arguments, 0));

		mw.error = function (str) {
			str = String(str);
			if (mw.enabled) {
				for (var i = 0, ii = mw.stack.length; i < ii; i++) {
					str = mw.stack[i].error(str);
				}
			}
			return str;
		};
		mw.warning = function (str) {
			str = String(str);
			if (mw.enabled) {
				for (var i = 0, ii = mw.stack.length; i < ii; i++) {
					str = mw.stack[i].warning(str);
				}
			}
			return str;
		};
		mw.success = function (str) {
			str = String(str);
			if (mw.enabled) {
				for (var i = 0, ii = mw.stack.length; i < ii; i++) {
					str = mw.stack[i].success(str);
				}
			}
			return str;
		};
		mw.accent = function (str) {
			str = String(str);
			if (mw.enabled) {
				for (var i = 0, ii = mw.stack.length; i < ii; i++) {
					str = mw.stack[i].accent(str);
				}
			}
			return str;
		};
		mw.signal = function (str) {
			str = String(str);
			if (mw.enabled) {
				for (var i = 0, ii = mw.stack.length; i < ii; i++) {
					str = mw.stack[i].signal(str);
				}
			}
			return str;
		};
		mw.muted = function (str) {
			str = String(str);
			if (mw.enabled) {
				for (var i = 0, ii = mw.stack.length; i < ii; i++) {
					str = mw.stack[i].muted(str);
				}
			}
			return str;
		};
		mw.plain = function (str) {
			str = String(str);
			if (mw.enabled) {
				for (var i = 0, ii = mw.stack.length; i < ii; i++) {
					str = mw.stack[i].plain(str);
				}
			}
			return str;
		};
		mw.toString = function () {
			return '<ministyle-stack>';
		};
		return mw;
	}
117049
function (styles) {
		/*jslint unparam: true*//* allow unused param a in the regexp function below */
		var elemWrapper = this,
			elem = elemWrapper.element,
			textWidth = styles && styles.width && elem.nodeName.toLowerCase() === 'text',
			n,
			serializedCss = '',
			hyphenate = function (a, b) { return '-' + b.toLowerCase(); };
		/*jslint unparam: false*/

		// convert legacy
		if (styles && styles.color) {
			styles.fill = styles.color;
		}

		// Merge the new styles with the old ones
		styles = extend(
			elemWrapper.styles,
			styles
		);

		// store object
		elemWrapper.styles = styles;


		// Don't handle line wrap on canvas
		if (useCanVG && textWidth) {
			delete styles.width;
		}

		// serialize and set style attribute
		if (isIE && !hasSVG) { // legacy IE doesn't support setting style attribute
			if (textWidth) {
				delete styles.width;
			}
			css(elemWrapper.element, styles);
		} else {
			for (n in styles) {
				serializedCss += n.replace(/([A-Z])/g, hyphenate) + ':' + styles[n] + ';';
			}
			attr(elem, 'style', serializedCss); // #1881
		}


		// re-build text
		if (textWidth && elemWrapper.added) {
			elemWrapper.renderer.buildText(elemWrapper);
		}

		return elemWrapper;
	}
754245
function parseStyles(style) {
  let re = /\s*([\w-]+)\s*:\s*([^;]+)/g, m, result = []
  while (m = re.exec(style)) result.push(m[1], m[2].trim())
  return result
}
940028
private void extractStyles(Document doc) {
        String stylesheet = fetchStyles(doc);

        String trimmedStylesheet = stylesheet.replaceAll("\n", "").replaceAll("/\\*.*?\\*/", "").replaceAll(" +", " ");
        String styleRules = trimmedStylesheet.trim(), delims = "{}";
        StringTokenizer st = new StringTokenizer(styleRules, delims);
        while (st.countTokens() > 1) {
            String selector = st.nextToken(), properties = st.nextToken();
            Elements selectedElements = doc.select(selector);
            for (Element selElem : selectedElements) {
                String oldProperties = selElem.attr(CSS_STYLE);
                selElem.attr(CSS_STYLE,
                        oldProperties.length() > 0 ? concatenateProperties(
                                        oldProperties, properties) : properties);
            }
        }
    }
838857
function() {
      ctx.options.styles.forEach(style => {
        if (ctx.map.getLayer(style.id)) {
          ctx.map.removeLayer(style.id);
        }
      });

      if (ctx.map.getSource(Constants.sources.COLD)) {
        ctx.map.removeSource(Constants.sources.COLD);
      }

      if (ctx.map.getSource(Constants.sources.HOT)) {
        ctx.map.removeSource(Constants.sources.HOT);
      }
    }
794140
function pasteGradient(property, gradients) {
		var rule = property.parent;
		var alignVendor = prefs.get('css.alignVendor');
		var omitDir = prefs.get('css.gradient.omitDefaultDirection');
		
		// we may have aligned gradient definitions: find the smallest value
		// separator
		var sep = property.styleSeparator;
		var before = property.styleBefore;
		
		// first, remove all properties within CSS rule with the same name and
		// gradient definition
		rule.getAll(similarPropertyNames(property)).forEach(function(item) {
			if (item != property && /gradient/i.test(item.value())) {
				if (item.styleSeparator.length < sep.length) {
					sep = item.styleSeparator;
				}
				if (item.styleBefore.length < before.length) {
					before = item.styleBefore;
				}
				rule.remove(item);
			}
		});
		
		if (alignVendor) {
			// update prefix
			if (before != property.styleBefore) {
				var fullRange = property.fullRange();
				rule._updateSource(before, fullRange.start, fullRange.start + property.styleBefore.length);
				property.styleBefore = before;
			}
			
			// update separator value
			if (sep != property.styleSeparator) {
				rule._updateSource(sep, property.nameRange().end, property.valueRange().start);
				property.styleSeparator = sep;
			}
		}
		
		var value = property.value();

		// create list of properties to insert
		var propsToInsert = getPropertiesForGradient(gradients, property);
		
		// align prefixed values
		if (alignVendor) {
			var names = [], values = [];
			propsToInsert.forEach(function(item) {
				names.push(item.name);
				values.push(item.value);
			});
			values.push(property.value());
			names.push(property.name());
			
			var valuePads = utils.getStringsPads(values.map(function(v) {
				return v.substring(0, v.indexOf('('));
			}));
			
			var namePads = utils.getStringsPads(names);
			property.name(namePads[namePads.length - 1] + property.name());
			
			propsToInsert.forEach(function(prop, i) {
				prop.name = namePads[i] + prop.name;
				prop.value = valuePads[i] + prop.value;
			});
			
			property.value(valuePads[valuePads.length - 1] + property.value());
		}
		
		// put vendor-prefixed definitions before current rule
		propsToInsert.forEach(function(prop) {
			rule.add(prop.name, prop.value, rule.indexOf(property));
		});

		// put vanilla-clean gradient definition into current rule
		property.value(insertGradientsIntoCSSValue(gradients, value, {
			placeholder: '${2}',
			omitDefaultDirection: omitDir
		}));
	}
135692
function(type) {
    this.rules = {};
    this.parseMethods = {};
    this.lastTag;

    var rules = require('./rules/all');
    Object.keys(rules.parseMethods).forEach(function(key) {
        this.parseMethods[key] = typeof rules.parseMethods[key] === 'function' ? rules.parseMethods[key] : this[rules.parseMethods[key]];
    }, this);

    if (type === 'js') {
        rules = require('./rules/javascript');
        this.rules = rules.rules;
    }
    else if (type === 'css' || type === 'less' || type === 'styl' || type === 'scss' || type === 'sass') {
        rules = require('./rules/styles');
        this.rules = rules.rules;
    }
    else {
        rules = null;
    }

    if (rules) {
        Object.keys(rules.parseMethods).forEach(function(key) {
            this.parseMethods[key] = typeof rules.parseMethods[key] === 'function' ? rules.parseMethods[key] : this[rules.parseMethods[key]];
        }, this);
    }
}
1242620
function selector() {
        whitespace();

        while (css[0] === '}') {
            error('extra closing bracket');
        }

        const m = match(/^(("(?:\\"|[^"])*"|'(?:\\'|[^'])*'|[^{])+)/);

        if (m) {
            return m[0]
                .trim() // remove all comments from selectors
                .replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g, '')
                .replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g, function(m) {
                    return m.replace(/,/g, '\u200C');
                })
                .split(/\s*(?![^(]*\)),\s*/)
                .map(function(s) {
                    return s.replace(/\u200C/g, ',');
                });
        }
    }
1275425
function marginAndPaddingStyles(scale) {
  const styles = {};

  shorthands.forEach(([propShorthand, prop]) => {
    directions.forEach(([directionShorthand, direction]) => {
      scale.forEach((unit, idx) => {
        styles[`${propShorthand}${directionShorthand}${idx}`] = {
          [`${prop}${direction}`]: unit,
        };
      });
    });
  });

  return styles;
}
157912
function splitStyleProperty(property) {
            var token = /((?:[^"']|".*?"|'.*?')*?)([(,)]|$)/g;
            var recurse = function () {
                var array = [];
                for (;;) {
                    var result = token.exec(property);
                    if (result[2] === "(") {
                        var str = result[1].trim() + "(" + recurse().join(",") + ")";
                        result = token.exec(property);
                        str += result[1];
                        array.push(str);
                    } else {
                        array.push(result[1].trim());
                    }
                    if (result[2] !== ",") {
                        return array;
                    }
                }
            };
            return (recurse());
        }
928890
function(styles, cb) {
			// Reduce the list to styles that haven't been loaded
			var existingStyles = _findExistingStyles();
			styles = jQuery.grep(styles, function(url) {
				return url && jQuery.inArray(url, existingStyles) === -1;
			});

			// Attempt to use the user provided method
			if (_config.loadStyles) {
				return _config.loadStyles(styles, cb);
			}

			// load styles, see #101
			var stylesFragment = null,
				useCreateStyleSheet = !!document.createStyleSheet;

			jQuery.each(styles, function(i, resourceUrl) {
				if (useCreateStyleSheet) {
					document.createStyleSheet(resourceUrl);
				}
				else {
					stylesFragment = stylesFragment || [];
					stylesFragment.push('<link rel="stylesheet" type="text/css" href="' + resourceUrl + '"/>');
				}
			});

			if (stylesFragment) {
				jQuery('head').append(stylesFragment.join(''));
			}

			cb();
		}
663540
function inlineStylesheet($, filepath) {
  $('link[rel=stylesheet][href]').each(function() {
    var el      = $(this);
    var href    = el.attr('href');
    if(ABS.test(href)) return;
    var relpath = /^\./.test(href) ? href : './' + href;
    var srcpath = resolve.sync(relpath, {
      basedir    : dirname(filepath),
      extensions : [extname(relpath)]
    })
    var content = read(srcpath);
    var style = whacko('<style>' + content + '</style>');
    style.attr(el.attr());
    style.attr('href', null);
    style.attr('rel', null);
    el.replaceWith(whacko.html(style));
  })
}
1137544
function(verts, styles, ctx){

            var vert = verts[0]
                ,x = vert.x
                ,y = vert.y
                ,l = verts.length
                ;

            ctx = ctx || this.ctx;
            ctx.beginPath();
            this.setStyle( styles, ctx );

            ctx.moveTo(x, y);

            for ( var i = 1; i < l; ++i ){

                vert = verts[ i ];
                x = vert.x;
                y = vert.y;
                ctx.lineTo(x, y);
            }

            if ( l > 2 ){
                ctx.closePath();
            }

            ctx.stroke();
            ctx.fill();
        }
107913
function (stylesObj) {
            var styles = '';
            Object.keys(stylesObj).forEach(function (prop) {
                styles += prop + ':' + stylesObj[prop].replace(/"/g, '\\"') + '; ';
            });
            return styles;
        }
211423
function() {
    var doc = this._doc;

    // Remove all style tags in head
    this._removeNodes(doc.getElementsByTagName("style"));

    if (doc.body) {
      this._replaceBrs(doc.body);
    }

    this._replaceNodeTags(doc.getElementsByTagName("font"), "SPAN");
  }
363842
function checkMiniStyle(target, first) {
		if (!target || typeof target !== 'object' || Array.isArray(target)) {
			return null;
		}
		var missing = [];
		var styleNames = getStyleNames();
		for (var i = 0; i < styleNames.length; i++) {
			if (typeof target[styleNames[i]] !== 'function') {
				if (first) {
					return null;
				}
				missing.push(styleNames[i]);
			}
		}
		return missing;
	}
903574
function lintStyles() {
  // Pass all command line flags to Stylelint.
  const options = minimist( process.argv.slice( 2 ) );
  const willFix = options.fix || false;
  return gulp.src( [
    'packages/**/*.less',
    '!packages/cf-*/node_modules/**/*.less',
    '!packages/cf-grid/src-generated/*.less'
  ] )
    .pipe( gulpStylelint( {
      failAfterError: true,
      fix: willFix,
      reporters: [ { formatter: 'string', console: true } ]
    } ) )
    .pipe( gulp.dest( 'packages' ) );
}