Index of every page on this site: llms.txt
All skills
tale-project avatar

/visual-aspect-analyzer

@02b23bc
by Taletale-project/tale47 stars
10
Run it yourself

Run this as the FINAL review step once you have finished a UI change you can load in a browser — it is the visual-regression gate, run once at the end (not after every edit), and the change is not done until it reports `score: 100`. It drives a real browser over the page, auto-detects its relevant elements (no selectors), labels each by ARIA role + accessible name, and reports which changed the rendered frame, what each is anchored to (screen/page/ancestor), and what transition defects (layout-shift, flicker, jank, dithering) occurred, with a 0–100 score. Run `bun src/analyze-cli.ts <url>` for a lean JSON report (`--full` for the faithful record). Also read before resolving what an element is anchored to, or editing the instrument, analysis, or element auto-detection in this directory.

  • 73 files
  • 505.3 KB
  • Updated 4 months ago
  • GitHub
Use this Skill: https://skilld.dev/gh/tale-project/tale/visual-aspect-analyzer

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

srcimpact-detection.md

≈1.7k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Impact detection & affected-by — the optimal check

Read when changing impact.ts, report.ts, or the instrument's counterfactual. This is the answer to "how do we optimally check which elements have visual impact, and which are affected by the matched elements."

Impact is temporal, not a snapshot

Ground truth is "hide the element; if the rendered frame changes, it had impact." But an element can flip from no-impact to impactful mid-session — an image finishes loading, text is injected, it scrolls into view, an occluder is removed — and back again. So a single point-in-time hide-and-diff would mislabel an element by the one instant it was probed. The correct primitive is to evaluate impact per frame and union it (ever-impactful), derived from the continuous recording we already collect.

effectivePaint(sample) in impact.ts encodes one frame's verdict; hasPaintImpact ORs it across the session and paintIntervals reports when.

Two modes, two independent checks

Mode Question Signal
paints renders pixels the user sees paints (text/bg/border/shadow/replaced) AND visible AND inViewport AND opacity>0 AND !occluded
affects layout occupies space that positions others observed co-movement + layout-shift sources + counterfactual

Occlusion is folded into the paint check, so a paints-in-isolation element fully covered by an opaque element scores zero — the same verdict the pixel counterfactual gives, for free.

The two-tier strategy (cheap first, counterfactual last)

Tier 1 — observe from the continuous record (no DOM mutation). The page runs the experiment for us: whenever a tracked element changes size/position/presence, any candidate that moves in the same frame is affected by it (computeAffected → co-movement). layout-shift entries whose sources[] co-occur (within a frame budget) with a tracked change confirm it. This is inherently temporal and catches elements that only become affected partway through.

Tier 2 — the counterfactual, targeted. Used only where Tier 1 is ambiguous, at the moments that matter:

  • Layout, invisible. For a tracked element that never changed on its own (no free experiment), the instrument's keyframe() sets display:none, reads every candidate rect (forces synchronous layout), and restores — all before the browser paints, so the user sees nothing. Elements that move become its layoutProbe.movedKeys.
  • Paint, brief flash. Only for genuine occlusion ambiguity: the driver toggles visibility:hidden, recaptures, diffs the element's sub-rect (occlusion-correct), and restores — at keyframes, not once.

Affected-by attribution is causal

affectedBy lists the tracked elements that moved in the same frame as the candidate (recordAttribution). Co-movement proposes; layout-shift sources and the counterfactual confirm. Because a tracked element that itself moves is reported as matched (not affected), candidates are the only affected entries — keeping attribution clean.

Same-frame co-movement is correlational, so it is constrained by how layout can actually propagate a displacement, keyed on whether the candidate is in normal flow that frame (outOfFlow, sampled from computed position):

  • In flow (static/relative/sticky): a preceding element's growth shifts it, so any co-changing tracked element is a plausible cause. relative and sticky stay in flow, so they remain pushable (a relative element offset via top is also pushed by content above it — both are real).
  • Out of flow (absolute/fixed): a sibling's in-flow growth cannot move it — only its containing block can. So it is attributed solely to a co-changing ancestor (the positioned ancestor it is laid out against); a coincidental same-frame self-move (e.g. an absolute element animating its own top) next to an unrelated grower is not attributed.

Boundaries (where attribution is intentionally conservative, not a bug):

  • Causation is computed for candidates; a tracked component root that is itself dragged by another element is reported as matched with its move captured, but without an affectedBy arrow.
  • An element first made "relevant" by the very change you are measuring is discovered at that moment, so its before-state isn't sampled (no move recorded) — the general temporal / discovery boundary, not specific to positioning.
  • Two in-flow elements that move in the exact same keyframe are both candidates for attribution from co-movement alone; document order isn't modelled, so a genuine push and a same-frame coincidence are only separated when a layout-shift source or counterfactual weighs in.

Cost controls

  • The paint-property timeline is event-driven (recompute on mutation, not every frame).
  • The rAF sampler follows only tracked + candidate elements (candidates are each tracked element's ancestor chain plus the nodes a layout-shift names as sources), never the whole DOM.
  • Pixel diffs are sub-rect, skipped when a cheap frame hash is unchanged.
  • The counterfactual is the exception — batched, time-targeted, never a per-frame sweep.

Anchor resolution (steps 6-7)

anchors.ts applies the ordered rules and stops at the first match: screen (constant in viewport coords, no page anchors) → page (all four document edges constant) → ancestor (highest ancestor preserving the direct parent's constant-offset edge set) → null. Computed on the element's primary segment so multi-segment sessions stay deterministic.

Single-axis scroll is handled per edge. Screen anchoring is decided edge-by-edge: an edge is screen-anchored when, in at least one frame, the page scrolled under it (the edge held constant in viewport coords while it moved in document coords). So a full-width fixed bar under vertical-only scroll has its top/bottom edges pinned to the screen and resolves to screen (with anchoredEdges: ['top','bottom']) — it does not need both axes to scroll. An element the page never scrolls under has no screen-anchored edges and falls through to the page/ancestor/null rules.

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No third-party reports yet.

Signed by skilld at 02b23bc. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated 4 months ago

README badge

README badge for tale-project/tale/visual-aspect-analyzer