@wordpress/edit-site 4.3.0 → 4.4.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 +2 -0
- package/build/components/block-editor/resizable-editor.js +2 -1
- package/build/components/block-editor/resizable-editor.js.map +1 -1
- package/build/components/editor/global-styles-renderer.js +2 -1
- package/build/components/editor/global-styles-renderer.js.map +1 -1
- package/build/components/editor/index.js +9 -5
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/border-panel.js +100 -79
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/screen-block-list.js +48 -4
- package/build/components/global-styles/screen-block-list.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +91 -15
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +12 -2
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/sidebar/navigation-menu-sidebar/index.js +4 -2
- package/build/components/sidebar/navigation-menu-sidebar/index.js.map +1 -1
- package/build-module/components/block-editor/resizable-editor.js +2 -1
- package/build-module/components/block-editor/resizable-editor.js.map +1 -1
- package/build-module/components/editor/global-styles-renderer.js +2 -1
- package/build-module/components/editor/global-styles-renderer.js.map +1 -1
- package/build-module/components/editor/index.js +10 -6
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +103 -80
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/screen-block-list.js +47 -4
- package/build-module/components/global-styles/screen-block-list.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +87 -13
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +12 -2
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/sidebar/navigation-menu-sidebar/index.js +4 -2
- package/build-module/components/sidebar/navigation-menu-sidebar/index.js.map +1 -1
- package/build-style/style-rtl.css +41 -1
- package/build-style/style.css +41 -1
- package/package.json +29 -29
- package/src/components/block-editor/resizable-editor.js +6 -2
- package/src/components/editor/global-styles-renderer.js +2 -1
- package/src/components/editor/index.js +16 -5
- package/src/components/global-styles/border-panel.js +112 -109
- package/src/components/global-styles/screen-block-list.js +63 -8
- package/src/components/global-styles/style.scss +2 -1
- package/src/components/global-styles/test/use-global-styles-output.js +4 -1
- package/src/components/global-styles/use-global-styles-output.js +112 -17
- package/src/components/global-styles/utils.js +6 -0
- package/src/components/sidebar/navigation-menu-sidebar/index.js +4 -1
- package/src/components/sidebar/style.scss +50 -0
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { createElement } from "@wordpress/element";
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* External dependencies
|
|
3
5
|
*/
|
|
@@ -9,16 +11,14 @@ import { first, forEach, get, isEmpty, isString, kebabCase, pickBy, reduce, set,
|
|
|
9
11
|
import { __EXPERIMENTAL_STYLE_PROPERTY as STYLE_PROPERTY, __EXPERIMENTAL_ELEMENTS as ELEMENTS, getBlockTypes } from '@wordpress/blocks';
|
|
10
12
|
import { useEffect, useState, useContext } from '@wordpress/element';
|
|
11
13
|
import { getCSSRules } from '@wordpress/style-engine';
|
|
12
|
-
|
|
13
|
-
* Internal dependencies
|
|
14
|
-
*/
|
|
15
|
-
|
|
14
|
+
import { __unstablePresetDuotoneFilter as PresetDuotoneFilter } from '@wordpress/block-editor';
|
|
16
15
|
/**
|
|
17
16
|
* Internal dependencies
|
|
18
17
|
*/
|
|
19
18
|
|
|
20
19
|
import { PRESET_METADATA, ROOT_BLOCK_SELECTOR } from './utils';
|
|
21
20
|
import { GlobalStylesContext } from './context';
|
|
21
|
+
import { useSetting } from './hooks';
|
|
22
22
|
|
|
23
23
|
function compileStyleValue(uncompiledValue) {
|
|
24
24
|
const VARIABLE_REFERENCE_PREFIX = 'var:';
|
|
@@ -47,13 +47,18 @@ function getPresetsDeclarations() {
|
|
|
47
47
|
let {
|
|
48
48
|
path,
|
|
49
49
|
valueKey,
|
|
50
|
+
valueFunc,
|
|
50
51
|
cssVarInfix
|
|
51
52
|
} = _ref;
|
|
52
53
|
const presetByOrigin = get(blockPresets, path, []);
|
|
53
54
|
['default', 'theme', 'custom'].forEach(origin => {
|
|
54
55
|
if (presetByOrigin[origin]) {
|
|
55
56
|
presetByOrigin[origin].forEach(value => {
|
|
56
|
-
|
|
57
|
+
if (valueKey) {
|
|
58
|
+
declarations.push(`--wp--preset--${cssVarInfix}--${kebabCase(value.slug)}: ${value[valueKey]}`);
|
|
59
|
+
} else if (valueFunc && typeof valueFunc === 'function') {
|
|
60
|
+
declarations.push(`--wp--preset--${cssVarInfix}--${kebabCase(value.slug)}: ${valueFunc(value)}`);
|
|
61
|
+
}
|
|
57
62
|
});
|
|
58
63
|
}
|
|
59
64
|
});
|
|
@@ -107,6 +112,18 @@ function getPresetsClasses(blockSelector) {
|
|
|
107
112
|
}, '');
|
|
108
113
|
}
|
|
109
114
|
|
|
115
|
+
function getPresetsSvgFilters() {
|
|
116
|
+
let blockPresets = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
117
|
+
return PRESET_METADATA.filter( // Duotone are the only type of filters for now.
|
|
118
|
+
metadata => metadata.path.at(-1) === 'duotone').flatMap(metadata => {
|
|
119
|
+
const presetByOrigin = get(blockPresets, metadata.path, {});
|
|
120
|
+
return ['default', 'theme'].filter(origin => presetByOrigin[origin]).flatMap(origin => presetByOrigin[origin].map(preset => createElement(PresetDuotoneFilter, {
|
|
121
|
+
preset: preset,
|
|
122
|
+
key: preset.slug
|
|
123
|
+
})));
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
|
|
110
127
|
function flattenTree() {
|
|
111
128
|
let input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
112
129
|
let prefix = arguments.length > 1 ? arguments[1] : undefined;
|
|
@@ -195,7 +212,7 @@ export const getNodesWithStyles = (tree, blockSelectors) => {
|
|
|
195
212
|
return nodes;
|
|
196
213
|
}
|
|
197
214
|
|
|
198
|
-
const pickStyleKeys = treeToPickFrom => pickBy(treeToPickFrom, (value, key) => ['border', 'color', 'spacing', 'typography'].includes(key)); // Top-level.
|
|
215
|
+
const pickStyleKeys = treeToPickFrom => pickBy(treeToPickFrom, (value, key) => ['border', 'color', 'spacing', 'typography', 'filter'].includes(key)); // Top-level.
|
|
199
216
|
|
|
200
217
|
|
|
201
218
|
const styles = pickStyleKeys(tree.styles);
|
|
@@ -224,7 +241,8 @@ export const getNodesWithStyles = (tree, blockSelectors) => {
|
|
|
224
241
|
if (!!blockStyles && !!(blockSelectors !== null && blockSelectors !== void 0 && (_blockSelectors$block = blockSelectors[blockName]) !== null && _blockSelectors$block !== void 0 && _blockSelectors$block.selector)) {
|
|
225
242
|
nodes.push({
|
|
226
243
|
styles: blockStyles,
|
|
227
|
-
selector: blockSelectors[blockName].selector
|
|
244
|
+
selector: blockSelectors[blockName].selector,
|
|
245
|
+
duotoneSelector: blockSelectors[blockName].duotoneSelector
|
|
228
246
|
});
|
|
229
247
|
}
|
|
230
248
|
|
|
@@ -312,15 +330,44 @@ export const toCustomProperties = (tree, blockSelectors) => {
|
|
|
312
330
|
});
|
|
313
331
|
return ruleset;
|
|
314
332
|
};
|
|
315
|
-
export const toStyles = (tree, blockSelectors) => {
|
|
333
|
+
export const toStyles = (tree, blockSelectors, hasBlockGapSupport) => {
|
|
316
334
|
const nodesWithStyles = getNodesWithStyles(tree, blockSelectors);
|
|
317
335
|
const nodesWithSettings = getNodesWithSettings(tree, blockSelectors);
|
|
318
|
-
|
|
336
|
+
/*
|
|
337
|
+
* Reset default browser margin on the root body element.
|
|
338
|
+
* This is set on the root selector **before** generating the ruleset
|
|
339
|
+
* from the `theme.json`. This is to ensure that if the `theme.json` declares
|
|
340
|
+
* `margin` in its `spacing` declaration for the `body` element then these
|
|
341
|
+
* user-generated values take precedence in the CSS cascade.
|
|
342
|
+
* @link https://github.com/WordPress/gutenberg/issues/36147.
|
|
343
|
+
*/
|
|
344
|
+
|
|
345
|
+
let ruleset = 'body {margin: 0;}';
|
|
319
346
|
nodesWithStyles.forEach(_ref8 => {
|
|
320
347
|
let {
|
|
321
348
|
selector,
|
|
349
|
+
duotoneSelector,
|
|
322
350
|
styles
|
|
323
351
|
} = _ref8;
|
|
352
|
+
const duotoneStyles = {};
|
|
353
|
+
|
|
354
|
+
if (styles !== null && styles !== void 0 && styles.filter) {
|
|
355
|
+
duotoneStyles.filter = styles.filter;
|
|
356
|
+
delete styles.filter;
|
|
357
|
+
} // Process duotone styles (they use color.__experimentalDuotone selector).
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
if (duotoneSelector) {
|
|
361
|
+
const duotoneDeclarations = getStylesDeclarations(duotoneStyles);
|
|
362
|
+
|
|
363
|
+
if (duotoneDeclarations.length === 0) {
|
|
364
|
+
return;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
ruleset = ruleset + `${duotoneSelector}{${duotoneDeclarations.join(';')};}`;
|
|
368
|
+
} // Process the remaning block styles (they use either normal block class or __experimentalSelector).
|
|
369
|
+
|
|
370
|
+
|
|
324
371
|
const declarations = getStylesDeclarations(styles);
|
|
325
372
|
|
|
326
373
|
if (declarations.length === 0) {
|
|
@@ -329,6 +376,17 @@ export const toStyles = (tree, blockSelectors) => {
|
|
|
329
376
|
|
|
330
377
|
ruleset = ruleset + `${selector}{${declarations.join(';')};}`;
|
|
331
378
|
});
|
|
379
|
+
/* Add alignment / layout styles */
|
|
380
|
+
|
|
381
|
+
ruleset = ruleset + '.wp-site-blocks > .alignleft { float: left; margin-right: 2em; }';
|
|
382
|
+
ruleset = ruleset + '.wp-site-blocks > .alignright { float: right; margin-left: 2em; }';
|
|
383
|
+
ruleset = ruleset + '.wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }';
|
|
384
|
+
|
|
385
|
+
if (hasBlockGapSupport) {
|
|
386
|
+
ruleset = ruleset + '.wp-site-blocks > * { margin-block-start: 0; margin-block-end: 0; }';
|
|
387
|
+
ruleset = ruleset + '.wp-site-blocks > * + * { margin-block-start: var( --wp--style--block-gap ); }';
|
|
388
|
+
}
|
|
389
|
+
|
|
332
390
|
nodesWithSettings.forEach(_ref9 => {
|
|
333
391
|
let {
|
|
334
392
|
selector,
|
|
@@ -348,17 +406,28 @@ export const toStyles = (tree, blockSelectors) => {
|
|
|
348
406
|
});
|
|
349
407
|
return ruleset;
|
|
350
408
|
};
|
|
409
|
+
export function toSvgFilters(tree, blockSelectors) {
|
|
410
|
+
const nodesWithSettings = getNodesWithSettings(tree, blockSelectors);
|
|
411
|
+
return nodesWithSettings.flatMap(_ref10 => {
|
|
412
|
+
let {
|
|
413
|
+
presets
|
|
414
|
+
} = _ref10;
|
|
415
|
+
return getPresetsSvgFilters(presets);
|
|
416
|
+
});
|
|
417
|
+
}
|
|
351
418
|
|
|
352
419
|
const getBlockSelectors = blockTypes => {
|
|
353
420
|
const result = {};
|
|
354
421
|
blockTypes.forEach(blockType => {
|
|
355
|
-
var _blockType$supports$_, _blockType$supports
|
|
422
|
+
var _blockType$supports$_, _blockType$supports, _blockType$supports$c, _blockType$supports2, _blockType$supports2$;
|
|
356
423
|
|
|
357
424
|
const name = blockType.name;
|
|
358
425
|
const selector = (_blockType$supports$_ = blockType === null || blockType === void 0 ? void 0 : (_blockType$supports = blockType.supports) === null || _blockType$supports === void 0 ? void 0 : _blockType$supports.__experimentalSelector) !== null && _blockType$supports$_ !== void 0 ? _blockType$supports$_ : '.wp-block-' + name.replace('core/', '').replace('/', '-');
|
|
426
|
+
const duotoneSelector = (_blockType$supports$c = blockType === null || blockType === void 0 ? void 0 : (_blockType$supports2 = blockType.supports) === null || _blockType$supports2 === void 0 ? void 0 : (_blockType$supports2$ = _blockType$supports2.color) === null || _blockType$supports2$ === void 0 ? void 0 : _blockType$supports2$.__experimentalDuotone) !== null && _blockType$supports$c !== void 0 ? _blockType$supports$c : null;
|
|
359
427
|
result[name] = {
|
|
360
428
|
name,
|
|
361
|
-
selector
|
|
429
|
+
selector,
|
|
430
|
+
duotoneSelector
|
|
362
431
|
};
|
|
363
432
|
});
|
|
364
433
|
return result;
|
|
@@ -367,9 +436,12 @@ const getBlockSelectors = blockTypes => {
|
|
|
367
436
|
export function useGlobalStylesOutput() {
|
|
368
437
|
const [stylesheets, setStylesheets] = useState([]);
|
|
369
438
|
const [settings, setSettings] = useState({});
|
|
439
|
+
const [svgFilters, setSvgFilters] = useState({});
|
|
370
440
|
const {
|
|
371
441
|
merged: mergedConfig
|
|
372
442
|
} = useContext(GlobalStylesContext);
|
|
443
|
+
const [blockGap] = useSetting('spacing.blockGap');
|
|
444
|
+
const hasBlockGapSupport = blockGap !== null;
|
|
373
445
|
useEffect(() => {
|
|
374
446
|
if (!(mergedConfig !== null && mergedConfig !== void 0 && mergedConfig.styles) || !(mergedConfig !== null && mergedConfig !== void 0 && mergedConfig.settings)) {
|
|
375
447
|
return;
|
|
@@ -377,7 +449,8 @@ export function useGlobalStylesOutput() {
|
|
|
377
449
|
|
|
378
450
|
const blockSelectors = getBlockSelectors(getBlockTypes());
|
|
379
451
|
const customProperties = toCustomProperties(mergedConfig, blockSelectors);
|
|
380
|
-
const globalStyles = toStyles(mergedConfig, blockSelectors);
|
|
452
|
+
const globalStyles = toStyles(mergedConfig, blockSelectors, hasBlockGapSupport);
|
|
453
|
+
const filters = toSvgFilters(mergedConfig, blockSelectors);
|
|
381
454
|
setStylesheets([{
|
|
382
455
|
css: customProperties,
|
|
383
456
|
isGlobalStyles: true
|
|
@@ -386,7 +459,8 @@ export function useGlobalStylesOutput() {
|
|
|
386
459
|
isGlobalStyles: true
|
|
387
460
|
}]);
|
|
388
461
|
setSettings(mergedConfig.settings);
|
|
462
|
+
setSvgFilters(filters);
|
|
389
463
|
}, [mergedConfig]);
|
|
390
|
-
return [stylesheets, settings];
|
|
464
|
+
return [stylesheets, settings, svgFilters, hasBlockGapSupport];
|
|
391
465
|
}
|
|
392
466
|
//# sourceMappingURL=use-global-styles-output.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/use-global-styles-output.js"],"names":["first","forEach","get","isEmpty","isString","kebabCase","pickBy","reduce","set","startsWith","__EXPERIMENTAL_STYLE_PROPERTY","STYLE_PROPERTY","__EXPERIMENTAL_ELEMENTS","ELEMENTS","getBlockTypes","useEffect","useState","useContext","getCSSRules","PRESET_METADATA","ROOT_BLOCK_SELECTOR","GlobalStylesContext","compileStyleValue","uncompiledValue","VARIABLE_REFERENCE_PREFIX","VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE","VARIABLE_PATH_SEPARATOR_TOKEN_STYLE","variable","slice","length","split","join","getPresetsDeclarations","blockPresets","declarations","path","valueKey","cssVarInfix","presetByOrigin","origin","value","push","slug","getPresetsClasses","blockSelector","classes","classSuffix","propertyName","classSelectorToUse","selectorToUse","map","selector","flattenTree","input","prefix","token","result","Object","keys","key","newKey","replace","newLeaf","newPrefix","getStylesDeclarations","blockStyles","output","properties","useEngine","pathToValue","styleValue","entries","entry","name","prop","cssProperty","extraRules","rule","getNodesWithStyles","tree","blockSelectors","nodes","styles","pickStyleKeys","treeToPickFrom","includes","elements","blocks","node","blockName","elementName","sel","getNodesWithSettings","settings","pickPresets","presets","custom","blockCustom","toCustomProperties","ruleset","customProps","toStyles","nodesWithStyles","nodesWithSettings","getBlockSelectors","blockTypes","blockType","supports","__experimentalSelector","useGlobalStylesOutput","stylesheets","setStylesheets","setSettings","merged","mergedConfig","customProperties","globalStyles","css","isGlobalStyles"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,KADD,EAECC,OAFD,EAGCC,GAHD,EAICC,OAJD,EAKCC,QALD,EAMCC,SAND,EAOCC,MAPD,EAQCC,MARD,EASCC,GATD,EAUCC,UAVD,QAWO,QAXP;AAaA;AACA;AACA;;AACA,SACCC,6BAA6B,IAAIC,cADlC,EAECC,uBAAuB,IAAIC,QAF5B,EAGCC,aAHD,QAIO,mBAJP;AAKA,SAASC,S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,CAACrB,QAAf,CAAX;AACA,GAtBQ,EAsBN,CAAEqB,YAAF,CAtBM,CAAT;AAwBA,SAAO,CAAEJ,WAAF,EAAejB,QAAf,CAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport {\n\tfirst,\n\tforEach,\n\tget,\n\tisEmpty,\n\tisString,\n\tkebabCase,\n\tpickBy,\n\treduce,\n\tset,\n\tstartsWith,\n} from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__EXPERIMENTAL_STYLE_PROPERTY as STYLE_PROPERTY,\n\t__EXPERIMENTAL_ELEMENTS as ELEMENTS,\n\tgetBlockTypes,\n} from '@wordpress/blocks';\nimport { useEffect, useState, useContext } from '@wordpress/element';\nimport { getCSSRules } from '@wordpress/style-engine';\n\n/**\n * Internal dependencies\n */\n\n/**\n * Internal dependencies\n */\nimport { PRESET_METADATA, ROOT_BLOCK_SELECTOR } from './utils';\nimport { GlobalStylesContext } from './context';\n\nfunction compileStyleValue( uncompiledValue ) {\n\tconst VARIABLE_REFERENCE_PREFIX = 'var:';\n\tconst VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE = '|';\n\tconst VARIABLE_PATH_SEPARATOR_TOKEN_STYLE = '--';\n\tif ( startsWith( uncompiledValue, VARIABLE_REFERENCE_PREFIX ) ) {\n\t\tconst variable = uncompiledValue\n\t\t\t.slice( VARIABLE_REFERENCE_PREFIX.length )\n\t\t\t.split( VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE )\n\t\t\t.join( VARIABLE_PATH_SEPARATOR_TOKEN_STYLE );\n\t\treturn `var(--wp--${ variable })`;\n\t}\n\treturn uncompiledValue;\n}\n\n/**\n * Transform given preset tree into a set of style declarations.\n *\n * @param {Object} blockPresets\n *\n * @return {Array} An array of style declarations.\n */\nfunction getPresetsDeclarations( blockPresets = {} ) {\n\treturn reduce(\n\t\tPRESET_METADATA,\n\t\t( declarations, { path, valueKey, cssVarInfix } ) => {\n\t\t\tconst presetByOrigin = get( blockPresets, path, [] );\n\t\t\t[ 'default', 'theme', 'custom' ].forEach( ( origin ) => {\n\t\t\t\tif ( presetByOrigin[ origin ] ) {\n\t\t\t\t\tpresetByOrigin[ origin ].forEach( ( value ) => {\n\t\t\t\t\t\tdeclarations.push(\n\t\t\t\t\t\t\t`--wp--preset--${ cssVarInfix }--${ kebabCase(\n\t\t\t\t\t\t\t\tvalue.slug\n\t\t\t\t\t\t\t) }: ${ value[ valueKey ] }`\n\t\t\t\t\t\t);\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} );\n\n\t\t\treturn declarations;\n\t\t},\n\t\t[]\n\t);\n}\n\n/**\n * Transform given preset tree into a set of preset class declarations.\n *\n * @param {string} blockSelector\n * @param {Object} blockPresets\n * @return {string} CSS declarations for the preset classes.\n */\nfunction getPresetsClasses( blockSelector, blockPresets = {} ) {\n\treturn reduce(\n\t\tPRESET_METADATA,\n\t\t( declarations, { path, cssVarInfix, classes } ) => {\n\t\t\tif ( ! classes ) {\n\t\t\t\treturn declarations;\n\t\t\t}\n\n\t\t\tconst presetByOrigin = get( blockPresets, path, [] );\n\t\t\t[ 'default', 'theme', 'custom' ].forEach( ( origin ) => {\n\t\t\t\tif ( presetByOrigin[ origin ] ) {\n\t\t\t\t\tpresetByOrigin[ origin ].forEach( ( { slug } ) => {\n\t\t\t\t\t\tclasses.forEach( ( { classSuffix, propertyName } ) => {\n\t\t\t\t\t\t\tconst classSelectorToUse = `.has-${ kebabCase(\n\t\t\t\t\t\t\t\tslug\n\t\t\t\t\t\t\t) }-${ classSuffix }`;\n\t\t\t\t\t\t\tconst selectorToUse = blockSelector\n\t\t\t\t\t\t\t\t.split( ',' ) // Selector can be \"h1, h2, h3\"\n\t\t\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\t\t\t( selector ) =>\n\t\t\t\t\t\t\t\t\t\t`${ selector }${ classSelectorToUse }`\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t.join( ',' );\n\t\t\t\t\t\t\tconst value = `var(--wp--preset--${ cssVarInfix }--${ kebabCase(\n\t\t\t\t\t\t\t\tslug\n\t\t\t\t\t\t\t) })`;\n\t\t\t\t\t\t\tdeclarations += `${ selectorToUse }{${ propertyName }: ${ value } !important;}`;\n\t\t\t\t\t\t} );\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} );\n\t\t\treturn declarations;\n\t\t},\n\t\t''\n\t);\n}\n\nfunction flattenTree( input = {}, prefix, token ) {\n\tlet result = [];\n\tObject.keys( input ).forEach( ( key ) => {\n\t\tconst newKey = prefix + kebabCase( key.replace( '/', '-' ) );\n\t\tconst newLeaf = input[ key ];\n\n\t\tif ( newLeaf instanceof Object ) {\n\t\t\tconst newPrefix = newKey + token;\n\t\t\tresult = [ ...result, ...flattenTree( newLeaf, newPrefix, token ) ];\n\t\t} else {\n\t\t\tresult.push( `${ newKey }: ${ newLeaf }` );\n\t\t}\n\t} );\n\treturn result;\n}\n\n/**\n * Transform given style tree into a set of style declarations.\n *\n * @param {Object} blockStyles Block styles.\n *\n * @return {Array} An array of style declarations.\n */\nfunction getStylesDeclarations( blockStyles = {} ) {\n\tconst output = reduce(\n\t\tSTYLE_PROPERTY,\n\t\t( declarations, { value, properties, useEngine }, key ) => {\n\t\t\tconst pathToValue = value;\n\t\t\tif ( first( pathToValue ) === 'elements' || useEngine ) {\n\t\t\t\treturn declarations;\n\t\t\t}\n\n\t\t\tconst styleValue = get( blockStyles, pathToValue );\n\n\t\t\tif ( !! properties && ! isString( styleValue ) ) {\n\t\t\t\tObject.entries( properties ).forEach( ( entry ) => {\n\t\t\t\t\tconst [ name, prop ] = entry;\n\n\t\t\t\t\tif ( ! get( styleValue, [ prop ], false ) ) {\n\t\t\t\t\t\t// Do not create a declaration\n\t\t\t\t\t\t// for sub-properties that don't have any value.\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst cssProperty = kebabCase( name );\n\t\t\t\t\tdeclarations.push(\n\t\t\t\t\t\t`${ cssProperty }: ${ compileStyleValue(\n\t\t\t\t\t\t\tget( styleValue, [ prop ] )\n\t\t\t\t\t\t) }`\n\t\t\t\t\t);\n\t\t\t\t} );\n\t\t\t} else if ( get( blockStyles, pathToValue, false ) ) {\n\t\t\t\tconst cssProperty = key.startsWith( '--' )\n\t\t\t\t\t? key\n\t\t\t\t\t: kebabCase( key );\n\t\t\t\tdeclarations.push(\n\t\t\t\t\t`${ cssProperty }: ${ compileStyleValue(\n\t\t\t\t\t\tget( blockStyles, pathToValue )\n\t\t\t\t\t) }`\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn declarations;\n\t\t},\n\t\t[]\n\t);\n\n\t// The goal is to move everything to server side generated engine styles\n\t// This is temporary as we absorb more and more styles into the engine.\n\tconst extraRules = getCSSRules( blockStyles, { selector: 'self' } );\n\textraRules.forEach( ( rule ) => {\n\t\tif ( rule.selector !== 'self' ) {\n\t\t\tthrow \"This style can't be added as inline style\";\n\t\t}\n\t\tconst cssProperty = rule.key.startsWith( '--' )\n\t\t\t? rule.key\n\t\t\t: kebabCase( rule.key );\n\t\toutput.push( `${ cssProperty }: ${ compileStyleValue( rule.value ) }` );\n\t} );\n\n\treturn output;\n}\n\nexport const getNodesWithStyles = ( tree, blockSelectors ) => {\n\tconst nodes = [];\n\n\tif ( ! tree?.styles ) {\n\t\treturn nodes;\n\t}\n\n\tconst pickStyleKeys = ( treeToPickFrom ) =>\n\t\tpickBy( treeToPickFrom, ( value, key ) =>\n\t\t\t[ 'border', 'color', 'spacing', 'typography' ].includes( key )\n\t\t);\n\n\t// Top-level.\n\tconst styles = pickStyleKeys( tree.styles );\n\tif ( !! styles ) {\n\t\tnodes.push( {\n\t\t\tstyles,\n\t\t\tselector: ROOT_BLOCK_SELECTOR,\n\t\t} );\n\t}\n\tforEach( tree.styles?.elements, ( value, key ) => {\n\t\tif ( !! value && !! ELEMENTS[ key ] ) {\n\t\t\tnodes.push( {\n\t\t\t\tstyles: value,\n\t\t\t\tselector: ELEMENTS[ key ],\n\t\t\t} );\n\t\t}\n\t} );\n\n\t// Iterate over blocks: they can have styles & elements.\n\tforEach( tree.styles?.blocks, ( node, blockName ) => {\n\t\tconst blockStyles = pickStyleKeys( node );\n\t\tif ( !! blockStyles && !! blockSelectors?.[ blockName ]?.selector ) {\n\t\t\tnodes.push( {\n\t\t\t\tstyles: blockStyles,\n\t\t\t\tselector: blockSelectors[ blockName ].selector,\n\t\t\t} );\n\t\t}\n\n\t\tforEach( node?.elements, ( value, elementName ) => {\n\t\t\tif (\n\t\t\t\t!! value &&\n\t\t\t\t!! blockSelectors?.[ blockName ] &&\n\t\t\t\t!! ELEMENTS?.[ elementName ]\n\t\t\t) {\n\t\t\t\tnodes.push( {\n\t\t\t\t\tstyles: value,\n\t\t\t\t\tselector: blockSelectors[ blockName ].selector\n\t\t\t\t\t\t.split( ',' )\n\t\t\t\t\t\t.map( ( sel ) => sel + ' ' + ELEMENTS[ elementName ] )\n\t\t\t\t\t\t.join( ',' ),\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\t} );\n\n\treturn nodes;\n};\n\nexport const getNodesWithSettings = ( tree, blockSelectors ) => {\n\tconst nodes = [];\n\n\tif ( ! tree?.settings ) {\n\t\treturn nodes;\n\t}\n\n\tconst pickPresets = ( treeToPickFrom ) => {\n\t\tconst presets = {};\n\t\tPRESET_METADATA.forEach( ( { path } ) => {\n\t\t\tconst value = get( treeToPickFrom, path, false );\n\t\t\tif ( value !== false ) {\n\t\t\t\tset( presets, path, value );\n\t\t\t}\n\t\t} );\n\t\treturn presets;\n\t};\n\n\t// Top-level.\n\tconst presets = pickPresets( tree.settings );\n\tconst custom = tree.settings?.custom;\n\tif ( ! isEmpty( presets ) || !! custom ) {\n\t\tnodes.push( {\n\t\t\tpresets,\n\t\t\tcustom,\n\t\t\tselector: ROOT_BLOCK_SELECTOR,\n\t\t} );\n\t}\n\n\t// Blocks.\n\tforEach( tree.settings?.blocks, ( node, blockName ) => {\n\t\tconst blockPresets = pickPresets( node );\n\t\tconst blockCustom = node.custom;\n\t\tif ( ! isEmpty( blockPresets ) || !! blockCustom ) {\n\t\t\tnodes.push( {\n\t\t\t\tpresets: blockPresets,\n\t\t\t\tcustom: blockCustom,\n\t\t\t\tselector: blockSelectors[ blockName ].selector,\n\t\t\t} );\n\t\t}\n\t} );\n\n\treturn nodes;\n};\n\nexport const toCustomProperties = ( tree, blockSelectors ) => {\n\tconst settings = getNodesWithSettings( tree, blockSelectors );\n\n\tlet ruleset = '';\n\tsettings.forEach( ( { presets, custom, selector } ) => {\n\t\tconst declarations = getPresetsDeclarations( presets );\n\t\tconst customProps = flattenTree( custom, '--wp--custom--', '--' );\n\t\tif ( customProps.length > 0 ) {\n\t\t\tdeclarations.push( ...customProps );\n\t\t}\n\n\t\tif ( declarations.length > 0 ) {\n\t\t\truleset = ruleset + `${ selector }{${ declarations.join( ';' ) };}`;\n\t\t}\n\t} );\n\n\treturn ruleset;\n};\n\nexport const toStyles = ( tree, blockSelectors ) => {\n\tconst nodesWithStyles = getNodesWithStyles( tree, blockSelectors );\n\tconst nodesWithSettings = getNodesWithSettings( tree, blockSelectors );\n\n\tlet ruleset =\n\t\t'.wp-site-blocks > * { margin-top: 0; margin-bottom: 0; }.wp-site-blocks > * + * { margin-top: var( --wp--style--block-gap ); }';\n\tnodesWithStyles.forEach( ( { selector, styles } ) => {\n\t\tconst declarations = getStylesDeclarations( styles );\n\t\tif ( declarations.length === 0 ) {\n\t\t\treturn;\n\t\t}\n\t\truleset = ruleset + `${ selector }{${ declarations.join( ';' ) };}`;\n\t} );\n\n\tnodesWithSettings.forEach( ( { selector, presets } ) => {\n\t\tif ( ROOT_BLOCK_SELECTOR === selector ) {\n\t\t\t// Do not add extra specificity for top-level classes.\n\t\t\tselector = '';\n\t\t}\n\n\t\tconst classes = getPresetsClasses( selector, presets );\n\t\tif ( ! isEmpty( classes ) ) {\n\t\t\truleset = ruleset + classes;\n\t\t}\n\t} );\n\n\treturn ruleset;\n};\n\nconst getBlockSelectors = ( blockTypes ) => {\n\tconst result = {};\n\tblockTypes.forEach( ( blockType ) => {\n\t\tconst name = blockType.name;\n\t\tconst selector =\n\t\t\tblockType?.supports?.__experimentalSelector ??\n\t\t\t'.wp-block-' + name.replace( 'core/', '' ).replace( '/', '-' );\n\t\tresult[ name ] = {\n\t\t\tname,\n\t\t\tselector,\n\t\t};\n\t} );\n\n\treturn result;\n};\n\nexport function useGlobalStylesOutput() {\n\tconst [ stylesheets, setStylesheets ] = useState( [] );\n\tconst [ settings, setSettings ] = useState( {} );\n\tconst { merged: mergedConfig } = useContext( GlobalStylesContext );\n\n\tuseEffect( () => {\n\t\tif ( ! mergedConfig?.styles || ! mergedConfig?.settings ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst blockSelectors = getBlockSelectors( getBlockTypes() );\n\t\tconst customProperties = toCustomProperties(\n\t\t\tmergedConfig,\n\t\t\tblockSelectors\n\t\t);\n\t\tconst globalStyles = toStyles( mergedConfig, blockSelectors );\n\t\tsetStylesheets( [\n\t\t\t{\n\t\t\t\tcss: customProperties,\n\t\t\t\tisGlobalStyles: true,\n\t\t\t},\n\t\t\t{\n\t\t\t\tcss: globalStyles,\n\t\t\t\tisGlobalStyles: true,\n\t\t\t},\n\t\t] );\n\t\tsetSettings( mergedConfig.settings );\n\t}, [ mergedConfig ] );\n\n\treturn [ stylesheets, settings ];\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/use-global-styles-output.js"],"names":["first","forEach","get","isEmpty","isString","kebabCase","pickBy","reduce","set","startsWith","__EXPERIMENTAL_STYLE_PROPERTY","STYLE_PROPERTY","__EXPERIMENTAL_ELEMENTS","ELEMENTS","getBlockTypes","useEffect","useState","useContext","getCSSRules","__unstablePresetDuotoneFilter","PresetDuotoneFilter","PRESET_METADATA","ROOT_BLOCK_SELECTOR","GlobalStylesContext","useSetting","compileStyleValue","uncompiledValue","VARIABLE_REFERENCE_PREFIX","VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE","VARIABLE_PATH_SEPARATOR_TOKEN_STYLE","variable","slice","length","split","join","getPresetsDeclarations","blockPresets","declarations","path","valueKey","valueFunc","cssVarInfix","presetByOrigin","origin","value","push","slug","getPresetsClasses","blockSelector","classes","classSuffix","propertyName","classSelectorToUse","selectorToUse","map","selector","getPresetsSvgFilters","filter","metadata","at","flatMap","preset","flattenTree","input","prefix","token","result","Object","keys","key","newKey","replace","newLeaf","newPrefix","getStylesDeclarations","blockStyles","output","properties","useEngine","pathToValue","styleValue","entries","entry","name","prop","cssProperty","extraRules","rule","getNodesWithStyles","tree","blockSelectors","nodes","styles","pickStyleKeys","treeToPickFrom","includes","elements","blocks","node","blockName","duotoneSelector","elementName","sel","getNodesWithSettings","settings","pickPresets","presets","custom","blockCustom","toCustomProperties","ruleset","customProps","toStyles","hasBlockGapSupport","nodesWithStyles","nodesWithSettings","duotoneStyles","duotoneDeclarations","toSvgFilters","getBlockSelectors","blockTypes","blockType","supports","__experimentalSelector","color","__experimentalDuotone","useGlobalStylesOutput","stylesheets","setStylesheets","setSettings","svgFilters","setSvgFilters","merged","mergedConfig","blockGap","customProperties","globalStyles","filters","css","isGlobalStyles"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,KADD,EAECC,OAFD,EAGCC,GAHD,EAICC,OAJD,EAKCC,QALD,EAMCC,SAND,EAOCC,MAPD,EAQCC,MARD,EASCC,GATD,EAUCC,UAVD,QAWO,QAXP;AAaA;AACA;AACA;;AACA,SACCC,6BAA6B,IAAIC,cADlC,EAECC,uBAAuB,IAAIC,QAF5B,EAGCC,aAHD,QAIO,mBAJP;AAKA,SAASC,SAAT,EAAoBC,QAApB,EAA8BC,UAA9B,QAAgD,oBAAhD;AACA,SAASC,WAAT,QAA4B,yBAA5B;AACA,SAASC,6BAA6B,IAAIC,mBAA1C,QAAqE,yBAArE;AAEA;AACA;AACA;;AACA,SAASC,eAAT,EAA0BC,mBAA1B,QAAqD,SAArD;AACA,SAASC,mBAA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W,CAAEI,YAAY,CAAC7B,QAAf,CAAX;AACA2B,IAAAA,aAAa,CAAEM,OAAF,CAAb;AACA,GA5BQ,EA4BN,CAAEJ,YAAF,CA5BM,CAAT;AA8BA,SAAO,CAAEN,WAAF,EAAevB,QAAf,EAAyB0B,UAAzB,EAAqCjB,kBAArC,CAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport {\n\tfirst,\n\tforEach,\n\tget,\n\tisEmpty,\n\tisString,\n\tkebabCase,\n\tpickBy,\n\treduce,\n\tset,\n\tstartsWith,\n} from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__EXPERIMENTAL_STYLE_PROPERTY as STYLE_PROPERTY,\n\t__EXPERIMENTAL_ELEMENTS as ELEMENTS,\n\tgetBlockTypes,\n} from '@wordpress/blocks';\nimport { useEffect, useState, useContext } from '@wordpress/element';\nimport { getCSSRules } from '@wordpress/style-engine';\nimport { __unstablePresetDuotoneFilter as PresetDuotoneFilter } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { PRESET_METADATA, ROOT_BLOCK_SELECTOR } from './utils';\nimport { GlobalStylesContext } from './context';\nimport { useSetting } from './hooks';\n\nfunction compileStyleValue( uncompiledValue ) {\n\tconst VARIABLE_REFERENCE_PREFIX = 'var:';\n\tconst VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE = '|';\n\tconst VARIABLE_PATH_SEPARATOR_TOKEN_STYLE = '--';\n\tif ( startsWith( uncompiledValue, VARIABLE_REFERENCE_PREFIX ) ) {\n\t\tconst variable = uncompiledValue\n\t\t\t.slice( VARIABLE_REFERENCE_PREFIX.length )\n\t\t\t.split( VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE )\n\t\t\t.join( VARIABLE_PATH_SEPARATOR_TOKEN_STYLE );\n\t\treturn `var(--wp--${ variable })`;\n\t}\n\treturn uncompiledValue;\n}\n\n/**\n * Transform given preset tree into a set of style declarations.\n *\n * @param {Object} blockPresets\n *\n * @return {Array} An array of style declarations.\n */\nfunction getPresetsDeclarations( blockPresets = {} ) {\n\treturn reduce(\n\t\tPRESET_METADATA,\n\t\t( declarations, { path, valueKey, valueFunc, cssVarInfix } ) => {\n\t\t\tconst presetByOrigin = get( blockPresets, path, [] );\n\t\t\t[ 'default', 'theme', 'custom' ].forEach( ( origin ) => {\n\t\t\t\tif ( presetByOrigin[ origin ] ) {\n\t\t\t\t\tpresetByOrigin[ origin ].forEach( ( value ) => {\n\t\t\t\t\t\tif ( valueKey ) {\n\t\t\t\t\t\t\tdeclarations.push(\n\t\t\t\t\t\t\t\t`--wp--preset--${ cssVarInfix }--${ kebabCase(\n\t\t\t\t\t\t\t\t\tvalue.slug\n\t\t\t\t\t\t\t\t) }: ${ value[ valueKey ] }`\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\tvalueFunc &&\n\t\t\t\t\t\t\ttypeof valueFunc === 'function'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tdeclarations.push(\n\t\t\t\t\t\t\t\t`--wp--preset--${ cssVarInfix }--${ kebabCase(\n\t\t\t\t\t\t\t\t\tvalue.slug\n\t\t\t\t\t\t\t\t) }: ${ valueFunc( value ) }`\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} );\n\n\t\t\treturn declarations;\n\t\t},\n\t\t[]\n\t);\n}\n\n/**\n * Transform given preset tree into a set of preset class declarations.\n *\n * @param {string} blockSelector\n * @param {Object} blockPresets\n * @return {string} CSS declarations for the preset classes.\n */\nfunction getPresetsClasses( blockSelector, blockPresets = {} ) {\n\treturn reduce(\n\t\tPRESET_METADATA,\n\t\t( declarations, { path, cssVarInfix, classes } ) => {\n\t\t\tif ( ! classes ) {\n\t\t\t\treturn declarations;\n\t\t\t}\n\n\t\t\tconst presetByOrigin = get( blockPresets, path, [] );\n\t\t\t[ 'default', 'theme', 'custom' ].forEach( ( origin ) => {\n\t\t\t\tif ( presetByOrigin[ origin ] ) {\n\t\t\t\t\tpresetByOrigin[ origin ].forEach( ( { slug } ) => {\n\t\t\t\t\t\tclasses.forEach( ( { classSuffix, propertyName } ) => {\n\t\t\t\t\t\t\tconst classSelectorToUse = `.has-${ kebabCase(\n\t\t\t\t\t\t\t\tslug\n\t\t\t\t\t\t\t) }-${ classSuffix }`;\n\t\t\t\t\t\t\tconst selectorToUse = blockSelector\n\t\t\t\t\t\t\t\t.split( ',' ) // Selector can be \"h1, h2, h3\"\n\t\t\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\t\t\t( selector ) =>\n\t\t\t\t\t\t\t\t\t\t`${ selector }${ classSelectorToUse }`\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t.join( ',' );\n\t\t\t\t\t\t\tconst value = `var(--wp--preset--${ cssVarInfix }--${ kebabCase(\n\t\t\t\t\t\t\t\tslug\n\t\t\t\t\t\t\t) })`;\n\t\t\t\t\t\t\tdeclarations += `${ selectorToUse }{${ propertyName }: ${ value } !important;}`;\n\t\t\t\t\t\t} );\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} );\n\t\t\treturn declarations;\n\t\t},\n\t\t''\n\t);\n}\n\nfunction getPresetsSvgFilters( blockPresets = {} ) {\n\treturn PRESET_METADATA.filter(\n\t\t// Duotone are the only type of filters for now.\n\t\t( metadata ) => metadata.path.at( -1 ) === 'duotone'\n\t).flatMap( ( metadata ) => {\n\t\tconst presetByOrigin = get( blockPresets, metadata.path, {} );\n\t\treturn [ 'default', 'theme' ]\n\t\t\t.filter( ( origin ) => presetByOrigin[ origin ] )\n\t\t\t.flatMap( ( origin ) =>\n\t\t\t\tpresetByOrigin[ origin ].map( ( preset ) => (\n\t\t\t\t\t<PresetDuotoneFilter\n\t\t\t\t\t\tpreset={ preset }\n\t\t\t\t\t\tkey={ preset.slug }\n\t\t\t\t\t/>\n\t\t\t\t) )\n\t\t\t);\n\t} );\n}\n\nfunction flattenTree( input = {}, prefix, token ) {\n\tlet result = [];\n\tObject.keys( input ).forEach( ( key ) => {\n\t\tconst newKey = prefix + kebabCase( key.replace( '/', '-' ) );\n\t\tconst newLeaf = input[ key ];\n\n\t\tif ( newLeaf instanceof Object ) {\n\t\t\tconst newPrefix = newKey + token;\n\t\t\tresult = [ ...result, ...flattenTree( newLeaf, newPrefix, token ) ];\n\t\t} else {\n\t\t\tresult.push( `${ newKey }: ${ newLeaf }` );\n\t\t}\n\t} );\n\treturn result;\n}\n\n/**\n * Transform given style tree into a set of style declarations.\n *\n * @param {Object} blockStyles Block styles.\n *\n * @return {Array} An array of style declarations.\n */\nfunction getStylesDeclarations( blockStyles = {} ) {\n\tconst output = reduce(\n\t\tSTYLE_PROPERTY,\n\t\t( declarations, { value, properties, useEngine }, key ) => {\n\t\t\tconst pathToValue = value;\n\t\t\tif ( first( pathToValue ) === 'elements' || useEngine ) {\n\t\t\t\treturn declarations;\n\t\t\t}\n\n\t\t\tconst styleValue = get( blockStyles, pathToValue );\n\n\t\t\tif ( !! properties && ! isString( styleValue ) ) {\n\t\t\t\tObject.entries( properties ).forEach( ( entry ) => {\n\t\t\t\t\tconst [ name, prop ] = entry;\n\n\t\t\t\t\tif ( ! get( styleValue, [ prop ], false ) ) {\n\t\t\t\t\t\t// Do not create a declaration\n\t\t\t\t\t\t// for sub-properties that don't have any value.\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst cssProperty = kebabCase( name );\n\t\t\t\t\tdeclarations.push(\n\t\t\t\t\t\t`${ cssProperty }: ${ compileStyleValue(\n\t\t\t\t\t\t\tget( styleValue, [ prop ] )\n\t\t\t\t\t\t) }`\n\t\t\t\t\t);\n\t\t\t\t} );\n\t\t\t} else if ( get( blockStyles, pathToValue, false ) ) {\n\t\t\t\tconst cssProperty = key.startsWith( '--' )\n\t\t\t\t\t? key\n\t\t\t\t\t: kebabCase( key );\n\t\t\t\tdeclarations.push(\n\t\t\t\t\t`${ cssProperty }: ${ compileStyleValue(\n\t\t\t\t\t\tget( blockStyles, pathToValue )\n\t\t\t\t\t) }`\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn declarations;\n\t\t},\n\t\t[]\n\t);\n\n\t// The goal is to move everything to server side generated engine styles\n\t// This is temporary as we absorb more and more styles into the engine.\n\tconst extraRules = getCSSRules( blockStyles, { selector: 'self' } );\n\textraRules.forEach( ( rule ) => {\n\t\tif ( rule.selector !== 'self' ) {\n\t\t\tthrow \"This style can't be added as inline style\";\n\t\t}\n\t\tconst cssProperty = rule.key.startsWith( '--' )\n\t\t\t? rule.key\n\t\t\t: kebabCase( rule.key );\n\t\toutput.push( `${ cssProperty }: ${ compileStyleValue( rule.value ) }` );\n\t} );\n\n\treturn output;\n}\n\nexport const getNodesWithStyles = ( tree, blockSelectors ) => {\n\tconst nodes = [];\n\n\tif ( ! tree?.styles ) {\n\t\treturn nodes;\n\t}\n\n\tconst pickStyleKeys = ( treeToPickFrom ) =>\n\t\tpickBy( treeToPickFrom, ( value, key ) =>\n\t\t\t[ 'border', 'color', 'spacing', 'typography', 'filter' ].includes(\n\t\t\t\tkey\n\t\t\t)\n\t\t);\n\n\t// Top-level.\n\tconst styles = pickStyleKeys( tree.styles );\n\tif ( !! styles ) {\n\t\tnodes.push( {\n\t\t\tstyles,\n\t\t\tselector: ROOT_BLOCK_SELECTOR,\n\t\t} );\n\t}\n\tforEach( tree.styles?.elements, ( value, key ) => {\n\t\tif ( !! value && !! ELEMENTS[ key ] ) {\n\t\t\tnodes.push( {\n\t\t\t\tstyles: value,\n\t\t\t\tselector: ELEMENTS[ key ],\n\t\t\t} );\n\t\t}\n\t} );\n\n\t// Iterate over blocks: they can have styles & elements.\n\tforEach( tree.styles?.blocks, ( node, blockName ) => {\n\t\tconst blockStyles = pickStyleKeys( node );\n\t\tif ( !! blockStyles && !! blockSelectors?.[ blockName ]?.selector ) {\n\t\t\tnodes.push( {\n\t\t\t\tstyles: blockStyles,\n\t\t\t\tselector: blockSelectors[ blockName ].selector,\n\t\t\t\tduotoneSelector: blockSelectors[ blockName ].duotoneSelector,\n\t\t\t} );\n\t\t}\n\n\t\tforEach( node?.elements, ( value, elementName ) => {\n\t\t\tif (\n\t\t\t\t!! value &&\n\t\t\t\t!! blockSelectors?.[ blockName ] &&\n\t\t\t\t!! ELEMENTS?.[ elementName ]\n\t\t\t) {\n\t\t\t\tnodes.push( {\n\t\t\t\t\tstyles: value,\n\t\t\t\t\tselector: blockSelectors[ blockName ].selector\n\t\t\t\t\t\t.split( ',' )\n\t\t\t\t\t\t.map( ( sel ) => sel + ' ' + ELEMENTS[ elementName ] )\n\t\t\t\t\t\t.join( ',' ),\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\t} );\n\n\treturn nodes;\n};\n\nexport const getNodesWithSettings = ( tree, blockSelectors ) => {\n\tconst nodes = [];\n\n\tif ( ! tree?.settings ) {\n\t\treturn nodes;\n\t}\n\n\tconst pickPresets = ( treeToPickFrom ) => {\n\t\tconst presets = {};\n\t\tPRESET_METADATA.forEach( ( { path } ) => {\n\t\t\tconst value = get( treeToPickFrom, path, false );\n\t\t\tif ( value !== false ) {\n\t\t\t\tset( presets, path, value );\n\t\t\t}\n\t\t} );\n\t\treturn presets;\n\t};\n\n\t// Top-level.\n\tconst presets = pickPresets( tree.settings );\n\tconst custom = tree.settings?.custom;\n\tif ( ! isEmpty( presets ) || !! custom ) {\n\t\tnodes.push( {\n\t\t\tpresets,\n\t\t\tcustom,\n\t\t\tselector: ROOT_BLOCK_SELECTOR,\n\t\t} );\n\t}\n\n\t// Blocks.\n\tforEach( tree.settings?.blocks, ( node, blockName ) => {\n\t\tconst blockPresets = pickPresets( node );\n\t\tconst blockCustom = node.custom;\n\t\tif ( ! isEmpty( blockPresets ) || !! blockCustom ) {\n\t\t\tnodes.push( {\n\t\t\t\tpresets: blockPresets,\n\t\t\t\tcustom: blockCustom,\n\t\t\t\tselector: blockSelectors[ blockName ].selector,\n\t\t\t} );\n\t\t}\n\t} );\n\n\treturn nodes;\n};\n\nexport const toCustomProperties = ( tree, blockSelectors ) => {\n\tconst settings = getNodesWithSettings( tree, blockSelectors );\n\n\tlet ruleset = '';\n\tsettings.forEach( ( { presets, custom, selector } ) => {\n\t\tconst declarations = getPresetsDeclarations( presets );\n\t\tconst customProps = flattenTree( custom, '--wp--custom--', '--' );\n\t\tif ( customProps.length > 0 ) {\n\t\t\tdeclarations.push( ...customProps );\n\t\t}\n\n\t\tif ( declarations.length > 0 ) {\n\t\t\truleset = ruleset + `${ selector }{${ declarations.join( ';' ) };}`;\n\t\t}\n\t} );\n\n\treturn ruleset;\n};\n\nexport const toStyles = ( tree, blockSelectors, hasBlockGapSupport ) => {\n\tconst nodesWithStyles = getNodesWithStyles( tree, blockSelectors );\n\tconst nodesWithSettings = getNodesWithSettings( tree, blockSelectors );\n\n\t/*\n\t * Reset default browser margin on the root body element.\n\t * This is set on the root selector **before** generating the ruleset\n\t * from the `theme.json`. This is to ensure that if the `theme.json` declares\n\t * `margin` in its `spacing` declaration for the `body` element then these\n\t * user-generated values take precedence in the CSS cascade.\n\t * @link https://github.com/WordPress/gutenberg/issues/36147.\n\t */\n\tlet ruleset = 'body {margin: 0;}';\n\tnodesWithStyles.forEach( ( { selector, duotoneSelector, styles } ) => {\n\t\tconst duotoneStyles = {};\n\t\tif ( styles?.filter ) {\n\t\t\tduotoneStyles.filter = styles.filter;\n\t\t\tdelete styles.filter;\n\t\t}\n\n\t\t// Process duotone styles (they use color.__experimentalDuotone selector).\n\t\tif ( duotoneSelector ) {\n\t\t\tconst duotoneDeclarations = getStylesDeclarations( duotoneStyles );\n\t\t\tif ( duotoneDeclarations.length === 0 ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\truleset =\n\t\t\t\truleset +\n\t\t\t\t`${ duotoneSelector }{${ duotoneDeclarations.join( ';' ) };}`;\n\t\t}\n\n\t\t// Process the remaning block styles (they use either normal block class or __experimentalSelector).\n\t\tconst declarations = getStylesDeclarations( styles );\n\t\tif ( declarations.length === 0 ) {\n\t\t\treturn;\n\t\t}\n\t\truleset = ruleset + `${ selector }{${ declarations.join( ';' ) };}`;\n\t} );\n\n\t/* Add alignment / layout styles */\n\truleset =\n\t\truleset +\n\t\t'.wp-site-blocks > .alignleft { float: left; margin-right: 2em; }';\n\truleset =\n\t\truleset +\n\t\t'.wp-site-blocks > .alignright { float: right; margin-left: 2em; }';\n\truleset =\n\t\truleset +\n\t\t'.wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }';\n\n\tif ( hasBlockGapSupport ) {\n\t\truleset =\n\t\t\truleset +\n\t\t\t'.wp-site-blocks > * { margin-block-start: 0; margin-block-end: 0; }';\n\t\truleset =\n\t\t\truleset +\n\t\t\t'.wp-site-blocks > * + * { margin-block-start: var( --wp--style--block-gap ); }';\n\t}\n\n\tnodesWithSettings.forEach( ( { selector, presets } ) => {\n\t\tif ( ROOT_BLOCK_SELECTOR === selector ) {\n\t\t\t// Do not add extra specificity for top-level classes.\n\t\t\tselector = '';\n\t\t}\n\n\t\tconst classes = getPresetsClasses( selector, presets );\n\t\tif ( ! isEmpty( classes ) ) {\n\t\t\truleset = ruleset + classes;\n\t\t}\n\t} );\n\n\treturn ruleset;\n};\n\nexport function toSvgFilters( tree, blockSelectors ) {\n\tconst nodesWithSettings = getNodesWithSettings( tree, blockSelectors );\n\treturn nodesWithSettings.flatMap( ( { presets } ) => {\n\t\treturn getPresetsSvgFilters( presets );\n\t} );\n}\n\nconst getBlockSelectors = ( blockTypes ) => {\n\tconst result = {};\n\tblockTypes.forEach( ( blockType ) => {\n\t\tconst name = blockType.name;\n\t\tconst selector =\n\t\t\tblockType?.supports?.__experimentalSelector ??\n\t\t\t'.wp-block-' + name.replace( 'core/', '' ).replace( '/', '-' );\n\t\tconst duotoneSelector =\n\t\t\tblockType?.supports?.color?.__experimentalDuotone ?? null;\n\t\tresult[ name ] = {\n\t\t\tname,\n\t\t\tselector,\n\t\t\tduotoneSelector,\n\t\t};\n\t} );\n\n\treturn result;\n};\n\nexport function useGlobalStylesOutput() {\n\tconst [ stylesheets, setStylesheets ] = useState( [] );\n\tconst [ settings, setSettings ] = useState( {} );\n\tconst [ svgFilters, setSvgFilters ] = useState( {} );\n\tconst { merged: mergedConfig } = useContext( GlobalStylesContext );\n\tconst [ blockGap ] = useSetting( 'spacing.blockGap' );\n\tconst hasBlockGapSupport = blockGap !== null;\n\n\tuseEffect( () => {\n\t\tif ( ! mergedConfig?.styles || ! mergedConfig?.settings ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst blockSelectors = getBlockSelectors( getBlockTypes() );\n\t\tconst customProperties = toCustomProperties(\n\t\t\tmergedConfig,\n\t\t\tblockSelectors\n\t\t);\n\t\tconst globalStyles = toStyles(\n\t\t\tmergedConfig,\n\t\t\tblockSelectors,\n\t\t\thasBlockGapSupport\n\t\t);\n\t\tconst filters = toSvgFilters( mergedConfig, blockSelectors );\n\t\tsetStylesheets( [\n\t\t\t{\n\t\t\t\tcss: customProperties,\n\t\t\t\tisGlobalStyles: true,\n\t\t\t},\n\t\t\t{\n\t\t\t\tcss: globalStyles,\n\t\t\t\tisGlobalStyles: true,\n\t\t\t},\n\t\t] );\n\t\tsetSettings( mergedConfig.settings );\n\t\tsetSvgFilters( filters );\n\t}, [ mergedConfig ] );\n\n\treturn [ stylesheets, settings, svgFilters, hasBlockGapSupport ];\n}\n"]}
|
|
@@ -29,6 +29,16 @@ export const PRESET_METADATA = [{
|
|
|
29
29
|
classSuffix: 'gradient-background',
|
|
30
30
|
propertyName: 'background'
|
|
31
31
|
}]
|
|
32
|
+
}, {
|
|
33
|
+
path: ['color', 'duotone'],
|
|
34
|
+
cssVarInfix: 'duotone',
|
|
35
|
+
valueFunc: _ref => {
|
|
36
|
+
let {
|
|
37
|
+
slug
|
|
38
|
+
} = _ref;
|
|
39
|
+
return `url( '#wp-duotone-${slug}' )`;
|
|
40
|
+
},
|
|
41
|
+
classes: []
|
|
32
42
|
}, {
|
|
33
43
|
path: ['typography', 'fontSizes'],
|
|
34
44
|
valueKey: 'size',
|
|
@@ -119,8 +129,8 @@ export function getPresetVariableFromValue(features, blockName, variableStylePat
|
|
|
119
129
|
return `var:preset|${cssVarInfix}|${presetObject.slug}`;
|
|
120
130
|
}
|
|
121
131
|
|
|
122
|
-
function getValueFromPresetVariable(features, blockName, variable,
|
|
123
|
-
let [presetType, slug] =
|
|
132
|
+
function getValueFromPresetVariable(features, blockName, variable, _ref2) {
|
|
133
|
+
let [presetType, slug] = _ref2;
|
|
124
134
|
const metadata = find(PRESET_METADATA, ['cssVarInfix', presetType]);
|
|
125
135
|
|
|
126
136
|
if (!metadata) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/utils.js"],"names":["get","find","isString","ROOT_BLOCK_NAME","ROOT_BLOCK_SELECTOR","ROOT_BLOCK_SUPPORTS","PRESET_METADATA","path","valueKey","cssVarInfix","classes","classSuffix","propertyName","STYLE_PATH_TO_CSS_VAR_INFIX","findInPresetsBy","features","blockName","presetPath","presetProperty","presetValueValue","orderedPresetsByOrigin","presetByOrigin","origins","origin","presets","presetObject","preset","highestPresetObjectWithSameSlug","slug","undefined","getPresetVariableFromValue","variableStylePath","presetPropertyValue","metadata","getValueFromPresetVariable","variable","presetType","result","getValueFromVariable","getValueFromCustomVariable","USER_VALUE_PREFIX","THEME_VALUE_PREFIX","THEME_VALUE_SUFFIX","parsedVar","startsWith","slice","length","split","endsWith","type"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,GAAT,EAAcC,IAAd,EAAoBC,QAApB,QAAoC,QAApC;AAEA;;AACA,OAAO,MAAMC,eAAe,GAAG,MAAxB;AACP,OAAO,MAAMC,mBAAmB,GAAG,MAA5B;AACP,OAAO,MAAMC,mBAAmB,GAAG,CAClC,YADkC,EAElC,iBAFkC,EAGlC,OAHkC,EAIlC,WAJkC,EAKlC,YALkC,EAMlC,UANkC,EAOlC,WAPkC,EAQlC,YARkC,EASlC,YATkC,EAUl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,CAAZ;AAGA,GAPM,MAOA;AACN;AACA,WAAOZ,QAAP;AACA;;AAED,QAAM,CAAEc,IAAF,EAAQ,GAAG1C,IAAX,IAAoBoC,SAA1B;;AACA,MAAKM,IAAI,KAAK,QAAd,EAAyB;AACxB,WAAOf,0BAA0B,CAChCnB,QADgC,EAEhCC,SAFgC,EAGhCmB,QAHgC,EAIhC5B,IAJgC,CAAjC;AAMA;;AACD,MAAK0C,IAAI,KAAK,QAAd,EAAyB;AACxB,WAAOV,0BAA0B,CAChCxB,QADgC,EAEhCC,SAFgC,EAGhCmB,QAHgC,EAIhC5B,IAJgC,CAAjC;AAMA;;AACD,SAAO4B,QAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { get, find, isString } from 'lodash';\n\n/* Supporting data. */\nexport const ROOT_BLOCK_NAME = 'root';\nexport const ROOT_BLOCK_SELECTOR = 'body';\nexport const ROOT_BLOCK_SUPPORTS = [\n\t'background',\n\t'backgroundColor',\n\t'color',\n\t'linkColor',\n\t'fontFamily',\n\t'fontSize',\n\t'fontStyle',\n\t'fontWeight',\n\t'lineHeight',\n\t'textDecoration',\n\t'textTransform',\n\t'padding',\n];\n\nexport const PRESET_METADATA = [\n\t{\n\t\tpath: [ 'color', 'palette' ],\n\t\tvalueKey: 'color',\n\t\tcssVarInfix: 'color',\n\t\tclasses: [\n\t\t\t{ classSuffix: 'color', propertyName: 'color' },\n\t\t\t{\n\t\t\t\tclassSuffix: 'background-color',\n\t\t\t\tpropertyName: 'background-color',\n\t\t\t},\n\t\t\t{\n\t\t\t\tclassSuffix: 'border-color',\n\t\t\t\tpropertyName: 'border-color',\n\t\t\t},\n\t\t],\n\t},\n\t{\n\t\tpath: [ 'color', 'gradients' ],\n\t\tvalueKey: 'gradient',\n\t\tcssVarInfix: 'gradient',\n\t\tclasses: [\n\t\t\t{\n\t\t\t\tclassSuffix: 'gradient-background',\n\t\t\t\tpropertyName: 'background',\n\t\t\t},\n\t\t],\n\t},\n\t{\n\t\tpath: [ 'typography', 'fontSizes' ],\n\t\tvalueKey: 'size',\n\t\tcssVarInfix: 'font-size',\n\t\tclasses: [ { classSuffix: 'font-size', propertyName: 'font-size' } ],\n\t},\n\t{\n\t\tpath: [ 'typography', 'fontFamilies' ],\n\t\tvalueKey: 'fontFamily',\n\t\tcssVarInfix: 'font-family',\n\t\tclasses: [\n\t\t\t{ classSuffix: 'font-family', propertyName: 'font-family' },\n\t\t],\n\t},\n];\n\nconst STYLE_PATH_TO_CSS_VAR_INFIX = {\n\t'color.background': 'color',\n\t'color.text': 'color',\n\t'elements.link.color.text': 'color',\n\t'color.gradient': 'gradient',\n\t'typography.fontSize': 'font-size',\n\t'typography.fontFamily': 'font-family',\n};\n\nfunction findInPresetsBy(\n\tfeatures,\n\tblockName,\n\tpresetPath,\n\tpresetProperty,\n\tpresetValueValue\n) {\n\t// Block presets take priority above root level presets.\n\tconst orderedPresetsByOrigin = [\n\t\tget( features, [ 'blocks', blockName, ...presetPath ] ),\n\t\tget( features, presetPath ),\n\t];\n\n\tfor ( const presetByOrigin of orderedPresetsByOrigin ) {\n\t\tif ( presetByOrigin ) {\n\t\t\t// Preset origins ordered by priority.\n\t\t\tconst origins = [ 'custom', 'theme', 'default' ];\n\t\t\tfor ( const origin of origins ) {\n\t\t\t\tconst presets = presetByOrigin[ origin ];\n\t\t\t\tif ( presets ) {\n\t\t\t\t\tconst presetObject = find(\n\t\t\t\t\t\tpresets,\n\t\t\t\t\t\t( preset ) =>\n\t\t\t\t\t\t\tpreset[ presetProperty ] === presetValueValue\n\t\t\t\t\t);\n\t\t\t\t\tif ( presetObject ) {\n\t\t\t\t\t\tif ( presetProperty === 'slug' ) {\n\t\t\t\t\t\t\treturn presetObject;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// If there is a highest priority preset with the same slug but different value the preset we found was overwritten and should be ignored.\n\t\t\t\t\t\tconst highestPresetObjectWithSameSlug = findInPresetsBy(\n\t\t\t\t\t\t\tfeatures,\n\t\t\t\t\t\t\tblockName,\n\t\t\t\t\t\t\tpresetPath,\n\t\t\t\t\t\t\t'slug',\n\t\t\t\t\t\t\tpresetObject.slug\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\thighestPresetObjectWithSameSlug[\n\t\t\t\t\t\t\t\tpresetProperty\n\t\t\t\t\t\t\t] === presetObject[ presetProperty ]\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\treturn presetObject;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport function getPresetVariableFromValue(\n\tfeatures,\n\tblockName,\n\tvariableStylePath,\n\tpresetPropertyValue\n) {\n\tif ( ! presetPropertyValue ) {\n\t\treturn presetPropertyValue;\n\t}\n\n\tconst cssVarInfix = STYLE_PATH_TO_CSS_VAR_INFIX[ variableStylePath ];\n\n\tconst metadata = find( PRESET_METADATA, [ 'cssVarInfix', cssVarInfix ] );\n\n\tif ( ! metadata ) {\n\t\t// The property doesn't have preset data\n\t\t// so the value should be returned as it is.\n\t\treturn presetPropertyValue;\n\t}\n\tconst { valueKey, path } = metadata;\n\n\tconst presetObject = findInPresetsBy(\n\t\tfeatures,\n\t\tblockName,\n\t\tpath,\n\t\tvalueKey,\n\t\tpresetPropertyValue\n\t);\n\n\tif ( ! presetObject ) {\n\t\t// Value wasn't found in the presets,\n\t\t// so it must be a custom value.\n\t\treturn presetPropertyValue;\n\t}\n\n\treturn `var:preset|${ cssVarInfix }|${ presetObject.slug }`;\n}\n\nfunction getValueFromPresetVariable(\n\tfeatures,\n\tblockName,\n\tvariable,\n\t[ presetType, slug ]\n) {\n\tconst metadata = find( PRESET_METADATA, [ 'cssVarInfix', presetType ] );\n\tif ( ! metadata ) {\n\t\treturn variable;\n\t}\n\n\tconst presetObject = findInPresetsBy(\n\t\tfeatures,\n\t\tblockName,\n\t\tmetadata.path,\n\t\t'slug',\n\t\tslug\n\t);\n\n\tif ( presetObject ) {\n\t\tconst { valueKey } = metadata;\n\t\tconst result = presetObject[ valueKey ];\n\t\treturn getValueFromVariable( features, blockName, result );\n\t}\n\n\treturn variable;\n}\n\nfunction getValueFromCustomVariable( features, blockName, variable, path ) {\n\tconst result =\n\t\tget( features, [ 'blocks', blockName, 'custom', ...path ] ) ??\n\t\tget( features, [ 'custom', ...path ] );\n\tif ( ! result ) {\n\t\treturn variable;\n\t}\n\t// A variable may reference another variable so we need recursion until we find the value.\n\treturn getValueFromVariable( features, blockName, result );\n}\n\nexport function getValueFromVariable( features, blockName, variable ) {\n\tif ( ! variable || ! isString( variable ) ) {\n\t\treturn variable;\n\t}\n\tconst USER_VALUE_PREFIX = 'var:';\n\tconst THEME_VALUE_PREFIX = 'var(--wp--';\n\tconst THEME_VALUE_SUFFIX = ')';\n\n\tlet parsedVar;\n\n\tif ( variable.startsWith( USER_VALUE_PREFIX ) ) {\n\t\tparsedVar = variable.slice( USER_VALUE_PREFIX.length ).split( '|' );\n\t} else if (\n\t\tvariable.startsWith( THEME_VALUE_PREFIX ) &&\n\t\tvariable.endsWith( THEME_VALUE_SUFFIX )\n\t) {\n\t\tparsedVar = variable\n\t\t\t.slice( THEME_VALUE_PREFIX.length, -THEME_VALUE_SUFFIX.length )\n\t\t\t.split( '--' );\n\t} else {\n\t\t// We don't know how to parse the value: either is raw of uses complex CSS such as `calc(1px * var(--wp--variable) )`\n\t\treturn variable;\n\t}\n\n\tconst [ type, ...path ] = parsedVar;\n\tif ( type === 'preset' ) {\n\t\treturn getValueFromPresetVariable(\n\t\t\tfeatures,\n\t\t\tblockName,\n\t\t\tvariable,\n\t\t\tpath\n\t\t);\n\t}\n\tif ( type === 'custom' ) {\n\t\treturn getValueFromCustomVariable(\n\t\t\tfeatures,\n\t\t\tblockName,\n\t\t\tvariable,\n\t\t\tpath\n\t\t);\n\t}\n\treturn variable;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/utils.js"],"names":["get","find","isString","ROOT_BLOCK_NAME","ROOT_BLOCK_SELECTOR","ROOT_BLOCK_SUPPORTS","PRESET_METADATA","path","valueKey","cssVarInfix","classes","classSuffix","propertyName","valueFunc","slug","STYLE_PATH_TO_CSS_VAR_INFIX","findInPresetsBy","features","blockName","presetPath","presetProperty","presetValueValue","orderedPresetsByOrigin","presetByOrigin","origins","origin","presets","presetObject","preset","highestPresetObjectWithSameSlug","undefined","getPresetVariableFromValue","variableStylePath","presetPropertyValue","metadata","getValueFromPresetVariable","variable","presetType","result","getValueFromVariable","getValueFromCustomVariable","USER_VALUE_PREFIX","THEME_VALUE_PREFIX","THEME_VALUE_SUFFIX","parsedVar","startsWith","slice","length","split","endsWith","type"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,GAAT,EAAcC,IAAd,EAAoBC,QAApB,QAAoC,QAApC;AAEA;;AACA,OAAO,MAAMC,eAAe,GAAG,MAAxB;AACP,OAAO,MAAMC,mBAAmB,GAAG,MAA5B;AACP,OAAO,MAAMC,mBAAmB,GAAG,CAClC,YADkC,EAElC,iBAFkC,EAGlC,OAHkC,EAIlC,WAJkC,EAKlC,YALkC,EAMlC,UANkC,EAOlC,WAPkC,EAQlC,YARkC,EASlC,YATkC,EAUlC,gBAVkC,EAWlC,eAXkC,EAYlC,SAZkC,CAA5B;AAeP,OAAO,MAAMC,eAAe,GAAG,CAC9B;AACCC,EAAAA,IAAI,EAAE,CAAE,OAAF,EAAW,SAAX,CADP;AAECC,EAAAA,QAAQ,EAAE,OAFX;AAGCC,EAAAA,WAAW,EAAE,OAHd;AAICC,EAAAA,OAAO,EAAE,CACR;AAAEC,IAAAA,WAAW,EAAE,OAAf;AAAwBC,IAAAA,YAAY,EAAE;AAAtC,GADQ,EAER;AACCD,IAAAA,WAAW,EAAE,kBADd;AAECC,IAAAA,YAAY,EAAE;AAFf,GAFQ,EAMR;AACCD,IAAAA,WAAW,EAAE,cADd;AAECC,IAAAA,YAAY,EAAE;AAFf,GANQ;AAJV,CAD8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kB,QAHgC,EAIhC7B,IAJgC,CAAjC;AAMA;;AACD,MAAK2C,IAAI,KAAK,QAAd,EAAyB;AACxB,WAAOV,0BAA0B,CAChCvB,QADgC,EAEhCC,SAFgC,EAGhCkB,QAHgC,EAIhC7B,IAJgC,CAAjC;AAMA;;AACD,SAAO6B,QAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { get, find, isString } from 'lodash';\n\n/* Supporting data. */\nexport const ROOT_BLOCK_NAME = 'root';\nexport const ROOT_BLOCK_SELECTOR = 'body';\nexport const ROOT_BLOCK_SUPPORTS = [\n\t'background',\n\t'backgroundColor',\n\t'color',\n\t'linkColor',\n\t'fontFamily',\n\t'fontSize',\n\t'fontStyle',\n\t'fontWeight',\n\t'lineHeight',\n\t'textDecoration',\n\t'textTransform',\n\t'padding',\n];\n\nexport const PRESET_METADATA = [\n\t{\n\t\tpath: [ 'color', 'palette' ],\n\t\tvalueKey: 'color',\n\t\tcssVarInfix: 'color',\n\t\tclasses: [\n\t\t\t{ classSuffix: 'color', propertyName: 'color' },\n\t\t\t{\n\t\t\t\tclassSuffix: 'background-color',\n\t\t\t\tpropertyName: 'background-color',\n\t\t\t},\n\t\t\t{\n\t\t\t\tclassSuffix: 'border-color',\n\t\t\t\tpropertyName: 'border-color',\n\t\t\t},\n\t\t],\n\t},\n\t{\n\t\tpath: [ 'color', 'gradients' ],\n\t\tvalueKey: 'gradient',\n\t\tcssVarInfix: 'gradient',\n\t\tclasses: [\n\t\t\t{\n\t\t\t\tclassSuffix: 'gradient-background',\n\t\t\t\tpropertyName: 'background',\n\t\t\t},\n\t\t],\n\t},\n\t{\n\t\tpath: [ 'color', 'duotone' ],\n\t\tcssVarInfix: 'duotone',\n\t\tvalueFunc: ( { slug } ) => `url( '#wp-duotone-${ slug }' )`,\n\t\tclasses: [],\n\t},\n\t{\n\t\tpath: [ 'typography', 'fontSizes' ],\n\t\tvalueKey: 'size',\n\t\tcssVarInfix: 'font-size',\n\t\tclasses: [ { classSuffix: 'font-size', propertyName: 'font-size' } ],\n\t},\n\t{\n\t\tpath: [ 'typography', 'fontFamilies' ],\n\t\tvalueKey: 'fontFamily',\n\t\tcssVarInfix: 'font-family',\n\t\tclasses: [\n\t\t\t{ classSuffix: 'font-family', propertyName: 'font-family' },\n\t\t],\n\t},\n];\n\nconst STYLE_PATH_TO_CSS_VAR_INFIX = {\n\t'color.background': 'color',\n\t'color.text': 'color',\n\t'elements.link.color.text': 'color',\n\t'color.gradient': 'gradient',\n\t'typography.fontSize': 'font-size',\n\t'typography.fontFamily': 'font-family',\n};\n\nfunction findInPresetsBy(\n\tfeatures,\n\tblockName,\n\tpresetPath,\n\tpresetProperty,\n\tpresetValueValue\n) {\n\t// Block presets take priority above root level presets.\n\tconst orderedPresetsByOrigin = [\n\t\tget( features, [ 'blocks', blockName, ...presetPath ] ),\n\t\tget( features, presetPath ),\n\t];\n\n\tfor ( const presetByOrigin of orderedPresetsByOrigin ) {\n\t\tif ( presetByOrigin ) {\n\t\t\t// Preset origins ordered by priority.\n\t\t\tconst origins = [ 'custom', 'theme', 'default' ];\n\t\t\tfor ( const origin of origins ) {\n\t\t\t\tconst presets = presetByOrigin[ origin ];\n\t\t\t\tif ( presets ) {\n\t\t\t\t\tconst presetObject = find(\n\t\t\t\t\t\tpresets,\n\t\t\t\t\t\t( preset ) =>\n\t\t\t\t\t\t\tpreset[ presetProperty ] === presetValueValue\n\t\t\t\t\t);\n\t\t\t\t\tif ( presetObject ) {\n\t\t\t\t\t\tif ( presetProperty === 'slug' ) {\n\t\t\t\t\t\t\treturn presetObject;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// If there is a highest priority preset with the same slug but different value the preset we found was overwritten and should be ignored.\n\t\t\t\t\t\tconst highestPresetObjectWithSameSlug = findInPresetsBy(\n\t\t\t\t\t\t\tfeatures,\n\t\t\t\t\t\t\tblockName,\n\t\t\t\t\t\t\tpresetPath,\n\t\t\t\t\t\t\t'slug',\n\t\t\t\t\t\t\tpresetObject.slug\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\thighestPresetObjectWithSameSlug[\n\t\t\t\t\t\t\t\tpresetProperty\n\t\t\t\t\t\t\t] === presetObject[ presetProperty ]\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\treturn presetObject;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport function getPresetVariableFromValue(\n\tfeatures,\n\tblockName,\n\tvariableStylePath,\n\tpresetPropertyValue\n) {\n\tif ( ! presetPropertyValue ) {\n\t\treturn presetPropertyValue;\n\t}\n\n\tconst cssVarInfix = STYLE_PATH_TO_CSS_VAR_INFIX[ variableStylePath ];\n\n\tconst metadata = find( PRESET_METADATA, [ 'cssVarInfix', cssVarInfix ] );\n\n\tif ( ! metadata ) {\n\t\t// The property doesn't have preset data\n\t\t// so the value should be returned as it is.\n\t\treturn presetPropertyValue;\n\t}\n\tconst { valueKey, path } = metadata;\n\n\tconst presetObject = findInPresetsBy(\n\t\tfeatures,\n\t\tblockName,\n\t\tpath,\n\t\tvalueKey,\n\t\tpresetPropertyValue\n\t);\n\n\tif ( ! presetObject ) {\n\t\t// Value wasn't found in the presets,\n\t\t// so it must be a custom value.\n\t\treturn presetPropertyValue;\n\t}\n\n\treturn `var:preset|${ cssVarInfix }|${ presetObject.slug }`;\n}\n\nfunction getValueFromPresetVariable(\n\tfeatures,\n\tblockName,\n\tvariable,\n\t[ presetType, slug ]\n) {\n\tconst metadata = find( PRESET_METADATA, [ 'cssVarInfix', presetType ] );\n\tif ( ! metadata ) {\n\t\treturn variable;\n\t}\n\n\tconst presetObject = findInPresetsBy(\n\t\tfeatures,\n\t\tblockName,\n\t\tmetadata.path,\n\t\t'slug',\n\t\tslug\n\t);\n\n\tif ( presetObject ) {\n\t\tconst { valueKey } = metadata;\n\t\tconst result = presetObject[ valueKey ];\n\t\treturn getValueFromVariable( features, blockName, result );\n\t}\n\n\treturn variable;\n}\n\nfunction getValueFromCustomVariable( features, blockName, variable, path ) {\n\tconst result =\n\t\tget( features, [ 'blocks', blockName, 'custom', ...path ] ) ??\n\t\tget( features, [ 'custom', ...path ] );\n\tif ( ! result ) {\n\t\treturn variable;\n\t}\n\t// A variable may reference another variable so we need recursion until we find the value.\n\treturn getValueFromVariable( features, blockName, result );\n}\n\nexport function getValueFromVariable( features, blockName, variable ) {\n\tif ( ! variable || ! isString( variable ) ) {\n\t\treturn variable;\n\t}\n\tconst USER_VALUE_PREFIX = 'var:';\n\tconst THEME_VALUE_PREFIX = 'var(--wp--';\n\tconst THEME_VALUE_SUFFIX = ')';\n\n\tlet parsedVar;\n\n\tif ( variable.startsWith( USER_VALUE_PREFIX ) ) {\n\t\tparsedVar = variable.slice( USER_VALUE_PREFIX.length ).split( '|' );\n\t} else if (\n\t\tvariable.startsWith( THEME_VALUE_PREFIX ) &&\n\t\tvariable.endsWith( THEME_VALUE_SUFFIX )\n\t) {\n\t\tparsedVar = variable\n\t\t\t.slice( THEME_VALUE_PREFIX.length, -THEME_VALUE_SUFFIX.length )\n\t\t\t.split( '--' );\n\t} else {\n\t\t// We don't know how to parse the value: either is raw of uses complex CSS such as `calc(1px * var(--wp--variable) )`\n\t\treturn variable;\n\t}\n\n\tconst [ type, ...path ] = parsedVar;\n\tif ( type === 'preset' ) {\n\t\treturn getValueFromPresetVariable(\n\t\t\tfeatures,\n\t\t\tblockName,\n\t\t\tvariable,\n\t\t\tpath\n\t\t);\n\t}\n\tif ( type === 'custom' ) {\n\t\treturn getValueFromCustomVariable(\n\t\t\tfeatures,\n\t\t\tblockName,\n\t\t\tvariable,\n\t\t\tpath\n\t\t);\n\t}\n\treturn variable;\n}\n"]}
|
|
@@ -16,11 +16,13 @@ export default function NavigationMenuSidebar() {
|
|
|
16
16
|
return createElement(DefaultSidebar, {
|
|
17
17
|
className: "edit-site-navigation-menu-sidebar",
|
|
18
18
|
identifier: "edit-site/navigation-menu",
|
|
19
|
-
title: __('Navigation
|
|
19
|
+
title: __('Navigation'),
|
|
20
20
|
icon: navigation,
|
|
21
21
|
closeLabel: __('Close navigation menu sidebar'),
|
|
22
22
|
panelClassName: "edit-site-navigation-menu-sidebar__panel",
|
|
23
|
-
header: createElement(Flex, null, createElement(FlexBlock, null, createElement("strong", null, __('Navigation Menus'))
|
|
23
|
+
header: createElement(Flex, null, createElement(FlexBlock, null, createElement("strong", null, __('Navigation Menus')), createElement("span", {
|
|
24
|
+
className: "edit-site-navigation-sidebar__beta"
|
|
25
|
+
}, __('Beta'))))
|
|
24
26
|
}, createElement(NavigationInspector, null));
|
|
25
27
|
}
|
|
26
28
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/navigation-menu-sidebar/index.js"],"names":["FlexBlock","Flex","__","navigation","DefaultSidebar","NavigationInspector","NavigationMenuSidebar"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,IAApB,QAAgC,uBAAhC;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,UAAT,QAA2B,kBAA3B;AAEA;AACA;AACA;;AACA,OAAOC,cAAP,MAA2B,oBAA3B;AACA,OAAOC,mBAAP,MAAgC,wBAAhC;AAEA,eAAe,SAASC,qBAAT,GAAiC;AAC/C,SACC,cAAC,cAAD;AACC,IAAA,SAAS,EAAC,mCADX;AAEC,IAAA,UAAU,EAAC,2BAFZ;AAGC,IAAA,KAAK,EAAGJ,EAAE,CAAE,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/navigation-menu-sidebar/index.js"],"names":["FlexBlock","Flex","__","navigation","DefaultSidebar","NavigationInspector","NavigationMenuSidebar"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,IAApB,QAAgC,uBAAhC;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,UAAT,QAA2B,kBAA3B;AAEA;AACA;AACA;;AACA,OAAOC,cAAP,MAA2B,oBAA3B;AACA,OAAOC,mBAAP,MAAgC,wBAAhC;AAEA,eAAe,SAASC,qBAAT,GAAiC;AAC/C,SACC,cAAC,cAAD;AACC,IAAA,SAAS,EAAC,mCADX;AAEC,IAAA,UAAU,EAAC,2BAFZ;AAGC,IAAA,KAAK,EAAGJ,EAAE,CAAE,YAAF,CAHX;AAIC,IAAA,IAAI,EAAGC,UAJR;AAKC,IAAA,UAAU,EAAGD,EAAE,CAAE,+BAAF,CALhB;AAMC,IAAA,cAAc,EAAC,0CANhB;AAOC,IAAA,MAAM,EACL,cAAC,IAAD,QACC,cAAC,SAAD,QACC,8BAAUA,EAAE,CAAE,kBAAF,CAAZ,CADD,EAEC;AAAM,MAAA,SAAS,EAAC;AAAhB,OACGA,EAAE,CAAE,MAAF,CADL,CAFD,CADD;AARF,KAkBC,cAAC,mBAAD,OAlBD,CADD;AAsBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { FlexBlock, Flex } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { navigation } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport DefaultSidebar from '../default-sidebar';\nimport NavigationInspector from './navigation-inspector';\n\nexport default function NavigationMenuSidebar() {\n\treturn (\n\t\t<DefaultSidebar\n\t\t\tclassName=\"edit-site-navigation-menu-sidebar\"\n\t\t\tidentifier=\"edit-site/navigation-menu\"\n\t\t\ttitle={ __( 'Navigation' ) }\n\t\t\ticon={ navigation }\n\t\t\tcloseLabel={ __( 'Close navigation menu sidebar' ) }\n\t\t\tpanelClassName=\"edit-site-navigation-menu-sidebar__panel\"\n\t\t\theader={\n\t\t\t\t<Flex>\n\t\t\t\t\t<FlexBlock>\n\t\t\t\t\t\t<strong>{ __( 'Navigation Menus' ) }</strong>\n\t\t\t\t\t\t<span className=\"edit-site-navigation-sidebar__beta\">\n\t\t\t\t\t\t\t{ __( 'Beta' ) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</FlexBlock>\n\t\t\t\t</Flex>\n\t\t\t}\n\t\t>\n\t\t\t<NavigationInspector />\n\t\t</DefaultSidebar>\n\t);\n}\n"]}
|
|
@@ -745,7 +745,8 @@ textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-inp
|
|
|
745
745
|
background: linear-gradient(45deg, transparent 48%, #ddd 48%, #ddd 52%, transparent 52%);
|
|
746
746
|
}
|
|
747
747
|
|
|
748
|
-
.edit-site-global-styles-header__description
|
|
748
|
+
.edit-site-global-styles-header__description,
|
|
749
|
+
.edit-site-block-types-search {
|
|
749
750
|
padding: 0 16px;
|
|
750
751
|
}
|
|
751
752
|
|
|
@@ -1541,6 +1542,7 @@ body.is-fullscreen-mode .edit-site-list-header {
|
|
|
1541
1542
|
padding: 16px;
|
|
1542
1543
|
}
|
|
1543
1544
|
|
|
1545
|
+
.edit-site-navigation-sidebar__beta,
|
|
1544
1546
|
.edit-site-global-styles-sidebar__beta {
|
|
1545
1547
|
display: inline-flex;
|
|
1546
1548
|
margin-right: 8px;
|
|
@@ -1554,6 +1556,44 @@ body.is-fullscreen-mode .edit-site-list-header {
|
|
|
1554
1556
|
line-height: 1;
|
|
1555
1557
|
}
|
|
1556
1558
|
|
|
1559
|
+
.edit-site-global-styles-sidebar__border-box-control__popover .components-popover__content,
|
|
1560
|
+
.edit-site-global-styles-sidebar__border-box-control__popover-top .components-popover__content,
|
|
1561
|
+
.edit-site-global-styles-sidebar__border-box-control__popover-right .components-popover__content,
|
|
1562
|
+
.edit-site-global-styles-sidebar__border-box-control__popover-bottom .components-popover__content,
|
|
1563
|
+
.edit-site-global-styles-sidebar__border-box-control__popover-left .components-popover__content {
|
|
1564
|
+
width: 282px;
|
|
1565
|
+
}
|
|
1566
|
+
|
|
1567
|
+
@media (min-width: 782px) {
|
|
1568
|
+
.edit-site-global-styles-sidebar__border-box-control__popover .components-popover__content,
|
|
1569
|
+
.edit-site-global-styles-sidebar__border-box-control__popover-left .components-popover__content {
|
|
1570
|
+
margin-left: 52px !important;
|
|
1571
|
+
}
|
|
1572
|
+
|
|
1573
|
+
.edit-site-global-styles-sidebar__border-box-control__popover-top .components-popover__content,
|
|
1574
|
+
.edit-site-global-styles-sidebar__border-box-control__popover-bottom .components-popover__content {
|
|
1575
|
+
margin-left: 107px !important;
|
|
1576
|
+
}
|
|
1577
|
+
|
|
1578
|
+
.edit-site-global-styles-sidebar__border-box-control__popover-right .components-popover__content {
|
|
1579
|
+
margin-left: 162px !important;
|
|
1580
|
+
}
|
|
1581
|
+
|
|
1582
|
+
.edit-site-global-styles-sidebar__border-box-control__popover.is-from-top .components-popover__content,
|
|
1583
|
+
.edit-site-global-styles-sidebar__border-box-control__popover-top.is-from-top .components-popover__content,
|
|
1584
|
+
.edit-site-global-styles-sidebar__border-box-control__popover-right.is-from-top .components-popover__content,
|
|
1585
|
+
.edit-site-global-styles-sidebar__border-box-control__popover-bottom.is-from-top .components-popover__content,
|
|
1586
|
+
.edit-site-global-styles-sidebar__border-box-control__popover-left.is-from-top .components-popover__content {
|
|
1587
|
+
margin-top: -52px !important;
|
|
1588
|
+
}
|
|
1589
|
+
.edit-site-global-styles-sidebar__border-box-control__popover.is-from-bottom .components-popover__content,
|
|
1590
|
+
.edit-site-global-styles-sidebar__border-box-control__popover-top.is-from-bottom .components-popover__content,
|
|
1591
|
+
.edit-site-global-styles-sidebar__border-box-control__popover-right.is-from-bottom .components-popover__content,
|
|
1592
|
+
.edit-site-global-styles-sidebar__border-box-control__popover-bottom.is-from-bottom .components-popover__content,
|
|
1593
|
+
.edit-site-global-styles-sidebar__border-box-control__popover-left.is-from-bottom .components-popover__content {
|
|
1594
|
+
margin-bottom: -52px !important;
|
|
1595
|
+
}
|
|
1596
|
+
}
|
|
1557
1597
|
.components-panel__header.edit-site-sidebar__panel-tabs {
|
|
1558
1598
|
justify-content: flex-start;
|
|
1559
1599
|
padding-right: 0;
|
package/build-style/style.css
CHANGED
|
@@ -745,7 +745,8 @@ textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-inp
|
|
|
745
745
|
background: linear-gradient(-45deg, transparent 48%, #ddd 48%, #ddd 52%, transparent 52%);
|
|
746
746
|
}
|
|
747
747
|
|
|
748
|
-
.edit-site-global-styles-header__description
|
|
748
|
+
.edit-site-global-styles-header__description,
|
|
749
|
+
.edit-site-block-types-search {
|
|
749
750
|
padding: 0 16px;
|
|
750
751
|
}
|
|
751
752
|
|
|
@@ -1541,6 +1542,7 @@ body.is-fullscreen-mode .edit-site-list-header {
|
|
|
1541
1542
|
padding: 16px;
|
|
1542
1543
|
}
|
|
1543
1544
|
|
|
1545
|
+
.edit-site-navigation-sidebar__beta,
|
|
1544
1546
|
.edit-site-global-styles-sidebar__beta {
|
|
1545
1547
|
display: inline-flex;
|
|
1546
1548
|
margin-left: 8px;
|
|
@@ -1554,6 +1556,44 @@ body.is-fullscreen-mode .edit-site-list-header {
|
|
|
1554
1556
|
line-height: 1;
|
|
1555
1557
|
}
|
|
1556
1558
|
|
|
1559
|
+
.edit-site-global-styles-sidebar__border-box-control__popover .components-popover__content,
|
|
1560
|
+
.edit-site-global-styles-sidebar__border-box-control__popover-top .components-popover__content,
|
|
1561
|
+
.edit-site-global-styles-sidebar__border-box-control__popover-right .components-popover__content,
|
|
1562
|
+
.edit-site-global-styles-sidebar__border-box-control__popover-bottom .components-popover__content,
|
|
1563
|
+
.edit-site-global-styles-sidebar__border-box-control__popover-left .components-popover__content {
|
|
1564
|
+
width: 282px;
|
|
1565
|
+
}
|
|
1566
|
+
|
|
1567
|
+
@media (min-width: 782px) {
|
|
1568
|
+
.edit-site-global-styles-sidebar__border-box-control__popover .components-popover__content,
|
|
1569
|
+
.edit-site-global-styles-sidebar__border-box-control__popover-left .components-popover__content {
|
|
1570
|
+
margin-right: 52px !important;
|
|
1571
|
+
}
|
|
1572
|
+
|
|
1573
|
+
.edit-site-global-styles-sidebar__border-box-control__popover-top .components-popover__content,
|
|
1574
|
+
.edit-site-global-styles-sidebar__border-box-control__popover-bottom .components-popover__content {
|
|
1575
|
+
margin-right: 107px !important;
|
|
1576
|
+
}
|
|
1577
|
+
|
|
1578
|
+
.edit-site-global-styles-sidebar__border-box-control__popover-right .components-popover__content {
|
|
1579
|
+
margin-right: 162px !important;
|
|
1580
|
+
}
|
|
1581
|
+
|
|
1582
|
+
.edit-site-global-styles-sidebar__border-box-control__popover.is-from-top .components-popover__content,
|
|
1583
|
+
.edit-site-global-styles-sidebar__border-box-control__popover-top.is-from-top .components-popover__content,
|
|
1584
|
+
.edit-site-global-styles-sidebar__border-box-control__popover-right.is-from-top .components-popover__content,
|
|
1585
|
+
.edit-site-global-styles-sidebar__border-box-control__popover-bottom.is-from-top .components-popover__content,
|
|
1586
|
+
.edit-site-global-styles-sidebar__border-box-control__popover-left.is-from-top .components-popover__content {
|
|
1587
|
+
margin-top: -52px !important;
|
|
1588
|
+
}
|
|
1589
|
+
.edit-site-global-styles-sidebar__border-box-control__popover.is-from-bottom .components-popover__content,
|
|
1590
|
+
.edit-site-global-styles-sidebar__border-box-control__popover-top.is-from-bottom .components-popover__content,
|
|
1591
|
+
.edit-site-global-styles-sidebar__border-box-control__popover-right.is-from-bottom .components-popover__content,
|
|
1592
|
+
.edit-site-global-styles-sidebar__border-box-control__popover-bottom.is-from-bottom .components-popover__content,
|
|
1593
|
+
.edit-site-global-styles-sidebar__border-box-control__popover-left.is-from-bottom .components-popover__content {
|
|
1594
|
+
margin-bottom: -52px !important;
|
|
1595
|
+
}
|
|
1596
|
+
}
|
|
1557
1597
|
.components-panel__header.edit-site-sidebar__panel-tabs {
|
|
1558
1598
|
justify-content: flex-start;
|
|
1559
1599
|
padding-left: 0;
|