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