版博士V2.0程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

2131 lines
67 KiB

  1. /*! *****************************************************************************
  2. Copyright (c) Microsoft Corporation.
  3. Permission to use, copy, modify, and/or distribute this software for any
  4. purpose with or without fee is hereby granted.
  5. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  6. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  7. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  8. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  9. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  10. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  11. PERFORMANCE OF THIS SOFTWARE.
  12. ***************************************************************************** */
  13. /* global Reflect, Promise */
  14. var extendStatics = function(d, b) {
  15. extendStatics = Object.setPrototypeOf ||
  16. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  17. function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
  18. return extendStatics(d, b);
  19. };
  20. function __extends(d, b) {
  21. if (typeof b !== "function" && b !== null)
  22. throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  23. extendStatics(d, b);
  24. function __() { this.constructor = d; }
  25. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  26. }
  27. var __assign = function() {
  28. __assign = Object.assign || function __assign(t) {
  29. for (var s, i = 1, n = arguments.length; i < n; i++) {
  30. s = arguments[i];
  31. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  32. }
  33. return t;
  34. };
  35. return __assign.apply(this, arguments);
  36. };
  37. function __spreadArray(to, from, pack) {
  38. if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
  39. if (ar || !(i in from)) {
  40. if (!ar) ar = Array.prototype.slice.call(from, 0, i);
  41. ar[i] = from[i];
  42. }
  43. }
  44. return to.concat(ar || Array.prototype.slice.call(from));
  45. }
  46. var Console = /** @class */ (function () {
  47. function Console() {
  48. }
  49. Console.log = function () {
  50. var message = [];
  51. for (var _i = 0; _i < arguments.length; _i++) {
  52. message[_i] = arguments[_i];
  53. }
  54. // eslint-disable-next-line no-console
  55. console.log.apply(console, message);
  56. };
  57. Console.error = function () {
  58. var message = [];
  59. for (var _i = 0; _i < arguments.length; _i++) {
  60. message[_i] = arguments[_i];
  61. }
  62. // eslint-disable-next-line no-console
  63. console.error.apply(console, message);
  64. };
  65. Console.time = function (label) {
  66. // eslint-disable-next-line no-console
  67. console.time(label);
  68. };
  69. Console.timeEnd = function (label) {
  70. // eslint-disable-next-line no-console
  71. console.timeEnd(label);
  72. };
  73. return Console;
  74. }());
  75. function toArray(v) {
  76. if (Array.isArray(v))
  77. return v;
  78. return [v];
  79. }
  80. function hash(str) {
  81. str = str.replace(/\r/g, '');
  82. var hash = 5381;
  83. var i = str.length;
  84. while (i--)
  85. hash = ((hash << 5) - hash) ^ str.charCodeAt(i);
  86. return (hash >>> 0).toString(36);
  87. }
  88. function type(val) {
  89. return val === null
  90. ? 'Null'
  91. : val === undefined
  92. ? 'Undefined'
  93. : Object.prototype.toString.call(val).slice(8, -1);
  94. }
  95. function indent(code, tab) {
  96. if (tab === void 0) { tab = 2; }
  97. var spaces = Array(tab).fill(' ').join('');
  98. return code
  99. .split('\n')
  100. .map(function (line) { return spaces + line; })
  101. .join('\n');
  102. }
  103. function wrapit(code, start, end, tab, minify) {
  104. if (start === void 0) { start = '{'; }
  105. if (end === void 0) { end = '}'; }
  106. if (tab === void 0) { tab = 2; }
  107. if (minify === void 0) { minify = false; }
  108. if (minify)
  109. return "".concat(start).concat(code).concat(end);
  110. return "".concat(start, "\n").concat(indent(code, tab), "\n").concat(end);
  111. }
  112. function isNumber(amount, start, end, type) {
  113. if (start === void 0) { start = -Infinity; }
  114. if (end === void 0) { end = Infinity; }
  115. if (type === void 0) { type = 'int'; }
  116. var isInt = /^-?\d+$/.test(amount);
  117. if (type === 'int') {
  118. if (!isInt)
  119. return false;
  120. }
  121. else {
  122. var isFloat = /^-?\d+\.\d+$/.test(amount);
  123. if (!(isInt || isFloat))
  124. return false;
  125. }
  126. var num = parseFloat(amount);
  127. return num >= start && num <= end;
  128. }
  129. function isFraction(amount) {
  130. return /^\d+\/\d+$/.test(amount);
  131. }
  132. function isSize(amount) {
  133. return /^-?(\d+(\.\d+)?)+(rem|em|px|rpx|vh|vw|ch|ex|cm|mm|in|pt|pc)$/.test(amount);
  134. }
  135. function isSpace(str) {
  136. return /^\s*$/.test(str);
  137. }
  138. function roundUp(num, precision) {
  139. if (precision === void 0) { precision = 0; }
  140. precision = Math.pow(10, precision);
  141. return Math.round(num * precision) / precision;
  142. }
  143. function fracToPercent(amount) {
  144. var matches = amount.match(/[^/]+/g);
  145. if (!matches || matches.length < 2)
  146. return;
  147. var a = +matches[0];
  148. var b = +matches[1];
  149. return roundUp((a / b) * 100, 6) + '%';
  150. }
  151. function hex2RGB(hex) {
  152. var RGB_HEX = /^#?(?:([\da-f]{3})[\da-f]?|([\da-f]{6})(?:[\da-f]{2})?)$/i;
  153. var _a = String(hex).match(RGB_HEX) || [], short = _a[1], long = _a[2];
  154. if (long) {
  155. var value = Number.parseInt(long, 16);
  156. return [value >> 16, (value >> 8) & 0xff, value & 0xff];
  157. }
  158. else if (short) {
  159. return Array.from(short, function (s) { return Number.parseInt(s, 16); }).map(function (n) { return (n << 4) | n; });
  160. }
  161. }
  162. function camelToDash(str) {
  163. // Use exact the same regex as Post CSS
  164. return str.replace(/([A-Z])/g, '-$1').replace(/^ms-/, '-ms-').toLowerCase();
  165. }
  166. function dashToCamel(str) {
  167. if (!/-/.test(str))
  168. return str;
  169. return str.toLowerCase().replace(/-(.)/g, function (_, group) { return group.toUpperCase(); });
  170. }
  171. // eslint-disable-next-line @typescript-eslint/no-explicit-any
  172. function getNestedValue(obj, key) {
  173. var topKey = key.match(/^[^.[]+/);
  174. if (!topKey)
  175. return;
  176. var topValue = obj[topKey[0]];
  177. if (!topValue)
  178. return;
  179. var index = topKey[0].length;
  180. while (index < key.length) {
  181. var square = key.slice(index).match(/\[[^\s\]]+?\]/);
  182. var dot = key.slice(index).match(/\.[^.[]+$|\.[^.[]+(?=\.)/);
  183. if ((!square && !dot) || ((square === null || square === void 0 ? void 0 : square.index) === undefined && (dot === null || dot === void 0 ? void 0 : dot.index) === undefined))
  184. return topValue;
  185. if (typeof topValue !== 'object')
  186. return;
  187. if (dot && dot.index !== undefined && ((square === null || square === void 0 ? void 0 : square.index) === undefined || dot.index < square.index)) {
  188. var arg = dot[0].slice(1);
  189. topValue = topValue[arg];
  190. index += dot.index + dot[0].length;
  191. }
  192. else if (square && square.index !== undefined) {
  193. var arg = square[0].slice(1, -1).trim().replace(/^['"]+|['"]+$/g, '');
  194. topValue = topValue[arg];
  195. index += square.index + square[0].length;
  196. }
  197. }
  198. return topValue;
  199. }
  200. function negateValue(value) {
  201. if (/(^0\w)|(^-)|(^0$)/.test(value))
  202. return value;
  203. return '-' + value;
  204. }
  205. function searchFrom(text, target, startIndex, endIndex) {
  206. if (startIndex === void 0) { startIndex = 0; }
  207. // search from partial of string
  208. var subText = text.substring(startIndex, endIndex);
  209. var relativeIndex = subText.search(target);
  210. return relativeIndex === -1 ? -1 : startIndex + relativeIndex;
  211. }
  212. function connectList(a, b, append) {
  213. if (append === void 0) { append = true; }
  214. return append ? __spreadArray(__spreadArray([], (a !== null && a !== void 0 ? a : []), true), (b !== null && b !== void 0 ? b : []), true) : __spreadArray(__spreadArray([], (b !== null && b !== void 0 ? b : []), true), (a !== null && a !== void 0 ? a : []), true);
  215. }
  216. function toType(value, type) {
  217. switch (type) {
  218. case 'object':
  219. return value && typeof value === 'object' ? value : {};
  220. case 'string':
  221. if (typeof value === 'string')
  222. return value;
  223. break;
  224. case 'number':
  225. if (typeof value === 'number')
  226. return value;
  227. break;
  228. }
  229. }
  230. function deepCopy(source) {
  231. return Array.isArray(source)
  232. ? source.map(function (item) { return deepCopy(item); })
  233. : source instanceof Date
  234. ? new Date(source.getTime())
  235. : source && typeof source === 'object'
  236. ? Object.getOwnPropertyNames(source).reduce(function (o, prop) {
  237. var descriptor = Object.getOwnPropertyDescriptor(source, prop);
  238. if (descriptor) {
  239. Object.defineProperty(o, prop, descriptor);
  240. if (source && typeof source === 'object') {
  241. o[prop] = deepCopy(source[prop]);
  242. }
  243. }
  244. return o;
  245. }, Object.create(Object.getPrototypeOf(source)))
  246. : source;
  247. }
  248. function isTagName(name) {
  249. return ['a', 'abbr', 'address', 'area', 'article', 'aside', 'audio', 'b', 'base', 'bdi', 'bdo', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'cite', 'code', 'col', 'colgroup', 'data', 'datalist', 'dd', 'del', 'details', 'dfn', 'dialog', 'div', 'dl', 'dt', 'em', 'embd', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hr', 'html', 'i', 'iframe', 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'link', 'main', 'map', 'mark', 'meta', 'meter', 'nav', 'noscript', 'object', 'ol', 'optgroup', 'option', 'output', 'p', 'param', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'script', 'section', 'select', 'small', 'source', 'span', 'strong', 'style', 'sub', 'summary', 'sup', 'svg', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'title', 'tr', 'track', 'u', 'ul', 'var', 'video', 'wbr'].includes(name);
  250. }
  251. function flatColors(colors, head) {
  252. var flatten = {};
  253. for (var _i = 0, _a = Object.entries(colors); _i < _a.length; _i++) {
  254. var _b = _a[_i], key = _b[0], value = _b[1];
  255. if (typeof value === 'string' || typeof value === 'function') {
  256. flatten[(head && key === 'DEFAULT') ? head : head ? "".concat(head, "-").concat(key) : key] = value;
  257. }
  258. else {
  259. flatten = __assign(__assign({}, flatten), flatColors(value, head ? "".concat(head, "-").concat(key) : key));
  260. }
  261. }
  262. return flatten;
  263. }
  264. function testRegexr(text, expressions) {
  265. for (var _i = 0, expressions_1 = expressions; _i < expressions_1.length; _i++) {
  266. var exp = expressions_1[_i];
  267. if (exp.test(text))
  268. return true;
  269. }
  270. return false;
  271. }
  272. function searchPropEnd(text, startIndex) {
  273. if (startIndex === void 0) { startIndex = 0; }
  274. var index = startIndex;
  275. var output = -1;
  276. var openSingleQuote = false;
  277. var openDoubleQuote = false;
  278. var openBracket = false;
  279. var isEscaped = false;
  280. while (index < text.length) {
  281. switch (text.charAt(index)) {
  282. case '\\':
  283. isEscaped = !isEscaped;
  284. break;
  285. case '\'':
  286. if (!openDoubleQuote && !openBracket && !isEscaped)
  287. openSingleQuote = !openSingleQuote;
  288. isEscaped = false;
  289. break;
  290. case '"':
  291. if (!openSingleQuote && !openBracket && !isEscaped)
  292. openDoubleQuote = !openDoubleQuote;
  293. isEscaped = false;
  294. break;
  295. case '(':
  296. if (!openBracket && !openSingleQuote && !openDoubleQuote && !isEscaped)
  297. openBracket = true;
  298. isEscaped = false;
  299. break;
  300. case ')':
  301. if (openBracket && !isEscaped)
  302. openBracket = false;
  303. isEscaped = false;
  304. break;
  305. case ';':
  306. if (!isEscaped && !openSingleQuote && !openDoubleQuote && !openBracket)
  307. output = index;
  308. isEscaped = false;
  309. break;
  310. default:
  311. isEscaped = false;
  312. break;
  313. }
  314. if (output !== -1)
  315. break;
  316. index++;
  317. }
  318. return output;
  319. }
  320. function searchNotEscape(text, chars) {
  321. if (chars === void 0) { chars = ['{']; }
  322. if (!Array.isArray(chars))
  323. chars = [chars];
  324. var i = 0;
  325. while (i < text.length) {
  326. if (chars.includes(text.charAt(i)) && text.charAt(i - 1) !== '\\') {
  327. return i;
  328. }
  329. i++;
  330. }
  331. return -1;
  332. }
  333. function splitSelectors(selectors) {
  334. var splitted = [];
  335. var parens = 0;
  336. var angulars = 0;
  337. var soFar = '';
  338. for (var i = 0, len = selectors.length; i < len; i++) {
  339. var char = selectors[i];
  340. if (char === '(') {
  341. parens += 1;
  342. }
  343. else if (char === ')') {
  344. parens -= 1;
  345. }
  346. else if (char === '[') {
  347. angulars += 1;
  348. }
  349. else if (char === ']') {
  350. angulars -= 1;
  351. }
  352. else if (char === ',') {
  353. if (!parens && !angulars) {
  354. splitted.push(soFar.trim());
  355. soFar = '';
  356. continue;
  357. }
  358. }
  359. soFar += char;
  360. }
  361. splitted.push(soFar.trim());
  362. return splitted;
  363. }
  364. function guessClassName(selector) {
  365. var _a;
  366. if (selector.indexOf(',') >= 0) {
  367. var splittedSelectors = splitSelectors(selector);
  368. if (splittedSelectors.length !== 1)
  369. return splittedSelectors.map(function (i) { return guessClassName(i); });
  370. }
  371. // not classes, contains attribute selectors, nested selectors - treat as static
  372. if (selector.charAt(0) !== '.' || searchNotEscape(selector, ['[', '>', '+', '~']) >= 0 || selector.trim().indexOf(' ') >= 0 || searchNotEscape(selector.slice(1), '.') >= 0)
  373. return { selector: selector, isClass: false };
  374. var pseudo = searchNotEscape(selector, ':');
  375. var className = (((_a = selector.match(/^\.([\w-]|(\\\W))+/)) === null || _a === void 0 ? void 0 : _a[0].slice(1)) || '').replace(/\\/g, '');
  376. if (pseudo === -1)
  377. return { selector: className, isClass: true };
  378. return { selector: className, isClass: true, pseudo: selector.slice(pseudo) };
  379. }
  380. function increaseWithUnit(target, delta) {
  381. var _a;
  382. if (typeof target === 'number')
  383. return target + delta;
  384. var value = ((_a = target.match(/^-?[0-9]+\.?[0-9]*/)) === null || _a === void 0 ? void 0 : _a[0]) || '';
  385. var unit = target.slice(value.length);
  386. var result = (parseFloat(value) + delta);
  387. if (Number.isNaN(result))
  388. return target;
  389. return result + unit;
  390. }
  391. function splitColorGroup(color) {
  392. var sep = color.indexOf('/');
  393. if (sep === -1)
  394. return [color, undefined];
  395. return [color.slice(0, sep), color.slice(sep + 1)];
  396. }
  397. var Property = /** @class */ (function () {
  398. function Property(name, value, comment, important) {
  399. if (important === void 0) { important = false; }
  400. this.meta = { type: 'utilities', group: 'plugin', order: 0, offset: 0, corePlugin: false };
  401. this.name = name;
  402. this.value = value;
  403. this.comment = comment;
  404. this.important = important;
  405. }
  406. Property._singleParse = function (css) {
  407. css = css.trim();
  408. if (!css)
  409. return;
  410. if (css.charAt(0) === '@')
  411. return InlineAtRule.parse(css);
  412. var split = css.search(':');
  413. var end = searchPropEnd(css);
  414. if (split === -1)
  415. return;
  416. var important = false;
  417. var prop = css.substring(split + 1, end === -1 ? undefined : end).trim();
  418. if (/!important;?$/.test(prop)) {
  419. important = true;
  420. prop = prop.replace(/!important/, '').trimRight();
  421. }
  422. return new Property(css.substring(0, split).trim(), prop, undefined, important);
  423. };
  424. Property.parse = function (css) {
  425. if (!/;\s*$/.test(css))
  426. css += ';'; // Fix for the situation where the last semicolon is omitted
  427. var properties = [];
  428. var index = 0;
  429. var end = searchPropEnd(css, index);
  430. while (end !== -1) {
  431. var parsed = this._singleParse(css.substring(searchFrom(css, /\S/, index), end + 1));
  432. if (parsed)
  433. properties.push(parsed);
  434. index = end + 1;
  435. end = searchPropEnd(css, index);
  436. }
  437. var count = properties.length;
  438. if (count > 1)
  439. return properties;
  440. if (count === 1)
  441. return properties[0];
  442. };
  443. Property.prototype.clone = function () {
  444. return deepCopy(this);
  445. };
  446. Property.prototype.toStyle = function (selector) {
  447. var style = new Style(selector, this, this.important);
  448. style.meta = this.meta;
  449. return style;
  450. };
  451. Property.prototype.build = function (minify) {
  452. var _this = this;
  453. if (minify === void 0) { minify = false; }
  454. var createProperty = function (name, value) {
  455. if (minify) {
  456. return "".concat(name, ":").concat(value).concat(_this.important ? '!important' : '', ";");
  457. }
  458. else {
  459. var p = "".concat(name, ": ").concat(value).concat(_this.important ? ' !important' : '', ";");
  460. return _this.comment ? p + " /* ".concat(_this.comment, " */") : p;
  461. }
  462. };
  463. if (!this.value)
  464. return '';
  465. return typeof this.name === 'string'
  466. ? createProperty(this.name, this.value)
  467. : this.name
  468. .map(function (i) { return createProperty(i, _this.value); })
  469. .join(minify ? '' : '\n');
  470. };
  471. Property.prototype.updateMeta = function (type, group, order, offset, corePlugin) {
  472. if (offset === void 0) { offset = 0; }
  473. if (corePlugin === void 0) { corePlugin = false; }
  474. this.meta = {
  475. type: type,
  476. group: group,
  477. order: order,
  478. offset: offset,
  479. corePlugin: corePlugin,
  480. };
  481. return this;
  482. };
  483. return Property;
  484. }());
  485. var InlineAtRule = /** @class */ (function (_super) {
  486. __extends(InlineAtRule, _super);
  487. function InlineAtRule(name, value, important) {
  488. if (important === void 0) { important = false; }
  489. var _this = _super.call(this, name, value, undefined, important) || this;
  490. _this.name = name;
  491. return _this;
  492. }
  493. InlineAtRule.parse = function (css) {
  494. var _a;
  495. var matchName = css.match(/@[^\s;{}]+/);
  496. if (matchName) {
  497. var name_1 = matchName[0].substring(1);
  498. var important = false;
  499. var expression = matchName.index !== undefined
  500. ? (_a = css
  501. .substring(matchName.index + name_1.length + 1)
  502. .match(/(?:(['"]).*?\1|[^;])*/)) === null || _a === void 0 ? void 0 : _a[0].trim()
  503. : undefined;
  504. if (expression && /!important;?$/.test(expression)) {
  505. important = true;
  506. expression = expression.replace(/!important/, '').trimRight();
  507. }
  508. return new InlineAtRule(name_1, expression === '' ? undefined : expression, important);
  509. }
  510. };
  511. InlineAtRule.prototype.build = function () {
  512. return this.value
  513. ? "@".concat(this.name, " ").concat(this.value).concat(this.important ? ' !important' : '', ";")
  514. : "@".concat(this.name).concat(this.important ? ' !important' : '', ";");
  515. };
  516. return InlineAtRule;
  517. }(Property));
  518. var Style = /** @class */ (function () {
  519. function Style(selector, property, important) {
  520. if (important === void 0) { important = false; }
  521. this.meta = { type: 'components', group: 'plugin', order: 0, offset: 0, corePlugin: false };
  522. this.selector = selector;
  523. this.important = important;
  524. this.property = toArray(property || []);
  525. }
  526. Object.defineProperty(Style.prototype, "rule", {
  527. get: function () {
  528. var _this = this;
  529. var _a, _b, _c;
  530. var selectors = ((_a = this.selector) !== null && _a !== void 0 ? _a : '').trim().split(/\s*,\s*/g);
  531. this._parentSelectors && (selectors = selectors.map(function (i) { var _a; return "".concat((_a = _this._parentSelectors) === null || _a === void 0 ? void 0 : _a.join(' '), " ").concat(i); }));
  532. ((_b = this._wrapSelectors) !== null && _b !== void 0 ? _b : []).forEach(function (func) { return (selectors = selectors.map(function (i) { return func(i); })); });
  533. this._pseudoClasses && (selectors = selectors.map(function (i) { var _a; return i + ":".concat((_a = _this._pseudoClasses) === null || _a === void 0 ? void 0 : _a.join(':')); }));
  534. this._pseudoElements && (selectors = selectors.map(function (i) { var _a; return i + "::".concat((_a = _this._pseudoElements) === null || _a === void 0 ? void 0 : _a.join('::')); }));
  535. this._brotherSelectors && (selectors = selectors.map(function (i) { var _a; return i + ".".concat((_a = _this._brotherSelectors) === null || _a === void 0 ? void 0 : _a.join('.')); }));
  536. this._childSelectors && (selectors = selectors.map(function (i) { var _a; return i + " ".concat((_a = _this._childSelectors) === null || _a === void 0 ? void 0 : _a.join(' ')); }));
  537. ((_c = this._wrapRules) !== null && _c !== void 0 ? _c : []).forEach(function (func) { return (selectors = selectors.map(function (i) { return func(i); })); });
  538. return selectors.join(', ');
  539. },
  540. enumerable: false,
  541. configurable: true
  542. });
  543. Object.defineProperty(Style.prototype, "pseudoClasses", {
  544. get: function () {
  545. return this._pseudoClasses;
  546. },
  547. enumerable: false,
  548. configurable: true
  549. });
  550. Object.defineProperty(Style.prototype, "pseudoElements", {
  551. get: function () {
  552. return this._pseudoElements;
  553. },
  554. enumerable: false,
  555. configurable: true
  556. });
  557. Object.defineProperty(Style.prototype, "parentSelectors", {
  558. get: function () {
  559. return this._parentSelectors;
  560. },
  561. enumerable: false,
  562. configurable: true
  563. });
  564. Object.defineProperty(Style.prototype, "childSelectors", {
  565. get: function () {
  566. return this._childSelectors;
  567. },
  568. enumerable: false,
  569. configurable: true
  570. });
  571. Object.defineProperty(Style.prototype, "brotherSelectors", {
  572. get: function () {
  573. return this._brotherSelectors;
  574. },
  575. enumerable: false,
  576. configurable: true
  577. });
  578. Object.defineProperty(Style.prototype, "wrapProperties", {
  579. get: function () {
  580. return this._wrapProperties;
  581. },
  582. enumerable: false,
  583. configurable: true
  584. });
  585. Object.defineProperty(Style.prototype, "wrapSelectors", {
  586. get: function () {
  587. return this._wrapSelectors;
  588. },
  589. enumerable: false,
  590. configurable: true
  591. });
  592. Object.defineProperty(Style.prototype, "wrapRules", {
  593. get: function () {
  594. return this._wrapRules;
  595. },
  596. enumerable: false,
  597. configurable: true
  598. });
  599. Object.defineProperty(Style.prototype, "simple", {
  600. get: function () {
  601. // is this style only has property and no wrap?
  602. return !(this.atRules || this._pseudoClasses || this._pseudoElements || this._parentSelectors || this._childSelectors || this._brotherSelectors || this._wrapProperties || this._wrapSelectors || this._wrapRules);
  603. },
  604. enumerable: false,
  605. configurable: true
  606. });
  607. Object.defineProperty(Style.prototype, "isAtrule", {
  608. get: function () {
  609. return !(this.atRules === undefined || this.atRules.length === 0);
  610. },
  611. enumerable: false,
  612. configurable: true
  613. });
  614. Style.generate = function (parent, property, root) {
  615. if (!root)
  616. root = (parent === null || parent === void 0 ? void 0 : parent.startsWith('@'))
  617. ? new Style().atRule(parent)
  618. : new Style(parent);
  619. var output = [];
  620. var _loop_1 = function (key, value) {
  621. var propertyValue = value;
  622. if (Array.isArray(propertyValue) && propertyValue.every(function (e) { return typeof e === 'object'; })) {
  623. propertyValue = Object.assign.apply(Object, __spreadArray([{}], propertyValue, false));
  624. }
  625. if (typeof propertyValue === 'string') {
  626. root.add(new Property(camelToDash(key), propertyValue));
  627. }
  628. else if (Array.isArray(propertyValue)) {
  629. propertyValue.map(function (i) { return root === null || root === void 0 ? void 0 : root.add(new Property(camelToDash(key), i)); });
  630. }
  631. else {
  632. var wrap = deepCopy(root);
  633. wrap.property = [];
  634. var child = void 0;
  635. if (key.startsWith('@')) {
  636. child = wrap.atRule(key, false);
  637. }
  638. else {
  639. if (wrap.selector === undefined) {
  640. wrap.selector = key;
  641. child = wrap;
  642. }
  643. else {
  644. if (/^[a-z]+$/.test(key) && !isTagName(key)) {
  645. wrap.wrapProperty(function (property) { return "".concat(key, "-").concat(property); });
  646. child = wrap;
  647. }
  648. else {
  649. var _hKey_1 = function (selector, key) { return (/&/.test(key) ? key : "& ".concat(key)).replace('&', selector); };
  650. wrap.wrapSelector(function (selector) {
  651. return selector
  652. .trim()
  653. .split(/\s*,\s*/g)
  654. .map(function (s) {
  655. return key
  656. .split(/\s*,\s*/g)
  657. .map(function (i) { return _hKey_1(s, i); })
  658. .join(', ');
  659. })
  660. .join(', ');
  661. });
  662. child = wrap;
  663. }
  664. }
  665. }
  666. output = output.concat(Style.generate(key.startsWith('@') ? undefined : key, propertyValue, child));
  667. }
  668. };
  669. for (var _i = 0, _a = Object.entries(property !== null && property !== void 0 ? property : {}); _i < _a.length; _i++) {
  670. var _b = _a[_i], key = _b[0], value = _b[1];
  671. _loop_1(key, value);
  672. }
  673. if (root.property.length > 0)
  674. output.unshift(root);
  675. return output;
  676. };
  677. Style.prototype.atRule = function (atrule, append) {
  678. if (append === void 0) { append = true; }
  679. if (!atrule)
  680. return this;
  681. if (this.atRules) {
  682. append ? this.atRules.push(atrule) : this.atRules.unshift(atrule);
  683. }
  684. else {
  685. this.atRules = [atrule];
  686. }
  687. return this;
  688. };
  689. Style.prototype.pseudoClass = function (string) {
  690. if (this._pseudoClasses) {
  691. this._pseudoClasses.push(string);
  692. }
  693. else {
  694. this._pseudoClasses = [string];
  695. }
  696. return this;
  697. };
  698. Style.prototype.pseudoElement = function (string) {
  699. if (this._pseudoElements) {
  700. this._pseudoElements.push(string);
  701. }
  702. else {
  703. this._pseudoElements = [string];
  704. }
  705. return this;
  706. };
  707. Style.prototype.brother = function (string) {
  708. if (this._brotherSelectors) {
  709. this._brotherSelectors.push(string);
  710. }
  711. else {
  712. this._brotherSelectors = [string];
  713. }
  714. return this;
  715. };
  716. Style.prototype.parent = function (string) {
  717. if (this._parentSelectors) {
  718. this._parentSelectors.push(string);
  719. }
  720. else {
  721. this._parentSelectors = [string];
  722. }
  723. return this;
  724. };
  725. Style.prototype.child = function (string) {
  726. if (this._childSelectors) {
  727. this._childSelectors.push(string);
  728. }
  729. else {
  730. this._childSelectors = [string];
  731. }
  732. return this;
  733. };
  734. Style.prototype.wrapProperty = function (func) {
  735. if (this._wrapProperties) {
  736. this._wrapProperties.push(func);
  737. }
  738. else {
  739. this._wrapProperties = [func];
  740. }
  741. return this;
  742. };
  743. Style.prototype.wrapSelector = function (func) {
  744. if (this._wrapSelectors) {
  745. this._wrapSelectors.push(func);
  746. }
  747. else {
  748. this._wrapSelectors = [func];
  749. }
  750. return this;
  751. };
  752. Style.prototype.wrapRule = function (func) {
  753. if (this._wrapRules) {
  754. this._wrapRules.push(func);
  755. }
  756. else {
  757. this._wrapRules = [func];
  758. }
  759. return this;
  760. };
  761. Style.prototype.add = function (item) {
  762. item = toArray(item);
  763. if (this.important)
  764. item.forEach(function (i) { return (i.important = true); });
  765. this.property = __spreadArray(__spreadArray([], this.property, true), item, true);
  766. return this;
  767. };
  768. Style.prototype.extend = function (item, onlyProperty, append) {
  769. if (onlyProperty === void 0) { onlyProperty = false; }
  770. if (append === void 0) { append = true; }
  771. if (!item)
  772. return this;
  773. if (item.wrapProperties) {
  774. var props_1 = [];
  775. item.property.forEach(function (p) {
  776. var _a;
  777. var pc = new Property(p.name, p.value, p.comment);
  778. (_a = item.wrapProperties) === null || _a === void 0 ? void 0 : _a.forEach(function (wrap) {
  779. pc.name = Array.isArray(pc.name)
  780. ? pc.name.map(function (i) { return wrap(i); })
  781. : wrap(pc.name);
  782. });
  783. if (item.important)
  784. pc.important = true;
  785. props_1.push(pc);
  786. });
  787. this.property = connectList(this.property, props_1, append);
  788. }
  789. else {
  790. if (item.important)
  791. item.property.forEach(function (i) { return (i.important = true); });
  792. this.property = connectList(this.property, item.property, append);
  793. }
  794. if (onlyProperty)
  795. return this;
  796. item.selector && (this.selector = item.selector);
  797. this.meta = item.meta;
  798. item.atRules &&
  799. (this.atRules = connectList(item.atRules, this.atRules, append)); // atrule is build in reverse
  800. item._brotherSelectors &&
  801. (this._brotherSelectors = connectList(this._brotherSelectors, item._brotherSelectors, append));
  802. item._childSelectors &&
  803. (this._childSelectors = connectList(this._childSelectors, item._childSelectors, append));
  804. item._parentSelectors &&
  805. (this._parentSelectors = connectList(this._parentSelectors, item._parentSelectors, append));
  806. item._pseudoClasses &&
  807. (this._pseudoClasses = connectList(this._pseudoClasses, item._pseudoClasses, append));
  808. item._pseudoElements &&
  809. (this._pseudoElements = connectList(this._pseudoElements, item._pseudoElements, append));
  810. item._wrapRules &&
  811. (this._wrapRules = connectList(this._wrapRules, item._wrapRules, append));
  812. item._wrapSelectors &&
  813. (this._wrapSelectors = connectList(this._wrapSelectors, item._wrapSelectors, append));
  814. return this;
  815. };
  816. Style.prototype.clean = function () {
  817. // remove duplicated property
  818. var property = [];
  819. var cache = [];
  820. this.property.forEach(function (i) {
  821. var inline = i.build();
  822. if (!cache.includes(inline)) {
  823. cache.push(inline);
  824. property.push(i);
  825. }
  826. });
  827. this.property = property;
  828. return this;
  829. };
  830. Style.prototype.flat = function () {
  831. var properties = [];
  832. this.property.forEach(function (p) {
  833. if (Array.isArray(p.name)) {
  834. p.name.forEach(function (i) {
  835. properties.push(new Property(i, p.value, p.comment));
  836. });
  837. }
  838. else {
  839. properties.push(p);
  840. }
  841. });
  842. this.property = properties;
  843. return this;
  844. };
  845. Style.prototype.clone = function (selector, property) {
  846. var newStyle = deepCopy(this);
  847. if (selector)
  848. newStyle.selector = selector;
  849. if (property)
  850. newStyle.property = Array.isArray(property) ? property : [property];
  851. return newStyle;
  852. };
  853. Style.prototype.sort = function () {
  854. // sort property
  855. this.property = this.property.sort(function (a, b) {
  856. return "".concat(a.name).substring(0, 2) > "".concat(b.name).substring(0, 2) ? 1 : -1;
  857. });
  858. return this;
  859. };
  860. Style.prototype.build = function (minify, prefixer) {
  861. var _this = this;
  862. if (minify === void 0) { minify = false; }
  863. if (prefixer === void 0) { prefixer = true; }
  864. var properties = this.property;
  865. if (!prefixer)
  866. properties = properties.filter(function (p) {
  867. if (p.value && /-(webkit|ms|moz|o)-/.test(p.value))
  868. return false;
  869. if (Array.isArray(p.name)) {
  870. p.name = p.name.filter(function (i) { return !/^-(webkit|ms|moz|o)-/.test(i); });
  871. return true;
  872. }
  873. return !/^-(webkit|ms|moz|o)-/.test(p.name);
  874. });
  875. var result = properties.map(function (p) {
  876. if (_this._wrapProperties) {
  877. var name_2 = p.name;
  878. _this._wrapProperties.forEach(function (w) { return (name_2 = Array.isArray(name_2) ? name_2.map(function (n) { return w(n); }) : w(name_2)); });
  879. return new Property(name_2, p.value, p.comment, _this.important ? true : p.important).build(minify);
  880. }
  881. return _this.important ? new Property(p.name, p.value, p.comment, true).build(minify) : p.build(minify);
  882. }).join(minify ? '' : '\n');
  883. if (!this.selector && !this.atRules)
  884. return result.replace(/;}/g, '}');
  885. if (this.selector)
  886. result = (minify ? this.rule.replace(/,\s/g, ',') : this.rule + ' ') + wrapit(result, undefined, undefined, undefined, result !== '' ? minify : true);
  887. if (this.atRules) {
  888. for (var _i = 0, _a = this.atRules; _i < _a.length; _i++) {
  889. var rule = _a[_i];
  890. result = minify ? "".concat(rule.replace(/\s/g, '')).concat(wrapit(result, undefined, undefined, undefined, minify)) : "".concat(rule, " ").concat(wrapit(result, undefined, undefined, undefined, result !== '' ? minify : true));
  891. }
  892. }
  893. return minify ? result.replace(/;}/g, '}') : result;
  894. };
  895. Style.prototype.updateMeta = function (type, group, order, offset, corePlugin, respectSelector) {
  896. if (offset === void 0) { offset = 0; }
  897. if (corePlugin === void 0) { corePlugin = false; }
  898. if (respectSelector === void 0) { respectSelector = false; }
  899. this.meta = {
  900. type: type,
  901. group: group,
  902. order: order,
  903. offset: offset,
  904. corePlugin: corePlugin,
  905. respectSelector: respectSelector,
  906. };
  907. return this;
  908. };
  909. return Style;
  910. }());
  911. /** @class */ ((function (_super) {
  912. __extends(GlobalStyle, _super);
  913. function GlobalStyle(selector, property, important) {
  914. return _super.call(this, selector, property, important) || this;
  915. }
  916. return GlobalStyle;
  917. })(Style));
  918. /** @class */ ((function (_super) {
  919. __extends(Keyframes, _super);
  920. function Keyframes(selector, property, important) {
  921. return _super.call(this, selector, property, important) || this;
  922. }
  923. // root param only for consist with style
  924. // eslint-disable-next-line @typescript-eslint/no-unused-vars
  925. Keyframes.generate = function (name, children, root, prefixer) {
  926. if (prefixer === void 0) { prefixer = true; }
  927. var styles = [];
  928. var webkitStyles = [];
  929. for (var _i = 0, _a = Object.entries(children); _i < _a.length; _i++) {
  930. var _b = _a[_i], key = _b[0], value = _b[1];
  931. var style = new Keyframes(key).atRule("@keyframes ".concat(name));
  932. var webkitStyle = new Keyframes(key).atRule("@-webkit-keyframes ".concat(name));
  933. for (var _c = 0, _d = Object.entries(value); _c < _d.length; _c++) {
  934. var _e = _d[_c], pkey = _e[0], pvalue = _e[1];
  935. var prop = pkey;
  936. if (pkey === 'transform') {
  937. prop = prefixer ? ['-webkit-transform', 'transform'] : 'transform';
  938. }
  939. else if (['animationTimingFunction', 'animation-timing-function'].includes(pkey)) {
  940. prop = prefixer ? [
  941. '-webkit-animation-timing-function',
  942. 'animation-timing-function',
  943. ] : 'animation-timing-function';
  944. }
  945. style.add(new Property(prop, pvalue));
  946. webkitStyle.add(new Property(prop, pvalue));
  947. }
  948. styles.push(style);
  949. if (prefixer)
  950. webkitStyles.push(webkitStyle);
  951. }
  952. return __spreadArray(__spreadArray([], styles, true), webkitStyles, true);
  953. };
  954. return Keyframes;
  955. })(Style));
  956. /** @class */ ((function (_super) {
  957. __extends(Container, _super);
  958. function Container(selector, property, important) {
  959. return _super.call(this, selector, property, important) || this;
  960. }
  961. return Container;
  962. })(Style));
  963. function isString(value) {
  964. return typeof value === 'string';
  965. }
  966. function negative$1(scale) {
  967. return Object.keys(scale)
  968. .filter(function (key) { return scale[key] !== '0'; })
  969. .reduce(function (negativeScale, key) {
  970. var _a;
  971. return (__assign(__assign({}, negativeScale), (_a = {}, _a["-".concat(key)] = negateValue(scale[key]), _a)));
  972. }, {});
  973. }
  974. function breakpoints(screens) {
  975. if (screens === void 0) { screens = {}; }
  976. return Object.keys(screens)
  977. .filter(function (key) { return typeof screens[key] === 'string'; })
  978. .reduce(function (breakpoints, key) {
  979. var _a;
  980. return (__assign(__assign({}, breakpoints), (_a = {}, _a["screen-".concat(key)] = screens[key], _a)));
  981. }, {});
  982. }
  983. function generateFontSize(font) {
  984. if (typeof font === 'string')
  985. return [new Property('font-size', font)];
  986. var properties = [];
  987. if (font[0])
  988. properties.push(new Property('font-size', font[0]));
  989. if (typeof font[1] === 'string') {
  990. properties.push(new Property('line-height', font[1]));
  991. }
  992. else if (font[1]) {
  993. if (font[1].lineHeight)
  994. properties.push(new Property('line-height', font[1].lineHeight));
  995. if (font[1].letterSpacing)
  996. properties.push(new Property('letter-spacing', font[1].letterSpacing));
  997. }
  998. return properties;
  999. }
  1000. function expandDirection(value, divide) {
  1001. if (divide === void 0) { divide = false; }
  1002. var map = {
  1003. '': ['*'],
  1004. y: ['top', 'bottom'],
  1005. x: ['left', 'right'],
  1006. t: divide ? ['top-left', 'top-right'] : ['top'],
  1007. r: divide ? ['top-right', 'bottom-right'] : ['right'],
  1008. b: divide ? ['bottom-right', 'bottom-left'] : ['bottom'],
  1009. l: divide ? ['top-left', 'bottom-left'] : ['left'],
  1010. tl: ['top-left'],
  1011. tr: ['top-right'],
  1012. br: ['bottom-right'],
  1013. bl: ['bottom-left'],
  1014. };
  1015. if (value in map)
  1016. return map[value];
  1017. }
  1018. function generatePlaceholder(selector, property, prefixer) {
  1019. if (prefixer === void 0) { prefixer = false; }
  1020. if (!prefixer)
  1021. return [new Style(selector, property).pseudoElement('placeholder')];
  1022. return [
  1023. new Style(selector, property).pseudoElement('-webkit-input-placeholder'),
  1024. new Style(selector, property).pseudoElement('-moz-placeholder'),
  1025. new Style(selector, property).pseudoClass('-ms-input-placeholder'),
  1026. new Style(selector, property).pseudoElement('-ms-input-placeholder'),
  1027. new Style(selector, property).pseudoElement('placeholder'),
  1028. ];
  1029. }
  1030. function toDarkStyle(style, mode) {
  1031. if (!mode)
  1032. return style;
  1033. if (Array.isArray(style)) {
  1034. if (mode === 'media')
  1035. return style.map(function (i) { return new Style().atRule('@media (prefers-color-scheme: dark)').extend(i); });
  1036. return style.map(function (i) { return new Style().parent('.dark').extend(i); });
  1037. }
  1038. if (mode === 'media')
  1039. return new Style().atRule('@media (prefers-color-scheme: dark)').extend(style);
  1040. return new Style().parent('.dark').extend(style);
  1041. }
  1042. var colorString$1 = {exports: {}};
  1043. var colorName = {
  1044. "aliceblue": [240, 248, 255],
  1045. "antiquewhite": [250, 235, 215],
  1046. "aqua": [0, 255, 255],
  1047. "aquamarine": [127, 255, 212],
  1048. "azure": [240, 255, 255],
  1049. "beige": [245, 245, 220],
  1050. "bisque": [255, 228, 196],
  1051. "black": [0, 0, 0],
  1052. "blanchedalmond": [255, 235, 205],
  1053. "blue": [0, 0, 255],
  1054. "blueviolet": [138, 43, 226],
  1055. "brown": [165, 42, 42],
  1056. "burlywood": [222, 184, 135],
  1057. "cadetblue": [95, 158, 160],
  1058. "chartreuse": [127, 255, 0],
  1059. "chocolate": [210, 105, 30],
  1060. "coral": [255, 127, 80],
  1061. "cornflowerblue": [100, 149, 237],
  1062. "cornsilk": [255, 248, 220],
  1063. "crimson": [220, 20, 60],
  1064. "cyan": [0, 255, 255],
  1065. "darkblue": [0, 0, 139],
  1066. "darkcyan": [0, 139, 139],
  1067. "darkgoldenrod": [184, 134, 11],
  1068. "darkgray": [169, 169, 169],
  1069. "darkgreen": [0, 100, 0],
  1070. "darkgrey": [169, 169, 169],
  1071. "darkkhaki": [189, 183, 107],
  1072. "darkmagenta": [139, 0, 139],
  1073. "darkolivegreen": [85, 107, 47],
  1074. "darkorange": [255, 140, 0],
  1075. "darkorchid": [153, 50, 204],
  1076. "darkred": [139, 0, 0],
  1077. "darksalmon": [233, 150, 122],
  1078. "darkseagreen": [143, 188, 143],
  1079. "darkslateblue": [72, 61, 139],
  1080. "darkslategray": [47, 79, 79],
  1081. "darkslategrey": [47, 79, 79],
  1082. "darkturquoise": [0, 206, 209],
  1083. "darkviolet": [148, 0, 211],
  1084. "deeppink": [255, 20, 147],
  1085. "deepskyblue": [0, 191, 255],
  1086. "dimgray": [105, 105, 105],
  1087. "dimgrey": [105, 105, 105],
  1088. "dodgerblue": [30, 144, 255],
  1089. "firebrick": [178, 34, 34],
  1090. "floralwhite": [255, 250, 240],
  1091. "forestgreen": [34, 139, 34],
  1092. "fuchsia": [255, 0, 255],
  1093. "gainsboro": [220, 220, 220],
  1094. "ghostwhite": [248, 248, 255],
  1095. "gold": [255, 215, 0],
  1096. "goldenrod": [218, 165, 32],
  1097. "gray": [128, 128, 128],
  1098. "green": [0, 128, 0],
  1099. "greenyellow": [173, 255, 47],
  1100. "grey": [128, 128, 128],
  1101. "honeydew": [240, 255, 240],
  1102. "hotpink": [255, 105, 180],
  1103. "indianred": [205, 92, 92],
  1104. "indigo": [75, 0, 130],
  1105. "ivory": [255, 255, 240],
  1106. "khaki": [240, 230, 140],
  1107. "lavender": [230, 230, 250],
  1108. "lavenderblush": [255, 240, 245],
  1109. "lawngreen": [124, 252, 0],
  1110. "lemonchiffon": [255, 250, 205],
  1111. "lightblue": [173, 216, 230],
  1112. "lightcoral": [240, 128, 128],
  1113. "lightcyan": [224, 255, 255],
  1114. "lightgoldenrodyellow": [250, 250, 210],
  1115. "lightgray": [211, 211, 211],
  1116. "lightgreen": [144, 238, 144],
  1117. "lightgrey": [211, 211, 211],
  1118. "lightpink": [255, 182, 193],
  1119. "lightsalmon": [255, 160, 122],
  1120. "lightseagreen": [32, 178, 170],
  1121. "lightskyblue": [135, 206, 250],
  1122. "lightslategray": [119, 136, 153],
  1123. "lightslategrey": [119, 136, 153],
  1124. "lightsteelblue": [176, 196, 222],
  1125. "lightyellow": [255, 255, 224],
  1126. "lime": [0, 255, 0],
  1127. "limegreen": [50, 205, 50],
  1128. "linen": [250, 240, 230],
  1129. "magenta": [255, 0, 255],
  1130. "maroon": [128, 0, 0],
  1131. "mediumaquamarine": [102, 205, 170],
  1132. "mediumblue": [0, 0, 205],
  1133. "mediumorchid": [186, 85, 211],
  1134. "mediumpurple": [147, 112, 219],
  1135. "mediumseagreen": [60, 179, 113],
  1136. "mediumslateblue": [123, 104, 238],
  1137. "mediumspringgreen": [0, 250, 154],
  1138. "mediumturquoise": [72, 209, 204],
  1139. "mediumvioletred": [199, 21, 133],
  1140. "midnightblue": [25, 25, 112],
  1141. "mintcream": [245, 255, 250],
  1142. "mistyrose": [255, 228, 225],
  1143. "moccasin": [255, 228, 181],
  1144. "navajowhite": [255, 222, 173],
  1145. "navy": [0, 0, 128],
  1146. "oldlace": [253, 245, 230],
  1147. "olive": [128, 128, 0],
  1148. "olivedrab": [107, 142, 35],
  1149. "orange": [255, 165, 0],
  1150. "orangered": [255, 69, 0],
  1151. "orchid": [218, 112, 214],
  1152. "palegoldenrod": [238, 232, 170],
  1153. "palegreen": [152, 251, 152],
  1154. "paleturquoise": [175, 238, 238],
  1155. "palevioletred": [219, 112, 147],
  1156. "papayawhip": [255, 239, 213],
  1157. "peachpuff": [255, 218, 185],
  1158. "peru": [205, 133, 63],
  1159. "pink": [255, 192, 203],
  1160. "plum": [221, 160, 221],
  1161. "powderblue": [176, 224, 230],
  1162. "purple": [128, 0, 128],
  1163. "rebeccapurple": [102, 51, 153],
  1164. "red": [255, 0, 0],
  1165. "rosybrown": [188, 143, 143],
  1166. "royalblue": [65, 105, 225],
  1167. "saddlebrown": [139, 69, 19],
  1168. "salmon": [250, 128, 114],
  1169. "sandybrown": [244, 164, 96],
  1170. "seagreen": [46, 139, 87],
  1171. "seashell": [255, 245, 238],
  1172. "sienna": [160, 82, 45],
  1173. "silver": [192, 192, 192],
  1174. "skyblue": [135, 206, 235],
  1175. "slateblue": [106, 90, 205],
  1176. "slategray": [112, 128, 144],
  1177. "slategrey": [112, 128, 144],
  1178. "snow": [255, 250, 250],
  1179. "springgreen": [0, 255, 127],
  1180. "steelblue": [70, 130, 180],
  1181. "tan": [210, 180, 140],
  1182. "teal": [0, 128, 128],
  1183. "thistle": [216, 191, 216],
  1184. "tomato": [255, 99, 71],
  1185. "turquoise": [64, 224, 208],
  1186. "violet": [238, 130, 238],
  1187. "wheat": [245, 222, 179],
  1188. "white": [255, 255, 255],
  1189. "whitesmoke": [245, 245, 245],
  1190. "yellow": [255, 255, 0],
  1191. "yellowgreen": [154, 205, 50]
  1192. };
  1193. var simpleSwizzle = {exports: {}};
  1194. var isArrayish$1 = function isArrayish(obj) {
  1195. if (!obj || typeof obj === 'string') {
  1196. return false;
  1197. }
  1198. return obj instanceof Array || Array.isArray(obj) ||
  1199. (obj.length >= 0 && (obj.splice instanceof Function ||
  1200. (Object.getOwnPropertyDescriptor(obj, (obj.length - 1)) && obj.constructor.name !== 'String')));
  1201. };
  1202. var isArrayish = isArrayish$1;
  1203. var concat = Array.prototype.concat;
  1204. var slice = Array.prototype.slice;
  1205. var swizzle$1 = simpleSwizzle.exports = function swizzle(args) {
  1206. var results = [];
  1207. for (var i = 0, len = args.length; i < len; i++) {
  1208. var arg = args[i];
  1209. if (isArrayish(arg)) {
  1210. // http://jsperf.com/javascript-array-concat-vs-push/98
  1211. results = concat.call(results, slice.call(arg));
  1212. } else {
  1213. results.push(arg);
  1214. }
  1215. }
  1216. return results;
  1217. };
  1218. swizzle$1.wrap = function (fn) {
  1219. return function () {
  1220. return fn(swizzle$1(arguments));
  1221. };
  1222. };
  1223. /* MIT license */
  1224. var colorNames = colorName;
  1225. var swizzle = simpleSwizzle.exports;
  1226. var hasOwnProperty = Object.hasOwnProperty;
  1227. var reverseNames = {};
  1228. // create a list of reverse color names
  1229. for (var name in colorNames) {
  1230. if (hasOwnProperty.call(colorNames, name)) {
  1231. reverseNames[colorNames[name]] = name;
  1232. }
  1233. }
  1234. var cs = colorString$1.exports = {
  1235. to: {},
  1236. get: {}
  1237. };
  1238. cs.get = function (string) {
  1239. var prefix = string.substring(0, 3).toLowerCase();
  1240. var val;
  1241. var model;
  1242. switch (prefix) {
  1243. case 'hsl':
  1244. val = cs.get.hsl(string);
  1245. model = 'hsl';
  1246. break;
  1247. case 'hwb':
  1248. val = cs.get.hwb(string);
  1249. model = 'hwb';
  1250. break;
  1251. default:
  1252. val = cs.get.rgb(string);
  1253. model = 'rgb';
  1254. break;
  1255. }
  1256. if (!val) {
  1257. return null;
  1258. }
  1259. return {model: model, value: val};
  1260. };
  1261. cs.get.rgb = function (string) {
  1262. if (!string) {
  1263. return null;
  1264. }
  1265. var abbr = /^#([a-f0-9]{3,4})$/i;
  1266. var hex = /^#([a-f0-9]{6})([a-f0-9]{2})?$/i;
  1267. var rgba = /^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/;
  1268. var per = /^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/;
  1269. var keyword = /^(\w+)$/;
  1270. var rgb = [0, 0, 0, 1];
  1271. var match;
  1272. var i;
  1273. var hexAlpha;
  1274. if (match = string.match(hex)) {
  1275. hexAlpha = match[2];
  1276. match = match[1];
  1277. for (i = 0; i < 3; i++) {
  1278. // https://jsperf.com/slice-vs-substr-vs-substring-methods-long-string/19
  1279. var i2 = i * 2;
  1280. rgb[i] = parseInt(match.slice(i2, i2 + 2), 16);
  1281. }
  1282. if (hexAlpha) {
  1283. rgb[3] = parseInt(hexAlpha, 16) / 255;
  1284. }
  1285. } else if (match = string.match(abbr)) {
  1286. match = match[1];
  1287. hexAlpha = match[3];
  1288. for (i = 0; i < 3; i++) {
  1289. rgb[i] = parseInt(match[i] + match[i], 16);
  1290. }
  1291. if (hexAlpha) {
  1292. rgb[3] = parseInt(hexAlpha + hexAlpha, 16) / 255;
  1293. }
  1294. } else if (match = string.match(rgba)) {
  1295. for (i = 0; i < 3; i++) {
  1296. rgb[i] = parseInt(match[i + 1], 0);
  1297. }
  1298. if (match[4]) {
  1299. if (match[5]) {
  1300. rgb[3] = parseFloat(match[4]) * 0.01;
  1301. } else {
  1302. rgb[3] = parseFloat(match[4]);
  1303. }
  1304. }
  1305. } else if (match = string.match(per)) {
  1306. for (i = 0; i < 3; i++) {
  1307. rgb[i] = Math.round(parseFloat(match[i + 1]) * 2.55);
  1308. }
  1309. if (match[4]) {
  1310. if (match[5]) {
  1311. rgb[3] = parseFloat(match[4]) * 0.01;
  1312. } else {
  1313. rgb[3] = parseFloat(match[4]);
  1314. }
  1315. }
  1316. } else if (match = string.match(keyword)) {
  1317. if (match[1] === 'transparent') {
  1318. return [0, 0, 0, 0];
  1319. }
  1320. if (!hasOwnProperty.call(colorNames, match[1])) {
  1321. return null;
  1322. }
  1323. rgb = colorNames[match[1]];
  1324. rgb[3] = 1;
  1325. return rgb;
  1326. } else {
  1327. return null;
  1328. }
  1329. for (i = 0; i < 3; i++) {
  1330. rgb[i] = clamp(rgb[i], 0, 255);
  1331. }
  1332. rgb[3] = clamp(rgb[3], 0, 1);
  1333. return rgb;
  1334. };
  1335. cs.get.hsl = function (string) {
  1336. if (!string) {
  1337. return null;
  1338. }
  1339. var hsl = /^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/;
  1340. var match = string.match(hsl);
  1341. if (match) {
  1342. var alpha = parseFloat(match[4]);
  1343. var h = ((parseFloat(match[1]) % 360) + 360) % 360;
  1344. var s = clamp(parseFloat(match[2]), 0, 100);
  1345. var l = clamp(parseFloat(match[3]), 0, 100);
  1346. var a = clamp(isNaN(alpha) ? 1 : alpha, 0, 1);
  1347. return [h, s, l, a];
  1348. }
  1349. return null;
  1350. };
  1351. cs.get.hwb = function (string) {
  1352. if (!string) {
  1353. return null;
  1354. }
  1355. var hwb = /^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/;
  1356. var match = string.match(hwb);
  1357. if (match) {
  1358. var alpha = parseFloat(match[4]);
  1359. var h = ((parseFloat(match[1]) % 360) + 360) % 360;
  1360. var w = clamp(parseFloat(match[2]), 0, 100);
  1361. var b = clamp(parseFloat(match[3]), 0, 100);
  1362. var a = clamp(isNaN(alpha) ? 1 : alpha, 0, 1);
  1363. return [h, w, b, a];
  1364. }
  1365. return null;
  1366. };
  1367. cs.to.hex = function () {
  1368. var rgba = swizzle(arguments);
  1369. return (
  1370. '#' +
  1371. hexDouble(rgba[0]) +
  1372. hexDouble(rgba[1]) +
  1373. hexDouble(rgba[2]) +
  1374. (rgba[3] < 1
  1375. ? (hexDouble(Math.round(rgba[3] * 255)))
  1376. : '')
  1377. );
  1378. };
  1379. cs.to.rgb = function () {
  1380. var rgba = swizzle(arguments);
  1381. return rgba.length < 4 || rgba[3] === 1
  1382. ? 'rgb(' + Math.round(rgba[0]) + ', ' + Math.round(rgba[1]) + ', ' + Math.round(rgba[2]) + ')'
  1383. : 'rgba(' + Math.round(rgba[0]) + ', ' + Math.round(rgba[1]) + ', ' + Math.round(rgba[2]) + ', ' + rgba[3] + ')';
  1384. };
  1385. cs.to.rgb.percent = function () {
  1386. var rgba = swizzle(arguments);
  1387. var r = Math.round(rgba[0] / 255 * 100);
  1388. var g = Math.round(rgba[1] / 255 * 100);
  1389. var b = Math.round(rgba[2] / 255 * 100);
  1390. return rgba.length < 4 || rgba[3] === 1
  1391. ? 'rgb(' + r + '%, ' + g + '%, ' + b + '%)'
  1392. : 'rgba(' + r + '%, ' + g + '%, ' + b + '%, ' + rgba[3] + ')';
  1393. };
  1394. cs.to.hsl = function () {
  1395. var hsla = swizzle(arguments);
  1396. return hsla.length < 4 || hsla[3] === 1
  1397. ? 'hsl(' + hsla[0] + ', ' + hsla[1] + '%, ' + hsla[2] + '%)'
  1398. : 'hsla(' + hsla[0] + ', ' + hsla[1] + '%, ' + hsla[2] + '%, ' + hsla[3] + ')';
  1399. };
  1400. // hwb is a bit different than rgb(a) & hsl(a) since there is no alpha specific syntax
  1401. // (hwb have alpha optional & 1 is default value)
  1402. cs.to.hwb = function () {
  1403. var hwba = swizzle(arguments);
  1404. var a = '';
  1405. if (hwba.length >= 4 && hwba[3] !== 1) {
  1406. a = ', ' + hwba[3];
  1407. }
  1408. return 'hwb(' + hwba[0] + ', ' + hwba[1] + '%, ' + hwba[2] + '%' + a + ')';
  1409. };
  1410. cs.to.keyword = function (rgb) {
  1411. return reverseNames[rgb.slice(0, 3)];
  1412. };
  1413. // helpers
  1414. function clamp(num, min, max) {
  1415. return Math.min(Math.max(min, num), max);
  1416. }
  1417. function hexDouble(num) {
  1418. var str = Math.round(num).toString(16).toUpperCase();
  1419. return (str.length < 2) ? '0' + str : str;
  1420. }
  1421. var colorString = colorString$1.exports;
  1422. function hsl2rgb(h, s, l) {
  1423. l /= 100;
  1424. if (h >= 360)
  1425. h %= 360;
  1426. var c = (1 - Math.abs(2 * l - 1)) * (s / 100);
  1427. var x = c * (1 - Math.abs((h / 60) % 2 - 1));
  1428. var m = l - c / 2;
  1429. var r = 0;
  1430. var g = 0;
  1431. var b = 0;
  1432. if (0 <= h && h < 60) {
  1433. r = c + m;
  1434. g = x + m;
  1435. b = m;
  1436. }
  1437. else if (60 <= h && h < 120) {
  1438. r = x + m;
  1439. g = c + m;
  1440. b = m;
  1441. }
  1442. else if (120 <= h && h < 180) {
  1443. r = m;
  1444. g = c + m;
  1445. b = x + m;
  1446. }
  1447. else if (180 <= h && h < 240) {
  1448. r = m;
  1449. g = x + m;
  1450. b = c + m;
  1451. }
  1452. else if (240 <= h && h < 300) {
  1453. r = x + m;
  1454. g = m;
  1455. b = c + m;
  1456. }
  1457. else if (300 <= h && h < 360) {
  1458. r = c + m;
  1459. g = m;
  1460. b = x + m;
  1461. }
  1462. return [
  1463. Math.round(r * 255),
  1464. Math.round(g * 255),
  1465. Math.round(b * 255),
  1466. ];
  1467. }
  1468. function hwb2rgb(h, w, b) {
  1469. var rgb = hsl2rgb(h, 100, 50);
  1470. for (var i = 0; i < 3; ++i) {
  1471. var c = rgb[i] / 255;
  1472. c *= 1 - w / 100 - b / 100;
  1473. c += w / 100;
  1474. rgb[i] = Math.round(c * 255);
  1475. }
  1476. return rgb;
  1477. }
  1478. function toRGBA(color) {
  1479. var _a;
  1480. if (/^hsla?/.test(color)) {
  1481. var color_array = colorString.get.hsl(color);
  1482. if (!color_array)
  1483. return;
  1484. return __spreadArray(__spreadArray([], hsl2rgb(color_array[0], color_array[1], color_array[2]), true), [color_array[3]], false);
  1485. }
  1486. else if (/^rgba?/.test(color)) {
  1487. var color_array = colorString.get.rgb(color);
  1488. if (!color_array)
  1489. return;
  1490. return color_array;
  1491. }
  1492. else if (color.startsWith('hwb')) {
  1493. var color_array = colorString.get.hwb(color);
  1494. if (!color_array)
  1495. return;
  1496. return __spreadArray(__spreadArray([], hwb2rgb(color_array[0], color_array[1], color_array[2]), true), [color_array[3]], false);
  1497. }
  1498. return (_a = colorString.get(color)) === null || _a === void 0 ? void 0 : _a.value;
  1499. }
  1500. function toRGB(color) {
  1501. var rgba = toRGBA(color);
  1502. if (!rgba)
  1503. return;
  1504. rgba.pop();
  1505. return rgba;
  1506. }
  1507. function toColor(color_string) {
  1508. var rgba = toRGBA(color_string);
  1509. var color = rgba ? rgba.slice(0, 3).join(', ') : color_string;
  1510. var opacity = rgba ? rgba[3].toString() : '1';
  1511. return { color: color, opacity: opacity };
  1512. }
  1513. var utilities = {
  1514. // Layout
  1515. columns: [
  1516. 'columns-${static}',
  1517. 'columns-${float}',
  1518. 'columns-${size}',
  1519. 'columns-${int}xl',
  1520. ],
  1521. container: [
  1522. 'container',
  1523. ],
  1524. objectPosition: [
  1525. 'object-${static}',
  1526. ],
  1527. inset: [
  1528. 'inset-${static}',
  1529. 'inset-${float}',
  1530. 'inset-${fraction}',
  1531. 'inset-${size}',
  1532. 'inset-y-${static}',
  1533. 'inset-y-${float}',
  1534. 'inset-y-${fraction}',
  1535. 'inset-y-${size}',
  1536. 'inset-x-${static}',
  1537. 'inset-x-${float}',
  1538. 'inset-x-${fraction}',
  1539. 'inset-x-${size}',
  1540. 'top-${static}',
  1541. 'top-${float}',
  1542. 'top-${fraction}',
  1543. 'top-${size}',
  1544. 'right-${static}',
  1545. 'right-${float}',
  1546. 'right-${fraction}',
  1547. 'right-${size}',
  1548. 'bottom-${static}',
  1549. 'bottom-${float}',
  1550. 'bottom-${fraction}',
  1551. 'bottom-${size}',
  1552. 'left-${static}',
  1553. 'left-${float}',
  1554. 'left-${fraction}',
  1555. 'left-${size}',
  1556. ],
  1557. zIndex: [
  1558. 'z-${static}',
  1559. 'z-${int}',
  1560. ],
  1561. // Flexbox
  1562. flex: [
  1563. 'flex-${static}',
  1564. ],
  1565. flexGrow: [
  1566. 'flex-grow-${static}',
  1567. ],
  1568. flexShrink: [
  1569. 'flex-shrink-${static}',
  1570. ],
  1571. order: [
  1572. 'order-${static}',
  1573. 'order-${int}',
  1574. ],
  1575. // Grid
  1576. gridTemplateColumns: [
  1577. 'grid-cols-${static}',
  1578. 'grid-cols-${int}',
  1579. ],
  1580. gridTemplateRows: [
  1581. 'grid-rows-${static}',
  1582. 'grid-rows-${int}',
  1583. ],
  1584. gridColumn: [
  1585. 'col-${static}',
  1586. 'col-span-${int}',
  1587. ],
  1588. gridColumnEnd: [
  1589. 'col-end-${static}',
  1590. 'col-end-${int}',
  1591. ],
  1592. gridColumnStart: [
  1593. 'col-start-${static}',
  1594. 'col-start-${int}',
  1595. ],
  1596. gridRow: [
  1597. 'row-${static}',
  1598. 'row-span-${int}',
  1599. ],
  1600. gridRowEnd: [
  1601. 'row-end-${static}',
  1602. 'row-end-${int}',
  1603. ],
  1604. gridRowStart: [
  1605. 'row-start-${static}',
  1606. 'row-start-${int}',
  1607. ],
  1608. gap: [
  1609. 'gap-${static}',
  1610. 'gap-x-${static}',
  1611. 'gap-y-${static}',
  1612. 'gap-${float}',
  1613. 'gap-x-${float}',
  1614. 'gap-y-${float}',
  1615. 'gap-${size}',
  1616. 'gap-x-${size}',
  1617. 'gap-y-${size}',
  1618. ],
  1619. // Box Alignment
  1620. // Spacing
  1621. padding: [
  1622. 'p-${static}',
  1623. 'py-${static}',
  1624. 'px-${static}',
  1625. 'pt-${static}',
  1626. 'pr-${static}',
  1627. 'pb-${static}',
  1628. 'pl-${static}',
  1629. 'p-${float}',
  1630. 'py-${float}',
  1631. 'px-${float}',
  1632. 'pt-${float}',
  1633. 'pr-${float}',
  1634. 'pb-${float}',
  1635. 'pl-${float}',
  1636. 'p-${size}',
  1637. 'py-${size}',
  1638. 'px-${size}',
  1639. 'pt-${size}',
  1640. 'pr-${size}',
  1641. 'pb-${size}',
  1642. 'pl-${size}',
  1643. ],
  1644. margin: [
  1645. 'm-${static}',
  1646. 'my-${static}',
  1647. 'mx-${static}',
  1648. 'mt-${static}',
  1649. 'mr-${static}',
  1650. 'mb-${static}',
  1651. 'ml-${static}',
  1652. 'm-${float}',
  1653. 'my-${float}',
  1654. 'mx-${float}',
  1655. 'mt-${float}',
  1656. 'mr-${float}',
  1657. 'mb-${float}',
  1658. 'ml-${float}',
  1659. 'm-${size}',
  1660. 'my-${size}',
  1661. 'mx-${size}',
  1662. 'mt-${size}',
  1663. 'mr-${size}',
  1664. 'mb-${size}',
  1665. 'ml-${size}',
  1666. ],
  1667. space: [
  1668. 'space-y-${static}',
  1669. 'space-y-reverse',
  1670. 'space-x-${static}',
  1671. 'space-x-reverse',
  1672. 'space-y-${float}',
  1673. 'space-x-${float}',
  1674. ],
  1675. width: [
  1676. 'w-${static}',
  1677. 'w-${float}',
  1678. 'w-${fraction}',
  1679. 'w-${int}xl',
  1680. 'w-${size}',
  1681. ],
  1682. minWidth: [
  1683. 'min-w-${static}',
  1684. 'min-w-${float}',
  1685. 'min-w-${fraction}',
  1686. 'min-w-${int}xl',
  1687. 'min-w-${size}',
  1688. ],
  1689. maxWidth: [
  1690. 'max-w-${static}',
  1691. 'max-w-${float}',
  1692. 'max-w-${fraction}',
  1693. 'max-w-${int}xl',
  1694. 'max-w-${size}',
  1695. ],
  1696. height: [
  1697. 'h-${static}',
  1698. 'h-${float}',
  1699. 'h-${fraction}',
  1700. 'h-${int}xl',
  1701. 'h-${size}',
  1702. ],
  1703. minHeight: [
  1704. 'min-h-${static}',
  1705. 'min-h-${float}',
  1706. 'min-h-${fraction}',
  1707. 'min-h-${int}xl',
  1708. 'min-h-${size}',
  1709. ],
  1710. maxHeight: [
  1711. 'max-h-${static}',
  1712. 'max-h-${float}',
  1713. 'max-h-${fraction}',
  1714. 'max-h-${int}xl',
  1715. 'max-h-${size}',
  1716. ],
  1717. // Typography
  1718. fontSize: [
  1719. 'text-${static}',
  1720. 'text-${int}xl',
  1721. ],
  1722. textOpacity: [
  1723. 'text-opacity-${static}',
  1724. 'text-opacity-${int<=100}',
  1725. ],
  1726. textColor: [
  1727. 'text-${color}',
  1728. ],
  1729. fontFamily: [
  1730. 'font-${static}',
  1731. ],
  1732. fontWeight: [
  1733. 'font-${static}',
  1734. 'font-${int}',
  1735. ],
  1736. letterSpacing: [
  1737. 'tracking-${static}',
  1738. 'tracking-${size}',
  1739. ],
  1740. lineHeight: [
  1741. 'leading-${static}',
  1742. 'leading-${int}',
  1743. 'leading-${size}',
  1744. ],
  1745. listStyleType: [
  1746. 'list-${static}',
  1747. ],
  1748. placeholderColor: [
  1749. 'placeholder-${color}',
  1750. ],
  1751. placeholderOpacity: [
  1752. 'placeholder-opacity-${static}',
  1753. 'placeholder-opacity-${int<=100}',
  1754. ],
  1755. // Backgrounds
  1756. backgroundColor: [
  1757. 'bg-${color}',
  1758. ],
  1759. backgroundOpacity: [
  1760. 'bg-opacity-${static}',
  1761. 'bg-opacity-${int<=100}',
  1762. ],
  1763. backgroundPosition: [
  1764. 'bg-${static}',
  1765. ],
  1766. backgroundSize: [
  1767. 'bg-${static}',
  1768. ],
  1769. backgroundImage: [
  1770. 'bg-${static}',
  1771. ],
  1772. gradientColorStops: [
  1773. 'from-${color}',
  1774. 'via-${color}',
  1775. 'to-${color}',
  1776. ],
  1777. // Borders
  1778. borderRadius: [
  1779. 'rounded-${static}',
  1780. 'rounded-t-${static}',
  1781. 'rounded-l-${static}',
  1782. 'rounded-r-${static}',
  1783. 'rounded-b-${static}',
  1784. 'rounded-tl-${static}',
  1785. 'rounded-tr-${static}',
  1786. 'rounded-br-${static}',
  1787. 'rounded-bl-${static}',
  1788. 'rounded-${int}xl',
  1789. 'rounded-${size}',
  1790. 'rounded-t-${int}xl',
  1791. 'rounded-t-${size}',
  1792. 'rounded-l-${int}xl',
  1793. 'rounded-l-${size}',
  1794. 'rounded-r-${int}xl',
  1795. 'rounded-r-${size}',
  1796. 'rounded-b-${int}xl',
  1797. 'rounded-b-${size}',
  1798. 'rounded-tl-${int}xl',
  1799. 'rounded-tl-${size}',
  1800. 'rounded-tr-${int}xl',
  1801. 'rounded-tr-${size}',
  1802. 'rounded-br-${int}xl',
  1803. 'rounded-br-${size}',
  1804. 'rounded-bl-${int}xl',
  1805. 'rounded-bl-${size}',
  1806. ],
  1807. borderWidth: [
  1808. 'border-${static}',
  1809. 'border-${int}',
  1810. 'border-${size}',
  1811. 'border-t-${int}',
  1812. 'border-t-${size}',
  1813. 'border-r-${int}',
  1814. 'border-r-${size}',
  1815. 'border-b-${int}',
  1816. 'border-b-${size}',
  1817. 'border-l-${int}',
  1818. 'border-l-${size}',
  1819. 'border-x-${int}',
  1820. 'border-x-${size}',
  1821. 'border-y-${int}',
  1822. 'border-y-${size}',
  1823. ],
  1824. borderColor: [
  1825. 'border-${color}',
  1826. ],
  1827. borderOpacity: [
  1828. 'border-opacity-${static}',
  1829. 'border-opacity-${int<=100}',
  1830. ],
  1831. divideWidth: [
  1832. 'divide-y-reverse',
  1833. 'divide-x-reverse',
  1834. 'divide-y-${int}',
  1835. 'divide-x-${int}',
  1836. ],
  1837. divideColor: [
  1838. 'divide-${color}',
  1839. ],
  1840. divideOpacity: [
  1841. 'divide-${static}',
  1842. 'divide-opacity-${int<=100}',
  1843. ],
  1844. ringOffsetWidth: [
  1845. 'ring-offset-${static}',
  1846. 'ring-offset-${int}',
  1847. ],
  1848. ringOffsetColor: [
  1849. 'ring-offset-${color}',
  1850. ],
  1851. ringWidth: [
  1852. 'ring-${static}',
  1853. 'ring-${int}',
  1854. ],
  1855. ringColor: [
  1856. 'ring-${color}',
  1857. ],
  1858. ringOpacity: [
  1859. 'ring-${static}',
  1860. 'ring-opacity-${int<=100}',
  1861. ],
  1862. // Effects
  1863. boxShadow: [
  1864. 'shadow-${static}',
  1865. ],
  1866. opacity: [
  1867. 'opacity-${static}',
  1868. 'opacity-${int<=100}',
  1869. ],
  1870. transition: [
  1871. 'transition-${static}',
  1872. ],
  1873. transitionDuration: [
  1874. 'duration-${static}',
  1875. 'duration-${int}',
  1876. ],
  1877. transitionTimingFunction: [
  1878. 'ease-${static}',
  1879. ],
  1880. transitionDelay: [
  1881. 'delay-${static}',
  1882. 'delay-${int}',
  1883. ],
  1884. animation: [
  1885. 'animate-${static}',
  1886. ],
  1887. // Transforms
  1888. transformOrigin: [
  1889. 'origin-${static}',
  1890. ],
  1891. scale: [
  1892. 'scale-${static}',
  1893. 'scale-${int}',
  1894. 'scale-x-${static}',
  1895. 'scale-x-${int}',
  1896. 'scale-y-${static}',
  1897. 'scale-y-${int}',
  1898. ],
  1899. rotate: [
  1900. 'rotate-${static}',
  1901. 'rotate-${float}',
  1902. ],
  1903. translate: [
  1904. 'translate-${static}',
  1905. 'translate-x-${static}',
  1906. 'translate-y-${static}',
  1907. 'translate-x-${float}',
  1908. 'translate-x-${fraction}',
  1909. 'translate-x-${size}',
  1910. 'translate-y-${float}',
  1911. 'translate-y-${fraction}',
  1912. 'translate-y-${size}',
  1913. ],
  1914. skew: [
  1915. 'skew-x-${static}',
  1916. 'skew-x-${float}',
  1917. 'skew-y-${static}',
  1918. 'skew-y-${float}',
  1919. ],
  1920. cursor: [
  1921. 'cursor-${static}',
  1922. ],
  1923. // Interactivity
  1924. outline: [
  1925. 'outline-${static}',
  1926. 'outline-${color}',
  1927. ],
  1928. // SVG
  1929. fill: [
  1930. 'fill-${color}',
  1931. ],
  1932. // Stroke
  1933. stroke: [
  1934. 'stroke-${color}',
  1935. ],
  1936. strokeWidth: [
  1937. 'stroke-${int}',
  1938. ],
  1939. // Plugins
  1940. typography: [
  1941. 'prose-sm',
  1942. 'prose',
  1943. 'prose-lg',
  1944. 'prose-xl',
  1945. 'prose-2xl',
  1946. 'prose-red',
  1947. 'prose-yellow',
  1948. 'prose-green',
  1949. 'prose-blue',
  1950. 'prose-indigo',
  1951. 'prose-purple',
  1952. 'prose-pink',
  1953. ],
  1954. aspectRatio: [
  1955. 'aspect-none',
  1956. 'aspect-auto',
  1957. 'aspect-square',
  1958. 'aspect-video',
  1959. 'aspect-w-${float}',
  1960. 'aspect-h-${float}',
  1961. 'aspect-${fraction}',
  1962. ],
  1963. lineClamp: [
  1964. 'line-clamp-none',
  1965. 'line-clamp-${int}',
  1966. ],
  1967. filter: [
  1968. 'filter-${static}',
  1969. ],
  1970. backdropFilter: [
  1971. 'backdrop-${static}',
  1972. ],
  1973. basis: [
  1974. 'basis-${static}',
  1975. 'basis-${float}',
  1976. 'basis-${size}',
  1977. 'basis-${fraction}',
  1978. ],
  1979. blur: [
  1980. 'blur-${static}',
  1981. 'blur-${float}',
  1982. 'blur-${size}',
  1983. ],
  1984. willChange: [
  1985. 'will-change-auto',
  1986. 'will-change-scroll',
  1987. 'will-change-contents',
  1988. 'will-change-transform',
  1989. ],
  1990. touchAction: [
  1991. 'touch-auto',
  1992. 'touch-none',
  1993. 'touch-pan-x',
  1994. 'touch-pan-left',
  1995. 'touch-pan-right',
  1996. 'touch-pan-y',
  1997. 'touch-pan-up',
  1998. 'touch-pan-down',
  1999. 'touch-pinch-zoom',
  2000. 'touch-manipulation',
  2001. ],
  2002. scrollBehavior: [
  2003. 'scroll-auto',
  2004. 'scroll-smooth',
  2005. ],
  2006. shadow: [
  2007. 'shadow-${static}',
  2008. ],
  2009. };
  2010. var negative = {
  2011. inset: true,
  2012. zIndex: true,
  2013. order: true,
  2014. margin: true,
  2015. space: true,
  2016. letterSpacing: true,
  2017. rotate: true,
  2018. translate: true,
  2019. skew: true,
  2020. };
  2021. function generateCompletions(processor) {
  2022. var completions = { static: [], color: [], dynamic: [] };
  2023. var colors = flatColors(processor.theme('colors'));
  2024. var _loop_1 = function (config, list) {
  2025. list.forEach(function (utility) {
  2026. var mark = utility.search(/\$/);
  2027. if (mark === -1) {
  2028. completions.static.push(utility);
  2029. }
  2030. else {
  2031. var prefix_1 = utility.slice(0, mark - 1);
  2032. var suffix = utility.slice(mark);
  2033. switch (suffix) {
  2034. case '${static}':
  2035. completions.static = completions.static.concat(Object.keys(processor.theme(config, {})).map(function (i) { return i === 'DEFAULT' ? prefix_1 : i.charAt(0) === '-' ? "-".concat(prefix_1).concat(i) : "".concat(prefix_1, "-").concat(i); }));
  2036. break;
  2037. case '${color}':
  2038. for (var _i = 0, _a = Object.keys(flatColors(processor.theme(config, colors))); _i < _a.length; _i++) {
  2039. var key = _a[_i];
  2040. if (key !== 'DEFAULT')
  2041. completions.color.push("".concat(prefix_1, "-").concat(key));
  2042. }
  2043. break;
  2044. default:
  2045. completions.dynamic.push(utility);
  2046. if (config in negative)
  2047. completions.dynamic.push("-".concat(utility));
  2048. break;
  2049. }
  2050. }
  2051. });
  2052. };
  2053. for (var _i = 0, _a = Object.entries(utilities); _i < _a.length; _i++) {
  2054. var _b = _a[_i], config = _b[0], list = _b[1];
  2055. _loop_1(config, list);
  2056. }
  2057. return completions;
  2058. }
  2059. export { Console, breakpoints, camelToDash, connectList, dashToCamel, deepCopy, expandDirection, flatColors, fracToPercent, generateCompletions, generateFontSize, generatePlaceholder, getNestedValue, guessClassName, hash, hex2RGB, hsl2rgb, hwb2rgb, increaseWithUnit, indent, isFraction, isNumber, isSize, isSpace, isString, isTagName, negateValue, negative$1 as negative, roundUp, searchFrom, searchNotEscape, searchPropEnd, splitColorGroup, splitSelectors, testRegexr, toArray, toColor, toDarkStyle, toRGB, toRGBA, toType, type, wrapit };