(dynamicThemeFixes: DynamicThemeFix[])
| 32 | } |
| 33 | |
| 34 | export function formatDynamicThemeFixes(dynamicThemeFixes: DynamicThemeFix[]): string { |
| 35 | const fixes = dynamicThemeFixes.slice().sort((a, b) => compareURLPatterns(a.url[0], b.url[0])); |
| 36 | |
| 37 | return formatSitesFixesConfig(fixes, { |
| 38 | props: Object.values(dynamicThemeFixesCommands), |
| 39 | getPropCommandName: (prop) => Object.entries(dynamicThemeFixesCommands).find(([, p]) => p === prop)![0], |
| 40 | formatPropValue: (prop, value) => { |
| 41 | if (prop === 'css') { |
| 42 | return formatCSS(value as string); |
| 43 | } |
| 44 | return formatArray(value as string[]).trim(); |
| 45 | }, |
| 46 | shouldIgnoreProp: (prop, value) => { |
| 47 | if (prop === 'css') { |
| 48 | return !value; |
| 49 | } |
| 50 | return !(Array.isArray(value) && value.length > 0); |
| 51 | }, |
| 52 | }); |
| 53 | } |
| 54 | |
| 55 | export function getDynamicThemeFixesFor(url: string, text: string, index: SiteFixesIndex, enabledForPDF: boolean): DynamicThemeFix[] | null { |
| 56 | const fixes = getSitesFixesFor(url, text, index, parseDynamicThemeFixes); |
no test coverage detected