@elementor/editor-editing-panel 0.18.0 → 0.19.0
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/CHANGELOG.md +13 -0
- package/dist/index.d.mts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +381 -330
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +291 -240
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/editing-panel-error-fallback.tsx +12 -0
- package/src/components/editing-panel.tsx +23 -12
- package/src/components/settings-tab.tsx +3 -3
- package/src/components/style-sections/background-section/background-color-control.tsx +20 -0
- package/src/components/style-sections/background-section/background-section.tsx +15 -0
- package/src/components/style-sections/effects-section/box-shadow-repeater.tsx +1 -1
- package/src/components/style-sections/spacing-section/linked-dimensions-control.tsx +1 -1
- package/src/components/style-sections/typography-section/text-alignment-control.tsx +1 -1
- package/src/components/style-sections/typography-section/text-direction-control.tsx +1 -1
- package/src/components/style-sections/typography-section/text-style-control.tsx +1 -1
- package/src/components/style-sections/typography-section/transform-control.tsx +1 -1
- package/src/components/style-tab.tsx +5 -3
- package/src/control-replacement.tsx +3 -0
- package/src/controls/components/text-field-inner-selection.tsx +2 -2
- package/src/controls/control-context.tsx +1 -1
- package/src/controls/control-replacement.ts +1 -1
- package/src/controls/control-types/color-control.tsx +1 -1
- package/src/controls/control-types/image-control.tsx +1 -1
- package/src/controls/control-types/image-media-control.tsx +2 -2
- package/src/controls/control-types/select-control.tsx +1 -1
- package/src/controls/control-types/size-control.tsx +1 -1
- package/src/controls/control-types/toggle-control.tsx +1 -1
- package/src/controls/create-control-replacement.tsx +53 -0
- package/src/controls/create-control.tsx +12 -3
- package/src/controls/hooks/use-style-control.ts +3 -3
- package/src/{hooks → controls/hooks}/use-widget-settings.ts +1 -1
- package/src/{props → controls/props}/is-transformable.ts +1 -2
- package/src/{types.ts → controls/props/types.ts} +0 -38
- package/src/{contexts/element-context.tsx → controls/providers/element-provider.tsx} +4 -4
- package/src/controls/settings-control.tsx +5 -5
- package/src/controls/style-control.tsx +1 -1
- package/src/{sync → controls/sync}/get-container.ts +1 -1
- package/src/{sync → controls/sync}/update-settings.ts +1 -1
- package/src/controls/types.ts +39 -0
- package/src/dynamics/components/dynamic-selection-control.tsx +1 -1
- package/src/dynamics/components/dynamic-selection.tsx +5 -5
- package/src/dynamics/dynamic-control.tsx +1 -1
- package/src/dynamics/hooks/use-dynamic-tag.ts +2 -2
- package/src/dynamics/hooks/use-prop-dynamic-action.tsx +2 -2
- package/src/dynamics/hooks/use-prop-dynamic-tags.ts +3 -3
- package/src/dynamics/hooks/use-prop-value-history.ts +3 -3
- package/src/dynamics/init.ts +1 -1
- package/src/dynamics/types.ts +2 -1
- package/src/dynamics/utils.ts +2 -2
- package/src/hooks/use-element-style-prop.ts +3 -2
- package/src/hooks/use-element-styles.ts +1 -1
- package/src/hooks/use-element-type.ts +1 -1
- package/src/index.ts +1 -1
- package/src/sync/get-element-styles.ts +2 -2
- package/src/sync/get-selected-elements.ts +1 -1
- package/src/sync/types.ts +2 -1
- package/src/sync/update-style.ts +3 -2
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useState, Fragment } from 'react';
|
|
3
|
-
import { useControl } from '../../controls/control-context';
|
|
4
|
-
import { DynamicPropValue } from '../types';
|
|
5
|
-
import { usePropDynamicTags } from '../hooks/use-prop-dynamic-tags';
|
|
6
|
-
import { getAtomicDynamicTags } from '../sync/get-atomic-dynamic-tags';
|
|
7
3
|
import { SearchIcon, PhotoIcon } from '@elementor/icons';
|
|
8
4
|
import {
|
|
9
5
|
Box,
|
|
@@ -18,9 +14,13 @@ import {
|
|
|
18
14
|
Typography,
|
|
19
15
|
} from '@elementor/ui';
|
|
20
16
|
import { __ } from '@wordpress/i18n';
|
|
21
|
-
import {
|
|
17
|
+
import { useControl } from '../../controls/control-context';
|
|
18
|
+
import { usePropDynamicTags } from '../hooks/use-prop-dynamic-tags';
|
|
19
|
+
import { getAtomicDynamicTags } from '../sync/get-atomic-dynamic-tags';
|
|
22
20
|
import { isDynamicPropValue } from '../utils';
|
|
23
21
|
import { usePropValueHistory } from '../hooks/use-prop-value-history';
|
|
22
|
+
import { DynamicPropValue } from '../types';
|
|
23
|
+
import { PropKey, PropValue } from '../../controls/props/types';
|
|
24
24
|
|
|
25
25
|
type Option = {
|
|
26
26
|
label: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ControlContext, useControl } from '../controls/control-context';
|
|
3
|
-
import { PropKey, PropValue } from '../types';
|
|
3
|
+
import { PropKey, PropValue } from '../controls/props/types';
|
|
4
4
|
import { useDynamicTag } from './hooks/use-dynamic-tag';
|
|
5
5
|
import { DynamicPropValue } from './types';
|
|
6
6
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
1
2
|
import { usePropDynamicTags } from './use-prop-dynamic-tags';
|
|
3
|
+
import { PropKey } from '../../controls/props/types';
|
|
2
4
|
import { DynamicTag } from '../types';
|
|
3
|
-
import { PropKey } from '../../types';
|
|
4
|
-
import { useMemo } from 'react';
|
|
5
5
|
|
|
6
6
|
export const useDynamicTag = ( propName: PropKey, tagName: string ): DynamicTag | null => {
|
|
7
7
|
const dynamicTags = usePropDynamicTags( propName );
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { useElement } from '../../controls/providers/element-provider';
|
|
3
3
|
import { supportsDynamic } from '../utils';
|
|
4
4
|
import { DynamicSelection } from '../components/dynamic-selection';
|
|
5
5
|
import { DatabaseIcon } from '@elementor/icons';
|
|
@@ -9,7 +9,7 @@ import { PopoverActionProps } from '../../controls/control-actions/actions/popov
|
|
|
9
9
|
|
|
10
10
|
export const usePropDynamicAction = (): PopoverActionProps => {
|
|
11
11
|
const { bind } = useControl();
|
|
12
|
-
const { elementType } =
|
|
12
|
+
const { elementType } = useElement();
|
|
13
13
|
|
|
14
14
|
const propType = elementType.propsSchema[ bind ];
|
|
15
15
|
const visible = !! propType && supportsDynamic( propType );
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { useElement } from '../../controls/providers/element-provider';
|
|
3
3
|
import { getAtomicDynamicTags } from '../sync/get-atomic-dynamic-tags';
|
|
4
|
-
import { PropKey } from '../../types';
|
|
4
|
+
import { PropKey } from '../../controls/props/types';
|
|
5
5
|
import { getDynamicPropType } from '../utils';
|
|
6
6
|
|
|
7
7
|
export const usePropDynamicTags = ( propName: PropKey ) => {
|
|
8
8
|
let categories: string[] = [];
|
|
9
9
|
|
|
10
|
-
const { elementType } =
|
|
10
|
+
const { elementType } = useElement();
|
|
11
11
|
|
|
12
12
|
const propType = elementType.propsSchema?.[ propName ];
|
|
13
13
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { PropValue } from '../../controls/props/types';
|
|
2
|
+
import { useElement } from '../../controls/providers/element-provider';
|
|
3
3
|
|
|
4
4
|
export const PROPS_VALUES_HISTORY_KEY = 'elementor/dynamic/non-dynamic-values-history';
|
|
5
5
|
|
|
6
6
|
export const usePropValueHistory = ( path: string ) => {
|
|
7
7
|
const valuesHistory = getValues();
|
|
8
|
-
const { element } =
|
|
8
|
+
const { element } = useElement();
|
|
9
9
|
const key = `${ element.id }-${ path }`;
|
|
10
10
|
|
|
11
11
|
const value = valuesHistory[ key ] ?? null;
|
package/src/dynamics/init.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { DynamicSelectionControl } from './components/dynamic-selection-control';
|
|
2
|
-
import { replaceControl } from '../controls/control-replacement';
|
|
3
2
|
import { isDynamicPropValue } from './utils';
|
|
4
3
|
import { usePropDynamicAction } from './hooks/use-prop-dynamic-action';
|
|
5
4
|
import { controlActionsMenu } from '../controls/control-actions/control-actions-menu';
|
|
5
|
+
import { replaceControl } from '../control-replacement';
|
|
6
6
|
|
|
7
7
|
const { registerPopoverAction } = controlActionsMenu;
|
|
8
8
|
|
package/src/dynamics/types.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { ControlItem, PropsSchema
|
|
1
|
+
import { ControlItem, PropsSchema } from '../controls/types';
|
|
2
|
+
import { TransformablePropType, TransformablePropValue } from '../controls/props/types';
|
|
2
3
|
|
|
3
4
|
export type ExtendedWindow = Window & {
|
|
4
5
|
elementor?: {
|
package/src/dynamics/utils.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { PropType, PropValue, TransformablePropType } from '../types';
|
|
1
|
+
import { PropType, PropValue, TransformablePropType } from '../controls/props/types';
|
|
2
2
|
import { DynamicPropType, DynamicPropValue } from './types';
|
|
3
|
-
import { isTransformable } from '../props/is-transformable';
|
|
3
|
+
import { isTransformable } from '../controls/props/is-transformable';
|
|
4
4
|
|
|
5
5
|
const DYNAMIC_PROP_TYPE_KEY = 'dynamic';
|
|
6
6
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { commandEndEvent, __privateUseListenTo as useListenTo } from '@elementor/editor-v1-adapters';
|
|
2
|
-
import { ElementID, PropKey, PropValue } from '../types';
|
|
3
|
-
import { getElementStyles } from '../sync/get-element-styles';
|
|
4
2
|
import { StyleDefinition, StyleDefinitionID, StyleVariant } from '@elementor/editor-style';
|
|
3
|
+
import { PropKey, PropValue } from '../controls/props/types';
|
|
4
|
+
import { ElementID } from '../controls/types';
|
|
5
|
+
import { getElementStyles } from '../sync/get-element-styles';
|
|
5
6
|
|
|
6
7
|
export type UseElementStylePropArgs = {
|
|
7
8
|
elementID: ElementID;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __privateUseListenTo as useListenTo, commandEndEvent } from '@elementor/editor-v1-adapters';
|
|
2
2
|
import { getElementStyles } from '../sync/get-element-styles';
|
|
3
|
-
import { ElementID } from '../types';
|
|
3
|
+
import { ElementID } from '../controls/types';
|
|
4
4
|
|
|
5
5
|
export const useElementStyles = ( elementID: ElementID ) => {
|
|
6
6
|
return useListenTo(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __privateUseListenTo as useListenTo, commandEndEvent } from '@elementor/editor-v1-adapters';
|
|
2
2
|
import getWidgetsCache from '../sync/get-widgets-cache';
|
|
3
|
-
import { ElementType } from '../types';
|
|
3
|
+
import { ElementType } from '../controls/types';
|
|
4
4
|
|
|
5
5
|
export default function useElementType( type?: string ) {
|
|
6
6
|
return useListenTo(
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type { PopoverActionProps } from './controls/control-actions/actions/popover-action';
|
|
2
|
-
export { replaceControl } from './
|
|
2
|
+
export { replaceControl } from './control-replacement';
|
|
3
3
|
export { useControl } from './controls/control-context';
|
|
4
4
|
export { controlActionsMenu } from './controls/control-actions/control-actions-menu';
|
|
5
5
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import getContainer from './get-container';
|
|
2
|
-
import { ElementID } from '../types';
|
|
3
1
|
import { StyleDefinition } from '@elementor/editor-style';
|
|
2
|
+
import { ElementID } from '../controls/types';
|
|
3
|
+
import getContainer from '../controls/sync/get-container';
|
|
4
4
|
|
|
5
5
|
export const getElementStyles = ( elementID: ElementID ): Record< string, StyleDefinition > | null => {
|
|
6
6
|
const container = getContainer( elementID );
|
package/src/sync/types.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { ControlItem, PropsSchema, PropValue } from '../types';
|
|
2
1
|
import { StyleDefinition, StyleDefinitionID } from '@elementor/editor-style';
|
|
2
|
+
import { ControlItem, PropsSchema } from '../controls/types';
|
|
3
|
+
import { PropValue } from '../controls/props/types';
|
|
3
4
|
|
|
4
5
|
export type ExtendedWindow = Window & {
|
|
5
6
|
elementor?: {
|
package/src/sync/update-style.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { __privateRunCommand as runCommand } from '@elementor/editor-v1-adapters';
|
|
2
|
-
import { ElementID, PropKey, Props } from '../types';
|
|
3
|
-
import getContainer from './get-container';
|
|
4
2
|
import { StyleDefinitionID, StyleVariant } from '@elementor/editor-style';
|
|
3
|
+
import getContainer from '../controls/sync/get-container';
|
|
4
|
+
import { PropKey, Props } from '../controls/props/types';
|
|
5
|
+
import { ElementID } from '../controls/types';
|
|
5
6
|
|
|
6
7
|
export type UpdateStyleProps = {
|
|
7
8
|
elementID: ElementID;
|