2601* and joining of connected scripts (e.g. Arabic).2602* @param {HTMLElement} element - animated text element2603*/2604function t_animate__unwrapAnimatedTextLetters(element) {2605const wordElements = element.querySelectorAll('.t-animate__word');26062607wordElements.forEach(wordElement => {2608if (wordElement.querySelector('.t-animate__letter')) {2609wordElement.textContent = wordElement.textContent;2610}2611});2612
}/** * Unwrap each line of animated text * @param {HTMLElement|null} element - optional specific element to prepare, if null, prepares all elements with the specified animation styles */function t_animate__unwrapAnimatedTextLines(element = null) { const animatedTextElements = t_animate__getAnimatedTextElements( ['line-fade-in-right-gradient', 'line-fade-in-left-gradient'], element ); animatedTextElements.forEach(animatedTextElement => { t_animate__unwrapAnimatedTextElementLines(animatedTextElement); });}/** * Wrap each word of animated text with a span for specific animation styles * @param {HTMLElement|null} element - optional specific element to prepare, if null, prepares all elements with the specified animation styles */function t_animate__wrapAnimatedTextLines(element = null) { t_animate__unwrapAnimatedTextLines(element); const animatedTextElements = t_animate__getAnimatedTextElements( ['line-fade-in-right-gradient', 'line-fade-in-left-gradient'], element ); animatedTextElements.forEach(animatedTextElement => { t_animate__wrapAnimatedTextElementLines(animatedTextElement); });}/** * Get base delay from element's transition-delay style * @param {HTMLElement} element - element to get delay from * @returns {number} - delay in seconds */function t_animate__getElementBaseDelay(element) { const transitionDelay = element.style.transitionDelay || window.getComputedStyle(element).transitionDelay; const parsedTransitionDelay = parseFloat(transitionDelay); if (isNaN(parsedTransitionDelay) || parsedTransitionDelay === 0) { return 0; } if (transitionDelay.includes('ms')) { return parsedTransitionDelay / 1000; } return parsedTransitionDelay;}/** * @typedef {Object} TextDecoration * @property {string[]} lines - array of text decoration lines (e.g., ['underline', 'line-through']) * @property {string} style - text decoration style (e.g., 'solid', 'dashed') * @property {string} color - text decoration color (e.g., '#000000') * @property {string} thickness - text decoration thickness (e.g., '2px') *//** * Get text decoration properties of a node * @param {CSSStyleDeclaration} computedStyle - computed style of the node * @param {TextDecoration|null} parentTextDecoration - inherited text decoration from parent * @returns {TextDecoration|null} - object with text decoration properties or null if none */function t_animate__getTextDecoration(computedStyle, parentTextDecoration) { const textDecorationLine = computedStyle.textDecorationLine; if (!textDecorationLine || textDecorationLine === 'none') { return parentTextDecoration; } const textDecorationStyle = computedStyle.textDecorationStyle; const textDecorationColor = computedStyle.textDecorationColor; const textDecorationThickness = computedStyle.textDecorationThickness; return { lines: [...(parentTextDecoration?.lines ?? []), textDecorationLine], style: textDecorationStyle, color: textDecorationColor, thickness: textDecorationThickness, };}/** * Get text vertical align of a node