import { Keyword , Token } from "@siteimprove/alfa-css" ; import { Parser } from "@siteimprove/alfa-parser" ; import { Result , Err } from "@siteimprove/alfa-result" ; import { Property } from "../property" ; import { List } from "./value/list" ; const { either } = Parser ; declare module "../property" { interface Longhands { "text-decoration-line" : Property < Specified , Computed > ; } } internal export type Specified = Keyword < "none" > | List < Keyword < "underline" > | Keyword < "overline" > | Keyword < "line-through" > | Keyword < "blink" > > ; internal export type Computed = Specified ; internal export const parse = either ( Keyword . parse ( "none" ) , ( input ) => { const keywords = [ ] ; while ( true ) { for ( const [ remainder ] of Token . parseWhitespace ( input ) ) { input = remainder ; } const result = Keyword . parse ( "underline" , "overline" , "line-through" , "blink" ) ( input ) ; if ( result . isOk ( ) ) { const [ remainder , value ] = result . get ( ) ; if ( keywords . every ( ( keyword ) => ! keyword . equals ( value ) ) ) { keywords . push ( value ) ; input = remainder ; continue ; } } break ; } if ( keywords . length === 0 ) { return Err . of ( `Expected one of underline, overline, line-through, or blink` ) ; } return Result . of ( [ input , List . of ( keywords ) ] ) ; } ) ; /**
 *  https internal export default Property . register ( "text-decoration-line" , Property . of < Specified , Computed > ( Keyword . of ( "none" ) , parse , ( textDecorationLine ) => textDecorationLine ) ) ;