Izmjenjena struktura, dodan backand

This commit is contained in:
GotPPay
2017-10-16 11:19:46 +02:00
parent 1ec88afacb
commit 048e32c4aa
37153 changed files with 2975854 additions and 1 deletions

View File

@@ -0,0 +1,390 @@
{
"countries": [
"AF",
"AL",
"DZ",
"AS",
"AD",
"AO",
"AI",
"AQ",
"AG",
"AR",
"AM",
"AW",
"AU",
"AT",
"AZ",
"BS",
"BH",
"BD",
"BB",
"BY",
"BE",
"BZ",
"BJ",
"BM",
"BT",
"BO",
"BA",
"BW",
"BR",
"IO",
"VG",
"BN",
"BG",
"BF",
"MM",
"BI",
"KH",
"CM",
"CA",
"CV",
"KY",
"CF",
"TD",
"CL",
"CN",
"CX",
"CC",
"CO",
"KM",
"CK",
"CR",
"HR",
"CU",
"CY",
"CZ",
"CD",
"DK",
"DJ",
"DM",
"DO",
"EC",
"EG",
"SV",
"GQ",
"ER",
"EE",
"ET",
"FK",
"FO",
"FJ",
"FI",
"FR",
"PF",
"GA",
"GM",
"GE",
"DE",
"GH",
"GI",
"GR",
"GL",
"GD",
"GU",
"GT",
"GN",
"GW",
"GY",
"HT",
"VA",
"HN",
"HK",
"HU",
"IS",
"IN",
"ID",
"IR",
"IQ",
"IE",
"IM",
"IL",
"IT",
"CI",
"JM",
"JP",
"JE",
"JO",
"KZ",
"KE",
"KI",
"KW",
"KG",
"LA",
"LV",
"LB",
"LS",
"LR",
"LY",
"LI",
"LT",
"LU",
"MO",
"MK",
"MG",
"MW",
"MY",
"MV",
"ML",
"MT",
"MH",
"MR",
"MU",
"YT",
"MX",
"FM",
"MD",
"MC",
"MN",
"ME",
"MS",
"MA",
"MZ",
"NA",
"NR",
"NP",
"NL",
"AN",
"NC",
"NZ",
"NI",
"NE",
"NG",
"NU",
"KP",
"MP",
"NO",
"OM",
"PK",
"PW",
"PA",
"PG",
"PY",
"PE",
"PH",
"PN",
"PL",
"PT",
"PR",
"QA",
"CG",
"RO",
"RU",
"RW",
"BL",
"SH",
"KN",
"LC",
"MF",
"PM",
"VC",
"WS",
"SM",
"ST",
"SA",
"SN",
"RS",
"SC",
"SL",
"SG",
"SK",
"SI",
"SB",
"SO",
"ZA",
"KR",
"ES",
"LK",
"SD",
"SR",
"SJ",
"SZ",
"SE",
"CH",
"SY",
"TW",
"TJ",
"TZ",
"TH",
"TL",
"TG",
"TK",
"TO",
"TT",
"TN",
"TR",
"TM",
"TC",
"TV",
"UG",
"UA",
"AE",
"GB",
"US",
"UY",
"VI",
"UZ",
"VU",
"VE",
"VN",
"WF",
"EH",
"YE",
"ZM",
"ZW"
],
"languages": [
"ab",
"aa",
"af",
"sq",
"am",
"ar",
"an",
"hy",
"as",
"ay",
"az",
"ba",
"eu",
"bn",
"dz",
"bh",
"bi",
"br",
"bg",
"my",
"be",
"km",
"ca",
"zh",
"zh-Hans",
"zh-Hant",
"co",
"hr",
"cs",
"da",
"nl",
"en",
"eo",
"et",
"fo",
"fa",
"fj",
"fi",
"fr",
"fy",
"gl",
"gd",
"gv",
"ka",
"de",
"el",
"kl",
"gn",
"gu",
"ht",
"ha",
"he",
"iw",
"hi",
"hu",
"is",
"io",
"id",
"in",
"ia",
"ie",
"iu",
"ik",
"ga",
"it",
"ja",
"jv",
"kn",
"ks",
"kk",
"rw",
"ky",
"rn",
"ko",
"ku",
"lo",
"la",
"lv",
"li",
"ln",
"lt",
"mk",
"mg",
"ms",
"ml",
"mt",
"mi",
"mr",
"mo",
"mn",
"na",
"ne",
"no",
"oc",
"or",
"om",
"ps",
"pl",
"pt",
"pa",
"qu",
"rm",
"ro",
"ru",
"sm",
"sg",
"sa",
"sr",
"sh",
"st",
"tn",
"sn",
"ii",
"sd",
"si",
"ss",
"sk",
"sl",
"so",
"es",
"su",
"sw",
"sv",
"tl",
"tg",
"ta",
"tt",
"te",
"th",
"bo",
"ti",
"to",
"ts",
"tr",
"tk",
"tw",
"ug",
"uk",
"ur",
"uz",
"vi",
"vo",
"wa",
"cy",
"wo",
"xh",
"yi",
"ji",
"yo",
"zu"
]
}

