1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | var toObjectMap = function () {
|
4 | var items = [];
|
5 | for (var _i = 0; _i < arguments.length; _i++) {
|
6 | items[_i] = arguments[_i];
|
7 | }
|
8 | var result = {};
|
9 | for (var _a = 0, items_1 = items; _a < items_1.length; _a++) {
|
10 | var item = items_1[_a];
|
11 | var keys = Array.isArray(item) ? item : Object.keys(item);
|
12 | for (var _b = 0, keys_1 = keys; _b < keys_1.length; _b++) {
|
13 | var key = keys_1[_b];
|
14 | result[key] = 1;
|
15 | }
|
16 | }
|
17 | return result;
|
18 | };
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 | exports.baseElementEvents = toObjectMap([
|
25 | 'onCopy',
|
26 | 'onCut',
|
27 | 'onPaste',
|
28 | 'onCompositionEnd',
|
29 | 'onCompositionStart',
|
30 | 'onCompositionUpdate',
|
31 | 'onFocus',
|
32 | 'onFocusCapture',
|
33 | 'onBlur',
|
34 | 'onBlurCapture',
|
35 | 'onChange',
|
36 | 'onInput',
|
37 | 'onSubmit',
|
38 | 'onLoad',
|
39 | 'onError',
|
40 | 'onKeyDown',
|
41 | 'onKeyDownCapture',
|
42 | 'onKeyPress',
|
43 | 'onKeyUp',
|
44 | 'onAbort',
|
45 | 'onCanPlay',
|
46 | 'onCanPlayThrough',
|
47 | 'onDurationChange',
|
48 | 'onEmptied',
|
49 | 'onEncrypted',
|
50 | 'onEnded',
|
51 | 'onLoadedData',
|
52 | 'onLoadedMetadata',
|
53 | 'onLoadStart',
|
54 | 'onPause',
|
55 | 'onPlay',
|
56 | 'onPlaying',
|
57 | 'onProgress',
|
58 | 'onRateChange',
|
59 | 'onSeeked',
|
60 | 'onSeeking',
|
61 | 'onStalled',
|
62 | 'onSuspend',
|
63 | 'onTimeUpdate',
|
64 | 'onVolumeChange',
|
65 | 'onWaiting',
|
66 | 'onClick',
|
67 | 'onClickCapture',
|
68 | 'onContextMenu',
|
69 | 'onDoubleClick',
|
70 | 'onDrag',
|
71 | 'onDragEnd',
|
72 | 'onDragEnter',
|
73 | 'onDragExit',
|
74 | 'onDragLeave',
|
75 | 'onDragOver',
|
76 | 'onDragStart',
|
77 | 'onDrop',
|
78 | 'onMouseDown',
|
79 | 'onMouseDownCapture',
|
80 | 'onMouseEnter',
|
81 | 'onMouseLeave',
|
82 | 'onMouseMove',
|
83 | 'onMouseOut',
|
84 | 'onMouseOver',
|
85 | 'onMouseUp',
|
86 | 'onMouseUpCapture',
|
87 | 'onSelect',
|
88 | 'onTouchCancel',
|
89 | 'onTouchEnd',
|
90 | 'onTouchMove',
|
91 | 'onTouchStart',
|
92 | 'onScroll',
|
93 | 'onWheel',
|
94 | 'onPointerCancel',
|
95 | 'onPointerDown',
|
96 | 'onPointerEnter',
|
97 | 'onPointerLeave',
|
98 | 'onPointerMove',
|
99 | 'onPointerOut',
|
100 | 'onPointerOver',
|
101 | 'onPointerUp',
|
102 | 'onGotPointerCapture',
|
103 | 'onLostPointerCapture',
|
104 | ]);
|
105 |
|
106 |
|
107 |
|
108 |
|
109 |
|
110 | exports.baseElementProperties = toObjectMap([
|
111 | 'accessKey',
|
112 | 'children',
|
113 | 'className',
|
114 | 'contentEditable',
|
115 | 'dir',
|
116 | 'draggable',
|
117 | 'hidden',
|
118 | 'htmlFor',
|
119 | 'id',
|
120 | 'lang',
|
121 | 'ref',
|
122 | 'role',
|
123 | 'style',
|
124 | 'tabIndex',
|
125 | 'title',
|
126 | 'translate',
|
127 | 'spellCheck',
|
128 | 'name',
|
129 | ]);
|
130 |
|
131 |
|
132 |
|
133 |
|
134 |
|
135 | exports.htmlElementProperties = toObjectMap(exports.baseElementProperties, exports.baseElementEvents);
|
136 |
|
137 |
|
138 |
|
139 |
|
140 |
|
141 | exports.labelProperties = toObjectMap(exports.htmlElementProperties, [
|
142 | 'form',
|
143 | ]);
|
144 |
|
145 |
|
146 |
|
147 |
|
148 |
|
149 | exports.audioProperties = toObjectMap(exports.htmlElementProperties, [
|
150 | 'height',
|
151 | 'loop',
|
152 | 'muted',
|
153 | 'preload',
|
154 | 'src',
|
155 | 'width',
|
156 | ]);
|
157 |
|
158 |
|
159 |
|
160 |
|
161 |
|
162 | exports.videoProperties = toObjectMap(exports.audioProperties, [
|
163 | 'poster',
|
164 | ]);
|
165 |
|
166 |
|
167 |
|
168 |
|
169 |
|
170 | exports.olProperties = toObjectMap(exports.htmlElementProperties, [
|
171 | 'start',
|
172 | ]);
|
173 |
|
174 |
|
175 |
|
176 |
|
177 |
|
178 | exports.liProperties = toObjectMap(exports.htmlElementProperties, [
|
179 | 'value',
|
180 | ]);
|
181 |
|
182 |
|
183 |
|
184 |
|
185 |
|
186 | exports.anchorProperties = toObjectMap(exports.htmlElementProperties, [
|
187 | 'download',
|
188 | 'href',
|
189 | 'hrefLang',
|
190 | 'media',
|
191 | 'rel',
|
192 | 'target',
|
193 | 'type',
|
194 | ]);
|
195 |
|
196 |
|
197 |
|
198 |
|
199 |
|
200 | exports.buttonProperties = toObjectMap(exports.htmlElementProperties, [
|
201 | 'autoFocus',
|
202 | 'disabled',
|
203 | 'form',
|
204 | 'formAction',
|
205 | 'formEncType',
|
206 | 'formMethod',
|
207 | 'formNoValidate',
|
208 | 'formTarget',
|
209 | 'type',
|
210 | 'value',
|
211 | ]);
|
212 |
|
213 |
|
214 |
|
215 |
|
216 |
|
217 | exports.inputProperties = toObjectMap(exports.buttonProperties, [
|
218 | 'accept',
|
219 | 'alt',
|
220 | 'autoCapitalize',
|
221 | 'autoComplete',
|
222 | 'checked',
|
223 | 'dirname',
|
224 | 'form',
|
225 | 'height',
|
226 | 'inputMode',
|
227 | 'list',
|
228 | 'max',
|
229 | 'maxLength',
|
230 | 'min',
|
231 | 'multiple',
|
232 | 'pattern',
|
233 | 'placeholder',
|
234 | 'readOnly',
|
235 | 'required',
|
236 | 'src',
|
237 | 'step',
|
238 | 'size',
|
239 | 'type',
|
240 | 'value',
|
241 | 'width',
|
242 | ]);
|
243 |
|
244 |
|
245 |
|
246 |
|
247 |
|
248 | exports.textAreaProperties = toObjectMap(exports.buttonProperties, [
|
249 | 'autoCapitalize',
|
250 | 'cols',
|
251 | 'dirname',
|
252 | 'form',
|
253 | 'maxLength',
|
254 | 'placeholder',
|
255 | 'readOnly',
|
256 | 'required',
|
257 | 'rows',
|
258 | 'wrap',
|
259 | ]);
|
260 |
|
261 |
|
262 |
|
263 |
|
264 |
|
265 | exports.selectProperties = toObjectMap(exports.buttonProperties, [
|
266 | 'form',
|
267 | 'multiple',
|
268 | 'required',
|
269 | ]);
|
270 | exports.optionProperties = toObjectMap(exports.htmlElementProperties, [
|
271 | 'selected',
|
272 | 'value',
|
273 | ]);
|
274 |
|
275 |
|
276 |
|
277 |
|
278 |
|
279 | exports.tableProperties = toObjectMap(exports.htmlElementProperties, [
|
280 | 'cellPadding',
|
281 | 'cellSpacing',
|
282 | ]);
|
283 |
|
284 |
|
285 |
|
286 |
|
287 |
|
288 | exports.trProperties = exports.htmlElementProperties;
|
289 |
|
290 |
|
291 |
|
292 |
|
293 |
|
294 | exports.thProperties = toObjectMap(exports.htmlElementProperties, [
|
295 | 'rowSpan',
|
296 | 'scope',
|
297 | ]);
|
298 |
|
299 |
|
300 |
|
301 |
|
302 |
|
303 | exports.tdProperties = toObjectMap(exports.htmlElementProperties, [
|
304 | 'colSpan',
|
305 | 'headers',
|
306 | 'rowSpan',
|
307 | 'scope',
|
308 | ]);
|
309 | exports.colGroupProperties = toObjectMap(exports.htmlElementProperties, [
|
310 | 'span',
|
311 | ]);
|
312 | exports.colProperties = toObjectMap(exports.htmlElementProperties, [
|
313 | 'span',
|
314 | ]);
|
315 |
|
316 |
|
317 |
|
318 |
|
319 |
|
320 | exports.formProperties = toObjectMap(exports.htmlElementProperties, [
|
321 | 'acceptCharset',
|
322 | 'action',
|
323 | 'encType',
|
324 | 'encType',
|
325 | 'method',
|
326 | 'noValidate',
|
327 | 'target',
|
328 | ]);
|
329 |
|
330 |
|
331 |
|
332 |
|
333 |
|
334 | exports.iframeProperties = toObjectMap(exports.htmlElementProperties, [
|
335 | 'allow',
|
336 | 'allowFullScreen',
|
337 | 'allowPaymentRequest',
|
338 | 'allowTransparency',
|
339 | 'csp',
|
340 | 'height',
|
341 | 'importance',
|
342 | 'referrerPolicy',
|
343 | 'sandbox',
|
344 | 'src',
|
345 | 'srcDoc',
|
346 | 'width',
|
347 | ]);
|
348 |
|
349 |
|
350 |
|
351 |
|
352 |
|
353 | exports.imgProperties = toObjectMap(exports.htmlElementProperties, [
|
354 | 'alt',
|
355 | 'crossOrigin',
|
356 | 'height',
|
357 | 'src',
|
358 | 'srcSet',
|
359 | 'useMap',
|
360 | 'width',
|
361 | ]);
|
362 |
|
363 |
|
364 |
|
365 | exports.imageProperties = exports.imgProperties;
|
366 |
|
367 |
|
368 |
|
369 |
|
370 |
|
371 | exports.divProperties = exports.htmlElementProperties;
|
372 |
|
373 |
|
374 |
|
375 |
|
376 |
|
377 |
|
378 |
|
379 |
|
380 |
|
381 |
|
382 |
|
383 |
|
384 |
|
385 |
|
386 |
|
387 | function getNativeProps(
|
388 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
389 | props, allowedPropNames, excludedPropNames) {
|
390 |
|
391 |
|
392 |
|
393 |
|
394 |
|
395 | var _a;
|
396 | var isArray = Array.isArray(allowedPropNames);
|
397 |
|
398 | var result = {};
|
399 | var keys = Object.keys(props);
|
400 | for (var _i = 0, keys_2 = keys; _i < keys_2.length; _i++) {
|
401 | var key = keys_2[_i];
|
402 | var isNativeProp = (!isArray && allowedPropNames[key]) ||
|
403 | (isArray && allowedPropNames.indexOf(key) >= 0) ||
|
404 | key.indexOf('data-') === 0 ||
|
405 | key.indexOf('aria-') === 0;
|
406 | if (isNativeProp && (!excludedPropNames || ((_a = excludedPropNames) === null || _a === void 0 ? void 0 : _a.indexOf(key)) === -1)) {
|
407 |
|
408 | result[key] = props[key];
|
409 | }
|
410 | }
|
411 | return result;
|
412 | }
|
413 | exports.getNativeProps = getNativeProps;
|
414 |
|
\ | No newline at end of file |