@elementor/editor-editing-panel 3.35.0-458 → 3.35.0-459
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 +33 -28
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +43 -30
- package/dist/index.mjs.map +1 -1
- package/package.json +20 -20
- package/src/dynamics/components/dynamic-conditional-control.tsx +1 -1
- package/src/dynamics/components/dynamic-selection-control.tsx +26 -5
- package/src/dynamics/dynamic-control.tsx +2 -1
- package/src/dynamics/dynamic-transformer.ts +8 -6
- package/src/dynamics/init.ts +6 -2
- package/src/dynamics/sync/get-atomic-dynamic-tags.ts +1 -1
- package/src/dynamics/types.ts +0 -12
- package/src/dynamics/utils.ts +15 -12
- package/src/sync/types.ts +14 -7
- package/src/dynamics/sync/get-elementor-config.ts +0 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elementor/editor-editing-panel",
|
|
3
|
-
"version": "3.35.0-
|
|
3
|
+
"version": "3.35.0-459",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "Elementor Team",
|
|
6
6
|
"homepage": "https://elementor.com/",
|
|
@@ -39,27 +39,27 @@
|
|
|
39
39
|
"dev": "tsup --config=../../tsup.dev.ts"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@elementor/editor": "3.35.0-
|
|
43
|
-
"@elementor/editor-canvas": "3.35.0-
|
|
44
|
-
"@elementor/editor-controls": "3.35.0-
|
|
45
|
-
"@elementor/editor-documents": "3.35.0-
|
|
46
|
-
"@elementor/editor-elements": "3.35.0-
|
|
47
|
-
"@elementor/editor-interactions": "3.35.0-
|
|
48
|
-
"@elementor/editor-panels": "3.35.0-
|
|
49
|
-
"@elementor/editor-props": "3.35.0-
|
|
50
|
-
"@elementor/editor-responsive": "3.35.0-
|
|
51
|
-
"@elementor/editor-styles": "3.35.0-
|
|
52
|
-
"@elementor/editor-styles-repository": "3.35.0-
|
|
53
|
-
"@elementor/editor-ui": "3.35.0-
|
|
54
|
-
"@elementor/editor-v1-adapters": "3.35.0-
|
|
42
|
+
"@elementor/editor": "3.35.0-459",
|
|
43
|
+
"@elementor/editor-canvas": "3.35.0-459",
|
|
44
|
+
"@elementor/editor-controls": "3.35.0-459",
|
|
45
|
+
"@elementor/editor-documents": "3.35.0-459",
|
|
46
|
+
"@elementor/editor-elements": "3.35.0-459",
|
|
47
|
+
"@elementor/editor-interactions": "3.35.0-459",
|
|
48
|
+
"@elementor/editor-panels": "3.35.0-459",
|
|
49
|
+
"@elementor/editor-props": "3.35.0-459",
|
|
50
|
+
"@elementor/editor-responsive": "3.35.0-459",
|
|
51
|
+
"@elementor/editor-styles": "3.35.0-459",
|
|
52
|
+
"@elementor/editor-styles-repository": "3.35.0-459",
|
|
53
|
+
"@elementor/editor-ui": "3.35.0-459",
|
|
54
|
+
"@elementor/editor-v1-adapters": "3.35.0-459",
|
|
55
55
|
"@elementor/icons": "^1.63.0",
|
|
56
|
-
"@elementor/locations": "3.35.0-
|
|
57
|
-
"@elementor/menus": "3.35.0-
|
|
58
|
-
"@elementor/schema": "3.35.0-
|
|
59
|
-
"@elementor/session": "3.35.0-
|
|
56
|
+
"@elementor/locations": "3.35.0-459",
|
|
57
|
+
"@elementor/menus": "3.35.0-459",
|
|
58
|
+
"@elementor/schema": "3.35.0-459",
|
|
59
|
+
"@elementor/session": "3.35.0-459",
|
|
60
60
|
"@elementor/ui": "1.36.17",
|
|
61
|
-
"@elementor/utils": "3.35.0-
|
|
62
|
-
"@elementor/wp-media": "3.35.0-
|
|
61
|
+
"@elementor/utils": "3.35.0-459",
|
|
62
|
+
"@elementor/wp-media": "3.35.0-459",
|
|
63
63
|
"@wordpress/i18n": "^5.13.0"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { isDependencyMet, type PropsSchema, type PropType, type PropValue } from '@elementor/editor-props';
|
|
3
3
|
|
|
4
|
-
import { type DynamicPropValue } from '../
|
|
4
|
+
import { type DynamicPropValue } from '../types';
|
|
5
5
|
|
|
6
6
|
type DynamicConditionalControlProps = React.PropsWithChildren< {
|
|
7
7
|
propType?: PropType;
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
type ControlComponent,
|
|
4
|
+
ControlFormLabel,
|
|
5
|
+
PropKeyProvider,
|
|
6
|
+
PropProvider,
|
|
7
|
+
useBoundProp,
|
|
8
|
+
} from '@elementor/editor-controls';
|
|
3
9
|
import type { Control, ControlLayout, ControlsSection } from '@elementor/editor-elements';
|
|
4
10
|
import { PopoverHeader } from '@elementor/editor-ui';
|
|
5
11
|
import { DatabaseIcon, SettingsIcon, XIcon } from '@elementor/icons';
|
|
@@ -24,28 +30,43 @@ import { __ } from '@wordpress/i18n';
|
|
|
24
30
|
import { PopoverBody } from '../../components/popover-body';
|
|
25
31
|
import { Control as BaseControl } from '../../controls-registry/control';
|
|
26
32
|
import { controlsRegistry, type ControlType } from '../../controls-registry/controls-registry';
|
|
33
|
+
import { createTopLevelObjectType } from '../../controls-registry/create-top-level-object-type';
|
|
27
34
|
import { usePersistDynamicValue } from '../../hooks/use-persist-dynamic-value';
|
|
28
35
|
import { DynamicControl } from '../dynamic-control';
|
|
29
36
|
import { useDynamicTag } from '../hooks/use-dynamic-tag';
|
|
30
37
|
import { type DynamicTag } from '../types';
|
|
31
|
-
import { dynamicPropTypeUtil } from '../utils';
|
|
38
|
+
import { dynamicPropTypeUtil, isDynamicTagSupported } from '../utils';
|
|
32
39
|
import { DynamicSelection } from './dynamic-selection';
|
|
33
40
|
|
|
34
41
|
const SIZE = 'tiny';
|
|
35
42
|
|
|
36
43
|
const tagsWithoutTabs = [ 'popup' ];
|
|
37
44
|
|
|
38
|
-
export const DynamicSelectionControl = () => {
|
|
39
|
-
const { setValue: setAnyValue } = useBoundProp();
|
|
45
|
+
export const DynamicSelectionControl = ( { OriginalControl, ...props }: { OriginalControl?: ControlComponent } ) => {
|
|
46
|
+
const { setValue: setAnyValue, propType } = useBoundProp();
|
|
40
47
|
const { bind, value } = useBoundProp( dynamicPropTypeUtil );
|
|
48
|
+
const originalPropType = createTopLevelObjectType( {
|
|
49
|
+
schema: {
|
|
50
|
+
[ bind ]: propType,
|
|
51
|
+
},
|
|
52
|
+
} );
|
|
41
53
|
|
|
42
54
|
const [ propValueFromHistory ] = usePersistDynamicValue( bind );
|
|
43
55
|
const selectionPopoverState = usePopupState( { variant: 'popover' } );
|
|
44
56
|
|
|
45
57
|
const { name: tagName = '' } = value;
|
|
46
|
-
|
|
47
58
|
const dynamicTag = useDynamicTag( tagName );
|
|
48
59
|
|
|
60
|
+
if ( ! isDynamicTagSupported( tagName ) && OriginalControl ) {
|
|
61
|
+
return (
|
|
62
|
+
<PropProvider propType={ originalPropType } value={ { [ bind ]: null } } setValue={ setAnyValue }>
|
|
63
|
+
<PropKeyProvider bind={ bind }>
|
|
64
|
+
<OriginalControl { ...props } />
|
|
65
|
+
</PropKeyProvider>
|
|
66
|
+
</PropProvider>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
49
70
|
const removeDynamicTag = () => {
|
|
50
71
|
setAnyValue( propValueFromHistory ?? null );
|
|
51
72
|
};
|
|
@@ -5,7 +5,8 @@ import { type PropKey } from '@elementor/editor-props';
|
|
|
5
5
|
import { createTopLevelObjectType } from '../controls-registry/create-top-level-object-type';
|
|
6
6
|
import { DynamicConditionalControl } from './components/dynamic-conditional-control';
|
|
7
7
|
import { useDynamicTag } from './hooks/use-dynamic-tag';
|
|
8
|
-
import {
|
|
8
|
+
import { type DynamicPropValue } from './types';
|
|
9
|
+
import { dynamicPropTypeUtil } from './utils';
|
|
9
10
|
|
|
10
11
|
type DynamicControlProps = React.PropsWithChildren< {
|
|
11
12
|
bind: PropKey;
|
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
import { createTransformer } from '@elementor/editor-canvas';
|
|
2
2
|
import { isTransformable, type Props } from '@elementor/editor-props';
|
|
3
3
|
|
|
4
|
+
import { type ExtendedWindow } from '../sync/types';
|
|
4
5
|
import { DynamicTagsManagerNotFoundError } from './errors';
|
|
5
|
-
import {
|
|
6
|
+
import { isDynamicTagSupported } from './utils';
|
|
6
7
|
|
|
7
8
|
type Dynamic = {
|
|
8
9
|
name?: string;
|
|
9
10
|
settings?: Props;
|
|
10
11
|
};
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
const extendedWindow = window as ExtendedWindow;
|
|
14
|
+
|
|
15
|
+
export const dynamicTransformer = createTransformer< Dynamic >( ( value, { propType } ) => {
|
|
16
|
+
if ( ! value?.name || ! isDynamicTagSupported( value.name ) ) {
|
|
17
|
+
return propType?.default ?? null;
|
|
15
18
|
}
|
|
16
19
|
|
|
17
|
-
return getDynamicValue( value.name, simpleTransform( value
|
|
20
|
+
return getDynamicValue( value.name, simpleTransform( value?.settings ?? {} ) );
|
|
18
21
|
} );
|
|
19
22
|
|
|
20
23
|
// Temporary naive transformation until we'll have a `backendTransformer` that
|
|
@@ -30,7 +33,6 @@ function simpleTransform( props: Props ) {
|
|
|
30
33
|
}
|
|
31
34
|
|
|
32
35
|
function getDynamicValue( name: string, settings: Record< string, unknown > ) {
|
|
33
|
-
const extendedWindow = window as unknown as ExtendedWindow;
|
|
34
36
|
const { dynamicTags } = extendedWindow.elementor ?? {};
|
|
35
37
|
|
|
36
38
|
if ( ! dynamicTags ) {
|
package/src/dynamics/init.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { settingsTransformersRegistry, styleTransformersRegistry } from '@elementor/editor-canvas';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
type ControlComponent,
|
|
4
|
+
injectIntoRepeaterItemIcon,
|
|
5
|
+
injectIntoRepeaterItemLabel,
|
|
6
|
+
} from '@elementor/editor-controls';
|
|
3
7
|
import { type BackgroundOverlayPropType, type PropValue } from '@elementor/editor-props';
|
|
4
8
|
import { type InjectedComponent } from '@elementor/locations';
|
|
5
9
|
|
|
@@ -18,7 +22,7 @@ const { registerPopoverAction } = controlActionsMenu;
|
|
|
18
22
|
|
|
19
23
|
export const init = () => {
|
|
20
24
|
registerControlReplacement( {
|
|
21
|
-
component: DynamicSelectionControl,
|
|
25
|
+
component: DynamicSelectionControl as ControlComponent,
|
|
22
26
|
condition: ( { value } ) => isDynamicPropValue( value ),
|
|
23
27
|
} );
|
|
24
28
|
|
package/src/dynamics/types.ts
CHANGED
|
@@ -1,18 +1,6 @@
|
|
|
1
1
|
import { type ControlItem } from '@elementor/editor-elements';
|
|
2
2
|
import { type PropsSchema, type TransformablePropType, type TransformablePropValue } from '@elementor/editor-props';
|
|
3
3
|
|
|
4
|
-
export type ExtendedWindow = Window & {
|
|
5
|
-
elementor?: {
|
|
6
|
-
config?: {
|
|
7
|
-
atomicDynamicTags?: {
|
|
8
|
-
tags: DynamicTags;
|
|
9
|
-
groups: Record< DynamicTag[ 'group' ], { title: string } >;
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
dynamicTags?: DynamicTagsManager;
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
|
|
16
4
|
export type DynamicTags = Record< DynamicTag[ 'name' ], DynamicTag >;
|
|
17
5
|
|
|
18
6
|
export type DynamicTag = {
|
package/src/dynamics/utils.ts
CHANGED
|
@@ -7,10 +7,24 @@ import {
|
|
|
7
7
|
} from '@elementor/editor-props';
|
|
8
8
|
import { z } from '@elementor/schema';
|
|
9
9
|
|
|
10
|
-
import {
|
|
10
|
+
import { getElementorConfig } from '../sync/get-elementor-globals';
|
|
11
|
+
import { type DynamicPropType, type DynamicPropValue } from './types';
|
|
11
12
|
|
|
12
13
|
const DYNAMIC_PROP_TYPE_KEY = 'dynamic';
|
|
13
14
|
|
|
15
|
+
export const dynamicPropTypeUtil = createPropUtils(
|
|
16
|
+
DYNAMIC_PROP_TYPE_KEY,
|
|
17
|
+
z.strictObject( {
|
|
18
|
+
name: z.string(),
|
|
19
|
+
group: z.string(),
|
|
20
|
+
settings: z.any().optional(),
|
|
21
|
+
} )
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
export const isDynamicTagSupported = ( tagName: string ) => {
|
|
25
|
+
return !! getElementorConfig()?.atomicDynamicTags?.tags?.[ tagName ];
|
|
26
|
+
};
|
|
27
|
+
|
|
14
28
|
const isDynamicPropType = ( prop: TransformablePropType ): prop is DynamicPropType =>
|
|
15
29
|
prop.key === DYNAMIC_PROP_TYPE_KEY;
|
|
16
30
|
|
|
@@ -27,14 +41,3 @@ export const isDynamicPropValue = ( prop: PropValue ): prop is DynamicPropValue
|
|
|
27
41
|
export const supportsDynamic = ( propType: PropType ): boolean => {
|
|
28
42
|
return !! getDynamicPropType( propType );
|
|
29
43
|
};
|
|
30
|
-
|
|
31
|
-
export const dynamicPropTypeUtil = createPropUtils(
|
|
32
|
-
DYNAMIC_PROP_TYPE_KEY,
|
|
33
|
-
z.strictObject( {
|
|
34
|
-
name: z.string(),
|
|
35
|
-
group: z.string(),
|
|
36
|
-
settings: z.any().optional(),
|
|
37
|
-
} )
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
export type DynamicPropValue = z.infer< typeof dynamicPropTypeUtil.schema >;
|
package/src/sync/types.ts
CHANGED
|
@@ -1,12 +1,26 @@
|
|
|
1
1
|
import { type ControlItem, type V1Element } from '@elementor/editor-elements';
|
|
2
2
|
import { type PropsSchema } from '@elementor/editor-props';
|
|
3
3
|
|
|
4
|
+
import { type DynamicTag, type DynamicTags, type DynamicTagsManager } from '../dynamics/types';
|
|
5
|
+
|
|
4
6
|
export type SupportedFonts = 'system' | 'googlefonts' | 'custom';
|
|
5
7
|
|
|
6
8
|
type EnqueueFont = ( fontFamily: string, context?: 'preview' | 'editor' ) => void;
|
|
7
9
|
|
|
8
10
|
export type ExtendedWindow = Window & {
|
|
9
11
|
elementor?: {
|
|
12
|
+
config?: {
|
|
13
|
+
controls?: {
|
|
14
|
+
font?: {
|
|
15
|
+
options?: Record< string, SupportedFonts >;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
atomicDynamicTags?: {
|
|
19
|
+
tags: DynamicTags;
|
|
20
|
+
groups: Record< DynamicTag[ 'group' ], { title: string } >;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
dynamicTags?: DynamicTagsManager;
|
|
10
24
|
selection?: {
|
|
11
25
|
getElements: () => V1Element[];
|
|
12
26
|
};
|
|
@@ -23,13 +37,6 @@ export type ExtendedWindow = Window & {
|
|
|
23
37
|
helpers?: {
|
|
24
38
|
enqueueFont: EnqueueFont;
|
|
25
39
|
};
|
|
26
|
-
config?: {
|
|
27
|
-
controls?: {
|
|
28
|
-
font?: {
|
|
29
|
-
options?: Record< string, SupportedFonts >;
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
40
|
};
|
|
34
41
|
elementorCommon?: {
|
|
35
42
|
config?: {
|