refactor(anatomy): adapt parser to new SVG convention (categories + single-element)

User dropped new Horse.svg / Horse_head.svg that follow a simpler
convention:

- Categories renamed to longer human strings:
    articulation       → articulations
    charniere          → charni-res-vert-brales
    spine-zone         → zone-colonne
    cadran-crane       → cadrans-du-cr-ne
    head, os-overlay   → dropped (head zone is now category="os" + data-anno-opens-detail)
    os                 → unchanged
- No more hitbox / visible class split; multiple elements may still share
  the same data-anno-id but they all carry the same role.
- Trigger-only zones (`data-anno-opens-detail="head"`) may omit
  `data-anno-name-fr/en`.

Changes:
- `Bone` now exposes a single `els: Element[]` instead of `hitboxEls +
  visibleEls`.
- `parseSvgBones` accepts annotations without fr/en labels (defaults to
  empty string) but still rejects unknown or missing categories.
- The "interactive vs decorative" filter is gone — every parsed
  annotation is interactive, since the new SVGs only annotate the
  clickable zones.
- Vertebra-picker trigger: `bone.category === 'zone-colonne'`
  (EditorRoute + ObservationCard).
- PDF colorisation in `observationPage.colorizedSvgString` writes the
  accent fill to every `els[]` entry (no more hitbox dual-pass).
- Dead `src/components/observation/ObservationEditor.tsx` removed (its
  body lives inside ObservationCard since the accordion refactor).
- Tests rewritten for the new vocabulary; synthetic fixture uses the new
  categories, real-SVG test asserts 18 + 9 unique zones.

92/92 tests pass, lint clean, build clean.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Bastien ChanotandClaude Opus 4.7 committed 2026-05-19 04:06:26 +02:00
1 parent 1109e33383
commit cad94a49db
10 files changed
+325 -428

No files matched your search

+2 -6
View File
@@ -22,13 +22,9 @@ async function colorizedSvgString(
.forEach((z) => {
const bone = bones.get(z.boneId)
if (!bone) return
bone.visibleEls.forEach((el) => {
bone.els.forEach((el) => {
el.setAttribute('fill', '#b85a3f')
el.setAttribute('fill-opacity', '0.85')
})
bone.hitboxEls.forEach((el) => {
el.setAttribute('fill', '#b85a3f')
el.setAttribute('fill-opacity', '0.4')
el.setAttribute('fill-opacity', '0.65')
})
})
return new XMLSerializer().serializeToString(root)