Skip to content

feat(apollo-react): expose canvas handle positioning utility#812

Merged
SreedharAvvari merged 1 commit into
mainfrom
codex/expose-handle-positioning
Jun 13, 2026
Merged

feat(apollo-react): expose canvas handle positioning utility#812
SreedharAvvari merged 1 commit into
mainfrom
codex/expose-handle-positioning

Conversation

@SreedharAvvari

@SreedharAvvari SreedharAvvari commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Moved the existing calculateGridAlignedHandlePositions logic from ButtonHandleStyleUtils into src/canvas/utils/handle-positioning.ts so it can be shared with consumers.
  • This is a 1:1 move of the existing handle positioning algorithm and its behavior tests, not a rewrite.
  • Re-exported calculateGridAlignedHandlePositions from the public canvas utils barrel, making it available from @uipath/apollo-react/canvas/utils and the root canvas barrel.
  • Kept the small snap helper internal to handle-positioning.ts; NodeUtils.snapToGrid is not changed.
  • Updated ButtonHandle and SmartHandle to use the moved helper for rendering.

Why

Downstream canvas layout/tidy code needs to align with Apollo's actual rendered side-handle slots without duplicating the placement math.

Validation

  • pnpm --dir packages/apollo-react exec vitest --run src/canvas/components/ButtonHandle src/canvas/utils/handle-positioning.test.ts
  • pnpm --dir packages/apollo-react exec tsc --noEmit --pretty false --project tsconfig.json
  • pnpm --dir packages/apollo-react exec biome check src/canvas/components/ButtonHandle/ButtonHandle.tsx src/canvas/components/ButtonHandle/SmartHandle.tsx src/canvas/components/ButtonHandle/ButtonHandleStyleUtils.ts src/canvas/components/ButtonHandle/ButtonHandleStyleUtils.test.ts src/canvas/utils/index.ts src/canvas/utils/handle-positioning.ts src/canvas/utils/handle-positioning.test.ts

Copilot AI review requested due to automatic review settings June 12, 2026 12:20
@github-actions

github-actions Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (PT)
apollo-design 🟢 Ready Preview, Logs Jun 12, 2026, 06:13:04 AM
apollo-docs 🟢 Ready Preview, Logs Jun 12, 2026, 06:13:04 AM
apollo-landing 🟢 Ready Preview, Logs Jun 12, 2026, 06:13:04 AM
apollo-vertex 🟢 Ready Preview, Logs Jun 12, 2026, 06:13:04 AM

@SreedharAvvari SreedharAvvari changed the title [codex] expose canvas handle positioning utility feat(apollo-react): expose canvas handle positioning utility Jun 12, 2026
@github-actions github-actions Bot added the size:L 100-499 changed lines. label Jun 12, 2026
@SreedharAvvari SreedharAvvari added the dev-packages Adds dev package publishing on pushes to this PR label Jun 12, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Dependency License Review

  • 1922 package(s) scanned
  • ✅ No license issues found
  • ⚠️ 2 package(s) excluded (see details below)
License distribution
License Packages
MIT 1692
ISC 89
Apache-2.0 55
BSD-3-Clause 27
BSD-2-Clause 23
BlueOak-1.0.0 8
MPL-2.0 4
MIT-0 3
CC0-1.0 3
MIT OR Apache-2.0 2
(MIT OR Apache-2.0) 2
Unlicense 2
LGPL-3.0-or-later 1
Python-2.0 1
CC-BY-4.0 1
(MPL-2.0 OR Apache-2.0) 1
Unknown 1
Artistic-2.0 1
(WTFPL OR MIT) 1
(BSD-2-Clause OR MIT OR Apache-2.0) 1
CC-BY-3.0 1
0BSD 1
(MIT OR CC0-1.0) 1
MIT AND ISC 1
Excluded packages
Package Version License Reason
@img/sharp-libvips-linux-x64 1.2.4 LGPL-3.0-or-later LGPL pre-built binary, not linked
khroma 2.1.0 Unknown MIT per GitHub repo, missing license field in package.json

@github-actions

github-actions Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

📦 Dev Packages

🧹 Dev packages cleaned up after PR close.

Last updated: 2026-06-12 20:35:27 PT

