|
| 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 | null |
| 77 | +} |
| 78 | + |
| 79 | +/** |
| 80 | + * Schema for a primary space. |
| 81 | + */ |
| 82 | +export interface Schema { |
| 83 | + /** |
| 84 | + * Object mapping normalized attributes and properties to properly cased |
| 85 | + * properties. |
| 86 | + */ |
| 87 | + normal: Record<string, string> |
| 88 | + /** |
| 89 | + * Object mapping properties to info. |
| 90 | + */ |
| 91 | + property: Record<string, Info> |
| 92 | + space: Space | null |
| 93 | +} |
| 94 | + |
| 95 | +/** |
| 96 | + * Space of a property. |
| 97 | + */ |
| 98 | +export type Space = 'html' | 'svg' | 'xlink' | 'xmlns' | 'xml' |
| 99 | + |
| 100 | +export {find} from './lib/find.js' |
| 101 | + |
| 102 | +export {hastToReact} from './lib/hast-to-react.js' |
| 103 | + |
| 104 | +/** |
| 105 | + * `Schema` for HTML, |
| 106 | + * with info on properties from HTML itself and related embedded spaces |
| 107 | + * (ARIA, XML, XMLNS, XLink). |
| 108 | + */ |
| 109 | +export const html: Schema |
| 110 | + |
| 111 | +export {normalize} from './lib/normalize.js' |
| 112 | + |
| 113 | +/** |
| 114 | + * `Schema` for SVG, |
| 115 | + * with info on properties from SVG itself and related embedded spaces |
| 116 | + * (ARIA, XML, XMLNS, XLink). |
| 117 | + */ |
| 118 | +export const svg: Schema |
0 commit comments