@elementor/editor-components 3.35.0-360 → 3.35.0-362
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.js +73 -70
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +35 -31
- package/dist/index.mjs.map +1 -1
- package/package.json +21 -21
- package/src/components/component-panel-header/component-panel-header.tsx +2 -3
- package/src/components/edit-component/component-modal.tsx +1 -0
- package/src/components/edit-component/edit-component.tsx +9 -6
- package/src/components/overridable-props/overridable-prop-control.tsx +3 -4
- package/src/components/overridable-props/overridable-prop-indicator.tsx +2 -2
- package/src/store/store.ts +6 -0
package/dist/index.mjs
CHANGED
|
@@ -25,7 +25,8 @@ import { __getState as getState } from "@elementor/store";
|
|
|
25
25
|
// src/store/store.ts
|
|
26
26
|
import {
|
|
27
27
|
__createSelector as createSelector,
|
|
28
|
-
__createSlice as createSlice
|
|
28
|
+
__createSlice as createSlice,
|
|
29
|
+
__useSelector as useSelector
|
|
29
30
|
} from "@elementor/store";
|
|
30
31
|
|
|
31
32
|
// src/store/thunks.ts
|
|
@@ -221,6 +222,9 @@ var selectCurrentComponentId = createSelector(
|
|
|
221
222
|
getCurrentComponentId,
|
|
222
223
|
(currentComponentId) => currentComponentId
|
|
223
224
|
);
|
|
225
|
+
var useCurrentComponentId = () => {
|
|
226
|
+
return useSelector(selectCurrentComponentId);
|
|
227
|
+
};
|
|
224
228
|
var selectArchivedComponents = createSelector(
|
|
225
229
|
selectArchivedData,
|
|
226
230
|
(archivedData) => archivedData
|
|
@@ -315,14 +319,13 @@ var componentOverrideTransformer = createTransformer3((override) => {
|
|
|
315
319
|
import * as React2 from "react";
|
|
316
320
|
import { getV1DocumentsManager as getV1DocumentsManager3 } from "@elementor/editor-documents";
|
|
317
321
|
import { ArrowLeftIcon, ComponentsFilledIcon } from "@elementor/icons";
|
|
318
|
-
import { __useSelector as useSelector3 } from "@elementor/store";
|
|
319
322
|
import { Box as Box2, Divider, IconButton, Stack, Tooltip, Typography } from "@elementor/ui";
|
|
320
323
|
import { __ as __2 } from "@wordpress/i18n";
|
|
321
324
|
|
|
322
325
|
// src/hooks/use-navigate-back.ts
|
|
323
326
|
import { useCallback } from "react";
|
|
324
327
|
import { getV1DocumentsManager as getV1DocumentsManager2 } from "@elementor/editor-documents";
|
|
325
|
-
import { __useSelector as
|
|
328
|
+
import { __useSelector as useSelector2 } from "@elementor/store";
|
|
326
329
|
|
|
327
330
|
// src/utils/switch-to-component.ts
|
|
328
331
|
import { __privateRunCommand as runCommand } from "@elementor/editor-v1-adapters";
|
|
@@ -338,7 +341,7 @@ function switchToComponent(componentId, componentInstanceId) {
|
|
|
338
341
|
|
|
339
342
|
// src/hooks/use-navigate-back.ts
|
|
340
343
|
function useNavigateBack() {
|
|
341
|
-
const path =
|
|
344
|
+
const path = useSelector2(selectPath);
|
|
342
345
|
const documentsManager = getV1DocumentsManager2();
|
|
343
346
|
return useCallback(() => {
|
|
344
347
|
const { componentId: prevComponentId, instanceId: prevComponentInstanceId } = path.at(-2) ?? {};
|
|
@@ -402,9 +405,9 @@ var slideUp = keyframes`
|
|
|
402
405
|
`;
|
|
403
406
|
|
|
404
407
|
// src/components/component-panel-header/use-overridable-props.ts
|
|
405
|
-
import { __useSelector as
|
|
408
|
+
import { __useSelector as useSelector3 } from "@elementor/store";
|
|
406
409
|
function useOverridableProps(componentId) {
|
|
407
|
-
return
|
|
410
|
+
return useSelector3((state) => {
|
|
408
411
|
if (!componentId) {
|
|
409
412
|
return void 0;
|
|
410
413
|
}
|
|
@@ -414,7 +417,7 @@ function useOverridableProps(componentId) {
|
|
|
414
417
|
|
|
415
418
|
// src/components/component-panel-header/component-panel-header.tsx
|
|
416
419
|
var ComponentPanelHeader = () => {
|
|
417
|
-
const currentComponentId =
|
|
420
|
+
const currentComponentId = useCurrentComponentId();
|
|
418
421
|
const overridableProps = useOverridableProps(currentComponentId);
|
|
419
422
|
const onBack = useNavigateBack();
|
|
420
423
|
const componentName = getComponentName();
|
|
@@ -1441,6 +1444,7 @@ import { useEffect as useEffect5 } from "react";
|
|
|
1441
1444
|
import { getV1DocumentsManager as getV1DocumentsManager4 } from "@elementor/editor-documents";
|
|
1442
1445
|
import { __privateListenTo as listenTo, commandEndEvent as commandEndEvent2 } from "@elementor/editor-v1-adapters";
|
|
1443
1446
|
import { __useSelector as useSelector5 } from "@elementor/store";
|
|
1447
|
+
import { throttle as throttle2 } from "@elementor/utils";
|
|
1444
1448
|
|
|
1445
1449
|
// src/store/actions/update-current-component.ts
|
|
1446
1450
|
import { setDocumentModifiedStatus as setDocumentModifiedStatus3 } from "@elementor/editor-documents";
|
|
@@ -1638,21 +1642,22 @@ function BlockEditPage() {
|
|
|
1638
1642
|
|
|
1639
1643
|
// src/components/edit-component/edit-component.tsx
|
|
1640
1644
|
function EditComponent() {
|
|
1641
|
-
const currentComponentId =
|
|
1645
|
+
const currentComponentId = useCurrentComponentId();
|
|
1642
1646
|
useHandleDocumentSwitches();
|
|
1643
|
-
const
|
|
1647
|
+
const navigateBack = useNavigateBack();
|
|
1648
|
+
const onClose = throttle2(navigateBack, 100);
|
|
1644
1649
|
const elementDom = getComponentDOMElement(currentComponentId ?? void 0);
|
|
1645
1650
|
if (!elementDom) {
|
|
1646
1651
|
return null;
|
|
1647
1652
|
}
|
|
1648
|
-
return /* @__PURE__ */ React11.createElement(ComponentModal, { element: elementDom, onClose
|
|
1653
|
+
return /* @__PURE__ */ React11.createElement(ComponentModal, { element: elementDom, onClose });
|
|
1649
1654
|
}
|
|
1650
1655
|
function useHandleDocumentSwitches() {
|
|
1651
1656
|
const documentsManager = getV1DocumentsManager4();
|
|
1652
|
-
const currentComponentId =
|
|
1657
|
+
const currentComponentId = useCurrentComponentId();
|
|
1653
1658
|
const path = useSelector5(selectPath);
|
|
1654
1659
|
useEffect5(() => {
|
|
1655
|
-
return listenTo(commandEndEvent2("editor/documents/
|
|
1660
|
+
return listenTo(commandEndEvent2("editor/documents/open"), () => {
|
|
1656
1661
|
const nextDocument = documentsManager.getCurrent();
|
|
1657
1662
|
if (nextDocument.id === currentComponentId) {
|
|
1658
1663
|
return;
|
|
@@ -1854,7 +1859,6 @@ function InstanceEditingPanel() {
|
|
|
1854
1859
|
import * as React17 from "react";
|
|
1855
1860
|
import { ControlReplacementsProvider, PropKeyProvider, PropProvider, useBoundProp } from "@elementor/editor-controls";
|
|
1856
1861
|
import { createTopLevelObjectType, useElement as useElement2 } from "@elementor/editor-editing-panel";
|
|
1857
|
-
import { __getState as getState7 } from "@elementor/store";
|
|
1858
1862
|
|
|
1859
1863
|
// src/prop-types/component-overridable-prop-type.ts
|
|
1860
1864
|
import { createPropUtils as createPropUtils4 } from "@elementor/editor-props";
|
|
@@ -1915,9 +1919,9 @@ function OverridablePropControl({
|
|
|
1915
1919
|
}) {
|
|
1916
1920
|
const { elementType } = useElement2();
|
|
1917
1921
|
const { value, bind, setValue, placeholder, ...propContext } = useBoundProp(componentOverridablePropTypeUtil);
|
|
1918
|
-
const componentId =
|
|
1922
|
+
const componentId = useCurrentComponentId();
|
|
1919
1923
|
if (!componentId) {
|
|
1920
|
-
|
|
1924
|
+
return null;
|
|
1921
1925
|
}
|
|
1922
1926
|
if (!value?.override_key) {
|
|
1923
1927
|
throw new Error("Override key is required");
|
|
@@ -1954,12 +1958,12 @@ import * as React20 from "react";
|
|
|
1954
1958
|
import { useBoundProp as useBoundProp2 } from "@elementor/editor-controls";
|
|
1955
1959
|
import { useElement as useElement3 } from "@elementor/editor-editing-panel";
|
|
1956
1960
|
import { getWidgetsCache } from "@elementor/editor-elements";
|
|
1957
|
-
import { __getState as
|
|
1961
|
+
import { __getState as getState9 } from "@elementor/store";
|
|
1958
1962
|
import { bindPopover, bindTrigger as bindTrigger2, Popover as Popover2, Tooltip as Tooltip3, usePopupState as usePopupState2 } from "@elementor/ui";
|
|
1959
1963
|
import { __ as __16 } from "@wordpress/i18n";
|
|
1960
1964
|
|
|
1961
1965
|
// src/store/actions/set-overridable-prop.ts
|
|
1962
|
-
import { __dispatch as dispatch5, __getState as
|
|
1966
|
+
import { __dispatch as dispatch5, __getState as getState7 } from "@elementor/store";
|
|
1963
1967
|
import { generateUniqueId as generateUniqueId2 } from "@elementor/utils";
|
|
1964
1968
|
import { __ as __13 } from "@wordpress/i18n";
|
|
1965
1969
|
function setOverridableProp({
|
|
@@ -1973,7 +1977,7 @@ function setOverridableProp({
|
|
|
1973
1977
|
widgetType,
|
|
1974
1978
|
originValue
|
|
1975
1979
|
}) {
|
|
1976
|
-
const overridableProps = selectOverridableProps(
|
|
1980
|
+
const overridableProps = selectOverridableProps(getState7(), componentId);
|
|
1977
1981
|
if (!overridableProps) {
|
|
1978
1982
|
return;
|
|
1979
1983
|
}
|
|
@@ -2228,12 +2232,12 @@ function OverridablePropForm({ onSubmit, groups, currentValue }) {
|
|
|
2228
2232
|
}
|
|
2229
2233
|
|
|
2230
2234
|
// src/components/overridable-props/utils/get-overridable-prop.ts
|
|
2231
|
-
import { __getState as
|
|
2235
|
+
import { __getState as getState8 } from "@elementor/store";
|
|
2232
2236
|
function getOverridableProp({
|
|
2233
2237
|
componentId,
|
|
2234
2238
|
overrideKey
|
|
2235
2239
|
}) {
|
|
2236
|
-
const overridableProps = selectOverridableProps(
|
|
2240
|
+
const overridableProps = selectOverridableProps(getState8(), componentId);
|
|
2237
2241
|
if (!overridableProps) {
|
|
2238
2242
|
return void 0;
|
|
2239
2243
|
}
|
|
@@ -2244,11 +2248,11 @@ function getOverridableProp({
|
|
|
2244
2248
|
var FORBIDDEN_KEYS = ["_cssid", "attributes"];
|
|
2245
2249
|
function OverridablePropIndicator() {
|
|
2246
2250
|
const { bind } = useBoundProp2();
|
|
2247
|
-
const componentId =
|
|
2251
|
+
const componentId = useCurrentComponentId();
|
|
2248
2252
|
if (!isPropAllowed(bind) || !componentId) {
|
|
2249
2253
|
return null;
|
|
2250
2254
|
}
|
|
2251
|
-
const overridableProps = selectOverridableProps(
|
|
2255
|
+
const overridableProps = selectOverridableProps(getState9(), componentId);
|
|
2252
2256
|
return /* @__PURE__ */ React20.createElement(Content2, { componentId, overridableProps });
|
|
2253
2257
|
}
|
|
2254
2258
|
function Content2({ componentId, overridableProps }) {
|
|
@@ -2675,7 +2679,7 @@ function removeComponentStyles(id) {
|
|
|
2675
2679
|
|
|
2676
2680
|
// src/store/components-styles-provider.ts
|
|
2677
2681
|
import { createStylesProvider } from "@elementor/editor-styles-repository";
|
|
2678
|
-
import { __getState as
|
|
2682
|
+
import { __getState as getState10, __subscribeWithSelector as subscribeWithSelector } from "@elementor/store";
|
|
2679
2683
|
var componentsStylesProvider = createStylesProvider({
|
|
2680
2684
|
key: "components-styles",
|
|
2681
2685
|
priority: 100,
|
|
@@ -2687,22 +2691,22 @@ var componentsStylesProvider = createStylesProvider({
|
|
|
2687
2691
|
),
|
|
2688
2692
|
actions: {
|
|
2689
2693
|
all: () => {
|
|
2690
|
-
return selectFlatStyles(
|
|
2694
|
+
return selectFlatStyles(getState10());
|
|
2691
2695
|
},
|
|
2692
2696
|
get: (id) => {
|
|
2693
|
-
return selectFlatStyles(
|
|
2697
|
+
return selectFlatStyles(getState10()).find((style) => style.id === id) ?? null;
|
|
2694
2698
|
}
|
|
2695
2699
|
}
|
|
2696
2700
|
});
|
|
2697
2701
|
|
|
2698
2702
|
// src/sync/create-components-before-save.ts
|
|
2699
2703
|
import { updateElementSettings } from "@elementor/editor-elements";
|
|
2700
|
-
import { __dispatch as dispatch8, __getState as
|
|
2704
|
+
import { __dispatch as dispatch8, __getState as getState11 } from "@elementor/store";
|
|
2701
2705
|
async function createComponentsBeforeSave({
|
|
2702
2706
|
elements,
|
|
2703
2707
|
status
|
|
2704
2708
|
}) {
|
|
2705
|
-
const unpublishedComponents = selectUnpublishedComponents(
|
|
2709
|
+
const unpublishedComponents = selectUnpublishedComponents(getState11());
|
|
2706
2710
|
if (!unpublishedComponents.length) {
|
|
2707
2711
|
return;
|
|
2708
2712
|
}
|
|
@@ -2776,7 +2780,7 @@ function updateElementComponentId(elementId, componentId) {
|
|
|
2776
2780
|
}
|
|
2777
2781
|
|
|
2778
2782
|
// src/sync/set-component-overridable-props-settings-before-save.ts
|
|
2779
|
-
import { __getState as
|
|
2783
|
+
import { __getState as getState12 } from "@elementor/store";
|
|
2780
2784
|
var setComponentOverridablePropsSettingsBeforeSave = ({
|
|
2781
2785
|
container
|
|
2782
2786
|
}) => {
|
|
@@ -2784,7 +2788,7 @@ var setComponentOverridablePropsSettingsBeforeSave = ({
|
|
|
2784
2788
|
if (!currentDocument || currentDocument.config.type !== COMPONENT_DOCUMENT_TYPE) {
|
|
2785
2789
|
return;
|
|
2786
2790
|
}
|
|
2787
|
-
const overridableProps = selectOverridableProps(
|
|
2791
|
+
const overridableProps = selectOverridableProps(getState12(), currentDocument.id);
|
|
2788
2792
|
if (overridableProps) {
|
|
2789
2793
|
container.settings.set("overridable_props", overridableProps);
|
|
2790
2794
|
}
|
|
@@ -2792,7 +2796,7 @@ var setComponentOverridablePropsSettingsBeforeSave = ({
|
|
|
2792
2796
|
|
|
2793
2797
|
// src/sync/update-archived-component-before-save.ts
|
|
2794
2798
|
import { notify } from "@elementor/editor-notifications";
|
|
2795
|
-
import { __getState as
|
|
2799
|
+
import { __getState as getState13 } from "@elementor/store";
|
|
2796
2800
|
var failedNotification = (message) => ({
|
|
2797
2801
|
type: "error",
|
|
2798
2802
|
message: `Failed to archive components: ${message}`,
|
|
@@ -2805,7 +2809,7 @@ var successNotification = (message) => ({
|
|
|
2805
2809
|
});
|
|
2806
2810
|
var updateArchivedComponentBeforeSave = async () => {
|
|
2807
2811
|
try {
|
|
2808
|
-
const archivedComponents = selectArchivedComponents(
|
|
2812
|
+
const archivedComponents = selectArchivedComponents(getState13());
|
|
2809
2813
|
if (!archivedComponents.length) {
|
|
2810
2814
|
return;
|
|
2811
2815
|
}
|