refactor(anatomy): rename SVG data attrs (bone → anno) per new convention

User updated the clickable-zone convention in the source SVGs:

  data-bone-id        → data-anno-id
  data-bone-fr        → data-anno-name-fr
  data-bone-en        → data-anno-name-en
  data-category       → data-anno-category
  data-opens-detail   → data-anno-opens-detail

Bulk-renamed across:
- public/species/equine/Horse.svg + Horse_head.svg (86 anno-attrs each)
- src/anatomy/svgConvention.ts (parser + getBoneIdFromEvent)
- src/anatomy/types.ts (doc strings)
- src/components/canvas/AnatomyCanvas.tsx (querySelector + delegated click)
- src/styles/index.css (`[data-bone-id]` selectors → `[data-anno-id]`)
- src/domain/species/types.ts + schema/observation.ts (doc strings)
- docs/{ANATOMY-SVG-CONVENTION,ADDING-A-SPECIES,superpowers/specs,plans}.md
- CLAUDE.md + .claude/{memory/learnings,tasks/TODO}.md
- tests/unit/{anatomy.svgConvention,anatomy.svgLoader,components.AnatomyCanvas}.test.tsx

Internal TS type names and field names (Bone, boneId, parseSvgBones,
getBoneIdFromEvent) are kept intentionally — they're the application's
logical shape and the persisted JSON contract. ObservationZone.boneId is
the identifier seen in already-exported PDFs; renaming it would break
re-import of those PDFs. Only the SVG-side attribute names change.

90/90 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 03:10:06 +02:00
1 parent e8c29c1fdf
commit 1109e33383
18 files changed
+308 -308

No files matched your search

+7 -7
View File
@@ -20,11 +20,11 @@ Every clickable zone element must carry these data attributes:
| Attribute | Required | Notes |
|----------------------|----------|-----------------------------------------------------------------|
| `data-bone-id` | yes | Stable kebab-case id, unique within the SVG. |
| `data-bone-fr` | yes | French anatomical label (used in tooltips and PDF text). |
| `data-bone-en` | yes | English anatomical label (used as fallback and a11y hint). |
| `data-category` | yes | One of: `articulation`, `charniere`, `spine-zone`, `os`, `os-overlay`, `head`, `cadran-crane`. |
| `data-opens-detail` | no | Id of a detail popup SVG to open when the zone is clicked. The id must match a key in the species manifest's `details` map. |
| `data-anno-id` | yes | Stable kebab-case id, unique within the SVG. |
| `data-anno-name-fr` | yes | French anatomical label (used in tooltips and PDF text). |
| `data-anno-name-en` | yes | English anatomical label (used as fallback and a11y hint). |
| `data-anno-category` | yes | One of: `articulation`, `charniere`, `spine-zone`, `os`, `os-overlay`, `head`, `cadran-crane`. |
| `data-anno-opens-detail` | no | Id of a detail popup SVG to open when the zone is clicked. The id must match a key in the species manifest's `details` map. |
Reuse the equine SVG patterns:
@@ -79,7 +79,7 @@ Required fields (see `src/domain/species/types.ts`):
- `labelFr` — French display name shown in the species picker.
- `mainSvg` — absolute path to the main anatomy SVG.
- `details` — map of detail id → SVG path. Keys must match every distinct
`data-opens-detail` attribute used in the main SVG.
`data-anno-opens-detail` attribute used in the main SVG.
- `vertebralFormula` — segment counts for the VertebraPicker (see step 5).
- `pathologies` — lazy import returning `{ default: Pathology[] }` (step 6).
@@ -182,7 +182,7 @@ Mirror `tests/unit/anatomy.horse.test.ts`. Create
`public/species/<id>/` and asserts:
- `parseSvgBones` does not throw and returns a non-empty map.
- Every required `data-category` you used is present at least once
- Every required `data-anno-category` you used is present at least once
(especially the `spine-zone` count, the `head` zone with `opensDetail`,
and any `charniere` hinges).
- Detail SVGs (one test per detail id) parse cleanly and contain the