@wordpress/edit-site 4.2.0 → 4.3.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/index.js +53 -4
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/global-styles/color-indicator-wrapper.js +37 -0
- package/build/components/global-styles/color-indicator-wrapper.js.map +1 -0
- package/build/components/global-styles/dimensions-panel.js +32 -1
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/header.js +1 -4
- package/build/components/global-styles/header.js.map +1 -1
- package/build/components/global-styles/icon-with-current-color.js +34 -0
- package/build/components/global-styles/icon-with-current-color.js.map +1 -0
- package/build/components/global-styles/navigation-button.js +7 -3
- package/build/components/global-styles/navigation-button.js.map +1 -1
- package/build/components/global-styles/palette.js +8 -5
- package/build/components/global-styles/palette.js.map +1 -1
- package/build/components/global-styles/preview.js +142 -26
- package/build/components/global-styles/preview.js.map +1 -1
- package/build/components/global-styles/screen-block-list.js +2 -2
- package/build/components/global-styles/screen-block-list.js.map +1 -1
- package/build/components/global-styles/screen-colors.js +11 -3
- package/build/components/global-styles/screen-colors.js.map +1 -1
- package/build/components/global-styles/screen-root.js +7 -5
- package/build/components/global-styles/screen-root.js.map +1 -1
- package/build/components/global-styles/screen-style-variations.js +12 -5
- package/build/components/global-styles/screen-style-variations.js.map +1 -1
- package/build/components/sidebar/index.js +12 -1
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar/navigation-menu-sidebar/index.js +40 -0
- package/build/components/sidebar/navigation-menu-sidebar/index.js.map +1 -0
- package/build/components/sidebar/navigation-menu-sidebar/navigation-inspector.js +185 -0
- package/build/components/sidebar/navigation-menu-sidebar/navigation-inspector.js.map +1 -0
- package/build/components/sidebar/navigation-menu-sidebar/navigation-menu.js +54 -0
- package/build/components/sidebar/navigation-menu-sidebar/navigation-menu.js.map +1 -0
- package/build/components/template-part-converter/convert-to-regular.js +6 -0
- package/build/components/template-part-converter/convert-to-regular.js.map +1 -1
- package/build-module/components/block-editor/index.js +51 -6
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/global-styles/color-indicator-wrapper.js +25 -0
- package/build-module/components/global-styles/color-indicator-wrapper.js.map +1 -0
- package/build-module/components/global-styles/dimensions-panel.js +33 -2
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/header.js +2 -5
- package/build-module/components/global-styles/header.js.map +1 -1
- package/build-module/components/global-styles/icon-with-current-color.js +22 -0
- package/build-module/components/global-styles/icon-with-current-color.js.map +1 -0
- package/build-module/components/global-styles/navigation-button.js +7 -3
- package/build-module/components/global-styles/navigation-button.js.map +1 -1
- package/build-module/components/global-styles/palette.js +8 -6
- package/build-module/components/global-styles/palette.js.map +1 -1
- package/build-module/components/global-styles/preview.js +141 -27
- package/build-module/components/global-styles/preview.js.map +1 -1
- package/build-module/components/global-styles/screen-block-list.js +2 -2
- package/build-module/components/global-styles/screen-block-list.js.map +1 -1
- package/build-module/components/global-styles/screen-colors.js +10 -3
- package/build-module/components/global-styles/screen-colors.js.map +1 -1
- package/build-module/components/global-styles/screen-root.js +8 -7
- package/build-module/components/global-styles/screen-root.js.map +1 -1
- package/build-module/components/global-styles/screen-style-variations.js +13 -6
- package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
- package/build-module/components/sidebar/index.js +11 -1
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar/navigation-menu-sidebar/index.js +26 -0
- package/build-module/components/sidebar/navigation-menu-sidebar/index.js.map +1 -0
- package/build-module/components/sidebar/navigation-menu-sidebar/navigation-inspector.js +168 -0
- package/build-module/components/sidebar/navigation-menu-sidebar/navigation-inspector.js.map +1 -0
- package/build-module/components/sidebar/navigation-menu-sidebar/navigation-menu.js +45 -0
- package/build-module/components/sidebar/navigation-menu-sidebar/navigation-menu.js.map +1 -0
- package/build-module/components/template-part-converter/convert-to-regular.js +6 -0
- package/build-module/components/template-part-converter/convert-to-regular.js.map +1 -1
- package/build-style/style-rtl.css +51 -4
- package/build-style/style.css +51 -4
- package/package.json +29 -29
- package/src/components/block-editor/index.js +79 -9
- package/src/components/global-styles/color-indicator-wrapper.js +23 -0
- package/src/components/global-styles/dimensions-panel.js +39 -1
- package/src/components/global-styles/header.js +2 -7
- package/src/components/global-styles/icon-with-current-color.js +21 -0
- package/src/components/global-styles/navigation-button.js +6 -4
- package/src/components/global-styles/palette.js +8 -11
- package/src/components/global-styles/preview.js +186 -29
- package/src/components/global-styles/screen-block-list.js +1 -3
- package/src/components/global-styles/screen-colors.js +7 -6
- package/src/components/global-styles/screen-root.js +15 -17
- package/src/components/global-styles/screen-style-variations.js +13 -4
- package/src/components/global-styles/style.scss +18 -6
- package/src/components/sidebar/index.js +12 -0
- package/src/components/sidebar/navigation-menu-sidebar/index.js +34 -0
- package/src/components/sidebar/navigation-menu-sidebar/navigation-inspector.js +224 -0
- package/src/components/sidebar/navigation-menu-sidebar/navigation-menu.js +62 -0
- package/src/components/sidebar/navigation-menu-sidebar/style.scss +42 -0
- package/src/components/sidebar/style.scss +1 -1
- package/src/components/template-part-converter/convert-to-regular.js +9 -0
- package/src/style.scss +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -23,6 +23,14 @@ var _compose = require("@wordpress/compose");
|
|
|
23
23
|
|
|
24
24
|
var _reusableBlocks = require("@wordpress/reusable-blocks");
|
|
25
25
|
|
|
26
|
+
var _icons = require("@wordpress/icons");
|
|
27
|
+
|
|
28
|
+
var _components = require("@wordpress/components");
|
|
29
|
+
|
|
30
|
+
var _i18n = require("@wordpress/i18n");
|
|
31
|
+
|
|
32
|
+
var _interface = require("@wordpress/interface");
|
|
33
|
+
|
|
26
34
|
var _templatePartConverter = _interopRequireDefault(require("../template-part-converter"));
|
|
27
35
|
|
|
28
36
|
var _navigateToLink = _interopRequireDefault(require("../navigate-to-link"));
|
|
@@ -61,19 +69,37 @@ function BlockEditor(_ref) {
|
|
|
61
69
|
setIsInserterOpen
|
|
62
70
|
} = _ref;
|
|
63
71
|
const {
|
|
64
|
-
settings
|
|
72
|
+
settings
|
|
73
|
+
} = (0, _data.useSelect)(select => {
|
|
74
|
+
let storedSettings = select(_store.store).getSettings(setIsInserterOpen);
|
|
75
|
+
|
|
76
|
+
if (!storedSettings.__experimentalBlockPatterns) {
|
|
77
|
+
storedSettings = { ...storedSettings,
|
|
78
|
+
__experimentalBlockPatterns: select(_coreData.store).getBlockPatterns()
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (!storedSettings.__experimentalBlockPatternCategories) {
|
|
83
|
+
storedSettings = { ...storedSettings,
|
|
84
|
+
__experimentalBlockPatternCategories: select(_coreData.store).getBlockPatternCategories()
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return {
|
|
89
|
+
settings: storedSettings
|
|
90
|
+
};
|
|
91
|
+
}, [setIsInserterOpen]);
|
|
92
|
+
const {
|
|
65
93
|
templateType,
|
|
66
94
|
templateId,
|
|
67
95
|
page
|
|
68
96
|
} = (0, _data.useSelect)(select => {
|
|
69
97
|
const {
|
|
70
|
-
getSettings,
|
|
71
98
|
getEditedPostType,
|
|
72
99
|
getEditedPostId,
|
|
73
100
|
getPage
|
|
74
101
|
} = select(_store.store);
|
|
75
102
|
return {
|
|
76
|
-
settings: getSettings(setIsInserterOpen),
|
|
77
103
|
templateType: getEditedPostType(),
|
|
78
104
|
templateId: getEditedPostId(),
|
|
79
105
|
page: getPage()
|
|
@@ -83,6 +109,12 @@ function BlockEditor(_ref) {
|
|
|
83
109
|
const {
|
|
84
110
|
setPage
|
|
85
111
|
} = (0, _data.useDispatch)(_store.store);
|
|
112
|
+
const {
|
|
113
|
+
enableComplementaryArea
|
|
114
|
+
} = (0, _data.useDispatch)(_interface.store);
|
|
115
|
+
const openNavigationSidebar = (0, _element.useCallback)(() => {
|
|
116
|
+
enableComplementaryArea('core/edit-site', 'edit-site/navigation-menu');
|
|
117
|
+
}, [enableComplementaryArea]);
|
|
86
118
|
const contentRef = (0, _element.useRef)();
|
|
87
119
|
const mergedRefs = (0, _compose.useMergeRefs)([contentRef, (0, _blockEditor.__unstableUseTypingObserver)()]);
|
|
88
120
|
const isMobileViewport = (0, _compose.useViewportMatch)('small', '<');
|
|
@@ -90,6 +122,23 @@ function BlockEditor(_ref) {
|
|
|
90
122
|
clearSelectedBlock
|
|
91
123
|
} = (0, _data.useDispatch)(_blockEditor.store);
|
|
92
124
|
const isTemplatePart = templateType === 'wp_template_part';
|
|
125
|
+
|
|
126
|
+
const NavMenuSidebarToggle = () => (0, _element.createElement)(_components.ToolbarGroup, null, (0, _element.createElement)(_components.ToolbarButton, {
|
|
127
|
+
className: "components-toolbar__control",
|
|
128
|
+
label: (0, _i18n.__)('Open list view'),
|
|
129
|
+
onClick: openNavigationSidebar,
|
|
130
|
+
icon: _icons.listView
|
|
131
|
+
})); // Conditionally include NavMenu sidebar in Plugin only.
|
|
132
|
+
// Optimise for dead code elimination.
|
|
133
|
+
// See https://github.com/WordPress/gutenberg/blob/trunk/docs/how-to-guides/feature-flags.md#dead-code-elimination.
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
let MaybeNavMenuSidebarToggle = 'Fragment';
|
|
137
|
+
|
|
138
|
+
if (process.env.IS_GUTENBERG_PLUGIN) {
|
|
139
|
+
MaybeNavMenuSidebarToggle = NavMenuSidebarToggle;
|
|
140
|
+
}
|
|
141
|
+
|
|
93
142
|
return (0, _element.createElement)(_blockEditor.BlockEditorProvider, {
|
|
94
143
|
settings: settings,
|
|
95
144
|
value: blocks,
|
|
@@ -128,6 +177,6 @@ function BlockEditor(_ref) {
|
|
|
128
177
|
return (0, _element.createElement)(_blockInspectorButton.default, {
|
|
129
178
|
onClick: onClose
|
|
130
179
|
});
|
|
131
|
-
})), (0, _element.createElement)(_reusableBlocks.ReusableBlocksMenuItems, null));
|
|
180
|
+
}), (0, _element.createElement)(_blockEditor.__unstableBlockToolbarLastItem, null, (0, _element.createElement)(_blockEditor.__unstableBlockNameContext.Consumer, null, blockName => blockName === 'core/navigation' && (0, _element.createElement)(MaybeNavMenuSidebarToggle, null)))), (0, _element.createElement)(_reusableBlocks.ReusableBlocksMenuItems, null));
|
|
132
181
|
}
|
|
133
182
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/index.js"],"names":["LAYOUT","type","alignments","BlockEditor","setIsInserterOpen","settings","templateType","templateId","page","select","getSettings","getEditedPostType","getEditedPostId","getPage","editSiteStore","blocks","onInput","onChange","setPage","contentRef","mergedRefs","isMobileViewport","clearSelectedBlock","blockEditorStore","isTemplatePart","fillProps","event","target","currentTarget","undefined","onClose"],"mappings":";;;;;;;;;AASA;;;;AANA;;AAKA;;AAEA;;AACA;;AAWA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAnCA;AACA;AACA;;AAGA;AACA;AACA;;AAkBA;AACA;AACA;AAUA,MAAMA,MAAM,GAAG;AACdC,EAAAA,IAAI,EAAE,SADQ;AAEd;AACAC,EAAAA,UAAU,EAAE;AAHE,CAAf;;AAMe,SAASC,WAAT,OAA8C;AAAA,MAAxB;AAAEC,IAAAA;AAAF,GAAwB;AAC5D,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,YAAZ;AAA0BC,IAAAA,UAA1B;AAAsCC,IAAAA;AAAtC,MAA+C,qBAClDC,MAAF,IAAc;AACb,UAAM;AACLC,MAAAA,WADK;AAELC,MAAAA,iBAFK;AAGLC,MAAAA,eAHK;AAILC,MAAAA;AAJK,QAKFJ,MAAM,CAAEK,YAAF,CALV;AAOA,WAAO;AACNT,MAAAA,QAAQ,EAAEK,WAAW,CAAEN,iBAAF,CADf;AAENE,MAAAA,YAAY,EAAEK,iBAAiB,EAFzB;AAGNJ,MAAAA,UAAU,EAAEK,eAAe,EAHrB;AAINJ,MAAAA,I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C;AAC3CN,QAAAA,kBAAkB;AAClB;AACD;AAVF,KAYC,4BAAC,yCAAD,CAA8B,QAA9B,OAZD,EAaC,4BAAC,mBAAD,OAbD,EAcC,4BAAC,wBAAD,CACC;AADD;AAEC,IAAA,GAAG,EAAGf,UAFP;AAGC,IAAA,cAAc,EACbiB,cAAc,IACd;AACA,KAAEH,gBANJ;AAQC,IAAA,QAAQ,EAAGhB,QARZ;AASC,IAAA,UAAU,EAAGe;AATd,KAWC,4BAAC,sBAAD;AACC,IAAA,SAAS,EAAC,mDADX;AAEC,IAAA,oBAAoB,EAAGpB,MAFxB;AAGC,IAAA,cAAc,EAAGwB,cAAc,GAAG,KAAH,GAAWK;AAH3C,IAXD,CAdD,EA+BC,4BAAC,iDAAD,QACG;AAAA,QAAE;AAAEC,MAAAA;AAAF,KAAF;AAAA,WACD,4BAAC,6BAAD;AAAsB,MAAA,OAAO,EAAGA;AAAhC,MADC;AAAA,GADH,CA/BD,CAxBD,EA6DC,4BAAC,uCAAD,OA7DD,CADD;AAiEA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useCallback, useRef } from '@wordpress/element';\nimport { useEntityBlockEditor } from '@wordpress/core-data';\nimport {\n\tBlockList,\n\tBlockEditorProvider,\n\t__experimentalLinkControl,\n\tBlockInspector,\n\tBlockTools,\n\t__unstableBlockSettingsMenuFirstItem,\n\t__unstableUseTypingObserver as useTypingObserver,\n\tBlockEditorKeyboardShortcuts,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useMergeRefs, useViewportMatch } from '@wordpress/compose';\nimport { ReusableBlocksMenuItems } from '@wordpress/reusable-blocks';\n\n/**\n * Internal dependencies\n */\nimport TemplatePartConverter from '../template-part-converter';\nimport NavigateToLink from '../navigate-to-link';\nimport { SidebarInspectorFill } from '../sidebar';\nimport { store as editSiteStore } from '../../store';\nimport BlockInspectorButton from './block-inspector-button';\nimport EditTemplatePartMenuButton from '../edit-template-part-menu-button';\nimport BackButton from './back-button';\nimport ResizableEditor from './resizable-editor';\n\nconst LAYOUT = {\n\ttype: 'default',\n\t// At the root level of the site editor, no alignments should be allowed.\n\talignments: [],\n};\n\nexport default function BlockEditor( { setIsInserterOpen } ) {\n\tconst { settings, templateType, templateId, page } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetSettings,\n\t\t\t\tgetEditedPostType,\n\t\t\t\tgetEditedPostId,\n\t\t\t\tgetPage,\n\t\t\t} = select( editSiteStore );\n\n\t\t\treturn {\n\t\t\t\tsettings: getSettings( setIsInserterOpen ),\n\t\t\t\ttemplateType: getEditedPostType(),\n\t\t\t\ttemplateId: getEditedPostId(),\n\t\t\t\tpage: getPage(),\n\t\t\t};\n\t\t},\n\t\t[ setIsInserterOpen ]\n\t);\n\tconst [ blocks, onInput, onChange ] = useEntityBlockEditor(\n\t\t'postType',\n\t\ttemplateType\n\t);\n\tconst { setPage } = useDispatch( editSiteStore );\n\tconst contentRef = useRef();\n\tconst mergedRefs = useMergeRefs( [ contentRef, useTypingObserver() ] );\n\tconst isMobileViewport = useViewportMatch( 'small', '<' );\n\tconst { clearSelectedBlock } = useDispatch( blockEditorStore );\n\n\tconst isTemplatePart = templateType === 'wp_template_part';\n\n\treturn (\n\t\t<BlockEditorProvider\n\t\t\tsettings={ settings }\n\t\t\tvalue={ blocks }\n\t\t\tonInput={ onInput }\n\t\t\tonChange={ onChange }\n\t\t\tuseSubRegistry={ false }\n\t\t>\n\t\t\t<EditTemplatePartMenuButton />\n\t\t\t<TemplatePartConverter />\n\t\t\t<__experimentalLinkControl.ViewerFill>\n\t\t\t\t{ useCallback(\n\t\t\t\t\t( fillProps ) => (\n\t\t\t\t\t\t<NavigateToLink\n\t\t\t\t\t\t\t{ ...fillProps }\n\t\t\t\t\t\t\tactivePage={ page }\n\t\t\t\t\t\t\tonActivePageChange={ setPage }\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\t[ page ]\n\t\t\t\t) }\n\t\t\t</__experimentalLinkControl.ViewerFill>\n\t\t\t<SidebarInspectorFill>\n\t\t\t\t<BlockInspector />\n\t\t\t</SidebarInspectorFill>\n\t\t\t<BlockTools\n\t\t\t\tclassName={ classnames( 'edit-site-visual-editor', {\n\t\t\t\t\t'is-focus-mode': isTemplatePart,\n\t\t\t\t} ) }\n\t\t\t\t__unstableContentRef={ contentRef }\n\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t// Clear selected block when clicking on the gray background.\n\t\t\t\t\tif ( event.target === event.currentTarget ) {\n\t\t\t\t\t\tclearSelectedBlock();\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<BlockEditorKeyboardShortcuts.Register />\n\t\t\t\t<BackButton />\n\t\t\t\t<ResizableEditor\n\t\t\t\t\t// Reinitialize the editor and reset the states when the template changes.\n\t\t\t\t\tkey={ templateId }\n\t\t\t\t\tenableResizing={\n\t\t\t\t\t\tisTemplatePart &&\n\t\t\t\t\t\t// Disable resizing in mobile viewport.\n\t\t\t\t\t\t! isMobileViewport\n\t\t\t\t\t}\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tcontentRef={ mergedRefs }\n\t\t\t\t>\n\t\t\t\t\t<BlockList\n\t\t\t\t\t\tclassName=\"edit-site-block-editor__block-list wp-site-blocks\"\n\t\t\t\t\t\t__experimentalLayout={ LAYOUT }\n\t\t\t\t\t\trenderAppender={ isTemplatePart ? false : undefined }\n\t\t\t\t\t/>\n\t\t\t\t</ResizableEditor>\n\t\t\t\t<__unstableBlockSettingsMenuFirstItem>\n\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t<BlockInspectorButton onClick={ onClose } />\n\t\t\t\t\t) }\n\t\t\t\t</__unstableBlockSettingsMenuFirstItem>\n\t\t\t</BlockTools>\n\t\t\t<ReusableBlocksMenuItems />\n\t\t</BlockEditorProvider>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/index.js"],"names":["LAYOUT","type","alignments","BlockEditor","setIsInserterOpen","settings","select","storedSettings","editSiteStore","getSettings","__experimentalBlockPatterns","coreStore","getBlockPatterns","__experimentalBlockPatternCategories","getBlockPatternCategories","templateType","templateId","page","getEditedPostType","getEditedPostId","getPage","blocks","onInput","onChange","setPage","enableComplementaryArea","interfaceStore","openNavigationSidebar","contentRef","mergedRefs","isMobileViewport","clearSelectedBlock","blockEditorStore","isTemplatePart","NavMenuSidebarToggle","listView","MaybeNavMenuSidebarToggle","process","env","IS_GUTENBERG_PLUGIN","fillProps","event","target","currentTarget","undefined","onClose","blockName"],"mappings":";;;;;;;;;AASA;;;;AANA;;AAKA;;AAEA;;AACA;;AAaA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAzCA;AACA;AACA;;AAGA;AACA;AACA;;AAwBA;AACA;AACA;AAUA,MAAMA,MAAM,GAAG;AACdC,EAAAA,IAAI,EAAE,SADQ;AAEd;AACAC,EAAAA,UAAU,EAAE;AAHE,CAAf;;AAMe,SAASC,WAAT,OAA8C;AAAA,MAAxB;AAAEC,IAAAA;AAAF,GAAwB;AAC5D,QAAM;AAAEC,IAAAA;AAAF,MAAe,qBAClBC,MAAF,IAAc;AACb,QAAIC,cAAc,GAAGD,MAAM,CAAEE,YAAF,CAAN,CAAwBC,WAAxB,CACpBL,iBADoB,CAArB;;AAIA,QAAK,CAAEG,cAAc,CAACG,2BAAtB,EAAoD;AACnDH,MAAAA,cAAc,GAAG,EAChB,GAAGA,cADa;AAEhBG,QAAAA,2BAA2B,EAAEJ,MAAM,CAClCK,eADkC,CAAN,CAE3BC,gBAF2B;AAFb,OAAjB;AAMA;;AAED,QAAK,CAAEL,cAAc,CAACM,oCAAtB,EAA6D;AAC5DN,MAAAA,cAAc,GAAG,EAChB,GAAGA,cADa;AAEhBM,QAAAA,oCAAo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,CACC;AADD;AAEC,IAAA,GAAG,EAAGf,UAFP;AAGC,IAAA,cAAc,EACbiB,cAAc,IACd;AACA,KAAEH,gBANJ;AAQC,IAAA,QAAQ,EAAGzB,QARZ;AASC,IAAA,UAAU,EAAGwB;AATd,KAWC,4BAAC,sBAAD;AACC,IAAA,SAAS,EAAC,mDADX;AAEC,IAAA,oBAAoB,EAAG7B,MAFxB;AAGC,IAAA,cAAc,EAAGiC,cAAc,GAAG,KAAH,GAAWW;AAH3C,IAXD,CAdD,EA+BC,4BAAC,iDAAD,QACG;AAAA,QAAE;AAAEC,MAAAA;AAAF,KAAF;AAAA,WACD,4BAAC,6BAAD;AAAsB,MAAA,OAAO,EAAGA;AAAhC,MADC;AAAA,GADH,CA/BD,EAoCC,4BAAC,2CAAD,QACC,4BAAC,uCAAD,CAA4B,QAA5B,QACKC,SAAF,IACDA,SAAS,KAAK,iBAAd,IACC,4BAAC,yBAAD,OAHH,CADD,CApCD,CAxBD,EAsEC,4BAAC,uCAAD,OAtED,CADD;AA0EA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useCallback, useRef } from '@wordpress/element';\nimport { useEntityBlockEditor, store as coreStore } from '@wordpress/core-data';\nimport {\n\tBlockList,\n\tBlockEditorProvider,\n\t__experimentalLinkControl,\n\tBlockInspector,\n\tBlockTools,\n\t__unstableBlockToolbarLastItem,\n\t__unstableBlockSettingsMenuFirstItem,\n\t__unstableUseTypingObserver as useTypingObserver,\n\tBlockEditorKeyboardShortcuts,\n\tstore as blockEditorStore,\n\t__unstableBlockNameContext,\n} from '@wordpress/block-editor';\nimport { useMergeRefs, useViewportMatch } from '@wordpress/compose';\nimport { ReusableBlocksMenuItems } from '@wordpress/reusable-blocks';\nimport { listView } from '@wordpress/icons';\nimport { ToolbarButton, ToolbarGroup } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport TemplatePartConverter from '../template-part-converter';\nimport NavigateToLink from '../navigate-to-link';\nimport { SidebarInspectorFill } from '../sidebar';\nimport { store as editSiteStore } from '../../store';\nimport BlockInspectorButton from './block-inspector-button';\nimport EditTemplatePartMenuButton from '../edit-template-part-menu-button';\nimport BackButton from './back-button';\nimport ResizableEditor from './resizable-editor';\n\nconst LAYOUT = {\n\ttype: 'default',\n\t// At the root level of the site editor, no alignments should be allowed.\n\talignments: [],\n};\n\nexport default function BlockEditor( { setIsInserterOpen } ) {\n\tconst { settings } = useSelect(\n\t\t( select ) => {\n\t\t\tlet storedSettings = select( editSiteStore ).getSettings(\n\t\t\t\tsetIsInserterOpen\n\t\t\t);\n\n\t\t\tif ( ! storedSettings.__experimentalBlockPatterns ) {\n\t\t\t\tstoredSettings = {\n\t\t\t\t\t...storedSettings,\n\t\t\t\t\t__experimentalBlockPatterns: select(\n\t\t\t\t\t\tcoreStore\n\t\t\t\t\t).getBlockPatterns(),\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tif ( ! storedSettings.__experimentalBlockPatternCategories ) {\n\t\t\t\tstoredSettings = {\n\t\t\t\t\t...storedSettings,\n\t\t\t\t\t__experimentalBlockPatternCategories: select(\n\t\t\t\t\t\tcoreStore\n\t\t\t\t\t).getBlockPatternCategories(),\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tsettings: storedSettings,\n\t\t\t};\n\t\t},\n\t\t[ setIsInserterOpen ]\n\t);\n\n\tconst { templateType, templateId, page } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedPostType, getEditedPostId, getPage } = select(\n\t\t\t\teditSiteStore\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\ttemplateType: getEditedPostType(),\n\t\t\t\ttemplateId: getEditedPostId(),\n\t\t\t\tpage: getPage(),\n\t\t\t};\n\t\t},\n\t\t[ setIsInserterOpen ]\n\t);\n\n\tconst [ blocks, onInput, onChange ] = useEntityBlockEditor(\n\t\t'postType',\n\t\ttemplateType\n\t);\n\tconst { setPage } = useDispatch( editSiteStore );\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\tconst openNavigationSidebar = useCallback( () => {\n\t\tenableComplementaryArea(\n\t\t\t'core/edit-site',\n\t\t\t'edit-site/navigation-menu'\n\t\t);\n\t}, [ enableComplementaryArea ] );\n\tconst contentRef = useRef();\n\tconst mergedRefs = useMergeRefs( [ contentRef, useTypingObserver() ] );\n\tconst isMobileViewport = useViewportMatch( 'small', '<' );\n\tconst { clearSelectedBlock } = useDispatch( blockEditorStore );\n\n\tconst isTemplatePart = templateType === 'wp_template_part';\n\n\tconst NavMenuSidebarToggle = () => (\n\t\t<ToolbarGroup>\n\t\t\t<ToolbarButton\n\t\t\t\tclassName=\"components-toolbar__control\"\n\t\t\t\tlabel={ __( 'Open list view' ) }\n\t\t\t\tonClick={ openNavigationSidebar }\n\t\t\t\ticon={ listView }\n\t\t\t/>\n\t\t</ToolbarGroup>\n\t);\n\n\t// Conditionally include NavMenu sidebar in Plugin only.\n\t// Optimise for dead code elimination.\n\t// See https://github.com/WordPress/gutenberg/blob/trunk/docs/how-to-guides/feature-flags.md#dead-code-elimination.\n\tlet MaybeNavMenuSidebarToggle = 'Fragment';\n\n\tif ( process.env.IS_GUTENBERG_PLUGIN ) {\n\t\tMaybeNavMenuSidebarToggle = NavMenuSidebarToggle;\n\t}\n\n\treturn (\n\t\t<BlockEditorProvider\n\t\t\tsettings={ settings }\n\t\t\tvalue={ blocks }\n\t\t\tonInput={ onInput }\n\t\t\tonChange={ onChange }\n\t\t\tuseSubRegistry={ false }\n\t\t>\n\t\t\t<EditTemplatePartMenuButton />\n\t\t\t<TemplatePartConverter />\n\t\t\t<__experimentalLinkControl.ViewerFill>\n\t\t\t\t{ useCallback(\n\t\t\t\t\t( fillProps ) => (\n\t\t\t\t\t\t<NavigateToLink\n\t\t\t\t\t\t\t{ ...fillProps }\n\t\t\t\t\t\t\tactivePage={ page }\n\t\t\t\t\t\t\tonActivePageChange={ setPage }\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\t[ page ]\n\t\t\t\t) }\n\t\t\t</__experimentalLinkControl.ViewerFill>\n\t\t\t<SidebarInspectorFill>\n\t\t\t\t<BlockInspector />\n\t\t\t</SidebarInspectorFill>\n\t\t\t<BlockTools\n\t\t\t\tclassName={ classnames( 'edit-site-visual-editor', {\n\t\t\t\t\t'is-focus-mode': isTemplatePart,\n\t\t\t\t} ) }\n\t\t\t\t__unstableContentRef={ contentRef }\n\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t// Clear selected block when clicking on the gray background.\n\t\t\t\t\tif ( event.target === event.currentTarget ) {\n\t\t\t\t\t\tclearSelectedBlock();\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<BlockEditorKeyboardShortcuts.Register />\n\t\t\t\t<BackButton />\n\t\t\t\t<ResizableEditor\n\t\t\t\t\t// Reinitialize the editor and reset the states when the template changes.\n\t\t\t\t\tkey={ templateId }\n\t\t\t\t\tenableResizing={\n\t\t\t\t\t\tisTemplatePart &&\n\t\t\t\t\t\t// Disable resizing in mobile viewport.\n\t\t\t\t\t\t! isMobileViewport\n\t\t\t\t\t}\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tcontentRef={ mergedRefs }\n\t\t\t\t>\n\t\t\t\t\t<BlockList\n\t\t\t\t\t\tclassName=\"edit-site-block-editor__block-list wp-site-blocks\"\n\t\t\t\t\t\t__experimentalLayout={ LAYOUT }\n\t\t\t\t\t\trenderAppender={ isTemplatePart ? false : undefined }\n\t\t\t\t\t/>\n\t\t\t\t</ResizableEditor>\n\t\t\t\t<__unstableBlockSettingsMenuFirstItem>\n\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t<BlockInspectorButton onClick={ onClose } />\n\t\t\t\t\t) }\n\t\t\t\t</__unstableBlockSettingsMenuFirstItem>\n\t\t\t\t<__unstableBlockToolbarLastItem>\n\t\t\t\t\t<__unstableBlockNameContext.Consumer>\n\t\t\t\t\t\t{ ( blockName ) =>\n\t\t\t\t\t\t\tblockName === 'core/navigation' && (\n\t\t\t\t\t\t\t\t<MaybeNavMenuSidebarToggle />\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t</__unstableBlockNameContext.Consumer>\n\t\t\t\t</__unstableBlockToolbarLastItem>\n\t\t\t</BlockTools>\n\t\t\t<ReusableBlocksMenuItems />\n\t\t</BlockEditorProvider>\n\t);\n}\n"]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _element = require("@wordpress/element");
|
|
11
|
+
|
|
12
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
+
|
|
14
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
|
+
|
|
16
|
+
var _components = require("@wordpress/components");
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* External dependencies
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* WordPress dependencies
|
|
24
|
+
*/
|
|
25
|
+
function ColorIndicatorWrapper(_ref) {
|
|
26
|
+
let {
|
|
27
|
+
className,
|
|
28
|
+
...props
|
|
29
|
+
} = _ref;
|
|
30
|
+
return (0, _element.createElement)(_components.Flex, (0, _extends2.default)({
|
|
31
|
+
className: (0, _classnames.default)('edit-site-global-styles__color-indicator-wrapper', className)
|
|
32
|
+
}, props));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
var _default = ColorIndicatorWrapper;
|
|
36
|
+
exports.default = _default;
|
|
37
|
+
//# sourceMappingURL=color-indicator-wrapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/color-indicator-wrapper.js"],"names":["ColorIndicatorWrapper","className","props"],"mappings":";;;;;;;;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;AAGA,SAASA,qBAAT,OAA0D;AAAA,MAA1B;AAAEC,IAAAA,SAAF;AAAa,OAAGC;AAAhB,GAA0B;AACzD,SACC,4BAAC,gBAAD;AACC,IAAA,SAAS,EAAG,yBACX,kDADW,EAEXD,SAFW;AADb,KAKMC,KALN,EADD;AASA;;eAEcF,qB","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { Flex } from '@wordpress/components';\n\nfunction ColorIndicatorWrapper( { className, ...props } ) {\n\treturn (\n\t\t<Flex\n\t\t\tclassName={ classnames(\n\t\t\t\t'edit-site-global-styles__color-indicator-wrapper',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n\nexport default ColorIndicatorWrapper;\n"]}
|
|
@@ -28,7 +28,8 @@ const AXIAL_SIDES = ['horizontal', 'vertical'];
|
|
|
28
28
|
function useHasDimensionsPanel(name) {
|
|
29
29
|
const hasPadding = useHasPadding(name);
|
|
30
30
|
const hasMargin = useHasMargin(name);
|
|
31
|
-
|
|
31
|
+
const hasGap = useHasGap(name);
|
|
32
|
+
return hasPadding || hasMargin || hasGap;
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
function useHasPadding(name) {
|
|
@@ -43,6 +44,16 @@ function useHasMargin(name) {
|
|
|
43
44
|
return settings && supports.includes('margin');
|
|
44
45
|
}
|
|
45
46
|
|
|
47
|
+
function useHasGap(name) {
|
|
48
|
+
const supports = (0, _hooks.getSupportedGlobalStylesPanels)(name);
|
|
49
|
+
const [settings] = (0, _hooks.useSetting)('spacing.blockGap', name); // Do not show the gap control panel for block-level global styles
|
|
50
|
+
// as they do not work on the frontend.
|
|
51
|
+
// See: https://github.com/WordPress/gutenberg/pull/39845.
|
|
52
|
+
// We can revert this condition when they're working again.
|
|
53
|
+
|
|
54
|
+
return !!name ? false : settings && supports.includes('--wp--style--block-gap');
|
|
55
|
+
}
|
|
56
|
+
|
|
46
57
|
function filterValuesBySides(values, sides) {
|
|
47
58
|
if (!sides) {
|
|
48
59
|
// If no custom side configuration all sides are opted into by default.
|
|
@@ -88,6 +99,7 @@ function DimensionsPanel(_ref) {
|
|
|
88
99
|
} = _ref;
|
|
89
100
|
const showPaddingControl = useHasPadding(name);
|
|
90
101
|
const showMarginControl = useHasMargin(name);
|
|
102
|
+
const showGapControl = useHasGap(name);
|
|
91
103
|
const units = (0, _components.__experimentalUseCustomUnits)({
|
|
92
104
|
availableUnits: (0, _hooks.useSetting)('spacing.units', name)[0] || ['%', 'px', 'em', 'rem', 'vw']
|
|
93
105
|
});
|
|
@@ -119,9 +131,16 @@ function DimensionsPanel(_ref) {
|
|
|
119
131
|
|
|
120
132
|
const hasMarginValue = () => !!marginValues && Object.keys(marginValues).length;
|
|
121
133
|
|
|
134
|
+
const [gapValue, setGapValue] = (0, _hooks.useStyle)('spacing.blockGap', name);
|
|
135
|
+
|
|
136
|
+
const resetGapValue = () => setGapValue(undefined);
|
|
137
|
+
|
|
138
|
+
const hasGapValue = () => !!gapValue;
|
|
139
|
+
|
|
122
140
|
const resetAll = () => {
|
|
123
141
|
resetPaddingValue();
|
|
124
142
|
resetMarginValue();
|
|
143
|
+
resetGapValue();
|
|
125
144
|
};
|
|
126
145
|
|
|
127
146
|
return (0, _element.createElement)(_components.__experimentalToolsPanel, {
|
|
@@ -153,6 +172,18 @@ function DimensionsPanel(_ref) {
|
|
|
153
172
|
units: units,
|
|
154
173
|
allowReset: false,
|
|
155
174
|
splitOnAxis: isAxialMargin
|
|
175
|
+
})), showGapControl && (0, _element.createElement)(_components.__experimentalToolsPanelItem, {
|
|
176
|
+
hasValue: hasGapValue,
|
|
177
|
+
label: (0, _i18n.__)('Block spacing'),
|
|
178
|
+
onDeselect: resetGapValue,
|
|
179
|
+
isShownByDefault: true
|
|
180
|
+
}, (0, _element.createElement)(_components.__experimentalUnitControl, {
|
|
181
|
+
label: (0, _i18n.__)('Block spacing'),
|
|
182
|
+
__unstableInputWidth: "80px",
|
|
183
|
+
min: 0,
|
|
184
|
+
onChange: setGapValue,
|
|
185
|
+
units: units,
|
|
186
|
+
value: gapValue
|
|
156
187
|
})));
|
|
157
188
|
}
|
|
158
189
|
//# sourceMappingURL=dimensions-panel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/dimensions-panel.js"],"names":["AXIAL_SIDES","useHasDimensionsPanel","name","hasPadding","useHasPadding","hasMargin","useHasMargin","supports","settings","includes","filterValuesBySides","values","sides","filteredValues","forEach","side","top","bottom","left","right","splitStyleValue","value","DimensionsPanel","showPaddingControl","showMarginControl","units","availableUnits","rawPadding","setRawPadding","paddingValues","paddingSides","isAxialPadding","some","setPaddingValues","newPaddingValues","padding","resetPaddingValue","hasPaddingValue","Object","keys","length","rawMargin","setRawMargin","marginValues","marginSides","isAxialMargin","setMarginValues","newMarginValues","margin","resetMarginValue","hasMarginValue","resetAll"],"mappings":";;;;;;;;;;AAGA;;AACA;;AAMA;;AAKA;;AAfA;AACA;AACA;;AAUA;AACA;AACA;AAGA,MAAMA,WAAW,GAAG,CAAE,YAAF,EAAgB,UAAhB,CAApB;;AAEO,SAASC,qBAAT,CAAgCC,IAAhC,EAAuC;AAC7C,QAAMC,UAAU,GAAGC,aAAa,CAAEF,IAAF,CAAhC;AACA,QAAMG,SAAS,GAAGC,YAAY,CAAEJ,IAAF,CAA9B;AAEA,SAAOC,UAAU,IAAIE,SAArB;AACA;;AAED,SAASD,aAAT,CAAwBF,IAAxB,EAA+B;AAC9B,QAAMK,QAAQ,GAAG,2CAAgCL,IAAhC,CAAjB;AACA,QAAM,C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ACC,IAAA,QAAQ,EAAG0B,cADZ;AAEC,IAAA,KAAK,EAAG,cAAI,QAAJ,CAFT;AAGC,IAAA,UAAU,EAAGD,gBAHd;AAIC,IAAA,gBAAgB,EAAG;AAJpB,KAMC,4BAAC,oCAAD;AACC,IAAA,MAAM,EAAGN,YADV;AAEC,IAAA,QAAQ,EAAGG,eAFZ;AAGC,IAAA,KAAK,EAAG,cAAI,QAAJ,CAHT;AAIC,IAAA,KAAK,EAAGF,WAJT;AAKC,IAAA,KAAK,EAAGnB,KALT;AAMC,IAAA,UAAU,EAAG,KANd;AAOC,IAAA,WAAW,EAAGoB;AAPf,IAND,CApBF,CADD;AAwCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalBoxControl as BoxControl,\n\t__experimentalUseCustomUnits as useCustomUnits,\n} from '@wordpress/components';\nimport { __experimentalUseCustomSides as useCustomSides } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { getSupportedGlobalStylesPanels, useSetting, useStyle } from './hooks';\n\nconst AXIAL_SIDES = [ 'horizontal', 'vertical' ];\n\nexport function useHasDimensionsPanel( name ) {\n\tconst hasPadding = useHasPadding( name );\n\tconst hasMargin = useHasMargin( name );\n\n\treturn hasPadding || hasMargin;\n}\n\nfunction useHasPadding( name ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\tconst [ settings ] = useSetting( 'spacing.padding', name );\n\n\treturn settings && supports.includes( 'padding' );\n}\n\nfunction useHasMargin( name ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\tconst [ settings ] = useSetting( 'spacing.margin', name );\n\n\treturn settings && supports.includes( 'margin' );\n}\n\nfunction filterValuesBySides( values, sides ) {\n\tif ( ! sides ) {\n\t\t// If no custom side configuration all sides are opted into by default.\n\t\treturn values;\n\t}\n\n\t// Only include sides opted into within filtered values.\n\tconst filteredValues = {};\n\tsides.forEach( ( side ) => {\n\t\tif ( side === 'vertical' ) {\n\t\t\tfilteredValues.top = values.top;\n\t\t\tfilteredValues.bottom = values.bottom;\n\t\t}\n\t\tif ( side === 'horizontal' ) {\n\t\t\tfilteredValues.left = values.left;\n\t\t\tfilteredValues.right = values.right;\n\t\t}\n\t\tfilteredValues[ side ] = values[ side ];\n\t} );\n\n\treturn filteredValues;\n}\n\nfunction splitStyleValue( value ) {\n\t// Check for shorthand value ( a string value ).\n\tif ( value && typeof value === 'string' ) {\n\t\t// Convert to value for individual sides for BoxControl.\n\t\treturn {\n\t\t\ttop: value,\n\t\t\tright: value,\n\t\t\tbottom: value,\n\t\t\tleft: value,\n\t\t};\n\t}\n\n\treturn value;\n}\n\nexport default function DimensionsPanel( { name } ) {\n\tconst showPaddingControl = useHasPadding( name );\n\tconst showMarginControl = useHasMargin( name );\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: useSetting( 'spacing.units', name )[ 0 ] || [\n\t\t\t'%',\n\t\t\t'px',\n\t\t\t'em',\n\t\t\t'rem',\n\t\t\t'vw',\n\t\t],\n\t} );\n\n\tconst [ rawPadding, setRawPadding ] = useStyle( 'spacing.padding', name );\n\tconst paddingValues = splitStyleValue( rawPadding );\n\tconst paddingSides = useCustomSides( name, 'padding' );\n\tconst isAxialPadding =\n\t\tpaddingSides &&\n\t\tpaddingSides.some( ( side ) => AXIAL_SIDES.includes( side ) );\n\n\tconst setPaddingValues = ( newPaddingValues ) => {\n\t\tconst padding = filterValuesBySides( newPaddingValues, paddingSides );\n\t\tsetRawPadding( padding );\n\t};\n\tconst resetPaddingValue = () => setPaddingValues( {} );\n\tconst hasPaddingValue = () =>\n\t\t!! paddingValues && Object.keys( paddingValues ).length;\n\n\tconst [ rawMargin, setRawMargin ] = useStyle( 'spacing.margin', name );\n\tconst marginValues = splitStyleValue( rawMargin );\n\tconst marginSides = useCustomSides( name, 'margin' );\n\tconst isAxialMargin =\n\t\tmarginSides &&\n\t\tmarginSides.some( ( side ) => AXIAL_SIDES.includes( side ) );\n\n\tconst setMarginValues = ( newMarginValues ) => {\n\t\tconst margin = filterValuesBySides( newMarginValues, marginSides );\n\t\tsetRawMargin( margin );\n\t};\n\tconst resetMarginValue = () => setMarginValues( {} );\n\tconst hasMarginValue = () =>\n\t\t!! marginValues && Object.keys( marginValues ).length;\n\tconst resetAll = () => {\n\t\tresetPaddingValue();\n\t\tresetMarginValue();\n\t};\n\n\treturn (\n\t\t<ToolsPanel label={ __( 'Dimensions' ) } resetAll={ resetAll }>\n\t\t\t{ showPaddingControl && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ hasPaddingValue }\n\t\t\t\t\tlabel={ __( 'Padding' ) }\n\t\t\t\t\tonDeselect={ resetPaddingValue }\n\t\t\t\t\tisShownByDefault={ true }\n\t\t\t\t>\n\t\t\t\t\t<BoxControl\n\t\t\t\t\t\tvalues={ paddingValues }\n\t\t\t\t\t\tonChange={ setPaddingValues }\n\t\t\t\t\t\tlabel={ __( 'Padding' ) }\n\t\t\t\t\t\tsides={ paddingSides }\n\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\tallowReset={ false }\n\t\t\t\t\t\tsplitOnAxis={ isAxialPadding }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ showMarginControl && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ hasMarginValue }\n\t\t\t\t\tlabel={ __( 'Margin' ) }\n\t\t\t\t\tonDeselect={ resetMarginValue }\n\t\t\t\t\tisShownByDefault={ true }\n\t\t\t\t>\n\t\t\t\t\t<BoxControl\n\t\t\t\t\t\tvalues={ marginValues }\n\t\t\t\t\t\tonChange={ setMarginValues }\n\t\t\t\t\t\tlabel={ __( 'Margin' ) }\n\t\t\t\t\t\tsides={ marginSides }\n\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\tallowReset={ false }\n\t\t\t\t\t\tsplitOnAxis={ isAxialMargin }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t</ToolsPanel>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/dimensions-panel.js"],"names":["AXIAL_SIDES","useHasDimensionsPanel","name","hasPadding","useHasPadding","hasMargin","useHasMargin","hasGap","useHasGap","supports","settings","includes","filterValuesBySides","values","sides","filteredValues","forEach","side","top","bottom","left","right","splitStyleValue","value","DimensionsPanel","showPaddingControl","showMarginControl","showGapControl","units","availableUnits","rawPadding","setRawPadding","paddingValues","paddingSides","isAxialPadding","some","setPaddingValues","newPaddingValues","padding","resetPaddingValue","hasPaddingValue","Object","keys","length","rawMargin","setRawMargin","marginValues","marginSides","isAxialMargin","setMarginValues","newMarginValues","margin","resetMarginValue","hasMarginValue","gapValue","setGapValue","resetGapValue","undefined","hasGapValue","resetAll"],"mappings":";;;;;;;;;;AAGA;;AACA;;AAOA;;AAKA;;AAhBA;AACA;AACA;;AAWA;AACA;AACA;AAGA,MAAMA,WAAW,GAAG,CAAE,YAAF,EAAgB,UAAhB,CAApB;;AAEO,SAASC,qBAAT,CAAgCC,IAAhC,EAAuC;AAC7C,QAAMC,UAAU,GAAGC,aAAa,CAAEF,IAAF,CAAhC;AACA,QAAMG,SAAS,GAAGC,YAAY,CAAEJ,IAAF,CAA9B;AACA,QAAMK,MAAM,GAAGC,SAAS,CAAEN,IAAF,CAAxB;AAEA,SAAOC,UAAU,IAAIE,SAAd,IAA2BE,MAAlC;AACA;;AAED,SAASH,aAAT,CAAwBF,IAAxB,EAA+B;AAC9B,QAAMO,QAAQ,GAAG,2CAAgCP,IAAhC,CAAjB;AACA,QAAM,CAAEQ,QAAF,IAAe,uBAAY,iBAAZ,EAA+BR,IAA/B,CAArB;AAEA,SAAOQ,QAAQ,IAAID,QAAQ,CAACE,QAAT,CAAmB,SAAnB,CAAnB;AACA;;AAED,SAASL,YAAT,CAAuBJ,IAAvB,EAA8B;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","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalBoxControl as BoxControl,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalUseCustomUnits as useCustomUnits,\n} from '@wordpress/components';\nimport { __experimentalUseCustomSides as useCustomSides } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { getSupportedGlobalStylesPanels, useSetting, useStyle } from './hooks';\n\nconst AXIAL_SIDES = [ 'horizontal', 'vertical' ];\n\nexport function useHasDimensionsPanel( name ) {\n\tconst hasPadding = useHasPadding( name );\n\tconst hasMargin = useHasMargin( name );\n\tconst hasGap = useHasGap( name );\n\n\treturn hasPadding || hasMargin || hasGap;\n}\n\nfunction useHasPadding( name ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\tconst [ settings ] = useSetting( 'spacing.padding', name );\n\n\treturn settings && supports.includes( 'padding' );\n}\n\nfunction useHasMargin( name ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\tconst [ settings ] = useSetting( 'spacing.margin', name );\n\n\treturn settings && supports.includes( 'margin' );\n}\n\nfunction useHasGap( name ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\tconst [ settings ] = useSetting( 'spacing.blockGap', name );\n\t// Do not show the gap control panel for block-level global styles\n\t// as they do not work on the frontend.\n\t// See: https://github.com/WordPress/gutenberg/pull/39845.\n\t// We can revert this condition when they're working again.\n\treturn !! name\n\t\t? false\n\t\t: settings && supports.includes( '--wp--style--block-gap' );\n}\n\nfunction filterValuesBySides( values, sides ) {\n\tif ( ! sides ) {\n\t\t// If no custom side configuration all sides are opted into by default.\n\t\treturn values;\n\t}\n\n\t// Only include sides opted into within filtered values.\n\tconst filteredValues = {};\n\tsides.forEach( ( side ) => {\n\t\tif ( side === 'vertical' ) {\n\t\t\tfilteredValues.top = values.top;\n\t\t\tfilteredValues.bottom = values.bottom;\n\t\t}\n\t\tif ( side === 'horizontal' ) {\n\t\t\tfilteredValues.left = values.left;\n\t\t\tfilteredValues.right = values.right;\n\t\t}\n\t\tfilteredValues[ side ] = values[ side ];\n\t} );\n\n\treturn filteredValues;\n}\n\nfunction splitStyleValue( value ) {\n\t// Check for shorthand value ( a string value ).\n\tif ( value && typeof value === 'string' ) {\n\t\t// Convert to value for individual sides for BoxControl.\n\t\treturn {\n\t\t\ttop: value,\n\t\t\tright: value,\n\t\t\tbottom: value,\n\t\t\tleft: value,\n\t\t};\n\t}\n\n\treturn value;\n}\n\nexport default function DimensionsPanel( { name } ) {\n\tconst showPaddingControl = useHasPadding( name );\n\tconst showMarginControl = useHasMargin( name );\n\tconst showGapControl = useHasGap( name );\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: useSetting( 'spacing.units', name )[ 0 ] || [\n\t\t\t'%',\n\t\t\t'px',\n\t\t\t'em',\n\t\t\t'rem',\n\t\t\t'vw',\n\t\t],\n\t} );\n\n\tconst [ rawPadding, setRawPadding ] = useStyle( 'spacing.padding', name );\n\tconst paddingValues = splitStyleValue( rawPadding );\n\tconst paddingSides = useCustomSides( name, 'padding' );\n\tconst isAxialPadding =\n\t\tpaddingSides &&\n\t\tpaddingSides.some( ( side ) => AXIAL_SIDES.includes( side ) );\n\n\tconst setPaddingValues = ( newPaddingValues ) => {\n\t\tconst padding = filterValuesBySides( newPaddingValues, paddingSides );\n\t\tsetRawPadding( padding );\n\t};\n\tconst resetPaddingValue = () => setPaddingValues( {} );\n\tconst hasPaddingValue = () =>\n\t\t!! paddingValues && Object.keys( paddingValues ).length;\n\n\tconst [ rawMargin, setRawMargin ] = useStyle( 'spacing.margin', name );\n\tconst marginValues = splitStyleValue( rawMargin );\n\tconst marginSides = useCustomSides( name, 'margin' );\n\tconst isAxialMargin =\n\t\tmarginSides &&\n\t\tmarginSides.some( ( side ) => AXIAL_SIDES.includes( side ) );\n\n\tconst setMarginValues = ( newMarginValues ) => {\n\t\tconst margin = filterValuesBySides( newMarginValues, marginSides );\n\t\tsetRawMargin( margin );\n\t};\n\tconst resetMarginValue = () => setMarginValues( {} );\n\tconst hasMarginValue = () =>\n\t\t!! marginValues && Object.keys( marginValues ).length;\n\n\tconst [ gapValue, setGapValue ] = useStyle( 'spacing.blockGap', name );\n\tconst resetGapValue = () => setGapValue( undefined );\n\tconst hasGapValue = () => !! gapValue;\n\n\tconst resetAll = () => {\n\t\tresetPaddingValue();\n\t\tresetMarginValue();\n\t\tresetGapValue();\n\t};\n\n\treturn (\n\t\t<ToolsPanel label={ __( 'Dimensions' ) } resetAll={ resetAll }>\n\t\t\t{ showPaddingControl && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ hasPaddingValue }\n\t\t\t\t\tlabel={ __( 'Padding' ) }\n\t\t\t\t\tonDeselect={ resetPaddingValue }\n\t\t\t\t\tisShownByDefault={ true }\n\t\t\t\t>\n\t\t\t\t\t<BoxControl\n\t\t\t\t\t\tvalues={ paddingValues }\n\t\t\t\t\t\tonChange={ setPaddingValues }\n\t\t\t\t\t\tlabel={ __( 'Padding' ) }\n\t\t\t\t\t\tsides={ paddingSides }\n\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\tallowReset={ false }\n\t\t\t\t\t\tsplitOnAxis={ isAxialPadding }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ showMarginControl && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ hasMarginValue }\n\t\t\t\t\tlabel={ __( 'Margin' ) }\n\t\t\t\t\tonDeselect={ resetMarginValue }\n\t\t\t\t\tisShownByDefault={ true }\n\t\t\t\t>\n\t\t\t\t\t<BoxControl\n\t\t\t\t\t\tvalues={ marginValues }\n\t\t\t\t\t\tonChange={ setMarginValues }\n\t\t\t\t\t\tlabel={ __( 'Margin' ) }\n\t\t\t\t\t\tsides={ marginSides }\n\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\tallowReset={ false }\n\t\t\t\t\t\tsplitOnAxis={ isAxialMargin }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ showGapControl && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ hasGapValue }\n\t\t\t\t\tlabel={ __( 'Block spacing' ) }\n\t\t\t\t\tonDeselect={ resetGapValue }\n\t\t\t\t\tisShownByDefault={ true }\n\t\t\t\t>\n\t\t\t\t\t<UnitControl\n\t\t\t\t\t\tlabel={ __( 'Block spacing' ) }\n\t\t\t\t\t\t__unstableInputWidth=\"80px\"\n\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t\tonChange={ setGapValue }\n\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\tvalue={ gapValue }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t</ToolsPanel>\n\t);\n}\n"]}
|
|
@@ -32,10 +32,7 @@ function ScreenHeader(_ref) {
|
|
|
32
32
|
}, (0, _element.createElement)(_components.__experimentalHStack, {
|
|
33
33
|
spacing: 2
|
|
34
34
|
}, (0, _element.createElement)(_components.__experimentalView, null, (0, _element.createElement)(_navigationButton.NavigationBackButton, {
|
|
35
|
-
icon: (0,
|
|
36
|
-
icon: (0, _i18n.isRTL)() ? _icons.chevronRight : _icons.chevronLeft,
|
|
37
|
-
variant: "muted"
|
|
38
|
-
}),
|
|
35
|
+
icon: (0, _i18n.isRTL)() ? _icons.chevronRight : _icons.chevronLeft,
|
|
39
36
|
size: "small",
|
|
40
37
|
"aria-label": (0, _i18n.__)('Navigate to the previous view')
|
|
41
38
|
})), (0, _element.createElement)(_components.__experimentalSpacer, null, (0, _element.createElement)(_components.__experimentalHeading, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/header.js"],"names":["ScreenHeader","title","description","chevronRight","chevronLeft"],"mappings":";;;;;;;;;AAGA;;AAOA;;AACA;;AAKA;;AAhBA;AACA;AACA;;AAWA;AACA;AACA;AAGA,SAASA,YAAT,OAAgD;AAAA,MAAzB;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,GAAyB;AAC/C,SACC,4BAAC,gCAAD;AAAQ,IAAA,OAAO,EAAG;AAAlB,KACC,4BAAC,gCAAD;AAAQ,IAAA,OAAO,EAAG;AAAlB,KACC,4BAAC,8BAAD,QACC,4BAAC,sCAAD;AACC,IAAA,IAAI,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/header.js"],"names":["ScreenHeader","title","description","chevronRight","chevronLeft"],"mappings":";;;;;;;;;AAGA;;AAOA;;AACA;;AAKA;;AAhBA;AACA;AACA;;AAWA;AACA;AACA;AAGA,SAASA,YAAT,OAAgD;AAAA,MAAzB;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,GAAyB;AAC/C,SACC,4BAAC,gCAAD;AAAQ,IAAA,OAAO,EAAG;AAAlB,KACC,4BAAC,gCAAD;AAAQ,IAAA,OAAO,EAAG;AAAlB,KACC,4BAAC,8BAAD,QACC,4BAAC,sCAAD;AACC,IAAA,IAAI,EAAG,qBAAUC,mBAAV,GAAyBC,kBADjC;AAEC,IAAA,IAAI,EAAC,OAFN;AAGC,kBAAa,cAAI,+BAAJ;AAHd,IADD,CADD,EAQC,4BAAC,gCAAD,QACC,4BAAC,iCAAD;AAAS,IAAA,KAAK,EAAG;AAAjB,KAAuBH,KAAvB,CADD,CARD,CADD,EAaGC,WAAW,IACZ;AAAG,IAAA,SAAS,EAAC;AAAb,KACGA,WADH,CAdF,CADD;AAqBA;;eAEcF,Y","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\t__experimentalSpacer as Spacer,\n\t__experimentalHeading as Heading,\n\t__experimentalView as View,\n} from '@wordpress/components';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport { chevronRight, chevronLeft } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { NavigationBackButton } from './navigation-button';\n\nfunction ScreenHeader( { title, description } ) {\n\treturn (\n\t\t<VStack spacing={ 2 }>\n\t\t\t<HStack spacing={ 2 }>\n\t\t\t\t<View>\n\t\t\t\t\t<NavigationBackButton\n\t\t\t\t\t\ticon={ isRTL() ? chevronRight : chevronLeft }\n\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\taria-label={ __( 'Navigate to the previous view' ) }\n\t\t\t\t\t/>\n\t\t\t\t</View>\n\t\t\t\t<Spacer>\n\t\t\t\t\t<Heading level={ 5 }>{ title }</Heading>\n\t\t\t\t</Spacer>\n\t\t\t</HStack>\n\t\t\t{ description && (\n\t\t\t\t<p className=\"edit-site-global-styles-header__description\">\n\t\t\t\t\t{ description }\n\t\t\t\t</p>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n\nexport default ScreenHeader;\n"]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.IconWithCurrentColor = IconWithCurrentColor;
|
|
9
|
+
|
|
10
|
+
var _element = require("@wordpress/element");
|
|
11
|
+
|
|
12
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
+
|
|
14
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
|
+
|
|
16
|
+
var _components = require("@wordpress/components");
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* External dependencies
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* WordPress dependencies
|
|
24
|
+
*/
|
|
25
|
+
function IconWithCurrentColor(_ref) {
|
|
26
|
+
let {
|
|
27
|
+
className,
|
|
28
|
+
...props
|
|
29
|
+
} = _ref;
|
|
30
|
+
return (0, _element.createElement)(_components.Icon, (0, _extends2.default)({
|
|
31
|
+
className: (0, _classnames.default)(className, 'edit-site-global-styles-icon-with-current-color')
|
|
32
|
+
}, props));
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=icon-with-current-color.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/icon-with-current-color.js"],"names":["IconWithCurrentColor","className","props"],"mappings":";;;;;;;;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;AAGO,SAASA,oBAAT,OAAyD;AAAA,MAA1B;AAAEC,IAAAA,SAAF;AAAa,OAAGC;AAAhB,GAA0B;AAC/D,SACC,4BAAC,gBAAD;AACC,IAAA,SAAS,EAAG,yBACXD,SADW,EAEX,iDAFW;AADb,KAKMC,KALN,EADD;AASA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { Icon } from '@wordpress/components';\n\nexport function IconWithCurrentColor( { className, ...props } ) {\n\treturn (\n\t\t<Icon\n\t\t\tclassName={ classnames(\n\t\t\t\tclassName,\n\t\t\t\t'edit-site-global-styles-icon-with-current-color'\n\t\t\t) }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -14,11 +14,15 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
14
14
|
|
|
15
15
|
var _components = require("@wordpress/components");
|
|
16
16
|
|
|
17
|
-
var
|
|
17
|
+
var _iconWithCurrentColor = require("./icon-with-current-color");
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* WordPress dependencies
|
|
21
21
|
*/
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Internal dependencies
|
|
25
|
+
*/
|
|
22
26
|
function GenericNavigationButton(_ref) {
|
|
23
27
|
let {
|
|
24
28
|
icon,
|
|
@@ -27,10 +31,10 @@ function GenericNavigationButton(_ref) {
|
|
|
27
31
|
} = _ref;
|
|
28
32
|
return (0, _element.createElement)(_components.__experimentalItem, props, icon && (0, _element.createElement)(_components.__experimentalHStack, {
|
|
29
33
|
justify: "flex-start"
|
|
30
|
-
}, (0, _element.createElement)(
|
|
34
|
+
}, (0, _element.createElement)(_iconWithCurrentColor.IconWithCurrentColor, {
|
|
31
35
|
icon: icon,
|
|
32
36
|
size: 24
|
|
33
|
-
})
|
|
37
|
+
}), (0, _element.createElement)(_components.FlexItem, null, children)), !icon && children);
|
|
34
38
|
}
|
|
35
39
|
|
|
36
40
|
function NavigationButton(props) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/navigation-button.js"],"names":["GenericNavigationButton","icon","children","props","NavigationButton","NavigationBackButton"],"mappings":";;;;;;;;;;;;;;AAGA;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/navigation-button.js"],"names":["GenericNavigationButton","icon","children","props","NavigationButton","NavigationBackButton"],"mappings":";;;;;;;;;;;;;;AAGA;;AAWA;;AAdA;AACA;AACA;;AASA;AACA;AACA;AAGA,SAASA,uBAAT,OAAiE;AAAA,MAA/B;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,QAAR;AAAkB,OAAGC;AAArB,GAA+B;AAChE,SACC,4BAAC,8BAAD,EAAWA,KAAX,EACGF,IAAI,IACL,4BAAC,gCAAD;AAAQ,IAAA,OAAO,EAAC;AAAhB,KACC,4BAAC,0CAAD;AAAsB,IAAA,IAAI,EAAGA,IAA7B;AAAoC,IAAA,IAAI,EAAG;AAA3C,IADD,EAEC,4BAAC,oBAAD,QAAYC,QAAZ,CAFD,CAFF,EAOG,CAAED,IAAF,IAAUC,QAPb,CADD;AAWA;;AAED,SAASE,gBAAT,CAA2BD,KAA3B,EAAmC;AAClC,SAAO,4BAAC,yCAAD;AAAiB,IAAA,EAAE,EAAGH;AAAtB,KAAqDG,KAArD,EAAP;AACA;;AAED,SAASE,oBAAT,CAA+BF,KAA/B,EAAuC;AACtC,SAAO,4BAAC,6CAAD;AAAqB,IAAA,EAAE,EAAGH;AAA1B,KAAyDG,KAAzD,EAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalNavigatorButton as NavigatorButton,\n\t__experimentalNavigatorBackButton as NavigatorBackButton,\n\t__experimentalItem as Item,\n\tFlexItem,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { IconWithCurrentColor } from './icon-with-current-color';\n\nfunction GenericNavigationButton( { icon, children, ...props } ) {\n\treturn (\n\t\t<Item { ...props }>\n\t\t\t{ icon && (\n\t\t\t\t<HStack justify=\"flex-start\">\n\t\t\t\t\t<IconWithCurrentColor icon={ icon } size={ 24 } />\n\t\t\t\t\t<FlexItem>{ children }</FlexItem>\n\t\t\t\t</HStack>\n\t\t\t) }\n\t\t\t{ ! icon && children }\n\t\t</Item>\n\t);\n}\n\nfunction NavigationButton( props ) {\n\treturn <NavigatorButton as={ GenericNavigationButton } { ...props } />;\n}\n\nfunction NavigationBackButton( props ) {\n\treturn <NavigatorBackButton as={ GenericNavigationButton } { ...props } />;\n}\n\nexport { NavigationButton, NavigationBackButton };\n"]}
|
|
@@ -19,6 +19,8 @@ var _navigationButton = require("./navigation-button");
|
|
|
19
19
|
|
|
20
20
|
var _hooks = require("./hooks");
|
|
21
21
|
|
|
22
|
+
var _colorIndicatorWrapper = _interopRequireDefault(require("./color-indicator-wrapper"));
|
|
23
|
+
|
|
22
24
|
/**
|
|
23
25
|
* WordPress dependencies
|
|
24
26
|
*/
|
|
@@ -49,18 +51,19 @@ function Palette(_ref) {
|
|
|
49
51
|
path: screenPath
|
|
50
52
|
}, (0, _element.createElement)(_components.__experimentalHStack, {
|
|
51
53
|
direction: colors.length === 0 ? 'row-reverse' : 'row'
|
|
52
|
-
}, (0, _element.createElement)(_components.
|
|
54
|
+
}, (0, _element.createElement)(_components.__experimentalZStack, {
|
|
53
55
|
isLayered: false,
|
|
54
56
|
offset: -8
|
|
55
57
|
}, colors.slice(0, 5).map(_ref2 => {
|
|
56
58
|
let {
|
|
57
59
|
color
|
|
58
60
|
} = _ref2;
|
|
59
|
-
return (0, _element.createElement)(
|
|
60
|
-
key: color
|
|
61
|
+
return (0, _element.createElement)(_colorIndicatorWrapper.default, {
|
|
62
|
+
key: color
|
|
63
|
+
}, (0, _element.createElement)(_components.ColorIndicator, {
|
|
61
64
|
colorValue: color
|
|
62
|
-
});
|
|
63
|
-
}))
|
|
65
|
+
}));
|
|
66
|
+
})), (0, _element.createElement)(_components.FlexItem, null, paletteButtonText)))));
|
|
64
67
|
}
|
|
65
68
|
|
|
66
69
|
var _default = Palette;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/palette.js"],"names":["EMPTY_COLORS","Palette","name","customColors","themeColors","defaultColors","defaultPaletteEnabled","colors","screenPath","paletteButtonText","length","slice","map","color"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/palette.js"],"names":["EMPTY_COLORS","Palette","name","customColors","themeColors","defaultColors","defaultPaletteEnabled","colors","screenPath","paletteButtonText","length","slice","map","color"],"mappings":";;;;;;;;;AAYA;;AATA;;AAQA;;AAMA;;AACA;;AACA;;AACA;;AApBA;AACA;AACA;;AAYA;AACA;AACA;AAMA,MAAMA,YAAY,GAAG,EAArB;;AAEA,SAASC,OAAT,OAA6B;AAAA,MAAX;AAAEC,IAAAA;AAAF,GAAW;AAC5B,QAAM,CAAEC,YAAF,IAAmB,uBAAY,sBAAZ,CAAzB;AACA,QAAM,CAAEC,WAAF,IAAkB,uBAAY,qBAAZ,CAAxB;AACA,QAAM,CAAEC,aAAF,IAAoB,uBAAY,uBAAZ,CAA1B;AAEA,QAAM,CAAEC,qBAAF,IAA4B,uBACjC,sBADiC,EAEjCJ,IAFiC,CAAlC;AAI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,4BAAC,oBAAD,QAAYJ,iBAAZ,CAZD,CADD,CADD,CAFD,CADD;AAuBA;;eAEcR,O","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\tFlexItem,\n\t__experimentalHStack as HStack,\n\t__experimentalZStack as ZStack,\n\t__experimentalVStack as VStack,\n\tColorIndicator,\n} from '@wordpress/components';\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport Subtitle from './subtitle';\nimport { NavigationButton } from './navigation-button';\nimport { useSetting } from './hooks';\nimport ColorIndicatorWrapper from './color-indicator-wrapper';\n\nconst EMPTY_COLORS = [];\n\nfunction Palette( { name } ) {\n\tconst [ customColors ] = useSetting( 'color.palette.custom' );\n\tconst [ themeColors ] = useSetting( 'color.palette.theme' );\n\tconst [ defaultColors ] = useSetting( 'color.palette.default' );\n\n\tconst [ defaultPaletteEnabled ] = useSetting(\n\t\t'color.defaultPalette',\n\t\tname\n\t);\n\tconst colors = useMemo(\n\t\t() => [\n\t\t\t...( customColors || EMPTY_COLORS ),\n\t\t\t...( themeColors || EMPTY_COLORS ),\n\t\t\t...( defaultColors && defaultPaletteEnabled\n\t\t\t\t? defaultColors\n\t\t\t\t: EMPTY_COLORS ),\n\t\t],\n\t\t[ customColors, themeColors, defaultColors, defaultPaletteEnabled ]\n\t);\n\n\tconst screenPath = ! name\n\t\t? '/colors/palette'\n\t\t: '/blocks/' + name + '/colors/palette';\n\tconst paletteButtonText =\n\t\tcolors.length > 0\n\t\t\t? sprintf(\n\t\t\t\t\t// Translators: %d: Number of palette colors.\n\t\t\t\t\t_n( '%d color', '%d colors', colors.length ),\n\t\t\t\t\tcolors.length\n\t\t\t )\n\t\t\t: __( 'Add custom colors' );\n\n\treturn (\n\t\t<VStack spacing={ 3 }>\n\t\t\t<Subtitle>{ __( 'Palette' ) }</Subtitle>\n\t\t\t<ItemGroup isBordered isSeparated>\n\t\t\t\t<NavigationButton path={ screenPath }>\n\t\t\t\t\t<HStack\n\t\t\t\t\t\tdirection={\n\t\t\t\t\t\t\tcolors.length === 0 ? 'row-reverse' : 'row'\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ZStack isLayered={ false } offset={ -8 }>\n\t\t\t\t\t\t\t{ colors.slice( 0, 5 ).map( ( { color } ) => (\n\t\t\t\t\t\t\t\t<ColorIndicatorWrapper key={ color }>\n\t\t\t\t\t\t\t\t\t<ColorIndicator colorValue={ color } />\n\t\t\t\t\t\t\t\t</ColorIndicatorWrapper>\n\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t</ZStack>\n\t\t\t\t\t\t<FlexItem>{ paletteButtonText }</FlexItem>\n\t\t\t\t\t</HStack>\n\t\t\t\t</NavigationButton>\n\t\t\t</ItemGroup>\n\t\t</VStack>\n\t);\n}\n\nexport default Palette;\n"]}
|