2/7 Publish and pin which styling survives which export path - #303
Conversation
`custom_css` was the only export asymmetry the docs named, and it is the one
that was already bounded: it raises, by name, and the message says to use
`Engine.chromium`. The unbounded one went unmentioned. `class_names={slot: ...}`
and `styles={slot: {...}}` are read only by the browser client's `_applySlot`;
`_svg.py` and `_raster.py` read `spec["dom"]["style"]` and nothing else, and the
SVG writer emits no `class` attribute anywhere. A Tailwind-styled chart exports
to PNG with none of it applied and no diagnostic.
Dropping is the right behavior — raising would break every native export of a
chart that carries slot classes for its live view, which is the normal way to
use both surfaces — but only if it is written down. So it is now a contract in
three places a reader might actually land: `spec/api/export.md` §9 for the
engineering matrix, `docs/styling/chrome-slots.md` for the task-oriented one,
and `limitations-and-alpha-status.md` for the auditor.
`tests/test_export_style_survival.py` pins every row, including that the two
native writers agree with each other and not merely with the page: the styled
and unstyled renders of the same chart are asserted pixel-identical, so a future
change that teaches one writer about slot styles fails until the other learns
too.
Two asymmetries surfaced while mapping this and are now stated rather than
hidden. `xy.legend(style=...)` reaches native through a second channel
(`legend_options["style"]`, six keys) that the chart-level `styles={"legend":
...}` spelling never touches, so two spellings that are equivalent in the
browser are not equivalent in a PNG. `xy.colorbar(style=...)` has no native
channel at all.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Merging this PR will not alter performance
Comparing Footnotes
|
Stacked on #302.
The gap
custom_csswas the only export asymmetry the docs named — and it is the one that was already bounded. It raises, by name, and the message says to useEngine.chromium.The unbounded one went unmentioned.
class_names={slot: ...}andstyles={slot: {...}}are read only by the browser client's_applySlot._svg.pyand_raster.pyreadspec["dom"]["style"]and nothing else, and the SVG writer emits noclassattribute anywhere. A Tailwind-styled chart exports to PNG with none of it applied and no diagnostic.What changes
Dropping is the right behavior — raising would break every native export of a chart that carries slot classes for its live view, which is the normal way to use both surfaces together. But that is only defensible if it is written down, so it becomes a contract in three places a reader might land:
spec/api/export.md§9 — the engineering matrixdocs/styling/chrome-slots.md— the task-oriented onelimitations-and-alpha-status.md— for the auditorstyle=style=tokensstyles={slot: {...}}class_names={slot: "..."}custom_css=xy.legend(style=...)xy.colorbar(style=...)Two asymmetries surfaced while mapping this
xy.legend(style=...)reaches native through a second channel (legend_options["style"], six keys) that the chart-levelstyles={"legend": ...}spelling never touches — so two spellings that are equivalent in the browser are not equivalent in a PNG.xy.colorbar(style=...)has no native channel at all. Both are now stated rather than hidden.Verification
tests/test_export_style_survival.pypins every row, including that the two native writers agree with each other and not merely with the page: the styled and unstyled renders of the same chart are asserted pixel-identical. A future change that teaches one writer about slot styles fails until the other learns too.Generated by Claude Code