View File

@@ -0,0 +1,36 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _jsxAstUtils = require('jsx-ast-utils');
/**
* Returns true if all items in baseAttributes are found in attributes. Always
* returns true if baseAttributes is empty.
*/
function attributesComparator() {
var baseAttributes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
var attributes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
return baseAttributes.every(function (baseAttr) {
return attributes.some(function (attribute) {
// Guard against non-JSXAttribute nodes like JSXSpreadAttribute
if (attribute.type !== 'JSXAttribute') {
return false;
}
// Attribute matches.
if (baseAttr.name !== (0, _jsxAstUtils.propName)(attribute)) {
return false;
}
// Value exists and does not match.
if (baseAttr.value && baseAttr.value !== (0, _jsxAstUtils.getLiteralPropValue)(attribute)) {
return false;
}
return true;
});
});
}
exports.default = attributesComparator;

View File

@@ -0,0 +1,28 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = getImplicitRole;
var _implicitRoles = require('./implicitRoles');
var _implicitRoles2 = _interopRequireDefault(_implicitRoles);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Returns an element's implicit role given its attributes and type.
* Some elements only have an implicit role when certain props are defined.
*
* @param type - The node's tagName.
* @param attributes - The collection of attributes on the node.
* @returns {String} - String representing the node's implicit role or '' if it doesn't exist.
*/
function getImplicitRole(type, attributes) {
if (_implicitRoles2.default[type]) {
return _implicitRoles2.default[type](attributes);
}
return '';
}

View File

@@ -0,0 +1,39 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = getSuggestion;
var _damerauLevenshtein = require('damerau-levenshtein');
var _damerauLevenshtein2 = _interopRequireDefault(_damerauLevenshtein);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// Minimum edit distance to be considered a good suggestion.
var THRESHOLD = 2;
/**
* Returns an array of suggestions given a word and a dictionary and limit of suggestions
* to return.
*/
function getSuggestion(word) {
var dictionary = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
var limit = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 2;
var distances = dictionary.reduce(function (suggestions, dictionaryWord) {
var distance = (0, _damerauLevenshtein2.default)(word.toUpperCase(), dictionaryWord.toUpperCase());
var steps = distance.steps;
suggestions[dictionaryWord] = steps; // eslint-disable-line
return suggestions;
}, {});
return Object.keys(distances).filter(function (suggestion) {
return distances[suggestion] <= THRESHOLD;
}).sort(function (a, b) {
return distances[a] - distances[b];
}) // Sort by distance
.slice(0, limit);
}

View File

@@ -0,0 +1,39 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
exports.default = getTabIndex;
var _jsxAstUtils = require('jsx-ast-utils');
/**
* Returns the tabIndex value.
*/
function getTabIndex(tabIndex) {
var literalValue = (0, _jsxAstUtils.getLiteralPropValue)(tabIndex);
// String and number values.
if (['string', 'number'].indexOf(typeof literalValue === 'undefined' ? 'undefined' : _typeof(literalValue)) > -1) {
// Empty string will convert to zero, so check for it explicity.
if (typeof literalValue === 'string' && literalValue.length === 0) {
return undefined;
}
var value = Number(literalValue);
if (Number.isNaN(value)) {
return undefined;
}
return Number.isInteger(value) ? value : undefined;
}
// Booleans are not valid values, return undefined.
if (literalValue === true || literalValue === false) {
return undefined;
}
return (0, _jsxAstUtils.getPropValue)(tabIndex);
}

View File

@@ -0,0 +1,32 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = hasAccessibleChild;
var _jsxAstUtils = require('jsx-ast-utils');
var _isHiddenFromScreenReader = require('./isHiddenFromScreenReader');
var _isHiddenFromScreenReader2 = _interopRequireDefault(_isHiddenFromScreenReader);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function hasAccessibleChild(node) {
return node.children.some(function (child) {
switch (child.type) {
case 'Literal':
return Boolean(child.value);
case 'JSXElement':
return !(0, _isHiddenFromScreenReader2.default)((0, _jsxAstUtils.elementType)(child.openingElement), child.openingElement.attributes);
case 'JSXExpressionContainer':
if (child.expression.type === 'Identifier') {
return child.expression.name !== 'undefined';
}
return true;
default:
return false;
}
}) || (0, _jsxAstUtils.hasAnyProp)(node.openingElement.attributes, ['dangerouslySetInnerHTML', 'children']);
}

View File

@@ -0,0 +1,19 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = getImplicitRoleForAnchor;
var _jsxAstUtils = require('jsx-ast-utils');
/**
* Returns the implicit role for an anchor tag.
*/
function getImplicitRoleForAnchor(attributes) {
if ((0, _jsxAstUtils.getProp)(attributes, 'href')) {
return 'link';
}
return '';
}

View File

