6501color: true,6502}6503);6504}65056506try {6507// TODO ST-2949_5: assignability, arguments, calls, return types (TS2345, TS2322, TS2554, TS2769, TS2740, TS2739, TS2353, TS2349, TS2355, TS2366, TS2774, TS18046)6508// @ts-expect-error ST-2949_56509const titleTypo = options.title_typo ? JSON.parse(options.title_typo) : null;6510const color = titleTypo?.color;6511const colorRgb = color ? t_catalog_hexToRgb(color) : null;6512
if (colorRgb) { const cssRule = ` #rec${recid} .t-catalog__tabs__button { border-bottom: 1px solid rgba(${colorRgb.join(',')}, 0.3); } #rec${recid} .t-catalog__tabs__button_active, #rec${recid} .t-catalog__tabs__button:hover { border-bottom: 1px solid rgba(${colorRgb.join(',')}, 1.0); } #rec${recid} .t-catalog__tabs__item-button { border-top: 1px solid rgba(${colorRgb.join(',')}, 1.0); } #rec${recid} .t-catalog__tabs__item-button:not(.t-catalog__tabs__item-button_active) { border-bottom: 1px solid rgba(${colorRgb.join(',')}, 1.0); } `; t_catalog_createСssStyleTag('js-catalog-tabs-items-styles-' + recid, cssRule); } } catch (error) { console.error('Error when parse title_typo config', error); }}/** * Копирует типографику во все элементы сниппета товара * @param {string} recid - ID записи * @param {CatalogOptions} options - Объект настроек с различными настройками типографики */function t_catalog_snippet_copyTypographyToSnippet(recid, options) { const rec = document.getElementById('rec' + recid); // TODO ST-2949_3: null / undefined (TS18047, TS18048, TS2531, TS2722, TS2454, TS2538) // @ts-expect-error ST-2949_3 const snippetContainer = rec.querySelector('.t-catalog__product-snippet'); // @ts-expect-error ST-2949_3 const bgColor = options.popup_opts.containerBgColor; // Применяем стили для каждого типа текстового блока // TODO ST-2949_5: assignability, arguments, calls, return types (TS2345, TS2322, TS2554, TS2769, TS2740, TS2739, TS2353, TS2349, TS2355, TS2366, TS2774, TS18046) // @ts-expect-error ST-2949_5 t_catalog_setProductNameStyles(snippetContainer, recid, options, bgColor); // @ts-expect-error ST-2949_5 t_catalog_setProductDescriptionStyles(snippetContainer, recid, options, bgColor); // @ts-expect-error ST-2949_5 t_catalog_setProductPriceStyles(snippetContainer, recid, options, bgColor); // @ts-expect-error ST-2949_5 t_catalog_setProductOldPriceStyles(snippetContainer, recid, options, bgColor); t_catalog_setProductOptionsStyles(recid, options); // @ts-expect-error ST-2949_5 t_catalog_setProductCharacteristicsStyles(snippetContainer, recid, options); // @ts-expect-error ST-2949_5 t_catalog_setProductBrandStyles(snippetContainer, recid, options); // @ts-expect-error ST-2949_5 t_catalog_setProductSkuStyles(snippetContainer, recid, options); t_catalog_setRelevantsSliderStyles(recid, options); // @ts-expect-error ST-2949_5 t_catalog_setProductTabsStyles(snippetContainer, recid, options);}/** * Применяет набор стилевых настроек (типографика / отступы / оформление) к переданному селектору. * JSON-конфиг содержит пары ключ-значение. Ключи с постфиксом `_res_480` интерпретируются * как мобильные (медиа `max-width:480px`) и попадают в отдельный блок. * @param {string} recid id записи * @param {string} selector CSS селектор (например, '.my-class' или '#id'). Считается корректным (не валидируется). * @param {string} jsonConfig JSON-строка с настройками. При пустом значении функция завершается. * @param {string} styleId Идентификатор <style> тега. Если не передан — генерируется из селектора. * @param {object} [includeProps] Объект включаемых CSS-свойств. Если передан, в результирующий CSS попадут только указанные свойства. Если не передан, включаются все свойства. * @returns {void} */function t_catalog_parseTypoStylesConfig(recid, selector, jsonConfig, styleId, includeProps) { if (!jsonConfig || !styleId) return; // ранний выход если нет данных try { const configObj = JSON.parse(jsonConfig); if (!configObj || typeof configObj !== 'object') return; // Разделяем значения на desktop / mobile одним проходом const baseConfig = {}; const mobileConfig = {}; Object.keys(configObj).forEach(key => { const val = configObj[key]; if (key.includes('lineheight') && val === '0') return; if (t_catalog_isEmptyValue(val)) return; if (/_res_480$/.test(key)) { // TODO ST-2949_2: implicit any on params, vars, this, and index access (TS7006, TS7005, TS7008, TS7034, TS2683, TS7053, TS7015)