@canva/design 2.3.0-beta.1 → 2.4.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.
@@ -88,7 +88,6 @@ export declare type AppElementChangeHandler<A extends AppElementData> = (
88
88
  */
89
89
  version: number;
90
90
  /**
91
- * @beta
92
91
  * Function to update the app element data.
93
92
  */
94
93
  update: (opts: AppElementOptions<A>) => Promise<void>;
@@ -102,6 +101,7 @@ export declare type AppElementChangeHandler<A extends AppElementData> = (
102
101
  */
103
102
  export declare interface AppElementClient<A extends AppElementData> {
104
103
  /**
104
+ * @deprecated This type has been superseded, use `addElement` or `registerOnElementChange` instead.
105
105
  * If an app element is selected, the element's data is overwritten and the element is re-rendered.
106
106
  * Otherwise, the provided data is used to create a new app element.
107
107
  * @param appElementData - The data to attach to the app element. Existing data will be overwritten.
@@ -109,7 +109,6 @@ export declare interface AppElementClient<A extends AppElementData> {
109
109
  */
110
110
  addOrUpdateElement(appElementData: A, placement?: Placement): Promise<void>;
111
111
  /**
112
- * @beta
113
112
  * Adds a new app element to the design.
114
113
  * @param opts - The data and placement of the app element.
115
114
  */
@@ -144,7 +143,7 @@ export declare type AppElementClientConfiguration<A extends AppElementData> = {
144
143
  export declare type AppElementData = Record<string, Value>;
145
144
 
146
145
  /**
147
- * @beta
146
+ * @public
148
147
  * Used to add or update an app element to the design.
149
148
  * The update function is provided in the AppElementChangeHandler callback (registerOnElementChange).
150
149
  */
@@ -384,730 +383,6 @@ export declare type Coordinates = {
384
383
  */
385
384
  export declare const createRichtextRange: () => RichtextRange;
386
385
 
387
- /**
388
- * @beta
389
- * Describes a part of a design.
390
- */
391
- export declare type DesignContext = DesignContextOptions["type"];
392
-
393
- /**
394
- * @beta
395
- * Options for configuring which part of a design to read.
396
- */
397
- declare type DesignContextOptions = {
398
- /**
399
- * The type of context.
400
- */
401
- type: "current_page";
402
- };
403
-
404
- /**
405
- * @beta
406
- * Provides methods for reading and updating the structure and content of a design.
407
- */
408
- export declare namespace DesignEditing {
409
- /**
410
- * @beta
411
- * A snapshot containing a fragment of a design's structure and content.
412
- */
413
- export type DesignDraft<D> = Readonly<D> & {
414
- /**
415
- * Saves any changes made to the draft.
416
- *
417
- * @remarks
418
- * - Any changes to the draft are only reflected in the design after this method is called.
419
- * - Once this method is called, further changes to the draft are not possible.
420
- */
421
- save(): Promise<void>;
422
- };
423
- /**
424
- * @beta
425
- * Options for creating an image fill in the element builder
426
- */
427
- export type ImageFillOpts = Partial<ImageFill> &
428
- Required<Pick<ImageFill, "type" | "imageRef">>;
429
- /**
430
- * @beta
431
- * Options for creating a video fill in the element builder
432
- */
433
- export type VideoFillOpts = Partial<VideoFill> &
434
- Required<Pick<VideoFill, "type" | "videoRef">>;
435
- /**
436
- * @beta
437
- * Options for creating a media fill in the element builder
438
- */
439
- export type MediaFillOpts = ImageFillOpts | VideoFillOpts;
440
- /**
441
- * @beta
442
- * Options for creating a fill in the element builder
443
- */
444
- export type FillOpts =
445
- | {
446
- color: ColorFillOpts;
447
- media?: MediaFillOpts;
448
- }
449
- | {
450
- color?: ColorFillOpts;
451
- media: MediaFillOpts;
452
- };
453
- /**
454
- * @beta
455
- */
456
- export type ColorFillOpts = Exclude<ColorFill, Unsupported>;
457
- /**
458
- * @beta
459
- * Options for creating a stroke in the element builder
460
- */
461
- export type StrokeOpts = Pick<Stroke, "weight"> & {
462
- color: ColorFillOpts;
463
- };
464
- /**
465
- * @beta
466
- * Options for creating a shape path in the element builder
467
- */
468
- export type PathOpts = Pick<Path, "d"> & {
469
- fill?: FillOpts;
470
- stroke?: StrokeOpts;
471
- };
472
- /**
473
- * @beta
474
- * Options for creating a rect element.
475
- */
476
- export type CreateRectElementOpts = Required<
477
- Pick<RectElement, "top" | "left" | "width" | "height">
478
- > & {
479
- fill?: FillOpts;
480
- } & {
481
- stroke?: StrokeOpts;
482
- } & Partial<Omit<RectElement, "fill" | "stroke" | "type">>;
483
- /**
484
- * @beta
485
- * Options for creating a shape element.
486
- */
487
- export type CreateShapeElementOpts = Required<
488
- Pick<ShapeElement, "top" | "left" | "width" | "height" | "viewBox">
489
- > & {
490
- paths: PathOpts[];
491
- } & Partial<Omit<ShapeElement, "type" | "paths">>;
492
- /**
493
- * @beta
494
- * Options for creating an embed element.
495
- */
496
- export type CreateEmbedElementOpts = Required<
497
- Pick<EmbedElement, "top" | "left" | "width" | "height" | "url">
498
- > &
499
- Partial<Omit<EmbedElement, "type">>;
500
- /**
501
- * @beta
502
- * Options for creating a text element.
503
- */
504
- export type CreateTextElementOpts = Required<
505
- Pick<TextElement, "top" | "left" | "width" | "text">
506
- > &
507
- Partial<Omit<TextElement, "type" | "height">>;
508
- /**
509
- * @beta
510
- * Provides methods for creating elements.
511
- *
512
- * @remarks
513
- * These methods don't add the elements to the design. They only return elements that can
514
- * be added to a design, such as with the `insertAfter` method.
515
- */
516
- export interface ElementBuilder {
517
- /**
518
- * Creates a rect element.
519
- * @param opts - Options for creating the rect element.
520
- */
521
- createRectElement(opts: CreateRectElementOpts): RectElement;
522
- /**
523
- * Creates a shape element.
524
- * @param opts - Options for creating the shape element.
525
- */
526
- createShapeElement(opts: CreateShapeElementOpts): ShapeElement;
527
- /**
528
- * Creates an embed element.
529
- * @param opts - Options for creating the embed element.
530
- */
531
- createEmbedElement(opts: CreateEmbedElementOpts): EmbedElement;
532
- /**
533
- * Creates a text element.
534
- * @param opts - Options for creating the text element.
535
- */
536
- createTextElement(opts: CreateTextElementOpts): TextElement;
537
- /**
538
- * Creates a richtext range.
539
- */
540
- createRichtextRange(): RichtextRange;
541
- /**
542
- * Creates a clone of an element.
543
- * @returns a new element with the same properties as the argument.
544
- */
545
- cloneElement(element: RectElement): RectElement;
546
- cloneElement(element: ShapeElement): ShapeElement;
547
- cloneElement(element: EmbedElement): EmbedElement;
548
- cloneElement(element: TextElement): TextElement;
549
- cloneElement(
550
- element: RectElement | ShapeElement | EmbedElement | TextElement,
551
- ): RectElement | ShapeElement | EmbedElement | TextElement;
552
- }
553
- /**
554
- * @beta
555
- * The result of reading part of a design when the context is the current page.
556
- */
557
- export type CurrentPageResult = DesignDraft<{
558
- /**
559
- * The current page of the design.
560
- */
561
- page: FixedPage;
562
- }>;
563
- /**
564
- * @beta
565
- * The result of reading part of a design.
566
- */
567
- export type DesignOpenResult = CurrentPageResult;
568
- /**
569
- * A function called for each item in the list.
570
- *
571
- * @param item - The current item in the list.
572
- * @param index - The index of the current item.
573
- */
574
- export type ForEachCallback<T> = (item: T, index: number) => void;
575
- /**
576
- * A function that determines if an item should be included in the result.
577
- *
578
- * @param item - The item to test.
579
- * @returns `true` if the item should be included, otherwise `false`.
580
- */
581
- export type FilterPredicate<T> = (item: T) => boolean;
582
- /**
583
- * A type predicate function that determines if an item is of a specific type.
584
- *
585
- * @param item - The item to test.
586
- * @returns `true` if the item is of type `C`, otherwise `false`.
587
- */
588
- export type TypeFilterPredicate<T, C extends T> = (item: T) => item is C;
589
- /**
590
- * A list that cannot be changed.
591
- */
592
- export interface ReadableList<T> {
593
- /**
594
- * Gets the number of items in the list.
595
- *
596
- * @returns The number of items.
597
- */
598
- count(): number;
599
- /**
600
- * Converts the list to an array.
601
- *
602
- * @returns An array containing all items. The items are the same as in the list.
603
- */
604
- toArray(): readonly T[];
605
- /**
606
- * Executes a function for each item in the list.
607
- *
608
- * @param callback - The function to run for each item.
609
- */
610
- forEach(callback: ForEachCallback<T>): void;
611
- /**
612
- * Creates a new array with items that match a specific type.
613
- *
614
- * @param filter - A function that checks if an item is of type `C`.
615
- * @returns An array of items that are of type `C`.
616
- */
617
- filter<C extends T>(filter: TypeFilterPredicate<T, C>): readonly C[];
618
- /**
619
- * Creates a new array with items that pass a test.
620
- *
621
- * @param filter - A function that tests each item. Returns `true` to keep the item.
622
- * @returns An array of items that passed the test.
623
- */
624
- filter(filter: FilterPredicate<T>): readonly T[];
625
- }
626
- /**
627
- * @beta
628
- * A list of items that can be changed.
629
- */
630
- export interface MutableList<T> {
631
- /**
632
- * Adds a copy of an item to the list and places it right before another item.
633
- *
634
- * @param ref - The existing item to place the new item before.
635
- * If `ref` is `undefined`, the new item is added at the end of the list.
636
- * If `ref` does not exist in the list, the operation fails.
637
- *
638
- * @param item - The item to add. A copy of this item will be inserted.
639
- *
640
- * @returns
641
- * The added item, or `undefined` if the operation failed.
642
- */
643
- insertBefore(ref: T | undefined, item: T): T | undefined;
644
- /**
645
- * Adds a copy of an item to the list and places it right after another item.
646
- *
647
- * @param ref - The existing item to place the new item after.
648
- * If `ref` is `undefined`, the new item is added at the end of the list.
649
- * If `ref` does not exist in the list, the operation fails.
650
- *
651
- * @param item - The item to add. A copy of this item will be inserted.
652
- *
653
- * @returns
654
- * The added item, or `undefined` if the operation failed.
655
- */
656
- insertAfter(ref: T | undefined, item: T): T | undefined;
657
- /**
658
- * Moves an existing item to a new position right before another item.
659
- *
660
- * @param ref - The existing item to move the item before.
661
- * If `ref` is `undefined`, the item is moved to the end of the list.
662
- * If `ref` does not exist in the list, the operation fails.
663
- *
664
- * @param item - The item to move.
665
- * The operation fails if the item is not already in the list.
666
- */
667
- moveBefore(ref: T | undefined, item: T): void;
668
- /**
669
- * Moves an existing item to a new position right after another item.
670
- *
671
- * @param ref - The existing item to move the item after.
672
- * If `ref` is `undefined`, the item is moved to the end of the list.
673
- * If `ref` does not exist in the list, the operation fails.
674
- *
675
- * @param item - The item to move.
676
- * The operation fails if the item is not already in the list.
677
- */
678
- moveAfter(ref: T | undefined, item: T): void;
679
- /**
680
- * Removes an item from the list.
681
- *
682
- * @param item - The item to remove from the list.
683
- */
684
- delete(item: T): void;
685
- }
686
- /**
687
- * @beta
688
- * A list of items that can be read and updated.
689
- */
690
- export interface List<T> extends ReadableList<T>, MutableList<T> {}
691
- /**
692
- * @beta
693
- * Represents an element that's not supported by the Apps SDK.
694
- */
695
- export interface Unsupported {
696
- /**
697
- * The type of element.
698
- */
699
- readonly type: "unsupported";
700
- }
701
- /**
702
- * @beta
703
- * A single valid character in a hex code.
704
- */
705
- export type Hex = `123456790abcdef`[number];
706
- /**
707
- * @beta
708
- * A six-character hexadecimal color code prefixed with a `#`.
709
- */
710
- export type HexCode = `#${Hex}${Hex}${Hex}${Hex}${Hex}${Hex}`;
711
- /**
712
- * @beta
713
- * A set of dimensions.
714
- */
715
- export interface Dimensions {
716
- /**
717
- * A width, in pixels.
718
- */
719
- readonly width: number;
720
- /**
721
- * A height, in pixels.
722
- */
723
- readonly height: number;
724
- }
725
- /**
726
- * @beta
727
- * An image that fills the interior of a path.
728
- */
729
- export interface ImageFill {
730
- /**
731
- * The type of media.
732
- */
733
- readonly type: "image";
734
- /**
735
- * A unique identifier that points to an image asset in Canva's backend.
736
- */
737
- imageRef: ImageRef;
738
- /**
739
- * If `true`, the image is flipped horizontally.
740
- */
741
- flipX: boolean;
742
- /**
743
- * If `true`, the image is flipped vertically.
744
- */
745
- flipY: boolean;
746
- }
747
- /**
748
- * @beta
749
- * A video that fills the interior of a path.
750
- */
751
- export interface VideoFill {
752
- /**
753
- * The type of media.
754
- */
755
- readonly type: "video";
756
- /**
757
- * A unique identifier that points to a video asset in Canva's backend.
758
- */
759
- videoRef: VideoRef;
760
- /**
761
- * If `true`, the video is flipped horizontally.
762
- */
763
- flipX: boolean;
764
- /**
765
- * If `true`, the video is flipped vertically.
766
- */
767
- flipY: boolean;
768
- }
769
- /**
770
- * @beta
771
- * A media item that fills the interior of a path.
772
- */
773
- export type MediaFill = ImageFill | VideoFill;
774
- /**
775
- * @beta
776
- * A solid color that fills the interior of a path.
777
- */
778
- export interface SolidFill {
779
- /**
780
- * The type of color.
781
- */
782
- readonly type: "solid";
783
- /**
784
- * The color of the fill, as a hex code.
785
- *
786
- * @remarks
787
- * - Must be six characters long.
788
- * - Must start with a `#`.
789
- * - Must use lowercase letters.
790
- */
791
- color: HexCode;
792
- }
793
- /**
794
- * @beta
795
- * A color that fills the interior of a path.
796
- */
797
- export type ColorFill = SolidFill | Unsupported;
798
- /**
799
- * @beta
800
- * Describes how a path is filled with color or media.
801
- *
802
- * @remarks
803
- * If both `media` and `color` are defined, `media` takes precedence.
804
- */
805
- export interface Fill {
806
- /**
807
- * The media fill for the path, if any.
808
- */
809
- media: MediaFill | undefined;
810
- /**
811
- * The color fill for the path, if any.
812
- */
813
- color: ColorFill | undefined;
814
- }
815
- /**
816
- * @beta
817
- * The scale and cropping of a shape.
818
- *
819
- * @remarks
820
- * This is similar to the `viewBox` attribute of an `SVGElement`.
821
- */
822
- export type AlignedBox = {
823
- /**
824
- * The distance of the shape from the top edge of the element, in pixels.
825
- */
826
- readonly top: number;
827
- /**
828
- * The distance of the shape from the left edge of the element, in pixels.
829
- */
830
- readonly left: number;
831
- /**
832
- * The width of the view box, in pixels.
833
- */
834
- readonly width: number;
835
- /**
836
- * The height of the view box, in pixels.
837
- */
838
- readonly height: number;
839
- };
840
- /**
841
- * @beta
842
- * A path that defines the structure of a shape element.
843
- */
844
- export interface Path {
845
- /**
846
- * The shape of the path.
847
- *
848
- * @remarks
849
- * This is similar to the `d` attribute of an SVG's `path` element, with some limitations:
850
- *
851
- * - Must start with an `M` command.
852
- * - Only one `M` command is allowed.
853
- * - `Q` and `T` commands are not permitted.
854
- * - The path must be closed using a `Z` command or matching start and end coordinates.
855
- */
856
- readonly d: string;
857
- /**
858
- * The appearance of the path's interior.
859
- */
860
- readonly fill: Fill;
861
- /**
862
- * The stroke (outline) of the path, if any.
863
- */
864
- readonly stroke: Stroke | undefined;
865
- }
866
- /**
867
- * @beta
868
- * Represents an outline, such as the border of an element.
869
- */
870
- export interface Stroke {
871
- /**
872
- * The weight (thickness) of the stroke.
873
- *
874
- * @remarks
875
- * - Minimum: 0
876
- * - Maximum: 100
877
- */
878
- weight: number;
879
- /**
880
- * The color of the stroke.
881
- */
882
- color: ColorFill;
883
- }
884
- /**
885
- * @beta
886
- * The basic properties of an element.
887
- *
888
- * @remarks
889
- * These properties are shared by all elements in a design.
890
- */
891
- export interface Element extends Dimensions {
892
- /**
893
- * If `true`, the element is locked and cannot be modified.
894
- */
895
- readonly locked: boolean;
896
- /**
897
- * The distance from the top edge of the container, in pixels.
898
- *
899
- * @remarks
900
- * - The pixels are relative to their container.
901
- * - Minimum: -32768
902
- * - Maximum: 32767
903
- */
904
- top: number;
905
- /**
906
- * The distance from the left edge of the container, in pixels.
907
- *
908
- * @remarks
909
- * - The pixels are relative to their container.
910
- * - Minimum: -32768
911
- * - Maximum: 32767
912
- */
913
- left: number;
914
- /**
915
- * A rotation, in degrees.
916
- *
917
- * @remarks
918
- * - Minimum: -180
919
- * - Maximum: 180
920
- */
921
- rotation: number;
922
- /**
923
- * Transparency as a percentage.
924
- *
925
- * @remarks
926
- * - Minimum: 0
927
- * - Maximum: 1
928
- */
929
- transparency: number;
930
- }
931
- /**
932
- * @beta
933
- * Represents a rectangular element.
934
- */
935
- export interface Rect {
936
- /**
937
- * The type of content.
938
- */
939
- readonly type: "rect";
940
- /**
941
- * The appearance of the rectangle's interior.
942
- */
943
- readonly fill: Fill;
944
- /**
945
- * The outline of the rectangle.
946
- */
947
- readonly stroke: Stroke;
948
- }
949
- /**
950
- * @beta
951
- * Represents a vector shape element.
952
- */
953
- export interface Shape {
954
- /**
955
- * The type of content.
956
- */
957
- readonly type: "shape";
958
- /**
959
- * The scale and cropping of the shape.
960
- */
961
- viewBox: AlignedBox;
962
- /**
963
- * The paths that define the structure of the shape.
964
- *
965
- * @remarks
966
- * - Must have between 1 and 30 paths.
967
- * - Total size of all paths must not exceed 2kb.
968
- * - Maximum of 6 unique fill colors across all paths.
969
- */
970
- readonly paths: ReadableList<Path>;
971
- }
972
- /**
973
- * @beta
974
- * Represents group content.
975
- */
976
- export interface Group<C> {
977
- /**
978
- * The type of content.
979
- */
980
- readonly type: "group";
981
- /**
982
- * The elements that exist within the group.
983
- */
984
- readonly contents: ReadableList<C>;
985
- }
986
- /**
987
- * @beta
988
- * Represents rich media content.
989
- */
990
- export interface Embed {
991
- /**
992
- * The type of content.
993
- */
994
- readonly type: "embed";
995
- /**
996
- * The URL of the rich media.
997
- *
998
- * @remarks
999
- * This URL must be supported by the Iframely API.
1000
- */
1001
- readonly url: string;
1002
- }
1003
- /**
1004
- * @beta
1005
- * Represents text content.
1006
- */
1007
- export interface Text {
1008
- /**
1009
- * The type of content.
1010
- */
1011
- readonly type: "text";
1012
- /**
1013
- * The text content.
1014
- */
1015
- readonly text: RichtextRange;
1016
- }
1017
- /**
1018
- * @beta
1019
- * An element that renders a rectangle.
1020
- *
1021
- * @remarks
1022
- * The rectangle can be filled with image content, video content, or a solid color.
1023
- */
1024
- export interface RectElement extends Rect, Element {}
1025
- /**
1026
- * @beta
1027
- * An element that renders a vector shape.
1028
- */
1029
- export interface ShapeElement extends Shape, Element {}
1030
- /**
1031
- * @beta
1032
- * An element that renders a group of other elements.
1033
- */
1034
- export interface GroupElement extends Group<GroupContentElement>, Element {}
1035
- /**
1036
- * @beta
1037
- * An element that embeds rich media, such as a YouTube video.
1038
- */
1039
- export interface EmbedElement extends Embed, Element {}
1040
- /**
1041
- * @beta
1042
- * An element that renders text content.
1043
- */
1044
- export interface TextElement extends Text, Element {}
1045
- /**
1046
- * @beta
1047
- * An element that is not supported by the Apps SDK.
1048
- */
1049
- export interface UnsupportedElement extends Unsupported, Element {}
1050
- /**
1051
- * @beta
1052
- * An element that can exist in a group element.
1053
- */
1054
- export type GroupContentElement =
1055
- | RectElement
1056
- | ShapeElement
1057
- | EmbedElement
1058
- | TextElement
1059
- | UnsupportedElement;
1060
- /**
1061
- * @beta
1062
- * An element that can exist on a fixed page.
1063
- */
1064
- export type FixedElement =
1065
- | RectElement
1066
- | ShapeElement
1067
- | GroupElement
1068
- | EmbedElement
1069
- | TextElement
1070
- | UnsupportedElement;
1071
- /**
1072
- * @beta
1073
- * A page with fixed dimensions.
1074
- */
1075
- export interface FixedPage {
1076
- /**
1077
- * The type of page.
1078
- */
1079
- readonly type: "fixed";
1080
- /**
1081
- * If `true`, the page is locked and cannot be modified.
1082
- */
1083
- readonly locked: boolean;
1084
- /**
1085
- * The dimensions of the page. `dimensions` is undefined for whiteboard pages.
1086
- */
1087
- readonly dimensions: Dimensions | undefined;
1088
- /**
1089
- * The background of the page. `background` is undefined for whiteboard pages.
1090
- */
1091
- readonly background: Fill | undefined;
1092
- /**
1093
- * The elements on the page.
1094
- *
1095
- * @remarks
1096
- * Elements are rendered in the order they appear in the list.
1097
- * Later elements appear on top of earlier ones.
1098
- */
1099
- readonly elements: List<FixedElement>;
1100
- }
1101
- /**
1102
- * @beta
1103
- * A page in a design.
1104
- */
1105
- export type Page = FixedPage | Unsupported;
1106
-
1107
- {
1108
- }
1109
- }
1110
-
1111
386
  /**
1112
387
  * @public
1113
388
  * An element that's natively supported by the Canva editor.
@@ -1122,28 +397,6 @@ export declare type DesignElement =
1122
397
  | RichtextElement
1123
398
  | TableElement;
1124
399
 
1125
- /**
1126
- * @beta
1127
- * A callback for reading and updating part of a design.
1128
- * @param draft - The result of reading part of a design.
1129
- * @param helpers - Helper methods for reading and updating the design.
1130
- */
1131
- export declare type DesignOpenCallback = (
1132
- draft: DesignEditing.DesignOpenResult,
1133
- helpers: {
1134
- /**
1135
- * Provides methods for creating elements.
1136
- */
1137
- elementBuilder: DesignEditing.ElementBuilder;
1138
- },
1139
- ) => Promise<void> | void;
1140
-
1141
- /**
1142
- * @beta
1143
- * Options for configuring which part of a design to read.
1144
- */
1145
- export declare type DesignOpenOptions = DesignContextOptions;
1146
-
1147
400
  /**
1148
401
  * @public
1149
402
  * Provides methods for managing the lifecycle of overlays, such as selected image overlays.
@@ -1492,7 +745,7 @@ export declare type Fill = {
1492
745
  * The hex code must include all six characters and be prefixed with a `#` symbol.
1493
746
  *
1494
747
  * @example
1495
- * " #ff0099"
748
+ * "#ff0099"
1496
749
  */
1497
750
  color?: string;
1498
751
  /**
@@ -1698,7 +951,7 @@ export declare type ImageRef = string & {
1698
951
  };
1699
952
 
1700
953
  /**
1701
- * @beta
954
+ * @public
1702
955
  * @param appElementConfig - Configuration for an AppElementClient
1703
956
  */
1704
957
  export declare const initAppElement: <A extends AppElementData>(
@@ -1884,23 +1137,6 @@ export declare type NativeVideoElementWithBox = VideoElementAtPoint;
1884
1137
  */
1885
1138
  declare type ObjectPrimitive = Boolean | String;
1886
1139
 
1887
- /**
1888
- * @beta
1889
- * Reads a specified part of the user's design and returns all elements in that part.
1890
- *
1891
- * @param options - Options for configuring how the design is read.
1892
- * @param callback - A callback for operating on the design.
1893
- */
1894
- export declare const openDesign: (
1895
- options: DesignOpenOptions,
1896
- callback: (
1897
- draft: DesignEditing.DesignOpenResult,
1898
- helpers: {
1899
- elementBuilder: DesignEditing.ElementBuilder;
1900
- },
1901
- ) => Promise<void> | void,
1902
- ) => Promise<void>;
1903
-
1904
1140
  /**
1905
1141
  * @public
1906
1142
  * An alias for the DesignOverlay interface, providing access to design overlay related functionality
@@ -2561,11 +1797,6 @@ export declare type TextDragConfig = {
2561
1797
  * @defaultValue "none"
2562
1798
  */
2563
1799
  decoration?: "none" | "underline";
2564
- /**
2565
- * @beta
2566
- * A unique identifier that points to a font asset in Canva's backend.
2567
- */
2568
- fontRef?: FontRef;
2569
1800
  };
2570
1801
 
2571
1802
  /**
@@ -1,21 +1,7 @@
1
- "use strict";
1
+ "use strict"
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- function _export(target, all) {
6
- for(var name in all)Object.defineProperty(target, name, {
7
- enumerable: true,
8
- get: all[name]
9
- });
10
- }
11
- _export(exports, {
12
- initAppElement: function() {
13
- return initAppElement;
14
- },
15
- openDesign: function() {
16
- return openDesign;
17
- }
18
- });
19
5
  _export_star(require("./public"), exports);
20
6
  function _export_star(from, to) {
21
7
  Object.keys(from).forEach(function(k) {
@@ -31,7 +17,4 @@ function _export_star(from, to) {
31
17
  return from;
32
18
  }
33
19
  var _window___canva___sdkRegistration, _window___canva__;
34
- const { canva_sdk } = window;
35
- const initAppElement = canva_sdk.design.v2.designInteraction.initAppElement;
36
- const openDesign = canva_sdk.design.v2.designInteraction.openDesign;
37
- (_window___canva__ = window.__canva__) === null || _window___canva__ === void 0 ? void 0 : (_window___canva___sdkRegistration = _window___canva__.sdkRegistration) === null || _window___canva___sdkRegistration === void 0 ? void 0 : _window___canva___sdkRegistration.registerPackageVersion('design', '2.3.0', 'beta');
20
+ (_window___canva__ = window.__canva__) === null || _window___canva__ === void 0 ? void 0 : (_window___canva___sdkRegistration = _window___canva__.sdkRegistration) === null || _window___canva___sdkRegistration === void 0 ? void 0 : _window___canva___sdkRegistration.registerPackageVersion('design', '2.4.0', 'ga');
@@ -9,53 +9,53 @@ function _export(target, all) {
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- selection: function() {
13
- return selection;
14
- },
15
- overlay: function() {
16
- return overlay;
17
- },
18
- addPage: function() {
19
- return addPage;
20
- },
21
- setCurrentPageBackground: function() {
22
- return setCurrentPageBackground;
23
- },
24
- getDefaultPageDimensions: function() {
25
- return getDefaultPageDimensions;
12
+ addAudioTrack: function() {
13
+ return addAudioTrack;
26
14
  },
27
- requestExport: function() {
28
- return requestExport;
15
+ addElementAtCursor: function() {
16
+ return addElementAtCursor;
29
17
  },
30
- ui: function() {
31
- return ui;
18
+ addElementAtPoint: function() {
19
+ return addElementAtPoint;
32
20
  },
33
21
  addNativeElement: function() {
34
22
  return addNativeElement;
35
23
  },
36
- addElementAtPoint: function() {
37
- return addElementAtPoint;
24
+ addPage: function() {
25
+ return addPage;
38
26
  },
39
- addElementAtCursor: function() {
40
- return addElementAtCursor;
27
+ createRichtextRange: function() {
28
+ return createRichtextRange;
41
29
  },
42
- addAudioTrack: function() {
43
- return addAudioTrack;
30
+ editContent: function() {
31
+ return editContent;
44
32
  },
45
33
  getCurrentPageContext: function() {
46
34
  return getCurrentPageContext;
47
35
  },
48
- initAppElement: function() {
49
- return initAppElement;
36
+ getDefaultPageDimensions: function() {
37
+ return getDefaultPageDimensions;
50
38
  },
51
39
  getDesignToken: function() {
52
40
  return getDesignToken;
53
41
  },
54
- createRichtextRange: function() {
55
- return createRichtextRange;
42
+ initAppElement: function() {
43
+ return initAppElement;
56
44
  },
57
- editContent: function() {
58
- return editContent;
45
+ overlay: function() {
46
+ return overlay;
47
+ },
48
+ requestExport: function() {
49
+ return requestExport;
50
+ },
51
+ selection: function() {
52
+ return selection;
53
+ },
54
+ setCurrentPageBackground: function() {
55
+ return setCurrentPageBackground;
56
+ },
57
+ ui: function() {
58
+ return ui;
59
59
  }
60
60
  });
61
61
  const { canva_sdk } = window;
@@ -9,12 +9,12 @@ function _export(target, all) {
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- getCanvaSdk: function() {
13
- return getCanvaSdk;
14
- },
15
12
  assertIsTestCanvaSdk: function() {
16
13
  return assertIsTestCanvaSdk;
17
14
  },
15
+ getCanvaSdk: function() {
16
+ return getCanvaSdk;
17
+ },
18
18
  injectFakeAPIClients: function() {
19
19
  return injectFakeAPIClients;
20
20
  }
@@ -1,6 +1,3 @@
1
1
  var _window___canva___sdkRegistration, _window___canva__;
2
- const { canva_sdk } = window;
3
- export const initAppElement = canva_sdk.design.v2.designInteraction.initAppElement;
4
- export const openDesign = canva_sdk.design.v2.designInteraction.openDesign;
5
2
  export * from './public';
6
- (_window___canva__ = window.__canva__) === null || _window___canva__ === void 0 ? void 0 : (_window___canva___sdkRegistration = _window___canva__.sdkRegistration) === null || _window___canva___sdkRegistration === void 0 ? void 0 : _window___canva___sdkRegistration.registerPackageVersion('design', '2.3.0', 'beta');
3
+ (_window___canva__ = window.__canva__) === null || _window___canva__ === void 0 ? void 0 : (_window___canva___sdkRegistration = _window___canva__.sdkRegistration) === null || _window___canva___sdkRegistration === void 0 ? void 0 : _window___canva___sdkRegistration.registerPackageVersion('design', '2.4.0', 'ga');
package/package.json CHANGED
@@ -1,25 +1,25 @@
1
1
  {
2
2
  "name": "@canva/design",
3
- "version": "2.3.0-beta.1",
3
+ "version": "2.4.0",
4
4
  "description": "The Canva Apps SDK design library",
5
5
  "author": "Canva Pty Ltd.",
6
6
  "license": "SEE LICENSE IN LICENSE.md FILE",
7
7
  "peerDependencies": {
8
8
  "@canva/error": "^2.0.0"
9
9
  },
10
- "main": "./lib/cjs/sdk/design/beta.js",
11
- "module": "./lib/esm/sdk/design/beta.js",
10
+ "main": "./lib/cjs/sdk/design/index.js",
11
+ "module": "./lib/esm/sdk/design/index.js",
12
12
  "exports": {
13
13
  ".": {
14
- "types": "./beta.d.ts",
15
- "require": "./lib/cjs/sdk/design/beta.js",
16
- "import": "./lib/esm/sdk/design/beta.js"
14
+ "types": "./index.d.ts",
15
+ "require": "./lib/cjs/sdk/design/index.js",
16
+ "import": "./lib/esm/sdk/design/index.js"
17
17
  },
18
18
  "./test": {
19
- "types": "./test/beta.d.ts",
20
- "require": "./lib/cjs/sdk/design/test/beta.js",
21
- "import": "./lib/esm/sdk/design/test/beta.js"
19
+ "types": "./test/index.d.ts",
20
+ "require": "./lib/cjs/sdk/design/test/index.js",
21
+ "import": "./lib/esm/sdk/design/test/index.js"
22
22
  }
23
23
  },
24
- "typings": "./beta.d.ts"
24
+ "typings": "./index.d.ts"
25
25
  }
@@ -1,18 +0,0 @@
1
- "use strict"
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- _export_star(require("./index"), exports);
6
- function _export_star(from, to) {
7
- Object.keys(from).forEach(function(k) {
8
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
9
- Object.defineProperty(to, k, {
10
- enumerable: true,
11
- get: function() {
12
- return from[k];
13
- }
14
- });
15
- }
16
- });
17
- return from;
18
- }
@@ -1 +0,0 @@
1
- export * from './index';
File without changes