@wordpress/edit-site 3.0.2 → 3.0.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/README.md +1 -1
- package/build/components/block-editor/back-button.js +60 -0
- package/build/components/block-editor/back-button.js.map +1 -0
- package/build/components/block-editor/index.js +18 -4
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/edit-template-part-menu-button/index.js +63 -0
- package/build/components/edit-template-part-menu-button/index.js.map +1 -0
- package/build/components/editor/global-styles-provider.js +1 -1
- package/build/components/editor/global-styles-provider.js.map +1 -1
- package/build/components/editor/index.js +7 -7
- package/build/components/editor/index.js.map +1 -1
- package/build/components/editor/utils.js +1 -1
- package/build/components/editor/utils.js.map +1 -1
- package/build/components/{sidebar → global-styles}/border-panel.js +0 -0
- package/build/components/global-styles/border-panel.js.map +1 -0
- package/build/components/{sidebar → global-styles}/color-palette-panel.js +4 -2
- package/build/components/global-styles/color-palette-panel.js.map +1 -0
- package/build/components/{sidebar → global-styles}/color-panel.js +7 -11
- package/build/components/global-styles/color-panel.js.map +1 -0
- package/build/components/global-styles/context-menu.js +58 -0
- package/build/components/global-styles/context-menu.js.map +1 -0
- package/build/components/{sidebar → global-styles}/dimensions-panel.js +6 -7
- package/build/components/global-styles/dimensions-panel.js.map +1 -0
- package/build/components/global-styles/header.js +54 -0
- package/build/components/global-styles/header.js.map +1 -0
- package/build/components/global-styles/index.js +89 -0
- package/build/components/global-styles/index.js.map +1 -0
- package/build/components/global-styles/navigation-button.js +43 -0
- package/build/components/global-styles/navigation-button.js.map +1 -0
- package/build/components/global-styles/palette.js +57 -0
- package/build/components/global-styles/palette.js.map +1 -0
- package/build/components/global-styles/preview.js +59 -0
- package/build/components/global-styles/preview.js.map +1 -0
- package/build/components/global-styles/screen-block-list.js +76 -0
- package/build/components/global-styles/screen-block-list.js.map +1 -0
- package/build/components/global-styles/screen-block.js +45 -0
- package/build/components/global-styles/screen-block.js.map +1 -0
- package/build/components/global-styles/screen-color-palette.js +48 -0
- package/build/components/global-styles/screen-color-palette.js.map +1 -0
- package/build/components/global-styles/screen-colors.js +51 -0
- package/build/components/global-styles/screen-colors.js.map +1 -0
- package/build/components/global-styles/screen-layout.js +60 -0
- package/build/components/global-styles/screen-layout.js.map +1 -0
- package/build/components/global-styles/screen-root.js +44 -0
- package/build/components/global-styles/screen-root.js.map +1 -0
- package/build/components/global-styles/screen-typography.js +50 -0
- package/build/components/global-styles/screen-typography.js.map +1 -0
- package/build/components/global-styles/subtitle.js +25 -0
- package/build/components/global-styles/subtitle.js.map +1 -0
- package/build/components/{sidebar → global-styles}/typography-panel.js +1 -3
- package/build/components/global-styles/typography-panel.js.map +1 -0
- package/build/components/header/plugin-more-menu-item/index.js +82 -0
- package/build/components/header/plugin-more-menu-item/index.js.map +1 -0
- package/build/components/header/plugin-sidebar-more-menu-item/index.js +75 -0
- package/build/components/header/plugin-sidebar-more-menu-item/index.js.map +1 -0
- package/build/components/header/undo-redo/redo.js +1 -1
- package/build/components/header/undo-redo/redo.js.map +1 -1
- package/build/components/header/undo-redo/undo.js +1 -1
- package/build/components/header/undo-redo/undo.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +2 -10
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/navigation-sidebar/index.js +1 -1
- package/build/components/navigation-sidebar/index.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-panel/constants.js +10 -10
- package/build/components/navigation-sidebar/navigation-panel/constants.js.map +1 -1
- package/build/components/save-button/index.js +1 -1
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/secondary-sidebar/inserter-sidebar.js +2 -1
- package/build/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
- package/build/components/sidebar/global-styles-sidebar.js +11 -161
- package/build/components/sidebar/global-styles-sidebar.js.map +1 -1
- package/build/components/sidebar/index.js +1 -6
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar/plugin-sidebar/index.js +95 -0
- package/build/components/sidebar/plugin-sidebar/index.js.map +1 -0
- package/build/components/template-details/index.js +12 -6
- package/build/components/template-details/index.js.map +1 -1
- package/build/components/template-details/template-areas.js +73 -0
- package/build/components/template-details/template-areas.js.map +1 -0
- package/build/components/template-part-converter/index.js +1 -1
- package/build/components/template-part-converter/index.js.map +1 -1
- package/build/components/url-query-controller/index.js +1 -1
- package/build/components/url-query-controller/index.js.map +1 -1
- package/build/index.js +24 -0
- package/build/index.js.map +1 -1
- package/build/store/actions.js +54 -1
- package/build/store/actions.js.map +1 -1
- package/build/store/constants.js +19 -1
- package/build/store/constants.js.map +1 -1
- package/build/store/reducer.js +16 -7
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +91 -9
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/block-editor/back-button.js +48 -0
- package/build-module/components/block-editor/back-button.js.map +1 -0
- package/build-module/components/block-editor/index.js +15 -4
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/edit-template-part-menu-button/index.js +49 -0
- package/build-module/components/edit-template-part-menu-button/index.js.map +1 -0
- package/build-module/components/editor/global-styles-provider.js +1 -1
- package/build-module/components/editor/global-styles-provider.js.map +1 -1
- package/build-module/components/editor/index.js +4 -5
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/editor/utils.js +1 -1
- package/build-module/components/editor/utils.js.map +1 -1
- package/build-module/components/{sidebar → global-styles}/border-panel.js +0 -0
- package/build-module/components/global-styles/border-panel.js.map +1 -0
- package/build-module/components/{sidebar → global-styles}/color-palette-panel.js +4 -2
- package/build-module/components/global-styles/color-palette-panel.js.map +1 -0
- package/build-module/components/{sidebar → global-styles}/color-panel.js +8 -12
- package/build-module/components/global-styles/color-panel.js.map +1 -0
- package/build-module/components/global-styles/context-menu.js +41 -0
- package/build-module/components/global-styles/context-menu.js.map +1 -0
- package/build-module/components/{sidebar → global-styles}/dimensions-panel.js +6 -7
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -0
- package/build-module/components/global-styles/header.js +41 -0
- package/build-module/components/global-styles/header.js.map +1 -0
- package/build-module/components/global-styles/index.js +70 -0
- package/build-module/components/global-styles/index.js.map +1 -0
- package/build-module/components/global-styles/navigation-button.js +31 -0
- package/build-module/components/global-styles/navigation-button.js.map +1 -0
- package/build-module/components/global-styles/palette.js +43 -0
- package/build-module/components/global-styles/palette.js.map +1 -0
- package/build-module/components/global-styles/preview.js +50 -0
- package/build-module/components/global-styles/preview.js.map +1 -0
- package/build-module/components/global-styles/screen-block-list.js +58 -0
- package/build-module/components/global-styles/screen-block-list.js.map +1 -0
- package/build-module/components/global-styles/screen-block.js +32 -0
- package/build-module/components/global-styles/screen-block.js.map +1 -0
- package/build-module/components/global-styles/screen-color-palette.js +35 -0
- package/build-module/components/global-styles/screen-color-palette.js.map +1 -0
- package/build-module/components/global-styles/screen-colors.js +38 -0
- package/build-module/components/global-styles/screen-colors.js.map +1 -0
- package/build-module/components/global-styles/screen-layout.js +44 -0
- package/build-module/components/global-styles/screen-layout.js.map +1 -0
- package/build-module/components/global-styles/screen-root.js +29 -0
- package/build-module/components/global-styles/screen-root.js.map +1 -0
- package/build-module/components/global-styles/screen-typography.js +37 -0
- package/build-module/components/global-styles/screen-typography.js.map +1 -0
- package/build-module/components/global-styles/subtitle.js +17 -0
- package/build-module/components/global-styles/subtitle.js.map +1 -0
- package/build-module/components/{sidebar → global-styles}/typography-panel.js +1 -2
- package/build-module/components/global-styles/typography-panel.js.map +1 -0
- package/build-module/components/header/plugin-more-menu-item/index.js +70 -0
- package/build-module/components/header/plugin-more-menu-item/index.js.map +1 -0
- package/build-module/components/header/plugin-sidebar-more-menu-item/index.js +64 -0
- package/build-module/components/header/plugin-sidebar-more-menu-item/index.js.map +1 -0
- package/build-module/components/header/undo-redo/redo.js +1 -1
- package/build-module/components/header/undo-redo/redo.js.map +1 -1
- package/build-module/components/header/undo-redo/undo.js +1 -1
- package/build-module/components/header/undo-redo/undo.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +3 -11
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/navigation-sidebar/index.js +1 -1
- package/build-module/components/navigation-sidebar/index.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-panel/constants.js +5 -3
- package/build-module/components/navigation-sidebar/navigation-panel/constants.js.map +1 -1
- package/build-module/components/save-button/index.js +1 -1
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/secondary-sidebar/inserter-sidebar.js +2 -1
- package/build-module/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
- package/build-module/components/sidebar/global-styles-sidebar.js +13 -159
- package/build-module/components/sidebar/global-styles-sidebar.js.map +1 -1
- package/build-module/components/sidebar/index.js +2 -7
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar/plugin-sidebar/index.js +84 -0
- package/build-module/components/sidebar/plugin-sidebar/index.js.map +1 -0
- package/build-module/components/template-details/index.js +13 -8
- package/build-module/components/template-details/index.js.map +1 -1
- package/build-module/components/template-details/template-areas.js +60 -0
- package/build-module/components/template-details/template-areas.js.map +1 -0
- package/build-module/components/template-part-converter/index.js +1 -1
- package/build-module/components/template-part-converter/index.js.map +1 -1
- package/build-module/components/url-query-controller/index.js +1 -1
- package/build-module/components/url-query-controller/index.js.map +1 -1
- package/build-module/index.js +3 -0
- package/build-module/index.js.map +1 -1
- package/build-module/store/actions.js +45 -1
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/constants.js +13 -0
- package/build-module/store/constants.js.map +1 -1
- package/build-module/store/reducer.js +16 -7
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +85 -9
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +122 -17
- package/build-style/style.css +122 -17
- package/package.json +26 -26
- package/src/components/block-editor/back-button.js +44 -0
- package/src/components/block-editor/index.js +16 -1
- package/src/components/block-editor/style.scss +26 -0
- package/src/components/edit-template-part-menu-button/index.js +57 -0
- package/src/components/editor/global-styles-provider.js +1 -1
- package/src/components/editor/index.js +5 -8
- package/src/components/editor/utils.js +1 -0
- package/src/components/{sidebar → global-styles}/border-panel.js +0 -0
- package/src/components/{sidebar → global-styles}/color-palette-panel.js +13 -11
- package/src/components/{sidebar → global-styles}/color-panel.js +12 -17
- package/src/components/global-styles/context-menu.js +54 -0
- package/src/components/{sidebar → global-styles}/dimensions-panel.js +6 -10
- package/src/components/global-styles/header.js +50 -0
- package/src/components/global-styles/index.js +81 -0
- package/src/components/global-styles/navigation-button.js +35 -0
- package/src/components/global-styles/palette.js +67 -0
- package/src/components/global-styles/preview.js +41 -0
- package/src/components/global-styles/screen-block-list.js +59 -0
- package/src/components/global-styles/screen-block.js +28 -0
- package/src/components/global-styles/screen-color-palette.js +33 -0
- package/src/components/global-styles/screen-colors.js +36 -0
- package/src/components/global-styles/screen-layout.js +45 -0
- package/src/components/global-styles/screen-root.js +43 -0
- package/src/components/global-styles/screen-typography.js +33 -0
- package/src/components/global-styles/style.scss +35 -0
- package/src/components/global-styles/subtitle.js +10 -0
- package/src/components/{sidebar → global-styles}/typography-panel.js +1 -2
- package/src/components/header/plugin-more-menu-item/index.js +71 -0
- package/src/components/header/plugin-sidebar-more-menu-item/index.js +64 -0
- package/src/components/header/undo-redo/redo.js +4 -1
- package/src/components/header/undo-redo/undo.js +4 -1
- package/src/components/keyboard-shortcuts/index.js +25 -40
- package/src/components/navigation-sidebar/index.js +1 -1
- package/src/components/navigation-sidebar/navigation-panel/constants.js +9 -4
- package/src/components/navigation-sidebar/navigation-panel/style.scss +1 -0
- package/src/components/save-button/index.js +1 -1
- package/src/components/secondary-sidebar/inserter-sidebar.js +1 -0
- package/src/components/sidebar/global-styles-sidebar.js +14 -187
- package/src/components/sidebar/index.js +2 -7
- package/src/components/sidebar/plugin-sidebar/index.js +80 -0
- package/src/components/sidebar/style.scss +40 -0
- package/src/components/template-details/index.js +17 -7
- package/src/components/template-details/style.scss +36 -27
- package/src/components/template-details/template-areas.js +66 -0
- package/src/components/template-part-converter/index.js +1 -1
- package/src/components/url-query-controller/index.js +1 -1
- package/src/index.js +3 -0
- package/src/store/actions.js +53 -1
- package/src/store/constants.js +15 -0
- package/src/store/reducer.js +26 -12
- package/src/store/selectors.js +96 -9
- package/src/store/test/reducer.js +40 -23
- package/src/store/test/selectors.js +34 -3
- package/src/style.scss +1 -0
- package/build/components/sidebar/border-panel.js.map +0 -1
- package/build/components/sidebar/color-palette-panel.js.map +0 -1
- package/build/components/sidebar/color-panel.js.map +0 -1
- package/build/components/sidebar/dimensions-panel.js.map +0 -1
- package/build/components/sidebar/typography-panel.js.map +0 -1
- package/build-module/components/sidebar/border-panel.js.map +0 -1
- package/build-module/components/sidebar/color-palette-panel.js.map +0 -1
- package/build-module/components/sidebar/color-panel.js.map +0 -1
- package/build-module/components/sidebar/dimensions-panel.js.map +0 -1
- package/build-module/components/sidebar/typography-panel.js.map +0 -1
package/src/store/constants.js
CHANGED
|
@@ -1,6 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
7
|
* The identifier for the data store.
|
|
3
8
|
*
|
|
4
9
|
* @type {string}
|
|
5
10
|
*/
|
|
6
11
|
export const STORE_NAME = 'core/edit-site';
|
|
12
|
+
|
|
13
|
+
export const TEMPLATE_PART_AREA_HEADER = 'header';
|
|
14
|
+
export const TEMPLATE_PART_AREA_FOOTER = 'footer';
|
|
15
|
+
export const TEMPLATE_PART_AREA_SIDEBAR = 'sidebar';
|
|
16
|
+
|
|
17
|
+
export const TEMPLATE_PART_AREA_TO_NAME = {
|
|
18
|
+
[ TEMPLATE_PART_AREA_HEADER ]: __( 'Header' ),
|
|
19
|
+
[ TEMPLATE_PART_AREA_FOOTER ]: __( 'Footer' ),
|
|
20
|
+
[ TEMPLATE_PART_AREA_SIDEBAR ]: __( 'Sidebar' ),
|
|
21
|
+
};
|
package/src/store/reducer.js
CHANGED
|
@@ -72,25 +72,39 @@ export function settings( state = {}, action ) {
|
|
|
72
72
|
* Reducer keeping track of the currently edited Post Type,
|
|
73
73
|
* Post Id and the context provided to fill the content of the block editor.
|
|
74
74
|
*
|
|
75
|
-
* @param {
|
|
75
|
+
* @param {Array} state Current state history.
|
|
76
76
|
* @param {Object} action Dispatched action.
|
|
77
77
|
*
|
|
78
|
-
* @return {
|
|
78
|
+
* @return {Array} Updated state.
|
|
79
79
|
*/
|
|
80
|
-
export function editedPost( state =
|
|
80
|
+
export function editedPost( state = [], action ) {
|
|
81
81
|
switch ( action.type ) {
|
|
82
82
|
case 'SET_TEMPLATE':
|
|
83
83
|
case 'SET_PAGE':
|
|
84
|
-
return
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
84
|
+
return [
|
|
85
|
+
{
|
|
86
|
+
type: 'wp_template',
|
|
87
|
+
id: action.templateId,
|
|
88
|
+
page: action.page,
|
|
89
|
+
},
|
|
90
|
+
];
|
|
89
91
|
case 'SET_TEMPLATE_PART':
|
|
90
|
-
return
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
return [
|
|
93
|
+
{
|
|
94
|
+
type: 'wp_template_part',
|
|
95
|
+
id: action.templatePartId,
|
|
96
|
+
},
|
|
97
|
+
];
|
|
98
|
+
case 'PUSH_TEMPLATE_PART':
|
|
99
|
+
return [
|
|
100
|
+
...state,
|
|
101
|
+
{
|
|
102
|
+
type: 'wp_template_part',
|
|
103
|
+
id: action.templatePartId,
|
|
104
|
+
},
|
|
105
|
+
];
|
|
106
|
+
case 'GO_BACK':
|
|
107
|
+
return state.slice( 0, -1 );
|
|
94
108
|
}
|
|
95
109
|
|
|
96
110
|
return state;
|
package/src/store/selectors.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { get, map } from 'lodash';
|
|
4
|
+
import { get, map, keyBy } from 'lodash';
|
|
5
5
|
import createSelector from 'rememo';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -10,6 +10,7 @@ import createSelector from 'rememo';
|
|
|
10
10
|
import { store as coreDataStore } from '@wordpress/core-data';
|
|
11
11
|
import { createRegistrySelector } from '@wordpress/data';
|
|
12
12
|
import { uploadMedia } from '@wordpress/media-utils';
|
|
13
|
+
import { isTemplatePart } from '@wordpress/blocks';
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* Internal dependencies
|
|
@@ -25,6 +26,10 @@ import {
|
|
|
25
26
|
isTemplateSuperseded,
|
|
26
27
|
} from '../components/navigation-sidebar/navigation-panel/template-hierarchy';
|
|
27
28
|
|
|
29
|
+
/**
|
|
30
|
+
* @typedef {'template'|'template_type'} TemplateType Template type.
|
|
31
|
+
*/
|
|
32
|
+
|
|
28
33
|
/**
|
|
29
34
|
* Returns whether the given feature is enabled or not.
|
|
30
35
|
*
|
|
@@ -110,15 +115,23 @@ export function getHomeTemplateId( state ) {
|
|
|
110
115
|
return state.homeTemplateId;
|
|
111
116
|
}
|
|
112
117
|
|
|
118
|
+
function getCurrentEditedPost( state ) {
|
|
119
|
+
return state.editedPost[ state.editedPost.length - 1 ] || {};
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function getPreviousEditedPost( state ) {
|
|
123
|
+
return state.editedPost[ state.editedPost.length - 2 ] || {};
|
|
124
|
+
}
|
|
125
|
+
|
|
113
126
|
/**
|
|
114
127
|
* Returns the current edited post type (wp_template or wp_template_part).
|
|
115
128
|
*
|
|
116
129
|
* @param {Object} state Global application state.
|
|
117
130
|
*
|
|
118
|
-
* @return {
|
|
131
|
+
* @return {TemplateType?} Template type.
|
|
119
132
|
*/
|
|
120
133
|
export function getEditedPostType( state ) {
|
|
121
|
-
return state.
|
|
134
|
+
return getCurrentEditedPost( state ).type;
|
|
122
135
|
}
|
|
123
136
|
|
|
124
137
|
/**
|
|
@@ -126,10 +139,32 @@ export function getEditedPostType( state ) {
|
|
|
126
139
|
*
|
|
127
140
|
* @param {Object} state Global application state.
|
|
128
141
|
*
|
|
129
|
-
* @return {
|
|
142
|
+
* @return {string?} Post ID.
|
|
130
143
|
*/
|
|
131
144
|
export function getEditedPostId( state ) {
|
|
132
|
-
return state.
|
|
145
|
+
return getCurrentEditedPost( state ).id;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Returns the previous edited post type (wp_template or wp_template_part).
|
|
150
|
+
*
|
|
151
|
+
* @param {Object} state Global application state.
|
|
152
|
+
*
|
|
153
|
+
* @return {TemplateType?} Template type.
|
|
154
|
+
*/
|
|
155
|
+
export function getPreviousEditedPostType( state ) {
|
|
156
|
+
return getPreviousEditedPost( state ).type;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Returns the ID of the previous edited template or template part.
|
|
161
|
+
*
|
|
162
|
+
* @param {Object} state Global application state.
|
|
163
|
+
*
|
|
164
|
+
* @return {string?} Post ID.
|
|
165
|
+
*/
|
|
166
|
+
export function getPreviousEditedPostId( state ) {
|
|
167
|
+
return getPreviousEditedPost( state ).id;
|
|
133
168
|
}
|
|
134
169
|
|
|
135
170
|
/**
|
|
@@ -140,7 +175,7 @@ export function getEditedPostId( state ) {
|
|
|
140
175
|
* @return {Object} Page.
|
|
141
176
|
*/
|
|
142
177
|
export function getPage( state ) {
|
|
143
|
-
return state.
|
|
178
|
+
return getCurrentEditedPost( state ).page;
|
|
144
179
|
}
|
|
145
180
|
|
|
146
181
|
/**
|
|
@@ -239,11 +274,15 @@ export function isInserterOpened( state ) {
|
|
|
239
274
|
*
|
|
240
275
|
* @param {Object} state Global application state.
|
|
241
276
|
*
|
|
242
|
-
* @return {Object} The root client ID
|
|
277
|
+
* @return {Object} The root client ID, index to insert at and starting filter value.
|
|
243
278
|
*/
|
|
244
279
|
export function __experimentalGetInsertionPoint( state ) {
|
|
245
|
-
const {
|
|
246
|
-
|
|
280
|
+
const {
|
|
281
|
+
rootClientId,
|
|
282
|
+
insertionIndex,
|
|
283
|
+
filterValue,
|
|
284
|
+
} = state.blockInserterPanel;
|
|
285
|
+
return { rootClientId, insertionIndex, filterValue };
|
|
247
286
|
}
|
|
248
287
|
|
|
249
288
|
/**
|
|
@@ -256,3 +295,51 @@ export function __experimentalGetInsertionPoint( state ) {
|
|
|
256
295
|
export function isListViewOpened( state ) {
|
|
257
296
|
return state.listViewPanel;
|
|
258
297
|
}
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Returns the template part blocks grouped by areas for the current edited template.
|
|
301
|
+
*
|
|
302
|
+
* @param {Object} state Global application state.
|
|
303
|
+
* @return {Object} Template part blocks by areas.
|
|
304
|
+
*/
|
|
305
|
+
export const getTemplateAreaBlocks = createRegistrySelector(
|
|
306
|
+
( select ) => ( state ) => {
|
|
307
|
+
const templateType = getEditedPostType( state );
|
|
308
|
+
const templateId = getEditedPostId( state );
|
|
309
|
+
const template = select( coreDataStore ).getEditedEntityRecord(
|
|
310
|
+
'postType',
|
|
311
|
+
templateType,
|
|
312
|
+
templateId
|
|
313
|
+
);
|
|
314
|
+
|
|
315
|
+
const templateParts = select( coreDataStore ).getEntityRecords(
|
|
316
|
+
'postType',
|
|
317
|
+
'wp_template_part',
|
|
318
|
+
{
|
|
319
|
+
per_page: -1,
|
|
320
|
+
}
|
|
321
|
+
);
|
|
322
|
+
const templatePartsById = keyBy(
|
|
323
|
+
templateParts,
|
|
324
|
+
( templatePart ) => templatePart.id
|
|
325
|
+
);
|
|
326
|
+
|
|
327
|
+
const templatePartBlocksByAreas = {};
|
|
328
|
+
|
|
329
|
+
for ( const block of template.blocks ?? [] ) {
|
|
330
|
+
if ( isTemplatePart( block ) ) {
|
|
331
|
+
const {
|
|
332
|
+
attributes: { theme, slug },
|
|
333
|
+
} = block;
|
|
334
|
+
const templatePartId = `${ theme }//${ slug }`;
|
|
335
|
+
const templatePart = templatePartsById[ templatePartId ];
|
|
336
|
+
|
|
337
|
+
if ( templatePart ) {
|
|
338
|
+
templatePartBlocksByAreas[ templatePart.area ] = block;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
return templatePartBlocksByAreas;
|
|
344
|
+
}
|
|
345
|
+
);
|
|
@@ -88,49 +88,66 @@ describe( 'state', () => {
|
|
|
88
88
|
|
|
89
89
|
describe( 'editedPost()', () => {
|
|
90
90
|
it( 'should apply default state', () => {
|
|
91
|
-
expect( editedPost( undefined, {} ) ).toEqual(
|
|
91
|
+
expect( editedPost( undefined, {} ) ).toEqual( [] );
|
|
92
92
|
} );
|
|
93
93
|
|
|
94
94
|
it( 'should default to returning the same state', () => {
|
|
95
|
-
const state =
|
|
95
|
+
const state = [];
|
|
96
96
|
expect( editedPost( state, {} ) ).toBe( state );
|
|
97
97
|
} );
|
|
98
98
|
|
|
99
99
|
it( 'should update when a template is set', () => {
|
|
100
100
|
expect(
|
|
101
|
-
editedPost(
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
)
|
|
108
|
-
).toEqual( { id: 2, type: 'wp_template' } );
|
|
101
|
+
editedPost( [ { id: 1, type: 'wp_template' } ], {
|
|
102
|
+
type: 'SET_TEMPLATE',
|
|
103
|
+
templateId: 2,
|
|
104
|
+
} )
|
|
105
|
+
).toEqual( [ { id: 2, type: 'wp_template' } ] );
|
|
109
106
|
} );
|
|
110
107
|
|
|
111
108
|
it( 'should update when a page is set', () => {
|
|
112
109
|
expect(
|
|
113
|
-
editedPost(
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
}
|
|
120
|
-
)
|
|
121
|
-
).toEqual( { id: 2, type: 'wp_template', page: {} } );
|
|
110
|
+
editedPost( [ { id: 1, type: 'wp_template' } ], {
|
|
111
|
+
type: 'SET_PAGE',
|
|
112
|
+
templateId: 2,
|
|
113
|
+
page: {},
|
|
114
|
+
} )
|
|
115
|
+
).toEqual( [ { id: 2, type: 'wp_template', page: {} } ] );
|
|
122
116
|
} );
|
|
123
117
|
|
|
124
118
|
it( 'should update when a template part is set', () => {
|
|
119
|
+
expect(
|
|
120
|
+
editedPost( [ { id: 1, type: 'wp_template' } ], {
|
|
121
|
+
type: 'SET_TEMPLATE_PART',
|
|
122
|
+
templatePartId: 2,
|
|
123
|
+
} )
|
|
124
|
+
).toEqual( [ { id: 2, type: 'wp_template_part' } ] );
|
|
125
|
+
} );
|
|
126
|
+
|
|
127
|
+
it( 'should update when a template part is pushed', () => {
|
|
128
|
+
expect(
|
|
129
|
+
editedPost( [ { id: 1, type: 'wp_template' } ], {
|
|
130
|
+
type: 'PUSH_TEMPLATE_PART',
|
|
131
|
+
templatePartId: 2,
|
|
132
|
+
} )
|
|
133
|
+
).toEqual( [
|
|
134
|
+
{ id: 1, type: 'wp_template' },
|
|
135
|
+
{ id: 2, type: 'wp_template_part' },
|
|
136
|
+
] );
|
|
137
|
+
} );
|
|
138
|
+
|
|
139
|
+
it( 'should go back to the previous page', () => {
|
|
125
140
|
expect(
|
|
126
141
|
editedPost(
|
|
127
|
-
|
|
142
|
+
[
|
|
143
|
+
{ id: 1, type: 'wp_template' },
|
|
144
|
+
{ id: 2, type: 'wp_template_part' },
|
|
145
|
+
],
|
|
128
146
|
{
|
|
129
|
-
type: '
|
|
130
|
-
templatePartId: 2,
|
|
147
|
+
type: 'GO_BACK',
|
|
131
148
|
}
|
|
132
149
|
)
|
|
133
|
-
).toEqual( { id:
|
|
150
|
+
).toEqual( [ { id: 1, type: 'wp_template' } ] );
|
|
134
151
|
} );
|
|
135
152
|
} );
|
|
136
153
|
|
|
@@ -13,6 +13,8 @@ import {
|
|
|
13
13
|
getHomeTemplateId,
|
|
14
14
|
getEditedPostType,
|
|
15
15
|
getEditedPostId,
|
|
16
|
+
getPreviousEditedPostType,
|
|
17
|
+
getPreviousEditedPostId,
|
|
16
18
|
getPage,
|
|
17
19
|
getNavigationPanelActiveMenu,
|
|
18
20
|
isNavigationOpened,
|
|
@@ -126,22 +128,51 @@ describe( 'selectors', () => {
|
|
|
126
128
|
|
|
127
129
|
describe( 'getEditedPostId', () => {
|
|
128
130
|
it( 'returns the template ID', () => {
|
|
129
|
-
const state = { editedPost: { id: 10 } };
|
|
131
|
+
const state = { editedPost: [ { id: 10 } ] };
|
|
130
132
|
expect( getEditedPostId( state ) ).toBe( 10 );
|
|
131
133
|
} );
|
|
132
134
|
} );
|
|
133
135
|
|
|
134
136
|
describe( 'getEditedPostType', () => {
|
|
135
137
|
it( 'returns the template type', () => {
|
|
136
|
-
const state = { editedPost: { type: 'wp_template' } };
|
|
138
|
+
const state = { editedPost: [ { type: 'wp_template' } ] };
|
|
137
139
|
expect( getEditedPostType( state ) ).toBe( 'wp_template' );
|
|
138
140
|
} );
|
|
139
141
|
} );
|
|
140
142
|
|
|
143
|
+
describe( 'getPreviousEditedPostId', () => {
|
|
144
|
+
it( 'returns the previous template ID', () => {
|
|
145
|
+
const state = { editedPost: [ { id: 10 }, { id: 20 } ] };
|
|
146
|
+
expect( getPreviousEditedPostId( state ) ).toBe( 10 );
|
|
147
|
+
} );
|
|
148
|
+
|
|
149
|
+
it( 'returns undefined when there are no previous pages', () => {
|
|
150
|
+
const state = { editedPost: [ { id: 10 } ] };
|
|
151
|
+
expect( getPreviousEditedPostId( state ) ).toBeUndefined();
|
|
152
|
+
} );
|
|
153
|
+
} );
|
|
154
|
+
|
|
155
|
+
describe( 'getPreviousEditedPostType', () => {
|
|
156
|
+
it( 'returns the previous template type', () => {
|
|
157
|
+
const state = {
|
|
158
|
+
editedPost: [
|
|
159
|
+
{ type: 'wp_template' },
|
|
160
|
+
{ type: 'wp_template_part' },
|
|
161
|
+
],
|
|
162
|
+
};
|
|
163
|
+
expect( getPreviousEditedPostType( state ) ).toBe( 'wp_template' );
|
|
164
|
+
} );
|
|
165
|
+
|
|
166
|
+
it( 'returns undefined when there are no previous pages', () => {
|
|
167
|
+
const state = { editedPost: [ { type: 'wp_template' } ] };
|
|
168
|
+
expect( getPreviousEditedPostType( state ) ).toBeUndefined();
|
|
169
|
+
} );
|
|
170
|
+
} );
|
|
171
|
+
|
|
141
172
|
describe( 'getPage', () => {
|
|
142
173
|
it( 'returns the page object', () => {
|
|
143
174
|
const page = {};
|
|
144
|
-
const state = { editedPost: { page } };
|
|
175
|
+
const state = { editedPost: [ { page } ] };
|
|
145
176
|
expect( getPage( state ) ).toBe( page );
|
|
146
177
|
} );
|
|
147
178
|
} );
|
package/src/style.scss
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
@import "../../interface/src/style.scss";
|
|
2
2
|
|
|
3
3
|
@import "./components/block-editor/style.scss";
|
|
4
|
+
@import "./components/global-styles/style.scss";
|
|
4
5
|
@import "./components/header/style.scss";
|
|
5
6
|
@import "./components/header/document-actions/style.scss";
|
|
6
7
|
@import "./components/header/more-menu/style.scss";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/border-panel.js"],"names":["MIN_BORDER_WIDTH","EMPTY_ARRAY","useHasBorderPanel","supports","name","controls","useHasBorderColorControl","useHasBorderRadiusControl","useHasBorderStyleControl","useHasBorderWidthControl","some","Boolean","includes","BorderPanel","context","getStyle","setStyle","units","availableUnits","hasBorderWidth","borderWidthValue","hasBorderStyle","borderStyle","colors","disableCustomColors","disableCustomGradients","hasBorderColor","borderColor","hasBorderRadius","borderRadiusValues","value","undefined"],"mappings":";;;;;;;;;;AAGA;;AAKA;;AAKA;;AAKA;;AAlBA;AACA;AACA;;AAaA;AACA;AACA;AAGA,MAAMA,gBAAgB,GAAG,CAAzB,C,CAEA;AACA;;AACA,MAAMC,WAAW,GAAG,EAApB;;AAEO,SAASC,iBAAT,CAA4B;AAAEC,EAAAA,QAAF;AAAYC,EAAAA;AAAZ,CAA5B,EAAiD;AACvD,QAAMC,QAAQ,GAAG,CAChBC,wBAAwB,CAAE;AAAEH,IAAAA,QAAF;AAAYC,IAAAA;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OAAJ,CAFT;AAGC,IAAA,GAAG,EAAGpB,gBAHP;AAIC,IAAA,QAAQ,EAAK8B,KAAF,IAAa;AACvBd,MAAAA,QAAQ,CACPZ,IADO,EAEP,aAFO,EAGP0B,KAAK,IAAIC,SAHF,CAAR;AAKA,KAVF;AAWC,IAAA,KAAK,EAAGd;AAXT,IAFF,EAgBGI,cAAc,IACf,4BAAC,6CAAD;AACC,IAAA,KAAK,EAAGC,WADT;AAEC,IAAA,QAAQ,EAAKQ,KAAF,IACVd,QAAQ,CAAEZ,IAAF,EAAQ,aAAR,EAAuB0B,KAAvB;AAHV,IAjBF,CAFF,EA4BGJ,cAAc,IACf,4BAAC,+CAAD;AACC,IAAA,KAAK,EAAG,cAAI,OAAJ,CADT;AAEC,IAAA,UAAU,EAAGC,WAFd;AAGC,IAAA,MAAM,EAAGJ,MAHV;AAIC,IAAA,SAAS,EAAGQ,SAJb;AAKC,IAAA,mBAAmB,EAAGP,mBALvB;AAMC,IAAA,sBAAsB,EAAGC,sBAN1B;AAOC,IAAA,aAAa,EAAKK,KAAF,IACfd,QAAQ,CAAEZ,IAAF,EAAQ,aAAR,EAAuB0B,KAAvB;AARV,IA7BF,EAyCGF,eAAe,IAChB,4BAAC,8CAAD;AACC,IAAA,MAAM,EAAGC,kBADV;AAEC,IAAA,QAAQ,EAAKC,KAAF,IACVd,QAAQ,CAAEZ,IAAF,EAAQ,cAAR,EAAwB0B,KAAxB;AAHV,IA1CF,CADD;AAoDA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalBorderRadiusControl as BorderRadiusControl,\n\t__experimentalBorderStyleControl as BorderStyleControl,\n\t__experimentalColorGradientControl as ColorGradientControl,\n} from '@wordpress/block-editor';\nimport {\n\tPanelBody,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalUseCustomUnits as useCustomUnits,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { useSetting } from '../editor/utils';\n\nconst MIN_BORDER_WIDTH = 0;\n\n// Defining empty array here instead of inline avoids unnecessary re-renders of\n// color control.\nconst EMPTY_ARRAY = [];\n\nexport function useHasBorderPanel( { supports, name } ) {\n\tconst controls = [\n\t\tuseHasBorderColorControl( { supports, name } ),\n\t\tuseHasBorderRadiusControl( { supports, name } ),\n\t\tuseHasBorderStyleControl( { supports, name } ),\n\t\tuseHasBorderWidthControl( { supports, name } ),\n\t];\n\n\treturn controls.some( Boolean );\n}\n\nfunction useHasBorderColorControl( { supports, name } ) {\n\treturn (\n\t\tuseSetting( 'border.customColor', name ) &&\n\t\tsupports.includes( 'borderColor' )\n\t);\n}\n\nfunction useHasBorderRadiusControl( { supports, name } ) {\n\treturn (\n\t\tuseSetting( 'border.customRadius', name ) &&\n\t\tsupports.includes( 'borderRadius' )\n\t);\n}\n\nfunction useHasBorderStyleControl( { supports, name } ) {\n\treturn (\n\t\tuseSetting( 'border.customStyle', name ) &&\n\t\tsupports.includes( 'borderStyle' )\n\t);\n}\n\nfunction useHasBorderWidthControl( { supports, name } ) {\n\treturn (\n\t\tuseSetting( 'border.customWidth', name ) &&\n\t\tsupports.includes( 'borderWidth' )\n\t);\n}\n\nexport default function BorderPanel( {\n\tcontext: { supports, name },\n\tgetStyle,\n\tsetStyle,\n} ) {\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: useSetting( 'spacing.units' ) || [ 'px', 'em', 'rem' ],\n\t} );\n\n\t// Border width.\n\tconst hasBorderWidth = useHasBorderWidthControl( { supports, name } );\n\tconst borderWidthValue = getStyle( name, 'borderWidth' );\n\n\t// Border style.\n\tconst hasBorderStyle = useHasBorderStyleControl( { supports, name } );\n\tconst borderStyle = getStyle( name, 'borderStyle' );\n\n\t// Border color.\n\tconst colors = useSetting( 'color.palette' ) || EMPTY_ARRAY;\n\tconst disableCustomColors = ! useSetting( 'color.custom' );\n\tconst disableCustomGradients = ! useSetting( 'color.customGradient' );\n\tconst hasBorderColor = useHasBorderColorControl( { supports, name } );\n\tconst borderColor = getStyle( name, 'borderColor' );\n\n\t// Border radius.\n\tconst hasBorderRadius = useHasBorderRadiusControl( { supports, name } );\n\tconst borderRadiusValues = getStyle( name, 'borderRadius' );\n\n\treturn (\n\t\t<PanelBody title={ __( 'Border' ) } initialOpen={ true }>\n\t\t\t{ ( hasBorderWidth || hasBorderStyle ) && (\n\t\t\t\t<div className=\"edit-site-global-styles-sidebar__border-controls-row\">\n\t\t\t\t\t{ hasBorderWidth && (\n\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\tvalue={ borderWidthValue }\n\t\t\t\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\t\t\t\tmin={ MIN_BORDER_WIDTH }\n\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\tsetStyle(\n\t\t\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\t\t\t'borderWidth',\n\t\t\t\t\t\t\t\t\tvalue || undefined\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ hasBorderStyle && (\n\t\t\t\t\t\t<BorderStyleControl\n\t\t\t\t\t\t\tvalue={ borderStyle }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetStyle( name, 'borderStyle', 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</div>\n\t\t\t) }\n\t\t\t{ hasBorderColor && (\n\t\t\t\t<ColorGradientControl\n\t\t\t\t\tlabel={ __( 'Color' ) }\n\t\t\t\t\tcolorValue={ borderColor }\n\t\t\t\t\tcolors={ colors }\n\t\t\t\t\tgradients={ undefined }\n\t\t\t\t\tdisableCustomColors={ disableCustomColors }\n\t\t\t\t\tdisableCustomGradients={ disableCustomGradients }\n\t\t\t\t\tonColorChange={ ( value ) =>\n\t\t\t\t\t\tsetStyle( name, 'borderColor', value )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasBorderRadius && (\n\t\t\t\t<BorderRadiusControl\n\t\t\t\t\tvalues={ borderRadiusValues }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetStyle( name, 'borderRadius', value )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t</PanelBody>\n\t);\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/color-palette-panel.js"],"names":["EMPTY_ARRAY","ColorPalettePanel","contextName","getSetting","setSetting","colors","userColors","immutableColorSlugs","select","baseStyles","editSiteStore","getSettings","__experimentalGlobalStylesBaseStyles","contextualBasePalette","globalPalette","basePalette","theme","core","map","slug","newColors"],"mappings":";;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AAKA;;AACA;;AAhBA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,WAAW,GAAG,EAApB;;AAEe,SAASC,iBAAT,CAA4B;AAC1CC,EAAAA,WAD0C;AAE1CC,EAAAA,UAF0C;AAG1CC,EAAAA;AAH0C,CAA5B,EAIX;AACH,QAAMC,MAAM,GAAG,uBAAY,eAAZ,EAA6BH,WAA7B,CAAf;AACA,QAAMI,UAAU,GAAGH,UAAU,CAAED,WAAF,EAAe,eAAf,CAA7B;AACA,QAAMK,mBAAmB,GAAG,qBACzBC,MAAF,IAAc;AAAA;;AACb,UAAMC,UAAU,GAAGD,MAAM,CAAEE,YAAF,CAAN,CAAwBC,WAAxB,GACjBC,oCADF;;AAEA,UAAMC,qBAAqB,GAAG,iBAAKJ,UAAL,EAAiB,CAC9C,UAD8C,EAE9C,QAF8C,EAG9CP,WAH8C,EAI9C,OAJ8C,EAK9C,SAL8C,CAAjB,CAA9B;AAOA,UAAMY,aAAa,GAAG,iBAAKL,UAAL,EAAiB,CACtC,UADsC,EAEtC,OAFsC,EAGtC,SAHsC,CAAjB,CAAtB;AAKA,UAAMM,WAAW,6CAChBF,qBADgB,aAChBA,qBADgB,uBAChBA,qBAAqB,CAAEG,KADP,yEAEhBH,qBAFgB,aAEhBA,qBAFgB,uBAEhBA,qBAAqB,CAAEI,IAFP,yCAGhBH,aAHgB,aAGhBA,aAHgB,uBAGhBA,aAAa,CAAEE,KAHC,uCAIhBF,aAJgB,aAIhBA,aAJgB,uBAIhBA,aAAa,CAAEG,IAJhB;;AAKA,QAAK,CAAEF,WAAP,EAAqB;AACpB,aAAOf,WAAP;AACA;;AACD,WAAOe,WAAW,CAACG,GAAZ,CAAiB,CAAE;AAAEC,MAAAA;AAAF,KAAF,KAAgBA,IAAjC,CAAP;AACA,GAzB0B,EA0B3B,CAAEjB,WAAF,CA1B2B,CAA5B;AA4BA,SACC,4BAAC,mCAAD;AACC,IAAA,mBAAmB,EAAGK,mBADvB;AAEC,IAAA,MAAM,EAAGF,MAFV;AAGC,IAAA,QAAQ,EAAKe,SAAF,IAAiB;AAC3BhB,MAAAA,UAAU,CAAEF,WAAF,EAAe,eAAf,EAAgCkB,SAAhC,CAAV;AACA,KALF;AAMC,IAAA,OAAO,EAAG,cACT,qEADS,CANX;AASC,IAAA,QAAQ,EAAGf,MAAM,KAAKC;AATvB,IADD;AAaA","sourcesContent":["/**\n * External dependencies\n */\nimport { get } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __experimentalColorEdit as ColorEdit } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useSetting } from '../editor/utils';\nimport { store as editSiteStore } from '../../store';\n\n/**\n * Shared reference to an empty array for cases where it is important to avoid\n * returning a new array reference on every invocation, as in a connected or\n * other pure component which performs `shouldComponentUpdate` check on props.\n * This should be used as a last resort, since the normalized data should be\n * maintained by the reducer result in state.\n *\n * @type {Array}\n */\nconst EMPTY_ARRAY = [];\n\nexport default function ColorPalettePanel( {\n\tcontextName,\n\tgetSetting,\n\tsetSetting,\n} ) {\n\tconst colors = useSetting( 'color.palette', contextName );\n\tconst userColors = getSetting( contextName, 'color.palette' );\n\tconst immutableColorSlugs = useSelect(\n\t\t( select ) => {\n\t\t\tconst baseStyles = select( editSiteStore ).getSettings()\n\t\t\t\t.__experimentalGlobalStylesBaseStyles;\n\t\t\tconst contextualBasePalette = get( baseStyles, [\n\t\t\t\t'settings',\n\t\t\t\t'blocks',\n\t\t\t\tcontextName,\n\t\t\t\t'color',\n\t\t\t\t'palette',\n\t\t\t] );\n\t\t\tconst globalPalette = get( baseStyles, [\n\t\t\t\t'settings',\n\t\t\t\t'color',\n\t\t\t\t'palette',\n\t\t\t] );\n\t\t\tconst basePalette =\n\t\t\t\tcontextualBasePalette?.theme ??\n\t\t\t\tcontextualBasePalette?.core ??\n\t\t\t\tglobalPalette?.theme ??\n\t\t\t\tglobalPalette?.core;\n\t\t\tif ( ! basePalette ) {\n\t\t\t\treturn EMPTY_ARRAY;\n\t\t\t}\n\t\t\treturn basePalette.map( ( { slug } ) => slug );\n\t\t},\n\t\t[ contextName ]\n\t);\n\treturn (\n\t\t<ColorEdit\n\t\t\timmutableColorSlugs={ immutableColorSlugs }\n\t\t\tcolors={ colors }\n\t\t\tonChange={ ( newColors ) => {\n\t\t\t\tsetSetting( contextName, 'color.palette', newColors );\n\t\t\t} }\n\t\t\temptyUI={ __(\n\t\t\t\t'Colors are empty! Add some colors to create your own color palette.'\n\t\t\t) }\n\t\t\tcanReset={ colors === userColors }\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/color-panel.js"],"names":["useHasColorPanel","supports","includes","ColorPanel","context","name","getStyle","setStyle","getSetting","setSetting","solids","gradients","areCustomSolidsEnabled","areCustomGradientsEnabled","isLinkEnabled","isTextEnabled","isBackgroundEnabled","hasLinkColor","length","hasTextColor","hasBackgroundColor","hasGradientColor","settings","color","userColor","push","colorValue","onColorChange","value","label","clearable","backgroundSettings","backgroundColor","userBackgroundColor","gradientSettings","gradient","userGradient","gradientValue","onGradientChange"],"mappings":";;;;;;;;;;;;AAGA;;AACA;;AAMA;;AACA;;AAXA;AACA;AACA;;AAIA;AACA;AACA;AAKO,SAASA,gBAAT,CAA2B;AAAEC,EAAAA;AAAF,CAA3B,EAA0C;AAChD,SACCA,QAAQ,CAACC,QAAT,CAAmB,OAAnB,KACAD,QAAQ,CAACC,QAAT,CAAmB,iBAAnB,CADA,IAEAD,QAAQ,CAACC,QAAT,CAAmB,YAAnB,CAFA,IAGAD,QAAQ,CAACC,QAAT,CAAmB,WAAnB,CAJD;AAMA;;AAEc,SAASC,UAAT,CAAqB;AACnCC,EAAAA,OAAO,EAAE;AAAEH,IAAAA,QAAF;AAAYI,IAAAA;AAAZ,GAD0B;AAEnCC,EAAAA,QAFmC;AAGnCC,EAAAA,QAHmC;AAInCC,EAAAA,UAJmC;AAKnCC,EAAAA;AALmC,CAArB,EAMX;AACH,QAAMC,MAAM,GAAG,uBAAY,eAAZ,EAA6BL,IAA7B,CAAf;AACA,QAAMM,SAAS,GAAG,uBAAY,iBAAZ,EAA+BN,IAA/B,CAAlB;AACA,QAAMO,sBAAsB,GAAG,uBAAY,cAAZ,EAA4BP,IAA5B,CAA/B;AACA,QAAMQ,yBAAyB,GAAG,uBACjC,sBADiC,EAEjCR,IAFiC,CAAlC;AAIA,QAAMS,aAAa,GAAG,uBAAY,YAAZ,EAA0BT,IAA1B,CAAtB;AACA,QAAMU,aAAa,GAAG,uBAAY,YAAZ,EAA0BV,IAA1B,CAAtB;AACA,QAAMW,mBAAmB,GAAG,uBAAY,kBAAZ,EAAgCX,IAAhC,CAA5B;AAEA,QAAMY,YAAY,GACjBhB,QAAQ,CAACC,QAAT,CAAmB,WAAnB,KACAY,aADA,KAEEJ,MAAM,CAACQ,MAAP,GAAgB,CAAhB,I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AAS,EAAEP,KAAK,KAAKC;AAJP,KAAf;AAMA;;AAED,SACC,4BAAC,qDAAD;AACC,IAAA,KAAK,EAAG,cAAI,OAAJ,CADT;AAEC,IAAA,QAAQ,EAAGF,QAFZ;AAGC,IAAA,MAAM,EAAGZ,MAHV;AAIC,IAAA,SAAS,EAAGC,SAJb;AAKC,IAAA,mBAAmB,EAAG,CAAEC,sBALzB;AAMC,IAAA,sBAAsB,EAAG,CAAEC;AAN5B,KAQC,4BAAC,0BAAD;AACC,IAAA,GAAG,EAAG,yBAAyBR,IADhC;AAEC,IAAA,WAAW,EAAGA,IAFf;AAGC,IAAA,UAAU,EAAGG,UAHd;AAIC,IAAA,UAAU,EAAGC;AAJd,IARD,CADD;AAiBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalPanelColorGradientSettings as PanelColorGradientSettings } from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\n\nimport { useSetting } from '../editor/utils';\nimport ColorPalettePanel from './color-palette-panel';\n\nexport function useHasColorPanel( { supports } ) {\n\treturn (\n\t\tsupports.includes( 'color' ) ||\n\t\tsupports.includes( 'backgroundColor' ) ||\n\t\tsupports.includes( 'background' ) ||\n\t\tsupports.includes( 'linkColor' )\n\t);\n}\n\nexport default function ColorPanel( {\n\tcontext: { supports, name },\n\tgetStyle,\n\tsetStyle,\n\tgetSetting,\n\tsetSetting,\n} ) {\n\tconst solids = useSetting( 'color.palette', name );\n\tconst gradients = useSetting( 'color.gradients', name );\n\tconst areCustomSolidsEnabled = useSetting( 'color.custom', name );\n\tconst areCustomGradientsEnabled = useSetting(\n\t\t'color.customGradient',\n\t\tname\n\t);\n\tconst isLinkEnabled = useSetting( 'color.link', name );\n\tconst isTextEnabled = useSetting( 'color.text', name );\n\tconst isBackgroundEnabled = useSetting( 'color.background', name );\n\n\tconst hasLinkColor =\n\t\tsupports.includes( 'linkColor' ) &&\n\t\tisLinkEnabled &&\n\t\t( solids.length > 0 || areCustomSolidsEnabled );\n\tconst hasTextColor =\n\t\tsupports.includes( 'color' ) &&\n\t\tisTextEnabled &&\n\t\t( solids.length > 0 || areCustomSolidsEnabled );\n\tconst hasBackgroundColor =\n\t\tsupports.includes( 'backgroundColor' ) &&\n\t\tisBackgroundEnabled &&\n\t\t( solids.length > 0 || areCustomSolidsEnabled );\n\tconst hasGradientColor =\n\t\tsupports.includes( 'background' ) &&\n\t\t( gradients.length > 0 || areCustomGradientsEnabled );\n\n\tconst settings = [];\n\n\tif ( hasTextColor ) {\n\t\tconst color = getStyle( name, 'color' );\n\t\tconst userColor = getStyle( name, 'color', 'user' );\n\t\tsettings.push( {\n\t\t\tcolorValue: color,\n\t\t\tonColorChange: ( value ) => setStyle( name, 'color', value ),\n\t\t\tlabel: __( 'Text color' ),\n\t\t\tclearable: color === userColor,\n\t\t} );\n\t}\n\n\tlet backgroundSettings = {};\n\tif ( hasBackgroundColor ) {\n\t\tconst backgroundColor = getStyle( name, 'backgroundColor' );\n\t\tconst userBackgroundColor = getStyle( name, 'backgroundColor', 'user' );\n\t\tbackgroundSettings = {\n\t\t\tcolorValue: backgroundColor,\n\t\t\tonColorChange: ( value ) =>\n\t\t\t\tsetStyle( name, 'backgroundColor', value ),\n\t\t};\n\t\tif ( backgroundColor ) {\n\t\t\tbackgroundSettings.clearable =\n\t\t\t\tbackgroundColor === userBackgroundColor;\n\t\t}\n\t}\n\n\tlet gradientSettings = {};\n\tif ( hasGradientColor ) {\n\t\tconst gradient = getStyle( name, 'background' );\n\t\tconst userGradient = getStyle( name, 'background', 'user' );\n\t\tgradientSettings = {\n\t\t\tgradientValue: gradient,\n\t\t\tonGradientChange: ( value ) =>\n\t\t\t\tsetStyle( name, 'background', value ),\n\t\t};\n\t\tif ( gradient ) {\n\t\t\tgradientSettings.clearable = gradient === userGradient;\n\t\t}\n\t}\n\n\tif ( hasBackgroundColor || hasGradientColor ) {\n\t\tsettings.push( {\n\t\t\t...backgroundSettings,\n\t\t\t...gradientSettings,\n\t\t\tlabel: __( 'Background color' ),\n\t\t} );\n\t}\n\n\tif ( hasLinkColor ) {\n\t\tconst color = getStyle( name, 'linkColor' );\n\t\tconst userColor = getStyle( name, 'linkColor', 'user' );\n\t\tsettings.push( {\n\t\t\tcolorValue: color,\n\t\t\tonColorChange: ( value ) => setStyle( name, 'linkColor', value ),\n\t\t\tlabel: __( 'Link color' ),\n\t\t\tclearable: color === userColor,\n\t\t} );\n\t}\n\n\treturn (\n\t\t<PanelColorGradientSettings\n\t\t\ttitle={ __( 'Color' ) }\n\t\t\tsettings={ settings }\n\t\t\tcolors={ solids }\n\t\t\tgradients={ gradients }\n\t\t\tdisableCustomColors={ ! areCustomSolidsEnabled }\n\t\t\tdisableCustomGradients={ ! areCustomGradientsEnabled }\n\t\t>\n\t\t\t<ColorPalettePanel\n\t\t\t\tkey={ 'color-palette-panel-' + name }\n\t\t\t\tcontextName={ name }\n\t\t\t\tgetSetting={ getSetting }\n\t\t\t\tsetSetting={ setSetting }\n\t\t\t/>\n\t\t</PanelColorGradientSettings>\n\t);\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/dimensions-panel.js"],"names":["AXIAL_SIDES","useHasDimensionsPanel","context","hasPadding","useHasPadding","hasMargin","useHasMargin","hasGap","useHasGap","name","supports","settings","includes","filterValuesBySides","values","sides","filteredValues","forEach","side","top","bottom","left","right","splitStyleValue","value","DimensionsPanel","getStyle","setStyle","showPaddingControl","showMarginControl","showGapControl","units","availableUnits","paddingValues","paddingSides","isAxialPadding","some","setPaddingValues","newPaddingValues","padding","resetPaddingValue","hasPaddingValue","Object","keys","length","marginValues","marginSides","isAxialMargin","setMarginValues","newMarginValues","margin","resetMarginValue","hasMarginValue","gapValue","setGapValue","newGapValue","resetGapValue","undefined","hasGapValue","resetAll"],"mappings":";;;;;;;;;;AAGA;;AACA;;AAOA;;AAKA;;AAhBA;AACA;AACA;;AAWA;AACA;AACA;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V;AAEC,IAAA,QAAQ,EAAGG,eAFZ;AAGC,IAAA,KAAK,EAAG,cAAI,QAAJ,CAHT;AAIC,IAAA,KAAK,EAAGF,WAJT;AAKC,IAAA,KAAK,EAAGf,KALT;AAMC,IAAA,UAAU,EAAG,KANd;AAOC,IAAA,WAAW,EAAGgB;AAPf,IAND,CAxBF,EAyCGjB,cAAc,IACf,4BAAC,wCAAD;AACC,IAAA,SAAS,EAAC,eADX;AAEC,IAAA,QAAQ,EAAG4B,WAFZ;AAGC,IAAA,KAAK,EAAG,cAAI,WAAJ,CAHT;AAIC,IAAA,UAAU,EAAGF,aAJd;AAKC,IAAA,gBAAgB,EAAG;AALpB,KAOC,4BAAC,qCAAD;AACC,IAAA,KAAK,EAAG,cAAI,WAAJ,CADT;AAEC,IAAA,GAAG,EAAG,CAFP;AAGC,IAAA,QAAQ,EAAGF,WAHZ;AAIC,IAAA,KAAK,EAAGvB,KAJT;AAKC,IAAA,KAAK,EAAGsB;AALT,IAPD,CA1CF,CADD;AA6DA","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 { useSetting } from '../editor/utils';\n\nconst AXIAL_SIDES = [ 'horizontal', 'vertical' ];\n\nexport function useHasDimensionsPanel( context ) {\n\tconst hasPadding = useHasPadding( context );\n\tconst hasMargin = useHasMargin( context );\n\tconst hasGap = useHasGap( context );\n\n\treturn hasPadding || hasMargin || hasGap;\n}\n\nfunction useHasPadding( { name, supports } ) {\n\tconst settings = useSetting( 'spacing.customPadding', name );\n\n\treturn settings && supports.includes( 'padding' );\n}\n\nfunction useHasMargin( { name, supports } ) {\n\tconst settings = useSetting( 'spacing.customMargin', name );\n\n\treturn settings && supports.includes( 'margin' );\n}\n\nfunction useHasGap( { name, supports } ) {\n\tconst settings = useSetting( 'spacing.blockGap', name );\n\n\treturn 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( { context, getStyle, setStyle } ) {\n\tconst { name } = context;\n\tconst showPaddingControl = useHasPadding( context );\n\tconst showMarginControl = useHasMargin( context );\n\tconst showGapControl = useHasGap( context );\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: useSetting( 'spacing.units', name ) || [\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 paddingValues = splitStyleValue( getStyle( name, 'padding' ) );\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\tsetStyle( name, 'padding', padding );\n\t};\n\tconst resetPaddingValue = () => setPaddingValues( {} );\n\tconst hasPaddingValue = () =>\n\t\tpaddingValues && Object.keys( paddingValues ).length;\n\n\tconst marginValues = splitStyleValue( getStyle( name, 'margin' ) );\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\tsetStyle( name, 'margin', margin );\n\t};\n\tconst resetMarginValue = () => setMarginValues( {} );\n\tconst hasMarginValue = () =>\n\t\tmarginValues && Object.keys( marginValues ).length;\n\n\tconst gapValue = getStyle( name, '--wp--style--block-gap' );\n\n\tconst setGapValue = ( newGapValue ) => {\n\t\tsetStyle( name, '--wp--style--block-gap', newGapValue );\n\t};\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\n\t\t\tlabel={ __( 'Dimensions options' ) }\n\t\t\theader={ __( 'Dimensions' ) }\n\t\t\tresetAll={ resetAll }\n\t\t>\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\tclassName=\"single-column\"\n\t\t\t\t\thasValue={ hasGapValue }\n\t\t\t\t\tlabel={ __( 'Block gap' ) }\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 gap' ) }\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"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/typography-panel.js"],"names":["useHasTypographyPanel","supports","name","hasLineHeight","useHasLineHeightControl","hasFontAppearance","useHasAppearanceControl","hasLetterSpacing","useHasLetterSpacingControl","includes","hasFontStyles","hasFontWeights","TypographyPanel","context","getStyle","setStyle","fontSizes","disableCustomFontSizes","fontFamilies","hasLineHeightEnabled","hasAppearanceControl","hasLetterSpacingControl","value","fontStyle","fontWeight"],"mappings":";;;;;;;;;;AAGA;;AAMA;;AACA;;AAKA;;AAfA;AACA;AACA;;AAUA;AACA;AACA;AAGO,SAASA,qBAAT,CAAgC;AAAEC,EAAAA,QAAF;AAAYC,EAAAA;AAAZ,CAAhC,EAAqD;AAC3D,QAAMC,aAAa,GAAGC,uBAAuB,CAAE;AAAEH,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,GAAF,CAA7C;AACA,QAAMG,iBAAiB,GAAGC,uBAAuB,CAAE;AAAEL,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,GAAF,CAAjD;AACA,QAAMK,gBAAgB,GAAGC,0BAA0B,CAAE;AAAEP,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,GAAF,CAAnD;AACA,SACCC,aAAa,IACbE,iBADA,IAEAE,gBAFA,IAGAN,QAAQ,CAACQ,QAAT,CAAmB,UAAnB,CAJD;AAMA;;AAED,SAASL,uBAAT,CAAkC;AAAEH,EAAAA,QAAF;AAAYC,EAAAA;AAAZ,CAAlC,EAAuD;AACtD,SACC,uBAAY,6BAAZ,EAA2CA,IAA3C,KACAD,QAAQ,CAACQ,QAAT,CAAmB,YAAnB,CAFD;AAIA;;AAED,SAASH,uBAAT,CAAkC;AAAEL,EAAAA,QAAF;AAAYC,EAAAA;AAAZ,CAAlC,EAAuD;AACtD,QAAMQ,aAAa,GAClB,uBAAY,4BAAZ,EAA0CR,IAA1C,KACAD,QAAQ,CAACQ,QAAT,CAAmB,WAAnB,CAFD;AAGA,QAAME,cAAc,GACnB,uBAAY,6BAAZ,EAA2CT,IAA3C,KACAD,QAAQ,CAACQ,QAAT,CAAmB,YAAnB,CAFD;AAGA,SAAOC,aAAa,IAAIC,cAAxB;AACA;;AAED,SAASH,0BAAT,CAAqC;AAAEP,EAAAA,QA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AAEC,IAAA,QAAQ,EAAKoB,KAAF,IACVP,QAAQ,CAAEb,IAAF,EAAQ,eAAR,EAAyBoB,KAAzB;AAHV,IA3CF,CADD;AAqDA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tLineHeightControl,\n\t__experimentalFontFamilyControl as FontFamilyControl,\n\t__experimentalFontAppearanceControl as FontAppearanceControl,\n\t__experimentalLetterSpacingControl as LetterSpacingControl,\n} from '@wordpress/block-editor';\nimport { PanelBody, FontSizePicker } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { useSetting } from '../editor/utils';\n\nexport function useHasTypographyPanel( { supports, name } ) {\n\tconst hasLineHeight = useHasLineHeightControl( { supports, name } );\n\tconst hasFontAppearance = useHasAppearanceControl( { supports, name } );\n\tconst hasLetterSpacing = useHasLetterSpacingControl( { supports, name } );\n\treturn (\n\t\thasLineHeight ||\n\t\thasFontAppearance ||\n\t\thasLetterSpacing ||\n\t\tsupports.includes( 'fontSize' )\n\t);\n}\n\nfunction useHasLineHeightControl( { supports, name } ) {\n\treturn (\n\t\tuseSetting( 'typography.customLineHeight', name ) &&\n\t\tsupports.includes( 'lineHeight' )\n\t);\n}\n\nfunction useHasAppearanceControl( { supports, name } ) {\n\tconst hasFontStyles =\n\t\tuseSetting( 'typography.customFontStyle', name ) &&\n\t\tsupports.includes( 'fontStyle' );\n\tconst hasFontWeights =\n\t\tuseSetting( 'typography.customFontWeight', name ) &&\n\t\tsupports.includes( 'fontWeight' );\n\treturn hasFontStyles || hasFontWeights;\n}\n\nfunction useHasLetterSpacingControl( { supports, name } ) {\n\treturn (\n\t\tuseSetting( 'typography.customLetterSpacing', name ) &&\n\t\tsupports.includes( 'letterSpacing' )\n\t);\n}\n\nexport default function TypographyPanel( {\n\tcontext: { supports, name },\n\tgetStyle,\n\tsetStyle,\n} ) {\n\tconst fontSizes = useSetting( 'typography.fontSizes', name );\n\tconst disableCustomFontSizes = ! useSetting(\n\t\t'typography.customFontSize',\n\t\tname\n\t);\n\tconst fontFamilies = useSetting( 'typography.fontFamilies', name );\n\tconst hasFontStyles =\n\t\tuseSetting( 'typography.customFontStyle', name ) &&\n\t\tsupports.includes( 'fontStyle' );\n\tconst hasFontWeights =\n\t\tuseSetting( 'typography.customFontWeight', name ) &&\n\t\tsupports.includes( 'fontWeight' );\n\tconst hasLineHeightEnabled = useHasLineHeightControl( { supports, name } );\n\tconst hasAppearanceControl = useHasAppearanceControl( { supports, name } );\n\tconst hasLetterSpacingControl = useHasLetterSpacingControl( {\n\t\tsupports,\n\t\tname,\n\t} );\n\n\treturn (\n\t\t<PanelBody title={ __( 'Typography' ) } initialOpen={ true }>\n\t\t\t{ supports.includes( 'fontFamily' ) && (\n\t\t\t\t<FontFamilyControl\n\t\t\t\t\tfontFamilies={ fontFamilies }\n\t\t\t\t\tvalue={ getStyle( name, 'fontFamily' ) }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetStyle( name, 'fontFamily', value )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ supports.includes( 'fontSize' ) && (\n\t\t\t\t<FontSizePicker\n\t\t\t\t\tvalue={ getStyle( name, 'fontSize' ) }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetStyle( name, 'fontSize', value )\n\t\t\t\t\t}\n\t\t\t\t\tfontSizes={ fontSizes }\n\t\t\t\t\tdisableCustomFontSizes={ disableCustomFontSizes }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasLineHeightEnabled && (\n\t\t\t\t<LineHeightControl\n\t\t\t\t\tvalue={ getStyle( name, 'lineHeight' ) }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetStyle( name, 'lineHeight', value )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasAppearanceControl && (\n\t\t\t\t<FontAppearanceControl\n\t\t\t\t\tvalue={ {\n\t\t\t\t\t\tfontStyle: getStyle( name, 'fontStyle' ),\n\t\t\t\t\t\tfontWeight: getStyle( name, 'fontWeight' ),\n\t\t\t\t\t} }\n\t\t\t\t\tonChange={ ( { fontStyle, fontWeight } ) => {\n\t\t\t\t\t\tsetStyle( name, 'fontStyle', fontStyle );\n\t\t\t\t\t\tsetStyle( name, 'fontWeight', fontWeight );\n\t\t\t\t\t} }\n\t\t\t\t\thasFontStyles={ hasFontStyles }\n\t\t\t\t\thasFontWeights={ hasFontWeights }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasLetterSpacingControl && (\n\t\t\t\t<LetterSpacingControl\n\t\t\t\t\tvalue={ getStyle( name, 'letterSpacing' ) }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetStyle( name, 'letterSpacing', value )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t</PanelBody>\n\t);\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/border-panel.js"],"names":["__experimentalBorderRadiusControl","BorderRadiusControl","__experimentalBorderStyleControl","BorderStyleControl","__experimentalColorGradientControl","ColorGradientControl","PanelBody","__experimentalUnitControl","UnitControl","__experimentalUseCustomUnits","useCustomUnits","__","useSetting","MIN_BORDER_WIDTH","EMPTY_ARRAY","useHasBorderPanel","supports","name","controls","useHasBorderColorControl","useHasBorderRadiusControl","useHasBorderStyleControl","useHasBorderWidthControl","some","Boolean","includes","BorderPanel","context","getStyle","setStyle","units","availableUnits","hasBorderWidth","borderWidthValue","hasBorderStyle","borderStyle","colors","disableCustomColors","disableCustomGradients","hasBorderColor","borderColor","hasBorderRadius","borderRadiusValues","value","undefined"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,iCAAiC,IAAIC,mBADtC,EAECC,gCAAgC,IAAIC,kBAFrC,EAGCC,kCAAkC,IAAIC,oBAHvC,QAIO,yBAJP;AAKA,SACCC,SADD,EAECC,yBAAyB,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EAyCGF,eAAe,IAChB,cAAC,mBAAD;AACC,IAAA,MAAM,EAAGC,kBADV;AAEC,IAAA,QAAQ,EAAKC,KAAF,IACVd,QAAQ,CAAEZ,IAAF,EAAQ,cAAR,EAAwB0B,KAAxB;AAHV,IA1CF,CADD;AAoDA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalBorderRadiusControl as BorderRadiusControl,\n\t__experimentalBorderStyleControl as BorderStyleControl,\n\t__experimentalColorGradientControl as ColorGradientControl,\n} from '@wordpress/block-editor';\nimport {\n\tPanelBody,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalUseCustomUnits as useCustomUnits,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { useSetting } from '../editor/utils';\n\nconst MIN_BORDER_WIDTH = 0;\n\n// Defining empty array here instead of inline avoids unnecessary re-renders of\n// color control.\nconst EMPTY_ARRAY = [];\n\nexport function useHasBorderPanel( { supports, name } ) {\n\tconst controls = [\n\t\tuseHasBorderColorControl( { supports, name } ),\n\t\tuseHasBorderRadiusControl( { supports, name } ),\n\t\tuseHasBorderStyleControl( { supports, name } ),\n\t\tuseHasBorderWidthControl( { supports, name } ),\n\t];\n\n\treturn controls.some( Boolean );\n}\n\nfunction useHasBorderColorControl( { supports, name } ) {\n\treturn (\n\t\tuseSetting( 'border.customColor', name ) &&\n\t\tsupports.includes( 'borderColor' )\n\t);\n}\n\nfunction useHasBorderRadiusControl( { supports, name } ) {\n\treturn (\n\t\tuseSetting( 'border.customRadius', name ) &&\n\t\tsupports.includes( 'borderRadius' )\n\t);\n}\n\nfunction useHasBorderStyleControl( { supports, name } ) {\n\treturn (\n\t\tuseSetting( 'border.customStyle', name ) &&\n\t\tsupports.includes( 'borderStyle' )\n\t);\n}\n\nfunction useHasBorderWidthControl( { supports, name } ) {\n\treturn (\n\t\tuseSetting( 'border.customWidth', name ) &&\n\t\tsupports.includes( 'borderWidth' )\n\t);\n}\n\nexport default function BorderPanel( {\n\tcontext: { supports, name },\n\tgetStyle,\n\tsetStyle,\n} ) {\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: useSetting( 'spacing.units' ) || [ 'px', 'em', 'rem' ],\n\t} );\n\n\t// Border width.\n\tconst hasBorderWidth = useHasBorderWidthControl( { supports, name } );\n\tconst borderWidthValue = getStyle( name, 'borderWidth' );\n\n\t// Border style.\n\tconst hasBorderStyle = useHasBorderStyleControl( { supports, name } );\n\tconst borderStyle = getStyle( name, 'borderStyle' );\n\n\t// Border color.\n\tconst colors = useSetting( 'color.palette' ) || EMPTY_ARRAY;\n\tconst disableCustomColors = ! useSetting( 'color.custom' );\n\tconst disableCustomGradients = ! useSetting( 'color.customGradient' );\n\tconst hasBorderColor = useHasBorderColorControl( { supports, name } );\n\tconst borderColor = getStyle( name, 'borderColor' );\n\n\t// Border radius.\n\tconst hasBorderRadius = useHasBorderRadiusControl( { supports, name } );\n\tconst borderRadiusValues = getStyle( name, 'borderRadius' );\n\n\treturn (\n\t\t<PanelBody title={ __( 'Border' ) } initialOpen={ true }>\n\t\t\t{ ( hasBorderWidth || hasBorderStyle ) && (\n\t\t\t\t<div className=\"edit-site-global-styles-sidebar__border-controls-row\">\n\t\t\t\t\t{ hasBorderWidth && (\n\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\tvalue={ borderWidthValue }\n\t\t\t\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\t\t\t\tmin={ MIN_BORDER_WIDTH }\n\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\tsetStyle(\n\t\t\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\t\t\t'borderWidth',\n\t\t\t\t\t\t\t\t\tvalue || undefined\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ hasBorderStyle && (\n\t\t\t\t\t\t<BorderStyleControl\n\t\t\t\t\t\t\tvalue={ borderStyle }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetStyle( name, 'borderStyle', 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</div>\n\t\t\t) }\n\t\t\t{ hasBorderColor && (\n\t\t\t\t<ColorGradientControl\n\t\t\t\t\tlabel={ __( 'Color' ) }\n\t\t\t\t\tcolorValue={ borderColor }\n\t\t\t\t\tcolors={ colors }\n\t\t\t\t\tgradients={ undefined }\n\t\t\t\t\tdisableCustomColors={ disableCustomColors }\n\t\t\t\t\tdisableCustomGradients={ disableCustomGradients }\n\t\t\t\t\tonColorChange={ ( value ) =>\n\t\t\t\t\t\tsetStyle( name, 'borderColor', value )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasBorderRadius && (\n\t\t\t\t<BorderRadiusControl\n\t\t\t\t\tvalues={ borderRadiusValues }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetStyle( name, 'borderRadius', value )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t</PanelBody>\n\t);\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/color-palette-panel.js"],"names":["get","__experimentalColorEdit","ColorEdit","__","useSelect","useSetting","store","editSiteStore","EMPTY_ARRAY","ColorPalettePanel","contextName","getSetting","setSetting","colors","userColors","immutableColorSlugs","select","baseStyles","getSettings","__experimentalGlobalStylesBaseStyles","contextualBasePalette","globalPalette","basePalette","theme","core","map","slug","newColors"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,GAAT,QAAoB,QAApB;AAEA;AACA;AACA;;AACA,SAASC,uBAAuB,IAAIC,SAApC,QAAqD,uBAArD;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,SAAT,QAA0B,iBAA1B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GAzBmC,EA0BpC,CAAEhB,WAAF,CA1BoC,CAArC;AA4BA,SACC,cAAC,SAAD;AACC,IAAA,mBAAmB,EAAGK,mBADvB;AAEC,IAAA,MAAM,EAAGF,MAFV;AAGC,IAAA,QAAQ,EAAKc,SAAF,IAAiB;AAC3Bf,MAAAA,UAAU,CAAEF,WAAF,EAAe,eAAf,EAAgCiB,SAAhC,CAAV;AACA,KALF;AAMC,IAAA,OAAO,EAAGxB,EAAE,CACX,qEADW,CANb;AASC,IAAA,QAAQ,EAAGU,MAAM,KAAKC;AATvB,IADD;AAaA","sourcesContent":["/**\n * External dependencies\n */\nimport { get } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __experimentalColorEdit as ColorEdit } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useSetting } from '../editor/utils';\nimport { store as editSiteStore } from '../../store';\n\n/**\n * Shared reference to an empty array for cases where it is important to avoid\n * returning a new array reference on every invocation, as in a connected or\n * other pure component which performs `shouldComponentUpdate` check on props.\n * This should be used as a last resort, since the normalized data should be\n * maintained by the reducer result in state.\n *\n * @type {Array}\n */\nconst EMPTY_ARRAY = [];\n\nexport default function ColorPalettePanel( {\n\tcontextName,\n\tgetSetting,\n\tsetSetting,\n} ) {\n\tconst colors = useSetting( 'color.palette', contextName );\n\tconst userColors = getSetting( contextName, 'color.palette' );\n\tconst immutableColorSlugs = useSelect(\n\t\t( select ) => {\n\t\t\tconst baseStyles = select( editSiteStore ).getSettings()\n\t\t\t\t.__experimentalGlobalStylesBaseStyles;\n\t\t\tconst contextualBasePalette = get( baseStyles, [\n\t\t\t\t'settings',\n\t\t\t\t'blocks',\n\t\t\t\tcontextName,\n\t\t\t\t'color',\n\t\t\t\t'palette',\n\t\t\t] );\n\t\t\tconst globalPalette = get( baseStyles, [\n\t\t\t\t'settings',\n\t\t\t\t'color',\n\t\t\t\t'palette',\n\t\t\t] );\n\t\t\tconst basePalette =\n\t\t\t\tcontextualBasePalette?.theme ??\n\t\t\t\tcontextualBasePalette?.core ??\n\t\t\t\tglobalPalette?.theme ??\n\t\t\t\tglobalPalette?.core;\n\t\t\tif ( ! basePalette ) {\n\t\t\t\treturn EMPTY_ARRAY;\n\t\t\t}\n\t\t\treturn basePalette.map( ( { slug } ) => slug );\n\t\t},\n\t\t[ contextName ]\n\t);\n\treturn (\n\t\t<ColorEdit\n\t\t\timmutableColorSlugs={ immutableColorSlugs }\n\t\t\tcolors={ colors }\n\t\t\tonChange={ ( newColors ) => {\n\t\t\t\tsetSetting( contextName, 'color.palette', newColors );\n\t\t\t} }\n\t\t\temptyUI={ __(\n\t\t\t\t'Colors are empty! Add some colors to create your own color palette.'\n\t\t\t) }\n\t\t\tcanReset={ colors === userColors }\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/color-panel.js"],"names":["__experimentalPanelColorGradientSettings","PanelColorGradientSettings","__","useSetting","ColorPalettePanel","useHasColorPanel","supports","includes","ColorPanel","context","name","getStyle","setStyle","getSetting","setSetting","solids","gradients","areCustomSolidsEnabled","areCustomGradientsEnabled","isLinkEnabled","isTextEnabled","isBackgroundEnabled","hasLinkColor","length","hasTextColor","hasBackgroundColor","hasGradientColor","settings","color","userColor","push","colorValue","onColorChange","value","label","clearable","backgroundSettings","backgroundColor","userBackgroundColor","gradientSettings","gradient","userGradient","gradientValue","onGradientChange"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,wCAAwC,IAAIC,0BAArD,QAAuF,yBAAvF;AACA,SAASC,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AAEA,SAASC,UAAT,QAA2B,iBAA3B;AACA,OAAOC,iBAAP,MAA8B,uBAA9B;AAEA,OAAO,SAASC,gBAAT,CAA2B;AAAEC,EAAAA;AAAF,CAA3B,EAA0C;AAChD,SACCA,QAAQ,CAACC,QAAT,CAAm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sBALzB;AAMC,IAAA,sBAAsB,EAAG,CAAEC;AAN5B,KAQC,cAAC,iBAAD;AACC,IAAA,GAAG,EAAG,yBAAyBR,IADhC;AAEC,IAAA,WAAW,EAAGA,IAFf;AAGC,IAAA,UAAU,EAAGG,UAHd;AAIC,IAAA,UAAU,EAAGC;AAJd,IARD,CADD;AAiBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalPanelColorGradientSettings as PanelColorGradientSettings } from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\n\nimport { useSetting } from '../editor/utils';\nimport ColorPalettePanel from './color-palette-panel';\n\nexport function useHasColorPanel( { supports } ) {\n\treturn (\n\t\tsupports.includes( 'color' ) ||\n\t\tsupports.includes( 'backgroundColor' ) ||\n\t\tsupports.includes( 'background' ) ||\n\t\tsupports.includes( 'linkColor' )\n\t);\n}\n\nexport default function ColorPanel( {\n\tcontext: { supports, name },\n\tgetStyle,\n\tsetStyle,\n\tgetSetting,\n\tsetSetting,\n} ) {\n\tconst solids = useSetting( 'color.palette', name );\n\tconst gradients = useSetting( 'color.gradients', name );\n\tconst areCustomSolidsEnabled = useSetting( 'color.custom', name );\n\tconst areCustomGradientsEnabled = useSetting(\n\t\t'color.customGradient',\n\t\tname\n\t);\n\tconst isLinkEnabled = useSetting( 'color.link', name );\n\tconst isTextEnabled = useSetting( 'color.text', name );\n\tconst isBackgroundEnabled = useSetting( 'color.background', name );\n\n\tconst hasLinkColor =\n\t\tsupports.includes( 'linkColor' ) &&\n\t\tisLinkEnabled &&\n\t\t( solids.length > 0 || areCustomSolidsEnabled );\n\tconst hasTextColor =\n\t\tsupports.includes( 'color' ) &&\n\t\tisTextEnabled &&\n\t\t( solids.length > 0 || areCustomSolidsEnabled );\n\tconst hasBackgroundColor =\n\t\tsupports.includes( 'backgroundColor' ) &&\n\t\tisBackgroundEnabled &&\n\t\t( solids.length > 0 || areCustomSolidsEnabled );\n\tconst hasGradientColor =\n\t\tsupports.includes( 'background' ) &&\n\t\t( gradients.length > 0 || areCustomGradientsEnabled );\n\n\tconst settings = [];\n\n\tif ( hasTextColor ) {\n\t\tconst color = getStyle( name, 'color' );\n\t\tconst userColor = getStyle( name, 'color', 'user' );\n\t\tsettings.push( {\n\t\t\tcolorValue: color,\n\t\t\tonColorChange: ( value ) => setStyle( name, 'color', value ),\n\t\t\tlabel: __( 'Text color' ),\n\t\t\tclearable: color === userColor,\n\t\t} );\n\t}\n\n\tlet backgroundSettings = {};\n\tif ( hasBackgroundColor ) {\n\t\tconst backgroundColor = getStyle( name, 'backgroundColor' );\n\t\tconst userBackgroundColor = getStyle( name, 'backgroundColor', 'user' );\n\t\tbackgroundSettings = {\n\t\t\tcolorValue: backgroundColor,\n\t\t\tonColorChange: ( value ) =>\n\t\t\t\tsetStyle( name, 'backgroundColor', value ),\n\t\t};\n\t\tif ( backgroundColor ) {\n\t\t\tbackgroundSettings.clearable =\n\t\t\t\tbackgroundColor === userBackgroundColor;\n\t\t}\n\t}\n\n\tlet gradientSettings = {};\n\tif ( hasGradientColor ) {\n\t\tconst gradient = getStyle( name, 'background' );\n\t\tconst userGradient = getStyle( name, 'background', 'user' );\n\t\tgradientSettings = {\n\t\t\tgradientValue: gradient,\n\t\t\tonGradientChange: ( value ) =>\n\t\t\t\tsetStyle( name, 'background', value ),\n\t\t};\n\t\tif ( gradient ) {\n\t\t\tgradientSettings.clearable = gradient === userGradient;\n\t\t}\n\t}\n\n\tif ( hasBackgroundColor || hasGradientColor ) {\n\t\tsettings.push( {\n\t\t\t...backgroundSettings,\n\t\t\t...gradientSettings,\n\t\t\tlabel: __( 'Background color' ),\n\t\t} );\n\t}\n\n\tif ( hasLinkColor ) {\n\t\tconst color = getStyle( name, 'linkColor' );\n\t\tconst userColor = getStyle( name, 'linkColor', 'user' );\n\t\tsettings.push( {\n\t\t\tcolorValue: color,\n\t\t\tonColorChange: ( value ) => setStyle( name, 'linkColor', value ),\n\t\t\tlabel: __( 'Link color' ),\n\t\t\tclearable: color === userColor,\n\t\t} );\n\t}\n\n\treturn (\n\t\t<PanelColorGradientSettings\n\t\t\ttitle={ __( 'Color' ) }\n\t\t\tsettings={ settings }\n\t\t\tcolors={ solids }\n\t\t\tgradients={ gradients }\n\t\t\tdisableCustomColors={ ! areCustomSolidsEnabled }\n\t\t\tdisableCustomGradients={ ! areCustomGradientsEnabled }\n\t\t>\n\t\t\t<ColorPalettePanel\n\t\t\t\tkey={ 'color-palette-panel-' + name }\n\t\t\t\tcontextName={ name }\n\t\t\t\tgetSetting={ getSetting }\n\t\t\t\tsetSetting={ setSetting }\n\t\t\t/>\n\t\t</PanelColorGradientSettings>\n\t);\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/dimensions-panel.js"],"names":["__","__experimentalToolsPanel","ToolsPanel","__experimentalToolsPanelItem","ToolsPanelItem","__experimentalBoxControl","BoxControl","__experimentalUnitControl","UnitControl","__experimentalUseCustomUnits","useCustomUnits","__experimentalUseCustomSides","useCustomSides","useSetting","AXIAL_SIDES","useHasDimensionsPanel","context","hasPadding","useHasPadding","hasMargin","useHasMargin","hasGap","useHasGap","name","supports","settings","includes","filterValuesBySides","values","sides","filteredValues","forEach","side","top","bottom","left","right","splitStyleValue","value","DimensionsPanel","getStyle","setStyle","showPaddingControl","showMarginControl","showGapControl","units","availableUnits","paddingValues","paddingSides","isAxialPadding","some","setPaddingValues","newPaddingValues","padding","resetPaddingValue","hasPaddingValue","Object","keys","length","marginValues","marginSides","isAxialMargin","setMarginValues","newMarginValues","margin","resetMarginValue","hasMarginValue","gapValue","setGapValue","newGapValue","resetGapValue","undefined","hasGapValue","resetAll"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SACCC,wBAAwB,IAAIC,UAD7B,EAECC,4BAA4B,IAAIC,cAFjC,EAGCC,wBAAwB,IAAIC,UAH7B,EAICC,yBAAyB,IAAI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,CANF,EAuBGN,iBAAiB,IAClB,cAAC,cAAD;AACC,IAAA,QAAQ,EAAGuB,cADZ;AAEC,IAAA,KAAK,EAAGlE,EAAE,CAAE,QAAF,CAFX;AAGC,IAAA,UAAU,EAAGiE,gBAHd;AAIC,IAAA,gBAAgB,EAAG;AAJpB,KAMC,cAAC,UAAD;AACC,IAAA,MAAM,EAAGN,YADV;AAEC,IAAA,QAAQ,EAAGG,eAFZ;AAGC,IAAA,KAAK,EAAG9D,EAAE,CAAE,QAAF,CAHX;AAIC,IAAA,KAAK,EAAG4D,WAJT;AAKC,IAAA,KAAK,EAAGf,KALT;AAMC,IAAA,UAAU,EAAG,KANd;AAOC,IAAA,WAAW,EAAGgB;AAPf,IAND,CAxBF,EAyCGjB,cAAc,IACf,cAAC,cAAD;AACC,IAAA,SAAS,EAAC,eADX;AAEC,IAAA,QAAQ,EAAG4B,WAFZ;AAGC,IAAA,KAAK,EAAGxE,EAAE,CAAE,WAAF,CAHX;AAIC,IAAA,UAAU,EAAGsE,aAJd;AAKC,IAAA,gBAAgB,EAAG;AALpB,KAOC,cAAC,WAAD;AACC,IAAA,KAAK,EAAGtE,EAAE,CAAE,WAAF,CADX;AAEC,IAAA,GAAG,EAAG,CAFP;AAGC,IAAA,QAAQ,EAAGoE,WAHZ;AAIC,IAAA,KAAK,EAAGvB,KAJT;AAKC,IAAA,KAAK,EAAGsB;AALT,IAPD,CA1CF,CADD;AA6DA","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 { useSetting } from '../editor/utils';\n\nconst AXIAL_SIDES = [ 'horizontal', 'vertical' ];\n\nexport function useHasDimensionsPanel( context ) {\n\tconst hasPadding = useHasPadding( context );\n\tconst hasMargin = useHasMargin( context );\n\tconst hasGap = useHasGap( context );\n\n\treturn hasPadding || hasMargin || hasGap;\n}\n\nfunction useHasPadding( { name, supports } ) {\n\tconst settings = useSetting( 'spacing.customPadding', name );\n\n\treturn settings && supports.includes( 'padding' );\n}\n\nfunction useHasMargin( { name, supports } ) {\n\tconst settings = useSetting( 'spacing.customMargin', name );\n\n\treturn settings && supports.includes( 'margin' );\n}\n\nfunction useHasGap( { name, supports } ) {\n\tconst settings = useSetting( 'spacing.blockGap', name );\n\n\treturn 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( { context, getStyle, setStyle } ) {\n\tconst { name } = context;\n\tconst showPaddingControl = useHasPadding( context );\n\tconst showMarginControl = useHasMargin( context );\n\tconst showGapControl = useHasGap( context );\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: useSetting( 'spacing.units', name ) || [\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 paddingValues = splitStyleValue( getStyle( name, 'padding' ) );\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\tsetStyle( name, 'padding', padding );\n\t};\n\tconst resetPaddingValue = () => setPaddingValues( {} );\n\tconst hasPaddingValue = () =>\n\t\tpaddingValues && Object.keys( paddingValues ).length;\n\n\tconst marginValues = splitStyleValue( getStyle( name, 'margin' ) );\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\tsetStyle( name, 'margin', margin );\n\t};\n\tconst resetMarginValue = () => setMarginValues( {} );\n\tconst hasMarginValue = () =>\n\t\tmarginValues && Object.keys( marginValues ).length;\n\n\tconst gapValue = getStyle( name, '--wp--style--block-gap' );\n\n\tconst setGapValue = ( newGapValue ) => {\n\t\tsetStyle( name, '--wp--style--block-gap', newGapValue );\n\t};\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\n\t\t\tlabel={ __( 'Dimensions options' ) }\n\t\t\theader={ __( 'Dimensions' ) }\n\t\t\tresetAll={ resetAll }\n\t\t>\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\tclassName=\"single-column\"\n\t\t\t\t\thasValue={ hasGapValue }\n\t\t\t\t\tlabel={ __( 'Block gap' ) }\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 gap' ) }\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"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/typography-panel.js"],"names":["LineHeightControl","__experimentalFontFamilyControl","FontFamilyControl","__experimentalFontAppearanceControl","FontAppearanceControl","__experimentalLetterSpacingControl","LetterSpacingControl","PanelBody","FontSizePicker","__","useSetting","useHasTypographyPanel","supports","name","hasLineHeight","useHasLineHeightControl","hasFontAppearance","useHasAppearanceControl","hasLetterSpacing","useHasLetterSpacingControl","includes","hasFontStyles","hasFontWeights","TypographyPanel","context","getStyle","setStyle","fontSizes","disableCustomFontSizes","fontFamilies","hasLineHeightEnabled","hasAppearanceControl","hasLetterSpacingControl","value","fontStyle","fontWeight"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,iBADD,EAECC,+BAA+B,IAAIC,iBAFpC,EAGCC,mCAAmC,IAAIC,qBAHxC,EAICC,kCAAkC,IAAIC,oBAJvC,QAKO,yBALP;AAMA,SAASC,SAAT,EAAoBC,cAApB,QAA0C,uBAA1C;AACA,SAASC,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,SAASC,UAAT,QAA2B,iBAA3B;AAEA,OAAO,SAASC,qBAAT,CAAgC;AAAEC,EAAAA,QAAF;AAAYC,EAAAA;AAAZ,CAAhC,EAAqD;AAC3D,QAAMC,aAAa,GAAGC,uBAAuB,CAAE;AAAEH,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,GAAF,CAA7C;AACA,QAAMG,iBAAiB,GAAGC,uBAAuB,CAAE;AAAEL,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,GAAF,CAAjD;AACA,QAAMK,gBAAgB,GAAGC,0BAA0B,CAAE;AAAEP,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,GAAF,CAAnD;AACA,SACCC,aAAa,IACbE,iBADA,IAEAE,gBAFA,IAGAN,QAAQ,CAACQ,Q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,QAAQ,CAAEb,IAAF,EAAQ,YAAR,EAAsBoB,KAAtB;AAHV,IArBF,EA4BGF,oBAAoB,IACrB,cAAC,qBAAD;AACC,IAAA,KAAK,EAAG;AACPG,MAAAA,SAAS,EAAET,QAAQ,CAAEZ,IAAF,EAAQ,WAAR,CADZ;AAEPsB,MAAAA,UAAU,EAAEV,QAAQ,CAAEZ,IAAF,EAAQ,YAAR;AAFb,KADT;AAKC,IAAA,QAAQ,EAAG,CAAE;AAAEqB,MAAAA,SAAF;AAAaC,MAAAA;AAAb,KAAF,KAAiC;AAC3CT,MAAAA,QAAQ,CAAEb,IAAF,EAAQ,WAAR,EAAqBqB,SAArB,CAAR;AACAR,MAAAA,QAAQ,CAAEb,IAAF,EAAQ,YAAR,EAAsBsB,UAAtB,CAAR;AACA,KARF;AASC,IAAA,aAAa,EAAGd,aATjB;AAUC,IAAA,cAAc,EAAGC;AAVlB,IA7BF,EA0CGU,uBAAuB,IACxB,cAAC,oBAAD;AACC,IAAA,KAAK,EAAGP,QAAQ,CAAEZ,IAAF,EAAQ,eAAR,CADjB;AAEC,IAAA,QAAQ,EAAKoB,KAAF,IACVP,QAAQ,CAAEb,IAAF,EAAQ,eAAR,EAAyBoB,KAAzB;AAHV,IA3CF,CADD;AAqDA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tLineHeightControl,\n\t__experimentalFontFamilyControl as FontFamilyControl,\n\t__experimentalFontAppearanceControl as FontAppearanceControl,\n\t__experimentalLetterSpacingControl as LetterSpacingControl,\n} from '@wordpress/block-editor';\nimport { PanelBody, FontSizePicker } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { useSetting } from '../editor/utils';\n\nexport function useHasTypographyPanel( { supports, name } ) {\n\tconst hasLineHeight = useHasLineHeightControl( { supports, name } );\n\tconst hasFontAppearance = useHasAppearanceControl( { supports, name } );\n\tconst hasLetterSpacing = useHasLetterSpacingControl( { supports, name } );\n\treturn (\n\t\thasLineHeight ||\n\t\thasFontAppearance ||\n\t\thasLetterSpacing ||\n\t\tsupports.includes( 'fontSize' )\n\t);\n}\n\nfunction useHasLineHeightControl( { supports, name } ) {\n\treturn (\n\t\tuseSetting( 'typography.customLineHeight', name ) &&\n\t\tsupports.includes( 'lineHeight' )\n\t);\n}\n\nfunction useHasAppearanceControl( { supports, name } ) {\n\tconst hasFontStyles =\n\t\tuseSetting( 'typography.customFontStyle', name ) &&\n\t\tsupports.includes( 'fontStyle' );\n\tconst hasFontWeights =\n\t\tuseSetting( 'typography.customFontWeight', name ) &&\n\t\tsupports.includes( 'fontWeight' );\n\treturn hasFontStyles || hasFontWeights;\n}\n\nfunction useHasLetterSpacingControl( { supports, name } ) {\n\treturn (\n\t\tuseSetting( 'typography.customLetterSpacing', name ) &&\n\t\tsupports.includes( 'letterSpacing' )\n\t);\n}\n\nexport default function TypographyPanel( {\n\tcontext: { supports, name },\n\tgetStyle,\n\tsetStyle,\n} ) {\n\tconst fontSizes = useSetting( 'typography.fontSizes', name );\n\tconst disableCustomFontSizes = ! useSetting(\n\t\t'typography.customFontSize',\n\t\tname\n\t);\n\tconst fontFamilies = useSetting( 'typography.fontFamilies', name );\n\tconst hasFontStyles =\n\t\tuseSetting( 'typography.customFontStyle', name ) &&\n\t\tsupports.includes( 'fontStyle' );\n\tconst hasFontWeights =\n\t\tuseSetting( 'typography.customFontWeight', name ) &&\n\t\tsupports.includes( 'fontWeight' );\n\tconst hasLineHeightEnabled = useHasLineHeightControl( { supports, name } );\n\tconst hasAppearanceControl = useHasAppearanceControl( { supports, name } );\n\tconst hasLetterSpacingControl = useHasLetterSpacingControl( {\n\t\tsupports,\n\t\tname,\n\t} );\n\n\treturn (\n\t\t<PanelBody title={ __( 'Typography' ) } initialOpen={ true }>\n\t\t\t{ supports.includes( 'fontFamily' ) && (\n\t\t\t\t<FontFamilyControl\n\t\t\t\t\tfontFamilies={ fontFamilies }\n\t\t\t\t\tvalue={ getStyle( name, 'fontFamily' ) }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetStyle( name, 'fontFamily', value )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ supports.includes( 'fontSize' ) && (\n\t\t\t\t<FontSizePicker\n\t\t\t\t\tvalue={ getStyle( name, 'fontSize' ) }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetStyle( name, 'fontSize', value )\n\t\t\t\t\t}\n\t\t\t\t\tfontSizes={ fontSizes }\n\t\t\t\t\tdisableCustomFontSizes={ disableCustomFontSizes }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasLineHeightEnabled && (\n\t\t\t\t<LineHeightControl\n\t\t\t\t\tvalue={ getStyle( name, 'lineHeight' ) }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetStyle( name, 'lineHeight', value )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasAppearanceControl && (\n\t\t\t\t<FontAppearanceControl\n\t\t\t\t\tvalue={ {\n\t\t\t\t\t\tfontStyle: getStyle( name, 'fontStyle' ),\n\t\t\t\t\t\tfontWeight: getStyle( name, 'fontWeight' ),\n\t\t\t\t\t} }\n\t\t\t\t\tonChange={ ( { fontStyle, fontWeight } ) => {\n\t\t\t\t\t\tsetStyle( name, 'fontStyle', fontStyle );\n\t\t\t\t\t\tsetStyle( name, 'fontWeight', fontWeight );\n\t\t\t\t\t} }\n\t\t\t\t\thasFontStyles={ hasFontStyles }\n\t\t\t\t\thasFontWeights={ hasFontWeights }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasLetterSpacingControl && (\n\t\t\t\t<LetterSpacingControl\n\t\t\t\t\tvalue={ getStyle( name, 'letterSpacing' ) }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetStyle( name, 'letterSpacing', value )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t</PanelBody>\n\t);\n}\n"]}
|