import { Diagnostic } from "@siteimprove/alfa-act" ; import { RGB } from "@siteimprove/alfa-css" ; import { Node } from "@siteimprove/alfa-dom" ; import { Option } from "@siteimprove/alfa-option" ; import * as act from "@siteimprove/alfa-act" ; public export namespace Question { /**
     * Maps the `type` parameter of questions to the expected type of the answer.
     */ interface Type { boolean : boolean ; node : Option < Node > ; "node[]" : Iterable < Node > ; "color[]" : Iterable < RGB > ; string : string ; } public export type Metadata = { [ K in Uri ] : [ Data [ K ] [ "type" ] , Type [ Data [ K ] [ "type" ] ] ] ; } ; type Data = typeof Data & Record < Uri , { readonly type : keyof Type ; readonly message : string ; } > ; type Uri = keyof typeof Data ; export function of < S , U extends Uri = Uri > ( uri , subject , diagnostic ? ) ; export function of < S , C , U extends Uri = Uri > ( uri , subject , context , diagnostic ? ) ; export function of < S , U extends Uri = Uri > ( uri , subject , contextOrDiagnostic ? , diagnostic ? ) { let context = subject ; if ( Diagnostic . isDiagnostic ( contextOrDiagnostic ) ) { diagnostic = contextOrDiagnostic ; } else { context = contextOrDiagnostic ?? subject ; diagnostic = diagnostic ?? Diagnostic . of ( Data [ uri ] . message ) ; } return act . Question . of ( Data [ uri ] . type , uri , diagnostic , subject , context ) ; } const Data = { "reference-equivalent-resources" : { type : "boolean" , message : `Do the [links/iframe] [resolve to/reference] equivalent resources?` , } , "has-audio" : { type : "boolean" , message : `Does the \`<video>\` element have audio?` , } , "has-audio-track" : { type : "boolean" , message : `Does the \`<video>\` element have an audio track that describes its visual information?` , } , "has-captions" : { type : "boolean" , message : `Does the \`<video>\` element have captions?` , } , "has-description" : { type : "boolean" , message : `Is the visual information of the [audio/video] available through its audio or a separate audio description track?` , } , "is-audio-streaming" : { type : "boolean" , message : `Is the \`<audio>\` element streaming?` , } , "is-playing" : { type : "boolean" , message : `Is the \`<audio>\` element currently playing?` , } , "is-video-streaming" : { type : "boolean" , message : `Is the \`<video>\` element streaming?` , } , label : { type : "node" , message : `Where is the text that labels the [audio/video] element as a video alternative?` , } , "play-button" : { type : "node" , message : `Where is the button that controls playback of the \`<audio>\` element?` , } , "text-alternative" : { type : "node" , message : `Where is the text alternative of the [audio/video] element?` , } , "track-describes-video" : { type : "boolean" , message : `Does at least 1 track describe the visual information of the \`<video>\` element, either in the language of the \`<video>\` element or the language of the page?` , } , transcript : { type : "node" , message : `Where is the transcript of the [audio/video] element?` , } , "transcript-link" : { type : "node" , message : `Where is the link pointing to the transcript of the [audio/video]
                  element?` , } , "transcript-perceivable" : { type : "boolean" , message : `Is the transcript of the [audio/video] element perceivable?` , } , "name-describes-purpose" : { type : "boolean" , message : `Does the accessible name of the \`<(target.name]>\` element describe its purpose?` , } , "audio-control-mechanism" : { type : "node" , message : `Where is the mechanism that can pause or stop the audio of the \`<[target.name]>\` element?` , } , "is-above-duration-threshold" : { type : "boolean" , message : `Does the \`<[element.name]>\` element have a duration of more than 3 seconds?` , } , "is-below-audio-duration-threshold" : { type : "boolean" , message : `Does the \`<[target.name]>\` element have a total audio duration of less than 3 seconds?` , } , "is-content-equivalent" : { type : "boolean" , message : `Do these [role] landmarks have the same or equivalent content?` , } , "has-focus-indicator" : { type : "boolean" , message : `Does the element have a visible focus indicator?` , } , "background-colors" : { type : "color[]" , message : "What are the background colors of the text node?" , } , "foreground-colors" : { type : "color[]" , message : "What are the foreground colors of the text node?" , } , "first-tabbable-is-internal-link" : { type : "boolean" , message : `Is the first tabbable element of the document an internal link?` , } , "first-tabbable-is-visible" : { type : "boolean" , message : `Is the first tabbable element of the document visible if it's focused?` , } , "first-tabbable-reference" : { type : "node" , message : `Where in the document does the first tabbable element point?` , } , "first-tabbable-reference-is-main" : { type : "boolean" , message : `Does the first tabbable element of the document point to the main content?` , } , "error-indicators" : { type : "node[]" , message : `Where are the error indicators, if any, for the form field?` , } , "error-indicator-describes-resolution" : { type : "boolean" , message : `Does the error indicator describe, in text, the cause of the error or how to resolve it?` , } , "error-indicator-identifies-form-field" : { type : "boolean" , message : "Does the error indicator identify, in text, the form field it relates to?" , } , "internal-reference" : { type : "node" , message : `Where in the document does this element point?` , } , "is-start-of-main" : { type : "boolean" , message : `Is this element at the start of the main content of the document?` , } , "is-visible-when-focused" : { type : "boolean" , message : `Is this element visible when it's focused?` , } , "document-language" : { type : "string" , message : "What is the main language of the document?" , } , } as const ; }