@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.
Files changed (47) hide show
  1. package/dist/index.d.mts +96 -75
  2. package/dist/index.d.ts +96 -75
  3. package/dist/index.js +1026 -934
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +681 -595
  6. package/dist/index.mjs.map +1 -1
  7. package/package.json +25 -25
  8. package/src/components/editing-panel-tabs.tsx +8 -4
  9. package/src/components/style-sections/border-section/border-color-field.tsx +4 -4
  10. package/src/components/style-sections/border-section/border-radius-field.tsx +4 -4
  11. package/src/components/style-sections/border-section/border-style-field.tsx +4 -4
  12. package/src/components/style-sections/border-section/border-width-field.tsx +4 -4
  13. package/src/components/style-sections/effects-section/blend-mode-field.tsx +4 -4
  14. package/src/components/style-sections/effects-section/opacity-control-field.tsx +4 -4
  15. package/src/components/style-sections/layout-section/align-content-field.tsx +4 -4
  16. package/src/components/style-sections/layout-section/align-items-field.tsx +4 -4
  17. package/src/components/style-sections/layout-section/display-field.tsx +4 -4
  18. package/src/components/style-sections/layout-section/flex-direction-field.tsx +4 -4
  19. package/src/components/style-sections/layout-section/gap-control-field.tsx +4 -4
  20. package/src/components/style-sections/layout-section/grid-justify-items-field.tsx +4 -4
  21. package/src/components/style-sections/layout-section/justify-content-field.tsx +4 -4
  22. package/src/components/style-sections/layout-section/wrap-field.tsx +4 -4
  23. package/src/components/style-sections/position-section/offset-field.tsx +4 -4
  24. package/src/components/style-sections/position-section/position-field.tsx +4 -4
  25. package/src/components/style-sections/position-section/z-index-field.tsx +4 -4
  26. package/src/components/style-sections/size-section/object-fit-field.tsx +4 -4
  27. package/src/components/style-sections/size-section/overflow-field.tsx +4 -4
  28. package/src/components/style-sections/typography-section/column-count-field.tsx +4 -4
  29. package/src/components/style-sections/typography-section/column-gap-field.tsx +4 -4
  30. package/src/components/style-sections/typography-section/font-family-field.tsx +5 -9
  31. package/src/components/style-sections/typography-section/font-size-field.tsx +5 -5
  32. package/src/components/style-sections/typography-section/font-style-field.tsx +4 -4
  33. package/src/components/style-sections/typography-section/font-weight-field.tsx +4 -4
  34. package/src/components/style-sections/typography-section/letter-spacing-field.tsx +4 -4
  35. package/src/components/style-sections/typography-section/line-height-field.tsx +4 -4
  36. package/src/components/style-sections/typography-section/text-alignment-field.tsx +4 -4
  37. package/src/components/style-sections/typography-section/text-color-field.tsx +4 -4
  38. package/src/components/style-sections/typography-section/text-decoration-field.tsx +4 -4
  39. package/src/components/style-sections/typography-section/text-direction-field.tsx +4 -4
  40. package/src/components/style-sections/typography-section/transform-field.tsx +4 -4
  41. package/src/components/style-sections/typography-section/word-spacing-field.tsx +4 -4
  42. package/src/contexts/styles-field-targets-context.tsx +17 -0
  43. package/src/controls-registry/styles-field.tsx +4 -0
  44. package/src/hooks/use-styles-fields.ts +89 -56
  45. package/src/index.ts +5 -2
  46. package/src/styles-field-registry.ts +79 -0
  47. 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
+ }