601if (!notProcessedAnimEls.length) return;602t_animationSBS__wrapAndUpdateEls(notProcessedAnimEls);603}604605/**606* @param {CSSStyleDeclaration} styles607* @param {'filter' | 'backdrop-filter'} filter608* @return {string}609*/610function t_animationSBS__getFilterValue(styles, filter) {611var value = styles.getPropertyValue(filter);612if (!value || value === 'none') value = styles.getPropertyValue('-webkit-' + filter);
if (!value || value === 'none') return ''; return value;}/** * Проверяет, что хотя бы один из углов border-radius ненулевой. * parseInt тут не подходит: для '0px 0px 20px 20px' он вернет 0 * * @param {string} value - вычисленное значение border-radius * @return {boolean} */function t_animationSBS__hasBorderRadius(value) { return !!value && /[1-9]/.test(value);}function t_animationSBS__updateStylesAfterWrapping(animatedEl, wrapper, isChrome) { // add border-radius property for animation wrapper, because we set filters for parentElem // getPropertyValue returns border-radius value in px. If it cannot setted, will return '0px' var elType = animatedEl.getAttribute('data-elem-type'); var animatedElStyles = getComputedStyle(animatedEl); var animCore = animatedEl.querySelector('.tn-molecule, .tn-atom'); var animCoreStyles = getComputedStyle(animCore); var elBorderRadius = animatedElStyles.getPropertyValue('border-radius'); if ( (elType === 'shape' || elType === 'button' || elType === 'image' || elType === 'widget') && t_animationSBS__hasBorderRadius(elBorderRadius) ) { wrapper.style.borderRadius = elBorderRadius; } var filterList = []; ['filter', 'backdrop-filter'].forEach(function (filter) { var elValue = t_animationSBS__getFilterValue(animatedElStyles, filter); // у групп фильтр задается не на .t396__group, а на вложенной .tn-molecule, // поэтому если на самом элементе фильтра нет, ищем его на ядре анимации var coreValue = elValue ? '' : t_animationSBS__getFilterValue(animCoreStyles, filter); var value = elValue || coreValue; if (!value) return; filterList.push({ filter: filter, webkitFilter: '-webkit-' + filter, value: value, // элемент, с которого фильтр нужно снять, чтобы он не наложился второй раз source: elValue ? animatedEl : animCore, }); }); var coreTransformValue = animCoreStyles.transform; var backdropFilterImageEvent = document.createEvent('Event'); backdropFilterImageEvent.initEvent('backdropFilterImgWrappered', true, true); filterList.forEach(function (filterOpts) { if (window.t_animationSBS__isFirefox) wrapper.style.backfaceVisibility = 'visible'; wrapper.style[filterOpts.webkitFilter] = filterOpts.value; wrapper.style[filterOpts.filter] = filterOpts.value; filterOpts.source.style[filterOpts.webkitFilter] = 'none'; filterOpts.source.style[filterOpts.filter] = 'none'; if (elType === 'image' && window.t_animationSBS__isSafari) { animatedEl.dispatchEvent(backdropFilterImageEvent); animatedEl.classList.add('t396__elem--backdrop-filter-img-wrappered'); } // in Chrome transform: translateZ(0) breaks backdrop-filter if (isChrome && filterOpts.filter === 'backdrop-filter') { animCore.style[filterOpts.webkitFilter] = 'inherit'; animCore.style[filterOpts.filter] = 'inherit'; } if (coreTransformValue === 'none') animCore.style.transform = 'translateZ(0)'; }); var hasBackdropFilter = filterList.some(function (filterOpts) { return filterOpts.filter === 'backdrop-filter'; }); if (isChrome && hasBackdropFilter) t_animationSBS__chromeFixBackdropFilter(animCore, wrapper);}/** * В Chrome backdrop-filter некорректно работает вместе с opacity атома меньше 1, * поэтому фон с учетом opacity переносится с атома на обертку, а атому ставится opacity: 1. * В атом записывается sbsBgHolder, чтобы анимация bg из шагов тоже шла на обертке * * @param {HTMLElement & {sbsBgHolder: sbsBgHolder | undefined}} atom * @param {HTMLElement} wrapper */function t_animationSBS__chromeFixBackdropFilter(atom, wrapper) { var atomStyles = getComputedStyle(atom); var atomBG = atomStyles.getPropertyValue('background-color'); var atomsOpacity = atomStyles.getPropertyValue('opacity');