@SreedharAvvari SreedharAvvari marked this pull request as ready for review June 12, 2026 12:22

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR extracts the grid-aligned side-handle slot positioning logic into a dedicated canvas utility and exposes it publicly so downstream canvas layout/tidy code can match Apollo’s rendered handle placement without duplicating the math.

Changes:

  • Added calculateGridAlignedHandlePositions to src/canvas/utils/handle-positioning.ts with dedicated unit tests.
  • Re-exported calculateGridAlignedHandlePositions from the public canvas utils barrel (and therefore from the root canvas barrel).
  • Updated ButtonHandle/SmartHandle to consume the shared helper; moved snapToGrid tests into NodeUtils.test.ts and removed the old helper implementation from ButtonHandleStyleUtils.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/apollo-react/src/canvas/utils/NodeUtils.ts Extends snapToGrid to accept a custom grid size parameter.
packages/apollo-react/src/canvas/utils/NodeUtils.test.ts Adds unit tests covering snapToGrid default/custom grid behavior.
packages/apollo-react/src/canvas/utils/index.ts Re-exports calculateGridAlignedHandlePositions from the public utils barrel.
packages/apollo-react/src/canvas/utils/handle-positioning.ts Introduces the extracted public handle positioning utility.
packages/apollo-react/src/canvas/utils/handle-positioning.test.ts Adds focused tests for handle positioning behavior and edge cases.
packages/apollo-react/src/canvas/components/ButtonHandle/ButtonHandle.tsx Switches to importing handle positioning from the shared util.
packages/apollo-react/src/canvas/components/ButtonHandle/SmartHandle.tsx Switches to importing handle positioning from the shared util.
packages/apollo-react/src/canvas/components/ButtonHandle/ButtonHandleStyleUtils.ts Removes the previous in-file snapToGrid and positioning helper implementation.
packages/apollo-react/src/canvas/components/ButtonHandle/ButtonHandleStyleUtils.test.ts Removes tests that were relocated to NodeUtils / handle-positioning tests.

Comment thread packages/apollo-react/src/canvas/utils/NodeUtils.ts Outdated
Comment thread packages/apollo-react/src/canvas/utils/handle-positioning.ts Outdated
@SreedharAvvari SreedharAvvari force-pushed the codex/expose-handle-positioning branch from b3f5e94 to 71ced11 Compare June 12, 2026 12:32
Copilot AI review requested due to automatic review settings June 12, 2026 12:38
@SreedharAvvari SreedharAvvari force-pushed the codex/expose-handle-positioning branch from 71ced11 to 8e6ac04 Compare June 12, 2026 12:38

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.

Comment thread packages/apollo-react/src/canvas/utils/handle-positioning.ts Outdated
Comment thread packages/apollo-react/src/canvas/utils/handle-positioning.ts
Comment thread packages/apollo-react/src/canvas/utils/handle-positioning.ts Outdated
Comment thread packages/apollo-react/src/canvas/utils/handle-positioning.test.ts
Comment thread packages/apollo-react/src/canvas/utils/handle-positioning.test.ts
Comment thread packages/apollo-react/src/canvas/utils/handle-positioning.test.ts
@SreedharAvvari SreedharAvvari force-pushed the codex/expose-handle-positioning branch from 8e6ac04 to e9705c1 Compare June 12, 2026 12:51
@SreedharAvvari SreedharAvvari requested a review from Copilot June 12, 2026 12:52

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

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

Comment thread packages/apollo-react/src/canvas/utils/handle-positioning.ts Outdated
Comment thread packages/apollo-react/src/canvas/utils/handle-positioning.ts
Comment thread packages/apollo-react/src/canvas/utils/index.ts Outdated
@SreedharAvvari SreedharAvvari force-pushed the codex/expose-handle-positioning branch from e9705c1 to d17386d Compare June 12, 2026 13:07
@SreedharAvvari SreedharAvvari merged commit e17d10a into main Jun 13, 2026
42 of 43 checks passed
@SreedharAvvari SreedharAvvari deleted the codex/expose-handle-positioning branch June 13, 2026 03:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dev-packages Adds dev package publishing on pushes to this PR pkg:apollo-react size:L 100-499 changed lines.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants