@elementor/editor-components 4.1.0-765 → 4.1.0-767

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/index.d.ts CHANGED
@@ -231,8 +231,8 @@ declare const componentInstanceOverridesPropTypeUtil: {
231
231
  value: {
232
232
  override_key: string;
233
233
  schema_source: {
234
- type: "component";
235
234
  id: number;
235
+ type: "component";
236
236
  };
237
237
  override_value?: unknown;
238
238
  };
@@ -253,8 +253,8 @@ declare const componentInstanceOverridesPropTypeUtil: {
253
253
  value: {
254
254
  override_key: string;
255
255
  schema_source: {
256
- type: "component";
257
256
  id: number;
257
+ type: "component";
258
258
  };
259
259
  override_value?: unknown;
260
260
  };
@@ -276,8 +276,8 @@ declare const componentInstanceOverridesPropTypeUtil: {
276
276
  value: {
277
277
  override_key: string;
278
278
  schema_source: {
279
- type: "component";
280
279
  id: number;
280
+ type: "component";
281
281
  };
282
282
  override_value?: unknown;
283
283
  };
@@ -297,8 +297,8 @@ declare const componentInstanceOverridesPropTypeUtil: {
297
297
  value: {
298
298
  override_key: string;
299
299
  schema_source: {
300
- type: "component";
301
300
  id: number;
301
+ type: "component";
302
302
  };
303
303
  override_value?: unknown;
304
304
  };
@@ -319,8 +319,8 @@ declare const componentInstanceOverridesPropTypeUtil: {
319
319
  value: {
320
320
  override_key: string;
321
321
  schema_source: {
322
- type: "component";
323
322
  id: number;
323
+ type: "component";
324
324
  };
325
325
  override_value?: unknown;
326
326
  };
@@ -340,8 +340,8 @@ declare const componentInstanceOverridesPropTypeUtil: {
340
340
  value: {
341
341
  override_key: string;
342
342
  schema_source: {
343
- type: "component";
344
343
  id: number;
344
+ type: "component";
345
345
  };
346
346
  override_value?: unknown;
347
347
  };
@@ -362,8 +362,8 @@ declare const componentInstanceOverridesPropTypeUtil: {
362
362
  value: {
363
363
  override_key: string;
364
364
  schema_source: {
365
- type: "component";
366
365
  id: number;
366
+ type: "component";
367
367
  };
368
368
  override_value?: unknown;
369
369
  };
@@ -383,8 +383,8 @@ declare const componentInstanceOverridesPropTypeUtil: {
383
383
  value: {
384
384
  override_key: string;
385
385
  schema_source: {
386
- type: "component";
387
386
  id: number;
387
+ type: "component";
388
388
  };
389
389
  override_value?: unknown;
390
390
  };
@@ -404,8 +404,8 @@ declare const componentInstanceOverridesPropTypeUtil: {
404
404
  value: {
405
405
  override_key: string;
406
406
  schema_source: {
407
- type: "component";
408
407
  id: number;
408
+ type: "component";
409
409
  };
410
410
  override_value?: unknown;
411
411
  };
@@ -429,8 +429,8 @@ declare const componentInstanceOverridesPropTypeUtil: {
429
429
  value: {
430
430
  override_key: string;
431
431
  schema_source: {
432
- type: "component";
433
432
  id: number;
433
+ type: "component";
434
434
  };
435
435
  override_value?: unknown;
436
436
  };
@@ -450,8 +450,8 @@ declare const componentInstanceOverridesPropTypeUtil: {
450
450
  value: {
451
451
  override_key: string;
452
452
  schema_source: {
453
- type: "component";
454
453
  id: number;
454
+ type: "component";
455
455
  };
456
456
  override_value?: unknown;
457
457
  };
@@ -475,8 +475,8 @@ declare const componentInstanceOverridesPropTypeUtil: {
475
475
  value: {
476
476
  override_key: string;
477
477
  schema_source: {
478
- type: "component";
479
478
  id: number;
479
+ type: "component";
480
480
  };
481
481
  override_value?: unknown;
482
482
  };
@@ -500,8 +500,8 @@ declare const componentInstanceOverridesPropTypeUtil: {
500
500
  value: {
501
501
  override_key: string;
502
502
  schema_source: {
503
- type: "component";
504
503
  id: number;
504
+ type: "component";
505
505
  };
506
506
  override_value?: unknown;
507
507
  };
@@ -563,16 +563,16 @@ declare const componentInstanceOverridePropTypeUtil: {
563
563
  extract: (prop: unknown) => {
564
564
  override_key: string;
565
565
  schema_source: {
566
- type: "component";
567
566
  id: number;
567
+ type: "component";
568
568
  };
569
569
  override_value?: unknown;
570
570
  } | null;
571
571
  isValid: (prop: unknown) => prop is _elementor_editor_props.TransformablePropValue<"override", {
572
572
  override_key: string;
573
573
  schema_source: {
574
- type: "component";
575
574
  id: number;
575
+ type: "component";
576
576
  };
577
577
  override_value?: unknown;
578
578
  }>;
@@ -580,52 +580,52 @@ declare const componentInstanceOverridePropTypeUtil: {
580
580
  (value: {
581
581
  override_key: string;
582
582
  schema_source: {
583
- type: "component";
584
583
  id: number;
584
+ type: "component";
585
585
  };
586
586
  override_value?: unknown;
587
587
  }): _elementor_editor_props.TransformablePropValue<"override", {
588
588
  override_key: string;
589
589
  schema_source: {
590
- type: "component";
591
590
  id: number;
591
+ type: "component";
592
592
  };
593
593
  override_value?: unknown;
594
594
  }>;
595
595
  (value: {
596
596
  override_key: string;
597
597
  schema_source: {
598
- type: "component";
599
598
  id: number;
599
+ type: "component";
600
600
  };
601
601
  override_value?: unknown;
602
602
  }, createOptions?: _elementor_editor_props.CreateOptions): _elementor_editor_props.TransformablePropValue<"override", {
603
603
  override_key: string;
604
604
  schema_source: {
605
- type: "component";
606
605
  id: number;
606
+ type: "component";
607
607
  };
608
608
  override_value?: unknown;
609
609
  }>;
610
610
  (value: (prev?: {
611
611
  override_key: string;
612
612
  schema_source: {
613
- type: "component";
614
613
  id: number;
614
+ type: "component";
615
615
  };
616
616
  override_value?: unknown;
617
617
  } | undefined) => {
618
618
  override_key: string;
619
619
  schema_source: {
620
- type: "component";
621
620
  id: number;
621
+ type: "component";
622
622
  };
623
623
  override_value?: unknown;
624
624
  }, createOptions: _elementor_editor_props.CreateOptions): _elementor_editor_props.TransformablePropValue<"override", {
625
625
  override_key: string;
626
626
  schema_source: {
627
- type: "component";
628
627
  id: number;
628
+ type: "component";
629
629
  };
630
630
  override_value?: unknown;
631
631
  }>;
@@ -635,15 +635,15 @@ declare const componentInstanceOverridePropTypeUtil: {
635
635
  value: z.ZodType<{
636
636
  override_key: string;
637
637
  schema_source: {
638
- type: "component";
639
638
  id: number;
639
+ type: "component";
640
640
  };
641
641
  override_value?: unknown;
642
642
  }, z.ZodTypeDef, {
643
643
  override_key: string;
644
644
  schema_source: {
645
- type: "component";
646
645
  id: number;
646
+ type: "component";
647
647
  };
648
648
  override_value?: unknown;
649
649
  }>;
@@ -652,8 +652,8 @@ declare const componentInstanceOverridePropTypeUtil: {
652
652
  value: {
653
653
  override_key: string;
654
654
  schema_source: {
655
- type: "component";
656
655
  id: number;
656
+ type: "component";
657
657
  };
658
658
  override_value?: unknown;
659
659
  };
@@ -663,8 +663,8 @@ declare const componentInstanceOverridePropTypeUtil: {
663
663
  value: {
664
664
  override_key: string;
665
665
  schema_source: {
666
- type: "component";
667
666
  id: number;
667
+ type: "component";
668
668
  };
669
669
  override_value?: unknown;
670
670
  };
@@ -689,8 +689,8 @@ declare const componentInstancePropTypeUtil: {
689
689
  value: {
690
690
  override_key: string;
691
691
  schema_source: {
692
- type: "component";
693
692
  id: number;
693
+ type: "component";
694
694
  };
695
695
  override_value?: unknown;
696
696
  };
@@ -722,8 +722,8 @@ declare const componentInstancePropTypeUtil: {
722
722
  value: {
723
723
  override_key: string;
724
724
  schema_source: {
725
- type: "component";
726
725
  id: number;
726
+ type: "component";
727
727
  };
728
728
  override_value?: unknown;
729
729
  };
@@ -756,8 +756,8 @@ declare const componentInstancePropTypeUtil: {
756
756
  value: {
757
757
  override_key: string;
758
758
  schema_source: {
759
- type: "component";
760
759
  id: number;
760
+ type: "component";
761
761
  };
762
762
  override_value?: unknown;
763
763
  };
@@ -788,8 +788,8 @@ declare const componentInstancePropTypeUtil: {
788
788
  value: {
789
789
  override_key: string;
790
790
  schema_source: {
791
- type: "component";
792
791
  id: number;
792
+ type: "component";
793
793
  };
794
794
  override_value?: unknown;
795
795
  };
@@ -821,8 +821,8 @@ declare const componentInstancePropTypeUtil: {
821
821
  value: {
822
822
  override_key: string;
823
823
  schema_source: {
824
- type: "component";
825
824
  id: number;
825
+ type: "component";
826
826
  };
827
827
  override_value?: unknown;
828
828
  };
@@ -853,8 +853,8 @@ declare const componentInstancePropTypeUtil: {
853
853
  value: {
854
854
  override_key: string;
855
855
  schema_source: {
856
- type: "component";
857
856
  id: number;
857
+ type: "component";
858
858
  };
859
859
  override_value?: unknown;
860
860
  };
@@ -886,8 +886,8 @@ declare const componentInstancePropTypeUtil: {
886
886
  value: {
887
887
  override_key: string;
888
888
  schema_source: {
889
- type: "component";
890
889
  id: number;
890
+ type: "component";
891
891
  };
892
892
  override_value?: unknown;
893
893
  };
@@ -918,8 +918,8 @@ declare const componentInstancePropTypeUtil: {
918
918
  value: {
919
919
  override_key: string;
920
920
  schema_source: {
921
- type: "component";
922
921
  id: number;
922
+ type: "component";
923
923
  };
924
924
  override_value?: unknown;
925
925
  };
@@ -950,8 +950,8 @@ declare const componentInstancePropTypeUtil: {
950
950
  value: {
951
951
  override_key: string;
952
952
  schema_source: {
953
- type: "component";
954
953
  id: number;
954
+ type: "component";
955
955
  };
956
956
  override_value?: unknown;
957
957
  };
@@ -986,8 +986,8 @@ declare const componentInstancePropTypeUtil: {
986
986
  value: {
987
987
  override_key: string;
988
988
  schema_source: {
989
- type: "component";
990
989
  id: number;
990
+ type: "component";
991
991
  };
992
992
  override_value?: unknown;
993
993
  };
@@ -1018,8 +1018,8 @@ declare const componentInstancePropTypeUtil: {
1018
1018
  value: {
1019
1019
  override_key: string;
1020
1020
  schema_source: {
1021
- type: "component";
1022
1021
  id: number;
1022
+ type: "component";
1023
1023
  };
1024
1024
  override_value?: unknown;
1025
1025
  };
@@ -1053,8 +1053,8 @@ declare const componentInstancePropTypeUtil: {
1053
1053
  value: {
1054
1054
  override_key: string;
1055
1055
  schema_source: {
1056
- type: "component";
1057
1056
  id: number;
1057
+ type: "component";
1058
1058
  };
1059
1059
  override_value?: unknown;
1060
1060
  };
@@ -1089,8 +1089,8 @@ declare const componentInstancePropTypeUtil: {
1089
1089
  value: {
1090
1090
  override_key: string;
1091
1091
  schema_source: {
1092
- type: "component";
1093
1092
  id: number;
1093
+ type: "component";
1094
1094
  };
1095
1095
  override_value?: unknown;
1096
1096
  };
@@ -1284,9 +1284,6 @@ declare const baseSlice: _reduxjs_toolkit.Slice<ComponentsState, {
1284
1284
  addUnpublished: (state: immer_dist_internal_js.WritableDraft<ComponentsState>, { payload }: PayloadAction<UnpublishedComponent>) => void;
1285
1285
  removeUnpublished: (state: immer_dist_internal_js.WritableDraft<ComponentsState>, { payload }: PayloadAction<string | string[]>) => void;
1286
1286
  resetUnpublished: (state: immer_dist_internal_js.WritableDraft<ComponentsState>) => void;
1287
- removeStyles(state: immer_dist_internal_js.WritableDraft<ComponentsState>, { payload }: PayloadAction<{
1288
- id: ComponentId;
1289
- }>): void;
1290
1287
  addStyles: (state: immer_dist_internal_js.WritableDraft<ComponentsState>, { payload }: {
1291
1288
  payload: any;
1292
1289
  type: string;
@@ -1337,7 +1334,6 @@ declare const componentsActions: {
1337
1334
  addUnpublished(component: UnpublishedComponent): void;
1338
1335
  removeUnpublished(uids: string | string[]): void;
1339
1336
  resetUnpublished(): void;
1340
- removeStyles(id: ComponentId): void;
1341
1337
  addStyles(styles: Record<string, unknown>): void;
1342
1338
  addCreatedThisSession(uid: string): void;
1343
1339
  removeCreatedThisSession(uid: string): void;
package/dist/index.js CHANGED
@@ -94,37 +94,9 @@ var import_editor_editing_panel7 = require("@elementor/editor-editing-panel");
94
94
  var import_editor_elements_panel = require("@elementor/editor-elements-panel");
95
95
  var import_editor_styles_repository2 = require("@elementor/editor-styles-repository");
96
96
  var import_editor_v1_adapters6 = require("@elementor/editor-v1-adapters");
97
- var import_store34 = require("@elementor/store");
97
+ var import_store32 = require("@elementor/store");
98
98
  var import_i18n16 = require("@wordpress/i18n");
99
99
 
100
- // src/component-instance-transformer.ts
101
- var import_editor_canvas = require("@elementor/editor-canvas");
102
- var import_store4 = require("@elementor/store");
103
-
104
- // src/store/store.ts
105
- var import_store3 = require("@elementor/store");
106
-
107
- // src/store/store-types.ts
108
- var initialState = {
109
- data: [],
110
- unpublishedData: [],
111
- loadStatus: "idle",
112
- styles: {},
113
- createdThisSession: [],
114
- archivedThisSession: [],
115
- path: [],
116
- currentComponentId: null,
117
- updatedComponentNames: {},
118
- sanitized: {}
119
- };
120
- var SLICE_NAME = "components";
121
-
122
- // src/store/extensible-slice.ts
123
- var import_store2 = require("@elementor/store");
124
-
125
- // src/store/thunks.ts
126
- var import_store = require("@elementor/store");
127
-
128
100
  // src/api.ts
129
101
  var import_editor_v1_adapters = require("@elementor/editor-v1-adapters");
130
102
  var import_http_client = require("@elementor/http-client");
@@ -180,7 +152,33 @@ var apiClient = {
180
152
  validate: async (payload) => await (0, import_http_client.httpService)().post(`${BASE_URL}/create-validate`, payload).then((res) => res.data)
181
153
  };
182
154
 
155
+ // src/component-instance-transformer.ts
156
+ var import_editor_canvas = require("@elementor/editor-canvas");
157
+ var import_store4 = require("@elementor/store");
158
+
159
+ // src/store/store.ts
160
+ var import_store3 = require("@elementor/store");
161
+
162
+ // src/store/store-types.ts
163
+ var initialState = {
164
+ data: [],
165
+ unpublishedData: [],
166
+ loadStatus: "idle",
167
+ styles: {},
168
+ createdThisSession: [],
169
+ archivedThisSession: [],
170
+ path: [],
171
+ currentComponentId: null,
172
+ updatedComponentNames: {},
173
+ sanitized: {}
174
+ };
175
+ var SLICE_NAME = "components";
176
+
177
+ // src/store/extensible-slice.ts
178
+ var import_store2 = require("@elementor/store");
179
+
183
180
  // src/store/thunks.ts
181
+ var import_store = require("@elementor/store");
184
182
  var loadComponents = (0, import_store.__createAsyncThunk)("components/load", async () => {
185
183
  const response = await apiClient.get();
186
184
  return response;
@@ -229,10 +227,6 @@ var baseSlice = (0, import_store2.__createSlice)({
229
227
  resetUnpublished: (state) => {
230
228
  state.unpublishedData = [];
231
229
  },
232
- removeStyles(state, { payload }) {
233
- const { [payload.id]: _, ...rest } = state.styles;
234
- state.styles = rest;
235
- },
236
230
  addStyles: (state, { payload }) => {
237
231
  state.styles = { ...state.styles, ...payload };
238
232
  },
@@ -359,7 +353,16 @@ var selectUnpublishedComponents = (0, import_store3.__createSelector)(
359
353
  var selectLoadIsPending = (0, import_store3.__createSelector)(selectLoadStatus, (status) => status === "pending");
360
354
  var selectLoadIsError = (0, import_store3.__createSelector)(selectLoadStatus, (status) => status === "error");
361
355
  var selectStyles = (state) => state[SLICE_NAME].styles ?? {};
362
- var selectFlatStyles = (0, import_store3.__createSelector)(selectStylesDefinitions, (data) => Object.values(data).flat());
356
+ var selectFlatStyles = (0, import_store3.__createSelector)(
357
+ selectStylesDefinitions,
358
+ (_state, excludeComponentId = null) => excludeComponentId,
359
+ (data, excludeComponentId) => {
360
+ if (excludeComponentId === null) {
361
+ return Object.values(data).flat();
362
+ }
363
+ return Object.entries(data).filter(([id]) => id !== String(excludeComponentId)).map(([, styles]) => styles).flat();
364
+ }
365
+ );
363
366
  var selectCreatedThisSession = (0, import_store3.__createSelector)(
364
367
  getCreatedThisSession,
365
368
  (createdThisSession) => createdThisSession
@@ -1722,9 +1725,6 @@ var componentsActions = {
1722
1725
  resetUnpublished() {
1723
1726
  (0, import_store12.__dispatch)(slice.actions.resetUnpublished());
1724
1727
  },
1725
- removeStyles(id) {
1726
- (0, import_store12.__dispatch)(slice.actions.removeStyles({ id }));
1727
- },
1728
1728
  addStyles(styles) {
1729
1729
  (0, import_store12.__dispatch)(slice.actions.addStyles(styles));
1730
1730
  },
@@ -3208,20 +3208,14 @@ function blockCircularPaste(args) {
3208
3208
  return hasCircularComponent;
3209
3209
  }
3210
3210
 
3211
- // src/store/actions/remove-component-styles.ts
3212
- var import_store30 = require("@elementor/store");
3213
- function removeComponentStyles(id) {
3214
- apiClient.invalidateComponentConfigCache(id);
3215
- (0, import_store30.__dispatch)(slice.actions.removeStyles({ id }));
3216
- }
3217
-
3218
3211
  // src/store/components-styles-provider.ts
3212
+ var import_editor_elements10 = require("@elementor/editor-elements");
3219
3213
  var import_editor_styles_repository = require("@elementor/editor-styles-repository");
3220
- var import_store32 = require("@elementor/store");
3214
+ var import_store30 = require("@elementor/store");
3221
3215
  var componentsStylesProvider = (0, import_editor_styles_repository.createStylesProvider)({
3222
3216
  key: "components-styles",
3223
3217
  priority: 100,
3224
- subscribe: (cb) => (0, import_store32.__subscribeWithSelector)(
3218
+ subscribe: (cb) => (0, import_store30.__subscribeWithSelector)(
3225
3219
  (state) => state[SLICE_NAME],
3226
3220
  () => {
3227
3221
  cb();
@@ -3229,10 +3223,11 @@ var componentsStylesProvider = (0, import_editor_styles_repository.createStylesP
3229
3223
  ),
3230
3224
  actions: {
3231
3225
  all: () => {
3232
- return selectFlatStyles((0, import_store32.__getState)());
3226
+ const currentDocumentId = (0, import_editor_elements10.getCurrentDocumentId)();
3227
+ return selectFlatStyles((0, import_store30.__getState)(), currentDocumentId);
3233
3228
  },
3234
3229
  get: (id) => {
3235
- return selectFlatStyles((0, import_store32.__getState)()).find((style) => style.id === id) ?? null;
3230
+ return selectFlatStyles((0, import_store30.__getState)()).find((style) => style.id === id) ?? null;
3236
3231
  }
3237
3232
  }
3238
3233
  });
@@ -3313,7 +3308,7 @@ function load(result) {
3313
3308
  // src/init.ts
3314
3309
  function init() {
3315
3310
  import_editor_styles_repository2.stylesRepository.register(componentsStylesProvider);
3316
- (0, import_store34.__registerSlice)(slice);
3311
+ (0, import_store32.__registerSlice)(slice);
3317
3312
  (0, import_editor_canvas5.registerElementType)(
3318
3313
  COMPONENT_WIDGET_TYPE2,
3319
3314
  (options) => createComponentType({
@@ -3336,7 +3331,7 @@ function init() {
3336
3331
  (0, import_editor_v1_adapters6.registerDataHook)("after", "editor/documents/attach-preview", async () => {
3337
3332
  const { id, config } = (0, import_editor_documents6.getV1CurrentDocument)();
3338
3333
  if (id) {
3339
- removeComponentStyles(id);
3334
+ apiClient.invalidateComponentConfigCache(id);
3340
3335
  }
3341
3336
  await loadComponentsAssets(config?.elements ?? []);
3342
3337
  });