@adobe/ccweb-add-on-sdk-types 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,9 +1,18 @@
1
1
  {
2
2
  "name": "@adobe/ccweb-add-on-sdk-types",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "author": "Adobe",
5
5
  "license": "MIT",
6
6
  "description": "Type definitions for Adobe Creative Cloud Web Add-on SDK.",
7
+ "keywords": [
8
+ "adobe",
9
+ "creative cloud web",
10
+ "express",
11
+ "add-on",
12
+ "typescript",
13
+ "sdk",
14
+ "typings"
15
+ ],
7
16
  "main": "",
8
17
  "types": "index.d.ts",
9
18
  "repository": {
@@ -183,8 +183,7 @@ export declare class Runtime {
183
183
  * Exposes the concrete object/function of type T,
184
184
  * which can be accessed into different runtime part of this AddOn e.g., "panel" (iframe) runtime.
185
185
  * Note that only concrete objects / class instances are supported. We can't expose entire class
186
- * from one runtime and create instance of that class in another runtime. Trying to do
187
- * so may result in undefined behaviour.
186
+ * from one runtime and create instance of that class in another runtime. Trying to do so will throw an exception.
188
187
  * @param obj - the concrete object to expose to other runtimes
189
188
  * Note: This method call is allowed only once. Subsequent calls are ignored.
190
189
  */
@@ -30,20 +30,8 @@ declare namespace ApiConstants {
30
30
 
31
31
  declare interface ApiModuleExport {
32
32
  editor: ExpressEditor;
33
- utils: ApiUtils;
34
33
  constants: unknown;
35
- }
36
-
37
- declare interface ApiUtils {
38
- /**
39
- * Create a new Color. All color components should be in a 0 - 1 range.
40
- *
41
- * @param red - The red component in a range from 0 - 1.
42
- * @param green - The green component in a range from 0 - 1.
43
- * @param blue - The blue component in a range from 0 - 1.
44
- * @param alpha - (optional) The alpha component in a range from 0 - 1. Defaults to 1 (fully opaque).
45
- */
46
- createColor(red: number, green: number, blue: number, alpha?: number): Color;
34
+ colorUtils: ExpressColorUtils;
47
35
  }
48
36
 
49
37
  /**
@@ -82,7 +70,20 @@ export declare class ArtboardList extends RestrictedItemList<ArtboardNode> {
82
70
  *
83
71
  * When multiple artboards exist on a page, the artboards represent "scenes" in a linear timeline sequence.
84
72
  */
85
- export declare class ArtboardNode extends ContainerNode implements IRectangularNode, IStrokableNode {
73
+ export declare class ArtboardNode extends BaseNode implements IRectangularNode, ContainerNode {
74
+ /**
75
+ * Returns a read-only list of all children of the node. General-purpose content containers such as ArtboardNode or
76
+ * GroupNode also provide a mutable {@link ContainerNode.children} list. Other nodes with a more specific structure can
77
+ * hold children in various discrete "slots"; this `allChildren` list includes *all* such children and reflects their
78
+ * overall display z-order.
79
+ *
80
+ * The children of an Artboard are always other Node classes (never the more minimal BaseNode).
81
+ */
82
+ get allChildren(): Readonly<Iterable<Node>>;
83
+ /**
84
+ * The node's children. Use the methods on this ItemList object to get, add, and remove children.
85
+ */
86
+ get children(): ItemList<Node>;
86
87
  /**
87
88
  * The node's parent. Undefined if the node is an orphan.
88
89
  */
@@ -96,14 +97,44 @@ export declare class ArtboardNode extends ContainerNode implements IRectangularN
96
97
  */
97
98
  get height(): number;
98
99
  /**
99
- * The background fill of the artboard.
100
+ * The background fill of the artboard. Artboards must always have a fill.
100
101
  */
101
- get fill(): Fill;
102
+ get fill(): Readonly<Fill>;
102
103
  set fill(fill: Fill);
104
+ }
105
+
106
+ /**
107
+ * A "node" represents an object in the scenegraph, the document's visual content tree. This base class includes only the
108
+ * most fundamental nonvisual properties that even nodes near the top of the document structure share (such as PageNode).
109
+ * The more tangible visual content typically extends the richer Node class which extends BaseNode with additional
110
+ * properties.
111
+ */
112
+ export declare class BaseNode {
103
113
  /**
104
- * Any strokes(s) on the shape. Use the methods on this ItemList object to get, add, and remove strokes.
114
+ * Returns a read-only list of all children of the node. General-purpose content containers such as ArtboardNode or
115
+ * GroupNode also provide a mutable {@link ContainerNode.children} list. Other nodes with a more specific structure can
116
+ * hold children in various discrete "slots"; this `allChildren` list includes *all* such children and reflects their
117
+ * overall display z-order.
118
+ *
119
+ * Although BaseNode's allChildren may yield other BaseNodes, the subclasses Node and ArtboardNode override allChildren
120
+ * to guarantee all their children are full-fledged Node instances.
121
+ */
122
+ get allChildren(): Readonly<Iterable<BaseNode>>;
123
+
124
+ /**
125
+ * The node's type.
126
+ */
127
+ get type(): SceneNodeType;
128
+ /**
129
+ * The node's parent. Undefined if the node is an orphan, or if the node is the artwork root.
105
130
  */
106
- get strokes(): ItemList<Stroke>;
131
+ get parent(): BaseNode | undefined;
132
+ /**
133
+ * Removes the node from its parent - for a basic ContainerNode, this is equivalent to `node.parent.children.remove(node)`.
134
+ * For nodes with other slots, removes the child from whichever slot it resides in, if possible. Throws if the slot does
135
+ * not support removal. Also throws if node is the artwork root. No-op if node is already an orphan.
136
+ */
137
+ removeFromParent(): void;
107
138
  }
108
139
 
109
140
  /**
@@ -166,33 +197,25 @@ declare enum BlendMode {
166
197
  }
167
198
 
168
199
  /**
169
- * Represents a color in a defined RGB colorspace. Value is immutable – to change, create a new Color object.
200
+ * Represents an RGBA color.
170
201
  */
171
- export declare class Color {
202
+ export declare interface Color {
172
203
  /**
173
204
  * The red channel in range from 0 - 1.
174
205
  */
175
- get red(): number;
206
+ red: number;
176
207
  /**
177
208
  * The green channel in range from 0 - 1.
178
209
  */
179
- get green(): number;
210
+ green: number;
180
211
  /**
181
212
  * The blue channel in range from 0 - 1.
182
213
  */
183
- get blue(): number;
214
+ blue: number;
184
215
  /**
185
216
  * The alpha channel in range from 0 - 1.
186
217
  */
187
- get alpha(): number;
188
- /**
189
- * This color's color space. Currently only sRGB is supported.
190
- */
191
- get colorSpace(): ColorSpace;
192
- /**
193
- * Get the color in 8-digit hex "#RRGGBBAA" format.
194
- */
195
- getHex(): string;
218
+ alpha: number;
196
219
  }
197
220
 
198
221
  /**
@@ -206,16 +229,44 @@ export declare interface ColorFill extends Fill {
206
229
  /**
207
230
  * The fill color.
208
231
  */
209
- readonly color: Color;
232
+ color: Color;
210
233
  }
211
234
 
212
235
  /**
213
- * Available color spaces. Currently only sRGB is supported.
236
+ * Utility methods for working with color values.
214
237
  */
215
- export declare enum ColorSpace {
216
- sRGB = "sRGB"
238
+ export declare class ColorUtils {
239
+ /**
240
+ * Create a new Color. All color components should be in a 0 - 1 range.
241
+ *
242
+ * @param redOrPartialColor - The red component in a range from 0 - 1; or Partial Color object having alpha component as partial.
243
+ * @param green - The green component in a range from 0 - 1.
244
+ * @param blue - The blue component in a range from 0 - 1.
245
+ * @param alpha - (optional) The alpha component in a range from 0 - 1. Defaults to 1 (fully opaque).
246
+ */
247
+ fromRGB(red: number, green: number, blue: number, alpha?: number): Color;
248
+ fromRGB(color: { red: number; green: number; blue: number; alpha?: number }): Color;
249
+ /**
250
+ * Create a new color from its equivalent RGBA hex representation. Currently only
251
+ * supports formats "#RRGGBBAA" or "RRGGBBAA". If the hex value is invalid, this
252
+ * method will return transparent black.
253
+ *
254
+ * @param hex - The color in hex representation.
255
+ * @returns A new color matching the given hex representation, or transparent black if
256
+ * the hex string cannot be parsed.
257
+ */
258
+ fromHex(hex: string): Color;
259
+ /**
260
+ * Get the color in 8-digit hex "#RRGGBBAA" format.
261
+ * @privateRemarks
262
+ * Future: Since this format is only valid for the sRGB color space, if the color is in another color space once other
263
+ * spaces are supported, the value return here would be a lossy conversion.
264
+ */
265
+ toHex(color: Color): string;
217
266
  }
218
267
 
268
+ export declare const colorUtils: ExpressColorUtils;
269
+
219
270
  /**
220
271
  * A ComplexShapeNode is complex prepackaged shape that appears as a leaf node in the UI, even if it is composed
221
272
  * of multiple separate paths.
@@ -225,11 +276,14 @@ export declare class ComplexShapeNode extends FillableNode {}
225
276
  export declare const constants: typeof ApiConstants;
226
277
 
227
278
  /**
228
- * Base class for a Node that contains an entirely generic collection of children. Some ContainerNode subclasses may host
279
+ * Interface for any node that contains an entirely generic collection of children. Some ContainerNode classes may host
229
280
  * *additional* children in other specific "slots," such as background or mask layers; and non-ContainerNode classes may
230
281
  * also hold children in specified "slots." Use {@link Node.allChildren} for read access to children regardless of node type.
282
+ *
283
+ * Some ContainerNode classes may be full-fledged Node subclasses (such as Group), while others may be a subclass of the
284
+ * more minimal BaseNode (such as Artboard).
231
285
  */
232
- export declare class ContainerNode extends Node {
286
+ export declare interface ContainerNode extends BaseNode {
233
287
  /**
234
288
  * The node's children. Use the methods on this ItemList object to get, add, and remove children.
235
289
  */
@@ -280,12 +334,12 @@ export declare class Editor {
280
334
  */
281
335
  get documentRoot(): ExpressRootNode;
282
336
  /**
283
- * @returns an ellipse node with default x/y radii, and *no* initial stroke or fill.
337
+ * @returns an ellipse node with default x/y radii, a black fill, and no initial stroke.
284
338
  * Transform values default to 0.
285
339
  */
286
340
  createEllipse(): EllipseNode;
287
341
  /**
288
- * @returns a rectangle node with default width and height, and *no* initial stroke or fill.
342
+ * @returns a rectangle node with default width and height, a black fill, and no initial stroke.
289
343
  * Transform values default to 0.
290
344
  */
291
345
  createRectangle(): RectangleNode;
@@ -299,10 +353,10 @@ export declare class Editor {
299
353
  */
300
354
  createGroup(): GroupNode;
301
355
  /**
356
+ * Convenience helper to create a complete ColorFill value given just its color.
302
357
  * @param color - The color to use for the fill.
303
- * @returns a solid color fill.
304
358
  */
305
- createColorFill(color: Color): ColorFill;
359
+ makeColorFill(color: Color): ColorFill;
306
360
  /**
307
361
  * Creates a bitmap image, represented as a multi-node MediaContainerNode structure. Always creates a "full-frame,"
308
362
  * uncropped image initially, but cropping can be changed after it is created by modifying the properties of the
@@ -337,20 +391,20 @@ export declare class Editor {
337
391
  */
338
392
  loadBitmapImage(bitmapData: Blob): Promise<BitmapImage>;
339
393
  /**
340
- * See {@link StrokeOptions} for more details on the `options` fields. Defaults:
394
+ * Convenience helper to create a complete Stroke value given just a subset of its fields. All other fields are
395
+ * populated with default values.
396
+ *
397
+ * See {@link Stroke} for more details on the `options` fields. Defaults:
341
398
  * - `color` has default value {@link DEFAULT_STROKE_COLOR} if none is provided.
342
399
  * - `width` has default value {@link DEFAULT_STROKE_WIDTH} if none is provided.
343
- * - `dashPattern` has default value [] if none is provided. Array must be
344
- * of even length. Values cannot be negative.
345
- * - `dashOffset` has default value 0 if none is provided. This options field is ignored
400
+ * - `position` has default value `center` if none is provided.
401
+ * - `dashPattern` has default value [] if none is provided.
402
+ * - `dashOffset` has default value 0 if none is provided. This field is ignored
346
403
  * if no `dashPattern` was provided.
347
404
  *
348
- * The stroke's `position` field cannot be specified via options yet because only
349
- * {@link StrokePosition.center} is supported.
350
- *
351
405
  * @returns a stroke configured with the given options.
352
406
  */
353
- createStroke(options?: Partial<StrokeOptions>): Stroke;
407
+ makeStroke(options?: Partial<Stroke>): Stroke;
354
408
  /**
355
409
  * @returns a text node with default styles. The text content is initially empty, so the text node will be
356
410
  * invisible until its `text` property is set. Creates point text, so the node's width will automatically
@@ -424,12 +478,14 @@ export declare class EllipseNode extends FillableNode {
424
478
  declare const expressApiModule: ApiModuleExport;
425
479
  export default expressApiModule;
426
480
 
481
+ declare class ExpressColorUtils extends ColorUtils {}
482
+
427
483
  declare class ExpressEditor extends Editor {}
428
484
 
429
485
  /**
430
486
  * An ExpressRootNode represents the root node of the document's "scenegraph" artwork tree.
431
487
  */
432
- export declare class ExpressRootNode extends Node {
488
+ export declare class ExpressRootNode extends BaseNode {
433
489
  /**
434
490
  * The pages of the document. All visual content is contained on artboards within the pages.
435
491
  */
@@ -451,9 +507,10 @@ export declare interface Fill {
451
507
  */
452
508
  export declare class FillableNode extends StrokableNode implements IFillableNode {
453
509
  /**
454
- * Any fill(s) on the shape. Use the methods on this ItemList object to get, add, and remove fills.
510
+ * The fill applied to the shape, if any.
455
511
  */
456
- get fills(): ItemList<Fill>;
512
+ get fill(): Readonly<Fill> | undefined;
513
+ set fill(fill: Fill | undefined);
457
514
  }
458
515
 
459
516
  /**
@@ -494,7 +551,7 @@ export declare class GridLayoutNode extends Node implements IRectangularNode {
494
551
  /**
495
552
  * The background fill of the GridLayout.
496
553
  */
497
- get fill(): Fill;
554
+ get fill(): Readonly<Fill>;
498
555
  set fill(fill: Fill);
499
556
  }
500
557
 
@@ -502,7 +559,7 @@ export declare class GridLayoutNode extends Node implements IRectangularNode {
502
559
  * A GroupNode represents a Group object in the scenegraph, which has a collection of generic children as well as a separate,
503
560
  * optional vector mask child.
504
561
  */
505
- export declare class GroupNode extends ContainerNode {
562
+ export declare class GroupNode extends Node implements ContainerNode {
506
563
  /**
507
564
  * The Group's regular children. Does not include the maskShape if one is present.
508
565
  * Use the methods on this ItemList object to get, add, and remove children.
@@ -523,11 +580,11 @@ export declare class GroupNode extends ContainerNode {
523
580
  }
524
581
 
525
582
  /**
526
- * Interface for {@link FillableNode} *and* any other nodes with a similar `fills` API that do not directly inherit from the
527
- * FillableNode class.
583
+ * Interface for {@link FillableNode} *and* any other nodes with a similar `fill` property that do not directly inherit from
584
+ * the FillableNode class.
528
585
  */
529
586
  declare interface IFillableNode {
530
- fills: ItemList<Fill>;
587
+ fill: Fill | undefined;
531
588
  }
532
589
 
533
590
  /**
@@ -559,11 +616,11 @@ declare interface IRectangularNode {
559
616
  }
560
617
 
561
618
  /**
562
- * Interface for {@link StrokableNode} *and* any other nodes with a similar `strokes` API that do not directly inherit from
563
- * the StrokableNode class. (See {@link ArtboardNode}, for example).
619
+ * Interface for {@link StrokableNode} *and* any other nodes with a similar `stroke` property that do not directly inherit
620
+ * from the StrokableNode class. (See {@link ArtboardNode}, for example).
564
621
  */
565
622
  declare interface IStrokableNode {
566
- strokes: ItemList<Stroke>;
623
+ stroke: Stroke | undefined;
567
624
  }
568
625
 
569
626
  /**
@@ -640,31 +697,23 @@ export declare class LineNode extends StrokableNode {
640
697
  */
641
698
  get endY(): number;
642
699
  /**
643
- * The shape encapsulating the start of a line. The size and color of the arrowhead
644
- * depends on the first available stroke's weight and color assigned to the node.
645
- * Removal of all strokes on this line leads to the arrowhead's removal.
700
+ * The shape encapsulating the start of a line.
646
701
  *
647
- * The getter returns {@link ArrowHeadType.none} when there are no strokes on the line
648
- * or no arrowhead on the first stroke of the line.
702
+ * Returns {@link ArrowHeadType.none} if there is no stroke on the line.
649
703
  */
650
704
  get startArrowHeadType(): ArrowHeadType;
651
705
  /**
652
- * The setter creates a default stroke for the line when there are no strokes on the line,
653
- * and updates the arrowhead on only the first stroke of the line.
706
+ * The setter sets a default stroke on the line if it did not have one.
654
707
  */
655
708
  set startArrowHeadType(type: ArrowHeadType);
656
709
  /**
657
- * The shape encapsulating the end of a line. The size and color of the arrowhead
658
- * depends on the first available stroke's weight and color assigned to the node.
659
- * Removal of all strokes on this line leads to the arrowhead's removal.
710
+ * The shape encapsulating the end of a line.
660
711
  *
661
- * The getter returns {@link ArrowHeadType.none} when there are no strokes on the line
662
- * or no arrowhead on the first stroke of the line.
712
+ * Returns {@link ArrowHeadType.none} if there is no stroke on the line.
663
713
  */
664
714
  get endArrowHeadType(): ArrowHeadType;
665
715
  /**
666
- * The setter creates a default stroke for the line when there are no strokes on the line,
667
- * and updates the arrowhead on only the first stroke of the line.
716
+ * The setter sets a default stroke on the line if it did not have one.
668
717
  */
669
718
  set endArrowHeadType(type: ArrowHeadType);
670
719
  }
@@ -696,21 +745,21 @@ export declare class MediaContainerNode extends Node {
696
745
  }
697
746
 
698
747
  /**
699
- * A Node represents an object in the scenegraph, the document's visual content tree.
748
+ * A Node represents an object in the scenegraph, the document's visual content tree. Most tangible visual content is a
749
+ * subclass of Node, but note that some abstract top-level structural nodes (such as PageNode) only extend the more minimal
750
+ * BaseNode. As a general rule, if you can click or drag an object with the select/move tool in the UI, then it extends
751
+ * from Node.
700
752
  */
701
- declare class Node {
753
+ declare class Node extends BaseNode {
702
754
  /**
703
755
  * Returns a read-only list of all children of the node. General-purpose content containers such as ArtboardNode or
704
756
  * GroupNode also provide a mutable {@link ContainerNode.children} list. Other nodes with a more specific structure can
705
757
  * hold children in various discrete "slots"; this `allChildren` list includes *all* such children and reflects their
706
758
  * overall display z-order.
759
+ *
760
+ * The children of a Node are always other Node classes (never the more minimal BaseNode).
707
761
  */
708
762
  get allChildren(): Readonly<Iterable<Node>>;
709
-
710
- /**
711
- * The node's type.
712
- */
713
- get type(): SceneNodeType;
714
763
  /**
715
764
  * The translation of the node along its parent's axes. This is identical to the translation component of
716
765
  * `transformMatrix`. It is often simpler to set a node's position using `setPositionInParent` than by
@@ -760,16 +809,6 @@ declare class Node {
760
809
  * cumulative rotation from the node's parent containers.
761
810
  */
762
811
  get rotationInScreen(): number;
763
- /**
764
- * The node's parent. Undefined if the node is an orphan, or if the node is the artwork root.
765
- */
766
- get parent(): Node | undefined;
767
- /**
768
- * Removes the node from its parent - for a basic ContainerNode, this is equivalent to `node.parent.children.remove(node)`.
769
- * For nodes with other slots, removes the child from whichever slot it resides in, if possible. Throws if the slot does
770
- * not support removal. Also throws if node is the artwork root. No-op if node is already an orphan.
771
- */
772
- removeFromParent(): void;
773
812
  /**
774
813
  * The node's opacity, from 0.0 to 1.0
775
814
  */
@@ -816,7 +855,7 @@ export declare class PageList extends RestrictedItemList<PageNode> {
816
855
  * A PageNode represents a page in the document. A page contains one or more artboards, representing "scenes" in a linear
817
856
  * timeline sequence. Those artboards in turn contain all the visual content of the document.
818
857
  */
819
- export declare class PageNode extends Node implements Readonly<IRectangularNode> {
858
+ export declare class PageNode extends BaseNode implements Readonly<IRectangularNode> {
820
859
  /**
821
860
  * The artboards or "scenes" of a page, ordered by timeline sequence.
822
861
  */
@@ -1048,7 +1087,7 @@ export declare class SolidColorShapeNode extends Node {
1048
1087
  /**
1049
1088
  * The color of the single color shape.
1050
1089
  */
1051
- get color(): Color | undefined;
1090
+ get color(): Readonly<Color> | undefined;
1052
1091
  set color(color: Color | undefined);
1053
1092
  }
1054
1093
 
@@ -1057,43 +1096,39 @@ export declare class SolidColorShapeNode extends Node {
1057
1096
  */
1058
1097
  export declare class StrokableNode extends Node implements IStrokableNode {
1059
1098
  /**
1060
- * Any stroke(s) on the shape. Use the methods on this ItemList object to get, add, and remove strokes.
1099
+ * The stroke applied to the shape, if any.
1061
1100
  */
1062
- get strokes(): ItemList<Stroke>;
1101
+ get stroke(): Readonly<Stroke> | undefined;
1102
+ set stroke(stroke: Stroke | undefined);
1063
1103
  }
1064
1104
 
1065
1105
  /**
1066
1106
  * Represents a stroke in the scenegraph. See {@link StrokableNode}.
1067
1107
  */
1068
- export declare interface Stroke extends StrokeOptions {
1069
- /**
1070
- * The position of the stroke relative to the outline of the shape.
1071
- */
1072
- readonly position: StrokePosition;
1073
- }
1074
-
1075
- /**
1076
- * Properties that can be provided to create a stroke.
1077
- */
1078
- export declare interface StrokeOptions {
1108
+ export declare interface Stroke {
1079
1109
  /**
1080
1110
  * The color of a stroke.
1081
1111
  */
1082
- readonly color: Color;
1112
+ color: Color;
1083
1113
  /**
1084
1114
  * The thickness of a stroke. Must be from {@link MIN_STROKE_WIDTH} to {@link MAX_STROKE_WIDTH}.
1085
1115
  */
1086
- readonly width: number;
1116
+ width: number;
1087
1117
  /**
1088
1118
  * If empty, this is a solid stroke.
1089
1119
  * If non-empty, the values alternate between length of a rendered and blank segment,
1090
1120
  * repeated along the length of the stroke. The first value represents the first solid segment.
1121
+ * Array must be of even length. Values cannot be negative.
1091
1122
  */
1092
- readonly dashPattern: number[];
1123
+ dashPattern: number[];
1093
1124
  /**
1094
1125
  * Number of pixels the beginning of dash pattern should be offset along the stroke.
1095
1126
  */
1096
- readonly dashOffset: number;
1127
+ dashOffset: number;
1128
+ /**
1129
+ * The position of the stroke relative to the outline of the shape.
1130
+ */
1131
+ position: StrokePosition;
1097
1132
  }
1098
1133
 
1099
1134
  /**
@@ -1112,13 +1147,7 @@ declare enum StrokePosition {
1112
1147
  * A StrokeShapeNode is prepackaged shape that has a single stroke property and appears as a leaf node in the UI, even
1113
1148
  * if it is composed of multiple separate paths.
1114
1149
  */
1115
- export declare class StrokeShapeNode extends Node {
1116
- /**
1117
- * Stroke on the shape.
1118
- */
1119
- get stroke(): Stroke | undefined;
1120
- set stroke(stroke: Stroke | undefined);
1121
- }
1150
+ export declare class StrokeShapeNode extends StrokableNode {}
1122
1151
 
1123
1152
  /**
1124
1153
  * <InlineAlert slots="text" variant="warning"/>
@@ -1151,6 +1180,4 @@ export declare class TextNode extends Node {
1151
1180
  */
1152
1181
  export declare class UnknownNode extends Node {}
1153
1182
 
1154
- export declare const utils: ApiUtils;
1155
-
1156
1183
  export {};
package/ui/ui-sdk.d.ts CHANGED
@@ -219,6 +219,13 @@ declare interface ApplicationBase {
219
219
  showModalDialog(dialogOptions: AlertDialogOptions): Promise<AlertDialogResult>;
220
220
  showModalDialog(dialogOptions: InputDialogOptions): Promise<InputDialogResult>;
221
221
  showModalDialog(dialogOptions: CustomDialogOptions): Promise<CustomDialogResult>;
222
+
223
+ /**
224
+ * @experimental - Experimental API
225
+ * Triggers/Starts the in-app monetization upgrade flow
226
+ * @returns if the user is premium user or not
227
+ */
228
+ startPremiumUpgradeIfFreeUser(): Promise<boolean>;
222
229
  }
223
230
 
224
231
  /**
@@ -344,6 +351,36 @@ export declare type AuthorizeWithOwnRedirectRequest = AuthorizationRequest & {
344
351
  state: string;
345
352
  };
346
353
 
354
+ /**
355
+ * Bleed for the page.
356
+ * In printing, bleed is printing that goes beyond the edge of where the sheet will be trimmed.
357
+ * In other words, the bleed is the area to be trimmed off.
358
+ */
359
+ export declare interface Bleed {
360
+ /**
361
+ * The amount for the bleed
362
+ */
363
+ amount: number;
364
+ /**
365
+ * The unit in which the bleed amount is expressed
366
+ */
367
+ unit: BleedUnit;
368
+ }
369
+
370
+ /**
371
+ * Units for the page bleed.
372
+ */
373
+ export declare enum BleedUnit {
374
+ /**
375
+ * Inch
376
+ */
377
+ Inch = "in",
378
+ /**
379
+ * Millimeter
380
+ */
381
+ Millimeter = "mm"
382
+ }
383
+
347
384
  export declare interface ButtonLabels {
348
385
  /**
349
386
  * Primary action label
@@ -424,6 +461,7 @@ declare namespace Constants {
424
461
  DialogResultType,
425
462
  ButtonType,
426
463
  RuntimeType,
464
+ BleedUnit,
427
465
  AuthorizationStatus
428
466
  };
429
467
  }
@@ -437,6 +475,12 @@ export declare interface CurrentUser {
437
475
  * Get user Id
438
476
  */
439
477
  userId(): Promise<string>;
478
+
479
+ /**
480
+ * @experimental - Experimental API
481
+ * @returns if the current user is a premium user
482
+ */
483
+ isPremiumUser(): Promise<boolean>;
440
484
  }
441
485
 
442
486
  /**
@@ -562,6 +606,11 @@ declare interface Document_2 {
562
606
  * Create renditions
563
607
  */
564
608
  createRenditions(renditionOptions: RenditionOptions, renditionIntent?: RenditionIntent): Promise<Rendition[]>;
609
+ /**
610
+ * @experimental - Experimental API
611
+ * Get metadata of all or range of pages of the document
612
+ */
613
+ getPagesMetadata(options: PageMetadataOptions): Promise<PageMetadata[]>;
565
614
  /**
566
615
  * Get document id
567
616
  */
@@ -792,6 +841,57 @@ export declare interface OAuth {
792
841
  authorizeWithOwnRedirect(request: AuthorizeWithOwnRedirectRequest): Promise<AuthorizationResult>;
793
842
  }
794
843
 
844
+ /**
845
+ * Represents the metadata of the Page
846
+ */
847
+ export declare interface PageMetadata {
848
+ /**
849
+ * Unique id that represent the given page
850
+ */
851
+ id: string;
852
+ /**
853
+ * Page title
854
+ */
855
+ title: string;
856
+ /**
857
+ * Page size in pixels
858
+ */
859
+ size: {
860
+ width: number;
861
+ height: number;
862
+ };
863
+ /**
864
+ * Whether page contains any premium content
865
+ */
866
+ hasPremiumContent: boolean;
867
+ /**
868
+ * Whether page contains timelines
869
+ */
870
+ hasTemporalContent: boolean;
871
+ /**
872
+ * Pixels per inch of the page
873
+ */
874
+ pixelsPerInch?: number;
875
+ /**
876
+ * Whether page is ready to print
877
+ */
878
+ isPrintReady?: boolean;
879
+ }
880
+
881
+ /**
882
+ * Options for fetching page metadata
883
+ */
884
+ export declare interface PageMetadataOptions {
885
+ /**
886
+ * Page range of the document to get the metadata
887
+ */
888
+ range: Range_2;
889
+ /**
890
+ * Ids of the pages (Only required if the range is "specificPages")
891
+ */
892
+ pageIds?: string[];
893
+ }
894
+
795
895
  export declare interface PageRendition extends Rendition {
796
896
  /**
797
897
  * Page rendition type
@@ -801,6 +901,21 @@ export declare interface PageRendition extends Rendition {
801
901
  * Page title
802
902
  */
803
903
  title: string;
904
+ /**
905
+ * Page metadata
906
+ */
907
+ metadata: PageMetadata;
908
+ }
909
+
910
+ export declare interface PdfRenditionOptions extends RenditionOptions {
911
+ /**
912
+ * PDF rendition format
913
+ */
914
+ format: RenditionFormat.pdf;
915
+ /**
916
+ * Bleed for the page. If undefined, then no bleed (zero).
917
+ */
918
+ bleed?: Bleed;
804
919
  }
805
920
 
806
921
  export declare interface PngRenditionOptions extends RenditionOptions {
@@ -857,7 +972,11 @@ declare enum Range_2 {
857
972
  /**
858
973
  * Generate rendition for all the pages
859
974
  */
860
- entireDocument = "entireDocument"
975
+ entireDocument = "entireDocument",
976
+ /**
977
+ * Generate rendition for specific pages
978
+ */
979
+ specificPages = "specificPages"
861
980
  }
862
981
  export { Range_2 as Range };
863
982
 
@@ -958,6 +1077,10 @@ export declare interface RenditionOptions {
958
1077
  * Format of the rendition
959
1078
  */
960
1079
  format: RenditionFormat;
1080
+ /**
1081
+ * Ids of the pages (Only required if the range is "specificPages")
1082
+ */
1083
+ pageIds?: string[];
961
1084
  }
962
1085
 
963
1086
  /**
@@ -980,12 +1103,10 @@ export declare interface Runtime {
980
1103
  dialog?: Dialog;
981
1104
 
982
1105
  /**
983
- * @experimental - Experimental API
984
1106
  * Exposes the concrete object/function of type T,
985
1107
  * which can be accessed into different runtime part of this AddOn e.g., "document model sandbox" runtime.
986
1108
  * Note that only concrete objects / class instances are supported. We can't expose entire class
987
- * from one runtime and create instance of that class in another runtime. Trying to do
988
- * so may result in undefined behaviour.
1109
+ * from one runtime and create instance of that class in another runtime. Trying to do so will throw an exception.
989
1110
  * @param apiObj - the concrete object to expose to other runtimes
990
1111
  *
991
1112
  * Notes:
@@ -995,7 +1116,6 @@ export declare interface Runtime {
995
1116
  */
996
1117
  exposeApi?<T>(apiObj: T): void;
997
1118
  /**
998
- * @experimental - Experimental API
999
1119
  * Requests a promise based proxy object for other runtimes, which will be used
1000
1120
  * by this UI runtime to directly call the APIs exposed (using exposeApi) from the other runtimes.
1001
1121
  * await or .then is necessary, since returned object is a promise.