UNPKG

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