ariaPropsMap.js 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. var _iterationDecorator = _interopRequireDefault(require("./util/iterationDecorator"));
  7. function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
  8. function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
  9. function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
  10. function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
  11. function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
  12. function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
  13. function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
  14. var properties = [['aria-activedescendant', {
  15. 'type': 'id'
  16. }], ['aria-atomic', {
  17. 'type': 'boolean'
  18. }], ['aria-autocomplete', {
  19. 'type': 'token',
  20. 'values': ['inline', 'list', 'both', 'none']
  21. }], ['aria-braillelabel', {
  22. 'type': 'string'
  23. }], ['aria-brailleroledescription', {
  24. 'type': 'string'
  25. }], ['aria-busy', {
  26. 'type': 'boolean'
  27. }], ['aria-checked', {
  28. 'type': 'tristate'
  29. }], ['aria-colcount', {
  30. type: 'integer'
  31. }], ['aria-colindex', {
  32. type: 'integer'
  33. }], ['aria-colspan', {
  34. type: 'integer'
  35. }], ['aria-controls', {
  36. 'type': 'idlist'
  37. }], ['aria-current', {
  38. type: 'token',
  39. values: ['page', 'step', 'location', 'date', 'time', true, false]
  40. }], ['aria-describedby', {
  41. 'type': 'idlist'
  42. }], ['aria-description', {
  43. 'type': 'string'
  44. }], ['aria-details', {
  45. 'type': 'id'
  46. }], ['aria-disabled', {
  47. 'type': 'boolean'
  48. }], ['aria-dropeffect', {
  49. 'type': 'tokenlist',
  50. 'values': ['copy', 'execute', 'link', 'move', 'none', 'popup']
  51. }], ['aria-errormessage', {
  52. 'type': 'id'
  53. }], ['aria-expanded', {
  54. 'type': 'boolean',
  55. 'allowundefined': true
  56. }], ['aria-flowto', {
  57. 'type': 'idlist'
  58. }], ['aria-grabbed', {
  59. 'type': 'boolean',
  60. 'allowundefined': true
  61. }], ['aria-haspopup', {
  62. 'type': 'token',
  63. 'values': [false, true, 'menu', 'listbox', 'tree', 'grid', 'dialog']
  64. }], ['aria-hidden', {
  65. 'type': 'boolean',
  66. 'allowundefined': true
  67. }], ['aria-invalid', {
  68. 'type': 'token',
  69. 'values': ['grammar', false, 'spelling', true]
  70. }], ['aria-keyshortcuts', {
  71. type: 'string'
  72. }], ['aria-label', {
  73. 'type': 'string'
  74. }], ['aria-labelledby', {
  75. 'type': 'idlist'
  76. }], ['aria-level', {
  77. 'type': 'integer'
  78. }], ['aria-live', {
  79. 'type': 'token',
  80. 'values': ['assertive', 'off', 'polite']
  81. }], ['aria-modal', {
  82. type: 'boolean'
  83. }], ['aria-multiline', {
  84. 'type': 'boolean'
  85. }], ['aria-multiselectable', {
  86. 'type': 'boolean'
  87. }], ['aria-orientation', {
  88. 'type': 'token',
  89. 'values': ['vertical', 'undefined', 'horizontal']
  90. }], ['aria-owns', {
  91. 'type': 'idlist'
  92. }], ['aria-placeholder', {
  93. type: 'string'
  94. }], ['aria-posinset', {
  95. 'type': 'integer'
  96. }], ['aria-pressed', {
  97. 'type': 'tristate'
  98. }], ['aria-readonly', {
  99. 'type': 'boolean'
  100. }], ['aria-relevant', {
  101. 'type': 'tokenlist',
  102. 'values': ['additions', 'all', 'removals', 'text']
  103. }], ['aria-required', {
  104. 'type': 'boolean'
  105. }], ['aria-roledescription', {
  106. type: 'string'
  107. }], ['aria-rowcount', {
  108. type: 'integer'
  109. }], ['aria-rowindex', {
  110. type: 'integer'
  111. }], ['aria-rowspan', {
  112. type: 'integer'
  113. }], ['aria-selected', {
  114. 'type': 'boolean',
  115. 'allowundefined': true
  116. }], ['aria-setsize', {
  117. 'type': 'integer'
  118. }], ['aria-sort', {
  119. 'type': 'token',
  120. 'values': ['ascending', 'descending', 'none', 'other']
  121. }], ['aria-valuemax', {
  122. 'type': 'number'
  123. }], ['aria-valuemin', {
  124. 'type': 'number'
  125. }], ['aria-valuenow', {
  126. 'type': 'number'
  127. }], ['aria-valuetext', {
  128. 'type': 'string'
  129. }]];
  130. var ariaPropsMap = {
  131. entries: function entries() {
  132. return properties;
  133. },
  134. forEach: function forEach(fn) {
  135. var thisArg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  136. for (var _i = 0, _properties = properties; _i < _properties.length; _i++) {
  137. var _properties$_i = _slicedToArray(_properties[_i], 2),
  138. key = _properties$_i[0],
  139. values = _properties$_i[1];
  140. fn.call(thisArg, values, key, properties);
  141. }
  142. },
  143. get: function get(key) {
  144. var item = properties.filter(function (tuple) {
  145. return tuple[0] === key ? true : false;
  146. })[0];
  147. return item && item[1];
  148. },
  149. has: function has(key) {
  150. return !!ariaPropsMap.get(key);
  151. },
  152. keys: function keys() {
  153. return properties.map(function (_ref) {
  154. var _ref2 = _slicedToArray(_ref, 1),
  155. key = _ref2[0];
  156. return key;
  157. });
  158. },
  159. values: function values() {
  160. return properties.map(function (_ref3) {
  161. var _ref4 = _slicedToArray(_ref3, 2),
  162. values = _ref4[1];
  163. return values;
  164. });
  165. }
  166. };
  167. var _default = exports.default = (0, _iterationDecorator.default)(ariaPropsMap, ariaPropsMap.entries());