Skip to content

Commit

Permalink
Merge branch 'master' into feature/table-block
Browse files Browse the repository at this point in the history
  • Loading branch information
oakesjosh committed Nov 25, 2024
2 parents 29237b1 + 2a4a72e commit 6326162
Show file tree
Hide file tree
Showing 63 changed files with 3,778 additions and 1,990 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy-on-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ jobs:
# For posting a rich message using Block Kit
payload: |
{
"text": "🚀 ${{ github.event.repository.name }} version ${{ github.event.release.tag_name }} has been released!\n\nView on GitHub: ${{ github.event.release.html_url }}"
"text": "<!subteam^S07ESK6U6EN|kadencewp-team> 🚀 ${{ github.event.repository.name }} version ${{ github.event.release.tag_name }} has been released!\n\nView on GitHub: ${{ github.event.release.html_url }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/eslint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ jobs:
- name: Check out Git repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v1
- name: Install Bun
uses: oven-sh/setup-bun@v1
with:
node-version: 18
bun-version: latest

# ESLint and Prettier must be in `package.json`
- name: Install Node.js dependencies
run: npm ci --ignore-scripts --legacy-peer-deps
- name: Install dependencies
run: bun install --frozen-lockfile

- name: Run linters
uses: wearerequired/lint-action@v2
Expand Down
2 changes: 2 additions & 0 deletions .puprc
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
{
"build": [
"rm -rf vendor",
"@composer install --no-dev --no-scripts",
"@composer run strauss-release",
"npm install --legacy-peer-deps",
"npm run build"
],
"build_dev": [
"rm -rf vendor",
"@composer install --no-dev --no-scripts",
"@composer run strauss-release",
"npm install --legacy-peer-deps",
Expand Down
4 changes: 4 additions & 0 deletions includes/advanced-form/advanced-form-cpt.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ function( string $column_name, int $post_id ) {
new Kadence_Blocks_Duplicate_Post( self::SLUG );
}
}

if( is_admin() && class_exists( 'Kadence_Blocks_Cpt_Import_Export' ) ) {
new Kadence_Blocks_Cpt_Import_Export( self::SLUG );
}
}
/**
* Filters the block area post type columns in the admin list table.
Expand Down
2 changes: 1 addition & 1 deletion includes/assets/js/kb-header-block.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion includes/assets/js/kt-accordion.min.js

Large diffs are not rendered by default.

12 changes: 8 additions & 4 deletions includes/blocks/class-kadence-blocks-advanced-heading-block.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,9 @@ public function build_css( $attributes, $css, $unique_id, $unique_style_id ) {
if( !empty( $attributes['textGradient'] ) && ! empty( $attributes['enableTextGradient'] ) ) {
$css->set_selector( '.wp-block-kadence-advancedheading.kt-adv-heading' . $unique_id . ', .wp-block-kadence-advancedheading.kt-adv-heading' . $unique_id . '[data-kb-block="kb-adv-heading' . $unique_id . '"] .kb-adv-text-inner' );
$css->add_property( 'background-image', $attributes['textGradient'] );
$css->add_property( '-webkit-box-decoration-break', 'clone' );
$css->add_property( 'background-clip', 'text' );
$css->add_property( '-webkit-box-decoration-break', 'clone' );
$css->add_property( 'box-decoration-break', 'clone' );
$css->add_property( '-webkit-background-clip', 'text' );
$css->add_property( '-webkit-text-fill-color', 'transparent' );
$css->set_selector( '.wp-block-kadence-advancedheading.kt-adv-heading' . $unique_id . ', .wp-block-kadence-advancedheading.kt-adv-heading' . $unique_id . '[data-kb-block="kb-adv-heading' . $unique_id . '"]' );
Expand Down Expand Up @@ -304,15 +305,17 @@ public function build_css( $attributes, $css, $unique_id, $unique_style_id ) {
$css->add_property( 'color', $css->render_color( $attributes['markColor'] ) );
} else if ( !empty( $attributes['markGradient'] ) && ! empty( $attributes['enableMarkGradient'] ) ) {
$css->add_property( 'background-image', $attributes['markGradient'] );
$css->add_property( '-webkit-box-decoration-break', 'clone' );
$css->add_property( '-webkit-background-clip', 'text' );
$css->add_property( 'background-clip', 'text' );
$css->add_property( '-webkit-text-fill-color', 'transparent' );
}
if ( ! empty($attributes['enableMarkBackgroundGradient']) && ! empty($attributes['markBackgroundGradient']) ) {
$css->add_property( 'background-image', $attributes['markBackgroundGradient'] );
}
if ( ! empty( $attributes['markTextTransform'] ) ) {
$css->add_property( 'text-transform', $attributes['markTextTransform'] );
}
if ( ! empty( $attributes['markBG'] ) && empty( $attributes['enableMarkGradient'] ) ) {
if ( ! empty( $attributes['markBG'] ) && empty( $attributes['enableMarkGradient'] ) && empty( $attributes['enableMarkBackgroundGradient'] ) ) {
$alpha = ( isset( $attributes['markBGOpacity'] ) && ! empty( $attributes['markBGOpacity'] ) ? $attributes['markBGOpacity'] : 1 );
$css->add_property( 'background', $css->render_color( $attributes['markBG'], $alpha ) );
}
Expand All @@ -328,7 +331,8 @@ public function build_css( $attributes, $css, $unique_id, $unique_style_id ) {
}
$css->render_border_styles( $attributes, 'markBorderStyles' );
$css->render_border_radius( $attributes, 'markBorderRadius', ( ! empty( $attributes['markBorderRadiusUnit'] ) ? $attributes['markBorderRadiusUnit'] : 'px' ) );

$css->add_property( '-webkit-box-decoration-break', 'clone' );
$css->add_property( 'box-decoration-break', 'clone' );
$css->set_media_state( 'tablet' );
$css->render_border_radius( $attributes, 'tabletMarkBorderRadius', ( ! empty( $attributes['markBorderRadiusUnit'] ) ? $attributes['markBorderRadiusUnit'] : 'px' ) );
$css->set_media_state( 'desktop' );
Expand Down
12 changes: 11 additions & 1 deletion includes/blocks/class-kadence-blocks-advancedgallery-block.php
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,17 @@ public function render_gallery_images( $image, $attributes ) {
$output .= '<div class="kadence-blocks-gallery-item-inner">';
$output .= '<figure class="' . esc_attr( implode( ' ', $fig_classes ) ). '" ' . ( ! empty( $padding_bottom ) && 'below' === $caption_style ? 'style="max-width:' . $image['width'] . 'px;"' : '' ) . '">';
if ( ! empty( $href ) ) {
$output .= '<a href="' . esc_url( $href ) . '"' . ( $link_to === 'media' && $lightbox === 'magnific' && $lightbox_cap && ! empty( $caption ) && is_string( $caption ) ? ' data-description="' . esc_attr( strip_tags( html_entity_decode($caption, ENT_QUOTES, 'UTF-8') ) ) . '"' : '' ) . '' . ( $link_to === 'media' && $lightbox === 'magnific' && ! empty( $image_alt ) && is_string( $image_alt ) ? ' data-alt="' . esc_attr( $image_alt ) . '"' : '' ) . ' class="kb-gallery-item-link" ' . ( ( $link_to === 'custom' && '_blank' === $link_target ) || ( $link_to === 'media' && $lightbox === 'new_tab' ) ? 'target="_blank"' : '' ) . ' ' . ( ( $link_to === 'custom' && ! empty( $rel_attr ) ) || ( $link_to === 'media' && ! empty( $rel_attr ) ) ? 'rel="' . esc_attr( $rel_attr ) . '"' : '' ) . '>';
$safe_caption = '';
if( $link_to === 'media' && $lightbox === 'magnific' && $lightbox_cap && ! empty( $caption ) && is_string( $caption ) ) {
$safe_caption = wp_kses(html_entity_decode($caption, ENT_QUOTES, 'UTF-8'), array(
'a' => array(
'href' => true,
'target' => array('_blank', '_self'),
'rel' => true,
)
));
}
$output .= '<a href="' . esc_url( $href ) . '"' . ( !empty( $safe_caption ) ? ' data-description="' . esc_attr( $safe_caption ) . '"' : '' ) . '' . ( $link_to === 'media' && $lightbox === 'magnific' && ! empty( $image_alt ) && is_string( $image_alt ) ? ' data-alt="' . esc_attr( $image_alt ) . '"' : '' ) . ' class="kb-gallery-item-link" ' . ( ( $link_to === 'custom' && '_blank' === $link_target ) || ( $link_to === 'media' && $lightbox === 'new_tab' ) ? 'target="_blank"' : '' ) . ' ' . ( ( $link_to === 'custom' && ! empty( $rel_attr ) ) || ( $link_to === 'media' && ! empty( $rel_attr ) ) ? 'rel="' . esc_attr( $rel_attr ) . '"' : '' ) . '>';
}
$output .= '<div class="kb-gal-image-radius"' . ( ! empty( $padding_bottom ) ? ' style="max-width:' . esc_attr( $image['width'] ) . 'px;"' : '' ) . '>';
$output .= $img;
Expand Down
6 changes: 6 additions & 0 deletions includes/blocks/class-kadence-blocks-column-block.php
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,12 @@ public function build_css( $attributes, $css, $unique_id, $unique_style_id ) {
}
break;
}
// Backdrop Filter (pro)
if ( ! empty( $attributes['backdropFilterType'] ) && $attributes['backdropFilterType'] !== 'none' ) {
$css->set_selector( '.kadence-column' . $unique_id . ' > .kt-inside-inner-col');
$css->add_property( '-webkit-backdrop-filter', $attributes['backdropFilterString'] );
$css->add_property( 'backdrop-filter', $attributes['backdropFilterString'] );
}
// Overlay.
$overlay_type = ! empty( $attributes['overlayType'] ) ? $attributes['overlayType'] : 'normal';
$css->set_selector( '.kadence-column' . $unique_id . ' > .kt-inside-inner-col:before' );
Expand Down
7 changes: 6 additions & 1 deletion includes/blocks/class-kadence-blocks-header-block.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,17 @@ public function build_css( $attributes, $css, $unique_id, $unique_style_id ) {
}
$css->set_media_state( 'desktop' );

// Normal state styles.
// Normal state styles.-cpt-id .kb-header-container
$css->set_selector( '.wp-block-kadence-header' . $unique_id . ' .kb-header-container' );
$css->render_measure_output( $header_attributes, 'margin', 'margin', [ 'unit_key' => 'marginUnit' ] );
$css->render_measure_output( $header_attributes, 'padding', 'padding', [ 'unit_key' => 'paddingUnit' ] );
$css->render_typography( $header_attributes );

if ( ! empty( $header_attributes['pro_backdropFilterString'] ) && class_exists( 'Kadence_Blocks_Pro' ) ) {
$css->add_property( 'backdrop-filter', $header_attributes['pro_backdropFilterString'] );
$css->add_property( '-webkit-backdrop-filter', $header_attributes['pro_backdropFilterString'] );
}

return $css->css_output();
}

Expand Down
2 changes: 1 addition & 1 deletion includes/blocks/class-kadence-blocks-infobox-block.php
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ public function build_css( $attributes, $css, $unique_id, $unique_style_id ) {
$css->add_property( 'margin-left', $media_style['margin'][3] . 'px' );
}
}
if ( isset( $media_style['borderRadius'] ) && ! empty( $media_style['borderRadius'] ) ) {
if ( isset( $media_style['borderRadius'] ) && ! empty( $media_style['borderRadius'] ) && isset( $media_style['padding'] ) && is_array( $media_style['padding'] ) && ! empty( array_filter( $media_style['padding'], fn($value) => $value > 0 ) ) ) {
$css->set_selector( $base_selector . ' .kt-blocks-info-box-media .kadence-info-box-image-intrisic img' );
$css->add_property( 'border-radius', $media_style['borderRadius'] . 'px' );
}
Expand Down
16 changes: 16 additions & 0 deletions includes/blocks/class-kadence-blocks-navigation-block.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,22 @@ public function sized_dynamic_styles( $css, $attributes, $unique_id, $size = 'De
$css->add_property( '--kb-nav-top-not-last-link-border-right', 'var(--kb-nav-link-border-right)' );
}

//link, description, and media alignment
if ($sized_attributes['linkHorizontalAlignment']) {
$css->add_property('--kb-nav-top-link-align', $sized_attributes['linkHorizontalAlignment']);
$link_flex_align = $sized_attributes['linkHorizontalAlignment'] == 'right' ? 'end' : ( $sized_attributes['linkHorizontalAlignment'] == 'center' ? 'center' : 'start' );
$css->add_property('--kb-nav-top-link-flex-justify', $link_flex_align);
$css->add_property('--kb-nav-top-link-media-container-align-self', $link_flex_align);
}

//dropdown link, description, and media alignment
if ($sized_attributes['dropdownLinkHorizontalAlignment']) {
$css->add_property('--kb-nav-dropdown-link-align', $sized_attributes['dropdownLinkHorizontalAlignment']);
$link_flex_align = $sized_attributes['dropdownLinkHorizontalAlignment'] == 'right' ? 'end' : ( $sized_attributes['dropdownLinkHorizontalAlignment'] == 'center' ? 'center' : 'start' );
$css->add_property('--kb-nav-dropdown-link-flex-justify', $link_flex_align);
$css->add_property('--kb-nav-dropdown-link-media-container-align-self', $link_flex_align);
}

if ( str_contains( $sized_attributes['style'], 'fullheight' ) ) {
$css->add_property( '--kb-nav-height', '100%' );
}
Expand Down
17 changes: 15 additions & 2 deletions includes/blocks/class-kadence-blocks-navigation-link-block.php
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,17 @@ public function sized_dynamic_styles( $css, $attributes, $unique_id, $size = 'De
$css->add_property( '--kb-nav-link-description-color-active', $css->render_color( $sized_attributes['descriptionColorActive'] ) );
$css->add_property( '--kb-nav-link-description-color-active-ancestor', $css->render_color( $sized_attributes['descriptionColorActive'] ) );
}
$css->add_property( '--kb-nav-link-align', ( isset( $sized_attributes['align'] ) && $sized_attributes['align'] ) ? $sized_attributes['align'] : 'left' );

//link, description, and media alignment
if ($sized_attributes['align']) {
$css->add_property( '--kb-nav-link-align', $sized_attributes['align'] );
$sized_flex_align = $sized_attributes['align'] == 'right' ? 'end' : ( $sized_attributes['align'] == 'center' ? 'center' : 'start' );
$css->add_property('--kb-nav-link-flex-justify', $sized_flex_align);
$css->add_property('--kb-nav-link-media-container-align-self', $sized_flex_align);
if ($sized_attributes['mediaAlign'] == 'top' || $sized_attributes['mediaAlign']) {
$css->add_property('--kb-nav-link-flex-align', $sized_flex_align);
}
}

//placement logic where an additional selector is needed
// Mega menu width styles.
Expand Down Expand Up @@ -708,7 +718,10 @@ public function get_child_info( $block_instance ) {
* @return boolean
*/
public function is_current( $attributes ) {
return ! empty( $attributes['id'] ) && get_queried_object_id() === (int) $attributes['id'] && ! empty( get_queried_object()->post_type );
global $wp;

$link_matches = untrailingslashit( $attributes['url'] ) ===untrailingslashit( home_url( $wp->request ) );
return ( ! empty( $attributes['id'] ) && get_queried_object_id() === (int) $attributes['id'] && ! empty( get_queried_object()->post_type ) ) || $link_matches;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion includes/blocks/class-kadence-blocks-posts-block.php
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ public function build_html( $attributes, $unique_id, $content, $block_instance )
* @param boolean $inline true or false based on when called.
*/
public function render_scripts( $attributes, $inline = false ) {
if ( ! class_exists( 'Kadence\Theme' ) || add_filter( 'kadence_blocks_post_block_style_force_output', '__return_false' ) ) {
if ( ! class_exists( 'Kadence\Theme' ) || apply_filters( 'kadence_blocks_post_block_style_force_output', false ) ) {
if ( ! wp_style_is( 'kadence-blocks-' . $this->block_name, 'enqueued' ) ) {
$this->enqueue_style( 'kadence-blocks-' . $this->block_name );
if ( $inline ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ private function get_percent( $attributes ) {

$prefix = isset( $attributes['numberPrefix'] ) ? $attributes['numberPrefix'] : '';
$suffix = isset( $attributes['numberSuffix'] ) ? $attributes['numberSuffix'] : '';
$starting = 0;
$starting = !empty( $attributes['progressMax'] ) && !empty( $attributes['showMaxProgressOnPageLoad'] ) ? $attributes['progressMax'] : 0;

$position = isset( $attributes['labelPosition'] ) ? $attributes['labelPosition'] : 'above';

Expand Down
4 changes: 3 additions & 1 deletion includes/blocks/form/class-kadence-blocks-submit-block.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,9 @@ public function build_css( $attributes, $css, $unique_id, $unique_style_id ) {
$css->add_property( 'background', $attributes['gradient'] . ' !important' );
}
$css->render_typography( $attributes, 'typography' );
$css->render_measure_output( $attributes, 'borderRadius', 'border-radius' );
$css->render_measure_output( $attributes, 'borderRadius', 'border-radius', array(
'unit_key'=>'borderRadiusUnit'
) );
$css->render_border_styles( $attributes, 'borderStyle', true );
$css->render_measure_output( $attributes, 'padding', 'padding', [ 'unit_key' => 'paddingUnit' ] );
$css->render_measure_output( $attributes, 'margin', 'margin', [ 'unit_key' => 'marginUnit' ] );
Expand Down
25 changes: 18 additions & 7 deletions includes/blocks/header/class-kadence-blocks-off-canvas-block.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,6 @@ public function build_css( $attributes, $css, $unique_id, $unique_style_id ) {

// container.
$css->set_selector( '.wp-block-kadence-off-canvas' . $unique_id . ' .kb-off-canvas-inner-wrap' );
if( !empty( $attributes['widthType'] ) && $attributes['widthType'] === 'full') {
$css->add_property( 'width', '100%' );
}
$css->render_border_styles( $attributes, 'border', false, array(
'desktop_key' => 'border',
'tablet_key' => 'borderTablet',
Expand Down Expand Up @@ -172,20 +169,25 @@ public function sized_dynamic_styles( $css, $attributes, $unique_id, $size = 'De

// Container.
$css->set_selector( '.wp-block-kadence-off-canvas' . $unique_id . ' .kb-off-canvas-inner-wrap' );
if ( empty( $attributes['widthType'] ) || $attributes['widthType'] !== 'full' ) {
if ( empty( $sized_attributes_inherit['widthType'] ) || $sized_attributes_inherit['widthType'] !== 'full' ) {
$max_width_unit = ! empty( $attributes['maxWidthUnit'] ) ? $attributes['maxWidthUnit'] : 'px';
if ( ! empty( $sized_attributes['maxWidth']) ) {
$css->add_property( 'max-width', $sized_attributes['maxWidth'] . $max_width_unit );
}
} else {
$css->add_property( 'max-width', 'initial' );
$css->add_property( 'width', '100%' );
}

if ( ! empty( $sized_attributes['backgroundColor'] ) ) {
$css->add_property( 'background-color', $css->render_color( $sized_attributes['backgroundColor'] ) );
}

// Inner container.
$css->set_selector( '.wp-block-kadence-off-canvas' . $unique_id . ' .kb-off-canvas-inner' );
$max_width_unit = ! empty( $sized_attributes['containerMaxWidthUnit'] ) ? $sized_attributes['containerMaxWidthUnit'] : 'px';

if ( ! empty( $sized_attributes['containerMaxWidth'] ) ) {
$max_width_unit = ! empty( $sized_attributes['containerMaxWidthUnit'] ) ? $sized_attributes['containerMaxWidthUnit'] : 'px';
$css->add_property( 'max-width', $sized_attributes['containerMaxWidth'] . $max_width_unit );
}

Expand Down Expand Up @@ -248,6 +250,7 @@ public function build_html( $attributes, $unique_id, $content, $block_instance )
$html = '';
$overlay = '';
$icon = '';
$css = Kadence_Blocks_CSS::get_instance();

if ( ! empty( $attributes['closeIcon'] ) ) {
$close_icon = $attributes['closeIcon'];
Expand All @@ -264,18 +267,26 @@ public function build_html( $attributes, $unique_id, $content, $block_instance )
$icon = '<button aria-label="' . esc_attr( $label ) . '" aria-expanded="false" class="kb-off-canvas-close">' . Kadence_Blocks_Svg_Render::render( $close_icon, $fill, $stroke_width, $title, $hidden ) . '</button>';
}

$open_side = ! empty( $attributes['slideFrom'] ) ? $attributes['slideFrom'] : 'left';
$open_side = $css->get_inherited_value( $attributes['slideFrom'], $attributes['slideFromTablet'], $attributes['slideFromMobile'], 'Desktop' );
$open_side_tablet = $css->get_inherited_value( $attributes['slideFrom'], $attributes['slideFromTablet'], $attributes['slideFromMobile'], 'Tablet' );
$open_side_mobile = $css->get_inherited_value( $attributes['slideFrom'], $attributes['slideFromTablet'], $attributes['slideFromMobile'], 'Mobile' );
$classes = array(
'wp-block-kadence-off-canvas',
'wp-block-kadence-off-canvas' . $unique_id,
'open-' . $open_side,
'open-tablet-' . $open_side_tablet,
'open-mobile-' . $open_side_mobile,
);

$overlay_classes = array(
'kb-off-canvas-overlay',
'kb-off-canvas-overlay' . $unique_id,
);
if ( empty( $attributes['widthType'] ) || $attributes['widthType'] === 'partial' ) {

$width_type = $css->get_inherited_value( $attributes['widthType'], $attributes['widthTypeTablet'], $attributes['widthTypeMobile'], 'Desktop' );
$width_type_tablet = $css->get_inherited_value( $attributes['widthType'], $attributes['widthTypeTablet'], $attributes['widthTypeMobile'], 'Tablet' );
$width_type_mobile = $css->get_inherited_value( $attributes['widthType'], $attributes['widthTypeTablet'], $attributes['widthTypeMobile'], 'Mobile' );
if ( ( ! $width_type || $width_type === 'partial' ) || ( ! $width_type_tablet || $width_type_tablet === 'partial' ) || ( ! $width_type_mobile || $width_type_mobile === 'partial' ) ) {
$overlay = '<div data-unique-id="' . esc_attr( $unique_id ) . '" class="' . esc_attr( implode( ' ', $overlay_classes ) ) . '"></div>';
}

Expand Down
Loading

0 comments on commit 6326162

Please sign in to comment.