@ingcreators/annot-playwright 0.3.0 → 0.3.1

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @ingcreators/annot-playwright
2
2
 
3
+ ## 0.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [806badc]
8
+ - Updated dependencies [df1a429]
9
+ - @ingcreators/annot-annotator@0.5.0
10
+
3
11
  ## 0.3.0
4
12
 
5
13
  ### Minor Changes
package/README.md CHANGED
@@ -161,7 +161,7 @@ const annotator = createAnnotator({
161
161
  — Phase 0 feasibility report.
162
162
  - [`docs/plans/_done/annot-annotator-package.md`](../../docs/plans/_done/annot-annotator-package.md)
163
163
  — Phase 1 annotator design.
164
- - [`docs/plans/annot-playwright-fixture.md`](../../docs/plans/annot-playwright-fixture.md)
164
+ - [`docs/plans/_done/annot-playwright-fixture.md`](../../docs/plans/_done/annot-playwright-fixture.md)
165
165
  — Phase 2 design (this package).
166
166
  - [`PRODUCT_DIRECTION.md`](../../PRODUCT_DIRECTION.md) — strategic
167
167
  context.
package/dist/index.js CHANGED
@@ -1,41 +1,32 @@
1
- import { createAnnotator as d, bboxAnnotationsToSvg as f, DEFAULT_ENCODE_OPTIONS as h, decodeAndEncodeImage as l } from "@ingcreators/annot-annotator";
2
- import { arrowBetween as A, bboxAnnotationsToSvg as D, rectForBoundingBox as O, textAt as E } from "@ingcreators/annot-annotator";
3
- import { test as w } from "@playwright/test";
4
- import { expect as T } from "@playwright/test";
5
- const P = w.extend({
6
- // biome-ignore lint/correctness/noEmptyPattern: Playwright fixture signature requires the empty destructure.
7
- annotator: async ({}, n) => {
8
- const e = d();
9
- await n({
10
- raw: e,
11
- annotateScreenshot: (t, o) => u(e, t, o)
12
- });
13
- }
14
- });
15
- async function u(n, e, t) {
16
- const o = await e.screenshot({ fullPage: t.fullPage }), { width: r, height: i } = b(o), s = `data:image/png;base64,${o.toString("base64")}`, c = "annotations" in t && t.annotations !== void 0 ? f(t.annotations) : t.annotationsSvg ?? "", a = n.toPng({
17
- originalDataUrl: s,
18
- annotationsSvg: c,
19
- width: r,
20
- height: i
21
- });
22
- if (!t.encode || Object.keys(t.encode).length === 0)
23
- return a;
24
- const g = { ...h, ...t.encode };
25
- return (await l(a, g)).bytes;
1
+ import { DEFAULT_ENCODE_OPTIONS as e, arrowBetween as t, bboxAnnotationsToSvg as n, bboxAnnotationsToSvg as r, createAnnotator as i, decodeAndEncodeImage as a, rectForBoundingBox as o, textAt as s } from "@ingcreators/annot-annotator";
2
+ import { expect as c, test as l } from "@playwright/test";
3
+ //#region src/fixture.ts
4
+ var u = l.extend({ annotator: async ({}, e) => {
5
+ let t = i();
6
+ await e({
7
+ raw: t,
8
+ annotateScreenshot: (e, n) => d(t, e, n)
9
+ });
10
+ } });
11
+ async function d(t, n, i) {
12
+ let o = await n.screenshot({ fullPage: i.fullPage }), { width: s, height: c } = f(o), l = `data:image/png;base64,${o.toString("base64")}`, u = "annotations" in i && i.annotations !== void 0 ? r(i.annotations) : i.annotationsSvg ?? "", d = t.toPng({
13
+ originalDataUrl: l,
14
+ annotationsSvg: u,
15
+ width: s,
16
+ height: c
17
+ });
18
+ return !i.encode || Object.keys(i.encode).length === 0 ? d : (await a(d, {
19
+ ...e,
20
+ ...i.encode
21
+ })).bytes;
26
22
  }
27
- function b(n) {
28
- if (n.length < 24)
29
- throw new Error("PNG too short to contain IHDR chunk");
30
- const e = new DataView(n.buffer, n.byteOffset, n.byteLength), t = e.getUint32(16, !1), o = e.getUint32(20, !1);
31
- return { width: t, height: o };
23
+ function f(e) {
24
+ if (e.length < 24) throw Error("PNG too short to contain IHDR chunk");
25
+ let t = new DataView(e.buffer, e.byteOffset, e.byteLength);
26
+ return {
27
+ width: t.getUint32(16, !1),
28
+ height: t.getUint32(20, !1)
29
+ };
32
30
  }
33
- export {
34
- u as annotateScreenshot,
35
- A as arrowBetween,
36
- D as bboxAnnotationsToSvg,
37
- T as expect,
38
- O as rectForBoundingBox,
39
- P as test,
40
- E as textAt
41
- };
31
+ //#endregion
32
+ export { d as annotateScreenshot, t as arrowBetween, n as bboxAnnotationsToSvg, c as expect, o as rectForBoundingBox, u as test, s as textAt };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ingcreators/annot-playwright",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Playwright fixture for annotated screenshots — emit annotated PNGs from failing tests without leaving the test file. Pairs `test.extend({ annotator })` with the headless renderer from @ingcreators/annot-annotator.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "ingcreators",
@@ -44,11 +44,11 @@
44
44
  "devDependencies": {
45
45
  "@playwright/test": "^1.50.0",
46
46
  "typescript": "^6.0.3",
47
- "vite": "^6.4.2",
48
- "vite-plugin-dts": "^5.0.0"
47
+ "vite": "^8.0.13",
48
+ "vite-plugin-dts": "^5.0.1"
49
49
  },
50
50
  "dependencies": {
51
- "@ingcreators/annot-annotator": "0.3.0"
51
+ "@ingcreators/annot-annotator": "0.5.0"
52
52
  },
53
53
  "peerDependencies": {
54
54
  "@playwright/test": "^1.40.0"