@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.mts +39 -43
- package/dist/index.d.ts +39 -43
- package/dist/index.js +45 -50
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +44 -49
- package/dist/index.mjs.map +1 -1
- package/package.json +24 -24
- package/src/init.ts +2 -2
- package/src/store/components-styles-provider.ts +3 -1
- package/src/store/dispatchers.ts +0 -3
- package/src/store/extensible-slice.ts +0 -5
- package/src/store/store.ts +14 -1
- package/src/store/actions/remove-component-styles.ts +0 -9
package/dist/index.mjs
CHANGED
|
@@ -12,38 +12,6 @@ import { registerDataHook as registerDataHook2 } from "@elementor/editor-v1-adap
|
|
|
12
12
|
import { __registerSlice as registerSlice } from "@elementor/store";
|
|
13
13
|
import { __ as __16 } from "@wordpress/i18n";
|
|
14
14
|
|
|
15
|
-
// src/component-instance-transformer.ts
|
|
16
|
-
import { createTransformer } from "@elementor/editor-canvas";
|
|
17
|
-
import { __getState as getState } from "@elementor/store";
|
|
18
|
-
|
|
19
|
-
// src/store/store.ts
|
|
20
|
-
import { __createSelector as createSelector, __useSelector as useSelector } from "@elementor/store";
|
|
21
|
-
|
|
22
|
-
// src/store/store-types.ts
|
|
23
|
-
var initialState = {
|
|
24
|
-
data: [],
|
|
25
|
-
unpublishedData: [],
|
|
26
|
-
loadStatus: "idle",
|
|
27
|
-
styles: {},
|
|
28
|
-
createdThisSession: [],
|
|
29
|
-
archivedThisSession: [],
|
|
30
|
-
path: [],
|
|
31
|
-
currentComponentId: null,
|
|
32
|
-
updatedComponentNames: {},
|
|
33
|
-
sanitized: {}
|
|
34
|
-
};
|
|
35
|
-
var SLICE_NAME = "components";
|
|
36
|
-
|
|
37
|
-
// src/store/extensible-slice.ts
|
|
38
|
-
import {
|
|
39
|
-
__createAction as createAction,
|
|
40
|
-
__createSlice as createSlice,
|
|
41
|
-
__dispatch as dispatch
|
|
42
|
-
} from "@elementor/store";
|
|
43
|
-
|
|
44
|
-
// src/store/thunks.ts
|
|
45
|
-
import { __createAsyncThunk as createAsyncThunk } from "@elementor/store";
|
|
46
|
-
|
|
47
15
|
// src/api.ts
|
|
48
16
|
import { ajax } from "@elementor/editor-v1-adapters";
|
|
49
17
|
import { httpService } from "@elementor/http-client";
|
|
@@ -99,7 +67,37 @@ var apiClient = {
|
|
|
99
67
|
validate: async (payload) => await httpService().post(`${BASE_URL}/create-validate`, payload).then((res) => res.data)
|
|
100
68
|
};
|
|
101
69
|
|
|
70
|
+
// src/component-instance-transformer.ts
|
|
71
|
+
import { createTransformer } from "@elementor/editor-canvas";
|
|
72
|
+
import { __getState as getState } from "@elementor/store";
|
|
73
|
+
|
|
74
|
+
// src/store/store.ts
|
|
75
|
+
import { __createSelector as createSelector, __useSelector as useSelector } from "@elementor/store";
|
|
76
|
+
|
|
77
|
+
// src/store/store-types.ts
|
|
78
|
+
var initialState = {
|
|
79
|
+
data: [],
|
|
80
|
+
unpublishedData: [],
|
|
81
|
+
loadStatus: "idle",
|
|
82
|
+
styles: {},
|
|
83
|
+
createdThisSession: [],
|
|
84
|
+
archivedThisSession: [],
|
|
85
|
+
path: [],
|
|
86
|
+
currentComponentId: null,
|
|
87
|
+
updatedComponentNames: {},
|
|
88
|
+
sanitized: {}
|
|
89
|
+
};
|
|
90
|
+
var SLICE_NAME = "components";
|
|
91
|
+
|
|
92
|
+
// src/store/extensible-slice.ts
|
|
93
|
+
import {
|
|
94
|
+
__createAction as createAction,
|
|
95
|
+
__createSlice as createSlice,
|
|
96
|
+
__dispatch as dispatch
|
|
97
|
+
} from "@elementor/store";
|
|
98
|
+
|
|
102
99
|
// src/store/thunks.ts
|
|
100
|
+
import { __createAsyncThunk as createAsyncThunk } from "@elementor/store";
|
|
103
101
|
var loadComponents = createAsyncThunk("components/load", async () => {
|
|
104
102
|
const response = await apiClient.get();
|
|
105
103
|
return response;
|
|
@@ -148,10 +146,6 @@ var baseSlice = createSlice({
|
|
|
148
146
|
resetUnpublished: (state) => {
|
|
149
147
|
state.unpublishedData = [];
|
|
150
148
|
},
|
|
151
|
-
removeStyles(state, { payload }) {
|
|
152
|
-
const { [payload.id]: _, ...rest } = state.styles;
|
|
153
|
-
state.styles = rest;
|
|
154
|
-
},
|
|
155
149
|
addStyles: (state, { payload }) => {
|
|
156
150
|
state.styles = { ...state.styles, ...payload };
|
|
157
151
|
},
|
|
@@ -278,7 +272,16 @@ var selectUnpublishedComponents = createSelector(
|
|
|
278
272
|
var selectLoadIsPending = createSelector(selectLoadStatus, (status) => status === "pending");
|
|
279
273
|
var selectLoadIsError = createSelector(selectLoadStatus, (status) => status === "error");
|
|
280
274
|
var selectStyles = (state) => state[SLICE_NAME].styles ?? {};
|
|
281
|
-
var selectFlatStyles = createSelector(
|
|
275
|
+
var selectFlatStyles = createSelector(
|
|
276
|
+
selectStylesDefinitions,
|
|
277
|
+
(_state, excludeComponentId = null) => excludeComponentId,
|
|
278
|
+
(data, excludeComponentId) => {
|
|
279
|
+
if (excludeComponentId === null) {
|
|
280
|
+
return Object.values(data).flat();
|
|
281
|
+
}
|
|
282
|
+
return Object.entries(data).filter(([id]) => id !== String(excludeComponentId)).map(([, styles]) => styles).flat();
|
|
283
|
+
}
|
|
284
|
+
);
|
|
282
285
|
var selectCreatedThisSession = createSelector(
|
|
283
286
|
getCreatedThisSession,
|
|
284
287
|
(createdThisSession) => createdThisSession
|
|
@@ -1656,9 +1659,6 @@ var componentsActions = {
|
|
|
1656
1659
|
resetUnpublished() {
|
|
1657
1660
|
dispatch3(slice.actions.resetUnpublished());
|
|
1658
1661
|
},
|
|
1659
|
-
removeStyles(id) {
|
|
1660
|
-
dispatch3(slice.actions.removeStyles({ id }));
|
|
1661
|
-
},
|
|
1662
1662
|
addStyles(styles) {
|
|
1663
1663
|
dispatch3(slice.actions.addStyles(styles));
|
|
1664
1664
|
},
|
|
@@ -3149,14 +3149,8 @@ function blockCircularPaste(args) {
|
|
|
3149
3149
|
return hasCircularComponent;
|
|
3150
3150
|
}
|
|
3151
3151
|
|
|
3152
|
-
// src/store/actions/remove-component-styles.ts
|
|
3153
|
-
import { __dispatch as dispatch7 } from "@elementor/store";
|
|
3154
|
-
function removeComponentStyles(id) {
|
|
3155
|
-
apiClient.invalidateComponentConfigCache(id);
|
|
3156
|
-
dispatch7(slice.actions.removeStyles({ id }));
|
|
3157
|
-
}
|
|
3158
|
-
|
|
3159
3152
|
// src/store/components-styles-provider.ts
|
|
3153
|
+
import { getCurrentDocumentId } from "@elementor/editor-elements";
|
|
3160
3154
|
import { createStylesProvider } from "@elementor/editor-styles-repository";
|
|
3161
3155
|
import { __getState as getState10, __subscribeWithSelector as subscribeWithSelector } from "@elementor/store";
|
|
3162
3156
|
var componentsStylesProvider = createStylesProvider({
|
|
@@ -3170,7 +3164,8 @@ var componentsStylesProvider = createStylesProvider({
|
|
|
3170
3164
|
),
|
|
3171
3165
|
actions: {
|
|
3172
3166
|
all: () => {
|
|
3173
|
-
|
|
3167
|
+
const currentDocumentId = getCurrentDocumentId();
|
|
3168
|
+
return selectFlatStyles(getState10(), currentDocumentId);
|
|
3174
3169
|
},
|
|
3175
3170
|
get: (id) => {
|
|
3176
3171
|
return selectFlatStyles(getState10()).find((style) => style.id === id) ?? null;
|
|
@@ -3277,7 +3272,7 @@ function init() {
|
|
|
3277
3272
|
registerDataHook2("after", "editor/documents/attach-preview", async () => {
|
|
3278
3273
|
const { id, config } = getV1CurrentDocument();
|
|
3279
3274
|
if (id) {
|
|
3280
|
-
|
|
3275
|
+
apiClient.invalidateComponentConfigCache(id);
|
|
3281
3276
|
}
|
|
3282
3277
|
await loadComponentsAssets(config?.elements ?? []);
|
|
3283
3278
|
});
|