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:
1 parent
e8c29c1fdf
commit
1109e33383
18 files changed
+308
-308
No files matched your search
@@ -184,7 +184,7 @@ SVG interaction
|
||||
→ parseSvgBones() walks DOM → Bone map
|
||||
→ delegated click listener → getBoneIdFromEvent()
|
||||
→ if spine-zone → VertebraPicker modal
|
||||
→ if data-opens-detail → DetailModal (loads detail SVG)
|
||||
→ if data-anno-opens-detail → DetailModal (loads detail SVG)
|
||||
→ else → updateObservation() in store
|
||||
|
||||
PDF export
|
||||
@@ -224,9 +224,9 @@ Runtime config
|
||||
|
||||
### SVG convention
|
||||
- docs/ANATOMY-SVG-CONVENTION.md is the source of truth
|
||||
- Every clickable element must have: data-bone-id, data-bone-fr, data-bone-en, data-category
|
||||
- Every clickable element must have: data-anno-id, data-anno-name-fr, data-anno-name-en, data-anno-category
|
||||
- SvgConventionError thrown on any missing required attribute
|
||||
- Never rely on element id or className for click targeting — always data-bone-id
|
||||
- Never rely on element id or className for click targeting — always data-anno-id
|
||||
|
||||
### Schemas
|
||||
- domain/schema/*.ts are the data contracts — never change without bumping version
|
||||
@@ -310,4 +310,4 @@ Allowed scopes: `schema`, `store`, `anatomy`, `pdf`, `editor`, `home`, `new`, `u
|
||||
Examples:
|
||||
- `test(schema): cover Report version literal`
|
||||
- `feat(store): implement addObservation`
|
||||
- `feat(anatomy): parse data-bone-id from SVG`
|
||||
- `feat(anatomy): parse data-anno-id from SVG`
|
||||
Reference in new issue
Block a user