v1.7.1
What's Changed
Added
-
is-styleguide-renderon<html>for every component and page render. A
component's JS sometimes has to know it is being previewed rather than served
live — to skip page-load choreography a screenshot would otherwise catch
mid-flight, or to lift a production-only guard. The renderer is the only layer
that knows this for a fact, so consumers should not have to derive it.
Without the class the reachable signal islocation.pathname, and two real
components in a downstream project ended up testing
startsWith('/styleguide/render/')— which couples them to this package's
ROUTING and would break silently the day a route moves, with no failing test
to say so.Emitted unconditionally, with no
iframeconfig required, and it composes
withiframe.html_class/ thedarktheme class rather than replacing them.
Consumers on an older version can seed the same class through
iframe.html_class, so the check reads identically either way and needs no
version branch.Two worked cases from the project that prompted this: a hero whose reveal is a
1000 mssetTimeoutplus a 0.5 s transition (the suite shoots ~1.5 s earlier
and captured a blank frame), andvanilla-cookieconsent, whose default
hideFromBotsmatchesnavigator.webdriverand therefore hides from every
automated browser — correct in production, a blank baseline in a preview.The 404 render is deliberately untouched: it is the package's own error page,
not a consumer's component, and nothing of theirs runs inside it.
Pull Requests
- #102 — feat(render): announce the styleguide context on
Full Changelog: v1.7.0...v1.7.1