@@ -0,0 +1,19 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = getImplicitRoleForArea;
var _jsxAstUtils = require('jsx-ast-utils');
/**
* Returns the implicit role for an area tag.
*/
function getImplicitRoleForArea(attributes) {
if ((0, _jsxAstUtils.getProp)(attributes, 'href')) {
return 'link';
}
return '';
}

View File

@@ -0,0 +1,12 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = getImplicitRoleForArticle;
/**
* Returns the implicit role for an article tag.
*/
function getImplicitRoleForArticle() {
return 'article';
}

View File

@@ -0,0 +1,12 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = getImplicitRoleForAside;
/**
* Returns the implicit role for an aside tag.
*/
function getImplicitRoleForAside() {
return 'complementary';
}

View File

@@ -0,0 +1,12 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = getImplicitRoleForBody;
/**
* Returns the implicit role for a body tag.
*/
function getImplicitRoleForBody() {
return 'document';
}

View File

@@ -0,0 +1,12 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = getImplicitRoleForButton;
/**
* Returns the implicit role for a button tag.
*/
function getImplicitRoleForButton() {
return 'button';
}

View File

@@ -0,0 +1,12 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = getImplicitRoleForDatalist;
/**
* Returns the implicit role for a datalist tag.
*/
function getImplicitRoleForDatalist() {
return 'listbox';
}

View File

@@ -0,0 +1,12 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = getImplicitRoleForDetails;
/**
* Returns the implicit role for a details tag.
*/
function getImplicitRoleForDetails() {
return 'group';
}

View File

@@ -0,0 +1,12 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = getImplicitRoleForDialog;
/**
* Returns the implicit role for a dialog tag.
*/
function getImplicitRoleForDialog() {
return 'dialog';
}

View File

@@ -0,0 +1,12 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = getImplicitRoleForDl;
/**
* Returns the implicit role for a dl tag.
*/
function getImplicitRoleForDl() {
return 'list';
}

View File

@@ -0,0 +1,12 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = getImplicitRoleForForm;
/**
* Returns the implicit role for a form tag.
*/
function getImplicitRoleForForm() {
return 'form';
}

View File

@@ -0,0 +1,12 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = getImplicitRoleForH1;
/**
* Returns the implicit role for an h1 tag.
*/
function getImplicitRoleForH1() {
return 'heading';
}

View File

@@ -0,0 +1,12 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = getImplicitRoleForH2;
/**
* Returns the implicit role for an h2 tag.
*/
function getImplicitRoleForH2() {
return 'heading';
}

View File

@@ -0,0 +1,12 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = getImplicitRoleForH3;
/**
* Returns the implicit role for an h3 tag.
*/
function getImplicitRoleForH3() {
return 'heading';
}

View File

@@ -0,0 +1,12 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = getImplicitRoleForH4;
/**
* Returns the implicit role for an h4 tag.
*/
function getImplicitRoleForH4() {
return 'heading';
}

View File

@@ -0,0 +1,12 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = getImplicitRoleForH5;
/**
* Returns the implicit role for an h5 tag.
*/
function getImplicitRoleForH5() {
return 'heading';
}

View File

@@ -0,0 +1,12 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = getImplicitRoleForH6;
/**
* Returns the implicit role for an h6tag.
*/
function getImplicitRoleForH6() {
return 'heading';
}

View File

@@ -0,0 +1,12 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = getImplicitRoleForHr;
/**
* Returns the implicit role for an hr tag.
*/
function getImplicitRoleForHr() {
return 'separator';
}

View File

@@ -0,0 +1,21 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = getImplicitRoleForImg;
var _jsxAstUtils = require('jsx-ast-utils');
/**
* Returns the implicit role for an img tag.
*/
function getImplicitRoleForImg(attributes) {
var alt = (0, _jsxAstUtils.getProp)(attributes, 'alt');
if (alt && (0, _jsxAstUtils.getLiteralPropValue)(alt) === '') {
return 'presentation';
}
return 'img';
}

View File

