@wix/editor 1.389.0 → 1.391.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 CHANGED
@@ -168,14 +168,14 @@ class ApplicationSDKShape extends BaseSDKShape {
168
168
  return privateAPI.info.getAppInstance(await this.getAppDefinitionId());
169
169
  }
170
170
  }
171
- var index$b = new PlatformSDKShape(ApplicationSDKShape).withPublicMethod("getPrivateAPI").withPublicMethod("getPublicAPI").withPublicMethod("getAppInstance").build();
171
+ var index$d = new PlatformSDKShape(ApplicationSDKShape).withPublicMethod("getPrivateAPI").withPublicMethod("getPublicAPI").withPublicMethod("getAppInstance").build();
172
172
 
173
173
  class EventsSDKShape extends BaseSDKShape {
174
174
  async addEventListener(name, cb) {
175
175
  return (await this.getApplicationContext()).getEvents().addEventListener(name, cb);
176
176
  }
177
177
  }
178
- var index$a = new PlatformSDKShape(EventsSDKShape).withPublicMethod("addEventListener").build();
178
+ var index$c = new PlatformSDKShape(EventsSDKShape).withPublicMethod("addEventListener").build();
179
179
 
180
180
  class ElementsSDKShape extends BaseSDKShape {
181
181
  async getSelection() {
@@ -194,7 +194,7 @@ class ElementsSDKShape extends BaseSDKShape {
194
194
  });
195
195
  }
196
196
  }
197
- var index$9 = new PlatformSDKShape(ElementsSDKShape).withPublicMethod("onSelectionChange").withPublicMethod("getSelection").build();
197
+ var index$b = new PlatformSDKShape(ElementsSDKShape).withPublicMethod("onSelectionChange").withPublicMethod("getSelection").build();
198
198
 
