UNPKG

41.3 kBTypeScriptView Raw
1/**
2 * This file gets copied to all distributions of stencil component collections.
3 * - no imports
4 */
5
6export interface ComponentWillLoad {
7 /**
8 * The component is about to load and it has not
9 * rendered yet.
10 *
11 * This is the best place to make any data updates
12 * before the first render.
13 *
14 * componentWillLoad will only be called once.
15 */
16 componentWillLoad: () => Promise<void> | void;
17}
18
19export interface ComponentDidLoad {
20 /**
21 * The component has loaded and has already rendered.
22 *
23 * Updating data in this method will cause the
24 * component to re-render.
25 *
26 * componentDidLoad will only be called once.
27 */
28 componentDidLoad: () => void;
29}
30
31export interface ComponentWillUpdate {
32 /**
33 * The component is about to update and re-render.
34 *
35 * Called multiple times throughout the life of
36 * the component as it updates.
37 *
38 * componentWillUpdate is not called on the first render.
39 */
40 componentWillUpdate: () => Promise<void> | void;
41}
42
43export interface ComponentDidUpdate {
44 /**
45 * The component has just re-rendered.
46 *
47 * Called multiple times throughout the life of
48 * the component as it updates.
49 *
50 * componentWillUpdate is not called on the
51 * first render.
52 */
53 componentDidUpdate: () => void;
54}
55
56export interface ComponentDidUnload {
57 /**
58 * The component did unload and the element
59 * will be destroyed.
60 */
61 componentDidUnload: () => void;
62}
63
64export interface ComponentInstance {
65 connectedCallback?: () => void;
66 disconnectedCallback?: () => void;
67
68 /**
69 * The component is about to load and it has not
70 * rendered yet.
71 *
72 * This is the best place to make any data updates
73 * before the first render.
74 *
75 * componentWillLoad will only be called once.
76 */
77 componentWillLoad?: () => Promise<void> | void;
78
79 /**
80 * The component has loaded and has already rendered.
81 *
82 * Updating data in this method will cause the
83 * component to re-render.
84 *
85 * componentDidLoad will only be called once.
86 */
87 componentDidLoad?: () => void;
88
89 /**
90 * The component is about to update and re-render.
91 *
92 * Called multiple times throughout the life of
93 * the component as it updates.
94 *
95 * componentWillUpdate is not called on the first render.
96 */
97 componentWillUpdate?: () => Promise<void> | void;
98
99 /**
100 * The component has just re-rendered.
101 *
102 * Called multiple times throughout the life of
103 * the component as it updates.
104 *
105 * componentWillUpdate is not called on the
106 * first render.
107 */
108 componentDidUpdate?: () => void;
109
110 /**
111 * The component did unload and the element
112 * will be destroyed.
113 */
114 componentDidUnload?: () => void;
115
116 render?: () => any;
117
118 /**
119 * Used to dynamically set host element attributes.
120 * Should be placed directly above render()
121 */
122 hostData?: () => {
123 class?: {[className: string]: boolean};
124 style?: any;
125 [attrName: string]: any;
126 };
127
128 [memberName: string]: any;
129}
130
131
132/**
133 * General types important to applications using stencil built components
134 */
135export interface EventEmitter<T= any> {
136 emit: (data?: T) => CustomEvent<T>;
137}
138
139export interface QueueApi {
140 tick: (cb: RafCallback) => void;
141 read: (cb: RafCallback) => void;
142 write: (cb: RafCallback) => void;
143 clear?: () => void;
144 flush?: (cb?: () => void) => void;
145}
146
147export interface RafCallback {
148 (timeStamp: number): void;
149}
150
151export interface HTMLStencilElement extends HTMLElement {
152 componentOnReady(): Promise<this>;
153 forceUpdate(): void;
154}
155
156
157declare namespace LocalJSX {
158 export interface Element {}
159 export interface IntrinsicElements {}
160}
161export { LocalJSX as JSX };
162
163export namespace JSXBase {
164 export interface IntrinsicElements {
165 // Stencil elements
166 slot: JSXBase.SlotAttributes;
167
168 // HTML
169 a: JSXBase.AnchorHTMLAttributes<HTMLAnchorElement>;
170 abbr: JSXBase.HTMLAttributes;
171 address: JSXBase.HTMLAttributes;
172 area: JSXBase.AreaHTMLAttributes<HTMLAreaElement>;
173 article: JSXBase.HTMLAttributes;
174 aside: JSXBase.HTMLAttributes;
175 audio: JSXBase.AudioHTMLAttributes<HTMLAudioElement>;
176 b: JSXBase.HTMLAttributes;
177 base: JSXBase.BaseHTMLAttributes<HTMLBaseElement>;
178 bdi: JSXBase.HTMLAttributes;
179 bdo: JSXBase.HTMLAttributes;
180 big: JSXBase.HTMLAttributes;
181 blockquote: JSXBase.BlockquoteHTMLAttributes<HTMLQuoteElement>;
182 body: JSXBase.HTMLAttributes<HTMLBodyElement>;
183 br: JSXBase.HTMLAttributes<HTMLBRElement>;
184 button: JSXBase.ButtonHTMLAttributes<HTMLButtonElement>;
185 canvas: JSXBase.CanvasHTMLAttributes<HTMLCanvasElement>;
186 caption: JSXBase.HTMLAttributes<HTMLTableCaptionElement>;
187 cite: JSXBase.HTMLAttributes;
188 code: JSXBase.HTMLAttributes;
189 col: JSXBase.ColHTMLAttributes<HTMLTableColElement>;
190 colgroup: JSXBase.ColgroupHTMLAttributes<HTMLTableColElement>;
191 data: JSXBase.HTMLAttributes<HTMLDataElement>;
192 datalist: JSXBase.HTMLAttributes<HTMLDataListElement>;
193 dd: JSXBase.HTMLAttributes;
194 del: JSXBase.DelHTMLAttributes<HTMLModElement>;
195 details: JSXBase.DetailsHTMLAttributes<HTMLElement>;
196 dfn: JSXBase.HTMLAttributes;
197 dialog: JSXBase.DialogHTMLAttributes<HTMLDialogElement>;
198 div: JSXBase.HTMLAttributes<HTMLDivElement>;
199 dl: JSXBase.HTMLAttributes<HTMLDListElement>;
200 dt: JSXBase.HTMLAttributes;
201 em: JSXBase.HTMLAttributes;
202 embed: JSXBase.EmbedHTMLAttributes<HTMLEmbedElement>;
203 fieldset: JSXBase.FieldsetHTMLAttributes<HTMLFieldSetElement>;
204 figcaption: JSXBase.HTMLAttributes;
205 figure: JSXBase.HTMLAttributes;
206 footer: JSXBase.HTMLAttributes;
207 form: JSXBase.FormHTMLAttributes<HTMLFormElement>;
208 h1: JSXBase.HTMLAttributes<HTMLHeadingElement>;
209 h2: JSXBase.HTMLAttributes<HTMLHeadingElement>;
210 h3: JSXBase.HTMLAttributes<HTMLHeadingElement>;
211 h4: JSXBase.HTMLAttributes<HTMLHeadingElement>;
212 h5: JSXBase.HTMLAttributes<HTMLHeadingElement>;
213 h6: JSXBase.HTMLAttributes<HTMLHeadingElement>;
214 head: JSXBase.HTMLAttributes<HTMLHeadElement>;
215 header: JSXBase.HTMLAttributes;
216 hgroup: JSXBase.HTMLAttributes;
217 hr: JSXBase.HTMLAttributes<HTMLHRElement>;
218 html: JSXBase.HTMLAttributes<HTMLHtmlElement>;
219 i: JSXBase.HTMLAttributes;
220 iframe: JSXBase.IframeHTMLAttributes<HTMLIFrameElement>;
221 img: JSXBase.ImgHTMLAttributes<HTMLImageElement>;
222 input: JSXBase.InputHTMLAttributes<HTMLInputElement>;
223 ins: JSXBase.InsHTMLAttributes<HTMLModElement>;
224 kbd: JSXBase.HTMLAttributes;
225 keygen: JSXBase.KeygenHTMLAttributes<HTMLElement>;
226 label: JSXBase.LabelHTMLAttributes<HTMLLabelElement>;
227 legend: JSXBase.HTMLAttributes<HTMLLegendElement>;
228 li: JSXBase.LiHTMLAttributes<HTMLLIElement>;
229 link: JSXBase.LinkHTMLAttributes<HTMLLinkElement>;
230 main: JSXBase.HTMLAttributes;
231 map: JSXBase.MapHTMLAttributes<HTMLMapElement>;
232 mark: JSXBase.HTMLAttributes;
233 menu: JSXBase.MenuHTMLAttributes<HTMLMenuElement>;
234 menuitem: JSXBase.HTMLAttributes;
235 meta: JSXBase.MetaHTMLAttributes<HTMLMetaElement>;
236 meter: JSXBase.MeterHTMLAttributes<HTMLMeterElement>;
237 nav: JSXBase.HTMLAttributes;
238 noscript: JSXBase.HTMLAttributes;
239 object: JSXBase.ObjectHTMLAttributes<HTMLObjectElement>;
240 ol: JSXBase.OlHTMLAttributes<HTMLOListElement>;
241 optgroup: JSXBase.OptgroupHTMLAttributes<HTMLOptGroupElement>;
242 option: JSXBase.OptionHTMLAttributes<HTMLOptionElement>;
243 output: JSXBase.OutputHTMLAttributes<HTMLOutputElement>;
244 p: JSXBase.HTMLAttributes<HTMLParagraphElement>;
245 param: JSXBase.ParamHTMLAttributes<HTMLParamElement>;
246 picture: JSXBase.HTMLAttributes<HTMLPictureElement>;
247 pre: JSXBase.HTMLAttributes<HTMLPreElement>;
248 progress: JSXBase.ProgressHTMLAttributes<HTMLProgressElement>;
249 q: JSXBase.QuoteHTMLAttributes<HTMLQuoteElement>;
250 rp: JSXBase.HTMLAttributes;
251 rt: JSXBase.HTMLAttributes;
252 ruby: JSXBase.HTMLAttributes;
253 s: JSXBase.HTMLAttributes;
254 samp: JSXBase.HTMLAttributes;
255 script: JSXBase.ScriptHTMLAttributes<HTMLScriptElement>;
256 section: JSXBase.HTMLAttributes;
257 select: JSXBase.SelectHTMLAttributes<HTMLSelectElement>;
258 small: JSXBase.HTMLAttributes;
259 source: JSXBase.SourceHTMLAttributes<HTMLSourceElement>;
260 span: JSXBase.HTMLAttributes<HTMLSpanElement>;
261 strong: JSXBase.HTMLAttributes;
262 style: JSXBase.StyleHTMLAttributes<HTMLStyleElement>;
263 sub: JSXBase.HTMLAttributes;
264 summary: JSXBase.HTMLAttributes;
265 sup: JSXBase.HTMLAttributes;
266 table: JSXBase.TableHTMLAttributes<HTMLTableElement>;
267 tbody: JSXBase.HTMLAttributes<HTMLTableSectionElement>;
268 td: JSXBase.TdHTMLAttributes<HTMLTableDataCellElement>;
269 textarea: JSXBase.TextareaHTMLAttributes<HTMLTextAreaElement>;
270 tfoot: JSXBase.HTMLAttributes<HTMLTableSectionElement>;
271 th: JSXBase.ThHTMLAttributes<HTMLTableHeaderCellElement>;
272 thead: JSXBase.HTMLAttributes<HTMLTableSectionElement>;
273 time: JSXBase.TimeHTMLAttributes<HTMLTimeElement>;
274 title: JSXBase.HTMLAttributes<HTMLTitleElement>;
275 tr: JSXBase.HTMLAttributes<HTMLTableRowElement>;
276 track: JSXBase.TrackHTMLAttributes<HTMLTrackElement>;
277 u: JSXBase.HTMLAttributes;
278 ul: JSXBase.HTMLAttributes<HTMLUListElement>;
279 'var': JSXBase.HTMLAttributes;
280 video: JSXBase.VideoHTMLAttributes<HTMLVideoElement>;
281 wbr: JSXBase.HTMLAttributes;
282
283
284 // SVG
285 animate: JSXBase.SVGAttributes;
286 circle: JSXBase.SVGAttributes;
287 clipPath: JSXBase.SVGAttributes;
288 defs: JSXBase.SVGAttributes;
289 desc: JSXBase.SVGAttributes;
290 ellipse: JSXBase.SVGAttributes;
291 feBlend: JSXBase.SVGAttributes;
292 feColorMatrix: JSXBase.SVGAttributes;
293 feComponentTransfer: JSXBase.SVGAttributes;
294 feComposite: JSXBase.SVGAttributes;
295 feConvolveMatrix: JSXBase.SVGAttributes;
296 feDiffuseLighting: JSXBase.SVGAttributes;
297 feDisplacementMap: JSXBase.SVGAttributes;
298 feDistantLight: JSXBase.SVGAttributes;
299 feDropShadow: JSXBase.SVGAttributes;
300 feFlood: JSXBase.SVGAttributes;
301 feFuncA: JSXBase.SVGAttributes;
302 feFuncB: JSXBase.SVGAttributes;
303 feFuncG: JSXBase.SVGAttributes;
304 feFuncR: JSXBase.SVGAttributes;
305 feGaussianBlur: JSXBase.SVGAttributes;
306 feImage: JSXBase.SVGAttributes;
307 feMerge: JSXBase.SVGAttributes;
308 feMergeNode: JSXBase.SVGAttributes;
309 feMorphology: JSXBase.SVGAttributes;
310 feOffset: JSXBase.SVGAttributes;
311 fePointLight: JSXBase.SVGAttributes;
312 feSpecularLighting: JSXBase.SVGAttributes;
313 feSpotLight: JSXBase.SVGAttributes;
314 feTile: JSXBase.SVGAttributes;
315 feTurbulence: JSXBase.SVGAttributes;
316 filter: JSXBase.SVGAttributes;
317 foreignObject: JSXBase.SVGAttributes;
318 g: JSXBase.SVGAttributes;
319 image: JSXBase.SVGAttributes;
320 line: JSXBase.SVGAttributes;
321 linearGradient: JSXBase.SVGAttributes;
322 marker: JSXBase.SVGAttributes;
323 mask: JSXBase.SVGAttributes;
324 metadata: JSXBase.SVGAttributes;
325 path: JSXBase.SVGAttributes;
326 pattern: JSXBase.SVGAttributes;
327 polygon: JSXBase.SVGAttributes;
328 polyline: JSXBase.SVGAttributes;
329 radialGradient: JSXBase.SVGAttributes;
330 rect: JSXBase.SVGAttributes;
331 stop: JSXBase.SVGAttributes;
332 svg: JSXBase.SVGAttributes;
333 switch: JSXBase.SVGAttributes;
334 symbol: JSXBase.SVGAttributes;
335 text: JSXBase.SVGAttributes;
336 textPath: JSXBase.SVGAttributes;
337 tspan: JSXBase.SVGAttributes;
338 use: JSXBase.SVGAttributes;
339 view: JSXBase.SVGAttributes;
340 }
341
342 export interface SlotAttributes {
343 name?: string;
344 slot?: string;
345 }
346
347 export interface AnchorHTMLAttributes<T> extends HTMLAttributes<T> {
348 download?: any;
349 href?: string;
350 hrefLang?: string;
351 hreflang?: string;
352 media?: string;
353 rel?: string;
354 target?: string;
355 }
356
357 export interface AudioHTMLAttributes<T> extends MediaHTMLAttributes<T> {}
358
359 export interface AreaHTMLAttributes<T> extends HTMLAttributes<T> {
360 alt?: string;
361 coords?: string;
362 download?: any;
363 href?: string;
364 hrefLang?: string;
365 hreflang?: string;
366 media?: string;
367 rel?: string;
368 shape?: string;
369 target?: string;
370 }
371
372 export interface BaseHTMLAttributes<T> extends HTMLAttributes<T> {
373 href?: string;
374 target?: string;
375 }
376
377 export interface BlockquoteHTMLAttributes<T> extends HTMLAttributes<T> {
378 cite?: string;
379 }
380
381 export interface ButtonHTMLAttributes<T> extends HTMLAttributes<T> {
382 autoFocus?: boolean;
383 disabled?: boolean;
384 form?: string;
385 formAction?: string;
386 formaction?: string;
387 formEncType?: string;
388 formenctype?: string;
389 formMethod?: string;
390 formmethod?: string;
391 formNoValidate?: boolean;
392 formnovalidate?: boolean;
393 formTarget?: string;
394 formtarget?: string;
395 name?: string;
396 type?: string;
397 value?: string | string[] | number;
398 }
399
400 export interface CanvasHTMLAttributes<T> extends HTMLAttributes<T> {
401 height?: number | string;
402 width?: number | string;
403 }
404
405 export interface ColHTMLAttributes<T> extends HTMLAttributes<T> {
406 span?: number;
407 }
408
409 export interface ColgroupHTMLAttributes<T> extends HTMLAttributes<T> {
410 span?: number;
411 }
412
413 export interface DetailsHTMLAttributes<T> extends HTMLAttributes<T> {
414 open?: boolean;
415 }
416
417 export interface DelHTMLAttributes<T> extends HTMLAttributes<T> {
418 cite?: string;
419 dateTime?: string;
420 datetime?: string;
421 }
422
423 export interface DialogHTMLAttributes<T> extends HTMLAttributes<T> {
424 onClose?: (event: Event) => void;
425 open?: boolean;
426 returnValue?: string;
427 }
428
429 export interface EmbedHTMLAttributes<T> extends HTMLAttributes<T> {
430 height?: number | string;
431 src?: string;
432 type?: string;
433 width?: number | string;
434 }
435
436 export interface FieldsetHTMLAttributes<T> extends HTMLAttributes<T> {
437 disabled?: boolean;
438 form?: string;
439 name?: string;
440 }
441
442 export interface FormHTMLAttributes<T> extends HTMLAttributes<T> {
443 acceptCharset?: string;
444 acceptcharset?: string;
445 action?: string;
446 autoComplete?: string;
447 autocomplete?: string;
448 encType?: string;
449 enctype?: string;
450 method?: string;
451 name?: string;
452 noValidate?: boolean;
453 novalidate?: boolean | string;
454 target?: string;
455 }
456
457 export interface HtmlHTMLAttributes<T> extends HTMLAttributes<T> {
458 manifest?: string;
459 }
460
461 export interface IframeHTMLAttributes<T> extends HTMLAttributes<T> {
462 allowFullScreen?: boolean;
463 allowfullScreen?: string | boolean;
464 allowTransparency?: boolean;
465 allowtransparency?: string | boolean;
466 frameBorder?: number | string;
467 frameborder?: number | string;
468 importance?: 'low' | 'auto' | 'high';
469 height?: number | string;
470 loading?: 'lazy' | 'auto' | 'eager';
471 marginHeight?: number;
472 marginheight?: string | number;
473 marginWidth?: number;
474 marginwidth?: string | number;
475 name?: string;
476 sandbox?: string;
477 scrolling?: string;
478 seamless?: boolean;
479 src?: string;
480 srcDoc?: string;
481 srcdoc?: string;
482 width?: number | string;
483 }
484
485 export interface ImgHTMLAttributes<T> extends HTMLAttributes<T> {
486 alt?: string;
487 decoding?: 'async' | 'auto' | 'sync';
488 importance?: 'low' | 'auto' | 'high';
489 height?: number | string;
490 loading?: 'lazy' | 'auto' | 'eager';
491 sizes?: string;
492 src?: string;
493 srcSet?: string;
494 srcset?: string;
495 useMap?: string;
496 usemap?: string;
497 width?: number | string;
498 }
499
500 export interface InsHTMLAttributes<T> extends HTMLAttributes<T> {
501 cite?: string;
502 dateTime?: string;
503 datetime?: string;
504 }
505
506 export interface InputHTMLAttributes<T> extends HTMLAttributes<T> {
507 accept?: string;
508 alt?: string;
509 autoComplete?: string;
510 autocomplete?: string;
511 autoFocus?: boolean;
512 autofocus?: boolean | string;
513 capture?: string; // https://www.w3.org/TR/html-media-capture/#the-capture-attribute
514 checked?: boolean;
515 crossOrigin?: string;
516 crossorigin?: string;
517 disabled?: boolean;
518 form?: string;
519 formAction?: string;
520 formaction?: string;
521 formEncType?: string;
522 formenctype?: string;
523 formMethod?: string;
524 formmethod?: string;
525 formNoValidate?: boolean;
526 formnovalidate?: boolean;
527 formTarget?: string;
528 formtarget?: string;
529 height?: number | string;
530 list?: string;
531 max?: number | string;
532 maxLength?: number;
533 maxlength?: number | string;
534 min?: number | string;
535 minLength?: number;
536 minlength?: number | string;
537 multiple?: boolean;
538 name?: string;
539 pattern?: string;
540 placeholder?: string;
541 readOnly?: boolean;
542 readonly?: boolean | string;
543 required?: boolean;
544 size?: number;
545 src?: string;
546 step?: number | string;
547 type?: string;
548 value?: string | string[] | number;
549 width?: number | string;
550 }
551
552 export interface KeygenHTMLAttributes<T> extends HTMLAttributes<T> {
553 autoFocus?: boolean;
554 autofocus?: boolean | string;
555 challenge?: string;
556 disabled?: boolean;
557 form?: string;
558 keyType?: string;
559 keytype?: string;
560 keyParams?: string;
561 keyparams?: string;
562 name?: string;
563 }
564
565 export interface LabelHTMLAttributes<T> extends HTMLAttributes<T> {
566 form?: string;
567 htmlFor?: string;
568 htmlfor?: string;
569 }
570
571 export interface LiHTMLAttributes<T> extends HTMLAttributes<T> {
572 value?: string | string[] | number;
573 }
574
575 export interface LinkHTMLAttributes<T> extends HTMLAttributes<T> {
576 href?: string;
577 hrefLang?: string;
578 hreflang?: string;
579 importance?: 'low' | 'auto' | 'high';
580 integrity?: string;
581 media?: string;
582 rel?: string;
583 sizes?: string;
584 type?: string;
585 }
586
587 export interface MapHTMLAttributes<T> extends HTMLAttributes<T> {
588 name?: string;
589 }
590
591 export interface MenuHTMLAttributes<T> extends HTMLAttributes<T> {
592 type?: string;
593 }
594
595 export interface MediaHTMLAttributes<T> extends HTMLAttributes<T> {
596 autoPlay?: boolean;
597 autoplay?: boolean | string;
598 controls?: boolean;
599 crossOrigin?: string;
600 crossorigin?: string;
601 loop?: boolean;
602 mediaGroup?: string;
603 mediagroup?: string;
604 muted?: boolean;
605 preload?: string;
606 src?: string;
607
608 // https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Media_events
609 onAbort?: (event: Event) => void;
610 onCanPlay?: (event: Event) => void;
611 onCanPlayThrough?: (event: Event) => void;
612 onDurationChange?: (event: Event) => void;
613 onEmptied?: (event: Event) => void;
614 onEnded?: (event: Event) => void;
615 onError?: (event: Event) => void;
616 onInterruptBegin?: (event: Event) => void;
617 onInterruptEnd?: (event: Event) => void;
618 onLoadedData?: (event: Event) => void;
619 onLoadedMetaData?: (event: Event) => void;
620 onLoadStart?: (event: Event) => void;
621 onMozAudioAvailable?: (event: Event) => void;
622 onPause?: (event: Event) => void;
623 onPlay?: (event: Event) => void;
624 onPlaying?: (event: Event) => void;
625 onProgress?: (event: Event) => void;
626 onRateChange?: (event: Event) => void;
627 onSeeked?: (event: Event) => void;
628 onSeeking?: (event: Event) => void;
629 onStalled?: (event: Event) => void;
630 onSuspend?: (event: Event) => void;
631 onTimeUpdate?: (event: Event) => void;
632 onVolumeChange?: (event: Event) => void;
633 onWaiting?: (event: Event) => void;
634 }
635
636 export interface MetaHTMLAttributes<T> extends HTMLAttributes<T> {
637 charSet?: string;
638 charset?: string;
639 content?: string;
640 httpEquiv?: string;
641 httpequiv?: string;
642 name?: string;
643 }
644
645 export interface MeterHTMLAttributes<T> extends HTMLAttributes<T> {
646 form?: string;
647 high?: number;
648 low?: number;
649 max?: number | string;
650 min?: number | string;
651 optimum?: number;
652 value?: string | string[] | number;
653 }
654
655 export interface QuoteHTMLAttributes<T> extends HTMLAttributes<T> {
656 cite?: string;
657 }
658
659 export interface ObjectHTMLAttributes<T> extends HTMLAttributes<T> {
660 classID?: string;
661 classid?: string;
662 data?: string;
663 form?: string;
664 height?: number | string;
665 name?: string;
666 type?: string;
667 useMap?: string;
668 usemap?: string;
669 width?: number | string;
670 wmode?: string;
671 }
672
673 export interface OlHTMLAttributes<T> extends HTMLAttributes<T> {
674 reversed?: boolean;
675 start?: number;
676 }
677
678 export interface OptgroupHTMLAttributes<T> extends HTMLAttributes<T> {
679 disabled?: boolean;
680 label?: string;
681 }
682
683 export interface OptionHTMLAttributes<T> extends HTMLAttributes<T> {
684 disabled?: boolean;
685 label?: string;
686 selected?: boolean;
687 value?: string | string[] | number;
688 }
689
690 export interface OutputHTMLAttributes<T> extends HTMLAttributes<T> {
691 form?: string;
692 htmlFor?: string;
693 htmlfor?: string;
694 name?: string;
695 }
696
697 export interface ParamHTMLAttributes<T> extends HTMLAttributes<T> {
698 name?: string;
699 value?: string | string[] | number;
700 }
701
702 export interface ProgressHTMLAttributes<T> extends HTMLAttributes<T> {
703 max?: number | string;
704 value?: string | string[] | number;
705 }
706
707 export interface ScriptHTMLAttributes<T> extends HTMLAttributes<T> {
708 async?: boolean;
709 charSet?: string;
710 charset?: string;
711 crossOrigin?: string;
712 crossorigin?: string;
713 defer?: boolean;
714 importance?: 'low' | 'auto' | 'high';
715 integrity?: string;
716 nonce?: string;
717 src?: string;
718 type?: string;
719 }
720
721 export interface SelectHTMLAttributes<T> extends HTMLAttributes<T> {
722 autoFocus?: boolean;
723 disabled?: boolean;
724 form?: string;
725 multiple?: boolean;
726 name?: string;
727 required?: boolean;
728 size?: number;
729 }
730
731 export interface SourceHTMLAttributes<T> extends HTMLAttributes<T> {
732 media?: string;
733 sizes?: string;
734 src?: string;
735 srcSet?: string;
736 type?: string;
737 }
738
739 export interface StyleHTMLAttributes<T> extends HTMLAttributes<T> {
740 media?: string;
741 nonce?: string;
742 scoped?: boolean;
743 type?: string;
744 }
745
746 export interface TableHTMLAttributes<T> extends HTMLAttributes<T> {
747 cellPadding?: number | string;
748 cellpadding?: number | string;
749 cellSpacing?: number | string;
750 cellspacing?: number | string;
751 summary?: string;
752 }
753
754 export interface TextareaHTMLAttributes<T> extends HTMLAttributes<T> {
755 autoFocus?: boolean;
756 autofocus?: boolean | string;
757 cols?: number;
758 disabled?: boolean;
759 form?: string;
760 maxLength?: number;
761 maxlength?: number | string;
762 minLength?: number;
763 minlength?: number | string;
764 name?: string;
765 placeholder?: string;
766 readOnly?: boolean;
767 readonly?: boolean | string;
768 required?: boolean;
769 rows?: number;
770 value?: string | string[] | number;
771 wrap?: string;
772 }
773
774 export interface TdHTMLAttributes<T> extends HTMLAttributes<T> {
775 colSpan?: number;
776 headers?: string;
777 rowSpan?: number;
778 }
779
780 export interface ThHTMLAttributes<T> extends HTMLAttributes<T> {
781 colSpan?: number;
782 headers?: string;
783 rowSpan?: number;
784 rowspan?: number | string;
785 scope?: string;
786 }
787
788 export interface TimeHTMLAttributes<T> extends HTMLAttributes<T> {
789 dateTime?: string;
790 }
791
792 export interface TrackHTMLAttributes<T> extends HTMLAttributes<T> {
793 default?: boolean;
794 kind?: string;
795 label?: string;
796 src?: string;
797 srcLang?: string;
798 srclang?: string;
799 }
800
801 export interface VideoHTMLAttributes<T> extends MediaHTMLAttributes<T> {
802 height?: number | string;
803 playsInline?: boolean;
804 playsinline?: boolean | string;
805 poster?: string;
806 width?: number | string;
807 }
808
809 export interface HTMLAttributes<T = HTMLElement> extends DOMAttributes<T> {
810 // vdom specific
811 innerHTML?: string;
812 key?: string | number;
813
814 // Standard HTML Attributes
815 accessKey?: string;
816 class?: string | { [className: string]: boolean };
817 contentEditable?: boolean | string;
818 contenteditable?: boolean | string;
819 contextMenu?: string;
820 contextmenu?: string;
821 dir?: string;
822 draggable?: boolean;
823 hidden?: boolean;
824 id?: string;
825 lang?: string;
826 slot?: string;
827 spellCheck?: boolean;
828 spellcheck?: boolean | string;
829 style?: { [key: string]: string | undefined };
830 tabIndex?: number;
831 tabindex?: number | string;
832 title?: string;
833
834 // Unknown
835 inputMode?: string;
836 inputmode?: string;
837 is?: string;
838 radioGroup?: string; // <command>, <menuitem>
839 radiogroup?: string;
840 part?: string;
841
842 // WAI-ARIA
843 role?: string;
844
845 // RDFa Attributes
846 about?: string;
847 datatype?: string;
848 inlist?: any;
849 prefix?: string;
850 property?: string;
851 resource?: string;
852 typeof?: string;
853 vocab?: string;
854
855 // Non-standard Attributes
856 autoCapitalize?: string;
857 autocapitalize?: string;
858 autoCorrect?: string;
859 autocorrect?: string;
860 autoSave?: string;
861 autosave?: string;
862 color?: string;
863 itemProp?: string;
864 itemprop?: string;
865 itemScope?: boolean;
866 itemscope?: boolean;
867 itemType?: string;
868 itemtype?: string;
869 itemID?: string;
870 itemid?: string;
871 itemRef?: string;
872 itemref?: string;
873 results?: number;
874 security?: string;
875 unselectable?: boolean;
876 }
877
878 export interface SVGAttributes<T = SVGElement> extends DOMAttributes<T> {
879 // Attributes which also defined in HTMLAttributes
880 // See comment in SVGDOMPropertyConfig.js
881 class?: string | { [className: string]: boolean };
882 color?: string;
883 height?: number | string;
884 id?: string;
885 lang?: string;
886 max?: number | string;
887 media?: string;
888 method?: string;
889 min?: number | string;
890 name?: string;
891 style?: { [key: string]: string | undefined };
892 target?: string;
893 type?: string;
894 width?: number | string;
895
896 // Other HTML properties supported by SVG elements in browsers
897 role?: string;
898 tabIndex?: number;
899
900 // SVG Specific attributes
901 accentHeight?: number | string;
902 accumulate?: 'none' | 'sum';
903 additive?: 'replace' | 'sum';
904 alignmentBaseline?: 'auto' | 'baseline' | 'before-edge' | 'text-before-edge' | 'middle' | 'central' | 'after-edge' |
905 'text-after-edge' | 'ideographic' | 'alphabetic' | 'hanging' | 'mathematical' | 'inherit';
906 allowReorder?: 'no' | 'yes';
907 alphabetic?: number | string;
908 amplitude?: number | string;
909 arabicForm?: 'initial' | 'medial' | 'terminal' | 'isolated';
910 ascent?: number | string;
911 attributeName?: string;
912 attributeType?: string;
913 autoReverse?: number | string;
914 azimuth?: number | string;
915 baseFrequency?: number | string;
916 baselineShift?: number | string;
917 baseProfile?: number | string;
918 bbox?: number | string;
919 begin?: number | string;
920 bias?: number | string;
921 by?: number | string;
922 calcMode?: number | string;
923 capHeight?: number | string;
924 clip?: number | string;
925 clipPath?: string;
926 clipPathUnits?: number | string;
927 clipRule?: number | string;
928 colorInterpolation?: number | string;
929 colorInterpolationFilters?: 'auto' | 'sRGB' | 'linearRGB' | 'inherit';
930 colorProfile?: number | string;
931 colorRendering?: number | string;
932 contentScriptType?: number | string;
933 contentStyleType?: number | string;
934 cursor?: number | string;
935 cx?: number | string;
936 cy?: number | string;
937 d?: string;
938 decelerate?: number | string;
939 descent?: number | string;
940 diffuseConstant?: number | string;
941 direction?: number | string;
942 display?: number | string;
943 divisor?: number | string;
944 dominantBaseline?: number | string;
945 dur?: number | string;
946 dx?: number | string;
947 dy?: number | string;
948 edgeMode?: number | string;
949 elevation?: number | string;
950 enableBackground?: number | string;
951 end?: number | string;
952 exponent?: number | string;
953 externalResourcesRequired?: number | string;
954 fill?: string;
955 fillOpacity?: number | string;
956 fillRule?: 'nonzero' | 'evenodd' | 'inherit';
957 filter?: string;
958 filterRes?: number | string;
959 filterUnits?: number | string;
960 floodColor?: number | string;
961 floodOpacity?: number | string;
962 focusable?: number | string;
963 fontFamily?: string;
964 fontSize?: number | string;
965 fontSizeAdjust?: number | string;
966 fontStretch?: number | string;
967 fontStyle?: number | string;
968 fontVariant?: number | string;
969 fontWeight?: number | string;
970 format?: number | string;
971 from?: number | string;
972 fx?: number | string;
973 fy?: number | string;
974 g1?: number | string;
975 g2?: number | string;
976 glyphName?: number | string;
977 glyphOrientationHorizontal?: number | string;
978 glyphOrientationVertical?: number | string;
979 glyphRef?: number | string;
980 gradientTransform?: string;
981 gradientUnits?: string;
982 hanging?: number | string;
983 horizAdvX?: number | string;
984 horizOriginX?: number | string;
985 ideographic?: number | string;
986 imageRendering?: number | string;
987 in2?: number | string;
988 in?: string;
989 intercept?: number | string;
990 k1?: number | string;
991 k2?: number | string;
992 k3?: number | string;
993 k4?: number | string;
994 k?: number | string;
995 kernelMatrix?: number | string;
996 kernelUnitLength?: number | string;
997 kerning?: number | string;
998 keyPoints?: number | string;
999 keySplines?: number | string;
1000 keyTimes?: number | string;
1001 lengthAdjust?: number | string;
1002 letterSpacing?: number | string;
1003 lightingColor?: number | string;
1004 limitingConeAngle?: number | string;
1005 local?: number | string;
1006 markerEnd?: string;
1007 markerHeight?: number | string;
1008 markerMid?: string;
1009 markerStart?: string;
1010 markerUnits?: number | string;
1011 markerWidth?: number | string;
1012 mask?: string;
1013 maskContentUnits?: number | string;
1014 maskUnits?: number | string;
1015 mathematical?: number | string;
1016 mode?: number | string;
1017 numOctaves?: number | string;
1018 offset?: number | string;
1019 opacity?: number | string;
1020 operator?: number | string;
1021 order?: number | string;
1022 orient?: number | string;
1023 orientation?: number | string;
1024 origin?: number | string;
1025 overflow?: number | string;
1026 overlinePosition?: number | string;
1027 overlineThickness?: number | string;
1028 paintOrder?: number | string;
1029 panose1?: number | string;
1030 pathLength?: number | string;
1031 patternContentUnits?: string;
1032 patternTransform?: number | string;
1033 patternUnits?: string;
1034 pointerEvents?: number | string;
1035 points?: string;
1036 pointsAtX?: number | string;
1037 pointsAtY?: number | string;
1038 pointsAtZ?: number | string;
1039 preserveAlpha?: number | string;
1040 preserveAspectRatio?: string;
1041 primitiveUnits?: number | string;
1042 r?: number | string;
1043 radius?: number | string;
1044 refX?: number | string;
1045 refY?: number | string;
1046 renderingIntent?: number | string;
1047 repeatCount?: number | string;
1048 repeatDur?: number | string;
1049 requiredExtensions?: number | string;
1050 requiredFeatures?: number | string;
1051 restart?: number | string;
1052 result?: string;
1053 rotate?: number | string;
1054 rx?: number | string;
1055 ry?: number | string;
1056 scale?: number | string;
1057 seed?: number | string;
1058 shapeRendering?: number | string;
1059 slope?: number | string;
1060 spacing?: number | string;
1061 specularConstant?: number | string;
1062 specularExponent?: number | string;
1063 speed?: number | string;
1064 spreadMethod?: string;
1065 startOffset?: number | string;
1066 stdDeviation?: number | string;
1067 stemh?: number | string;
1068 stemv?: number | string;
1069 stitchTiles?: number | string;
1070 stopColor?: string;
1071 stopOpacity?: number | string;
1072 strikethroughPosition?: number | string;
1073 strikethroughThickness?: number | string;
1074 string?: number | string;
1075 stroke?: string;
1076 strokeDasharray?: string | number;
1077 strokeDashoffset?: string | number;
1078 strokeLinecap?: 'butt' | 'round' | 'square' | 'inherit';
1079 strokeLinejoin?: 'miter' | 'round' | 'bevel' | 'inherit';
1080 strokeMiterlimit?: string;
1081 strokeOpacity?: number | string;
1082 strokeWidth?: number | string;
1083 surfaceScale?: number | string;
1084 systemLanguage?: number | string;
1085 tableValues?: number | string;
1086 targetX?: number | string;
1087 targetY?: number | string;
1088 textAnchor?: string;
1089 textDecoration?: number | string;
1090 textLength?: number | string;
1091 textRendering?: number | string;
1092 to?: number | string;
1093 transform?: string;
1094 u1?: number | string;
1095 u2?: number | string;
1096 underlinePosition?: number | string;
1097 underlineThickness?: number | string;
1098 unicode?: number | string;
1099 unicodeBidi?: number | string;
1100 unicodeRange?: number | string;
1101 unitsPerEm?: number | string;
1102 vAlphabetic?: number | string;
1103 values?: string;
1104 vectorEffect?: number | string;
1105 version?: string;
1106 vertAdvY?: number | string;
1107 vertOriginX?: number | string;
1108 vertOriginY?: number | string;
1109 vHanging?: number | string;
1110 vIdeographic?: number | string;
1111 viewBox?: string;
1112 viewTarget?: number | string;
1113 visibility?: number | string;
1114 vMathematical?: number | string;
1115 widths?: number | string;
1116 wordSpacing?: number | string;
1117 writingMode?: number | string;
1118 x1?: number | string;
1119 x2?: number | string;
1120 x?: number | string;
1121 xChannelSelector?: string;
1122 xHeight?: number | string;
1123 xlinkActuate?: string;
1124 xlinkArcrole?: string;
1125 xlinkHref?: string;
1126 xlinkRole?: string;
1127 xlinkShow?: string;
1128 xlinkTitle?: string;
1129 xlinkType?: string;
1130 xmlBase?: string;
1131 xmlLang?: string;
1132 xmlns?: string;
1133 xmlnsXlink?: string;
1134 xmlSpace?: string;
1135 y1?: number | string;
1136 y2?: number | string;
1137 y?: number | string;
1138 yChannelSelector?: string;
1139 z?: number | string;
1140 zoomAndPan?: string;
1141 }
1142
1143 export interface DOMAttributes<T = Element> {
1144 ref?: (elm?: T) => void;
1145
1146 // Clipboard Events
1147 onCopy?: (event: ClipboardEvent) => void;
1148 onCopyCapture?: (event: ClipboardEvent) => void;
1149 onCut?: (event: ClipboardEvent) => void;
1150 onCutCapture?: (event: ClipboardEvent) => void;
1151 onPaste?: (event: ClipboardEvent) => void;
1152 onPasteCapture?: (event: ClipboardEvent) => void;
1153
1154 // Composition Events
1155 onCompositionEnd?: (event: CompositionEvent) => void;
1156 onCompositionEndCapture?: (event: CompositionEvent) => void;
1157 onCompositionStart?: (event: CompositionEvent) => void;
1158 onCompositionStartCapture?: (event: CompositionEvent) => void;
1159 onCompositionUpdate?: (event: CompositionEvent) => void;
1160 onCompositionUpdateCapture?: (event: CompositionEvent) => void;
1161
1162 // Focus Events
1163 onFocus?: (event: FocusEvent) => void;
1164 onFocusCapture?: (event: FocusEvent) => void;
1165 onBlur?: (event: FocusEvent) => void;
1166 onBlurCapture?: (event: FocusEvent) => void;
1167
1168 // Form Events
1169 onChange?: (event: Event) => void;
1170 onChangeCapture?: (event: Event) => void;
1171 onInput?: (event: Event) => void;
1172 onInputCapture?: (event: Event) => void;
1173 onReset?: (event: Event) => void;
1174 onResetCapture?: (event: Event) => void;
1175 onSubmit?: (event: Event) => void;
1176 onSubmitCapture?: (event: Event) => void;
1177 onInvalid?: (event: Event) => void;
1178 onInvalidCapture?: (event: Event) => void;
1179
1180 // Image Events
1181 onLoad?: (event: Event) => void;
1182 onLoadCapture?: (event: Event) => void;
1183 onError?: (event: Event) => void; // also a Media Event
1184 onErrorCapture?: (event: Event) => void; // also a Media Event
1185
1186 // Keyboard Events
1187 onKeyDown?: (event: KeyboardEvent) => void;
1188 onKeyDownCapture?: (event: KeyboardEvent) => void;
1189 onKeyPress?: (event: KeyboardEvent) => void;
1190 onKeyPressCapture?: (event: KeyboardEvent) => void;
1191 onKeyUp?: (event: KeyboardEvent) => void;
1192 onKeyUpCapture?: (event: KeyboardEvent) => void;
1193
1194 // MouseEvents
1195 onAuxClick?: (event: MouseEvent) => void;
1196 onClick?: (event: MouseEvent) => void;
1197 onClickCapture?: (event: MouseEvent) => void;
1198 onContextMenu?: (event: MouseEvent) => void;
1199 onContextMenuCapture?: (event: MouseEvent) => void;
1200 onDblClick?: (event: MouseEvent) => void;
1201 onDblClickCapture?: (event: MouseEvent) => void;
1202 onDrag?: (event: DragEvent) => void;
1203 onDragCapture?: (event: DragEvent) => void;
1204 onDragEnd?: (event: DragEvent) => void;
1205 onDragEndCapture?: (event: DragEvent) => void;
1206 onDragEnter?: (event: DragEvent) => void;
1207 onDragEnterCapture?: (event: DragEvent) => void;
1208 onDragExit?: (event: DragEvent) => void;
1209 onDragExitCapture?: (event: DragEvent) => void;
1210 onDragLeave?: (event: DragEvent) => void;
1211 onDragLeaveCapture?: (event: DragEvent) => void;
1212 onDragOver?: (event: DragEvent) => void;
1213 onDragOverCapture?: (event: DragEvent) => void;
1214 onDragStart?: (event: DragEvent) => void;
1215 onDragStartCapture?: (event: DragEvent) => void;
1216 onDrop?: (event: DragEvent) => void;
1217 onDropCapture?: (event: DragEvent) => void;
1218 onMouseDown?: (event: MouseEvent) => void;
1219 onMouseDownCapture?: (event: MouseEvent) => void;
1220 onMouseEnter?: (event: MouseEvent) => void;
1221 onMouseLeave?: (event: MouseEvent) => void;
1222 onMouseMove?: (event: MouseEvent) => void;
1223 onMouseMoveCapture?: (event: MouseEvent) => void;
1224 onMouseOut?: (event: MouseEvent) => void;
1225 onMouseOutCapture?: (event: MouseEvent) => void;
1226 onMouseOver?: (event: MouseEvent) => void;
1227 onMouseOverCapture?: (event: MouseEvent) => void;
1228 onMouseUp?: (event: MouseEvent) => void;
1229 onMouseUpCapture?: (event: MouseEvent) => void;
1230
1231 // Touch Events
1232 onTouchCancel?: (event: TouchEvent) => void;
1233 onTouchCancelCapture?: (event: TouchEvent) => void;
1234 onTouchEnd?: (event: TouchEvent) => void;
1235 onTouchEndCapture?: (event: TouchEvent) => void;
1236 onTouchMove?: (event: TouchEvent) => void;
1237 onTouchMoveCapture?: (event: TouchEvent) => void;
1238 onTouchStart?: (event: TouchEvent) => void;
1239 onTouchStartCapture?: (event: TouchEvent) => void;
1240
1241 // Pointer Events
1242 onPointerDown?: (event: PointerEvent) => void;
1243 onPointerDownCapture?: (event: PointerEvent) => void;
1244 onPointerMove?: (event: PointerEvent) => void;
1245 onPointerMoveCapture?: (event: PointerEvent) => void;
1246 onPointerUp?: (event: PointerEvent) => void;
1247 onPointerUpCapture?: (event: PointerEvent) => void;
1248 onPointerCancel?: (event: PointerEvent) => void;
1249 onPointerCancelCapture?: (event: PointerEvent) => void;
1250 onPointerEnter?: (event: PointerEvent) => void;
1251 onPointerEnterCapture?: (event: PointerEvent) => void;
1252 onPointerLeave?: (event: PointerEvent) => void;
1253 onPointerLeaveCapture?: (event: PointerEvent) => void;
1254 onPointerOver?: (event: PointerEvent) => void;
1255 onPointerOverCapture?: (event: PointerEvent) => void;
1256 onPointerOut?: (event: PointerEvent) => void;
1257 onPointerOutCapture?: (event: PointerEvent) => void;
1258 onGotPointerCapture?: (event: PointerEvent) => void;
1259 onGotPointerCaptureCapture?: (event: PointerEvent) => void;
1260 onLostPointerCapture?: (event: PointerEvent) => void;
1261 onLostPointerCaptureCapture?: (event: PointerEvent) => void;
1262
1263 // UI Events
1264 onScroll?: (event: UIEvent) => void;
1265 onScrollCapture?: (event: UIEvent) => void;
1266
1267 // Wheel Events
1268 onWheel?: (event: WheelEvent) => void;
1269 onWheelCapture?: (event: WheelEvent) => void;
1270
1271 // Animation Events
1272 onAnimationStart?: (event: AnimationEvent) => void;
1273 onAnimationStartCapture?: (event: AnimationEvent) => void;
1274 onAnimationEnd?: (event: AnimationEvent) => void;
1275 onAnimationEndCapture?: (event: AnimationEvent) => void;
1276 onAnimationIteration?: (event: AnimationEvent) => void;
1277 onAnimationIterationCapture?: (event: AnimationEvent) => void;
1278
1279 // Transition Events
1280 onTransitionEnd?: (event: TransitionEvent) => void;
1281 onTransitionEndCapture?: (event: TransitionEvent) => void;
1282 }
1283}
1284
1285
1286export interface Hyperscript {
1287 (sel: any): VNode;
1288 (sel: Node, data: VNodeData): VNode;
1289 (sel: any, data: VNodeData): VNode;
1290 (sel: any, text: string): VNode;
1291 (sel: any, children: Array<VNode | undefined | null>): VNode;
1292 (sel: any, data: VNodeData, text: string): VNode;
1293 (sel: any, data: VNodeData, children: Array<VNode | undefined | null>): VNode;
1294 (sel: any, data: VNodeData, children: VNode): VNode;
1295}
1296
1297
1298export interface VNodeData {
1299 class?: {[className: string]: boolean};
1300 style?: any;
1301 [attrName: string]: any;
1302}
1303
1304
1305export type ChildType = VNode | number | string;
1306export type PropsType = VNodeProdData | number | string | null;
1307
1308export interface VNodeProdData {
1309 key?: string | number;
1310 class?: {[className: string]: boolean} | string;
1311 className?: {[className: string]: boolean} | string;
1312 style?: any;
1313 [key: string]: any;
1314}
1315
1316export interface FunctionalUtilities {
1317 forEach: (children: VNode[], cb: (vnode: ChildNode, index: number, array: ChildNode[]) => void) => void;
1318 map: (children: VNode[], cb: (vnode: ChildNode, index: number, array: ChildNode[]) => ChildNode) => VNode[];
1319}
1320
1321export interface FunctionalComponent<T = {}> {
1322 (props: T, children: VNode[], utils: FunctionalUtilities): VNode | VNode[];
1323}
1324
1325export interface VNode {
1326 $tag$?: string | number | Function;
1327 $key$?: string | number;
1328 $text$?: string;
1329 $children$?: VNode[];
1330 $attrs$?: any;
1331 $name$?: string;
1332 $flags$: number;
1333 $elm$?: any;
1334}
1335
1336export interface ChildNode {
1337 vtag?: string | number | Function;
1338 vkey?: string | number;
1339 vtext?: string;
1340 vchildren?: VNode[];
1341 vattrs?: any;
1342 vname?: string;
1343}