Skip to content

Import PPTX arrow callouts, brackets, and homePlate alias#253

Merged
hackerwins merged 1 commit into
mainfrom
feat/pptx-unsupported-shapes
May 16, 2026
Merged

Import PPTX arrow callouts, brackets, and homePlate alias#253
hackerwins merged 1 commit into
mainfrom
feat/pptx-unsupported-shapes

Conversation

@hackerwins

@hackerwins hackerwins commented May 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Adds 11 new ShapeKind values (7 arrow callouts + 4 brackets/braces) and a homePlate → pentagonArrow import alias, fixing a silent import bug where slide 7 of a real Yorkie deck rendered the centre shape as an empty rotated rectangle.
  • Root cause: prstToShapeKind() returned undefined for unsupported presets, and the importer fell back silently to rect (shape.ts:389). The Yorkie 캐즘 deck has three such presets — rightArrowCallout (slide 7), leftBracket (slide 28), homePlate (slide 31).
  • Brackets/braces are open paths in OOXML; the renderer now skips fill for them (OPEN_PATH_KINDS in shape-renderer.ts) so the auto-close behavior doesn't produce misleading filled C-rects. Stroke (the dominant real-world usage) traces just the visible outline.
  • Roadmap count moves 117 → 128; design doc and registry snapshot updated.

Test plan

  • pnpm verify:fast green (slides 981, docs 787, others pass)
  • New unit tests: 7 arrow callouts (geometry hit-test + slide-7 adj values + degenerate frames), 4 brackets/braces (corner-arc cutout probes at max radius)
  • Flipped geometry.test.ts negative assertions to positive resolutions + new homePlate alias test
  • Manual end-to-end import of the user's PPTX confirmed slide 7 / 28 / 31 now resolve to their correct ShapeKinds
  • Visual smoke check in pnpm dev after merge (UI affordances for handles)

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • New Features

    • Added 11 new arrow callout shapes: right, left, up, down, left-right, up-down, and quad variants
    • Added 4 new bracket and brace shapes for enhanced shape library
    • Improved PPTX file import compatibility with previously unsupported preset shapes
  • Bug Fixes

    • Fixed silent fallback when importing unsupported callout and bracket shapes from PPTX files

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 16, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@hackerwins has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 33 minutes and 2 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: af3db414-266e-4eb0-839a-2f3304f6e848

📥 Commits

Reviewing files that changed from the base of the PR and between bb82c32 and 9321760.

