refactor: remove HTML report export and implement PDF export options in PDF comparison tool

- Deleted the exportCompareHtmlReport function and its related imports.
- Introduced a dropdown menu for exporting comparison results as PDFs with multiple modes (split, alternating, left, right).
- Updated the comparison logic to utilize caching for page models and comparison results.
- Refactored rendering functions to improve code organization and maintainability.
- Enhanced UI elements for better user experience during PDF export.
This commit is contained in:
alam00000
2026-03-09 23:26:52 +05:30
parent 0fe94795cc
commit d2a1450bc0
15 changed files with 953 additions and 526 deletions

View File

@@ -1,6 +1,7 @@
import pixelmatch from 'pixelmatch';
import type { CompareVisualDiff } from '../types.ts';
import { VISUAL_DIFF as VISUAL_DIFF_CONFIG } from '../config.ts';
type FocusRegion = {
x: number;
@@ -69,12 +70,16 @@ export function renderVisualDiff(
width,
height,
{
threshold: 0.12,
threshold: VISUAL_DIFF_CONFIG.PIXELMATCH_THRESHOLD,
includeAA: false,
alpha: 0.2,
alpha: VISUAL_DIFF_CONFIG.ALPHA,
diffMask: false,
diffColor: [239, 68, 68],
diffColorAlt: [34, 197, 94],
diffColor: [...VISUAL_DIFF_CONFIG.DIFF_COLOR] as [number, number, number],
diffColorAlt: [...VISUAL_DIFF_CONFIG.DIFF_COLOR_ALT] as [
number,
number,
number,
],
}
);