chore: initial scaffold + design spec + implementation plan

Skeleton for Osteo Report MVP. Build passes, 7 smoke tests green, real
Horse.svg + Horse_head.svg in public/species/equine/. Zod schemas are
the contract; store/anatomy/pdf modules are typed stubs throwing
"not implemented" awaiting implementation.

Spec: docs/superpowers/specs/2026-05-18-osteo-report-mvp-design.md
Plan: docs/superpowers/plans/2026-05-18-osteo-report-mvp.md (23 phases, ~70 TDD tasks)

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-18 20:55:10 +02:00
1 parent 12a3e48fdf
commit 8ca36b5ccd
104 files changed
+12448

No files matched your search

+42
View File
@@ -0,0 +1,42 @@
import type { Bone, BoneCategory } from './types'
const VALID_CATEGORIES: BoneCategory[] = [
'articulation',
'charniere',
'spine-zone',
'os',
'os-overlay',
'head',
'cadran-crane',
]
/**
* Parses an inline SVG document and returns a map of boneId → Bone.
* Throws SvgConventionError if a required attribute is missing or invalid.
*/
export function parseSvgBones(_svgRoot: SVGSVGElement): Map<string, Bone> {
throw new Error('not implemented')
}
/**
* Walks up from event.target to find the nearest element with data-bone-id.
* Returns null if no bone element is found.
*/
export function getBoneIdFromEvent(_event: Event): string | null {
throw new Error('not implemented')
}
/**
* Validates that all required data attributes are present on an element.
* Throws SvgConventionError on the first missing attribute.
*/
export function validateBoneElement(_el: Element): void {
throw new Error('not implemented')
}
/**
* Returns true if the category string is a valid BoneCategory.
*/
export function isValidCategory(value: string): value is BoneCategory {
return (VALID_CATEGORIES as string[]).includes(value)
}
+18
View File
@@ -0,0 +1,18 @@
/**
* Fetches an SVG file and parses it into a live DOM element.
* Uses DOMParser so the SVG is fully controlled by the app's CSS.
*/
export async function loadSvg(_publicPath: string): Promise<SVGSVGElement> {
throw new Error('not implemented')
}
/**
* Rasterizes an SVGSVGElement to a PNG data URL at the given scale factor.
* Uses canvg under the hood for A4 print quality.
*/
export async function svgToPngDataUrl(
_svgEl: SVGSVGElement,
_scale: number,
): Promise<string> {
throw new Error('not implemented')
}
+40
View File
@@ -0,0 +1,40 @@
/** Valid data-category values per the SVG convention. */
export type BoneCategory =
| 'articulation'
| 'charniere'
| 'spine-zone'
| 'os'
| 'os-overlay'
| 'head'
| 'cadran-crane'
/** A logical bone as parsed from an SVG — groups hitbox + visible elements. */
export interface Bone {
id: string
/** French label from data-bone-fr */
fr: string
/** English label from data-bone-en */
en: string
category: BoneCategory
/** Detail popup id from data-opens-detail, if present */
opensDetail?: string
/** Elements with class containing "hitbox" */
hitboxEls: Element[]
/** Elements with class containing "visible" */
visibleEls: Element[]
}
/** Visual state applied to SVG elements for multi-observation colorization. */
export type BoneState = 'current' | 'linked' | 'multi' | 'default'
/** Error thrown when SVG violates the convention. */
export class SvgConventionError extends Error {
constructor(
message: string,
public readonly boneId: string,
public readonly missingAttribute: string,
) {
super(message)
this.name = 'SvgConventionError'
}
}