⛔ Files ignored due to path filters (1)
  • packages/slides/test/view/canvas/shapes/__snapshots__/registry.snap.test.ts.snap is excluded by !**/*.snap
📒 Files selected for processing (20)
  • docs/design/slides/slides-shapes.md
  • docs/tasks/active/20260517-pptx-unsupported-shapes-todo.md
  • packages/slides/src/import/pptx/geometry.ts
  • packages/slides/src/model/element.ts
  • packages/slides/src/view/canvas/shape-renderer.ts
  • packages/slides/src/view/canvas/shapes/basic/left-brace.ts
  • packages/slides/src/view/canvas/shapes/basic/left-bracket.ts
  • packages/slides/src/view/canvas/shapes/basic/right-brace.ts
  • packages/slides/src/view/canvas/shapes/basic/right-bracket.ts
  • packages/slides/src/view/canvas/shapes/callouts/down-arrow-callout.ts
  • packages/slides/src/view/canvas/shapes/callouts/left-arrow-callout.ts
  • packages/slides/src/view/canvas/shapes/callouts/left-right-arrow-callout.ts
  • packages/slides/src/view/canvas/shapes/callouts/quad-arrow-callout.ts
  • packages/slides/src/view/canvas/shapes/callouts/right-arrow-callout.ts
  • packages/slides/src/view/canvas/shapes/callouts/up-arrow-callout.ts
  • packages/slides/src/view/canvas/shapes/callouts/up-down-arrow-callout.ts
  • packages/slides/src/view/canvas/shapes/index.ts
  • packages/slides/test/import/pptx/geometry.test.ts
  • packages/slides/test/view/canvas/shapes/basic/brackets.test.ts
  • packages/slides/test/view/canvas/shapes/callouts/right-arrow-callout.test.ts
📝 Walkthrough

Walkthrough

This PR extends the slides shape library from 117 to 128 ShapeKind values by adding support for 7 arrow-callout variants and 4 bracket/brace shapes. The implementation includes type-system updates, PPTX import alias mapping, rendering guards for open-path geometry, 11 new path builders with interactive adjustment handles, central shape registration, and comprehensive canvas and import tests.

Changes

Arrow Callouts and Bracket/Brace Shape Support

Layer / File(s) Summary
ShapeKind type extension
packages/slides/src/model/element.ts
ShapeKind union expanded to include rightArrowCallout, leftArrowCallout, upArrowCallout, downArrowCallout, leftRightArrowCallout, upDownArrowCallout, quadArrowCallout, leftBracket, rightBracket, leftBrace, rightBrace. Callout comment updated to reflect arrow callouts and added categories for brackets/braces.
PPTX import geometry mapping
packages/slides/src/import/pptx/geometry.ts, packages/slides/test/import/pptx/geometry.test.ts
PRST_ALIASES map translates OOXML legacy names (homePlatepentagonArrow) to ShapeKind values. prstToShapeKind consults aliases first, returning the mapped kind if registered in PATH_BUILDERS. Tests verify new shape names resolve and homePlate alias works.
Rendering logic for open-path shapes
packages/slides/src/view/canvas/shape-renderer.ts
OPEN_PATH_KINDS set identifies bracket/brace shapes with intentionally unclosed path geometry. drawShape conditionally applies ctx.fill() only when data.fill is set and kind is not in OPEN_PATH_KINDS, preserving stroke behavior for all.
Arrow callout shape builders
packages/slides/src/view/canvas/shapes/callouts/right-arrow-callout.ts, left-arrow-callout.ts, up-arrow-callout.ts, down-arrow-callout.ts, left-right-arrow-callout.ts, up-down-arrow-callout.ts, quad-arrow-callout.ts
Seven arrow-callout builders construct Path2D polygons using shaft/head/depth/body adjustment parameters. Each exports shared or unique *_ADJUSTMENTS specs (with defaults), a build*ArrowCallout path builder, and *_HANDLES for interactive corner/body-extent resizing via pointer Y/X normalization.
Bracket and brace shape builders
packages/slides/src/view/canvas/shapes/basic/left-bracket.ts, right-bracket.ts, left-brace.ts, right-brace.ts
Four basic shapes ([ ] { }) as open-path builders. bracketCornerRadius and braceCornerRadius helpers compute geometry from size and adjustment values. Each builder generates Path2D outlines via line/curve segments and exposes handles mapping pointer movement to corner-radius or notch-position adjustments.
Shape builder and adjustment registration
packages/slides/src/view/canvas/shapes/index.ts
All 11 new shapes imported and registered: path builders in PATH_BUILDERS, adjustment specs in ADJUSTMENT_SPECS, and interactive handles in ADJUSTMENT_HANDLES.
Canvas rendering tests
packages/slides/test/view/canvas/shapes/basic/brackets.test.ts, packages/slides/test/view/canvas/shapes/callouts/right-arrow-callout.test.ts
brackets.test.ts validates left/right bracket and brace open-path geometry (corner regions, spine symmetry, non-degeneracy) via ctx.isPointInPath(). right-arrow-callout.test.ts hits-tests all 7 arrow callouts for tip/shaft coverage and robustness against zero/near-zero dimensions, plus regression check for specific slide parameters.
Design documentation and task notes
docs/design/slides/slides-shapes.md, docs/tasks/active/20260517-pptx-unsupported-shapes-todo.md
Design doc updated to show 128 total shapes, expanded catalog callout section with arrow variants, and added brackets/braces categories. Task note captures issue (missing rightArrowCallout fallback), lists targeted unsupported PPTX names, outlines implementation/test/doc follow-ups, and records OOXML geometry adjustment parameters.

Sequence Diagram

sequenceDiagram
  participant PPTX as PPTX Importer
  participant Alias as PRST_ALIASES
  participant PathBuilder as Path Builder Registry
  participant Canvas as Canvas Renderer
  participant Shapes as Shape Geometry
  
  PPTX->>Alias: prstToShapeKind("homePlate")
  Alias->>PathBuilder: lookup aliased "pentagonArrow"
  alt Alias found and registered
    PathBuilder-->>PPTX: return ShapeKind
  else Fallback
    PPTX->>PathBuilder: lookup direct "homePlate"
    PathBuilder-->>PPTX: cast/check result
  end
  
  PPTX->>Canvas: render shape with ShapeKind
  Canvas->>Shapes: buildArrowCallout/buildBracket(size, adjustments)
  Shapes->>Shapes: compute geometry (shaft/head/depth/body or radius/notch)
  Shapes-->>Canvas: return Path2D
  
  alt Open-path kind (bracket/brace)
    Canvas->>Canvas: skip ctx.fill(), apply ctx.stroke()
  else Closed-path kind (callout)
    Canvas->>Canvas: apply ctx.fill() + ctx.stroke()
  end
  Canvas-->>PPTX: rendered shape on canvas
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • wafflebase/wafflebase#241: Both modify the ShapeKind union in packages/slides/src/model/element.ts; this PR adds arrow callouts/brackets/braces while #241 modifies connector element support.
  • wafflebase/wafflebase#210: Both extend the ADJUSTMENT_HANDLES registry and AdjustmentHandle infrastructure in packages/slides/src/view/canvas/shapes/; #210 introduces the system and this PR populates it with 11 new shape adjustments.
  • wafflebase/wafflebase#226: Both register shape builders and adjustments in packages/slides/src/view/canvas/shapes/index.ts; this PR extends the PATH_BUILDERS, ADJUSTMENT_SPECS, and ADJUSTMENT_HANDLES registries.

Poem

🐰 Eleven new shapes hop into the frame,
Arrow callouts and brackets stake their claim,
Adjustable handles that twist and bend,
Open paths guard their geometry's end,
From PPTX aliases to canvas delight—
128 kinds render sharp and bright!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly and specifically summarizes the main change: importing support for PPTX arrow callouts, brackets, and the homePlate alias. It directly reflects the primary additions and fixes made in the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/pptx-unsupported-shapes

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 6

🧹 Nitpick comments (1)
packages/slides/test/view/canvas/shapes/basic/brackets.test.ts (1)

30-35: ⚡ Quick win

Consider adding explanatory comment for consistency.

The leftBracket test (lines 19-22) includes helpful geometric reasoning explaining why specific coordinates were chosen. Adding a similar comment here would improve consistency and maintainability. As per coding guidelines, comments should explain the 'why' behind complex logic—the choice of coordinates (39, 1) and (39, 199) involves geometric reasoning that would benefit from documentation similar to the leftBracket test.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/slides/test/view/canvas/shapes/basic/brackets.test.ts` around lines
30 - 35, The rightBracket test lacks the explanatory geometric comment present
in leftBracket; add a brief comment in the it('rightBracket...') block
explaining why points (39,1) and (39,199) were chosen — i.e., they sit just
inside the bracket's carved top-right and bottom-right corners given
buildRightBracket({ w: 40, h: 200 }, [50000]) — so future readers understand the
geometric reasoning used to assert ctx.isPointInPath results for the
buildRightBracket path.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/design/slides/slides-shapes.md`:
- Line 398: Add the missing OOXML alias mapping by inserting the alias entry
"homePlate -> pentagonArrow" into the OOXML alias table in slides-shapes.md so
the canonical alias list matches the roadmap; ensure the new row uses the same
table format and ordering/style as the other alias rows in the OOXML alignment
section.

In `@docs/tasks/active/20260517-pptx-unsupported-shapes-todo.md`:
- Around line 75-78: Update the bracket/brace note under the "Brackets render
via a single PathBuilder" paragraph to reflect current rendering: instead of
saying filled open paths "auto-close acceptably," state that for open-path kinds
the renderer skips applying fill (only stroke is used). Keep the existing
mention of using a single open path and the adj: corner radius note (percent of
min(w,h)/2, default 8333), but replace the sentence about auto-closing with an
explicit statement that fills are omitted for open-path bracket/brace shapes.
- Around line 5-6: Remove the embedded absolute local path that contains the
username from the task note (the /Users/... path shown in the diff) and replace
it with a sanitized sample or placeholder (e.g. <path/to/file>.pptx or
Downloads/YourFile.pptx) so the note is non‑identifying and portable; update the
sentence mentioning slide 7 to reference the sanitized filename/placeholder
instead of the original absolute path and keep the descriptive text about the
empty rotated centre shape unchanged.

In `@packages/slides/src/view/canvas/shapes/basic/left-bracket.ts`:
- Around line 48-55: The bracket handle currently ignores the shape's stored
radius and mis-maps pointer drags: update position to call
bracketCornerRadius(size, /*current radius value from shape data*/ ) instead of
passing undefined so the handle location reflects the actual radius; in apply,
compute the pointer-to-radius mapping using the same geometry as
bracketCornerRadius (use min(w,h) and half of that for the vertical scale)
rather than h/2, keep the DEF_BRACKET_RADIUS fallback when height is
non-positive, and clamp the resulting raw value into [0,50000] as before (refer
to position, bracketCornerRadius, insetAlongAxis, apply, and DEF_BRACKET_RADIUS
to locate the changes).

