Skip to content

Add CSS isolation support to SVG Frame#233

Draft
arnavsharma990 wants to merge 2 commits intocreativescala:mainfrom
arnavsharma990:feature/frame-isolation-property
Draft

Add CSS isolation support to SVG Frame#233
arnavsharma990 wants to merge 2 commits intocreativescala:mainfrom
arnavsharma990:feature/frame-isolation-property

Conversation

@arnavsharma990
Copy link
Contributor

Adds support for the CSS isolation property on Frame.

  • Introduces a minimal Isolation sealed trait (Auto, Isolate)
  • Adds optional isolation field to Frame
  • Emits isolation in svgTag only when set
  • No behavior changes when isolation is not specified

Closes #228

Copilot AI review requested due to automatic review settings March 3, 2026 20:47
@arnavsharma990
Copy link
Contributor Author

Note: The issue description(#228 ) mentions that an ideal solution could allow arbitrary CSS styles on Frame, potentially reusing ScalaTags.

This PR intentionally focuses only on supporting the isolation property to keep the change minimal and aligned with the current issue scope. If desired, I’d be happy to explore a more general style mechanism in a follow up PR.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for the CSS isolation property on the SVG root element via Frame, allowing callers to control blending/stacking behavior of rendered SVG output.

Changes:

  • Introduces doodle.svg.effect.Isolation ADT (Auto, Isolate) with toCSS rendering.
  • Extends doodle.svg.effect.Frame with an optional isolation field and a withIsolation builder.
  • Updates SVG root tag rendering to emit isolation: ... in the inline style when configured.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
svg/shared/src/main/scala/doodle/svg/effect/Isolation.scala Adds an ADT representing CSS isolation values and CSS serialization.
svg/shared/src/main/scala/doodle/svg/effect/Frame.scala Adds optional isolation to the public Frame API plus a builder method.
svg/shared/src/main/scala/doodle/svg/algebra/Svg.scala Appends isolation into the generated root <svg> style attribute.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- Refactor SVG style attribute building to use List of fragments joined
  with space, eliminating trailing space when isolation is not set
- Remove unused imports in SvgSpec
- Add tests for svgTag style generation:
  - No isolation: output has no trailing space or isolation property
  - With Isolation.Isolate: isolation property emitted
  - With background + isolation: both properties present
  - With Isolation.Auto: auto value emitted
  - FixedSize variants of the above
@arnavsharma990 arnavsharma990 marked this pull request as draft March 5, 2026 07:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow isolate property to be specified in Frame

2 participants