@@ -0,0 +1,195 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _a = require('./a');
var _a2 = _interopRequireDefault(_a);
var _area = require('./area');
var _area2 = _interopRequireDefault(_area);
var _article = require('./article');
var _article2 = _interopRequireDefault(_article);
var _aside = require('./aside');
var _aside2 = _interopRequireDefault(_aside);
var _body = require('./body');
var _body2 = _interopRequireDefault(_body);
var _button = require('./button');
var _button2 = _interopRequireDefault(_button);
var _datalist = require('./datalist');
var _datalist2 = _interopRequireDefault(_datalist);
var _details = require('./details');
var _details2 = _interopRequireDefault(_details);
var _dialog = require('./dialog');
var _dialog2 = _interopRequireDefault(_dialog);
var _dl = require('./dl');
var _dl2 = _interopRequireDefault(_dl);
var _form = require('./form');
var _form2 = _interopRequireDefault(_form);
var _h = require('./h1');
var _h2 = _interopRequireDefault(_h);
var _h3 = require('./h2');
var _h4 = _interopRequireDefault(_h3);
var _h5 = require('./h3');
var _h6 = _interopRequireDefault(_h5);
var _h7 = require('./h4');
var _h8 = _interopRequireDefault(_h7);
var _h9 = require('./h5');
var _h10 = _interopRequireDefault(_h9);
var _h11 = require('./h6');
var _h12 = _interopRequireDefault(_h11);
var _hr = require('./hr');
var _hr2 = _interopRequireDefault(_hr);
var _img = require('./img');
var _img2 = _interopRequireDefault(_img);
var _input = require('./input');
var _input2 = _interopRequireDefault(_input);
var _li = require('./li');
var _li2 = _interopRequireDefault(_li);
var _link = require('./link');
var _link2 = _interopRequireDefault(_link);
var _menu = require('./menu');
var _menu2 = _interopRequireDefault(_menu);
var _menuitem = require('./menuitem');
var _menuitem2 = _interopRequireDefault(_menuitem);
var _meter = require('./meter');
var _meter2 = _interopRequireDefault(_meter);
var _nav = require('./nav');
var _nav2 = _interopRequireDefault(_nav);
var _ol = require('./ol');
var _ol2 = _interopRequireDefault(_ol);
var _option = require('./option');
var _option2 = _interopRequireDefault(_option);
var _output = require('./output');
var _output2 = _interopRequireDefault(_output);
var _progress = require('./progress');
var _progress2 = _interopRequireDefault(_progress);
var _section = require('./section');
var _section2 = _interopRequireDefault(_section);
var _select = require('./select');
var _select2 = _interopRequireDefault(_select);
var _tbody = require('./tbody');
var _tbody2 = _interopRequireDefault(_tbody);
var _textarea = require('./textarea');
var _textarea2 = _interopRequireDefault(_textarea);
var _tfoot = require('./tfoot');
var _tfoot2 = _interopRequireDefault(_tfoot);
var _thead = require('./thead');
var _thead2 = _interopRequireDefault(_thead);
var _ul = require('./ul');
var _ul2 = _interopRequireDefault(_ul);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
a: _a2.default,
area: _area2.default,
article: _article2.default,
aside: _aside2.default,
body: _body2.default,
button: _button2.default,
datalist: _datalist2.default,
details: _details2.default,
dialog: _dialog2.default,
dl: _dl2.default,
form: _form2.default,
h1: _h2.default,
h2: _h4.default,
h3: _h6.default,
h4: _h8.default,
h5: _h10.default,
h6: _h12.default,
hr: _hr2.default,
img: _img2.default,
input: _input2.default,
li: _li2.default,
link: _link2.default,
menu: _menu2.default,
menuitem: _menuitem2.default,
meter: _meter2.default,
nav: _nav2.default,
ol: _ol2.default,
option: _option2.default,
output: _output2.default,
progress: _progress2.default,
section: _section2.default,
select: _select2.default,
tbody: _tbody2.default,
textarea: _textarea2.default,
tfoot: _tfoot2.default,
thead: _thead2.default,
ul: _ul2.default
};

View File

@@ -0,0 +1,42 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = getImplicitRoleForInput;
var _jsxAstUtils = require('jsx-ast-utils');
/**
* Returns the implicit role for an input tag.
*/
function getImplicitRoleForInput(attributes) {
var type = (0, _jsxAstUtils.getProp)(attributes, 'type');
if (type) {
var value = (0, _jsxAstUtils.getLiteralPropValue)(type) || '';
switch (value.toUpperCase()) {
case 'BUTTON':
case 'IMAGE':
case 'RESET':
case 'SUBMIT':
return 'button';
case 'CHECKBOX':
return 'checkbox';
case 'RADIO':
return 'radio';
case 'RANGE':
return 'slider';
case 'EMAIL':
case 'PASSWORD':
case 'SEARCH': // with [list] selector it's combobox
case 'TEL': // with [list] selector it's combobox
case 'URL': // with [list] selector it's combobox
default:
return 'textbox';
}
}
return 'textbox';
}

View File

@@ -0,0 +1,12 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = getImplicitRoleForLi;
/**
* Returns the implicit role for an li tag.
*/
function getImplicitRoleForLi() {
return 'listitem';
}

View File

@@ -0,0 +1,19 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = getImplicitRoleForLink;
var _jsxAstUtils = require('jsx-ast-utils');
/**
* Returns the implicit role for a link tag.
*/
function getImplicitRoleForLink(attributes) {
if ((0, _jsxAstUtils.getProp)(attributes, 'href')) {
return 'link';
}
return '';
}

View File

@@ -0,0 +1,23 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = getImplicitRoleForMenu;
var _jsxAstUtils = require('jsx-ast-utils');
/**
* Returns the implicit role for a menu tag.
*/
function getImplicitRoleForMenu(attributes) {
var type = (0, _jsxAstUtils.getProp)(attributes, 'type');
if (type) {
var value = (0, _jsxAstUtils.getLiteralPropValue)(type);
return value && value.toUpperCase() === 'TOOLBAR' ? 'toolbar' : '';
}
return '';
}