In `@packages/slides/src/view/canvas/shapes/basic/right-bracket.ts`:
- Around line 21-28: The bracket handle mapping uses the frame height only,
desynchronizing radius when the frame is non-square; update the position and
apply logic in the right-bracket shape so the handle is computed relative to the
geometry's min(width,height) basis: in position (function position) compute the
corner inset using bracketCornerRadius(size, undefined) and call insetAlongAxis
with that radius against the min of size.w and size.h (instead of size.h), and
in apply ({ h }, _start, pointer) replace h/2 bounds with (Math.min(w, h) / 2)
(use the geometry width/height min) when clamping pointer.y and when deriving
raw (fall back to DEF_BRACKET_RADIUS as before); reference bracketCornerRadius,
insetAlongAxis, position and apply to locate the changes.

In `@packages/slides/src/view/canvas/shapes/callouts/right-arrow-callout.ts`:
- Around line 67-86: The handle compute in apply can produce adj4 values that
place the handle past the body/head seam for deep heads; reproduce the same
dx1/seam calculation used in buildRightArrowCallout and clamp pointer.x against
w - dx1 before converting to the 0..100000 adj4 value: derive dx1 from the
current head/depth parameters (start[1], start[2]) using the same formula/build
helper as buildRightArrowCallout, compute maxX = Math.max(0, w - dx1), clamp x =
Math.max(0, Math.min(maxX, pointer.x)), then compute newA4 = maxX > 0 ?
Math.round((x / w) * 100000) (or divide by maxX if buildRightArrowCallout maps
over that range) and finally bound newA4 to 0..100000 as before so the handle
cannot enter the dead range.

