@wordpress/block-editor 15.6.0 → 15.6.1-next.36001005c.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/build/components/background-image-control/index.js +2 -2
- package/build/components/background-image-control/index.js.map +2 -2
- package/build/components/block-quick-navigation/index.js +1 -0
- package/build/components/block-quick-navigation/index.js.map +2 -2
- package/build/components/global-styles/border-panel.js +2 -1
- package/build/components/global-styles/border-panel.js.map +2 -2
- package/build/components/global-styles/color-panel.js +2 -1
- package/build/components/global-styles/color-panel.js.map +2 -2
- package/build/components/global-styles/dimensions-panel.js +3 -2
- package/build/components/global-styles/dimensions-panel.js.map +2 -2
- package/build/components/global-styles/filters-panel.js +2 -1
- package/build/components/global-styles/filters-panel.js.map +2 -2
- package/build/components/global-styles/hooks.js +23 -95
- package/build/components/global-styles/hooks.js.map +2 -2
- package/build/components/global-styles/index.js +0 -14
- package/build/components/global-styles/index.js.map +2 -2
- package/build/components/global-styles/typography-panel.js +2 -1
- package/build/components/global-styles/typography-panel.js.map +2 -2
- package/build/components/global-styles/typography-utils.js +2 -49
- package/build/components/global-styles/typography-utils.js.map +2 -2
- package/build/components/global-styles/utils.js +0 -377
- package/build/components/global-styles/utils.js.map +2 -2
- package/build/hooks/block-style-variation.js +6 -10
- package/build/hooks/block-style-variation.js.map +2 -2
- package/build/hooks/duotone.js +3 -3
- package/build/hooks/duotone.js.map +2 -2
- package/build/hooks/font-size.js +2 -2
- package/build/hooks/font-size.js.map +2 -2
- package/build/hooks/use-typography-props.js +2 -2
- package/build/hooks/use-typography-props.js.map +2 -2
- package/build-module/components/background-image-control/index.js +1 -1
- package/build-module/components/background-image-control/index.js.map +2 -2
- package/build-module/components/block-quick-navigation/index.js +1 -0
- package/build-module/components/block-quick-navigation/index.js.map +2 -2
- package/build-module/components/global-styles/border-panel.js +2 -1
- package/build-module/components/global-styles/border-panel.js.map +2 -2
- package/build-module/components/global-styles/color-panel.js +2 -1
- package/build-module/components/global-styles/color-panel.js.map +2 -2
- package/build-module/components/global-styles/dimensions-panel.js +2 -1
- package/build-module/components/global-styles/dimensions-panel.js.map +2 -2
- package/build-module/components/global-styles/filters-panel.js +2 -1
- package/build-module/components/global-styles/filters-panel.js.map +2 -2
- package/build-module/components/global-styles/hooks.js +27 -95
- package/build-module/components/global-styles/hooks.js.map +2 -2
- package/build-module/components/global-styles/index.js +0 -14
- package/build-module/components/global-styles/index.js.map +2 -2
- package/build-module/components/global-styles/typography-panel.js +2 -1
- package/build-module/components/global-styles/typography-panel.js.map +2 -2
- package/build-module/components/global-styles/typography-utils.js +1 -49
- package/build-module/components/global-styles/typography-utils.js.map +2 -2
- package/build-module/components/global-styles/utils.js +0 -364
- package/build-module/components/global-styles/utils.js.map +2 -2
- package/build-module/hooks/block-style-variation.js +4 -12
- package/build-module/hooks/block-style-variation.js.map +2 -2
- package/build-module/hooks/duotone.js +3 -3
- package/build-module/hooks/duotone.js.map +2 -2
- package/build-module/hooks/font-size.js +1 -1
- package/build-module/hooks/font-size.js.map +2 -2
- package/build-module/hooks/use-typography-props.js +1 -1
- package/build-module/hooks/use-typography-props.js.map +2 -2
- package/build-style/style-rtl.css +10 -6
- package/build-style/style.css +10 -6
- package/package.json +36 -35
- package/src/components/background-image-control/index.js +1 -1
- package/src/components/block-card/style.scss +1 -1
- package/src/components/block-navigation/style.scss +1 -1
- package/src/components/block-quick-navigation/index.js +1 -0
- package/src/components/block-quick-navigation/style.scss +5 -0
- package/src/components/block-switcher/style.scss +1 -1
- package/src/components/color-palette/test/__snapshots__/control.js.snap +1 -1
- package/src/components/global-styles/border-panel.js +2 -1
- package/src/components/global-styles/color-panel.js +2 -1
- package/src/components/global-styles/color-panel.native.js +1 -1
- package/src/components/global-styles/dimensions-panel.js +2 -1
- package/src/components/global-styles/filters-panel.js +2 -1
- package/src/components/global-styles/hooks.js +29 -108
- package/src/components/global-styles/index.js +0 -8
- package/src/components/global-styles/test/typography-utils.js +0 -806
- package/src/components/global-styles/test/utils.js +1 -442
- package/src/components/global-styles/typography-panel.js +2 -1
- package/src/components/global-styles/typography-utils.js +0 -133
- package/src/components/global-styles/utils.js +0 -537
- package/src/components/inserter/style.scss +2 -2
- package/src/components/multi-selection-inspector/style.scss +1 -1
- package/src/hooks/block-style-variation.js +4 -12
- package/src/hooks/duotone.js +3 -3
- package/src/hooks/font-size.js +1 -1
- package/src/hooks/use-typography-props.js +1 -1
- package/src/style.scss +1 -0
- package/tsconfig.json +1 -0
- package/build/components/global-styles/get-block-css-selector.js +0 -78
- package/build/components/global-styles/get-block-css-selector.js.map +0 -7
- package/build/components/global-styles/use-global-styles-output.js +0 -998
- package/build/components/global-styles/use-global-styles-output.js.map +0 -7
- package/build-module/components/global-styles/get-block-css-selector.js +0 -54
- package/build-module/components/global-styles/get-block-css-selector.js.map +0 -7
- package/build-module/components/global-styles/use-global-styles-output.js +0 -979
- package/build-module/components/global-styles/use-global-styles-output.js.map +0 -7
- package/src/components/global-styles/get-block-css-selector.js +0 -114
- package/src/components/global-styles/test/use-global-styles-output.js +0 -1131
- package/src/components/global-styles/use-global-styles-output.js +0 -1487
|
@@ -10,81 +10,21 @@ import { useContext, useCallback, useMemo } from '@wordpress/element';
|
|
|
10
10
|
import { useSelect } from '@wordpress/data';
|
|
11
11
|
import { store as blocksStore } from '@wordpress/blocks';
|
|
12
12
|
import { _x } from '@wordpress/i18n';
|
|
13
|
+
import {
|
|
14
|
+
getSetting,
|
|
15
|
+
getStyle,
|
|
16
|
+
getPresetVariableFromValue,
|
|
17
|
+
} from '@wordpress/global-styles-engine';
|
|
13
18
|
|
|
14
19
|
/**
|
|
15
20
|
* Internal dependencies
|
|
16
21
|
*/
|
|
17
|
-
import {
|
|
18
|
-
import { getValueFromObjectPath, setImmutably } from '../../utils/object';
|
|
22
|
+
import { setImmutably } from '../../utils/object';
|
|
19
23
|
import { GlobalStylesContext } from './context';
|
|
20
24
|
import { unlock } from '../../lock-unlock';
|
|
21
25
|
|
|
22
26
|
const EMPTY_CONFIG = { settings: {}, styles: {} };
|
|
23
27
|
|
|
24
|
-
const VALID_SETTINGS = [
|
|
25
|
-
'appearanceTools',
|
|
26
|
-
'useRootPaddingAwareAlignments',
|
|
27
|
-
'background.backgroundImage',
|
|
28
|
-
'background.backgroundRepeat',
|
|
29
|
-
'background.backgroundSize',
|
|
30
|
-
'background.backgroundPosition',
|
|
31
|
-
'border.color',
|
|
32
|
-
'border.radius',
|
|
33
|
-
'border.style',
|
|
34
|
-
'border.width',
|
|
35
|
-
'border.radiusSizes',
|
|
36
|
-
'shadow.presets',
|
|
37
|
-
'shadow.defaultPresets',
|
|
38
|
-
'color.background',
|
|
39
|
-
'color.button',
|
|
40
|
-
'color.caption',
|
|
41
|
-
'color.custom',
|
|
42
|
-
'color.customDuotone',
|
|
43
|
-
'color.customGradient',
|
|
44
|
-
'color.defaultDuotone',
|
|
45
|
-
'color.defaultGradients',
|
|
46
|
-
'color.defaultPalette',
|
|
47
|
-
'color.duotone',
|
|
48
|
-
'color.gradients',
|
|
49
|
-
'color.heading',
|
|
50
|
-
'color.link',
|
|
51
|
-
'color.palette',
|
|
52
|
-
'color.text',
|
|
53
|
-
'custom',
|
|
54
|
-
'dimensions.aspectRatio',
|
|
55
|
-
'dimensions.minHeight',
|
|
56
|
-
'layout.contentSize',
|
|
57
|
-
'layout.definitions',
|
|
58
|
-
'layout.wideSize',
|
|
59
|
-
'lightbox.enabled',
|
|
60
|
-
'lightbox.allowEditing',
|
|
61
|
-
'position.fixed',
|
|
62
|
-
'position.sticky',
|
|
63
|
-
'spacing.customSpacingSize',
|
|
64
|
-
'spacing.defaultSpacingSizes',
|
|
65
|
-
'spacing.spacingSizes',
|
|
66
|
-
'spacing.spacingScale',
|
|
67
|
-
'spacing.blockGap',
|
|
68
|
-
'spacing.margin',
|
|
69
|
-
'spacing.padding',
|
|
70
|
-
'spacing.units',
|
|
71
|
-
'typography.fluid',
|
|
72
|
-
'typography.customFontSize',
|
|
73
|
-
'typography.defaultFontSizes',
|
|
74
|
-
'typography.dropCap',
|
|
75
|
-
'typography.fontFamilies',
|
|
76
|
-
'typography.fontSizes',
|
|
77
|
-
'typography.fontStyle',
|
|
78
|
-
'typography.fontWeight',
|
|
79
|
-
'typography.letterSpacing',
|
|
80
|
-
'typography.lineHeight',
|
|
81
|
-
'typography.textAlign',
|
|
82
|
-
'typography.textColumns',
|
|
83
|
-
'typography.textDecoration',
|
|
84
|
-
'typography.textTransform',
|
|
85
|
-
'typography.writingMode',
|
|
86
|
-
];
|
|
87
|
-
|
|
88
28
|
export const useGlobalStylesReset = () => {
|
|
89
29
|
const { user, setUserConfig } = useContext( GlobalStylesContext );
|
|
90
30
|
const config = {
|
|
@@ -103,7 +43,6 @@ export function useGlobalSetting( propertyPath, blockName, source = 'all' ) {
|
|
|
103
43
|
const appendedBlockPath = blockName ? '.blocks.' + blockName : '';
|
|
104
44
|
const appendedPropertyPath = propertyPath ? '.' + propertyPath : '';
|
|
105
45
|
const contextualPath = `settings${ appendedBlockPath }${ appendedPropertyPath }`;
|
|
106
|
-
const globalPath = `settings${ appendedPropertyPath }`;
|
|
107
46
|
const sourceKey = source === 'all' ? 'merged' : source;
|
|
108
47
|
|
|
109
48
|
const settingValue = useMemo( () => {
|
|
@@ -112,34 +51,9 @@ export function useGlobalSetting( propertyPath, blockName, source = 'all' ) {
|
|
|
112
51
|
throw 'Unsupported source';
|
|
113
52
|
}
|
|
114
53
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
getValueFromObjectPath( configToUse, globalPath )
|
|
119
|
-
);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
let result = {};
|
|
123
|
-
VALID_SETTINGS.forEach( ( setting ) => {
|
|
124
|
-
const value =
|
|
125
|
-
getValueFromObjectPath(
|
|
126
|
-
configToUse,
|
|
127
|
-
`settings${ appendedBlockPath }.${ setting }`
|
|
128
|
-
) ??
|
|
129
|
-
getValueFromObjectPath( configToUse, `settings.${ setting }` );
|
|
130
|
-
if ( value !== undefined ) {
|
|
131
|
-
result = setImmutably( result, setting.split( '.' ), value );
|
|
132
|
-
}
|
|
133
|
-
} );
|
|
134
|
-
return result;
|
|
135
|
-
}, [
|
|
136
|
-
configs,
|
|
137
|
-
sourceKey,
|
|
138
|
-
propertyPath,
|
|
139
|
-
contextualPath,
|
|
140
|
-
globalPath,
|
|
141
|
-
appendedBlockPath,
|
|
142
|
-
] );
|
|
54
|
+
// Use engine's getSetting instead of duplicating logic
|
|
55
|
+
return getSetting( configToUse, propertyPath, blockName );
|
|
56
|
+
}, [ configs, sourceKey, propertyPath, blockName ] );
|
|
143
57
|
|
|
144
58
|
const setSetting = ( newValue ) => {
|
|
145
59
|
setUserConfig( ( currentConfig ) =>
|
|
@@ -183,25 +97,32 @@ export function useGlobalStyle(
|
|
|
183
97
|
);
|
|
184
98
|
};
|
|
185
99
|
|
|
186
|
-
let
|
|
100
|
+
let result;
|
|
101
|
+
// Use engine's getStyle instead of duplicating logic
|
|
187
102
|
switch ( source ) {
|
|
188
103
|
case 'all':
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
104
|
+
result = getStyle(
|
|
105
|
+
mergedConfig,
|
|
106
|
+
path,
|
|
107
|
+
blockName,
|
|
108
|
+
shouldDecodeEncode
|
|
109
|
+
);
|
|
193
110
|
break;
|
|
194
111
|
case 'user':
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
112
|
+
result = getStyle(
|
|
113
|
+
userConfig,
|
|
114
|
+
path,
|
|
115
|
+
blockName,
|
|
116
|
+
shouldDecodeEncode
|
|
117
|
+
);
|
|
199
118
|
break;
|
|
200
119
|
case 'base':
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
120
|
+
result = getStyle(
|
|
121
|
+
baseConfig,
|
|
122
|
+
path,
|
|
123
|
+
blockName,
|
|
124
|
+
shouldDecodeEncode
|
|
125
|
+
);
|
|
205
126
|
break;
|
|
206
127
|
default:
|
|
207
128
|
throw 'Unsupported source';
|
|
@@ -4,14 +4,6 @@ export {
|
|
|
4
4
|
useGlobalStyle,
|
|
5
5
|
useSettingsForBlockElement,
|
|
6
6
|
} from './hooks';
|
|
7
|
-
export { getBlockCSSSelector } from './get-block-css-selector';
|
|
8
|
-
export {
|
|
9
|
-
getLayoutStyles,
|
|
10
|
-
getBlockSelectors,
|
|
11
|
-
toStyles,
|
|
12
|
-
useGlobalStylesOutput,
|
|
13
|
-
useGlobalStylesOutputWithConfig,
|
|
14
|
-
} from './use-global-styles-output';
|
|
15
7
|
export { GlobalStylesContext } from './context';
|
|
16
8
|
export {
|
|
17
9
|
default as TypographyPanel,
|