@elementor/editor-editing-panel 4.5.0-1218 → 4.5.0-1219
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 +96 -75
- package/dist/index.d.ts +96 -75
- package/dist/index.js +1026 -934
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +681 -595
- package/dist/index.mjs.map +1 -1
- package/package.json +25 -25
- package/src/components/editing-panel-tabs.tsx +8 -4
- package/src/components/style-sections/border-section/border-color-field.tsx +4 -4
- package/src/components/style-sections/border-section/border-radius-field.tsx +4 -4
- package/src/components/style-sections/border-section/border-style-field.tsx +4 -4
- package/src/components/style-sections/border-section/border-width-field.tsx +4 -4
- package/src/components/style-sections/effects-section/blend-mode-field.tsx +4 -4
- package/src/components/style-sections/effects-section/opacity-control-field.tsx +4 -4
- package/src/components/style-sections/layout-section/align-content-field.tsx +4 -4
- package/src/components/style-sections/layout-section/align-items-field.tsx +4 -4
- package/src/components/style-sections/layout-section/display-field.tsx +4 -4
- package/src/components/style-sections/layout-section/flex-direction-field.tsx +4 -4
- package/src/components/style-sections/layout-section/gap-control-field.tsx +4 -4
- package/src/components/style-sections/layout-section/grid-justify-items-field.tsx +4 -4
- package/src/components/style-sections/layout-section/justify-content-field.tsx +4 -4
- package/src/components/style-sections/layout-section/wrap-field.tsx +4 -4
- package/src/components/style-sections/position-section/offset-field.tsx +4 -4
- package/src/components/style-sections/position-section/position-field.tsx +4 -4
- package/src/components/style-sections/position-section/z-index-field.tsx +4 -4
- package/src/components/style-sections/size-section/object-fit-field.tsx +4 -4
- package/src/components/style-sections/size-section/overflow-field.tsx +4 -4
- package/src/components/style-sections/typography-section/column-count-field.tsx +4 -4
- package/src/components/style-sections/typography-section/column-gap-field.tsx +4 -4
- package/src/components/style-sections/typography-section/font-family-field.tsx +5 -9
- package/src/components/style-sections/typography-section/font-size-field.tsx +5 -5
- package/src/components/style-sections/typography-section/font-style-field.tsx +4 -4
- package/src/components/style-sections/typography-section/font-weight-field.tsx +4 -4
- package/src/components/style-sections/typography-section/letter-spacing-field.tsx +4 -4
- package/src/components/style-sections/typography-section/line-height-field.tsx +4 -4
- package/src/components/style-sections/typography-section/text-alignment-field.tsx +4 -4
- package/src/components/style-sections/typography-section/text-color-field.tsx +4 -4
- package/src/components/style-sections/typography-section/text-decoration-field.tsx +4 -4
- package/src/components/style-sections/typography-section/text-direction-field.tsx +4 -4
- package/src/components/style-sections/typography-section/transform-field.tsx +4 -4
- package/src/components/style-sections/typography-section/word-spacing-field.tsx +4 -4
- package/src/contexts/styles-field-targets-context.tsx +17 -0
- package/src/controls-registry/styles-field.tsx +4 -0
- package/src/hooks/use-styles-fields.ts +89 -56
- package/src/index.ts +5 -2
- package/src/styles-field-registry.ts +79 -0
- package/src/utils/element-local-style.ts +30 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type ElementID, getContainer, getElementType } from '@elementor/editor-elements';
|
|
2
|
+
import { CLASSES_PROP_KEY } from '@elementor/editor-props';
|
|
3
|
+
import { type StyleDefinitionID } from '@elementor/editor-styles';
|
|
4
|
+
import { isElementsStylesProvider, type StylesProvider, stylesRepository } from '@elementor/editor-styles-repository';
|
|
5
|
+
|
|
6
|
+
export type ElementLocalStyle = {
|
|
7
|
+
styleId: StyleDefinitionID;
|
|
8
|
+
provider: StylesProvider;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export function getElementLocalStyle( elementId: ElementID ): ElementLocalStyle | null {
|
|
12
|
+
const provider = stylesRepository
|
|
13
|
+
.getProviders()
|
|
14
|
+
.find( ( stylesProvider ) => isElementsStylesProvider( stylesProvider.getKey() ) );
|
|
15
|
+
const [ style ] = provider?.actions.all( { elementId } ) ?? [];
|
|
16
|
+
|
|
17
|
+
return provider && style ? { styleId: style.id, provider } : null;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function getElementClassesProp( elementId: ElementID ): string | null {
|
|
21
|
+
const container = getContainer( elementId );
|
|
22
|
+
const type = container?.model.get( 'widgetType' ) || container?.model.get( 'elType' );
|
|
23
|
+
const propsSchema = type ? getElementType( type )?.propsSchema : null;
|
|
24
|
+
|
|
25
|
+
const classesEntry = Object.entries( propsSchema ?? {} ).find(
|
|
26
|
+
( [ , propType ] ) => propType.kind === 'plain' && propType.key === CLASSES_PROP_KEY
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
return classesEntry?.[ 0 ] ?? null;
|
|
30
|
+
}
|