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.
Deferred from #3070 (thread).
The repo now carries several independently-maintained "does this element visually paint" heuristics:
elementPaintsInk/styleInk—packages/sdk/src/adapters/iframe.ts(new in feat(sdk): expose a paint query for transparent-composition hit-testing #3070)hasVisualPresence+VISUAL_LEAF_TAGS—packages/studio/src/components/editor/domEditingElement.ts:29They already disagree: studio counts
box-shadowandaudio; 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
audiois meaningless for the paint query. The shared core isstyleInkplus the transparent-colour parse, with each caller keeping its own policy on top.Easiest first slice: the transparent-colour test.
isTransparentColorin 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.