Skip to content

feat(web): side-by-side old and new views in compare mode - #6

Merged
MathiasVDA merged 1 commit into
mainfrom
compare-side-by-side
Oct 21, 2026
Merged

MathiasVDA merged 1 commit into
mainfrom
compare-side-by-side

Conversation

@MathiasVDA

Copy link
Copy Markdown
Contributor

Requested by Mathias · project thread

Compare mode showed changes only as colours on the later version. The page of a changed component now also shows the previous state and the new state, in the diagram and in the code, side by side.

What changed

  • View switch on the compare page of a component: Changes (the existing highlights, now with the later version's annotated diagram), Side by side, Old, New. The choice is kept in share links (v=).
  • Side-by-side class diagrams: each side is the normal diagram of its own version, built from its own bundle. The union of both graphs is laid out once with ELK, and each side draws only its own boxes and lines at those positions, so matching boxes line up. Removed items are marked on the left, added items on the right and changed items on both. Pan and zoom are linked by default (Linked turns this off). Double-click expands a box on both sides (kept by qualified name in xq=). Each side has its own export. The two sides stack on narrow screens.
  • Side-by-side content trees: rows are aligned where items match (compositors are matched by their "from Base" caption), with dotted blank rows for items that only one side has. Opening a node opens it on both sides.
  • XSD source diff: a small Myers diff in web/src/textdiff.ts (no new dependency) gives line pairs and word highlights inside changed lines. Indentation-only changes are ignored. Long unchanged stretches are folded, a Unified toggle is available, and both sides scroll as one table. Type links still work: links on the left open the earlier version's pages through a new #/old/<kind>/<qname> route, and links on the right open the later version.
  • Old / New show the full normal page of that version. A component that exists on only one side shows that side, with a note.
  • Accessibility: + / − / ~ markers, strike-through and dashed outlines are used alongside colour, and the views were checked in the dark theme.
  • The earlier version's .xsd files are now available for its source view (compareSources= when they are not next to its bundle).
  • Small fix: an empty x= diagram parameter no longer adds component 0 to the expanded set.
  • README and the in-app manual describe the new views.

Tested with railML 3.2 vs 3.3 (rail3:Balise) in Chromium via Playwright: light and dark themes, 400 px width, linked pan and zoom, unified and fold toggles, and links on the left side.


Generated by Claude Code

A changed component's compare page gets a view switch, kept in the link
(v=): Changes (the highlighted later version, now with its diagram),
Side by side, Old and New.

- Side by side: each version's own class diagram, laid out once from the
  union graph so matching boxes sit at the same place; removed items are
  marked on the left, added on the right, changed on both. Pan and zoom
  can be linked, double-click expands on both sides, export per side.
- Content trees of both versions lined up row by row, with blank rows for
  items only one side has; opening a node opens it on both sides.
- XSD source of both versions with a Myers line diff, word highlights in
  changed lines, folded unchanged stretches and a unified mode; type
  links on the left open the earlier version's pages.
- Old / New: the full normal page of either version; earlier-version
  pages get their own route (#/old/...).
- Markers (+, -, ~) and strike-through besides colour; works in dark mode.
@MathiasVDA MathiasVDA self-assigned this Oct 21, 2026
@MathiasVDA
MathiasVDA merged commit 131d31f into main Oct 21, 2026
6 checks passed
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