Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark the color support flag as stable #25694

Merged
merged 1 commit into from
Sep 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/block-supports/colors.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
function gutenberg_register_colors_support( $block_type ) {
$color_support = false;
if ( property_exists( $block_type, 'supports' ) ) {
$color_support = gutenberg_experimental_get( $block_type->supports, array( '__experimentalColor' ), false );
$color_support = gutenberg_experimental_get( $block_type->supports, array( 'color' ), false );
}
$has_text_colors_support = true === $color_support || ( is_array( $color_support ) && gutenberg_experimental_get( $color_support, array( 'text' ), true ) );
$has_background_colors_support = true === $color_support || ( is_array( $color_support ) && gutenberg_experimental_get( $color_support, array( 'background' ), true ) );
Expand Down Expand Up @@ -60,10 +60,10 @@ function gutenberg_register_colors_support( $block_type ) {
* @return array Colors CSS classes and inline styles.
*/
function gutenberg_apply_colors_support( $attributes, $block_attributes, $block_type ) {
$color_support = gutenberg_experimental_get( $block_type->supports, array( '__experimentalColor' ), false );
$color_support = gutenberg_experimental_get( $block_type->supports, array( 'color' ), false );
$has_text_colors_support = true === $color_support || ( is_array( $color_support ) && gutenberg_experimental_get( $color_support, array( 'text' ), true ) );
$has_background_colors_support = true === $color_support || ( is_array( $color_support ) && gutenberg_experimental_get( $color_support, array( 'background' ), true ) );
$has_link_colors_support = gutenberg_experimental_get( $color_support, array( 'linkColor' ), false );
$has_link_colors_support = gutenberg_experimental_get( $color_support, array( 'link' ), false );
$has_gradients_support = gutenberg_experimental_get( $color_support, array( 'gradients' ), false );

// Text Colors.
Expand Down
12 changes: 6 additions & 6 deletions lib/global-styles.php
Original file line number Diff line number Diff line change
Expand Up @@ -417,10 +417,10 @@ function gutenberg_experimental_global_styles_get_style_property() {
*/
function gutenberg_experimental_global_styles_get_support_keys() {
return array(
'--wp--style--color--link' => array( '__experimentalColor', 'linkColor' ),
'background' => array( '__experimentalColor', 'gradients' ),
'backgroundColor' => array( '__experimentalColor' ),
'color' => array( '__experimentalColor' ),
'--wp--style--color--link' => array( 'color', 'link' ),
'background' => array( 'color', 'gradients' ),
'backgroundColor' => array( 'color' ),
'color' => array( 'color' ),
'fontSize' => array( '__experimentalFontSize' ),
'lineHeight' => array( '__experimentalLineHeight' ),
);
Expand Down Expand Up @@ -485,8 +485,8 @@ function gutenberg_experimental_global_styles_get_block_data() {
'supports' => array(
'__experimentalSelector' => ':root',
'__experimentalFontSize' => true,
'__experimentalColor' => array(
'linkColor' => true,
'color' => array(
'link' => true,
'gradients' => true,
),
),
Expand Down
6 changes: 3 additions & 3 deletions packages/block-editor/src/hooks/color.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { cleanEmptyObject } from './utils';
import ColorPanel from './color-panel';
import useEditorFeature from '../components/use-editor-feature';

export const COLOR_SUPPORT_KEY = '__experimentalColor';
export const COLOR_SUPPORT_KEY = 'color';
const EMPTY_ARRAY = [];

const hasColorSupport = ( blockType ) => {
Expand All @@ -40,7 +40,7 @@ const hasColorSupport = ( blockType ) => {
const colorSupport = getBlockSupport( blockType, COLOR_SUPPORT_KEY );
return (
colorSupport &&
( colorSupport.linkColor === true ||
( colorSupport.link === true ||
colorSupport.gradient === true ||
colorSupport.background !== false ||
colorSupport.text !== false )
Expand All @@ -54,7 +54,7 @@ const hasLinkColorSupport = ( blockType ) => {

const colorSupport = getBlockSupport( blockType, COLOR_SUPPORT_KEY );

return isObject( colorSupport ) && !! colorSupport.linkColor;
return isObject( colorSupport ) && !! colorSupport.link;
};

const hasGradientSupport = ( blockType ) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/button/deprecated.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const deprecated = [
supports: {
align: true,
alignWide: false,
__experimentalColor: { gradients: true },
color: { gradients: true },
},
attributes: {
...blockAttributes,
Expand Down
4 changes: 2 additions & 2 deletions packages/block-library/src/columns/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
],
"html": false,
"lightBlockWrapper": true,
"__experimentalColor": {
"color": {
"gradients": true,
"linkColor": true
"link": true
}
}
}
4 changes: 2 additions & 2 deletions packages/block-library/src/group/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
"anchor": true,
"html": false,
"lightBlockWrapper": true,
"__experimentalColor": {
"color": {
"gradients": true,
"linkColor": true
"link": true
},
"__experimentalPadding": true
}
Expand Down
4 changes: 2 additions & 2 deletions packages/block-library/src/heading/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
"anchor": true,
"className": false,
"lightBlockWrapper": true,
"__experimentalColor": {
"linkColor": true
"color": {
"link": true
},
"__experimentalFontSize": true,
"__experimentalLineHeight": true,
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/list/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"supports": {
"anchor": true,
"className": false,
"__experimentalColor": {
"color": {
"gradients": true
},
"__unstablePasteTextInline": true,
Expand Down
4 changes: 2 additions & 2 deletions packages/block-library/src/media-text/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@
"align": [ "wide", "full" ],
"html": false,
"lightBlockWrapper": true,
"__experimentalColor": {
"color": {
"gradients": true,
"linkColor": true
"link": true
}
}
}
2 changes: 1 addition & 1 deletion packages/block-library/src/navigation/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"inserter": true,
"lightBlockWrapper": true,
"__experimentalFontSize": true,
"__experimentalColor": {
"color": {
"textColor": true,
"backgroundColor": true
}
Expand Down
4 changes: 2 additions & 2 deletions packages/block-library/src/paragraph/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
"anchor": true,
"className": false,
"lightBlockWrapper": true,
"__experimentalColor": {
"linkColor": true
"color": {
"link": true
},
"__experimentalFontSize": true,
"__experimentalLineHeight": true,
Expand Down
4 changes: 2 additions & 2 deletions packages/block-library/src/post-author/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
"html": false,
"lightBlockWrapper": true,
"__experimentalFontSize": true,
"__experimentalColor": {
"color": {
"gradients": true,
"linkColor": true
"link": true
},
"__experimentalLineHeight": true
}
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/post-comments-count/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"supports": {
"html": false,
"lightBlockWrapper": true,
"__experimentalColor": {
"color": {
"gradients": true
},
"__experimentalFontSize": true,
Expand Down
4 changes: 2 additions & 2 deletions packages/block-library/src/post-comments-form/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
"supports": {
"html": false,
"lightBlockWrapper": true,
"__experimentalColor": {
"color": {
"gradients": true,
"linkColor": true
"link": true
},
"__experimentalFontSize": true,
"__experimentalLineHeight": true
Expand Down
4 changes: 2 additions & 2 deletions packages/block-library/src/post-comments/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
"full"
],
"__experimentalFontSize": true,
"__experimentalColor": {
"color": {
"gradients": true,
"linkColor": true
"link": true
},
"__experimentalLineHeight": true
}
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/post-date/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"supports": {
"html": false,
"lightBlockWrapper": true,
"__experimentalColor": {
"color": {
"gradients": true
},
"__experimentalFontSize": true,
Expand Down
4 changes: 2 additions & 2 deletions packages/block-library/src/post-excerpt/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
"html": false,
"lightBlockWrapper": true,
"__experimentalFontSize": true,
"__experimentalColor": {
"color": {
"gradients": true,
"linkColor": true
"link": true
},
"__experimentalLineHeight": true
}
Expand Down
4 changes: 2 additions & 2 deletions packages/block-library/src/post-hierarchical-terms/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
"html": false,
"lightBlockWrapper": true,
"__experimentalFontSize": true,
"__experimentalColor": {
"color": {
"gradients": true,
"linkColor": true
"link": true
},
"__experimentalLineHeight": true
}
Expand Down
4 changes: 2 additions & 2 deletions packages/block-library/src/post-tags/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
"html": false,
"lightBlockWrapper": true,
"__experimentalFontSize": true,
"__experimentalColor": {
"color": {
"gradients": true,
"linkColor": true
"link": true
},
"__experimentalLineHeight": true
}
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/post-title/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"supports": {
"html": false,
"lightBlockWrapper": true,
"__experimentalColor": {
"color": {
"gradients": true
},
"__experimentalFontSize": true,
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/site-tagline/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"supports": {
"html": false,
"lightBlockWrapper": true,
"__experimentalColor": {
"color": {
"gradients": true
},
"__experimentalFontSize": true,
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/site-title/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"supports": {
"html": false,
"lightBlockWrapper": true,
"__experimentalColor": {
"color": {
"gradients": true
},
"__experimentalFontSize": true,
Expand Down
4 changes: 2 additions & 2 deletions packages/block-library/src/template-part/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
"align": true,
"html": false,
"lightBlockWrapper": true,
"__experimentalColor": {
"color": {
"gradients": true,
"linkColor": true
"link": true
}
}
}
2 changes: 1 addition & 1 deletion packages/edit-navigation/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function removeNavigationBlockSettingsUnsupportedFeatures( settings, name ) {
...omit( settings.supports, [
'anchor',
'customClassName',
'__experimentalColor',
'color',
'__experimentalFontSize',
] ),
customClassName: false,
Expand Down
24 changes: 12 additions & 12 deletions phpunit/class-block-supported-styles-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ function test_named_color_support() {
$block_type_settings = array(
'attributes' => array(),
'supports' => array(
'__experimentalColor' => true,
'color' => true,
),
'render_callback' => true,
);
Expand Down Expand Up @@ -175,7 +175,7 @@ function test_custom_color_support() {
$block_type_settings = array(
'attributes' => array(),
'supports' => array(
'__experimentalColor' => true,
'color' => true,
),
'render_callback' => true,
);
Expand Down Expand Up @@ -212,8 +212,8 @@ function test_named_link_color_support() {
$block_type_settings = array(
'attributes' => array(),
'supports' => array(
'__experimentalColor' => array(
'linkColor' => true,
'color' => array(
'link' => true,
),
),
'render_callback' => true,
Expand Down Expand Up @@ -243,8 +243,8 @@ function test_custom_link_color_support() {
$block_type_settings = array(
'attributes' => array(),
'supports' => array(
'__experimentalColor' => array(
'linkColor' => true,
'color' => array(
'link' => true,
),
),
'render_callback' => true,
Expand Down Expand Up @@ -274,7 +274,7 @@ function test_named_gradient_support() {
$block_type_settings = array(
'attributes' => array(),
'supports' => array(
'__experimentalColor' => array(
'color' => array(
'gradients' => true,
),
),
Expand Down Expand Up @@ -305,7 +305,7 @@ function test_custom_gradient_support() {
$block_type_settings = array(
'attributes' => array(),
'supports' => array(
'__experimentalColor' => array(
'color' => array(
'gradients' => true,
),
),
Expand Down Expand Up @@ -570,9 +570,9 @@ function test_all_supported() {
$block_type_settings = array(
'attributes' => array(),
'supports' => array(
'__experimentalColor' => array(
'color' => array(
'gradients' => true,
'linkColor' => true,
'link' => true,
),
'__experimentalFontSize' => true,
'__experimentalLineHeight' => true,
Expand Down Expand Up @@ -660,9 +660,9 @@ function test_render_callback_required() {
'attributes' => array(),
'supports' => array(
'align' => true,
'__experimentalColor' => array(
'color' => array(
'gradients' => true,
'linkColor' => true,
'link' => true,
),
'__experimentalFontSize' => true,
'__experimentalLineHeight' => true,
Expand Down