View File

@@ -0,0 +1,32 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = getImplicitRoleForMenuitem;
var _jsxAstUtils = require('jsx-ast-utils');
/**
* Returns the implicit role for a menuitem tag.
*/
function getImplicitRoleForMenuitem(attributes) {
var type = (0, _jsxAstUtils.getProp)(attributes, 'type');
if (type) {
var value = (0, _jsxAstUtils.getLiteralPropValue)(type) || '';
switch (value.toUpperCase()) {
case 'COMMAND':
return 'menuitem';
case 'CHECKBOX':
return 'menuitemcheckbox';
case 'RADIO':
return 'menuitemradio';
default:
return '';
}
}
return '';
}

View File

@@ -0,0 +1,12 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = getImplicitRoleForMeter;
/**
* Returns the implicit role for a meter tag.
*/
function getImplicitRoleForMeter() {
return 'progressbar';
}

View File

@@ -0,0 +1,12 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = getImplicitRoleForNav;
/**
* Returns the implicit role for a nav tag.
*/
function getImplicitRoleForNav() {
return 'navigation';
}

View File

@@ -0,0 +1,12 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = getImplicitRoleForOl;
/**
* Returns the implicit role for an ol tag.
*/
function getImplicitRoleForOl() {
return 'list';
}

View File

@@ -0,0 +1,12 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = getImplicitRoleForOption;
/**
* Returns the implicit role for an option tag.
*/
function getImplicitRoleForOption() {
return 'option';
}

View File

@@ -0,0 +1,12 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = getImplicitRoleForOutput;
/**
* Returns the implicit role for an output tag.
*/
function getImplicitRoleForOutput() {
return 'status';
}

View File

@@ -0,0 +1,12 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = getImplicitRoleForProgress;
/**
* Returns the implicit role for a progress tag.
*/
function getImplicitRoleForProgress() {
return 'progressbar';
}

View File

@@ -0,0 +1,12 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = getImplicitRoleForSection;
/**
* Returns the implicit role for a section tag.
*/
function getImplicitRoleForSection() {
return 'region';
}

View File

@@ -0,0 +1,12 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = getImplicitRoleForSelect;
/**
* Returns the implicit role for a select tag.
*/
function getImplicitRoleForSelect() {
return 'listbox';
}

View File

@@ -0,0 +1,12 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = getImplicitRoleForTbody;
/**
* Returns the implicit role for a tbody tag.
*/
function getImplicitRoleForTbody() {
return 'rowgroup';
}

View File

@@ -0,0 +1,12 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = getImplicitRoleForTextarea;
/**
* Returns the implicit role for a textarea tag.
*/
function getImplicitRoleForTextarea() {
return 'textbox';
}

View File

@@ -0,0 +1,12 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = getImplicitRoleForTfoot;
/**
* Returns the implicit role for a tfoot tag.
*/
function getImplicitRoleForTfoot() {
return 'rowgroup';
}

View File

@@ -0,0 +1,12 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = getImplicitRoleForThead;
/**
* Returns the implicit role for a thead tag.
*/
function getImplicitRoleForThead() {
return 'rowgroup';
}

View File

@@ -0,0 +1,12 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = getImplicitRoleForUl;
/**
* Returns the implicit role for a ul tag.
*/
function getImplicitRoleForUl() {
return 'list';
}

View File

@@ -0,0 +1,31 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _ariaQuery = require('aria-query');
var _jsxAstUtils = require('jsx-ast-utils');
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
var abstractRoles = new Set([].concat(_toConsumableArray(_ariaQuery.roles.keys())).filter(function (role) {
return _ariaQuery.roles.get(role).abstract;
}));
var DOMElements = [].concat(_toConsumableArray(_ariaQuery.dom.keys()));
var isAbstractRole = function isAbstractRole(tagName, attributes) {
// Do not test higher level JSX components, as we do not know what
// low-level DOM element this maps to.
if (DOMElements.indexOf(tagName) === -1) {
return false;
}
var role = (0, _jsxAstUtils.getLiteralPropValue)((0, _jsxAstUtils.getProp)(attributes, 'role'));
return abstractRoles.has(role);
};
exports.default = isAbstractRole;

View File

@@ -0,0 +1,29 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _jsxAstUtils = require('jsx-ast-utils');
/**
* Returns boolean indicating that the aria-hidden prop
* is present or the value is true. Will also return true if
* there is an input with type='hidden'.
*
* <div aria-hidden /> is equivalent to the DOM as <div aria-hidden=true />.
*/
var isHiddenFromScreenReader = function isHiddenFromScreenReader(type, attributes) {
if (type.toUpperCase() === 'INPUT') {
var hidden = (0, _jsxAstUtils.getLiteralPropValue)((0, _jsxAstUtils.getProp)(attributes, 'type'));
if (hidden && hidden.toUpperCase() === 'HIDDEN') {
return true;
}
}
var ariaHidden = (0, _jsxAstUtils.getPropValue)((0, _jsxAstUtils.getProp)(attributes, 'aria-hidden'));
return ariaHidden === true;
};
exports.default = isHiddenFromScreenReader;

