Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.
TypeScript accessibilityalternativecloudflarecloudflare-workersdesignfreefrontendopen-sourceradix-uireactremixweb-developmentwebflowwebsite-builderwebsite-developmentwebsiteswebstudio
experimental: generate meta for html and aria attributes (#5149)
Bogdan Chadkin87312f880966
diff --git a/packages/html-data/bin/aria.ts b/packages/html-data/bin/aria.tsnew file mode 100644index 0000000000..e8aff9d409--- /dev/null+++ b/packages/html-data/bin/aria.ts@@ -0,0 +1,147 @@+import { aria } from "aria-query";+import {+ findTags,+ getAttr,+ getTextContent,+ loadPage,+ parseHtml,+} from "./crawler";+import { mkdir, writeFile } from "node:fs/promises";+import {+ createScope,+ elementComponent,+ Prop,+ type Instance,+ type Instances,+ type Props,+} from "@webstudio-is/sdk";+import { generateWebstudioComponent } from "@webstudio-is/react-sdk";++type Attribute = {+ name: string;+ description: string;+ type: "string" | "boolean" | "number" | "select";+ options?: string[];+};++const html = await loadPage("aria1.3", "https://www.w3.org/TR/wai-aria-1.3");+const document = parseHtml(html);+const list = findTags(document, "dl").find(+ (table) => getAttr(table, "id")?.value === "index_state_prop"+);+const terms = findTags(list, "dt");+const details = findTags(list, "dd");+const descriptions = new Map<string, string>();+for (let index = 0; index < terms.length; index += 1) {+ const term = getTextContent(terms[index]);+ const detail = getTextContent(details[index]);+ descriptions.set(term, detail);+}++const attributes: Attribute[] = [];+for (const [name, meta] of aria.entries()) {+ const attribute: Attribute = {+ name,+ description: descriptions.get(name) ?? "",+ type: "string",+ };+ if (meta.type === "string" || meta.type === "boolean") {+ attribute.type = meta.type;+ } else if (meta.type === "number" || meta.type === "integer") {+ attribute.type = "number";+ } else if (meta.type === "token" || meta.type === "tokenlist") {+ attribute.type = "select";+ attribute.options = meta.values?.map((item) => item.toString());+ } else if (meta.type === "tristate") {+ attribute.type = "select";+ attribute.options = ["false", "mixed", "true"];+ } else {+ meta.type satisfies "id" | "idlist" | "tristate";+ }+ attributes.push(attribute);+}++const ariaContent = `type Attribute = {+ name: string,+ description: string,+ type: 'string' | 'boolean' | 'number' | 'select',+ options?: string[]+}++export const ariaAttributes: Attribute[] = ${JSON.stringify(attributes, null, 2)};+`;+await mkdir("./src/__generated__", { recursive: true });+await writeFile("./src/__generated__/aria.ts", ariaContent);++// generate jsx for testing react types++const instances: Instances = new Map();+const props: Props = new Map();++let id = 0;+const getId = () => {+ id += 1;+ return id.toString();+};++const instance: Instance = {+ type: "instance",+ id: getId(),+ component: elementComponent,+ tag: "div",+ children: [],+};+instances.set(instance.id, instance);+for (const { name, type, options } of attributes) {+ const id = getId();+ const instanceId = instance.id;+ if (type === "string") {+ const prop: Prop = { id, instanceId, type, name, value: "" };+ props.set(prop.id, prop);+ continue;+ }+ if (type === "boolean") {+ const prop: Prop = { id, instanceId, type, name, value: true };+ props.set(prop.id, prop);+ continue;+ }+ if (type === "select") {+ const prop: Prop = {+ id,+ instanceId,+ type: "string",+ name,+ value: options?.[0] ?? "",+ };+ props.set(prop.id, prop);+ continue;+ }+ if (type === "number") {+ const prop: Prop = {+ id,+ instanceId,+ type: "number",+ name,+ value: 0,+ };+ props.set(prop.id, prop);+ continue;+ }+ throw Error(`Unknown attribute ${name} with type ${type}`);+}++await mkdir("./src/__generated__", { recursive: true });+await writeFile(+ "./src/__generated__/aria-jsx-test.tsx",+ generateWebstudioComponent({+ name: "Page",+ scope: createScope(),+ instances,+ props,+ dataSources: new Map(),+ rootInstanceId: instance.id,+ classesMap: new Map(),+ parameters: [],+ metas: new Map(),+ }) + "export { Page }"+);diff --git a/packages/html-data/bin/attributes.ts b/packages/html-data/bin/attributes.tsnew file mode 100644index 0000000000..6564f6d89d--- /dev/null+++ b/packages/html-data/bin/attributes.ts@@ -0,0 +1,253 @@+import { mkdir, writeFile } from "node:fs/promises";+import {+ createScope,+ elementComponent,+ type Instance,+ type Instances,+ type Prop,+ type Props,+} from "@webstudio-is/sdk";+import { generateWebstudioComponent } from "@webstudio-is/react-sdk";+import {+ findTags,+ getAttr,+ getTextContent,+ loadHtmlIndices,+ parseHtml,+} from "./crawler";++type Attribute = {+ name: string;+ description: string;+ type: "string" | "boolean" | "number" | "select";+ options?: string[];+};++const overrides: Record<+ string,+ false | Record<string, false | Partial<Attribute>>+> = {+ template: false,+ link: false,+ script: false,+ style: false,+ "*": {+ // react has own opinions about it+ style: false,+ // specific to input in react types+ enterkeyhint: false,+ inert: false,+ popover: false,+ writingsuggestions: false,+ hidden: {+ // "until-found"; "hidden"; the empty string+ type: "boolean",+ options: undefined,+ },+ },+ area: {+ ping: false,+ },+ button: {+ command: false,+ commandfor: false,+ popovertarget: false,+ popovertargetaction: false,+ },+ dialog: {+ closedby: false,+ },+ img: {+ ismap: false,+ },+ input: {+ alpha: false,+ colorspace: false,+ // react types have it only in textarea+ dirname: false,+ popovertarget: false,+ popovertargetaction: false,+ },+};++// Crawl WHATWG HTML.+const html = await loadHtmlIndices();+const document = parseHtml(html);+const table = findTags(document, "table").find(+ (table) => getAttr(table, "id")?.value === "attributes-1"+);+const [tbody] = findTags(table, "tbody");+const rows = findTags(tbody, "tr");++const attributesByTag: Record<string, Attribute[]> = {};++for (const row of rows) {+ const attribute = getTextContent(row.childNodes[0]).trim();+ const elements = getTextContent(row.childNodes[1]).trim();+ const description = getTextContent(row.childNodes[2]).trim();+ const tags = /HTML elements/.test(elements)+ ? ["*"]+ : elements.split(/;/g).map((d) => d.replace(/\([^)]+\)/g, "").trim());+ let value = getTextContent(row.childNodes[3]).trim().toLowerCase();+ if (value.endsWith(";")) {+ value = value.slice(0, -1);+ }+ const possibleOptions = value+ .split(/\s*;\s*/)+ .filter((item) => item.startsWith('"') && item.endsWith('"'))+ .map((item) => item.slice(1, -1));+ let type: "string" | "boolean" | "number" | "select" = "string";+ let options: undefined | string[];+ if (possibleOptions.length > 0) {+ type = "select";+ options = possibleOptions;+ } else if (value.includes("boolean attribute")) {+ type = "boolean";+ } else if (+ (value.includes("number") || value.includes("integer")) &&+ !value.includes("list") &&+ !value.includes("string")+ ) {+ type = "number";+ }+ for (let tag of tags) {+ tag = tag.toLowerCase().trim();+ if (/custom elements/i.test(tag)) {+ continue;+ }+ const tagOverride = overrides[tag];+ if (tagOverride === false) {+ continue;+ }+ if (!attributesByTag[tag]) {+ attributesByTag[tag] = [];+ }+ const attributes = attributesByTag[tag];+ if (!attributes.some((item) => item.name === attribute)) {+ const override = tagOverride?.[attribute];+ if (override !== false) {+ attributes.push({+ name: attribute,+ description,+ type,+ options,+ ...override,+ });+ }+ }+ }+}++// sort tags and attributes+const tags = Object.keys(attributesByTag).sort();+for (const tag of tags) {+ const attributes = attributesByTag[tag];+ delete attributesByTag[tag];+ attributes.sort();+ if (attributes.length > 0) {+ attributesByTag[tag] = attributes;+ }+}++const attributesContent = `type Attribute = {+ name: string,+ description: string,+ type: 'string' | 'boolean' | 'number' | 'select',+ options?: string[]+}++export const attributesByTag: Record<string, undefined | Attribute[]> = ${JSON.stringify(attributesByTag, null, 2)};+`;++await mkdir("./src/__generated__", { recursive: true });+await writeFile("./src/__generated__/attributes.ts", attributesContent);++// generate jsx for testing react types++const instances: Instances = new Map();+const props: Props = new Map();++let id = 0;+const getId = () => {+ id += 1;+ return id.toString();+};++const body: Instance = {+ type: "instance",+ id: getId(),+ component: elementComponent,+ tag: "body",+ children: [],+};+instances.set(body.id, body);++for (const entry of Object.entries(attributesByTag)) {+ let [tag] = entry;+ const [_tag, attributes] = entry;+ if (tag === "*") {+ tag = "div";+ }+ const instance: Instance = {+ type: "instance",+ id: getId(),+ component: elementComponent,+ tag,+ children: [],+ };+ body.children.push({ type: "id", value: instance.id });+ instances.set(instance.id, instance);+ for (const { name, type, options } of attributes) {+ const id = getId();+ const instanceId = instance.id;+ if (type === "string") {+ const prop: Prop = { id, instanceId, type, name, value: "" };+ props.set(prop.id, prop);+ continue;+ }+ if (type === "boolean") {+ const prop: Prop = { id, instanceId, type, name, value: true };+ props.set(prop.id, prop);+ continue;+ }+ if (type === "select") {+ const prop: Prop = {+ id,+ instanceId,+ type: "string",+ name,+ value: options?.[0] ?? "",+ };+ props.set(prop.id, prop);+ continue;+ }+ if (type === "number") {+ const prop: Prop = {+ id,+ instanceId,+ type: "number",+ name,+ value: 0,+ };+ props.set(prop.id, prop);+ continue;+ }+ throw Error(`Unknown attribute ${name} with type ${type}`);+ }+}++await mkdir("./src/__generated__", { recursive: true });+await writeFile(+ "./src/__generated__/attributes-jsx-test.tsx",+ generateWebstudioComponent({+ name: "Page",+ scope: createScope(),+ instances,+ props,+ dataSources: new Map(),+ rootInstanceId: body.id,+ classesMap: new Map(),+ parameters: [],+ metas: new Map(),+ }) + "export { Page }"+);diff --git a/packages/html-data/bin/crawler.ts b/packages/html-data/bin/crawler.tsindex d7dc33475b..87536f0080 100644--- a/packages/html-data/bin/crawler.ts+++ b/packages/html-data/bin/crawler.ts@@ -1,3 +1,4 @@+import { readFile, writeFile } from "node:fs/promises";import { Parser, defaultTreeAdapter, type DefaultTreeAdapterMap } from "parse5";type Document = DefaultTreeAdapterMap["document"];@@ -29,10 +30,10 @@ export const findTags = (};export const getAttr = (- node: NodeWithChildren,+ node: undefined | NodeWithChildren,name: string): undefined | Attribute => {- return node.attrs.find((attr) => attr.name === name);+ return node?.attrs.find((attr) => attr.name === name);};export const getTextContent = (node: ChildNode) => {@@ -51,3 +52,23 @@ export const getTextContent = (node: ChildNode) => {export const parseHtml = (html: string): Document => {return Parser.parse(html, { treeAdapter: defaultTreeAdapter });};++export const loadPage = async (name: string, url: string) => {+ // prefer cached file to avoid too many requests on debug+ const cachedFile = `./node_modules/.cache/${name}.html`;+ let text;+ try {+ text = await readFile(cachedFile, "utf-8");+ } catch {+ const response = await fetch(url);+ text = await response.text();+ await writeFile(cachedFile, text);+ }+ return text;+};++export const loadHtmlIndices = () =>+ loadPage(+ "html-spec-indices",+ "https://html.spec.whatwg.org/multipage/indices.html"+ );diff --git a/packages/html-data/bin/html-crawler.ts b/packages/html-data/bin/elements.tssimilarity index 76%rename from packages/html-data/bin/html-crawler.tsrename to packages/html-data/bin/elements.tsindex 9071ed56c8..98def52c90 100644--- a/packages/html-data/bin/html-crawler.ts+++ b/packages/html-data/bin/elements.ts@@ -1,23 +1,16 @@import { dirname } from "node:path";-import { mkdir, readFile, writeFile } from "node:fs/promises";-import { findTags, getTextContent, parseHtml } from "./crawler";+import { mkdir, writeFile } from "node:fs/promises";+import {+ findTags,+ getTextContent,+ loadHtmlIndices,+ parseHtml,+} from "./crawler";// Crawl WHATWG HTML.-// prefer cached file to avoid too many requests on debug-const cachedFile = "./node_modules/.cache/html-spec-indices.html";-let text;-try {- text = await readFile(cachedFile, "utf-8");-} catch {- const response = await fetch(- "https://html.spec.whatwg.org/multipage/indices.html"- );- text = await response.text();- await writeFile(cachedFile, text);-}--const document = parseHtml(text);+const html = await loadHtmlIndices();+const document = parseHtml(html);const categoriesByTag: Record<string, string[]> = {};const childrenCategoriesByTag: Record<string, string[]> = {};diff --git a/packages/html-data/package.json b/packages/html-data/package.jsonindex a975a41ab1..daf0cd31d6 100644--- a/packages/html-data/package.json+++ b/packages/html-data/package.json@@ -7,10 +7,16 @@"type": "module","scripts": {"typecheck": "tsc",- "build:spec": "tsx --conditions=webstudio ./bin/html-crawler.ts"+ "build:elements": "tsx --conditions=webstudio ./bin/elements.ts && prettier --write ./src/__generated__",+ "build:attributes": "tsx --conditions=webstudio ./bin/attributes.ts && prettier --write ./src/__generated__",+ "build:aria": "tsx --conditions=webstudio ./bin/aria.ts && prettier --write ./src/__generated__"},"devDependencies": {+ "@types/aria-query": "^5.0.4",+ "@webstudio-is/react-sdk": "workspace:*",+ "@webstudio-is/sdk": "workspace:*","@webstudio-is/tsconfig": "workspace:*",+ "aria-query": "^5.3.2","parse5": "7.2.1"},"exports": {diff --git a/packages/html-data/src/__generated__/aria-jsx-test.tsx b/packages/html-data/src/__generated__/aria-jsx-test.tsxnew file mode 100644index 0000000000..533c78d065--- /dev/null+++ b/packages/html-data/src/__generated__/aria-jsx-test.tsx@@ -0,0 +1,58 @@+const Page = () => {+ return (+ <div+ aria-activedescendant={""}+ aria-atomic={true}+ aria-autocomplete={"inline"}+ aria-braillelabel={""}+ aria-brailleroledescription={""}+ aria-busy={true}+ aria-checked={"false"}+ aria-colcount={0}+ aria-colindex={0}+ aria-colspan={0}+ aria-controls={""}+ aria-current={"page"}+ aria-describedby={""}+ aria-description={""}+ aria-details={""}+ aria-disabled={true}+ aria-dropeffect={"copy"}+ aria-errormessage={""}+ aria-expanded={true}+ aria-flowto={""}+ aria-grabbed={true}+ aria-haspopup={"false"}+ aria-hidden={true}+ aria-invalid={"grammar"}+ aria-keyshortcuts={""}+ aria-label={""}+ aria-labelledby={""}+ aria-level={0}+ aria-live={"assertive"}+ aria-modal={true}+ aria-multiline={true}+ aria-multiselectable={true}+ aria-orientation={"vertical"}+ aria-owns={""}+ aria-placeholder={""}+ aria-posinset={0}+ aria-pressed={"false"}+ aria-readonly={true}+ aria-relevant={"additions"}+ aria-required={true}+ aria-roledescription={""}+ aria-rowcount={0}+ aria-rowindex={0}+ aria-rowspan={0}+ aria-selected={true}+ aria-setsize={0}+ aria-sort={"ascending"}+ aria-valuemax={0}+ aria-valuemin={0}+ aria-valuenow={0}+ aria-valuetext={""}+ />+ );+};+export { Page };diff --git a/packages/html-data/src/__generated__/aria.ts b/packages/html-data/src/__generated__/aria.tsnew file mode 100644index 0000000000..42f560b17b--- /dev/null+++ b/packages/html-data/src/__generated__/aria.ts@@ -0,0 +1,323 @@+type Attribute = {+ name: string;+ description: string;+ type: "string" | "boolean" | "number" | "select";+ options?: string[];+};++export const ariaAttributes: Attribute[] = [+ {+ name: "aria-activedescendant",+ description:+ "Identifies the currently active element when DOM focus is on a composite widget, combobox, textbox, group, or application.",+ type: "string",+ },+ {+ name: "aria-atomic",+ description:+ "Indicates whether assistive technologies will present all, or only parts of, the changed region based on the change notifications defined by the aria-relevant attribute.",+ type: "boolean",+ },+ {+ name: "aria-autocomplete",+ description:+ "Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for a combobox, searchbox, or textbox and specifies how predictions would be presented if they were made.",+ type: "select",+ options: ["inline", "list", "both", "none"],+ },+ {+ name: "aria-braillelabel",+ description:+ "Defines a string value that labels the current element, which is intended to be converted into Braille. See related aria-label.",+ type: "string",+ },+ {+ name: "aria-brailleroledescription",+ description:+ "Defines a human-readable, author-localized abbreviated description for the role of an element, which is intended to be converted into Braille. See related aria-roledescription.",+ type: "string",+ },+ {+ name: "aria-busy",+ description:+ "Indicates an element is being modified and that assistive technologies could wait until the modifications are complete before exposing them to the user.",+ type: "boolean",+ },+ {+ name: "aria-checked",+ description:+ 'Indicates the current "checked" state of checkboxes, radio buttons, and other widgets. See related aria-pressed and aria-selected.',+ type: "select",+ options: ["false", "mixed", "true"],+ },+ {+ name: "aria-colcount",+ description:+ "Defines the total number of columns in a table, grid, or treegrid. See related aria-colindex.",+ type: "number",+ },+ {+ name: "aria-colindex",+ description:+ "Defines an element's column index or position with respect to the total number of columns within a table, grid, or treegrid. See related aria-colindextext, aria-colcount, and aria-colspan.",+ type: "number",+ },+ {+ name: "aria-colspan",+ description:+ "Defines the number of columns spanned by a cell or gridcell within a table, grid, or treegrid. See related aria-colindex and aria-rowspan.",+ type: "number",+ },+ {+ name: "aria-controls",+ description:+ "Identifies the element (or elements) whose contents or presence are controlled by the current element. See related aria-owns.",+ type: "string",+ },+ {+ name: "aria-current",+ description:+ "Indicates the element that represents the current item within a container or set of related elements.",+ type: "select",+ options: ["page", "step", "location", "date", "time", "true", "false"],+ },+ {+ name: "aria-describedby",+ description:+ "Identifies the element (or elements) that describes the object. See related aria-labelledby and aria-description.",+ type: "string",+ },+ {+ name: "aria-description",+ description:+ "Defines a string value that describes or annotates the current element. See related aria-describedby.",+ type: "string",+ },+ {+ name: "aria-details",+ description:+ "Identifies the element (or elements) that provide additional information related to the object. See related aria-describedby.",+ type: "string",+ },+ {+ name: "aria-disabled",+ description:+ "Indicates that the element is perceivable but disabled, so it is not editable or otherwise operable. See related aria-hidden and aria-readonly.",+ type: "boolean",+ },+ {+ name: "aria-dropeffect",+ description:+ "[Deprecated in ARIA 1.1] Indicates what functions can be performed when a dragged object is released on the drop target.",+ type: "select",+ options: ["copy", "execute", "link", "move", "none", "popup"],+ },+ {+ name: "aria-errormessage",+ description:+ "Identifies the element (or elements) that provides an error message for an object. See related aria-invalid and aria-describedby.",+ type: "string",+ },+ {+ name: "aria-expanded",+ description:+ "Indicates whether a grouping element that is the accessibility child of or is controlled by this element is expanded or collapsed.",+ type: "boolean",+ },+ {+ name: "aria-flowto",+ description:+ "Identifies the next element (or elements) in an alternate reading order of content which, at the user's discretion, allows assistive technology to override the general default of reading in document source order.",+ type: "string",+ },+ {+ name: "aria-grabbed",+ description:+ '[Deprecated in ARIA 1.1] Indicates an element\'s "grabbed" state in a drag-and-drop operation.',+ type: "boolean",+ },+ {+ name: "aria-haspopup",+ description:+ "Indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an element.",+ type: "select",+ options: ["false", "true", "menu", "listbox", "tree", "grid", "dialog"],+ },+ {+ name: "aria-hidden",+ description:+ "Indicates whether the element is exposed to an accessibility API. See related aria-disabled.",+ type: "boolean",+ },+ {+ name: "aria-invalid",+ description:+ "Indicates the entered value does not conform to the format expected by the application. See related aria-errormessage.",+ type: "select",+ options: ["grammar", "false", "spelling", "true"],+ },+ {+ name: "aria-keyshortcuts",+ description:+ "Defines keyboard shortcuts that an author has implemented to activate or give focus to an element.",+ type: "string",+ },+ {+ name: "aria-label",+ description:+ "Defines a string value that labels the current element. See related aria-labelledby.",+ type: "string",+ },+ {+ name: "aria-labelledby",+ description:+ "Identifies the element (or elements) that labels the current element. See related aria-label and aria-describedby.",+ type: "string",+ },+ {+ name: "aria-level",+ description:+ "Defines the hierarchical level of an element within a structure.",+ type: "number",+ },+ {+ name: "aria-live",+ description:+ "Indicates that an element will be updated, and describes the types of updates the user agents, assistive technologies, and user can expect from the live region.",+ type: "select",+ options: ["assertive", "off", "polite"],+ },+ {+ name: "aria-modal",+ description: "Indicates whether an element is modal when displayed.",+ type: "boolean",+ },+ {+ name: "aria-multiline",+ description:+ "Indicates whether a text box accepts multiple lines of input or only a single line.",+ type: "boolean",+ },+ {+ name: "aria-multiselectable",+ description:+ "Indicates that the user can select more than one item from the current selectable descendants.",+ type: "boolean",+ },+ {+ name: "aria-orientation",+ description:+ "Indicates whether the element's orientation is horizontal, vertical, or unknown/ambiguous.",+ type: "select",+ options: ["vertical", "undefined", "horizontal"],+ },+ {+ name: "aria-owns",+ description:+ "Identifies an element (or elements) in order to define a visual, functional, or contextual parent/child relationship between DOM elements where the DOM hierarchy cannot be used to represent the relationship. See related aria-controls.",+ type: "string",+ },+ {+ name: "aria-placeholder",+ description:+ "Defines a short hint (a word or short phrase) intended to aid the user with data entry when the control has no value. A hint could be a sample value or a brief description of the expected format.",+ type: "string",+ },+ {+ name: "aria-posinset",+ description:+ "Defines an element's number or position in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM. See related aria-setsize.",+ type: "number",+ },+ {+ name: "aria-pressed",+ description:+ 'Indicates the current "pressed" state of toggle buttons. See related aria-checked and aria-selected.',+ type: "select",+ options: ["false", "mixed", "true"],+ },+ {+ name: "aria-readonly",+ description:+ " Indicates that the element is not editable, but is otherwise operable. See related aria-disabled.",+ type: "boolean",+ },+ {+ name: "aria-relevant",+ description:+ "Indicates what notifications the user agent will trigger when the accessibility tree within a live region is modified. See related aria-atomic.",+ type: "select",+ options: ["additions", "all", "removals", "text"],+ },+ {+ name: "aria-required",+ description:+ "Indicates that user input is required on the element before a form can be submitted.",+ type: "boolean",+ },+ {+ name: "aria-roledescription",+ description:+ "Defines a human-readable, author-localized description for the role of an element.",+ type: "string",+ },+ {+ name: "aria-rowcount",+ description:+ "Defines the total number of rows in a table, grid, or treegrid. See related aria-rowindex.",+ type: "number",+ },+ {+ name: "aria-rowindex",+ description:+ "Defines an element's row index or position with respect to the total number of rows within a table, grid, or treegrid. See related aria-rowindextext, aria-rowcount, and aria-rowspan.",+ type: "number",+ },+ {+ name: "aria-rowspan",+ description:+ "Defines the number of rows spanned by a cell or gridcell within a table, grid, or treegrid. See related aria-rowindex and aria-colspan.",+ type: "number",+ },+ {+ name: "aria-selected",+ description:+ 'Indicates the current "selected" state of various widgets. See related aria-checked and aria-pressed.',+ type: "boolean",+ },+ {+ name: "aria-setsize",+ description:+ "Defines the number of items in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM. See related aria-posinset.",+ type: "number",+ },+ {+ name: "aria-sort",+ description:+ "Indicates if items in a table or grid are sorted in ascending or descending order.",+ type: "select",+ options: ["ascending", "descending", "none", "other"],+ },+ {+ name: "aria-valuemax",+ description: "Defines the maximum allowed value for a range widget.",+ type: "number",+ },+ {+ name: "aria-valuemin",+ description: "Defines the minimum allowed value for a range widget.",+ type: "number",+ },+ {+ name: "aria-valuenow",+ description:+ "Defines the current value for a range widget. See related aria-valuetext.",+ type: "number",+ },+ {+ name: "aria-valuetext",+ description:+ "Defines the human readable text alternative of aria-valuenow for a range widget.",+ type: "string",+ },+];diff --git a/packages/html-data/src/__generated__/attributes-jsx-test.tsx b/packages/html-data/src/__generated__/attributes-jsx-test.tsxnew file mode 100644index 0000000000..c86a5c0e54--- /dev/null+++ b/packages/html-data/src/__generated__/attributes-jsx-test.tsx@@ -0,0 +1,232 @@+const Page = () => {+ return (+ <body>+ <div+ accessKey={""}+ autoCapitalize={"on"}+ autoCorrect={"on"}+ autoFocus={true}+ contentEditable={"true"}+ dir={"ltr"}+ draggable={"true"}+ hidden={true}+ id={""}+ inputMode={"none"}+ is={""}+ itemID={""}+ itemProp={""}+ itemRef={""}+ itemScope={true}+ itemType={""}+ lang={""}+ nonce={""}+ slot={""}+ spellCheck={"true"}+ tabIndex={0}+ title={""}+ translate={"yes"}+ className={`${""}`}+ />+ <a+ download={""}+ href={""}+ hrefLang={""}+ ping={""}+ referrerPolicy={""}+ rel={""}+ target={""}+ type={""}+ />+ <abbr title={""} />+ <area+ alt={""}+ coords={""}+ download={""}+ href={""}+ referrerPolicy={""}+ rel={""}+ shape={"circle"}+ target={""}+ />+ <audio+ autoPlay={true}+ controls={true}+ crossOrigin={"anonymous"}+ loop={true}+ muted={true}+ preload={"none"}+ src={""}+ />+ <base href={""} target={""} />+ <bdo dir={"ltr"} />+ <blockquote cite={""} />+ <button+ disabled={true}+ form={""}+ formAction={""}+ formEncType={"application/x-www-form-urlencoded"}+ formMethod={"get"}+ formNoValidate={true}+ formTarget={""}+ name={""}+ type={"submit"}+ value={""}+ />+ <canvas height={0} width={0} />+ <col span={0} />+ <colgroup span={0} />+ <data value={""} />+ <del cite={""} dateTime={""} />+ <details name={""} open={true} />+ <dfn title={""} />+ <dialog open={true} />+ <embed height={0} src={""} type={""} width={0} />+ <fieldset disabled={true} form={""} name={""} />+ <form+ acceptCharset={""}+ action={""}+ autoComplete={"on"}+ encType={"application/x-www-form-urlencoded"}+ method={"get"}+ name={""}+ noValidate={true}+ target={""}+ />+ <iframe+ allow={""}+ allowFullScreen={true}+ height={0}+ loading={"lazy"}+ name={""}+ referrerPolicy={""}+ sandbox={""}+ src={""}+ srcDoc={""}+ width={0}+ />+ <img+ alt={""}+ crossOrigin={"anonymous"}+ decoding={"sync"}+ fetchPriority={"auto"}+ height={0}+ loading={"lazy"}+ referrerPolicy={""}+ sizes={""}+ src={""}+ srcSet={""}+ useMap={""}+ width={0}+ />+ <input+ accept={""}+ alt={""}+ autoComplete={""}+ checked={true}+ disabled={true}+ form={""}+ formAction={""}+ formEncType={"application/x-www-form-urlencoded"}+ formMethod={"get"}+ formNoValidate={true}+ formTarget={""}+ height={0}+ list={""}+ max={""}+ maxLength={0}+ min={""}+ minLength={0}+ multiple={true}+ name={""}+ pattern={""}+ placeholder={""}+ readOnly={true}+ required={true}+ size={0}+ src={""}+ step={0}+ title={""}+ type={""}+ value={""}+ width={0}+ />+ <ins cite={""} dateTime={""} />+ <label htmlFor={""} />+ <li value={0} />+ <map name={""} />+ <meta+ charSet={"utf-8"}+ content={""}+ httpEquiv={"content-type"}+ media={""}+ name={""}+ />+ <meter high={0} low={0} max={0} min={0} optimum={0} value={0} />+ <object data={""} form={""} height={0} name={""} type={""} width={0} />+ <ol reversed={true} start={0} type={"1"} />+ <optgroup disabled={true} label={""} />+ <option disabled={true} label={""} selected={true} value={""} />+ <output htmlFor={""} form={""} name={""} />+ <progress max={0} value={0} />+ <q cite={""} />+ <select+ autoComplete={""}+ disabled={true}+ form={""}+ multiple={true}+ name={""}+ required={true}+ size={0}+ />+ <slot name={""} />+ <source+ height={0}+ media={""}+ sizes={""}+ src={""}+ srcSet={""}+ type={""}+ width={0}+ />+ <td colSpan={0} headers={""} rowSpan={0} />+ <textarea+ autoComplete={""}+ cols={0}+ dirName={""}+ disabled={true}+ form={""}+ maxLength={0}+ minLength={0}+ name={""}+ placeholder={""}+ readOnly={true}+ required={true}+ rows={0}+ wrap={"soft"}+ />+ <th abbr={""} colSpan={0} headers={""} rowSpan={0} scope={"row"} />+ <time dateTime={""} />+ <track+ default={true}+ kind={"subtitles"}+ label={""}+ src={""}+ srcLang={""}+ />+ <video+ autoPlay={true}+ controls={true}+ crossOrigin={"anonymous"}+ height={0}+ loop={true}+ muted={true}+ playsInline={true}+ poster={""}+ preload={"none"}+ src={""}+ width={0}+ />+ </body>+ );+};+export { Page };diff --git a/packages/html-data/src/__generated__/attributes.ts b/packages/html-data/src/__generated__/attributes.tsnew file mode 100644index 0000000000..003f1833f2--- /dev/null+++ b/packages/html-data/src/__generated__/attributes.ts@@ -0,0 +1,1350 @@+type Attribute = {+ name: string;+ description: string;+ type: "string" | "boolean" | "number" | "select";+ options?: string[];+};++export const attributesByTag: Record<string, undefined | Attribute[]> = {+ "*": [+ {+ name: "accesskey",+ description: "Keyboard shortcut to activate or focus element",+ type: "string",+ },+ {+ name: "autocapitalize",+ description:+ "Recommended autocapitalization behavior (for supported input methods)",+ type: "select",+ options: ["on", "off", "none", "sentences", "words", "characters"],+ },+ {+ name: "autocorrect",+ description:+ "Recommended autocorrection behavior (for supported input methods)",+ type: "select",+ options: ["on", "off"],+ },+ {+ name: "autofocus",+ description: "Automatically focus the element when the page is loaded",+ type: "boolean",+ },+ {+ name: "class",+ description: "Classes to which the element belongs",+ type: "string",+ },+ {+ name: "contenteditable",+ description: "Whether the element is editable",+ type: "select",+ options: ["true", "plaintext-only", "false"],+ },+ {+ name: "dir",+ description: "The text directionality of the element",+ type: "select",+ options: ["ltr", "rtl", "auto"],+ },+ {+ name: "draggable",+ description: "Whether the element is draggable",+ type: "select",+ options: ["true", "false"],+ },+ {+ name: "hidden",+ description: "Whether the element is relevant",+ type: "boolean",+ },+ {+ name: "id",+ description: "The element's ID",+ type: "string",+ },+ {+ name: "inputmode",+ description: "Hint for selecting an input modality",+ type: "select",+ options: [+ "none",+ "text",+ "tel",+ "email",+ "url",+ "numeric",+ "decimal",+ "search",+ ],+ },+ {+ name: "is",+ description: "Creates a customized built-in element",+ type: "string",+ },+ {+ name: "itemid",+ description: "Global identifier for a microdata item",+ type: "string",+ },+ {+ name: "itemprop",+ description: "Property names of a microdata item",+ type: "string",+ },+ {+ name: "itemref",+ description: "Referenced elements",+ type: "string",+ },+ {+ name: "itemscope",+ description: "Introduces a microdata item",+ type: "boolean",+ },+ {+ name: "itemtype",+ description: "Item types of a microdata item",+ type: "string",+ },+ {+ name: "lang",+ description: "Language of the element",+ type: "string",+ },+ {+ name: "nonce",+ description:+ "Cryptographic nonce used in Content Security Policy checks [CSP]",+ type: "string",+ },+ {+ name: "slot",+ description: "The element's desired slot",+ type: "string",+ },+ {+ name: "spellcheck",+ description:+ "Whether the element is to have its spelling and grammar checked",+ type: "select",+ options: ["true", "false"],+ },+ {+ name: "tabindex",+ description:+ "Whether the element is focusable and sequentially focusable, and\n the relative order of the element for the purposes of sequential focus navigation",+ type: "number",+ },+ {+ name: "title",+ description: "Advisory information for the element",+ type: "string",+ },+ {+ name: "translate",+ description:+ "Whether the element is to be translated when the page is localized",+ type: "select",+ options: ["yes", "no"],+ },+ ],+ a: [+ {+ name: "download",+ description:+ "Whether to download the resource instead of navigating to it, and its filename if so",+ type: "string",+ },+ {+ name: "href",+ description: "Address of the hyperlink",+ type: "string",+ },+ {+ name: "hreflang",+ description: "Language of the linked resource",+ type: "string",+ },+ {+ name: "ping",+ description: "URLs to ping",+ type: "string",+ },+ {+ name: "referrerpolicy",+ description: "Referrer policy for fetches initiated by the element",+ type: "string",+ },+ {+ name: "rel",+ description:+ "Relationship between the location in the document containing the hyperlink and the destination resource",+ type: "string",+ },+ {+ name: "target",+ description: "Navigable for hyperlink navigation",+ type: "string",+ },+ {+ name: "type",+ description: "Hint for the type of the referenced resource",+ type: "string",+ },+ ],+ abbr: [+ {+ name: "title",+ description: "Full term or expansion of abbreviation",+ type: "string",+ },+ ],+ area: [+ {+ name: "alt",+ description: "Replacement text for use when images are not available",+ type: "string",+ },+ {+ name: "coords",+ description: "Coordinates for the shape to be created in an image map",+ type: "string",+ },+ {+ name: "download",+ description:+ "Whether to download the resource instead of navigating to it, and its filename if so",+ type: "string",+ },+ {+ name: "href",+ description: "Address of the hyperlink",+ type: "string",+ },+ {+ name: "referrerpolicy",+ description: "Referrer policy for fetches initiated by the element",+ type: "string",+ },+ {+ name: "rel",+ description:+ "Relationship between the location in the document containing the hyperlink and the destination resource",+ type: "string",+ },+ {+ name: "shape",+ description: "The kind of shape to be created in an image map",+ type: "select",+ options: ["circle", "default", "poly", "rect"],+ },+ {+ name: "target",+ description: "Navigable for hyperlink navigation",+ type: "string",+ },+ ],+ audio: [+ {+ name: "autoplay",+ description:+ "Hint that the media resource can be started automatically when the page is loaded",+ type: "boolean",+ },+ {+ name: "controls",+ description: "Show user agent controls",+ type: "boolean",+ },+ {+ name: "crossorigin",+ description: "How the element handles crossorigin requests",+ type: "select",+ options: ["anonymous", "use-credentials"],+ },+ {+ name: "loop",+ description: "Whether to loop the media resource",+ type: "boolean",+ },+ {+ name: "muted",+ description: "Whether to mute the media resource by default",+ type: "boolean",+ },+ {+ name: "preload",+ description:+ "Hints how much buffering the media resource will likely need",+ type: "select",+ options: ["none", "metadata", "auto"],+ },+ {+ name: "src",+ description: "Address of the resource",+ type: "string",+ },+ ],+ base: [+ {+ name: "href",+ description: "Document base URL",+ type: "string",+ },+ {+ name: "target",+ description:+ "Default navigable for hyperlink navigation and form submission",+ type: "string",+ },+ ],+ bdo: [+ {+ name: "dir",+ description: "The text directionality of the element",+ type: "select",+ options: ["ltr", "rtl"],+ },+ ],+ blockquote: [+ {+ name: "cite",+ description:+ "Link to the source of the quotation or more information about the edit",+ type: "string",+ },+ ],+ button: [+ {+ name: "disabled",+ description: "Whether the form control is disabled",+ type: "boolean",+ },+ {+ name: "form",+ description: "Associates the element with a form element",+ type: "string",+ },+ {+ name: "formaction",+ description: "URL to use for form submission",+ type: "string",+ },+ {+ name: "formenctype",+ description: "Entry list encoding type to use for form submission",+ type: "select",+ options: [+ "application/x-www-form-urlencoded",+ "multipart/form-data",+ "text/plain",+ ],+ },+ {+ name: "formmethod",+ description: "Variant to use for form submission",+ type: "select",+ options: ["get", "post", "dialog"],+ },+ {+ name: "formnovalidate",+ description: "Bypass form control validation for form submission",+ type: "boolean",+ },+ {+ name: "formtarget",+ description: "Navigable for form submission",+ type: "string",+ },+ {+ name: "name",+ description:+ "Name of the element to use for form submission and in the form.elements API",+ type: "string",+ },+ {+ name: "type",+ description: "Type of button",+ type: "select",+ options: ["submit", "reset", "button"],+ },+ {+ name: "value",+ description: "Value to be used for form submission",+ type: "string",+ },+ ],+ canvas: [+ {+ name: "height",+ description: "Vertical dimension",+ type: "number",+ },+ {+ name: "width",+ description: "Horizontal dimension",+ type: "number",+ },+ ],+ col: [+ {+ name: "span",+ description: "Number of columns spanned by the element",+ type: "number",+ },+ ],+ colgroup: [+ {+ name: "span",+ description: "Number of columns spanned by the element",+ type: "number",+ },+ ],+ data: [+ {+ name: "value",+ description: "Machine-readable value",+ type: "string",+ },+ ],+ del: [+ {+ name: "cite",+ description:+ "Link to the source of the quotation or more information about the edit",+ type: "string",+ },+ {+ name: "datetime",+ description: "Date and (optionally) time of the change",+ type: "string",+ },+ ],+ details: [+ {+ name: "name",+ description: "Name of group of mutually-exclusive details elements",+ type: "string",+ },+ {+ name: "open",+ description: "Whether the details are visible",+ type: "boolean",+ },+ ],+ dfn: [+ {+ name: "title",+ description: "Full term or expansion of abbreviation",+ type: "string",+ },+ ],+ dialog: [+ {+ name: "open",+ description: "Whether the dialog box is showing",+ type: "boolean",+ },+ ],+ embed: [+ {+ name: "height",+ description: "Vertical dimension",+ type: "number",+ },+ {+ name: "src",+ description: "Address of the resource",+ type: "string",+ },+ {+ name: "type",+ description: "Type of embedded resource",+ type: "string",+ },+ {+ name: "width",+ description: "Horizontal dimension",+ type: "number",+ },+ ],+ fieldset: [+ {+ name: "disabled",+ description:+ "Whether the descendant form controls, except any inside legend, are disabled",+ type: "boolean",+ },+ {+ name: "form",+ description: "Associates the element with a form element",+ type: "string",+ },+ {+ name: "name",+ description:+ "Name of the element to use for form submission and in the form.elements API",+ type: "string",+ },+ ],+ form: [+ {+ name: "accept-charset",+ description: "Character encodings to use for form submission",+ type: "string",+ },+ {+ name: "action",+ description: "URL to use for form submission",+ type: "string",+ },+ {+ name: "autocomplete",+ description:+ "Default setting for autofill feature for controls in the form",+ type: "select",+ options: ["on", "off"],+ },+ {+ name: "enctype",+ description: "Entry list encoding type to use for form submission",+ type: "select",+ options: [+ "application/x-www-form-urlencoded",+ "multipart/form-data",+ "text/plain",+ ],+ },+ {+ name: "method",+ description: "Variant to use for form submission",+ type: "select",+ options: ["get", "post", "dialog"],+ },+ {+ name: "name",+ description: "Name of form to use in the document.forms API",+ type: "string",+ },+ {+ name: "novalidate",+ description: "Bypass form control validation for form submission",+ type: "boolean",+ },+ {+ name: "target",+ description: "Navigable for form submission",+ type: "string",+ },+ ],+ iframe: [+ {+ name: "allow",+ description: "Permissions policy to be applied to the iframe's contents",+ type: "string",+ },+ {+ name: "allowfullscreen",+ description:+ "Whether to allow the iframe's contents to use requestFullscreen()",+ type: "boolean",+ },+ {+ name: "height",+ description: "Vertical dimension",+ type: "number",+ },+ {+ name: "loading",+ description: "Used when determining loading deferral",+ type: "select",+ options: ["lazy", "eager"],+ },+ {+ name: "name",+ description: "Name of content navigable",+ type: "string",+ },+ {+ name: "referrerpolicy",+ description: "Referrer policy for fetches initiated by the element",+ type: "string",+ },+ {+ name: "sandbox",+ description: "Security rules for nested content",+ type: "string",+ },+ {+ name: "src",+ description: "Address of the resource",+ type: "string",+ },+ {+ name: "srcdoc",+ description: "A document to render in the iframe",+ type: "string",+ },+ {+ name: "width",+ description: "Horizontal dimension",+ type: "number",+ },+ ],+ img: [+ {+ name: "alt",+ description: "Replacement text for use when images are not available",+ type: "string",+ },+ {+ name: "crossorigin",+ description: "How the element handles crossorigin requests",+ type: "select",+ options: ["anonymous", "use-credentials"],+ },+ {+ name: "decoding",+ description:+ "Decoding hint to use when processing this image for presentation",+ type: "select",+ options: ["sync", "async", "auto"],+ },+ {+ name: "fetchpriority",+ description: "Sets the priority for fetches initiated by the element",+ type: "select",+ options: ["auto", "high", "low"],+ },+ {+ name: "height",+ description: "Vertical dimension",+ type: "number",+ },+ {+ name: "loading",+ description: "Used when determining loading deferral",+ type: "select",+ options: ["lazy", "eager"],+ },+ {+ name: "referrerpolicy",+ description: "Referrer policy for fetches initiated by the element",+ type: "string",+ },+ {+ name: "sizes",+ description: "Image sizes for different page layouts",+ type: "string",+ },+ {+ name: "src",+ description: "Address of the resource",+ type: "string",+ },+ {+ name: "srcset",+ description:+ "Images to use in different situations, e.g., high-resolution displays, small monitors, etc.",+ type: "string",+ },+ {+ name: "usemap",+ description: "Name of image map to use",+ type: "string",+ },+ {+ name: "width",+ description: "Horizontal dimension",+ type: "number",+ },+ ],+ input: [+ {+ name: "accept",+ description: "Hint for expected file type in file upload controls",+ type: "string",+ },+ {+ name: "alt",+ description: "Replacement text for use when images are not available",+ type: "string",+ },+ {+ name: "autocomplete",+ description: "Hint for form autofill feature",+ type: "string",+ },+ {+ name: "checked",+ description: "Whether the control is checked",+ type: "boolean",+ },+ {+ name: "disabled",+ description: "Whether the form control is disabled",+ type: "boolean",+ },+ {+ name: "form",+ description: "Associates the element with a form element",+ type: "string",+ },+ {+ name: "formaction",+ description: "URL to use for form submission",+ type: "string",+ },+ {+ name: "formenctype",+ description: "Entry list encoding type to use for form submission",+ type: "select",+ options: [+ "application/x-www-form-urlencoded",+ "multipart/form-data",+ "text/plain",+ ],+ },+ {+ name: "formmethod",+ description: "Variant to use for form submission",+ type: "select",+ options: ["get", "post", "dialog"],+ },+ {+ name: "formnovalidate",+ description: "Bypass form control validation for form submission",+ type: "boolean",+ },+ {+ name: "formtarget",+ description: "Navigable for form submission",+ type: "string",+ },+ {+ name: "height",+ description: "Vertical dimension",+ type: "number",+ },+ {+ name: "list",+ description: "List of autocomplete options",+ type: "string",+ },+ {+ name: "max",+ description: "Maximum value",+ type: "string",+ },+ {+ name: "maxlength",+ description: "Maximum length of value",+ type: "number",+ },+ {+ name: "min",+ description: "Minimum value",+ type: "string",+ },+ {+ name: "minlength",+ description: "Minimum length of value",+ type: "number",+ },+ {+ name: "multiple",+ description: "Whether to allow multiple values",+ type: "boolean",+ },+ {+ name: "name",+ description:+ "Name of the element to use for form submission and in the form.elements API",+ type: "string",+ },+ {+ name: "pattern",+ description: "Pattern to be matched by the form control's value",+ type: "string",+ },+ {+ name: "placeholder",+ description: "User-visible label to be placed within the form control",+ type: "string",+ },+ {+ name: "readonly",+ description: "Whether to allow the value to be edited by the user",+ type: "boolean",+ },+ {+ name: "required",+ description: "Whether the control is required for form submission",+ type: "boolean",+ },+ {+ name: "size",+ description: "Size of the control",+ type: "number",+ },+ {+ name: "src",+ description: "Address of the resource",+ type: "string",+ },+ {+ name: "step",+ description: "Granularity to be matched by the form control's value",+ type: "number",+ },+ {+ name: "title",+ description: "Description of pattern (when used with pattern attribute)",+ type: "string",+ },+ {+ name: "type",+ description: "Type of form control",+ type: "string",+ },+ {+ name: "value",+ description: "Value of the form control",+ type: "string",+ },+ {+ name: "width",+ description: "Horizontal dimension",+ type: "number",+ },+ ],+ ins: [+ {+ name: "cite",+ description:+ "Link to the source of the quotation or more information about the edit",+ type: "string",+ },+ {+ name: "datetime",+ description: "Date and (optionally) time of the change",+ type: "string",+ },+ ],+ label: [+ {+ name: "for",+ description: "Associate the label with form control",+ type: "string",+ },+ ],+ li: [+ {+ name: "value",+ description: "Ordinal value of the list item",+ type: "number",+ },+ ],+ map: [+ {+ name: "name",+ description: "Name of image map to reference from the usemap attribute",+ type: "string",+ },+ ],+ meta: [+ {+ name: "charset",+ description: "Character encoding declaration",+ type: "select",+ options: ["utf-8"],+ },+ {+ name: "content",+ description: "Value of the element",+ type: "string",+ },+ {+ name: "http-equiv",+ description: "Pragma directive",+ type: "select",+ options: [+ "content-type",+ "default-style",+ "refresh",+ "x-ua-compatible",+ "content-security-policy",+ ],+ },+ {+ name: "media",+ description: "Applicable media",+ type: "string",+ },+ {+ name: "name",+ description: "Metadata name",+ type: "string",+ },+ ],+ meter: [+ {+ name: "high",+ description: "Low limit of high range",+ type: "number",+ },+ {+ name: "low",+ description: "High limit of low range",+ type: "number",+ },+ {+ name: "max",+ description: "Upper bound of range",+ type: "number",+ },+ {+ name: "min",+ description: "Lower bound of range",+ type: "number",+ },+ {+ name: "optimum",+ description: "Optimum value in gauge",+ type: "number",+ },+ {+ name: "value",+ description: "Current value of the element",+ type: "number",+ },+ ],+ object: [+ {+ name: "data",+ description: "Address of the resource",+ type: "string",+ },+ {+ name: "form",+ description: "Associates the element with a form element",+ type: "string",+ },+ {+ name: "height",+ description: "Vertical dimension",+ type: "number",+ },+ {+ name: "name",+ description: "Name of content navigable",+ type: "string",+ },+ {+ name: "type",+ description: "Type of embedded resource",+ type: "string",+ },+ {+ name: "width",+ description: "Horizontal dimension",+ type: "number",+ },+ ],+ ol: [+ {+ name: "reversed",+ description: "Number the list backwards",+ type: "boolean",+ },+ {+ name: "start",+ description: "Starting value of the list",+ type: "number",+ },+ {+ name: "type",+ description: "Kind of list marker",+ type: "select",+ options: ["1", "a", "a", "i", "i"],+ },+ ],+ optgroup: [+ {+ name: "disabled",+ description: "Whether the form control is disabled",+ type: "boolean",+ },+ {+ name: "label",+ description: "User-visible label",+ type: "string",+ },+ ],+ option: [+ {+ name: "disabled",+ description: "Whether the form control is disabled",+ type: "boolean",+ },+ {+ name: "label",+ description: "User-visible label",+ type: "string",+ },+ {+ name: "selected",+ description: "Whether the option is selected by default",+ type: "boolean",+ },+ {+ name: "value",+ description: "Value to be used for form submission",+ type: "string",+ },+ ],+ output: [+ {+ name: "for",+ description: "Specifies controls from which the output was calculated",+ type: "string",+ },+ {+ name: "form",+ description: "Associates the element with a form element",+ type: "string",+ },+ {+ name: "name",+ description:+ "Name of the element to use for form submission and in the form.elements API",+ type: "string",+ },+ ],+ progress: [+ {+ name: "max",+ description: "Upper bound of range",+ type: "number",+ },+ {+ name: "value",+ description: "Current value of the element",+ type: "number",+ },+ ],+ q: [+ {+ name: "cite",+ description:+ "Link to the source of the quotation or more information about the edit",+ type: "string",+ },+ ],+ select: [+ {+ name: "autocomplete",+ description: "Hint for form autofill feature",+ type: "string",+ },+ {+ name: "disabled",+ description: "Whether the form control is disabled",+ type: "boolean",+ },+ {+ name: "form",+ description: "Associates the element with a form element",+ type: "string",+ },+ {+ name: "multiple",+ description: "Whether to allow multiple values",+ type: "boolean",+ },+ {+ name: "name",+ description:+ "Name of the element to use for form submission and in the form.elements API",+ type: "string",+ },+ {+ name: "required",+ description: "Whether the control is required for form submission",+ type: "boolean",+ },+ {+ name: "size",+ description: "Size of the control",+ type: "number",+ },+ ],+ slot: [+ {+ name: "name",+ description: "Name of shadow tree slot",+ type: "string",+ },+ ],+ source: [+ {+ name: "height",+ description: "Vertical dimension",+ type: "number",+ },+ {+ name: "media",+ description: "Applicable media",+ type: "string",+ },+ {+ name: "sizes",+ description: "Image sizes for different page layouts",+ type: "string",+ },+ {+ name: "src",+ description: "Address of the resource",+ type: "string",+ },+ {+ name: "srcset",+ description:+ "Images to use in different situations, e.g., high-resolution displays, small monitors, etc.",+ type: "string",+ },+ {+ name: "type",+ description: "Type of embedded resource",+ type: "string",+ },+ {+ name: "width",+ description: "Horizontal dimension",+ type: "number",+ },+ ],+ td: [+ {+ name: "colspan",+ description: "Number of columns that the cell is to span",+ type: "number",+ },+ {+ name: "headers",+ description: "The header cells for this cell",+ type: "string",+ },+ {+ name: "rowspan",+ description: "Number of rows that the cell is to span",+ type: "number",+ },+ ],+ textarea: [+ {+ name: "autocomplete",+ description: "Hint for form autofill feature",+ type: "string",+ },+ {+ name: "cols",+ description: "Maximum number of characters per line",+ type: "number",+ },+ {+ name: "dirname",+ description:+ "Name of form control to use for sending the element's directionality in form submission",+ type: "string",+ },+ {+ name: "disabled",+ description: "Whether the form control is disabled",+ type: "boolean",+ },+ {+ name: "form",+ description: "Associates the element with a form element",+ type: "string",+ },+ {+ name: "maxlength",+ description: "Maximum length of value",+ type: "number",+ },+ {+ name: "minlength",+ description: "Minimum length of value",+ type: "number",+ },+ {+ name: "name",+ description:+ "Name of the element to use for form submission and in the form.elements API",+ type: "string",+ },+ {+ name: "placeholder",+ description: "User-visible label to be placed within the form control",+ type: "string",+ },+ {+ name: "readonly",+ description: "Whether to allow the value to be edited by the user",+ type: "boolean",+ },+ {+ name: "required",+ description: "Whether the control is required for form submission",+ type: "boolean",+ },+ {+ name: "rows",+ description: "Number of lines to show",+ type: "number",+ },+ {+ name: "wrap",+ description:+ "How the value of the form control is to be wrapped for form submission",+ type: "select",+ options: ["soft", "hard"],+ },+ ],+ th: [+ {+ name: "abbr",+ description:+ "Alternative label to use for the header cell when referencing the cell in other contexts",+ type: "string",+ },+ {+ name: "colspan",+ description: "Number of columns that the cell is to span",+ type: "number",+ },+ {+ name: "headers",+ description: "The header cells for this cell",+ type: "string",+ },+ {+ name: "rowspan",+ description: "Number of rows that the cell is to span",+ type: "number",+ },+ {+ name: "scope",+ description: "Specifies which cells the header cell applies to",+ type: "select",+ options: ["row", "col", "rowgroup", "colgroup"],+ },+ ],+ time: [+ {+ name: "datetime",+ description: "Machine-readable value",+ type: "string",+ },+ ],+ track: [+ {+ name: "default",+ description: "Enable the track if no other text track is more suitable",+ type: "boolean",+ },+ {+ name: "kind",+ description: "The type of text track",+ type: "select",+ options: [+ "subtitles",+ "captions",+ "descriptions",+ "chapters",+ "metadata",+ ],+ },+ {+ name: "label",+ description: "User-visible label",+ type: "string",+ },+ {+ name: "src",+ description: "Address of the resource",+ type: "string",+ },+ {+ name: "srclang",+ description: "Language of the text track",+ type: "string",+ },+ ],+ video: [+ {+ name: "autoplay",+ description:+ "Hint that the media resource can be started automatically when the page is loaded",+ type: "boolean",+ },+ {+ name: "controls",+ description: "Show user agent controls",+ type: "boolean",+ },+ {+ name: "crossorigin",+ description: "How the element handles crossorigin requests",+ type: "select",+ options: ["anonymous", "use-credentials"],+ },+ {+ name: "height",+ description: "Vertical dimension",+ type: "number",+ },+ {+ name: "loop",+ description: "Whether to loop the media resource",+ type: "boolean",+ },+ {+ name: "muted",+ description: "Whether to mute the media resource by default",+ type: "boolean",+ },+ {+ name: "playsinline",+ description:+ "Encourage the user agent to display video content within the element's playback area",+ type: "boolean",+ },+ {+ name: "poster",+ description: "Poster frame to show prior to video playback",+ type: "string",+ },+ {+ name: "preload",+ description:+ "Hints how much buffering the media resource will likely need",+ type: "select",+ options: ["none", "metadata", "auto"],+ },+ {+ name: "src",+ description: "Address of the resource",+ type: "string",+ },+ {+ name: "width",+ description: "Horizontal dimension",+ type: "number",+ },+ ],+};diff --git a/packages/html-data/src/index.ts b/packages/html-data/src/index.tsindex a0aca455c0..a926ad6c76 100644--- a/packages/html-data/src/index.ts+++ b/packages/html-data/src/index.ts@@ -1,3 +1,4 @@export * from "./__generated__/content-model";export * from "./descriptions";export * from "./dom-attributes-react-mappings";+export * from "./__generated__/attributes";diff --git a/packages/react-sdk/src/standard-attributes.ts b/packages/react-sdk/src/standard-attributes.tsindex 447f153546..efe8a347b9 100644--- a/packages/react-sdk/src/standard-attributes.ts+++ b/packages/react-sdk/src/standard-attributes.ts@@ -506,4 +506,6 @@ export const standardAttributesToReactProps: Record<string, string> = {ychannelselector: "yChannelSelector",z: "z",zoomandpan: "zoomAndPan",+ // added by us+ dirname: "dirName",};diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex c5fcd294e4..7b3af34816 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -1534,9 +1534,21 @@ importers:packages/html-data:devDependencies:+ '@types/aria-query':+ specifier: ^5.0.4+ version: 5.0.4+ '@webstudio-is/react-sdk':+ specifier: workspace:*+ version: link:../react-sdk+ '@webstudio-is/sdk':+ specifier: workspace:*+ version: link:../sdk'@webstudio-is/tsconfig':specifier: workspace:*version: link:../tsconfig+ aria-query:+ specifier: ^5.3.2+ version: 5.3.2parse5:specifier: 7.2.1version: 7.2.1@@ -5543,6 +5555,10 @@ packages:resolution: {integrity: sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==}+ resolution: {integrity: sha512-COROpnaoap1E2F000S62r6A60uHZnmlvomhfyT2DlTcrY1OrBKn2UhH7qn5wTC9zMvD0AY7csdPSNwKP+7WiQw==}+ engines: {node: '>= 0.4'}+resolution: {integrity: sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==}@@ -12777,6 +12793,8 @@ snapshots:dependencies:dequal: 2.0.3+ [email protected]: {}+@@ -16455,7 +16473,7 @@ snapshots:'@jridgewell/sourcemap-codec': 1.5.0'@jridgewell/trace-mapping': 0.3.25acorn: 8.14.1- aria-query: 5.3.0+ aria-query: 5.3.2axobject-query: 3.2.1code-red: 1.0.4css-tree: 2.3.1(patch_hash=epgcmebti7rfrc2ej4odb3t4jy)