|
| 1 | +import { SplitsContentBoxContent, SplitsContentBoxProperties } from './content' |
| 2 | +import { NoteSeverity } from './lib' |
| 3 | +import { ITranslatableMessage } from './translations' |
| 4 | + |
| 5 | +export interface PopupPreview<P extends Previews = Previews> { |
| 6 | + name?: string |
| 7 | + preview?: P |
| 8 | + warnings?: InvalidPreview[] |
| 9 | +} |
| 10 | +export type Previews = TablePreview | ScriptPreview | HTMLPreview | SplitPreview | VTPreview | BlueprintImagePreview |
| 11 | + |
| 12 | +export enum PreviewType { |
| 13 | + Invalid = 'invalid', |
| 14 | + Table = 'table', |
| 15 | + Script = 'script', |
| 16 | + HTML = 'html', |
| 17 | + Split = 'split', |
| 18 | + VT = 'vt', |
| 19 | + BlueprintImage = 'blueprintImage', |
| 20 | +} |
| 21 | + |
| 22 | +interface PreviewBase { |
| 23 | + type: PreviewType |
| 24 | +} |
| 25 | + |
| 26 | +export interface InvalidPreview extends PreviewBase { |
| 27 | + type: PreviewType.Invalid |
| 28 | + |
| 29 | + severity: NoteSeverity |
| 30 | + reason: ITranslatableMessage |
| 31 | +} |
| 32 | +export interface TablePreview extends PreviewBase { |
| 33 | + type: PreviewType.Table |
| 34 | + |
| 35 | + entries: { key: string; value: string }[] |
| 36 | + displayTiming: boolean |
| 37 | +} |
| 38 | +export interface ScriptPreview extends PreviewBase { |
| 39 | + type: PreviewType.Script |
| 40 | + |
| 41 | + fullText?: string |
| 42 | + lastWords?: string |
| 43 | + comment?: string |
| 44 | + lastModified?: number |
| 45 | +} |
| 46 | +export interface HTMLPreview extends PreviewBase { |
| 47 | + // todo - expose if and how steps can be controlled |
| 48 | + type: PreviewType.HTML |
| 49 | + |
| 50 | + name?: string |
| 51 | + |
| 52 | + previewUrl: string |
| 53 | + previewDimension?: { width: number; height: number } |
| 54 | + |
| 55 | + postMessageOnLoad?: any |
| 56 | + |
| 57 | + steps?: { current: number; total: number } |
| 58 | +} |
| 59 | +export interface SplitPreview extends PreviewBase { |
| 60 | + type: PreviewType.Split |
| 61 | + |
| 62 | + background?: string // file asset upload? |
| 63 | + boxes: (SplitsContentBoxContent & SplitsContentBoxProperties)[] |
| 64 | +} |
| 65 | +export interface VTPreview extends PreviewBase { |
| 66 | + type: PreviewType.VT |
| 67 | + |
| 68 | + // note: the info required for the preview follows from package manager so there's nothing for blueprins here |
| 69 | + // note: if we want to allow a preview for different media than saved on the piece (because perhaps the media is in a non-primary piece) should we allow to specifiy the package to preview? |
| 70 | + |
| 71 | + inWords?: string // note - only displayed if outWords are present |
| 72 | + outWords?: string |
| 73 | +} |
| 74 | +export interface BlueprintImagePreview extends PreviewBase { |
| 75 | + type: PreviewType.BlueprintImage |
| 76 | + |
| 77 | + image: string // to be put in as asset |
| 78 | +} |
0 commit comments