jsx.d.ts 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775
  1. import { Ref, ComponentPublicInstance } from '@vue/runtime-core'
  2. // This code is based on https://github.com/wonderful-panda/vue-tsx-support
  3. // published under the MIT license.
  4. // Copyright by @wonderful-panda
  5. //
  6. // which is in turn based on the react definition in DefinitelyTyped
  7. // published under the MIT license.
  8. // Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
  9. // Path in the repository: types/react/v15/index.d.ts
  10. //
  11. // Copyrights of original definition are:
  12. // Asana <https://asana.com>
  13. // AssureSign <http://www.assuresign.com>
  14. // Microsoft <https://microsoft.com>
  15. // John Reilly <https://github.com/johnnyreilly/>
  16. // Benoit Benezech <https://github.com/bbenezech>
  17. // Patricio Zavolinsky <https://github.com/pzavolinsky>
  18. // Digiguru <https://github.com/digiguru>
  19. // Eric Anderson <https://github.com/ericanderson>
  20. // Albert Kurniawan <https://github.com/morcerf>
  21. // Tanguy Krotoff <https://github.com/tkrotoff>
  22. // Dovydas Navickas <https://github.com/DovydasNavickas>
  23. // Stéphane Goetz <https://github.com/onigoetz>
  24. interface HTMLAttributes {
  25. class?: any
  26. style?: string | Partial<CSSStyleDeclaration>
  27. accesskey?: string
  28. contenteditable?: boolean
  29. contextmenu?: string
  30. dir?: string
  31. disabled?: boolean
  32. draggable?: boolean
  33. hidden?: boolean
  34. id?: string
  35. lang?: string
  36. spellcheck?: boolean
  37. tabindex?: number
  38. title?: string
  39. role?: string
  40. }
  41. interface AnchorHTMLAttributes extends HTMLAttributes {
  42. download?: any
  43. href?: string
  44. hreflang?: string
  45. media?: string
  46. rel?: string
  47. target?: string
  48. }
  49. interface AreaHTMLAttributes extends HTMLAttributes {
  50. alt?: string
  51. coord?: string
  52. download?: any
  53. href?: string
  54. hreflang?: string
  55. media?: string
  56. rel?: string
  57. shape?: string
  58. target?: string
  59. }
  60. interface AudioHTMLAttributes extends MediaHTMLAttributes {}
  61. interface BaseHTMLAttributes extends HTMLAttributes {
  62. href?: string
  63. target?: string
  64. }
  65. interface BlockquoteHTMLAttributes extends HTMLAttributes {
  66. cite?: string
  67. }
  68. interface ButtonHTMLAttributes extends HTMLAttributes {
  69. autofocus?: boolean
  70. disabled?: boolean
  71. form?: string
  72. formaction?: string
  73. formenctype?: string
  74. formmethod?: string
  75. formnovalidate?: boolean
  76. formtarget?: string
  77. name?: string
  78. type?: string
  79. value?: string | string[] | number
  80. }
  81. interface CanvasHTMLAttributes extends HTMLAttributes {
  82. height?: number | string
  83. width?: number | string
  84. }
  85. interface ColHTMLAttributes extends HTMLAttributes {
  86. span?: number
  87. }
  88. interface ColgroupHTMLAttributes extends ColHTMLAttributes {}
  89. interface DetailsHTMLAttributes extends HTMLAttributes {
  90. open?: boolean
  91. }
  92. interface DelHTMLAttributes extends HTMLAttributes {
  93. cite?: string
  94. datetime?: string
  95. }
  96. interface EmbedHTMLAttributes extends HTMLAttributes {
  97. height?: number | string
  98. src?: string
  99. type?: string
  100. width?: number | string
  101. }
  102. interface FieldsetHTMLAttributes extends HTMLAttributes {
  103. disabled?: boolean
  104. form?: string
  105. name?: string
  106. }
  107. interface FormHTMLAttributes extends HTMLAttributes {
  108. acceptcharset?: string
  109. action?: string
  110. autocomplete?: string
  111. enctype?: string
  112. method?: string
  113. name?: string
  114. novalidate?: boolean
  115. target?: string
  116. }
  117. interface HtmlHTMLAttributes extends HTMLAttributes {
  118. manifest?: string
  119. }
  120. interface IframeHTMLAttributes extends HTMLAttributes {
  121. allowfullscreen?: boolean
  122. allowtransparency?: boolean
  123. frameborder?: number | string
  124. height?: number | string
  125. marginheight?: number
  126. marginwidth?: number
  127. name?: string
  128. sandbox?: string
  129. scrolling?: string
  130. seamless?: boolean
  131. src?: string
  132. srcdoc?: string
  133. width?: number | string
  134. }
  135. interface ImgHTMLAttributes extends HTMLAttributes {
  136. alt?: string
  137. height?: number | string
  138. sizes?: string
  139. src?: string
  140. srcset?: string
  141. usemap?: string
  142. width?: number | string
  143. }
  144. interface InsHTMLAttributes extends HTMLAttributes {
  145. cite?: string
  146. datetime?: string
  147. }
  148. interface InputHTMLAttributes extends HTMLAttributes {
  149. accept?: string
  150. alt?: string
  151. autocomplete?: string
  152. autofocus?: boolean
  153. capture?: boolean // https://www.w3.org/tr/html-media-capture/#the-capture-attribute
  154. checked?: boolean
  155. crossorigin?: string
  156. disabled?: boolean
  157. form?: string
  158. formaction?: string
  159. formenctype?: string
  160. formmethod?: string
  161. formnovalidate?: boolean
  162. formtarget?: string
  163. height?: number | string
  164. list?: string
  165. max?: number | string
  166. maxlength?: number
  167. min?: number | string
  168. minlength?: number
  169. multiple?: boolean
  170. name?: string
  171. pattern?: string
  172. placeholder?: string
  173. readonly?: boolean
  174. required?: boolean
  175. size?: number
  176. src?: string
  177. step?: number | string
  178. type?: string
  179. value?: string | string[] | number
  180. width?: number | string
  181. }
  182. interface KeygenHTMLAttributes extends HTMLAttributes {
  183. autofocus?: boolean
  184. challenge?: string
  185. disabled?: boolean
  186. form?: string
  187. keytype?: string
  188. keyparams?: string
  189. name?: string
  190. }
  191. interface LabelHTMLAttributes extends HTMLAttributes {
  192. form?: string
  193. htmlfor?: string
  194. }
  195. interface LiHTMLAttributes extends HTMLAttributes {
  196. value?: string | string[] | number
  197. }
  198. interface LinkHTMLAttributes extends HTMLAttributes {
  199. href?: string
  200. hreflang?: string
  201. integrity?: string
  202. media?: string
  203. rel?: string
  204. sizes?: string
  205. type?: string
  206. }
  207. interface MapHTMLAttributes extends HTMLAttributes {
  208. name?: string
  209. }
  210. interface MenuHTMLAttributes extends HTMLAttributes {
  211. type?: string
  212. }
  213. interface MediaHTMLAttributes extends HTMLAttributes {
  214. autoplay?: boolean
  215. controls?: boolean
  216. crossorigin?: string
  217. loop?: boolean
  218. mediagroup?: string
  219. muted?: boolean
  220. preload?: string
  221. src?: string
  222. }
  223. interface MetaHTMLAttributes extends HTMLAttributes {
  224. charset?: string
  225. content?: string
  226. httpequiv?: string
  227. name?: string
  228. }
  229. interface MeterHTMLAttributes extends HTMLAttributes {
  230. form?: string
  231. high?: number
  232. low?: number
  233. max?: number | string
  234. min?: number | string
  235. optimum?: number
  236. value?: string | string[] | number
  237. }
  238. interface QuoteHTMLAttributes extends HTMLAttributes {
  239. cite?: string
  240. }
  241. interface ObjectHTMLAttributes extends HTMLAttributes {
  242. classid?: string
  243. data?: string
  244. form?: string
  245. height?: number | string
  246. name?: string
  247. type?: string
  248. usemap?: string
  249. width?: number | string
  250. wmode?: string
  251. }
  252. interface OlHTMLAttributes extends HTMLAttributes {
  253. reversed?: boolean
  254. start?: number
  255. }
  256. interface OptgroupHTMLAttributes extends HTMLAttributes {
  257. disabled?: boolean
  258. label?: string
  259. }
  260. interface OptionHTMLAttributes extends HTMLAttributes {
  261. disabled?: boolean
  262. label?: string
  263. selected?: boolean
  264. value?: string | string[] | number
  265. }
  266. interface OutputHTMLAttributes extends HTMLAttributes {
  267. form?: string
  268. htmlfor?: string
  269. name?: string
  270. }
  271. interface ParamHTMLAttributes extends HTMLAttributes {
  272. name?: string
  273. value?: string | string[] | number
  274. }
  275. interface ProgressHTMLAttributes extends HTMLAttributes {
  276. max?: number | string
  277. value?: string | string[] | number
  278. }
  279. interface ScriptHTMLAttributes extends HTMLAttributes {
  280. async?: boolean
  281. charset?: string
  282. crossorigin?: string
  283. defer?: boolean
  284. integrity?: string
  285. nonce?: string
  286. src?: string
  287. type?: string
  288. }
  289. interface SelectHTMLAttributes extends HTMLAttributes {
  290. autofocus?: boolean
  291. disabled?: boolean
  292. form?: string
  293. multiple?: boolean
  294. name?: string
  295. required?: boolean
  296. size?: number
  297. value?: string | string[] | number
  298. }
  299. interface SourceHTMLAttributes extends HTMLAttributes {
  300. media?: string
  301. sizes?: string
  302. src?: string
  303. srcset?: string
  304. type?: string
  305. }
  306. interface StyleHTMLAttributes extends HTMLAttributes {
  307. media?: string
  308. nonce?: string
  309. scoped?: boolean
  310. type?: string
  311. }
  312. interface TableHTMLAttributes extends HTMLAttributes {
  313. cellpadding?: number | string
  314. cellspacing?: number | string
  315. summary?: string
  316. }
  317. interface TextareaHTMLAttributes extends HTMLAttributes {
  318. autocomplete?: string
  319. autofocus?: boolean
  320. cols?: number
  321. dirname?: string
  322. disabled?: boolean
  323. form?: string
  324. maxlength?: number
  325. minlength?: number
  326. name?: string
  327. placeholder?: string
  328. readonly?: boolean
  329. required?: boolean
  330. rows?: number
  331. value?: string | string[] | number
  332. wrap?: string
  333. }
  334. interface TdHTMLAttributes extends HTMLAttributes {
  335. colspan?: number
  336. headers?: string
  337. rowspan?: number
  338. }
  339. interface ThHTMLAttributes extends HTMLAttributes {
  340. colspan?: number
  341. headers?: string
  342. rowspan?: number
  343. scope?: string
  344. }
  345. interface TimeHTMLAttributes extends HTMLAttributes {
  346. datetime?: string
  347. }
  348. interface TrackHTMLAttributes extends HTMLAttributes {
  349. default?: boolean
  350. kind?: string
  351. label?: string
  352. src?: string
  353. srclang?: string
  354. }
  355. interface VideoHTMLAttributes extends MediaHTMLAttributes {
  356. height?: number | string
  357. playsinline?: boolean
  358. poster?: string
  359. width?: number | string
  360. }
  361. interface AllHTMLAttributes extends HTMLAttributes {
  362. accept?: string
  363. acceptcharset?: string
  364. action?: boolean
  365. allowfullscreen?: boolean
  366. allowtransparency?: boolean
  367. alt?: string
  368. async?: boolean
  369. autocomplete?: string
  370. autofocus?: boolean
  371. autoplay?: boolean
  372. capture?: boolean // https://www.w3.org/tr/html-media-capture/#the-capture-attribute
  373. cellpadding?: number | string
  374. cellspacing?: number | string
  375. challenge?: string
  376. charset?: string
  377. checked?: boolean
  378. cite?: string
  379. classid?: string
  380. cols?: number
  381. colspan?: number
  382. content?: string
  383. controls?: boolean
  384. coord?: string
  385. crossorigin?: string
  386. data?: string
  387. datetime?: string
  388. default?: boolean
  389. defer?: boolean
  390. dirname?: string
  391. disabled?: boolean
  392. download?: any
  393. enctype?: string
  394. form?: string
  395. formaction?: string
  396. formenctype?: string
  397. formmethod?: string
  398. formnovalidate?: boolean
  399. formtarget?: string
  400. frameborder?: number | string
  401. headers?: string
  402. height?: number | string
  403. high?: number
  404. href?: string
  405. hreflang?: string
  406. htmlfor?: string
  407. httpequiv?: string
  408. integrity?: string
  409. keyparams?: string
  410. keytype?: string
  411. kind?: string
  412. label?: string
  413. list?: string
  414. loop?: boolean
  415. low?: number
  416. manifest?: string
  417. marginheight?: number
  418. marginwidth?: number
  419. max?: number | string
  420. maxlength?: number
  421. media?: string
  422. mediagroup?: string
  423. method?: string
  424. min?: number | string
  425. minlength?: number
  426. multiple?: boolean
  427. muted?: boolean
  428. name?: string
  429. nonce?: string
  430. novalidate?: boolean
  431. open?: boolean
  432. optimum?: number
  433. pattern?: string
  434. placeholder?: string
  435. playsinline?: boolean
  436. poster?: string
  437. preload?: string
  438. readonly?: boolean
  439. rel?: string
  440. required?: boolean
  441. reversed?: boolean
  442. rows?: number
  443. rowspan?: number
  444. sandbox?: string
  445. scope?: string
  446. scoped?: boolean
  447. scrolling?: string
  448. seamless?: boolean
  449. selected?: boolean
  450. shape?: string
  451. size?: number
  452. sizes?: string
  453. span?: number
  454. src?: string
  455. srcdoc?: string
  456. srclang?: string
  457. srcset?: string
  458. start?: number
  459. step?: number | string
  460. summary?: string
  461. target?: string
  462. type?: string
  463. usemap?: string
  464. value?: string | string[] | number
  465. width?: number | string
  466. wmode?: string
  467. wrap?: string
  468. }
  469. interface IntrinsicElementAttributes {
  470. a: AnchorHTMLAttributes
  471. abbr: HTMLAttributes
  472. address: HTMLAttributes
  473. area: AreaHTMLAttributes
  474. article: HTMLAttributes
  475. aside: HTMLAttributes
  476. audio: AudioHTMLAttributes
  477. b: HTMLAttributes
  478. base: BaseHTMLAttributes
  479. bdi: HTMLAttributes
  480. bdo: HTMLAttributes
  481. big: HTMLAttributes
  482. blockquote: BlockquoteHTMLAttributes
  483. body: HTMLAttributes
  484. br: HTMLAttributes
  485. button: ButtonHTMLAttributes
  486. canvas: CanvasHTMLAttributes
  487. caption: HTMLAttributes
  488. cite: HTMLAttributes
  489. code: HTMLAttributes
  490. col: ColHTMLAttributes
  491. colgroup: ColgroupHTMLAttributes
  492. data: HTMLAttributes
  493. datalist: HTMLAttributes
  494. dd: HTMLAttributes
  495. del: DelHTMLAttributes
  496. details: DetailsHTMLAttributes
  497. dfn: HTMLAttributes
  498. dialog: HTMLAttributes
  499. div: HTMLAttributes
  500. dl: HTMLAttributes
  501. dt: HTMLAttributes
  502. em: HTMLAttributes
  503. embed: EmbedHTMLAttributes
  504. fieldset: FieldsetHTMLAttributes
  505. figcaption: HTMLAttributes
  506. figure: HTMLAttributes
  507. footer: HTMLAttributes
  508. form: FormHTMLAttributes
  509. h1: HTMLAttributes
  510. h2: HTMLAttributes
  511. h3: HTMLAttributes
  512. h4: HTMLAttributes
  513. h5: HTMLAttributes
  514. h6: HTMLAttributes
  515. head: HTMLAttributes
  516. header: HTMLAttributes
  517. hgroup: HTMLAttributes
  518. hr: HTMLAttributes
  519. html: HtmlHTMLAttributes
  520. i: HTMLAttributes
  521. iframe: IframeHTMLAttributes
  522. img: ImgHTMLAttributes
  523. input: InputHTMLAttributes
  524. ins: InsHTMLAttributes
  525. kbd: HTMLAttributes
  526. keygen: KeygenHTMLAttributes
  527. label: LabelHTMLAttributes
  528. legend: HTMLAttributes
  529. li: LiHTMLAttributes
  530. link: LinkHTMLAttributes
  531. main: HTMLAttributes
  532. map: MapHTMLAttributes
  533. mark: HTMLAttributes
  534. menu: MenuHTMLAttributes
  535. menuitem: HTMLAttributes
  536. meta: MetaHTMLAttributes
  537. meter: MeterHTMLAttributes
  538. nav: HTMLAttributes
  539. noscript: HTMLAttributes
  540. object: ObjectHTMLAttributes
  541. ol: OlHTMLAttributes
  542. optgroup: OptgroupHTMLAttributes
  543. option: OptionHTMLAttributes
  544. output: OutputHTMLAttributes
  545. p: HTMLAttributes
  546. param: ParamHTMLAttributes
  547. picture: HTMLAttributes
  548. pre: HTMLAttributes
  549. progress: ProgressHTMLAttributes
  550. q: QuoteHTMLAttributes
  551. rp: HTMLAttributes
  552. rt: HTMLAttributes
  553. ruby: HTMLAttributes
  554. s: HTMLAttributes
  555. samp: HTMLAttributes
  556. script: ScriptHTMLAttributes
  557. section: HTMLAttributes
  558. select: SelectHTMLAttributes
  559. small: HTMLAttributes
  560. source: SourceHTMLAttributes
  561. span: HTMLAttributes
  562. strong: HTMLAttributes
  563. style: StyleHTMLAttributes
  564. sub: HTMLAttributes
  565. summary: HTMLAttributes
  566. sup: HTMLAttributes
  567. table: TableHTMLAttributes
  568. tbody: HTMLAttributes
  569. td: TdHTMLAttributes
  570. textarea: TextareaHTMLAttributes
  571. tfoot: HTMLAttributes
  572. th: ThHTMLAttributes
  573. thead: HTMLAttributes
  574. time: TimeHTMLAttributes
  575. title: HTMLAttributes
  576. tr: HTMLAttributes
  577. track: TrackHTMLAttributes
  578. u: HTMLAttributes
  579. ul: HTMLAttributes
  580. var: HTMLAttributes
  581. video: VideoHTMLAttributes
  582. wbr: HTMLAttributes
  583. }
  584. interface Events {
  585. // clipboard events
  586. onCopy: ClipboardEvent
  587. onCut: ClipboardEvent
  588. onPaste: ClipboardEvent
  589. // composition events
  590. onCompositionend: CompositionEvent
  591. onCompositionstart: CompositionEvent
  592. onCompositionupdate: CompositionEvent
  593. // drag drop events
  594. onDrag: DragEvent
  595. onDragend: DragEvent
  596. onDragenter: DragEvent
  597. onDragexit: DragEvent
  598. onDragleave: DragEvent
  599. onDragover: DragEvent
  600. onDragstart: DragEvent
  601. onDrop: DragEvent
  602. // focus events
  603. onFocus: FocusEvent
  604. onBlur: FocusEvent
  605. // form events
  606. onChange: Event
  607. onInput: Event
  608. onReset: Event
  609. onSubmit: Event
  610. onInvalid: Event
  611. // image events
  612. onLoad: Event
  613. onError: Event
  614. // keyboard events
  615. onKeydown: KeyboardEvent
  616. onKeypress: KeyboardEvent
  617. onKeyup: KeyboardEvent
  618. // mouse events
  619. onClick: MouseEvent
  620. onContextmenu: MouseEvent
  621. onDblclick: MouseEvent
  622. onMousedown: MouseEvent
  623. onMouseenter: MouseEvent
  624. onMouseleave: MouseEvent
  625. onMousemove: MouseEvent
  626. onMouseout: MouseEvent
  627. onMouseover: MouseEvent
  628. onMouseup: MouseEvent
  629. // media events
  630. onAbort: Event
  631. onCanplay: Event
  632. onCanplaythrough: Event
  633. onDurationchange: Event
  634. onEmptied: Event
  635. onEncrypted: Event
  636. onEnded: Event
  637. onLoadeddata: Event
  638. onLoadedmetadata: Event
  639. onLoadstart: Event
  640. onPause: Event
  641. onPlay: Event
  642. onPlaying: Event
  643. onProgress: Event
  644. onRatechange: Event
  645. onSeeked: Event
  646. onSeeking: Event
  647. onStalled: Event
  648. onSuspend: Event
  649. onTimeupdate: Event
  650. onVolumechange: Event
  651. onWaiting: Event
  652. // selection events
  653. onSelect: Event
  654. // UI events
  655. onScroll: UIEvent
  656. // touch events
  657. onTouchcancel: TouchEvent
  658. onTouchend: TouchEvent
  659. onTouchmove: TouchEvent
  660. onTouchstart: TouchEvent
  661. // wheel events
  662. onWheel: WheelEvent
  663. // animation events
  664. onAnimationstart: AnimationEvent
  665. onAnimationend: AnimationEvent
  666. onAnimationiteration: AnimationEvent
  667. // transition events
  668. onTransitionend: TransitionEvent
  669. onTransitionstart: TransitionEvent
  670. }
  671. type StringKeyOf<T> = Extract<keyof T, string>
  672. type EventHandlers<E> = {
  673. [K in StringKeyOf<E>]?: E[K] extends Function ? E[K] : (payload: E[K]) => void
  674. }
  675. type ReservedProps = {
  676. key?: string | number
  677. ref?: string | Ref | ((ref: Element | ComponentPublicInstance | null) => void)
  678. }
  679. type ElementAttrs<T> = T & EventHandlers<Events> & ReservedProps
  680. type NativeElements = {
  681. [K in StringKeyOf<IntrinsicElementAttributes>]: ElementAttrs<
  682. IntrinsicElementAttributes[K]
  683. >
  684. }
  685. declare global {
  686. namespace JSX {
  687. interface Element {}
  688. interface ElementClass {
  689. $props: {}
  690. }
  691. interface ElementAttributesProperty {
  692. $props: {}
  693. }
  694. interface IntrinsicElements extends NativeElements {
  695. // allow arbitrary elements
  696. [name: string]: any
  697. }
  698. }
  699. }
  700. // suppress ts:2669
  701. export {}