@fairfox/polly 0.38.2 → 0.40.0

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.
Files changed (42) hide show
  1. package/dist/cli/polly.js.map +1 -1
  2. package/dist/src/background/index.js +1 -2
  3. package/dist/src/background/index.js.map +6 -6
  4. package/dist/src/background/message-router.js +1 -2
  5. package/dist/src/background/message-router.js.map +6 -6
  6. package/dist/src/client/index.js +46 -27
  7. package/dist/src/client/index.js.map +5 -5
  8. package/dist/src/client/wrapper.d.ts +8 -0
  9. package/dist/src/elysia/index.js +10 -31
  10. package/dist/src/elysia/index.js.map +5 -5
  11. package/dist/src/elysia/route-match.d.ts +9 -0
  12. package/dist/src/elysia/types.d.ts +4 -5
  13. package/dist/src/index.js +1 -2
  14. package/dist/src/index.js.map +7 -7
  15. package/dist/src/mesh-node.js.map +1 -1
  16. package/dist/src/mesh.js.map +7 -7
  17. package/dist/src/peer.js.map +3 -3
  18. package/dist/src/polly-ui/index.js.map +3 -3
  19. package/dist/src/polly-ui/markdown.js +583 -517
  20. package/dist/src/polly-ui/markdown.js.map +6 -6
  21. package/dist/src/shared/adapters/index.js.map +3 -3
  22. package/dist/src/shared/lib/context-helpers.js +1 -2
  23. package/dist/src/shared/lib/context-helpers.js.map +6 -6
  24. package/dist/src/shared/lib/mesh-signaling-client.d.ts +1 -1
  25. package/dist/src/shared/lib/message-bus.js +1 -2
  26. package/dist/src/shared/lib/message-bus.js.map +6 -6
  27. package/dist/src/shared/lib/peer-relay-adapter.d.ts +3 -2
  28. package/dist/src/shared/lib/resource.js.map +3 -3
  29. package/dist/src/shared/lib/state.js.map +3 -3
  30. package/dist/src/shared/state/app-state.js.map +4 -4
  31. package/dist/src/shared/types/messages.d.ts +0 -9
  32. package/dist/src/shared/types/messages.js.map +1 -1
  33. package/dist/tools/test/src/adapters/index.js.map +1 -1
  34. package/dist/tools/test/src/index.js.map +1 -1
  35. package/dist/tools/test/src/visual/index.js +64 -38
  36. package/dist/tools/test/src/visual/index.js.map +4 -4
  37. package/dist/tools/verify/Dockerfile +1 -1
  38. package/dist/tools/verify/specs/Dockerfile +1 -1
  39. package/dist/tools/verify/src/cli.js.map +3 -3
  40. package/dist/tools/visualize/src/cli.js.map +3 -3
  41. package/package.json +33 -28
  42. package/dist/src/utils/function-serialization.d.ts +0 -14
