framesheet 0.0.0-stage → 0.2.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 (85) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +247 -2
  3. package/dist/analysis.d.ts +84 -0
  4. package/dist/analysis.d.ts.map +1 -0
  5. package/dist/analysis.js +335 -0
  6. package/dist/analysis.js.map +1 -0
  7. package/dist/checks.d.ts +44 -0
  8. package/dist/checks.d.ts.map +1 -0
  9. package/dist/checks.js +200 -0
  10. package/dist/checks.js.map +1 -0
  11. package/dist/compose.d.ts +130 -0
  12. package/dist/compose.d.ts.map +1 -0
  13. package/dist/compose.js +266 -0
  14. package/dist/compose.js.map +1 -0
  15. package/dist/driver.d.ts +56 -0
  16. package/dist/driver.d.ts.map +1 -0
  17. package/dist/driver.js +94 -0
  18. package/dist/driver.js.map +1 -0
  19. package/dist/generated/assets.d.ts +13 -0
  20. package/dist/generated/assets.d.ts.map +1 -0
  21. package/dist/generated/assets.js +15 -0
  22. package/dist/generated/assets.js.map +1 -0
  23. package/dist/index.d.ts +18 -0
  24. package/dist/index.d.ts.map +1 -0
  25. package/dist/index.js +17 -0
  26. package/dist/index.js.map +1 -0
  27. package/dist/inspect.d.ts +163 -0
  28. package/dist/inspect.d.ts.map +1 -0
  29. package/dist/inspect.js +593 -0
  30. package/dist/inspect.js.map +1 -0
  31. package/dist/marks.d.ts +49 -0
  32. package/dist/marks.d.ts.map +1 -0
  33. package/dist/marks.js +460 -0
  34. package/dist/marks.js.map +1 -0
  35. package/dist/marks.schema.json +307 -0
  36. package/dist/media.d.ts +22 -0
  37. package/dist/media.d.ts.map +1 -0
  38. package/dist/media.js +306 -0
  39. package/dist/media.js.map +1 -0
  40. package/dist/models.d.ts +208 -0
  41. package/dist/models.d.ts.map +1 -0
  42. package/dist/models.js +9 -0
  43. package/dist/models.js.map +1 -0
  44. package/dist/pixels.d.ts +52 -0
  45. package/dist/pixels.d.ts.map +1 -0
  46. package/dist/pixels.js +275 -0
  47. package/dist/pixels.js.map +1 -0
  48. package/dist/pyfmt.d.ts +16 -0
  49. package/dist/pyfmt.d.ts.map +1 -0
  50. package/dist/pyfmt.js +54 -0
  51. package/dist/pyfmt.js.map +1 -0
  52. package/dist/report.schema.json +1326 -0
  53. package/dist/sources.d.ts +43 -0
  54. package/dist/sources.d.ts.map +1 -0
  55. package/dist/sources.js +164 -0
  56. package/dist/sources.js.map +1 -0
  57. package/dist/test.d.ts +46 -0
  58. package/dist/test.d.ts.map +1 -0
  59. package/dist/test.js +58 -0
  60. package/dist/test.js.map +1 -0
  61. package/dist/timing.d.ts +30 -0
  62. package/dist/timing.d.ts.map +1 -0
  63. package/dist/timing.js +128 -0
  64. package/dist/timing.js.map +1 -0
  65. package/dist/video.d.ts +65 -0
  66. package/dist/video.d.ts.map +1 -0
  67. package/dist/video.js +440 -0
  68. package/dist/video.js.map +1 -0
  69. package/package.json +79 -4
  70. package/src/analysis.ts +416 -0
  71. package/src/checks.ts +261 -0
  72. package/src/compose.ts +337 -0
  73. package/src/driver.ts +115 -0
  74. package/src/generated/assets.ts +20 -0
  75. package/src/index.ts +54 -0
  76. package/src/inspect.ts +722 -0
  77. package/src/marks.ts +481 -0
  78. package/src/media.ts +296 -0
  79. package/src/models.ts +225 -0
  80. package/src/pixels.ts +284 -0
  81. package/src/pyfmt.ts +55 -0
  82. package/src/sources.ts +175 -0
  83. package/src/test.ts +100 -0
  84. package/src/timing.ts +133 -0
  85. package/src/video.ts +513 -0
