@readium/shared
Version:
Shared models to be used across other Readium projects and implementations in Typescript
128 lines (127 loc) • 4.43 kB
TypeScript
import { AltIdentifier } from './AltIdentifier';
import { BelongsTo } from './BelongsTo';
import { Contributors } from './Contributor';
import { Layout } from './Layout';
import { LocalizedString } from './LocalizedString';
import { Profile } from './Profiles';
import { ReadingProgression } from './ReadingProgression';
import { Subjects } from './Subject';
import { Accessibility } from './accessibility/Accessibility';
import { TDM } from './TDM';
/**
* https://readium.org/webpub-manifest/schema/metadata.schema.json
*
* readingProgression : This contains the reading progression as declared in the
* publication, so it might be [auto]. To lay out the content, use [effectiveReadingProgression]
* to get the calculated reading progression from the declared direction and the language.
* otherMetadata Additional metadata for extensions, as a JSON dictionary.
*/
export declare class Metadata {
title: LocalizedString;
typeUri?: string;
conformsTo?: Array<Profile>;
identifier?: string;
altIdentifier?: AltIdentifier;
subtitle?: LocalizedString;
sortAs?: LocalizedString;
artists?: Contributors;
authors?: Contributors;
colorists?: Contributors;
contributors?: Contributors;
editors?: Contributors;
illustrators?: Contributors;
inkers?: Contributors;
letterers?: Contributors;
narrators?: Contributors;
pencilers?: Contributors;
translators?: Contributors;
languages?: Array<string>;
description?: string;
publishers?: Contributors;
imprints?: Contributors;
published?: Date;
modified?: Date;
subjects?: Subjects;
belongsTo?: BelongsTo;
belongsToCollections?: Contributors;
belongsToSeries?: Contributors;
layout?: Layout;
readingProgression?: ReadingProgression;
duration?: number;
numberOfPages?: number;
accessibility?: Accessibility;
tdm?: TDM;
otherMetadata?: {
[key: string]: any;
};
/**All metadata not in otherMetadata */
private static readonly mappedProperties;
/** Creates [Metadata] object */
constructor(values: {
title: LocalizedString;
typeUri?: string;
conformsTo?: Array<Profile>;
identifier?: string;
altIdentifier?: AltIdentifier;
subtitle?: LocalizedString;
sortAs?: LocalizedString;
artists?: Contributors;
authors?: Contributors;
colorists?: Contributors;
contributors?: Contributors;
editors?: Contributors;
illustrators?: Contributors;
inkers?: Contributors;
letterers?: Contributors;
narrators?: Contributors;
pencilers?: Contributors;
translators?: Contributors;
languages?: Array<string>;
description?: string;
publishers?: Contributors;
imprints?: Contributors;
published?: Date;
modified?: Date;
subjects?: Subjects;
belongsTo?: BelongsTo;
belongsToCollections?: Contributors;
belongsToSeries?: Contributors;
layout?: Layout;
readingProgression?: ReadingProgression;
duration?: number;
numberOfPages?: number;
accessibility?: Accessibility;
tdm?: TDM;
otherMetadata?: {
[key: string]: any;
};
});
/**
* Parses a [Metadata] from its RWPM JSON representation.
*
* If the metadata can't be parsed, a warning will be logged with [warnings].
*/
static deserialize(json: any): Metadata | undefined;
/**
* Serializes a [Metadata] to its RWPM JSON representation.
*/
serialize(): any;
/**
* Computes a [Layout] using the [conformsTo] profile and layout property.
*
* Special cases:
* - EPUB profile defaults to reflowable if layout is not present
* - Divina profile defaults to fixed if layout is not present
* - Layout is ignored for audiobook and PDF profiles
* - Layout is ignored if set to reflowable on a Divina profile
*
* Note: Stops at the first matching profile.
*/
get effectiveLayout(): Layout | null;
/**
* Computes a [ReadingProgression] when the value of [readingProgression] is undefined, using the publication language.
*
* See this issue for more details: https://github.com/readium/architecture/issues/113
*/
get effectiveReadingProgression(): ReadingProgression;
}