@wix/editor 1.437.0 → 1.439.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +438 -6
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +438 -6
- package/dist/esm/index.js.map +1 -1
- package/dist/statics/docs-ts-model.json +6187 -0
- package/dist/statics/index.js +438 -6
- package/dist/statics/index.js.map +1 -1
- package/dist/types/index.d.ts +464 -5
- package/package.json +14 -8
package/dist/cjs/index.js
CHANGED
|
@@ -533,6 +533,19 @@ class ElementSDKShape extends BaseSDKShape {
|
|
|
533
533
|
this.overriddenApplicationContext = overriddenApplicationContext;
|
|
534
534
|
this.childPath = childPath;
|
|
535
535
|
}
|
|
536
|
+
/**
|
|
537
|
+
* Retrieves the style definitions declared in the component's manifest,
|
|
538
|
+
* including `cssProperties` and `cssCustomProperties`.
|
|
539
|
+
*
|
|
540
|
+
* @returns Style definitions for the component.
|
|
541
|
+
*
|
|
542
|
+
* @example
|
|
543
|
+
* ```ts
|
|
544
|
+
* import { element } from '@wix/editor';
|
|
545
|
+
*
|
|
546
|
+
* const defs = await element.getStyleDefinitions();
|
|
547
|
+
* ```
|
|
548
|
+
*/
|
|
536
549
|
async getStyleDefinitions() {
|
|
537
550
|
const privateAPI = await this.getPlatformPrivateAPI();
|
|
538
551
|
const manifestContextId = await this.getRequiredManifestContextId();
|
|
@@ -541,6 +554,19 @@ class ElementSDKShape extends BaseSDKShape {
|
|
|
541
554
|
this.childPath
|
|
542
555
|
);
|
|
543
556
|
}
|
|
557
|
+
/**
|
|
558
|
+
* Retrieves the current style values for the component.
|
|
559
|
+
*
|
|
560
|
+
* @returns Current `cssProperties` and `cssCustomProperties` values.
|
|
561
|
+
*
|
|
562
|
+
* @example
|
|
563
|
+
* ```ts
|
|
564
|
+
* import { element } from '@wix/editor';
|
|
565
|
+
*
|
|
566
|
+
* const styles = await element.getStyles();
|
|
567
|
+
* const bgColor = styles.cssProperties.backgroundColor;
|
|
568
|
+
* ```
|
|
569
|
+
*/
|
|
544
570
|
async getStyles() {
|
|
545
571
|
const privateAPI = await this.getPlatformPrivateAPI();
|
|
546
572
|
const manifestContextId = await this.getRequiredManifestContextId();
|
|
@@ -550,9 +576,11 @@ class ElementSDKShape extends BaseSDKShape {
|
|
|
550
576
|
);
|
|
551
577
|
}
|
|
552
578
|
/**
|
|
553
|
-
* Sets style values for the
|
|
579
|
+
* Sets style values for the component.
|
|
554
580
|
*
|
|
555
581
|
* @example
|
|
582
|
+
* ```ts
|
|
583
|
+
* import { element } from '@wix/editor';
|
|
556
584
|
* import { CssPropertyType } from '@wix/public-editor-platform-sdk';
|
|
557
585
|
*
|
|
558
586
|
* // Using enum (recommended):
|
|
@@ -564,6 +592,7 @@ class ElementSDKShape extends BaseSDKShape {
|
|
|
564
592
|
* await element.setStyles({
|
|
565
593
|
* cssProperties: { 'color': '#fff' }
|
|
566
594
|
* });
|
|
595
|
+
* ```
|
|
567
596
|
*/
|
|
568
597
|
async setStyles(values = {}) {
|
|
569
598
|
const privateAPI = await this.getPlatformPrivateAPI();
|
|
@@ -575,9 +604,11 @@ class ElementSDKShape extends BaseSDKShape {
|
|
|
575
604
|
);
|
|
576
605
|
}
|
|
577
606
|
/**
|
|
578
|
-
* Removes style values from the
|
|
607
|
+
* Removes style values from the component.
|
|
579
608
|
*
|
|
580
609
|
* @example
|
|
610
|
+
* ```ts
|
|
611
|
+
* import { element } from '@wix/editor';
|
|
581
612
|
* import { CssPropertyType } from '@wix/public-editor-platform-sdk';
|
|
582
613
|
*
|
|
583
614
|
* // Using enum (recommended):
|
|
@@ -589,6 +620,7 @@ class ElementSDKShape extends BaseSDKShape {
|
|
|
589
620
|
* await element.removeStyles({
|
|
590
621
|
* cssPropertiesKeys: ['color']
|
|
591
622
|
* });
|
|
623
|
+
* ```
|
|
592
624
|
*/
|
|
593
625
|
async removeStyles(values = {}) {
|
|
594
626
|
const privateAPI = await this.getPlatformPrivateAPI();
|
|
@@ -599,6 +631,18 @@ class ElementSDKShape extends BaseSDKShape {
|
|
|
599
631
|
values
|
|
600
632
|
);
|
|
601
633
|
}
|
|
634
|
+
/**
|
|
635
|
+
* Retrieves the data item definitions declared in the component's manifest.
|
|
636
|
+
*
|
|
637
|
+
* @returns Data item definitions keyed by data item key.
|
|
638
|
+
*
|
|
639
|
+
* @example
|
|
640
|
+
* ```ts
|
|
641
|
+
* import { element } from '@wix/editor';
|
|
642
|
+
*
|
|
643
|
+
* const defs = await element.getDataDefinitions();
|
|
644
|
+
* ```
|
|
645
|
+
*/
|
|
602
646
|
async getDataDefinitions() {
|
|
603
647
|
const privateAPI = await this.getPlatformPrivateAPI();
|
|
604
648
|
const manifestContextId = await this.getRequiredManifestContextId();
|
|
@@ -607,6 +651,19 @@ class ElementSDKShape extends BaseSDKShape {
|
|
|
607
651
|
this.childPath
|
|
608
652
|
);
|
|
609
653
|
}
|
|
654
|
+
/**
|
|
655
|
+
* Retrieves the current data values for the component.
|
|
656
|
+
*
|
|
657
|
+
* @typeParam T - Optional type parameter to define the expected structure of the returned data.
|
|
658
|
+
* @returns Current data values for the component.
|
|
659
|
+
*
|
|
660
|
+
* @example
|
|
661
|
+
* ```ts
|
|
662
|
+
* import { element } from '@wix/editor';
|
|
663
|
+
*
|
|
664
|
+
* const data = await element.getData();
|
|
665
|
+
* ```
|
|
666
|
+
*/
|
|
610
667
|
async getData() {
|
|
611
668
|
const privateAPI = await this.getPlatformPrivateAPI();
|
|
612
669
|
const manifestContextId = await this.getRequiredManifestContextId();
|
|
@@ -615,6 +672,24 @@ class ElementSDKShape extends BaseSDKShape {
|
|
|
615
672
|
this.childPath
|
|
616
673
|
);
|
|
617
674
|
}
|
|
675
|
+
/**
|
|
676
|
+
* Retrieves the resolved value of a specific data item.
|
|
677
|
+
*
|
|
678
|
+
* Unlike {@link getData}, this method returns the fully resolved value
|
|
679
|
+
* for a single data item.
|
|
680
|
+
*
|
|
681
|
+
* @param options - Object containing the `dataItemKey` to resolve.
|
|
682
|
+
* @returns Resolved value for the specified data item.
|
|
683
|
+
*
|
|
684
|
+
* @example
|
|
685
|
+
* ```ts
|
|
686
|
+
* import { element } from '@wix/editor';
|
|
687
|
+
*
|
|
688
|
+
* const resolved = await element.getResolvedData({
|
|
689
|
+
* dataItemKey: 'heroImage',
|
|
690
|
+
* });
|
|
691
|
+
* ```
|
|
692
|
+
*/
|
|
618
693
|
async getResolvedData({ dataItemKey }) {
|
|
619
694
|
const privateAPI = await this.getPlatformPrivateAPI();
|
|
620
695
|
const manifestContextId = await this.getRequiredManifestContextId();
|
|
@@ -626,6 +701,20 @@ class ElementSDKShape extends BaseSDKShape {
|
|
|
626
701
|
}
|
|
627
702
|
);
|
|
628
703
|
}
|
|
704
|
+
/**
|
|
705
|
+
* Updates data values for the component. Only the specified data items
|
|
706
|
+
* are updated; other data items remain unchanged.
|
|
707
|
+
*
|
|
708
|
+
* @typeParam T - Optional type parameter to define the expected structure of the input data.
|
|
709
|
+
* @param values - Data item keys and their new values.
|
|
710
|
+
*
|
|
711
|
+
* @example
|
|
712
|
+
* ```ts
|
|
713
|
+
* import { element } from '@wix/editor';
|
|
714
|
+
*
|
|
715
|
+
* await element.setData({ title: 'New Title', showButton: false });
|
|
716
|
+
* ```
|
|
717
|
+
*/
|
|
629
718
|
async setData(values) {
|
|
630
719
|
const privateAPI = await this.getPlatformPrivateAPI();
|
|
631
720
|
const manifestContextId = await this.getRequiredManifestContextId();
|
|
@@ -635,6 +724,18 @@ class ElementSDKShape extends BaseSDKShape {
|
|
|
635
724
|
values
|
|
636
725
|
);
|
|
637
726
|
}
|
|
727
|
+
/**
|
|
728
|
+
* Retrieves the preset definitions declared in the component's manifest.
|
|
729
|
+
*
|
|
730
|
+
* @returns Preset definitions keyed by preset key.
|
|
731
|
+
*
|
|
732
|
+
* @example
|
|
733
|
+
* ```ts
|
|
734
|
+
* import { element } from '@wix/editor';
|
|
735
|
+
*
|
|
736
|
+
* const presets = await element.getPresetDefinitions();
|
|
737
|
+
* ```
|
|
738
|
+
*/
|
|
638
739
|
async getPresetDefinitions() {
|
|
639
740
|
const privateAPI = await this.getPlatformPrivateAPI();
|
|
640
741
|
const manifestContextId = await this.getRequiredManifestContextId();
|
|
@@ -643,6 +744,18 @@ class ElementSDKShape extends BaseSDKShape {
|
|
|
643
744
|
this.childPath
|
|
644
745
|
);
|
|
645
746
|
}
|
|
747
|
+
/**
|
|
748
|
+
* Retrieves the currently applied preset for the component.
|
|
749
|
+
*
|
|
750
|
+
* @returns Key of the applied preset, or `null` if no preset is applied.
|
|
751
|
+
*
|
|
752
|
+
* @example
|
|
753
|
+
* ```ts
|
|
754
|
+
* import { element } from '@wix/editor';
|
|
755
|
+
*
|
|
756
|
+
* const preset = await element.getAppliedPreset();
|
|
757
|
+
* ```
|
|
758
|
+
*/
|
|
646
759
|
async getAppliedPreset() {
|
|
647
760
|
const privateAPI = await this.getPlatformPrivateAPI();
|
|
648
761
|
const manifestContextId = await this.getRequiredManifestContextId();
|
|
@@ -651,6 +764,19 @@ class ElementSDKShape extends BaseSDKShape {
|
|
|
651
764
|
this.childPath
|
|
652
765
|
);
|
|
653
766
|
}
|
|
767
|
+
/**
|
|
768
|
+
* Applies a preset to the component. Applying a preset updates the component's
|
|
769
|
+
* styles and data to match the preset's defined defaults.
|
|
770
|
+
*
|
|
771
|
+
* @param options - Object containing the `key` of the preset to apply.
|
|
772
|
+
*
|
|
773
|
+
* @example
|
|
774
|
+
* ```ts
|
|
775
|
+
* import { element } from '@wix/editor';
|
|
776
|
+
*
|
|
777
|
+
* await element.applyPreset({ key: 'minimal' });
|
|
778
|
+
* ```
|
|
779
|
+
*/
|
|
654
780
|
async applyPreset(options) {
|
|
655
781
|
const privateAPI = await this.getPlatformPrivateAPI();
|
|
656
782
|
const manifestContextId = await this.getRequiredManifestContextId();
|
|
@@ -660,6 +786,23 @@ class ElementSDKShape extends BaseSDKShape {
|
|
|
660
786
|
options
|
|
661
787
|
);
|
|
662
788
|
}
|
|
789
|
+
/**
|
|
790
|
+
* Retrieves the display group definitions declared in the component's manifest.
|
|
791
|
+
*
|
|
792
|
+
* @param options - Optional filter by `groupType`.
|
|
793
|
+
* @returns Display group definitions for the component.
|
|
794
|
+
*
|
|
795
|
+
* @example
|
|
796
|
+
* ```ts
|
|
797
|
+
* import { element } from '@wix/editor';
|
|
798
|
+
*
|
|
799
|
+
* const groups = await element.getDisplayGroupDefinitions();
|
|
800
|
+
*
|
|
801
|
+
* const cssGroups = await element.getDisplayGroupDefinitions({
|
|
802
|
+
* filter: { groupType: 'cssDataType' },
|
|
803
|
+
* });
|
|
804
|
+
* ```
|
|
805
|
+
*/
|
|
663
806
|
// TODO: group type should come from builder enum
|
|
664
807
|
async getDisplayGroupDefinitions(options) {
|
|
665
808
|
const privateAPI = await this.getPlatformPrivateAPI();
|
|
@@ -670,6 +813,18 @@ class ElementSDKShape extends BaseSDKShape {
|
|
|
670
813
|
options
|
|
671
814
|
);
|
|
672
815
|
}
|
|
816
|
+
/**
|
|
817
|
+
* Retrieves the display name of the component as defined in the manifest.
|
|
818
|
+
*
|
|
819
|
+
* @returns Component display name.
|
|
820
|
+
*
|
|
821
|
+
* @example
|
|
822
|
+
* ```ts
|
|
823
|
+
* import { element } from '@wix/editor';
|
|
824
|
+
*
|
|
825
|
+
* const name = await element.getDisplayName();
|
|
826
|
+
* ```
|
|
827
|
+
*/
|
|
673
828
|
async getDisplayName() {
|
|
674
829
|
const privateAPI = await this.getPlatformPrivateAPI();
|
|
675
830
|
const manifestContextId = await this.getRequiredManifestContextId();
|
|
@@ -678,6 +833,18 @@ class ElementSDKShape extends BaseSDKShape {
|
|
|
678
833
|
this.childPath
|
|
679
834
|
);
|
|
680
835
|
}
|
|
836
|
+
/**
|
|
837
|
+
* Retrieves the currently active state for the component.
|
|
838
|
+
*
|
|
839
|
+
* @returns Key of the active state, or `null` if the default state is active.
|
|
840
|
+
*
|
|
841
|
+
* @example
|
|
842
|
+
* ```ts
|
|
843
|
+
* import { element } from '@wix/editor';
|
|
844
|
+
*
|
|
845
|
+
* const state = await element.getState();
|
|
846
|
+
* ```
|
|
847
|
+
*/
|
|
681
848
|
async getState() {
|
|
682
849
|
const privateAPI = await this.getPlatformPrivateAPI();
|
|
683
850
|
const manifestContextId = await this.getRequiredManifestContextId();
|
|
@@ -686,6 +853,21 @@ class ElementSDKShape extends BaseSDKShape {
|
|
|
686
853
|
this.childPath
|
|
687
854
|
);
|
|
688
855
|
}
|
|
856
|
+
/**
|
|
857
|
+
* Sets the active state for the component. Pass `null` to return to the
|
|
858
|
+
* default state.
|
|
859
|
+
*
|
|
860
|
+
* @param stateKey - State key to activate, or `null` for the default state.
|
|
861
|
+
*
|
|
862
|
+
* @example
|
|
863
|
+
* ```ts
|
|
864
|
+
* import { element } from '@wix/editor';
|
|
865
|
+
*
|
|
866
|
+
* await element.setState('hover');
|
|
867
|
+
*
|
|
868
|
+
* await element.setState(null);
|
|
869
|
+
* ```
|
|
870
|
+
*/
|
|
689
871
|
async setState(stateKey) {
|
|
690
872
|
const privateAPI = await this.getPlatformPrivateAPI();
|
|
691
873
|
const manifestContextId = await this.getRequiredManifestContextId();
|
|
@@ -695,6 +877,18 @@ class ElementSDKShape extends BaseSDKShape {
|
|
|
695
877
|
stateKey
|
|
696
878
|
);
|
|
697
879
|
}
|
|
880
|
+
/**
|
|
881
|
+
* Retrieves the state definitions declared in the component's manifest.
|
|
882
|
+
*
|
|
883
|
+
* @returns State definitions keyed by state key.
|
|
884
|
+
*
|
|
885
|
+
* @example
|
|
886
|
+
* ```ts
|
|
887
|
+
* import { element } from '@wix/editor';
|
|
888
|
+
*
|
|
889
|
+
* const states = await element.getStateDefinitions();
|
|
890
|
+
* ```
|
|
891
|
+
*/
|
|
698
892
|
async getStateDefinitions() {
|
|
699
893
|
const privateAPI = await this.getPlatformPrivateAPI();
|
|
700
894
|
const manifestContextId = await this.getRequiredManifestContextId();
|
|
@@ -703,19 +897,58 @@ class ElementSDKShape extends BaseSDKShape {
|
|
|
703
897
|
this.childPath
|
|
704
898
|
);
|
|
705
899
|
}
|
|
900
|
+
// TODO: use type from the ManifestChangeDetection,
|
|
901
|
+
// but type should be moved to editor-platform-public-interfaces
|
|
706
902
|
/**
|
|
707
|
-
*
|
|
708
|
-
*
|
|
903
|
+
* Subscribes to changes on the component. The callback is invoked whenever
|
|
904
|
+
* styles, data, state, preset, props, or manifest values change.
|
|
905
|
+
*
|
|
906
|
+
* @param callback - Callback that receives a patch with `type` and `value`.
|
|
907
|
+
* @returns Unsubscribe method.
|
|
908
|
+
*
|
|
909
|
+
* @example
|
|
910
|
+
* ```ts
|
|
911
|
+
* import { element } from '@wix/editor';
|
|
912
|
+
*
|
|
913
|
+
* const unsubscribe = await element.onChange((patch) => {
|
|
914
|
+
* if (patch.type === 'data') {
|
|
915
|
+
* console.log('Data changed:', patch.value);
|
|
916
|
+
* }
|
|
917
|
+
* });
|
|
918
|
+
*
|
|
919
|
+
* unsubscribe();
|
|
920
|
+
* ```
|
|
709
921
|
*/
|
|
710
|
-
async onChange(
|
|
922
|
+
async onChange(callback) {
|
|
711
923
|
const privateAPI = await this.getPlatformPrivateAPI();
|
|
712
924
|
const manifestContextId = await this.getRequiredManifestContextId();
|
|
713
925
|
return privateAPI.builderComponent.onChange(
|
|
714
926
|
manifestContextId,
|
|
715
927
|
this.childPath,
|
|
716
|
-
|
|
928
|
+
callback
|
|
717
929
|
);
|
|
718
930
|
}
|
|
931
|
+
/**
|
|
932
|
+
* Opens the font picker for selecting a font family and weight.
|
|
933
|
+
*
|
|
934
|
+
* Pass `styleItemKey` to bind the picker to a manifest style item,
|
|
935
|
+
* or pass manual options to handle the selection via callbacks.
|
|
936
|
+
*
|
|
937
|
+
* @param params - `styleItemKey` for manifest binding, or manual picker options.
|
|
938
|
+
* @returns Selected font family and weight, or `undefined` if dismissed.
|
|
939
|
+
*
|
|
940
|
+
* @example
|
|
941
|
+
* ```ts
|
|
942
|
+
* import { element } from '@wix/editor';
|
|
943
|
+
*
|
|
944
|
+
* const font = await element.selectFont({ styleItemKey: 'headingFont' });
|
|
945
|
+
*
|
|
946
|
+
* const font = await element.selectFont({
|
|
947
|
+
* selectedFontFamily: { family: 'Arial', weight: '400' },
|
|
948
|
+
* onChange: (value) => console.log('Selected:', value),
|
|
949
|
+
* });
|
|
950
|
+
* ```
|
|
951
|
+
*/
|
|
719
952
|
async selectFont(params) {
|
|
720
953
|
try {
|
|
721
954
|
const privateAPI = await this.getPlatformPrivateAPI();
|
|
@@ -732,6 +965,26 @@ class ElementSDKShape extends BaseSDKShape {
|
|
|
732
965
|
} catch (error) {
|
|
733
966
|
}
|
|
734
967
|
}
|
|
968
|
+
/**
|
|
969
|
+
* Opens the font family picker for selecting a font family without
|
|
970
|
+
* weight options. Works the same as {@link selectFont} but without
|
|
971
|
+
* the weight selector.
|
|
972
|
+
*
|
|
973
|
+
* @param params - `styleItemKey` for manifest binding, or manual picker options.
|
|
974
|
+
* @returns Selected font family, or `undefined` if dismissed.
|
|
975
|
+
*
|
|
976
|
+
* @example
|
|
977
|
+
* ```ts
|
|
978
|
+
* import { element } from '@wix/editor';
|
|
979
|
+
*
|
|
980
|
+
* const font = await element.selectFontFamily({ styleItemKey: 'bodyFont' });
|
|
981
|
+
*
|
|
982
|
+
* const font = await element.selectFontFamily({
|
|
983
|
+
* selectedFontFamily: { family: 'Helvetica', weight: '400' },
|
|
984
|
+
* onChange: (value) => console.log('Selected:', value.family),
|
|
985
|
+
* });
|
|
986
|
+
* ```
|
|
987
|
+
*/
|
|
735
988
|
async selectFontFamily(params) {
|
|
736
989
|
try {
|
|
737
990
|
const privateAPI = await this.getPlatformPrivateAPI();
|
|
@@ -748,6 +1001,28 @@ class ElementSDKShape extends BaseSDKShape {
|
|
|
748
1001
|
} catch (error) {
|
|
749
1002
|
}
|
|
750
1003
|
}
|
|
1004
|
+
/**
|
|
1005
|
+
* Opens the media picker for selecting images, videos, or other media
|
|
1006
|
+
* from the Wix Media Manager.
|
|
1007
|
+
*
|
|
1008
|
+
* Pass `dataItemKey` to bind the picker to a manifest data item,
|
|
1009
|
+
* or pass manual options to configure the picker.
|
|
1010
|
+
*
|
|
1011
|
+
* @param params - `dataItemKey` for manifest binding, or manual picker options.
|
|
1012
|
+
* @returns Selected media items.
|
|
1013
|
+
*
|
|
1014
|
+
* @example
|
|
1015
|
+
* ```ts
|
|
1016
|
+
* import { element } from '@wix/editor';
|
|
1017
|
+
*
|
|
1018
|
+
* const media = await element.selectMedia({ dataItemKey: 'heroImage' });
|
|
1019
|
+
*
|
|
1020
|
+
* const media = await element.selectMedia({
|
|
1021
|
+
* isMultiSelect: true,
|
|
1022
|
+
* category: 'image',
|
|
1023
|
+
* });
|
|
1024
|
+
* ```
|
|
1025
|
+
*/
|
|
751
1026
|
async selectMedia(params) {
|
|
752
1027
|
const privateAPI = await this.getPlatformPrivateAPI();
|
|
753
1028
|
const manifestContextId = await this.getRequiredManifestContextId();
|
|
@@ -757,6 +1032,27 @@ class ElementSDKShape extends BaseSDKShape {
|
|
|
757
1032
|
params
|
|
758
1033
|
);
|
|
759
1034
|
}
|
|
1035
|
+
/**
|
|
1036
|
+
* Opens the link picker for creating or editing a link.
|
|
1037
|
+
*
|
|
1038
|
+
* Pass `dataItemKey` to bind the picker to a manifest data item,
|
|
1039
|
+
* or pass a `value` and optional `linkTypes` to configure manually.
|
|
1040
|
+
*
|
|
1041
|
+
* @param params - `dataItemKey` for manifest binding, or manual picker options.
|
|
1042
|
+
* @returns Selected link, or `null`/`undefined` if dismissed.
|
|
1043
|
+
*
|
|
1044
|
+
* @example
|
|
1045
|
+
* ```ts
|
|
1046
|
+
* import { element } from '@wix/editor';
|
|
1047
|
+
*
|
|
1048
|
+
* const link = await element.selectLink({ dataItemKey: 'buttonLink' });
|
|
1049
|
+
*
|
|
1050
|
+
* const link = await element.selectLink({
|
|
1051
|
+
* value: currentLink,
|
|
1052
|
+
* options: { linkTypes: ['ExternalLink', 'PageLink'] },
|
|
1053
|
+
* });
|
|
1054
|
+
* ```
|
|
1055
|
+
*/
|
|
760
1056
|
async selectLink(params) {
|
|
761
1057
|
const privateAPI = await this.getPlatformPrivateAPI();
|
|
762
1058
|
const manifestContextId = await this.getRequiredManifestContextId();
|
|
@@ -766,6 +1062,30 @@ class ElementSDKShape extends BaseSDKShape {
|
|
|
766
1062
|
params
|
|
767
1063
|
);
|
|
768
1064
|
}
|
|
1065
|
+
/**
|
|
1066
|
+
* Opens the color picker for selecting a color.
|
|
1067
|
+
*
|
|
1068
|
+
* Pass `styleItemKey` to bind the picker to a manifest style item,
|
|
1069
|
+
* or pass manual options to configure the picker.
|
|
1070
|
+
*
|
|
1071
|
+
* @param params - `styleItemKey` for manifest binding, or manual picker options.
|
|
1072
|
+
* @returns Selected color value, or `undefined` if dismissed.
|
|
1073
|
+
*
|
|
1074
|
+
* @example
|
|
1075
|
+
* ```ts
|
|
1076
|
+
* import { element } from '@wix/editor';
|
|
1077
|
+
*
|
|
1078
|
+
* const color = await element.selectColor({ styleItemKey: 'backgroundColor' });
|
|
1079
|
+
*
|
|
1080
|
+
* const color = await element.selectColor({
|
|
1081
|
+
* initialValue: '#ff0000',
|
|
1082
|
+
* mode: ['solid', 'gradient'],
|
|
1083
|
+
* showOpacity: true,
|
|
1084
|
+
* onChange: (color) => console.log('Preview:', color),
|
|
1085
|
+
* onApply: (color) => console.log('Applied:', color),
|
|
1086
|
+
* });
|
|
1087
|
+
* ```
|
|
1088
|
+
*/
|
|
769
1089
|
async selectColor(params) {
|
|
770
1090
|
const privateAPI = await this.getPlatformPrivateAPI();
|
|
771
1091
|
try {
|
|
@@ -779,6 +1099,23 @@ class ElementSDKShape extends BaseSDKShape {
|
|
|
779
1099
|
} catch (error) {
|
|
780
1100
|
}
|
|
781
1101
|
}
|
|
1102
|
+
/**
|
|
1103
|
+
* Opens the background picker for selecting a background fill
|
|
1104
|
+
* (color, gradient, or image).
|
|
1105
|
+
*
|
|
1106
|
+
* @param options - Background picker configuration.
|
|
1107
|
+
* @returns Selected background fill value.
|
|
1108
|
+
*
|
|
1109
|
+
* @example
|
|
1110
|
+
* ```ts
|
|
1111
|
+
* import { element } from '@wix/editor';
|
|
1112
|
+
*
|
|
1113
|
+
* const bg = await element.selectBackground({
|
|
1114
|
+
* initialValue: { backgroundColor: '#fff', backgroundImage: '' },
|
|
1115
|
+
* onChange: (value) => console.log('Preview:', value),
|
|
1116
|
+
* });
|
|
1117
|
+
* ```
|
|
1118
|
+
*/
|
|
782
1119
|
async selectBackground(options) {
|
|
783
1120
|
const privateAPI = await this.getPlatformPrivateAPI();
|
|
784
1121
|
const manifestContextId = await this.getRequiredManifestContextId();
|
|
@@ -788,6 +1125,31 @@ class ElementSDKShape extends BaseSDKShape {
|
|
|
788
1125
|
options
|
|
789
1126
|
);
|
|
790
1127
|
}
|
|
1128
|
+
/**
|
|
1129
|
+
* Opens the font weight picker for selecting a font weight for a specified
|
|
1130
|
+
* font family.
|
|
1131
|
+
*
|
|
1132
|
+
* Pass manifest style item keys to bind the picker, or pass manual
|
|
1133
|
+
* options to handle the selection via callbacks.
|
|
1134
|
+
*
|
|
1135
|
+
* @param params - Manifest style item keys, or manual picker options.
|
|
1136
|
+
* @returns Selected font weight.
|
|
1137
|
+
*
|
|
1138
|
+
* @example
|
|
1139
|
+
* ```ts
|
|
1140
|
+
* import { element } from '@wix/editor';
|
|
1141
|
+
*
|
|
1142
|
+
* const weight = await element.selectFontWeight({
|
|
1143
|
+
* fontFamilyStyleItemKey: 'headingFontFamily',
|
|
1144
|
+
* fontWeightStyleItemKey: 'headingFontWeight',
|
|
1145
|
+
* });
|
|
1146
|
+
*
|
|
1147
|
+
* const weight = await element.selectFontWeight({
|
|
1148
|
+
* fontFamily: { family: 'Arial', weight: '400' },
|
|
1149
|
+
* onChange: (value) => console.log('Selected weight:', value.weight),
|
|
1150
|
+
* });
|
|
1151
|
+
* ```
|
|
1152
|
+
*/
|
|
791
1153
|
async selectFontWeight(params) {
|
|
792
1154
|
const privateAPI = await this.getPlatformPrivateAPI();
|
|
793
1155
|
const manifestContextId = await this.getRequiredManifestContextId();
|
|
@@ -799,6 +1161,24 @@ class ElementSDKShape extends BaseSDKShape {
|
|
|
799
1161
|
)
|
|
800
1162
|
};
|
|
801
1163
|
}
|
|
1164
|
+
/**
|
|
1165
|
+
* Opens the text theme picker for selecting a predefined text theme
|
|
1166
|
+
* (a combination of font and color from the site's theme).
|
|
1167
|
+
*
|
|
1168
|
+
* @param params - Text theme picker configuration.
|
|
1169
|
+
* @param params.target - HTML element to anchor the picker to.
|
|
1170
|
+
* @param params.initialValue - Initial font and color values.
|
|
1171
|
+
* @returns Selected text theme.
|
|
1172
|
+
*
|
|
1173
|
+
* @example
|
|
1174
|
+
* ```ts
|
|
1175
|
+
* import { element } from '@wix/editor';
|
|
1176
|
+
*
|
|
1177
|
+
* const theme = await element.selectTextTheme({
|
|
1178
|
+
* initialValue: { font: 'Heading 1', color: '#333' },
|
|
1179
|
+
* });
|
|
1180
|
+
* ```
|
|
1181
|
+
*/
|
|
802
1182
|
async selectTextTheme(params) {
|
|
803
1183
|
const privateAPI = await this.getPlatformPrivateAPI();
|
|
804
1184
|
const manifestContextId = await this.getRequiredManifestContextId();
|
|
@@ -807,6 +1187,20 @@ class ElementSDKShape extends BaseSDKShape {
|
|
|
807
1187
|
params
|
|
808
1188
|
);
|
|
809
1189
|
}
|
|
1190
|
+
/**
|
|
1191
|
+
* Retrieves the currently selected index in an array items data group.
|
|
1192
|
+
*
|
|
1193
|
+
* @param options - Specify `arrayItemsDisplayGroupKey` if the component
|
|
1194
|
+
* has multiple array item groups.
|
|
1195
|
+
* @returns Index of the currently selected array item.
|
|
1196
|
+
*
|
|
1197
|
+
* @example
|
|
1198
|
+
* ```ts
|
|
1199
|
+
* import { element } from '@wix/editor';
|
|
1200
|
+
*
|
|
1201
|
+
* const index = await element.getArrayItemsSelectedIndex();
|
|
1202
|
+
* ```
|
|
1203
|
+
*/
|
|
810
1204
|
async getArrayItemsSelectedIndex(options) {
|
|
811
1205
|
const privateAPI = await this.getPlatformPrivateAPI();
|
|
812
1206
|
const manifestContextId = await this.getRequiredManifestContextId();
|
|
@@ -816,6 +1210,19 @@ class ElementSDKShape extends BaseSDKShape {
|
|
|
816
1210
|
options
|
|
817
1211
|
);
|
|
818
1212
|
}
|
|
1213
|
+
/**
|
|
1214
|
+
* Sets the selected index in an array items data group.
|
|
1215
|
+
*
|
|
1216
|
+
* @param options - Object containing the `index` to select, and optionally
|
|
1217
|
+
* `arrayItemsDisplayGroupKey` if there are multiple array item groups.
|
|
1218
|
+
*
|
|
1219
|
+
* @example
|
|
1220
|
+
* ```ts
|
|
1221
|
+
* import { element } from '@wix/editor';
|
|
1222
|
+
*
|
|
1223
|
+
* await element.setArrayItemsSelectedIndex({ index: 2 });
|
|
1224
|
+
* ```
|
|
1225
|
+
*/
|
|
819
1226
|
async setArrayItemsSelectedIndex(options) {
|
|
820
1227
|
const privateAPI = await this.getPlatformPrivateAPI();
|
|
821
1228
|
const manifestContextId = await this.getRequiredManifestContextId();
|
|
@@ -825,6 +1232,19 @@ class ElementSDKShape extends BaseSDKShape {
|
|
|
825
1232
|
options
|
|
826
1233
|
);
|
|
827
1234
|
}
|
|
1235
|
+
/**
|
|
1236
|
+
* Resets the selected index in an array items data group to the default.
|
|
1237
|
+
*
|
|
1238
|
+
* @param options - Specify `arrayItemsDisplayGroupKey` if the component
|
|
1239
|
+
* has multiple array item groups.
|
|
1240
|
+
*
|
|
1241
|
+
* @example
|
|
1242
|
+
* ```ts
|
|
1243
|
+
* import { element } from '@wix/editor';
|
|
1244
|
+
*
|
|
1245
|
+
* await element.resetArrayItemsSelectedIndex();
|
|
1246
|
+
* ```
|
|
1247
|
+
*/
|
|
828
1248
|
async resetArrayItemsSelectedIndex(options) {
|
|
829
1249
|
const privateAPI = await this.getPlatformPrivateAPI();
|
|
830
1250
|
const manifestContextId = await this.getRequiredManifestContextId();
|
|
@@ -834,6 +1254,18 @@ class ElementSDKShape extends BaseSDKShape {
|
|
|
834
1254
|
options
|
|
835
1255
|
);
|
|
836
1256
|
}
|
|
1257
|
+
/**
|
|
1258
|
+
* Retrieves the BI (Business Intelligence) token for the component.
|
|
1259
|
+
*
|
|
1260
|
+
* @returns BI token string.
|
|
1261
|
+
*
|
|
1262
|
+
* @example
|
|
1263
|
+
* ```ts
|
|
1264
|
+
* import { element } from '@wix/editor';
|
|
1265
|
+
*
|
|
1266
|
+
* const token = await element.getBiToken();
|
|
1267
|
+
* ```
|
|
1268
|
+
*/
|
|
837
1269
|
async getBiToken() {
|
|
838
1270
|
const privateAPI = await this.getPlatformPrivateAPI();
|
|
839
1271
|
const manifestContextId = await this.getRequiredManifestContextId();
|