UI for Zipcoin Blue

list.js 8.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. 'use strict';
  2. exports.__esModule = true;
  3. /**
  4. * Contains helpers for safely splitting lists of CSS values,
  5. * preserving parentheses and quotes.
  6. *
  7. * @example
  8. * const list = postcss.list;
  9. *
  10. * @namespace list
  11. */
  12. var list = {
  13. split: function split(string, separators, last) {
  14. var array = [];
  15. var current = '';
  16. var split = false;
  17. var func = 0;
  18. var quote = false;
  19. var escape = false;
  20. for (var i = 0; i < string.length; i++) {
  21. var letter = string[i];
  22. if (quote) {
  23. if (escape) {
  24. escape = false;
  25. } else if (letter === '\\') {
  26. escape = true;
  27. } else if (letter === quote) {
  28. quote = false;
  29. }
  30. } else if (letter === '"' || letter === '\'') {
  31. quote = letter;
  32. } else if (letter === '(') {
  33. func += 1;
  34. } else if (letter === ')') {
  35. if (func > 0) func -= 1;
  36. } else if (func === 0) {
  37. if (separators.indexOf(letter) !== -1) split = true;
  38. }
  39. if (split) {
  40. if (current !== '') array.push(current.trim());
  41. current = '';
  42. split = false;
  43. } else {
  44. current += letter;
  45. }
  46. }
  47. if (last || current !== '') array.push(current.trim());
  48. return array;
  49. },
  50. /**
  51. * Safely splits space-separated values (such as those for `background`,
  52. * `border-radius`, and other shorthand properties).
  53. *
  54. * @param {string} string - space-separated values
  55. *
  56. * @return {string[]} split values
  57. *
  58. * @example
  59. * postcss.list.space('1px calc(10% + 1px)') //=> ['1px', 'calc(10% + 1px)']
  60. */
  61. space: function space(string) {
  62. var spaces = [' ', '\n', '\t'];
  63. return list.split(string, spaces);
  64. },
  65. /**
  66. * Safely splits comma-separated values (such as those for `transition-*`
  67. * and `background` properties).
  68. *
  69. * @param {string} string - comma-separated values
  70. *
  71. * @return {string[]} split values
  72. *
  73. * @example
  74. * postcss.list.comma('black, linear-gradient(white, black)')
  75. * //=> ['black', 'linear-gradient(white, black)']
  76. */
  77. comma: function comma(string) {
  78. var comma = ',';
  79. return list.split(string, [comma], true);
  80. }
  81. };
  82. exports.default = list;
  83. module.exports = exports['default'];
  84. //# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImxpc3QuZXM2Il0sIm5hbWVzIjpbImxpc3QiLCJzcGxpdCIsInN0cmluZyIsInNlcGFyYXRvcnMiLCJsYXN0IiwiYXJyYXkiLCJjdXJyZW50IiwiZnVuYyIsInF1b3RlIiwiZXNjYXBlIiwiaSIsImxlbmd0aCIsImxldHRlciIsImluZGV4T2YiLCJwdXNoIiwidHJpbSIsInNwYWNlIiwic3BhY2VzIiwiY29tbWEiXSwibWFwcGluZ3MiOiI7OztBQUFBOzs7Ozs7Ozs7QUFTQSxJQUFJQSxPQUFPO0FBRVBDLFNBRk8saUJBRURDLE1BRkMsRUFFT0MsVUFGUCxFQUVtQkMsSUFGbkIsRUFFeUI7QUFDNUIsWUFBSUMsUUFBVSxFQUFkO0FBQ0EsWUFBSUMsVUFBVSxFQUFkO0FBQ0EsWUFBSUwsUUFBVSxLQUFkOztBQUVBLFlBQUlNLE9BQVUsQ0FBZDtBQUNBLFlBQUlDLFFBQVUsS0FBZDtBQUNBLFlBQUlDLFNBQVUsS0FBZDs7QUFFQSxhQUFNLElBQUlDLElBQUksQ0FBZCxFQUFpQkEsSUFBSVIsT0FBT1MsTUFBNUIsRUFBb0NELEdBQXBDLEVBQTBDO0FBQ3RDLGdCQUFJRSxTQUFTVixPQUFPUSxDQUFQLENBQWI7O0FBRUEsZ0JBQUtGLEtBQUwsRUFBYTtBQUNULG9CQUFLQyxNQUFMLEVBQWM7QUFDVkEsNkJBQVMsS0FBVDtBQUNILGlCQUZELE1BRU8sSUFBS0csV0FBVyxJQUFoQixFQUF1QjtBQUMxQkgsNkJBQVMsSUFBVDtBQUNILGlCQUZNLE1BRUEsSUFBS0csV0FBV0osS0FBaEIsRUFBd0I7QUFDM0JBLDRCQUFRLEtBQVI7QUFDSDtBQU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gICAgICAgICAgICAgZXNjYXBlID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKCBsZXR0ZXIgPT09IHF1b3RlICkge1xuICAgICAgICAgICAgICAgICAgICBxdW90ZSA9IGZhbHNlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0gZWxzZSBpZiAoIGxldHRlciA9PT0gJ1wiJyB8fCBsZXR0ZXIgPT09ICdcXCcnICkge1xuICAgICAgICAgICAgICAgIHF1b3RlID0gbGV0dGVyO1xuICAgICAgICAgICAgfSBlbHNlIGlmICggbGV0dGVyID09PSAnKCcgKSB7XG4gICAgICAgICAgICAgICAgZnVuYyArPSAxO1xuICAgICAgICAgICAgfSBlbHNlIGlmICggbGV0dGVyID09PSAnKScgKSB7XG4gICAgICAgICAgICAgICAgaWYgKCBmdW5jID4gMCApIGZ1bmMgLT0gMTtcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoIGZ1bmMgPT09IDAgKSB7XG4gICAgICAgICAgICAgICAgaWYgKCBzZXBhcmF0b3JzLmluZGV4T2YobGV0dGVyKSAhPT0gLTEgKSBzcGxpdCA9IHRydWU7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmICggc3BsaXQgKSB7XG4gICAgICAgICAgICAgICAgaWYgKCBjdXJyZW50ICE9PSAnJyApIGFycmF5LnB1c2goY3VycmVudC50cmltKCkpO1xuICAgICAgICAgICAgICAgIGN1cnJlbnQgPSAnJztcbiAgICAgICAgICAgICAgICBzcGxpdCAgID0gZmFsc2U7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGN1cnJlbnQgKz0gbGV0dGVyO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgaWYgKCBsYXN0IHx8IGN1cnJlbnQgIT09ICcnICkgYXJyYXkucHVzaChjdXJyZW50LnRyaW0oKSk7XG4gICAgICAgIHJldHVybiBhcnJheTtcbiAgICB9LFxuXG4gICAgL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