---

Nitpick comments:
In `@packages/slides/test/view/canvas/shapes/basic/brackets.test.ts`:
- Around line 30-35: The rightBracket test lacks the explanatory geometric
comment present in leftBracket; add a brief comment in the it('rightBracket...')
block explaining why points (39,1) and (39,199) were chosen — i.e., they sit
just inside the bracket's carved top-right and bottom-right corners given
buildRightBracket({ w: 40, h: 200 }, [50000]) — so future readers understand the
geometric reasoning used to assert ctx.isPointInPath results for the
buildRightBracket path.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 46e81fc3-559d-49d6-9347-4d26d6e3541b

📥 Commits

Reviewing files that changed from the base of the PR and between 5d1db1b and bb82c32.

⛔ Files ignored due to path filters (1)
  • packages/slides/test/view/canvas/shapes/__snapshots__/registry.snap.test.ts.snap is excluded by !**/*.snap
📒 Files selected for processing (20)
  • docs/design/slides/slides-shapes.md
  • docs/tasks/active/20260517-pptx-unsupported-shapes-todo.md
  • packages/slides/src/import/pptx/geometry.ts
  • packages/slides/src/model/element.ts
  • packages/slides/src/view/canvas/shape-renderer.ts
  • packages/slides/src/view/canvas/shapes/basic/left-brace.ts
  • packages/slides/src/view/canvas/shapes/basic/left-bracket.ts
  • packages/slides/src/view/canvas/shapes/basic/right-brace.ts
  • packages/slides/src/view/canvas/shapes/basic/right-bracket.ts
  • packages/slides/src/view/canvas/shapes/callouts/down-arrow-callout.ts
  • packages/slides/src/view/canvas/shapes/callouts/left-arrow-callout.ts
  • packages/slides/src/view/canvas/shapes/callouts/left-right-arrow-callout.ts
  • packages/slides/src/view/canvas/shapes/callouts/quad-arrow-callout.ts
  • packages/slides/src/view/canvas/shapes/callouts/right-arrow-callout.ts
  • packages/slides/src/view/canvas/shapes/callouts/up-arrow-callout.ts
  • packages/slides/src/view/canvas/shapes/callouts/up-down-arrow-callout.ts
  • packages/slides/src/view/canvas/shapes/index.ts
  • packages/slides/test/import/pptx/geometry.test.ts
  • packages/slides/test/view/canvas/shapes/basic/brackets.test.ts
  • packages/slides/test/view/canvas/shapes/callouts/right-arrow-callout.test.ts

Comment thread docs/design/slides/slides-shapes.md
Comment thread docs/tasks/active/20260517-pptx-unsupported-shapes-todo.md Outdated
Comment thread docs/tasks/active/20260517-pptx-unsupported-shapes-todo.md Outdated
Comment thread packages/slides/src/view/canvas/shapes/basic/left-bracket.ts Outdated
Comment thread packages/slides/src/view/canvas/shapes/basic/right-bracket.ts Outdated
@github-actions

github-actions Bot commented May 16, 2026

Copy link
Copy Markdown
Contributor

Verification: verify:self

Result: ✅ PASS in 212.6s

Lane Status Duration
sheets:build ✅ pass 14.3s
docs:build ✅ pass 12.5s
slides:build ✅ pass 13.3s
verify:fast ✅ pass 125.0s
frontend:build ✅ pass 18.8s
verify:frontend:chunks ✅ pass 0.3s
backend:build ✅ pass 5.0s
cli:build ✅ pass 2.2s
verify:entropy ✅ pass 21.2s

Verification: verify:integration

Result: ✅ PASS

@codecov

codecov Bot commented May 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Slide 7 of the Yorkie 캐즘 deck rendered the centre shape as a
rotated empty rectangle: PPTX preset `rightArrowCallout` was
missing from `ShapeKind`, so `prstToShapeKind()` returned undefined
and the importer silently fell back to `rect` (shape.ts:389). The
same deck has two more presets with the identical symptom:
`leftBracket` (slide 28) and `homePlate` (slide 31, a synonym for
the existing `pentagonArrow`).

Adding only the three presets we tripped on would leave their
OOXML siblings as the next landmine, so this commit lights up
the natural families:

- 7 arrow callouts (right/left/up/down + leftRight/upDown/quad)
- 4 brackets/braces (left/rightBracket, left/rightBrace) as
  open paths — OOXML separates fill and stroke paths; we
  collapse to a single open polyline that strokes correctly and
  auto-closes acceptably when filled (`<a:noFill>` is the
  common case in real decks)
- `homePlate` → `pentagonArrow` import alias

ShapeKind count moves 117 → 128; design doc roadmap and registry
snapshot updated to match. The negative assertions in
geometry.test.ts that pinned the three missing prsts flip to
positive, plus a new alias assertion. Path-builder unit tests
cover the seven arrow callouts and four brackets at nominal and
degenerate frame sizes.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@hackerwins
hackerwins force-pushed the feat/pptx-unsupported-shapes branch from bb82c32 to 9321760 Compare May 16, 2026 18:23
@hackerwins
hackerwins merged commit 3e0991f into main May 16, 2026
4 checks passed
@hackerwins
hackerwins deleted the feat/pptx-unsupported-shapes branch May 16, 2026 23:26
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.

1 participant