199
199
  class InfoSDKShape extends BaseSDKShape {
200
200
  async getViewMode() {
@@ -218,7 +218,7 @@ class InfoSDKShape extends BaseSDKShape {
218
218
  return privateAPI.info.getThemeCustomProperties(filter);
219
219
  }
220
220
  }
221
- var index$8 = new PlatformSDKShape(InfoSDKShape).withPublicMethod("getViewMode").withPublicMethod("getLanguageCode").withPublicMethod("getSiteDirection").withPublicMethod("siteHasCustomClasses").withPublicMethod("getThemeCustomProperties").build();
221
+ var index$a = new PlatformSDKShape(InfoSDKShape).withPublicMethod("getViewMode").withPublicMethod("getLanguageCode").withPublicMethod("getSiteDirection").withPublicMethod("siteHasCustomClasses").withPublicMethod("getThemeCustomProperties").build();
222
222
 
223
223
  var WidgetShapeErrorCode = /* @__PURE__ */ ((WidgetShapeErrorCode2) => {
224
224
  WidgetShapeErrorCode2["UndefinedCompRef"] = "UndefinedCompRef";
@@ -394,7 +394,7 @@ class WidgetSDKShape extends BaseSDKShape {
394
394
  }
395
395
  }
396
396
  const widgetShape = new PlatformSDKShape(WidgetSDKShape).withPublicMethod("getNestedWidget").withPublicMethod("setDesignPreset").withPublicMethod("getDesignPreset").withPublicMethod("setProp").withPublicMethod("getProp").withPublicMethod("setPreloadFonts");
397
- var index$7 = widgetShape.build();
397
+ var index$9 = widgetShape.build();
398
398
 
399
399
  function fontValueToCSS(fontValue) {
400
400
  return `${fontValue.cssVariableName ? `var(${fontValue.cssVariableName}, ` : ""}${fontValue.italic ? "italic " : ""}${fontValue.bold ? "bold " : ""}${fontValue.size || 16}px ${// wrap each font family with quotes
@@ -494,7 +494,7 @@ class InputsSDKShape extends BaseSDKShape {
494
494
  return _value;
495
495
  }
496
496
  }
497
- var index$6 = new PlatformSDKShape(InputsSDKShape).withPublicMethod("selectColor").withPublicMethod("selectFont").build();
497
+ var index$8 = new PlatformSDKShape(InputsSDKShape).withPublicMethod("selectColor").withPublicMethod("selectFont").build();
498
498
 
499
499
  class PanelsSDKShape extends BaseSDKShape {
500
500
  async openLanguageSupportPanel() {
@@ -506,7 +506,7 @@ class PanelsSDKShape extends BaseSDKShape {
506
506
  return privateAPI.panels.openFontsUploadPanel();
507
507
  }
508
508
  }
509
- var index$5 = new PlatformSDKShape(PanelsSDKShape).withPublicMethod("openLanguageSupportPanel").withPublicMethod("openFontsUploadPanel").build();
509
+ var index$7 = new PlatformSDKShape(PanelsSDKShape).withPublicMethod("openLanguageSupportPanel").withPublicMethod("openFontsUploadPanel").build();
510
510
 
511
511
  class ModalsSDKShape extends BaseSDKShape {
512
512
  async openDashboardModal(options) {
@@ -517,18 +517,29 @@ class ModalsSDKShape extends BaseSDKShape {
517
517
  );
518
518
  }
519
519
  }
520
- var index$4 = new PlatformSDKShape(ModalsSDKShape).withPublicMethod("openDashboardModal").build();
520
+ var index$6 = new PlatformSDKShape(ModalsSDKShape).withPublicMethod("openDashboardModal").build();
521
521
 
522
522
  class ElementSDKShape extends BaseSDKShape {
523
+ constructor(overriddenApplicationContext = null, childPath = []) {
524
+ super(overriddenApplicationContext);
525
+ this.overriddenApplicationContext = overriddenApplicationContext;
526
+ this.childPath = childPath;
527
+ }
523
528
  async getStyleDefinitions() {
524
529
  const privateAPI = await this.getPlatformPrivateAPI();
525
530
  const manifestContextId = await this.getRequiredManifestContextId();
526
- return privateAPI.builderComponent.getStyleDefinitions(manifestContextId);
531
+ return privateAPI.builderComponent.getStyleDefinitions(
532
+ manifestContextId,
533
+ this.childPath
534
+ );
527
535
  }
528
536
  async getStyles() {
529
537
  const privateAPI = await this.getPlatformPrivateAPI();
530
538
  const manifestContextId = await this.getRequiredManifestContextId();
531
- return privateAPI.builderComponent.getStyles(manifestContextId);
539
+ return privateAPI.builderComponent.getStyles(
540
+ manifestContextId,
541
+ this.childPath
542
+ );
532
543
  }
533
544
  async setStyles({
534
545
  cssProperties,
@@ -536,25 +547,39 @@ class ElementSDKShape extends BaseSDKShape {
536
547
  } = {}) {
537
548
  const privateAPI = await this.getPlatformPrivateAPI();
538
549
  const manifestContextId = await this.getRequiredManifestContextId();
539
- return privateAPI.builderComponent.setStyles(manifestContextId, {
540
- cssProperties,
541
- cssCustomProperties
542
- });
550
+ return privateAPI.builderComponent.setStyles(
551
+ manifestContextId,
552
+ this.childPath,
553
+ {
554
+ cssProperties,
555
+ cssCustomProperties
556
+ }
557
+ );
543
558
  }
544
559
  async removeStyles(values = {}) {
545
560
  const privateAPI = await this.getPlatformPrivateAPI();
546
561
  const manifestContextId = await this.getRequiredManifestContextId();
547
- return privateAPI.builderComponent.removeStyles(manifestContextId, values);
562
+ return privateAPI.builderComponent.removeStyles(
563
+ manifestContextId,
564
+ this.childPath,
565
+ values
566
+ );
548
567
  }
549
568
  async getDataDefinitions() {
550
569
  const privateAPI = await this.getPlatformPrivateAPI();
551
570
  const manifestContextId = await this.getRequiredManifestContextId();
552
- return privateAPI.builderComponent.getDataDefinitions(manifestContextId);
571
+ return privateAPI.builderComponent.getDataDefinitions(
572
+ manifestContextId,
573
+ this.childPath
574
+ );
553
575
  }
554
576
  async getData() {
555
577
  const privateAPI = await this.getPlatformPrivateAPI();
556
578
  const manifestContextId = await this.getRequiredManifestContextId();
557
- return privateAPI.builderComponent.getData(manifestContextId);
579
+ return privateAPI.builderComponent.getData(
580
+ manifestContextId,
581
+ this.childPath
582
+ );
558
583
  }
559
584
  async getResolvedData({ dataItemKey }) {
560
585
  const privateAPI = await this.getPlatformPrivateAPI();
@@ -566,7 +591,11 @@ class ElementSDKShape extends BaseSDKShape {
566
591
  async setData(values) {
567
592
  const privateAPI = await this.getPlatformPrivateAPI();
568
593
  const manifestContextId = await this.getRequiredManifestContextId();
569
- return privateAPI.builderComponent.setData(manifestContextId, values);
594
+ return privateAPI.builderComponent.setData(
595
+ manifestContextId,
596
+ this.childPath,
597
+ values
598
+ );
570
599
  }
571
600
  async getPresetDefinitions() {
572
601
  const privateAPI = await this.getPlatformPrivateAPI();
@@ -595,12 +624,19 @@ class ElementSDKShape extends BaseSDKShape {
595
624
  async getState() {
596
625
  const privateAPI = await this.getPlatformPrivateAPI();
597
626
  const manifestContextId = await this.getRequiredManifestContextId();
598
- return privateAPI.builderComponent.getState(manifestContextId);
627
+ return privateAPI.builderComponent.getState(
628
+ manifestContextId,
629
+ this.childPath
630
+ );
599
631
  }
600
632
  async setState(stateKey) {
601
633
  const privateAPI = await this.getPlatformPrivateAPI();
602
634
  const manifestContextId = await this.getRequiredManifestContextId();
603
- return privateAPI.builderComponent.setState(manifestContextId, stateKey);
635
+ return privateAPI.builderComponent.setState(
636
+ manifestContextId,
637
+ this.childPath,
638
+ stateKey
639
+ );
604
640
  }
605
641
  async getStateDefinitions() {
606
642
  const privateAPI = await this.getPlatformPrivateAPI();
@@ -621,6 +657,7 @@ class ElementSDKShape extends BaseSDKShape {
621
657
  const manifestContextId = await this.getRequiredManifestContextId();
622
658
  const selectedFont = await privateAPI.builderComponent.selectFont(
623
659
  manifestContextId,
660
+ this.childPath,
624
661
  {
625
662
  ...params,
626
663
  showWeights: true
@@ -636,6 +673,7 @@ class ElementSDKShape extends BaseSDKShape {
636
673
  const manifestContextId = await this.getRequiredManifestContextId();
637
674
  const selectedFont = await privateAPI.builderComponent.selectFont(
638
675
  manifestContextId,
676
+ this.childPath,
639
677
  {
640
678
  ...params,
641
679
  showWeights: false
@@ -648,12 +686,20 @@ class ElementSDKShape extends BaseSDKShape {
648
686
  async selectMedia(params) {
649
687
  const privateAPI = await this.getPlatformPrivateAPI();
650
688
  const manifestContextId = await this.getRequiredManifestContextId();
651
- return privateAPI.builderComponent.selectMedia(manifestContextId, params);
689
+ return privateAPI.builderComponent.selectMedia(
690
+ manifestContextId,
691
+ this.childPath,
692
+ params
693
+ );
652
694
  }
653
695
  async selectLink(params) {
654
696
  const privateAPI = await this.getPlatformPrivateAPI();
655
697
  const manifestContextId = await this.getRequiredManifestContextId();
656
- return privateAPI.builderComponent.selectLink(manifestContextId, params);
698
+ return privateAPI.builderComponent.selectLink(
699
+ manifestContextId,
700
+ this.childPath,
701
+ params
702
+ );
657
703
  }
658
704
  async selectColor(params) {
659
705
  const privateAPI = await this.getPlatformPrivateAPI();
@@ -661,6 +707,7 @@ class ElementSDKShape extends BaseSDKShape {
661
707
  const manifestContextId = await this.getRequiredManifestContextId();
662
708
  const selectedColor = await privateAPI.builderComponent.selectColor(
663
709
  manifestContextId,
710
+ this.childPath,
664
711
  params
665
712
  );
666
713
  return selectedColor;
@@ -672,6 +719,7 @@ class ElementSDKShape extends BaseSDKShape {
672
719
  const manifestContextId = await this.getRequiredManifestContextId();
673
720
  return privateAPI.builderComponent.selectFontWeight(
674
721
  manifestContextId,
722
+ this.childPath,
675
723
  params
676
724
  );
677
725
  }
@@ -684,7 +732,7 @@ class ElementSDKShape extends BaseSDKShape {
684
732
  );
685
733
  }
686
734
  }
687
- var index$3 = new PlatformSDKShape(ElementSDKShape).withPublicMethod("getDataDefinitions").withPublicMethod("getData").withPublicMethod("getResolvedData").withPublicMethod("setData").withPublicMethod("getStyleDefinitions").withPublicMethod("getStyles").withPublicMethod("setStyles").withPublicMethod("removeStyles").withPublicMethod("getPresetDefinitions").withPublicMethod("getAppliedPreset").withPublicMethod("applyPreset").withPublicMethod("getDisplayGroupDefinitions").withPublicMethod("getState").withPublicMethod("setState").withPublicMethod("onChange").withPublicMethod("getStateDefinitions").withPublicMethod("selectFont").withPublicMethod("selectFontFamily").withPublicMethod("selectMedia").withPublicMethod("selectLink").withPublicMethod("selectColor").withPublicMethod("selectFontWeight").withPublicMethod("selectTextTheme").build();
735
+ var index$5 = new PlatformSDKShape(ElementSDKShape).withPublicMethod("getDataDefinitions").withPublicMethod("getData").withPublicMethod("getResolvedData").withPublicMethod("setData").withPublicMethod("getStyleDefinitions").withPublicMethod("getStyles").withPublicMethod("setStyles").withPublicMethod("removeStyles").withPublicMethod("getPresetDefinitions").withPublicMethod("getAppliedPreset").withPublicMethod("applyPreset").withPublicMethod("getDisplayGroupDefinitions").withPublicMethod("getState").withPublicMethod("setState").withPublicMethod("onChange").withPublicMethod("getStateDefinitions").withPublicMethod("selectFont").withPublicMethod("selectFontFamily").withPublicMethod("selectMedia").withPublicMethod("selectLink").withPublicMethod("selectColor").withPublicMethod("selectFontWeight").withPublicMethod("selectTextTheme").build();
688
736
 
689
737
  class PreferencesSDKShape extends BaseSDKShape {
690
738
  async get(keys) {
@@ -702,7 +750,7 @@ class PreferencesSDKShape extends BaseSDKShape {
702
750
  );
703
751
  }
704
752
  }
705
- var index$2 = new PlatformSDKShape(PreferencesSDKShape).withPublicMethod("set").withPublicMethod("get").build();
753
+ var index$4 = new PlatformSDKShape(PreferencesSDKShape).withPublicMethod("set").withPublicMethod("get").build();
706
754
 
707
755
  class ExternalPanelsSDKShape extends BaseSDKShape {
708
756
  async getData() {
@@ -744,7 +792,7 @@ class ExternalPanelsSDKShape extends BaseSDKShape {
744
792
  return privateAPI.externalPanels.translate(key, values);
745
793
  }
746
794
  }
747
- var index$1 = new PlatformSDKShape(ExternalPanelsSDKShape).withPublicMethod("getTheme").withPublicMethod("getData").withPublicMethod("getStyle").withPublicMethod("selectColor").withPublicMethod("selectLink").withPublicMethod("selectMedia").withPublicMethod("setData").withPublicMethod("setStyle").withPublicMethod("translate").build();
795
+ var index$3 = new PlatformSDKShape(ExternalPanelsSDKShape).withPublicMethod("getTheme").withPublicMethod("getData").withPublicMethod("getStyle").withPublicMethod("selectColor").withPublicMethod("selectLink").withPublicMethod("selectMedia").withPublicMethod("setData").withPublicMethod("setStyle").withPublicMethod("translate").build();
748
796
 
749
797
  var ControllersErrorCode = /* @__PURE__ */ ((ControllersErrorCode2) => {
750
798
  ControllersErrorCode2["UndefinedCompRef"] = "UndefinedCompRef";
@@ -775,7 +823,109 @@ class ControllersSDKShape extends BaseSDKShape {
775
823
  );
776
824
  }
777
825
  }
778
- var index = new PlatformSDKShape(ControllersSDKShape).withPublicMethod("get").build();
826
+ var index$2 = new PlatformSDKShape(ControllersSDKShape).withPublicMethod("get").build();
827
+
828
+ class BindingConnectionItem {
829
+ constructor(privateAPI, compRef, bindingTargetId, config) {
830
+ this.privateAPI = privateAPI;
831
+ this.compRef = compRef;
832
+ this.bindingTargetId = bindingTargetId;
833
+ this.config = config;
834
+ }
835
+ update(data) {
836
+ return this.privateAPI.bindings.update(this.compRef, this.bindingTargetId, {
837
+ config: data.config,
838
+ role: data.role
839
+ });
840
+ }
841
+ delete() {
842
+ return this.privateAPI.bindings.delete(this.compRef, this.bindingTargetId);
843
+ }
844
+ }
845
+ class BindingsSDKShape extends BaseSDKShape {
846
+ async get(bindingTarget) {
847
+ const privateAPI = await this.getPlatformPrivateAPI();
848
+ const compRefs = await privateAPI.components.getSelectedComponents();
849
+ if (compRefs.length !== 1) {
850
+ return null;
851
+ }
852
+ const [compRef] = compRefs;
853
+ const dataBindingConfig = privateAPI.bindings.get(
854
+ bindingTarget.id,
855
+ compRef
856
+ );
857
+ if (!dataBindingConfig) {
858
+ return null;
859
+ }
860
+ return new BindingConnectionItem(
861
+ privateAPI,
862
+ compRef,
863
+ bindingTarget.id,
864
+ dataBindingConfig
865
+ );
866
+ }
867
+ }
868
+ var index$1 = new PlatformSDKShape(BindingsSDKShape).withPublicMethod("get").build();
869
+
870
+ const DATA_BINDING_PANEL_ID = "Data Binding";
871
+ const { dataBindingPanelId, bindingItemName } = {
872
+ dataBindingPanelId: "",
873
+ bindingItemName: "dataBinding"
874
+ };
875
+ class BindingsProvider {
876
+ constructor(privateAPI, compRef, dataItemTarget, name, dataBindingPanelId2) {
877
+ this.privateAPI = privateAPI;
878
+ this.compRef = compRef;
879
+ this.dataItemTarget = dataItemTarget;
880
+ this.name = name;
881
+ this.dataBindingPanelId = dataBindingPanelId2;
882
+ }
883
+ select() {
884
+ return this.privateAPI.bindings.openDataBindingPanel(
885
+ this.dataItemTarget.id,
886
+ this.dataBindingPanelId
887
+ );
888
+ }
889
+ createBinding(data) {
890
+ const created = this.privateAPI.bindings.create(this.compRef, {
891
+ dataItemId: this.dataItemTarget.id,
892
+ bindingItemType: bindingItemName,
893
+ ...data
894
+ });
895
+ if (!created) {
896
+ return null;
897
+ }
898
+ return new BindingConnectionItem(
899
+ this.privateAPI,
900
+ this.compRef,
901
+ this.dataItemTarget.id,
902
+ JSON.stringify(data)
903
+ );
904
+ }
905
+ }
906
+ class BindingsProvidersSDKShape extends BaseSDKShape {
907
+ async list(bindingTarget) {
908
+ const privateAPI = await this.getPlatformPrivateAPI();
909
+ const compRefs = await privateAPI.components.getSelectedComponents();
910
+ if (compRefs.length !== 1) {
911
+ return [];
912
+ }
913
+ const [compRef] = compRefs;
914
+ if (!await privateAPI.bindings.canCreateBindingsProvider(compRef)) {
915
+ return [];
916
+ }
917
+ return [
918
+ new BindingsProvider(
919
+ privateAPI,
920
+ compRef,
921
+ bindingTarget,
922
+ DATA_BINDING_PANEL_ID,
923
+ dataBindingPanelId
924
+ )
925
+ ];
926
+ }
927
+ }
928
+ var index = new PlatformSDKShape(BindingsProvidersSDKShape).withPublicMethod("list").build();
779
929
 
780
930
  const frame = () => {
781
931
  const queryParams = new URLSearchParams(window.location.search);
@@ -825,17 +975,22 @@ const editor = {
825
975
  auth
826
976
  };
827
977
 
828
- exports.application = index$b;
829
- exports.controllers = index;
978
+ exports.BaseSDKShape = BaseSDKShape;
979
+ exports.ElementSDKShape = ElementSDKShape;
980
+ exports.PlatformSDKShape = PlatformSDKShape;
981
+ exports.application = index$d;
982
+ exports.bindings = index$1;
983
+ exports.bindingsProviders = index;
984
+ exports.controllers = index$2;
830
985
  exports.editor = editor;
831
- exports.element = index$3;
832
- exports.elements = index$9;
833
- exports.events = index$a;
834
- exports.externalPanels = index$1;
835
- exports.info = index$8;
836
- exports.inputs = index$6;
837
- exports.modals = index$4;
838
- exports.panels = index$5;
839
- exports.preferences = index$2;
840
- exports.widget = index$7;
986
+ exports.element = index$5;
987
+ exports.elements = index$b;
988
+ exports.events = index$c;
989
+ exports.externalPanels = index$3;
990
+ exports.info = index$a;
991
+ exports.inputs = index$8;
992
+ exports.modals = index$6;
993
+ exports.panels = index$7;
994
+ exports.preferences = index$4;
995
+ exports.widget = index$9;
841
996
  //# sourceMappingURL=index.js.map