svelte-html.d.ts 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. /// <reference lib="dom" />
  2. // This file is deliberately not exposed through the exports map.
  3. // It's meant to be loaded directly by the Svelte language server
  4. /* eslint-disable @typescript-eslint/no-empty-interface */
  5. import * as svelteElements from './elements.js';
  6. /**
  7. * @internal do not use
  8. */
  9. type HTMLProps<Property extends string, Override> = Omit<
  10. import('./elements.js').SvelteHTMLElements[Property],
  11. keyof Override
  12. > &
  13. Override;
  14. declare global {
  15. /**
  16. * This namespace does not exist in the runtime, it is only used for typings
  17. */
  18. namespace svelteHTML {
  19. // Every namespace eligible for use needs to implement the following two functions
  20. /**
  21. * @internal do not use
  22. */
  23. function mapElementTag<K extends keyof ElementTagNameMap>(tag: K): ElementTagNameMap[K];
  24. function mapElementTag<K extends keyof SVGElementTagNameMap>(tag: K): SVGElementTagNameMap[K];
  25. function mapElementTag(tag: any): any; // needs to be any because used in context of <svelte:element>
  26. /**
  27. * @internal do not use
  28. */
  29. function createElement<Elements extends IntrinsicElements, Key extends keyof Elements>(
  30. // "undefined | null" because of <svelte:element>
  31. element: Key | undefined | null,
  32. attrs: string extends Key ? svelteElements.HTMLAttributes<any> : Elements[Key]
  33. ): Key extends keyof ElementTagNameMap
  34. ? ElementTagNameMap[Key]
  35. : Key extends keyof SVGElementTagNameMap
  36. ? SVGElementTagNameMap[Key]
  37. : any;
  38. function createElement<Elements extends IntrinsicElements, Key extends keyof Elements, T>(
  39. // "undefined | null" because of <svelte:element>
  40. element: Key | undefined | null,
  41. attrsEnhancers: T,
  42. attrs: (string extends Key ? svelteElements.HTMLAttributes<any> : Elements[Key]) & T
  43. ): Key extends keyof ElementTagNameMap
  44. ? ElementTagNameMap[Key]
  45. : Key extends keyof SVGElementTagNameMap
  46. ? SVGElementTagNameMap[Key]
  47. : any;
  48. // TODO remove HTMLAttributes/SVGAttributes/IntrinsicElements in Svelte 6
  49. // For backwards-compatibility and ease-of-use, in case someone enhanced the typings from import('svelte/elements').HTMLAttributes/SVGAttributes
  50. // eslint-disable-next-line @typescript-eslint/no-unused-vars
  51. interface HTMLAttributes<T extends EventTarget = any> {}
  52. // eslint-disable-next-line @typescript-eslint/no-unused-vars
  53. interface SVGAttributes<T extends EventTarget = any> {}
  54. /**
  55. * Avoid using this interface directly. Instead use the `SvelteHTMLElements` interface exported by `svelte/elements`
  56. * This should only be used if you need to extend the interface with custom elements
  57. */
  58. interface IntrinsicElements extends svelteElements.SvelteHTMLElements {
  59. a: HTMLProps<'a', HTMLAttributes>;
  60. abbr: HTMLProps<'abbr', HTMLAttributes>;
  61. address: HTMLProps<'address', HTMLAttributes>;
  62. area: HTMLProps<'area', HTMLAttributes>;
  63. article: HTMLProps<'article', HTMLAttributes>;
  64. aside: HTMLProps<'aside', HTMLAttributes>;
  65. audio: HTMLProps<'audio', HTMLAttributes>;
  66. b: HTMLProps<'b', HTMLAttributes>;
  67. base: HTMLProps<'base', HTMLAttributes>;
  68. bdi: HTMLProps<'bdi', HTMLAttributes>;
  69. bdo: HTMLProps<'bdo', HTMLAttributes>;
  70. big: HTMLProps<'big', HTMLAttributes>;
  71. blockquote: HTMLProps<'blockquote', HTMLAttributes>;
  72. body: HTMLProps<'body', HTMLAttributes>;
  73. br: HTMLProps<'br', HTMLAttributes>;
  74. button: HTMLProps<'button', HTMLAttributes>;
  75. canvas: HTMLProps<'canvas', HTMLAttributes>;
  76. caption: HTMLProps<'caption', HTMLAttributes>;
  77. cite: HTMLProps<'cite', HTMLAttributes>;
  78. code: HTMLProps<'code', HTMLAttributes>;
  79. col: HTMLProps<'col', HTMLAttributes>;
  80. colgroup: HTMLProps<'colgroup', HTMLAttributes>;
  81. data: HTMLProps<'data', HTMLAttributes>;
  82. datalist: HTMLProps<'datalist', HTMLAttributes>;
  83. dd: HTMLProps<'dd', HTMLAttributes>;
  84. del: HTMLProps<'del', HTMLAttributes>;
  85. details: HTMLProps<'details', HTMLAttributes>;
  86. dfn: HTMLProps<'dfn', HTMLAttributes>;
  87. dialog: HTMLProps<'dialog', HTMLAttributes>;
  88. div: HTMLProps<'div', HTMLAttributes>;
  89. dl: HTMLProps<'dl', HTMLAttributes>;
  90. dt: HTMLProps<'dt', HTMLAttributes>;
  91. em: HTMLProps<'em', HTMLAttributes>;
  92. embed: HTMLProps<'embed', HTMLAttributes>;
  93. fieldset: HTMLProps<'fieldset', HTMLAttributes>;
  94. figcaption: HTMLProps<'figcaption', HTMLAttributes>;
  95. figure: HTMLProps<'figure', HTMLAttributes>;
  96. footer: HTMLProps<'footer', HTMLAttributes>;
  97. form: HTMLProps<'form', HTMLAttributes>;
  98. h1: HTMLProps<'h1', HTMLAttributes>;
  99. h2: HTMLProps<'h2', HTMLAttributes>;
  100. h3: HTMLProps<'h3', HTMLAttributes>;
  101. h4: HTMLProps<'h4', HTMLAttributes>;
  102. h5: HTMLProps<'h5', HTMLAttributes>;
  103. h6: HTMLProps<'h6', HTMLAttributes>;
  104. head: HTMLProps<'head', HTMLAttributes>;
  105. header: HTMLProps<'header', HTMLAttributes>;
  106. hgroup: HTMLProps<'hgroup', HTMLAttributes>;
  107. hr: HTMLProps<'hr', HTMLAttributes>;
  108. html: HTMLProps<'html', HTMLAttributes>;
  109. i: HTMLProps<'i', HTMLAttributes>;
  110. iframe: HTMLProps<'iframe', HTMLAttributes>;
  111. img: HTMLProps<'img', HTMLAttributes>;
  112. input: HTMLProps<'input', HTMLAttributes>;
  113. ins: HTMLProps<'ins', HTMLAttributes>;
  114. kbd: HTMLProps<'kbd', HTMLAttributes>;
  115. keygen: HTMLProps<'keygen', HTMLAttributes>;
  116. label: HTMLProps<'label', HTMLAttributes>;
  117. legend: HTMLProps<'legend', HTMLAttributes>;
  118. li: HTMLProps<'li', HTMLAttributes>;
  119. link: HTMLProps<'link', HTMLAttributes>;
  120. main: HTMLProps<'main', HTMLAttributes>;
  121. map: HTMLProps<'map', HTMLAttributes>;
  122. mark: HTMLProps<'mark', HTMLAttributes>;
  123. menu: HTMLProps<'menu', HTMLAttributes>;
  124. menuitem: HTMLProps<'menuitem', HTMLAttributes>;
  125. meta: HTMLProps<'meta', HTMLAttributes>;
  126. meter: HTMLProps<'meter', HTMLAttributes>;
  127. nav: HTMLProps<'nav', HTMLAttributes>;
  128. noscript: HTMLProps<'noscript', HTMLAttributes>;
  129. object: HTMLProps<'object', HTMLAttributes>;
  130. ol: HTMLProps<'ol', HTMLAttributes>;
  131. optgroup: HTMLProps<'optgroup', HTMLAttributes>;
  132. option: HTMLProps<'option', HTMLAttributes>;
  133. output: HTMLProps<'output', HTMLAttributes>;
  134. p: HTMLProps<'p', HTMLAttributes>;
  135. param: HTMLProps<'param', HTMLAttributes>;
  136. picture: HTMLProps<'picture', HTMLAttributes>;
  137. pre: HTMLProps<'pre', HTMLAttributes>;
  138. progress: HTMLProps<'progress', HTMLAttributes>;
  139. q: HTMLProps<'q', HTMLAttributes>;
  140. rp: HTMLProps<'rp', HTMLAttributes>;
  141. rt: HTMLProps<'rt', HTMLAttributes>;
  142. ruby: HTMLProps<'ruby', HTMLAttributes>;
  143. s: HTMLProps<'s', HTMLAttributes>;
  144. samp: HTMLProps<'samp', HTMLAttributes>;
  145. slot: HTMLProps<'slot', HTMLAttributes>;
  146. script: HTMLProps<'script', HTMLAttributes>;
  147. section: HTMLProps<'section', HTMLAttributes>;
  148. select: HTMLProps<'select', HTMLAttributes>;
  149. small: HTMLProps<'small', HTMLAttributes>;
  150. source: HTMLProps<'source', HTMLAttributes>;
  151. span: HTMLProps<'span', HTMLAttributes>;
  152. strong: HTMLProps<'strong', HTMLAttributes>;
  153. style: HTMLProps<'style', HTMLAttributes>;
  154. sub: HTMLProps<'sub', HTMLAttributes>;
  155. summary: HTMLProps<'summary', HTMLAttributes>;
  156. sup: HTMLProps<'sup', HTMLAttributes>;
  157. table: HTMLProps<'table', HTMLAttributes>;
  158. template: HTMLProps<'template', HTMLAttributes>;
  159. tbody: HTMLProps<'tbody', HTMLAttributes>;
  160. td: HTMLProps<'td', HTMLAttributes>;
  161. textarea: HTMLProps<'textarea', HTMLAttributes>;
  162. tfoot: HTMLProps<'tfoot', HTMLAttributes>;
  163. th: HTMLProps<'th', HTMLAttributes>;
  164. thead: HTMLProps<'thead', HTMLAttributes>;
  165. time: HTMLProps<'time', HTMLAttributes>;
  166. title: HTMLProps<'title', HTMLAttributes>;
  167. tr: HTMLProps<'tr', HTMLAttributes>;
  168. track: HTMLProps<'track', HTMLAttributes>;
  169. u: HTMLProps<'u', HTMLAttributes>;
  170. ul: HTMLProps<'ul', HTMLAttributes>;
  171. var: HTMLProps<'var', HTMLAttributes>;
  172. video: HTMLProps<'video', HTMLAttributes>;
  173. wbr: HTMLProps<'wbr', HTMLAttributes>;
  174. webview: HTMLProps<'webview', HTMLAttributes>;
  175. // SVG
  176. svg: HTMLProps<'svg', SVGAttributes>;
  177. animate: HTMLProps<'animate', SVGAttributes>;
  178. animateMotion: HTMLProps<'animateMotion', SVGAttributes>;
  179. animateTransform: HTMLProps<'animateTransform', SVGAttributes>;
  180. circle: HTMLProps<'circle', SVGAttributes>;
  181. clipPath: HTMLProps<'clipPath', SVGAttributes>;
  182. defs: HTMLProps<'defs', SVGAttributes>;
  183. desc: HTMLProps<'desc', SVGAttributes>;
  184. ellipse: HTMLProps<'ellipse', SVGAttributes>;
  185. feBlend: HTMLProps<'feBlend', SVGAttributes>;
  186. feColorMatrix: HTMLProps<'feColorMatrix', SVGAttributes>;
  187. feComponentTransfer: HTMLProps<'feComponentTransfer', SVGAttributes>;
  188. feComposite: HTMLProps<'feComposite', SVGAttributes>;
  189. feConvolveMatrix: HTMLProps<'feConvolveMatrix', SVGAttributes>;
  190. feDiffuseLighting: HTMLProps<'feDiffuseLighting', SVGAttributes>;
  191. feDisplacementMap: HTMLProps<'feDisplacementMap', SVGAttributes>;
  192. feDistantLight: HTMLProps<'feDistantLight', SVGAttributes>;
  193. feDropShadow: HTMLProps<'feDropShadow', SVGAttributes>;
  194. feFlood: HTMLProps<'feFlood', SVGAttributes>;
  195. feFuncA: HTMLProps<'feFuncA', SVGAttributes>;
  196. feFuncB: HTMLProps<'feFuncB', SVGAttributes>;
  197. feFuncG: HTMLProps<'feFuncG', SVGAttributes>;
  198. feFuncR: HTMLProps<'feFuncR', SVGAttributes>;
  199. feGaussianBlur: HTMLProps<'feGaussianBlur', SVGAttributes>;
  200. feImage: HTMLProps<'feImage', SVGAttributes>;
  201. feMerge: HTMLProps<'feMerge', SVGAttributes>;
  202. feMergeNode: HTMLProps<'feMergeNode', SVGAttributes>;
  203. feMorphology: HTMLProps<'feMorphology', SVGAttributes>;
  204. feOffset: HTMLProps<'feOffset', SVGAttributes>;
  205. fePointLight: HTMLProps<'fePointLight', SVGAttributes>;
  206. feSpecularLighting: HTMLProps<'feSpecularLighting', SVGAttributes>;
  207. feSpotLight: HTMLProps<'feSpotLight', SVGAttributes>;
  208. feTile: HTMLProps<'feTile', SVGAttributes>;
  209. feTurbulence: HTMLProps<'feTurbulence', SVGAttributes>;
  210. filter: HTMLProps<'filter', SVGAttributes>;
  211. foreignObject: HTMLProps<'foreignObject', SVGAttributes>;
  212. g: HTMLProps<'g', SVGAttributes>;
  213. image: HTMLProps<'image', SVGAttributes>;
  214. line: HTMLProps<'line', SVGAttributes>;
  215. linearGradient: HTMLProps<'linearGradient', SVGAttributes>;
  216. marker: HTMLProps<'marker', SVGAttributes>;
  217. mask: HTMLProps<'mask', SVGAttributes>;
  218. metadata: HTMLProps<'metadata', SVGAttributes>;
  219. mpath: HTMLProps<'mpath', SVGAttributes>;
  220. path: HTMLProps<'path', SVGAttributes>;
  221. pattern: HTMLProps<'pattern', SVGAttributes>;
  222. polygon: HTMLProps<'polygon', SVGAttributes>;
  223. polyline: HTMLProps<'polyline', SVGAttributes>;
  224. radialGradient: HTMLProps<'radialGradient', SVGAttributes>;
  225. rect: HTMLProps<'rect', SVGAttributes>;
  226. stop: HTMLProps<'stop', SVGAttributes>;
  227. switch: HTMLProps<'switch', SVGAttributes>;
  228. symbol: HTMLProps<'symbol', SVGAttributes>;
  229. text: HTMLProps<'text', SVGAttributes>;
  230. textPath: HTMLProps<'textPath', SVGAttributes>;
  231. tspan: HTMLProps<'tspan', SVGAttributes>;
  232. use: HTMLProps<'use', SVGAttributes>;
  233. view: HTMLProps<'view', SVGAttributes>;
  234. [name: string]: { [name: string]: any };
  235. }
  236. }
  237. }