@kmanueldc/vue-odontogram 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +720 -0
  3. package/THIRD_PARTY_NOTICES.md +37 -0
  4. package/dist/catalogs/nts-peru.d.ts +277 -0
  5. package/dist/components/ConditionLabels.vue.d.ts +40 -0
  6. package/dist/components/FindingPrimitives.vue.d.ts +6 -0
  7. package/dist/components/Odontogram.vue.d.ts +131 -0
  8. package/dist/components/OdontogramTooltip.vue.d.ts +82 -0
  9. package/dist/components/SurfaceDiagrams.vue.d.ts +33 -0
  10. package/dist/components/SurfaceGuide.vue.d.ts +47 -0
  11. package/dist/components/Tooth.vue.d.ts +56 -0
  12. package/dist/components/ToothInspector.vue.d.ts +57 -0
  13. package/dist/composables/useOdontogram.d.ts +43 -0
  14. package/dist/composables/useToothSelection.d.ts +11 -0
  15. package/dist/data/index.d.ts +1 -0
  16. package/dist/data/permanent-horizontal.d.ts +8 -0
  17. package/dist/data/permanent.d.ts +8 -0
  18. package/dist/data/primary-horizontal.d.ts +19 -0
  19. package/dist/data/primary.d.ts +14 -0
  20. package/dist/index.d.ts +26 -0
  21. package/dist/types/findings.d.ts +154 -0
  22. package/dist/types/geometry.d.ts +18 -0
  23. package/dist/types/odontogram.d.ts +119 -0
  24. package/dist/types/surfaces.d.ts +21 -0
  25. package/dist/utils/anchors.d.ts +37 -0
  26. package/dist/utils/compositions.d.ts +41 -0
  27. package/dist/utils/dentition-layout.d.ts +27 -0
  28. package/dist/utils/finding-records.d.ts +82 -0
  29. package/dist/utils/findings.d.ts +74 -0
  30. package/dist/utils/labels.d.ts +4 -0
  31. package/dist/utils/layout.d.ts +19 -0
  32. package/dist/utils/mixed-layout.d.ts +20 -0
  33. package/dist/utils/navigation.d.ts +11 -0
  34. package/dist/utils/notation.d.ts +26 -0
  35. package/dist/utils/numbers.d.ts +28 -0
  36. package/dist/utils/primary-horizontal-layout.d.ts +13 -0
  37. package/dist/utils/primary-layout.d.ts +34 -0
  38. package/dist/utils/quadrants.d.ts +6 -0
  39. package/dist/utils/state-marks.d.ts +35 -0
  40. package/dist/utils/surfaces.d.ts +118 -0
  41. package/dist/utils/svg-geometry.d.ts +36 -0
  42. package/dist/utils/tooth-frames.d.ts +51 -0
  43. package/dist/vue-odontogram.css +1 -0
  44. package/dist/vue-odontogram.js +3202 -0
  45. package/dist/vue-odontogram.umd.cjs +1 -0
  46. package/package.json +52 -0