View File

@@ -0,0 +1,129 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
var _ariaQuery = require('aria-query');
var _axobjectQuery = require('axobject-query');
var _arrayIncludes = require('array-includes');
var _arrayIncludes2 = _interopRequireDefault(_arrayIncludes);
var _attributesComparator = require('./attributesComparator');
var _attributesComparator2 = _interopRequireDefault(_attributesComparator);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
var roleKeys = [].concat(_toConsumableArray(_ariaQuery.roles.keys()));
var elementRoleEntries = [].concat(_toConsumableArray(_ariaQuery.elementRoles));
var nonInteractiveRoles = new Set(roleKeys.filter(function (name) {
var role = _ariaQuery.roles.get(name);
return !role.abstract && !role.superClass.some(function (classes) {
return (0, _arrayIncludes2.default)(classes, 'widget');
});
}));
var interactiveRoles = new Set([].concat(roleKeys,
// 'toolbar' does not descend from widget, but it does support
// aria-activedescendant, thus in practice we treat it as a widget.
'toolbar').filter(function (name) {
var role = _ariaQuery.roles.get(name);
return !role.abstract && role.superClass.some(function (classes) {
return (0, _arrayIncludes2.default)(classes, 'widget');
});
}));
var nonInteractiveElementRoleSchemas = elementRoleEntries.reduce(function (accumulator, _ref) {
var _ref2 = _slicedToArray(_ref, 2),
elementSchema = _ref2[0],
roleSet = _ref2[1];
if ([].concat(_toConsumableArray(roleSet)).every(function (role) {
return nonInteractiveRoles.has(role);
})) {
accumulator.push(elementSchema);
}
return accumulator;
}, []);
var interactiveElementRoleSchemas = elementRoleEntries.reduce(function (accumulator, _ref3) {
var _ref4 = _slicedToArray(_ref3, 2),
elementSchema = _ref4[0],
roleSet = _ref4[1];
if ([].concat(_toConsumableArray(roleSet)).some(function (role) {
return interactiveRoles.has(role);
})) {
accumulator.push(elementSchema);
}
return accumulator;
}, []);
var interactiveAXObjects = new Set([].concat(_toConsumableArray(_axobjectQuery.AXObjects.keys())).filter(function (name) {
return _axobjectQuery.AXObjects.get(name).type === 'widget';
}));
var interactiveElementAXObjectSchemas = [].concat(_toConsumableArray(_axobjectQuery.elementAXObjects)).reduce(function (accumulator, _ref5) {
var _ref6 = _slicedToArray(_ref5, 2),
elementSchema = _ref6[0],
AXObjectSet = _ref6[1];
if ([].concat(_toConsumableArray(AXObjectSet)).every(function (role) {
return interactiveAXObjects.has(role);
})) {
accumulator.push(elementSchema);
}
return accumulator;
}, []);
function checkIsInteractiveElement(tagName, attributes) {
function elementSchemaMatcher(elementSchema) {
return tagName === elementSchema.name && (0, _attributesComparator2.default)(elementSchema.attributes, attributes);
}
// Check in elementRoles for inherent interactive role associations for
// this element.
var isInherentInteractiveElement = interactiveElementRoleSchemas.some(elementSchemaMatcher);
if (isInherentInteractiveElement) {
return true;
}
// Check in elementRoles for inherent non-interactive role associations for
// this element.
var isInherentNonInteractiveElement = nonInteractiveElementRoleSchemas.some(elementSchemaMatcher);
if (isInherentNonInteractiveElement) {
return false;
}
// Check in elementAXObjects for AX Tree associations for this element.
var isInteractiveAXElement = interactiveElementAXObjectSchemas.some(elementSchemaMatcher);
if (isInteractiveAXElement) {
return true;
}
return false;
}
/**
* Returns boolean indicating whether the given element is
* interactive on the DOM or not. Usually used when an element
* has a dynamic handler on it and we need to discern whether or not
* it's intention is to be interacted with on the DOM.
*/
var isInteractiveElement = function isInteractiveElement(tagName, attributes) {
// Do not test higher level JSX components, as we do not know what
// low-level DOM element this maps to.
if (!_ariaQuery.dom.keys(tagName)) {
return false;
}
return checkIsInteractiveElement(tagName, attributes);
};
exports.default = isInteractiveElement;

View File

