1
+ import { SplitsContentBoxContent , SplitsContentBoxProperties } from './content'
1
2
import { NoteSeverity } from './lib'
3
+ import { ITranslatableMessage } from './translations'
2
4
3
- export type Previews =
4
- | InvalidPreview
5
- | TablePreview
6
- | ScriptPreview
7
- | HTMLPreview
8
- | SplitPreview
9
- | VTPreview
10
- | BlueprintImagePreview
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
11
12
12
export enum PreviewType {
13
13
Invalid = 'invalid' ,
@@ -24,18 +24,14 @@ interface PreviewBase {
24
24
}
25
25
26
26
export interface InvalidPreview extends PreviewBase {
27
- // todo - is this required or would we just pull this from the piece warning anyway
28
27
type : PreviewType . Invalid
29
28
30
29
severity : NoteSeverity
31
- reason : string // todo - translate
30
+ reason : ITranslatableMessage
32
31
}
33
32
export interface TablePreview extends PreviewBase {
34
- // todo - translations
35
33
type : PreviewType . Table
36
34
37
- heading : string
38
- subheading ?: string
39
35
entries : { key : string ; value : string } [ ]
40
36
}
41
37
export interface ScriptPreview extends PreviewBase {
@@ -47,31 +43,35 @@ export interface ScriptPreview extends PreviewBase {
47
43
lastModified ?: number
48
44
}
49
45
export interface HTMLPreview extends PreviewBase {
50
- // todo - steps and how to control them
46
+ // todo - expose if and how steps can be controlled
51
47
type : PreviewType . HTML
52
48
53
- previewUrl : string
49
+ name ? : string
54
50
51
+ previewUrl : string
55
52
previewDimension ?: { width : number ; height : number }
56
- hasSteps ?: boolean
57
53
58
54
postMessageOnLoad ?: any
55
+
56
+ steps ?: { current : number ; total : number }
59
57
}
60
58
export interface SplitPreview extends PreviewBase {
61
59
type : PreviewType . Split
62
60
63
61
background ?: string // file asset upload?
64
- boxes : any // todo
62
+ boxes : ( SplitsContentBoxContent & SplitsContentBoxProperties ) [ ]
65
63
}
66
64
export interface VTPreview extends PreviewBase {
67
65
type : PreviewType . VT
68
66
69
67
// note: the info required for the preview follows from package manager so there's nothing for blueprins here
70
68
// 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?
71
- // todo - turn this into a "PackagePreview"?
69
+
70
+ inWords ?: string // note - only displayed if outWords are present
71
+ outWords ?: string
72
72
}
73
73
export interface BlueprintImagePreview extends PreviewBase {
74
74
type : PreviewType . BlueprintImage
75
75
76
- image ? : string // to be put in as asset
76
+ image : string // to be put in as asset
77
77
}
0 commit comments