diff --git a/lib/class-wp-theme-json-gutenberg.php b/lib/class-wp-theme-json-gutenberg.php index 9cd8ee501b58..1b5cba91fe81 100644 --- a/lib/class-wp-theme-json-gutenberg.php +++ b/lib/class-wp-theme-json-gutenberg.php @@ -35,7 +35,7 @@ class WP_Theme_JSON_Gutenberg { const ROOT_BLOCK_SELECTOR = 'body'; const VALID_ORIGINS = array( - 'core', + 'default', 'theme', 'user', ); @@ -281,7 +281,7 @@ class WP_Theme_JSON_Gutenberg { * Constructor. * * @param array $theme_json A structure that follows the theme.json schema. - * @param string $origin What source of data this object represents. One of core, theme, or user. Default: theme. + * @param string $origin What source of data this object represents. One of default, theme, or user. Default: theme. */ public function __construct( $theme_json = array(), $origin = 'theme' ) { if ( ! in_array( $origin, self::VALID_ORIGINS, true ) ) { @@ -1263,7 +1263,7 @@ private static function get_setting_nodes( $theme_json, $selectors = array() ) { * 'variables': only the CSS Custom Properties for presets & custom ones. * 'styles': only the styles section in theme.json. * 'presets': only the classes for the presets. - * @param array $origins A list of origins to include. By default it includes 'core', 'theme', and 'user'. + * @param array $origins A list of origins to include. By default it includes 'default', 'theme', and 'user'. * * @return string Stylesheet. */ diff --git a/lib/class-wp-theme-json-resolver-gutenberg.php b/lib/class-wp-theme-json-resolver-gutenberg.php index 76138436e340..8af59b240392 100644 --- a/lib/class-wp-theme-json-resolver-gutenberg.php +++ b/lib/class-wp-theme-json-resolver-gutenberg.php @@ -117,7 +117,7 @@ public static function get_core_data() { $config = self::read_json_file( __DIR__ . '/theme.json' ); $config = self::translate( $config ); - self::$core = new WP_Theme_JSON_Gutenberg( $config, 'core' ); + self::$core = new WP_Theme_JSON_Gutenberg( $config, 'default' ); return self::$core; } @@ -283,8 +283,8 @@ public static function get_user_data() { /** * There are three sources of data (origins) for a site: - * core, theme, and user. The user's has higher priority - * than the theme's, and the theme's higher than core's. + * default, theme, and user. The user's has higher priority + * than the theme's, and the theme's higher than defaults's. * * Unlike the getters {@link get_core_data}, * {@link get_theme_data}, and {@link get_user_data}, diff --git a/lib/compat/wordpress-5.9/get-global-styles-and-settings.php b/lib/compat/wordpress-5.9/get-global-styles-and-settings.php index 0b1e9c375671..4e43ed9cba89 100644 --- a/lib/compat/wordpress-5.9/get-global-styles-and-settings.php +++ b/lib/compat/wordpress-5.9/get-global-styles-and-settings.php @@ -99,14 +99,14 @@ function gutenberg_get_global_stylesheet( $types = array() ) { $types = array( 'variables', 'styles', 'presets' ); } - $origins = array( 'core', 'theme', 'user' ); + $origins = array( 'default', 'theme', 'user' ); if ( ! $supports_theme_json && ! $supports_link_color ) { // In this case we only enqueue the core presets (CSS Custom Properties + the classes). - $origins = array( 'core' ); + $origins = array( 'default' ); } elseif ( ! $supports_theme_json && $supports_link_color ) { // For the legacy link color feature to work, the CSS Custom Properties // should be in scope (either the core or the theme ones). - $origins = array( 'core', 'theme' ); + $origins = array( 'default', 'theme' ); } $tree = WP_Theme_JSON_Resolver_Gutenberg::get_merged_data(); diff --git a/lib/global-styles.php b/lib/global-styles.php index ddcba56c2eec..97deb8ccdb7f 100644 --- a/lib/global-styles.php +++ b/lib/global-styles.php @@ -114,7 +114,7 @@ function_exists( 'gutenberg_is_edit_site_page' ) && $colors_by_origin['user'] : ( isset( $colors_by_origin['theme'] ) ? $colors_by_origin['theme'] : - $colors_by_origin['core'] + $colors_by_origin['default'] ); } @@ -124,7 +124,7 @@ function_exists( 'gutenberg_is_edit_site_page' ) && $gradients_by_origin['user'] : ( isset( $gradients_by_origin['theme'] ) ? $gradients_by_origin['theme'] : - $gradients_by_origin['core'] + $gradients_by_origin['default'] ); } @@ -134,7 +134,7 @@ function_exists( 'gutenberg_is_edit_site_page' ) && $font_sizes_by_origin['user'] : ( isset( $font_sizes_by_origin['theme'] ) ? $font_sizes_by_origin['theme'] : - $font_sizes_by_origin['core'] + $font_sizes_by_origin['default'] ); } diff --git a/packages/block-editor/src/components/colors-gradients/panel-color-gradient-settings.js b/packages/block-editor/src/components/colors-gradients/panel-color-gradient-settings.js index a7b7324d1fdd..fa807439819f 100644 --- a/packages/block-editor/src/components/colors-gradients/panel-color-gradient-settings.js +++ b/packages/block-editor/src/components/colors-gradients/panel-color-gradient-settings.js @@ -174,7 +174,7 @@ const PanelColorGradientSettingsMultipleSelect = ( props ) => { const colorGradientSettings = useCommonSingleMultipleSelects(); const customColors = useSetting( 'color.palette.user' ); const themeColors = useSetting( 'color.palette.theme' ); - const defaultColors = useSetting( 'color.palette.core' ); + const defaultColors = useSetting( 'color.palette.default' ); const shouldDisplayDefaultColors = useSetting( 'color.defaultPalette' ); colorGradientSettings.colors = useMemo( () => { @@ -215,7 +215,7 @@ const PanelColorGradientSettingsMultipleSelect = ( props ) => { const customGradients = useSetting( 'color.gradients.user' ); const themeGradients = useSetting( 'color.gradients.theme' ); - const defaultGradients = useSetting( 'color.gradients.core' ); + const defaultGradients = useSetting( 'color.gradients.default' ); const shouldDisplayDefaultGradients = useSetting( 'color.defaultGradients' ); diff --git a/packages/block-editor/src/components/use-setting/index.js b/packages/block-editor/src/components/use-setting/index.js index 4108ddd24a95..c57a53026cb4 100644 --- a/packages/block-editor/src/components/use-setting/index.js +++ b/packages/block-editor/src/components/use-setting/index.js @@ -119,7 +119,7 @@ export default function useSetting( path ) { return ( experimentalFeaturesResult.user ?? experimentalFeaturesResult.theme ?? - experimentalFeaturesResult.core + experimentalFeaturesResult.default ); } return experimentalFeaturesResult; diff --git a/packages/components/src/mobile/global-styles-context/test/fixtures/theme.native.js b/packages/components/src/mobile/global-styles-context/test/fixtures/theme.native.js index 16d28c27d13f..5b5a9d0ad037 100644 --- a/packages/components/src/mobile/global-styles-context/test/fixtures/theme.native.js +++ b/packages/components/src/mobile/global-styles-context/test/fixtures/theme.native.js @@ -23,7 +23,7 @@ export const GLOBAL_STYLES_PALETTE = [ ]; export const GLOBAL_STYLES_GRADIENTS = { - core: [ + default: [ { name: 'Vivid cyan blue to vivid purple', gradient: @@ -138,7 +138,7 @@ export const PARSED_GLOBAL_STYLES = { export const RAW_FEATURES = { color: { palette: { - core: [ + default: [ { name: 'Black', slug: 'black', @@ -174,7 +174,7 @@ export const RAW_FEATURES = { ], }, gradients: { - core: [ + default: [ { name: 'Vivid cyan blue to vivid purple', gradient: @@ -204,7 +204,7 @@ export const RAW_FEATURES = { }, typography: { fontSizes: { - core: [ + default: [ { name: 'Small', slug: 'small', diff --git a/packages/components/src/mobile/global-styles-context/utils.native.js b/packages/components/src/mobile/global-styles-context/utils.native.js index 0c77562f54ed..a0b0f2aa2639 100644 --- a/packages/components/src/mobile/global-styles-context/utils.native.js +++ b/packages/components/src/mobile/global-styles-context/utils.native.js @@ -265,7 +265,7 @@ function normalizeFontSizes( fontSizes ) { const normalizedFontSizes = {}; const dimensions = Dimensions.get( 'window' ); - [ 'core', 'theme', 'user' ].forEach( ( key ) => { + [ 'default', 'theme', 'user' ].forEach( ( key ) => { if ( fontSizes[ key ] ) { normalizedFontSizes[ key ] = fontSizes[ key ]?.map( ( fontSizeObject ) => { diff --git a/packages/edit-site/src/components/global-styles/hooks.js b/packages/edit-site/src/components/global-styles/hooks.js index a8a20251188d..a639237ac0cf 100644 --- a/packages/edit-site/src/components/global-styles/hooks.js +++ b/packages/edit-site/src/components/global-styles/hooks.js @@ -65,7 +65,7 @@ export function useSetting( path, blockName, source = 'all' ) { const getSettingValue = ( configToUse ) => { const result = get( configToUse, currentPath ); if ( PATHS_WITH_MERGE[ path ] ) { - return result?.user ?? result?.theme ?? result?.core; + return result?.user ?? result?.theme ?? result?.default; } return result; }; @@ -220,7 +220,7 @@ export function getSupportedGlobalStylesPanels( name ) { export function useColorsPerOrigin( name ) { const [ customColors ] = useSetting( 'color.palette.user', name ); const [ themeColors ] = useSetting( 'color.palette.theme', name ); - const [ defaultColors ] = useSetting( 'color.palette.core', name ); + const [ defaultColors ] = useSetting( 'color.palette.default', name ); const [ shouldDisplayDefaultColors ] = useSetting( 'color.defaultPalette' ); return useMemo( () => { @@ -263,7 +263,7 @@ export function useColorsPerOrigin( name ) { export function useGradientsPerOrigin( name ) { const [ customGradients ] = useSetting( 'color.gradients.user', name ); const [ themeGradients ] = useSetting( 'color.gradients.theme', name ); - const [ defaultGradients ] = useSetting( 'color.gradients.core', name ); + const [ defaultGradients ] = useSetting( 'color.gradients.default', name ); const [ shouldDisplayDefaultGradients ] = useSetting( 'color.defaultGradients' ); diff --git a/packages/edit-site/src/components/global-styles/test/use-global-styles-output.js b/packages/edit-site/src/components/global-styles/test/use-global-styles-output.js index 1003aea3bc16..0c4f7d8119f9 100644 --- a/packages/edit-site/src/components/global-styles/test/use-global-styles-output.js +++ b/packages/edit-site/src/components/global-styles/test/use-global-styles-output.js @@ -268,7 +268,7 @@ describe( 'global styles renderer', () => { settings: { color: { palette: { - core: [ + default: [ { name: 'White', slug: 'white', @@ -286,7 +286,7 @@ describe( 'global styles renderer', () => { 'core/heading': { color: { palette: { - core: [ + default: [ { name: 'Blue', slug: 'blue', diff --git a/packages/edit-site/src/components/global-styles/use-global-styles-output.js b/packages/edit-site/src/components/global-styles/use-global-styles-output.js index a67c3e5fb3af..b0d40133cca2 100644 --- a/packages/edit-site/src/components/global-styles/use-global-styles-output.js +++ b/packages/edit-site/src/components/global-styles/use-global-styles-output.js @@ -60,7 +60,7 @@ function getPresetsDeclarations( blockPresets = {} ) { PRESET_METADATA, ( declarations, { path, valueKey, cssVarInfix } ) => { const presetByOrigin = get( blockPresets, path, [] ); - [ 'core', 'theme', 'user' ].forEach( ( origin ) => { + [ 'default', 'theme', 'user' ].forEach( ( origin ) => { if ( presetByOrigin[ origin ] ) { presetByOrigin[ origin ].forEach( ( value ) => { declarations.push( @@ -94,7 +94,7 @@ function getPresetsClasses( blockSelector, blockPresets = {} ) { } const presetByOrigin = get( blockPresets, path, [] ); - [ 'core', 'theme', 'user' ].forEach( ( origin ) => { + [ 'default', 'theme', 'user' ].forEach( ( origin ) => { if ( presetByOrigin[ origin ] ) { presetByOrigin[ origin ].forEach( ( { slug } ) => { classes.forEach( ( { classSuffix, propertyName } ) => { diff --git a/packages/edit-site/src/components/global-styles/utils.js b/packages/edit-site/src/components/global-styles/utils.js index 7ef155eca0b3..0b1c7607de23 100644 --- a/packages/edit-site/src/components/global-styles/utils.js +++ b/packages/edit-site/src/components/global-styles/utils.js @@ -90,7 +90,7 @@ function findInPresetsBy( for ( const presetByOrigin of orderedPresetsByOrigin ) { if ( presetByOrigin ) { // Preset origins ordered by priority. - const origins = [ 'user', 'theme', 'core' ]; + const origins = [ 'user', 'theme', 'default' ]; for ( const origin of origins ) { const presets = presetByOrigin[ origin ]; if ( presets ) { diff --git a/phpunit/class-wp-theme-json-test.php b/phpunit/class-wp-theme-json-test.php index d8c9f47a1460..fb2388dda544 100644 --- a/phpunit/class-wp-theme-json-test.php +++ b/phpunit/class-wp-theme-json-test.php @@ -64,7 +64,7 @@ function test_get_settings() { } function test_get_settings_presets_are_keyed_by_origin() { - $core_origin = new WP_Theme_JSON_Gutenberg( + $default_origin = new WP_Theme_JSON_Gutenberg( array( 'version' => WP_Theme_JSON_Gutenberg::LATEST_SCHEMA, 'settings' => array( @@ -91,9 +91,9 @@ function test_get_settings_presets_are_keyed_by_origin() { ), ), ), - 'core' + 'default' ); - $no_origin = new WP_Theme_JSON_Gutenberg( + $no_origin = new WP_Theme_JSON_Gutenberg( array( 'version' => WP_Theme_JSON_Gutenberg::LATEST_SCHEMA, 'settings' => array( @@ -122,15 +122,15 @@ function test_get_settings_presets_are_keyed_by_origin() { ) ); - $actual_core = $core_origin->get_raw_data(); + $actual_default = $default_origin->get_raw_data(); $actual_no_origin = $no_origin->get_raw_data(); - $expected_core = array( + $expected_default = array( 'version' => WP_Theme_JSON_Gutenberg::LATEST_SCHEMA, 'settings' => array( 'color' => array( 'palette' => array( - 'core' => array( + 'default' => array( array( 'slug' => 'white', 'color' => 'white', @@ -142,7 +142,7 @@ function test_get_settings_presets_are_keyed_by_origin() { 'core/group' => array( 'color' => array( 'palette' => array( - 'core' => array( + 'default' => array( array( 'slug' => 'white', 'color' => 'white', @@ -184,7 +184,7 @@ function test_get_settings_presets_are_keyed_by_origin() { ), ); - $this->assertEqualSetsWithIndex( $expected_core, $actual_core ); + $this->assertEqualSetsWithIndex( $expected_default, $actual_default ); $this->assertEqualSetsWithIndex( $expected_no_origin, $actual_no_origin ); } @@ -553,7 +553,7 @@ public function test_get_stylesheet_preset_values_are_marked_as_important() { ), ), ), - 'core' + 'default' ); $this->assertEquals(