@@ -0,0 +1,68 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _ariaQuery = require('aria-query');
var _jsxAstUtils = require('jsx-ast-utils');
var _arrayIncludes = require('array-includes');
var _arrayIncludes2 = _interopRequireDefault(_arrayIncludes);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
var roles = [].concat(_toConsumableArray(_ariaQuery.roles.keys()));
var interactiveRoles = roles.filter(function (name) {
return !_ariaQuery.roles.get(name).abstract;
}).filter(function (name) {
return _ariaQuery.roles.get(name).superClass.some(function (klasses) {
return (0, _arrayIncludes2.default)(klasses, 'widget');
});
});
// 'toolbar' does not descend from widget, but it does support
// aria-activedescendant, thus in practice we treat it as a widget.
interactiveRoles.push('toolbar');
/**
* Returns boolean indicating whether the given element has a role
* that is associated with an interactive component. Used when an element
* has a dynamic handler on it and we need to discern whether or not
* its intention is to be interacted with in the DOM.
*
* isInteractiveRole is a Logical Disjunction:
* https://en.wikipedia.org/wiki/Logical_disjunction
* The JSX element does not have a tagName or it has a tagName and a role
* attribute with a value in the set of non-interactive roles.
*/
var isInteractiveRole = function isInteractiveRole(tagName, attributes) {
var value = (0, _jsxAstUtils.getLiteralPropValue)((0, _jsxAstUtils.getProp)(attributes, 'role'));
// If value is undefined, then the role attribute will be dropped in the DOM.
// If value is null, then getLiteralAttributeValue is telling us that the
// value isn't in the form of a literal
if (value === undefined || value === null) {
return false;
}
var isInteractive = false;
var normalizedValues = String(value).toLowerCase().split(' ');
var validRoles = normalizedValues.reduce(function (accumulator, name) {
if ((0, _arrayIncludes2.default)(roles, name)) {
accumulator.push(name);
}
return accumulator;
}, []);
if (validRoles.length > 0) {
// The first role value is a series takes precedence.
isInteractive = (0, _arrayIncludes2.default)(interactiveRoles, validRoles[0]);
}
return isInteractive;
};
exports.default = isInteractiveRole;

View File

@@ -0,0 +1,131 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
var _ariaQuery = require('aria-query');
var _axobjectQuery = require('axobject-query');
var _arrayIncludes = require('array-includes');
var _arrayIncludes2 = _interopRequireDefault(_arrayIncludes);
var _attributesComparator = require('./attributesComparator');
var _attributesComparator2 = _interopRequireDefault(_attributesComparator);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
var roleKeys = [].concat(_toConsumableArray(_ariaQuery.roles.keys()));
var elementRoleEntries = [].concat(_toConsumableArray(_ariaQuery.elementRoles));
var nonInteractiveRoles = new Set(roleKeys.filter(function (name) {
var role = _ariaQuery.roles.get(name);
return !role.abstract && !role.superClass.some(function (classes) {
return (0, _arrayIncludes2.default)(classes, 'widget');
});
}));
var interactiveRoles = new Set([].concat(roleKeys,
// 'toolbar' does not descend from widget, but it does support
// aria-activedescendant, thus in practice we treat it as a widget.
'toolbar').filter(function (name) {
var role = _ariaQuery.roles.get(name);
return !role.abstract && role.superClass.some(function (classes) {
return (0, _arrayIncludes2.default)(classes, 'widget');
});
}));
var nonInteractiveElementRoleSchemas = elementRoleEntries.reduce(function (accumulator, _ref) {
var _ref2 = _slicedToArray(_ref, 2),
elementSchema = _ref2[0],
roleSet = _ref2[1];
if ([].concat(_toConsumableArray(roleSet)).every(function (role) {
return nonInteractiveRoles.has(role);
})) {
accumulator.push(elementSchema);
}
return accumulator;
}, []);
var interactiveElementRoleSchemas = elementRoleEntries.reduce(function (accumulator, _ref3) {
var _ref4 = _slicedToArray(_ref3, 2),
elementSchema = _ref4[0],
roleSet = _ref4[1];
if ([].concat(_toConsumableArray(roleSet)).some(function (role) {
return interactiveRoles.has(role);
})) {
accumulator.push(elementSchema);
}
return accumulator;
}, []);
var nonInteractiveAXObjects = new Set([].concat(_toConsumableArray(_axobjectQuery.AXObjects.keys())).filter(function (name) {
return (0, _arrayIncludes2.default)(['window', 'structure'], _axobjectQuery.AXObjects.get(name).type);
}));
var nonInteractiveElementAXObjectSchemas = [].concat(_toConsumableArray(_axobjectQuery.elementAXObjects)).reduce(function (accumulator, _ref5) {
var _ref6 = _slicedToArray(_ref5, 2),
elementSchema = _ref6[0],
AXObjectSet = _ref6[1];
if ([].concat(_toConsumableArray(AXObjectSet)).every(function (role) {
return nonInteractiveAXObjects.has(role);
})) {
accumulator.push(elementSchema);
}
return accumulator;
}, []);
function checkIsNonInteractiveElement(tagName, attributes) {
function elementSchemaMatcher(elementSchema) {
return tagName === elementSchema.name && (0, _attributesComparator2.default)(elementSchema.attributes, attributes);
}
// Check in elementRoles for inherent non-interactive role associations for
// this element.
var isInherentNonInteractiveElement = nonInteractiveElementRoleSchemas.some(elementSchemaMatcher);
if (isInherentNonInteractiveElement) {
return true;
}
// Check in elementRoles for inherent interactive role associations for
// this element.
var isInherentInteractiveElement = interactiveElementRoleSchemas.some(elementSchemaMatcher);
if (isInherentInteractiveElement) {
return false;
}
// Check in elementAXObjects for AX Tree associations for this element.
var isNonInteractiveAXElement = nonInteractiveElementAXObjectSchemas.some(elementSchemaMatcher);
if (isNonInteractiveAXElement) {
return true;
}
return false;
}
/**
* Returns boolean indicating whether the given element is a non-interactive
* element. If the element has either a non-interactive role assigned or it
* is an element with an inherently non-interactive role, then this utility
* returns true. Elements that lack either an explicitly assigned role or
* an inherent role are not considered. For those, this utility returns false
* because a positive determination of interactiveness cannot be determined.
*/
var isNonInteractiveElement = function isNonInteractiveElement(tagName, attributes) {
// Do not test higher level JSX components, as we do not know what
// low-level DOM element this maps to.
if (!_ariaQuery.dom.has(tagName)) {
return false;
}
return checkIsNonInteractiveElement(tagName, attributes);
};
exports.default = isNonInteractiveElement;

