From f2be1c732e524363972bf6dae2376c89f8a7e51b Mon Sep 17 00:00:00 2001 From: mxkae Date: Thu, 22 Feb 2024 20:25:00 +0800 Subject: [PATCH 1/4] fix shadow color and opacity --- src/components/shadow-control/index.js | 52 +++----------------------- 1 file changed, 6 insertions(+), 46 deletions(-) diff --git a/src/components/shadow-control/index.js b/src/components/shadow-control/index.js index 397100ecd..88c8db52a 100644 --- a/src/components/shadow-control/index.js +++ b/src/components/shadow-control/index.js @@ -2,13 +2,10 @@ * External dependencies */ import { i18n } from 'stackable' -import { - compact, isNumber, isEqual, -} from 'lodash' +import { compact, isEqual } from 'lodash' import { AdvancedRangeControl, AdvancedToggleControl, ColorPaletteControl, Popover, } from '~stackable/components' -import { hexToRgba, extractColor } from '~stackable/util' import AdvancedControl, { extractControlProps } from '~stackable/components/base-control2' import { useControlHandlers } from '~stackable/components/base-control2/hooks' @@ -103,34 +100,8 @@ const FILTERS = [ key: 'shadowColor', props: { label: __( 'Shadow Color', i18n ), - disableAlpha: false, - }, - default: 'rgba(0,0,0,1)', - changeCallback: color => { - if ( color?.startsWith( 'rgba(' ) ) { - return color - } - - if ( color?.startsWith( 'rgb(' ) ) { - return color?.replace( 'rgb', 'rgba' ).replace( /\)$/g, ', 1)' ) || '' - } - - color = extractColor( color ) - - const rgba = hexToRgba( color ) - - return rgba.startsWith( 'rgb(' ) ? rgba.replace( 'rgb', 'rgba' ).replace( /\)$/g, ', 1)' ) : rgba - }, - }, - { - component: AdvancedRangeControl, - key: 'opacity', - props: { - label: __( 'Shadow Opacity', i18n ), - min: 0, - max: 1, - step: 0.1, }, + default: '#000000', }, ] @@ -146,13 +117,6 @@ const filterToValue = ( props, filters ) => { return undefined } - if ( key === 'shadowColor' ) { - const opacity = filters.opacity - if ( isNumber( opacity ) || opacity === '' || opacity === undefined ) { - return ( filters[ key ] || filterItem.default || '' ).replace( /,[\d| ||\.]*\)$/g, () => `, ${ ! isNumber( opacity ) ? 1 : opacity })` ) - } - } - if ( filterItem.show && ! filterItem.show( props ) ) { return undefined } @@ -176,12 +140,9 @@ const ShadowFilterControl = props => { useEffect( () => { if ( value ) { let _value = value - let rgbaValue = '' - let opacity = 1 - _value = _value.replace( /rgba\(.*\)$/g, value => { - rgbaValue = value - opacity = value.match( /[\d| ||\.]*\)$/g )[ 0 ] - opacity = parseFloat( opacity ) + let hexValue = '' + _value = _value.replace( /#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})([0-9a-fA-F]{2})?$/g, value => { + hexValue = value return '' } ).trim() @@ -197,8 +158,7 @@ const ShadowFilterControl = props => { filters.verticalOffset = parseInt( verticalOffset ) filters.blur = parseInt( blur ) filters.shadowSpread = isNaN( parseInt( spread ) ) ? '' : parseInt( spread ) - filters.shadowColor = rgbaValue - filters.opacity = opacity + filters.shadowColor = hexValue setFilters( { ...filters } ) } }, [ value ] ) From 466e1125d797c186cd411a59ff58ad5a0581a576 Mon Sep 17 00:00:00 2001 From: mxkae Date: Mon, 26 Feb 2024 01:58:40 +0800 Subject: [PATCH 2/4] test heading deprecation --- src/block-components/block-div/deprecated.js | 11 +++- src/block-components/block-div/index.js | 2 +- .../container-div/deprecated.js | 11 +++- src/block-components/container-div/index.js | 2 +- .../helpers/borders/attributes.js | 4 ++ .../helpers/borders/deprecated.js | 63 +++++++++++++++++++ src/block-components/typography/deprecated.js | 49 ++++++++++++++- src/block-components/typography/index.js | 2 +- src/block/heading/deprecated.js | 22 +++++++ src/components/shadow-control/index.js | 4 -- src/util/colors.js | 29 +++++++++ 11 files changed, 189 insertions(+), 10 deletions(-) diff --git a/src/block-components/block-div/deprecated.js b/src/block-components/block-div/deprecated.js index b0a7bacb8..f8f2655b8 100644 --- a/src/block-components/block-div/deprecated.js +++ b/src/block-components/block-div/deprecated.js @@ -1,4 +1,4 @@ -import { deprecationBackgrounColorOpacity } from '../helpers' +import { deprecationBackgrounColorOpacity, deprecateShadowColor } from '../helpers' import { addFilter } from '@wordpress/hooks' import { semverCompare } from '~stackable/util' @@ -29,3 +29,12 @@ export const deprecateBlockBackgroundColorOpacity = { return deprecationBackgrounColorOpacity.migrate( 'block%s' )( attributes ) }, } + +export const deprecateBlockShadowColor = { + isEligible: attributes => { + return deprecateShadowColor.isEligible( 'block%s' )( attributes ) + }, + migrate: attributes => { + return deprecateShadowColor.migrate( 'block%s' )( attributes ) + }, +} diff --git a/src/block-components/block-div/index.js b/src/block-components/block-div/index.js index 9094c89ff..8b2625131 100644 --- a/src/block-components/block-div/index.js +++ b/src/block-components/block-div/index.js @@ -17,7 +17,7 @@ import { CustomAttributes } from '../custom-attributes' import { version as VERSION } from 'stackable' export { useUniqueId } -export { deprecateBlockBackgroundColorOpacity } from './deprecated' +export { deprecateBlockBackgroundColorOpacity, deprecateBlockShadowColor } from './deprecated' export const BlockDiv = props => { const { diff --git a/src/block-components/container-div/deprecated.js b/src/block-components/container-div/deprecated.js index 293e6f7ff..d86e48587 100644 --- a/src/block-components/container-div/deprecated.js +++ b/src/block-components/container-div/deprecated.js @@ -1,4 +1,4 @@ -import { deprecationBackgrounColorOpacity } from '../helpers' +import { deprecationBackgrounColorOpacity, deprecateShadowColor } from '../helpers' export const deprecateContainerBackgroundColorOpacity = { isEligible: attributes => { @@ -8,3 +8,12 @@ export const deprecateContainerBackgroundColorOpacity = { return deprecationBackgrounColorOpacity.migrate( 'container%s' )( attributes ) }, } + +export const deprecateContainerShadowColor = { + isEligible: attributes => { + return deprecateShadowColor.isEligible( 'container%s' )( attributes ) + }, + migrate: attributes => { + return deprecateShadowColor.migrate( 'container%s' )( attributes ) + }, +} diff --git a/src/block-components/container-div/index.js b/src/block-components/container-div/index.js index a64380fb5..89fdb5e93 100644 --- a/src/block-components/container-div/index.js +++ b/src/block-components/container-div/index.js @@ -8,7 +8,7 @@ import { getUniqueBlockClass, useQueryLoopInstanceId } from '~stackable/util' import { useBlockAttributesContext } from '~stackable/hooks' import { applyFilters } from '@wordpress/hooks' -export { deprecateContainerBackgroundColorOpacity } from './deprecated' +export { deprecateContainerBackgroundColorOpacity, deprecateContainerShadowColor } from './deprecated' export const ContainerDiv = props => { const attributes = useBlockAttributesContext( attributes => { diff --git a/src/block-components/helpers/borders/attributes.js b/src/block-components/helpers/borders/attributes.js index 2ff942c19..e8637b5e5 100644 --- a/src/block-components/helpers/borders/attributes.js +++ b/src/block-components/helpers/borders/attributes.js @@ -1,3 +1,5 @@ +import { deprecatedAddAttributes } from './deprecated' + export const borderAttributes = { borderType: { type: 'string', @@ -32,6 +34,8 @@ export const borderAttributes = { } export const addBorderAttributes = ( attrObject, attrNameTemplate = '%s' ) => { + deprecatedAddAttributes( attrObject, attrNameTemplate ) + attrObject.add( { attributes: borderAttributes, attrNameTemplate, diff --git a/src/block-components/helpers/borders/deprecated.js b/src/block-components/helpers/borders/deprecated.js index da44f8b2f..e2b0d5293 100644 --- a/src/block-components/helpers/borders/deprecated.js +++ b/src/block-components/helpers/borders/deprecated.js @@ -1,3 +1,7 @@ +import { + extractRgba, rgbaToHexAlpha, getAttrNameFunction, +} from '~stackable/util' + import { addFilter } from '@wordpress/hooks' import { dispatch } from '@wordpress/data' @@ -32,3 +36,62 @@ addFilter( 'stackable.block-component.helpers.borders', 'borders', ( output, get } ) } } ) + +export const deprecatedAddAttributes = ( attrObject, attrNameTemplate = '%s' ) => { + attrObject.add( { + attributes: { + shadow: { + type: 'string', + default: '', + }, + }, + versionAdded: '3.0.0', + versionDeprecated: '3.12.11', + attrNameTemplate, + } ) +} + +export const deprecateShadowColor = { + isEligible: attrNameTemplate => attributes => { + const getAttrName = getAttrNameFunction( attrNameTemplate ) + const getAttribute = _attrName => attributes[ getAttrName( _attrName ) ] + + if ( getAttribute( 'shadow' ) || getAttribute( 'shadowHover' ) || getAttribute( 'shadowParentHover' ) ) { + return true + } + + return false + }, + migrate: attrNameTemplate => attributes => { + const getAttrName = getAttrNameFunction( attrNameTemplate ) + const getAttribute = _attrName => attributes[ getAttrName( _attrName ) ] + + const newAttributes = { + ...attributes, + } + + const shadow = getAttribute( 'shadow' ) + const shadowHover = getAttribute( 'shadowHover' ) || shadow + const shadowParentHover = getAttribute( 'shadowParentHover' ) || shadowHover + + if ( getAttribute( 'shadow' ) && getAttribute( 'shadow' ).indexOf( 'rgba' ) !== -1 ) { + const { options, color } = extractRgba( shadow ) + const hex = rgbaToHexAlpha( color ) + newAttributes[ getAttrName( 'shadow' ) ] = `${ options } ${ hex }` + } + + if ( getAttribute( 'shadowHover' ) && getAttribute( 'shadowHover' ).indexOf( 'rgba' ) !== -1 ) { + const { options, color } = extractRgba( shadowHover ) + const hex = rgbaToHexAlpha( color ) + newAttributes[ getAttrName( 'shadowHover' ) ] = `${ options } ${ hex }` + } + + if ( getAttribute( 'shadowParentHover' ) && getAttribute( 'shadowParentHover' ).indexOf( 'rgba' ) !== -1 ) { + const { options, color } = extractRgba( shadowParentHover ) + const hex = rgbaToHexAlpha( color ) + newAttributes[ getAttrName( 'shadowParentHover' ) ] = `${ options } ${ hex }` + } + + return newAttributes + }, +} diff --git a/src/block-components/typography/deprecated.js b/src/block-components/typography/deprecated.js index c9c8f873a..968b06698 100644 --- a/src/block-components/typography/deprecated.js +++ b/src/block-components/typography/deprecated.js @@ -1,4 +1,6 @@ -import { getAttrNameFunction } from '~stackable/util' +import { + extractRgba, rgbaToHexAlpha, getAttrNameFunction, +} from '~stackable/util' export const deprecatedAddAttributes = ( attrObject, options ) => { const { @@ -49,3 +51,48 @@ export const deprecateTypographyGradientColor = { return newAttributes }, } + +export const deprecateTypographyShadowColor = { + isEligible: attrNameTemplate => attributes => { + const getAttrName = getAttrNameFunction( attrNameTemplate ) + const getAttribute = _attrName => attributes[ getAttrName( _attrName ) ] + + if ( getAttribute( 'textShadow' ) || getAttribute( 'textShadowHover' ) || getAttribute( 'textShadowParentHover' ) ) { + return true + } + + return false + }, + migrate: attrNameTemplate => attributes => { + const getAttrName = getAttrNameFunction( attrNameTemplate ) + const getAttribute = _attrName => attributes[ getAttrName( _attrName ) ] + + const newAttributes = { + ...attributes, + } + + const shadow = getAttribute( 'textShadow' ) + const shadowHover = getAttribute( 'textShadowHover' ) || shadow + const shadowParentHover = getAttribute( 'textShadowParentHover' ) || shadowHover + + if ( getAttribute( 'textShadow' ) && getAttribute( 'textShadow' ).indexOf( 'rgba' ) !== -1 ) { + const { options, color } = extractRgba( shadowHover ) + const hex = rgbaToHexAlpha( color ) + newAttributes[ getAttrName( 'textShadow' ) ] = `${ options } ${ hex }` + } + + if ( getAttribute( 'textShadowHover' ) && getAttribute( 'textShadowHover' ).indexOf( 'rgba' ) !== -1 ) { + const { options, color } = extractRgba( shadowHover ) + const hex = rgbaToHexAlpha( color ) + newAttributes[ getAttrName( 'textShadowHover' ) ] = `${ options } ${ hex }` + } + + if ( getAttribute( 'textShadowParentHover' ) && getAttribute( 'textShadowParentHover' ).indexOf( 'rgba' ) !== -1 ) { + const { options, color } = extractRgba( shadowParentHover ) + const hex = rgbaToHexAlpha( color ) + newAttributes[ getAttrName( 'textShadowParentHover' ) ] = `${ options } ${ hex }` + } + + return newAttributes + }, +} diff --git a/src/block-components/typography/index.js b/src/block-components/typography/index.js index 7e877769c..ec6198113 100644 --- a/src/block-components/typography/index.js +++ b/src/block-components/typography/index.js @@ -28,7 +28,7 @@ import { memo, } from '@wordpress/element' -export { deprecateTypographyGradientColor } from './deprecated' +export { deprecateTypographyGradientColor, deprecateTypographyShadowColor } from './deprecated' export const Typography = memo( forwardRef( ( props, ref ) => { const { diff --git a/src/block/heading/deprecated.js b/src/block/heading/deprecated.js index d72e92c9f..97b7c590d 100644 --- a/src/block/heading/deprecated.js +++ b/src/block/heading/deprecated.js @@ -11,6 +11,7 @@ import { withVersion } from '~stackable/higher-order' import compareVersions from 'compare-versions' import { deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity, deprecateTypographyGradientColor, getResponsiveClasses, + deprecateBlockShadowColor, deprecateContainerShadowColor, deprecateTypographyShadowColor, } from '~stackable/block-components' /** @@ -33,6 +34,27 @@ addFilter( 'stackable.heading.save.blockClassNames', 'stackable/3.6.1', ( output } ) const deprecated = [ + { + // Support the new shadow color. + attributes: attributes( '3.12.11' ), + save: withVersion( '3.12.11' )( Save ), + isEligible: attributes => { + const hasBlockShadow = deprecateBlockShadowColor.isEligible( attributes ) + const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes ) + const hasTextShadow = deprecateTypographyShadowColor.isEligible( '%s' )( attributes ) + + return hasBlockShadow || hasContainerShadow || hasTextShadow + }, + migrate: attributes => { + let newAttributes = { ...attributes } + + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + newAttributes = deprecateTypographyShadowColor.migrate( '%s' )( newAttributes ) + + return newAttributes + }, + }, // Support the new combined opacity and color. { attributes: attributes( '3.11.9' ), diff --git a/src/components/shadow-control/index.js b/src/components/shadow-control/index.js index 88c8db52a..c16c45955 100644 --- a/src/components/shadow-control/index.js +++ b/src/components/shadow-control/index.js @@ -113,10 +113,6 @@ const filterToValue = ( props, filters ) => { return filters[ key ] ? 'inset' : '' } - if ( key === 'opacity' ) { - return undefined - } - if ( filterItem.show && ! filterItem.show( props ) ) { return undefined } diff --git a/src/util/colors.js b/src/util/colors.js index 1a02ef60c..21507ca7b 100644 --- a/src/util/colors.js +++ b/src/util/colors.js @@ -99,3 +99,32 @@ export const colorOpacityToHexAplha = ( color, opacity ) => { } return color } + +export const extractRgba = value => { + let options = value + let color = '' + options = options.replace( /rgba\(.*\)$/g, val => { + color = val + return '' + } ).trim() + + return { + options, + color, + } +} + +export const rgbaToHexAlpha = color => { + const rgba = color.substring( 5, color.length - 1 ).split( ',' ) + + const hexAlpha = rgba.map( ( val, i ) => { + if ( i === 3 ) { + const opacity = parseFloat( val ) + return Math.ceil( ( opacity * 255 ) ).toString( 16 ).padStart( 2, '0' ) + } + const hex = parseInt( val ).toString( 16 ) + return hex.length === 1 ? '0' + hex : hex + } ) + + return '#' + hexAlpha.join( '' ) +} From 12dcc61f5dc6cdebd6ccee2fdd60bb86787ef0b3 Mon Sep 17 00:00:00 2001 From: mxkae Date: Mon, 26 Feb 2024 02:48:40 +0800 Subject: [PATCH 3/4] add deprecation for other blocks --- src/block/accordion/deprecated.js | 24 +++++++++++++++++- src/block/blockquote/deprecated.js | 24 +++++++++++++++++- src/block/button-group/deprecated/index.js | 24 +++++++++++++++++- src/block/button/deprecated.js | 25 +++++++++++++++++- src/block/call-to-action/deprecated.js | 28 ++++++++++++++++++++- src/block/card/deprecated.js | 23 ++++++++++++++++- src/block/carousel/deprecated.js | 28 ++++++++++++++++++++- src/block/column/deprecated.js | 24 +++++++++++++++++- src/block/columns/deprecated.js | 28 ++++++++++++++++++++- src/block/count-up/deprecated.js | 22 ++++++++++++++++ src/block/countdown/deprecated.js | 20 +++++++++++++++ src/block/divider/deprecated.js | 24 +++++++++++++++++- src/block/expand/deprecated.js | 24 +++++++++++++++++- src/block/feature-grid/deprecated.js | 27 +++++++++++++++++++- src/block/feature/deprecated.js | 24 ++++++++++++++++++ src/block/hero/deprecated.js | 28 ++++++++++++++++++++- src/block/horizontal-scroller/deprecated.js | 24 +++++++++++++++++- src/block/icon-box/deprecated.js | 24 +++++++++++++++++- src/block/icon-button/deprecated.js | 25 +++++++++++++++++- src/block/icon-label/deprecated.js | 24 +++++++++++++++++- src/block/icon-list-item/deprecated.js | 28 +++++++++++++++++++++ src/block/icon-list-item/index.js | 2 ++ src/block/icon-list/deprecated/index.js | 20 +++++++++++++++ src/block/icon/deprecated.js | 24 +++++++++++++++++- src/block/image-box/deprecated.js | 24 +++++++++++++++++- src/block/image/deprecated.js | 22 ++++++++++++++++ src/block/map/deprecated.js | 24 +++++++++++++++++- src/block/notification/deprecated.js | 24 +++++++++++++++++- src/block/number-box/deprecated.js | 22 ++++++++++++++++ src/block/posts/deprecated.js | 25 +++++++++++++++++- src/block/price/deprecated.js | 24 +++++++++++++++++- src/block/pricing-box/deprecated.js | 25 ++++++++++++++++-- src/block/progress-bar/deprecated.js | 22 ++++++++++++++++ src/block/progress-circle/deprecated.js | 22 ++++++++++++++++ src/block/separator/deprecated.js | 26 ++++++++++++++++++- src/block/spacer/deprecated.js | 24 +++++++++++++++++- src/block/subtitle/deprecated.js | 22 ++++++++++++++++ src/block/tab-content/deprecated.js | 24 +++++++++++++++++- src/block/tab-labels/deprecated.js | 26 +++++++++++++++++++ src/block/table-of-contents/deprecated.js | 20 +++++++++++++++ src/block/tabs/deprecated.js | 24 +++++++++++++++++- src/block/team-member/deprecated.js | 24 +++++++++++++++++- src/block/testimonial/deprecated.js | 24 +++++++++++++++++- src/block/text/deprecated.js | 22 ++++++++++++++++ src/block/timeline/deprecated.js | 22 ++++++++++++++++ src/block/video-popup/deprecated.js | 24 +++++++++++++++++- 46 files changed, 1052 insertions(+), 32 deletions(-) create mode 100644 src/block/icon-list-item/deprecated.js diff --git a/src/block/accordion/deprecated.js b/src/block/accordion/deprecated.js index 1a6f40cae..7434314cb 100644 --- a/src/block/accordion/deprecated.js +++ b/src/block/accordion/deprecated.js @@ -2,9 +2,31 @@ import { Save } from './save' import { attributes } from './schema' import { withVersion } from '~stackable/higher-order' -import { deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity } from '~stackable/block-components' +import { + deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity, + deprecateBlockShadowColor, deprecateContainerShadowColor, +} from '~stackable/block-components' const deprecated = [ + { + // Support the new shadow color. + attributes: attributes( '3.12.11' ), + save: withVersion( '3.12.11' )( Save ), + isEligible: attributes => { + const hasBlockShadow = deprecateBlockShadowColor.isEligible( attributes ) + const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes ) + + return hasBlockShadow || hasContainerShadow + }, + migrate: attributes => { + let newAttributes = { ...attributes } + + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + + return newAttributes + }, + }, // Support the new combined opacity and color. { attributes: attributes( '3.11.9' ), diff --git a/src/block/blockquote/deprecated.js b/src/block/blockquote/deprecated.js index 5f940d480..38a4aefdb 100644 --- a/src/block/blockquote/deprecated.js +++ b/src/block/blockquote/deprecated.js @@ -2,9 +2,31 @@ import { Save } from './save' import { attributes } from './schema' import { withVersion } from '~stackable/higher-order' -import { deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity } from '~stackable/block-components' +import { + deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity, + deprecateBlockShadowColor, deprecateContainerShadowColor, +} from '~stackable/block-components' const deprecated = [ + { + // Support the new shadow color. + attributes: attributes( '3.12.11' ), + save: withVersion( '3.12.11' )( Save ), + isEligible: attributes => { + const hasBlockShadow = deprecateBlockShadowColor.isEligible( attributes ) + const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes ) + + return hasBlockShadow || hasContainerShadow + }, + migrate: attributes => { + let newAttributes = { ...attributes } + + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + + return newAttributes + }, + }, { // Support the new combined opacity and color. attributes: attributes( '3.11.9' ), diff --git a/src/block/button-group/deprecated/index.js b/src/block/button-group/deprecated/index.js index 2fde64245..ea2d66e33 100644 --- a/src/block/button-group/deprecated/index.js +++ b/src/block/button-group/deprecated/index.js @@ -4,9 +4,31 @@ import { Save } from '../save' import { attributes } from '../schema' import { withVersion } from '~stackable/higher-order' -import { deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity } from '~stackable/block-components' +import { + deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity, + deprecateBlockShadowColor, deprecateContainerShadowColor, +} from '~stackable/block-components' const deprecated = [ + { + // Support the new shadow color. + attributes: attributes( '3.12.11' ), + save: withVersion( '3.12.11' )( Save ), + isEligible: attributes => { + const hasBlockShadow = deprecateBlockShadowColor.isEligible( attributes ) + const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes ) + + return hasBlockShadow || hasContainerShadow + }, + migrate: attributes => { + let newAttributes = { ...attributes } + + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + + return newAttributes + }, + }, // Support the new combined opacity and color. { attributes: attributes( '3.11.9' ), diff --git a/src/block/button/deprecated.js b/src/block/button/deprecated.js index 260438d3a..644acc839 100644 --- a/src/block/button/deprecated.js +++ b/src/block/button/deprecated.js @@ -3,10 +3,33 @@ import { attributes } from './schema' import { withVersion } from '~stackable/higher-order' import { - deprecateBlockBackgroundColorOpacity, deprecateButtonGradientColor, deprecateContainerBackgroundColorOpacity, + deprecateBlockBackgroundColorOpacity, deprecateButtonGradientColor, + deprecateContainerBackgroundColorOpacity, deprecateShadowColor, + deprecateContainerShadowColor, deprecateBlockShadowColor, } from '~stackable/block-components' const deprecated = [ + { + // Support the new shadow color. + attributes: attributes( '3.12.11' ), + save: withVersion( '3.12.11' )( Save ), + isEligible: attributes => { + const hasBlockShadow = deprecateBlockShadowColor.isEligible( attributes ) + const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes ) + const hasButtonShadow = deprecateShadowColor.isEligible( 'button%s' )( attributes ) + + return hasBlockShadow || hasContainerShadow || hasButtonShadow + }, + migrate: attributes => { + let newAttributes = { ...attributes } + + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + newAttributes = deprecateShadowColor.migrate( 'button%s' )( attributes ) + + return newAttributes + }, + }, { // Support the new combined opacity and color. attributes: attributes( '3.11.9' ), diff --git a/src/block/call-to-action/deprecated.js b/src/block/call-to-action/deprecated.js index 96da7f730..60b67c2ce 100644 --- a/src/block/call-to-action/deprecated.js +++ b/src/block/call-to-action/deprecated.js @@ -8,7 +8,10 @@ import { attributes } from './schema' * External dependencies */ import { withVersion } from '~stackable/higher-order' -import { deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity } from '~stackable/block-components' +import { + deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity, + deprecateBlockShadowColor, deprecateContainerShadowColor, deprecateShadowColor, +} from '~stackable/block-components' import compareVersions from 'compare-versions' /** @@ -32,6 +35,29 @@ addFilter( 'stackable.call-to-action.save.innerClassNames', 'stackable/3.8.0', ( } ) const deprecated = [ + { + // Support the new shadow color. + attributes: attributes( '3.12.11' ), + save: withVersion( '3.12.11' )( Save ), + isEligible: attributes => { + const hasBlockShadow = deprecateBlockShadowColor.isEligible( attributes ) + const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes ) + const hasTopSeparatorShadow = deprecateShadowColor.isEligible( 'topSeparator%s' )( attributes ) + const hasBottomSeparatorShadow = deprecateShadowColor.isEligible( 'bottomSeparator%s' )( attributes ) + + return hasBlockShadow || hasContainerShadow || hasTopSeparatorShadow || hasBottomSeparatorShadow + }, + migrate: attributes => { + let newAttributes = { ...attributes } + + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + newAttributes = deprecateShadowColor.migrate( 'topSeparator%s' )( newAttributes ) + newAttributes = deprecateShadowColor.migrate( 'bottomSeparator%s' )( newAttributes ) + + return newAttributes + }, + }, // Support the new combined opacity and color. { attributes: attributes( '3.11.9' ), diff --git a/src/block/card/deprecated.js b/src/block/card/deprecated.js index 6aece8e7e..7fdfa2ea4 100644 --- a/src/block/card/deprecated.js +++ b/src/block/card/deprecated.js @@ -10,7 +10,9 @@ import { attributes } from './schema' import { withVersion } from '~stackable/higher-order' import compareVersions from 'compare-versions' import { - deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity, deprecationImageOverlayOpacity, getAlignmentClasses, + deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity, + deprecationImageOverlayOpacity, getAlignmentClasses, + deprecateBlockShadowColor, deprecateContainerShadowColor, } from '~stackable/block-components' /** @@ -84,6 +86,25 @@ addFilter( 'stackable.card.save.innerClassNames', 'stackable/3.0.2', ( output, p } ) const deprecated = [ + { + // Support the new shadow color. + attributes: attributes( '3.12.11' ), + save: withVersion( '3.12.11' )( Save ), + isEligible: attributes => { + const hasBlockShadow = deprecateBlockShadowColor.isEligible( attributes ) + const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes ) + + return hasBlockShadow || hasContainerShadow + }, + migrate: attributes => { + let newAttributes = { ...attributes } + + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + + return newAttributes + }, + }, { // We have to repeat this because the older deprecations are not called when this triggers. attributes: attributes( '3.11.9' ), diff --git a/src/block/carousel/deprecated.js b/src/block/carousel/deprecated.js index a3df0531b..53d9c18ea 100644 --- a/src/block/carousel/deprecated.js +++ b/src/block/carousel/deprecated.js @@ -1,10 +1,36 @@ -import { deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity } from '~stackable/block-components' +import { + deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity, + deprecateBlockShadowColor, deprecateContainerShadowColor, deprecateShadowColor, +} from '~stackable/block-components' import { Save } from './save' import { attributes } from './schema' import { withVersion } from '~stackable/higher-order' const deprecated = [ + { + // Support the new shadow color. + attributes: attributes( '3.12.11' ), + save: withVersion( '3.12.11' )( Save ), + isEligible: attributes => { + const hasBlockShadow = deprecateBlockShadowColor.isEligible( attributes ) + const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes ) + const hasTopSeparatorShadow = deprecateShadowColor.isEligible( 'topSeparator%s' )( attributes ) + const hasBottomSeparatorShadow = deprecateShadowColor.isEligible( 'bottomSeparator%s' )( attributes ) + + return hasBlockShadow || hasContainerShadow || hasTopSeparatorShadow || hasBottomSeparatorShadow + }, + migrate: attributes => { + let newAttributes = { ...attributes } + + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + newAttributes = deprecateShadowColor.migrate( 'topSeparator%s' )( newAttributes ) + newAttributes = deprecateShadowColor.migrate( 'bottomSeparator%s' )( newAttributes ) + + return newAttributes + }, + }, // Support the new combined opacity and color. { attributes: attributes( '3.11.9' ), diff --git a/src/block/column/deprecated.js b/src/block/column/deprecated.js index aabb51fd7..ac8bdc3d3 100644 --- a/src/block/column/deprecated.js +++ b/src/block/column/deprecated.js @@ -15,7 +15,10 @@ import classnames from 'classnames/dedupe' */ import { addFilter } from '@wordpress/hooks' import { semverCompare } from '~stackable/util' -import { deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity } from '~stackable/block-components' +import { + deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity, + deprecateBlockShadowColor, deprecateContainerShadowColor, +} from '~stackable/block-components' // Version 3.8 added horizontal flex, we changed the stk--block-orientation-* to stk--block-horizontal-flex. addFilter( 'stackable.column.save.innerClassNames', 'stackable/3.8.0', ( output, props ) => { @@ -72,6 +75,25 @@ addFilter( 'stackable.column.save.blockClassNames', 'stackable/3.8.0', ( output, } ) const deprecated = [ + { + // Support the new shadow color. + attributes: attributes( '3.12.11' ), + save: withVersion( '3.12.11' )( Save ), + isEligible: attributes => { + const hasBlockShadow = deprecateBlockShadowColor.isEligible( attributes ) + const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes ) + + return hasBlockShadow || hasContainerShadow + }, + migrate: attributes => { + let newAttributes = { ...attributes } + + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + + return newAttributes + }, + }, { // Support the new combined opacity and color. attributes: attributes( '3.11.9' ), diff --git a/src/block/columns/deprecated.js b/src/block/columns/deprecated.js index 5110794c0..caf351751 100644 --- a/src/block/columns/deprecated.js +++ b/src/block/columns/deprecated.js @@ -14,7 +14,10 @@ import { withVersion } from '~stackable/higher-order' */ import { addFilter } from '@wordpress/hooks' import { semverCompare } from '~stackable/util' -import { deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity } from '~stackable/block-components' +import { + deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity, + deprecateBlockShadowColor, deprecateContainerShadowColor, deprecateShadowColor, +} from '~stackable/block-components' // Version 3.6.2 Deprecations, we now don't need the stk--has-column-order class. addFilter( 'stackable.columns.save.contentClassNames', 'stackable/3.8.0', ( classes, props ) => { @@ -33,6 +36,29 @@ addFilter( 'stackable.columns.save.contentClassNames', 'stackable/3.8.0', ( clas } ) const deprecated = [ + { + // Support the new shadow color. + attributes: attributes( '3.12.11' ), + save: withVersion( '3.12.11' )( Save ), + isEligible: attributes => { + const hasBlockShadow = deprecateBlockShadowColor.isEligible( attributes ) + const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes ) + const hasTopSeparatorShadow = deprecateShadowColor.isEligible( 'topSeparator%s' )( attributes ) + const hasBottomSeparatorShadow = deprecateShadowColor.isEligible( 'bottomSeparator%s' )( attributes ) + + return hasBlockShadow || hasContainerShadow || hasTopSeparatorShadow || hasBottomSeparatorShadow + }, + migrate: attributes => { + let newAttributes = { ...attributes } + + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + newAttributes = deprecateShadowColor.migrate( 'topSeparator%s' )( newAttributes ) + newAttributes = deprecateShadowColor.migrate( 'bottomSeparator%s' )( newAttributes ) + + return newAttributes + }, + }, { // Support the new combined opacity and color. attributes: attributes( '3.11.9' ), diff --git a/src/block/count-up/deprecated.js b/src/block/count-up/deprecated.js index a0679333e..d9a18b572 100644 --- a/src/block/count-up/deprecated.js +++ b/src/block/count-up/deprecated.js @@ -4,9 +4,31 @@ import { attributes } from './schema' import { withVersion } from '~stackable/higher-order' import { deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity, deprecateTypographyGradientColor, + deprecateTypographyShadowColor, deprecateBlockShadowColor, deprecateContainerShadowColor, } from '~stackable/block-components' const deprecated = [ + { + // Support the new shadow color. + attributes: attributes( '3.12.11' ), + save: withVersion( '3.12.11' )( Save ), + isEligible: attributes => { + const hasBlockShadow = deprecateBlockShadowColor.isEligible( attributes ) + const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes ) + const hasTextShadow = deprecateTypographyShadowColor.isEligible( '%s' )( attributes ) + + return hasBlockShadow || hasContainerShadow || hasTextShadow + }, + migrate: attributes => { + let newAttributes = { ...attributes } + + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + newAttributes = deprecateTypographyShadowColor.migrate( '%s' )( newAttributes ) + + return newAttributes + }, + }, // Support the new combined opacity and color. { attributes: attributes( '3.11.9' ), diff --git a/src/block/countdown/deprecated.js b/src/block/countdown/deprecated.js index 79d8d301d..9de29a4e8 100644 --- a/src/block/countdown/deprecated.js +++ b/src/block/countdown/deprecated.js @@ -1,5 +1,6 @@ import { deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity, deprecateTypographyGradientColor, + deprecateBlockShadowColor, deprecateContainerShadowColor, } from '~stackable/block-components' import { Save } from './save' import { attributes } from './schema' @@ -7,6 +8,25 @@ import { attributes } from './schema' import { withVersion } from '~stackable/higher-order' const deprecated = [ + { + // Support the new shadow color. + attributes: attributes( '3.12.11' ), + save: withVersion( '3.12.11' )( Save ), + isEligible: attributes => { + const hasBlockShadow = deprecateBlockShadowColor.isEligible( attributes ) + const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes ) + + return hasBlockShadow || hasContainerShadow + }, + migrate: attributes => { + let newAttributes = { ...attributes } + + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + + return newAttributes + }, + }, // Support the new combined opacity and color. { attributes: attributes( '3.11.9' ), diff --git a/src/block/divider/deprecated.js b/src/block/divider/deprecated.js index 0914b7646..6024aad74 100644 --- a/src/block/divider/deprecated.js +++ b/src/block/divider/deprecated.js @@ -2,9 +2,31 @@ import { Save } from './save' import { attributes } from './schema' import { withVersion } from '~stackable/higher-order' -import { deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity } from '~stackable/block-components' +import { + deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity, + deprecateBlockShadowColor, deprecateContainerShadowColor, +} from '~stackable/block-components' const deprecated = [ + { + // Support the new shadow color. + attributes: attributes( '3.12.11' ), + save: withVersion( '3.12.11' )( Save ), + isEligible: attributes => { + const hasBlockShadow = deprecateBlockShadowColor.isEligible( attributes ) + const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes ) + + return hasBlockShadow || hasContainerShadow + }, + migrate: attributes => { + let newAttributes = { ...attributes } + + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + + return newAttributes + }, + }, // Support the new combined opacity and color. { attributes: attributes( '3.11.9' ), diff --git a/src/block/expand/deprecated.js b/src/block/expand/deprecated.js index 0914b7646..6024aad74 100644 --- a/src/block/expand/deprecated.js +++ b/src/block/expand/deprecated.js @@ -2,9 +2,31 @@ import { Save } from './save' import { attributes } from './schema' import { withVersion } from '~stackable/higher-order' -import { deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity } from '~stackable/block-components' +import { + deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity, + deprecateBlockShadowColor, deprecateContainerShadowColor, +} from '~stackable/block-components' const deprecated = [ + { + // Support the new shadow color. + attributes: attributes( '3.12.11' ), + save: withVersion( '3.12.11' )( Save ), + isEligible: attributes => { + const hasBlockShadow = deprecateBlockShadowColor.isEligible( attributes ) + const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes ) + + return hasBlockShadow || hasContainerShadow + }, + migrate: attributes => { + let newAttributes = { ...attributes } + + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + + return newAttributes + }, + }, // Support the new combined opacity and color. { attributes: attributes( '3.11.9' ), diff --git a/src/block/feature-grid/deprecated.js b/src/block/feature-grid/deprecated.js index d4ea669e0..c17f2cb76 100644 --- a/src/block/feature-grid/deprecated.js +++ b/src/block/feature-grid/deprecated.js @@ -10,7 +10,9 @@ import { attributes } from './schema' import { withVersion } from '~stackable/higher-order' import compareVersions from 'compare-versions' import { - deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity, getResponsiveClasses, getSeparatorClasses, + deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity, + getResponsiveClasses, getSeparatorClasses, + deprecateBlockShadowColor, deprecateContainerShadowColor, deprecateShadowColor, } from '~stackable/block-components' /** @@ -36,6 +38,29 @@ addFilter( 'stackable.feature-grid.save.blockClassNames', 'stackable/3.1.0', ( o } ) const deprecated = [ + { + // Support the new shadow color. + attributes: attributes( '3.12.11' ), + save: withVersion( '3.12.11' )( Save ), + isEligible: attributes => { + const hasBlockShadow = deprecateBlockShadowColor.isEligible( attributes ) + const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes ) + const hasTopSeparatorShadow = deprecateShadowColor.isEligible( 'topSeparator%s' )( attributes ) + const hasBottomSeparatorShadow = deprecateShadowColor.isEligible( 'bottomSeparator%s' )( attributes ) + + return hasBlockShadow || hasContainerShadow || hasTopSeparatorShadow || hasBottomSeparatorShadow + }, + migrate: attributes => { + let newAttributes = { ...attributes } + + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + newAttributes = deprecateShadowColor.migrate( 'topSeparator%s' )( newAttributes ) + newAttributes = deprecateShadowColor.migrate( 'bottomSeparator%s' )( newAttributes ) + + return newAttributes + }, + }, // Support the new combined opacity and color. { attributes: attributes( '3.11.9' ), diff --git a/src/block/feature/deprecated.js b/src/block/feature/deprecated.js index 1b7ea594b..6c9890522 100644 --- a/src/block/feature/deprecated.js +++ b/src/block/feature/deprecated.js @@ -13,6 +13,7 @@ import { deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity, getAlignmentClasses, getContentAlignmentClasses, getRowClasses, + deprecateBlockShadowColor, deprecateContainerShadowColor, deprecateShadowColor, } from '~stackable/block-components' /** @@ -61,6 +62,29 @@ addFilter( 'stackable.feature.save.innerClassNames', 'stackable/3.8.0', ( output } ) const deprecated = [ + { + // Support the new shadow color. + attributes: attributes( '3.12.11' ), + save: withVersion( '3.12.11' )( Save ), + isEligible: attributes => { + const hasBlockShadow = deprecateBlockShadowColor.isEligible( attributes ) + const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes ) + const hasTopSeparatorShadow = deprecateShadowColor.isEligible( 'topSeparator%s' )( attributes ) + const hasBottomSeparatorShadow = deprecateShadowColor.isEligible( 'bottomSeparator%s' )( attributes ) + + return hasBlockShadow || hasContainerShadow || hasTopSeparatorShadow || hasBottomSeparatorShadow + }, + migrate: attributes => { + let newAttributes = { ...attributes } + + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + newAttributes = deprecateShadowColor.migrate( 'topSeparator%s' )( newAttributes ) + newAttributes = deprecateShadowColor.migrate( 'bottomSeparator%s' )( newAttributes ) + + return newAttributes + }, + }, // Support the new combined opacity and color. { attributes: attributes( '3.11.9' ), diff --git a/src/block/hero/deprecated.js b/src/block/hero/deprecated.js index 30056da2f..1d6da3d34 100644 --- a/src/block/hero/deprecated.js +++ b/src/block/hero/deprecated.js @@ -9,7 +9,10 @@ import { attributes } from './schema' */ import { withVersion } from '~stackable/higher-order' import compareVersions from 'compare-versions' -import { deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity } from '~stackable/block-components' +import { + deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity, + deprecateBlockShadowColor, deprecateContainerShadowColor, deprecateShadowColor, +} from '~stackable/block-components' /** * WordPress dependencies @@ -32,6 +35,29 @@ addFilter( 'stackable.hero.save.innerClassNames', 'stackable/3.8.0', ( output, p } ) const deprecated = [ + { + // Support the new shadow color. + attributes: attributes( '3.12.11' ), + save: withVersion( '3.12.11' )( Save ), + isEligible: attributes => { + const hasBlockShadow = deprecateBlockShadowColor.isEligible( attributes ) + const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes ) + const hasTopSeparatorShadow = deprecateShadowColor.isEligible( 'topSeparator%s' )( attributes ) + const hasBottomSeparatorShadow = deprecateShadowColor.isEligible( 'bottomSeparator%s' )( attributes ) + + return hasBlockShadow || hasContainerShadow || hasTopSeparatorShadow || hasBottomSeparatorShadow + }, + migrate: attributes => { + let newAttributes = { ...attributes } + + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + newAttributes = deprecateShadowColor.migrate( 'topSeparator%s' )( newAttributes ) + newAttributes = deprecateShadowColor.migrate( 'bottomSeparator%s' )( newAttributes ) + + return newAttributes + }, + }, // Support the new combined opacity and color. { attributes: attributes( '3.11.9' ), diff --git a/src/block/horizontal-scroller/deprecated.js b/src/block/horizontal-scroller/deprecated.js index a78388812..47ffde6e0 100644 --- a/src/block/horizontal-scroller/deprecated.js +++ b/src/block/horizontal-scroller/deprecated.js @@ -2,7 +2,10 @@ import { Save } from './save' import { attributes } from './schema' import { withVersion } from '~stackable/higher-order' -import { deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity } from '~stackable/block-components' +import { + deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity, + deprecateBlockShadowColor, deprecateContainerShadowColor, +} from '~stackable/block-components' import { addFilter } from '@wordpress/hooks' import compareVersions from 'compare-versions' @@ -19,6 +22,25 @@ addFilter( 'stackable.horizontal-scroller.save.contentClassNames', 'stackable/3_ } ) const deprecated = [ + { + // Support the new shadow color. + attributes: attributes( '3.12.11' ), + save: withVersion( '3.12.11' )( Save ), + isEligible: attributes => { + const hasBlockShadow = deprecateBlockShadowColor.isEligible( attributes ) + const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes ) + + return hasBlockShadow || hasContainerShadow + }, + migrate: attributes => { + let newAttributes = { ...attributes } + + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + + return newAttributes + }, + }, // Support the new combined opacity and color. { attributes: attributes( '3.11.9' ), diff --git a/src/block/icon-box/deprecated.js b/src/block/icon-box/deprecated.js index e58a4e675..4d270e69c 100644 --- a/src/block/icon-box/deprecated.js +++ b/src/block/icon-box/deprecated.js @@ -2,9 +2,31 @@ import { Save } from './save' import { attributes } from './schema' import { withVersion } from '~stackable/higher-order' -import { deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity } from '~stackable/block-components' +import { + deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity, + deprecateBlockShadowColor, deprecateContainerShadowColor, +} from '~stackable/block-components' const deprecated = [ + { + // Support the new shadow color. + attributes: attributes( '3.12.11' ), + save: withVersion( '3.12.11' )( Save ), + isEligible: attributes => { + const hasBlockShadow = deprecateBlockShadowColor.isEligible( attributes ) + const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes ) + + return hasBlockShadow || hasContainerShadow + }, + migrate: attributes => { + let newAttributes = { ...attributes } + + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + + return newAttributes + }, + }, // Support the new combined opacity and color. { attributes: attributes( '3.11.9' ), diff --git a/src/block/icon-button/deprecated.js b/src/block/icon-button/deprecated.js index 1a2a3555f..e16bdd1b6 100644 --- a/src/block/icon-button/deprecated.js +++ b/src/block/icon-button/deprecated.js @@ -3,10 +3,33 @@ import { attributes } from './schema' import { withVersion } from '~stackable/higher-order' import { - deprecateBlockBackgroundColorOpacity, deprecateButtonGradientColor, deprecateContainerBackgroundColorOpacity, + deprecateBlockBackgroundColorOpacity, deprecateButtonGradientColor, + deprecateContainerBackgroundColorOpacity, deprecateShadowColor, + deprecateContainerShadowColor, deprecateBlockShadowColor, } from '~stackable/block-components' const deprecated = [ + { + // Support the new shadow color. + attributes: attributes( '3.12.11' ), + save: withVersion( '3.12.11' )( Save ), + isEligible: attributes => { + const hasBlockShadow = deprecateBlockShadowColor.isEligible( attributes ) + const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes ) + const hasButtonShadow = deprecateShadowColor.isEligible( 'button%s' )( attributes ) + + return hasBlockShadow || hasContainerShadow || hasButtonShadow + }, + migrate: attributes => { + let newAttributes = { ...attributes } + + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + newAttributes = deprecateShadowColor.migrate( 'button%s' )( attributes ) + + return newAttributes + }, + }, // Support the new combined opacity and color. { attributes: attributes( '3.11.9' ), diff --git a/src/block/icon-label/deprecated.js b/src/block/icon-label/deprecated.js index 0914b7646..6024aad74 100644 --- a/src/block/icon-label/deprecated.js +++ b/src/block/icon-label/deprecated.js @@ -2,9 +2,31 @@ import { Save } from './save' import { attributes } from './schema' import { withVersion } from '~stackable/higher-order' -import { deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity } from '~stackable/block-components' +import { + deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity, + deprecateBlockShadowColor, deprecateContainerShadowColor, +} from '~stackable/block-components' const deprecated = [ + { + // Support the new shadow color. + attributes: attributes( '3.12.11' ), + save: withVersion( '3.12.11' )( Save ), + isEligible: attributes => { + const hasBlockShadow = deprecateBlockShadowColor.isEligible( attributes ) + const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes ) + + return hasBlockShadow || hasContainerShadow + }, + migrate: attributes => { + let newAttributes = { ...attributes } + + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + + return newAttributes + }, + }, // Support the new combined opacity and color. { attributes: attributes( '3.11.9' ), diff --git a/src/block/icon-list-item/deprecated.js b/src/block/icon-list-item/deprecated.js new file mode 100644 index 000000000..2c6633b1a --- /dev/null +++ b/src/block/icon-list-item/deprecated.js @@ -0,0 +1,28 @@ +import { Save } from './save' +import { attributes } from './schema' + +import { withVersion } from '~stackable/higher-order' +import { deprecateBlockShadowColor, deprecateContainerShadowColor } from '~stackable/block-components' + +const deprecated = [ + { + // Support the new shadow color. + attributes: attributes( '3.12.11' ), + save: withVersion( '3.12.11' )( Save ), + isEligible: attributes => { + const hasBlockShadow = deprecateBlockShadowColor.isEligible( attributes ) + const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes ) + + return hasBlockShadow || hasContainerShadow + }, + migrate: attributes => { + let newAttributes = { ...attributes } + + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + + return newAttributes + }, + }, +] +export default deprecated diff --git a/src/block/icon-list-item/index.js b/src/block/icon-list-item/index.js index deb186ac8..ce8886c3f 100644 --- a/src/block/icon-list-item/index.js +++ b/src/block/icon-list-item/index.js @@ -11,6 +11,7 @@ import save from './save' import schema from './schema' import metadata from './block.json' import example from './example' +import deprecated from './deprecated' export const settings = { ...metadata, @@ -23,6 +24,7 @@ export const settings = { example, edit, save, + deprecated, merge( attributes, attributesToMerge ) { return { ...attributes, diff --git a/src/block/icon-list/deprecated/index.js b/src/block/icon-list/deprecated/index.js index 07ae044f0..4cfda6cdc 100644 --- a/src/block/icon-list/deprecated/index.js +++ b/src/block/icon-list/deprecated/index.js @@ -4,6 +4,7 @@ import { attributes } from './schema' import { withVersion } from '~stackable/higher-order' import { deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity, deprecateTypographyGradientColor, + deprecateBlockShadowColor, deprecateContainerShadowColor, } from '~stackable/block-components' import { createBlock } from '@wordpress/blocks' @@ -66,6 +67,25 @@ const getEquivalentIconSize = iconSize => { } const deprecated = [ + { + // Support the new shadow color. + attributes: attributes( '3.12.11' ), + save: withVersion( '3.12.11' )( Save ), + isEligible: attributes => { + const hasBlockShadow = deprecateBlockShadowColor.isEligible( attributes ) + const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes ) + + return hasBlockShadow || hasContainerShadow + }, + migrate: attributes => { + let newAttributes = { ...attributes } + + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + + return newAttributes + }, + }, { attributes: attributes( '3.12.8' ), save: withVersion( '3.12.8' )( Save ), diff --git a/src/block/icon/deprecated.js b/src/block/icon/deprecated.js index 0914b7646..6024aad74 100644 --- a/src/block/icon/deprecated.js +++ b/src/block/icon/deprecated.js @@ -2,9 +2,31 @@ import { Save } from './save' import { attributes } from './schema' import { withVersion } from '~stackable/higher-order' -import { deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity } from '~stackable/block-components' +import { + deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity, + deprecateBlockShadowColor, deprecateContainerShadowColor, +} from '~stackable/block-components' const deprecated = [ + { + // Support the new shadow color. + attributes: attributes( '3.12.11' ), + save: withVersion( '3.12.11' )( Save ), + isEligible: attributes => { + const hasBlockShadow = deprecateBlockShadowColor.isEligible( attributes ) + const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes ) + + return hasBlockShadow || hasContainerShadow + }, + migrate: attributes => { + let newAttributes = { ...attributes } + + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + + return newAttributes + }, + }, // Support the new combined opacity and color. { attributes: attributes( '3.11.9' ), diff --git a/src/block/image-box/deprecated.js b/src/block/image-box/deprecated.js index 0914b7646..6024aad74 100644 --- a/src/block/image-box/deprecated.js +++ b/src/block/image-box/deprecated.js @@ -2,9 +2,31 @@ import { Save } from './save' import { attributes } from './schema' import { withVersion } from '~stackable/higher-order' -import { deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity } from '~stackable/block-components' +import { + deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity, + deprecateBlockShadowColor, deprecateContainerShadowColor, +} from '~stackable/block-components' const deprecated = [ + { + // Support the new shadow color. + attributes: attributes( '3.12.11' ), + save: withVersion( '3.12.11' )( Save ), + isEligible: attributes => { + const hasBlockShadow = deprecateBlockShadowColor.isEligible( attributes ) + const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes ) + + return hasBlockShadow || hasContainerShadow + }, + migrate: attributes => { + let newAttributes = { ...attributes } + + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + + return newAttributes + }, + }, // Support the new combined opacity and color. { attributes: attributes( '3.11.9' ), diff --git a/src/block/image/deprecated.js b/src/block/image/deprecated.js index e06640083..004e20078 100644 --- a/src/block/image/deprecated.js +++ b/src/block/image/deprecated.js @@ -4,6 +4,7 @@ import { attributes } from './schema' import { withVersion } from '~stackable/higher-order' import { deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity, deprecationImageOverlayOpacity, + deprecateBlockShadowColor, deprecateContainerShadowColor, deprecateShadowColor, } from '~stackable/block-components' import { RichText } from '@wordpress/block-editor' @@ -58,6 +59,27 @@ addFilter( 'stackable.image.save.wrapper', 'stackable/image-caption-wrapper', ( } ) const deprecated = [ + { + // Support the new shadow color. + attributes: attributes( '3.12.11' ), + save: withVersion( '3.12.11' )( Save ), + isEligible: attributes => { + const hasBlockShadow = deprecateBlockShadowColor.isEligible( attributes ) + const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes ) + const hasImageShadow = deprecateShadowColor.isEligible( 'image%s' )( attributes ) + + return hasBlockShadow || hasContainerShadow || hasImageShadow + }, + migrate: attributes => { + let newAttributes = { ...attributes } + + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + newAttributes = deprecateShadowColor.migrate( 'image%s' )( newAttributes ) + + return newAttributes + }, + }, { attributes: attributes( '3.12.6' ), save: withVersion( '3.12.6' )( Save ), diff --git a/src/block/map/deprecated.js b/src/block/map/deprecated.js index 0914b7646..6024aad74 100644 --- a/src/block/map/deprecated.js +++ b/src/block/map/deprecated.js @@ -2,9 +2,31 @@ import { Save } from './save' import { attributes } from './schema' import { withVersion } from '~stackable/higher-order' -import { deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity } from '~stackable/block-components' +import { + deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity, + deprecateBlockShadowColor, deprecateContainerShadowColor, +} from '~stackable/block-components' const deprecated = [ + { + // Support the new shadow color. + attributes: attributes( '3.12.11' ), + save: withVersion( '3.12.11' )( Save ), + isEligible: attributes => { + const hasBlockShadow = deprecateBlockShadowColor.isEligible( attributes ) + const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes ) + + return hasBlockShadow || hasContainerShadow + }, + migrate: attributes => { + let newAttributes = { ...attributes } + + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + + return newAttributes + }, + }, // Support the new combined opacity and color. { attributes: attributes( '3.11.9' ), diff --git a/src/block/notification/deprecated.js b/src/block/notification/deprecated.js index 59afe1fcf..a255aa32f 100644 --- a/src/block/notification/deprecated.js +++ b/src/block/notification/deprecated.js @@ -9,7 +9,10 @@ import { attributes } from './schema' */ import { withVersion } from '~stackable/higher-order' import compareVersions from 'compare-versions' -import { deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity } from '~stackable/block-components' +import { + deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity, + deprecateBlockShadowColor, deprecateContainerShadowColor, +} from '~stackable/block-components' /** * WordPress dependencies @@ -32,6 +35,25 @@ addFilter( 'stackable.notification.save.innerClassNames', 'stackable/3.8.0', ( o } ) const deprecated = [ + { + // Support the new shadow color. + attributes: attributes( '3.12.11' ), + save: withVersion( '3.12.11' )( Save ), + isEligible: attributes => { + const hasBlockShadow = deprecateBlockShadowColor.isEligible( attributes ) + const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes ) + + return hasBlockShadow || hasContainerShadow + }, + migrate: attributes => { + let newAttributes = { ...attributes } + + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + + return newAttributes + }, + }, // Support the new combined opacity and color. { attributes: attributes( '3.11.9' ), diff --git a/src/block/number-box/deprecated.js b/src/block/number-box/deprecated.js index c7953dcf3..ea68ebb9b 100644 --- a/src/block/number-box/deprecated.js +++ b/src/block/number-box/deprecated.js @@ -4,9 +4,31 @@ import { attributes } from './schema' import { withVersion } from '~stackable/higher-order' import { deprecateBlockBackgroundColorOpacity, deprecateTypographyGradientColor, deprecationBackgrounColorOpacity, + deprecateBlockShadowColor, deprecateContainerShadowColor, deprecateShadowColor, } from '~stackable/block-components' const deprecated = [ + { + // Support the new shadow color. + attributes: attributes( '3.12.11' ), + save: withVersion( '3.12.11' )( Save ), + isEligible: attributes => { + const hasBlockShadow = deprecateBlockShadowColor.isEligible( attributes ) + const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes ) + const hasShapeShadow = deprecateShadowColor.isEligible( 'shape%s' )( attributes ) + + return hasBlockShadow || hasContainerShadow || hasShapeShadow + }, + migrate: attributes => { + let newAttributes = { ...attributes } + + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + newAttributes = deprecateShadowColor.migrate( 'shape%s' )( newAttributes ) + + return newAttributes + }, + }, // Support the new combined opacity and color. { attributes: attributes( '3.11.9' ), diff --git a/src/block/posts/deprecated.js b/src/block/posts/deprecated.js index 282d61d17..38b32a15b 100644 --- a/src/block/posts/deprecated.js +++ b/src/block/posts/deprecated.js @@ -10,7 +10,9 @@ import { Save } from './save' import { withVersion } from '~stackable/higher-order' import compareVersions from 'compare-versions' import { - Image, deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity, deprecateTypographyGradientColor, deprecationImageOverlayOpacity, + Image, deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity, + deprecateTypographyGradientColor, deprecationImageOverlayOpacity, + deprecateBlockShadowColor, deprecateContainerShadowColor, deprecateShadowColor, } from '~stackable/block-components' /** @@ -39,6 +41,27 @@ addFilter( 'stackable.posts.title.readmore-content', 'stackable/3_0_2', addUndef addFilter( 'stackable.posts.feature-image', 'stackable/3_6_3', determineFeatureImage ) const deprecated = [ + { + // Support the new shadow color. + attributes: attributes( '3.12.11' ), + save: withVersion( '3.12.11' )( Save ), + isEligible: attributes => { + const hasBlockShadow = deprecateBlockShadowColor.isEligible( attributes ) + const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes ) + const hasImageShadow = deprecateShadowColor.isEligible( 'image%s' )( attributes ) + + return hasBlockShadow || hasContainerShadow || hasImageShadow + }, + migrate: attributes => { + let newAttributes = { ...attributes } + + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + newAttributes = deprecateShadowColor.migrate( 'image%s' )( newAttributes ) + + return newAttributes + }, + }, { // Support the new combined opacity and color. // We have to repeat this because the older deprecations are not called when this triggers. diff --git a/src/block/price/deprecated.js b/src/block/price/deprecated.js index 0914b7646..6024aad74 100644 --- a/src/block/price/deprecated.js +++ b/src/block/price/deprecated.js @@ -2,9 +2,31 @@ import { Save } from './save' import { attributes } from './schema' import { withVersion } from '~stackable/higher-order' -import { deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity } from '~stackable/block-components' +import { + deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity, + deprecateBlockShadowColor, deprecateContainerShadowColor, +} from '~stackable/block-components' const deprecated = [ + { + // Support the new shadow color. + attributes: attributes( '3.12.11' ), + save: withVersion( '3.12.11' )( Save ), + isEligible: attributes => { + const hasBlockShadow = deprecateBlockShadowColor.isEligible( attributes ) + const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes ) + + return hasBlockShadow || hasContainerShadow + }, + migrate: attributes => { + let newAttributes = { ...attributes } + + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + + return newAttributes + }, + }, // Support the new combined opacity and color. { attributes: attributes( '3.11.9' ), diff --git a/src/block/pricing-box/deprecated.js b/src/block/pricing-box/deprecated.js index 7cd380348..58728fb1c 100644 --- a/src/block/pricing-box/deprecated.js +++ b/src/block/pricing-box/deprecated.js @@ -9,8 +9,10 @@ import { attributes } from './schema' */ import { withVersion } from '~stackable/higher-order' import compareVersions from 'compare-versions' -import { deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity } from '~stackable/block-components' - +import { + deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity, + deprecateBlockShadowColor, deprecateContainerShadowColor, +} from '~stackable/block-components' /** * WordPress dependencies */ @@ -32,6 +34,25 @@ addFilter( 'stackable.pricing-box.save.innerClassNames', 'stackable/3.8.0', ( ou } ) const deprecated = [ + { + // Support the new shadow color. + attributes: attributes( '3.12.11' ), + save: withVersion( '3.12.11' )( Save ), + isEligible: attributes => { + const hasBlockShadow = deprecateBlockShadowColor.isEligible( attributes ) + const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes ) + + return hasBlockShadow || hasContainerShadow + }, + migrate: attributes => { + let newAttributes = { ...attributes } + + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + + return newAttributes + }, + }, // Support the new combined opacity and color. { attributes: attributes( '3.11.9' ), diff --git a/src/block/progress-bar/deprecated.js b/src/block/progress-bar/deprecated.js index a0679333e..d9a18b572 100644 --- a/src/block/progress-bar/deprecated.js +++ b/src/block/progress-bar/deprecated.js @@ -4,9 +4,31 @@ import { attributes } from './schema' import { withVersion } from '~stackable/higher-order' import { deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity, deprecateTypographyGradientColor, + deprecateTypographyShadowColor, deprecateBlockShadowColor, deprecateContainerShadowColor, } from '~stackable/block-components' const deprecated = [ + { + // Support the new shadow color. + attributes: attributes( '3.12.11' ), + save: withVersion( '3.12.11' )( Save ), + isEligible: attributes => { + const hasBlockShadow = deprecateBlockShadowColor.isEligible( attributes ) + const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes ) + const hasTextShadow = deprecateTypographyShadowColor.isEligible( '%s' )( attributes ) + + return hasBlockShadow || hasContainerShadow || hasTextShadow + }, + migrate: attributes => { + let newAttributes = { ...attributes } + + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + newAttributes = deprecateTypographyShadowColor.migrate( '%s' )( newAttributes ) + + return newAttributes + }, + }, // Support the new combined opacity and color. { attributes: attributes( '3.11.9' ), diff --git a/src/block/progress-circle/deprecated.js b/src/block/progress-circle/deprecated.js index a0679333e..d9a18b572 100644 --- a/src/block/progress-circle/deprecated.js +++ b/src/block/progress-circle/deprecated.js @@ -4,9 +4,31 @@ import { attributes } from './schema' import { withVersion } from '~stackable/higher-order' import { deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity, deprecateTypographyGradientColor, + deprecateTypographyShadowColor, deprecateBlockShadowColor, deprecateContainerShadowColor, } from '~stackable/block-components' const deprecated = [ + { + // Support the new shadow color. + attributes: attributes( '3.12.11' ), + save: withVersion( '3.12.11' )( Save ), + isEligible: attributes => { + const hasBlockShadow = deprecateBlockShadowColor.isEligible( attributes ) + const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes ) + const hasTextShadow = deprecateTypographyShadowColor.isEligible( '%s' )( attributes ) + + return hasBlockShadow || hasContainerShadow || hasTextShadow + }, + migrate: attributes => { + let newAttributes = { ...attributes } + + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + newAttributes = deprecateTypographyShadowColor.migrate( '%s' )( newAttributes ) + + return newAttributes + }, + }, // Support the new combined opacity and color. { attributes: attributes( '3.11.9' ), diff --git a/src/block/separator/deprecated.js b/src/block/separator/deprecated.js index 0914b7646..2b91d3ed7 100644 --- a/src/block/separator/deprecated.js +++ b/src/block/separator/deprecated.js @@ -2,9 +2,33 @@ import { Save } from './save' import { attributes } from './schema' import { withVersion } from '~stackable/higher-order' -import { deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity } from '~stackable/block-components' +import { + deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity, + deprecateBlockShadowColor, deprecateContainerShadowColor, deprecateShadowColor, +} from '~stackable/block-components' const deprecated = [ + { + // Support the new shadow color. + attributes: attributes( '3.12.11' ), + save: withVersion( '3.12.11' )( Save ), + isEligible: attributes => { + const hasBlockShadow = deprecateBlockShadowColor.isEligible( attributes ) + const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes ) + const hasSeparatorShadow = deprecateShadowColor.isEligible( 'separator%s' )( attributes ) + + return hasBlockShadow || hasContainerShadow || hasSeparatorShadow + }, + migrate: attributes => { + let newAttributes = { ...attributes } + + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + newAttributes = deprecateShadowColor.migrate( 'separator%s' )( newAttributes ) + + return newAttributes + }, + }, // Support the new combined opacity and color. { attributes: attributes( '3.11.9' ), diff --git a/src/block/spacer/deprecated.js b/src/block/spacer/deprecated.js index 0914b7646..6024aad74 100644 --- a/src/block/spacer/deprecated.js +++ b/src/block/spacer/deprecated.js @@ -2,9 +2,31 @@ import { Save } from './save' import { attributes } from './schema' import { withVersion } from '~stackable/higher-order' -import { deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity } from '~stackable/block-components' +import { + deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity, + deprecateBlockShadowColor, deprecateContainerShadowColor, +} from '~stackable/block-components' const deprecated = [ + { + // Support the new shadow color. + attributes: attributes( '3.12.11' ), + save: withVersion( '3.12.11' )( Save ), + isEligible: attributes => { + const hasBlockShadow = deprecateBlockShadowColor.isEligible( attributes ) + const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes ) + + return hasBlockShadow || hasContainerShadow + }, + migrate: attributes => { + let newAttributes = { ...attributes } + + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + + return newAttributes + }, + }, // Support the new combined opacity and color. { attributes: attributes( '3.11.9' ), diff --git a/src/block/subtitle/deprecated.js b/src/block/subtitle/deprecated.js index a0679333e..d87a7096d 100644 --- a/src/block/subtitle/deprecated.js +++ b/src/block/subtitle/deprecated.js @@ -4,9 +4,31 @@ import { attributes } from './schema' import { withVersion } from '~stackable/higher-order' import { deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity, deprecateTypographyGradientColor, + deprecateBlockShadowColor, deprecateContainerShadowColor, deprecateTypographyShadowColor, } from '~stackable/block-components' const deprecated = [ + { + // Support the new shadow color. + attributes: attributes( '3.12.11' ), + save: withVersion( '3.12.11' )( Save ), + isEligible: attributes => { + const hasBlockShadow = deprecateBlockShadowColor.isEligible( attributes ) + const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes ) + const hasTextShadow = deprecateTypographyShadowColor.isEligible( '%s' )( attributes ) + + return hasBlockShadow || hasContainerShadow || hasTextShadow + }, + migrate: attributes => { + let newAttributes = { ...attributes } + + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + newAttributes = deprecateTypographyShadowColor.migrate( '%s' )( newAttributes ) + + return newAttributes + }, + }, // Support the new combined opacity and color. { attributes: attributes( '3.11.9' ), diff --git a/src/block/tab-content/deprecated.js b/src/block/tab-content/deprecated.js index a3df0531b..9d99c2c45 100644 --- a/src/block/tab-content/deprecated.js +++ b/src/block/tab-content/deprecated.js @@ -1,10 +1,32 @@ -import { deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity } from '~stackable/block-components' +import { + deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity, + deprecateBlockShadowColor, deprecateContainerShadowColor, +} from '~stackable/block-components' import { Save } from './save' import { attributes } from './schema' import { withVersion } from '~stackable/higher-order' const deprecated = [ + { + // Support the new shadow color. + attributes: attributes( '3.12.11' ), + save: withVersion( '3.12.11' )( Save ), + isEligible: attributes => { + const hasBlockShadow = deprecateBlockShadowColor.isEligible( attributes ) + const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes ) + + return hasBlockShadow || hasContainerShadow + }, + migrate: attributes => { + let newAttributes = { ...attributes } + + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + + return newAttributes + }, + }, // Support the new combined opacity and color. { attributes: attributes( '3.11.9' ), diff --git a/src/block/tab-labels/deprecated.js b/src/block/tab-labels/deprecated.js index 5c6d9e3cf..5750f1f45 100644 --- a/src/block/tab-labels/deprecated.js +++ b/src/block/tab-labels/deprecated.js @@ -1,5 +1,6 @@ import { deprecateBlockBackgroundColorOpacity, deprecateButtonGradientColor, deprecateContainerBackgroundColorOpacity, deprecateTypographyGradientColor, + deprecateBlockShadowColor, deprecateContainerShadowColor, deprecateShadowColor, deprecateTypographyShadowColor, } from '~stackable/block-components' import { Save } from './save' import { attributes } from './schema' @@ -7,6 +8,31 @@ import { attributes } from './schema' import { withVersion } from '~stackable/higher-order' const deprecated = [ + { + // Support the new shadow color. + attributes: attributes( '3.12.11' ), + save: withVersion( '3.12.11' )( Save ), + isEligible: attributes => { + const hasBlockShadow = deprecateBlockShadowColor.isEligible( attributes ) + const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes ) + const hasTabButtonShadow = deprecateShadowColor.isEligible( 'tab%s' )( attributes ) + const hasActiveTabButtonShadow = deprecateShadowColor.isEligible( 'activeTab%s' )( attributes ) + const hasTextShadow = deprecateTypographyShadowColor.isEligible( 'tab%s' )( attributes ) + + return hasBlockShadow || hasContainerShadow || hasTextShadow || hasTabButtonShadow || hasActiveTabButtonShadow + }, + migrate: attributes => { + let newAttributes = { ...attributes } + + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + newAttributes = deprecateTypographyShadowColor.migrate( '%s' )( newAttributes ) + newAttributes = deprecateShadowColor.migrate( 'tab%s' )( newAttributes ) + newAttributes = deprecateShadowColor.migrate( 'activeTab%s' )( newAttributes ) + + return newAttributes + }, + }, // Support the new combined opacity and color. { attributes: attributes( '3.11.9' ), diff --git a/src/block/table-of-contents/deprecated.js b/src/block/table-of-contents/deprecated.js index b4005a052..7adc61dca 100644 --- a/src/block/table-of-contents/deprecated.js +++ b/src/block/table-of-contents/deprecated.js @@ -11,6 +11,7 @@ import { withVersion } from '~stackable/higher-order' import compareVersions from 'compare-versions' import { deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity, deprecateTypographyGradientColor, + deprecateBlockShadowColor, deprecateContainerShadowColor, } from '~stackable/block-components' /** @@ -35,6 +36,25 @@ addFilter( 'stackable.table-of-contents.save.tableOfContentsClasses', 'stackable } ) const deprecated = [ + { + // Support the new shadow color. + attributes: attributes( '3.12.11' ), + save: withVersion( '3.12.11' )( Save ), + isEligible: attributes => { + const hasBlockShadow = deprecateBlockShadowColor.isEligible( attributes ) + const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes ) + + return hasBlockShadow || hasContainerShadow + }, + migrate: attributes => { + let newAttributes = { ...attributes } + + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + + return newAttributes + }, + }, // Support the new combined opacity and color. { attributes: attributes( '3.11.9' ), diff --git a/src/block/tabs/deprecated.js b/src/block/tabs/deprecated.js index 5a76247f3..de0ab8522 100644 --- a/src/block/tabs/deprecated.js +++ b/src/block/tabs/deprecated.js @@ -1,10 +1,32 @@ -import { deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity } from '~stackable/block-components' +import { + deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity, + deprecateBlockShadowColor, deprecateContainerShadowColor, +} from '~stackable/block-components' import { Save } from './save' import { attributes } from './schema' import { withVersion } from '~stackable/higher-order' const deprecated = [ + { + // Support the new shadow color. + attributes: attributes( '3.12.11' ), + save: withVersion( '3.12.11' )( Save ), + isEligible: attributes => { + const hasBlockShadow = deprecateBlockShadowColor.isEligible( attributes ) + const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes ) + + return hasBlockShadow || hasContainerShadow + }, + migrate: attributes => { + let newAttributes = { ...attributes } + + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + + return newAttributes + }, + }, { attributes: attributes( '3.12.3' ), migrate: attributes => { diff --git a/src/block/team-member/deprecated.js b/src/block/team-member/deprecated.js index 4259223e9..44abebc7b 100644 --- a/src/block/team-member/deprecated.js +++ b/src/block/team-member/deprecated.js @@ -9,7 +9,10 @@ import { attributes } from './schema' */ import { withVersion } from '~stackable/higher-order' import compareVersions from 'compare-versions' -import { deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity } from '~stackable/block-components' +import { + deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity, + deprecateBlockShadowColor, deprecateContainerShadowColor, +} from '~stackable/block-components' /** * WordPress dependencies @@ -32,6 +35,25 @@ addFilter( 'stackable.team-member.save.innerClassNames', 'stackable/3.8.0', ( ou } ) const deprecated = [ + { + // Support the new shadow color. + attributes: attributes( '3.12.11' ), + save: withVersion( '3.12.11' )( Save ), + isEligible: attributes => { + const hasBlockShadow = deprecateBlockShadowColor.isEligible( attributes ) + const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes ) + + return hasBlockShadow || hasContainerShadow + }, + migrate: attributes => { + let newAttributes = { ...attributes } + + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + + return newAttributes + }, + }, // Support the new combined opacity and color. { attributes: attributes( '3.11.9' ), diff --git a/src/block/testimonial/deprecated.js b/src/block/testimonial/deprecated.js index d60d73f51..c66975a6b 100644 --- a/src/block/testimonial/deprecated.js +++ b/src/block/testimonial/deprecated.js @@ -9,7 +9,10 @@ import { attributes } from './schema' */ import { withVersion } from '~stackable/higher-order' import compareVersions from 'compare-versions' -import { deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity } from '~stackable/block-components' +import { + deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity, + deprecateBlockShadowColor, deprecateContainerShadowColor, +} from '~stackable/block-components' /** * WordPress dependencies @@ -32,6 +35,25 @@ addFilter( 'stackable.testimonial.save.innerClassNames', 'stackable/3.8.0', ( ou } ) const deprecated = [ + { + // Support the new shadow color. + attributes: attributes( '3.12.11' ), + save: withVersion( '3.12.11' )( Save ), + isEligible: attributes => { + const hasBlockShadow = deprecateBlockShadowColor.isEligible( attributes ) + const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes ) + + return hasBlockShadow || hasContainerShadow + }, + migrate: attributes => { + let newAttributes = { ...attributes } + + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + + return newAttributes + }, + }, // Support the new combined opacity and color. { attributes: attributes( '3.11.9' ), diff --git a/src/block/text/deprecated.js b/src/block/text/deprecated.js index 37c393bad..3e145ed3b 100644 --- a/src/block/text/deprecated.js +++ b/src/block/text/deprecated.js @@ -4,9 +4,31 @@ import { attributes } from './schema' import { withVersion } from '~stackable/higher-order' import { deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity, deprecateTypographyGradientColor, + deprecateTypographyShadowColor, deprecateBlockShadowColor, deprecateContainerShadowColor, } from '~stackable/block-components' const deprecated = [ + { + // Support the new shadow color. + attributes: attributes( '3.12.11' ), + save: withVersion( '3.12.11' )( Save ), + isEligible: attributes => { + const hasBlockShadow = deprecateBlockShadowColor.isEligible( attributes ) + const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes ) + const hasTextShadow = deprecateTypographyShadowColor.isEligible( '%s' )( attributes ) + + return hasBlockShadow || hasContainerShadow || hasTextShadow + }, + migrate: attributes => { + let newAttributes = { ...attributes } + + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + newAttributes = deprecateTypographyShadowColor.migrate( '%s' )( newAttributes ) + + return newAttributes + }, + }, // Support the new combined opacity and color. { attributes: attributes( '3.11.4' ), diff --git a/src/block/timeline/deprecated.js b/src/block/timeline/deprecated.js index 2e2b59051..de196957d 100644 --- a/src/block/timeline/deprecated.js +++ b/src/block/timeline/deprecated.js @@ -1,5 +1,6 @@ import { deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity, deprecateTypographyGradientColor, + deprecateTypographyShadowColor, deprecateBlockShadowColor, deprecateContainerShadowColor, } from '~stackable/block-components' import { Save } from './save' import { attributes } from './schema' @@ -7,6 +8,27 @@ import { attributes } from './schema' import { withVersion } from '~stackable/higher-order' const deprecated = [ + { + // Support the new shadow color. + attributes: attributes( '3.12.11' ), + save: withVersion( '3.12.11' )( Save ), + isEligible: attributes => { + const hasBlockShadow = deprecateBlockShadowColor.isEligible( attributes ) + const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes ) + const hasTextShadow = deprecateTypographyShadowColor.isEligible( '%s' )( attributes ) + + return hasBlockShadow || hasContainerShadow || hasTextShadow + }, + migrate: attributes => { + let newAttributes = { ...attributes } + + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + newAttributes = deprecateTypographyShadowColor.migrate( '%s' )( newAttributes ) + + return newAttributes + }, + }, // Support the new combined opacity and color. { attributes: attributes( '3.11.9' ), diff --git a/src/block/video-popup/deprecated.js b/src/block/video-popup/deprecated.js index 0914b7646..6024aad74 100644 --- a/src/block/video-popup/deprecated.js +++ b/src/block/video-popup/deprecated.js @@ -2,9 +2,31 @@ import { Save } from './save' import { attributes } from './schema' import { withVersion } from '~stackable/higher-order' -import { deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity } from '~stackable/block-components' +import { + deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity, + deprecateBlockShadowColor, deprecateContainerShadowColor, +} from '~stackable/block-components' const deprecated = [ + { + // Support the new shadow color. + attributes: attributes( '3.12.11' ), + save: withVersion( '3.12.11' )( Save ), + isEligible: attributes => { + const hasBlockShadow = deprecateBlockShadowColor.isEligible( attributes ) + const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes ) + + return hasBlockShadow || hasContainerShadow + }, + migrate: attributes => { + let newAttributes = { ...attributes } + + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + + return newAttributes + }, + }, // Support the new combined opacity and color. { attributes: attributes( '3.11.9' ), From 1337d54bbd7ee322a7e8b8a8e1e985a949095d68 Mon Sep 17 00:00:00 2001 From: mxkae Date: Wed, 28 Feb 2024 13:14:14 +0800 Subject: [PATCH 4/4] add other deprecation methods --- src/block/accordion/deprecated.js | 8 ++- src/block/blockquote/deprecated.js | 14 ++++- src/block/button-group/deprecated/index.js | 8 ++- src/block/button/deprecated.js | 11 +++- src/block/call-to-action/deprecated.js | 67 +++++++++++++++++++-- src/block/card/deprecated.js | 64 ++++++++++++++++++-- src/block/carousel/deprecated.js | 6 ++ src/block/column/deprecated.js | 67 +++++++++++++++++++-- src/block/columns/deprecated.js | 20 +++++- src/block/count-up/deprecated.js | 9 +++ src/block/countdown/deprecated.js | 14 ++++- src/block/divider/deprecated.js | 8 ++- src/block/expand/deprecated.js | 8 ++- src/block/feature-grid/deprecated.js | 20 +++++- src/block/feature/deprecated.js | 29 ++++++++- src/block/heading/deprecated.js | 9 +++ src/block/hero/deprecated.js | 65 +++++++++++++++++++- src/block/horizontal-scroller/deprecated.js | 8 ++- src/block/icon-box/deprecated.js | 25 +++++++- src/block/icon-button/deprecated.js | 11 +++- src/block/icon-label/deprecated.js | 8 ++- src/block/icon-list/deprecated/index.js | 50 ++++++++++++++- src/block/icon/deprecated.js | 8 ++- src/block/image-box/deprecated.js | 8 ++- src/block/image/deprecated.js | 9 +++ src/block/map/deprecated.js | 8 ++- src/block/notification/deprecated.js | 61 ++++++++++++++++++- src/block/number-box/deprecated.js | 11 +++- src/block/posts/deprecated.js | 53 +++++++++++++++- src/block/price/deprecated.js | 8 ++- src/block/pricing-box/deprecated.js | 61 ++++++++++++++++++- src/block/progress-bar/deprecated.js | 9 +++ src/block/progress-circle/deprecated.js | 9 +++ src/block/separator/deprecated.js | 10 ++- src/block/spacer/deprecated.js | 8 ++- src/block/subtitle/deprecated.js | 9 +++ src/block/tab-content/deprecated.js | 4 ++ src/block/tab-labels/deprecated.js | 10 +++ src/block/table-of-contents/deprecated.js | 8 +++ src/block/tabs/deprecated.js | 20 +++++- src/block/team-member/deprecated.js | 61 ++++++++++++++++++- src/block/testimonial/deprecated.js | 61 ++++++++++++++++++- src/block/text/deprecated.js | 9 +++ src/block/timeline/deprecated.js | 6 ++ src/block/video-popup/deprecated.js | 8 ++- src/dynamic-breakpoints.php | 2 +- 46 files changed, 929 insertions(+), 61 deletions(-) diff --git a/src/block/accordion/deprecated.js b/src/block/accordion/deprecated.js index 7434314cb..962ab1715 100644 --- a/src/block/accordion/deprecated.js +++ b/src/block/accordion/deprecated.js @@ -23,6 +23,8 @@ const deprecated = [ newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) return newAttributes }, @@ -42,6 +44,8 @@ const deprecated = [ newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) return newAttributes }, @@ -52,7 +56,9 @@ const deprecated = [ attributes: attributes( '3.7.9' ), save: withVersion( '3.7.9' )( Save ), migrate: attributes => { - const newAttributes = deprecateContainerBackgroundColorOpacity.migrate( attributes ) + let newAttributes = deprecateContainerBackgroundColorOpacity.migrate( attributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) return deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) }, }, diff --git a/src/block/blockquote/deprecated.js b/src/block/blockquote/deprecated.js index 38a4aefdb..da35e425a 100644 --- a/src/block/blockquote/deprecated.js +++ b/src/block/blockquote/deprecated.js @@ -15,14 +15,20 @@ const deprecated = [ isEligible: attributes => { const hasBlockShadow = deprecateBlockShadowColor.isEligible( attributes ) const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes ) + const isNotV4 = attributes.version < 2 || typeof attributes.version === 'undefined' - return hasBlockShadow || hasContainerShadow + return hasBlockShadow || hasContainerShadow || isNotV4 }, migrate: attributes => { - let newAttributes = { ...attributes } + let newAttributes = { + ...attributes, + version: 2, + } newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) return newAttributes }, @@ -44,6 +50,8 @@ const deprecated = [ version: 2, } + newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) @@ -85,6 +93,8 @@ const deprecated = [ } } + newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) diff --git a/src/block/button-group/deprecated/index.js b/src/block/button-group/deprecated/index.js index ea2d66e33..55251ee12 100644 --- a/src/block/button-group/deprecated/index.js +++ b/src/block/button-group/deprecated/index.js @@ -25,6 +25,8 @@ const deprecated = [ newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) return newAttributes }, @@ -44,6 +46,8 @@ const deprecated = [ newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) return newAttributes }, @@ -53,7 +57,9 @@ const deprecated = [ attributes: attributes( '3.7.9' ), save: withVersion( '3.7.9' )( Save ), migrate: attributes => { - const newAttributes = deprecateContainerBackgroundColorOpacity.migrate( attributes ) + let newAttributes = deprecateContainerBackgroundColorOpacity.migrate( attributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) return deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) }, }, diff --git a/src/block/button/deprecated.js b/src/block/button/deprecated.js index 644acc839..e7b1f9feb 100644 --- a/src/block/button/deprecated.js +++ b/src/block/button/deprecated.js @@ -25,7 +25,10 @@ const deprecated = [ newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) - newAttributes = deprecateShadowColor.migrate( 'button%s' )( attributes ) + newAttributes = deprecateShadowColor.migrate( 'button%s' )( newAttributes ) + newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateButtonGradientColor.migrate( 'button%s' )( newAttributes ) return newAttributes }, @@ -47,6 +50,9 @@ const deprecated = [ newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateButtonGradientColor.migrate( 'button%s' )( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + newAttributes = deprecateShadowColor.migrate( 'button%s' )( newAttributes ) return newAttributes }, @@ -58,6 +64,9 @@ const deprecated = [ migrate: attributes => { let newAttributes = deprecateContainerBackgroundColorOpacity.migrate( attributes ) newAttributes = deprecateButtonGradientColor.migrate( 'button%s' )( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + newAttributes = deprecateShadowColor.migrate( 'button%s' )( newAttributes ) return deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) }, }, diff --git a/src/block/call-to-action/deprecated.js b/src/block/call-to-action/deprecated.js index 60b67c2ce..e185c0314 100644 --- a/src/block/call-to-action/deprecated.js +++ b/src/block/call-to-action/deprecated.js @@ -44,18 +44,69 @@ const deprecated = [ const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes ) const hasTopSeparatorShadow = deprecateShadowColor.isEligible( 'topSeparator%s' )( attributes ) const hasBottomSeparatorShadow = deprecateShadowColor.isEligible( 'bottomSeparator%s' )( attributes ) + const isNotV4 = attributes.version < 2 || typeof attributes.version === 'undefined' - return hasBlockShadow || hasContainerShadow || hasTopSeparatorShadow || hasBottomSeparatorShadow + return hasBlockShadow || hasContainerShadow || hasTopSeparatorShadow || hasBottomSeparatorShadow || isNotV4 }, - migrate: attributes => { - let newAttributes = { ...attributes } + migrate: ( attributes, innerBlocks ) => { + const isNotV4 = attributes.version < 2 || typeof attributes.version === 'undefined' + + let newAttributes = { + ...attributes, + } + + if ( isNotV4 ) { + newAttributes = { + ...newAttributes, + version: 2, + } + + // Update the vertical align into flexbox + const hasOldVerticalAlign = !! attributes.containerVerticalAlign // Column only, this was changed to flexbox + + if ( hasOldVerticalAlign ) { + newAttributes = { + ...newAttributes, + containerVerticalAlign: '', + innerBlockAlign: attributes.containerVerticalAlign, + } + } + + // If the inner blocks are horizontal, adjust to accomodate the new + // column gap, it will modify blocks because people used block + // margins before instead of a proper column gap. + if ( attributes.innerBlockOrientation === 'horizontal' ) { + innerBlocks.forEach( ( block, index ) => { + if ( index ) { + if ( ! block.attributes.blockMargin ) { + block.attributes.blockMargin = { + top: '', + right: '', + bottom: '', + left: '', + } + } + if ( block.attributes.blockMargin.left === '' ) { + block.attributes.blockMargin.left = 24 + } + } + } ) + newAttributes = { + ...newAttributes, + innerBlockColumnGap: 0, + } + } + } + + newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) newAttributes = deprecateShadowColor.migrate( 'topSeparator%s' )( newAttributes ) newAttributes = deprecateShadowColor.migrate( 'bottomSeparator%s' )( newAttributes ) - return newAttributes + return [ newAttributes, innerBlocks ] }, }, // Support the new combined opacity and color. @@ -122,6 +173,10 @@ const deprecated = [ newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + newAttributes = deprecateShadowColor.migrate( 'topSeparator%s' )( newAttributes ) + newAttributes = deprecateShadowColor.migrate( 'bottomSeparator%s' )( newAttributes ) return [ newAttributes, innerBlocks ] }, @@ -200,6 +255,10 @@ const deprecated = [ newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + newAttributes = deprecateShadowColor.migrate( 'topSeparator%s' )( newAttributes ) + newAttributes = deprecateShadowColor.migrate( 'bottomSeparator%s' )( newAttributes ) return [ newAttributes, innerBlocks ] }, diff --git a/src/block/card/deprecated.js b/src/block/card/deprecated.js index 7fdfa2ea4..da6cd555b 100644 --- a/src/block/card/deprecated.js +++ b/src/block/card/deprecated.js @@ -93,16 +93,68 @@ const deprecated = [ isEligible: attributes => { const hasBlockShadow = deprecateBlockShadowColor.isEligible( attributes ) const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes ) + const isNotV4 = attributes.version < 2 || typeof attributes.version === 'undefined' - return hasBlockShadow || hasContainerShadow + return hasBlockShadow || hasContainerShadow || isNotV4 }, - migrate: attributes => { - let newAttributes = { ...attributes } + migrate: ( attributes, innerBlocks ) => { + const isNotV4 = attributes.version < 2 || typeof attributes.version === 'undefined' + + let newAttributes = { + ...attributes, + } + + if ( isNotV4 ) { + newAttributes = { + ...newAttributes, + version: 2, + } + + // Update the vertical align into flexbox + const hasOldVerticalAlign = !! attributes.containerVerticalAlign // Column only, this was changed to flexbox + if ( hasOldVerticalAlign ) { + newAttributes = { + ...newAttributes, + containerVerticalAlign: '', + innerBlockAlign: attributes.containerVerticalAlign, + } + } + + // If the inner blocks are horizontal, adjust to accomodate the new + // column gap, it will modify blocks because people used block + // margins before instead of a proper column gap. + if ( attributes.innerBlockOrientation === 'horizontal' ) { + innerBlocks.forEach( ( block, index ) => { + if ( index ) { + if ( ! block.attributes.blockMargin ) { + block.attributes.blockMargin = { + top: '', + right: '', + bottom: '', + left: '', + } + } + if ( block.attributes.blockMargin.left === '' ) { + block.attributes.blockMargin.left = 24 + } + } + } ) + + newAttributes = { + ...newAttributes, + innerBlockColumnGap: 0, + } + } + } + + newAttributes = deprecationImageOverlayOpacity.migrate( newAttributes ), + newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) - return newAttributes + return [ newAttributes, innerBlocks ] }, }, { @@ -170,6 +222,8 @@ const deprecated = [ newAttributes = deprecationImageOverlayOpacity.migrate( newAttributes ), newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) return [ newAttributes, innerBlocks ] }, @@ -249,6 +303,8 @@ const deprecated = [ newAttributes = deprecationImageOverlayOpacity.migrate( newAttributes ), newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) return [ newAttributes, innerBlocks ] }, diff --git a/src/block/carousel/deprecated.js b/src/block/carousel/deprecated.js index 53d9c18ea..047bfa76c 100644 --- a/src/block/carousel/deprecated.js +++ b/src/block/carousel/deprecated.js @@ -27,6 +27,8 @@ const deprecated = [ newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) newAttributes = deprecateShadowColor.migrate( 'topSeparator%s' )( newAttributes ) newAttributes = deprecateShadowColor.migrate( 'bottomSeparator%s' )( newAttributes ) + newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) return newAttributes }, @@ -46,6 +48,10 @@ const deprecated = [ newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + newAttributes = deprecateShadowColor.migrate( 'topSeparator%s' )( newAttributes ) + newAttributes = deprecateShadowColor.migrate( 'bottomSeparator%s' )( newAttributes ) return newAttributes }, diff --git a/src/block/column/deprecated.js b/src/block/column/deprecated.js index ac8bdc3d3..1c889b75e 100644 --- a/src/block/column/deprecated.js +++ b/src/block/column/deprecated.js @@ -82,16 +82,71 @@ const deprecated = [ isEligible: attributes => { const hasBlockShadow = deprecateBlockShadowColor.isEligible( attributes ) const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes ) + const isNotV4 = attributes.version < 4 || typeof attributes.version === 'undefined' - return hasBlockShadow || hasContainerShadow + return hasBlockShadow || hasContainerShadow || isNotV4 }, - migrate: attributes => { - let newAttributes = { ...attributes } + migrate: ( attributes, innerBlocks ) => { + const isNotV4 = attributes.version < 4 || typeof attributes.version === 'undefined' + + let newAttributes = { + ...attributes, + } + + if ( isNotV4 ) { + newAttributes = { + ...newAttributes, + version: 4, + className: classnames( attributes.className, { + 'stk-block-column--v2': false, + 'stk-block-column--v3': false, + } ), + } + + // Update the vertical align into flexbox + const hasOldVerticalAlign = !! attributes.containerVerticalAlign // Column only, this was changed to flexbox + + if ( hasOldVerticalAlign ) { + newAttributes = { + ...newAttributes, + containerVerticalAlign: '', + innerBlockAlign: attributes.containerVerticalAlign, + } + } + + // If the inner blocks are horizontal, adjust to accomodate the new + // column gap, it will modify blocks because people used block + // margins before instead of a proper column gap. + if ( attributes.innerBlockOrientation === 'horizontal' ) { + innerBlocks.forEach( ( block, index ) => { + if ( index ) { + if ( ! block.attributes.blockMargin ) { + block.attributes.blockMargin = { + top: '', + right: '', + bottom: '', + left: '', + } + } + if ( block.attributes.blockMargin.left === '' ) { + block.attributes.blockMargin.left = 24 + } + } + } ) + + newAttributes = { + ...newAttributes, + innerBlockColumnGap: 0, + } + } + } + newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) - return newAttributes + return [ newAttributes, innerBlocks ] }, }, { @@ -162,6 +217,8 @@ const deprecated = [ newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) return [ newAttributes, innerBlocks ] }, @@ -244,6 +301,8 @@ const deprecated = [ newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) return [ newAttributes, innerBlocks ] }, diff --git a/src/block/columns/deprecated.js b/src/block/columns/deprecated.js index caf351751..8b6d5db02 100644 --- a/src/block/columns/deprecated.js +++ b/src/block/columns/deprecated.js @@ -45,12 +45,20 @@ const deprecated = [ const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes ) const hasTopSeparatorShadow = deprecateShadowColor.isEligible( 'topSeparator%s' )( attributes ) const hasBottomSeparatorShadow = deprecateShadowColor.isEligible( 'bottomSeparator%s' )( attributes ) + const hasColumnFit = !! attributes.columnFit - return hasBlockShadow || hasContainerShadow || hasTopSeparatorShadow || hasBottomSeparatorShadow + return hasBlockShadow || hasContainerShadow || hasTopSeparatorShadow || hasBottomSeparatorShadow || hasColumnFit }, migrate: attributes => { - let newAttributes = { ...attributes } + let newAttributes = { + ...attributes, + columnFit: '', + columnFitAlign: '', + columnJustify: !! attributes.columnFit ? ( attributes.columnFitAlign || 'flex-start' ) : '', + } + newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) newAttributes = deprecateShadowColor.migrate( 'topSeparator%s' )( newAttributes ) @@ -80,6 +88,10 @@ const deprecated = [ newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + newAttributes = deprecateShadowColor.migrate( 'topSeparator%s' )( newAttributes ) + newAttributes = deprecateShadowColor.migrate( 'bottomSeparator%s' )( newAttributes ) return newAttributes }, @@ -102,6 +114,10 @@ const deprecated = [ newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + newAttributes = deprecateShadowColor.migrate( 'topSeparator%s' )( newAttributes ) + newAttributes = deprecateShadowColor.migrate( 'bottomSeparator%s' )( newAttributes ) return newAttributes }, diff --git a/src/block/count-up/deprecated.js b/src/block/count-up/deprecated.js index d9a18b572..0db656007 100644 --- a/src/block/count-up/deprecated.js +++ b/src/block/count-up/deprecated.js @@ -22,6 +22,9 @@ const deprecated = [ migrate: attributes => { let newAttributes = { ...attributes } + newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateTypographyGradientColor.migrate( '%s' )( newAttributes ) newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) newAttributes = deprecateTypographyShadowColor.migrate( '%s' )( newAttributes ) @@ -46,6 +49,9 @@ const deprecated = [ newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateTypographyGradientColor.migrate( '%s' )( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + newAttributes = deprecateTypographyShadowColor.migrate( '%s' )( newAttributes ) return newAttributes }, @@ -57,6 +63,9 @@ const deprecated = [ migrate: attributes => { let newAttributes = deprecateContainerBackgroundColorOpacity.migrate( attributes ) newAttributes = deprecateTypographyGradientColor.migrate( '%s' )( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + newAttributes = deprecateTypographyShadowColor.migrate( '%s' )( newAttributes ) return deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) }, }, diff --git a/src/block/countdown/deprecated.js b/src/block/countdown/deprecated.js index 9de29a4e8..31e834a1a 100644 --- a/src/block/countdown/deprecated.js +++ b/src/block/countdown/deprecated.js @@ -15,12 +15,18 @@ const deprecated = [ isEligible: attributes => { const hasBlockShadow = deprecateBlockShadowColor.isEligible( attributes ) const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes ) + const isNotV4 = attributes.version < 2 || typeof attributes.version === 'undefined' - return hasBlockShadow || hasContainerShadow + return hasBlockShadow || hasContainerShadow || isNotV4 }, migrate: attributes => { let newAttributes = { ...attributes } + newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateTypographyGradientColor.migrate( 'digit%s' )( newAttributes ) + newAttributes = deprecateTypographyGradientColor.migrate( 'label%s' )( newAttributes ) + newAttributes = deprecateTypographyGradientColor.migrate( 'message%s' )( newAttributes ) newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) @@ -49,6 +55,8 @@ const deprecated = [ newAttributes = deprecateTypographyGradientColor.migrate( 'digit%s' )( newAttributes ) newAttributes = deprecateTypographyGradientColor.migrate( 'label%s' )( newAttributes ) newAttributes = deprecateTypographyGradientColor.migrate( 'message%s' )( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) return newAttributes }, @@ -90,6 +98,8 @@ const deprecated = [ newAttributes = deprecateTypographyGradientColor.migrate( 'digit%s' )( newAttributes ) newAttributes = deprecateTypographyGradientColor.migrate( 'label%s' )( newAttributes ) newAttributes = deprecateTypographyGradientColor.migrate( 'message%s' )( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) return newAttributes }, @@ -103,6 +113,8 @@ const deprecated = [ newAttributes = deprecateTypographyGradientColor.migrate( 'digit%s' )( newAttributes ) newAttributes = deprecateTypographyGradientColor.migrate( 'label%s' )( newAttributes ) newAttributes = deprecateTypographyGradientColor.migrate( 'message%s' )( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) return deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) }, diff --git a/src/block/divider/deprecated.js b/src/block/divider/deprecated.js index 6024aad74..395ffb36b 100644 --- a/src/block/divider/deprecated.js +++ b/src/block/divider/deprecated.js @@ -21,6 +21,8 @@ const deprecated = [ migrate: attributes => { let newAttributes = { ...attributes } + newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) @@ -42,6 +44,8 @@ const deprecated = [ newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) return newAttributes }, @@ -51,7 +55,9 @@ const deprecated = [ attributes: attributes( '3.7.9' ), save: withVersion( '3.7.9' )( Save ), migrate: attributes => { - const newAttributes = deprecateContainerBackgroundColorOpacity.migrate( attributes ) + let newAttributes = deprecateContainerBackgroundColorOpacity.migrate( attributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) return deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) }, }, diff --git a/src/block/expand/deprecated.js b/src/block/expand/deprecated.js index 6024aad74..395ffb36b 100644 --- a/src/block/expand/deprecated.js +++ b/src/block/expand/deprecated.js @@ -21,6 +21,8 @@ const deprecated = [ migrate: attributes => { let newAttributes = { ...attributes } + newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) @@ -42,6 +44,8 @@ const deprecated = [ newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) return newAttributes }, @@ -51,7 +55,9 @@ const deprecated = [ attributes: attributes( '3.7.9' ), save: withVersion( '3.7.9' )( Save ), migrate: attributes => { - const newAttributes = deprecateContainerBackgroundColorOpacity.migrate( attributes ) + let newAttributes = deprecateContainerBackgroundColorOpacity.migrate( attributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) return deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) }, }, diff --git a/src/block/feature-grid/deprecated.js b/src/block/feature-grid/deprecated.js index c17f2cb76..d863d3c19 100644 --- a/src/block/feature-grid/deprecated.js +++ b/src/block/feature-grid/deprecated.js @@ -47,12 +47,20 @@ const deprecated = [ const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes ) const hasTopSeparatorShadow = deprecateShadowColor.isEligible( 'topSeparator%s' )( attributes ) const hasBottomSeparatorShadow = deprecateShadowColor.isEligible( 'bottomSeparator%s' )( attributes ) + const hasColumnFit = !! attributes.columnFit - return hasBlockShadow || hasContainerShadow || hasTopSeparatorShadow || hasBottomSeparatorShadow + return hasBlockShadow || hasContainerShadow || hasTopSeparatorShadow || hasBottomSeparatorShadow || hasColumnFit }, migrate: attributes => { - let newAttributes = { ...attributes } + let newAttributes = { + ...attributes, + columnFit: '', + columnFitAlign: '', + columnJustify: !! attributes.columnFit ? ( attributes.columnFitAlign || 'flex-start' ) : '', + } + newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) newAttributes = deprecateShadowColor.migrate( 'topSeparator%s' )( newAttributes ) @@ -82,6 +90,10 @@ const deprecated = [ newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + newAttributes = deprecateShadowColor.migrate( 'topSeparator%s' )( newAttributes ) + newAttributes = deprecateShadowColor.migrate( 'bottomSeparator%s' )( newAttributes ) return newAttributes }, @@ -100,6 +112,10 @@ const deprecated = [ newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + newAttributes = deprecateShadowColor.migrate( 'topSeparator%s' )( newAttributes ) + newAttributes = deprecateShadowColor.migrate( 'bottomSeparator%s' )( newAttributes ) return newAttributes }, diff --git a/src/block/feature/deprecated.js b/src/block/feature/deprecated.js index 6c9890522..851ca5574 100644 --- a/src/block/feature/deprecated.js +++ b/src/block/feature/deprecated.js @@ -71,12 +71,29 @@ const deprecated = [ const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes ) const hasTopSeparatorShadow = deprecateShadowColor.isEligible( 'topSeparator%s' )( attributes ) const hasBottomSeparatorShadow = deprecateShadowColor.isEligible( 'bottomSeparator%s' )( attributes ) + const isNotV4 = attributes.version < 2 || typeof attributes.version === 'undefined' - return hasBlockShadow || hasContainerShadow || hasTopSeparatorShadow || hasBottomSeparatorShadow + return hasBlockShadow || hasContainerShadow || hasTopSeparatorShadow || hasBottomSeparatorShadow || isNotV4 }, migrate: attributes => { - let newAttributes = { ...attributes } + let newAttributes = { + ...attributes, + version: 2, + } + + // Update the old column fit into flexbox + const hasOldColumnFit = !! attributes.columnFit + if ( hasOldColumnFit ) { + newAttributes = { + ...newAttributes, + columnFit: '', + columnFitAlign: '', + columnJustify: attributes.columnFitAlign, + } + } + newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) newAttributes = deprecateShadowColor.migrate( 'topSeparator%s' )( newAttributes ) @@ -115,6 +132,10 @@ const deprecated = [ newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + newAttributes = deprecateShadowColor.migrate( 'topSeparator%s' )( newAttributes ) + newAttributes = deprecateShadowColor.migrate( 'bottomSeparator%s' )( newAttributes ) return newAttributes }, @@ -167,6 +188,10 @@ const deprecated = [ newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + newAttributes = deprecateShadowColor.migrate( 'topSeparator%s' )( newAttributes ) + newAttributes = deprecateShadowColor.migrate( 'bottomSeparator%s' )( newAttributes ) return newAttributes }, diff --git a/src/block/heading/deprecated.js b/src/block/heading/deprecated.js index 97b7c590d..e8cc3be19 100644 --- a/src/block/heading/deprecated.js +++ b/src/block/heading/deprecated.js @@ -48,6 +48,9 @@ const deprecated = [ migrate: attributes => { let newAttributes = { ...attributes } + newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateTypographyGradientColor.migrate( '%s' )( newAttributes ) newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) newAttributes = deprecateTypographyShadowColor.migrate( '%s' )( newAttributes ) @@ -72,6 +75,9 @@ const deprecated = [ newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateTypographyGradientColor.migrate( '%s' )( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + newAttributes = deprecateTypographyShadowColor.migrate( '%s' )( newAttributes ) return newAttributes }, @@ -83,6 +89,9 @@ const deprecated = [ migrate: attributes => { let newAttributes = deprecateContainerBackgroundColorOpacity.migrate( attributes ) newAttributes = deprecateTypographyGradientColor.migrate( '%s' )( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + newAttributes = deprecateTypographyShadowColor.migrate( '%s' )( newAttributes ) return deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) }, }, diff --git a/src/block/hero/deprecated.js b/src/block/hero/deprecated.js index 1d6da3d34..cc43238e3 100644 --- a/src/block/hero/deprecated.js +++ b/src/block/hero/deprecated.js @@ -44,12 +44,63 @@ const deprecated = [ const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes ) const hasTopSeparatorShadow = deprecateShadowColor.isEligible( 'topSeparator%s' )( attributes ) const hasBottomSeparatorShadow = deprecateShadowColor.isEligible( 'bottomSeparator%s' )( attributes ) + const isNotV4 = attributes.version < 2 || typeof attributes.version === 'undefined' - return hasBlockShadow || hasContainerShadow || hasTopSeparatorShadow || hasBottomSeparatorShadow + return hasBlockShadow || hasContainerShadow || hasTopSeparatorShadow || hasBottomSeparatorShadow || isNotV4 }, - migrate: attributes => { - let newAttributes = { ...attributes } + migrate: ( attributes, innerBlocks ) => { + const isNotV4 = attributes.version < 2 || typeof attributes.version === 'undefined' + + let newAttributes = { + ...attributes, + } + + if ( isNotV4 ) { + newAttributes = { + ...newAttributes, + version: 2, + } + + // Update the vertical align into flexbox + const hasOldVerticalAlign = !! attributes.containerVerticalAlign // Column only, this was changed to flexbox + if ( hasOldVerticalAlign ) { + newAttributes = { + ...newAttributes, + containerVerticalAlign: '', + innerBlockAlign: attributes.containerVerticalAlign, + } + } + + // If the inner blocks are horizontal, adjust to accomodate the new + // column gap, it will modify blocks because people used block + // margins before instead of a proper column gap. + if ( attributes.innerBlockOrientation === 'horizontal' ) { + innerBlocks.forEach( ( block, index ) => { + if ( index ) { + if ( ! block.attributes.blockMargin ) { + block.attributes.blockMargin = { + top: '', + right: '', + bottom: '', + left: '', + } + } + if ( block.attributes.blockMargin.left === '' ) { + block.attributes.blockMargin.left = 24 + } + } + } ) + + newAttributes = { + ...newAttributes, + innerBlockColumnGap: 0, + } + } + } + + newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) newAttributes = deprecateShadowColor.migrate( 'topSeparator%s' )( newAttributes ) @@ -122,6 +173,10 @@ const deprecated = [ newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + newAttributes = deprecateShadowColor.migrate( 'topSeparator%s' )( newAttributes ) + newAttributes = deprecateShadowColor.migrate( 'bottomSeparator%s' )( newAttributes ) return newAttributes }, @@ -201,6 +256,10 @@ const deprecated = [ newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + newAttributes = deprecateShadowColor.migrate( 'topSeparator%s' )( newAttributes ) + newAttributes = deprecateShadowColor.migrate( 'bottomSeparator%s' )( newAttributes ) return [ newAttributes, innerBlocks ] }, diff --git a/src/block/horizontal-scroller/deprecated.js b/src/block/horizontal-scroller/deprecated.js index 47ffde6e0..a3d054b75 100644 --- a/src/block/horizontal-scroller/deprecated.js +++ b/src/block/horizontal-scroller/deprecated.js @@ -35,6 +35,8 @@ const deprecated = [ migrate: attributes => { let newAttributes = { ...attributes } + newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) @@ -56,6 +58,8 @@ const deprecated = [ newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) return newAttributes }, @@ -65,7 +69,9 @@ const deprecated = [ attributes: attributes( '3.7.9' ), save: withVersion( '3.7.9' )( Save ), migrate: attributes => { - const newAttributes = deprecateContainerBackgroundColorOpacity.migrate( attributes ) + let newAttributes = deprecateContainerBackgroundColorOpacity.migrate( attributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) return deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) }, }, diff --git a/src/block/icon-box/deprecated.js b/src/block/icon-box/deprecated.js index 4d270e69c..7a6bc048e 100644 --- a/src/block/icon-box/deprecated.js +++ b/src/block/icon-box/deprecated.js @@ -15,12 +15,29 @@ const deprecated = [ isEligible: attributes => { const hasBlockShadow = deprecateBlockShadowColor.isEligible( attributes ) const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes ) + const isNotV4 = attributes.version < 2 || typeof attributes.version === 'undefined' - return hasBlockShadow || hasContainerShadow + return hasBlockShadow || hasContainerShadow || isNotV4 }, migrate: attributes => { - let newAttributes = { ...attributes } + let newAttributes = { + ...attributes, + version: 2, + } + + // Update the vertical align into flexbox + const hasOldVerticalAlign = !! attributes.containerVerticalAlign // Column only, this was changed to flexbox + + if ( hasOldVerticalAlign ) { + newAttributes = { + ...newAttributes, + containerVerticalAlign: '', + innerBlockAlign: attributes.containerVerticalAlign, + } + } + newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) @@ -57,6 +74,8 @@ const deprecated = [ newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) return newAttributes }, @@ -109,6 +128,8 @@ const deprecated = [ newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) return newAttributes }, diff --git a/src/block/icon-button/deprecated.js b/src/block/icon-button/deprecated.js index e16bdd1b6..9bf89108c 100644 --- a/src/block/icon-button/deprecated.js +++ b/src/block/icon-button/deprecated.js @@ -23,9 +23,12 @@ const deprecated = [ migrate: attributes => { let newAttributes = { ...attributes } + newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateButtonGradientColor.migrate( 'button%s' )( newAttributes ) newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) - newAttributes = deprecateShadowColor.migrate( 'button%s' )( attributes ) + newAttributes = deprecateShadowColor.migrate( 'button%s' )( newAttributes ) return newAttributes }, @@ -47,6 +50,9 @@ const deprecated = [ newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateButtonGradientColor.migrate( 'button%s' )( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + newAttributes = deprecateShadowColor.migrate( 'button%s' )( newAttributes ) return newAttributes }, @@ -58,6 +64,9 @@ const deprecated = [ migrate: attributes => { let newAttributes = deprecateContainerBackgroundColorOpacity.migrate( attributes ) newAttributes = deprecateButtonGradientColor.migrate( 'button%s' )( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + newAttributes = deprecateShadowColor.migrate( 'button%s' )( newAttributes ) return deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) }, }, diff --git a/src/block/icon-label/deprecated.js b/src/block/icon-label/deprecated.js index 6024aad74..395ffb36b 100644 --- a/src/block/icon-label/deprecated.js +++ b/src/block/icon-label/deprecated.js @@ -21,6 +21,8 @@ const deprecated = [ migrate: attributes => { let newAttributes = { ...attributes } + newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) @@ -42,6 +44,8 @@ const deprecated = [ newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) return newAttributes }, @@ -51,7 +55,9 @@ const deprecated = [ attributes: attributes( '3.7.9' ), save: withVersion( '3.7.9' )( Save ), migrate: attributes => { - const newAttributes = deprecateContainerBackgroundColorOpacity.migrate( attributes ) + let newAttributes = deprecateContainerBackgroundColorOpacity.migrate( attributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) return deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) }, }, diff --git a/src/block/icon-list/deprecated/index.js b/src/block/icon-list/deprecated/index.js index 4cfda6cdc..3339592e6 100644 --- a/src/block/icon-list/deprecated/index.js +++ b/src/block/icon-list/deprecated/index.js @@ -77,13 +77,53 @@ const deprecated = [ return hasBlockShadow || hasContainerShadow }, - migrate: attributes => { + supports: { + anchor: true, + spacing: true, + __unstablePasteTextInline: true, + __experimentalSelector: 'ol,ul', + __experimentalOnMerge: true, + }, + migrate: ( attributes, innerBlocks ) => { let newAttributes = { ...attributes } + const { + text, icons, iconSize, ordered, iconGap, + } = attributes + + const _iconSize = iconSize ? iconSize : 1 + const _iconGap = iconGap ? iconGap : 0 + + newAttributes = { + ...newAttributes, + listFullWidth: false, + iconVerticalAlignment: 'baseline', + iconGap: _iconGap + 4, // Our gap is smaller now. + iconSize: ordered + ? getEquivalentFontSize( _iconSize ) + : getEquivalentIconSize( _iconSize ), + } + if ( ! text ) { + const block = createBlock( 'stackable/icon-list-item' ) + innerBlocks = [ block ] + } else { + const contents = textToArray( text ) + const blocks = contents.map( ( content, index ) => { + return createBlock( 'stackable/icon-list-item', { + text: content, + icon: getUniqueIcon( icons, index ), + } ) + } ) + innerBlocks = blocks + } + + newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateTypographyGradientColor.migrate( '%s' )( newAttributes ) newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) - return newAttributes + return [ newAttributes, innerBlocks ] }, }, { @@ -132,6 +172,8 @@ const deprecated = [ newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateTypographyGradientColor.migrate( '%s' )( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) return [ newAttributes, innerBlocks ] }, @@ -153,6 +195,8 @@ const deprecated = [ newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateTypographyGradientColor.migrate( '%s' )( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) return newAttributes }, @@ -164,6 +208,8 @@ const deprecated = [ migrate: attributes => { let newAttributes = deprecateContainerBackgroundColorOpacity.migrate( attributes ) newAttributes = deprecateTypographyGradientColor.migrate( '%s' )( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) return deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) }, diff --git a/src/block/icon/deprecated.js b/src/block/icon/deprecated.js index 6024aad74..395ffb36b 100644 --- a/src/block/icon/deprecated.js +++ b/src/block/icon/deprecated.js @@ -21,6 +21,8 @@ const deprecated = [ migrate: attributes => { let newAttributes = { ...attributes } + newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) @@ -42,6 +44,8 @@ const deprecated = [ newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) return newAttributes }, @@ -51,7 +55,9 @@ const deprecated = [ attributes: attributes( '3.7.9' ), save: withVersion( '3.7.9' )( Save ), migrate: attributes => { - const newAttributes = deprecateContainerBackgroundColorOpacity.migrate( attributes ) + let newAttributes = deprecateContainerBackgroundColorOpacity.migrate( attributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) return deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) }, }, diff --git a/src/block/image-box/deprecated.js b/src/block/image-box/deprecated.js index 6024aad74..395ffb36b 100644 --- a/src/block/image-box/deprecated.js +++ b/src/block/image-box/deprecated.js @@ -21,6 +21,8 @@ const deprecated = [ migrate: attributes => { let newAttributes = { ...attributes } + newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) @@ -42,6 +44,8 @@ const deprecated = [ newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) return newAttributes }, @@ -51,7 +55,9 @@ const deprecated = [ attributes: attributes( '3.7.9' ), save: withVersion( '3.7.9' )( Save ), migrate: attributes => { - const newAttributes = deprecateContainerBackgroundColorOpacity.migrate( attributes ) + let newAttributes = deprecateContainerBackgroundColorOpacity.migrate( attributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) return deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) }, }, diff --git a/src/block/image/deprecated.js b/src/block/image/deprecated.js index 004e20078..04e709ee1 100644 --- a/src/block/image/deprecated.js +++ b/src/block/image/deprecated.js @@ -73,6 +73,9 @@ const deprecated = [ migrate: attributes => { let newAttributes = { ...attributes } + newAttributes = deprecationImageOverlayOpacity.migrate( newAttributes ) + newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) newAttributes = deprecateShadowColor.migrate( 'image%s' )( newAttributes ) @@ -104,6 +107,9 @@ const deprecated = [ newAttributes = deprecationImageOverlayOpacity.migrate( newAttributes ) newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + newAttributes = deprecateShadowColor.migrate( 'image%s' )( newAttributes ) return newAttributes }, @@ -115,6 +121,9 @@ const deprecated = [ migrate: attributes => { let newAttributes = deprecateContainerBackgroundColorOpacity.migrate( attributes ) newAttributes = deprecationImageOverlayOpacity.migrate( attributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + newAttributes = deprecateShadowColor.migrate( 'image%s' )( newAttributes ) return deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) }, }, diff --git a/src/block/map/deprecated.js b/src/block/map/deprecated.js index 6024aad74..395ffb36b 100644 --- a/src/block/map/deprecated.js +++ b/src/block/map/deprecated.js @@ -21,6 +21,8 @@ const deprecated = [ migrate: attributes => { let newAttributes = { ...attributes } + newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) @@ -42,6 +44,8 @@ const deprecated = [ newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) return newAttributes }, @@ -51,7 +55,9 @@ const deprecated = [ attributes: attributes( '3.7.9' ), save: withVersion( '3.7.9' )( Save ), migrate: attributes => { - const newAttributes = deprecateContainerBackgroundColorOpacity.migrate( attributes ) + let newAttributes = deprecateContainerBackgroundColorOpacity.migrate( attributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) return deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) }, }, diff --git a/src/block/notification/deprecated.js b/src/block/notification/deprecated.js index a255aa32f..843109e86 100644 --- a/src/block/notification/deprecated.js +++ b/src/block/notification/deprecated.js @@ -42,12 +42,63 @@ const deprecated = [ isEligible: attributes => { const hasBlockShadow = deprecateBlockShadowColor.isEligible( attributes ) const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes ) + const isNotV4 = attributes.version < 2 || typeof attributes.version === 'undefined' - return hasBlockShadow || hasContainerShadow + return hasBlockShadow || hasContainerShadow || isNotV4 }, - migrate: attributes => { - let newAttributes = { ...attributes } + migrate: ( attributes, innerBlocks ) => { + const isNotV4 = attributes.version < 2 || typeof attributes.version === 'undefined' + + let newAttributes = { + ...attributes, + } + if ( isNotV4 ) { + newAttributes = { + ...newAttributes, + version: 2, + } + + // Update the vertical align into flexbox + const hasOldVerticalAlign = !! attributes.containerVerticalAlign // Column only, this was changed to flexbox + + if ( hasOldVerticalAlign ) { + newAttributes = { + ...newAttributes, + containerVerticalAlign: '', + innerBlockAlign: attributes.containerVerticalAlign, + } + } + + // If the inner blocks are horizontal, adjust to accomodate the new + // column gap, it will modify blocks because people used block + // margins before instead of a proper column gap. + if ( attributes.innerBlockOrientation === 'horizontal' ) { + innerBlocks.forEach( ( block, index ) => { + if ( index ) { + if ( ! block.attributes.blockMargin ) { + block.attributes.blockMargin = { + top: '', + right: '', + bottom: '', + left: '', + } + } + if ( block.attributes.blockMargin.left === '' ) { + block.attributes.blockMargin.left = 24 + } + } + } ) + + newAttributes = { + ...newAttributes, + innerBlockColumnGap: 0, + } + } + } + + newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) @@ -118,6 +169,8 @@ const deprecated = [ newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) return newAttributes }, @@ -196,6 +249,8 @@ const deprecated = [ newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) return [ newAttributes, innerBlocks ] }, diff --git a/src/block/number-box/deprecated.js b/src/block/number-box/deprecated.js index ea68ebb9b..d66bfcf0e 100644 --- a/src/block/number-box/deprecated.js +++ b/src/block/number-box/deprecated.js @@ -20,8 +20,9 @@ const deprecated = [ return hasBlockShadow || hasContainerShadow || hasShapeShadow }, migrate: attributes => { - let newAttributes = { ...attributes } - + let newAttributes = deprecateBlockBackgroundColorOpacity.migrate( attributes ) + newAttributes = deprecationBackgrounColorOpacity.migrate( 'shape%s' )( newAttributes ) + newAttributes = deprecateTypographyGradientColor.migrate( '%s' )( newAttributes ) newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) newAttributes = deprecateShadowColor.migrate( 'shape%s' )( newAttributes ) @@ -42,6 +43,9 @@ const deprecated = [ let newAttributes = deprecateBlockBackgroundColorOpacity.migrate( attributes ) newAttributes = deprecationBackgrounColorOpacity.migrate( 'shape%s' )( newAttributes ) newAttributes = deprecateTypographyGradientColor.migrate( '%s' )( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + newAttributes = deprecateShadowColor.migrate( 'shape%s' )( newAttributes ) return newAttributes }, }, @@ -54,6 +58,9 @@ const deprecated = [ let newAttributes = deprecateBlockBackgroundColorOpacity.migrate( attributes ) newAttributes = deprecationBackgrounColorOpacity.migrate( 'shape%s' )( newAttributes ) newAttributes = deprecateTypographyGradientColor.migrate( '%s' )( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + newAttributes = deprecateShadowColor.migrate( 'shape%s' )( newAttributes ) return newAttributes }, }, diff --git a/src/block/posts/deprecated.js b/src/block/posts/deprecated.js index 38b32a15b..88bb28a62 100644 --- a/src/block/posts/deprecated.js +++ b/src/block/posts/deprecated.js @@ -49,11 +49,52 @@ const deprecated = [ const hasBlockShadow = deprecateBlockShadowColor.isEligible( attributes ) const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes ) const hasImageShadow = deprecateShadowColor.isEligible( 'image%s' )( attributes ) + const isNotV4 = attributes.version < 2 || typeof attributes.version === 'undefined' - return hasBlockShadow || hasContainerShadow || hasImageShadow + return hasBlockShadow || hasContainerShadow || hasImageShadow || isNotV4 }, migrate: attributes => { - let newAttributes = { ...attributes } + let newAttributes = { + ...attributes, + version: 2, + } + + // We used to have an "Inner content width" which is now just the block width + const hasOldInnerContentWidth = attributes.innerBlockContentWidth || attributes.innerBlockContentWidthTablet || attributes.innerBlockContentWidthMobile + + if ( hasOldInnerContentWidth ) { + newAttributes = { + ...newAttributes, + innerBlockContentWidth: '', + innerBlockContentWidthTablet: '', + innerBlockContentWidthMobile: '', + innerBlockContentWidthUnit: 'px', + innerBlockContentWidthUnitTablet: '', + innerBlockContentWidthUnitMobile: '', + blockWidth: attributes.innerBlockContentWidth, + blockWidthTablet: attributes.innerBlockContentWidthTablet, + blockWidthMobile: attributes.innerBlockContentWidthMobile, + blockWidthUnit: attributes.innerBlockContentWidthUnit, + blockWidthUnitTablet: attributes.innerBlockContentWidthUnitTablet, + blockWidthUnitMobile: attributes.innerBlockContentWidthUnitMobile, + innerBlockAlign: '', + innerBlockAlignTablet: '', + innerBlockAlignMobile: '', + blockHorizontalAlign: attributes.innerBlockAlign, + blockHorizontalAlignTablet: attributes.innerBlockAlignTablet, + blockHorizontalAlignMobile: attributes.innerBlockAlignMobile, + } + } + + newAttributes = deprecationImageOverlayOpacity.migrate( newAttributes ) + newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) + + newAttributes = deprecateTypographyGradientColor.migrate( 'title%s' )( newAttributes ) + newAttributes = deprecateTypographyGradientColor.migrate( 'category%s' )( newAttributes ) + newAttributes = deprecateTypographyGradientColor.migrate( 'excerpt%s' )( newAttributes ) + newAttributes = deprecateTypographyGradientColor.migrate( 'meta%s' )( newAttributes ) + newAttributes = deprecateTypographyGradientColor.migrate( 'readmore%s' )( newAttributes ) newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) @@ -133,6 +174,10 @@ const deprecated = [ newAttributes = deprecateTypographyGradientColor.migrate( 'meta%s' )( newAttributes ) newAttributes = deprecateTypographyGradientColor.migrate( 'readmore%s' )( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + newAttributes = deprecateShadowColor.migrate( 'image%s' )( newAttributes ) + return newAttributes }, }, @@ -208,6 +253,10 @@ const deprecated = [ newAttributes = deprecateTypographyGradientColor.migrate( 'meta%s' )( newAttributes ) newAttributes = deprecateTypographyGradientColor.migrate( 'readmore%s' )( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + newAttributes = deprecateShadowColor.migrate( 'image%s' )( newAttributes ) + return newAttributes }, }, diff --git a/src/block/price/deprecated.js b/src/block/price/deprecated.js index 6024aad74..395ffb36b 100644 --- a/src/block/price/deprecated.js +++ b/src/block/price/deprecated.js @@ -21,6 +21,8 @@ const deprecated = [ migrate: attributes => { let newAttributes = { ...attributes } + newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) @@ -42,6 +44,8 @@ const deprecated = [ newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) return newAttributes }, @@ -51,7 +55,9 @@ const deprecated = [ attributes: attributes( '3.7.9' ), save: withVersion( '3.7.9' )( Save ), migrate: attributes => { - const newAttributes = deprecateContainerBackgroundColorOpacity.migrate( attributes ) + let newAttributes = deprecateContainerBackgroundColorOpacity.migrate( attributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) return deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) }, }, diff --git a/src/block/pricing-box/deprecated.js b/src/block/pricing-box/deprecated.js index 58728fb1c..aa0e1113f 100644 --- a/src/block/pricing-box/deprecated.js +++ b/src/block/pricing-box/deprecated.js @@ -41,12 +41,63 @@ const deprecated = [ isEligible: attributes => { const hasBlockShadow = deprecateBlockShadowColor.isEligible( attributes ) const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes ) + const isNotV4 = attributes.version < 2 || typeof attributes.version === 'undefined' - return hasBlockShadow || hasContainerShadow + return hasBlockShadow || hasContainerShadow || isNotV4 }, - migrate: attributes => { - let newAttributes = { ...attributes } + migrate: ( attributes, innerBlocks ) => { + const isNotV4 = attributes.version < 2 || typeof attributes.version === 'undefined' + + let newAttributes = { + ...attributes, + } + if ( isNotV4 ) { + newAttributes = { + ...newAttributes, + version: 2, + } + + // Update the vertical align into flexbox + const hasOldVerticalAlign = !! attributes.containerVerticalAlign // Column only, this was changed to flexbox + + if ( hasOldVerticalAlign ) { + newAttributes = { + ...newAttributes, + containerVerticalAlign: '', + innerBlockAlign: attributes.containerVerticalAlign, + } + } + + // If the inner blocks are horizontal, adjust to accomodate the new + // column gap, it will modify blocks because people used block + // margins before instead of a proper column gap. + if ( attributes.innerBlockOrientation === 'horizontal' ) { + innerBlocks.forEach( ( block, index ) => { + if ( index ) { + if ( ! block.attributes.blockMargin ) { + block.attributes.blockMargin = { + top: '', + right: '', + bottom: '', + left: '', + } + } + if ( block.attributes.blockMargin.left === '' ) { + block.attributes.blockMargin.left = 24 + } + } + } ) + + newAttributes = { + ...newAttributes, + innerBlockColumnGap: 0, + } + } + } + + newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) @@ -117,6 +168,8 @@ const deprecated = [ newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) return newAttributes }, @@ -195,6 +248,8 @@ const deprecated = [ newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) return [ newAttributes, innerBlocks ] }, diff --git a/src/block/progress-bar/deprecated.js b/src/block/progress-bar/deprecated.js index d9a18b572..0db656007 100644 --- a/src/block/progress-bar/deprecated.js +++ b/src/block/progress-bar/deprecated.js @@ -22,6 +22,9 @@ const deprecated = [ migrate: attributes => { let newAttributes = { ...attributes } + newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateTypographyGradientColor.migrate( '%s' )( newAttributes ) newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) newAttributes = deprecateTypographyShadowColor.migrate( '%s' )( newAttributes ) @@ -46,6 +49,9 @@ const deprecated = [ newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateTypographyGradientColor.migrate( '%s' )( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + newAttributes = deprecateTypographyShadowColor.migrate( '%s' )( newAttributes ) return newAttributes }, @@ -57,6 +63,9 @@ const deprecated = [ migrate: attributes => { let newAttributes = deprecateContainerBackgroundColorOpacity.migrate( attributes ) newAttributes = deprecateTypographyGradientColor.migrate( '%s' )( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + newAttributes = deprecateTypographyShadowColor.migrate( '%s' )( newAttributes ) return deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) }, }, diff --git a/src/block/progress-circle/deprecated.js b/src/block/progress-circle/deprecated.js index d9a18b572..0db656007 100644 --- a/src/block/progress-circle/deprecated.js +++ b/src/block/progress-circle/deprecated.js @@ -22,6 +22,9 @@ const deprecated = [ migrate: attributes => { let newAttributes = { ...attributes } + newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateTypographyGradientColor.migrate( '%s' )( newAttributes ) newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) newAttributes = deprecateTypographyShadowColor.migrate( '%s' )( newAttributes ) @@ -46,6 +49,9 @@ const deprecated = [ newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateTypographyGradientColor.migrate( '%s' )( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + newAttributes = deprecateTypographyShadowColor.migrate( '%s' )( newAttributes ) return newAttributes }, @@ -57,6 +63,9 @@ const deprecated = [ migrate: attributes => { let newAttributes = deprecateContainerBackgroundColorOpacity.migrate( attributes ) newAttributes = deprecateTypographyGradientColor.migrate( '%s' )( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + newAttributes = deprecateTypographyShadowColor.migrate( '%s' )( newAttributes ) return deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) }, }, diff --git a/src/block/separator/deprecated.js b/src/block/separator/deprecated.js index 2b91d3ed7..329d461cd 100644 --- a/src/block/separator/deprecated.js +++ b/src/block/separator/deprecated.js @@ -22,6 +22,8 @@ const deprecated = [ migrate: attributes => { let newAttributes = { ...attributes } + newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) newAttributes = deprecateShadowColor.migrate( 'separator%s' )( newAttributes ) @@ -44,6 +46,9 @@ const deprecated = [ newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + newAttributes = deprecateShadowColor.migrate( 'separator%s' )( newAttributes ) return newAttributes }, @@ -53,7 +58,10 @@ const deprecated = [ attributes: attributes( '3.7.9' ), save: withVersion( '3.7.9' )( Save ), migrate: attributes => { - const newAttributes = deprecateContainerBackgroundColorOpacity.migrate( attributes ) + let newAttributes = deprecateContainerBackgroundColorOpacity.migrate( attributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + newAttributes = deprecateShadowColor.migrate( 'separator%s' )( newAttributes ) return deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) }, }, diff --git a/src/block/spacer/deprecated.js b/src/block/spacer/deprecated.js index 6024aad74..395ffb36b 100644 --- a/src/block/spacer/deprecated.js +++ b/src/block/spacer/deprecated.js @@ -21,6 +21,8 @@ const deprecated = [ migrate: attributes => { let newAttributes = { ...attributes } + newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) @@ -42,6 +44,8 @@ const deprecated = [ newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) return newAttributes }, @@ -51,7 +55,9 @@ const deprecated = [ attributes: attributes( '3.7.9' ), save: withVersion( '3.7.9' )( Save ), migrate: attributes => { - const newAttributes = deprecateContainerBackgroundColorOpacity.migrate( attributes ) + let newAttributes = deprecateContainerBackgroundColorOpacity.migrate( attributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) return deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) }, }, diff --git a/src/block/subtitle/deprecated.js b/src/block/subtitle/deprecated.js index d87a7096d..a0c6c4240 100644 --- a/src/block/subtitle/deprecated.js +++ b/src/block/subtitle/deprecated.js @@ -22,6 +22,9 @@ const deprecated = [ migrate: attributes => { let newAttributes = { ...attributes } + newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateTypographyGradientColor.migrate( '%s' )( newAttributes ) newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) newAttributes = deprecateTypographyShadowColor.migrate( '%s' )( newAttributes ) @@ -46,6 +49,9 @@ const deprecated = [ newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateTypographyGradientColor.migrate( '%s' )( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + newAttributes = deprecateTypographyShadowColor.migrate( '%s' )( newAttributes ) return newAttributes }, @@ -57,6 +63,9 @@ const deprecated = [ migrate: attributes => { let newAttributes = deprecateContainerBackgroundColorOpacity.migrate( attributes ) newAttributes = deprecateTypographyGradientColor.migrate( '%s' )( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + newAttributes = deprecateTypographyShadowColor.migrate( '%s' )( newAttributes ) return deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) }, }, diff --git a/src/block/tab-content/deprecated.js b/src/block/tab-content/deprecated.js index 9d99c2c45..57fd88d26 100644 --- a/src/block/tab-content/deprecated.js +++ b/src/block/tab-content/deprecated.js @@ -21,6 +21,8 @@ const deprecated = [ migrate: attributes => { let newAttributes = { ...attributes } + newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) @@ -42,6 +44,8 @@ const deprecated = [ newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) return newAttributes }, diff --git a/src/block/tab-labels/deprecated.js b/src/block/tab-labels/deprecated.js index 5750f1f45..6f6cca19d 100644 --- a/src/block/tab-labels/deprecated.js +++ b/src/block/tab-labels/deprecated.js @@ -24,6 +24,11 @@ const deprecated = [ migrate: attributes => { let newAttributes = { ...attributes } + newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateTypographyGradientColor.migrate( 'tab%s' )( newAttributes ) + newAttributes = deprecateButtonGradientColor.migrate( 'tab%s' )( newAttributes ) + newAttributes = deprecateButtonGradientColor.migrate( 'activeTab%s' )( newAttributes ) newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) newAttributes = deprecateTypographyShadowColor.migrate( '%s' )( newAttributes ) @@ -54,6 +59,11 @@ const deprecated = [ newAttributes = deprecateTypographyGradientColor.migrate( 'tab%s' )( newAttributes ) newAttributes = deprecateButtonGradientColor.migrate( 'tab%s' )( newAttributes ) newAttributes = deprecateButtonGradientColor.migrate( 'activeTab%s' )( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + newAttributes = deprecateTypographyShadowColor.migrate( '%s' )( newAttributes ) + newAttributes = deprecateShadowColor.migrate( 'tab%s' )( newAttributes ) + newAttributes = deprecateShadowColor.migrate( 'activeTab%s' )( newAttributes ) return newAttributes }, diff --git a/src/block/table-of-contents/deprecated.js b/src/block/table-of-contents/deprecated.js index 7adc61dca..1aa3cccf6 100644 --- a/src/block/table-of-contents/deprecated.js +++ b/src/block/table-of-contents/deprecated.js @@ -49,6 +49,10 @@ const deprecated = [ migrate: attributes => { let newAttributes = { ...attributes } + newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateTypographyGradientColor.migrate( '%s' )( newAttributes ) + newAttributes = deprecateTypographyGradientColor.migrate( 'title%s' )( newAttributes ) newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) @@ -74,6 +78,8 @@ const deprecated = [ newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateTypographyGradientColor.migrate( '%s' )( newAttributes ) newAttributes = deprecateTypographyGradientColor.migrate( 'title%s' )( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) return newAttributes }, @@ -86,6 +92,8 @@ const deprecated = [ let newAttributes = deprecateContainerBackgroundColorOpacity.migrate( attributes ) newAttributes = deprecateTypographyGradientColor.migrate( '%s' )( newAttributes ) newAttributes = deprecateTypographyGradientColor.migrate( 'title%s' )( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) return deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) }, }, diff --git a/src/block/tabs/deprecated.js b/src/block/tabs/deprecated.js index de0ab8522..85ccf8730 100644 --- a/src/block/tabs/deprecated.js +++ b/src/block/tabs/deprecated.js @@ -21,10 +21,23 @@ const deprecated = [ migrate: attributes => { let newAttributes = { ...attributes } + const hasContainerOpacity = deprecateContainerBackgroundColorOpacity.isEligible( attributes ) + if ( hasContainerOpacity ) { + newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) + } + + const hasBlockOpacity = deprecateBlockBackgroundColorOpacity.isEligible( attributes ) + if ( hasBlockOpacity ) { + newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) + } + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) - return newAttributes + return { + ...newAttributes, + equalTabHeight: true, + } }, }, { @@ -43,6 +56,9 @@ const deprecated = [ newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) } + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + return { ...newAttributes, equalTabHeight: true, @@ -65,6 +81,8 @@ const deprecated = [ newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) return newAttributes }, diff --git a/src/block/team-member/deprecated.js b/src/block/team-member/deprecated.js index 44abebc7b..ef5c7d6b2 100644 --- a/src/block/team-member/deprecated.js +++ b/src/block/team-member/deprecated.js @@ -42,12 +42,63 @@ const deprecated = [ isEligible: attributes => { const hasBlockShadow = deprecateBlockShadowColor.isEligible( attributes ) const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes ) + const isNotV4 = attributes.version < 2 || typeof attributes.version === 'undefined' - return hasBlockShadow || hasContainerShadow + return hasBlockShadow || hasContainerShadow || isNotV4 }, - migrate: attributes => { - let newAttributes = { ...attributes } + migrate: ( attributes, innerBlocks ) => { + const isNotV4 = attributes.version < 2 || typeof attributes.version === 'undefined' + + let newAttributes = { + ...attributes, + } + if ( isNotV4 ) { + newAttributes = { + ...newAttributes, + version: 2, + } + + // Update the vertical align into flexbox + const hasOldVerticalAlign = !! attributes.containerVerticalAlign // Column only, this was changed to flexbox + + if ( hasOldVerticalAlign ) { + newAttributes = { + ...newAttributes, + containerVerticalAlign: '', + innerBlockAlign: attributes.containerVerticalAlign, + } + } + + // If the inner blocks are horizontal, adjust to accomodate the new + // column gap, it will modify blocks because people used block + // margins before instead of a proper column gap. + if ( attributes.innerBlockOrientation === 'horizontal' ) { + innerBlocks.forEach( ( block, index ) => { + if ( index ) { + if ( ! block.attributes.blockMargin ) { + block.attributes.blockMargin = { + top: '', + right: '', + bottom: '', + left: '', + } + } + if ( block.attributes.blockMargin.left === '' ) { + block.attributes.blockMargin.left = 24 + } + } + } ) + + newAttributes = { + ...newAttributes, + innerBlockColumnGap: 0, + } + } + } + + newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) @@ -118,6 +169,8 @@ const deprecated = [ newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) return newAttributes }, @@ -196,6 +249,8 @@ const deprecated = [ newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) return [ newAttributes, innerBlocks ] }, diff --git a/src/block/testimonial/deprecated.js b/src/block/testimonial/deprecated.js index c66975a6b..cc64e5fd2 100644 --- a/src/block/testimonial/deprecated.js +++ b/src/block/testimonial/deprecated.js @@ -42,12 +42,63 @@ const deprecated = [ isEligible: attributes => { const hasBlockShadow = deprecateBlockShadowColor.isEligible( attributes ) const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes ) + const isNotV4 = attributes.version < 2 || typeof attributes.version === 'undefined' - return hasBlockShadow || hasContainerShadow + return hasBlockShadow || hasContainerShadow || isNotV4 }, - migrate: attributes => { - let newAttributes = { ...attributes } + migrate: ( attributes, innerBlocks ) => { + const isNotV4 = attributes.version < 2 || typeof attributes.version === 'undefined' + + let newAttributes = { + ...attributes, + } + if ( isNotV4 ) { + newAttributes = { + ...newAttributes, + version: 2, + } + + // Update the vertical align into flexbox + const hasOldVerticalAlign = !! attributes.containerVerticalAlign // Column only, this was changed to flexbox + + if ( hasOldVerticalAlign ) { + newAttributes = { + ...newAttributes, + containerVerticalAlign: '', + innerBlockAlign: attributes.containerVerticalAlign, + } + } + + // If the inner blocks are horizontal, adjust to accomodate the new + // column gap, it will modify blocks because people used block + // margins before instead of a proper column gap. + if ( attributes.innerBlockOrientation === 'horizontal' ) { + innerBlocks.forEach( ( block, index ) => { + if ( index ) { + if ( ! block.attributes.blockMargin ) { + block.attributes.blockMargin = { + top: '', + right: '', + bottom: '', + left: '', + } + } + if ( block.attributes.blockMargin.left === '' ) { + block.attributes.blockMargin.left = 24 + } + } + } ) + + newAttributes = { + ...newAttributes, + innerBlockColumnGap: 0, + } + } + } + + newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) @@ -118,6 +169,8 @@ const deprecated = [ newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) return newAttributes }, @@ -196,6 +249,8 @@ const deprecated = [ newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) return [ newAttributes, innerBlocks ] }, diff --git a/src/block/text/deprecated.js b/src/block/text/deprecated.js index 3e145ed3b..57d902aa2 100644 --- a/src/block/text/deprecated.js +++ b/src/block/text/deprecated.js @@ -22,6 +22,9 @@ const deprecated = [ migrate: attributes => { let newAttributes = { ...attributes } + newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateTypographyGradientColor.migrate( '%s' )( newAttributes ) newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) newAttributes = deprecateTypographyShadowColor.migrate( '%s' )( newAttributes ) @@ -46,6 +49,9 @@ const deprecated = [ newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateTypographyGradientColor.migrate( '%s' )( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + newAttributes = deprecateTypographyShadowColor.migrate( '%s' )( newAttributes ) return newAttributes }, @@ -57,6 +63,9 @@ const deprecated = [ migrate: attributes => { let newAttributes = deprecateContainerBackgroundColorOpacity.migrate( attributes ) newAttributes = deprecateTypographyGradientColor.migrate( '%s' )( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + newAttributes = deprecateTypographyShadowColor.migrate( '%s' )( newAttributes ) return deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) }, }, diff --git a/src/block/timeline/deprecated.js b/src/block/timeline/deprecated.js index de196957d..8ef5054ff 100644 --- a/src/block/timeline/deprecated.js +++ b/src/block/timeline/deprecated.js @@ -22,6 +22,9 @@ const deprecated = [ migrate: attributes => { let newAttributes = { ...attributes } + newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateTypographyGradientColor.migrate( '%s' )( newAttributes ) newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) newAttributes = deprecateTypographyShadowColor.migrate( '%s' )( newAttributes ) @@ -46,6 +49,9 @@ const deprecated = [ newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateTypographyGradientColor.migrate( '%s' )( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) + newAttributes = deprecateTypographyShadowColor.migrate( '%s' )( newAttributes ) return newAttributes }, diff --git a/src/block/video-popup/deprecated.js b/src/block/video-popup/deprecated.js index 6024aad74..395ffb36b 100644 --- a/src/block/video-popup/deprecated.js +++ b/src/block/video-popup/deprecated.js @@ -21,6 +21,8 @@ const deprecated = [ migrate: attributes => { let newAttributes = { ...attributes } + newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) @@ -42,6 +44,8 @@ const deprecated = [ newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) return newAttributes }, @@ -51,7 +55,9 @@ const deprecated = [ attributes: attributes( '3.7.9' ), save: withVersion( '3.7.9' )( Save ), migrate: attributes => { - const newAttributes = deprecateContainerBackgroundColorOpacity.migrate( attributes ) + let newAttributes = deprecateContainerBackgroundColorOpacity.migrate( attributes ) + newAttributes = deprecateBlockShadowColor.migrate( newAttributes ) + newAttributes = deprecateContainerShadowColor.migrate( newAttributes ) return deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) }, }, diff --git a/src/dynamic-breakpoints.php b/src/dynamic-breakpoints.php index 839b0b4ba..1b4277d9b 100644 --- a/src/dynamic-breakpoints.php +++ b/src/dynamic-breakpoints.php @@ -15,7 +15,7 @@ function stackable_get_responsive_css() { // NOTE: THE VALUE BELOW IS AUTOMATICALLY GENERATED BY THE BUILD PROCESS. return <<.stk-inner-blocks.stk-block-tabs--vertical{grid-template-columns:auto 1fr auto}.stk-block-tabs>.stk-inner-blocks.stk-block-tabs--vertical>.stk-block-tab-labels:first-child{grid-column:1/2}.stk-block-tabs>.stk-inner-blocks.stk-block-tabs--vertical>.stk-block-tab-content:last-child{grid-column:2/4}.stk-block-tabs>.stk-inner-blocks.stk-block-tabs--vertical>.stk-block-tab-content:first-child{grid-column:1/3}.stk-block-tabs>.stk-inner-blocks.stk-block-tabs--vertical>.stk-block-tab-labels:last-child{grid-column:3/4}.stk-block .stk-block.aligncenter,.stk-block:is(.aligncenter,.alignwide,.alignfull)>.stk-content-align:not(.alignwide):not(.alignfull){margin-left:auto;margin-right:auto;max-width:var(--stk-block-default-width,var(--stk-block-width-default-detected,900px));width:100%}.stk-block .stk-block.alignwide,.stk-block:is(.aligncenter,.alignwide,.alignfull)>.stk-content-align.alignwide{margin-left:auto;margin-right:auto;max-width:var(--stk-block-wide-width,var(--stk-block-width-wide-detected,80vw));width:100%}.stk-row.stk-columns-2>.stk-column{flex:1 1 50%;max-width:50%}.stk-row.stk-columns-3>.stk-column{flex:1 1 33.3333333333%;max-width:33.3333333333%}.stk-row.stk-columns-4>.stk-column{flex:1 1 25%;max-width:25%}.stk-row.stk-columns-5>.stk-column{flex:1 1 20%;max-width:20%}.stk-row.stk-columns-6>.stk-column{flex:1 1 16.6666666667%;max-width:16.6666666667%}.stk-row.stk-columns-7>.stk-column{flex:1 1 14.2857142857%;max-width:14.2857142857%}.stk-row.stk-columns-8>.stk-column{flex:1 1 12.5%;max-width:12.5%}.stk-row.stk-columns-9>.stk-column{flex:1 1 11.1111111111%;max-width:11.1111111111%}.stk-row.stk-columns-10>.stk-column{flex:1 1 10%;max-width:10%}}@media only screen and (min-width:768px) and (max-width:1023px){:where(.has-text-align-left-tablet) .stk-block-divider{--stk-dots-margin-left:0;--stk-dots-margin-right:auto}:where(.has-text-align-right-tablet) .stk-block-divider{--stk-dots-margin-right:0;--stk-dots-margin-left:auto}:where(.has-text-align-center-tablet) .stk-block-divider{--stk-dots-margin-right:auto;--stk-dots-margin-left:auto}.stk--hide-tablet,.stk--hide-tablet.stk-block{display:none!important}.stk-button-group:is(.stk--collapse-on-tablet) .stk-block:is(.stk-block-button,.stk-block-icon-button){margin-inline-end:var(--stk-alignment-margin-right);margin-inline-start:var(--stk-alignment-margin-left)}}@media only screen and (max-width:1023px){.stk-block-button{min-width:-moz-fit-content;min-width:fit-content}.stk-block.stk-block-divider.has-text-align-center-tablet{--stk-dots-margin-right:auto;--stk-dots-margin-left:auto}.stk-block.stk-block-divider.has-text-align-right-tablet{--stk-dots-margin-right:0;--stk-dots-margin-left:auto}.stk-block.stk-block-divider.has-text-align-left-tablet{--stk-dots-margin-left:0;--stk-dots-margin-right:auto}.stk-block-timeline.stk-block-timeline__ios-polyfill{--fixed-bg:linear-gradient(to bottom,var(--line-accent-bg-color,#000) 0,var(--line-accent-bg-color-2,#000) var(--line-accent-bg-location,50%))}.has-text-align-center-tablet{--stk-alignment-padding-left:0;--stk-alignment-justify-content:center;--stk-alignment-text-align:center;--stk-alignment-margin-left:auto;--stk-alignment-margin-right:auto;text-align:var(--stk-alignment-text-align,start)}.has-text-align-left-tablet{--stk-alignment-justify-content:flex-start;--stk-alignment-text-align:start;--stk-alignment-margin-left:0;--stk-alignment-margin-right:auto;text-align:var(--stk-alignment-text-align,start)}.has-text-align-right-tablet{--stk-alignment-justify-content:flex-end;--stk-alignment-text-align:end;--stk-alignment-margin-left:auto;--stk-alignment-margin-right:0;text-align:var(--stk-alignment-text-align,start)}.has-text-align-justify-tablet{--stk-alignment-text-align:justify}.has-text-align-space-between-tablet{--stk-alignment-justify-content:space-between}.has-text-align-space-around-tablet{--stk-alignment-justify-content:space-around}.has-text-align-space-evenly-tablet{--stk-alignment-justify-content:space-evenly}}@media only screen and (max-width:767px){.stk-block-carousel.stk--hide-mobile-arrows>.stk-block-carousel__content-wrapper>*>.stk-block-carousel__buttons,.stk-block-carousel.stk--hide-mobile-dots>.stk-block-carousel__content-wrapper>.stk-block-carousel__dots{display:none}:where(.has-text-align-left-mobile) .stk-block-divider{--stk-dots-margin-left:0;--stk-dots-margin-right:auto}:where(.has-text-align-right-mobile) .stk-block-divider{--stk-dots-margin-right:0;--stk-dots-margin-left:auto}:where(.has-text-align-center-mobile) .stk-block-divider{--stk-dots-margin-right:auto;--stk-dots-margin-left:auto}.stk-block.stk-block-divider.has-text-align-center-mobile{--stk-dots-margin-right:auto;--stk-dots-margin-left:auto}.stk-block.stk-block-divider.has-text-align-right-mobile{--stk-dots-margin-right:0;--stk-dots-margin-left:auto}.stk-block.stk-block-divider.has-text-align-left-mobile{--stk-dots-margin-left:0;--stk-dots-margin-right:auto}.stk-block.stk-block-feature:is(.is-style-default,.is-style-horizontal)>.stk-container>.stk-inner-blocks.stk-block-content{flex-direction:column-reverse}.stk-block-posts{--stk-columns:1}.stk-block-tab-labels:not(.stk-block-tab-labels--wrap-mobile){overflow-x:auto!important;width:100%}.stk-block-tab-labels:not(.stk-block-tab-labels--wrap-mobile)::-webkit-scrollbar{height:0!important}.stk-block-tab-labels:not(.stk-block-tab-labels--wrap-mobile) .stk-block-tab-labels__wrapper{flex-wrap:nowrap;min-width:-webkit-fill-available;min-width:fill-available;width:max-content}.stk-block-tabs>.stk-inner-blocks{grid-template-columns:1fr}.stk-block-tabs>.stk-inner-blocks>.stk-block-tab-labels:last-child{grid-row:1/2}.stk-block.stk-block-timeline{--content-line:0!important;padding-top:0}.stk-block-timeline>.stk-inner-blocks{align-items:flex-start;grid-template-columns:var(--line-dot-size,16px) 1fr;grid-template-rows:auto 1fr;padding-left:16px}.stk-block-timeline>.stk-inner-blocks:after{inset-inline-start:calc(var(--line-dot-size, 16px)/2 - var(--line-bg-width, 3px)/2 + 16px)}.stk-block-timeline .stk-block-timeline__middle{inset-block-start:8px;inset-inline-start:16px;position:absolute}.stk-block-timeline .stk-block-timeline__content{grid-column:2/3;grid-row:2/3;text-align:start}.stk-block-timeline .stk-block-timeline__date{grid-column:2/3;grid-row:1/2;text-align:start}.stk-block-timeline>.stk-inner-blocks:after{bottom:calc(100% - var(--line-dot-size, 16px)/2 - .5em);top:calc(var(--line-dot-size, 16px)/2 + .5em)}.stk-block-timeline+.stk-block-timeline>.stk-inner-blocks:after{top:-16px}:root{--stk-block-margin-bottom:16px;--stk-container-padding:24px 24px;--stk-container-padding-large:32px 24px;--stk-container-padding-small:8px 24px;--stk-column-margin:8px;--stk-block-background-padding:16px 16px}.stk-block .stk-block:is(.aligncenter,.alignwide),.stk-block:is(.aligncenter,.alignwide,.alignfull)>.stk-content-align.alignwide,.stk-block:is(.aligncenter,.alignwide,.alignfull)>.stk-content-align:not(.alignwide):not(.alignfull){width:100%}.stk-column{flex:1 1 100%;max-width:100%}.stk--hide-mobile,.stk--hide-mobile.stk-block{display:none!important}.stk-button-group:is(.stk--collapse-on-mobile) .stk-block:is(.stk-block-button,.stk-block-icon-button),.stk-button-group:is(.stk--collapse-on-tablet) .stk-block:is(.stk-block-button,.stk-block-icon-button){margin-inline-end:var(--stk-alignment-margin-right);margin-inline-start:var(--stk-alignment-margin-left)}.has-text-align-center-mobile{--stk-alignment-padding-left:0;--stk-alignment-justify-content:center;--stk-alignment-text-align:center;--stk-alignment-margin-left:auto;--stk-alignment-margin-right:auto;text-align:var(--stk-alignment-text-align,start)}.has-text-align-left-mobile{--stk-alignment-justify-content:flex-start;--stk-alignment-text-align:start;--stk-alignment-margin-left:0;--stk-alignment-margin-right:auto;text-align:var(--stk-alignment-text-align,start)}.has-text-align-right-mobile{--stk-alignment-justify-content:flex-end;--stk-alignment-text-align:end;--stk-alignment-margin-left:auto;--stk-alignment-margin-right:0;text-align:var(--stk-alignment-text-align,start)}.has-text-align-justify-mobile{--stk-alignment-text-align:justify}.has-text-align-space-between-mobile{--stk-alignment-justify-content:space-between}.has-text-align-space-around-mobile{--stk-alignment-justify-content:space-around}.has-text-align-space-evenly-mobile{--stk-alignment-justify-content:space-evenly}.entry-content .stk-block.stk-has-top-separator{padding-top:23vw}.entry-content .stk-block.stk-has-bottom-separator{padding-bottom:23vw}.entry-content .stk-block .stk-separator__wrapper{height:23vw}}#end-resizable-editor-section{display:none} +#start-resizable-editor-section{display:none}@media only screen and (min-width:1024px){:where(.has-text-align-left) .stk-block-divider{--stk-dots-margin-left:0;--stk-dots-margin-right:auto}:where(.has-text-align-right) .stk-block-divider{--stk-dots-margin-right:0;--stk-dots-margin-left:auto}:where(.has-text-align-center) .stk-block-divider{--stk-dots-margin-right:auto;--stk-dots-margin-left:auto}.stk-block.stk-block-divider.has-text-align-center{--stk-dots-margin-right:auto;--stk-dots-margin-left:auto}.stk-block.stk-block-divider.has-text-align-right{--stk-dots-margin-right:0;--stk-dots-margin-left:auto}.stk-block.stk-block-divider.has-text-align-left{--stk-dots-margin-left:0;--stk-dots-margin-right:auto}.stk-row{flex-wrap:nowrap}.stk--hide-desktop,.stk--hide-desktop.stk-block{display:none!important}}@media only screen and (min-width:768px){:where(body:not(.wp-admin) .stk-block-column:first-child:nth-last-child(2)){flex:1 1 calc(50% - var(--stk-column-gap, 0px)*1/2)!important}:where(body:not(.wp-admin) .stk-block-column:nth-child(2):last-child){flex:1 1 calc(50% - var(--stk-column-gap, 0px)*1/2)!important}:where(body:not(.wp-admin) .stk-block-column:first-child:nth-last-child(3)){flex:1 1 calc(33.33333% - var(--stk-column-gap, 0px)*2/3)!important}:where(body:not(.wp-admin) .stk-block-column:nth-child(2):nth-last-child(2)){flex:1 1 calc(33.33333% - var(--stk-column-gap, 0px)*2/3)!important}:where(body:not(.wp-admin) .stk-block-column:nth-child(3):last-child){flex:1 1 calc(33.33333% - var(--stk-column-gap, 0px)*2/3)!important}:where(body:not(.wp-admin) .stk-block-column:first-child:nth-last-child(4)){flex:1 1 calc(25% - var(--stk-column-gap, 0px)*3/4)!important}:where(body:not(.wp-admin) .stk-block-column:nth-child(2):nth-last-child(3)){flex:1 1 calc(25% - var(--stk-column-gap, 0px)*3/4)!important}:where(body:not(.wp-admin) .stk-block-column:nth-child(3):nth-last-child(2)){flex:1 1 calc(25% - var(--stk-column-gap, 0px)*3/4)!important}:where(body:not(.wp-admin) .stk-block-column:nth-child(4):last-child){flex:1 1 calc(25% - var(--stk-column-gap, 0px)*3/4)!important}:where(body:not(.wp-admin) .stk-block-column:first-child:nth-last-child(5)){flex:1 1 calc(20% - var(--stk-column-gap, 0px)*4/5)!important}:where(body:not(.wp-admin) .stk-block-column:nth-child(2):nth-last-child(4)){flex:1 1 calc(20% - var(--stk-column-gap, 0px)*4/5)!important}:where(body:not(.wp-admin) .stk-block-column:nth-child(3):nth-last-child(3)){flex:1 1 calc(20% - var(--stk-column-gap, 0px)*4/5)!important}:where(body:not(.wp-admin) .stk-block-column:nth-child(4):nth-last-child(2)){flex:1 1 calc(20% - var(--stk-column-gap, 0px)*4/5)!important}:where(body:not(.wp-admin) .stk-block-column:nth-child(5):last-child){flex:1 1 calc(20% - var(--stk-column-gap, 0px)*4/5)!important}:where(body:not(.wp-admin) .stk-block-column:first-child:nth-last-child(6)){flex:1 1 calc(16.66667% - var(--stk-column-gap, 0px)*5/6)!important}:where(body:not(.wp-admin) .stk-block-column:nth-child(2):nth-last-child(5)){flex:1 1 calc(16.66667% - var(--stk-column-gap, 0px)*5/6)!important}:where(body:not(.wp-admin) .stk-block-column:nth-child(3):nth-last-child(4)){flex:1 1 calc(16.66667% - var(--stk-column-gap, 0px)*5/6)!important}:where(body:not(.wp-admin) .stk-block-column:nth-child(4):nth-last-child(3)){flex:1 1 calc(16.66667% - var(--stk-column-gap, 0px)*5/6)!important}:where(body:not(.wp-admin) .stk-block-column:nth-child(5):nth-last-child(2)){flex:1 1 calc(16.66667% - var(--stk-column-gap, 0px)*5/6)!important}:where(body:not(.wp-admin) .stk-block-column:nth-child(6):last-child){flex:1 1 calc(16.66667% - var(--stk-column-gap, 0px)*5/6)!important}.stk-block-tabs>.stk-inner-blocks.stk-block-tabs--vertical{grid-template-columns:auto 1fr auto}.stk-block-tabs>.stk-inner-blocks.stk-block-tabs--vertical>.stk-block-tab-labels:first-child{grid-column:1/2}.stk-block-tabs>.stk-inner-blocks.stk-block-tabs--vertical>.stk-block-tab-content:last-child{grid-column:2/4}.stk-block-tabs>.stk-inner-blocks.stk-block-tabs--vertical>.stk-block-tab-content:first-child{grid-column:1/3}.stk-block-tabs>.stk-inner-blocks.stk-block-tabs--vertical>.stk-block-tab-labels:last-child{grid-column:3/4}.stk-block .stk-block.aligncenter,.stk-block:is(.aligncenter,.alignwide,.alignfull)>.stk-content-align:not(.alignwide):not(.alignfull){margin-left:auto;margin-right:auto;max-width:var(--stk-block-default-width,var(--stk-block-width-default-detected,900px));width:100%}.stk-block .stk-block.alignwide,.stk-block:is(.aligncenter,.alignwide,.alignfull)>.stk-content-align.alignwide{margin-left:auto;margin-right:auto;max-width:var(--stk-block-wide-width,var(--stk-block-width-wide-detected,80vw));width:100%}.stk-row.stk-columns-2>.stk-column{flex:1 1 50%;max-width:50%}.stk-row.stk-columns-3>.stk-column{flex:1 1 33.3333333333%;max-width:33.3333333333%}.stk-row.stk-columns-4>.stk-column{flex:1 1 25%;max-width:25%}.stk-row.stk-columns-5>.stk-column{flex:1 1 20%;max-width:20%}.stk-row.stk-columns-6>.stk-column{flex:1 1 16.6666666667%;max-width:16.6666666667%}.stk-row.stk-columns-7>.stk-column{flex:1 1 14.2857142857%;max-width:14.2857142857%}.stk-row.stk-columns-8>.stk-column{flex:1 1 12.5%;max-width:12.5%}.stk-row.stk-columns-9>.stk-column{flex:1 1 11.1111111111%;max-width:11.1111111111%}.stk-row.stk-columns-10>.stk-column{flex:1 1 10%;max-width:10%}}@media only screen and (min-width:768px) and (max-width:1023px){:where(.has-text-align-left-tablet) .stk-block-divider{--stk-dots-margin-left:0;--stk-dots-margin-right:auto}:where(.has-text-align-right-tablet) .stk-block-divider{--stk-dots-margin-right:0;--stk-dots-margin-left:auto}:where(.has-text-align-center-tablet) .stk-block-divider{--stk-dots-margin-right:auto;--stk-dots-margin-left:auto}.stk--hide-tablet,.stk--hide-tablet.stk-block{display:none!important}.stk-button-group:is(.stk--collapse-on-tablet) .stk-block:is(.stk-block-button,.stk-block-icon-button){margin-inline-end:var(--stk-alignment-margin-right);margin-inline-start:var(--stk-alignment-margin-left)}}@media only screen and (max-width:1023px){.stk-block-button{min-width:-moz-fit-content;min-width:fit-content}.stk-block.stk-block-divider.has-text-align-center-tablet{--stk-dots-margin-right:auto;--stk-dots-margin-left:auto}.stk-block.stk-block-divider.has-text-align-right-tablet{--stk-dots-margin-right:0;--stk-dots-margin-left:auto}.stk-block.stk-block-divider.has-text-align-left-tablet{--stk-dots-margin-left:0;--stk-dots-margin-right:auto}.has-text-align-center-tablet{--stk-alignment-padding-left:0;--stk-alignment-justify-content:center;--stk-alignment-text-align:center;--stk-alignment-margin-left:auto;--stk-alignment-margin-right:auto;text-align:var(--stk-alignment-text-align,start)}.has-text-align-left-tablet{--stk-alignment-justify-content:flex-start;--stk-alignment-text-align:start;--stk-alignment-margin-left:0;--stk-alignment-margin-right:auto;text-align:var(--stk-alignment-text-align,start)}.has-text-align-right-tablet{--stk-alignment-justify-content:flex-end;--stk-alignment-text-align:end;--stk-alignment-margin-left:auto;--stk-alignment-margin-right:0;text-align:var(--stk-alignment-text-align,start)}.has-text-align-justify-tablet{--stk-alignment-text-align:justify}.has-text-align-space-between-tablet{--stk-alignment-justify-content:space-between}.has-text-align-space-around-tablet{--stk-alignment-justify-content:space-around}.has-text-align-space-evenly-tablet{--stk-alignment-justify-content:space-evenly}.stk-block-timeline.stk-block-timeline__ios-polyfill{--fixed-bg:linear-gradient(to bottom,var(--line-accent-bg-color,#000) 0,var(--line-accent-bg-color-2,#000) var(--line-accent-bg-location,50%))}}@media only screen and (max-width:767px){.entry-content .stk-block.stk-has-top-separator{padding-top:23vw}.entry-content .stk-block.stk-has-bottom-separator{padding-bottom:23vw}.entry-content .stk-block .stk-separator__wrapper{height:23vw}.stk-block-carousel.stk--hide-mobile-arrows>.stk-block-carousel__content-wrapper>*>.stk-block-carousel__buttons,.stk-block-carousel.stk--hide-mobile-dots>.stk-block-carousel__content-wrapper>.stk-block-carousel__dots{display:none}:where(.has-text-align-left-mobile) .stk-block-divider{--stk-dots-margin-left:0;--stk-dots-margin-right:auto}:where(.has-text-align-right-mobile) .stk-block-divider{--stk-dots-margin-right:0;--stk-dots-margin-left:auto}:where(.has-text-align-center-mobile) .stk-block-divider{--stk-dots-margin-right:auto;--stk-dots-margin-left:auto}.stk-block.stk-block-divider.has-text-align-center-mobile{--stk-dots-margin-right:auto;--stk-dots-margin-left:auto}.stk-block.stk-block-divider.has-text-align-right-mobile{--stk-dots-margin-right:0;--stk-dots-margin-left:auto}.stk-block.stk-block-divider.has-text-align-left-mobile{--stk-dots-margin-left:0;--stk-dots-margin-right:auto}.stk-block.stk-block-feature:is(.is-style-default,.is-style-horizontal)>.stk-container>.stk-inner-blocks.stk-block-content{flex-direction:column-reverse}.stk-block-posts{--stk-columns:1}.stk-block-tab-labels:not(.stk-block-tab-labels--wrap-mobile){overflow-x:auto!important;width:100%}.stk-block-tab-labels:not(.stk-block-tab-labels--wrap-mobile)::-webkit-scrollbar{height:0!important}.stk-block-tab-labels:not(.stk-block-tab-labels--wrap-mobile) .stk-block-tab-labels__wrapper{flex-wrap:nowrap;min-width:-webkit-fill-available;min-width:fill-available;width:max-content}.stk-block-tabs>.stk-inner-blocks{grid-template-columns:1fr}.stk-block-tabs>.stk-inner-blocks>.stk-block-tab-labels:last-child{grid-row:1/2}:root{--stk-block-margin-bottom:16px;--stk-container-padding:24px 24px;--stk-container-padding-large:32px 24px;--stk-container-padding-small:8px 24px;--stk-column-margin:8px;--stk-block-background-padding:16px 16px}.stk-block .stk-block:is(.aligncenter,.alignwide),.stk-block:is(.aligncenter,.alignwide,.alignfull)>.stk-content-align.alignwide,.stk-block:is(.aligncenter,.alignwide,.alignfull)>.stk-content-align:not(.alignwide):not(.alignfull){width:100%}.stk-column{flex:1 1 100%;max-width:100%}.stk--hide-mobile,.stk--hide-mobile.stk-block{display:none!important}.stk-button-group:is(.stk--collapse-on-mobile) .stk-block:is(.stk-block-button,.stk-block-icon-button),.stk-button-group:is(.stk--collapse-on-tablet) .stk-block:is(.stk-block-button,.stk-block-icon-button){margin-inline-end:var(--stk-alignment-margin-right);margin-inline-start:var(--stk-alignment-margin-left)}.has-text-align-center-mobile{--stk-alignment-padding-left:0;--stk-alignment-justify-content:center;--stk-alignment-text-align:center;--stk-alignment-margin-left:auto;--stk-alignment-margin-right:auto;text-align:var(--stk-alignment-text-align,start)}.has-text-align-left-mobile{--stk-alignment-justify-content:flex-start;--stk-alignment-text-align:start;--stk-alignment-margin-left:0;--stk-alignment-margin-right:auto;text-align:var(--stk-alignment-text-align,start)}.has-text-align-right-mobile{--stk-alignment-justify-content:flex-end;--stk-alignment-text-align:end;--stk-alignment-margin-left:auto;--stk-alignment-margin-right:0;text-align:var(--stk-alignment-text-align,start)}.has-text-align-justify-mobile{--stk-alignment-text-align:justify}.has-text-align-space-between-mobile{--stk-alignment-justify-content:space-between}.has-text-align-space-around-mobile{--stk-alignment-justify-content:space-around}.has-text-align-space-evenly-mobile{--stk-alignment-justify-content:space-evenly}.stk-block.stk-block-timeline{--content-line:0!important;padding-top:0}.stk-block-timeline>.stk-inner-blocks{align-items:flex-start;grid-template-columns:var(--line-dot-size,16px) 1fr;grid-template-rows:auto 1fr;padding-left:16px}.stk-block-timeline>.stk-inner-blocks:after{inset-inline-start:calc(var(--line-dot-size, 16px)/2 - var(--line-bg-width, 3px)/2 + 16px)}.stk-block-timeline .stk-block-timeline__middle{inset-block-start:8px;inset-inline-start:16px;position:absolute}.stk-block-timeline .stk-block-timeline__content{grid-column:2/3;grid-row:2/3;text-align:start}.stk-block-timeline .stk-block-timeline__date{grid-column:2/3;grid-row:1/2;text-align:start}.stk-block-timeline>.stk-inner-blocks:after{bottom:calc(100% - var(--line-dot-size, 16px)/2 - .5em);top:calc(var(--line-dot-size, 16px)/2 + .5em)}.stk-block-timeline+.stk-block-timeline>.stk-inner-blocks:after{top:-16px}}#end-resizable-editor-section{display:none} STK_RESPONSIVE_CSS; } }