Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
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.

stringifier.js 34KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362
  1. "use strict";
  2. exports.__esModule = true;
  3. exports.default = void 0;
  4. var DEFAULT_RAW = {
  5. colon: ': ',
  6. indent: ' ',
  7. beforeDecl: '\n',
  8. beforeRule: '\n',
  9. beforeOpen: ' ',
  10. beforeClose: '\n',
  11. beforeComment: '\n',
  12. after: '\n',
  13. emptyBody: '',
  14. commentLeft: ' ',
  15. commentRight: ' ',
  16. semicolon: false
  17. };
  18. function capitalize(str) {
  19. return str[0].toUpperCase() + str.slice(1);
  20. }
  21. var Stringifier = /*#__PURE__*/function () {
  22. function Stringifier(builder) {
  23. this.builder = builder;
  24. }
  25. var _proto = Stringifier.prototype;
  26. _proto.stringify = function stringify(node, semicolon) {
  27. this[node.type](node, semicolon);
  28. };
  29. _proto.root = function root(node) {
  30. this.body(node);
  31. if (node.raws.after) this.builder(node.raws.after);
  32. };
  33. _proto.comment = function comment(node) {
  34. var left = this.raw(node, 'left', 'commentLeft');
  35. var right = this.raw(node, 'right', 'commentRight');
  36. this.builder('/*' + left + node.text + right + '*/', node);
  37. };
  38. _proto.decl = function decl(node, semicolon) {
  39. var between = this.raw(node, 'between', 'colon');
  40. var string = node.prop + between + this.rawValue(node, 'value');
  41. if (node.important) {
  42. string += node.raws.important || ' !important';
  43. }
  44. if (semicolon) string += ';';
  45. this.builder(string, node);
  46. };
  47. _proto.rule = function rule(node) {
  48. this.block(node, this.rawValue(node, 'selector'));
  49. if (node.raws.ownSemicolon) {
  50. this.builder(node.raws.ownSemicolon, node, 'end');
  51. }
  52. };
  53. _proto.atrule = function atrule(node, semicolon) {
  54. var name = '@' + node.name;
  55. var params = node.params ? this.rawValue(node, 'params') : '';
  56. if (typeof node.raws.afterName !== 'undefined') {
  57. name += node.raws.afterName;
  58. } else if (params) {
  59. name += ' ';
  60. }
  61. if (node.nodes) {
  62. this.block(node, name + params);
  63. } else {
  64. var end = (node.raws.between || '') + (semicolon ? ';' : '');
  65. this.builder(name + params + end, node);
  66. }
  67. };
  68. _proto.body = function body(node) {
  69. var last = node.nodes.length - 1;
  70. while (last > 0) {
  71. if (node.nodes[last].type !== 'comment') break;
  72. last -= 1;
  73. }
  74. var semicolon = this.raw(node, 'semicolon');
  75. for (var i = 0; i < node.nodes.length; i++) {
  76. var child = node.nodes[i];
  77. var before = this.raw(child, 'before');
  78. if (before) this.builder(before);
  79. this.stringify(child, last !== i || semicolon);
  80. }
  81. };
  82. _proto.block = function block(node, start) {
  83. var between = this.raw(node, 'between', 'beforeOpen');
  84. this.builder(start + between + '{', node, 'start');
  85. var after;
  86. if (node.nodes && node.nodes.length) {
  87. this.body(node);
  88. after = this.raw(node, 'after');
  89. } else {
  90. after = this.raw(node, 'after', 'emptyBody');
  91. }
  92. if (after) this.builder(after);
  93. this.builder('}', node, 'end');
  94. };
  95. _proto.raw = function raw(node, own, detect) {
  96. var value;
  97. if (!detect) detect = own; // Already had
  98. if (own) {
  99. value = node.raws[own];
  100. if (typeof value !== 'undefined') return value;
  101. }
  102. var parent = node.parent; // Hack for first rule in CSS
  103. if (detect === 'before') {
  104. if (!parent || parent.type === 'root' && parent.first === node) {
  105. return '';
  106. }
  107. } // Floating child without parent
  108. if (!parent) return DEFAULT_RAW[detect]; // Detect style by other nodes
  109. var root = node.root();
  110. if (!root.rawCache) root.rawCache = {};
  111. if (typeof root.rawCache[detect] !== 'undefined') {
  112. return root.rawCache[detect];
  113. }
  114. if (detect === 'before' || detect === 'after') {
  115. return this.beforeAfter(node, detect);
  116. } else {
  117. var method = 'raw' + capitalize(detect);
  118. if (this[method]) {
  119. value = this[method](root, node);
  120. } else {
  121. root.walk(function (i) {
  122. value = i.raws[own];
  123. if (typeof value !== 'undefined') return false;
  124. });
  125. }
  126. }
  127. if (typeof value === 'undefined') value = DEFAULT_RAW[detect];
  128. root.rawCache[detect] = value;
  129. return value;
  130. };
  131. _proto.rawSemicolon = function rawSemicolon(root) {
  132. var value;
  133. root.walk(function (i) {
  134. if (i.nodes && i.nodes.length && i.last.type === 'decl') {
  135. value = i.raws.semicolon;
  136. if (typeof value !== 'undefined') return false;
  137. }
  138. });
  139. return value;
  140. };
  141. _proto.rawEmptyBody = function rawEmptyBody(root) {
  142. var value;
  143. root.walk(function (i) {
  144. if (i.nodes && i.nodes.length === 0) {
  145. value = i.raws.after;
  146. if (typeof value !== 'undefined') return false;
  147. }
  148. });
  149. return value;
  150. };
  151. _proto.rawIndent = function rawIndent(root) {
  152. if (root.raws.indent) return root.raws.indent;
  153. var value;
  154. root.walk(function (i) {
  155. var p = i.parent;
  156. if (p && p !== root && p.parent && p.parent === root) {
  157. if (typeof i.raws.before !== 'undefined') {
  158. var parts = i.raws.before.split('\n');
  159. value = parts[parts.length - 1];
  160. value = value.replace(/[^\s]/g, '');
  161. return false;
  162. }
  163. }
  164. });
  165. return value;
  166. };
  167. _proto.rawBeforeComment = function rawBeforeComment(root, node) {
  168. var value;
  169. root.walkComments(function (i) {
  170. if (typeof i.raws.before !== 'undefined') {
  171. value = i.raws.before;
  172. if (value.indexOf('\n') !== -1) {
  173. value = value.replace(/[^\n]+$/, '');
  174. }
  175. return false;
  176. }
  177. });
  178. if (typeof value === 'undefined') {
  179. value = this.raw(node, null, 'beforeDecl');
  180. } else if (value) {
  181. value = value.replace(/[^\s]/g, '');
  182. }
  183. return value;
  184. };
  185. _proto.rawBeforeDecl = function rawBeforeDecl(root, node) {
  186. var value;
  187. root.walkDecls(function (i) {
  188. if (typeof i.raws.before !== 'undefined') {
  189. value = i.raws.before;
  190. if (value.indexOf('\n') !== -1) {
  191. value = value.replace(/[^\n]+$/, '');
  192. }
  193. return false;
  194. }
  195. });
  196. if (typeof value === 'undefined') {
  197. value = this.raw(node, null, 'beforeRule');
  198. } else if (value) {
  199. value = value.replace(/[^\s]/g, '');
  200. }
  201. return value;
  202. };
  203. _proto.rawBeforeRule = function rawBeforeRule(root) {
  204. var value;
  205. root.walk(function (i) {
  206. if (i.nodes && (i.parent !== root || root.first !== i)) {
  207. if (typeof i.raws.before !== 'undefined') {
  208. value = i.raws.before;
  209. if (value.indexOf('\n') !== -1) {
  210. value = value.replace(/[^\n]+$/, '');
  211. }
  212. return false;
  213. }
  214. }
  215. });
  216. if (value) value = value.replace(/[^\s]/g, '');
  217. return value;
  218. };
  219. _proto.rawBeforeClose = function rawBeforeClose(root) {
  220. var value;
  221. root.walk(function (i) {
  222. if (i.nodes && i.nodes.length > 0) {
  223. if (typeof i.raws.after !== 'undefined') {
  224. value = i.raws.after;
  225. if (value.indexOf('\n') !== -1) {
  226. value = value.replace(/[^\n]+$/, '');
  227. }
  228. return false;
  229. }
  230. }
  231. });
  232. if (value) value = value.replace(/[^\s]/g, '');
  233. return value;
  234. };
  235. _proto.rawBeforeOpen = function rawBeforeOpen(root) {
  236. var value;
  237. root.walk(function (i) {
  238. if (i.type !== 'decl') {
  239. value = i.raws.between;
  240. if (typeof value !== 'undefined') return false;
  241. }
  242. });
  243. return value;
  244. };
  245. _proto.rawColon = function rawColon(root) {
  246. var value;
  247. root.walkDecls(function (i) {
  248. if (typeof i.raws.between !== 'undefined') {
  249. value = i.raws.between.replace(/[^\s:]/g, '');
  250. return false;
  251. }
  252. });
  253. return value;
  254. };
  255. _proto.beforeAfter = function beforeAfter(node, detect) {
  256. var value;
  257. if (node.type === 'decl') {
  258. value = this.raw(node, null, 'beforeDecl');
  259. } else if (node.type === 'comment') {
  260. value = this.raw(node, null, 'beforeComment');
  261. } else if (detect === 'before') {
  262. value = this.raw(node, null, 'beforeRule');
  263. } else {
  264. value = this.raw(node, null, 'beforeClose');
  265. }
  266. var buf = node.parent;
  267. var depth = 0;
  268. while (buf && buf.type !== 'root') {
  269. depth += 1;
  270. buf = buf.parent;
  271. }
  272. if (value.indexOf('\n') !== -1) {
  273. var indent = this.raw(node, null, 'indent');
  274. if (indent.length) {
  275. for (var step = 0; step < depth; step++) {
  276. value += indent;
  277. }
  278. }
  279. }
  280. return value;
  281. };
  282. _proto.rawValue = function rawValue(node, prop) {
  283. var value = node[prop];
  284. var raw = node.raws[prop];
  285. if (raw && raw.value === value) {
  286. return raw.raw;
  287. }
  288. return value;
  289. };
  290. return Stringifier;
  291. }();
  292. var _default = Stringifier;
  293. exports.default = _default;
  294. module.exports = exports.default;
  295. //# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0cmluZ2lmaWVyLmVzNiJdLCJuYW1lcyI6WyJERUZBVUxUX1JBVyIsImNvbG9uIiwiaW5kZW50IiwiYmVmb3JlRGVjbCIsImJlZm9yZVJ1bGUiLCJiZWZvcmVPcGVuIiwiYmVmb3JlQ2xvc2UiLCJiZWZvcmVDb21tZW50IiwiYWZ0ZXIiLCJlbXB0eUJvZHkiLCJjb21tZW50TGVmdCIsImNvbW1lbnRSaWdodCIsInNlbWljb2xvbiIsImNhcGl0YWxpemUiLCJzdHIiLCJ0b1VwcGVyQ2FzZSIsInNsaWNlIiwiU3RyaW5naWZpZXIiLCJidWlsZGVyIiwic3RyaW5naWZ5Iiwibm9kZSIsInR5cGUiLCJyb290IiwiYm9keSIsInJhd3MiLCJjb21tZW50IiwibGVmdCIsInJhdyIsInJpZ2h0IiwidGV4dCIsImRlY2w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