View File

@@ -0,0 +1,71 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _ariaQuery = require('aria-query');
var _jsxAstUtils = require('jsx-ast-utils');
var _arrayIncludes = require('array-includes');
var _arrayIncludes2 = _interopRequireDefault(_arrayIncludes);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
var roles = [].concat(_toConsumableArray(_ariaQuery.roles.keys()));
var nonInteractiveRoles = roles.filter(function (name) {
return !_ariaQuery.roles.get(name).abstract;
}).filter(function (name) {
return !_ariaQuery.roles.get(name).superClass.some(function (klasses) {
return (0, _arrayIncludes2.default)(klasses, 'widget');
});
});
/**
* Returns boolean indicating whether the given element has a role
* that is associated with a non-interactive component. Non-interactive roles
* include `listitem`, `article`, or `dialog`. These are roles that indicate
* for the most part containers.
*
* Elements with these roles should not respond or handle user interactions.
* For example, an `onClick` handler should not be assigned to an element with
* the role `listitem`. An element inside the `listitem`, like a button or a
* link, should handle the click.
*
* This utility returns true for elements that are assigned a non-interactive
* role. It will return false for elements that do not have a role. So whereas
* a `div` might be considered non-interactive, for the purpose of this utility,
* it is considered neither interactive nor non-interactive -- a determination
* cannot be made in this case and false is returned.
*/
var isNonInteractiveRole = function isNonInteractiveRole(tagName, attributes) {
// Do not test higher level JSX components, as we do not know what
// low-level DOM element this maps to.
if (!_ariaQuery.dom.has(tagName)) {
return false;
}
var role = (0, _jsxAstUtils.getLiteralPropValue)((0, _jsxAstUtils.getProp)(attributes, 'role'));
var isNonInteractive = false;
var normalizedValues = String(role).toLowerCase().split(' ');
var validRoles = normalizedValues.reduce(function (accumulator, name) {
if ((0, _arrayIncludes2.default)(roles, name)) {
accumulator.push(name);
}
return accumulator;
}, []);
if (validRoles.length > 0) {
// The first role value is a series takes precedence.
isNonInteractive = (0, _arrayIncludes2.default)(nonInteractiveRoles, validRoles[0]);
}
return isNonInteractive;
};
exports.default = isNonInteractiveRole;

View File

@@ -0,0 +1,15 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _jsxAstUtils = require('jsx-ast-utils');
var presentationRoles = new Set(['presentation', 'none']);
var isPresentationRole = function isPresentationRole(tagName, attributes) {
return presentationRoles.has((0, _jsxAstUtils.getLiteralPropValue)((0, _jsxAstUtils.getProp)(attributes, 'role')));
};
exports.default = isPresentationRole;

View File

@@ -0,0 +1,41 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
/**
* JSON schema to accept an array of unique strings
*/
var arraySchema = exports.arraySchema = {
type: 'array',
items: {
type: 'string'
},
uniqueItems: true,
additionalItems: false
};
/**
* JSON schema to accept an array of unique strings from an enumerated list.
*/
var enumArraySchema = exports.enumArraySchema = function enumArraySchema() {
var enumeratedList = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
return Object.assign({}, arraySchema, {
items: {
type: 'string',
enum: enumeratedList
}
});
};
/**
* Factory function to generate an object schema
* with specified properties object
*/
var generateObjSchema = exports.generateObjSchema = function generateObjSchema() {
var properties = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
return {
type: 'object',
properties: properties
};
};