Skip to content

refactor: consolidate the duplicated visual-paint heuristics on the SDK's styleInk #3079

Closed as not planned

Description

@hblee12294

Deferred from #3070 (thread).

The repo now carries several independently-maintained "does this element visually paint" heuristics:

They already disagree: studio counts box-shadow and audio; the sdk counts the element's own text and per-pixel <img> alpha. That drift is the problem — same-looking predicates answering differently.

Direction: sdk as the shared home, studio delegating. The dependency arrow already points that way (studio → sdk), so studio can import but not the reverse.

But not as one predicate. They answer different questions — "is this element worth showing as an editable leaf" versus "is there ink at this exact point". The per-point half is meaningless for studio, and audio is meaningless for the paint query. The shared core is styleInk plus the transparent-colour parse, with each caller keeping its own policy on top.

Easiest first slice: the transparent-colour test. isTransparentColor in the sdk is a pure function with no policy in it, and it is currently duplicated three times with at least one copy that string-matches known spellings rather than reading the alpha (the bug fixed in #3070) — so the duplicates are likely wrong in the same way.

Activity

  1. leorivastech commented on Aug 8, 2026

    @leorivastech
    Contributor

    I'd like to take this. I have a tested implementation that moves the pure CSS alpha parser to Core, re-exports the host-facing API from the SDK, delegates Studio and captions to it, and injects the same function into the CLI's standalone browser audit while preserving each caller's policy. I'll open the focused PR shortly with regression tests and build verification.

  2. miga-heygen commented on Sep 16, 2026

    @miga-heygen
    Contributor

    Closing during backlog triage: this is an internal consolidation note with no user-visible defect attached. Happy to revisit alongside a concrete paint-heuristic bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions