@elementor/editor-components 4.0.0-675 → 4.0.0-676
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 +20 -8
- package/dist/index.d.ts +20 -8
- package/dist/index.js +140 -97
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +84 -43
- package/dist/index.mjs.map +1 -1
- package/package.json +23 -23
- package/src/index.ts +3 -1
- package/src/store/extensible-slice.ts +168 -0
- package/src/store/selectors.ts +4 -0
- package/src/store/store-types.ts +48 -0
- package/src/store/store.ts +7 -169
package/dist/index.d.mts
CHANGED
|
@@ -11,9 +11,10 @@ import { z } from '@elementor/schema';
|
|
|
11
11
|
import { useElement } from '@elementor/editor-editing-panel';
|
|
12
12
|
import { V1Document } from '@elementor/editor-documents';
|
|
13
13
|
import * as reselect from 'reselect';
|
|
14
|
-
import
|
|
14
|
+
import { PayloadAction, SliceState } from '@elementor/store';
|
|
15
15
|
import * as immer_dist_internal_js from 'immer/dist/internal.js';
|
|
16
|
-
import
|
|
16
|
+
import * as _reduxjs_toolkit_dist_tsHelpers from '@reduxjs/toolkit/dist/tsHelpers';
|
|
17
|
+
import * as _reduxjs_toolkit from '@reduxjs/toolkit';
|
|
17
18
|
|
|
18
19
|
declare function init(): void;
|
|
19
20
|
|
|
@@ -1248,12 +1249,11 @@ declare function loadComponentsAssets(elements: V1ElementData[]): Promise<void>;
|
|
|
1248
1249
|
|
|
1249
1250
|
declare function updateOverridableProp(componentId: number, propValue: ComponentOverridablePropValue, originPropFields?: OriginPropFields): void;
|
|
1250
1251
|
|
|
1251
|
-
type Status = 'idle' | 'pending' | 'error';
|
|
1252
1252
|
type SanitizeAttributes = 'overridableProps';
|
|
1253
1253
|
type ComponentsState = {
|
|
1254
1254
|
data: PublishedComponent[];
|
|
1255
1255
|
unpublishedData: UnpublishedComponent[];
|
|
1256
|
-
loadStatus:
|
|
1256
|
+
loadStatus: 'idle' | 'pending' | 'error';
|
|
1257
1257
|
styles: StylesDefinition;
|
|
1258
1258
|
createdThisSession: Component['uid'][];
|
|
1259
1259
|
archivedThisSession: ComponentId[];
|
|
@@ -1262,14 +1262,21 @@ type ComponentsState = {
|
|
|
1262
1262
|
updatedComponentNames: Record<number, string>;
|
|
1263
1263
|
sanitized: Record<ComponentId, Partial<Record<SanitizeAttributes, boolean>>>;
|
|
1264
1264
|
};
|
|
1265
|
-
type ComponentsSlice = SliceState<typeof slice>;
|
|
1266
1265
|
type ComponentsPathItem = {
|
|
1267
1266
|
instanceId?: string;
|
|
1268
1267
|
instanceTitle?: string;
|
|
1269
1268
|
componentId: V1Document['id'];
|
|
1270
1269
|
};
|
|
1271
1270
|
declare const SLICE_NAME = "components";
|
|
1272
|
-
|
|
1271
|
+
|
|
1272
|
+
type ComponentsReducer<P> = (state: ComponentsState, action: PayloadAction<P>) => void;
|
|
1273
|
+
declare function registerComponentsReducer<P>(name: string, reducer: ComponentsReducer<P>): void;
|
|
1274
|
+
declare function createComponentsAction<P>(name: string): {
|
|
1275
|
+
action: _reduxjs_toolkit_dist_tsHelpers.IsAny<P, _reduxjs_toolkit.ActionCreatorWithPayload<any, string>, _reduxjs_toolkit_dist_tsHelpers.IsUnknown<P, _reduxjs_toolkit.ActionCreatorWithNonInferrablePayload<string>, _reduxjs_toolkit_dist_tsHelpers.IfVoid<P, _reduxjs_toolkit.ActionCreatorWithoutPayload<string>, _reduxjs_toolkit_dist_tsHelpers.IfMaybeUndefined<P, _reduxjs_toolkit.ActionCreatorWithOptionalPayload<P, string>, _reduxjs_toolkit.ActionCreatorWithPayload<P, string>>>>>;
|
|
1276
|
+
register(reducer: ComponentsReducer<P>): void;
|
|
1277
|
+
dispatch(payload: P): void;
|
|
1278
|
+
};
|
|
1279
|
+
declare const baseSlice: _reduxjs_toolkit.Slice<ComponentsState, {
|
|
1273
1280
|
add: (state: immer_dist_internal_js.WritableDraft<ComponentsState>, { payload }: PayloadAction<PublishedComponent | PublishedComponent[]>) => void;
|
|
1274
1281
|
load: (state: immer_dist_internal_js.WritableDraft<ComponentsState>, { payload }: PayloadAction<PublishedComponent[]>) => void;
|
|
1275
1282
|
addUnpublished: (state: immer_dist_internal_js.WritableDraft<ComponentsState>, { payload }: PayloadAction<UnpublishedComponent>) => void;
|
|
@@ -1286,7 +1293,7 @@ declare const slice: _reduxjs_toolkit.Slice<ComponentsState, {
|
|
|
1286
1293
|
removeCreatedThisSession: (state: immer_dist_internal_js.WritableDraft<ComponentsState>, { payload }: PayloadAction<string>) => void;
|
|
1287
1294
|
archive: (state: immer_dist_internal_js.WritableDraft<ComponentsState>, { payload }: PayloadAction<number>) => void;
|
|
1288
1295
|
setCurrentComponentId: (state: immer_dist_internal_js.WritableDraft<ComponentsState>, { payload }: PayloadAction<V1Document["id"] | null>) => void;
|
|
1289
|
-
setPath: (state: immer_dist_internal_js.WritableDraft<ComponentsState>, { payload }: PayloadAction<
|
|
1296
|
+
setPath: (state: immer_dist_internal_js.WritableDraft<ComponentsState>, { payload }: PayloadAction<ComponentsState["path"]>) => void;
|
|
1290
1297
|
setOverridableProps: (state: immer_dist_internal_js.WritableDraft<ComponentsState>, { payload }: PayloadAction<{
|
|
1291
1298
|
componentId: ComponentId;
|
|
1292
1299
|
overridableProps: OverridableProps;
|
|
@@ -1302,6 +1309,10 @@ declare const slice: _reduxjs_toolkit.Slice<ComponentsState, {
|
|
|
1302
1309
|
}>) => void;
|
|
1303
1310
|
resetSanitizedComponents: (state: immer_dist_internal_js.WritableDraft<ComponentsState>) => void;
|
|
1304
1311
|
}, "components">;
|
|
1312
|
+
declare const slice: typeof baseSlice;
|
|
1313
|
+
|
|
1314
|
+
type ComponentsSlice = SliceState<typeof slice>;
|
|
1315
|
+
|
|
1305
1316
|
declare const selectOverridableProps: ((state: ComponentsSlice, componentId: number) => OverridableProps | undefined) & reselect.OutputSelectorFields<(args_0: PublishedComponent | undefined) => OverridableProps | undefined, {
|
|
1306
1317
|
clearCache: () => void;
|
|
1307
1318
|
}> & {
|
|
@@ -1347,6 +1358,7 @@ declare const componentsSelectors: {
|
|
|
1347
1358
|
title: string;
|
|
1348
1359
|
}[];
|
|
1349
1360
|
getArchivedThisSession(): number[];
|
|
1361
|
+
getCreatedThisSession(): string[];
|
|
1350
1362
|
getComponents(): (PublishedComponent | {
|
|
1351
1363
|
uid: string;
|
|
1352
1364
|
name: string;
|
|
@@ -1409,4 +1421,4 @@ type ComponentEventData = Record<string, unknown> & {
|
|
|
1409
1421
|
declare const trackComponentEvent: ({ action, source, ...data }: ComponentEventData) => void;
|
|
1410
1422
|
declare const onElementDrop: (_args: unknown, element: V1Element) => void;
|
|
1411
1423
|
|
|
1412
|
-
export { COMPONENT_WIDGET_TYPE, type Component, type ComponentFormValues, type ComponentId, type ComponentInstanceOverride, type ComponentInstanceOverrideProp, type ComponentInstanceOverridePropValue, type ComponentInstanceOverridesPropValue, type ComponentInstanceProp, type ComponentInstancePropValue, ComponentInstanceProvider, ComponentItem, type ComponentItemProps, ComponentName, type ComponentOverridableProp, type ComponentOverridablePropValue, ComponentSearch, ComponentsList, type ComponentsPathItem, type ComponentsSlice, DetachAction, type DocumentSaveStatus, EditComponentAction, EmptySearchResult, type ExtendedWindow, EmptyState as InstanceEmptyState, InstancePanelBody, InstancePanelHeader, LoadingComponents, type OriginPropFields, type OriginalElementData, type OverridableProp, OverridablePropProvider, type OverridableProps, type OverridablePropsGroup, type PublishedComponent, SLICE_NAME, type SanitizeAttributes, SearchProvider, type Source, type StylesDefinition, type UnpublishedComponent, type UpdatedComponentName, apiClient, componentInstanceOverridePropTypeUtil, componentInstanceOverridesPropTypeUtil, componentInstancePropTypeUtil, componentOverridablePropTypeUtil, componentsActions, componentsSelectors, filterValidOverridableProps, getContainerByOriginId, getOverridableProp, getPropTypeForComponentOverride, init, isComponentInstance, loadComponentsAssets, onElementDrop, publishDraftComponentsInPageBeforeSave, resolveOverridePropValue, selectOverridableProps, selectPath, slice, switchToComponent, trackComponentEvent, updateOverridableProp, useComponentInstanceElement, useComponents, useComponentsPermissions, useCurrentComponent, useCurrentComponentId, useFilteredComponents, useInstancePanelData, useIsSanitizedComponent, useOverridablePropValue, useOverridableProps, useSanitizeOverridableProps };
|
|
1424
|
+
export { COMPONENT_WIDGET_TYPE, type Component, type ComponentFormValues, type ComponentId, type ComponentInstanceOverride, type ComponentInstanceOverrideProp, type ComponentInstanceOverridePropValue, type ComponentInstanceOverridesPropValue, type ComponentInstanceProp, type ComponentInstancePropValue, ComponentInstanceProvider, ComponentItem, type ComponentItemProps, ComponentName, type ComponentOverridableProp, type ComponentOverridablePropValue, ComponentSearch, ComponentsList, type ComponentsPathItem, type ComponentsSlice, type ComponentsState, DetachAction, type DocumentSaveStatus, EditComponentAction, EmptySearchResult, type ExtendedWindow, EmptyState as InstanceEmptyState, InstancePanelBody, InstancePanelHeader, LoadingComponents, type OriginPropFields, type OriginalElementData, type OverridableProp, OverridablePropProvider, type OverridableProps, type OverridablePropsGroup, type PublishedComponent, SLICE_NAME, type SanitizeAttributes, SearchProvider, type Source, type StylesDefinition, type UnpublishedComponent, type UpdatedComponentName, apiClient, componentInstanceOverridePropTypeUtil, componentInstanceOverridesPropTypeUtil, componentInstancePropTypeUtil, componentOverridablePropTypeUtil, componentsActions, componentsSelectors, createComponentsAction, filterValidOverridableProps, getContainerByOriginId, getOverridableProp, getPropTypeForComponentOverride, init, isComponentInstance, loadComponentsAssets, onElementDrop, publishDraftComponentsInPageBeforeSave, registerComponentsReducer, resolveOverridePropValue, selectOverridableProps, selectPath, slice, switchToComponent, trackComponentEvent, updateOverridableProp, useComponentInstanceElement, useComponents, useComponentsPermissions, useCurrentComponent, useCurrentComponentId, useFilteredComponents, useInstancePanelData, useIsSanitizedComponent, useOverridablePropValue, useOverridableProps, useSanitizeOverridableProps };
|
package/dist/index.d.ts
CHANGED
|
@@ -11,9 +11,10 @@ import { z } from '@elementor/schema';
|
|
|
11
11
|
import { useElement } from '@elementor/editor-editing-panel';
|
|
12
12
|
import { V1Document } from '@elementor/editor-documents';
|
|
13
13
|
import * as reselect from 'reselect';
|
|
14
|
-
import
|
|
14
|
+
import { PayloadAction, SliceState } from '@elementor/store';
|
|
15
15
|
import * as immer_dist_internal_js from 'immer/dist/internal.js';
|
|
16
|
-
import
|
|
16
|
+
import * as _reduxjs_toolkit_dist_tsHelpers from '@reduxjs/toolkit/dist/tsHelpers';
|
|
17
|
+
import * as _reduxjs_toolkit from '@reduxjs/toolkit';
|
|
17
18
|
|
|
18
19
|
declare function init(): void;
|
|
19
20
|
|
|
@@ -1248,12 +1249,11 @@ declare function loadComponentsAssets(elements: V1ElementData[]): Promise<void>;
|
|
|
1248
1249
|
|
|
1249
1250
|
declare function updateOverridableProp(componentId: number, propValue: ComponentOverridablePropValue, originPropFields?: OriginPropFields): void;
|
|
1250
1251
|
|
|
1251
|
-
type Status = 'idle' | 'pending' | 'error';
|
|
1252
1252
|
type SanitizeAttributes = 'overridableProps';
|
|
1253
1253
|
type ComponentsState = {
|
|
1254
1254
|
data: PublishedComponent[];
|
|
1255
1255
|
unpublishedData: UnpublishedComponent[];
|
|
1256
|
-
loadStatus:
|
|
1256
|
+
loadStatus: 'idle' | 'pending' | 'error';
|
|
1257
1257
|
styles: StylesDefinition;
|
|
1258
1258
|
createdThisSession: Component['uid'][];
|
|
1259
1259
|
archivedThisSession: ComponentId[];
|
|
@@ -1262,14 +1262,21 @@ type ComponentsState = {
|
|
|
1262
1262
|
updatedComponentNames: Record<number, string>;
|
|
1263
1263
|
sanitized: Record<ComponentId, Partial<Record<SanitizeAttributes, boolean>>>;
|
|
1264
1264
|
};
|
|
1265
|
-
type ComponentsSlice = SliceState<typeof slice>;
|
|
1266
1265
|
type ComponentsPathItem = {
|
|
1267
1266
|
instanceId?: string;
|
|
1268
1267
|
instanceTitle?: string;
|
|
1269
1268
|
componentId: V1Document['id'];
|
|
1270
1269
|
};
|
|
1271
1270
|
declare const SLICE_NAME = "components";
|
|
1272
|
-
|
|
1271
|
+
|
|
1272
|
+
type ComponentsReducer<P> = (state: ComponentsState, action: PayloadAction<P>) => void;
|
|
1273
|
+
declare function registerComponentsReducer<P>(name: string, reducer: ComponentsReducer<P>): void;
|
|
1274
|
+
declare function createComponentsAction<P>(name: string): {
|
|
1275
|
+
action: _reduxjs_toolkit_dist_tsHelpers.IsAny<P, _reduxjs_toolkit.ActionCreatorWithPayload<any, string>, _reduxjs_toolkit_dist_tsHelpers.IsUnknown<P, _reduxjs_toolkit.ActionCreatorWithNonInferrablePayload<string>, _reduxjs_toolkit_dist_tsHelpers.IfVoid<P, _reduxjs_toolkit.ActionCreatorWithoutPayload<string>, _reduxjs_toolkit_dist_tsHelpers.IfMaybeUndefined<P, _reduxjs_toolkit.ActionCreatorWithOptionalPayload<P, string>, _reduxjs_toolkit.ActionCreatorWithPayload<P, string>>>>>;
|
|
1276
|
+
register(reducer: ComponentsReducer<P>): void;
|
|
1277
|
+
dispatch(payload: P): void;
|
|
1278
|
+
};
|
|
1279
|
+
declare const baseSlice: _reduxjs_toolkit.Slice<ComponentsState, {
|
|
1273
1280
|
add: (state: immer_dist_internal_js.WritableDraft<ComponentsState>, { payload }: PayloadAction<PublishedComponent | PublishedComponent[]>) => void;
|
|
1274
1281
|
load: (state: immer_dist_internal_js.WritableDraft<ComponentsState>, { payload }: PayloadAction<PublishedComponent[]>) => void;
|
|
1275
1282
|
addUnpublished: (state: immer_dist_internal_js.WritableDraft<ComponentsState>, { payload }: PayloadAction<UnpublishedComponent>) => void;
|
|
@@ -1286,7 +1293,7 @@ declare const slice: _reduxjs_toolkit.Slice<ComponentsState, {
|
|
|
1286
1293
|
removeCreatedThisSession: (state: immer_dist_internal_js.WritableDraft<ComponentsState>, { payload }: PayloadAction<string>) => void;
|
|
1287
1294
|
archive: (state: immer_dist_internal_js.WritableDraft<ComponentsState>, { payload }: PayloadAction<number>) => void;
|
|
1288
1295
|
setCurrentComponentId: (state: immer_dist_internal_js.WritableDraft<ComponentsState>, { payload }: PayloadAction<V1Document["id"] | null>) => void;
|
|
1289
|
-
setPath: (state: immer_dist_internal_js.WritableDraft<ComponentsState>, { payload }: PayloadAction<
|
|
1296
|
+
setPath: (state: immer_dist_internal_js.WritableDraft<ComponentsState>, { payload }: PayloadAction<ComponentsState["path"]>) => void;
|
|
1290
1297
|
setOverridableProps: (state: immer_dist_internal_js.WritableDraft<ComponentsState>, { payload }: PayloadAction<{
|
|
1291
1298
|
componentId: ComponentId;
|
|
1292
1299
|
overridableProps: OverridableProps;
|
|
@@ -1302,6 +1309,10 @@ declare const slice: _reduxjs_toolkit.Slice<ComponentsState, {
|
|
|
1302
1309
|
}>) => void;
|
|
1303
1310
|
resetSanitizedComponents: (state: immer_dist_internal_js.WritableDraft<ComponentsState>) => void;
|
|
1304
1311
|
}, "components">;
|
|
1312
|
+
declare const slice: typeof baseSlice;
|
|
1313
|
+
|
|
1314
|
+
type ComponentsSlice = SliceState<typeof slice>;
|
|
1315
|
+
|
|
1305
1316
|
declare const selectOverridableProps: ((state: ComponentsSlice, componentId: number) => OverridableProps | undefined) & reselect.OutputSelectorFields<(args_0: PublishedComponent | undefined) => OverridableProps | undefined, {
|
|
1306
1317
|
clearCache: () => void;
|
|
1307
1318
|
}> & {
|
|
@@ -1347,6 +1358,7 @@ declare const componentsSelectors: {
|
|
|
1347
1358
|
title: string;
|
|
1348
1359
|
}[];
|
|
1349
1360
|
getArchivedThisSession(): number[];
|
|
1361
|
+
getCreatedThisSession(): string[];
|
|
1350
1362
|
getComponents(): (PublishedComponent | {
|
|
1351
1363
|
uid: string;
|
|
1352
1364
|
name: string;
|
|
@@ -1409,4 +1421,4 @@ type ComponentEventData = Record<string, unknown> & {
|
|
|
1409
1421
|
declare const trackComponentEvent: ({ action, source, ...data }: ComponentEventData) => void;
|
|
1410
1422
|
declare const onElementDrop: (_args: unknown, element: V1Element) => void;
|
|
1411
1423
|
|
|
1412
|
-
export { COMPONENT_WIDGET_TYPE, type Component, type ComponentFormValues, type ComponentId, type ComponentInstanceOverride, type ComponentInstanceOverrideProp, type ComponentInstanceOverridePropValue, type ComponentInstanceOverridesPropValue, type ComponentInstanceProp, type ComponentInstancePropValue, ComponentInstanceProvider, ComponentItem, type ComponentItemProps, ComponentName, type ComponentOverridableProp, type ComponentOverridablePropValue, ComponentSearch, ComponentsList, type ComponentsPathItem, type ComponentsSlice, DetachAction, type DocumentSaveStatus, EditComponentAction, EmptySearchResult, type ExtendedWindow, EmptyState as InstanceEmptyState, InstancePanelBody, InstancePanelHeader, LoadingComponents, type OriginPropFields, type OriginalElementData, type OverridableProp, OverridablePropProvider, type OverridableProps, type OverridablePropsGroup, type PublishedComponent, SLICE_NAME, type SanitizeAttributes, SearchProvider, type Source, type StylesDefinition, type UnpublishedComponent, type UpdatedComponentName, apiClient, componentInstanceOverridePropTypeUtil, componentInstanceOverridesPropTypeUtil, componentInstancePropTypeUtil, componentOverridablePropTypeUtil, componentsActions, componentsSelectors, filterValidOverridableProps, getContainerByOriginId, getOverridableProp, getPropTypeForComponentOverride, init, isComponentInstance, loadComponentsAssets, onElementDrop, publishDraftComponentsInPageBeforeSave, resolveOverridePropValue, selectOverridableProps, selectPath, slice, switchToComponent, trackComponentEvent, updateOverridableProp, useComponentInstanceElement, useComponents, useComponentsPermissions, useCurrentComponent, useCurrentComponentId, useFilteredComponents, useInstancePanelData, useIsSanitizedComponent, useOverridablePropValue, useOverridableProps, useSanitizeOverridableProps };
|
|
1424
|
+
export { COMPONENT_WIDGET_TYPE, type Component, type ComponentFormValues, type ComponentId, type ComponentInstanceOverride, type ComponentInstanceOverrideProp, type ComponentInstanceOverridePropValue, type ComponentInstanceOverridesPropValue, type ComponentInstanceProp, type ComponentInstancePropValue, ComponentInstanceProvider, ComponentItem, type ComponentItemProps, ComponentName, type ComponentOverridableProp, type ComponentOverridablePropValue, ComponentSearch, ComponentsList, type ComponentsPathItem, type ComponentsSlice, type ComponentsState, DetachAction, type DocumentSaveStatus, EditComponentAction, EmptySearchResult, type ExtendedWindow, EmptyState as InstanceEmptyState, InstancePanelBody, InstancePanelHeader, LoadingComponents, type OriginPropFields, type OriginalElementData, type OverridableProp, OverridablePropProvider, type OverridableProps, type OverridablePropsGroup, type PublishedComponent, SLICE_NAME, type SanitizeAttributes, SearchProvider, type Source, type StylesDefinition, type UnpublishedComponent, type UpdatedComponentName, apiClient, componentInstanceOverridePropTypeUtil, componentInstanceOverridesPropTypeUtil, componentInstancePropTypeUtil, componentOverridablePropTypeUtil, componentsActions, componentsSelectors, createComponentsAction, filterValidOverridableProps, getContainerByOriginId, getOverridableProp, getPropTypeForComponentOverride, init, isComponentInstance, loadComponentsAssets, onElementDrop, publishDraftComponentsInPageBeforeSave, registerComponentsReducer, resolveOverridePropValue, selectOverridableProps, selectPath, slice, switchToComponent, trackComponentEvent, updateOverridableProp, useComponentInstanceElement, useComponents, useComponentsPermissions, useCurrentComponent, useCurrentComponentId, useFilteredComponents, useInstancePanelData, useIsSanitizedComponent, useOverridablePropValue, useOverridableProps, useSanitizeOverridableProps };
|