@elementor/editor-editing-panel 1.37.0 → 1.38.1
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 +24 -0
- package/dist/index.js +311 -251
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +251 -191
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -8
- package/src/components/style-sections/layout-section/display-field.tsx +2 -2
- package/src/components/style-sections/typography-section/column-count-field.tsx +22 -0
- package/src/components/style-sections/typography-section/column-gap-field.tsx +22 -0
- package/src/components/style-sections/typography-section/typography-section.tsx +14 -0
- package/src/contexts/styles-inheritance-context.tsx +25 -20
- package/src/hooks/use-normalized-inheritance-chain-items.tsx +10 -3
- package/src/styles-inheritance/create-styles-inheritance.ts +49 -3
- package/src/styles-inheritance/styles-inheritance-indicator.tsx +14 -9
- package/src/styles-inheritance/styles-inheritance-infotip.tsx +8 -15
- package/src/styles-inheritance/types.ts +5 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elementor/editor-editing-panel",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.38.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "Elementor Team",
|
|
6
6
|
"homepage": "https://elementor.com/",
|
|
@@ -40,15 +40,15 @@
|
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@elementor/editor": "0.19.3",
|
|
43
|
-
"@elementor/editor-canvas": "0.
|
|
44
|
-
"@elementor/editor-controls": "0.
|
|
45
|
-
"@elementor/editor-current-user": "0.
|
|
46
|
-
"@elementor/editor-elements": "0.8.
|
|
43
|
+
"@elementor/editor-canvas": "0.22.0",
|
|
44
|
+
"@elementor/editor-controls": "0.31.0",
|
|
45
|
+
"@elementor/editor-current-user": "0.4.0",
|
|
46
|
+
"@elementor/editor-elements": "0.8.4",
|
|
47
47
|
"@elementor/editor-panels": "0.15.3",
|
|
48
|
-
"@elementor/editor-props": "0.12.
|
|
48
|
+
"@elementor/editor-props": "0.12.1",
|
|
49
49
|
"@elementor/editor-responsive": "0.13.5",
|
|
50
|
-
"@elementor/editor-styles": "0.6.
|
|
51
|
-
"@elementor/editor-styles-repository": "0.
|
|
50
|
+
"@elementor/editor-styles": "0.6.8",
|
|
51
|
+
"@elementor/editor-styles-repository": "0.9.0",
|
|
52
52
|
"@elementor/editor-ui": "0.8.2",
|
|
53
53
|
"@elementor/editor-v1-adapters": "0.12.0",
|
|
54
54
|
"@elementor/icons": "1.40.1",
|
|
@@ -4,7 +4,7 @@ import { isExperimentActive } from '@elementor/editor-v1-adapters';
|
|
|
4
4
|
import { Stack } from '@elementor/ui';
|
|
5
5
|
import { __ } from '@wordpress/i18n';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { useStylesInheritanceChain } from '../../../contexts/styles-inheritance-context';
|
|
8
8
|
import { StylesField } from '../../../controls-registry/styles-field';
|
|
9
9
|
import { ControlLabel } from '../../control-label';
|
|
10
10
|
|
|
@@ -64,4 +64,4 @@ export const DisplayField = () => {
|
|
|
64
64
|
};
|
|
65
65
|
|
|
66
66
|
// TODO - placing this logic deliberately here, and will be removed once applied automatically to all style fields as part of ED-18491
|
|
67
|
-
export const useDisplayPlaceholderValue = () =>
|
|
67
|
+
export const useDisplayPlaceholderValue = () => useStylesInheritanceChain( [ 'display' ] )[ 0 ]?.value ?? undefined;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { NumberControl } from '@elementor/editor-controls';
|
|
3
|
+
import { Grid } from '@elementor/ui';
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
|
|
6
|
+
import { StylesField } from '../../../controls-registry/styles-field';
|
|
7
|
+
import { ControlLabel } from '../../control-label';
|
|
8
|
+
|
|
9
|
+
export const ColumnCountField = () => {
|
|
10
|
+
return (
|
|
11
|
+
<StylesField bind="column-count">
|
|
12
|
+
<Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
|
|
13
|
+
<Grid item xs={ 6 }>
|
|
14
|
+
<ControlLabel>{ __( 'Columns', 'elementor' ) }</ControlLabel>
|
|
15
|
+
</Grid>
|
|
16
|
+
<Grid item xs={ 6 }>
|
|
17
|
+
<NumberControl shouldForceInt min={ 0 } step={ 1 } />
|
|
18
|
+
</Grid>
|
|
19
|
+
</Grid>
|
|
20
|
+
</StylesField>
|
|
21
|
+
);
|
|
22
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { SizeControl } from '@elementor/editor-controls';
|
|
3
|
+
import { Grid } from '@elementor/ui';
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
|
|
6
|
+
import { StylesField } from '../../../controls-registry/styles-field';
|
|
7
|
+
import { ControlLabel } from '../../control-label';
|
|
8
|
+
|
|
9
|
+
export const ColumnGapField = () => {
|
|
10
|
+
return (
|
|
11
|
+
<StylesField bind="column-gap">
|
|
12
|
+
<Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
|
|
13
|
+
<Grid item xs={ 6 }>
|
|
14
|
+
<ControlLabel>{ __( 'Column gap', 'elementor' ) }</ControlLabel>
|
|
15
|
+
</Grid>
|
|
16
|
+
<Grid item xs={ 6 }>
|
|
17
|
+
<SizeControl />
|
|
18
|
+
</Grid>
|
|
19
|
+
</Grid>
|
|
20
|
+
</StylesField>
|
|
21
|
+
);
|
|
22
|
+
};
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import type { NumberPropValue } from '@elementor/editor-props';
|
|
3
|
+
import { isExperimentActive } from '@elementor/editor-v1-adapters';
|
|
2
4
|
|
|
5
|
+
import { useStylesField } from '../../../hooks/use-styles-field';
|
|
3
6
|
import { CollapsibleContent } from '../../collapsible-content';
|
|
4
7
|
import { PanelDivider } from '../../panel-divider';
|
|
5
8
|
import { SectionContent } from '../../section-content';
|
|
9
|
+
import { ColumnCountField } from './column-count-field';
|
|
10
|
+
import { ColumnGapField } from './column-gap-field';
|
|
6
11
|
import { FontFamilyField } from './font-family-field';
|
|
7
12
|
import { FontSizeField } from './font-size-field';
|
|
8
13
|
import { FontStyleField } from './font-style-field';
|
|
@@ -18,6 +23,9 @@ import { TransformField } from './transform-field';
|
|
|
18
23
|
import { WordSpacingField } from './word-spacing-field';
|
|
19
24
|
|
|
20
25
|
export const TypographySection = () => {
|
|
26
|
+
const [ columnCount ] = useStylesField< NumberPropValue >( 'column-count' );
|
|
27
|
+
const isVersion330Active = isExperimentActive( 'e_v_3_30' );
|
|
28
|
+
const hasMultiColumns = columnCount?.value && columnCount?.value > 1;
|
|
21
29
|
return (
|
|
22
30
|
<SectionContent>
|
|
23
31
|
<FontFamilyField />
|
|
@@ -31,6 +39,12 @@ export const TypographySection = () => {
|
|
|
31
39
|
<LineHeightField />
|
|
32
40
|
<LetterSpacingField />
|
|
33
41
|
<WordSpacingField />
|
|
42
|
+
{ isVersion330Active && (
|
|
43
|
+
<>
|
|
44
|
+
<ColumnCountField />
|
|
45
|
+
{ hasMultiColumns && <ColumnGapField /> }
|
|
46
|
+
</>
|
|
47
|
+
) }
|
|
34
48
|
<PanelDivider />
|
|
35
49
|
<TextDecorationField />
|
|
36
50
|
<TransformField />
|
|
@@ -7,51 +7,56 @@ import { stylesRepository } from '@elementor/editor-styles-repository';
|
|
|
7
7
|
|
|
8
8
|
import { useStylesRerender } from '../hooks/use-styles-rerender';
|
|
9
9
|
import { createStylesInheritance } from '../styles-inheritance/create-styles-inheritance';
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
type SnapshotPropValue,
|
|
12
|
+
type StylesInheritanceAPI,
|
|
13
|
+
type StylesInheritanceSnapshot,
|
|
14
|
+
} from '../styles-inheritance/types';
|
|
11
15
|
import { useClassesProp } from './classes-prop-context';
|
|
12
16
|
import { useElement } from './element-context';
|
|
13
17
|
import { useStyle } from './style-context';
|
|
14
18
|
|
|
15
|
-
|
|
16
|
-
getSnapshot: StylesInheritanceSnapshotGetter;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const Context = createContext< ContextValue | null >( null );
|
|
19
|
+
const Context = createContext< StylesInheritanceAPI | null >( null );
|
|
20
20
|
|
|
21
21
|
export function StyleInheritanceProvider( { children }: PropsWithChildren ) {
|
|
22
22
|
const styleDefs = useAppliedStyles();
|
|
23
23
|
|
|
24
24
|
const breakpointsTree = getBreakpointsTree();
|
|
25
25
|
|
|
26
|
-
const getSnapshot = createStylesInheritance( styleDefs, breakpointsTree );
|
|
26
|
+
const { getSnapshot, getInheritanceChain } = createStylesInheritance( styleDefs, breakpointsTree );
|
|
27
27
|
|
|
28
|
-
return <Context.Provider value={ { getSnapshot } }>{ children }</Context.Provider>;
|
|
28
|
+
return <Context.Provider value={ { getSnapshot, getInheritanceChain } }>{ children }</Context.Provider>;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
export function
|
|
32
|
-
fields: T
|
|
33
|
-
): { [ K in T[ number ] ]: SnapshotPropValue[] } | null {
|
|
31
|
+
export function useStylesInheritanceSnapshot(): StylesInheritanceSnapshot | null {
|
|
34
32
|
const context = useContext( Context );
|
|
35
33
|
const { meta } = useStyle();
|
|
36
34
|
|
|
37
35
|
if ( ! context ) {
|
|
38
|
-
throw new Error( '
|
|
36
|
+
throw new Error( 'useStylesInheritanceSnapshot must be used within a StyleInheritanceProvider' );
|
|
39
37
|
}
|
|
40
38
|
|
|
41
39
|
if ( ! meta ) {
|
|
42
40
|
return null;
|
|
43
41
|
}
|
|
44
42
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
return fields.reduce(
|
|
48
|
-
( acc, key: T[ number ] ) => ( { ...acc, [ key ]: snapshot?.[ key ] ?? [] } ),
|
|
49
|
-
{} as { [ K in T[ number ] ]: SnapshotPropValue[] }
|
|
50
|
-
);
|
|
43
|
+
return context.getSnapshot( meta ) ?? null;
|
|
51
44
|
}
|
|
52
45
|
|
|
53
|
-
export function
|
|
54
|
-
|
|
46
|
+
export function useStylesInheritanceChain( path: string[] ): SnapshotPropValue[] {
|
|
47
|
+
const context = useContext( Context );
|
|
48
|
+
|
|
49
|
+
if ( ! context ) {
|
|
50
|
+
throw new Error( 'useStylesInheritanceChain must be used within a StyleInheritanceProvider' );
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const snapshot = useStylesInheritanceSnapshot();
|
|
54
|
+
|
|
55
|
+
if ( ! snapshot ) {
|
|
56
|
+
return [];
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return context.getInheritanceChain( snapshot, path );
|
|
55
60
|
}
|
|
56
61
|
|
|
57
62
|
const useAppliedStyles = () => {
|
|
@@ -1,12 +1,19 @@
|
|
|
1
|
-
import { useEffect, useState } from 'react';
|
|
1
|
+
import { type ReactNode, useEffect, useState } from 'react';
|
|
2
2
|
import { type PropsResolver } from '@elementor/editor-canvas';
|
|
3
3
|
import { type PropKey } from '@elementor/editor-props';
|
|
4
|
+
import { type StyleDefinitionVariant } from '@elementor/editor-styles';
|
|
4
5
|
|
|
5
|
-
import { type NormalizedItem } from '../styles-inheritance/styles-inheritance-infotip';
|
|
6
6
|
import { type SnapshotPropValue } from '../styles-inheritance/types';
|
|
7
7
|
|
|
8
8
|
const MAXIMUM_ITEMS = 2;
|
|
9
9
|
|
|
10
|
+
type NormalizedItem = {
|
|
11
|
+
id: string | number;
|
|
12
|
+
breakpoint?: StyleDefinitionVariant[ 'meta' ][ 'breakpoint' ];
|
|
13
|
+
displayLabel: string;
|
|
14
|
+
value: ReactNode | string;
|
|
15
|
+
};
|
|
16
|
+
|
|
10
17
|
export const useNormalizedInheritanceChainItems = (
|
|
11
18
|
inheritanceChain: SnapshotPropValue[],
|
|
12
19
|
bind: PropKey,
|
|
@@ -49,7 +56,7 @@ export const normalizeInheritanceItem = async (
|
|
|
49
56
|
};
|
|
50
57
|
};
|
|
51
58
|
|
|
52
|
-
|
|
59
|
+
const getTransformedValue = async (
|
|
53
60
|
item: SnapshotPropValue,
|
|
54
61
|
bind: PropKey,
|
|
55
62
|
resolve: PropsResolver
|
|
@@ -1,21 +1,45 @@
|
|
|
1
|
+
import { isEmpty, isTransformable, type PropKey, type PropValue } from '@elementor/editor-props';
|
|
1
2
|
import { type BreakpointNode } from '@elementor/editor-responsive';
|
|
2
3
|
import { type StyleDefinition } from '@elementor/editor-styles';
|
|
3
4
|
|
|
4
5
|
import { getProviderByStyleId } from '../contexts/style-context';
|
|
5
6
|
import { createSnapshotsManager } from './create-snapshots-manager';
|
|
6
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
type BreakpointsStatesStyles,
|
|
9
|
+
type StyleInheritanceMetaProps,
|
|
10
|
+
type StylesInheritanceAPI,
|
|
11
|
+
type StylesInheritanceSnapshot,
|
|
12
|
+
} from './types';
|
|
7
13
|
import { getBreakpointKey, getStateKey } from './utils';
|
|
8
14
|
|
|
9
15
|
export function createStylesInheritance(
|
|
10
16
|
styleDefs: StyleDefinition[],
|
|
11
17
|
breakpointsRoot: BreakpointNode
|
|
12
|
-
):
|
|
18
|
+
): StylesInheritanceAPI {
|
|
13
19
|
const styleVariantsByMeta = buildStyleVariantsByMetaMapping( styleDefs );
|
|
14
20
|
|
|
15
21
|
const getStyles = ( { breakpoint, state }: StyleInheritanceMetaProps ) =>
|
|
16
22
|
styleVariantsByMeta?.[ getBreakpointKey( breakpoint ) ]?.[ getStateKey( state ) ] ?? [];
|
|
17
23
|
|
|
18
|
-
return
|
|
24
|
+
return {
|
|
25
|
+
getSnapshot: createSnapshotsManager( getStyles, breakpointsRoot ),
|
|
26
|
+
getInheritanceChain: ( snapshot: StylesInheritanceSnapshot, path: string[] ) => {
|
|
27
|
+
const [ field, ...nextFields ] = path;
|
|
28
|
+
|
|
29
|
+
let inheritanceChain = snapshot[ field ] ?? [];
|
|
30
|
+
|
|
31
|
+
if ( nextFields.length > 0 ) {
|
|
32
|
+
inheritanceChain = inheritanceChain
|
|
33
|
+
.map( ( { value: styleValue, ...rest } ) => ( {
|
|
34
|
+
...rest,
|
|
35
|
+
value: getValueByPath( styleValue, nextFields ),
|
|
36
|
+
} ) )
|
|
37
|
+
.filter( ( { value: styleValue } ) => ! isEmpty( styleValue ) );
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return inheritanceChain;
|
|
41
|
+
},
|
|
42
|
+
};
|
|
19
43
|
}
|
|
20
44
|
|
|
21
45
|
function buildStyleVariantsByMetaMapping( styleDefs: StyleDefinition[] ): BreakpointsStatesStyles {
|
|
@@ -52,3 +76,25 @@ function buildStyleVariantsByMetaMapping( styleDefs: StyleDefinition[] ): Breakp
|
|
|
52
76
|
|
|
53
77
|
return breakpointStateSlots;
|
|
54
78
|
}
|
|
79
|
+
|
|
80
|
+
function getValueByPath( value: PropValue, path: PropKey[] ): PropValue {
|
|
81
|
+
if ( ! value || typeof value !== 'object' ) {
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return path.reduce( ( currentScope: PropValue, key: PropKey ): PropValue | null => {
|
|
86
|
+
if ( ! currentScope ) {
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if ( isTransformable( currentScope ) ) {
|
|
91
|
+
return currentScope.value?.[ key ];
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if ( typeof currentScope === 'object' ) {
|
|
95
|
+
return currentScope[ key as keyof typeof currentScope ];
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return null;
|
|
99
|
+
}, value );
|
|
100
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useState } from 'react';
|
|
3
3
|
import { useBoundProp } from '@elementor/editor-controls';
|
|
4
|
+
import { isEmpty } from '@elementor/editor-props';
|
|
4
5
|
import { ELEMENTS_BASE_STYLES_PROVIDER_KEY, isElementsStylesProvider } from '@elementor/editor-styles-repository';
|
|
5
6
|
import { isExperimentActive } from '@elementor/editor-v1-adapters';
|
|
6
7
|
import { IconButton, Infotip } from '@elementor/ui';
|
|
@@ -8,18 +9,20 @@ import { __ } from '@wordpress/i18n';
|
|
|
8
9
|
|
|
9
10
|
import { StyleIndicator } from '../components/style-indicator';
|
|
10
11
|
import { useStyle } from '../contexts/style-context';
|
|
11
|
-
import {
|
|
12
|
+
import { useStylesInheritanceChain } from '../contexts/styles-inheritance-context';
|
|
12
13
|
import { StyleIndicatorInfotip } from './styles-inheritance-infotip';
|
|
13
14
|
|
|
14
15
|
export const StylesInheritanceIndicator = () => {
|
|
15
16
|
const [ open, setOpen ] = useState( false );
|
|
16
17
|
|
|
17
|
-
const { value, path } = useBoundProp();
|
|
18
|
+
const { value, path, propType } = useBoundProp();
|
|
18
19
|
const { id: currentStyleId, provider: currentStyleProvider, meta: currentStyleMeta } = useStyle();
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const
|
|
21
|
+
const isUsingNestedProps = isExperimentActive( 'e_v_3_30' );
|
|
22
|
+
|
|
23
|
+
const finalPath = isUsingNestedProps ? path : path.slice( 0, 1 );
|
|
24
|
+
|
|
25
|
+
const inheritanceChain = useStylesInheritanceChain( finalPath );
|
|
23
26
|
|
|
24
27
|
if ( ! inheritanceChain.length ) {
|
|
25
28
|
return null;
|
|
@@ -33,12 +36,12 @@ export const StylesInheritanceIndicator = () => {
|
|
|
33
36
|
|
|
34
37
|
const { breakpoint, state } = variant.meta;
|
|
35
38
|
|
|
36
|
-
const isFinalValue
|
|
39
|
+
const isFinalValue =
|
|
37
40
|
style.id === currentStyleId && breakpoint === currentStyleMeta.breakpoint && state === currentStyleMeta.state;
|
|
38
41
|
|
|
39
|
-
const hasValue
|
|
42
|
+
const hasValue = ! isEmpty( value );
|
|
40
43
|
|
|
41
|
-
const label
|
|
44
|
+
const label = getLabel( { isFinalValue, hasValue } );
|
|
42
45
|
const variantType = getVariant( { isFinalValue, hasValue, currentStyleProvider } );
|
|
43
46
|
|
|
44
47
|
const eIndicationsPopover = isExperimentActive( 'e_indications_popover' );
|
|
@@ -52,7 +55,9 @@ export const StylesInheritanceIndicator = () => {
|
|
|
52
55
|
return (
|
|
53
56
|
<Infotip
|
|
54
57
|
placement="top"
|
|
55
|
-
content={
|
|
58
|
+
content={
|
|
59
|
+
<StyleIndicatorInfotip inheritanceChain={ inheritanceChain } path={ finalPath } propType={ propType } />
|
|
60
|
+
}
|
|
56
61
|
open={ open }
|
|
57
62
|
onClose={ () => setOpen( false ) }
|
|
58
63
|
trigger="manual"
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
3
|
import { createPropsResolver, type PropsResolver, styleTransformersRegistry } from '@elementor/editor-canvas';
|
|
4
|
-
import { type PropKey } from '@elementor/editor-props';
|
|
5
|
-
import { getStylesSchema, type StyleDefinitionVariant } from '@elementor/editor-styles';
|
|
4
|
+
import { type PropKey, type PropType } from '@elementor/editor-props';
|
|
6
5
|
import { Card, CardContent, List, ListItem, ListItemText } from '@elementor/ui';
|
|
7
6
|
|
|
8
7
|
import { useNormalizedInheritanceChainItems } from '../hooks/use-normalized-inheritance-chain-items';
|
|
@@ -10,27 +9,21 @@ import { type SnapshotPropValue } from './types';
|
|
|
10
9
|
|
|
11
10
|
type StyleIndicatorInfotipProps = {
|
|
12
11
|
inheritanceChain: SnapshotPropValue[];
|
|
13
|
-
|
|
12
|
+
propType: PropType;
|
|
13
|
+
path: PropKey[];
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
export
|
|
17
|
-
|
|
18
|
-
breakpoint?: StyleDefinitionVariant[ 'meta' ][ 'breakpoint' ];
|
|
19
|
-
displayLabel: string;
|
|
20
|
-
value: string;
|
|
21
|
-
};
|
|
16
|
+
export const StyleIndicatorInfotip = ( { inheritanceChain, propType, path }: StyleIndicatorInfotipProps ) => {
|
|
17
|
+
const key = path.join( '.' );
|
|
22
18
|
|
|
23
|
-
export const StyleIndicatorInfotip = ( { inheritanceChain, bind }: StyleIndicatorInfotipProps ) => {
|
|
24
19
|
const resolve = useMemo< PropsResolver >( () => {
|
|
25
|
-
const stylesSchema = getStylesSchema();
|
|
26
|
-
|
|
27
20
|
return createPropsResolver( {
|
|
28
21
|
transformers: styleTransformersRegistry,
|
|
29
|
-
schema: { [
|
|
22
|
+
schema: { [ key ]: propType },
|
|
30
23
|
} );
|
|
31
|
-
}, [
|
|
24
|
+
}, [ key, propType ] );
|
|
32
25
|
|
|
33
|
-
const items = useNormalizedInheritanceChainItems( inheritanceChain,
|
|
26
|
+
const items = useNormalizedInheritanceChainItems( inheritanceChain, key, resolve );
|
|
34
27
|
|
|
35
28
|
return (
|
|
36
29
|
<Card elevation={ 0 } sx={ { maxWidth: 320 } }>
|
|
@@ -41,3 +41,8 @@ export type StyleInheritanceMetaProps = {
|
|
|
41
41
|
export type StylesInheritanceSnapshotGetter = (
|
|
42
42
|
meta: StyleInheritanceMetaProps
|
|
43
43
|
) => StylesInheritanceSnapshot | undefined;
|
|
44
|
+
|
|
45
|
+
export type StylesInheritanceAPI = {
|
|
46
|
+
getSnapshot: ( meta: StyleInheritanceMetaProps ) => StylesInheritanceSnapshot | undefined;
|
|
47
|
+
getInheritanceChain: ( snapshotField: StylesInheritanceSnapshot, path: string[] ) => SnapshotPropValue[];
|
|
48
|
+
};
|