@@ -0,0 +1,56 @@
1
+ import type { ToothDefinition, ToothState } from '../types/odontogram';
2
+ import { type ToothNavigationKey } from '../utils/navigation';
3
+ export interface ToothCondition {
4
+ fillColor?: string;
5
+ outlineColor?: string;
6
+ }
7
+ type __VLS_Props = {
8
+ tooth: ToothDefinition;
9
+ selected?: boolean;
10
+ disabled?: boolean;
11
+ condition?: ToothCondition;
12
+ /** Presentation transform supplied by the layout, after the shape's own. */
13
+ layoutTransform?: string;
14
+ /** Prefix of the accessible name, e.g. "Tooth" → "Tooth 11". */
15
+ label?: string;
16
+ /** Whether Tab reaches this tooth; a chart keeps a single tab stop. */
17
+ focusable?: boolean;
18
+ /** Presence status; it never changes selection or interaction. */
19
+ state?: ToothState;
20
+ /** Name of a non-present state, appended to the accessible name. */
21
+ stateLabel?: string;
22
+ /** Extra text appended to the accessible name, e.g. the tooth findings. */
23
+ description?: string;
24
+ /** Number shown in the title, in the chart's notation; the FDI ID by default. */
25
+ number?: string;
26
+ /** Number read in the accessible name; `number` by default. */
27
+ spokenNumber?: string;
28
+ };
29
+ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
30
+ select: (tooth: ToothDefinition) => any;
31
+ mouseenter: (tooth: ToothDefinition, event: MouseEvent) => any;
32
+ mouseleave: (tooth: ToothDefinition, event: MouseEvent) => any;
33
+ focus: (tooth: ToothDefinition, event: FocusEvent) => any;
34
+ blur: (tooth: ToothDefinition, event: FocusEvent) => any;
35
+ navigate: (tooth: ToothDefinition, key: ToothNavigationKey) => any;
36
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
37
+ onSelect?: ((tooth: ToothDefinition) => any) | undefined;
38
+ onMouseenter?: ((tooth: ToothDefinition, event: MouseEvent) => any) | undefined;
39
+ onMouseleave?: ((tooth: ToothDefinition, event: MouseEvent) => any) | undefined;
40
+ onFocus?: ((tooth: ToothDefinition, event: FocusEvent) => any) | undefined;
41
+ onBlur?: ((tooth: ToothDefinition, event: FocusEvent) => any) | undefined;
42
+ onNavigate?: ((tooth: ToothDefinition, key: ToothNavigationKey) => any) | undefined;
43
+ }>, {
44
+ number: string;
45
+ selected: boolean;
46
+ condition: ToothCondition;
47
+ state: ToothState;
48
+ label: string;
49
+ disabled: boolean;
50
+ spokenNumber: string;
51
+ layoutTransform: string;
52
+ focusable: boolean;
53
+ stateLabel: string;
54
+ description: string;
55
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
56
+ export default _default;
@@ -0,0 +1,57 @@
1
+ import type { FindingCatalog, OdontogramFinding } from '../types/findings';
2
+ import type { OdontogramLabelsInput, OdontogramToothStates, ToothNotation } from '../types/odontogram';
3
+ import { type SurfaceShapeKind, type ToothSurface } from '../types/surfaces';
4
+ import { type SurfaceFindingRemoval, type ToothFindingInput } from '../utils/finding-records';
5
+ /**
6
+ * Panel with everything recorded on one tooth: its surfaces (drawn with the
7
+ * surface guide), its findings by surface and on the whole tooth, and a form
8
+ * to add new ones. It holds no clinical rules and saves nothing: it emits
9
+ * `add-finding` and `remove-finding`, and the app decides what to record.
10
+ */
11
+ type __VLS_Props = {
12
+ /** FDI ID of the tooth. */
13
+ toothId: string;
14
+ findings?: OdontogramFinding[];
15
+ findingCatalog?: FindingCatalog;
16
+ toothStates?: OdontogramToothStates;
17
+ labels?: OdontogramLabelsInput;
18
+ notation?: ToothNotation;
19
+ /** Shape of the surface diagram, like the chart's `surfaceShape`. */
20
+ shape?: SurfaceShapeKind;
21
+ /** Read-only panel: no adding or removing. */
22
+ disabled?: boolean;
23
+ /**
24
+ * Surfaces chosen for the next surface finding. Bind it with
25
+ * `v-model:selected-surfaces` to choose them from the chart too (e.g.
26
+ * `surfaces[toothId]` of the chart's `v-model:surfaces`); without it the
27
+ * panel keeps its own choice.
28
+ */
29
+ selectedSurfaces?: ToothSurface[];
30
+ };
31
+ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
32
+ "add-finding": (input: ToothFindingInput) => any;
33
+ "remove-finding": (removal: SurfaceFindingRemoval) => any;
34
+ "update:selectedSurfaces": (surfaces: ToothSurface[]) => any;
35
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
36
+ "onAdd-finding"?: ((input: ToothFindingInput) => any) | undefined;
37
+ "onRemove-finding"?: ((removal: SurfaceFindingRemoval) => any) | undefined;
38
+ "onUpdate:selectedSurfaces"?: ((surfaces: ToothSurface[]) => any) | undefined;
39
+ }>, {
40
+ findings: OdontogramFinding[];
41
+ labels: Partial<Omit<import("..").OdontogramLabels, "chartTitles" | "states" | "surfaceNames" | "surfaceLetters" | "surfaceDescriptions" | "findingStatuses" | "inspector"> & {
42
+ chartTitles: Partial<import("..").OdontogramLabels["chartTitles"]>;
43
+ states: Partial<import("..").OdontogramLabels["states"]>;
44
+ surfaceNames: Partial<import("..").OdontogramLabels["surfaceNames"]>;
45
+ surfaceLetters: Partial<import("..").OdontogramLabels["surfaceLetters"]>;
46
+ surfaceDescriptions: Partial<import("..").OdontogramLabels["surfaceDescriptions"]>;
47
+ findingStatuses: Partial<import("..").OdontogramLabels["findingStatuses"]>;
48
+ inspector: Partial<import("..").OdontogramLabels["inspector"]>;
49
+ }>;
50
+ disabled: boolean;
51
+ notation: ToothNotation;
52
+ toothStates: OdontogramToothStates;
53
+ findingCatalog: FindingCatalog;
54
+ shape: SurfaceShapeKind;
55
+ selectedSurfaces: ToothSurface[];
56
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
57
+ export default _default;
@@ -0,0 +1,43 @@
1
+ import { type MaybeRefOrGetter } from 'vue';
2
+ import type { OdontogramCondition, OdontogramHalf, ToothNotation } from '../types/odontogram';
3
+ import { type ToothAnchor } from '../utils/anchors';
4
+ import type { RenderableDentition } from '../utils/dentition-layout';
5
+ import type { OdontogramLayout } from '../utils/layout';
6
+ import { type Box } from '../utils/svg-geometry';
7
+ import type { FindingCatalog, OdontogramFinding } from '../types/findings';
8
+ import type { SurfaceShapeKind } from '../types/surfaces';
9
+ export interface OdontogramOptions {
10
+ dentition: MaybeRefOrGetter<RenderableDentition>;
11
+ layout: MaybeRefOrGetter<OdontogramLayout>;
12
+ notation: MaybeRefOrGetter<ToothNotation>;
13
+ conditions: MaybeRefOrGetter<readonly OdontogramCondition[] | undefined>;
14
+ showHalf?: MaybeRefOrGetter<OdontogramHalf>;
15
+ showNumbers?: MaybeRefOrGetter<boolean>;
16
+ findings?: MaybeRefOrGetter<readonly OdontogramFinding[] | undefined>;
17
+ findingCatalog?: MaybeRefOrGetter<FindingCatalog | undefined>;
18
+ showSurfaces?: MaybeRefOrGetter<boolean>;
19
+ /** Square (default) or circular surface diagrams. */
20
+ surfaceShape?: MaybeRefOrGetter<SurfaceShapeKind | undefined>;
21
+ /** FDI IDs of the teeth to draw; every tooth of the dentition when omitted. */
22
+ teeth?: MaybeRefOrGetter<readonly string[] | undefined>;
23
+ }
24
+ /**
25
+ * Resolves the dataset, composition, tooth definitions, anchors and number
26
+ * labels for a dentition and layout, limited to the visible arches.
27
+ */
28
+ export declare function useOdontogram(options: OdontogramOptions): {
29
+ viewBox: import("vue").ComputedRef<string>;
30
+ viewBoxRect: import("vue").ComputedRef<Box>;
31
+ quadrants: import("vue").ComputedRef<{
32
+ teeth: import("../utils/compositions").ComposedTooth[];
33
+ quadrant: number;
34
+ transform: string;
35
+ }[]>;
36
+ anchors: import("vue").ComputedRef<Readonly<Record<string, ToothAnchor>>>;
37
+ anchorList: import("vue").ComputedRef<readonly ToothAnchor[]>;
38
+ numberLabels: import("vue").ComputedRef<import("../utils/numbers").ToothNumberLabel[]>;
39
+ surfaceDiagrams: import("vue").ComputedRef<import("..").SurfaceDiagram[]>;
40
+ findingLayout: import("vue").ComputedRef<import("../utils/findings").FindingLayout>;
41
+ findingsByTooth: import("vue").ComputedRef<Map<string, import("../utils/findings").RenderedFinding[]>>;
42
+ conditionByTooth: import("vue").ComputedRef<Map<string, OdontogramCondition>>;
43
+ };
@@ -0,0 +1,11 @@
1
+ import { type MaybeRefOrGetter } from 'vue';
2
+ export interface ToothSelectionOptions {
3
+ modelValue: MaybeRefOrGetter<readonly string[] | undefined>;
4
+ singleSelect: MaybeRefOrGetter<boolean>;
5
+ }
6
+ /** Selection state derived from, and written back to, an Odontogram v-model. */
7
+ export declare function useToothSelection(options: ToothSelectionOptions): {
8
+ isSelected: (id: string) => boolean;
9
+ selectedTeeth: import("vue").ComputedRef<string[]>;
10
+ toggle: (id: string) => string[];
11
+ };
@@ -0,0 +1 @@
1
+ export { permanentTeethPaths, type ToothShape, type ToothType, } from './permanent';
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Framework-independent SVG geometry for the permanent horizontal layout.
3
+ *
4
+ * Paths are ported verbatim from react-odontogram/src/data.ts::NewTeethPaths
5
+ * (MIT). They are a presentation alternative to permanentTeethPaths.
6
+ */
7
+ import type { ToothShape } from './permanent';
8
+ export declare const permanentHorizontalTeethPaths: ToothShape[];
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Framework-independent SVG geometry for the eight permanent tooth positions.
3
+ *
4
+ * Paths are ported verbatim from react-odontogram/src/data.ts (MIT).
5
+ */
6
+ import type { ToothShape } from '../types/geometry';
7
+ export type { ToothShape, ToothType } from '../types/geometry';
8
+ export declare const permanentTeethPaths: ToothShape[];
@@ -0,0 +1,19 @@
1
+ import type { ToothShape } from '../types/geometry';
2
+ /**
3
+ * Provisional pediatric geometry designed specifically for the horizontal
4
+ * composition. These original simplified paths are not clinically validated
5
+ * and must not be used for diagnostic or treatment purposes.
6
+ *
7
+ * Coordinates occupy the base half (x=18–246, y=14–64) of the tentative
8
+ * 520×180 workspace. The opposite side will be composed independently in
9
+ * the following layout phase.
10
+ */
11
+ export declare const primaryHorizontalTeethPaths: ToothShape[];
12
+ export declare const primaryHorizontalGeometryStatus: {
13
+ readonly status: "provisional";
14
+ readonly clinicallyValidated: false;
15
+ readonly intendedUse: "development-and-visual-review";
16
+ readonly source: "original-horizontal-prototype";
17
+ readonly scale: 0.75;
18
+ readonly targetGap: 12;
19
+ };
@@ -0,0 +1,14 @@
1
+ import type { ToothShape } from '../types/geometry';
2
+ /**
3
+ * Provisional pediatric geometry for development and visual iteration only.
4
+ *
5
+ * These SVG paths are simplified original approximations. They use the
6
+ * permanent arch as a coordinate reference but are not clinically validated
7
+ * and must not be used for diagnostic or treatment purposes.
8
+ */
9
+ export declare const primaryTeethPaths: ToothShape[];
10
+ export declare const primaryGeometryStatus: {
11
+ readonly status: "provisional";
12
+ readonly clinicallyValidated: false;
13
+ readonly intendedUse: "development-and-visual-review";
14
+ };
@@ -0,0 +1,26 @@
1
+ export { default as Odontogram } from './components/Odontogram.vue';
2
+ export { default as Tooth } from './components/Tooth.vue';
3
+ export { default as SurfaceGuide } from './components/SurfaceGuide.vue';
4
+ export { default as ToothInspector } from './components/ToothInspector.vue';
5
+ export { buildToothId, formatToothNumber, getPalmerQuadrant, getToothType } from './utils/notation';
6
+ export type { PalmerQuadrant } from './utils/notation';
7
+ export { getQuadrant } from './utils/quadrants';
8
+ export { defaultOdontogramLabels } from './utils/labels';
9
+ export { toothStates } from './types/odontogram';
10
+ export { ntsPeruFindingCatalog } from './catalogs/nts-peru';
11
+ export type { NtsPeruFindingCode } from './catalogs/nts-peru';
12
+ export { findingStatuses } from './types/findings';
13
+ export { getFindingScope, resolveFindingTone } from './utils/findings';
14
+ export type { FindingCatalog, FindingDefinition, FindingDirection, FindingScope, FindingStatus, FindingSymbol, FindingSymbolKind, FindingTone, OdontogramFinding, } from './types/findings';
15
+ export { surfaceShapeKinds, toothSurfaces } from './types/surfaces';
16
+ export type { OdontogramSurfaces, SurfaceShapeKind, ToothSurface, ToothSurfaceName } from './types/surfaces';
17
+ export { getSurfaceName, toggleSurface } from './utils/surfaces';
18
+ export type { SurfaceDiagram, SurfaceShape } from './utils/surfaces';
19
+ export { addFinding, addSurfaceFinding, getToothRecord, removeSurfaceFinding } from './utils/finding-records';
20
+ export type { SurfaceFindingInput, SurfaceFindingRemoval, ToothFindingInput, ToothFindingEntry, ToothRecord, } from './utils/finding-records';
21
+ export { getToothAnchors, getLayoutViewBox } from './utils/anchors';
22
+ export type { Box, Point, ToothAnchor } from './utils/anchors';
23
+ export type { DentalArch, DentalSide, Dentition, OdontogramCondition, OdontogramHalf, OdontogramLabels, OdontogramLabelsInput, OdontogramToothStates, ToothDefinition, ToothNotation, ToothShape, ToothState, ToothType, ToothVisualCondition, } from './types/odontogram';
24
+ export type { OdontogramLayout } from './utils/layout';
25
+ export type { ToothCondition } from './components/Tooth.vue';
26
+ export type { TooltipPlacement } from './components/OdontogramTooltip.vue';
@@ -0,0 +1,154 @@
1
+ import type { ToothSurface } from './surfaces';
2
+ /**
3
+ * Default color of a finding. Following the common charting convention
4
+ * (e.g. Peru's NTS odontogram standard): `good` is drawn in blue (good state
5
+ * or completed treatment) and `bad` in red (bad state or pending).
6
+ */
7
+ export type FindingTone = 'good' | 'bad';
8
+ /**
9
+ * Where a finding stands in the treatment workflow. The library only draws it;
10
+ * clinical rules (what can be planned, when it is done) belong to the app.
11
+ * - `existing`: found in the mouth, e.g. a caries or a previous restoration.
12
+ * - `planned`: a treatment to do; drawn with dashed strokes and a lighter fill.
13
+ * - `done`: a treatment performed.
14
+ */
15
+ export type FindingStatus = 'existing' | 'planned' | 'done';
16
+ export declare const findingStatuses: readonly FindingStatus[];
17
+ /** Direction of a finding along the arch. */
18
+ export type FindingDirection = 'mesial' | 'distal';
19
+ /**
20
+ * How a finding is drawn. The kind also fixes how many teeth it uses:
21
+ * - surfaces of the surface diagram, per listed tooth: `fill`, `outline`;
22
+ * - single tooth, one symbol per listed tooth: `line`, `cross`, `circle`,
23
+ * `double-circle`, `triangle`, `arrow`, `curved-arrow`, `zigzag`, `text`,
24
+ * `encircled-text`;
25
+ * - between two teeth: `diastema`, `transposition`;
26
+ * - a range of teeth of one arch, from the first to the last listed tooth:
27
+ * `bridge`, `double-line`, `brackets`, `zigzag-line`, `center-line`.
28
+ */
29
+ export type FindingSymbol =
30
+ /** Fills the finding's surfaces in the surface diagram, e.g. a caries or a restoration. */
31
+ {
32
+ kind: 'fill';
33
+ }
34
+ /** Outlines the finding's surfaces in the surface diagram, e.g. a temporary restoration. */
35
+ | {
36
+ kind: 'outline';
37
+ }
38
+ /** A straight line across the tooth, e.g. a fracture. */
39
+ | {
40
+ kind: 'line';
41
+ }
42
+ /** An "X" across the tooth, e.g. an extraction. */
43
+ | {
44
+ kind: 'cross';
45
+ }
46
+ /** A circle around the tooth, e.g. a crown. */
47
+ | {
48
+ kind: 'circle';
49
+ }
50
+ /** Two overlapping circles, e.g. fusion. */
51
+ | {
52
+ kind: 'double-circle';
53
+ }
54
+ /** A triangle over the tooth, e.g. a peg-shaped tooth. */
55
+ | {
56
+ kind: 'triangle';
57
+ }
58
+ /**
59
+ * A straight arrow across the tooth. `occlusal` points to the other arch,
60
+ * `apical` away from it; `mesial`/`distal` follow the arch, and `auto`
61
+ * uses the finding's `direction` (mesial by default).
62
+ */
63
+ | {
64
+ kind: 'arrow';
65
+ direction: 'occlusal' | 'apical' | 'mesial' | 'distal' | 'auto';
66
+ }
67
+ /** A curved arrow over the tooth, e.g. rotation. */
68
+ | {
69
+ kind: 'curved-arrow';
70
+ }
71
+ /** A zigzag arrow toward the other arch, e.g. an erupting tooth. */
72
+ | {
73
+ kind: 'zigzag';
74
+ }
75
+ /** An abbreviation on the vestibular side of the tooth, e.g. `IMP`. */
76
+ | {
77
+ kind: 'text';
78
+ text: string;
79
+ }
80
+ /** An abbreviation inside a circle, e.g. `S` for a supernumerary tooth. */
81
+ | {
82
+ kind: 'encircled-text';
83
+ text: string;
84
+ }
85
+ /** Facing arcs `)(` between two teeth. */
86
+ | {
87
+ kind: 'diastema';
88
+ }
89
+ /** Crossed arrows between two teeth. */
90
+ | {
91
+ kind: 'transposition';
92
+ }
93
+ /** A line with end caps along a range of teeth, e.g. a fixed prosthesis. */
94
+ | {
95
+ kind: 'bridge';
96
+ }
97
+ /** Two parallel lines along a range of teeth, e.g. a removable prosthesis. */
98
+ | {
99
+ kind: 'double-line';
100
+ }
101
+ /** A line with a bracket on each tooth, e.g. a fixed orthodontic appliance. */
102
+ | {
103
+ kind: 'brackets';
104
+ }
105
+ /** A zigzag line along a range of teeth, e.g. a removable orthodontic appliance. */
106
+ | {
107
+ kind: 'zigzag-line';
108
+ }
109
+ /** A line through the teeth centers, e.g. an edentulous arch. */
110
+ | {
111
+ kind: 'center-line';
112
+ };
113
+ export type FindingSymbolKind = FindingSymbol['kind'];
114
+ export type FindingScope = 'surface' | 'tooth' | 'between' | 'span';
115
+ /** A catalog entry: how a finding code is named and drawn. */
116
+ export interface FindingDefinition {
117
+ /** Display name for tooltip, legend and accessible names. */
118
+ name: string;
119
+ symbol: FindingSymbol;
120
+ /** Color used when a finding sets neither `tone` nor `color`. */
121
+ tone: FindingTone;
122
+ }
123
+ /** Finding definitions keyed by code. */
124
+ export type FindingCatalog = Readonly<Record<string, FindingDefinition>>;
125
+ /** A finding recorded on the chart. */
126
+ export interface OdontogramFinding {
127
+ /** Catalog code, e.g. `fracture`. */
128
+ code: string;
129
+ /**
130
+ * FDI IDs. Surface and single-tooth findings draw one symbol per tooth;
131
+ * `between` findings use two teeth; `span` findings cover the arch range
132
+ * from the first to the last listed tooth.
133
+ */
134
+ teeth: string[];
135
+ /**
136
+ * Surfaces of surface findings (`fill`, `outline`); every surface when
137
+ * omitted. Other findings ignore it.
138
+ */
139
+ surfaces?: ToothSurface[];
140
+ /** Workflow status; `existing` by default. */
141
+ status?: FindingStatus;
142
+ /**
143
+ * Overrides the default color. Without it, `planned` findings are `bad`
144
+ * (red), `done` findings are `good` (blue) and `existing` ones use the
145
+ * catalog tone.
146
+ */
147
+ tone?: FindingTone;
148
+ /** Any CSS color; overrides `tone`. */
149
+ color?: string;
150
+ /** Overrides the abbreviation of text symbols, e.g. `M2` for mobility. */
151
+ label?: string;
152
+ /** Direction for arrows whose catalog direction is `auto`, e.g. migration. */
153
+ direction?: FindingDirection;
154
+ }
@@ -0,0 +1,18 @@
1
+ /** Tooth categories represented by the permanent dataset. */
2
+ export type PermanentToothType = 'Central Incisor' | 'Lateral Incisor' | 'Canine' | 'First Premolar' | 'Second Premolar' | 'First Molar' | 'Second Molar' | 'Third Molar';
3
+ /** Tooth categories required by a clinically correct primary dataset. */
4
+ export type PrimaryToothType = 'Primary Central Incisor' | 'Primary Lateral Incisor' | 'Primary Canine' | 'Primary First Molar' | 'Primary Second Molar';
5
+ export type ToothType = PermanentToothType | PrimaryToothType;
6
+ /**
7
+ * Reusable SVG geometry. It intentionally contains no dentition, quadrant,
8
+ * notation, selection or framework concerns.
9
+ */
10
+ export interface ToothShape {
11
+ position: number;
12
+ type: ToothType;
13
+ outlinePath: string;
14
+ shadowPath?: string;
15
+ lineHighlightPath?: string | string[];
16
+ /** Optional local SVG transform intrinsic to this geometry. */
17
+ transform?: string;
18
+ }
@@ -0,0 +1,119 @@
1
+ import type { ToothShape, ToothType } from './geometry';
2
+ import type { FindingStatus } from './findings';
3
+ import type { ToothSurfaceName } from './surfaces';
4
+ /** The set of dentitions the library can represent. */
5
+ export type Dentition = 'permanent' | 'primary' | 'mixed';
6
+ /** Dental numbering systems supported by the public API. */
7
+ export type ToothNotation = 'FDI' | 'Universal' | 'Palmer';
8
+ export type DentalArch = 'upper' | 'lower';
9
+ export type DentalSide = 'left' | 'right';
10
+ /** Which arches an odontogram shows: both, or only one of them. */
11
+ export type OdontogramHalf = 'full' | DentalArch;
12
+ /**
13
+ * A tooth in a chart. It connects its clinical position to a reusable SVG
14
+ * shape, without placing rendering concerns in the data model.
15
+ */
16
+ export interface ToothDefinition {
17
+ id: string;
18
+ position: number;
19
+ quadrant: number;
20
+ dentition: Dentition;
21
+ type: ToothType;
22
+ shape: ToothShape;
23
+ }
24
+ /**
25
+ * Presence status of a tooth. It is independent of selection and conditions:
26
+ * - `present`: the tooth is in the mouth (default).
27
+ * - `missing`: absent, e.g. agenesis or unknown cause.
28
+ * - `extracted`: removed.
29
+ * - `implant`: replaced by an implant.
30
+ * - `unerupted`: not yet erupted.
31
+ */
32
+ export type ToothState = 'present' | 'missing' | 'extracted' | 'implant' | 'unerupted';
33
+ export declare const toothStates: readonly ToothState[];
34
+ /** Tooth states keyed by FDI ID; unlisted teeth are `present`. */
35
+ export type OdontogramToothStates = Partial<Record<string, ToothState>>;
36
+ /** Colors and legend text applied to a tooth. */
37
+ export interface ToothVisualCondition {
38
+ label?: string;
39
+ fillColor?: string;
40
+ outlineColor?: string;
41
+ }
42
+ /**
43
+ * A visual condition applied to a group of FDI teeth. A tooth shows a single
44
+ * condition: when it appears in several groups, the last group wins.
45
+ */
46
+ export interface OdontogramCondition extends ToothVisualCondition {
47
+ teeth: string[];
48
+ }
49
+ /** User-facing text rendered by the odontogram, tooltip and legend. */
50
+ export interface OdontogramLabels {
51
+ /** Accessible name of the whole chart container. */
52
+ odontogram: string;
53
+ /** Title and accessible name of the SVG, per dentition. */
54
+ chartTitles: Record<Dentition, string>;
55
+ /** Prefix of each tooth's accessible name, e.g. "Tooth 11". */
56
+ tooth: string;
57
+ type: string;
58
+ selected: string;
59
+ yes: string;
60
+ no: string;
61
+ condition: string;
62
+ /** Accessible name of the condition legend. */
63
+ legend: string;
64
+ /** Display names per tooth type; missing entries show the type itself. */
65
+ toothTypes: Partial<Record<ToothType, string>>;
66
+ /** Prefix of the tooth state line in the tooltip. */
67
+ state: string;
68
+ /** Display names per tooth state. */
69
+ states: Record<ToothState, string>;
70
+ /** Prefix of the findings line in the tooltip. */
71
+ findings: string;
72
+ /** Finding statuses, shown after planned and done findings. */
73
+ findingStatuses: Record<FindingStatus, string>;
74
+ /** Accessible name of the surface diagrams layer. */
75
+ surfaces: string;
76
+ /** Prefix of the surface line in the tooltip of a surface. */
77
+ surface: string;
78
+ /** Heading of the per-surface summary in the tooltip of a tooth. */
79
+ surfaceSummary: string;
80
+ /** Clinical surface names, e.g. "Tooth 11, Incisal". */
81
+ surfaceNames: Record<ToothSurfaceName, string>;
82
+ /** One-letter surface codes drawn on diagrams, e.g. `M` or `P`. */
83
+ surfaceLetters: Record<ToothSurfaceName, string>;
84
+ /** What each surface is, shown by the surface guide. */
85
+ surfaceDescriptions: Record<ToothSurfaceName, string>;
86
+ /** Accessible name of the surface guide. */
87
+ surfaceGuide: string;
88
+ /** Accessible name of the surface menu, e.g. "Surface findings: Tooth 16, Occlusal". */
89
+ surfaceMenu: string;
90
+ /** Texts of the tooth inspector panel. */
91
+ inspector: {
92
+ /** Accessible name of the panel, followed by the tooth. */
93
+ title: string;
94
+ surfaceFindings: string;
95
+ toothFindings: string;
96
+ noFindings: string;
97
+ addFinding: string;
98
+ finding: string;
99
+ status: string;
100
+ add: string;
101
+ remove: string;
102
+ /** Hint shown until surfaces are chosen for a surface finding. */
103
+ chooseSurfaces: string;
104
+ /** Option groups of the finding list. */
105
+ onSurfaces: string;
106
+ onTooth: string;
107
+ };
108
+ }
109
+ /** Labels override where nested maps can also be partially replaced. */
110
+ export type OdontogramLabelsInput = Partial<Omit<OdontogramLabels, 'chartTitles' | 'states' | 'surfaceNames' | 'surfaceLetters' | 'surfaceDescriptions' | 'findingStatuses' | 'inspector'> & {
111
+ chartTitles: Partial<OdontogramLabels['chartTitles']>;
112
+ states: Partial<OdontogramLabels['states']>;
113
+ surfaceNames: Partial<OdontogramLabels['surfaceNames']>;
114
+ surfaceLetters: Partial<OdontogramLabels['surfaceLetters']>;
115
+ surfaceDescriptions: Partial<OdontogramLabels['surfaceDescriptions']>;
116
+ findingStatuses: Partial<OdontogramLabels['findingStatuses']>;
117
+ inspector: Partial<OdontogramLabels['inspector']>;
118
+ }>;
119
+ export type { ToothShape, ToothType };
@@ -0,0 +1,21 @@
1
+ /**
2
+ * The five crown surfaces of a tooth. The keys are the same for every tooth;
3
+ * the clinical name adapts to it (see `getSurfaceName`):
4
+ * - `occlusal` is incisal on incisors and canines;
5
+ * - `lingual` is palatal on upper teeth;
6
+ * - `vestibular` faces the lips or cheeks (buccal/labial).
7
+ */
8
+ export type ToothSurface = 'mesial' | 'distal' | 'occlusal' | 'vestibular' | 'lingual';
9
+ /** Every surface, in the order they are listed in the model and read aloud. */
10
+ export declare const toothSurfaces: readonly ToothSurface[];
11
+ /** Clinical name of a surface on a given tooth. */
12
+ export type ToothSurfaceName = ToothSurface | 'incisal' | 'palatal';
13
+ /**
14
+ * How the five-surface diagram is drawn:
15
+ * - `square`: a square with a central occlusal square and four trapezoids.
16
+ * - `circle`: a circle with a central occlusal circle and four ring sectors.
17
+ */
18
+ export type SurfaceShapeKind = 'square' | 'circle';
19
+ export declare const surfaceShapeKinds: readonly SurfaceShapeKind[];
20
+ /** Selected surfaces keyed by FDI ID; unlisted teeth have none. */
21
+ export type OdontogramSurfaces = Partial<Record<string, ToothSurface[]>>;
@@ -0,0 +1,37 @@
1
+ import type { DentalArch } from '../types/odontogram';
2
+ import type { RenderableDentition } from './dentition-layout';
3
+ import type { OdontogramLayout } from './layout';
4
+ import type { NumberedDentition } from './quadrants';
5
+ import { type Box, type Point } from './svg-geometry';
6
+ export type { Box, Point };
7
+ /**
8
+ * A row of teeth drawn along one arch, e.g. `upper-primary`. Permanent and
9
+ * primary charts have one row per arch; mixed charts have two.
10
+ */
11
+ export type ToothRow = `${DentalArch}-${NumberedDentition}`;
12
+ /**
13
+ * Where a tooth is drawn, in the SVG coordinates of its layout's viewBox.
14
+ * Overlays such as numbers, symbols or surface diagrams can be positioned
15
+ * from it without reading the DOM.
16
+ */
17
+ export interface ToothAnchor {
18
+ toothId: string;
19
+ quadrant: number;
20
+ arch: DentalArch;
21
+ dentition: NumberedDentition;
22
+ row: ToothRow;
23
+ /** Axis-aligned bounding box of the tooth outline. */
24
+ box: Box;
25
+ /** Center of `box`. */
26
+ center: Point;
27
+ }
28
+ /** Parses a `viewBox` attribute. */
29
+ export declare function parseViewBox(viewBox: string): Box;
30
+ /**
31
+ * Computes the anchor of every tooth for a dentition and layout, in render
32
+ * order. It composes the quadrant, shape and layout transforms exactly as the
33
+ * SVG does, so the result matches the rendered position.
34
+ */
35
+ export declare function getToothAnchors(dentition: RenderableDentition, layout: OdontogramLayout): readonly ToothAnchor[];
36
+ /** Returns the parsed viewBox of a dentition and layout. */
37
+ export declare function getLayoutViewBox(dentition: RenderableDentition, layout: OdontogramLayout): Box;
@@ -0,0 +1,41 @@
1
+ import type { ToothDefinition, ToothShape, ToothType } from '../types/odontogram';
2
+ import type { RenderableDentition } from './dentition-layout';
3
+ import { type OdontogramLayout } from './layout';
4
+ import type { NumberedDentition } from './quadrants';
5
+ /** The teeth of one dataset in a composition. */
6
+ export interface CompositionPart {
7
+ dentition: NumberedDentition;
8
+ quadrants: readonly {
9
+ quadrant: number;
10
+ transform: string;
11
+ }[];
12
+ shapes: readonly ToothShape[];
13
+ /** Presentation offsets per tooth type, applied after the shape transform. */
14
+ toothTransforms?: Readonly<Partial<Record<ToothType, string>>>;
15
+ }
16
+ /**
17
+ * Everything needed to draw one dentition in one layout. Permanent and
18
+ * primary compositions have one part; mixed ones combine both datasets.
19
+ */
20
+ export interface DentitionComposition {
21
+ viewBox: string;
22
+ parts: readonly CompositionPart[];
23
+ }
24
+ export declare function getComposition(dentition: RenderableDentition, layout: OdontogramLayout): DentitionComposition;
25
+ export interface ComposedTooth {
26
+ tooth: ToothDefinition;
27
+ /** Layout-specific transform for this tooth, if any. */
28
+ transform?: string;
29
+ }
30
+ export interface ComposedQuadrant {
31
+ quadrant: number;
32
+ transform: string;
33
+ teeth: ComposedTooth[];
34
+ }
35
+ /**
36
+ * Builds the FDI teeth of a composition, grouped in render order. Tooth IDs
37
+ * are always FDI, independent of the presentation.
38
+ */
39
+ export declare function composeQuadrants(dentition: RenderableDentition, layout: OdontogramLayout): ComposedQuadrant[];
40
+ /** FDI IDs of every tooth a dentition can draw, in render order. */
41
+ export declare function getDentitionToothIds(dentition: RenderableDentition, layout: OdontogramLayout): string[];