styleproof 1.3.0 → 1.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 +10 -0
- package/README.md +26 -1
- package/dist/report.js +9 -11
- package/docs/demo-composite.png +0 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,16 @@ this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.3.1]
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- The before/after composite no longer draws coloured accent strips (grey for
|
|
15
|
+
before, blue for after) above each crop. They were a font-free before/after
|
|
16
|
+
cue, but a strip that differs between the two sides reads as a _second_ change
|
|
17
|
+
in the pair. Now the only thing that differs across the composite is the actual
|
|
18
|
+
change; before/after stays conveyed by position (left = before) and the caption.
|
|
19
|
+
|
|
10
20
|
## [1.3.0]
|
|
11
21
|
|
|
12
22
|
Clearer reports: one section per screenshot.
|
package/README.md
CHANGED
|
@@ -18,7 +18,32 @@ On every PR, StyleProof captures a `StyleMap` from the HEAD and from the base br
|
|
|
18
18
|
- An **approval checkbox per change**, driving a `StyleProof` commit status: red until every change is signed off, green when there are none.
|
|
19
19
|
- No committed baseline to maintain — the diff is HEAD-vs-base, so the report is _exactly what this PR changes_.
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
## What a report looks like
|
|
22
|
+
|
|
23
|
+
One change — the hero CTA recoloured cyan → amber — posts as a single section: a side-by-side before/after cropped screenshot, a one-line summary, then the exact property change folded under a toggle.
|
|
24
|
+
|
|
25
|
+

|
|
26
|
+
|
|
27
|
+
As it renders in the PR comment (colours become live swatches; the full table sits inside the toggle):
|
|
28
|
+
|
|
29
|
+
```text
|
|
30
|
+
### `a.btn-solid` · 1 element restyled
|
|
31
|
+
_landing @ 1280_
|
|
32
|
+
|
|
33
|
+
`background-color` `rgb(95, 202, 219)` → `rgb(245, 158, 11)`
|
|
34
|
+
|
|
35
|
+
▾ Show the property change
|
|
36
|
+
| Property | Before | After |
|
|
37
|
+
| background-color | rgb(95, 202, 219) | rgb(245, 158, 11) |
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Works with any styling system
|
|
41
|
+
|
|
42
|
+
StyleProof reads the browser's **computed styles** — the values it actually resolves — never your source CSS. Tailwind, CSS Modules, styled-components, Sass, vanilla CSS, inline styles: all produce the same computed output, and that's what it diffs. Elements are keyed by **DOM structure, not class name**, so a refactor that rewrites every `class` still lines up element-for-element.
|
|
43
|
+
|
|
44
|
+
## Certify a refactor
|
|
45
|
+
|
|
46
|
+
The same engine has a second mode that proves a change touched _nothing_ visual: with `fail-on-diff: true`, any difference at all fails the job. It's the job StyleProof was born for — certifying a CSS-to-Tailwind migration rendered byte-for-byte identical. Reach for it on any change whose whole promise is "the output is unchanged": a utility-class migration, a design-system swap, a dependency or build-tooling bump. Zero diff is the contract; one drifting longhand is a regression to investigate, not a change to approve.
|
|
22
47
|
|
|
23
48
|
## Install
|
|
24
49
|
|
package/dist/report.js
CHANGED
|
@@ -80,28 +80,26 @@ function fillRect(png, x, y, w, h, [r, g, b]) {
|
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
/**
|
|
83
|
-
* One
|
|
84
|
-
*
|
|
85
|
-
*
|
|
83
|
+
* One before|after image: the two equal-size crops on a dark canvas with a
|
|
84
|
+
* neutral divider between them. Left is always before; before/after is labelled
|
|
85
|
+
* by the caption under the image. The divider is identical on both sides, so the
|
|
86
|
+
* ONLY thing that differs across the pair is the actual change — no extra chrome
|
|
87
|
+
* (e.g. a coloured accent strip) that reads as a second diff.
|
|
86
88
|
*/
|
|
87
89
|
function compositePair(before, after) {
|
|
88
90
|
const PAD = 20;
|
|
89
91
|
const GAP = 28;
|
|
90
|
-
const BAR = 6; // accent strip height
|
|
91
92
|
const w = Math.max(before.width, after.width);
|
|
92
93
|
const h = Math.max(before.height, after.height);
|
|
93
94
|
const width = PAD + w + GAP + w + PAD;
|
|
94
|
-
const height = PAD +
|
|
95
|
+
const height = PAD + h + PAD;
|
|
95
96
|
const canvas = new PNG({ width, height });
|
|
96
97
|
fillRect(canvas, 0, 0, width, height, [13, 17, 23]); // GitHub dark
|
|
97
98
|
const leftX = PAD;
|
|
98
99
|
const rightX = PAD + w + GAP;
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
fillRect(canvas,
|
|
102
|
-
PNG.bitblt(before, canvas, 0, 0, before.width, before.height, leftX, top);
|
|
103
|
-
PNG.bitblt(after, canvas, 0, 0, after.width, after.height, rightX, top);
|
|
104
|
-
fillRect(canvas, PAD + w + GAP / 2 - 1, PAD, 2, BAR + h, [48, 54, 61]); // divider
|
|
100
|
+
PNG.bitblt(before, canvas, 0, 0, before.width, before.height, leftX, PAD);
|
|
101
|
+
PNG.bitblt(after, canvas, 0, 0, after.width, after.height, rightX, PAD);
|
|
102
|
+
fillRect(canvas, PAD + w + GAP / 2 - 1, PAD, 2, h, [48, 54, 61]); // divider
|
|
105
103
|
return canvas;
|
|
106
104
|
}
|
|
107
105
|
function readPng(file) {
|
package/docs/demo-composite.png
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "styleproof",
|
|
3
|
-
"version": "1.3.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.3.1",
|
|
4
|
+
"description": "Catch every CSS change before it ships — review PRs and certify refactors by the browser's computed styles, not pixels. Works with any styling system.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"playwright",
|
|
7
7
|
"css",
|