UNPKG

amphtml-validator-rules

Version:
303 lines (267 loc) 8.7 kB
export interface IndexD { attrLists: AttrList[]; scriptSpecUrl: string; tags: Tag[]; specFileRevision: number; errorSpecificity: ErrorSpecificity[]; stylesSpecUrl: string; templateSpecUrl: string; cssLengthSpec: CSSLengthSpec[]; minValidatorRevisionRequired: number; errorFormats: ErrorFormat[]; descendantTagList: DescendantTagList[]; } export interface AttrList { name: string; attrs: AttrListAttr[]; } export interface AttrListAttr { name: string; valueCasei?: string[]; blacklistedValueRegex?: string; valueUrl?: ValueURL; value?: string[]; mandatory?: boolean; alternativeNames?: string[]; cssDeclaration?: CSSDeclaration[]; enabledBy?: AbledBy[]; disabledBy?: AbledBy[]; trigger?: Trigger; requiresExtension?: RequiresExtension[]; valueRegexCasei?: string; requiresAncestor?: MarkDescendants; valueRegex?: string; } export interface CSSDeclaration { name: string; valueCasei?: string[]; } export enum AbledBy { Transformed = "transformed", } export interface MarkDescendants { marker: string[]; } export enum RequiresExtension { AmpFxCollection = "amp-fx-collection", AmpSubscriptions = "amp-subscriptions", AmpVideoDocking = "amp-video-docking", } export interface Trigger { alsoRequiresAttr: string[]; ifValueRegex?: string; } export interface ValueURL { allowEmpty?: boolean; protocol: string[]; allowRelative?: boolean; } export interface CSSLengthSpec { maxBytesPerInlineStyle: number; specUrl: string; htmlFormat: HTMLFormat; maxBytes: number; } export enum HTMLFormat { Actions = "ACTIONS", Amp = "AMP", Amp4Ads = "AMP4ADS", Amp4Email = "AMP4EMAIL", Experimental = "EXPERIMENTAL", } export interface DescendantTagList { tag: string[]; name: string; } export interface ErrorFormat { code: string; format: string; } export interface ErrorSpecificity { code: string; specificity: number; } export interface Tag { mandatoryParent?: string; mandatory?: boolean; explicitAttrsOnly?: boolean; htmlFormat: HTMLFormat[]; specUrl?: string; attrs?: TagAttr[]; tagName: string; specName?: string; unique?: boolean; disabledBy?: AbledBy[]; enabledBy?: AbledBy[]; attrLists?: string[]; disallowedAncestor?: string[]; satisfies?: string[]; namedId?: string; mandatoryAncestor?: string; cdata?: Cdata; mandatoryLastChild?: boolean; mandatoryAncestorSuggestedAlternative?: string; requiresExtension?: string[]; ampLayout?: AmpLayout; extensionSpec?: ExtensionSpec; excludes?: string[]; childTags?: ChildTags; requires?: string[]; alsoRequiresTagWarning?: string[]; referencePoints?: ReferencePoint[]; uniqueWarning?: boolean; markDescendants?: MarkDescendants; deprecation?: string; deprecationUrl?: string; descendantTagList?: string; siblingsDisallowed?: boolean; } export interface AmpLayout { supportedLayouts: SupportedLayout[]; definesDefaultHeight?: boolean; definesDefaultWidth?: boolean; } export enum SupportedLayout { Container = "CONTAINER", Fill = "FILL", Fixed = "FIXED", FixedHeight = "FIXED_HEIGHT", FlexItem = "FLEX_ITEM", Fluid = "FLUID", Intrinsic = "INTRINSIC", Nodisplay = "NODISPLAY", Responsive = "RESPONSIVE", } export interface TagAttr { mandatory?: boolean; name: string; value?: string[]; valueCasei?: string[]; blacklistedValueRegex?: string; valueUrl?: ValueURL; dispatchKey?: DispatchKey; valueRegex?: string; valueProperties?: ValueProperties; implicit?: boolean; alternativeNames?: string[]; mandatoryOneof?: string; deprecation?: string; deprecationUrl?: string; trigger?: Trigger; requiresExtension?: string[]; disabledBy?: AbledBy[]; cssDeclaration?: CSSDeclaration[]; valueRegexCasei?: string; mandatoryAnyof?: string; } export enum DispatchKey { NameDispatch = "NAME_DISPATCH", NameValueDispatch = "NAME_VALUE_DISPATCH", NameValueParentDispatch = "NAME_VALUE_PARENT_DISPATCH", } export interface ValueProperties { properties: Property[]; } export interface Property { mandatory?: boolean; name: string; value?: string; } export interface Cdata { maxBytesSpecUrl?: string; blacklistedCdataRegex?: BlacklistedCdataRegex[]; cssSpec?: CSSSpec; maxBytes?: number; urlBytesIncluded?: boolean; cdataRegex?: string; } export interface BlacklistedCdataRegex { regex: Regex; errorMessage: ErrorMessage; } export enum ErrorMessage { CSSIAmphtmlNamePrefix = "CSS i-amphtml- name prefix", CSSImportant = "CSS !important", Contents = "contents", HTMLComments = "html comments", } export enum Regex { Empty = "<!--", Regex = ".", SImportant = "!\\s*important", WIAmphtml = "(^|\\W)i-amphtml-", } export interface CSSSpec { fontUrlSpec?: URLSpec; atRuleSpec: AtRuleSpec[]; imageUrlSpec?: URLSpec; validateAmp4ads?: boolean; validateKeyframes?: boolean; declaration?: string[]; } export interface AtRuleSpec { type: Type; name: string; mediaQuerySpec?: MediaQuerySpec; } export interface MediaQuerySpec { type: string[]; feature: string[]; issuesAsError: boolean; } export enum Type { ParseAsDeclarations = "PARSE_AS_DECLARATIONS", ParseAsError = "PARSE_AS_ERROR", ParseAsRules = "PARSE_AS_RULES", } export interface URLSpec { allowEmpty?: boolean; protocol: Protocol[]; } export enum Protocol { Absolute = "absolute", Data = "data", HTTP = "http", HTTPS = "https", } export interface ChildTags { childTagNameOneof?: string[]; mandatoryNumChildTags?: number; firstChildTagNameOneof?: string[]; mandatoryMinNumChildTags?: number; } export interface ExtensionSpec { version: Version[]; name: string; requiresUsage?: RequiresUsage; deprecatedAllowDuplicates?: boolean; extensionType?: string; deprecatedVersion?: Version[]; } export enum Version { Latest = "latest", The01 = "0.1", The02 = "0.2", The10 = "1.0", } export enum RequiresUsage { Grandfathered = "GRANDFATHERED", None = "NONE", } export interface ReferencePoint { tagSpecName: string; unique?: boolean; mandatory?: boolean; } export const version: string; export const attrLists: IndexD['attrLists']; export const scriptSpecUrl: IndexD['scriptSpecUrl']; export const tags: IndexD['tags']; export const specFileRevision: IndexD['specFileRevision']; export const errorSpecificity: IndexD['errorSpecificity']; export const stylesSpecUrl: IndexD['stylesSpecUrl']; export const templateSpecUrl: IndexD['templateSpecUrl']; export const cssLengthSpec: IndexD['cssLengthSpec']; export const minValidatorRevisionRequired: IndexD['minValidatorRevisionRequired']; export const errorFormats: IndexD['errorFormats']; export const descendantTagList: IndexD['descendantTagList'];