@canva/design 2.4.1 → 2.6.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/index.d.ts CHANGED
@@ -358,7 +358,7 @@ export declare type ContentType = "richtext";
358
358
  * @public
359
359
  * Options for configuring where content in a design should be queried from.
360
360
  */
361
- declare type ContextOptions = {
361
+ export declare type ContextOptions = {
362
362
  target: "current_page";
363
363
  };
364
364
 
@@ -383,6 +383,1503 @@ export declare type Coordinates = {
383
383
  */
384
384
  export declare const createRichtextRange: () => RichtextRange;
385
385
 
386
+ /**
387
+ * @public
388
+ * Describes a part of a design.
389
+ */
390
+ export declare type DesignContext = DesignContextOptions["type"];
391
+
392
+ /**
393
+ * @public
394
+ * Options for configuring which part of a design to read.
395
+ */
396
+ declare type DesignContextOptions = {
397
+ /**
398
+ * The type of context.
399
+ */
400
+ type: "current_page";
401
+ };
402
+
403
+ /**
404
+ * @public
405
+ * Provides methods for reading and updating the structure and content of a design.
406
+ */
407
+ export declare namespace DesignEditing {
408
+ /**
409
+ * @public
410
+ * Options for creating an image fill in the element state builder
411
+ */
412
+ export type ImageFillOpts = {
413
+ /**
414
+ * The type of media.
415
+ */
416
+ type: "image";
417
+ /**
418
+ * A unique identifier that points to an image asset in Canva's backend.
419
+ */
420
+ imageRef: ImageRef;
421
+ /**
422
+ * If `true`, the image is flipped horizontally.
423
+ */
424
+ flipX?: boolean;
425
+ /**
426
+ * If `true`, the image is flipped vertically.
427
+ */
428
+ flipY?: boolean;
429
+ };
430
+ /**
431
+ * @public
432
+ * Options for creating a video fill in the element state builder
433
+ */
434
+ export type VideoFillOpts = {
435
+ /**
436
+ * The type of media.
437
+ */
438
+ type: "video";
439
+ /**
440
+ * A unique identifier that points to a video asset in Canva's backend.
441
+ */
442
+ videoRef: VideoRef;
443
+ /**
444
+ * If `true`, the video is flipped horizontally.
445
+ */
446
+ flipX?: boolean;
447
+ /**
448
+ * If `true`, the video is flipped vertically.
449
+ */
450
+ flipY?: boolean;
451
+ };
452
+ /**
453
+ * @public
454
+ * Options for creating a media fill in the element state builder
455
+ */
456
+ export type MediaContainerOpts = ImageFillOpts | VideoFillOpts;
457
+ /**
458
+ * @public
459
+ * Options for creating a fill in the element state builder
460
+ */
461
+ export type FillOpts =
462
+ | {
463
+ colorContainer: ColorContainerOpts;
464
+ mediaContainer?: MediaContainerOpts;
465
+ }
466
+ | {
467
+ colorContainer?: ColorContainerOpts;
468
+ mediaContainer: MediaContainerOpts;
469
+ };
470
+ /**
471
+ * @public
472
+ * Options for creating a fill of a shape in the element state builder
473
+ */
474
+ export type PathFillOpts =
475
+ | {
476
+ colorContainer: ColorContainerOpts;
477
+ mediaContainer?: MediaContainerOpts;
478
+ isMediaEditable?: boolean;
479
+ }
480
+ | {
481
+ colorContainer?: ColorContainerOpts;
482
+ mediaContainer: MediaContainerOpts;
483
+ isMediaEditable?: boolean;
484
+ };
485
+ /**
486
+ * @public
487
+ */
488
+ export type ColorContainerOpts = SolidFillState;
489
+ /**
490
+ * @public
491
+ * Options for creating a stroke in the element state builder
492
+ */
493
+ export type StrokeOpts = {
494
+ /**
495
+ * The weight (thickness) of the stroke.
496
+ *
497
+ * @remarks
498
+ * - Minimum: 0
499
+ * - Maximum: 100
500
+ */
501
+ weight: number;
502
+ /**
503
+ * The color of the stroke.
504
+ */
505
+ colorContainer: ColorContainerOpts;
506
+ };
507
+ /**
508
+ * @public
509
+ * Options for creating a shape path in the element state builder
510
+ */
511
+ export type PathOpts = {
512
+ d: string;
513
+ /**
514
+ * Describes how a fill is filled with color or media.
515
+ *
516
+ * @remarks
517
+ * If both `media` and `color` are defined, `media` takes precedence.
518
+ */
519
+ fill?: PathFillOpts;
520
+ /**
521
+ * The outline of the path.
522
+ */
523
+ stroke?: StrokeOpts;
524
+ };
525
+ /**
526
+ * @public
527
+ * Options for creating a rect element.
528
+ */
529
+ export type CreateRectElementOpts = {
530
+ /**
531
+ * The distance from the top edge of the container, in pixels.
532
+ *
533
+ * @remarks
534
+ * - The pixels are relative to their container.
535
+ * - Minimum: -32768
536
+ * - Maximum: 32767
537
+ */
538
+ top: number;
539
+ /**
540
+ * The distance from the left edge of the container, in pixels.
541
+ *
542
+ * @remarks
543
+ * - The pixels are relative to their container.
544
+ * - Minimum: -32768
545
+ * - Maximum: 32767
546
+ */
547
+ left: number;
548
+ /**
549
+ * A rotation, in degrees.
550
+ *
551
+ * @remarks
552
+ * - Minimum: -180
553
+ * - Maximum: 180
554
+ */
555
+ rotation?: number;
556
+ /**
557
+ * Transparency as a percentage.
558
+ *
559
+ * @remarks
560
+ * - Minimum: 0
561
+ * - Maximum: 1
562
+ */
563
+ transparency?: number;
564
+ /**
565
+ * A width, in pixels.
566
+ */
567
+ width: number;
568
+ /**
569
+ * A height, in pixels.
570
+ */
571
+ height: number;
572
+ /**
573
+ * Describes how a fill is filled with color or media.
574
+ *
575
+ * @remarks
576
+ * If both `media` and `color` are defined, `media` takes precedence.
577
+ */
578
+ fill?: FillOpts;
579
+ /**
580
+ * The outline of the rect.
581
+ */
582
+ stroke?: StrokeOpts;
583
+ };
584
+ /**
585
+ * @public
586
+ * Options for creating a shape element.
587
+ */
588
+ export type CreateShapeElementOpts = {
589
+ /**
590
+ * The distance from the top edge of the container, in pixels.
591
+ *
592
+ * @remarks
593
+ * - The pixels are relative to their container.
594
+ * - Minimum: -32768
595
+ * - Maximum: 32767
596
+ */
597
+ top: number;
598
+ /**
599
+ * The distance from the left edge of the container, in pixels.
600
+ *
601
+ * @remarks
602
+ * - The pixels are relative to their container.
603
+ * - Minimum: -32768
604
+ * - Maximum: 32767
605
+ */
606
+ left: number;
607
+ /**
608
+ * A rotation, in degrees.
609
+ *
610
+ * @remarks
611
+ * - Minimum: -180
612
+ * - Maximum: 180
613
+ */
614
+ rotation?: number;
615
+ /**
616
+ * Transparency as a percentage.
617
+ *
618
+ * @remarks
619
+ * - Minimum: 0
620
+ * - Maximum: 1
621
+ */
622
+ transparency?: number;
623
+ /**
624
+ * A width, in pixels.
625
+ */
626
+ width: number;
627
+ /**
628
+ * A height, in pixels.
629
+ */
630
+ height: number;
631
+ /**
632
+ * The scale and cropping of the shape.
633
+ */
634
+ readonly viewBox: AlignedBoxState;
635
+ /**
636
+ * The paths that define the structure of the shape.
637
+ *
638
+ * @remarks
639
+ * - Must have between 1 and 30 paths.
640
+ * - Total size of all paths must not exceed 2kb.
641
+ * - Maximum of 6 unique fill colors across all paths.
642
+ */
643
+ paths: PathOpts[];
644
+ };
645
+ /**
646
+ * @public
647
+ * Options for creating an embed element.
648
+ */
649
+ export type CreateEmbedElementOpts = {
650
+ /**
651
+ * The distance from the top edge of the container, in pixels.
652
+ *
653
+ * @remarks
654
+ * - The pixels are relative to their container.
655
+ * - Minimum: -32768
656
+ * - Maximum: 32767
657
+ */
658
+ top: number;
659
+ /**
660
+ * The distance from the left edge of the container, in pixels.
661
+ *
662
+ * @remarks
663
+ * - The pixels are relative to their container.
664
+ * - Minimum: -32768
665
+ * - Maximum: 32767
666
+ */
667
+ left: number;
668
+ /**
669
+ * A rotation, in degrees.
670
+ *
671
+ * @remarks
672
+ * - Minimum: -180
673
+ * - Maximum: 180
674
+ */
675
+ rotation?: number;
676
+ /**
677
+ * Transparency as a percentage.
678
+ *
679
+ * @remarks
680
+ * - Minimum: 0
681
+ * - Maximum: 1
682
+ */
683
+ transparency?: number;
684
+ /**
685
+ * A width, in pixels.
686
+ */
687
+ width: number;
688
+ /**
689
+ * A height, in pixels.
690
+ */
691
+ height: number;
692
+ /**
693
+ * The URL of the rich media.
694
+ *
695
+ * @remarks
696
+ * This URL must be supported by the Iframely API.
697
+ */
698
+ url: string;
699
+ };
700
+ /**
701
+ * @public
702
+ * Options for creating a text element.
703
+ */
704
+ export type CreateTextElementOpts = {
705
+ /**
706
+ * The distance from the top edge of the container, in pixels.
707
+ *
708
+ * @remarks
709
+ * - The pixels are relative to their container.
710
+ * - Minimum: -32768
711
+ * - Maximum: 32767
712
+ */
713
+ top: number;
714
+ /**
715
+ * The distance from the left edge of the container, in pixels.
716
+ *
717
+ * @remarks
718
+ * - The pixels are relative to their container.
719
+ * - Minimum: -32768
720
+ * - Maximum: 32767
721
+ */
722
+ left: number;
723
+ /**
724
+ * A width, in pixels.
725
+ */
726
+ width: number;
727
+ /**
728
+ * The text content.
729
+ */
730
+ text: {
731
+ regions: readonly TextRegion[];
732
+ };
733
+ /**
734
+ * A rotation, in degrees.
735
+ *
736
+ * @remarks
737
+ * - Minimum: -180
738
+ * - Maximum: 180
739
+ */
740
+ rotation?: number;
741
+ /**
742
+ * Transparency as a percentage.
743
+ *
744
+ * @remarks
745
+ * - Minimum: 0
746
+ * - Maximum: 1
747
+ */
748
+ transparency?: number;
749
+ };
750
+ /**
751
+ * @public
752
+ * Provides methods for creating element states.
753
+ *
754
+ * @remarks
755
+ * These methods don't add the elements to the design. They only return elements that can
756
+ * be added to a design, such as with the `insertAfter` method.
757
+ *
758
+ * @preventInline
759
+ */
760
+ export interface ElementStateBuilder {
761
+ /**
762
+ * Creates a rect element state.
763
+ * @param opts - Options for creating the rect element.
764
+ */
765
+ createRectElement(opts: CreateRectElementOpts): RectElementState;
766
+ /**
767
+ * Creates a shape element state.
768
+ * @param opts - Options for creating the shape element.
769
+ */
770
+ createShapeElement(opts: CreateShapeElementOpts): ShapeElementState;
771
+ /**
772
+ * Creates an embed element state.
773
+ * @param opts - Options for creating the embed element.
774
+ */
775
+ createEmbedElement(opts: CreateEmbedElementOpts): EmbedElementState;
776
+ /**
777
+ * Creates a text element state.
778
+ * @param opts - Options for creating the text element.
779
+ */
780
+ createTextElement(opts: CreateTextElementOpts): TextElementState;
781
+ /**
782
+ * Creates a richtext range.
783
+ */
784
+ createRichtextRange(): RichtextRange;
785
+ }
786
+ /**
787
+ * @public
788
+ * Async methods for handling more complex operations.
789
+ */
790
+ export interface AsyncOperations {
791
+ /**
792
+ * Group specified elements.
793
+ *
794
+ * @param opts - Options for grouping elements.
795
+ *
796
+ * @returns a new group element containing all the given elements.
797
+ */
798
+ group(opts: AsyncOperationsGroupOpts): Promise<GroupElement>;
799
+ /**
800
+ * Ungroup a group element.
801
+ *
802
+ * @param opts - Options for ungrouping a group element.
803
+ *
804
+ * @returns new elements that are ungrouped from the given group.
805
+ */
806
+ ungroup(
807
+ opts: AsyncOperationsUngroupOpts,
808
+ ): Promise<readonly AbsoluteElement[]>;
809
+ }
810
+ /**
811
+ * @public
812
+ * Options for `group` operation.
813
+ */
814
+ export interface AsyncOperationsGroupOpts {
815
+ /**
816
+ * Elements to be grouped.
817
+ */
818
+ elements: readonly Exclude<GroupContentElement, UnsupportedElement>[];
819
+ }
820
+ /**
821
+ * @public
822
+ * Options for `ungroup` operation.
823
+ */
824
+ export interface AsyncOperationsUngroupOpts {
825
+ /**
826
+ * Group element to be ungroup.
827
+ */
828
+ element: GroupElement;
829
+ }
830
+ /**
831
+ * @public
832
+ * Helpers for use with supported pages.
833
+ *
834
+ * @remarks
835
+ * Not applicable to unsupported pages.
836
+ *
837
+ * @preventInline
838
+ */
839
+ export type PageHelpers = AsyncOperations & {
840
+ /**
841
+ * Build an element state that can be used to create an element with the `insert` methods of
842
+ * the page's element list
843
+ */
844
+ elementStateBuilder: DesignEditing.ElementStateBuilder;
845
+ };
846
+ /**
847
+ * @public
848
+ * The result of reading part of a design when the context is the current page.
849
+ */
850
+ export type CurrentPageResult<
851
+ Page = DesignEditing.Page,
852
+ Helpers = DesignEditing.PageHelpers,
853
+ > = Readonly<{
854
+ /**
855
+ * The current page of the design.
856
+ */
857
+ page: Page;
858
+ /**
859
+ * These are various utilities that allow apps to do more complex operations on the page.
860
+ */
861
+ helpers: Helpers;
862
+ /**
863
+ * Saves any changes made during the session while keeping the transaction open.
864
+ *
865
+ * @remarks
866
+ * - Any changes in the session are only reflected in the design after this method is called.
867
+ * - Once this method is called, further changes in the session can still be made.
868
+ */
869
+ sync(): Promise<void>;
870
+ }>;
871
+ /**
872
+ * A function called for each item in the list.
873
+ *
874
+ * @param item - The current item in the list.
875
+ * @param index - The index of the current item.
876
+ */
877
+ export type ForEachCallback<M> = (item: M, index: number) => void;
878
+ /**
879
+ * A function that determines if an item should be included in the result.
880
+ *
881
+ * @param item - The item to test.
882
+ * @returns `true` if the item should be included, otherwise `false`.
883
+ */
884
+ export type FilterPredicate<M> = (item: M) => boolean;
885
+ /**
886
+ * A type predicate function that determines if an item is of a specific type.
887
+ *
888
+ * @param item - The item to test.
889
+ * @returns `true` if the item is of type `C`, otherwise `false`.
890
+ */
891
+ export type TypeFilterPredicate<M, C extends M> = (item: M) => item is C;
892
+ /**
893
+ * @public
894
+ * A list that cannot be changed.
895
+ *
896
+ * @preventInline
897
+ */
898
+ export interface ReadableList<M> {
899
+ /**
900
+ * Gets the number of items in the list.
901
+ *
902
+ * @returns The number of items.
903
+ */
904
+ count(): number;
905
+ /**
906
+ * Converts the list to an array.
907
+ *
908
+ * @returns An array containing all items. The items are the same as in the list.
909
+ */
910
+ toArray(): readonly M[];
911
+ /**
912
+ * Executes a function for each item in the list.
913
+ *
914
+ * @param callback - The function to run for each item.
915
+ */
916
+ forEach(callback: ForEachCallback<M>): void;
917
+ /**
918
+ * Creates a new array with items that match a specific type.
919
+ *
920
+ * @param filter - A function that checks if an item is of type `C`.
921
+ * @returns An array of items that are of type `C`.
922
+ */
923
+ filter<C extends M>(filter: TypeFilterPredicate<M, C>): readonly C[];
924
+ /**
925
+ * Creates a new array with items that pass a test.
926
+ *
927
+ * @param filter - A function that tests each item. Returns `true` to keep the item.
928
+ * @returns An array of items that passed the test.
929
+ */
930
+ filter(filter: FilterPredicate<M>): readonly M[];
931
+ }
932
+ /**
933
+ * @public
934
+ * A list of items that can be read.
935
+ *
936
+ * @preventInline
937
+ */
938
+ export interface ListState<T> extends Iterable<T | undefined> {
939
+ join(separator?: string): string;
940
+ slice(start?: number, end?: number): EditableListState<T>;
941
+ indexOf(searchElement: T, fromIndex?: number): number;
942
+ lastIndexOf(searchElement: T, fromIndex?: number): number;
943
+ every<S extends T>(
944
+ predicate: (value: T, index: number) => value is S,
945
+ ): this is ListState<S>;
946
+ every(predicate: (value: T, index: number) => unknown): boolean;
947
+ some(predicate: (value: T, index: number) => unknown): boolean;
948
+ forEach(callbackFn: (value: T, index: number) => void): void;
949
+ map<U>(callbackFn: (value: T, index: number) => U): EditableListState<U>;
950
+ filter<S extends T>(
951
+ predicate: (value: T, index: number) => value is S,
952
+ ): S[];
953
+ filter(predicate: (value: T, index: number) => unknown): T[];
954
+ reduce(
955
+ callbackFn: (
956
+ previousValue: T,
957
+ currentValue: T,
958
+ currentIndex: number,
959
+ ) => T,
960
+ initialValue?: T,
961
+ ): T;
962
+ reduce<U>(
963
+ callbackFn: (
964
+ previousValue: U,
965
+ currentValue: T,
966
+ currentIndex: number,
967
+ ) => U,
968
+ initialValue: U,
969
+ ): U;
970
+ reduceRight(
971
+ callbackFn: (
972
+ previousValue: T,
973
+ currentValue: T,
974
+ currentIndex: number,
975
+ ) => T,
976
+ initialValue?: T,
977
+ ): T;
978
+ reduceRight<U>(
979
+ callbackFn: (
980
+ previousValue: U,
981
+ currentValue: T,
982
+ currentIndex: number,
983
+ ) => U,
984
+ initialValue: U,
985
+ ): U;
986
+ find<S extends T>(
987
+ predicate: (value: T | undefined, index: number) => value is S,
988
+ ): S | undefined;
989
+ find(
990
+ predicate: (value: T | undefined, index: number) => unknown,
991
+ ): T | undefined;
992
+ flatMap<U>(
993
+ callback: (value: T, index: number, array: T[]) => U | readonly U[],
994
+ ): U[];
995
+ readonly length: number;
996
+ readonly [n: number]: T;
997
+ }
998
+ /**
999
+ * @public
1000
+ * A list of items that can be read and updated.
1001
+ */
1002
+ export type EditableListState<T> = ListState<T> & {
1003
+ length: number;
1004
+ pop(): T | undefined;
1005
+ push(...items: T[]): number;
1006
+ shift(): T | undefined;
1007
+ splice(start: number, deleteCount?: number): EditableListState<T>;
1008
+ splice(
1009
+ start: number,
1010
+ deleteCount: number,
1011
+ ...items: T[]
1012
+ ): EditableListState<T>;
1013
+ unshift(...items: T[]): number;
1014
+ [n: number]: T;
1015
+ };
1016
+ /**
1017
+ * @public
1018
+ * A list of items that can be read and updated.
1019
+ *
1020
+ * @preventInline
1021
+ */
1022
+ export interface List<S, M> extends ReadableList<M> {
1023
+ /**
1024
+ * Adds a copy of an item to the list and places it right before another item.
1025
+ *
1026
+ * @param ref - The existing item to place the new item before.
1027
+ * If `ref` is `undefined`, the new item is added at the end of the list.
1028
+ * If `ref` does not exist in the list, the operation fails.
1029
+ *
1030
+ * @param item - The item to add. A copy of this item will be inserted.
1031
+ *
1032
+ * @returns
1033
+ * The added item, or `undefined` if the operation failed.
1034
+ */
1035
+ insertBefore(ref: M | undefined, item: S): M | undefined;
1036
+ /**
1037
+ * Adds a copy of an item to the list and places it right after another item.
1038
+ *
1039
+ * @param ref - The existing item to place the new item after.
1040
+ * If `ref` is `undefined`, the new item is added at the end of the list.
1041
+ * If `ref` does not exist in the list, the operation fails.
1042
+ *
1043
+ * @param item - The item to add. A copy of this item will be inserted.
1044
+ *
1045
+ * @returns
1046
+ * The added item, or `undefined` if the operation failed.
1047
+ */
1048
+ insertAfter(ref: M | undefined, item: S): M | undefined;
1049
+ /**
1050
+ * Moves an existing item to a new position right before another item.
1051
+ *
1052
+ * @param ref - The existing item to move the item before.
1053
+ * If `ref` is `undefined`, the item is moved to the end of the list.
1054
+ * If `ref` does not exist in the list, the operation fails.
1055
+ *
1056
+ * @param item - The item to move.
1057
+ * The operation fails if the item is not already in the list.
1058
+ */
1059
+ moveBefore(ref: M | undefined, item: M): void;
1060
+ /**
1061
+ * Moves an existing item to a new position right after another item.
1062
+ *
1063
+ * @param ref - The existing item to move the item after.
1064
+ * If `ref` is `undefined`, the item is moved to the end of the list.
1065
+ * If `ref` does not exist in the list, the operation fails.
1066
+ *
1067
+ * @param item - The item to move.
1068
+ * The operation fails if the item is not already in the list.
1069
+ */
1070
+ moveAfter(ref: M | undefined, item: M): void;
1071
+ /**
1072
+ * Removes an item from the list.
1073
+ *
1074
+ * @param item - The item to remove from the list.
1075
+ */
1076
+ delete(item: M): void;
1077
+ }
1078
+ /**
1079
+ * @public
1080
+ * Represents something that's not supported by the Apps SDK.
1081
+ */
1082
+ export interface Unsupported {
1083
+ readonly type: "unsupported";
1084
+ }
1085
+ /**
1086
+ * @public
1087
+ * A state that creates a set of dimensions.
1088
+ */
1089
+ export interface DimensionsState {
1090
+ /**
1091
+ * A width, in pixels.
1092
+ */
1093
+ readonly width: number;
1094
+ /**
1095
+ * A height, in pixels.
1096
+ */
1097
+ readonly height: number;
1098
+ }
1099
+ /**
1100
+ * @public
1101
+ * A set of dimensions.
1102
+ */
1103
+ export type Dimensions = DimensionsState;
1104
+ /**
1105
+ * @public
1106
+ * A state that creates an image fill.
1107
+ */
1108
+ export interface ImageFillState {
1109
+ /**
1110
+ * The type of media.
1111
+ */
1112
+ readonly type: "image";
1113
+ /**
1114
+ * A unique identifier that points to an image asset in Canva's backend.
1115
+ */
1116
+ readonly imageRef: ImageRef;
1117
+ /**
1118
+ * If `true`, the image is flipped horizontally.
1119
+ */
1120
+ flipX: boolean;
1121
+ /**
1122
+ * If `true`, the image is flipped vertically.
1123
+ */
1124
+ flipY: boolean;
1125
+ }
1126
+ /**
1127
+ * @public
1128
+ * An image that fills the interior of a media.
1129
+ */
1130
+ export type ImageFill = ImageFillState;
1131
+ /**
1132
+ * @public
1133
+ * A state that creates a video fill.
1134
+ */
1135
+ export interface VideoFillState {
1136
+ /**
1137
+ * The type of media.
1138
+ */
1139
+ readonly type: "video";
1140
+ /**
1141
+ * A unique identifier that points to a video asset in Canva's backend.
1142
+ */
1143
+ readonly videoRef: VideoRef;
1144
+ /**
1145
+ * If `true`, the video is flipped horizontally.
1146
+ */
1147
+ flipX: boolean;
1148
+ /**
1149
+ * If `true`, the video is flipped vertically.
1150
+ */
1151
+ flipY: boolean;
1152
+ }
1153
+ /**
1154
+ * @public
1155
+ * A video that fills the interior of a media.
1156
+ */
1157
+ export type VideoFill = VideoFillState;
1158
+ /**
1159
+ * @public
1160
+ * A state that creates a media fill.
1161
+ */
1162
+ export type MediaFillState = ImageFillState | VideoFillState;
1163
+ /**
1164
+ * @public
1165
+ * A media item that fills an interior.
1166
+ */
1167
+ export type MediaFill = ImageFill | VideoFill;
1168
+ /**
1169
+ * @public
1170
+ * A state that creates a solid color fill.
1171
+ */
1172
+ export interface SolidFillState {
1173
+ /**
1174
+ * The type of color.
1175
+ */
1176
+ readonly type: "solid";
1177
+ /**
1178
+ * The color of the fill.
1179
+ * This must be a valid, six-digit hex code, prefixed with a `#` symbol.
1180
+ *
1181
+ * @remarks
1182
+ * - Must be six characters long.
1183
+ * - Must start with a `#`.
1184
+ * - Must use lowercase letters.
1185
+ * @example "#ff0099"
1186
+ */
1187
+ color: string;
1188
+ }
1189
+ /**
1190
+ * @public
1191
+ * A solid color that fills an interior.
1192
+ */
1193
+ export type SolidFill = SolidFillState;
1194
+ /**
1195
+ * @public
1196
+ * A state that creates a color fill.
1197
+ */
1198
+ export type ColorFillState = SolidFillState | Unsupported;
1199
+ /**
1200
+ * @public
1201
+ * A color that fills an interior.
1202
+ */
1203
+ export type ColorFill = SolidFill | Unsupported;
1204
+ /**
1205
+ * @public
1206
+ * A state that creates a fill with color or media.
1207
+ *
1208
+ * @remarks
1209
+ * If both `media` and `color` are defined, `media` takes precedence.
1210
+ */
1211
+ export interface FillState {
1212
+ /**
1213
+ * The media fill for the path, if any.
1214
+ */
1215
+ mediaContainer: MediaFillState | undefined;
1216
+ /**
1217
+ * The color fill for the path, if any.
1218
+ */
1219
+ colorContainer: ColorFillState | undefined;
1220
+ }
1221
+ /**
1222
+ * @public
1223
+ * A state that creates a shape path fill with color or media.
1224
+ *
1225
+ * @remarks
1226
+ * If both `media` and `color` are defined, `media` takes precedence.
1227
+ */
1228
+ export interface PathFillState {
1229
+ /**
1230
+ * Defines whether the media fill is editable.
1231
+ */
1232
+ isMediaEditable: boolean;
1233
+ /**
1234
+ * The media fill for the path, if any.
1235
+ */
1236
+ mediaContainer: MediaFillState | undefined;
1237
+ /**
1238
+ * The color fill for the path, if any.
1239
+ */
1240
+ colorContainer: ColorFillState | undefined;
1241
+ }
1242
+ /**
1243
+ * @public
1244
+ * Describes how a fill of a shape path is filled with color or media.
1245
+ *
1246
+ * @remarks
1247
+ * If both `media` and `color` are defined, `media` takes precedence.
1248
+ */
1249
+ export type PathFill =
1250
+ | PathFillWithEditableMedia
1251
+ | PathFillWithNonEditableMedia;
1252
+ export interface PathFillWithEditableMedia {
1253
+ readonly isMediaEditable: true;
1254
+ /**
1255
+ * A media fill, if any.
1256
+ */
1257
+ readonly mediaContainer: {
1258
+ set(state: MediaFillState | undefined): void;
1259
+ ref: MediaFill | undefined;
1260
+ };
1261
+ /**
1262
+ * A color fill, if any.
1263
+ */
1264
+ readonly colorContainer: {
1265
+ set(state: SolidFillState | undefined): void;
1266
+ ref: ColorFill | undefined;
1267
+ };
1268
+ }
1269
+ export interface PathFillWithNonEditableMedia {
1270
+ readonly isMediaEditable: false;
1271
+ /**
1272
+ * A media fill, if any.
1273
+ * MediaFill is not editable
1274
+ */
1275
+ readonly mediaContainer: {
1276
+ ref: MediaFill | undefined;
1277
+ };
1278
+ /**
1279
+ * A color fill, if any.
1280
+ */
1281
+ readonly colorContainer: {
1282
+ set(state: SolidFillState | undefined): void;
1283
+ ref: ColorFill | undefined;
1284
+ };
1285
+ }
1286
+ /**
1287
+ * @public
1288
+ * Describes how a fill is filled with color or media.
1289
+ *
1290
+ * @remarks
1291
+ * If both `media` and `color` are defined, `media` takes precedence.
1292
+ *
1293
+ * @preventInline
1294
+ */
1295
+ export interface Fill {
1296
+ /**
1297
+ * A media fill, if any.
1298
+ */
1299
+ readonly mediaContainer: {
1300
+ set(state: MediaFillState | undefined): void;
1301
+ ref: MediaFill | undefined;
1302
+ };
1303
+ /**
1304
+ * A color fill, if any.
1305
+ */
1306
+ readonly colorContainer: {
1307
+ set(state: SolidFillState | undefined): void;
1308
+ ref: ColorFill | undefined;
1309
+ };
1310
+ }
1311
+ /**
1312
+ * @public
1313
+ * A state that creates the scale and cropping of a shape.
1314
+ *
1315
+ * @remarks
1316
+ * This is similar to the `viewBox` attribute of an `SVGElement`.
1317
+ */
1318
+ export interface AlignedBoxState {
1319
+ /**
1320
+ * The distance of the shape from the top edge of the element, in pixels.
1321
+ */
1322
+ readonly top: number;
1323
+ /**
1324
+ * The distance of the shape from the left edge of the element, in pixels.
1325
+ */
1326
+ readonly left: number;
1327
+ /**
1328
+ * The width of the view box, in pixels.
1329
+ */
1330
+ readonly width: number;
1331
+ /**
1332
+ * The height of the view box, in pixels.
1333
+ */
1334
+ readonly height: number;
1335
+ }
1336
+ /**
1337
+ * @public
1338
+ * The scale and cropping of a shape.
1339
+ *
1340
+ * @remarks
1341
+ * This is similar to the `viewBox` attribute of an `SVGElement`.
1342
+ */
1343
+ export type AlignedBox = AlignedBoxState;
1344
+ /**
1345
+ * @public
1346
+ * A state that creates a path that defines the structure of a shape element.
1347
+ */
1348
+ export interface PathState {
1349
+ /**
1350
+ * The shape of the path.
1351
+ *
1352
+ * @remarks
1353
+ * This is similar to the `d` attribute of an SVG's `path` element, with some limitations:
1354
+ *
1355
+ * - Must start with an `M` command.
1356
+ * - Only one `M` command is allowed.
1357
+ * - `Q` and `T` commands are not permitted.
1358
+ * - The path must be closed using a `Z` command or matching start and end coordinates.
1359
+ */
1360
+ readonly d: string;
1361
+ /**
1362
+ * The appearance of the path's interior.
1363
+ */
1364
+ readonly fill: PathFillState;
1365
+ /**
1366
+ * The stroke (outline) of the path, if any.
1367
+ */
1368
+ readonly stroke: StrokeState | undefined;
1369
+ }
1370
+ /**
1371
+ * @public
1372
+ * A path that defines the structure of a shape element.
1373
+ *
1374
+ * @preventInline
1375
+ */
1376
+ export type Path = {
1377
+ /**
1378
+ * The shape of the path.
1379
+ *
1380
+ * @remarks
1381
+ * This is similar to the `d` attribute of an SVG's `path` element, with some limitations:
1382
+ *
1383
+ * - Must start with an `M` command.
1384
+ * - Only one `M` command is allowed.
1385
+ * - `Q` and `T` commands are not permitted.
1386
+ * - The path must be closed using a `Z` command or matching start and end coordinates.
1387
+ */
1388
+ readonly d: string;
1389
+ /**
1390
+ * The appearance of the path's interior.
1391
+ */
1392
+ readonly fill: PathFill;
1393
+ /**
1394
+ * The stroke (outline) of the path, if any.
1395
+ */
1396
+ readonly stroke: Stroke | undefined;
1397
+ };
1398
+ /**
1399
+ * @public
1400
+ * A state that creates an outline, such as the border of an element.
1401
+ */
1402
+ export interface StrokeState {
1403
+ /**
1404
+ * The weight (thickness) of the stroke.
1405
+ *
1406
+ * @remarks
1407
+ * - Minimum: 0
1408
+ * - Maximum: 100
1409
+ */
1410
+ weight: number;
1411
+ /**
1412
+ * The color of the stroke.
1413
+ */
1414
+ colorContainer: ColorFillState;
1415
+ }
1416
+ /**
1417
+ * @public
1418
+ * Represents an outline, such as the border of an element.
1419
+ *
1420
+ * @preventInline
1421
+ */
1422
+ export type Stroke = {
1423
+ /**
1424
+ * The weight (thickness) of the stroke.
1425
+ *
1426
+ * @remarks
1427
+ * - Minimum: 0
1428
+ * - Maximum: 100
1429
+ */
1430
+ weight: number;
1431
+ /**
1432
+ * The color of the stroke.
1433
+ */
1434
+ readonly colorContainer: {
1435
+ ref: ColorFill;
1436
+ set(state: SolidFillState): void;
1437
+ };
1438
+ };
1439
+ /**
1440
+ * @public
1441
+ * The basic properties of the state of an element.
1442
+ *
1443
+ * @remarks
1444
+ * These properties are shared by all elements in a design.
1445
+ */
1446
+ export interface ElementState extends DimensionsState {
1447
+ /**
1448
+ * If `true`, the element is locked and cannot be modified.
1449
+ */
1450
+ readonly locked: boolean;
1451
+ /**
1452
+ * The distance from the top edge of the container, in pixels.
1453
+ *
1454
+ * @remarks
1455
+ * - The pixels are relative to their container.
1456
+ * - Minimum: -32768
1457
+ * - Maximum: 32767
1458
+ */
1459
+ readonly top: number;
1460
+ /**
1461
+ * The distance from the left edge of the container, in pixels.
1462
+ *
1463
+ * @remarks
1464
+ * - The pixels are relative to their container.
1465
+ * - Minimum: -32768
1466
+ * - Maximum: 32767
1467
+ */
1468
+ readonly left: number;
1469
+ /**
1470
+ * A rotation, in degrees.
1471
+ *
1472
+ * @remarks
1473
+ * - Minimum: -180
1474
+ * - Maximum: 180
1475
+ */
1476
+ readonly rotation: number;
1477
+ /**
1478
+ * Transparency as a percentage.
1479
+ *
1480
+ * @remarks
1481
+ * - Minimum: 0
1482
+ * - Maximum: 1
1483
+ */
1484
+ readonly transparency: number;
1485
+ }
1486
+ /**
1487
+ * @public
1488
+ * The basic properties of an element.
1489
+ *
1490
+ * @remarks
1491
+ * These properties are shared by all elements in a design.
1492
+ */
1493
+ export type Element = DimensionsState & {
1494
+ /**
1495
+ * If `true`, the element is locked and cannot be modified.
1496
+ */
1497
+ readonly locked: boolean;
1498
+ /**
1499
+ * The distance from the top edge of the container, in pixels.
1500
+ *
1501
+ * @remarks
1502
+ * - The pixels are relative to their container.
1503
+ * - Minimum: -32768
1504
+ * - Maximum: 32767
1505
+ */
1506
+ top: number;
1507
+ /**
1508
+ * The distance from the left edge of the container, in pixels.
1509
+ *
1510
+ * @remarks
1511
+ * - The pixels are relative to their container.
1512
+ * - Minimum: -32768
1513
+ * - Maximum: 32767
1514
+ */
1515
+ left: number;
1516
+ /**
1517
+ * A rotation, in degrees.
1518
+ *
1519
+ * @remarks
1520
+ * - Minimum: -180
1521
+ * - Maximum: 180
1522
+ */
1523
+ rotation: number;
1524
+ /**
1525
+ * Transparency as a percentage.
1526
+ *
1527
+ * @remarks
1528
+ * - Minimum: 0
1529
+ * - Maximum: 1
1530
+ */
1531
+ transparency: number;
1532
+ };
1533
+ /**
1534
+ * @public
1535
+ * A state that creates a rectangular element.
1536
+ */
1537
+ export interface RectState {
1538
+ /**
1539
+ * The type of content.
1540
+ */
1541
+ readonly type: "rect";
1542
+ /**
1543
+ * The appearance of the rectangle's interior.
1544
+ */
1545
+ readonly fill: FillState;
1546
+ /**
1547
+ * The outline of the rectangle.
1548
+ */
1549
+ readonly stroke: StrokeState;
1550
+ }
1551
+ /**
1552
+ * @public
1553
+ * Represents a rectangular element.
1554
+ */
1555
+ export type Rect = {
1556
+ /**
1557
+ * The element type
1558
+ */
1559
+ readonly type: "rect";
1560
+ readonly fill: Fill;
1561
+ /**
1562
+ * The outline of the rectangle.
1563
+ */
1564
+ readonly stroke: Stroke;
1565
+ };
1566
+ /**
1567
+ * @public
1568
+ * A state that creates a vector shape element.
1569
+ */
1570
+ export interface ShapeState {
1571
+ /**
1572
+ * The type of content.
1573
+ */
1574
+ readonly type: "shape";
1575
+ /**
1576
+ * The scale and cropping of the shape.
1577
+ */
1578
+ readonly viewBox: AlignedBoxState;
1579
+ /**
1580
+ * The paths that define the structure of the shape.
1581
+ *
1582
+ * @remarks
1583
+ * - Must have between 1 and 30 paths.
1584
+ * - Total size of all paths must not exceed 2kb.
1585
+ * - Maximum of 6 unique fill colors across all paths.
1586
+ */
1587
+ readonly paths: ListState<PathState>;
1588
+ }
1589
+ /**
1590
+ * @public
1591
+ * Represents a vector shape element.
1592
+ */
1593
+ export type Shape = {
1594
+ /**
1595
+ * The type of content.
1596
+ */
1597
+ readonly type: "shape";
1598
+ /**
1599
+ * The scale and cropping of the shape.
1600
+ */
1601
+ readonly viewBox: AlignedBox;
1602
+ /**
1603
+ * The paths that define the structure of the shape.
1604
+ */
1605
+ readonly paths: ReadableList<Path>;
1606
+ };
1607
+ /**
1608
+ * @public
1609
+ * A state that creates group content.
1610
+ */
1611
+ export interface GroupState {
1612
+ /**
1613
+ * The type of content.
1614
+ */
1615
+ readonly type: "group";
1616
+ /**
1617
+ * The elements that exist within the group.
1618
+ */
1619
+ readonly contents: ListState<GroupContentElementState>;
1620
+ }
1621
+ /**
1622
+ * @public
1623
+ * Represents group content.
1624
+ */
1625
+ export type Group = {
1626
+ /**
1627
+ * The type of content.
1628
+ */
1629
+ readonly type: "group";
1630
+ /**
1631
+ * The elements that exist within the group.
1632
+ */
1633
+ readonly contents: ReadableList<GroupContentElement>;
1634
+ };
1635
+ /**
1636
+ * @public
1637
+ * A state that creates rich media content.
1638
+ */
1639
+ export interface EmbedState {
1640
+ /**
1641
+ * The type of content.
1642
+ */
1643
+ readonly type: "embed";
1644
+ /**
1645
+ * The URL of the rich media.
1646
+ *
1647
+ * @remarks
1648
+ * This URL must be supported by the Iframely API.
1649
+ */
1650
+ readonly url: string;
1651
+ }
1652
+ /**
1653
+ * @public
1654
+ * Represents rich media content.
1655
+ */
1656
+ export type Embed = EmbedState;
1657
+ /**
1658
+ * @public
1659
+ * A state that creates text content.
1660
+ */
1661
+ export interface TextState {
1662
+ /**
1663
+ * The type of content.
1664
+ */
1665
+ readonly type: "text";
1666
+ /**
1667
+ * The text content.
1668
+ */
1669
+ readonly text: {
1670
+ regions: ListState<TextRegion>;
1671
+ };
1672
+ }
1673
+ /**
1674
+ * @public
1675
+ * Represents text content.
1676
+ */
1677
+ export type Text = {
1678
+ readonly type: "text";
1679
+ readonly text: RichtextRange;
1680
+ };
1681
+ /**
1682
+ * @public
1683
+ * A state that creates a rectangle element.
1684
+ *
1685
+ * @remarks
1686
+ * The rectangle can be filled with image content, video content, or a solid color.
1687
+ */
1688
+ export type RectElementState = RectState & ElementState;
1689
+ /**
1690
+ * @public
1691
+ * An element that renders a rectangle.
1692
+ *
1693
+ * @remarks
1694
+ * The rectangle can be filled with image content, video content, or a solid color.
1695
+ */
1696
+ export type RectElement = Rect & Element;
1697
+ /**
1698
+ * @public
1699
+ * A state that creates a vector shape element.
1700
+ */
1701
+ export type ShapeElementState = ShapeState & ElementState;
1702
+ /**
1703
+ * @public
1704
+ * An element that renders a vector shape.
1705
+ */
1706
+ export type ShapeElement = Shape & Element;
1707
+ /**
1708
+ * @public
1709
+ * A state that creates a group element.
1710
+ */
1711
+ export type GroupElementState = GroupState & ElementState;
1712
+ /**
1713
+ * @public
1714
+ * An element that renders a group of other elements.
1715
+ */
1716
+ export type GroupElement = Group & Element;
1717
+ /**
1718
+ * @public
1719
+ * A state that creates an embed element, such as a YouTube video.
1720
+ */
1721
+ export type EmbedElementState = EmbedState & ElementState;
1722
+ /**
1723
+ * @public
1724
+ * An element that embeds rich media, such as a YouTube video.
1725
+ */
1726
+ export type EmbedElement = Embed & Element;
1727
+ /**
1728
+ * @public
1729
+ * A state that creates a text element.
1730
+ */
1731
+ export type TextElementState = TextState & ElementState;
1732
+ /**
1733
+ * @public
1734
+ * An element that renders text content.
1735
+ */
1736
+ export type TextElement = Text & Element;
1737
+ /**
1738
+ * @public
1739
+ * An element state that is not supported by the Apps SDK.
1740
+ */
1741
+ export type UnsupportedElementState = Unsupported & ElementState;
1742
+ /**
1743
+ * @public
1744
+ * An element that is not supported by the Apps SDK.
1745
+ */
1746
+ export type UnsupportedElement = Unsupported & Readonly<Element>;
1747
+ /**
1748
+ * @public
1749
+ * An element state that can exist in a group content state.
1750
+ */
1751
+ export type GroupContentElementState =
1752
+ | RectElementState
1753
+ | ShapeElementState
1754
+ | EmbedElementState
1755
+ | TextElementState
1756
+ | UnsupportedElementState;
1757
+ /**
1758
+ * @public
1759
+ * An element that can exist in a group element.
1760
+ *
1761
+ * @preventInline
1762
+ */
1763
+ export type GroupContentElement =
1764
+ | RectElement
1765
+ | ShapeElement
1766
+ | EmbedElement
1767
+ | TextElement
1768
+ | UnsupportedElement;
1769
+ /**
1770
+ * @public
1771
+ * An element state that can exist on an absolute page state.
1772
+ *
1773
+ * @preventInline
1774
+ */
1775
+ export type AbsoluteElementState =
1776
+ | RectElementState
1777
+ | ShapeElementState
1778
+ | GroupElementState
1779
+ | EmbedElementState
1780
+ | TextElementState
1781
+ | UnsupportedElementState;
1782
+ /**
1783
+ * @public
1784
+ * An element that can exist on an absolute page.
1785
+ *
1786
+ * @preventInline
1787
+ */
1788
+ export type AbsoluteElement =
1789
+ | RectElement
1790
+ | ShapeElement
1791
+ | GroupElement
1792
+ | EmbedElement
1793
+ | TextElement
1794
+ | UnsupportedElement;
1795
+ /**
1796
+ * @public
1797
+ * A list of elements.
1798
+ *
1799
+ * @preventInline
1800
+ */
1801
+ export interface ElementList
1802
+ extends List<AbsoluteElementState, AbsoluteElement> {
1803
+ insertBefore(
1804
+ ref: AbsoluteElement | undefined,
1805
+ state: EmbedElementState,
1806
+ ): EmbedElement;
1807
+ insertBefore(
1808
+ ref: AbsoluteElement | undefined,
1809
+ state: TextElementState,
1810
+ ): TextElement;
1811
+ insertBefore(
1812
+ ref: AbsoluteElement | undefined,
1813
+ state: ShapeElementState,
1814
+ ): ShapeElement;
1815
+ insertBefore(
1816
+ ref: AbsoluteElement | undefined,
1817
+ state: RectElementState,
1818
+ ): RectElement;
1819
+ insertAfter(
1820
+ ref: AbsoluteElement | undefined,
1821
+ state: EmbedElementState,
1822
+ ): EmbedElement;
1823
+ insertAfter(
1824
+ ref: AbsoluteElement | undefined,
1825
+ state: TextElementState,
1826
+ ): TextElement;
1827
+ insertAfter(
1828
+ ref: AbsoluteElement | undefined,
1829
+ state: ShapeElementState,
1830
+ ): ShapeElement;
1831
+ insertAfter(
1832
+ ref: AbsoluteElement | undefined,
1833
+ state: RectElementState,
1834
+ ): RectElement;
1835
+ }
1836
+
1837
+ /**
1838
+ * @public
1839
+ * A page with either fixed or unbounded dimensions.
1840
+ *
1841
+ * @preventInline
1842
+ */
1843
+ export type AbsolutePage = {
1844
+ /**
1845
+ * The type of page.
1846
+ */
1847
+ readonly type: "absolute";
1848
+ /**
1849
+ * If `true`, the page is locked and cannot be modified.
1850
+ */
1851
+ readonly locked: boolean;
1852
+ /**
1853
+ * The dimensions of the page. `dimensions` is undefined for whiteboard pages.
1854
+ */
1855
+ readonly dimensions: Dimensions | undefined;
1856
+ /**
1857
+ * The background of the page. `background` is undefined for whiteboard pages.
1858
+ */
1859
+ readonly background: Fill | undefined;
1860
+ /**
1861
+ * The elements on the page.
1862
+ *
1863
+ * @remarks
1864
+ * Elements are rendered in the order they appear in the list.
1865
+ * Later elements appear on top of earlier ones.
1866
+ */
1867
+ readonly elements: ElementList;
1868
+ };
1869
+ /**
1870
+ * @public
1871
+ * A page in a design.
1872
+ *
1873
+ * @remarks
1874
+ * - Currently, only absolute pages are supported.
1875
+ * - Other page types are represented as `Unsupported`.
1876
+ * - Additional page types may be supported in future releases.
1877
+ */
1878
+ export type Page = AbsolutePage | Unsupported;
1879
+ {
1880
+ }
1881
+ }
1882
+
386
1883
  /**
387
1884
  * @public
388
1885
  * An element that's natively supported by the Canva editor.
@@ -397,6 +1894,21 @@ export declare type DesignElement =
397
1894
  | RichtextElement
398
1895
  | TableElement;
399
1896
 
1897
+ /**
1898
+ * @public
1899
+ * A callback for reading and updating part of a design.
1900
+ * @param session - The result of reading part of a design.
1901
+ */
1902
+ export declare type DesignOpenCallback = (
1903
+ session: DesignEditing.CurrentPageResult,
1904
+ ) => Promise<void>;
1905
+
1906
+ /**
1907
+ * @public
1908
+ * Options for configuring which part of a design to read.
1909
+ */
1910
+ export declare type DesignOpenOptions = DesignContextOptions;
1911
+
400
1912
  /**
401
1913
  * @public
402
1914
  * Provides methods for managing the lifecycle of overlays, such as selected image overlays.
@@ -499,19 +2011,9 @@ export declare const editContent: (
499
2011
  * A callback for reading and updating the requested design content.
500
2012
  * @param session - The result of reading the content in the design.
501
2013
  */
502
- export declare type EditContentCallback = (session: {
503
- /**
504
- * The individual content items returned by a query.
505
- */
506
- readonly contents: readonly RichtextContentRange[];
507
- /**
508
- * Commits any changes made to the items in the `contents` array.
509
- *
510
- * @remarks
511
- * An app must call this method for any changes to be reflected in the user's design.
512
- */
513
- sync(): Promise<void>;
514
- }) => Promise<void> | void;
2014
+ export declare type EditContentCallback = (
2015
+ session: RichtextContentSession,
2016
+ ) => Promise<void> | void;
515
2017
 
516
2018
  /**
517
2019
  * @public
@@ -1137,6 +2639,19 @@ export declare type NativeVideoElementWithBox = VideoElementAtPoint;
1137
2639
  */
1138
2640
  declare type ObjectPrimitive = Boolean | String;
1139
2641
 
2642
+ /**
2643
+ * @public
2644
+ *
2645
+ * Reads a specified part of the user's design and returns all elements in that part.
2646
+ *
2647
+ * @param options - Options for configuring how the design is read.
2648
+ * @param callback - A callback for operating on the design.
2649
+ */
2650
+ export declare const openDesign: (
2651
+ options: DesignOpenOptions,
2652
+ callback: DesignOpenCallback,
2653
+ ) => Promise<void>;
2654
+
1140
2655
  /**
1141
2656
  * @public
1142
2657
  * An alias for the DesignOverlay interface, providing access to design overlay related functionality
@@ -1325,6 +2840,15 @@ export declare interface RichtextContentRange extends RichtextRange {
1325
2840
  readonly deleted: boolean;
1326
2841
  }
1327
2842
 
2843
+ /**
2844
+ * @public
2845
+ * Session for reading and updating richtext content in a user's design.
2846
+ */
2847
+ export declare interface RichtextContentSession {
2848
+ readonly contents: readonly RichtextContentRange[];
2849
+ sync(): Promise<void>;
2850
+ }
2851
+
1328
2852
  /**
1329
2853
  * @public
1330
2854
  * An element that renders richtext content.