@cesdk/cesdk-js 1.4.0 → 1.4.3

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/BlockAPI.d.ts CHANGED
@@ -10,6 +10,7 @@ type Size2 = {
10
10
  width: number;
11
11
  height: number;
12
12
  };
13
+ type RGBA = [r: number, g: number, b: number, a: number];
13
14
 
14
15
  export enum PositionMode {
15
16
  /** Position in absolute design units. */
@@ -29,6 +30,16 @@ export enum SizeMode {
29
30
  Auto = 'Auto'
30
31
  }
31
32
 
33
+ export enum PropertyType {
34
+ Bool = 'Bool',
35
+ Int = 'Int',
36
+ Float = 'Float',
37
+ String = 'String',
38
+ Color = 'Color',
39
+ Enum = 'Enum',
40
+ Struct = 'Struct'
41
+ }
42
+
32
43
  export default class BlockAPI {
33
44
  /**
34
45
  * Exports a design block element as a file of the given mime type.
@@ -390,4 +401,385 @@ export default class BlockAPI {
390
401
  * @return UBQResult<float> The height of the axis-aligned bounding box.
391
402
  */
392
403
  getGlobalBoundingBoxHeight(id: DesignBlockId): number;
404
+
405
+ /**
406
+ * Get all available properties of a block.
407
+ * @param id The block whose properties should be queried.
408
+ * @returns A list of the property names.
409
+ */
410
+ findAllProperties(id: DesignBlockId): string[];
411
+
412
+ /**
413
+ * Get the type of a property given its name.
414
+ * @param property The name of the property whose type should be queried.
415
+ * @returns The property type.
416
+ */
417
+ getPropertyType(property: string): PropertyType;
418
+
419
+ /**
420
+ * Get all the possible values of an enum given an enum property.
421
+ * @param enumProperty The name of the property whose enum values should be queried.
422
+ * @returns A list of the enum value names as string.
423
+ */
424
+ getEnumValues<T = string>(enumProperty: string): T[];
425
+
426
+ /**
427
+ * Set a bool property of the given design block to the given value.
428
+ * @param id The block whose property should be set.
429
+ * @param property The name of the property to set.
430
+ * @param value The value to set.
431
+ */
432
+ setBool(id: DesignBlockId, property: string, value: boolean): void;
433
+
434
+ /**
435
+ * Get the value of a bool property of the given design block.
436
+ * @param id The block whose property should be queried.
437
+ * @param property The name of the property to query.
438
+ * @returns The value of the property.
439
+ */
440
+ getBool(id: DesignBlockId, property: string): boolean;
441
+
442
+ /**
443
+ * Set an int property of the given design block to the given value.
444
+ * @param id The block whose property should be set.
445
+ * @param property The name of the property to set.
446
+ * @param value The value to set.
447
+ */
448
+ setInt(id: DesignBlockId, property: string, value: number): void;
449
+
450
+ /**
451
+ * Get the value of an int property of the given design block.
452
+ * @param id The block whose property should be queried.
453
+ * @param property The name of the property to query.
454
+ * @returns The value of the property.
455
+ */
456
+ getInt(id: DesignBlockId, property: string): number;
457
+
458
+ /**
459
+ * Set a float property of the given design block to the given value.
460
+ * @param id The block whose property should be set.
461
+ * @param property The name of the property to set.
462
+ * @param value The value to set.
463
+ */
464
+ setFloat(id: DesignBlockId, property: string, value: number): void;
465
+
466
+ /**
467
+ * Get the value of a float property of the given design block.
468
+ * @param id The block whose property should be queried.
469
+ * @param property The name of the property to query.
470
+ * @returns The value of the property.
471
+ */
472
+ getFloat(id: DesignBlockId, property: string): number;
473
+
474
+ /**
475
+ * Set a string property of the given design block to the given value.
476
+ * @param id The block whose property should be set.
477
+ * @param property The name of the property to set.
478
+ * @param value The value to set.
479
+ */
480
+ setString(id: DesignBlockId, property: string, value: string): void;
481
+
482
+ /**
483
+ * Get the value of a string property of the given design block.
484
+ * @param id The block whose property should be queried.
485
+ * @param property The name of the property to query.
486
+ * @returns The value of the property.
487
+ */
488
+ getString(id: DesignBlockId, property: string): string;
489
+
490
+ /**
491
+ * Set a color property of the given design block to the given value.
492
+ * @param id The block whose property should be set.
493
+ * @param property The name of the property to set.
494
+ * @param r The red color component in the range of 0 to 1.
495
+ * @param g The green color component in the range of 0 to 1.
496
+ * @param b The blue color component in the range of 0 to 1.
497
+ * @param a The alpha color component in the range of 0 to 1.
498
+ */
499
+ setColorRGBA(
500
+ id: DesignBlockId,
501
+ property: string,
502
+ r: number,
503
+ g: number,
504
+ b: number,
505
+ a: number
506
+ ): void;
507
+
508
+ /**
509
+ * Get the value of a string property of the given design block.
510
+ * @param id The block whose property should be queried.
511
+ * @param property The name of the property to query.
512
+ * @returns A tuple of channels red, green, blue and alpha in the range of 0 to 1.
513
+ */
514
+ getColorRGBA(id: DesignBlockId, property: string): RGBA;
515
+
516
+ /**
517
+ * Set an enum property of the given design block to the given value.
518
+ * @param block The block whose property should be set.
519
+ * @param property The name of the property to set.
520
+ * @param value The enum value as string.
521
+ */
522
+ setEnum(id: DesignBlockId, property: string, value: string): void;
523
+
524
+ /**
525
+ * Get the value of an enum property of the given design block.
526
+ * @param block The block whose property should be queried.
527
+ * @param property The name of the property to query.
528
+ * @returns The value as string.
529
+ */
530
+ getEnum(id: DesignBlockId, property: string): string;
531
+
532
+ /**
533
+ * Query if the given block has crop properties.
534
+ * @param id The block to query.
535
+ * @returns true, if the block has crop properties.
536
+ */
537
+ hasCrop(id: DesignBlockId): boolean;
538
+
539
+ /**
540
+ * Set the crop scale in x direction of the given design block.
541
+ * @param id The block whose crop should be set.
542
+ * @param scaleX The scale in x direction.
543
+ */
544
+ setCropScaleX(id: DesignBlockId, scaleX: number): void;
545
+
546
+ /**
547
+ * Set the crop scale in y direction of the given design block.
548
+ * @param id The block whose crop should be set.
549
+ * @param scaleY The scale in y direction.
550
+ */
551
+ setCropScaleY(id: DesignBlockId, scaleY: number): void;
552
+
553
+ /**
554
+ * Set the crop rotation of the given design block.
555
+ * @param id The block whose crop should be set.
556
+ * @param rotation The rotation in radians.
557
+ */
558
+ setCropRotation(id: DesignBlockId, rotation: number): void;
559
+
560
+ /**
561
+ * Set the crop translation in x direction of the given design block.
562
+ * @param id The block whose crop should be set.
563
+ * @param translationY The translation in x direction.
564
+ */
565
+ setCropTranslationX(id: DesignBlockId, translationX: number): void;
566
+
567
+ /**
568
+ * Set the crop translation in y direction of the given design block.
569
+ * @param id The block whose crop should be set.
570
+ * @param translationY The translation in y direction.
571
+ */
572
+ setCropTranslationY(id: DesignBlockId, translationY: number): void;
573
+
574
+ /**
575
+ * Resets the manually set crop of the given design block.
576
+ * The block's content fill mode is set to 'cover'.
577
+ * @param id The block whose crop should be reset.
578
+ */
579
+ resetCrop(id: DesignBlockId): void;
580
+
581
+ /**
582
+ * Get the crop scale on the x axis of the given design block.
583
+ * @param id The block whose scale should be queried.
584
+ * @returns The scale on the x axis.
585
+ */
586
+ getCropScaleX(id: DesignBlockId): number;
587
+
588
+ /**
589
+ * Get the crop scale on the y axis of the given design block.
590
+ * @param id The block whose scale should be queried.
591
+ * @returns The scale on the y axis.
592
+ */
593
+ getCropScaleY(id: DesignBlockId): number;
594
+
595
+ /**
596
+ * Get the crop rotation of the given design block.
597
+ * @param id The block whose crop rotation should be queried.
598
+ * @returns The crop rotation.
599
+ */
600
+ getCropRotation(id: DesignBlockId): number;
601
+
602
+ /**
603
+ * Get the crop translation on the x axis of the given design block.
604
+ * @param id The block whose translation should be queried.
605
+ * @returns The translation on the x axis.
606
+ */
607
+ getCropTranslationX(id: DesignBlockId): number;
608
+
609
+ /**
610
+ * Get the crop translation on the y axis of the given design block.
611
+ * @param id The block whose translation should be queried.
612
+ * @returns The translation on the y axis.
613
+ */
614
+ getCropTranslationY(id: DesignBlockId): number;
615
+
616
+ /**
617
+ * Query if the given block has an opacity.
618
+ * @param id The block to query.
619
+ * @returns true, if the block has an opcity.
620
+ */
621
+ hasOpacity(id: DesignBlockId): boolean;
622
+
623
+ /**
624
+ * Set the opacity of the given design block.
625
+ * @param id The block whose opacity should be set.
626
+ * @param opacity The opacity to be set. The valid range is 0 to 1.
627
+ */
628
+ setOpacity(id: DesignBlockId, opacity: number): void;
629
+
630
+ /**
631
+ * Get the opacity of the given design block.
632
+ * @param id The block whose opacity should be queried.
633
+ * @returns The opacity in a range of 0 to 1.
634
+ */
635
+ getOpacity(id: DesignBlockId): number;
636
+
637
+ /**
638
+ * Query if the given block has fill color properties.
639
+ * @param id The block to query.
640
+ * @returns true, if the block has fill color properties.
641
+ */
642
+ hasFillColor(id: DesignBlockId): boolean;
643
+
644
+ /**
645
+ * Set the fill color of the given design block.
646
+ * @param id The block whose fill color should be set.
647
+ * @param color The fill color to be set, a tuple of
648
+ * @param r The red color component in the range of 0 to 1.
649
+ * @param g The green color component in the range of 0 to 1.
650
+ * @param b The blue color component in the range of 0 to 1.
651
+ * @param a The alpha color component in the range of 0 to 1.
652
+ */
653
+ setFillColorRGBA(
654
+ id: DesignBlockId,
655
+ r: number,
656
+ g: number,
657
+ b: number,
658
+ a: number
659
+ ): void;
660
+
661
+ /**
662
+ * Get the fill color of the given design block.
663
+ * @param id The block whose fill color should be queried.
664
+ * @returns The fill color.
665
+ */
666
+ getFillColorRGBA(id: DesignBlockId): RGBA;
667
+
668
+ /**
669
+ * Enable or disable the fill of the given design block.
670
+ * @param id The block whose fill should be enabled or disabled.
671
+ * @param enabled If true, the fill will be enabled.
672
+ */
673
+ setFillColorEnabled(id: DesignBlockId, enabled: boolean): void;
674
+
675
+ /**
676
+ * Query if the fill of the given design block is enabled.
677
+ * @param id The block whose fill state should be queried.
678
+ * @returns True, if fill is enabled.
679
+ */
680
+ isFillColorEnabled(id: DesignBlockId): boolean;
681
+
682
+ /**
683
+ * Query if the given block has background color properties.
684
+ * @param id The block to query.
685
+ * @returns true, if the block has background color properties.
686
+ */
687
+ hasBackgroundColor(id: DesignBlockId): boolean;
688
+
689
+ /**
690
+ * Set the background color of the given design block.
691
+ * @param id The block whose background color should be set.
692
+ * @param color The background color to be set, a tuple of
693
+ * @param r The red color component in the range of 0 to 1.
694
+ * @param g The green color component in the range of 0 to 1.
695
+ * @param b The blue color component in the range of 0 to 1.
696
+ * @param a The alpha color component in the range of 0 to 1.
697
+ */
698
+ setBackgroundColorRGBA(
699
+ id: DesignBlockId,
700
+ r: number,
701
+ g: number,
702
+ b: number,
703
+ a: number
704
+ ): void;
705
+
706
+ /**
707
+ * Get the background color of the given design block.
708
+ * @param id The block whose background color should be queried.
709
+ * @returns The background color.
710
+ */
711
+ getBackgroundColorRGBA(id: DesignBlockId): RGBA;
712
+
713
+ /**
714
+ * Enable or disable the background of the given design block.
715
+ * @param id The block whose background should be enabled or disabled.
716
+ * @param enabled If true, the background will be enabled.
717
+ */
718
+ setBackgroundColorEnabled(id: DesignBlockId, enabled: boolean): void;
719
+
720
+ /**
721
+ * Query if the background of the given design block is enabled.
722
+ * @param id The block whose background state should be queried.
723
+ * @returns True, if background is enabled.
724
+ */
725
+ isBackgroundColorEnabled(id: DesignBlockId): boolean;
726
+
727
+ /**
728
+ * Query if the given block has outline properties.
729
+ * @param id The block to query.
730
+ * @returns true, if the block has outline properties.
731
+ */
732
+ hasOutline(id: DesignBlockId): boolean;
733
+
734
+ /**
735
+ * Set the outline color of the given design block.
736
+ * @param id The block whose outline color should be set.
737
+ * @param color The outline color to be set, a tuple of
738
+ * @param r The red color component in the range of 0 to 1.
739
+ * @param g The green color component in the range of 0 to 1.
740
+ * @param b The blue color component in the range of 0 to 1.
741
+ * @param a The alpha color component in the range of 0 to 1.
742
+ */
743
+ setOutlineColorRGBA(
744
+ id: DesignBlockId,
745
+ r: number,
746
+ g: number,
747
+ b: number,
748
+ a: number
749
+ ): void;
750
+
751
+ /**
752
+ * Get the outline color of the given design block.
753
+ * @param id The block whose outline color should be queried.
754
+ * @returns The outline color.
755
+ */
756
+ getOutlineColorRGBA(id: DesignBlockId): RGBA;
757
+
758
+ /**
759
+ * Enable or disable the outline of the given design block.
760
+ * @param id The block whose outline should be enabled or disabled.
761
+ * @param enabled If true, the outline will be enabled.
762
+ */
763
+ setOutlineEnabled(id: DesignBlockId, enabled: boolean): void;
764
+
765
+ /**
766
+ * Query if the outline of the given design block is enabled.
767
+ * @param id The block whose outline state should be queried.
768
+ * @returns True, if outline is enabled.
769
+ */
770
+ isOutlineEnabled(id: DesignBlockId): boolean;
771
+
772
+ /**
773
+ * Set the outline width of the given design block.
774
+ * @param id The block whose outline width should be set.
775
+ * @param width The outline width to be set.
776
+ */
777
+ setOutlineWidth(id: DesignBlockId, width: number): void;
778
+
779
+ /**
780
+ * Get the outline width of the given design block.
781
+ * @param id The block whose outline width should be queried.
782
+ * @returns The outline width.
783
+ */
784
+ getOutlineWidth(id: DesignBlockId): number;
393
785
  }
package/api.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import BlockAPI from './BlockAPI';
2
2
  import SceneAPI from './SceneAPI';
3
- import PropertyAPI from './PropertyAPI';
4
3
  import VariableAPI from './VariableAPI';
5
4
 
6
5
  export default class API {
@@ -8,7 +7,5 @@ export default class API {
8
7
 
9
8
  scene: SceneAPI;
10
9
 
11
- property: PropertyAPI;
12
-
13
10
  variable: VariableAPI;
14
11
  }
Binary file
Binary file
@@ -1,7 +1,6 @@
1
- import BlockAPI from './BlockAPI';
1
+ import BlockAPI, { PropertyType } from './BlockAPI';
2
2
  import SceneAPI from './SceneAPI';
3
3
  import VariableAPI from './VariableAPI';
4
- import PropertyAPI, { PropertyType } from './PropertyAPI';
5
4
  import { UserConfiguration } from './types';
6
5
 
7
6
  export { PropertyType };
@@ -16,8 +15,6 @@ export default class CreativeEngine {
16
15
 
17
16
  scene: SceneAPI;
18
17
 
19
- property: PropertyAPI;
20
-
21
18
  variable: VariableAPI;
22
19
 
23
20
  private constructor(...args: unknown[]);