@elementor/editor-components 4.0.0-505 → 4.0.0-508

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.mjs CHANGED
@@ -165,12 +165,6 @@ var slice = createSlice({
165
165
  }
166
166
  component.overridableProps = payload.overridableProps;
167
167
  },
168
- clearOverridableProps: (state, { payload }) => {
169
- const component = state.data.find((comp) => comp.id === payload.componentId);
170
- if (component) {
171
- component.overridableProps = void 0;
172
- }
173
- },
174
168
  rename: (state, { payload }) => {
175
169
  const component = state.data.find((comp) => comp.uid === payload.componentUid);
176
170
  if (!component) {
@@ -288,7 +282,6 @@ var selectUpdatedComponentNames = createSelector(
288
282
 
289
283
  // src/utils/component-document-data.ts
290
284
  import { getV1DocumentsManager } from "@elementor/editor-documents";
291
- import { __dispatch as dispatch } from "@elementor/store";
292
285
  var getComponentDocumentData = async (id2) => {
293
286
  const documentManager = getV1DocumentsManager();
294
287
  try {
@@ -297,11 +290,9 @@ var getComponentDocumentData = async (id2) => {
297
290
  return null;
298
291
  }
299
292
  };
300
- var invalidateComponentCache = (id2) => {
293
+ var invalidateComponentDocumentData = (id2) => {
301
294
  const documentManager = getV1DocumentsManager();
302
295
  documentManager.invalidateCache(id2);
303
- dispatch(slice.actions.removeStyles({ id: id2 }));
304
- dispatch(slice.actions.clearOverridableProps({ componentId: id2 }));
305
296
  };
306
297
 
307
298
  // src/component-instance-transformer.ts
@@ -400,7 +391,6 @@ async function expandNavigator() {
400
391
  // src/utils/switch-to-component.ts
401
392
  async function switchToComponent(componentId, componentInstanceId, element) {
402
393
  const selector = getSelector(element, componentInstanceId);
403
- invalidateComponentCache(componentId);
404
394
  await runCommand2("editor/documents/switch", {
405
395
  id: componentId,
406
396
  selector,
@@ -514,7 +504,7 @@ import { generateUniqueId as generateUniqueId2 } from "@elementor/utils";
514
504
  import { __ as __10 } from "@wordpress/i18n";
515
505
 
516
506
  // src/store/actions/add-overridable-group.ts
517
- import { __dispatch as dispatch2, __getState as getState3 } from "@elementor/store";
507
+ import { __dispatch as dispatch, __getState as getState3 } from "@elementor/store";
518
508
  function addOverridableGroup({
519
509
  componentId,
520
510
  groupId,
@@ -531,7 +521,7 @@ function addOverridableGroup({
531
521
  label,
532
522
  props: []
533
523
  };
534
- dispatch2(
524
+ dispatch(
535
525
  slice.actions.setOverridableProps({
536
526
  componentId,
537
527
  overridableProps: {
@@ -557,7 +547,7 @@ function addOverridableGroup({
557
547
  }
558
548
 
559
549
  // src/store/actions/delete-overridable-group.ts
560
- import { __dispatch as dispatch3, __getState as getState4 } from "@elementor/store";
550
+ import { __dispatch as dispatch2, __getState as getState4 } from "@elementor/store";
561
551
 
562
552
  // src/store/utils/groups-transformers.ts
563
553
  import { generateUniqueId } from "@elementor/utils";
@@ -714,7 +704,7 @@ function deleteOverridableGroup({ componentId, groupId }) {
714
704
  return false;
715
705
  }
716
706
  const updatedGroups = deleteGroup(overridableProps.groups, groupId);
717
- dispatch3(
707
+ dispatch2(
718
708
  slice.actions.setOverridableProps({
719
709
  componentId,
720
710
  overridableProps: {
@@ -727,7 +717,7 @@ function deleteOverridableGroup({ componentId, groupId }) {
727
717
  }
728
718
 
729
719
  // src/store/actions/delete-overridable-prop.ts
730
- import { __dispatch as dispatch4, __getState as getState6 } from "@elementor/store";
720
+ import { __dispatch as dispatch3, __getState as getState6 } from "@elementor/store";
731
721
 
732
722
  // src/utils/revert-overridable-settings.ts
733
723
  import {
@@ -1181,7 +1171,7 @@ function deleteOverridableProp({ componentId, propKey, source }) {
1181
1171
  revertElementOverridableSetting(prop.elementId, prop.propKey, prop.originValue, propKey);
1182
1172
  const { [propKey]: removedProp, ...remainingProps } = overridableProps.props;
1183
1173
  const updatedGroups = removePropFromAllGroups(overridableProps.groups, propKey);
1184
- dispatch4(
1174
+ dispatch3(
1185
1175
  slice.actions.setOverridableProps({
1186
1176
  componentId,
1187
1177
  overridableProps: {
@@ -1204,7 +1194,7 @@ function deleteOverridableProp({ componentId, propKey, source }) {
1204
1194
  }
1205
1195
 
1206
1196
  // src/store/actions/reorder-group-props.ts
1207
- import { __dispatch as dispatch5, __getState as getState7 } from "@elementor/store";
1197
+ import { __dispatch as dispatch4, __getState as getState7 } from "@elementor/store";
1208
1198
  function reorderGroupProps({ componentId, groupId, newPropsOrder }) {
1209
1199
  const overridableProps = selectOverridableProps(getState7(), componentId);
1210
1200
  if (!overridableProps) {
@@ -1214,7 +1204,7 @@ function reorderGroupProps({ componentId, groupId, newPropsOrder }) {
1214
1204
  if (!group) {
1215
1205
  return;
1216
1206
  }
1217
- dispatch5(
1207
+ dispatch4(
1218
1208
  slice.actions.setOverridableProps({
1219
1209
  componentId,
1220
1210
  overridableProps: {
@@ -1235,13 +1225,13 @@ function reorderGroupProps({ componentId, groupId, newPropsOrder }) {
1235
1225
  }
1236
1226
 
1237
1227
  // src/store/actions/reorder-overridable-groups.ts
1238
- import { __dispatch as dispatch6, __getState as getState8 } from "@elementor/store";
1228
+ import { __dispatch as dispatch5, __getState as getState8 } from "@elementor/store";
1239
1229
  function reorderOverridableGroups({ componentId, newOrder }) {
1240
1230
  const overridableProps = selectOverridableProps(getState8(), componentId);
1241
1231
  if (!overridableProps) {
1242
1232
  return;
1243
1233
  }
1244
- dispatch6(
1234
+ dispatch5(
1245
1235
  slice.actions.setOverridableProps({
1246
1236
  componentId,
1247
1237
  overridableProps: {
@@ -1256,7 +1246,7 @@ function reorderOverridableGroups({ componentId, newOrder }) {
1256
1246
  }
1257
1247
 
1258
1248
  // src/store/actions/update-overridable-prop-params.ts
1259
- import { __dispatch as dispatch7, __getState as getState9 } from "@elementor/store";
1249
+ import { __dispatch as dispatch6, __getState as getState9 } from "@elementor/store";
1260
1250
  function updateOverridablePropParams({
1261
1251
  componentId,
1262
1252
  overrideKey,
@@ -1279,7 +1269,7 @@ function updateOverridablePropParams({
1279
1269
  groupId: newGroupId
1280
1270
  };
1281
1271
  const updatedGroups = movePropBetweenGroups(overridableProps.groups, overrideKey, oldGroupId, newGroupId);
1282
- dispatch7(
1272
+ dispatch6(
1283
1273
  slice.actions.setOverridableProps({
1284
1274
  componentId,
1285
1275
  overridableProps: {
@@ -1863,7 +1853,7 @@ import { useEditable } from "@elementor/editor-ui";
1863
1853
  import { __ as __9 } from "@wordpress/i18n";
1864
1854
 
1865
1855
  // src/store/actions/rename-overridable-group.ts
1866
- import { __dispatch as dispatch8, __getState as getState10 } from "@elementor/store";
1856
+ import { __dispatch as dispatch7, __getState as getState10 } from "@elementor/store";
1867
1857
  function renameOverridableGroup({ componentId, groupId, label }) {
1868
1858
  const overridableProps = selectOverridableProps(getState10(), componentId);
1869
1859
  if (!overridableProps) {
@@ -1874,7 +1864,7 @@ function renameOverridableGroup({ componentId, groupId, label }) {
1874
1864
  return false;
1875
1865
  }
1876
1866
  const updatedGroups = renameGroup(overridableProps.groups, groupId, label);
1877
- dispatch8(
1867
+ dispatch7(
1878
1868
  slice.actions.setOverridableProps({
1879
1869
  componentId,
1880
1870
  overridableProps: {
@@ -2310,10 +2300,10 @@ var useComponentsPermissions = () => {
2310
2300
  // src/store/actions/rename-component.ts
2311
2301
  import { getV1DocumentsManager as getV1DocumentsManager4, setDocumentModifiedStatus as setDocumentModifiedStatus3 } from "@elementor/editor-documents";
2312
2302
  import { getAllDescendants as getAllDescendants2 } from "@elementor/editor-elements";
2313
- import { __dispatch as dispatch9 } from "@elementor/store";
2303
+ import { __dispatch as dispatch8 } from "@elementor/store";
2314
2304
  var TITLE_EXTERNAL_CHANGE_COMMAND = "title_external_change";
2315
2305
  var renameComponent = (componentUid, newName) => {
2316
- dispatch9(slice.actions.rename({ componentUid, name: newName }));
2306
+ dispatch8(slice.actions.rename({ componentUid, name: newName }));
2317
2307
  setDocumentModifiedStatus3(true);
2318
2308
  refreshComponentInstanceTitles(componentUid);
2319
2309
  };
@@ -2366,7 +2356,7 @@ import { __ as __18 } from "@wordpress/i18n";
2366
2356
  // src/store/actions/archive-component.ts
2367
2357
  import { setDocumentModifiedStatus as setDocumentModifiedStatus4 } from "@elementor/editor-documents";
2368
2358
  import { notify } from "@elementor/editor-notifications";
2369
- import { __dispatch as dispatch10 } from "@elementor/store";
2359
+ import { __dispatch as dispatch9 } from "@elementor/store";
2370
2360
  import { __ as __15 } from "@wordpress/i18n";
2371
2361
  var successNotification = (componentId, componentName) => ({
2372
2362
  type: "success",
@@ -2375,7 +2365,7 @@ var successNotification = (componentId, componentName) => ({
2375
2365
  id: `success-archived-components-notification-${componentId}`
2376
2366
  });
2377
2367
  var archiveComponent = (componentId, componentName) => {
2378
- dispatch10(slice.actions.archive(componentId));
2368
+ dispatch9(slice.actions.archive(componentId));
2379
2369
  setDocumentModifiedStatus4(true);
2380
2370
  notify(successNotification(componentId, componentName));
2381
2371
  };
@@ -2427,7 +2417,7 @@ async function getDocumentsMap(ids, cache) {
2427
2417
  }
2428
2418
 
2429
2419
  // src/store/actions/load-components-overridable-props.ts
2430
- import { __dispatch as dispatch11, __getState as getState12 } from "@elementor/store";
2420
+ import { __dispatch as dispatch10, __getState as getState12 } from "@elementor/store";
2431
2421
  function loadComponentsOverridableProps(componentIds) {
2432
2422
  if (!componentIds.length) {
2433
2423
  return;
@@ -2443,7 +2433,7 @@ async function loadComponentOverrides(componentId) {
2443
2433
  if (!overridableProps) {
2444
2434
  return;
2445
2435
  }
2446
- dispatch11(
2436
+ dispatch10(
2447
2437
  slice.actions.setOverridableProps({
2448
2438
  componentId,
2449
2439
  overridableProps
@@ -2452,7 +2442,7 @@ async function loadComponentOverrides(componentId) {
2452
2442
  }
2453
2443
 
2454
2444
  // src/store/actions/load-components-styles.ts
2455
- import { __dispatch as dispatch12, __getState as getState13 } from "@elementor/store";
2445
+ import { __dispatch as dispatch11, __getState as getState13 } from "@elementor/store";
2456
2446
  function loadComponentsStyles(documents) {
2457
2447
  if (!documents.size) {
2458
2448
  return;
@@ -2468,7 +2458,7 @@ function addStyles(documents) {
2468
2458
  const styles = Object.fromEntries(
2469
2459
  [...documents.entries()].map(([id2, document]) => [id2, extractStylesFromDocument(document)])
2470
2460
  );
2471
- dispatch12(slice.actions.addStyles(styles));
2461
+ dispatch11(slice.actions.addStyles(styles));
2472
2462
  }
2473
2463
  function extractStylesFromDocument(document) {
2474
2464
  if (!document.elements?.length) {
@@ -3142,7 +3132,7 @@ function findNonAtomicElementsInElement(element) {
3142
3132
  // src/store/actions/create-unpublished-component.ts
3143
3133
  import { createElements, deleteElement, getContainer as getContainer3 } from "@elementor/editor-elements";
3144
3134
  import { __privateRunCommand as runCommand3 } from "@elementor/editor-v1-adapters";
3145
- import { __dispatch as dispatch13 } from "@elementor/store";
3135
+ import { __dispatch as dispatch12 } from "@elementor/store";
3146
3136
  import { generateUniqueId as generateUniqueId3 } from "@elementor/utils";
3147
3137
  import { __ as __22 } from "@wordpress/i18n";
3148
3138
  async function createUnpublishedComponent({
@@ -3163,14 +3153,14 @@ async function createUnpublishedComponent({
3163
3153
  parentId: container?.parent?.id ?? "",
3164
3154
  index: container?.view?._index ?? 0
3165
3155
  };
3166
- dispatch13(
3156
+ dispatch12(
3167
3157
  slice.actions.addUnpublished({
3168
3158
  ...componentBase,
3169
3159
  elements: [elementDataWithOverridablesReverted],
3170
3160
  overridableProps
3171
3161
  })
3172
3162
  );
3173
- dispatch13(slice.actions.addCreatedThisSession(generatedUid));
3163
+ dispatch12(slice.actions.addCreatedThisSession(generatedUid));
3174
3164
  const componentInstance = await replaceElementWithComponent(element, componentBase);
3175
3165
  trackComponentEvent({
3176
3166
  action: "created",
@@ -3183,8 +3173,8 @@ async function createUnpublishedComponent({
3183
3173
  await runCommand3("document/save/auto");
3184
3174
  } catch (error) {
3185
3175
  restoreOriginalElement(originalElement, componentInstance.id);
3186
- dispatch13(slice.actions.removeUnpublished(generatedUid));
3187
- dispatch13(slice.actions.removeCreatedThisSession(generatedUid));
3176
+ dispatch12(slice.actions.removeUnpublished(generatedUid));
3177
+ dispatch12(slice.actions.removeCreatedThisSession(generatedUid));
3188
3178
  throw error;
3189
3179
  }
3190
3180
  return { uid: generatedUid, instanceId: componentInstance.id };
@@ -3478,12 +3468,12 @@ function updateCurrentComponent({
3478
3468
  path,
3479
3469
  currentComponentId
3480
3470
  }) {
3481
- const dispatch21 = getStore2()?.dispatch;
3482
- if (!dispatch21) {
3471
+ const dispatch20 = getStore2()?.dispatch;
3472
+ if (!dispatch20) {
3483
3473
  return;
3484
3474
  }
3485
- dispatch21(slice.actions.setPath(path));
3486
- dispatch21(slice.actions.setCurrentComponentId(currentComponentId));
3475
+ dispatch20(slice.actions.setPath(path));
3476
+ dispatch20(slice.actions.setCurrentComponentId(currentComponentId));
3487
3477
  }
3488
3478
 
3489
3479
  // src/components/edit-component/component-modal.tsx
@@ -3897,7 +3887,7 @@ var useOverridablePropValue = () => useContext2(OverridablePropContext)?.value;
3897
3887
  var useComponentInstanceElement = () => useContext2(OverridablePropContext)?.componentInstanceElement;
3898
3888
 
3899
3889
  // src/store/actions/update-overridable-prop.ts
3900
- import { __dispatch as dispatch14, __getState as getState16 } from "@elementor/store";
3890
+ import { __dispatch as dispatch13, __getState as getState16 } from "@elementor/store";
3901
3891
 
3902
3892
  // src/utils/resolve-override-prop-value.ts
3903
3893
  var resolveOverridePropValue = (originalPropValue) => {
@@ -3957,7 +3947,7 @@ function updateOverridableProp(componentId, propValue, originPropFields) {
3957
3947
  }
3958
3948
  }
3959
3949
  };
3960
- dispatch14(
3950
+ dispatch13(
3961
3951
  slice.actions.setOverridableProps({
3962
3952
  componentId,
3963
3953
  overridableProps: newOverridableProps
@@ -4326,7 +4316,7 @@ import { bindPopover as bindPopover2, bindTrigger as bindTrigger4, Popover as Po
4326
4316
  import { __ as __29 } from "@wordpress/i18n";
4327
4317
 
4328
4318
  // src/store/actions/set-overridable-prop.ts
4329
- import { __dispatch as dispatch15, __getState as getState17 } from "@elementor/store";
4319
+ import { __dispatch as dispatch14, __getState as getState17 } from "@elementor/store";
4330
4320
  import { generateUniqueId as generateUniqueId4 } from "@elementor/utils";
4331
4321
  function setOverridableProp({
4332
4322
  componentId,
@@ -4378,7 +4368,7 @@ function setOverridableProp({
4378
4368
  if (isChangingGroups) {
4379
4369
  groups = removePropFromGroup(groups, existingOverridableProp.groupId, overridableProp.overrideKey);
4380
4370
  }
4381
- dispatch15(
4371
+ dispatch14(
4382
4372
  slice.actions.setOverridableProps({
4383
4373
  componentId,
4384
4374
  overridableProps: {
@@ -4943,10 +4933,10 @@ function initMcp() {
4943
4933
 
4944
4934
  // src/populate-store.ts
4945
4935
  import { useEffect as useEffect6 } from "react";
4946
- import { __dispatch as dispatch16 } from "@elementor/store";
4936
+ import { __dispatch as dispatch15 } from "@elementor/store";
4947
4937
  function PopulateStore() {
4948
4938
  useEffect6(() => {
4949
- dispatch16(loadComponents());
4939
+ dispatch15(loadComponents());
4950
4940
  }, []);
4951
4941
  return null;
4952
4942
  }
@@ -5079,10 +5069,10 @@ function blockCircularPaste(args) {
5079
5069
  }
5080
5070
 
5081
5071
  // src/store/actions/remove-component-styles.ts
5082
- import { __dispatch as dispatch17 } from "@elementor/store";
5072
+ import { __dispatch as dispatch16 } from "@elementor/store";
5083
5073
  function removeComponentStyles(id2) {
5084
5074
  apiClient.invalidateComponentConfigCache(id2);
5085
- dispatch17(slice.actions.removeStyles({ id: id2 }));
5075
+ dispatch16(slice.actions.removeStyles({ id: id2 }));
5086
5076
  }
5087
5077
 
5088
5078
  // src/store/components-styles-provider.ts
@@ -5109,7 +5099,7 @@ var componentsStylesProvider = createStylesProvider({
5109
5099
 
5110
5100
  // src/sync/create-components-before-save.ts
5111
5101
  import { updateElementSettings as updateElementSettings2 } from "@elementor/editor-elements";
5112
- import { __dispatch as dispatch18, __getState as getState21 } from "@elementor/store";
5102
+ import { __dispatch as dispatch17, __getState as getState21 } from "@elementor/store";
5113
5103
  async function createComponentsBeforeSave({
5114
5104
  elements,
5115
5105
  status
@@ -5121,7 +5111,7 @@ async function createComponentsBeforeSave({
5121
5111
  try {
5122
5112
  const uidToComponentId = await createComponents(unpublishedComponents, status);
5123
5113
  updateComponentInstances(elements, uidToComponentId);
5124
- dispatch18(
5114
+ dispatch17(
5125
5115
  slice.actions.add(
5126
5116
  unpublishedComponents.map((component) => ({
5127
5117
  id: uidToComponentId.get(component.uid),
@@ -5131,10 +5121,10 @@ async function createComponentsBeforeSave({
5131
5121
  }))
5132
5122
  )
5133
5123
  );
5134
- dispatch18(slice.actions.resetUnpublished());
5124
+ dispatch17(slice.actions.resetUnpublished());
5135
5125
  } catch (error) {
5136
5126
  const failedUids = unpublishedComponents.map((component) => component.uid);
5137
- dispatch18(slice.actions.removeUnpublished(failedUids));
5127
+ dispatch17(slice.actions.removeUnpublished(failedUids));
5138
5128
  throw new Error(`Failed to publish components: ${error}`);
5139
5129
  }
5140
5130
  }
@@ -5204,7 +5194,7 @@ async function publishDraftComponentsInPageBeforeSave({ status, elements }) {
5204
5194
  return;
5205
5195
  }
5206
5196
  await apiClient.updateStatuses(draftIds, "publish");
5207
- draftIds.forEach((id2) => invalidateComponentCache(id2));
5197
+ draftIds.forEach((id2) => invalidateComponentDocumentData(id2));
5208
5198
  }
5209
5199
 
5210
5200
  // src/sync/set-component-overridable-props-settings-before-save.ts
@@ -5247,7 +5237,7 @@ var updateArchivedComponentBeforeSave = async (status) => {
5247
5237
  };
5248
5238
 
5249
5239
  // src/sync/update-component-title-before-save.ts
5250
- import { __dispatch as dispatch19, __getState as getState24 } from "@elementor/store";
5240
+ import { __dispatch as dispatch18, __getState as getState24 } from "@elementor/store";
5251
5241
  var updateComponentTitleBeforeSave = async (status) => {
5252
5242
  const updatedComponentNames = selectUpdatedComponentNames(getState24());
5253
5243
  if (!updatedComponentNames.length) {
@@ -5255,7 +5245,7 @@ var updateComponentTitleBeforeSave = async (status) => {
5255
5245
  }
5256
5246
  const result = await apiClient.updateComponentTitle(updatedComponentNames, status);
5257
5247
  if (result.failedIds.length === 0) {
5258
- dispatch19(slice.actions.cleanUpdatedComponentNames());
5248
+ dispatch18(slice.actions.cleanUpdatedComponentNames());
5259
5249
  }
5260
5250
  };
5261
5251
 
@@ -5283,7 +5273,7 @@ var updateExistingComponentsBeforeSave = async ({
5283
5273
  // src/sync/cleanup-overridable-props-on-delete.ts
5284
5274
  import { getAllDescendants as getAllDescendants5 } from "@elementor/editor-elements";
5285
5275
  import { registerDataHook } from "@elementor/editor-v1-adapters";
5286
- import { __dispatch as dispatch20, __getState as getState25 } from "@elementor/store";
5276
+ import { __dispatch as dispatch19, __getState as getState25 } from "@elementor/store";
5287
5277
  function initCleanupOverridablePropsOnDelete() {
5288
5278
  registerDataHook("dependency", "document/elements/delete", (args) => {
5289
5279
  const state = getState25();
@@ -5317,7 +5307,7 @@ function initCleanupOverridablePropsOnDelete() {
5317
5307
  for (const propKey of propKeysToDelete) {
5318
5308
  updatedGroups = removePropFromAllGroups(updatedGroups, propKey);
5319
5309
  }
5320
- dispatch20(
5310
+ dispatch19(
5321
5311
  slice.actions.setOverridableProps({
5322
5312
  componentId: currentComponentId,
5323
5313
  overridableProps: {