@elementor/editor-global-classes 4.1.0-734 → 4.1.0-736
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 +38 -37
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +20 -20
- package/src/components/class-manager/global-classes-list.tsx +2 -2
- package/src/components/search-and-filter/components/filter/css-class-filter.tsx +2 -1
- package/src/components/search-and-filter/context.tsx +2 -2
package/dist/index.js
CHANGED
|
@@ -628,7 +628,7 @@ var PrefetchCssClassUsage = () => {
|
|
|
628
628
|
|
|
629
629
|
// src/components/class-manager/class-manager-panel.tsx
|
|
630
630
|
var React19 = __toESM(require("react"));
|
|
631
|
-
var
|
|
631
|
+
var import_react10 = require("react");
|
|
632
632
|
var import_editor_current_user2 = require("@elementor/editor-current-user");
|
|
633
633
|
var import_editor_documents3 = require("@elementor/editor-documents");
|
|
634
634
|
var import_editor_panels = require("@elementor/editor-panels");
|
|
@@ -666,7 +666,7 @@ var INIT_CHECKED_FILTERS = {
|
|
|
666
666
|
unused: false
|
|
667
667
|
};
|
|
668
668
|
var SearchAndFilterProvider = ({ children }) => {
|
|
669
|
-
const [filters, setFilters] =
|
|
669
|
+
const [filters, setFilters] = (0, import_react.useState)(INIT_CHECKED_FILTERS);
|
|
670
670
|
const getInitialSearchValue = () => {
|
|
671
671
|
const storedValue = localStorage.getItem("elementor-global-classes-search");
|
|
672
672
|
if (storedValue) {
|
|
@@ -1093,6 +1093,7 @@ var chipSx = {
|
|
|
1093
1093
|
|
|
1094
1094
|
// src/components/search-and-filter/components/filter/css-class-filter.tsx
|
|
1095
1095
|
var React7 = __toESM(require("react"));
|
|
1096
|
+
var import_react4 = require("react");
|
|
1096
1097
|
var import_editor_ui3 = require("@elementor/editor-ui");
|
|
1097
1098
|
var import_icons3 = require("@elementor/icons");
|
|
1098
1099
|
var import_ui5 = require("@elementor/ui");
|
|
@@ -1105,7 +1106,7 @@ var CssClassFilter = () => {
|
|
|
1105
1106
|
variant: "popover",
|
|
1106
1107
|
disableAutoFocus: true
|
|
1107
1108
|
});
|
|
1108
|
-
|
|
1109
|
+
(0, import_react4.useEffect)(() => {
|
|
1109
1110
|
if (popupState.isOpen) {
|
|
1110
1111
|
trackGlobalClasses({
|
|
1111
1112
|
event: "classManagerFiltersOpened"
|
|
@@ -1200,7 +1201,7 @@ var ClassManagerSearch = () => {
|
|
|
1200
1201
|
|
|
1201
1202
|
// src/components/class-manager/class-manager-introduction.tsx
|
|
1202
1203
|
var React9 = __toESM(require("react"));
|
|
1203
|
-
var
|
|
1204
|
+
var import_react5 = require("react");
|
|
1204
1205
|
var import_editor_current_user = require("@elementor/editor-current-user");
|
|
1205
1206
|
var import_editor_ui4 = require("@elementor/editor-ui");
|
|
1206
1207
|
var import_ui7 = require("@elementor/ui");
|
|
@@ -1208,7 +1209,7 @@ var import_i18n7 = require("@wordpress/i18n");
|
|
|
1208
1209
|
var MESSAGE_KEY = "global-class-manager";
|
|
1209
1210
|
var ClassManagerIntroduction = () => {
|
|
1210
1211
|
const [isMessageSuppressed, suppressMessage] = (0, import_editor_current_user.useSuppressedMessage)(MESSAGE_KEY);
|
|
1211
|
-
const [shouldShowIntroduction, setShouldShowIntroduction] = (0,
|
|
1212
|
+
const [shouldShowIntroduction, setShouldShowIntroduction] = (0, import_react5.useState)(!isMessageSuppressed);
|
|
1212
1213
|
return /* @__PURE__ */ React9.createElement(
|
|
1213
1214
|
import_editor_ui4.IntroductionModal,
|
|
1214
1215
|
{
|
|
@@ -1267,7 +1268,7 @@ var FlippedColorSwatchIcon = ({ sx, ...props }) => /* @__PURE__ */ React10.creat
|
|
|
1267
1268
|
|
|
1268
1269
|
// src/components/class-manager/global-classes-list.tsx
|
|
1269
1270
|
var React17 = __toESM(require("react"));
|
|
1270
|
-
var
|
|
1271
|
+
var import_react8 = require("react");
|
|
1271
1272
|
var import_store18 = require("@elementor/store");
|
|
1272
1273
|
var import_ui14 = require("@elementor/ui");
|
|
1273
1274
|
var import_i18n13 = require("@wordpress/i18n");
|
|
@@ -1280,7 +1281,7 @@ var useOrderedClasses = () => {
|
|
|
1280
1281
|
|
|
1281
1282
|
// src/components/class-manager/class-item.tsx
|
|
1282
1283
|
var React15 = __toESM(require("react"));
|
|
1283
|
-
var
|
|
1284
|
+
var import_react7 = require("react");
|
|
1284
1285
|
var import_editor_styles_repository2 = require("@elementor/editor-styles-repository");
|
|
1285
1286
|
var import_editor_ui8 = require("@elementor/editor-ui");
|
|
1286
1287
|
var import_icons9 = require("@elementor/icons");
|
|
@@ -1537,13 +1538,13 @@ var InfoAlertMessage = ({ children }) => /* @__PURE__ */ React12.createElement(
|
|
|
1537
1538
|
|
|
1538
1539
|
// src/components/class-manager/delete-confirmation-dialog.tsx
|
|
1539
1540
|
var React13 = __toESM(require("react"));
|
|
1540
|
-
var
|
|
1541
|
+
var import_react6 = require("react");
|
|
1541
1542
|
var import_editor_ui7 = require("@elementor/editor-ui");
|
|
1542
1543
|
var import_ui10 = require("@elementor/ui");
|
|
1543
1544
|
var import_i18n10 = require("@wordpress/i18n");
|
|
1544
|
-
var context = (0,
|
|
1545
|
+
var context = (0, import_react6.createContext)(null);
|
|
1545
1546
|
var DeleteConfirmationProvider = ({ children }) => {
|
|
1546
|
-
const [dialogProps, setDialogProps] = (0,
|
|
1547
|
+
const [dialogProps, setDialogProps] = (0, import_react6.useState)(null);
|
|
1547
1548
|
const openDialog2 = (props) => {
|
|
1548
1549
|
setDialogProps(props);
|
|
1549
1550
|
};
|
|
@@ -1571,7 +1572,7 @@ var DeleteClassDialog = ({ label, id: id2 }) => {
|
|
|
1571
1572
|
return /* @__PURE__ */ React13.createElement(import_editor_ui7.ConfirmationDialog, { open: true, onClose: closeDialog2 }, /* @__PURE__ */ React13.createElement(import_editor_ui7.ConfirmationDialog.Title, null, (0, import_i18n10.__)("Delete this class?", "elementor")), /* @__PURE__ */ React13.createElement(import_editor_ui7.ConfirmationDialog.Content, null, /* @__PURE__ */ React13.createElement(import_editor_ui7.ConfirmationDialog.ContentText, null, (0, import_i18n10.__)("Deleting", "elementor"), /* @__PURE__ */ React13.createElement(import_ui10.Typography, { variant: "subtitle2", component: "span" }, "\xA0", label, "\xA0"), text)), /* @__PURE__ */ React13.createElement(import_editor_ui7.ConfirmationDialog.Actions, { onClose: closeDialog2, onConfirm: handleConfirm }));
|
|
1572
1573
|
};
|
|
1573
1574
|
var useDeleteConfirmation = () => {
|
|
1574
|
-
const contextValue = (0,
|
|
1575
|
+
const contextValue = (0, import_react6.useContext)(context);
|
|
1575
1576
|
if (!contextValue) {
|
|
1576
1577
|
throw new Error("useDeleteConfirmation must be used within a DeleteConfirmationProvider");
|
|
1577
1578
|
}
|
|
@@ -1651,7 +1652,7 @@ var ClassItem = ({
|
|
|
1651
1652
|
syncToV3,
|
|
1652
1653
|
onToggleSync
|
|
1653
1654
|
}) => {
|
|
1654
|
-
const itemRef = (0,
|
|
1655
|
+
const itemRef = (0, import_react7.useRef)(null);
|
|
1655
1656
|
const {
|
|
1656
1657
|
ref: editableRef,
|
|
1657
1658
|
openEditMode,
|
|
@@ -1663,7 +1664,7 @@ var ClassItem = ({
|
|
|
1663
1664
|
onSubmit: renameClass,
|
|
1664
1665
|
validation: validateLabel
|
|
1665
1666
|
});
|
|
1666
|
-
const [selectedCssUsage, setSelectedCssUsage] = (0,
|
|
1667
|
+
const [selectedCssUsage, setSelectedCssUsage] = (0, import_react7.useState)("");
|
|
1667
1668
|
const { openDialog: openDialog2 } = useDeleteConfirmation();
|
|
1668
1669
|
const popupState = (0, import_ui12.usePopupState)({
|
|
1669
1670
|
variant: "popover",
|
|
@@ -1935,11 +1936,11 @@ var GlobalClassesList = ({ disabled, onStopSyncRequest, onStartSyncRequest }) =>
|
|
|
1935
1936
|
const cssClasses = useOrderedClasses();
|
|
1936
1937
|
const dispatch5 = (0, import_store18.__useDispatch)();
|
|
1937
1938
|
const filters = useFilters();
|
|
1938
|
-
const [draggedItemId, setDraggedItemId] =
|
|
1939
|
+
const [draggedItemId, setDraggedItemId] = (0, import_react8.useState)(null);
|
|
1939
1940
|
const draggedItemLabel = cssClasses.find((cssClass) => cssClass.id === draggedItemId)?.label ?? "";
|
|
1940
1941
|
const [classesOrder, reorderClasses] = useReorder(draggedItemId, setDraggedItemId, draggedItemLabel ?? "");
|
|
1941
1942
|
const filteredCssClasses = useFilteredCssClasses();
|
|
1942
|
-
(0,
|
|
1943
|
+
(0, import_react8.useEffect)(() => {
|
|
1943
1944
|
const handler2 = (event) => {
|
|
1944
1945
|
if (event.key === "z" && (event.ctrlKey || event.metaKey)) {
|
|
1945
1946
|
event.stopImmediatePropagation();
|
|
@@ -2058,20 +2059,20 @@ var useFilteredCssClasses = () => {
|
|
|
2058
2059
|
search: { debouncedValue: searchValue }
|
|
2059
2060
|
} = useSearchAndFilters();
|
|
2060
2061
|
const filters = useFilters();
|
|
2061
|
-
const lowercaseLabels = (0,
|
|
2062
|
+
const lowercaseLabels = (0, import_react8.useMemo)(
|
|
2062
2063
|
() => cssClasses.map((cssClass) => ({
|
|
2063
2064
|
...cssClass,
|
|
2064
2065
|
lowerLabel: cssClass.label.toLowerCase()
|
|
2065
2066
|
})),
|
|
2066
2067
|
[cssClasses]
|
|
2067
2068
|
);
|
|
2068
|
-
const filteredClasses = (0,
|
|
2069
|
+
const filteredClasses = (0, import_react8.useMemo)(() => {
|
|
2069
2070
|
if (searchValue.length > 1) {
|
|
2070
2071
|
return lowercaseLabels.filter((cssClass) => cssClass.lowerLabel.includes(searchValue.toLowerCase()));
|
|
2071
2072
|
}
|
|
2072
2073
|
return cssClasses;
|
|
2073
2074
|
}, [searchValue, cssClasses, lowercaseLabels]);
|
|
2074
|
-
return (0,
|
|
2075
|
+
return (0, import_react8.useMemo)(() => {
|
|
2075
2076
|
if (filters && filters.length > 0) {
|
|
2076
2077
|
return filteredClasses.filter((cssClass) => filters.includes(cssClass.id));
|
|
2077
2078
|
}
|
|
@@ -2091,7 +2092,7 @@ function unblockPanelInteractions() {
|
|
|
2091
2092
|
|
|
2092
2093
|
// src/components/class-manager/start-sync-to-v3-modal.tsx
|
|
2093
2094
|
var React18 = __toESM(require("react"));
|
|
2094
|
-
var
|
|
2095
|
+
var import_react9 = require("react");
|
|
2095
2096
|
var import_ui15 = require("@elementor/ui");
|
|
2096
2097
|
var import_i18n14 = require("@wordpress/i18n");
|
|
2097
2098
|
var IMAGE_URL = "https://assets.elementor.com/packages/v1/images/class-manager-sync-modal.png";
|
|
@@ -2101,9 +2102,9 @@ var StartSyncToV3Modal = ({
|
|
|
2101
2102
|
onExternalClose,
|
|
2102
2103
|
onConfirm
|
|
2103
2104
|
} = {}) => {
|
|
2104
|
-
const [shouldShowAgain, setShouldShowAgain] = (0,
|
|
2105
|
-
const hasTrackedExposure = (0,
|
|
2106
|
-
(0,
|
|
2105
|
+
const [shouldShowAgain, setShouldShowAgain] = (0, import_react9.useState)(true);
|
|
2106
|
+
const hasTrackedExposure = (0, import_react9.useRef)(false);
|
|
2107
|
+
(0, import_react9.useEffect)(() => {
|
|
2107
2108
|
if (externalOpen && classId && !hasTrackedExposure.current) {
|
|
2108
2109
|
hasTrackedExposure.current = true;
|
|
2109
2110
|
trackGlobalClasses({ event: "classSyncToV3PopupShown", classId });
|
|
@@ -2175,15 +2176,15 @@ function ClassManagerPanel() {
|
|
|
2175
2176
|
const isDirty2 = useDirtyState();
|
|
2176
2177
|
const { close: closePanel } = usePanelActions();
|
|
2177
2178
|
const { open: openSaveChangesDialog, close: closeSaveChangesDialog, isOpen: isSaveChangesDialogOpen } = (0, import_editor_ui9.useDialog)();
|
|
2178
|
-
const [stopSyncConfirmation, setStopSyncConfirmation] = (0,
|
|
2179
|
-
const [startSyncConfirmation, setStartSyncConfirmation] = (0,
|
|
2179
|
+
const [stopSyncConfirmation, setStopSyncConfirmation] = (0, import_react10.useState)(null);
|
|
2180
|
+
const [startSyncConfirmation, setStartSyncConfirmation] = (0, import_react10.useState)(null);
|
|
2180
2181
|
const [isStopSyncSuppressed] = (0, import_editor_current_user2.useSuppressedMessage)(STOP_SYNC_MESSAGE_KEY);
|
|
2181
2182
|
const { mutateAsync: publish, isPending: isPublishing } = usePublish();
|
|
2182
2183
|
const resetAndClosePanel = () => {
|
|
2183
2184
|
(0, import_store20.__dispatch)(slice.actions.resetToInitialState({ context: "frontend" }));
|
|
2184
2185
|
closeSaveChangesDialog();
|
|
2185
2186
|
};
|
|
2186
|
-
const handleStopSync = (0,
|
|
2187
|
+
const handleStopSync = (0, import_react10.useCallback)((classId) => {
|
|
2187
2188
|
(0, import_store20.__dispatch)(
|
|
2188
2189
|
slice.actions.update({
|
|
2189
2190
|
style: {
|
|
@@ -2195,7 +2196,7 @@ function ClassManagerPanel() {
|
|
|
2195
2196
|
trackGlobalClasses({ event: "classSyncToV3", classId, action: "unsync" });
|
|
2196
2197
|
setStopSyncConfirmation(null);
|
|
2197
2198
|
}, []);
|
|
2198
|
-
const handleStartSync = (0,
|
|
2199
|
+
const handleStartSync = (0, import_react10.useCallback)((classId) => {
|
|
2199
2200
|
(0, import_store20.__dispatch)(
|
|
2200
2201
|
slice.actions.update({
|
|
2201
2202
|
style: {
|
|
@@ -2207,7 +2208,7 @@ function ClassManagerPanel() {
|
|
|
2207
2208
|
trackGlobalClasses({ event: "classSyncToV3", classId, action: "sync" });
|
|
2208
2209
|
setStartSyncConfirmation(null);
|
|
2209
2210
|
}, []);
|
|
2210
|
-
const handleStopSyncRequest = (0,
|
|
2211
|
+
const handleStopSyncRequest = (0, import_react10.useCallback)(
|
|
2211
2212
|
(classId) => {
|
|
2212
2213
|
if (!isStopSyncSuppressed) {
|
|
2213
2214
|
setStopSyncConfirmation(classId);
|
|
@@ -2313,7 +2314,7 @@ var CloseButton = ({ onClose, ...props }) => /* @__PURE__ */ React19.createEleme
|
|
|
2313
2314
|
var ErrorBoundaryFallback = () => /* @__PURE__ */ React19.createElement(import_ui16.Box, { role: "alert", sx: { minHeight: "100%", p: 2 } }, /* @__PURE__ */ React19.createElement(import_ui16.Alert, { severity: "error", sx: { mb: 2, maxWidth: 400, textAlign: "center" } }, /* @__PURE__ */ React19.createElement("strong", null, (0, import_i18n15.__)("Something went wrong", "elementor"))));
|
|
2314
2315
|
var usePreventUnload = () => {
|
|
2315
2316
|
const isDirty2 = useDirtyState();
|
|
2316
|
-
(0,
|
|
2317
|
+
(0, import_react10.useEffect)(() => {
|
|
2317
2318
|
const handleBeforeUnload = (event) => {
|
|
2318
2319
|
if (isDirty2) {
|
|
2319
2320
|
event.preventDefault();
|
|
@@ -2474,11 +2475,11 @@ function createClassName(prefix) {
|
|
|
2474
2475
|
}
|
|
2475
2476
|
|
|
2476
2477
|
// src/components/global-styles-import-listener.tsx
|
|
2477
|
-
var
|
|
2478
|
+
var import_react11 = require("react");
|
|
2478
2479
|
var import_store22 = require("@elementor/store");
|
|
2479
2480
|
function GlobalStylesImportListener() {
|
|
2480
2481
|
const dispatch5 = (0, import_store22.__useDispatch)();
|
|
2481
|
-
(0,
|
|
2482
|
+
(0, import_react11.useEffect)(() => {
|
|
2482
2483
|
const handleGlobalStylesImported = (event) => {
|
|
2483
2484
|
const importedClasses = event.detail?.global_classes;
|
|
2484
2485
|
if (importedClasses?.items && importedClasses?.order) {
|
|
@@ -2525,15 +2526,15 @@ function GlobalStylesImportListener() {
|
|
|
2525
2526
|
}
|
|
2526
2527
|
|
|
2527
2528
|
// src/components/open-panel-from-url.tsx
|
|
2528
|
-
var
|
|
2529
|
+
var import_react12 = require("react");
|
|
2529
2530
|
var import_editor_v1_adapters3 = require("@elementor/editor-v1-adapters");
|
|
2530
2531
|
var ACTIVE_PANEL_PARAM = "active-panel";
|
|
2531
2532
|
var PANEL_ID = "global-classes-manager";
|
|
2532
2533
|
var DEFAULT_PANEL_ROUTE = "panel/elements";
|
|
2533
2534
|
function OpenPanelFromUrl() {
|
|
2534
2535
|
const { open } = usePanelActions();
|
|
2535
|
-
const hasOpened = (0,
|
|
2536
|
-
(0,
|
|
2536
|
+
const hasOpened = (0, import_react12.useRef)(false);
|
|
2537
|
+
(0, import_react12.useEffect)(() => {
|
|
2537
2538
|
const urlParams = new URLSearchParams(window.location.search);
|
|
2538
2539
|
const activePanel = urlParams.get(ACTIVE_PANEL_PARAM);
|
|
2539
2540
|
if (activePanel !== PANEL_ID) {
|
|
@@ -2554,11 +2555,11 @@ function OpenPanelFromUrl() {
|
|
|
2554
2555
|
}
|
|
2555
2556
|
|
|
2556
2557
|
// src/components/populate-store.tsx
|
|
2557
|
-
var
|
|
2558
|
+
var import_react13 = require("react");
|
|
2558
2559
|
var import_store24 = require("@elementor/store");
|
|
2559
2560
|
function PopulateStore() {
|
|
2560
2561
|
const dispatch5 = (0, import_store24.__useDispatch)();
|
|
2561
|
-
(0,
|
|
2562
|
+
(0, import_react13.useEffect)(() => {
|
|
2562
2563
|
Promise.all([apiClient.all("preview"), apiClient.all("frontend")]).then(
|
|
2563
2564
|
([previewRes, frontendRes]) => {
|
|
2564
2565
|
const { data: previewData } = previewRes;
|
|
@@ -3027,7 +3028,7 @@ var initMcpIntegration = (reg, canvasMcpEntry) => {
|
|
|
3027
3028
|
};
|
|
3028
3029
|
|
|
3029
3030
|
// src/sync-with-document.tsx
|
|
3030
|
-
var
|
|
3031
|
+
var import_react14 = require("react");
|
|
3031
3032
|
var import_editor_v1_adapters5 = require("@elementor/editor-v1-adapters");
|
|
3032
3033
|
|
|
3033
3034
|
// src/sync-with-document-save.ts
|
|
@@ -3092,7 +3093,7 @@ function isDirty() {
|
|
|
3092
3093
|
// src/sync-with-document.tsx
|
|
3093
3094
|
function SyncWithDocumentSave() {
|
|
3094
3095
|
const panelActions = usePanelActions();
|
|
3095
|
-
(0,
|
|
3096
|
+
(0, import_react14.useEffect)(() => {
|
|
3096
3097
|
(0, import_editor_v1_adapters5.__privateListenTo)((0, import_editor_v1_adapters5.v1ReadyEvent)(), () => {
|
|
3097
3098
|
syncWithDocumentSave(panelActions);
|
|
3098
3099
|
});
|