| 1 |
import { select } from "@wordpress/data"; |
| 2 |
import { backgroundStyle, gradientHoverStyle } from "../../controls/controls"; |
| 3 |
import { boxCss, colorControls, objectToCssString, rangerCss, spacingGenerate, wrapInMediaQuery } from "../shared/helpFn"; |
| 4 |
|
| 5 |
const cacheCss = { desktop: "", mobile: "", tablet: "" }; |
| 6 |
|
| 7 |
const dynamicCss = (attributes, page = "frontend", currentDevice = "all") => { |
| 8 |
const { |
| 9 |
uniqueId, |
| 10 |
containerPadding, |
| 11 |
containerMargin, |
| 12 |
containerWidth, |
| 13 |
containerCustomWidth, |
| 14 |
contentWidth, |
| 15 |
contentHeightType, |
| 16 |
containerMinHeight, |
| 17 |
columnsGap, |
| 18 |
rowGap, |
| 19 |
equalHeight, |
| 20 |
containerOverflow, |
| 21 |
containerBG, |
| 22 |
containerBGImage, |
| 23 |
containerOverlayBg, |
| 24 |
containerOverlayType, |
| 25 |
containerOverlayOpacity, |
| 26 |
containerOverlayBlandMode, |
| 27 |
containerBorder, |
| 28 |
containerBorderWidth, |
| 29 |
containerBorderRadius, |
| 30 |
containerBoxShadowEnable, |
| 31 |
containerBoxShadow, |
| 32 |
containerFlexDirection, |
| 33 |
containerJustifyContent, |
| 34 |
containerFlexWrap, |
| 35 |
containerAlignItem, |
| 36 |
shapeDividerWidthTop, |
| 37 |
shapeDividerHeightTop, |
| 38 |
shapeDividerWidthBottom, |
| 39 |
shapeDividerHeightBottom, |
| 40 |
shapeDividerBgColorTop, |
| 41 |
shapeDividerBringToFrontTop, |
| 42 |
shapeDividerBringToFrontBottom, |
| 43 |
advanceZIndex, |
| 44 |
advanceVisibilityHideDesktop, |
| 45 |
advanceVisibilityHideTablet, |
| 46 |
advanceVisibilityHideMobile, |
| 47 |
containerBGImageHover, |
| 48 |
shapeDividerBgColorBottom, |
| 49 |
containerBoxShadowEnableHover, |
| 50 |
containerBoxShadowHover, |
| 51 |
containerOverlayTypeHover, |
| 52 |
containerOverlayOpacityHover, |
| 53 |
containerOverlayBlandModeHover, |
| 54 |
containerBorderWidthHover, |
| 55 |
containerBorderRadiusHover, |
| 56 |
columns, |
| 57 |
columnsTablet, |
| 58 |
columnsMobile, |
| 59 |
// globalBreakPointData |
| 60 |
} = attributes; |
| 61 |
const globalBreakPointData = sp_smart_post_block_localize?.breakPoint; |
| 62 |
|
| 63 |
// const globalBreakPointData = select("smartpost/global-settings").getCategory("breakpoint"); |
| 64 |
|
| 65 |
const containerHeightObj = { |
| 66 |
default: "fit-content", |
| 67 |
"fit-to-screen": "100vh", |
| 68 |
}; |
| 69 |
|
| 70 |
const imageNormalOverlay = (deviceType) => { |
| 71 |
return ["image", "video"].includes(containerBG.color.style) |
| 72 |
? [ |
| 73 |
{ |
| 74 |
class: `.${uniqueId}::before`, |
| 75 |
styles: { |
| 76 |
...backgroundStyle(containerOverlayBg, "", false, "no-overlay" !== containerOverlayType), |
| 77 |
"mix-blend-mode": containerOverlayBlandMode, |
| 78 |
opacity: |
| 79 |
"no-overlay" !== containerOverlayType |
| 80 |
? containerOverlayOpacity?.device?.[deviceType] + |
| 81 |
containerOverlayOpacity?.unit?.[deviceType] |
| 82 |
: "0", |
| 83 |
transition: "all 0.3s ease-in-out", |
| 84 |
}, |
| 85 |
}, |
| 86 |
{ |
| 87 |
class: `.${uniqueId}:hover::before`, |
| 88 |
styles: { |
| 89 |
opacity: 0 |
| 90 |
}, |
| 91 |
}, |
| 92 |
] |
| 93 |
: []; |
| 94 |
}; |
| 95 |
const imageHoverOverlay = (deviceType) => { |
| 96 |
return ["image"].includes(containerBG.hover.style) |
| 97 |
? [ |
| 98 |
{ |
| 99 |
class: `.${uniqueId}:hover::after`, |
| 100 |
styles: { |
| 101 |
...backgroundStyle( |
| 102 |
containerOverlayBg, |
| 103 |
"", |
| 104 |
true, |
| 105 |
"no-overlay" !== containerOverlayTypeHover |
| 106 |
), |
| 107 |
"mix-blend-mode": containerOverlayBlandModeHover, |
| 108 |
}, |
| 109 |
}, |
| 110 |
{ |
| 111 |
class: `.${uniqueId}:hover::after`, |
| 112 |
styles: { |
| 113 |
opacity: |
| 114 |
"no-overlay" !== containerOverlayTypeHover |
| 115 |
? containerOverlayOpacityHover?.device?.[deviceType] + |
| 116 |
containerOverlayOpacityHover?.unit?.[deviceType] |
| 117 |
: "0", |
| 118 |
transition: "all 0.3s ease-in-out", |
| 119 |
}, |
| 120 |
}, |
| 121 |
] |
| 122 |
: [ |
| 123 |
{ |
| 124 |
class: `.${uniqueId}:hover::after`, |
| 125 |
styles: { |
| 126 |
background: "transparent", |
| 127 |
}, |
| 128 |
}, |
| 129 |
]; |
| 130 |
}; |
| 131 |
const imageOverlayStyles = (deviceType) => { |
| 132 |
return [...imageNormalOverlay(deviceType), ...imageHoverOverlay(deviceType)]; |
| 133 |
}; |
| 134 |
|
| 135 |
const responsiveCss = (deviceType) => { |
| 136 |
const responsiveData = [ |
| 137 |
{ |
| 138 |
class: `.${uniqueId}-boxed`, |
| 139 |
styles: { |
| 140 |
margin: spacingGenerate(containerMargin, deviceType), |
| 141 |
}, |
| 142 |
}, |
| 143 |
{ |
| 144 |
class: `.${uniqueId}`, |
| 145 |
styles: { |
| 146 |
padding: spacingGenerate(containerPadding, deviceType), |
| 147 |
width: |
| 148 |
containerWidth === "boxed" |
| 149 |
? (containerCustomWidth?.device?.[deviceType] || 1200) + |
| 150 |
containerCustomWidth?.unit?.[deviceType] |
| 151 |
: "", |
| 152 |
"border-width": spacingGenerate(containerBorderWidth, deviceType), |
| 153 |
"border-radius": spacingGenerate(containerBorderRadius, deviceType), |
| 154 |
"box-shadow": boxCss(containerBoxShadowEnable, deviceType, containerBoxShadow, "color"), |
| 155 |
"box-sizing": "border-box", |
| 156 |
margin: "auto", |
| 157 |
"max-width": "100% !important", |
| 158 |
}, |
| 159 |
}, |
| 160 |
{ |
| 161 |
class: `.${uniqueId}:hover`, |
| 162 |
styles: { |
| 163 |
"box-shadow": boxCss(containerBoxShadowEnableHover, deviceType, containerBoxShadowHover, "color"), |
| 164 |
"border-width": spacingGenerate(containerBorderWidthHover, deviceType), |
| 165 |
"border-radius": spacingGenerate(containerBorderRadiusHover, deviceType), |
| 166 |
}, |
| 167 |
}, |
| 168 |
{ |
| 169 |
class: `.${uniqueId} .sp-smart-post-container-parent-block`, |
| 170 |
styles: { |
| 171 |
"max-width": contentWidth.device?.[deviceType] ? rangerCss(contentWidth, [deviceType]) : `${parseInt(globalBreakPointData?.container) || 1200 }px`, |
| 172 |
}, |
| 173 |
}, |
| 174 |
|
| 175 |
{ |
| 176 |
class: `.${uniqueId} .sp-smart-post-container-shape.sp-smart-post-container-shape-top`, |
| 177 |
styles: { |
| 178 |
width: shapeDividerWidthTop.device?.[deviceType] + shapeDividerWidthTop.unit?.[deviceType], |
| 179 |
height: shapeDividerHeightTop.device?.[deviceType] + shapeDividerHeightTop.unit?.[deviceType], |
| 180 |
}, |
| 181 |
}, |
| 182 |
{ |
| 183 |
class: `.${uniqueId} .sp-smart-post-container-shape.sp-smart-post-container-shape-bottom`, |
| 184 |
styles: { |
| 185 |
width: shapeDividerWidthBottom.device?.[deviceType] + shapeDividerWidthBottom.unit?.[deviceType], |
| 186 |
height: shapeDividerHeightBottom.device?.[deviceType] + shapeDividerHeightBottom.unit?.[deviceType], |
| 187 |
}, |
| 188 |
}, |
| 189 |
{ |
| 190 |
class: `.${uniqueId} .sp-smart-post-container-column`, |
| 191 |
styles: { |
| 192 |
"flex-basis": (columns > 4 && ["row", "row-reverse"].includes(containerFlexDirection.device[deviceType])) ? `calc(${100 / columns}% - ${rangerCss(columnsGap, [deviceType])})` : "", |
| 193 |
}, |
| 194 |
}, |
| 195 |
]; |
| 196 |
if ( page === "editor" ) { |
| 197 |
responsiveData.push( ...[ |
| 198 |
{ |
| 199 |
class: `.${uniqueId} .sp-smart-post-container-parent-block > .block-editor-inner-blocks > .block-editor-block-list__layout`, |
| 200 |
styles: { |
| 201 |
"column-gap": columnsGap.device?.[deviceType] + columnsGap.unit?.[deviceType], |
| 202 |
"row-gap": rowGap.device?.[deviceType] + rowGap.unit?.[deviceType], |
| 203 |
"min-height": |
| 204 |
containerHeightObj[contentHeightType] || |
| 205 |
containerMinHeight?.device?.[deviceType] + containerMinHeight?.unit?.[deviceType] || |
| 206 |
"auto", |
| 207 |
}, |
| 208 |
}, |
| 209 |
{ |
| 210 |
class: `.${uniqueId} .sp-smart-post-container-parent-block > .block-editor-inner-blocks > .block-editor-block-list__layout`, |
| 211 |
styles: { |
| 212 |
display: "flex", |
| 213 |
"flex-wrap": containerFlexWrap.device?.[deviceType], |
| 214 |
"flex-direction": containerFlexDirection.device?.[deviceType], |
| 215 |
"align-items": containerAlignItem.device?.[deviceType], |
| 216 |
"justify-content": containerJustifyContent.device?.[deviceType], |
| 217 |
}, |
| 218 |
}, |
| 219 |
{ |
| 220 |
class: `.${uniqueId} .sp-resizable-box .components-resizable-box__container .components-resizable-box__handle-right`, |
| 221 |
styles: { |
| 222 |
right: `calc(-11.5px - ${columnsGap?.device?.[ deviceType ] / 2}px)`, |
| 223 |
}, |
| 224 |
}, |
| 225 |
] ); |
| 226 |
} |
| 227 |
if ( page === "frontend" ) { |
| 228 |
responsiveData.push( ...[ |
| 229 |
{ |
| 230 |
class: `.${uniqueId}.sp-smart-post-show-container-front-page .sp-smart-post-container-parent-block`, |
| 231 |
styles: { |
| 232 |
"column-gap": columnsGap.device?.[deviceType] + columnsGap.unit?.[deviceType], |
| 233 |
"row-gap": rowGap.device?.[deviceType] + rowGap.unit?.[deviceType], |
| 234 |
"min-height": |
| 235 |
containerHeightObj[contentHeightType] || |
| 236 |
containerMinHeight?.device?.[deviceType] + containerMinHeight?.unit?.[deviceType] || |
| 237 |
"auto", |
| 238 |
}, |
| 239 |
}, |
| 240 |
{ |
| 241 |
class: `.${uniqueId}.sp-smart-post-show-container-front-page .sp-smart-post-container-parent-block`, |
| 242 |
styles: { |
| 243 |
display: "flex", |
| 244 |
"flex-wrap": containerFlexWrap.device?.[deviceType], |
| 245 |
"flex-direction": containerFlexDirection.device?.[deviceType], |
| 246 |
"align-items": containerAlignItem.device?.[deviceType], |
| 247 |
"justify-content": containerJustifyContent.device?.[deviceType], |
| 248 |
}, |
| 249 |
}, |
| 250 |
]); |
| 251 |
} |
| 252 |
if ( page === "frontend" && ["row", "row-reverse"].includes( containerFlexDirection.device?.[deviceType] ) ) { |
| 253 |
responsiveData.push( ...[ |
| 254 |
// Two column layouts |
| 255 |
{ |
| 256 |
class: `.${uniqueId}.sp-smart-post-show-container-front-page > .sp-smart-post-container-column-2 > .sp-smart-post-container-column:nth-of-type( odd )`, |
| 257 |
styles: { |
| 258 |
width: "calc( var( --columnOne, 50% ) - ( var( --gap, 16px ) / 2) )", |
| 259 |
}, |
| 260 |
}, |
| 261 |
{ |
| 262 |
class: `.${uniqueId}.sp-smart-post-show-container-front-page > .sp-smart-post-container-column-2 > .sp-smart-post-container-column:nth-of-type( even )`, |
| 263 |
styles: { |
| 264 |
width: "calc( var( --columnTwo, 50% ) - ( var( --gap, 16px ) / 2) )", |
| 265 |
}, |
| 266 |
}, |
| 267 |
// Three columns layouts |
| 268 |
{ |
| 269 |
class: `.${uniqueId}.sp-smart-post-show-container-front-page > .sp-smart-post-container-column-3 > .sp-smart-post-container-column:nth-of-type( 3n + 1 )`, |
| 270 |
styles: { |
| 271 |
width: "calc( var( --columnOne, 33.33% ) - ( var( --gap, 16px ) / 3) )", |
| 272 |
}, |
| 273 |
}, |
| 274 |
{ |
| 275 |
class: `.${uniqueId}.sp-smart-post-show-container-front-page > .sp-smart-post-container-column-3 > .sp-smart-post-container-column:nth-of-type( 3n + 2 )`, |
| 276 |
styles: { |
| 277 |
width: "calc( var( --columnTwo, 33.33% ) - ( var( --gap, 16px ) / 3) )", |
| 278 |
}, |
| 279 |
}, |
| 280 |
{ |
| 281 |
class: `.${uniqueId}.sp-smart-post-show-container-front-page > .sp-smart-post-container-column-3 > .sp-smart-post-container-column:nth-of-type( 3n + 3 )`, |
| 282 |
styles: { |
| 283 |
width: "calc( var( --columnThree, 33.33% ) - ( var( --gap, 16px ) / 3) )", |
| 284 |
}, |
| 285 |
}, |
| 286 |
// Four columns layouts |
| 287 |
{ |
| 288 |
class: `.${uniqueId}.sp-smart-post-show-container-front-page > .sp-smart-post-container-column-4 > .sp-smart-post-container-column:nth-of-type( 4n + 1 )`, |
| 289 |
styles: { |
| 290 |
width: "calc( var( --columnOne, 25% ) - ( var( --gap, 16px ) / 4) )", |
| 291 |
}, |
| 292 |
}, |
| 293 |
{ |
| 294 |
class: `.${uniqueId}.sp-smart-post-show-container-front-page > .sp-smart-post-container-column-4 > .sp-smart-post-container-column:nth-of-type( 4n + 2 )`, |
| 295 |
styles: { |
| 296 |
width: "calc( var( --columnTwo, 25% ) - ( var( --gap, 16px ) / 4) )", |
| 297 |
}, |
| 298 |
}, |
| 299 |
{ |
| 300 |
class: `.${uniqueId}.sp-smart-post-show-container-front-page > .sp-smart-post-container-column-4 > .sp-smart-post-container-column:nth-of-type( 4n + 3 )`, |
| 301 |
styles: { |
| 302 |
width: "calc( var( --columnThree, 25% ) - ( var( --gap, 16px ) / 4) )", |
| 303 |
}, |
| 304 |
}, |
| 305 |
{ |
| 306 |
class: `.${uniqueId}.sp-smart-post-show-container-front-page > .sp-smart-post-container-column-4 > .sp-smart-post-container-column:nth-of-type( 4n + 4 )`, |
| 307 |
styles: { |
| 308 |
width: "calc( var( --columnFour, 25% ) - ( var( --gap, 16px ) / 4) )", |
| 309 |
}, |
| 310 |
}, |
| 311 |
// Multi-row layout one. |
| 312 |
{ |
| 313 |
class: `.${uniqueId}.sp-smart-post-show-container-front-page > .sp-smart-post-container-column-multi-row.container-column-multi-row-layout-one > .sp-smart-post-container-column:nth-of-type( 6n + 1 )`, |
| 314 |
styles: { |
| 315 |
width: "calc( var( --columnOne, 33.33% ) - ( var( --gap, 16px ) / var( --gapMultiplier, 3 )) )", |
| 316 |
}, |
| 317 |
}, |
| 318 |
{ |
| 319 |
class: `.${uniqueId}.sp-smart-post-show-container-front-page > .sp-smart-post-container-column-multi-row.container-column-multi-row-layout-one > .sp-smart-post-container-column:nth-of-type( 6n + 2 )`, |
| 320 |
styles: { |
| 321 |
width: "calc( var( --columnTwo, 33.33% ) - ( var( --gap, 16px ) / var( --gapMultiplier, 3 )) )", |
| 322 |
}, |
| 323 |
}, |
| 324 |
{ |
| 325 |
class: `.${uniqueId}.sp-smart-post-show-container-front-page > .sp-smart-post-container-column-multi-row.container-column-multi-row-layout-one > .sp-smart-post-container-column:nth-of-type( 6n + 3 )`, |
| 326 |
styles: { |
| 327 |
width: "calc( var( --columnThree, 33.33% ) - ( var( --gap, 16px ) / var( --gapMultiplier, 3 )) )", |
| 328 |
}, |
| 329 |
}, |
| 330 |
{ |
| 331 |
class: `.${uniqueId}.sp-smart-post-show-container-front-page > .sp-smart-post-container-column-multi-row.container-column-multi-row-layout-one > .sp-smart-post-container-column:nth-of-type( 6n + 4 )`, |
| 332 |
styles: { |
| 333 |
width: "calc( var( --columnFour, 33.33% ) - ( var( --gap, 16px ) / var( --gapMultiplier, 3 )) )", |
| 334 |
}, |
| 335 |
}, |
| 336 |
{ |
| 337 |
class: `.${uniqueId}.sp-smart-post-show-container-front-page > .sp-smart-post-container-column-multi-row.container-column-multi-row-layout-one > .sp-smart-post-container-column:nth-of-type( 6n + 5 )`, |
| 338 |
styles: { |
| 339 |
width: "calc( var( --columnFive, 33.33% ) - ( var( --gap, 16px ) / var( --gapMultiplier, 3 )) )", |
| 340 |
}, |
| 341 |
}, |
| 342 |
{ |
| 343 |
class: `.${uniqueId}.sp-smart-post-show-container-front-page > .sp-smart-post-container-column-multi-row.container-column-multi-row-layout-one > .sp-smart-post-container-column:nth-of-type( 6n + 6 )`, |
| 344 |
styles: { |
| 345 |
width: "calc( var( --columnSix, 33.33% ) - ( var( --gap, 16px ) / var( --gapMultiplier, 3 )) )", |
| 346 |
}, |
| 347 |
}, |
| 348 |
// Multi-row layout five |
| 349 |
{ |
| 350 |
class: `.${uniqueId}.sp-smart-post-show-container-front-page > .sp-smart-post-container-column-multi-row.container-column-multi-row-layout-five > .sp-smart-post-container-column:nth-of-type( 3n + 1 )`, |
| 351 |
styles: { |
| 352 |
width: "calc( var( --columnOne, 50% ) - ( var( --gap, 16px ) / var( --gapMultiplier, 3 )) )", |
| 353 |
}, |
| 354 |
}, |
| 355 |
{ |
| 356 |
class: `.${uniqueId}.sp-smart-post-show-container-front-page > .sp-smart-post-container-column-multi-row.container-column-multi-row-layout-five > .sp-smart-post-container-column:nth-of-type( 3n + 2 )`, |
| 357 |
styles: { |
| 358 |
width: "calc( var( --columnTwo, 50% ) - ( var( --gap, 16px ) / var( --gapMultiplier, 3 )) )", |
| 359 |
}, |
| 360 |
}, |
| 361 |
{ |
| 362 |
class: `.${uniqueId}.sp-smart-post-show-container-front-page > .sp-smart-post-container-column-multi-row.container-column-multi-row-layout-five > .sp-smart-post-container-column:nth-of-type( 3n + 3 )`, |
| 363 |
styles: { |
| 364 |
width: "calc( var( --columnThree, 100% ) )", |
| 365 |
}, |
| 366 |
}, |
| 367 |
// Multi row not( layout one, layout five ) |
| 368 |
{ |
| 369 |
class: `.${uniqueId}.sp-smart-post-show-container-front-page > .sp-smart-post-container-column-multi-row:not(.container-column-multi-row-layout-one, .container-column-multi-row-layout-five) > .sp-smart-post-container-column:nth-of-type( 4n + 1 )`, |
| 370 |
styles: { |
| 371 |
width: "calc( var( --columnOne, 50% ) - ( var( --gap, 32px ) / var( --gapMultiplier, 2 )) )", |
| 372 |
}, |
| 373 |
}, |
| 374 |
{ |
| 375 |
class: `.${uniqueId}.sp-smart-post-show-container-front-page > .sp-smart-post-container-column-multi-row:not(.container-column-multi-row-layout-one, .container-column-multi-row-layout-five) > .sp-smart-post-container-column:nth-of-type( 4n + 2 )`, |
| 376 |
styles: { |
| 377 |
width: "calc( var( --columnTwo, 50% ) - ( var( --gap, 32px ) / var( --gapMultiplier, 2 )) )", |
| 378 |
}, |
| 379 |
}, |
| 380 |
{ |
| 381 |
class: `.${uniqueId}.sp-smart-post-show-container-front-page > .sp-smart-post-container-column-multi-row:not(.container-column-multi-row-layout-one, .container-column-multi-row-layout-five) > .sp-smart-post-container-column:nth-of-type( 4n + 3 )`, |
| 382 |
styles: { |
| 383 |
width: "calc( var( --columnThree, 50% ) - ( var( --gap, 32px ) / var( --gapMultiplier, 2 )) )", |
| 384 |
}, |
| 385 |
}, |
| 386 |
{ |
| 387 |
class: `.${uniqueId}.sp-smart-post-show-container-front-page > .sp-smart-post-container-column-multi-row:not(.container-column-multi-row-layout-one, .container-column-multi-row-layout-five) > .sp-smart-post-container-column:nth-of-type( 4n + 4 )`, |
| 388 |
styles: { |
| 389 |
width: "calc( var( --columnFour, 50% ) - ( var( --gap, 32px ) / var( --gapMultiplier, 2 )) )", |
| 390 |
}, |
| 391 |
}, |
| 392 |
]) |
| 393 |
} |
| 394 |
return responsiveData; |
| 395 |
}; |
| 396 |
|
| 397 |
const desktopCss = [ |
| 398 |
...responsiveCss("Desktop"), |
| 399 |
...imageOverlayStyles("Desktop"), |
| 400 |
{ |
| 401 |
class: `.${uniqueId}`, |
| 402 |
styles: { |
| 403 |
// "max-width": "none !important", |
| 404 |
overflow: containerOverflow, |
| 405 |
position: "relative", |
| 406 |
...backgroundStyle(containerBG, containerBGImage, false), |
| 407 |
"background-position": "center", |
| 408 |
"background-attachment": "scroll", |
| 409 |
"background-repeat": "no-repeat", |
| 410 |
"background-size": "cover", |
| 411 |
"border-style": containerBorder.style, |
| 412 |
"border-color": containerBorder.color, |
| 413 |
"z-index": advanceZIndex !== "" ? advanceZIndex : 1, |
| 414 |
transition: "all 0.3s ease-in-out", |
| 415 |
}, |
| 416 |
}, |
| 417 |
{ |
| 418 |
class: `.${uniqueId}:hover`, |
| 419 |
styles: { |
| 420 |
"border-style": containerBorder.hoverStyle, |
| 421 |
"border-color": containerBorder.hoverColor, |
| 422 |
}, |
| 423 |
}, |
| 424 |
...gradientHoverStyle(`.${uniqueId}`, containerBG, containerBGImageHover ), |
| 425 |
{ |
| 426 |
class: `.${uniqueId}::before, .${uniqueId}::after`, |
| 427 |
styles: { |
| 428 |
position: "absolute", |
| 429 |
content: '""', |
| 430 |
top: "0", |
| 431 |
left: "0", |
| 432 |
width: "100%", |
| 433 |
height: "100%", |
| 434 |
"pointer-events": "none", |
| 435 |
}, |
| 436 |
}, |
| 437 |
{ |
| 438 |
class: `.${uniqueId}::after`, |
| 439 |
styles: { |
| 440 |
opacity: 0, |
| 441 |
transition: "all 0.3s ease-in-out" |
| 442 |
}, |
| 443 |
}, |
| 444 |
{ |
| 445 |
class: `.${uniqueId} .sp-smart-post-container-parent-block > .wp-block-sp-smart-post-show-container > .block-editor-inner-blocks > .block-editor-block-list__layout, .${uniqueId}.sp-smart-post-show-container-front-page .sp-smart-post-container-parent-block`, |
| 446 |
styles: { |
| 447 |
display: "flex", |
| 448 |
}, |
| 449 |
}, |
| 450 |
{ |
| 451 |
class: `.${uniqueId} > .block-editor-inner-blocks > .block-editor-block-list__layout .wp-block-sp-smart-post-show-column, .${uniqueId}.sp-smart-post-show-container-front-page .wp-block-sp-smart-post-show-column`, |
| 452 |
styles: { |
| 453 |
height: equalHeight ? "fit-content" : "auto", |
| 454 |
}, |
| 455 |
}, |
| 456 |
{ |
| 457 |
class: `.${uniqueId} .sp-smart-post-container-shape`, |
| 458 |
styles: { |
| 459 |
position: "absolute", |
| 460 |
left: "0", |
| 461 |
display: "block", |
| 462 |
overflow: "hidden", |
| 463 |
}, |
| 464 |
}, |
| 465 |
{ |
| 466 |
class: `.${uniqueId} .sp-smart-post-container-shape.sp-smart-post-container-shape-top`, |
| 467 |
styles: { |
| 468 |
top: "0", |
| 469 |
"z-index": shapeDividerBringToFrontTop ? "9" : "1", |
| 470 |
"pointer-events": "none", |
| 471 |
}, |
| 472 |
}, |
| 473 |
{ |
| 474 |
class: `.${uniqueId} .sp-smart-post-container-shape.sp-smart-post-container-shape-bottom`, |
| 475 |
styles: { |
| 476 |
bottom: "0", |
| 477 |
transform: "rotate(180deg)", |
| 478 |
"z-index": shapeDividerBringToFrontBottom ? "9" : "1", |
| 479 |
"pointer-events": "none", |
| 480 |
}, |
| 481 |
}, |
| 482 |
{ |
| 483 |
class: `.${uniqueId} .sp-smart-post-container-shape svg`, |
| 484 |
styles: { |
| 485 |
position: "relative", |
| 486 |
width: "calc( 100% + 3px )", |
| 487 |
left: "-3px", |
| 488 |
display: "block", |
| 489 |
height: "100%", |
| 490 |
}, |
| 491 |
}, |
| 492 |
{ |
| 493 |
class: `.${uniqueId} .sp-smart-post-container-shape.sp-smart-post-container-shape-top svg .sp-smart-post-show-container_shape-fill`, |
| 494 |
styles: { |
| 495 |
fill: colorControls( |
| 496 |
shapeDividerBgColorTop?.color?.style, |
| 497 |
shapeDividerBgColorTop?.color?.solidColor, |
| 498 |
shapeDividerBgColorTop?.color?.gradient |
| 499 |
), |
| 500 |
}, |
| 501 |
}, |
| 502 |
{ |
| 503 |
class: `.${uniqueId} .sp-smart-post-container-shape.sp-smart-post-container-shape-bottom svg .sp-smart-post-show-container_shape-fill`, |
| 504 |
styles: { |
| 505 |
fill: colorControls( |
| 506 |
shapeDividerBgColorBottom?.color?.style, |
| 507 |
shapeDividerBgColorBottom?.color?.solidColor, |
| 508 |
shapeDividerBgColorBottom?.color?.gradient |
| 509 |
), |
| 510 |
}, |
| 511 |
}, |
| 512 |
{ |
| 513 |
class: `.${uniqueId} .sp-smart-post-container-shape.sp-smart-post-container-shape-top.sp-smart-post-shape-flip svg`, |
| 514 |
styles: { |
| 515 |
transform: "rotateY(180deg)", |
| 516 |
}, |
| 517 |
}, |
| 518 |
{ |
| 519 |
class: `.${uniqueId} .sp-smart-post-container-shape.sp-smart-post-container-shape-bottom.sp-smart-post-shape-flip svg`, |
| 520 |
styles: { |
| 521 |
transform: "rotateY(180deg)", |
| 522 |
}, |
| 523 |
}, |
| 524 |
{ |
| 525 |
class: `.${uniqueId} .sp-smart-post-container-parent-block-wrapper-link`, |
| 526 |
styles: { |
| 527 |
width: "100%", |
| 528 |
height: "100%", |
| 529 |
position: "absolute", |
| 530 |
top: "0", |
| 531 |
left: "0", |
| 532 |
cursor: "pointer", |
| 533 |
"pointer-events": page === "editor" ? "none" : "all", |
| 534 |
"z-index": "20", |
| 535 |
}, |
| 536 |
}, |
| 537 |
{ |
| 538 |
class: `.${uniqueId} .sp-smart-post-column-wrapper, .${uniqueId} .sp-smart-post-column-wrapper .wp-block-sp-smart-post-show-column, .${uniqueId} .sp-smart-post-show-column, .${uniqueId} .sp-smart-post-show-column .block-editor-inner-blocks, .${uniqueId} .sp-smart-post-show-column .block-editor-block-list__layout`, |
| 539 |
styles: { |
| 540 |
height: equalHeight ? "100%" : "", |
| 541 |
}, |
| 542 |
}, |
| 543 |
{ |
| 544 |
class: `.${uniqueId}`, |
| 545 |
styles: { |
| 546 |
display: advanceVisibilityHideDesktop ? "none" : "block", |
| 547 |
}, |
| 548 |
}, |
| 549 |
]; |
| 550 |
|
| 551 |
cacheCss.desktop = objectToCssString(desktopCss); |
| 552 |
|
| 553 |
if ("Tablet" === currentDevice || "all" === currentDevice) { |
| 554 |
const tabletCss = [ |
| 555 |
...responsiveCss("Tablet"), |
| 556 |
...imageOverlayStyles("Tablet"), |
| 557 |
{ |
| 558 |
class: `.${uniqueId}`, |
| 559 |
styles: { |
| 560 |
display: advanceVisibilityHideTablet ? "none" : "block", |
| 561 |
}, |
| 562 |
}, |
| 563 |
{ |
| 564 |
class: `.${uniqueId} .sp-smart-post-container-parent-block .sp-smart-post-container-column`, |
| 565 |
styles: { |
| 566 |
width: `calc( (100% / ${ columnsTablet || columns }) - (${rangerCss( columnsGap, "Tablet") || rangerCss( columnsGap, "Desktop")} * ${ (columnsTablet || columns) - 1 } / ${ columnsTablet || columns })) !important`, |
| 567 |
}, |
| 568 |
}, |
| 569 |
]; |
| 570 |
cacheCss.tablet = wrapInMediaQuery( |
| 571 |
objectToCssString(tabletCss), |
| 572 |
`only screen and (max-width: ${globalBreakPointData?.tablet}px)` |
| 573 |
); |
| 574 |
} |
| 575 |
if ("Mobile" === currentDevice || "all" === currentDevice) { |
| 576 |
const mobileCss = [ |
| 577 |
...responsiveCss("Mobile"), |
| 578 |
...imageOverlayStyles("Mobile"), |
| 579 |
{ |
| 580 |
class: `.${uniqueId} .sp-smart-post-container-parent-block > .wp-block-sp-smart-post-show-container > .block-editor-inner-blocks > .block-editor-block-list__layout, .${uniqueId} .sp-smart-post-container-parent-block`, |
| 581 |
styles: { |
| 582 |
"flex-direction": "column", |
| 583 |
}, |
| 584 |
}, |
| 585 |
{ |
| 586 |
class: `.${uniqueId}`, |
| 587 |
styles: { |
| 588 |
display: advanceVisibilityHideMobile ? "none" : "block", |
| 589 |
"margin-left": "auto !important", |
| 590 |
"margin-right": "auto !important", |
| 591 |
}, |
| 592 |
}, |
| 593 |
{ |
| 594 |
class: `.${uniqueId} .sp-smart-post-container-parent-block .sp-smart-post-container-column`, |
| 595 |
styles: { |
| 596 |
width: `calc( (100% / ${ columnsMobile || columns }) - (${rangerCss( columnsGap, "Mobile") || rangerCss( columnsGap, "Desktop")} * ${ (columnsMobile || columns) - 1 } / ${ columnsMobile || columns })) !important`, |
| 597 |
}, |
| 598 |
}, |
| 599 |
]; |
| 600 |
|
| 601 |
cacheCss.mobile = wrapInMediaQuery( |
| 602 |
objectToCssString(mobileCss), |
| 603 |
`only screen and (max-width: ${globalBreakPointData?.mobile}px)` |
| 604 |
); |
| 605 |
} |
| 606 |
|
| 607 |
return `${cacheCss.desktop} ${cacheCss.tablet} ${cacheCss.mobile}`; |
| 608 |
}; |
| 609 |
|
| 610 |
export default dynamicCss; |
| 611 |
|