Skip to content

Replace D3 DOM rendering with React SVG charts - #60

Merged
skratchdot merged 1 commit into
mainfrom
react-svg-visualizations
Sep 8, 2026
Merged

skratchdot merged 1 commit into
mainfrom
react-svg-visualizations

Conversation

@skratchdot

Copy link
Copy Markdown
Owner

Summary

Move ownership of chart SVG children from D3 to React, with Tailwind styling and no intended redesign. Audio timing remains outside React.

Rendering and behavior

  • Render bars, sort markers, trajectory paths, and the envelope diagram through React components.
  • Publish frame data, position, and visualization mode from the player controller; charts subscribe to those snapshots.
  • Preserve input dragging, hover feedback, pointer capture/cancellation, playback highlighting, and renderer switching.
  • Memoize trajectory geometry by recorded frames and preserve item identity when values repeat.
  • Remove imperative renderers, d3-selection, and the entire visualizations.css stylesheet. Keep D3 array, scale, color, and shape calculation helpers.

Structure and types

  • Keep React rendering under components/visualizations.
  • Rename audio/envelope-diagram.ts to audio/envelope.ts now that it only contains calculations and formatting.
  • Introduce typed create-trajectories.ts with frame, point, and result types.
  • Replace visualization-registry.mjs with visualization-types.ts, exporting mode labels and VisualizationType.
  • Update documentation and the README dependency synopsis.

Verification

  • pnpm run check passed: lint, formatting, spelling, TypeScript, 362 unit tests, and production build.
  • All 38 Playwright browser tests passed using local Chrome.
  • Added tests for duplicate-value trajectory identity, empty/single-item geometry, hover styling, and pointer cancellation.
  • git diff --check passed.
  • Existing large-chunk build warnings remain. Audible output was not manually verified; a quick playback/listening check is still recommended.

Replace imperative D3 bar and trajectory renderers with React SVG components subscribed to player snapshots. Keep audio clocks outside React, preserve pointer capture editing and cancellation, and memoize trajectory geometry across playback updates.

Render the envelope declaratively, remove the visualization stylesheet and d3-selection dependency, and retain D3 only for pure calculation helpers. Rename envelope utilities, type trajectory geometry and visualization modes, and add the required D3 type declarations.

Update documentation and regression coverage for duplicate-value trajectories, finite geometry, hover styling, and cancelled pointer edits. Verified the full check pipeline with 362 unit tests and 38 browser tests.
@skratchdot
skratchdot merged commit 8e4f19b into main Sep 8, 2026
1 check passed
@skratchdot
skratchdot deleted the react-svg-visualizations branch September 9, 2026 03:42
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