Repository navigation
feat(studio): export the canvas edit overlay so a host can mount its handles - #4708
Conversation
jrusso1020
left a comment
There was a problem hiding this comment.
Review at eea028de592ad6d519a915d4ed9d1bb64766b9ab.
Verdict: APPROVE
This adds an export and changes no behaviour. DomEditOverlay, DomEditOverlayProps and DomEditGroupPathOffsetCommit are now exported from the package entry, next to the existing ConnectedDomEditOverlay. The body's claims hold. The component itself is unchanged, and Studio still renders it through ConnectedDomEditOverlay.
Findings
Blocking: none.
Non-blocking:
DomEditOverlayPropsuses four types that the package still doesn't export by name:PreviewMouseDownOptions(onCanvasMouseDown),GestureRecordingState(recordingState), andZOrderPatchandZOrderAction(onApplyZIndex). A host can still type its handlers, for example asDomEditOverlayProps["onApplyZIndex"], so nothing is blocked. Exporting them would help a host that writes those handlers separately.
Claims checked
- "Declared in the package types without being exported." True at the base:
index.tsexportedConnectedDomEditOverlayandDomEditSelection, but not the plain overlay. - The published entry carries it.
publishConfigpoints.atdist/index.jsanddist/index.d.ts. Afterbun run buildat this head,dist/index.d.tsexportsDomEditOverlay,type DomEditOverlayPropsandtype DomEditGroupPathOffsetCommit, anddist/index.jsexportsDomEditOverlay. - "Removing the export fails it." True. With the
export { DomEditOverlay }line deleted fromindex.ts, the new test fails (1 failed, 2 passed). I restored the line afterwards.
Tests run
bun install --frozen-lockfileandbun run build: clean.vitest run src/components/editor/DomEditOverlayHover.test.tsx: 3/3 pass.tsc --noEmitinpackages/studio: clean.
Checks
37 checks pass and none fail, including Typecheck, Build, Test (studio), Lint, Fallow audit, regression, Studio and player captures, and Test reachability. Smoke: global install was still pending when I posted this. The rest are skipped by path filters.
Gate
There were no reviews on this head when I posted. reviewDecision is REVIEW_REQUIRED and mergeStateStatus is BLOCKED. The branch requires approval of the last push, so an approval at this head clears the review requirement.
— Rames
What
DomEditOverlay, the canvas layer that draws Studio's move, resize and rotate handles and its snap lines, is exported from the package entry, with its props typeDomEditOverlayPropsandDomEditGroupPathOffsetCommit.Why
A host that runs its own preview and picker could only mount
ConnectedDomEditOverlay, which throws outsideDomEditProviderand reads every handler from a fulluseDomEditSession. The plain overlay takes its selection and commits as props, but it was declared in the package types without being exported, so a host could not import it.How
One export line and one
exportkeyword on the props interface. No behaviour change.Before
A host page with its own preview: the package has no
DomEditOverlayto import.After
The same host page mounts
DomEditOverlayover its preview with its own selection: the handles draw on the title, and a drag moves it live. Saving the move comes with the geometry commit hook in the stacked PR, so this page passes commits that refuse.Test plan
DomEditOverlayHover.test.tsx): the package entry exports the same overlay Studio renders. Removing the export fails it.