@@ -13351,13 +13351,14 @@ var require_png = __commonJS((exports) => {
13351
13351
  // tools/test/src/visual/compare.ts
13352
13352
  var {readFileSync, writeFileSync} = (() => ({}));
13353
13353
 
13354
- // node_modules/.bun/pixelmatch@7.1.0/node_modules/pixelmatch/index.js
13354
+ // node_modules/.bun/pixelmatch@7.2.0/node_modules/pixelmatch/index.js
13355
13355
  function pixelmatch(img1, img2, output, width, height, options = {}) {
13356
13356
  const {
13357
13357
  threshold = 0.1,
13358
13358
  alpha = 0.1,
13359
13359
  aaColor = [255, 255, 0],
13360
13360
  diffColor = [255, 0, 0],
13361
+ checkerboard = true,
13361
13362
  includeAA,
13362
13363
  diffColorAlt,
13363
13364
  diffMask
@@ -13365,9 +13366,9 @@ function pixelmatch(img1, img2, output, width, height, options = {}) {
13365
13366
  if (!isPixelData(img1) || !isPixelData(img2) || output && !isPixelData(output))
13366
13367
  throw new Error("Image data: Uint8Array, Uint8ClampedArray or Buffer expected.");
13367
13368
  if (img1.length !== img2.length || output && output.length !== img1.length)
13368
- throw new Error("Image sizes do not match.");
13369
+ throw new Error(`Image sizes do not match. Image 1 size: ${img1.length}, image 2 size: ${img2.length}`);
13369
13370
  if (img1.length !== width * height * 4)
13370
- throw new Error("Image data size does not match width/height.");
13371
+ throw new Error(`Image data size does not match width/height. Expecting ${width * height * 4}. Got ${img1.length}`);
13371
13372
  const len = width * height;
13372
13373
  const a32 = new Uint32Array(img1.buffer, img1.byteOffset, len);
13373
13374
  const b32 = new Uint32Array(img2.buffer, img2.byteOffset, len);
@@ -13380,8 +13381,8 @@ function pixelmatch(img1, img2, output, width, height, options = {}) {
13380
13381
  }
13381
13382
  if (identical) {
13382
13383
  if (output && !diffMask) {
13383
- for (let i = 0;i < len; i++)
13384
- drawGrayPixel(img1, 4 * i, alpha, output);
13384
+ for (let i = 0, pos = 0;i < len; i++, pos += 4)
13385
+ drawGrayPixel(img1, pos, alpha, output);
13385
13386
  }
13386
13387
  return 0;
13387
13388
  }
@@ -13390,29 +13391,27 @@ function pixelmatch(img1, img2, output, width, height, options = {}) {
13390
13391
  const [diffR, diffG, diffB] = diffColor;
13391
13392
  const [altR, altG, altB] = diffColorAlt || diffColor;
13392
13393
  let diff = 0;
13393
- for (let y = 0;y < height; y++) {
13394
- for (let x = 0;x < width; x++) {
13395
- const i = y * width + x;
13396
- const pos = i * 4;
13397
- const delta = a32[i] === b32[i] ? 0 : colorDelta(img1, img2, pos, pos, false);
13398
- if (Math.abs(delta) > maxDelta) {
13399
- const isAA = antialiased(img1, x, y, width, height, a32, b32) || antialiased(img2, x, y, width, height, b32, a32);
13400
- if (!includeAA && isAA) {
13401
- if (output && !diffMask)
13402
- drawPixel(output, pos, aaR, aaG, aaB);
13403
- } else {
13404
- if (output) {
13405
- if (delta < 0) {
13406
- drawPixel(output, pos, altR, altG, altB);
13407
- } else {
13408
- drawPixel(output, pos, diffR, diffG, diffB);
13409
- }
13394
+ for (let i = 0, pos = 0;i < len; i++, pos += 4) {
13395
+ const delta = a32[i] === b32[i] ? 0 : colorDelta(img1, img2, pos, pos, checkerboard);
13396
+ if (Math.abs(delta) > maxDelta) {
13397
+ const x = i % width;
13398
+ const y = i / width | 0;
13399
+ const isExcludedAA = !includeAA && (antialiased(img1, x, y, width, height, a32, b32, checkerboard) || antialiased(img2, x, y, width, height, b32, a32, checkerboard));
13400
+ if (isExcludedAA) {
13401
+ if (output && !diffMask)
13402
+ drawPixel(output, pos, aaR, aaG, aaB);
13403
+ } else {
13404
+ if (output) {
13405
+ if (delta < 0) {
13406
+ drawPixel(output, pos, altR, altG, altB);
13407
+ } else {
13408
+ drawPixel(output, pos, diffR, diffG, diffB);
13410
13409
  }
13411
- diff++;
13412
13410
  }
13413
- } else if (output && !diffMask) {
13414
- drawGrayPixel(img1, pos, alpha, output);
13411
+ diff++;
13415
13412
  }
13413
+ } else if (output && !diffMask) {
13414
+ drawGrayPixel(img1, pos, alpha, output);
13416
13415
  }
13417
13416
  }
13418
13417
  return diff;
@@ -13420,12 +13419,16 @@ function pixelmatch(img1, img2, output, width, height, options = {}) {
13420
13419
  function isPixelData(arr) {
13421
13420
  return ArrayBuffer.isView(arr) && arr.BYTES_PER_ELEMENT === 1;
13422
13421
  }
13423
- function antialiased(img, x1, y1, width, height, a32, b32) {
13422
+ function antialiased(img, x1, y1, width, height, a32, b32, checkerboard) {
13424
13423
  const x0 = Math.max(x1 - 1, 0);
13425
13424
  const y0 = Math.max(y1 - 1, 0);
13426
13425
  const x2 = Math.min(x1 + 1, width - 1);
13427
13426
  const y2 = Math.min(y1 + 1, height - 1);
13428
- const pos = y1 * width + x1;
13427
+ const pos4 = (y1 * width + x1) * 4;
13428
+ const cr = img[pos4];
13429
+ const cg = img[pos4 + 1];
13430
+ const cb = img[pos4 + 2];
13431
+ const ca = img[pos4 + 3];
13429
13432
  let zeroes = x1 === x0 || x1 === x2 || y1 === y0 || y1 === y2 ? 1 : 0;
13430
13433
  let min = 0;
13431
13434
  let max = 0;
@@ -13437,7 +13440,7 @@ function antialiased(img, x1, y1, width, height, a32, b32) {
13437
13440
  for (let y = y0;y <= y2; y++) {
13438
13441
  if (x === x1 && y === y1)
13439
13442
  continue;
13440
- const delta = colorDelta(img, img, pos * 4, (y * width + x) * 4, true);
13443
+ const delta = brightnessDelta(img, pos4, (y * width + x) * 4, cr, cg, cb, ca, checkerboard);
13441
13444
  if (delta === 0) {
13442
13445
  zeroes++;
13443
13446
  if (zeroes > 2)
@@ -13475,7 +13478,7 @@ function hasManySiblings(img, x1, y1, width, height) {
13475
13478
  }
13476
13479
  return false;
13477
13480
  }
13478
- function colorDelta(img1, img2, k, m, yOnly) {
13481
+ function colorDelta(img1, img2, k, m, checkerboard) {
13479
13482
  const r1 = img1[k];
13480
13483
  const g1 = img1[k + 1];
13481
13484
  const b1 = img1[k + 2];
@@ -13488,26 +13491,49 @@ function colorDelta(img1, img2, k, m, yOnly) {
13488
13491
  let dg = g1 - g2;
13489
13492
  let db = b1 - b2;
13490
13493
  const da = a1 - a2;
13491
- if (!dr && !dg && !db && !da)
13492
- return 0;
13493
13494
  if (a1 < 255 || a2 < 255) {
13494
- const rb = 48 + 159 * (k % 2);
13495
- const gb = 48 + 159 * ((k / 1.618033988749895 | 0) % 2);
13496
- const bb = 48 + 159 * ((k / 2.618033988749895 | 0) % 2);
13495
+ let rb = 255, gb = 255, bb = 255;
13496
+ if (checkerboard) {
13497
+ rb = 48 + 159 * (k % 2);
13498
+ gb = 48 + 159 * ((k / 1.618033988749895 | 0) % 2);
13499
+ bb = 48 + 159 * ((k / 2.618033988749895 | 0) % 2);
13500
+ }
13497
13501
  dr = (r1 * a1 - r2 * a2 - rb * da) / 255;
13498
13502
  dg = (g1 * a1 - g2 * a2 - gb * da) / 255;
13499
13503
  db = (b1 * a1 - b2 * a2 - bb * da) / 255;
13500
13504
  }
13501
13505
  const y = dr * 0.29889531 + dg * 0.58662247 + db * 0.11448223;
13502
- if (yOnly)
13503
- return y;
13504
13506
  const i = dr * 0.59597799 - dg * 0.2741761 - db * 0.32180189;
13505
13507
  const q = dr * 0.21147017 - dg * 0.52261711 + db * 0.31114694;
13506
13508
  const delta = 0.5053 * y * y + 0.299 * i * i + 0.1957 * q * q;
13507
13509
  return y > 0 ? -delta : delta;
13508
13510
  }
13511
+ function brightnessDelta(img, k, m, r1, g1, b1, a1, checkerboard) {
13512
+ const r2 = img[m];
13513
+ const g2 = img[m + 1];
13514
+ const b2 = img[m + 2];
13515
+ const a2 = img[m + 3];
13516
+ let dr = r1 - r2;
13517
+ let dg = g1 - g2;
13518
+ let db = b1 - b2;
13519
+ const da = a1 - a2;
13520
+ if (!dr && !dg && !db && !da)
13521
+ return 0;
13522
+ if (a1 < 255 || a2 < 255) {
13523
+ let rb = 255, gb = 255, bb = 255;
13524
+ if (checkerboard) {
13525
+ rb = 48 + 159 * (k % 2);
13526
+ gb = 48 + 159 * ((k / 1.618033988749895 | 0) % 2);
13527
+ bb = 48 + 159 * ((k / 2.618033988749895 | 0) % 2);
13528
+ }
13529
+ dr = (r1 * a1 - r2 * a2 - rb * da) / 255;
13530
+ dg = (g1 * a1 - g2 * a2 - gb * da) / 255;
13531
+ db = (b1 * a1 - b2 * a2 - bb * da) / 255;
13532
+ }
13533
+ return dr * 0.29889531 + dg * 0.58662247 + db * 0.11448223;
13534
+ }
13509
13535
  function drawPixel(output, pos, r, g, b) {
13510
- output[pos + 0] = r;
13536
+ output[pos] = r;
13511
13537
  output[pos + 1] = g;
13512
13538
  output[pos + 2] = b;
13513
13539
  output[pos + 3] = 255;
@@ -13965,4 +13991,4 @@ export {
13965
13991
  assertSafeUpdateMode
13966
13992
  };
13967
13993
 
13968
- //# debugId=5C6BB1754AE9201464756E2164756E21
13994
+ //# debugId=A8F0CA1BEDC12C8F64756E2164756E21