UNPKG

@readium/shared

Version:

Shared models to be used across other Readium projects and implementations in Typescript

124 lines (123 loc) 4.52 kB
import { Links } from "./Link"; export interface Clip { audioResource: string; fragmentId?: string; start?: number; end?: number; } /** * Guided Navigation Document * https://readium.org/guided-navigation/schema/document.schema.json */ export declare class GuidedNavigationDocument { readonly links?: Links; readonly guided?: GuidedNavigationObject[]; constructor(values: { links?: Links; guided?: GuidedNavigationObject[]; }); static deserialize(json: any): GuidedNavigationDocument | undefined; serialize(): any; } /** * Represents a text value containing plain text, SSML, and language information. */ export declare class GuidedNavigationText { /** Plain text content */ readonly plain?: string; /** SSML (Speech Synthesis Markup Language) content */ readonly ssml?: string; /** * BCP 47 language tag * @pattern ^((?<grandfathered>(en-GB-oed|i-ami|i-bnn|i-default|i-enochian|i-hak|i-klingon|i-lux|i-mingo|i-navajo|i-pwn|i-tao|i-tay|i-tsu|sgn-BE-FR|sgn-BE-NL|sgn-CH-DE)|(art-lojban|cel-gaulish|no-bok|no-nyn|zh-guoyu|zh-hakka|zh-min|zh-min-nan|zh-xiang))|((?<language>([A-Za-z]{2,3}(-(?<extlang>[A-Za-z]{3}(-[A-Za-z]{3}){0,2}))?)|[A-Za-z]{4}|[A-Za-z]{5,8})(-(?<script>[A-Za-z]{4}))?(-(?<region>[A-Za-z]{2}|[0-9]{3}))?(-(?<variant>[A-Za-z0-9]{5,8}|[0-9][A-Za-z0-9]{3}))*(-(?<extension>[0-9A-WY-Za-wy-z](-[A-Za-z0-9]{2,8})+))*(-(?<privateUse>x(-[A-Za-z0-9]{1,8})+))?)|(?<privateUse2>x(-[A-Za-z0-9]{1,8})+))$ */ readonly language?: string; constructor(values: { plain?: string; ssml?: string; language?: string; }); /** * Deserializes a GuidedNavigationText from JSON */ static deserialize(json: any): GuidedNavigationText | undefined; /** * Serializes the text to a plain object */ serialize(): any; } /** * Guided Navigation Object * https://github.com/readium/guided-navigation/blob/main/schema/object.schema.json */ export declare class GuidedNavigationObject { /** References an audio resource or a fragment of it. */ readonly audioref?: string; /** Items that are children of the containing Guided Navigation Object. */ readonly children?: GuidedNavigationObject[]; /** References an image or a fragment of it. */ readonly imgref?: string; /** Convey the structural semantics of a publication. */ readonly role?: Set<string>; /** * Indicates the heading level (1-6) for the navigation object. * @minimum 1 * @maximum 6 */ readonly level?: number; /** * Textual equivalent of the resources or fragment of the resources referenced by the current Guided Navigation Object. */ readonly text?: GuidedNavigationText; /** References a textual resource or a fragment of it. */ readonly textref?: string; /** * Describes the image referenced by the current Guided Navigation Object. * This is a GuidedNavigationObject that should not contain 'level' or 'children' properties. */ readonly description?: Omit<GuidedNavigationObject, 'level' | 'children'>; /** * Creates a [GuidedNavigation] object. */ constructor(values: { audioref?: string; children?: GuidedNavigationObject[]; imgref?: string; role?: Set<string>; level?: number; text?: GuidedNavigationText; textref?: string; description?: Omit<GuidedNavigationObject, 'level' | 'children'>; }); /** * Gets the plain text content. * Returns undefined if no text is available. */ get plainText(): string | undefined; /** * Gets the SSML content if available. */ get ssmlText(): string | undefined; /** * Gets the language of the text if available. */ get textLanguage(): string | undefined; /** * Deserializes a GuidedNavigationObject from JSON */ static deserialize(json: any): GuidedNavigationObject | undefined; /** * Parses a [GuidedNavigationObject] array from its RWPM JSON representation. */ static deserializeArray(json: any): GuidedNavigationObject[] | undefined; /** * Serializes a [GuidedNavigationObject] to its RWPM JSON representation. */ serialize(): any; get audioFile(): string | undefined; get audioTime(): string | undefined; get textFile(): string | undefined; get fragmentId(): string | undefined; get clip(): Clip | undefined; private parseTimer; }