Wisps: drawing at the end of the page; none in forced colours; layers only while playing
Review (Claude Fable 5.1) of e7a3d0b: the 175 KB drawing sat at the top of a no-store page, ahead of the first words (Medium); a CanvasText blur in forced colours; 35 layers held for the page's life; and a NaN check that could not see whole-number path data (Lows). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit e9c986bbbdbf03b8db474583a9c7c8f85bd98b9d)
4 files changed,
+21
−4
internal/home/page.go+3 −1internal/home/static/site/home.css+5 −1internal/home/static/site/index.html+1 −1internal/home/wisp/wisp_test.go+12 −1
CI passed — run details
diff --git a/internal/home/page.go b/internal/home/page.go| index ce1ed30..7566a37 100644 |
| --- a/internal/home/page.go |
| +++ b/internal/home/page.go |
| @@ -70,7 +70,9 @@ func mountSite(r chi.Router) { |
| } |
| // The wisps (package wisp): <!-- wisp:sprite --> is where the drawing |
| -// goes, once, at the top of the body; <!-- wisp:N --> is where a heading's |
| +// goes, once, at the end of the body ā the front page is no-store, so a |
| +// visitor reads it every time, and there it never stands between them and |
| +// the first words; <!-- wisp:N --> is where a heading's |
| // wisp goes, inside the heading, which also carries data-wisp="N" for |
| // home.css to time it by. |
| var ( |
diff --git a/internal/home/static/site/home.css b/internal/home/static/site/home.css| index aac7613..090ab72 100644 |
| --- a/internal/home/static/site/home.css |
| +++ b/internal/home/static/site/home.css |
| @@ -206,6 +206,9 @@ h1, h2, h3 { text-wrap: balance; } |
| composited, never repainted. No scroll-driven animations, or reduced |
| motion asked for: no wisp, and nothing missing. */ |
| .wisp { display: none; } |
| +/* In forced colours the wisp would be a CanvasText blur behind CanvasText |
| + words: gone, like the sky's colour. */ |
| +@media (forced-colors: active) { h2 .wisp { display: none !important; } } |
| .wisp-defs { position: absolute; width: 0; height: 0; overflow: hidden; } |
| main { overflow-x: clip; } |
| @@ -232,7 +235,6 @@ main { overflow-x: clip; } |
| pointer-events: none; |
| color: var(--rst-accent); |
| opacity: 0; |
| - will-change: opacity, transform; |
| } |
| /* The three boxes meet corner to corner, so one wisp runs through |
| them. The tails are pixel-sized, as package wisp draws them. */ |
| @@ -246,6 +248,8 @@ main { overflow-x: clip; } |
| and the animation is withdrawn, ready to play again. */ |
| @container style(--wisp-play: running) { |
| .wisp { |
| + /* A layer of its own only while its heading's wisp is playing. */ |
| + will-change: opacity, transform; |
| animation: wisp-pass 1.9s cubic-bezier(.33, 0, .25, 1) both; |
| animation-delay: calc(var(--wisp-i) * 0.32s + var(--wisp-d0)); |
| } |
diff --git a/internal/home/static/site/index.html b/internal/home/static/site/index.html| index 8722a1c..4d3f0fc 100644 |
| --- a/internal/home/static/site/index.html |
| +++ b/internal/home/static/site/index.html |
| @@ -21,7 +21,6 @@ |
| <link rel="stylesheet" href="/static/site/home.css"> |
| </head> |
| <body> |
| -<!-- wisp:sprite --> |
| <a class="skip" href="#directory">Skip to the apps</a> |
| @@ -262,5 +261,6 @@ |
| </div> |
| </footer> |
| +<!-- wisp:sprite --> |
| </body> |
| </html> |
diff --git a/internal/home/wisp/wisp_test.go b/internal/home/wisp/wisp_test.go| index e646756..e53f382 100644 |
| --- a/internal/home/wisp/wisp_test.go |
| +++ b/internal/home/wisp/wisp_test.go |
| @@ -3,6 +3,7 @@ package wisp |
| import ( |
| "bytes" |
| "regexp" |
| + "strconv" |
| "strings" |
| "sync" |
| "testing" |
| @@ -44,7 +45,17 @@ func TestSpriteHasEveryStretch(t *testing.T) { |
| } |
| } |
| if strings.Contains(s, "NaN") || strings.Contains(s, "Inf") { |
| - t.Fatal("sprite has a non-finite coordinate") |
| + t.Fatal("sprite has a non-finite number") |
| + } |
| + // Path data is whole numbers, so a NaN would arrive as whatever Go's |
| + // float-to-int conversion makes of it (a huge negative, or 0), never |
| + // as "NaN". Every step of every outline is small: bound them all. |
| + for _, d := range regexp.MustCompile(` d="([^"]+)"`).FindAllStringSubmatch(s, -1) { |
| + for _, n := range regexp.MustCompile(`-?\d+`).FindAllString(d[1], -1) { |
| + if v, _ := strconv.Atoi(n); v < -3000 || v > 3000 { |
| + t.Fatalf("a path coordinate or step of %d is out of any box: %.60sā¦", v, d[1]) |
| + } |
| + } |
| } |
| for _, f := range []string{"glow", "body", "fibre"} { |
| if !strings.Contains(s, `<filter id="wisp-`+f+`"`) { |