@wordpress/edit-site 6.33.3-next.36001005c.0 → 6.33.3
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/dataviews-actions/index.js +8 -6
- package/build/components/dataviews-actions/index.js.map +2 -2
- package/build/components/global-styles-renderer/index.js +4 -2
- package/build/components/global-styles-renderer/index.js.map +3 -3
- package/build/components/page-templates/fields.js +19 -26
- package/build/components/page-templates/fields.js.map +2 -2
- package/build/components/page-templates/index.js +41 -31
- package/build/components/page-templates/index.js.map +2 -2
- package/build/components/revisions/index.js +2 -2
- package/build/components/revisions/index.js.map +2 -2
- package/build/components/sidebar-navigation-screen-templates-browse/content.js +6 -7
- package/build/components/sidebar-navigation-screen-templates-browse/content.js.map +2 -2
- package/build/components/style-book/index.js +8 -4
- package/build/components/style-book/index.js.map +2 -2
- package/build-module/components/dataviews-actions/index.js +8 -6
- package/build-module/components/dataviews-actions/index.js.map +2 -2
- package/build-module/components/global-styles-renderer/index.js +3 -1
- package/build-module/components/global-styles-renderer/index.js.map +2 -2
- package/build-module/components/page-templates/fields.js +19 -26
- package/build-module/components/page-templates/fields.js.map +2 -2
- package/build-module/components/page-templates/index.js +41 -31
- package/build-module/components/page-templates/index.js.map +2 -2
- package/build-module/components/revisions/index.js +1 -1
- package/build-module/components/revisions/index.js.map +2 -2
- package/build-module/components/sidebar-navigation-screen-templates-browse/content.js +6 -7
- package/build-module/components/sidebar-navigation-screen-templates-browse/content.js.map +2 -2
- package/build-module/components/style-book/index.js +6 -2
- package/build-module/components/style-book/index.js.map +2 -2
- package/build-style/posts-rtl.css +13 -13
- package/build-style/posts.css +13 -13
- package/build-style/style-rtl.css +23 -23
- package/build-style/style.css +23 -23
- package/package.json +44 -45
- package/src/components/dataviews-actions/index.js +12 -10
- package/src/components/global-styles/font-library-modal/style.scss +3 -3
- package/src/components/global-styles/style.scss +1 -1
- package/src/components/global-styles-renderer/index.js +4 -1
- package/src/components/global-styles-sidebar/style.scss +2 -2
- package/src/components/page-templates/fields.js +23 -29
- package/src/components/page-templates/index.js +51 -38
- package/src/components/revisions/index.js +1 -1
- package/src/components/sidebar-navigation-screen/style.scss +1 -1
- package/src/components/sidebar-navigation-screen-patterns/style.scss +1 -1
- package/src/components/sidebar-navigation-screen-templates-browse/content.js +6 -7
- package/src/components/site-hub/style.scss +1 -1
- package/src/components/style-book/index.js +6 -3
- package/tsconfig.json +0 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/build/hooks/use-global-styles-output.js +0 -77
- package/build/hooks/use-global-styles-output.js.map +0 -7
- package/build-module/hooks/use-global-styles-output.js +0 -52
- package/build-module/hooks/use-global-styles-output.js.map +0 -7
- package/src/hooks/use-global-styles-output.js +0 -80
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var use_global_styles_output_exports = {};
|
|
20
|
-
__export(use_global_styles_output_exports, {
|
|
21
|
-
useGlobalStylesOutput: () => useGlobalStylesOutput,
|
|
22
|
-
useGlobalStylesOutputWithConfig: () => useGlobalStylesOutputWithConfig
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(use_global_styles_output_exports);
|
|
25
|
-
var import_blocks = require("@wordpress/blocks");
|
|
26
|
-
var import_data = require("@wordpress/data");
|
|
27
|
-
var import_element = require("@wordpress/element");
|
|
28
|
-
var import_global_styles_engine = require("@wordpress/global-styles-engine");
|
|
29
|
-
var import_block_editor = require("@wordpress/block-editor");
|
|
30
|
-
var import_store = require("../store");
|
|
31
|
-
var import_lock_unlock = require("../lock-unlock");
|
|
32
|
-
const { GlobalStylesContext, useGlobalSetting } = (0, import_lock_unlock.unlock)(
|
|
33
|
-
import_block_editor.privateApis
|
|
34
|
-
);
|
|
35
|
-
function useGlobalStylesOutputWithConfig(mergedConfig = {}, disableRootPadding = false) {
|
|
36
|
-
const [blockGap] = useGlobalSetting("spacing.blockGap");
|
|
37
|
-
const hasBlockGapSupport = blockGap !== null;
|
|
38
|
-
const hasFallbackGapSupport = !hasBlockGapSupport;
|
|
39
|
-
const { disableLayoutStyles, getBlockStyles } = (0, import_data.useSelect)((select) => {
|
|
40
|
-
const { getSettings } = select(import_store.store);
|
|
41
|
-
const { getBlockStyles: getBlockStylesSelector } = select(import_blocks.store);
|
|
42
|
-
return {
|
|
43
|
-
disableLayoutStyles: !!getSettings()?.disableLayoutStyles,
|
|
44
|
-
getBlockStyles: getBlockStylesSelector
|
|
45
|
-
};
|
|
46
|
-
}, []);
|
|
47
|
-
return (0, import_element.useMemo)(() => {
|
|
48
|
-
if (!mergedConfig?.styles || !mergedConfig?.settings) {
|
|
49
|
-
return [[], {}];
|
|
50
|
-
}
|
|
51
|
-
const blockTypes = (0, import_blocks.getBlockTypes)();
|
|
52
|
-
return (0, import_global_styles_engine.generateGlobalStyles)(mergedConfig, blockTypes, {
|
|
53
|
-
hasBlockGapSupport,
|
|
54
|
-
hasFallbackGapSupport,
|
|
55
|
-
disableLayoutStyles,
|
|
56
|
-
disableRootPadding,
|
|
57
|
-
getBlockStyles
|
|
58
|
-
});
|
|
59
|
-
}, [
|
|
60
|
-
hasBlockGapSupport,
|
|
61
|
-
hasFallbackGapSupport,
|
|
62
|
-
mergedConfig,
|
|
63
|
-
disableLayoutStyles,
|
|
64
|
-
disableRootPadding,
|
|
65
|
-
getBlockStyles
|
|
66
|
-
]);
|
|
67
|
-
}
|
|
68
|
-
function useGlobalStylesOutput(disableRootPadding = false) {
|
|
69
|
-
const { merged: mergedConfig } = (0, import_element.useContext)(GlobalStylesContext);
|
|
70
|
-
return useGlobalStylesOutputWithConfig(mergedConfig, disableRootPadding);
|
|
71
|
-
}
|
|
72
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
73
|
-
0 && (module.exports = {
|
|
74
|
-
useGlobalStylesOutput,
|
|
75
|
-
useGlobalStylesOutputWithConfig
|
|
76
|
-
});
|
|
77
|
-
//# sourceMappingURL=use-global-styles-output.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/hooks/use-global-styles-output.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { getBlockTypes, store as blocksStore } from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport { useContext, useMemo } from '@wordpress/element';\nimport { generateGlobalStyles } from '@wordpress/global-styles-engine';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../store';\nimport { unlock } from '../lock-unlock';\n\nconst { GlobalStylesContext, useGlobalSetting } = unlock(\n\tblockEditorPrivateApis\n);\n\n/**\n * Returns the global styles output based on the provided global styles config.\n *\n * @param {Object} mergedConfig The merged global styles config.\n * @param {boolean} disableRootPadding Disable root padding styles.\n *\n * @return {Array} Array of stylesheets and settings.\n */\nexport function useGlobalStylesOutputWithConfig(\n\tmergedConfig = {},\n\tdisableRootPadding = false\n) {\n\tconst [ blockGap ] = useGlobalSetting( 'spacing.blockGap' );\n\tconst hasBlockGapSupport = blockGap !== null;\n\tconst hasFallbackGapSupport = ! hasBlockGapSupport;\n\n\tconst { disableLayoutStyles, getBlockStyles } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( editSiteStore );\n\t\tconst { getBlockStyles: getBlockStylesSelector } =\n\t\t\tselect( blocksStore );\n\t\treturn {\n\t\t\tdisableLayoutStyles: !! getSettings()?.disableLayoutStyles,\n\t\t\tgetBlockStyles: getBlockStylesSelector,\n\t\t};\n\t}, [] );\n\n\treturn useMemo( () => {\n\t\tif ( ! mergedConfig?.styles || ! mergedConfig?.settings ) {\n\t\t\treturn [ [], {} ];\n\t\t}\n\n\t\tconst blockTypes = getBlockTypes();\n\n\t\treturn generateGlobalStyles( mergedConfig, blockTypes, {\n\t\t\thasBlockGapSupport,\n\t\t\thasFallbackGapSupport,\n\t\t\tdisableLayoutStyles,\n\t\t\tdisableRootPadding,\n\t\t\tgetBlockStyles,\n\t\t} );\n\t}, [\n\t\thasBlockGapSupport,\n\t\thasFallbackGapSupport,\n\t\tmergedConfig,\n\t\tdisableLayoutStyles,\n\t\tdisableRootPadding,\n\t\tgetBlockStyles,\n\t] );\n}\n\n/**\n * Returns the global styles output based on the current state of global styles config loaded in the editor context.\n *\n * @param {boolean} disableRootPadding Disable root padding styles.\n *\n * @return {Array} Array of stylesheets and settings.\n */\nexport function useGlobalStylesOutput( disableRootPadding = false ) {\n\tconst { merged: mergedConfig } = useContext( GlobalStylesContext );\n\treturn useGlobalStylesOutputWithConfig( mergedConfig, disableRootPadding );\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,oBAAoD;AACpD,kBAA0B;AAC1B,qBAAoC;AACpC,kCAAqC;AACrC,0BAAsD;AAKtD,mBAAuC;AACvC,yBAAuB;AAEvB,MAAM,EAAE,qBAAqB,iBAAiB,QAAI;AAAA,EACjD,oBAAAA;AACD;AAUO,SAAS,gCACf,eAAe,CAAC,GAChB,qBAAqB,OACpB;AACD,QAAM,CAAE,QAAS,IAAI,iBAAkB,kBAAmB;AAC1D,QAAM,qBAAqB,aAAa;AACxC,QAAM,wBAAwB,CAAE;AAEhC,QAAM,EAAE,qBAAqB,eAAe,QAAI,uBAAW,CAAE,WAAY;AACxE,UAAM,EAAE,YAAY,IAAI,OAAQ,aAAAC,KAAc;AAC9C,UAAM,EAAE,gBAAgB,uBAAuB,IAC9C,OAAQ,cAAAC,KAAY;AACrB,WAAO;AAAA,MACN,qBAAqB,CAAC,CAAE,YAAY,GAAG;AAAA,MACvC,gBAAgB;AAAA,IACjB;AAAA,EACD,GAAG,CAAC,CAAE;AAEN,aAAO,wBAAS,MAAM;AACrB,QAAK,CAAE,cAAc,UAAU,CAAE,cAAc,UAAW;AACzD,aAAO,CAAE,CAAC,GAAG,CAAC,CAAE;AAAA,IACjB;AAEA,UAAM,iBAAa,6BAAc;AAEjC,eAAO,kDAAsB,cAAc,YAAY;AAAA,MACtD;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACD,CAAE;AAAA,EACH,GAAG;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,CAAE;AACH;AASO,SAAS,sBAAuB,qBAAqB,OAAQ;AACnE,QAAM,EAAE,QAAQ,aAAa,QAAI,2BAAY,mBAAoB;AACjE,SAAO,gCAAiC,cAAc,kBAAmB;AAC1E;",
|
|
6
|
-
"names": ["blockEditorPrivateApis", "editSiteStore", "blocksStore"]
|
|
7
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { getBlockTypes, store as blocksStore } from "@wordpress/blocks";
|
|
2
|
-
import { useSelect } from "@wordpress/data";
|
|
3
|
-
import { useContext, useMemo } from "@wordpress/element";
|
|
4
|
-
import { generateGlobalStyles } from "@wordpress/global-styles-engine";
|
|
5
|
-
import { privateApis as blockEditorPrivateApis } from "@wordpress/block-editor";
|
|
6
|
-
import { store as editSiteStore } from "../store";
|
|
7
|
-
import { unlock } from "../lock-unlock";
|
|
8
|
-
const { GlobalStylesContext, useGlobalSetting } = unlock(
|
|
9
|
-
blockEditorPrivateApis
|
|
10
|
-
);
|
|
11
|
-
function useGlobalStylesOutputWithConfig(mergedConfig = {}, disableRootPadding = false) {
|
|
12
|
-
const [blockGap] = useGlobalSetting("spacing.blockGap");
|
|
13
|
-
const hasBlockGapSupport = blockGap !== null;
|
|
14
|
-
const hasFallbackGapSupport = !hasBlockGapSupport;
|
|
15
|
-
const { disableLayoutStyles, getBlockStyles } = useSelect((select) => {
|
|
16
|
-
const { getSettings } = select(editSiteStore);
|
|
17
|
-
const { getBlockStyles: getBlockStylesSelector } = select(blocksStore);
|
|
18
|
-
return {
|
|
19
|
-
disableLayoutStyles: !!getSettings()?.disableLayoutStyles,
|
|
20
|
-
getBlockStyles: getBlockStylesSelector
|
|
21
|
-
};
|
|
22
|
-
}, []);
|
|
23
|
-
return useMemo(() => {
|
|
24
|
-
if (!mergedConfig?.styles || !mergedConfig?.settings) {
|
|
25
|
-
return [[], {}];
|
|
26
|
-
}
|
|
27
|
-
const blockTypes = getBlockTypes();
|
|
28
|
-
return generateGlobalStyles(mergedConfig, blockTypes, {
|
|
29
|
-
hasBlockGapSupport,
|
|
30
|
-
hasFallbackGapSupport,
|
|
31
|
-
disableLayoutStyles,
|
|
32
|
-
disableRootPadding,
|
|
33
|
-
getBlockStyles
|
|
34
|
-
});
|
|
35
|
-
}, [
|
|
36
|
-
hasBlockGapSupport,
|
|
37
|
-
hasFallbackGapSupport,
|
|
38
|
-
mergedConfig,
|
|
39
|
-
disableLayoutStyles,
|
|
40
|
-
disableRootPadding,
|
|
41
|
-
getBlockStyles
|
|
42
|
-
]);
|
|
43
|
-
}
|
|
44
|
-
function useGlobalStylesOutput(disableRootPadding = false) {
|
|
45
|
-
const { merged: mergedConfig } = useContext(GlobalStylesContext);
|
|
46
|
-
return useGlobalStylesOutputWithConfig(mergedConfig, disableRootPadding);
|
|
47
|
-
}
|
|
48
|
-
export {
|
|
49
|
-
useGlobalStylesOutput,
|
|
50
|
-
useGlobalStylesOutputWithConfig
|
|
51
|
-
};
|
|
52
|
-
//# sourceMappingURL=use-global-styles-output.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/hooks/use-global-styles-output.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { getBlockTypes, store as blocksStore } from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport { useContext, useMemo } from '@wordpress/element';\nimport { generateGlobalStyles } from '@wordpress/global-styles-engine';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../store';\nimport { unlock } from '../lock-unlock';\n\nconst { GlobalStylesContext, useGlobalSetting } = unlock(\n\tblockEditorPrivateApis\n);\n\n/**\n * Returns the global styles output based on the provided global styles config.\n *\n * @param {Object} mergedConfig The merged global styles config.\n * @param {boolean} disableRootPadding Disable root padding styles.\n *\n * @return {Array} Array of stylesheets and settings.\n */\nexport function useGlobalStylesOutputWithConfig(\n\tmergedConfig = {},\n\tdisableRootPadding = false\n) {\n\tconst [ blockGap ] = useGlobalSetting( 'spacing.blockGap' );\n\tconst hasBlockGapSupport = blockGap !== null;\n\tconst hasFallbackGapSupport = ! hasBlockGapSupport;\n\n\tconst { disableLayoutStyles, getBlockStyles } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( editSiteStore );\n\t\tconst { getBlockStyles: getBlockStylesSelector } =\n\t\t\tselect( blocksStore );\n\t\treturn {\n\t\t\tdisableLayoutStyles: !! getSettings()?.disableLayoutStyles,\n\t\t\tgetBlockStyles: getBlockStylesSelector,\n\t\t};\n\t}, [] );\n\n\treturn useMemo( () => {\n\t\tif ( ! mergedConfig?.styles || ! mergedConfig?.settings ) {\n\t\t\treturn [ [], {} ];\n\t\t}\n\n\t\tconst blockTypes = getBlockTypes();\n\n\t\treturn generateGlobalStyles( mergedConfig, blockTypes, {\n\t\t\thasBlockGapSupport,\n\t\t\thasFallbackGapSupport,\n\t\t\tdisableLayoutStyles,\n\t\t\tdisableRootPadding,\n\t\t\tgetBlockStyles,\n\t\t} );\n\t}, [\n\t\thasBlockGapSupport,\n\t\thasFallbackGapSupport,\n\t\tmergedConfig,\n\t\tdisableLayoutStyles,\n\t\tdisableRootPadding,\n\t\tgetBlockStyles,\n\t] );\n}\n\n/**\n * Returns the global styles output based on the current state of global styles config loaded in the editor context.\n *\n * @param {boolean} disableRootPadding Disable root padding styles.\n *\n * @return {Array} Array of stylesheets and settings.\n */\nexport function useGlobalStylesOutput( disableRootPadding = false ) {\n\tconst { merged: mergedConfig } = useContext( GlobalStylesContext );\n\treturn useGlobalStylesOutputWithConfig( mergedConfig, disableRootPadding );\n}\n"],
|
|
5
|
-
"mappings": "AAGA,SAAS,eAAe,SAAS,mBAAmB;AACpD,SAAS,iBAAiB;AAC1B,SAAS,YAAY,eAAe;AACpC,SAAS,4BAA4B;AACrC,SAAS,eAAe,8BAA8B;AAKtD,SAAS,SAAS,qBAAqB;AACvC,SAAS,cAAc;AAEvB,MAAM,EAAE,qBAAqB,iBAAiB,IAAI;AAAA,EACjD;AACD;AAUO,SAAS,gCACf,eAAe,CAAC,GAChB,qBAAqB,OACpB;AACD,QAAM,CAAE,QAAS,IAAI,iBAAkB,kBAAmB;AAC1D,QAAM,qBAAqB,aAAa;AACxC,QAAM,wBAAwB,CAAE;AAEhC,QAAM,EAAE,qBAAqB,eAAe,IAAI,UAAW,CAAE,WAAY;AACxE,UAAM,EAAE,YAAY,IAAI,OAAQ,aAAc;AAC9C,UAAM,EAAE,gBAAgB,uBAAuB,IAC9C,OAAQ,WAAY;AACrB,WAAO;AAAA,MACN,qBAAqB,CAAC,CAAE,YAAY,GAAG;AAAA,MACvC,gBAAgB;AAAA,IACjB;AAAA,EACD,GAAG,CAAC,CAAE;AAEN,SAAO,QAAS,MAAM;AACrB,QAAK,CAAE,cAAc,UAAU,CAAE,cAAc,UAAW;AACzD,aAAO,CAAE,CAAC,GAAG,CAAC,CAAE;AAAA,IACjB;AAEA,UAAM,aAAa,cAAc;AAEjC,WAAO,qBAAsB,cAAc,YAAY;AAAA,MACtD;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACD,CAAE;AAAA,EACH,GAAG;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,CAAE;AACH;AASO,SAAS,sBAAuB,qBAAqB,OAAQ;AACnE,QAAM,EAAE,QAAQ,aAAa,IAAI,WAAY,mBAAoB;AACjE,SAAO,gCAAiC,cAAc,kBAAmB;AAC1E;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { getBlockTypes, store as blocksStore } from '@wordpress/blocks';
|
|
5
|
-
import { useSelect } from '@wordpress/data';
|
|
6
|
-
import { useContext, useMemo } from '@wordpress/element';
|
|
7
|
-
import { generateGlobalStyles } from '@wordpress/global-styles-engine';
|
|
8
|
-
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Internal dependencies
|
|
12
|
-
*/
|
|
13
|
-
import { store as editSiteStore } from '../store';
|
|
14
|
-
import { unlock } from '../lock-unlock';
|
|
15
|
-
|
|
16
|
-
const { GlobalStylesContext, useGlobalSetting } = unlock(
|
|
17
|
-
blockEditorPrivateApis
|
|
18
|
-
);
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Returns the global styles output based on the provided global styles config.
|
|
22
|
-
*
|
|
23
|
-
* @param {Object} mergedConfig The merged global styles config.
|
|
24
|
-
* @param {boolean} disableRootPadding Disable root padding styles.
|
|
25
|
-
*
|
|
26
|
-
* @return {Array} Array of stylesheets and settings.
|
|
27
|
-
*/
|
|
28
|
-
export function useGlobalStylesOutputWithConfig(
|
|
29
|
-
mergedConfig = {},
|
|
30
|
-
disableRootPadding = false
|
|
31
|
-
) {
|
|
32
|
-
const [ blockGap ] = useGlobalSetting( 'spacing.blockGap' );
|
|
33
|
-
const hasBlockGapSupport = blockGap !== null;
|
|
34
|
-
const hasFallbackGapSupport = ! hasBlockGapSupport;
|
|
35
|
-
|
|
36
|
-
const { disableLayoutStyles, getBlockStyles } = useSelect( ( select ) => {
|
|
37
|
-
const { getSettings } = select( editSiteStore );
|
|
38
|
-
const { getBlockStyles: getBlockStylesSelector } =
|
|
39
|
-
select( blocksStore );
|
|
40
|
-
return {
|
|
41
|
-
disableLayoutStyles: !! getSettings()?.disableLayoutStyles,
|
|
42
|
-
getBlockStyles: getBlockStylesSelector,
|
|
43
|
-
};
|
|
44
|
-
}, [] );
|
|
45
|
-
|
|
46
|
-
return useMemo( () => {
|
|
47
|
-
if ( ! mergedConfig?.styles || ! mergedConfig?.settings ) {
|
|
48
|
-
return [ [], {} ];
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const blockTypes = getBlockTypes();
|
|
52
|
-
|
|
53
|
-
return generateGlobalStyles( mergedConfig, blockTypes, {
|
|
54
|
-
hasBlockGapSupport,
|
|
55
|
-
hasFallbackGapSupport,
|
|
56
|
-
disableLayoutStyles,
|
|
57
|
-
disableRootPadding,
|
|
58
|
-
getBlockStyles,
|
|
59
|
-
} );
|
|
60
|
-
}, [
|
|
61
|
-
hasBlockGapSupport,
|
|
62
|
-
hasFallbackGapSupport,
|
|
63
|
-
mergedConfig,
|
|
64
|
-
disableLayoutStyles,
|
|
65
|
-
disableRootPadding,
|
|
66
|
-
getBlockStyles,
|
|
67
|
-
] );
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Returns the global styles output based on the current state of global styles config loaded in the editor context.
|
|
72
|
-
*
|
|
73
|
-
* @param {boolean} disableRootPadding Disable root padding styles.
|
|
74
|
-
*
|
|
75
|
-
* @return {Array} Array of stylesheets and settings.
|
|
76
|
-
*/
|
|
77
|
-
export function useGlobalStylesOutput( disableRootPadding = false ) {
|
|
78
|
-
const { merged: mergedConfig } = useContext( GlobalStylesContext );
|
|
79
|
-
return useGlobalStylesOutputWithConfig( mergedConfig, disableRootPadding );
|
|
80
|
-
}
|