Skip to content

Commit f631303

Browse files
PIE-619: add accessibility catalog model contract
Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent cb4720f commit f631303

3 files changed

Lines changed: 47 additions & 0 deletions

File tree

docs/API_REFERENCE.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,33 @@ interface PieEnvironment {
4444
Base interface that all element models extend.
4545

4646
```typescript
47+
interface AccessibilityCatalogCard {
48+
catalog: string; // e.g., "spoken"
49+
language?: string; // BCP 47 language tag, e.g., "en-US"
50+
content: string; // Authored alternative content, often SSML
51+
}
52+
53+
interface AccessibilityCatalog {
54+
identifier: string; // Stable ID referenced by visible content
55+
cards: AccessibilityCatalogCard[];
56+
}
57+
4758
interface PieModel {
4859
id: string; // Unique identifier
4960
element: string; // Element type (e.g., "@pie-element/multiple-choice")
61+
accessibilityCatalogs?: AccessibilityCatalog[];
5062
}
5163
```
5264

5365
Element-specific models extend this with additional properties.
5466

67+
`accessibilityCatalogs` is an optional, QTI-aligned contract for authored
68+
accessibility alternatives. PIE players/toolkits can use spoken catalog entries
69+
to replace visible model content during text-to-speech playback, for example
70+
when visible math or abbreviated text needs a clearer spoken representation.
71+
Individual elements are not expected to render this field directly, and default
72+
models should omit it unless authored content provides catalog entries.
73+
5574
### PieSession
5675

5776
Represents student response data.

packages/core/src/types.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,24 @@
22
* Core PIE specification types
33
*/
44

5+
// QTI-aligned accessibility catalog entry for spoken alternatives.
6+
// Players/toolkits may use this to map visible model content to authored TTS.
7+
export interface AccessibilityCatalogCard {
8+
catalog: string;
9+
language?: string;
10+
content: string;
11+
}
12+
13+
export interface AccessibilityCatalog {
14+
identifier: string;
15+
cards: AccessibilityCatalogCard[];
16+
}
17+
518
// Base PIE model (all elements extend this)
619
export interface PieModel {
720
id: string;
821
element: string; // e.g., "@pie-element/multiple-choice"
22+
accessibilityCatalogs?: AccessibilityCatalog[];
923
}
1024

1125
// Environment configuration

packages/shared/types/src/types.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,24 @@
22
* Core PIE specification types
33
*/
44

5+
// QTI-aligned accessibility catalog entry for spoken alternatives.
6+
// Players/toolkits may use this to map visible model content to authored TTS.
7+
export interface AccessibilityCatalogCard {
8+
catalog: string;
9+
language?: string;
10+
content: string;
11+
}
12+
13+
export interface AccessibilityCatalog {
14+
identifier: string;
15+
cards: AccessibilityCatalogCard[];
16+
}
17+
518
// Base PIE model (all elements extend this)
619
export interface PieModel {
720
id: string;
821
element: string; // e.g., "@pie-element/multiple-choice"
22+
accessibilityCatalogs?: AccessibilityCatalog[];
923
}
1024

1125
// Theme configuration (from DaisyUI or custom)

0 commit comments

Comments
 (0)