@mizchi/vlmkit-core 0.23.2 → 0.28.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 (112) hide show
  1. package/dist/a11y-semantic.d.mts +6 -10
  2. package/dist/a11y-semantic.mjs +3 -4
  3. package/dist/animated-image.d.mts +27 -0
  4. package/dist/animated-image.mjs +112 -0
  5. package/dist/apng.d.mts +5 -9
  6. package/dist/apng.mjs +6 -7
  7. package/dist/arg-reader.d.mts +9 -12
  8. package/dist/arg-reader.mjs +1 -2
  9. package/dist/auth-state.d.mts +6 -9
  10. package/dist/auth-state.mjs +1 -2
  11. package/dist/authored-style-capture.d.mts +7 -10
  12. package/dist/authored-style-capture.mjs +1 -2
  13. package/dist/authored-style-diff.d.mts +8 -12
  14. package/dist/authored-style-diff.mjs +1 -2
  15. package/dist/bitmap-font.d.mts +7 -10
  16. package/dist/bitmap-font.mjs +1 -2
  17. package/dist/browser-launch.d.mts +7 -11
  18. package/dist/browser-launch.mjs +1 -2
  19. package/dist/cli-args.d.mts +8 -11
  20. package/dist/cli-args.mjs +1 -2
  21. package/dist/cli-error.d.mts +10 -13
  22. package/dist/cli-error.mjs +2 -3
  23. package/dist/computed-style-capture.d.mts +20 -23
  24. package/dist/computed-style-capture.mjs +4 -5
  25. package/dist/computed-style-diff.d.mts +8 -11
  26. package/dist/computed-style-diff.mjs +2 -3
  27. package/dist/diff-regions.d.mts +3 -7
  28. package/dist/diff-regions.mjs +1 -2
  29. package/dist/dom-equivalence.d.mts +5 -8
  30. package/dist/dom-equivalence.mjs +1 -2
  31. package/dist/dom-position-styles.d.mts +14 -15
  32. package/dist/dom-position-styles.mjs +4 -5
  33. package/dist/element-compare.d.mts +8 -9
  34. package/dist/element-compare.mjs +5 -5
  35. package/dist/filmstrip.d.mts +60 -9
  36. package/dist/filmstrip.mjs +83 -12
  37. package/dist/gate-config.d.mts +18 -22
  38. package/dist/gate-config.mjs +8 -4
  39. package/dist/gate-exit.d.mts +5 -8
  40. package/dist/gate-exit.mjs +1 -2
  41. package/dist/gif.d.mts +41 -0
  42. package/dist/gif.mjs +73 -0
  43. package/dist/heatmap-regions.d.mts +4 -7
  44. package/dist/heatmap-regions.mjs +1 -2
  45. package/dist/heatmap.d.mts +21 -17
  46. package/dist/heatmap.mjs +23 -11
  47. package/dist/image-resize.d.mts +9 -12
  48. package/dist/image-resize.mjs +1 -2
  49. package/dist/image-timing.d.mts +57 -0
  50. package/dist/image-timing.mjs +166 -0
  51. package/dist/index.d.mts +14 -14
  52. package/dist/index.mjs +11 -11
  53. package/dist/mask.d.mts +5 -9
  54. package/dist/mask.mjs +1 -2
  55. package/dist/motion-spec.d.mts +97 -0
  56. package/dist/motion-spec.mjs +145 -0
  57. package/dist/navigation-redirect.d.mts +1 -4
  58. package/dist/navigation-redirect.mjs +1 -2
  59. package/dist/page-load.d.mts +40 -16
  60. package/dist/page-load.mjs +34 -5
  61. package/dist/page-open.d.mts +15 -15
  62. package/dist/page-open.mjs +4 -3
  63. package/dist/plugin/args.d.mts +16 -12
  64. package/dist/plugin/args.mjs +15 -4
  65. package/dist/plugin/browser.d.mts +3 -3
  66. package/dist/plugin/browser.mjs +2 -2
  67. package/dist/plugin/cli-entry.d.mts +1 -4
  68. package/dist/plugin/cli-entry.mjs +1 -2
  69. package/dist/plugin/contract.d.mts +17 -21
  70. package/dist/plugin/contract.mjs +1 -2
  71. package/dist/plugin/index.d.mts +6 -9
  72. package/dist/plugin/index.mjs +7 -8
  73. package/dist/plugin/load.d.mts +7 -11
  74. package/dist/plugin/load.mjs +1 -2
  75. package/dist/plugin/registry.d.mts +8 -12
  76. package/dist/plugin/registry.mjs +1 -2
  77. package/dist/plugin/rule-prose.d.mts +4 -8
  78. package/dist/plugin/rule-prose.mjs +1 -2
  79. package/dist/plugin/rule-tier.d.mts +7 -11
  80. package/dist/plugin/rule-tier.mjs +1 -2
  81. package/dist/plugin/rules.d.mts +18 -22
  82. package/dist/plugin/rules.mjs +1 -2
  83. package/dist/plugin/runner.d.mts +18 -21
  84. package/dist/plugin/runner.mjs +55 -6
  85. package/dist/png-decode.d.mts +17 -0
  86. package/dist/png-decode.mjs +160 -0
  87. package/dist/png-utils.d.mts +7 -10
  88. package/dist/png-utils.mjs +3 -3
  89. package/dist/project-config.d.mts +7 -10
  90. package/dist/project-config.mjs +1 -2
  91. package/dist/rect-overlap.d.mts +3 -6
  92. package/dist/rect-overlap.mjs +1 -2
  93. package/dist/region-shift.d.mts +3 -6
  94. package/dist/region-shift.mjs +1 -2
  95. package/dist/run-ledger.d.mts +10 -13
  96. package/dist/run-ledger.mjs +4 -4
  97. package/dist/stable-selector.d.mts +1 -4
  98. package/dist/stable-selector.mjs +1 -2
  99. package/dist/terminal-colors.d.mts +8 -11
  100. package/dist/terminal-colors.mjs +1 -2
  101. package/dist/text-rows.d.mts +10 -13
  102. package/dist/text-rows.mjs +1 -2
  103. package/dist/types.d.mts +87 -64
  104. package/dist/version.d.mts +1 -4
  105. package/dist/version.mjs +2 -3
  106. package/dist/video-decode.d.mts +144 -0
  107. package/dist/video-decode.mjs +939 -0
  108. package/dist/video-frames.d.mts +310 -0
  109. package/dist/video-frames.mjs +576 -0
  110. package/dist/webp.d.mts +7 -11
  111. package/dist/webp.mjs +3 -3
  112. package/package.json +7 -7
