index.d.ts 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /**
  2. * Info on a property.
  3. */
  4. export interface Info {
  5. /**
  6. * Attribute name for the property that could be used in markup
  7. * (such as `'aria-describedby'`, `'allowfullscreen'`, `'xml:lang'`,
  8. * `'for'`, or `'charoff'`).
  9. */
  10. attribute: string
  11. /**
  12. * The property is *like* a `boolean`
  13. * (such as `draggable`);
  14. * these properties have both an on and off state when defined,
  15. * *and* another state when not defined.
  16. */
  17. booleanish: boolean
  18. /**
  19. * The property is a `boolean`
  20. * (such as `hidden`);
  21. * these properties have an on state when defined and an off state when not
  22. * defined.
  23. */
  24. boolean: boolean
  25. /**
  26. * The property is a list separated by spaces or commas
  27. * (such as `strokeDashArray`).
  28. */
  29. commaOrSpaceSeparated: boolean
  30. /**
  31. * The property is a list separated by commas
  32. * (such as `coords`).
  33. */
  34. commaSeparated: boolean
  35. /**
  36. * The property is defined by a space;
  37. * this is the case for values in HTML
  38. * (including data and ARIA),
  39. * SVG, XML, XMLNS, and XLink;
  40. * not defined properties can only be found through `find`.
  41. */
  42. defined: boolean
  43. /**
  44. * When working with the DOM,
  45. * this property has to be changed as a field on the element,
  46. * instead of through `setAttribute`
  47. * (this is true only for `'checked'`, `'multiple'`, `'muted'`, and
  48. * `'selected'`).
  49. */
  50. mustUseProperty: boolean
  51. /**
  52. * The property is a `number` (such as `height`).
  53. */
  54. number: boolean
  55. /**
  56. * The property is *like* a `boolean` (such as `download`);
  57. * these properties have an on state *and* more states when defined and an
  58. * off state when not defined.
  59. */
  60. overloadedBoolean: boolean
  61. /**
  62. * JavaScript-style camel-cased name;
  63. * based on the DOM but sometimes different
  64. * (such as `'ariaDescribedBy'`, `'allowFullScreen'`, `'xmlLang'`,
  65. * `'htmlFor'`, `'charOff'`).
  66. */
  67. property: string
  68. /**
  69. * The property is a list separated by spaces
  70. * (such as `className`).
  71. */
  72. spaceSeparated: boolean
  73. /**
  74. * Space of the property.
  75. */
  76. space: Space | undefined
  77. }
  78. /**
  79. * Schema for a primary space.
  80. */
  81. export interface Schema {
  82. /**
  83. * Object mapping normalized attributes and properties to properly cased
  84. * properties.
  85. */
  86. normal: Record<string, string>
  87. /**
  88. * Object mapping properties to info.
  89. */
  90. property: Record<string, Info>
  91. space: Space | undefined
  92. }
  93. /**
  94. * Space of a property.
  95. */
  96. export type Space = 'html' | 'svg' | 'xlink' | 'xmlns' | 'xml'
  97. export {find} from './lib/find.js'
  98. export {hastToReact} from './lib/hast-to-react.js'
  99. /**
  100. * `Schema` for HTML,
  101. * with info on properties from HTML itself and related embedded spaces
  102. * (ARIA, XML, XMLNS, XLink).
  103. */
  104. export const html: Schema
  105. export {normalize} from './lib/normalize.js'
  106. /**
  107. * `Schema` for SVG,
  108. * with info on properties from SVG itself and related embedded spaces
  109. * (ARIA, XML, XMLNS, XLink).
  110. */
  111. export const svg: Schema