@swmansion/argent 0.14.1-next.1 → 0.14.1-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -139258,14 +139258,30 @@ async function analyzeScreenshotTextChanges(options) {
139258
139258
  };
139259
139259
  }
139260
139260
  return analyzeTextRegions({
139261
- baselineRegions: baselineOcr.blocks,
139262
- currentRegions: currentOcr.blocks,
139261
+ baselineRegions: rescaleTextRegions(baselineOcr.blocks, options.baselineRegionScale),
139262
+ currentRegions: rescaleTextRegions(currentOcr.blocks, options.currentRegionScale),
139263
139263
  baselineImage: options.baselineImage,
139264
139264
  currentImage: options.currentImage,
139265
139265
  ignoreTopPixels: options.ignoreTopPixels,
139266
139266
  textChangeMinConfidence: options.textChangeMinConfidence
139267
139267
  });
139268
139268
  }
139269
+ function rescaleTextRegions(regions, scale) {
139270
+ if (!scale || scale.x === 1 && scale.y === 1) return regions;
139271
+ return regions.map((region) => ({
139272
+ ...region,
139273
+ bounds: scaleBounds(region.bounds, scale),
139274
+ words: region.words?.map((word) => ({ ...word, bounds: scaleBounds(word.bounds, scale) }))
139275
+ }));
139276
+ }
139277
+ function scaleBounds(bounds, scale) {
139278
+ return {
139279
+ x: bounds.x * scale.x,
139280
+ y: bounds.y * scale.y,
139281
+ width: bounds.width * scale.x,
139282
+ height: bounds.height * scale.y
139283
+ };
139284
+ }
139269
139285
  function analyzeTextRegions(params) {
139270
139286
  const textChangeMinConfidence = params.textChangeMinConfidence ?? DEFAULT_TEXT_CHANGE_MIN_CONFIDENCE;
139271
139287
  validateTextChangeMinConfidence(textChangeMinConfidence);
@@ -139950,9 +139966,11 @@ async function diffPngFiles(options) {
139950
139966
  baselinePath: options.baselinePath,
139951
139967
  currentPath: options.currentPath,
139952
139968
  hasPixelDiff: pixelDiff.differentPixels > 0,
139953
- baselineImage: decodedBaseline,
139954
- currentImage: decodedCurrent,
139955
- ignoreTopPixels: ignoredTopRowsFor(decodedBaseline.height, settings.ignoreTopNormalizedY),
139969
+ baselineImage: baseline,
139970
+ currentImage: current,
139971
+ baselineRegionScale: regionScaleBetween(decodedBaseline, baseline),
139972
+ currentRegionScale: regionScaleBetween(decodedCurrent, current),
139973
+ ignoreTopPixels: ignoredTopRowsFor(baseline.height, settings.ignoreTopNormalizedY),
139956
139974
  textChangeMinConfidence: DEFAULT_TEXT_CHANGE_MIN_CONFIDENCE
139957
139975
  });
139958
139976
  return summarizeResult({
@@ -140020,6 +140038,12 @@ function markChangedPixels(params) {
140020
140038
  function ignoredTopRowsFor(height, ignoreTopNormalizedY) {
140021
140039
  return Math.min(height, Math.ceil(height * ignoreTopNormalizedY));
140022
140040
  }
140041
+ function regionScaleBetween(from2, to) {
140042
+ return {
140043
+ x: from2.width === 0 ? 1 : to.width / from2.width,
140044
+ y: from2.height === 0 ? 1 : to.height / from2.height
140045
+ };
140046
+ }
140023
140047
  function getChangedRegions(params) {
140024
140048
  const rawRegions = traceChangeRegions({
140025
140049
  mask: params.mask,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swmansion/argent",
3
- "version": "0.14.1-next.1",
3
+ "version": "0.14.1-next.2",
4
4
  "description": "MCP server for iOS Simulator and Android Emulator control",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {