Каталог файловtilda-animation-sbs-1.0.js
2401 (animatedHTML.colorTargets || []).forEach(target => {2402 target.nodes.forEach(node => t_animationSBS__restoreInlineStyles(node));2403 t_animationSBS__removeBgColorLayer(target);2404 });2405 if (animatedHTML.sbsShapeColorStyle) animatedHTML.sbsShapeColorStyle.remove();2406 delete animatedHTML.sbsShapeColorStyle;2407 delete animatedHTML.sbsShapeColorCss;2408 animatedHTML.colorTargets = [];2409}2410 2411/**2412
История файла и сравнение версий
* Собирает цели анимации цвета по типу элемента:
2413 * color - у .tn-atom и у текста кнопки; 2414 * background-color - у .tn-atom (у тултипа это пин), у физической группы - у .tn-molecule, 2415 * или у обертки, если фон перенесен на нее в t_animationSBS__chromeFixBackdropFilter; 2416 * fill и stroke - у фигур внутри svg вектора, см. t_animationSBS__collectShapeColorTargets. 2417 * Ключи шагов cl, bg, fl и st у неподдерживаемых типов элементов обнуляются. 2418 * Правило слоев целям здесь не ставится, см. t_animationSBS__setColorTargets 2420 * @param {AnimatedHTML} animatedHTML 2421 * @param {string | null} elType - тип элемента, по умолчанию определяется по animatedHTML 2422 * @returns {sbsColorTarget[]} 2424function t_animationSBS__collectColorTargets(animatedHTML, elType = t_animationSBS__getColorElType(animatedHTML)) { 2425 const wrapperEl = animatedHTML.wrapperEl; 2426 // .tn-molecule для группы, .tn-atom для остальных элементов, как в t_animationSBS__wrapAndUpdateEls 2427 const animCore = wrapperEl ? wrapperEl.querySelector('.tn-molecule, .tn-atom') : null; 2428 const colorTargets = []; 2430 // у одного узла может анимироваться и color, и bgColor, тогда это одна цель с одной анимацией 2431 const addTarget = (node, prop, alpha) => { 2432 let target = colorTargets.find(colorTarget => colorTarget.node === node); 2434 const selector = t_animationSBS__getChildSelector(wrapperEl, node); 2435 target = { node, nodes: [node], selector, props: [], base: {}, alpha }; 2436 colorTargets.push(target); 2438 target.props.push(prop); 2442 const shapeProps = []; 2443 ['color', 'bgColor', 'fill', 'stroke'].forEach(prop => { 2444 const isSupported = animCore && t_animationSBS__getColorPropOpts(prop).elTypes.includes(elType); 2445 const hasColor = animatedHTML.steps.some(step => step.styles[prop]); 2446 // ключи могли попасть на неподдерживаемый элемент при копировании анимации - обнуляем их в шагах 2447 if (!isSupported || !hasColor) { 2448 animatedHTML.steps.forEach(step => { 2449 step.styles[prop] = null; 2454 if (prop === 'fill' || prop === 'stroke') { 2455 shapeProps.push(prop); 2459 // в шагах есть градиент: все шаги свойства рисуются слоями градиента, см. t_animationSBS__createPaintMeta 2460 const paintMeta = t_animationSBS__createPaintMeta(animatedHTML, prop); 2461 const addPaintTarget = node => { 2462 const paintTarget = addTarget(node, prop, 1); 2463 paintTarget.paint = Object.assign(paintTarget.paint || {}, { [prop]: paintMeta }); 2464 t_animationSBS__registerPaintProperties(paintMeta); 2467 if (prop === 'color') { 2468 // .tn-atom__btn-text - в редакторе, .tn-atom__button-text - в разметке кнопки на сайте 2469 const btnText = animCore.querySelector('.tn-atom__btn-text, .tn-atom__button-text'); 2471 // у кнопки градиент рисуется на тексте, а атому для иконок (currentColor) - цвет первого стопа 2472 if (btnText) addTarget(animCore, prop, 1); 2473 addPaintTarget(btnText || animCore); 2476 addTarget(animCore, prop, 1); 2477 if (btnText) addTarget(btnText, prop, 1); 2482 addPaintTarget(animCore); 2483 } else if (t_animationSBS__getBgLayerInfo(getComputedStyle(animCore))) { 2484 // background-color не виден под градиентом bgcolor и у текста с градиентом букв без фона, 2485 // в этих случаях цвет шага рисуется отдельным слоем, см. t_animationSBS__getBgLayerInfo. 2486 // Слой проверяется раньше chrome fix: тот переносит только background-color, а градиент остается на атоме 2487 t_animationSBS__registerBgColorProperty(); 2488 addTarget(animCore, prop, 1).hasBgLayer = true; 2489 } else if (animCore.sbsBgHolder) { 2490 addTarget(animCore.sbsBgHolder.node, prop, animCore.sbsBgHolder.alpha); 2492 addTarget(animCore, prop, 1); 2496 if (shapeProps.length) 2497 colorTargets.push(...t_animationSBS__collectShapeColorTargets(animatedHTML, animCore, shapeProps)); 2499 return colorTargets;