@googleforcreators/media
Version:
Functionality for creating and working with media resources in the Web Stories editor.
73 lines • 2.28 kB
TypeScript
/**
* Internal dependencies
*/
import type { ResourceType } from './resourceType';
export interface Dimensions {
width: number;
height: number;
}
export interface AttributionAuthor {
/** Display name of the author. */
displayName: string;
/** The author's profile or website. */
url: string;
}
export interface Attribution {
/** The optional author of the media object. */
author?: AttributionAuthor;
/** The optional url to register the media usage. */
registerUsageUrl?: string;
}
export interface ResourceSize {
/** The MIME type of the resource. E.g. "image/png". */
mimeType: string;
/** The source URL of the resource. */
sourceUrl: string;
/** The natural width of the resource in physical pixels. */
width: number;
/** The natural height of the resource in physical pixels. */
height: number;
}
export type ResourceId = string | number;
/** A media resource. */
export interface Resource {
/**
* The resource ID.
* TODO: currently this value is local to the editor's media system.
*/
id: ResourceId;
/** The type of the resource. */
type: ResourceType;
/** The MIME type of the resource. E.g. "image/png". */
mimeType: string;
/** The source URL of the resource. */
src: string;
/** The "alt" text of the resource. */
alt: string;
/** The natural width of the resource in physical pixels. */
width: number;
/** The natural height of the resource in physical pixels. */
height: number;
/** The resource's average color. */
baseColor?: string;
/** BlurHash. */
blurHash?: string;
/** Whether the resource externally hosted. */
isExternal?: boolean;
/** Whether the resource is a placeholder. */
isPlaceholder?: boolean;
/** Whether the resource needs a CORS proxy. */
needsProxy?: boolean;
/** Resource creation date. */
readonly creationDate?: string;
/** Resource sizes */
sizes?: {
[key: string]: ResourceSize;
};
/** Resource author attribution */
attribution?: Attribution;
posterId?: ResourceId;
isOptimized?: boolean;
provider?: 'local' | 'unsplash' | 'coverr' | 'tenor' | 'tenor_stickers';
}
//# sourceMappingURL=resource.d.ts.map