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