@elementor/editor-editing-panel 4.5.0-1191 → 4.5.0-1193

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
@@ -1027,6 +1027,9 @@ var CLASS_STATES_MAP = {
1027
1027
  },
1028
1028
  disabled: {
1029
1029
  label: __5("disabled", "elementor")
1030
+ },
1031
+ current: {
1032
+ label: __5("current", "elementor")
1030
1033
  }
1031
1034
  };
1032
1035
  function useElementStates() {
@@ -1035,7 +1038,7 @@ function useElementStates() {
1035
1038
  const elementStates = styleStates.map(({ value, name }) => ({
1036
1039
  key: value,
1037
1040
  value,
1038
- label: CLASS_STATES_MAP[value]?.label ?? name
1041
+ label: CLASS_STATES_MAP[name]?.label ?? name
1039
1042
  }));
1040
1043
  return {
1041
1044
  elementStates,
@@ -3264,6 +3267,20 @@ function useActiveAndAppliedClassId(id, appliedClassesIds) {
3264
3267
  return isClassApplied ? id : null;
3265
3268
  }
3266
3269
 
3270
+ // src/hooks/use-broadcast-style-state.ts
3271
+ import { useEffect as useEffect4 } from "react";
3272
+ var STYLE_STATE_EVENT = "elementor/editor/style-state/change";
3273
+ function broadcast(id, state) {
3274
+ window.dispatchEvent(new CustomEvent(STYLE_STATE_EVENT, { detail: { id, state } }));
3275
+ }
3276
+ function useBroadcastStyleState(state) {
3277
+ const { element } = useElement();
3278
+ useEffect4(() => {
3279
+ broadcast(element.id, state);
3280
+ return () => broadcast(element.id, null);
3281
+ }, [element.id, state]);
3282
+ }
3283
+
3267
3284
  // src/components/style-sections.tsx
3268
3285
  import * as React90 from "react";
3269
3286
 
@@ -3292,7 +3309,7 @@ function useStylesField(propName, meta) {
3292
3309
  }
3293
3310
 
3294
3311
  // src/controls-registry/conditional-field.tsx
3295
- import { useEffect as useEffect4, useRef as useRef4 } from "react";
3312
+ import { useEffect as useEffect5, useRef as useRef4 } from "react";
3296
3313
  import { useBoundProp as useBoundProp2 } from "@elementor/editor-controls";
3297
3314
  import { isDependency as isDependency2, isDependencyMet as isDependencyMet2 } from "@elementor/editor-props";
3298
3315
  var ConditionalField = ({ children }) => {
@@ -3322,7 +3339,7 @@ function useSyncDepsWithInherited({
3322
3339
  resetValue
3323
3340
  }) {
3324
3341
  const syncRef = useRef4({ hasSynced: false, prevDepValues: depValues });
3325
- useEffect4(() => {
3342
+ useEffect5(() => {
3326
3343
  const { hasSynced, prevDepValues } = syncRef.current;
3327
3344
  if (hasSynced && value && wasDepsCleared(prevDepValues, depValues) || isHidden && depValues && value) {
3328
3345
  resetValue();
@@ -4253,7 +4270,7 @@ var FlexDirectionField = () => {
4253
4270
 
4254
4271
  // src/components/style-sections/layout-section/flex-order-field.tsx
4255
4272
  import * as React51 from "react";
4256
- import { useEffect as useEffect5, useMemo as useMemo9, useState as useState8 } from "react";
4273
+ import { useEffect as useEffect6, useMemo as useMemo9, useState as useState8 } from "react";
4257
4274
  import {
4258
4275
  ControlToggleButtonGroup,
4259
4276
  NumberControl as NumberControl2,
@@ -4308,12 +4325,12 @@ function FlexOrderFieldContent() {
4308
4325
  const currentGroup = useMemo9(() => getGroupControlValue(order?.value ?? null), [order]);
4309
4326
  const [activeGroup, setActiveGroup] = useState8(currentGroup);
4310
4327
  const [customLocked, setCustomLocked] = useState8(false);
4311
- useEffect5(() => {
4328
+ useEffect6(() => {
4312
4329
  if (!customLocked) {
4313
4330
  setActiveGroup(currentGroup);
4314
4331
  }
4315
4332
  }, [currentGroup, customLocked]);
4316
- useEffect5(() => {
4333
+ useEffect6(() => {
4317
4334
  if (order === null) {
4318
4335
  setCustomLocked(false);
4319
4336
  }
@@ -4373,7 +4390,7 @@ var getGroupControlValue = (order) => {
4373
4390
 
4374
4391
  // src/components/style-sections/layout-section/flex-size-field.tsx
4375
4392
  import * as React52 from "react";
4376
- import { useEffect as useEffect6, useMemo as useMemo10, useRef as useRef7, useState as useState9 } from "react";
4393
+ import { useEffect as useEffect7, useMemo as useMemo10, useRef as useRef7, useState as useState9 } from "react";
4377
4394
  import {
4378
4395
  ControlToggleButtonGroup as ControlToggleButtonGroup2,
4379
4396
  NumberControl as NumberControl3,
@@ -4419,12 +4436,12 @@ var FlexSizeFieldContent = () => {
4419
4436
  const currentGroup = useMemo10(() => getActiveGroup(flexValues), [flexValues]);
4420
4437
  const [activeGroup, setActiveGroup] = useState9(currentGroup);
4421
4438
  const [customLocked, setCustomLocked] = useState9(false);
4422
- useEffect6(() => {
4439
+ useEffect7(() => {
4423
4440
  if (!customLocked) {
4424
4441
  setActiveGroup(currentGroup);
4425
4442
  }
4426
4443
  }, [currentGroup, customLocked]);
4427
- useEffect6(() => {
4444
+ useEffect7(() => {
4428
4445
  if (value === null) {
4429
4446
  setCustomLocked(false);
4430
4447
  }
@@ -5007,7 +5024,7 @@ var shouldDisplayFlexFields = (display, local) => {
5007
5024
 
5008
5025
  // src/components/style-sections/position-section/position-section.tsx
5009
5026
  import * as React67 from "react";
5010
- import { useEffect as useEffect7, useRef as useRef12 } from "react";
5027
+ import { useEffect as useEffect8, useRef as useRef12 } from "react";
5011
5028
  import { useSessionStorage as useSessionStorage4 } from "@elementor/session";
5012
5029
  import { styled as styled6 } from "@elementor/ui";
5013
5030
  import { __ as __44 } from "@wordpress/i18n";
@@ -5134,7 +5151,7 @@ var PositionSection = () => {
5134
5151
  const positionPrevRef = useRef12(position);
5135
5152
  const { values: dependentValues, setValues: setDependentValues } = useStylesFields(DEPENDENT_PROP_NAMES);
5136
5153
  const [savedDependentValues, saveToHistory, clearHistory] = usePersistDimensions();
5137
- useEffect7(() => {
5154
+ useEffect8(() => {
5138
5155
  if (position && position?.value === POSITION_STATIC && hasDependentValues(dependentValues)) {
5139
5156
  saveToHistory(extractDimensions(dependentValues));
5140
5157
  }
@@ -5849,6 +5866,7 @@ var StyleTab = () => {
5849
5866
  const [activeStyleDefId, setActiveStyleDefId] = useActiveStyleDefId(currentClassesProp ?? "");
5850
5867
  const [activeStyleState, setActiveStyleState] = useState10(null);
5851
5868
  const breakpoint = useActiveBreakpoint2();
5869
+ useBroadcastStyleState(activeStyleState);
5852
5870
  if (!currentClassesProp) {
5853
5871
  return null;
5854
5872
  }
@@ -6032,7 +6050,7 @@ import { registerPanel } from "@elementor/editor-panels";
6032
6050
  import { blockCommand } from "@elementor/editor-v1-adapters";
6033
6051
 
6034
6052
  // src/hooks/use-open-editor-panel.ts
6035
- import { useEffect as useEffect8 } from "react";
6053
+ import { useEffect as useEffect9 } from "react";
6036
6054
  import { __privateListenTo as listenTo, commandStartEvent } from "@elementor/editor-v1-adapters";
6037
6055
 
6038
6056
  // src/panel.ts
@@ -6056,7 +6074,7 @@ var isAtomicWidgetSelected = () => {
6056
6074
  // src/hooks/use-open-editor-panel.ts
6057
6075
  var useOpenEditorPanel = () => {
6058
6076
  const { open } = usePanelActions();
6059
- useEffect8(() => {
6077
+ useEffect9(() => {
6060
6078
  return listenTo(commandStartEvent("panel/editor/open"), () => {
6061
6079
  if (isAtomicWidgetSelected()) {
6062
6080
  open();
@@ -6294,7 +6312,7 @@ var useActions = () => {
6294
6312
  };
6295
6313
 
6296
6314
  // src/controls-registry/element-controls/accordion-items-control/use-show-icon-write-through.ts
6297
- import { useEffect as useEffect9, useRef as useRef20 } from "react";
6315
+ import { useEffect as useEffect10, useRef as useRef20 } from "react";
6298
6316
  import { getContainer as getContainer4, getElementSettings as getElementSettings2, updateElementSettings as updateElementSettings4 } from "@elementor/editor-elements";
6299
6317
  import { booleanPropTypeUtil as booleanPropTypeUtil3 } from "@elementor/editor-props";
6300
6318
  import { undoable as undoable5 } from "@elementor/editor-v1-adapters";
@@ -6401,7 +6419,7 @@ var cascadeDifferentOpenIconToHeaders = undoable5(
6401
6419
  );
6402
6420
  function useDifferentOpenIconWriteThrough(accordionId, differentOpenIcon) {
6403
6421
  const previousRef = useRef20(null);
6404
- useEffect9(() => {
6422
+ useEffect10(() => {
6405
6423
  const previous = previousRef.current;
6406
6424
  previousRef.current = { accordionId, differentOpenIcon };
6407
6425
  if (!previous || previous.accordionId !== accordionId || previous.differentOpenIcon === differentOpenIcon) {
@@ -6412,7 +6430,7 @@ function useDifferentOpenIconWriteThrough(accordionId, differentOpenIcon) {
6412
6430
  }
6413
6431
  function useShowIconWriteThrough(accordionId, showIcon) {
6414
6432
  const previousRef = useRef20(null);
6415
- useEffect9(() => {
6433
+ useEffect10(() => {
6416
6434
  const previous = previousRef.current;
6417
6435
  previousRef.current = { accordionId, showIcon };
6418
6436
  if (!previous || previous.accordionId !== accordionId || previous.showIcon === showIcon) {
@@ -6662,7 +6680,7 @@ var addItem = ({
6662
6680
  };
6663
6681
 
6664
6682
  // src/controls-registry/element-controls/list-items-control/use-show-markers-write-through.ts
6665
- import { useEffect as useEffect10, useRef as useRef21 } from "react";
6683
+ import { useEffect as useEffect11, useRef as useRef21 } from "react";
6666
6684
  import { getContainer as getContainer6, getElementSettings as getElementSettings3, updateElementSettings as updateElementSettings5 } from "@elementor/editor-elements";
6667
6685
  import { booleanPropTypeUtil as booleanPropTypeUtil6 } from "@elementor/editor-props";
6668
6686
  import { undoable as undoable6 } from "@elementor/editor-v1-adapters";
@@ -6715,7 +6733,7 @@ function getListItemIds(listId) {
6715
6733
  }
6716
6734
  function useShowMarkersWriteThrough(listId, showMarkers) {
6717
6735
  const previousRef = useRef21(null);
6718
- useEffect10(() => {
6736
+ useEffect11(() => {
6719
6737
  const previous = previousRef.current;
6720
6738
  previousRef.current = { listId, showMarkers };
6721
6739
  if (!previous || previous.listId !== listId || previous.showMarkers === showMarkers) {
@@ -7771,7 +7789,7 @@ var DynamicControl = ({ bind, children }) => {
7771
7789
 
7772
7790
  // src/dynamics/components/dynamic-selection.tsx
7773
7791
  import * as React103 from "react";
7774
- import { Fragment as Fragment17, useEffect as useEffect11, useState as useState11 } from "react";
7792
+ import { Fragment as Fragment17, useEffect as useEffect12, useState as useState11 } from "react";
7775
7793
  import { trackUpgradePromotionClick, trackViewPromotion, useBoundProp as useBoundProp12 } from "@elementor/editor-controls";
7776
7794
  import { CtaButton, PopoverHeader, PopoverMenuList, SearchField, SectionPopoverBody } from "@elementor/editor-ui";
7777
7795
  import { DatabaseIcon as DatabaseIcon2 } from "@elementor/icons";
@@ -7791,7 +7809,7 @@ var DynamicSelection = ({ close: closePopover, expired = false }) => {
7791
7809
  const isCurrentValueDynamic = !!dynamicValue;
7792
7810
  const options13 = useFilteredOptions(searchValue);
7793
7811
  const hasNoDynamicTags = !options13.length && !searchValue.trim();
7794
- useEffect11(() => {
7812
+ useEffect12(() => {
7795
7813
  if (hasNoDynamicTags) {
7796
7814
  trackViewPromotion({ target_name: "dynamic_tags" });
7797
7815
  } else if (expired) {
@@ -8318,7 +8336,7 @@ import {
8318
8336
  import { __ as __85 } from "@wordpress/i18n";
8319
8337
 
8320
8338
  // src/styles-inheritance/hooks/use-normalized-inheritance-chain-items.tsx
8321
- import { isValidElement, useEffect as useEffect12, useState as useState12 } from "react";
8339
+ import { isValidElement, useEffect as useEffect13, useState as useState12 } from "react";
8322
8340
  import { UnknownStyleStateError } from "@elementor/editor-canvas";
8323
8341
  import {
8324
8342
  isClassState as isClassState2,
@@ -8329,7 +8347,7 @@ import { __ as __83 } from "@wordpress/i18n";
8329
8347
  var MAXIMUM_ITEMS = 2;
8330
8348
  var useNormalizedInheritanceChainItems = (inheritanceChain, bind, resolve) => {
8331
8349
  const [items3, setItems] = useState12([]);
8332
- useEffect12(() => {
8350
+ useEffect13(() => {
8333
8351
  (async () => {
8334
8352
  const normalizedItems = await Promise.all(
8335
8353
  inheritanceChain.filter(({ style }) => style).map((item, index) => normalizeInheritanceItem(item, index, bind, resolve))