@@ -0,0 +1,43 @@
1
+ /** Input handling: files, markup strings and URLs (port of sources.py). */
2
+ import type { ParsedDocument } from "./checks.js";
3
+ import type { SourceKind } from "./models.js";
4
+ export declare const DEFAULT_HTML_SIZE: [number, number];
5
+ export declare const DEFAULT_SVG_SIZE: [number, number];
6
+ /** Markup strings are served from this virtual origin (page.route), never from disk. */
7
+ export declare const VIRTUAL_ORIGIN = "http://framesheet.invalid";
8
+ /** A resolved input. */
9
+ export interface Source {
10
+ /** What the caller passed (path, URL, or `<snippet>`). */
11
+ label: string;
12
+ kind: SourceKind;
13
+ /** What the browser navigates to. */
14
+ url: string;
15
+ /** Source text if available (static checks, size detection). */
16
+ text: string | null;
17
+ /** Markup served via page.route at `url` (markup-string inputs only). */
18
+ body?: string;
19
+ /** Video/animated image bytes (`kind === "video"`), served to the wrapper page. */
20
+ media?: Buffer;
21
+ /** Video container (`mp4`, `webm`, `gif`, ...) for video sources. */
22
+ container?: string;
23
+ }
24
+ /** Video wrapper pages and media are served from this virtual (secure) origin. */
25
+ export declare const VIDEO_ORIGIN = "https://framesheet.invalid";
26
+ export declare const VIDEO_PAGE = "<!DOCTYPE html><html><head><meta charset='utf-8'><title>framesheet video</title></head><body></body></html>";
27
+ /** A video/animated image, played in a wrapper page on {@link VIDEO_ORIGIN}. */
28
+ export declare function videoSource(label: string, data: Buffer, container?: string | null): Source;
29
+ /** Download a video URL (errors are raised: there is nothing to inspect without it). */
30
+ export declare function fetchBytes(url: string, timeoutMs?: number): Promise<Buffer>;
31
+ export declare function looksLikeSvg(text: string): boolean;
32
+ /** Wrap an in-memory SVG/HTML snippet as a source (served from a virtual URL). */
33
+ export declare function snippet(markup: string, label?: string): Source;
34
+ /** Best-effort download of a URL's body (for static checks and SVG size detection). */
35
+ export declare function fetchText(url: string, timeoutMs?: number): Promise<string | null>;
36
+ /** Turn a path, URL or markup string (starting with `<`) into a {@link Source}. */
37
+ export declare function resolveSource(source: string): Promise<Source>;
38
+ /** Intrinsic size of a parsed SVG: absolute width/height attributes, else the viewBox. */
39
+ export declare function svgSize(doc: ParsedDocument): [number, number] | null;
40
+ export declare function defaultSize(kind: SourceKind, parsed: ParsedDocument | null): [number, number];
41
+ /** Parse `WxH` (e.g. `1280x720`). */
42
+ export declare function parseSize(value: string): [number, number];
43
+ //# sourceMappingURL=sources.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sources.d.ts","sourceRoot":"","sources":["../src/sources.ts"],"names":[],"mappings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AG,EAAE,MAAM,EAAE,SAAS,SAAS,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAWvF;AAED,mFAAmF;AACnF,wBAAsB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAkCnE;AAQD,0FAA0F;AAC1F,wBAAgB,OAAO,CAAC,GAAG,EAAE,cAAc,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAoBpE;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,cAAc,GAAG,IAAI,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAM7F;AAED,qCAAqC;AACrC,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAIzD"}
@@ -0,0 +1,164 @@
1
+ /** Input handling: files, markup strings and URLs (port of sources.py). */
2
+ import { closeSync, openSync, readFileSync, readSync, statSync } from "node:fs";
3
+ import { extname, resolve as resolvePath } from "node:path";
4
+ import { pathToFileURL } from "node:url";
5
+ import { sniff, VIDEO_EXTENSIONS } from "./media.js";
6
+ import { pyRound } from "./pyfmt.js";
7
+ export const DEFAULT_HTML_SIZE = [1280, 720];
8
+ export const DEFAULT_SVG_SIZE = [960, 540];
9
+ const LENGTH = /^\s*([0-9]*\.?[0-9]+)\s*(px)?\s*$/;
10
+ /** Markup strings are served from this virtual origin (page.route), never from disk. */
11
+ export const VIRTUAL_ORIGIN = "http://framesheet.invalid";
12
+ /** Video wrapper pages and media are served from this virtual (secure) origin. */
13
+ export const VIDEO_ORIGIN = "https://framesheet.invalid";
14
+ export const VIDEO_PAGE = "<!DOCTYPE html><html><head><meta charset='utf-8'><title>framesheet video</title></head><body></body></html>";
15
+ /** A video/animated image, played in a wrapper page on {@link VIDEO_ORIGIN}. */
16
+ export function videoSource(label, data, container = null) {
17
+ const kind = sniff(data) ?? container;
18
+ if (kind === null)
19
+ throw new Error(`Not a supported video or animated image: ${label}`);
20
+ return { label, kind: "video", url: `${VIDEO_ORIGIN}/video.html`, text: null, media: data, container: kind };
21
+ }
22
+ function videoExt(name) {
23
+ return VIDEO_EXTENSIONS[extname(name.split("?")[0]).toLowerCase()] ?? null;
24
+ }
25
+ /** Download a video URL (errors are raised: there is nothing to inspect without it). */
26
+ export async function fetchBytes(url, timeoutMs = 60_000) {
27
+ let response;
28
+ try {
29
+ response = await fetch(url, { headers: { "User-Agent": "framesheet" }, signal: AbortSignal.timeout(timeoutMs) });
30
+ }
31
+ catch (err) {
32
+ throw new Error(`Cannot download ${url}: ${err.message}`);
33
+ }
34
+ if (!response.ok)
35
+ throw new Error(`Cannot download ${url}: HTTP ${response.status}`);
36
+ return Buffer.from(await response.arrayBuffer());
37
+ }
38
+ export function looksLikeSvg(text) {
39
+ let head = text.slice(0, 4096).replace(/<!--[\s\S]*?-->/g, "").trimStart().toLowerCase();
40
+ if (head.startsWith("<?xml")) {
41
+ const i = head.indexOf("?>");
42
+ head = (i >= 0 ? head.slice(i + 2) : "").trimStart();
43
+ }
44
+ if (head.startsWith("<!doctype svg"))
45
+ return true;
46
+ return head.startsWith("<svg");
47
+ }
48
+ /** Wrap an in-memory SVG/HTML snippet as a source (served from a virtual URL). */
49
+ export function snippet(markup, label = "<snippet>") {
50
+ const kind = looksLikeSvg(markup) ? "svg" : "html";
51
+ let text = markup;
52
+ if (kind === "html" && !text.toLowerCase().includes("<html")) {
53
+ text = `<!DOCTYPE html>\n<html><head><meta charset='utf-8'></head><body>${text}</body></html>`;
54
+ }
55
+ return { label, kind, url: `${VIRTUAL_ORIGIN}/input.${kind}`, text, body: text };
56
+ }
57
+ /** Best-effort download of a URL's body (for static checks and SVG size detection). */
58
+ export async function fetchText(url, timeoutMs = 15_000) {
59
+ try {
60
+ const response = await fetch(url, {
61
+ headers: { "User-Agent": "framesheet" },
62
+ signal: AbortSignal.timeout(timeoutMs),
63
+ });
64
+ if (!response.ok)
65
+ return null;
66
+ return await response.text();
67
+ }
68
+ catch {
69
+ return null;
70
+ }
71
+ }
72
+ /** Turn a path, URL or markup string (starting with `<`) into a {@link Source}. */
73
+ export async function resolveSource(source) {
74
+ if (source.trimStart().startsWith("<"))
75
+ return snippet(source);
76
+ if (/^https?:\/\//.test(source)) {
77
+ const container = videoExt(source);
78
+ if (container)
79
+ return videoSource(source, await fetchBytes(source), container);
80
+ const text = await fetchText(source);
81
+ const byName = source.split("?")[0].toLowerCase().endsWith(".svg");
82
+ const kind = byName || (text !== null && looksLikeSvg(text)) ? "svg" : "html";
83
+ return { label: source, kind, url: source, text };
84
+ }
85
+ const path = resolvePath(source.startsWith("file://") ? new URL(source).pathname : source);
86
+ let isFile = false;
87
+ try {
88
+ isFile = statSync(path).isFile();
89
+ }
90
+ catch {
91
+ isFile = false;
92
+ }
93
+ if (!isFile)
94
+ throw new Error(`Input not found: ${source}`);
95
+ const head = Buffer.alloc(64);
96
+ const fd = openSync(path, "r");
97
+ try {
98
+ readSync(fd, head, 0, 64, 0);
99
+ }
100
+ finally {
101
+ closeSync(fd);
102
+ }
103
+ const container = videoExt(path);
104
+ if (container || sniff(head))
105
+ return videoSource(source, readFileSync(path), container);
106
+ const text = readFileSync(path, "utf8");
107
+ const ext = extname(path).toLowerCase();
108
+ let kind;
109
+ if (ext === ".svg")
110
+ kind = "svg";
111
+ else if ([".html", ".htm", ".xhtml"].includes(ext))
112
+ kind = "html";
113
+ else
114
+ kind = looksLikeSvg(text) ? "svg" : "html";
115
+ return { label: source, kind, url: pathToFileURL(path).href, text };
116
+ }
117
+ function length(value) {
118
+ if (value == null)
119
+ return null;
120
+ const m = LENGTH.exec(value);
121
+ return m ? parseFloat(m[1]) : null;
122
+ }
123
+ /** Intrinsic size of a parsed SVG: absolute width/height attributes, else the viewBox. */
124
+ export function svgSize(doc) {
125
+ if (doc.error !== null || !doc.elements.length)
126
+ return null;
127
+ const root = doc.elements[0];
128
+ const get = (name) => root.attrs.find(([local]) => local === name)?.[2];
129
+ let width = length(get("width"));
130
+ let height = length(get("height"));
131
+ const box = (get("viewBox") ?? "")
132
+ .trim()
133
+ .split(/[\s,]+/)
134
+ .filter(Boolean)
135
+ .map(Number);
136
+ if (box.length === 4 && box[2] > 0 && box[3] > 0) {
137
+ const [, , vbW, vbH] = box;
138
+ if (width && !height)
139
+ height = (width * vbH) / vbW;
140
+ else if (height && !width)
141
+ width = (height * vbW) / vbH;
142
+ width = width || vbW;
143
+ height = height || vbH;
144
+ }
145
+ if (width && height)
146
+ return [Math.max(1, pyRound(width)), Math.max(1, pyRound(height))];
147
+ return null;
148
+ }
149
+ export function defaultSize(kind, parsed) {
150
+ if (kind === "svg" && parsed) {
151
+ const size = svgSize(parsed);
152
+ if (size)
153
+ return size;
154
+ }
155
+ return kind === "svg" ? DEFAULT_SVG_SIZE : DEFAULT_HTML_SIZE;
156
+ }
157
+ /** Parse `WxH` (e.g. `1280x720`). */
158
+ export function parseSize(value) {
159
+ const m = /^\s*(\d+)\s*[xX*]\s*(\d+)\s*$/.exec(value);
160
+ if (!m)
161
+ throw new Error(`Invalid size '${value}'; expected WIDTHxHEIGHT, e.g. 1280x720`);
162
+ return [Number(m[1]), Number(m[2])];
163
+ }
164
+ //# sourceMappingURL=sources.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sources.js","sourceRoot":"","sources":["../src/sources.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAE3E,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAChF,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAErD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,MAAM,CAAC,MAAM,iBAAiB,G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AAU,WAAW,CAAC,IAAgB,EAAE,MAA6B;IACzE,IAAI,IAAI,KAAK,KAAK,IAAI,MAAM,EAAE,CAAC;QAC7B,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;QAC7B,IAAI,IAAI;YAAE,OAAO,IAAI,CAAC;IACxB,CAAC;IACD,OAAO,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,iBAAiB,CAAC;AAC/D,CAAC;AAED,qCAAqC;AACrC,MAAM,UAAU,SAAS,CAAC,KAAa;IACrC,MAAM,CAAC,GAAG,+BAA+B,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACtD,IAAI,CAAC,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,iBAAiB,KAAK,yCAAyC,CAAC,CAAC;IACzF,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACtC,CAAC"}
package/dist/test.d.ts ADDED
@@ -0,0 +1,46 @@
1
+ /**
2
+ * `framesheet/test`: visual regression of animations in a `@playwright/test` suite.
3
+ *
4
+ * ```ts
5
+ * import { test } from "@playwright/test";
6
+ * import { expectAnimation } from "framesheet/test";
7
+ *
8
+ * test("mind map opens smoothly", async ({ page }) => {
9
+ * await page.goto("/mindmap");
10
+ * await expectAnimation(page.locator("#mindmap"), "mindmap-open", { frames: 8 });
11
+ * });
12
+ * ```
13
+ */
14
+ import { type Locator, type Page } from "@playwright/test";
15
+ import { type Inspection, type InspectPageOptions } from "./inspect.js";
16
+ import type { Severity } from "./models.js";
17
+ export { LAUNCH_ARGS, prepare } from "./inspect.js";
18
+ export interface ExpectAnimationOptions extends Omit<InspectPageOptions, "locator" | "out"> {
19
+ /** Allowed share of differing pixels in the sheet (Playwright `maxDiffPixelRatio`). */
20
+ maxDiffPixelRatio?: number;
21
+ /** Allowed number of differing pixels (Playwright `maxDiffPixels`). */
22
+ maxDiffPixels?: number;
23
+ /** Per-pixel colour distance threshold 0-1 (Playwright `threshold`, default 0.2). */
24
+ threshold?: number;
25
+ /** Also compare the motion heatmap against `<name>-heatmap.png`. Default false. */
26
+ heatmap?: boolean;
27
+ /**
28
+ * Fail on findings of this severity or worse: `"error"` (default), `"warning"`, or
29
+ * `false` to only compare images.
30
+ */
31
+ failOn?: Exclude<Severity, "info"> | false;
32
+ /** Finding codes to ignore for `failOn` (e.g. `["console-error"]`). */
33
+ ignore?: string[];
34
+ /** Attach sheet/heatmap/full/report to the test report. Default true. */
35
+ attach?: boolean;
36
+ /** Compare against the stored baseline. Default true; `false` only checks findings. */
37
+ snapshot?: boolean;
38
+ }
39
+ /**
40
+ * Build the contact sheet of an animation (whole page or one component) and compare it
41
+ * with the stored baseline `<name>.png` via Playwright's `toMatchSnapshot` (so
42
+ * `--update-snapshots`, per-platform snapshot names and diff images work as usual).
43
+ * Also fails on error findings unless `failOn: false`. Returns the inspection.
44
+ */
45
+ export declare function expectAnimation(target: Page | Locator, name: string, options?: ExpectAnimationOptions): Promise<Inspection>;
46
+ //# sourceMappingURL=test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../src/test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAU,KAAK,OAAO,EAAE,KAAK,IAAI,EAAQ,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,kBAAkB,EAAe,MAAM,cAAc,CAAC;AACrF,OAAO,KAAK,EAAW,QAAQ,EAAE,MAAM,aAAa,CAAC;AAErD,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEpD,MAAM,WAAW,sBAAuB,SAAQ,IAAI,CAAC,kBAAkB,EAAE,SAAS,GAAG,KAAK,CAAC;IACzF,uFAAuF;IACvF,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,uEAAuE;IACvE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,qFAAqF;IACrF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mFAAmF;IACnF,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC,QAAQ,EAAE,MAAM,CAAC,GAAG,KAAK,CAAC;IAC3C,uEAAuE;IACvE,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,yEAAyE;IACzE,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,uFAAuF;IACvF,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAUD;;;;;GAKG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,IAAI,GAAG,OAAO,EACtB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,UAAU,CAAC,CAuCrB"}
package/dist/test.js ADDED
@@ -0,0 +1,58 @@
1
+ /**
2
+ * `framesheet/test`: visual regression of animations in a `@playwright/test` suite.
3
+ *
4
+ * ```ts
5
+ * import { test } from "@playwright/test";
6
+ * import { expectAnimation } from "framesheet/test";
7
+ *
8
+ * test("mind map opens smoothly", async ({ page }) => {
9
+ * await page.goto("/mindmap");
10
+ * await expectAnimation(page.locator("#mindmap"), "mindmap-open", { frames: 8 });
11
+ * });
12
+ * ```
13
+ */
14
+ import { expect, test } from "@playwright/test";
15
+ import { inspectPage } from "./inspect.js";
16
+ export { LAUNCH_ARGS, prepare } from "./inspect.js";
17
+ function isPage(target) {
18
+ return typeof target.goto === "function";
19
+ }
20
+ function describe(findings) {
21
+ return findings.map((f) => `${f.severity} ${f.code}: ${f.message}`).join("\n");
22
+ }
23
+ /**
24
+ * Build the contact sheet of an animation (whole page or one component) and compare it
25
+ * with the stored baseline `<name>.png` via Playwright's `toMatchSnapshot` (so
26
+ * `--update-snapshots`, per-platform snapshot names and diff images work as usual).
27
+ * Also fails on error findings unless `failOn: false`. Returns the inspection.
28
+ */
29
+ export async function expectAnimation(target, name, options = {}) {
30
+ const page = isPage(target) ? target : target.page();
31
+ const locator = isPage(target) ? undefined : target;
32
+ const { maxDiffPixelRatio, maxDiffPixels, threshold, heatmap, failOn = "error", ignore = [], attach = true, snapshot = true, ...rest } = options;
33
+ const result = await inspectPage(page, { ...rest, locator, title: rest.title ?? name });
34
+ const base = name.replace(/\.png$/i, "");
35
+ if (attach) {
36
+ const info = test.info();
37
+ await info.attach(`${base}-sheet.png`, { body: result.images.sheet, contentType: "image/png" });
38
+ await info.attach(`${base}-heatmap.png`, { body: result.images.heatmap, contentType: "image/png" });
39
+ await info.attach(`${base}-full.png`, { body: result.images.full, contentType: "image/png" });
40
+ await info.attach(`${base}-report.json`, {
41
+ body: JSON.stringify(result.report, null, 2),
42
+ contentType: "application/json",
43
+ });
44
+ }
45
+ const compare = Object.fromEntries(Object.entries({ maxDiffPixelRatio, maxDiffPixels, threshold }).filter(([, v]) => v !== undefined));
46
+ if (snapshot) {
47
+ expect(result.images.sheet).toMatchSnapshot(`${base}.png`, compare);
48
+ if (heatmap)
49
+ expect(result.images.heatmap).toMatchSnapshot(`${base}-heatmap.png`, compare);
50
+ }
51
+ if (failOn) {
52
+ const worst = failOn === "warning" ? ["error", "warning"] : ["error"];
53
+ const bad = result.findings.filter((f) => worst.includes(f.severity) && !ignore.includes(f.code));
54
+ expect(bad, `framesheet findings for '${base}':\n${describe(bad)}\n\n${result.summary()}`).toEqual([]);
55
+ }
56
+ return result;
57
+ }
58
+ //# sourceMappingURL=test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test.js","sourceRoot":"","sources":["../src/test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,MAAM,EAA2B,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAA4C,WAAW,EAAE,MAAM,cAAc,CAAC;AAGrF,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,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,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;QACtE,MAAM,GAAG,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;QAClG,MAAM,CAAC,GAAG,EAAE,4BAA4B,IAAI,OAAO,QAAQ,CAAC,GAAG,CAAC,OAAO,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IACzG,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,30 @@
1
+ /** Duration detection and sample-time planning (port of timing.py). */
2
+ import type { AnimationTiming, DurationInfo } from "./models.js";
3
+ export declare const FALLBACK_SECONDS = 3;
4
+ export declare const MAX_SECONDS = 60;
5
+ /** Use the LCM of loop periods only if it is at most this many times the longest period. */
6
+ export declare const LCM_FACTOR = 4;
7
+ /** One 60 fps frame: the last tile and the loop probe sit this far before the cycle end. */
8
+ export declare const EPSILON: number;
9
+ /** Normalise raw runtime output (`window.__framesheet.timings()`) to full records. */
10
+ export declare function parseTimings(raw: unknown[]): AnimationTiming[];
11
+ /**
12
+ * Pick the time span to sample.
13
+ *
14
+ * - Infinite animations contribute their loop period (`duration`, doubled for
15
+ * `alternate`). Several periods are combined with their least common multiple if that
16
+ * stays reasonable, otherwise the longest period wins.
17
+ * - A positive start (`begin`/`delay`) of a looping animation is added, so the warm-up
18
+ * before the first iteration is visible.
19
+ * - Finite animations contribute their end time (delay + duration x iterations).
20
+ */
21
+ export declare function detectDuration(animations: AnimationTiming[], override?: number | null): DurationInfo;
22
+ /** The probe offset for loop checks: one 60 fps frame, or 1% of very short cycles. */
23
+ export declare function epsilon(duration: number): number;
24
+ /**
25
+ * Evenly spaced times over `[0, duration]`. The last sample is one 60 fps frame *before*
26
+ * the end: at exactly `t=end` an infinite animation has already wrapped to its first
27
+ * frame, which would make every loop look seamless.
28
+ */
29
+ export declare function sampleTimes(duration: number, frames: number): number[];
30
+ //# sourceMappingURL=timing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timing.d.ts","sourceRoot":"","sources":["../src/timing.ts"],"names":[],"mappings":"AAAA,uEAAuE;AAEvE,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGjE,eAAO,MAAM,gBAAgB,IAAM,CAAC;AACpC,eAAO,MAAM,WAAW,KAAO,CAAC;AAChC,4FAA4F;AAC5F,eAAO,MAAM,UAAU,IAAI,CAAC;AAC5B,4FAA4F;AAC5F,eAAO,MAAM,OAAO,QAAS,CAAC;AAE9B,sFAAsF;AACtF,wBAAgB,YAAY,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,eAAe,EAAE,CAgB9D;AAYD;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,eAAe,EAAE,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,YAAY,CAgEpG;AAED,sFAAsF;AACtF,wBAAgB,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAKtE"}
package/dist/timing.js ADDED
@@ -0,0 +1,128 @@
1
+ /** Duration detection and sample-time planning (port of timing.py). */
2
+ import { g, pyRound } from "./pyfmt.js";
3
+ export const FALLBACK_SECONDS = 3.0;
4
+ export const MAX_SECONDS = 60.0;
5
+ /** Use the LCM of loop periods only if it is at most this many times the longest period. */
6
+ export const LCM_FACTOR = 4;
7
+ /** One 60 fps frame: the last tile and the loop probe sit this far before the cycle end. */
8
+ export const EPSILON = 1 / 60;
9
+ /** Normalise raw runtime output (`window.__framesheet.timings()`) to full records. */
10
+ export function parseTimings(raw) {
11
+ return raw.map((item) => {
12
+ const r = item;
13
+ return {
14
+ kind: r.kind,
15
+ target: r.target ?? null,
16
+ name: r.name ?? null,
17
+ start: Number(r.start),
18
+ duration: Number(r.duration),
19
+ iterations: r.iterations == null ? null : Number(r.iterations),
20
+ direction: r.direction ?? "normal",
21
+ period: Number(r.period),
22
+ end: r.end == null ? null : Number(r.end),
23
+ transform_box: r.transform_box ?? null,
24
+ };
25
+ });
26
+ }
27
+ function gcd(a, b) {
28
+ while (b)
29
+ [a, b] = [b, a % b];
30
+ return a;
31
+ }
32
+ function lcm(periods) {
33
+ const ticks = periods.map((p) => Math.max(1, pyRound(p * 100))); // 10 ms resolution
34
+ return ticks.reduce((a, b) => (a / gcd(a, b)) * b) / 100;
35
+ }
36
+ /**
37
+ * Pick the time span to sample.
38
+ *
39
+ * - Infinite animations contribute their loop period (`duration`, doubled for
40
+ * `alternate`). Several periods are combined with their least common multiple if that
41
+ * stays reasonable, otherwise the longest period wins.
42
+ * - A positive start (`begin`/`delay`) of a looping animation is added, so the warm-up
43
+ * before the first iteration is visible.
44
+ * - Finite animations contribute their end time (delay + duration x iterations).
45
+ */
46
+ export function detectDuration(animations, override) {
47
+ const infinite = animations.filter((a) => a.iterations === null);
48
+ const finite = animations.filter((a) => a.iterations !== null && a.end !== null);
49
+ const looping = infinite.length > 0;
50
+ if (override != null) {
51
+ return {
52
+ seconds: override,
53
+ method: "override",
54
+ looping,
55
+ detail: `--duration ${g(override)}s`,
56
+ animations,
57
+ };
58
+ }
59
+ if (animations.length === 0) {
60
+ return {
61
+ seconds: FALLBACK_SECONDS,
62
+ method: "fallback",
63
+ looping: false,
64
+ detail: `no SMIL/CSS/Web Animations found; sampled the ${g(FALLBACK_SECONDS)}s ` +
65
+ "fallback (pass --duration for JS-driven animation)",
66
+ animations: [],
67
+ };
68
+ }
69
+ const parts = [];
70
+ let seconds = 0;
71
+ if (infinite.length) {
72
+ const periods = [...new Set(infinite.map((a) => pyRound(a.period, 3)))].sort((a, b) => a - b);
73
+ let cycle = lcm(periods);
74
+ const longest = periods[periods.length - 1];
75
+ const list = periods.map((p) => `${g(p)}s`).join(", ");
76
+ if (periods.length === 1) {
77
+ parts.push(`loop period ${g(periods[0])}s`);
78
+ }
79
+ else if (cycle <= LCM_FACTOR * longest && cycle <= MAX_SECONDS) {
80
+ parts.push(`LCM of loop periods ${list}`);
81
+ }
82
+ else {
83
+ cycle = longest;
84
+ parts.push(`longest of loop periods ${list} (no short common multiple)`);
85
+ }
86
+ seconds = cycle;
87
+ const warmup = Math.max(Math.max(...infinite.map((a) => a.start)), 0);
88
+ if (warmup > 0) {
89
+ seconds = Math.max(seconds, warmup + cycle);
90
+ parts.push(`+ ${g(warmup)}s positive begin/delay before the first loop`);
91
+ }
92
+ }
93
+ if (finite.length) {
94
+ const lastEnd = Math.max(...finite.map((a) => a.end ?? 0));
95
+ if (lastEnd > seconds) {
96
+ seconds = lastEnd;
97
+ parts.push(`finite animations end at ${g(lastEnd)}s`);
98
+ }
99
+ }
100
+ const kinds = [...new Set(animations.map((a) => a.kind))].sort();
101
+ let detail = `${parts.join("; ")} (${animations.length} animation(s): ${kinds.join(", ")})`;
102
+ if (seconds > MAX_SECONDS) {
103
+ detail += `; capped at ${g(MAX_SECONDS)}s`;
104
+ seconds = MAX_SECONDS;
105
+ }
106
+ if (seconds <= 0) {
107
+ seconds = FALLBACK_SECONDS;
108
+ detail += `; zero-length, using ${g(FALLBACK_SECONDS)}s`;
109
+ }
110
+ return { seconds: pyRound(seconds, 3), method: "detected", looping, detail, animations };
111
+ }
112
+ /** The probe offset for loop checks: one 60 fps frame, or 1% of very short cycles. */
113
+ export function epsilon(duration) {
114
+ return Math.min(EPSILON, duration / 100);
115
+ }
116
+ /**
117
+ * Evenly spaced times over `[0, duration]`. The last sample is one 60 fps frame *before*
118
+ * the end: at exactly `t=end` an infinite animation has already wrapped to its first
119
+ * frame, which would make every loop look seamless.
120
+ */
121
+ export function sampleTimes(duration, frames) {
122
+ if (frames < 2)
123
+ return [0];
124
+ const times = Array.from({ length: frames }, (_, i) => pyRound((duration * i) / (frames - 1), 4));
125
+ times[times.length - 1] = pyRound(duration - epsilon(duration), 4);
126
+ return times;
127
+ }
128
+ //# sourceMappingURL=timing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timing.js","sourceRoot":"","sources":["../src/timing.ts"],"names":[],"mappings":"AAAA,uEAAuE;AAGvE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAExC,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,CAAC;AACpC,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,CAAC;AAChC,4FAA4F;AAC5F,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC;AAC5B,4FAA4F;AAC5F,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,GAAG,EAAE,CAAC;AAE9B,sFAAsF;AACtF,MAAM,UAAU,YAAY,CAAC,GAAc;IACzC,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACtB,MAAM,CAAC,GAAG,IAA+B,CAAC;QAC1C,OAAO;YACL,IAAI,EAAE,CAAC,CAAC,IAA+B;YACvC,MAAM,EAAG,CAAC,CAAC,MAAoC,IAAI,IAAI;YACvD,IAAI,EAAG,CAAC,CAAC,IAAkC,IAAI,IAAI;YACnD,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC;YACtB,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC;YAC5B,UAAU,EAAE,CAAC,CAAC,UAAU,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC;YAC9D,SAAS,EAAG,CAAC,CAAC,SAAgC,IAAI,QAAQ;YAC1D,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;YACxB,GAAG,E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C,GAAG,OAAO,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;IACnE,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Video and animated-image inputs (port of video.py): exact seeks in Chromium, dense
3
+ * samples, pacing checks (static stretches, black/blank frames, cuts, mark overlaps), and
4
+ * the sheet with marks and a timeline.
5
+ */
6
+ import type { Browser } from "playwright-core";
7
+ import { type Renderer } from "./compose.js";
8
+ import { type Issue } from "./marks.js";
9
+ import { type Probe } from "./media.js";
10
+ import type { ActivitySample, Finding, ImageBuffers, ImagePaths, Marks, Report } from "./models.js";
11
+ import { type Source } from "./sources.js";
12
+ /** A sample step changing fewer than 0.05% of pixels counts as "no visible change". */
13
+ export declare const STATIC_RATIO = 0.0005;
14
+ /** A step changing at least 40% of pixels ... */
15
+ export declare const CUT_RATIO = 0.4;
16
+ /** ... while both neighbouring steps change at most a quarter of that is an abrupt cut. */
17
+ export declare const CUT_NEIGHBOUR = 0.25;
18
+ /** Dense samples are at most this far apart (seconds), up to MAX_SAMPLES. */
19
+ export declare const SAMPLE_STEP = 0.25;
20
+ export declare const MAX_SAMPLES = 240;
21
+ export declare const MAX_TILES = 100;
22
+ export declare const DEFAULT_STATIC_STRETCH = 2;
23
+ export type TimesSpec = number[] | "marks";
24
+ export interface VideoOptions {
25
+ frames?: number;
26
+ every?: number;
27
+ times?: TimesSpec;
28
+ start?: number;
29
+ end?: number;
30
+ marks?: Marks | null;
31
+ }
32
+ /** Range and tile times: `[start, end, times, mode]`. */
33
+ export declare function planTimes(total: number, o?: VideoOptions): [number, number, number[], string];
34
+ /** Evenly spaced pacing samples over `[start, end]` (both ends included). */
35
+ export declare function denseTimes(start: number, end: number, heatFrames: number): number[];
36
+ /** Maximal runs of sample steps without visible change lasting > `threshold` s. */
37
+ export declare function staticStretches(samples: ActivitySample[], threshold: number): [number, number][];
38
+ /** Sample times where one step changes >= CUT_RATIO and its neighbours little. */
39
+ export declare function abruptCuts(samples: ActivitySample[]): number[];
40
+ /** Span boxes (captions) covering `target` region boxes while both are active. */
41
+ export declare function markOverlaps(marks: Marks, start: number, end: number): Finding[];
42
+ /** Findings plus timeline issues. */
43
+ export declare function videoFindings(samples: ActivitySample[], stats: Map<number, [boolean, boolean]>, threshold: number, marks: Marks | null, start: number, end: number): [Finding[], Issue[]];
44
+ export declare function decodeHint(label: string, probe: Probe, error: string): string;
45
+ export interface VideoPipelineOptions extends VideoOptions {
46
+ duration?: number;
47
+ size?: [number, number];
48
+ scale?: number;
49
+ at?: number;
50
+ out?: string;
51
+ tile?: number;
52
+ columns?: number;
53
+ keepFrames?: boolean;
54
+ heatFrames?: number;
55
+ timeout?: number;
56
+ staticStretch?: number;
57
+ }
58
+ type Built = {
59
+ report: Report;
60
+ images: ImageBuffers;
61
+ paths: ImagePaths | null;
62
+ };
63
+ export declare function inspectVideo(src: Source, browser: Browser, renderer: Renderer, o: VideoPipelineOptions, autoScale: (size: [number, number]) => number): Promise<Built>;
64
+ export {};
65
+ //# sourceMappingURL=video.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"video.d.ts","sourceRoot":"","sources":["../src/video.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,OAAO,EAAS,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAyB,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAC;AAEpE,OAAO,EAIL,KAAK,KAAK,EAIX,MAAM,YAAY,CAAC;AACpB,OAAO,EAAoD,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAC1F,OAAO,KAAK,EACV,cAAc,EAEd,OAAO,EAEP,YAAY,EACZ,UAAU,EACV,KAAK,EAEL,MAAM,EAGP,MAAM,aAAa,CAAC;AAIrB,OAAO,EAAqB,KAAK,MAAM,EAA4B,MAAM,cAAc,CAAC;AAExF,uFAAuF;AACvF,eAAO,MAAM,YAAY,SAAS,CAAC;AACnC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