@elementor/editor-editing-panel 0.18.0 → 1.0.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 +64 -0
- package/dist/index.d.mts +8 -24
- package/dist/index.d.ts +8 -24
- package/dist/index.js +1452 -1122
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1436 -1099
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -14
- package/src/components/accordion-section.tsx +3 -2
- package/src/components/add-or-remove-content.tsx +42 -0
- package/src/components/collapsible-field.tsx +34 -0
- package/src/components/editing-panel-error-fallback.tsx +12 -0
- package/src/components/editing-panel.tsx +27 -19
- package/src/components/settings-tab.tsx +12 -11
- package/src/components/style-sections/background-section/background-color-field.tsx +21 -0
- package/src/components/style-sections/background-section/background-section.tsx +15 -0
- package/src/components/style-sections/border-section/border-color-field.tsx +21 -0
- package/src/components/style-sections/border-section/border-field.tsx +47 -0
- package/src/components/style-sections/border-section/border-radius-field.tsx +48 -0
- package/src/components/style-sections/border-section/border-section.tsx +16 -0
- package/src/components/style-sections/border-section/border-style-field.tsx +32 -0
- package/src/components/style-sections/border-section/border-width-field.tsx +42 -0
- package/src/components/style-sections/effects-section/effects-section.tsx +5 -5
- package/src/components/style-sections/position-section/dimensions-field.tsx +46 -0
- package/src/components/style-sections/position-section/position-field.tsx +28 -0
- package/src/components/style-sections/position-section/position-section.tsx +15 -2
- package/src/components/style-sections/position-section/z-index-field.tsx +21 -0
- package/src/components/style-sections/size-section/overflow-field.tsx +45 -0
- package/src/components/style-sections/size-section/size-section.tsx +55 -0
- package/src/components/style-sections/spacing-section/spacing-section.tsx +6 -6
- package/src/components/style-sections/typography-section/font-size-field.tsx +21 -0
- package/src/components/style-sections/typography-section/{font-weight-control.tsx → font-weight-field.tsx} +7 -6
- package/src/components/style-sections/typography-section/letter-spacing-field.tsx +21 -0
- package/src/components/style-sections/typography-section/{text-alignment-control.tsx → text-alignment-field.tsx} +8 -8
- package/src/components/style-sections/typography-section/text-color-field.tsx +21 -0
- package/src/components/style-sections/typography-section/{text-direction-control.tsx → text-direction-field.tsx} +8 -8
- package/src/components/style-sections/typography-section/text-stroke-field.tsx +16 -0
- package/src/components/style-sections/typography-section/{text-style-control.tsx → text-style-field.tsx} +5 -5
- package/src/components/style-sections/typography-section/{transform-control.tsx → transform-field.tsx} +8 -7
- package/src/components/style-sections/typography-section/typography-section.tsx +20 -18
- package/src/components/style-sections/typography-section/word-spacing-field.tsx +21 -0
- package/src/components/style-tab.tsx +44 -25
- package/src/contexts/classes-prop-context.tsx +24 -0
- package/src/contexts/element-context.tsx +6 -10
- package/src/contexts/style-context.tsx +8 -22
- package/src/control-replacement.tsx +3 -0
- package/src/controls/bound-prop-context.tsx +30 -0
- package/src/controls/components/control-toggle-button-group.tsx +15 -6
- package/src/controls/components/repeater.tsx +1 -1
- package/src/controls/components/text-field-inner-selection.tsx +20 -24
- package/src/controls/control-actions/control-actions-context.tsx +27 -0
- package/src/controls/control-actions/control-actions-menu.ts +6 -7
- package/src/controls/control-actions/control-actions.tsx +14 -26
- package/src/{components/style-sections/effects-section/box-shadow-repeater.tsx → controls/controls/box-shadow-repeater-control.tsx} +51 -65
- package/src/controls/controls/color-control.tsx +25 -0
- package/src/controls/controls/equal-unequal-sizes-control.tsx +196 -0
- package/src/controls/{control-types → controls}/image-control.tsx +15 -23
- package/src/controls/{control-types → controls}/image-media-control.tsx +5 -14
- package/src/{components/style-sections/spacing-section → controls/controls}/linked-dimensions-control.tsx +10 -26
- package/src/controls/{control-types → controls}/number-control.tsx +2 -2
- package/src/controls/{control-types → controls}/select-control.tsx +4 -4
- package/src/controls/{control-types → controls}/size-control.tsx +8 -8
- package/src/controls/controls/stroke-control.tsx +105 -0
- package/src/controls/{control-types → controls}/text-area-control.tsx +3 -3
- package/src/controls/{control-types → controls}/text-control.tsx +3 -3
- package/src/controls/{control-types → controls}/toggle-control.tsx +4 -4
- package/src/controls/create-control-replacement.tsx +53 -0
- package/src/controls/create-control.tsx +12 -3
- package/src/controls/index.ts +24 -0
- package/src/controls-actions.ts +8 -0
- package/src/{controls/components → controls-registry}/control-type-container.tsx +1 -1
- package/src/{controls → controls-registry}/controls-registry.tsx +1 -6
- package/src/controls-registry/settings-field.tsx +35 -0
- package/src/controls-registry/styles-field.tsx +19 -0
- package/src/dynamics/components/dynamic-selection-control.tsx +11 -11
- package/src/dynamics/components/dynamic-selection.tsx +6 -6
- package/src/dynamics/dynamic-control.tsx +6 -5
- package/src/dynamics/hooks/use-dynamic-tag.ts +2 -2
- package/src/dynamics/hooks/use-prop-dynamic-action.tsx +7 -7
- 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 +2 -4
- package/src/dynamics/types.ts +2 -1
- package/src/dynamics/utils.ts +1 -2
- package/src/hooks/use-styles-field.ts +30 -0
- package/src/index.ts +3 -4
- package/src/sync/should-use-v2-panel.ts +1 -2
- package/src/sync/types.ts +3 -2
- package/src/components/style-sections/position-section/z-index-control.tsx +0 -20
- package/src/components/style-sections/size-section.tsx +0 -49
- package/src/components/style-sections/typography-section/font-size-control.tsx +0 -20
- package/src/components/style-sections/typography-section/letter-spacing-control.tsx +0 -20
- package/src/components/style-sections/typography-section/text-color-control.tsx +0 -20
- package/src/components/style-sections/typography-section/word-spacing-control.tsx +0 -20
- package/src/controls/control-context.tsx +0 -22
- package/src/controls/control-replacement.ts +0 -34
- package/src/controls/control-types/color-control.tsx +0 -27
- package/src/controls/hooks/use-style-control.ts +0 -29
- package/src/controls/settings-control.tsx +0 -37
- package/src/controls/style-control.tsx +0 -20
- package/src/hooks/use-element-style-prop.ts +0 -45
- package/src/hooks/use-element-styles.ts +0 -13
- package/src/hooks/use-element-type.ts +0 -33
- package/src/hooks/use-selected-elements.ts +0 -9
- package/src/hooks/use-widget-settings.ts +0 -16
- package/src/props/is-transformable.ts +0 -14
- package/src/sync/get-container.ts +0 -8
- package/src/sync/get-element-styles.ts +0 -9
- package/src/sync/get-selected-elements.ts +0 -21
- package/src/sync/get-widgets-cache.ts +0 -7
- package/src/sync/update-settings.ts +0 -14
- package/src/sync/update-style.ts +0 -24
- package/src/types.ts +0 -89
- package/src/{controls → controls-registry}/control.tsx +0 -0
- package/src/{controls/control-actions/actions/popover-action.tsx → popover-action.tsx} +1 -1
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { UnstableColorPicker, UnstableColorPickerProps } from '@elementor/ui';
|
|
3
|
-
import { useControl } from '../control-context';
|
|
4
|
-
import ControlActions from '../control-actions/control-actions';
|
|
5
|
-
import { createControl } from '../create-control';
|
|
6
|
-
import { TransformablePropValue } from '../../types';
|
|
7
|
-
|
|
8
|
-
export type ColorPropValue = TransformablePropValue< 'color', string >;
|
|
9
|
-
|
|
10
|
-
export const ColorControl = createControl(
|
|
11
|
-
( props: Partial< Omit< UnstableColorPickerProps, 'value' | 'onChange' > > ) => {
|
|
12
|
-
const { value, setValue } = useControl< ColorPropValue >();
|
|
13
|
-
|
|
14
|
-
const handleChange = ( selectedColor: string ) => {
|
|
15
|
-
setValue( {
|
|
16
|
-
$$type: 'color',
|
|
17
|
-
value: selectedColor,
|
|
18
|
-
} );
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
return (
|
|
22
|
-
<ControlActions>
|
|
23
|
-
<UnstableColorPicker size="tiny" { ...props } value={ value?.value } onChange={ handleChange } />
|
|
24
|
-
</ControlActions>
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
);
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { useElementContext } from '../../contexts/element-context';
|
|
2
|
-
import { useStyleContext } from '../../contexts/style-context';
|
|
3
|
-
import { useElementStyleProp } from '../../hooks/use-element-style-prop';
|
|
4
|
-
import { updateStyle } from '../../sync/update-style';
|
|
5
|
-
import { PropKey, PropValue } from '../../types';
|
|
6
|
-
|
|
7
|
-
export const useStyleControl = < T extends PropValue >( propName: PropKey ) => {
|
|
8
|
-
const { element } = useElementContext();
|
|
9
|
-
const { selectedStyleDef, selectedMeta, selectedClassesProp } = useStyleContext();
|
|
10
|
-
|
|
11
|
-
const value = useElementStyleProp< T >( {
|
|
12
|
-
elementID: element.id,
|
|
13
|
-
styleDefID: selectedStyleDef?.id,
|
|
14
|
-
meta: selectedMeta,
|
|
15
|
-
propName,
|
|
16
|
-
} );
|
|
17
|
-
|
|
18
|
-
const setValue = ( newValue: T ) => {
|
|
19
|
-
updateStyle( {
|
|
20
|
-
elementID: element.id,
|
|
21
|
-
styleDefID: selectedStyleDef?.id,
|
|
22
|
-
props: { [ propName ]: newValue },
|
|
23
|
-
meta: selectedMeta,
|
|
24
|
-
bind: selectedClassesProp,
|
|
25
|
-
} );
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
return [ value, setValue ] as const;
|
|
29
|
-
};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { ControlContext } from './control-context';
|
|
3
|
-
import { PropKey, PropValue } from '../types';
|
|
4
|
-
import { useElementContext } from '../contexts/element-context';
|
|
5
|
-
import { useWidgetSettings } from '../hooks/use-widget-settings';
|
|
6
|
-
import { updateSettings } from '../sync/update-settings';
|
|
7
|
-
import { ControlLabel } from '../components/control-label';
|
|
8
|
-
|
|
9
|
-
type Props = {
|
|
10
|
-
bind: PropKey;
|
|
11
|
-
children: React.ReactNode;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const SettingsControl = ( { bind, children }: Props ) => {
|
|
15
|
-
const { element, elementType } = useElementContext();
|
|
16
|
-
|
|
17
|
-
const defaultValue = elementType.propsSchema[ bind ]?.default;
|
|
18
|
-
const settingsValue = useWidgetSettings( { id: element.id, bind } );
|
|
19
|
-
const value = settingsValue ?? defaultValue ?? null;
|
|
20
|
-
|
|
21
|
-
const setValue = ( newValue: PropValue ) => {
|
|
22
|
-
updateSettings( {
|
|
23
|
-
id: element.id,
|
|
24
|
-
props: {
|
|
25
|
-
[ bind ]: newValue,
|
|
26
|
-
},
|
|
27
|
-
} );
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
return <ControlContext.Provider value={ { setValue, value, bind } }>{ children }</ControlContext.Provider>;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
// TODO: When we start using useControl inside the label component, we should create a new component for it,
|
|
34
|
-
// and keep ControlLabel as a simple label component without context.
|
|
35
|
-
SettingsControl.Label = ControlLabel;
|
|
36
|
-
|
|
37
|
-
export { SettingsControl };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { PropKey } from '../types';
|
|
3
|
-
import { ControlContext } from '../controls/control-context';
|
|
4
|
-
import { ControlLabel } from '../components/control-label';
|
|
5
|
-
import { useStyleControl } from './hooks/use-style-control';
|
|
6
|
-
|
|
7
|
-
export type StyleControlProps = {
|
|
8
|
-
bind: PropKey;
|
|
9
|
-
children: React.ReactNode;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export const StyleControl = ( { bind, children }: StyleControlProps ) => {
|
|
13
|
-
const [ value, setValue ] = useStyleControl( bind );
|
|
14
|
-
|
|
15
|
-
return <ControlContext.Provider value={ { bind, value, setValue } }>{ children }</ControlContext.Provider>;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
// TODO: When we start using useControl inside the label component, we should create a new component for it,
|
|
19
|
-
// and keep ControlLabel as a simple label component without context.
|
|
20
|
-
StyleControl.Label = ControlLabel;
|
|
@@ -1,45 +0,0 @@
|
|
|
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
|
-
import { StyleDefinition, StyleDefinitionID, StyleVariant } from '@elementor/editor-style';
|
|
5
|
-
|
|
6
|
-
export type UseElementStylePropArgs = {
|
|
7
|
-
elementID: ElementID;
|
|
8
|
-
styleDefID?: StyleDefinitionID;
|
|
9
|
-
meta: StyleVariant[ 'meta' ];
|
|
10
|
-
propName: PropKey;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export const useElementStyleProp = < T extends PropValue >( {
|
|
14
|
-
elementID,
|
|
15
|
-
styleDefID,
|
|
16
|
-
meta,
|
|
17
|
-
propName,
|
|
18
|
-
}: UseElementStylePropArgs ): T | null => {
|
|
19
|
-
return useListenTo(
|
|
20
|
-
commandEndEvent( 'document/atomic-widgets/styles' ),
|
|
21
|
-
() => {
|
|
22
|
-
// TODO: return default value for style prop
|
|
23
|
-
if ( ! styleDefID ) {
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const styleDef = getElementStyles( elementID )?.[ styleDefID ];
|
|
28
|
-
|
|
29
|
-
if ( ! styleDef ) {
|
|
30
|
-
return null;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const variant = getVariantByMeta( styleDef, meta );
|
|
34
|
-
|
|
35
|
-
return variant?.props[ propName ] ?? null;
|
|
36
|
-
},
|
|
37
|
-
[ elementID, styleDefID, propName, meta ]
|
|
38
|
-
) as T;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
function getVariantByMeta( styleDef: StyleDefinition, meta: StyleVariant[ 'meta' ] ) {
|
|
42
|
-
return styleDef.variants.find( ( variant ) => {
|
|
43
|
-
return variant.meta.breakpoint === meta.breakpoint && variant.meta.state === meta.state;
|
|
44
|
-
} );
|
|
45
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { __privateUseListenTo as useListenTo, commandEndEvent } from '@elementor/editor-v1-adapters';
|
|
2
|
-
import { getElementStyles } from '../sync/get-element-styles';
|
|
3
|
-
import { ElementID } from '../types';
|
|
4
|
-
|
|
5
|
-
export const useElementStyles = ( elementID: ElementID ) => {
|
|
6
|
-
return useListenTo(
|
|
7
|
-
commandEndEvent( 'document/atomic-widgets/styles' ),
|
|
8
|
-
() => {
|
|
9
|
-
return getElementStyles( elementID );
|
|
10
|
-
},
|
|
11
|
-
[ elementID ]
|
|
12
|
-
);
|
|
13
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { __privateUseListenTo as useListenTo, commandEndEvent } from '@elementor/editor-v1-adapters';
|
|
2
|
-
import getWidgetsCache from '../sync/get-widgets-cache';
|
|
3
|
-
import { ElementType } from '../types';
|
|
4
|
-
|
|
5
|
-
export default function useElementType( type?: string ) {
|
|
6
|
-
return useListenTo(
|
|
7
|
-
commandEndEvent( 'editor/documents/load' ),
|
|
8
|
-
(): ElementType | null => {
|
|
9
|
-
if ( ! type ) {
|
|
10
|
-
return null;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const widgetsCache = getWidgetsCache();
|
|
14
|
-
const elementType = widgetsCache?.[ type ];
|
|
15
|
-
|
|
16
|
-
if ( ! elementType?.atomic_controls ) {
|
|
17
|
-
return null;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
if ( ! elementType?.atomic_props_schema ) {
|
|
21
|
-
return null;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return {
|
|
25
|
-
key: type,
|
|
26
|
-
controls: elementType.atomic_controls,
|
|
27
|
-
propsSchema: elementType.atomic_props_schema,
|
|
28
|
-
title: elementType.title,
|
|
29
|
-
};
|
|
30
|
-
},
|
|
31
|
-
[ type ]
|
|
32
|
-
);
|
|
33
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { __privateUseListenTo as useListenTo, commandEndEvent } from '@elementor/editor-v1-adapters';
|
|
2
|
-
import getSelectedElements from '../sync/get-selected-elements';
|
|
3
|
-
|
|
4
|
-
export default function useSelectedElements() {
|
|
5
|
-
return useListenTo(
|
|
6
|
-
[ commandEndEvent( 'document/elements/select' ), commandEndEvent( 'document/elements/deselect' ) ],
|
|
7
|
-
() => getSelectedElements()
|
|
8
|
-
);
|
|
9
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { commandEndEvent, __privateUseListenTo as useListenTo } from '@elementor/editor-v1-adapters';
|
|
2
|
-
import { PropValue } from '../types';
|
|
3
|
-
import getContainer from '../sync/get-container';
|
|
4
|
-
|
|
5
|
-
export const useWidgetSettings = ( { id, bind }: { id: string; bind: string } ): PropValue => {
|
|
6
|
-
return useListenTo(
|
|
7
|
-
commandEndEvent( 'document/elements/settings' ),
|
|
8
|
-
() => {
|
|
9
|
-
const container = getContainer( id );
|
|
10
|
-
const value = container?.settings?.get( bind ) ?? null;
|
|
11
|
-
|
|
12
|
-
return value;
|
|
13
|
-
},
|
|
14
|
-
[ id, bind ]
|
|
15
|
-
);
|
|
16
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { z } from '@elementor/schema';
|
|
2
|
-
|
|
3
|
-
// TODO: Move this file content a shared package.
|
|
4
|
-
|
|
5
|
-
export const transformableSchema = z.object( {
|
|
6
|
-
$$type: z.string(),
|
|
7
|
-
value: z.any(),
|
|
8
|
-
} );
|
|
9
|
-
|
|
10
|
-
export type TransformablePropValue = z.infer< typeof transformableSchema >;
|
|
11
|
-
|
|
12
|
-
export const isTransformable = ( value: unknown ): value is TransformablePropValue => {
|
|
13
|
-
return transformableSchema.safeParse( value ).success;
|
|
14
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import getContainer from './get-container';
|
|
2
|
-
import { ElementID } from '../types';
|
|
3
|
-
import { StyleDefinition } from '@elementor/editor-style';
|
|
4
|
-
|
|
5
|
-
export const getElementStyles = ( elementID: ElementID ): Record< string, StyleDefinition > | null => {
|
|
6
|
-
const container = getContainer( elementID );
|
|
7
|
-
|
|
8
|
-
return container?.model.get( 'styles' ) || null;
|
|
9
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { ExtendedWindow } from './types';
|
|
2
|
-
import { Element } from '../types';
|
|
3
|
-
|
|
4
|
-
export default function getSelectedElements(): Element[] {
|
|
5
|
-
const extendedWindow = window as unknown as ExtendedWindow;
|
|
6
|
-
|
|
7
|
-
const selectedElements = extendedWindow.elementor?.selection?.getElements?.() ?? [];
|
|
8
|
-
|
|
9
|
-
return selectedElements.reduce< Element[] >( ( acc, el ) => {
|
|
10
|
-
const type = el.model.get( 'widgetType' ) || el.model.get( 'elType' );
|
|
11
|
-
|
|
12
|
-
if ( type ) {
|
|
13
|
-
acc.push( {
|
|
14
|
-
id: el.model.get( 'id' ),
|
|
15
|
-
type,
|
|
16
|
-
} );
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
return acc;
|
|
20
|
-
}, [] );
|
|
21
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { __privateRunCommand as runCommand } from '@elementor/editor-v1-adapters';
|
|
2
|
-
import { Props } from '../types';
|
|
3
|
-
import getContainer from './get-container';
|
|
4
|
-
|
|
5
|
-
export const updateSettings = ( { id, props }: { id: string; props: Props } ) => {
|
|
6
|
-
const container = getContainer( id );
|
|
7
|
-
|
|
8
|
-
runCommand( 'document/elements/settings', {
|
|
9
|
-
container,
|
|
10
|
-
settings: {
|
|
11
|
-
...props,
|
|
12
|
-
},
|
|
13
|
-
} );
|
|
14
|
-
};
|
package/src/sync/update-style.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { __privateRunCommand as runCommand } from '@elementor/editor-v1-adapters';
|
|
2
|
-
import { ElementID, PropKey, Props } from '../types';
|
|
3
|
-
import getContainer from './get-container';
|
|
4
|
-
import { StyleDefinitionID, StyleVariant } from '@elementor/editor-style';
|
|
5
|
-
|
|
6
|
-
export type UpdateStyleProps = {
|
|
7
|
-
elementID: ElementID;
|
|
8
|
-
styleDefID?: StyleDefinitionID;
|
|
9
|
-
meta: StyleVariant[ 'meta' ];
|
|
10
|
-
props: Props;
|
|
11
|
-
bind: PropKey;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export const updateStyle = ( { elementID, styleDefID, meta, props, bind }: UpdateStyleProps ) => {
|
|
15
|
-
const container = getContainer( elementID );
|
|
16
|
-
|
|
17
|
-
runCommand( 'document/atomic-widgets/styles', {
|
|
18
|
-
container,
|
|
19
|
-
styleDefID,
|
|
20
|
-
bind,
|
|
21
|
-
meta,
|
|
22
|
-
props,
|
|
23
|
-
} );
|
|
24
|
-
};
|
package/src/types.ts
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
export type ElementID = string;
|
|
2
|
-
|
|
3
|
-
export type Element = {
|
|
4
|
-
id: ElementID;
|
|
5
|
-
type: string;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export type ElementType = {
|
|
9
|
-
key: string;
|
|
10
|
-
controls: ControlItem[];
|
|
11
|
-
propsSchema: PropsSchema;
|
|
12
|
-
title: string;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export type ControlsSection = {
|
|
16
|
-
type: 'section';
|
|
17
|
-
value: {
|
|
18
|
-
description?: string;
|
|
19
|
-
label: string;
|
|
20
|
-
items: ControlItem[];
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export type Control = {
|
|
25
|
-
type: 'control';
|
|
26
|
-
value: {
|
|
27
|
-
bind: string;
|
|
28
|
-
label?: string;
|
|
29
|
-
description?: string;
|
|
30
|
-
type: string;
|
|
31
|
-
props: Record< string, unknown >;
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export type ControlItem = ControlsSection | Control;
|
|
36
|
-
|
|
37
|
-
type PropTypeKey = string;
|
|
38
|
-
|
|
39
|
-
type BasePropType = {
|
|
40
|
-
default: PropValue;
|
|
41
|
-
settings: Record< string, unknown >;
|
|
42
|
-
meta: Record< string, unknown >;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export type PlainPropType = BasePropType & {
|
|
46
|
-
kind: 'plain';
|
|
47
|
-
key: PropTypeKey;
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
export type ArrayPropType = BasePropType & {
|
|
51
|
-
kind: 'array';
|
|
52
|
-
key: PropTypeKey;
|
|
53
|
-
item_prop_type: PropType | null;
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
export type ObjectPropType = BasePropType & {
|
|
57
|
-
kind: 'object';
|
|
58
|
-
key: PropTypeKey;
|
|
59
|
-
shape: Record< string, PropType >;
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
export type TransformablePropType = PlainPropType | ArrayPropType | ObjectPropType;
|
|
63
|
-
|
|
64
|
-
export type UnionPropType = BasePropType & {
|
|
65
|
-
kind: 'union';
|
|
66
|
-
prop_types: Record< string, TransformablePropType >;
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
export type PropType = TransformablePropType | UnionPropType;
|
|
70
|
-
|
|
71
|
-
export type PropsSchema = Record< Control[ 'value' ][ 'bind' ], PropType >;
|
|
72
|
-
|
|
73
|
-
type MaybeArray< T > = T | T[];
|
|
74
|
-
|
|
75
|
-
export type TransformablePropValue< Type extends string, Value = unknown > = {
|
|
76
|
-
$$type: Type;
|
|
77
|
-
value: Value;
|
|
78
|
-
disabled?: boolean;
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
export type PlainPropValue = MaybeArray< string | number | boolean | object | null | undefined >;
|
|
82
|
-
|
|
83
|
-
export type PropValue = PlainPropValue | TransformablePropValue< string >;
|
|
84
|
-
|
|
85
|
-
export type PropKey = string;
|
|
86
|
-
|
|
87
|
-
export type Props = Record< PropKey, PropValue >;
|
|
88
|
-
|
|
89
|
-
export type PlainProps = Record< PropKey, PlainPropValue >;
|
|
File without changes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { bindPopover, bindToggle, IconButton, Popover, Stack, Tooltip, Typography, usePopupState } from '@elementor/ui';
|
|
3
2
|
import { ComponentType, ElementType as ReactElementType, useId } from 'react';
|
|
4
3
|
import { XIcon } from '@elementor/icons';
|
|
4
|
+
import { bindPopover, bindToggle, IconButton, Popover, Stack, Tooltip, Typography, usePopupState } from '@elementor/ui';
|
|
5
5
|
|
|
6
6
|
const SIZE = 'tiny';
|
|
7
7
|
|