Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "stackable",
"version": "3.18.1",
"version": "3.19.0",
"private": true,
"description": "Blocks for everyone",
"author": "Benjamin Intal of Gambit",
Expand Down
4 changes: 2 additions & 2 deletions plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Author: Gambit Technologies, Inc
* Author URI: http://gambit.ph
* Text Domain: stackable-ultimate-gutenberg-blocks
* Version: 3.18.1
* Version: 3.19.0
*
* @package Stackable
* @fs_premium_only /freemius.php, /freemius/
Expand Down Expand Up @@ -46,7 +46,7 @@ function stackable_multiple_plugins_check() {

defined( 'STACKABLE_SHOW_PRO_NOTICES' ) || define( 'STACKABLE_SHOW_PRO_NOTICES', true );
defined( 'STACKABLE_BUILD' ) || define( 'STACKABLE_BUILD', 'free' );
defined( 'STACKABLE_VERSION' ) || define( 'STACKABLE_VERSION', '3.18.1' );
defined( 'STACKABLE_VERSION' ) || define( 'STACKABLE_VERSION', '3.19.0' );
defined( 'STACKABLE_FILE' ) || define( 'STACKABLE_FILE', __FILE__ );
defined( 'STACKABLE_I18N' ) || define( 'STACKABLE_I18N', 'stackable-ultimate-gutenberg-blocks' ); // Plugin slug.
defined( 'STACKABLE_DESIGN_LIBRARY_URL' ) || define( 'STACKABLE_DESIGN_LIBRARY_URL', 'https://stackable-files.pages.dev' ); // Design Library CDN URL
Expand Down
10 changes: 10 additions & 0 deletions src/block/carousel/deprecated.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ import { Save } from './save'
import { attributes } from './schema'

import { withVersion } from '~stackable/higher-order'
import { addFilter } from '@wordpress/hooks'
import { semverCompare } from '~stackable/util'

addFilter( 'stackable.carousel.save.slider', 'stackable/3.19.0', version => {
if ( semverCompare( version, '<', '3.19.0' ) ) {
return {}
}

return { tabIndex: 0 }
} )

const deprecated = [
{
Expand Down
1 change: 1 addition & 0 deletions src/block/carousel/save.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export const Save = props => {
role="list"
data-autoplay={ attributes.autoplay ? ( attributes.autoplaySpeed || '4000' ) : undefined }
data-label-slide-of={ attributes.ariaLabelPrev || 'Slide %%d of %%d' }
{ ...applyFilters( 'stackable.carousel.save.slider', props.version ) }
>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Likely wrong attribute used for the “Slide %d of %d” label.

Using attributes.ariaLabelPrev here seems off; this should be a separate string (e.g., ariaLabelSlideOf). This affects SR announcements.

Apply this diff (adjust to the actual schema name if different):

-							data-label-slide-of={ attributes.ariaLabelPrev || 'Slide %%d of %%d' }
+							data-label-slide-of={ attributes.ariaLabelSlideOf || 'Slide %%d of %%d' }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
data-label-slide-of={ attributes.ariaLabelPrev || 'Slide %%d of %%d' }
{ ...applyFilters( 'stackable.carousel.save.slider', props.version ) }
>
data-label-slide-of={ attributes.ariaLabelSlideOf || 'Slide %%d of %%d' }
{ ...applyFilters( 'stackable.carousel.save.slider', props.version ) }
>
🤖 Prompt for AI Agents
In src/block/carousel/save.js around lines 83 to 85, the code uses
attributes.ariaLabelPrev for the "Slide %%d of %%d" data-label-slide-of which is
incorrect; replace references to ariaLabelPrev with a dedicated attribute (e.g.,
attributes.ariaLabelSlideOf), update the fallback default to 'Slide %%d of %%d',
and ensure the block schema/attributes object defines ariaLabelSlideOf (or the
actual schema name) so the save function reads the correct attribute; preserve
the applyFilters spread and keep the same filter hook.

<InnerBlocks.Content />
</div>
Expand Down
9 changes: 9 additions & 0 deletions src/block/horizontal-scroller/deprecated.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ import {
} from '~stackable/block-components'
import { addFilter } from '@wordpress/hooks'
import compareVersions from 'compare-versions'
import { semverCompare } from '~stackable/util'

addFilter( 'stackable.horizontal-scroller.save.scroller', 'stackable/3.19.0', version => {
if ( semverCompare( version, '<', '3.19.0' ) ) {
return {}
}

return { tabIndex: 0 }
} )
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Align filter signature with WP API and guard default to avoid spread errors.

Per applyFilters(value, ...args), the first param to the callback is the “value” object, not the version. Update to accept (attrs, version) and merge attrs. This pairs with a Save-side change to pass {} as the default value.

Apply this diff:

-addFilter( 'stackable.horizontal-scroller.save.scroller', 'stackable/3.19.0', version => {
-	if ( semverCompare( version, '<', '3.19.0' ) ) {
-		return {}
-	}
-
-	return { tabIndex: 0 }
-} )
+addFilter( 'stackable.horizontal-scroller.save.scroller', 'stackable/3.19.0', ( attrs, version ) => {
+	if ( semverCompare( version, '<', '3.19.0' ) ) {
+		return attrs
+	}
+	return { ...attrs, tabIndex: 0 }
+} )
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
addFilter( 'stackable.horizontal-scroller.save.scroller', 'stackable/3.19.0', version => {
if ( semverCompare( version, '<', '3.19.0' ) ) {
return {}
}
return { tabIndex: 0 }
} )
addFilter( 'stackable.horizontal-scroller.save.scroller', 'stackable/3.19.0', ( attrs, version ) => {
if ( semverCompare( version, '<', '3.19.0' ) ) {
return attrs
}
return { ...attrs, tabIndex: 0 }
} )
🤖 Prompt for AI Agents
In src/block/horizontal-scroller/deprecated.js around lines 13 to 19, the filter
callback currently treats the first arg as version which mismatches WP
applyFilters signature and can cause spread errors if attrs is undefined; change
the function signature to (attrs, version) and return a merged object (e.g.,
Object.assign({}, attrs || {}, { tabIndex: 0 }) or equivalent) so attrs are
preserved and guarded before spreading, while keeping the semverCompare check on
version to conditionally set tabIndex.


// Previously, our horizontal scroller always had the stk--fit-content class (which was wrong).
addFilter( 'stackable.horizontal-scroller.save.contentClassNames', 'stackable/3_8_0', ( classes, props ) => {
Expand Down
5 changes: 4 additions & 1 deletion src/block/horizontal-scroller/save.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ export const Save = props => {
>
{ attributes.generatedCss && <style>{ attributes.generatedCss }</style> }
<CustomCSS.Content attributes={ attributes } />
<div className={ contentClassNames }>
<div
className={ contentClassNames }
{ ...applyFilters( 'stackable.horizontal-scroller.save.scroller', props.version ) }
>
<InnerBlocks.Content />
</div>
</BlockDiv.Content>
Expand Down
14 changes: 14 additions & 0 deletions src/block/notification/deprecated.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,33 @@ import { attributes } from './schema'
/**
* External dependencies
*/
import { i18n } from 'stackable'
import { withVersion } from '~stackable/higher-order'
import compareVersions from 'compare-versions'
import {
deprecateBlockBackgroundColorOpacity, deprecateContainerBackgroundColorOpacity,
deprecateBlockShadowColor, deprecateContainerShadowColor, deprecateBlockHeight,
deprecateInnerBlockRowGapAndContainerHeight,
} from '~stackable/block-components'
import { semverCompare } from '~stackable/util'

/**
* WordPress dependencies
*/

import { __ } from '@wordpress/i18n'
import { addFilter } from '@wordpress/hooks'

addFilter( 'stackable.notification.save.close-button', 'stackable/3.19.0', version => {
if ( semverCompare( version, '<', '3.19.0' ) ) {
return {}
}

return {
'aria-label': __( 'Close', i18n ),
}
} )

// Version 3.8 added horizontal flex, this changes the stk--block-orientation-* to stk--block-horizontal-flex.
addFilter( 'stackable.notification.save.innerClassNames', 'stackable/3.8.0', ( output, props ) => {
if ( compareVersions( props.version, '3.8.0' ) >= 0 ) {
Expand Down
1 change: 1 addition & 0 deletions src/block/notification/save.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export const Save = props => {
{ attributes.isDismissible &&
<button
className="stk-block-notification__close-button"
{ ...applyFilters( 'stackable.notification.save.close-button', props.version ) }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check my suggestion for the progress circle, this prop would need to be added in by default, and then the deprecation filter would remove it. This is so that our save.js always contains our latest version, and the filters are there to modify it for older versions

>
<SVGCloseIcon
width={ attributes.dismissibleSize || 16 }
Expand Down
26 changes: 26 additions & 0 deletions src/block/posts/deprecated.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
import { createHigherOrderComponent } from '@wordpress/compose'
import { addFilter } from '@wordpress/hooks'
import { select } from '@wordpress/data'
import { semverCompare } from '~stackable/util'

// Version 3.0.2 Deprecations
const addUndefinedAttributes = ( attributes, version ) => {
Expand All @@ -36,10 +37,35 @@ const determineFeatureImage = ( featuredImage, version ) => {
return ( compareVersions( '3.6.3', version ) === -1 ) ? featuredImage : <Image.Content />
}

const fixMetaAccessibility = ( output, metaProps, version ) => {
const {
authorShow,
dateShow,
commentsShow,
author,
date,
comments,
separator,
metaClassNames,
} = metaProps
if ( semverCompare( version, '<', '3.19.0' ) ) {
return ( authorShow || dateShow || commentsShow ) && <aside className={ metaClassNames }>
{ authorShow && author }
{ authorShow && author && ( ( dateShow && date ) || ( commentsShow && comments ) ) && separator }
{ dateShow && date }
{ ( ( authorShow && author ) || ( dateShow && date ) ) && commentsShow && comments && separator }
{ commentsShow && comments }
</aside>
}

return output
}

addFilter( 'stackable.posts.title.typography-content', 'stackable/3_0_2', addUndefinedAttributes )
addFilter( 'stackable.posts.title.category-content', 'stackable/3_0_2', addUndefinedAttributes )
addFilter( 'stackable.posts.title.readmore-content', 'stackable/3_0_2', addUndefinedAttributes )
addFilter( 'stackable.posts.feature-image', 'stackable/3_6_3', determineFeatureImage )
addFilter( 'stackable.posts.meta', 'stackable/3.19.0', fixMetaAccessibility )

const deprecated = [
{
Expand Down
20 changes: 15 additions & 5 deletions src/block/posts/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,13 +225,13 @@ export const generateRenderPostItem = ( attributes, { isHovered } ) => {
)

const meta = ( authorShow || dateShow || commentsShow ) && (
<aside className={ metaClassNames }>
<div className={ metaClassNames }>
{ authorShow && author }
{ authorShow && author && ( ( dateShow && date ) || ( commentsShow && comments ) ) && separator }
{ dateShow && date }
{ ( ( authorShow && author ) || ( dateShow && date ) ) && commentsShow && comments && separator }
{ commentsShow && comments }
</aside>
</div>
)

const contentFactory = {
Expand Down Expand Up @@ -382,15 +382,25 @@ generateRenderPostItem.save = ( attributes, version = VERSION ) => {
/>
)

const meta = ( authorShow || dateShow || commentsShow ) && (
<aside className={ metaClassNames }>
let meta = ( authorShow || dateShow || commentsShow ) && (
<div className={ metaClassNames }>
{ authorShow && author }
{ authorShow && author && ( ( dateShow && date ) || ( commentsShow && comments ) ) && separator }
{ dateShow && date }
{ ( ( authorShow && author ) || ( dateShow && date ) ) && commentsShow && comments && separator }
{ commentsShow && comments }
</aside>
</div>
)
meta = applyFilters( 'stackable.posts.meta', meta, {
authorShow,
dateShow,
commentsShow,
author,
date,
comments,
separator,
metaClassNames,
}, version )

const contentFactory = {
'featured-image': imageShow && featuredImage,
Expand Down
17 changes: 17 additions & 0 deletions src/block/progress-bar/deprecated.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,23 @@ import {
deprecateTypographyShadowColor, deprecateBlockShadowColor, deprecateContainerShadowColor, deprecateTypographyFontSize,
deprecateBlockHeight,
} from '~stackable/block-components'
import { semverCompare } from '~stackable/util'

import striptags from 'striptags'

import { addFilter } from '@wordpress/hooks'

const addAriaLabel = ( derivedAriaValue, version ) => {
if ( semverCompare( version, '<', '3.19.0' ) ) {
return {}
}

return {
'aria-label': derivedAriaValue ? striptags( derivedAriaValue ) : undefined,
}
}

addFilter( 'stackable.progress-bar.accessibility', 'stackable/3.19.0', addAriaLabel )

const deprecated = [
{
Expand Down
2 changes: 2 additions & 0 deletions src/block/progress-bar/save.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import classnames from 'classnames'
import striptags from 'striptags'

import { compose } from '@wordpress/compose'
import { applyFilters } from '@wordpress/hooks'

export const Save = props => {
const { className, attributes } = props
Expand Down Expand Up @@ -75,6 +76,7 @@ export const Save = props => {
aria-valuemax="100"
aria-valuenow={ progressValue }
aria-valuetext={ derivedAriaValue ? striptags( derivedAriaValue ) : undefined }
{ ...applyFilters( 'stackable.progress-bar.accessibility', derivedAriaValue, props.version ) }
>
<div className={ barClassNames }>
{ attributes.showText && (
Expand Down
17 changes: 17 additions & 0 deletions src/block/progress-circle/deprecated.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,23 @@ import {
deprecateTypographyShadowColor, deprecateBlockShadowColor, deprecateContainerShadowColor, deprecateTypographyFontSize,
deprecateBlockHeight,
} from '~stackable/block-components'
import { semverCompare } from '~stackable/util'

import striptags from 'striptags'

import { addFilter } from '@wordpress/hooks'

const addAriaLabel = ( derivedAriaValue, version ) => {
if ( semverCompare( version, '<', '3.19.0' ) ) {
return {}
}

return {
'aria-label': derivedAriaValue ? striptags( derivedAriaValue ) : undefined,
}
}

addFilter( 'stackable.progress-circle.accessibility', 'stackable/3.19.0', addAriaLabel )

const deprecated = [
{
Expand Down
2 changes: 2 additions & 0 deletions src/block/progress-circle/save.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import classnames from 'classnames'
import striptags from 'striptags'

import { compose } from '@wordpress/compose'
import { applyFilters } from '@wordpress/hooks'

export const Save = props => {
const { className, attributes } = props
Expand Down Expand Up @@ -71,6 +72,7 @@ export const Save = props => {
aria-valuemax="100"
aria-valuenow={ progressValue }
aria-valuetext={ attributes.progressAriaValueText ? striptags( attributes.progressAriaValueText ) : undefined }
{ ...applyFilters( 'stackable.progress-circle.accessibility', attributes.progressAriaValueText, props.version ) }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of the filter adding the aria-label, the aria-label should be added normally, and then the filter would remove it for deprecation. this would also need to be done in the save portion

Suggested change
{ ...applyFilters( 'stackable.progress-circle.accessibility', attributes.progressAriaValueText, props.version ) }
aria-label={ attributes.progressAriaValueText ? striptags( attributes.progressAriaValueText ) : undefined }
{ ...applyFilters( 'stackable.progress-circle.div-props', {}, props.version ) }

Then in the deprecation

const addAriaLabel = ( props, version ) => {
	// If from an old version, remove the aria-label
	if ( oldVersion ) {
		return { 
			...props,
			'aria-label': undefined,
		}
	}
	return props
}
addFilter( 'stackable.progress-circle.div-props', 'stackable/3.19.0', props, removeAriaLabel )

>
<svg>
{ attributes.progressColorType === 'gradient' && (
Expand Down
Loading