Skip to content

Draw one diagram on a page without the board around it - #1551

Closed
ketan0 wants to merge 2 commits into
mainfrom
ketan/diagram-component
Closed

ketan0 wants to merge 2 commits into
mainfrom
ketan/diagram-component

Conversation

@ketan0

@ketan0 ketan0 commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Cloudboard's walkthrough pages draw their own blocks and want to show a diagram beside them, the way they show flow and sequence diagrams: a component that takes the block and a code callback. This makes the diagram stage usable on its own.

  • Diagram in @dev.fast/canvas: { block, theme?, onCode?, onFindings? } draws one diagram block (header, stage, step player) at its container's width, with no WhiteboardProvider or board around it. A click on a code link calls onCode(name); the stage's findings go to onFindings.
  • One stage, two hosts: StageBlock now reads a StageHost (animation/stage-host.ts) instead of board hooks. The board builds it with useBoardStageHost (animation/board-stage.tsx) from the same hooks as before, so tours, peeks, fullscreen, selection, telemetry and run reports are unchanged. Diagram builds a small host from its props.
  • Page width: a diagram's html is now laid out at least as wide as the board's column. It was laid out at its in-flow content's width, so a grid of 1fr columns whose parts sit at position: absolute shrank and cut them off. Graphs still measure what sits beside them without it.

Tests: diagram.browser.test.tsx mounts <Diagram> with no provider, checks the stage runs and a code link calls onCode. A browser test covers the page width. The diagram, animation and blocks browser tests pass; two of them flaked once and passed on rerun. Typecheck, lint and format are clean.

Not checked yet: the board's diagrams and animations in an isolated Desktop (themes, narrow layout, keyboard, tour and fullscreen).

🤖 Generated with Claude Code

ketan0 and others added 2 commits November 16, 2026 17:28
diagram.html was laid out at max-content width, so a grid of 1fr screens
whose parts sit at position: absolute shrank to its in-flow text and
clipped those parts. The page now takes at least the column's width, as
any page does; graphs still measure what sits beside them without it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: 01a0d12e-51ca-7230-9991-0ce7a73018b2
@dev.fast/canvas exports Diagram: given a diagram block, it draws the block's header, stage and step player at its container's width, with no WhiteboardProvider. A page passes the code titles to show, and gets a clicked code link's name through onCode and what the stage found through onFindings. Cloudboard's walkthrough pages draw diagrams beside their own flow and sequence diagrams with it.

The stage reads what it needs from a StageHost: theme, code titles and status, embeddable blocks, the draw queue, where reports go, and a chrome hook for its surroundings. The board builds its host from its own state, with the tour, peeks, fullscreen and telemetry in its chrome, so the board draws as before; Diagram builds one from its props, with the figure inline. Both run the same stage.

WhiteboardBlock, which drew a block inside WhiteboardProvider, is gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: 01a0d12e-51ca-7230-9991-0ce7a73018b2
@ketan0
ketan0 force-pushed the ketan/diagram-component branch from d3b3e2f to a9be936 Compare November 18, 2026 02:01
@ketan0

ketan0 commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

Superseded: Cloudboard now copies the diagram stage instead of importing it (devdotfast/cloudboard#365).

@ketan0 ketan0 closed this Nov 18, 2026
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