@elliemae/ds-props-helpers 2.2.0 → 2.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/globalProps/constants.js +15 -0
- package/cjs/globalProps/globalAttributesPropTypes.js +382 -0
- package/cjs/globalProps/index.js +11 -0
- package/cjs/globalProps/useGetGlobalAttributes.js +36 -0
- package/cjs/index.js +8 -0
- package/cjs/propTypes/PropTypes.js +130 -0
- package/cjs/propTypes/customPropTypes.js +21 -0
- package/cjs/propTypes/describe.js +64 -0
- package/cjs/propTypes/describeConversions.js +104 -0
- package/cjs/propTypes/describeGuards.js +21 -0
- package/cjs/propTypes/index.js +11 -0
- package/cjs/propTypes/toTypescript.js +160 -0
- package/cjs/propTypes/types.js +2 -0
- package/cjs/validation/typescriptValidator.js +3 -2
- package/esm/globalProps/constants.js +11 -0
- package/esm/globalProps/globalAttributesPropTypes.js +378 -0
- package/esm/globalProps/index.js +2 -0
- package/esm/globalProps/useGetGlobalAttributes.js +32 -0
- package/esm/index.js +4 -0
- package/esm/propTypes/PropTypes.js +124 -0
- package/esm/propTypes/customPropTypes.js +17 -0
- package/esm/propTypes/describe.js +62 -0
- package/esm/propTypes/describeConversions.js +96 -0
- package/esm/propTypes/describeGuards.js +10 -0
- package/esm/propTypes/index.js +2 -0
- package/esm/propTypes/toTypescript.js +154 -0
- package/esm/propTypes/types.js +1 -0
- package/esm/validation/typescriptValidator.js +2 -1
- package/package.json +56 -4
- package/types/globalProps/constants.d.ts +3 -0
- package/types/globalProps/globalAttributesPropTypes.d.ts +363 -0
- package/types/globalProps/index.d.ts +2 -0
- package/types/globalProps/useGetGlobalAttributes.d.ts +5 -0
- package/types/index.d.ts +2 -0
- package/types/propTypes/PropTypes.d.ts +3 -0
- package/types/propTypes/customPropTypes.d.ts +2 -0
- package/types/propTypes/describe.d.ts +3 -0
- package/types/propTypes/describeConversions.d.ts +3 -0
- package/types/propTypes/describeGuards.d.ts +9 -0
- package/types/propTypes/index.d.ts +3 -0
- package/types/propTypes/toTypescript.d.ts +3 -0
- package/types/propTypes/types.d.ts +96 -0
- package/types/tests/globalProps/TestComponent.d.ts +1 -0
- package/types/tests/{any.validation.test.d.ts → globalProps/globalAttributes.test.d.ts} +0 -0
- package/types/tests/{array.validation.test.d.ts → validation/any.validation.test.d.ts} +0 -0
- package/types/tests/{boolean.validation.test.d.ts → validation/array.validation.test.d.ts} +0 -0
- package/types/tests/{function.validation.test.d.ts → validation/boolean.validation.test.d.ts} +0 -0
- package/types/tests/{number.validation.test.d.ts → validation/function.validation.test.d.ts} +0 -0
- package/types/tests/{object.validation.test.d.ts → validation/number.validation.test.d.ts} +0 -0
- package/types/tests/{schema.validation.test.d.ts → validation/object.validation.test.d.ts} +0 -0
- package/types/tests/{string.validation.test.d.ts → validation/schema.validation.test.d.ts} +0 -0
- package/types/tests/{union.validation.test.d.ts → validation/string.validation.test.d.ts} +0 -0
- package/types/tests/{test.schema.d.ts → validation/test.schema.d.ts} +0 -0
- package/types/tests/validation/union.validation.test.d.ts +1 -0
- package/types/validation/typescriptValidator.d.ts +2 -2
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
4
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
5
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
6
|
+
var describeConversions = require('./describeConversions.js');
|
|
7
|
+
var toTypescript = require('./toTypescript.js');
|
|
8
|
+
|
|
9
|
+
function describe(ComponentInstance) {
|
|
10
|
+
if (!ComponentInstance) {
|
|
11
|
+
throw new Error('react-desc: component is required');
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const documentation = {
|
|
15
|
+
propTypes: {}
|
|
16
|
+
};
|
|
17
|
+
const DocumentedComponent = ComponentInstance;
|
|
18
|
+
|
|
19
|
+
const addDocumentationProp = propName => {
|
|
20
|
+
const func = value => {
|
|
21
|
+
documentation[propName] = value;
|
|
22
|
+
return DocumentedComponent;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
return func;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
DocumentedComponent.availableAt = addDocumentationProp('availableAt');
|
|
29
|
+
DocumentedComponent.description = addDocumentationProp('description');
|
|
30
|
+
DocumentedComponent.details = addDocumentationProp('details');
|
|
31
|
+
DocumentedComponent.deprecated = addDocumentationProp('deprecated');
|
|
32
|
+
DocumentedComponent.usage = addDocumentationProp('usage');
|
|
33
|
+
DocumentedComponent.intrinsicElement = addDocumentationProp('intrinsicElement');
|
|
34
|
+
|
|
35
|
+
DocumentedComponent.toTypescript = () => toTypescript(ComponentInstance, documentation);
|
|
36
|
+
|
|
37
|
+
Object.defineProperty(DocumentedComponent, 'propTypes', {
|
|
38
|
+
get: () => DocumentedComponent.propTypesValue,
|
|
39
|
+
set: value => {
|
|
40
|
+
if (!DocumentedComponent.propTypesValue) {
|
|
41
|
+
DocumentedComponent.propTypesValue = {};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
Object.keys(value).forEach(name => {
|
|
45
|
+
const propType = value[name];
|
|
46
|
+
let realPropType;
|
|
47
|
+
documentation.propTypes[name] = propType;
|
|
48
|
+
realPropType = describeConversions.convertPropType(propType);
|
|
49
|
+
|
|
50
|
+
if (value[name].reactDesc.required) {
|
|
51
|
+
realPropType = realPropType.isRequired;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
DocumentedComponent.propTypesValue[name] = realPropType;
|
|
55
|
+
return propType;
|
|
56
|
+
});
|
|
57
|
+
},
|
|
58
|
+
enumerable: true,
|
|
59
|
+
configurable: true
|
|
60
|
+
});
|
|
61
|
+
return DocumentedComponent;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
module.exports = describe;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
6
|
+
require('core-js/modules/esnext.async-iterator.map.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.map.js');
|
|
8
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
10
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
11
|
+
var PropTypes = require('prop-types');
|
|
12
|
+
var customPropTypes = require('./customPropTypes.js');
|
|
13
|
+
var describeGuards = require('./describeGuards.js');
|
|
14
|
+
|
|
15
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
16
|
+
|
|
17
|
+
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
18
|
+
|
|
19
|
+
const enrichPropType = (propType, reactDesc) => {
|
|
20
|
+
const func = function (props, propName, componentName) {
|
|
21
|
+
if (reactDesc && reactDesc.deprecated && propName in props && !reactDesc.warned) {
|
|
22
|
+
const {
|
|
23
|
+
version = '',
|
|
24
|
+
message = ''
|
|
25
|
+
} = reactDesc.deprecated;
|
|
26
|
+
const warning = "\"".concat(propName, "\" property of \"").concat(componentName, "\" will be deprecated on VERSION: ").concat(version, ".\n").concat(message);
|
|
27
|
+
console.warn(warning);
|
|
28
|
+
reactDesc.warned = true;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
for (var _len = arguments.length, rest = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
|
|
32
|
+
rest[_key - 3] = arguments[_key];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return propType(props, propName, componentName, ...rest);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
Object.defineProperty(func, 'isRequired', Object.getOwnPropertyDescriptor(propType, 'isRequired'));
|
|
39
|
+
return func;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const convertArray = array => array.map(type => convertPropType(type));
|
|
43
|
+
|
|
44
|
+
const convertShape = _shape => {
|
|
45
|
+
const result = {};
|
|
46
|
+
Object.keys(_shape).forEach(key => {
|
|
47
|
+
result[key] = convertPropType(_shape[key]);
|
|
48
|
+
});
|
|
49
|
+
return result;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const convertPropType = propType => {
|
|
53
|
+
if (!propType || !propType.type) {
|
|
54
|
+
throw new Error("react-desc: unknown error -- proptype is not well defined");
|
|
55
|
+
} // DimSum PropTypes conversion
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
if (propType.type === 'tuple') {
|
|
59
|
+
return enrichPropType(PropTypes__default["default"].arrayOf(customPropTypes.tupleValidator(convertArray(propType.args))), propType.reactDesc);
|
|
60
|
+
} // Default PropType conversion
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
const realPropType = PropTypes__default["default"][propType.type];
|
|
64
|
+
|
|
65
|
+
if (!realPropType) {
|
|
66
|
+
throw new Error("react-desc: unknown type ".concat(propType.type));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (describeGuards.hasArguments(propType)) {
|
|
70
|
+
if (describeGuards.isOneOfType(propType)) {
|
|
71
|
+
return enrichPropType(realPropType(convertArray(propType.args)), propType.reactDesc);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (describeGuards.isArrayOf(propType)) {
|
|
75
|
+
return enrichPropType(realPropType(convertPropType(propType.args)), propType.reactDesc);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (describeGuards.isShape(propType)) {
|
|
79
|
+
return enrichPropType(realPropType(convertShape(propType.args)), propType.reactDesc);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (describeGuards.isInstanceOf(propType)) {
|
|
83
|
+
return enrichPropType(realPropType(propType.args), propType.reactDesc);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (describeGuards.isOneOf(propType)) {
|
|
87
|
+
return enrichPropType(realPropType(propType.args), propType.reactDesc);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (describeGuards.isObjectOf(propType)) {
|
|
91
|
+
return enrichPropType(realPropType(propType.args), propType.reactDesc);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (describeGuards.isExact(propType)) {
|
|
95
|
+
return enrichPropType(realPropType(propType.args), propType.reactDesc);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
throw new Error("react-desc: unknown error -- proptype with args is not matching");
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return enrichPropType(realPropType, propType.reactDesc);
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
exports.convertPropType = convertPropType;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const hasArguments = (propType, realPropType) => !!propType.args;
|
|
6
|
+
const isOneOfType = (propType, realPropType) => propType.type === 'oneOfType';
|
|
7
|
+
const isArrayOf = (propType, realPropType) => propType.type === 'arrayOf';
|
|
8
|
+
const isShape = (propType, realPropType) => propType.type === 'shape';
|
|
9
|
+
const isInstanceOf = (propType, realPropType) => propType.type === 'instanceOf';
|
|
10
|
+
const isOneOf = (propType, realPropType) => propType.type === 'oneOf';
|
|
11
|
+
const isObjectOf = (propType, realPropType) => propType.type === 'objectOf';
|
|
12
|
+
const isExact = (propType, realPropType) => propType.type === 'exact';
|
|
13
|
+
|
|
14
|
+
exports.hasArguments = hasArguments;
|
|
15
|
+
exports.isArrayOf = isArrayOf;
|
|
16
|
+
exports.isExact = isExact;
|
|
17
|
+
exports.isInstanceOf = isInstanceOf;
|
|
18
|
+
exports.isObjectOf = isObjectOf;
|
|
19
|
+
exports.isOneOf = isOneOf;
|
|
20
|
+
exports.isOneOfType = isOneOfType;
|
|
21
|
+
exports.isShape = isShape;
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
4
|
+
require('core-js/modules/esnext.async-iterator.map.js');
|
|
5
|
+
require('core-js/modules/esnext.iterator.map.js');
|
|
6
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
8
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
9
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
10
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
11
|
+
|
|
12
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
13
|
+
|
|
14
|
+
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
15
|
+
|
|
16
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
17
|
+
|
|
18
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
19
|
+
|
|
20
|
+
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
|
21
|
+
|
|
22
|
+
/* eslint-disable @typescript-eslint/no-use-before-define */
|
|
23
|
+
|
|
24
|
+
/* eslint-disable complexity */
|
|
25
|
+
|
|
26
|
+
/* eslint-disable react/forbid-foreign-prop-types */
|
|
27
|
+
const arrayFormat = array => array.map(propType => propTypeFormat(propType));
|
|
28
|
+
|
|
29
|
+
const shapeFormat = shape => {
|
|
30
|
+
const props = Object.keys(shape).map(key => {
|
|
31
|
+
const value = shape[key];
|
|
32
|
+
let valueFormat;
|
|
33
|
+
|
|
34
|
+
if (value.type && (value.type === 'arrayOf' || value.type === 'oneOfType' || value.type === 'oneOf') && Array.isArray(value.args)) {
|
|
35
|
+
valueFormat = "".concat(propTypeFormat(value));
|
|
36
|
+
} else if (value.type === 'shape') {
|
|
37
|
+
valueFormat = "".concat(propTypeFormat(value));
|
|
38
|
+
} else {
|
|
39
|
+
valueFormat = propTypeFormat(value);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return "".concat(key).concat(value.reactDesc && value.reactDesc.required ? '' : '?', ": ").concat(valueFormat);
|
|
43
|
+
});
|
|
44
|
+
return "{".concat(props.join(','), "}");
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const propTypeFormat = function (propType) {
|
|
48
|
+
let joinWith = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
49
|
+
let result;
|
|
50
|
+
|
|
51
|
+
if (Array.isArray(propType)) {
|
|
52
|
+
result = arrayFormat(propType).join(joinWith);
|
|
53
|
+
} else if (typeof propType !== 'function' && propType.type) {
|
|
54
|
+
switch (propType.type) {
|
|
55
|
+
case 'array':
|
|
56
|
+
result = 'any[]';
|
|
57
|
+
break;
|
|
58
|
+
|
|
59
|
+
case 'arrayOf':
|
|
60
|
+
if (propType.args.type === 'oneOfType') {
|
|
61
|
+
result = "(".concat(propTypeFormat(propType.args, ' | '), ")[]");
|
|
62
|
+
} else {
|
|
63
|
+
result = "".concat(propTypeFormat(propType.args, '\n'), "[]");
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
break;
|
|
67
|
+
|
|
68
|
+
case 'tuple':
|
|
69
|
+
result = "[".concat(propTypeFormat(propType.args, ', '), "]");
|
|
70
|
+
break;
|
|
71
|
+
|
|
72
|
+
case 'bool':
|
|
73
|
+
result = 'boolean';
|
|
74
|
+
break;
|
|
75
|
+
|
|
76
|
+
case 'func':
|
|
77
|
+
result = '((...args: any[]) => any)';
|
|
78
|
+
break;
|
|
79
|
+
|
|
80
|
+
case 'node':
|
|
81
|
+
result = 'React.ReactNode';
|
|
82
|
+
break;
|
|
83
|
+
|
|
84
|
+
case 'element':
|
|
85
|
+
result = 'JSX.Element';
|
|
86
|
+
break;
|
|
87
|
+
|
|
88
|
+
case 'instanceOf':
|
|
89
|
+
result = 'any';
|
|
90
|
+
break;
|
|
91
|
+
|
|
92
|
+
case 'symbol':
|
|
93
|
+
result = 'any';
|
|
94
|
+
break;
|
|
95
|
+
|
|
96
|
+
case 'objectOf':
|
|
97
|
+
result = "{ [key: string]: ".concat(propTypeFormat(propType.args), " }");
|
|
98
|
+
break;
|
|
99
|
+
|
|
100
|
+
case 'oneOf':
|
|
101
|
+
result = propType.args.map(a => "\"".concat(a, "\"")).join(' | ');
|
|
102
|
+
break;
|
|
103
|
+
|
|
104
|
+
case 'oneOfType':
|
|
105
|
+
result = "".concat(propTypeFormat(propType.args, ' | '));
|
|
106
|
+
break;
|
|
107
|
+
|
|
108
|
+
case 'shape':
|
|
109
|
+
result = "".concat(shapeFormat(propType.args));
|
|
110
|
+
break;
|
|
111
|
+
|
|
112
|
+
default:
|
|
113
|
+
result = "".concat(propType.type);
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
} else {
|
|
117
|
+
result = 'any';
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return result;
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
const propTypeAsTypescript = (propType, propName) => {
|
|
124
|
+
const documentation = _objectSpread(_objectSpread({}, propType.reactDesc), {}, {
|
|
125
|
+
name: propName
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
documentation.format = propTypeFormat(propType);
|
|
129
|
+
return documentation;
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
function descToTypescript(component, reactDesc) {
|
|
133
|
+
if (!component) {
|
|
134
|
+
throw new Error('react-desc: component is required');
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const documentation = _objectSpread({
|
|
138
|
+
name: component.displayName || component.name
|
|
139
|
+
}, reactDesc);
|
|
140
|
+
|
|
141
|
+
if (reactDesc) {
|
|
142
|
+
delete documentation.propTypes;
|
|
143
|
+
|
|
144
|
+
if (reactDesc.propTypes) {
|
|
145
|
+
const propTypes = [];
|
|
146
|
+
Object.keys(reactDesc.propTypes).forEach(propName => {
|
|
147
|
+
const propType = reactDesc.propTypes[propName];
|
|
148
|
+
propTypes.push(propTypeAsTypescript(propType, propName));
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
if (propTypes.length > 0) {
|
|
152
|
+
documentation.properties = propTypes;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
return documentation;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
module.exports = descToTypescript;
|
|
@@ -6,8 +6,9 @@ require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
|
6
6
|
require('core-js/modules/esnext.iterator.constructor.js');
|
|
7
7
|
require('core-js/modules/esnext.iterator.for-each.js');
|
|
8
8
|
require('core-js/modules/web.dom-collections.iterator.js');
|
|
9
|
-
var reactDesc = require('react-desc');
|
|
10
9
|
var react = require('react');
|
|
10
|
+
require('../propTypes/PropTypes.js');
|
|
11
|
+
var describe = require('../propTypes/describe.js');
|
|
11
12
|
var errorTemplates = require('./errorTemplates.js');
|
|
12
13
|
var typescriptGuards = require('./typescriptGuards.js');
|
|
13
14
|
var typescriptParsers = require('./typescriptParsers.js');
|
|
@@ -191,7 +192,7 @@ const useValidateTypescriptPropTypes = (props, propTypes) => {
|
|
|
191
192
|
const Component = () => {}; // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call
|
|
192
193
|
|
|
193
194
|
|
|
194
|
-
return
|
|
195
|
+
return describe(Component);
|
|
195
196
|
}, []); // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment
|
|
196
197
|
|
|
197
198
|
ComponentWithSchema.propTypes = propTypes;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.map.js';
|
|
3
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
4
|
+
|
|
5
|
+
/* eslint-disable max-lines */
|
|
6
|
+
const ariaAttributes = ['aria-activedescendant', 'aria-atomic', 'aria-autocomplete', 'aria-busy', 'aria-checked', 'aria-colcount', 'aria-colindex', 'aria-colspan', 'aria-controls', 'aria-current', 'aria-describedby', 'aria-details', 'aria-disabled', 'aria-dropeffect', 'aria-errormessage', 'aria-expanded', 'aria-flowto', 'aria-grabbed', 'aria-haspopup', 'aria-hidden', 'aria-invalid', 'aria-keyshortcuts', 'aria-label', 'aria-labelledby', 'aria-level', 'aria-live', 'aria-modal', 'aria-multiline', 'aria-multiselectable', 'aria-orientation', 'aria-owns', 'aria-placeholder', 'aria-posinset', 'aria-pressed', 'aria-readonly', 'aria-relevant', 'aria-required', 'aria-roledescription', 'aria-rowcount', 'aria-rowindex', 'aria-rowspan', 'aria-selected', 'aria-setsize', 'aria-sort', 'aria-valuemax', 'aria-valuemin', 'aria-valuenow', 'aria-valuetext'];
|
|
7
|
+
const domAttributes = ['onCopy', 'onCopyCapture', 'onCut', 'onCutCapture', 'onPaste', 'onPasteCapture', 'onCompositionEnd', 'onCompositionEndCapture', 'onCompositionStart', 'onCompositionStartCapture', 'onCompositionUpdate', 'onCompositionUpdateCapture', 'onFocus', 'onFocusCapture', 'onBlur', 'onBlurCapture', 'onChange', 'onChangeCapture', 'onBeforeInput', 'onBeforeInputCapture', 'onInput', 'onInputCapture', 'onReset', 'onResetCapture', 'onSubmit', 'onSubmitCapture', 'onInvalid', 'onInvalidCapture', 'onLoad', 'onLoadCapture', 'onError', 'onErrorCapture', 'onKeyDown', 'onKeyDownCapture', 'onKeyPress', 'onKeyPressCapture', 'onKeyUp', 'onKeyUpCapture', 'onAbort', 'onAbortCapture', 'onCanPlay', 'onCanPlayCapture', 'onCanPlayThrough', 'onCanPlayThroughCapture', 'onDurationChange', 'onDurationChangeCapture', 'onEmptied', 'onEmptiedCapture', 'onEncrypted', 'onEncryptedCapture', 'onEnded', 'onEndedCapture', 'onLoadedData', 'onLoadedDataCapture', 'onLoadedMetadata', 'onLoadedMetadataCapture', 'onLoadStart', 'onLoadStartCapture', 'onPause', 'onPauseCapture', 'onPlay', 'onPlayCapture', 'onPlaying', 'onPlayingCapture', 'onProgress', 'onProgressCapture', 'onRateChange', 'onRateChangeCapture', 'onSeeked', 'onSeekedCapture', 'onSeeking', 'onSeekingCapture', 'onStalled', 'onStalledCapture', 'onSuspend', 'onSuspendCapture', 'onTimeUpdate', 'onTimeUpdateCapture', 'onVolumeChange', 'onVolumeChangeCapture', 'onWaiting', 'onWaitingCapture', 'onAuxClick', 'onAuxClickCapture', 'onClick', 'onClickCapture', 'onContextMenu', 'onContextMenuCapture', 'onDoubleClick', 'onDoubleClickCapture', 'onDrag', 'onDragCapture', 'onDragEnd', 'onDragEndCapture', 'onDragEnter', 'onDragEnterCapture', 'onDragExit', 'onDragExitCapture', 'onDragLeave', 'onDragLeaveCapture', 'onDragOver', 'onDragOverCapture', 'onDragStart', 'onDragStartCapture', 'onDrop', 'onDropCapture', 'onMouseDown', 'onMouseDownCapture', 'onMouseEnter', 'onMouseLeave', 'onMouseMove', 'onMouseMoveCapture', 'onMouseOut', 'onMouseOutCapture', 'onMouseOver', 'onMouseOverCapture', 'onMouseUp', 'onMouseUpCapture', 'onSelect', 'onSelectCapture', 'onTouchCancel', 'onTouchCancelCapture', 'onTouchEnd', 'onTouchEndCapture', 'onTouchMove', 'onTouchMoveCapture', 'onTouchStart', 'onTouchStartCapture', 'onPointerDown', 'onPointerDownCapture', 'onPointerMove', 'onPointerMoveCapture', 'onPointerUp', 'onPointerUpCapture', 'onPointerCancel', 'onPointerCancelCapture', 'onPointerEnter', 'onPointerEnterCapture', 'onPointerLeave', 'onPointerLeaveCapture', 'onPointerOver', 'onPointerOverCapture', 'onPointerOut', 'onPointerOutCapture', 'onGotPointerCapture', 'onGotPointerCaptureCapture', 'onLostPointerCapture', 'onLostPointerCaptureCapture', 'onScroll', 'onScrollCapture', 'onWheel', 'onWheelCapture', 'onAnimationStart', 'onAnimationStartCapture', 'onAnimationEnd', 'onAnimationEndCapture', 'onAnimationIteration', 'onAnimationIterationCapture', 'onTransitionEnd', 'onTransitionEndCapture'];
|
|
8
|
+
const htmlAttributes = ['about', 'accept', 'acceptCharset', 'accessKey', 'action', 'allowFullScreen', 'allowTransparency', 'alt', 'as', 'async', 'autoCapitalize', 'autoComplete', 'autoCorrect', 'autoFocus', 'autoPlay', 'autoSave', 'capture', 'cellPadding', 'cellSpacing', 'challenge', 'charSet', 'checked', 'cite', 'classID', 'className', 'color', 'cols', 'colSpan', 'content', 'contentEditable', 'contextMenu', 'controls', 'coords', 'crossOrigin', 'data', 'datatype', 'dateTime', 'default', 'defaultChecked', 'defaultValue', 'defer', 'dir', 'disabled', 'download', 'draggable', 'encType', 'form', 'formAction', 'formEncType', 'formMethod', 'formNoValidate', 'formTarget', 'frameBorder', 'headers', 'height', 'hidden', 'high', 'href', 'hrefLang', 'htmlFor', 'httpEquiv', 'id', 'inlist', 'inputMode', 'integrity', 'is', 'itemID', 'itemProp', 'itemRef', 'itemScope', 'itemType', 'keyParams', 'keyType', 'kind', 'label', 'lang', 'list', 'loop', 'low', 'manifest', 'marginHeight', 'marginWidth', 'max', 'maxLength', 'media', 'mediaGroup', 'method', 'min', 'minLength', 'multiple', 'muted', 'name', 'nonce', 'noValidate', 'open', 'optimum', 'pattern', 'placeholder', 'playsInline', 'poster', 'prefix', 'preload', 'property', 'radioGroup', 'readOnly', 'rel', 'required', 'resource', 'results', 'reversed', 'role', 'rows', 'rowSpan', 'sandbox', 'scope', 'scoped', 'scrolling', 'seamless', 'security', 'selected', 'shape', 'size', 'sizes', 'slot', 'span', 'spellCheck', 'src', 'srcDoc', 'srcLang', 'srcSet', 'start', 'step', 'style', 'summary', 'suppressContentEditableWarning', 'suppressHydrationWarning', 'tabIndex', 'target', 'title', 'translate', 'type', 'typeof', 'unselectable', 'useMap', 'value', 'vocab', 'width', 'wmode', 'wrap'];
|
|
9
|
+
const globalAttributes = Object.fromEntries([...ariaAttributes, ...domAttributes, ...htmlAttributes].map(entry => [entry, true]));
|
|
10
|
+
|
|
11
|
+
export { globalAttributes };
|