display.js 2.7 KB

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