display.js 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.display = void 0;
  4. var parser_1 = require("../syntax/parser");
  5. exports.display = {
  6. name: 'display',
  7. initialValue: 'inline-block',
  8. prefix: false,
  9. type: 1 /* LIST */,
  10. parse: function (_context, tokens) {
  11. return tokens.filter(parser_1.isIdentToken).reduce(function (bit, token) {
  12. return bit | parseDisplayValue(token.value);
  13. }, 0 /* NONE */);
  14. }
  15. };
  16. var parseDisplayValue = function (display) {
  17. switch (display) {
  18. case 'block':
  19. case '-webkit-box':
  20. return 2 /* BLOCK */;
  21. case 'inline':
  22. return 4 /* INLINE */;
  23. case 'run-in':
  24. return 8 /* RUN_IN */;
  25. case 'flow':
  26. return 16 /* FLOW */;
  27. case 'flow-root':
  28. return 32 /* FLOW_ROOT */;
  29. case 'table':
  30. return 64 /* TABLE */;
  31. case 'flex':
  32. case '-webkit-flex':
  33. return 128 /* FLEX */;
  34. case 'grid':
  35. case '-ms-grid':
  36. return 256 /* GRID */;
  37. case 'ruby':
  38. return 512 /* RUBY */;
  39. case 'subgrid':
  40. return 1024 /* SUBGRID */;
  41. case 'list-item':
  42. return 2048 /* LIST_ITEM */;
  43. case 'table-row-group':
  44. return 4096 /* TABLE_ROW_GROUP */;
  45. case 'table-header-group':
  46. return 8192 /* TABLE_HEADER_GROUP */;
  47. case 'table-footer-group':
  48. return 16384 /* TABLE_FOOTER_GROUP */;
  49. case 'table-row':
  50. return 32768 /* TABLE_ROW */;
  51. case 'table-cell':
  52. return 65536 /* TABLE_CELL */;
  53. case 'table-column-group':
  54. return 131072 /* TABLE_COLUMN_GROUP */;
  55. case 'table-column':
  56. return 262144 /* TABLE_COLUMN */;
  57. case 'table-caption':
  58. return 524288 /* TABLE_CAPTION */;
  59. case 'ruby-base':
  60. return 1048576 /* RUBY_BASE */;
  61. case 'ruby-text':
  62. return 2097152 /* RUBY_TEXT */;
  63. case 'ruby-base-container':
  64. return 4194304 /* RUBY_BASE_CONTAINER */;
  65. case 'ruby-text-container':
  66. return 8388608 /* RUBY_TEXT_CONTAINER */;
  67. case 'contents':
  68. return 16777216 /* CONTENTS */;
  69. case 'inline-block':
  70. return 33554432 /* INLINE_BLOCK */;
  71. case 'inline-list-item':
  72. return 67108864 /* INLINE_LIST_ITEM */;
  73. case 'inline-table':
  74. return 134217728 /* INLINE_TABLE */;
  75. case 'inline-flex':
  76. return 268435456 /* INLINE_FLEX */;
  77. case 'inline-grid':
  78. return 536870912 /* INLINE_GRID */;
  79. }
  80. return 0 /* NONE */;
  81. };
  82. //# sourceMappingURL=display.js.map