@@ -1,20 +1,19 @@
1
- //#region src/cli-args.d.ts
2
- declare function getArg(name: string, fallback: string): string;
3
- declare function getArg(name: string): string | undefined;
1
+ export declare function getArg(name: string, fallback: string): string;
2
+ export declare function getArg(name: string): string | undefined;
4
3
  /**
5
4
  * Numeric flags, validated. Callers used to write `parseInt(getArg(n, d), 10)`,
6
5
  * which is where a bad value became `NaN` — far from the flag that caused it.
7
6
  */
8
- declare function getIntArg(name: string, fallback: number, options?: {
7
+ export declare function getIntArg(name: string, fallback: number, options?: {
9
8
  min?: number;
10
9
  max?: number;
11
10
  }): number;
12
- declare function getFloatArg(name: string, fallback: number, options?: {
11
+ export declare function getFloatArg(name: string, fallback: number, options?: {
13
12
  min?: number;
14
13
  max?: number;
15
14
  }): number;
16
- declare function hasFlag(name: string): boolean;
17
- declare function getArgValues(name: string): string[];
15
+ export declare function hasFlag(name: string): boolean;
16
+ export declare function getArgValues(name: string): string[];
18
17
  /**
19
18
  * Positional arguments.
20
19
  *
@@ -23,8 +22,6 @@ declare function getArgValues(name: string): string[];
23
22
  * implementation assumed *every* flag takes a value, which silently dropped a
24
23
  * positional that happened to follow a boolean flag.
25
24
  */
26
- declare function getPositionalArgs(valueFlags?: readonly string[]): string[];
25
+ export declare function getPositionalArgs(valueFlags?: readonly string[]): string[];
27
26
  /** Raw argv tail, for callers doing their own scanning. */
28
- declare function getRawArgs(): string[];
29
- //#endregion
30
- export { getArg, getArgValues, getFloatArg, getIntArg, getPositionalArgs, getRawArgs, hasFlag };
27
+ export declare function getRawArgs(): string[];
package/dist/cli-args.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { hasFlag as hasFlag$1, readAll, readFlag, readNumber, readPositionals } from "./arg-reader.mjs";
2
- //#region src/cli-args.ts
2
+ // src/cli-args.ts
3
3
  /**
4
4
  * Shared CLI argument helpers, kept as the ergonomic `process.argv`-bound
5
5
  * facade over `arg-reader.ts`.
@@ -54,5 +54,4 @@ function getPositionalArgs(valueFlags = []) {
54
54
  function getRawArgs() {
55
55
  return argv();
56
56
  }
57
- //#endregion
58
57
  export { getArg, getArgValues, getFloatArg, getIntArg, getPositionalArgs, getRawArgs, hasFlag };
@@ -1,6 +1,4 @@
1
1
  import { UsageError } from "@mizchi/vlmkit-judge/errors.ts";
2
-
3
- //#region src/cli-error.d.ts
4
2
  /**
5
3
  * The `playwright` peer range. Duplicated from this package's own
6
4
  * `peerDependencies` because the shipped bundle has no reliable path back to
@@ -9,9 +7,9 @@ import { UsageError } from "@mizchi/vlmkit-judge/errors.ts";
9
7
  * the manifest and fails if the two drift, so the duplication cannot rot
10
8
  * silently.
11
9
  */
12
- declare const PLAYWRIGHT_PEER_RANGE = ">=1.61 <2";
10
+ export declare const PLAYWRIGHT_PEER_RANGE = ">=1.61 <2";
13
11
  /** Playwright install target: which `playwright` *this* process resolved. */
14
- interface PlaywrightInstallTarget {
12
+ export interface PlaywrightInstallTarget {
15
13
  version: string;
16
14
  /** Directory of the resolved `playwright` package — the identity the reporter of #112 could not see. */
17
15
  packageDir: string;
@@ -42,10 +40,10 @@ declare function resolvePlaywrightInstallTarget(): PlaywrightInstallTarget | nul
42
40
  * `chromium`: `playwright install chromium` fetches the headless shell as well
43
41
  * (verified against the 1.61.1 CLI, which lists both under that one name).
44
42
  */
45
- declare function playwrightEngineFromLaunchError(message: string): "chromium" | "firefox" | "webkit";
43
+ export declare function playwrightEngineFromLaunchError(message: string): "chromium" | "firefox" | "webkit";
46
44
  /** `node <resolved playwright>/cli.js install <engine>` — quoted for a shell. */
47
- declare function playwrightInstallCommand(target: PlaywrightInstallTarget, engine?: "chromium" | "firefox" | "webkit"): string;
48
- declare function formatMissingPlaywrightBrowserError(error: unknown, target?: PlaywrightInstallTarget | null): string | null;
45
+ export declare function playwrightInstallCommand(target: PlaywrightInstallTarget, engine?: "chromium" | "firefox" | "webkit"): string;
46
+ export declare function formatMissingPlaywrightBrowserError(error: unknown, target?: PlaywrightInstallTarget | null): string | null;
49
47
  /**
50
48
  * `playwright` absent entirely, rather than present-but-browserless.
51
49
  *
@@ -57,13 +55,13 @@ declare function formatMissingPlaywrightBrowserError(error: unknown, target?: Pl
57
55
  * the package removed, `vlmkit diff png --help` dies with ERR_MODULE_NOT_FOUND
58
56
  * before printing usage. That raw stack is what this turns into one sentence.
59
57
  */
60
- declare function formatMissingPlaywrightModuleError(error: unknown): string | null;
58
+ export declare function formatMissingPlaywrightModuleError(error: unknown): string | null;
61
59
  /**
62
60
  * Best-effort sanity check used by tests: does the resolved playwright actually
63
61
  * have a `cli.js` to invoke? Kept exported so the happy-path test can assert the
64
62
  * command we print is runnable rather than merely well-formed.
65
63
  */
66
- declare function resolvedPlaywrightHasCli(): boolean;
64
+ export declare function resolvedPlaywrightHasCli(): boolean;
67
65
  /**
68
66
  * The one-line diagnosis for an error, or `null` when there isn't one.
69
67
  *
@@ -78,7 +76,6 @@ declare function resolvedPlaywrightHasCli(): boolean;
78
76
  * reach the developer whole, stack and all. A prettifier that invents a summary
79
77
  * for everything is worse than one that admits it has nothing to add.
80
78
  */
81
- declare function formatCliError(e: unknown): string | null;
82
- declare function handleCliError(e: unknown): never;
83
- //#endregion
84
- export { PLAYWRIGHT_PEER_RANGE, PlaywrightInstallTarget, UsageError, formatCliError, formatMissingPlaywrightBrowserError, formatMissingPlaywrightModuleError, handleCliError, playwrightEngineFromLaunchError, playwrightInstallCommand, resolvePlaywrightInstallTarget, resolvedPlaywrightHasCli };
79
+ export declare function formatCliError(e: unknown): string | null;
80
+ export declare function handleCliError(e: unknown): never;
81
+ export { UsageError, resolvePlaywrightInstallTarget };
@@ -3,7 +3,7 @@ import { existsSync, readFileSync, statSync } from "node:fs";
3
3
  import { dirname, join } from "node:path";
4
4
  import { fileURLToPath } from "node:url";
5
5
  import { UsageError } from "@mizchi/vlmkit-judge/errors.ts";
6
- //#region src/cli-error.ts
6
+ // src/cli-error.ts
7
7
  /**
8
8
  * Shared CLI error-prettifier. Recognizes common error shapes that
9
9
  * make `vlmkit` look user-hostile (ENOENT stack traces, Playwright
@@ -14,7 +14,7 @@ import { UsageError } from "@mizchi/vlmkit-judge/errors.ts";
14
14
  * main().catch(handleCliError);
15
15
  *
16
16
  * Every CLI entry must go through it, *including* `scripts/vlmkit-bundled.mjs`
17
- * — that is the one `tsdown.config.ts` builds into the published `bin`. It used
17
+ * — that is the one `vite.config.ts`'s `pack` block builds into the published `bin`. It used
18
18
  * to `console.error(error)` instead, which made everything below dead code in
19
19
  * the shipped CLI while it kept working in the workspace (issue #112, item 2).
20
20
  * `tests/playwright-peer-contract.test.mjs` guards that.
@@ -228,5 +228,4 @@ function findDirectoryArg() {
228
228
  } catch {}
229
229
  }
230
230
  }
231
- //#endregion
232
231
  export { PLAYWRIGHT_PEER_RANGE, UsageError, formatCliError, formatMissingPlaywrightBrowserError, formatMissingPlaywrightModuleError, handleCliError, playwrightEngineFromLaunchError, playwrightInstallCommand, resolvePlaywrightInstallTarget, resolvedPlaywrightHasCli };
@@ -1,9 +1,8 @@
1
- //#region src/computed-style-capture.d.ts
2
- type ComputedStyleSnapshot = Record<string, Record<string, string>>;
3
- type InteractionType = "hover" | "focus" | "active";
1
+ export type ComputedStyleSnapshot = Record<string, Record<string, string>>;
2
+ export type InteractionType = "hover" | "focus" | "active";
4
3
  /** Pseudo-class state names that CDP `CSS.forcePseudoState` accepts. */
5
- type ForcedPseudoState = "hover" | "focus" | "focus-visible" | "focus-within" | "active";
6
- interface InteractionTargetPlan {
4
+ export type ForcedPseudoState = "hover" | "focus" | "focus-visible" | "focus-within" | "active";
5
+ export interface InteractionTargetPlan {
7
6
  selector: string;
8
7
  normalizedSelector: string;
9
8
  /**
@@ -18,24 +17,22 @@ interface InteractionTargetPlan {
18
17
  */
19
18
  forcedStates: ForcedPseudoState[];
20
19
  }
21
- declare const TRACKED_PROPERTIES: string[];
22
- declare function normalizeInteractionSelector(selector: string): string;
23
- declare function buildInteractionTargetPlans(selectors: string[]): InteractionTargetPlan[];
24
- declare function selectInteractionFallbackPlans(plans: InteractionTargetPlan[], emulatedSnapshotMeaningful: boolean): InteractionTargetPlan[];
25
- declare function mergeComputedStyleSnapshots(...snapshots: ComputedStyleSnapshot[]): ComputedStyleSnapshot;
26
- declare function captureComputedStyleSnapshotInDom(props: string[]): ComputedStyleSnapshot;
27
- declare function captureComputedStyleSnapshotForTargetSelectorsInDom(input: {
20
+ export declare const TRACKED_PROPERTIES: string[];
21
+ export declare function normalizeInteractionSelector(selector: string): string;
22
+ export declare function buildInteractionTargetPlans(selectors: string[]): InteractionTargetPlan[];
23
+ export declare function selectInteractionFallbackPlans(plans: InteractionTargetPlan[], emulatedSnapshotMeaningful: boolean): InteractionTargetPlan[];
24
+ export declare function mergeComputedStyleSnapshots(...snapshots: ComputedStyleSnapshot[]): ComputedStyleSnapshot;
25
+ export declare function captureComputedStyleSnapshotInDom(props: string[]): ComputedStyleSnapshot;
26
+ export declare function captureComputedStyleSnapshotForTargetSelectorsInDom(input: {
28
27
  props: string[];
29
28
  selectors: string[];
30
29
  }): ComputedStyleSnapshot;
31
- declare function collectInteractionTargetPlansInDom(): InteractionTargetPlan[];
32
- declare function waitForInteractionStylesInDom(): Promise<void>;
33
- declare function captureEmulatedInteractionStyleSnapshotInDom(props: string[]): Promise<ComputedStyleSnapshot>;
34
- declare function computedStyleSnapshotToMap(snapshot: ComputedStyleSnapshot): Map<string, Record<string, string>>;
35
- declare const ESBUILD_NAME_POLYFILL = "var __name = typeof __name !== 'undefined' ? __name : function(fn) { return fn; };";
36
- declare function buildComputedStyleCaptureExpression(props?: string[]): string;
37
- declare function buildComputedStyleCaptureJsonExpression(props?: string[]): string;
38
- declare function parseComputedStyleSnapshot(value: unknown): ComputedStyleSnapshot;
39
- declare function hasMeaningfulComputedStyleSnapshot(snapshot: ComputedStyleSnapshot): boolean;
40
- //#endregion
41
- export { ComputedStyleSnapshot, ESBUILD_NAME_POLYFILL, ForcedPseudoState, InteractionTargetPlan, InteractionType, TRACKED_PROPERTIES, buildComputedStyleCaptureExpression, buildComputedStyleCaptureJsonExpression, buildInteractionTargetPlans, captureComputedStyleSnapshotForTargetSelectorsInDom, captureComputedStyleSnapshotInDom, captureEmulatedInteractionStyleSnapshotInDom, collectInteractionTargetPlansInDom, computedStyleSnapshotToMap, hasMeaningfulComputedStyleSnapshot, mergeComputedStyleSnapshots, normalizeInteractionSelector, parseComputedStyleSnapshot, selectInteractionFallbackPlans, waitForInteractionStylesInDom };
30
+ export declare function collectInteractionTargetPlansInDom(): InteractionTargetPlan[];
31
+ export declare function waitForInteractionStylesInDom(): Promise<void>;
32
+ export declare function captureEmulatedInteractionStyleSnapshotInDom(props: string[]): Promise<ComputedStyleSnapshot>;
33
+ export declare function computedStyleSnapshotToMap(snapshot: ComputedStyleSnapshot): Map<string, Record<string, string>>;
34
+ export declare const ESBUILD_NAME_POLYFILL = "var __name = typeof __name !== 'undefined' ? __name : function(fn) { return fn; };";
35
+ export declare function buildComputedStyleCaptureExpression(props?: string[]): string;
36
+ export declare function buildComputedStyleCaptureJsonExpression(props?: string[]): string;
37
+ export declare function parseComputedStyleSnapshot(value: unknown): ComputedStyleSnapshot;
38
+ export declare function hasMeaningfulComputedStyleSnapshot(snapshot: ComputedStyleSnapshot): boolean;
@@ -1,4 +1,4 @@
1
- //#region src/computed-style-capture.ts
1
+ // src/computed-style-capture.ts
2
2
  const FORCED_PSEUDO_REGEX = /:(focus-visible|focus-within|focus|hover|active)\b/g;
3
3
  function extractForcedStates(selector) {
4
4
  const states = [];
@@ -129,7 +129,7 @@ function mergeComputedStyleSnapshots(...snapshots) {
129
129
  }
130
130
  function captureComputedStyleSnapshotInDom(props) {
131
131
  const results = {};
132
- const semanticTags = new Set([
132
+ const semanticTags = /* @__PURE__ */ new Set([
133
133
  "main",
134
134
  "nav",
135
135
  "header",
@@ -260,7 +260,7 @@ function captureComputedStyleSnapshotInDom(props) {
260
260
  function captureComputedStyleSnapshotForTargetSelectorsInDom(input) {
261
261
  const { props, selectors } = input;
262
262
  const results = {};
263
- const semanticTags = new Set([
263
+ const semanticTags = /* @__PURE__ */ new Set([
264
264
  "main",
265
265
  "nav",
266
266
  "header",
@@ -414,7 +414,7 @@ async function waitForInteractionStylesInDom() {
414
414
  }
415
415
  async function captureEmulatedInteractionStyleSnapshotInDom(props) {
416
416
  const results = {};
417
- const semanticTags = new Set([
417
+ const semanticTags = /* @__PURE__ */ new Set([
418
418
  "main",
419
419
  "nav",
420
420
  "header",
@@ -585,5 +585,4 @@ function safeJsonParse(value) {
585
585
  function isRecord(value) {
586
586
  return typeof value === "object" && value !== null && !Array.isArray(value);
587
587
  }
588
- //#endregion
589
588
  export { ESBUILD_NAME_POLYFILL, TRACKED_PROPERTIES, buildComputedStyleCaptureExpression, buildComputedStyleCaptureJsonExpression, buildInteractionTargetPlans, captureComputedStyleSnapshotForTargetSelectorsInDom, captureComputedStyleSnapshotInDom, captureEmulatedInteractionStyleSnapshotInDom, collectInteractionTargetPlansInDom, computedStyleSnapshotToMap, hasMeaningfulComputedStyleSnapshot, mergeComputedStyleSnapshots, normalizeInteractionSelector, parseComputedStyleSnapshot, selectInteractionFallbackPlans, waitForInteractionStylesInDom };
@@ -1,13 +1,11 @@
1
1
  import { ComputedStyleSnapshot } from "./computed-style-capture.mjs";
2
-
3
- //#region src/computed-style-diff.d.ts
4
- interface CsdEntry {
2
+ export interface CsdEntry {
5
3
  selector: string;
6
4
  property: string;
7
5
  baseline: string;
8
6
  variant: string;
9
7
  }
10
- interface CsdResult {
8
+ export interface CsdResult {
11
9
  /** Per-(selector, property) differences. */
12
10
  entries: CsdEntry[];
13
11
  /** Total differing (selector, property) pairs. */
@@ -26,19 +24,19 @@ interface CsdResult {
26
24
  selectorsOnlyInBaseline: string[];
27
25
  selectorsOnlyInVariant: string[];
28
26
  }
29
- interface CsdPerViewportSample {
27
+ export interface CsdPerViewportSample {
30
28
  viewport: string;
31
29
  baseline: string;
32
30
  variant: string;
33
31
  }
34
- interface CsdPerViewportEntry {
32
+ export interface CsdPerViewportEntry {
35
33
  selector: string;
36
34
  property: string;
37
35
  /** Viewports on which this (selector, property) pair differs. */
38
36
  viewports: string[];
39
37
  samples: CsdPerViewportSample[];
40
38
  }
41
- interface CsdPerViewportResult {
39
+ export interface CsdPerViewportResult {
42
40
  /** Total (selector, property, viewport) tuples — i.e. Σ per-viewport counts. */
43
41
  totalDiffs: number;
44
42
  byViewport: Array<{
@@ -69,7 +67,7 @@ interface CsdPerViewportResult {
69
67
  * which is the same order migration-compare captures viewports (small →
70
68
  * large or whatever the caller chose).
71
69
  */
72
- declare function aggregateCsdByViewport(perViewport: ReadonlyArray<{
70
+ export declare function aggregateCsdByViewport(perViewport: ReadonlyArray<{
73
71
  viewport: string;
74
72
  result: CsdResult;
75
73
  }>): CsdPerViewportResult;
@@ -78,6 +76,5 @@ declare function aggregateCsdByViewport(perViewport: ReadonlyArray<{
78
76
  * `Record<selector, Record<property, value>>`; produced by
79
77
  * `captureComputedStyleSnapshotInDom`.
80
78
  */
81
- declare function diffComputedStyles(baseline: ComputedStyleSnapshot, variant: ComputedStyleSnapshot): CsdResult;
82
- //#endregion
83
- export { type ComputedStyleSnapshot, CsdEntry, CsdPerViewportEntry, CsdPerViewportResult, CsdPerViewportSample, CsdResult, aggregateCsdByViewport, diffComputedStyles };
79
+ export declare function diffComputedStyles(baseline: ComputedStyleSnapshot, variant: ComputedStyleSnapshot): CsdResult;
80
+ export type { ComputedStyleSnapshot };
@@ -1,4 +1,4 @@
1
- //#region src/computed-style-diff.ts
1
+ // src/computed-style-diff.ts
2
2
  /**
3
3
  * Roll up N per-viewport CSD results into a single per-viewport report,
4
4
  * surfacing which pairs apply universally vs. which are breakpoint-gated.
@@ -82,7 +82,7 @@ function diffComputedStyles(baseline, variant) {
82
82
  for (const selector of shared) {
83
83
  const b = baseline[selector] ?? {};
84
84
  const v = variant[selector] ?? {};
85
- const props = new Set([...Object.keys(b), ...Object.keys(v)]);
85
+ const props = /* @__PURE__ */ new Set([...Object.keys(b), ...Object.keys(v)]);
86
86
  for (const property of props) {
87
87
  const bv = b[property] ?? "";
88
88
  const vv = v[property] ?? "";
@@ -119,5 +119,4 @@ function diffComputedStyles(baseline, variant) {
119
119
  selectorsOnlyInVariant
120
120
  };
121
121
  }
122
- //#endregion
123
122
  export { aggregateCsdByViewport, diffComputedStyles };
@@ -1,8 +1,4 @@
1
1
  import { DiffRegion, VrtDiff } from "./types.mjs";
2
-
3
- //#region src/diff-regions.d.ts
4
- declare function normalizeVrtDiffRegions(diff: VrtDiff): DiffRegion[];
5
- declare function normalizeVrtDiffRegionPixels(diff: VrtDiff): number[];
6
- declare function createScopedVrtDiff(diff: VrtDiff, region: DiffRegion): VrtDiff;
7
- //#endregion
8
- export { createScopedVrtDiff, normalizeVrtDiffRegionPixels, normalizeVrtDiffRegions };
2
+ export declare function normalizeVrtDiffRegions(diff: VrtDiff): DiffRegion[];
3
+ export declare function normalizeVrtDiffRegionPixels(diff: VrtDiff): number[];
4
+ export declare function createScopedVrtDiff(diff: VrtDiff, region: DiffRegion): VrtDiff;
@@ -1,4 +1,4 @@
1
- //#region src/diff-regions.ts
1
+ // src/diff-regions.ts
2
2
  function normalizeVrtDiffRegions(diff) {
3
3
  const normalizedPixels = normalizeVrtDiffRegionPixels(diff);
4
4
  return diff.regions.map((region, index) => ({
@@ -48,5 +48,4 @@ function distributeEvenly(total, count) {
48
48
  return base;
49
49
  });
50
50
  }
51
- //#endregion
52
51
  export { createScopedVrtDiff, normalizeVrtDiffRegionPixels, normalizeVrtDiffRegions };
@@ -1,4 +1,3 @@
1
- //#region src/dom-equivalence.d.ts
2
1
  /**
3
2
  * DOM equivalence preflight for `migration-compare`.
4
3
  *
@@ -16,19 +15,19 @@
16
15
  * here; migration-compare evaluates the script with `page.evaluate()`
17
16
  * and feeds the results into `verifyDomEquivalence`.
18
17
  */
19
- interface DomFingerprint {
18
+ export interface DomFingerprint {
20
19
  headingTexts: string[];
21
20
  buttonTexts: string[];
22
21
  inputValues: string[];
23
22
  elementCount: number;
24
23
  }
25
- interface DomEquivalenceWarning {
24
+ export interface DomEquivalenceWarning {
26
25
  code: "heading-mismatch" | "button-mismatch" | "input-mismatch" | "element-count-mismatch";
27
26
  message: string;
28
27
  baseline: string[];
29
28
  variant: string[];
30
29
  }
31
- interface DomEquivalenceResult {
30
+ export interface DomEquivalenceResult {
32
31
  ok: boolean;
33
32
  warnings: DomEquivalenceWarning[];
34
33
  }
@@ -36,11 +35,9 @@ interface DomEquivalenceResult {
36
35
  * Verify structural DOM equivalence between two captured fingerprints.
37
36
  *
38
37
  */
39
- declare function verifyDomEquivalence(baseline: DomFingerprint, variant: DomFingerprint): DomEquivalenceResult;
38
+ export declare function verifyDomEquivalence(baseline: DomFingerprint, variant: DomFingerprint): DomEquivalenceResult;
40
39
  /**
41
40
  * Browser-side capture script. Designed to be passed verbatim to
42
41
  * `page.evaluate()`; produces a {@link DomFingerprint}.
43
42
  */
44
- declare const DOM_FINGERPRINT_BROWSER_SCRIPT = "(() => {\n const norm = (s) => (s || \"\").replace(/\\s+/g, \" \").trim();\n const headingTexts = Array.from(document.querySelectorAll(\"h1, h2, h3, h4, h5, h6\")).map((el) => norm(el.textContent));\n const buttonTexts = Array.from(document.querySelectorAll(\"button\")).map((el) => norm(el.textContent));\n const inputValues = Array.from(document.querySelectorAll(\"input, textarea, select\")).map((el) => {\n const v = el.value != null ? el.value : el.getAttribute(\"value\") || \"\";\n return norm(v);\n });\n const elementCount = document.querySelectorAll(\"*\").length;\n return { headingTexts, buttonTexts, inputValues, elementCount };\n})()";
45
- //#endregion
46
- export { DOM_FINGERPRINT_BROWSER_SCRIPT, DomEquivalenceResult, DomEquivalenceWarning, DomFingerprint, verifyDomEquivalence };
43
+ export declare const DOM_FINGERPRINT_BROWSER_SCRIPT = "(() => {\n const norm = (s) => (s || \"\").replace(/\\s+/g, \" \").trim();\n const headingTexts = Array.from(document.querySelectorAll(\"h1, h2, h3, h4, h5, h6\")).map((el) => norm(el.textContent));\n const buttonTexts = Array.from(document.querySelectorAll(\"button\")).map((el) => norm(el.textContent));\n const inputValues = Array.from(document.querySelectorAll(\"input, textarea, select\")).map((el) => {\n const v = el.value != null ? el.value : el.getAttribute(\"value\") || \"\";\n return norm(v);\n });\n const elementCount = document.querySelectorAll(\"*\").length;\n return { headingTexts, buttonTexts, inputValues, elementCount };\n})()";
@@ -1,4 +1,4 @@
1
- //#region src/dom-equivalence.ts
1
+ // src/dom-equivalence.ts
2
2
  function normalize(s) {
3
3
  return s.replace(/\s+/g, " ").trim();
4
4
  }
@@ -82,5 +82,4 @@ const DOM_FINGERPRINT_BROWSER_SCRIPT = `(() => {
82
82
  const elementCount = document.querySelectorAll("*").length;
83
83
  return { headingTexts, buttonTexts, inputValues, elementCount };
84
84
  })()`;
85
- //#endregion
86
85
  export { DOM_FINGERPRINT_BROWSER_SCRIPT, verifyDomEquivalence };
@@ -1,4 +1,3 @@
1
- //#region src/dom-position-styles.d.ts
2
1
  /**
3
2
  * DOM-position-based selector alignment for migration diffs.
4
3
  *
@@ -19,7 +18,7 @@
19
18
  * Pure module. The browser-side capture script ships as a string fed
20
19
  * to `page.evaluate()`.
21
20
  */
22
- interface PositionedElement {
21
+ export interface PositionedElement {
23
22
  /** DOM path: `tag[childIndex]>tag[childIndex]>...` rooted at body. */
24
23
  path: string;
25
24
  /** Tag name (lower-case). */
@@ -35,7 +34,7 @@ interface PositionedElement {
35
34
  */
36
35
  parentDisplay?: string;
37
36
  }
38
- interface DpEntry {
37
+ export interface DpEntry {
39
38
  path: string;
40
39
  tag: string;
41
40
  baselineClasses: string;
@@ -59,11 +58,12 @@ interface DpEntry {
59
58
  */
60
59
  parentDisplayContext?: {
61
60
  baselineParent: string;
62
- variantParent: string; /** True when at least one parent is flex/grid/inline-flex/inline-grid. */
61
+ variantParent: string;
62
+ /** True when at least one parent is flex/grid/inline-flex/inline-grid. */
63
63
  isFlexOrGridItem: boolean;
64
64
  };
65
65
  }
66
- interface DpResult {
66
+ export interface DpResult {
67
67
  entries: DpEntry[];
68
68
  totalDiffs: number;
69
69
  /** path strings that appear only in one side (DOM structure drift). */
@@ -81,7 +81,7 @@ interface DpResult {
81
81
  count: number;
82
82
  }>;
83
83
  }
84
- declare function diffDomPositionStyles(baseline: PositionedElement[], variant: PositionedElement[]): DpResult;
84
+ export declare function diffDomPositionStyles(baseline: PositionedElement[], variant: PositionedElement[]): DpResult;
85
85
  /**
86
86
  * Browser-side capture script: walks the DOM from `<body>`, emits
87
87
  * `{path, tag, classes, styles}` for every element that has a class
@@ -89,12 +89,12 @@ declare function diffDomPositionStyles(baseline: PositionedElement[], variant: P
89
89
  * `path` uses 0-based child indices among ALL children, so it's stable
90
90
  * across class renames as long as the tree shape is the same.
91
91
  */
92
- declare const DOM_POSITION_STYLES_BROWSER_SCRIPT: string;
93
- declare function parseDomPositionStyles(value: unknown): PositionedElement[];
94
- interface DpEntryWithViewport extends DpEntry {
92
+ export declare const DOM_POSITION_STYLES_BROWSER_SCRIPT: string;
93
+ export declare function parseDomPositionStyles(value: unknown): PositionedElement[];
94
+ export interface DpEntryWithViewport extends DpEntry {
95
95
  viewport: string;
96
96
  }
97
- interface DpSample {
97
+ export interface DpSample {
98
98
  viewport: string;
99
99
  baseline: string;
100
100
  variant: string;
@@ -102,7 +102,7 @@ interface DpSample {
102
102
  baselineEm?: number;
103
103
  variantEm?: number;
104
104
  }
105
- interface DpPerViewportResult {
105
+ export interface DpPerViewportResult {
106
106
  /** All per-viewport diff tuples (entries[i] carries its viewport). */
107
107
  entries: DpEntryWithViewport[];
108
108
  /** Total tuples across all viewports (before any caller-side cap). */
@@ -126,7 +126,8 @@ interface DpPerViewportResult {
126
126
  baselineClasses: string;
127
127
  variantClasses: string;
128
128
  viewports: string[];
129
- samples: DpSample[]; /** Set on `display`-property pairs when at least one parent is flex/grid. */
129
+ samples: DpSample[];
130
+ /** Set on `display`-property pairs when at least one parent is flex/grid. */
130
131
  parentDisplayContext?: {
131
132
  baselineParent: string;
132
133
  variantParent: string;
@@ -161,6 +162,4 @@ interface DpPerViewportResult {
161
162
  * "this delta appears at every viewport" vs "this delta only appears at
162
163
  * mobile" (the latter usually means a missing or wrong media query).
163
164
  */
164
- declare function diffPositionStylesAcrossViewports(baselineByVp: Map<string, PositionedElement[]> | Record<string, PositionedElement[]>, variantByVp: Map<string, PositionedElement[]> | Record<string, PositionedElement[]>): DpPerViewportResult;
165
- //#endregion
166
- export { DOM_POSITION_STYLES_BROWSER_SCRIPT, DpEntry, DpEntryWithViewport, DpPerViewportResult, DpResult, DpSample, PositionedElement, diffDomPositionStyles, diffPositionStylesAcrossViewports, parseDomPositionStyles };
165
+ export declare function diffPositionStylesAcrossViewports(baselineByVp: Map<string, PositionedElement[]> | Record<string, PositionedElement[]>, variantByVp: Map<string, PositionedElement[]> | Record<string, PositionedElement[]>): DpPerViewportResult;
@@ -1,5 +1,5 @@
1
1
  import { TRACKED_PROPERTIES } from "./computed-style-capture.mjs";
2
- //#region src/dom-position-styles.ts
2
+ // src/dom-position-styles.ts
3
3
  /**
4
4
  * DOM-position-based selector alignment for migration diffs.
5
5
  *
@@ -21,13 +21,13 @@ import { TRACKED_PROPERTIES } from "./computed-style-capture.mjs";
21
21
  * to `page.evaluate()`.
22
22
  */
23
23
  /** Properties for which em-normalization is informative. */
24
- const EM_RELATIVE = new Set([
24
+ const EM_RELATIVE = /* @__PURE__ */ new Set([
25
25
  "letter-spacing",
26
26
  "word-spacing",
27
27
  "line-height"
28
28
  ]);
29
29
  /** Parent `display` values that coerce inline children to block-ish layouts. */
30
- const FLEX_OR_GRID_DISPLAYS = new Set([
30
+ const FLEX_OR_GRID_DISPLAYS = /* @__PURE__ */ new Set([
31
31
  "flex",
32
32
  "inline-flex",
33
33
  "grid",
@@ -69,7 +69,7 @@ function diffDomPositionStyles(baseline, variant) {
69
69
  const b = baselineMap.get(path);
70
70
  const v = variantMap.get(path);
71
71
  if (b.tag !== v.tag) continue;
72
- const props = new Set([...Object.keys(b.styles), ...Object.keys(v.styles)]);
72
+ const props = /* @__PURE__ */ new Set([...Object.keys(b.styles), ...Object.keys(v.styles)]);
73
73
  const bFontSize = parseFontSizePx(b.styles["font-size"]);
74
74
  const vFontSize = parseFontSizePx(v.styles["font-size"]);
75
75
  for (const property of props) {
@@ -292,5 +292,4 @@ function diffPositionStylesAcrossViewports(baselineByVp, variantByVp) {
292
292
  })).sort((a, b) => b.count - a.count || a.path.localeCompare(b.path))
293
293
  };
294
294
  }
295
- //#endregion
296
295
  export { DOM_POSITION_STYLES_BROWSER_SCRIPT, diffDomPositionStyles, diffPositionStylesAcrossViewports, parseDomPositionStyles };
@@ -1,5 +1,4 @@
1
- //#region src/element-compare.d.ts
2
- interface ElementCompareOptions {
1
+ export interface ElementCompareOptions {
3
2
  /** CSS selectors for elements to compare */
4
3
  selectors: string[];
5
4
  /** Baseline HTML file path */
@@ -22,7 +21,7 @@ interface ElementCompareOptions {
22
21
  /** pixelmatch threshold */
23
22
  threshold?: number;
24
23
  }
25
- interface ElementDiffResult {
24
+ export interface ElementDiffResult {
26
25
  selector: string;
27
26
  found: {
28
27
  baseline: boolean;
@@ -49,7 +48,7 @@ interface ElementDiffResult {
49
48
  baselinePath?: string;
50
49
  currentPath?: string;
51
50
  }
52
- interface ElementCompareReport {
51
+ export interface ElementCompareReport {
53
52
  baselineSource: string;
54
53
  currentSource: string;
55
54
  viewport: {
@@ -61,11 +60,11 @@ interface ElementCompareReport {
61
60
  total: number;
62
61
  matched: number;
63
62
  changed: number;
64
- missing: number; /** Full-page diff ratio (for comparison) */
65
- fullPageDiffRatio?: number; /** Sum of element-level diff pixels (isolates actual changes from cascading shifts) */
63
+ missing: number;
64
+ /** Full-page diff ratio (for comparison) */
65
+ fullPageDiffRatio?: number;
66
+ /** Sum of element-level diff pixels (isolates actual changes from cascading shifts) */
66
67
  elementDiffRatio: number;
67
68
  };
68
69
  }
69
- declare function runElementCompare(options: ElementCompareOptions): Promise<ElementCompareReport>;
70
- //#endregion
71
- export { ElementCompareOptions, ElementCompareReport, ElementDiffResult, runElementCompare };
70
+ export declare function runElementCompare(options: ElementCompareOptions): Promise<ElementCompareReport>;
@@ -1,14 +1,14 @@
1
1
  #!/usr/bin/env node
2
2
  import { UsageError, handleCliError } from "./cli-error.mjs";
3
- import { withBrowser } from "./browser-launch.mjs";
4
3
  import { isCliEntry } from "./plugin/cli-entry.mjs";
5
4
  import { compareScreenshots } from "./heatmap.mjs";
6
5
  import { applyMask, parseMaskSelectors } from "./mask.mjs";
7
6
  import { BOLD, CYAN, DIM, GREEN, RED, RESET, YELLOW, hr } from "./terminal-colors.mjs";
7
+ import { withBrowser } from "./browser-launch.mjs";
8
8
  import { join, resolve } from "node:path";
9
9
  import "playwright";
10
10
  import { mkdir, readFile, writeFile } from "node:fs/promises";
11
- //#region src/element-compare.ts
11
+ // src/element-compare.ts
12
12
  /**
13
13
  * Element-level VRT comparison
14
14
  *
@@ -112,14 +112,15 @@ async function runElementCompare(options) {
112
112
  });
113
113
  continue;
114
114
  }
115
- const diff = await compareScreenshots({
115
+ const snap = {
116
116
  testId: `el-${safeSelector}`,
117
117
  testTitle: `Element: ${selector}`,
118
118
  projectName: "element-compare",
119
119
  screenshotPath: currentPath,
120
120
  baselinePath,
121
121
  status: "changed"
122
- }, {
122
+ };
123
+ const diff = await compareScreenshots(snap, {
123
124
  outputDir,
124
125
  threshold
125
126
  });
@@ -262,5 +263,4 @@ async function main() {
262
263
  console.log();
263
264
  }
264
265
  if (isCliEntry(import.meta.url, "element-compare")) main().catch(handleCliError);
265
- //#endregion
266
266
  export { runElementCompare };