@pie-element/shared-types 0.2.1 → 0.2.2-next.20261018222107
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.
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/summary.d.ts +57 -0
- package/dist/summary.js +9 -0
- package/dist/summary.js.map +1 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC","sourcesContent":["/**\n * PIE Shared Types\n *\n * Framework-agnostic TypeScript types for PIE elements.\n */\n\nexport * from './authoring.js';\nexport * from './docs-contract.js';\nexport * from './types.js';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC","sourcesContent":["/**\n * PIE Shared Types\n *\n * Framework-agnostic TypeScript types for PIE elements.\n */\n\nexport * from './authoring.js';\nexport * from './docs-contract.js';\nexport * from './summary.js';\nexport * from './types.js';\n"]}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The element summary contract: an element's item content described as data, which a player
|
|
3
|
+
* renders as a list row without loading the element. An element publishes it as a `./summary`
|
|
4
|
+
* entry exporting `summarize`, and its browser build as `./browser/summary`. The vocabulary
|
|
5
|
+
* follows QTI interaction terms. pie-players' item summary and list PRD owns the design:
|
|
6
|
+
* https://github.com/pie-framework/pie-players/blob/develop/docs/prds/item-summary-and-list.md
|
|
7
|
+
*/
|
|
8
|
+
export interface SummaryOptions {
|
|
9
|
+
/** Gates `answer` and `correct`; `student` withholds both. */
|
|
10
|
+
role: 'student' | 'instructor';
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Describes `model`, an element model as authored. Pure and deterministic: no I/O, no clock or
|
|
14
|
+
* random source, and options keep authored order whatever the model's shuffle setting. Strings are
|
|
15
|
+
* HTML, unsanitized, with TeX as authored; the renderer sanitizes them.
|
|
16
|
+
*/
|
|
17
|
+
export type SummarizeFn = (model: unknown, options: SummaryOptions) => ElementSummary;
|
|
18
|
+
export interface ElementSummary {
|
|
19
|
+
/** HTML. */
|
|
20
|
+
prompt?: string;
|
|
21
|
+
/** Sub-prompts in document order: blanks, rows, a multi-part element's parts. */
|
|
22
|
+
parts?: SummaryPart[];
|
|
23
|
+
/** Choices, dropdown entries, draggable tokens, in authored order. */
|
|
24
|
+
options?: SummaryOption[];
|
|
25
|
+
/** HTML, instructor only: the correct response stated as content. */
|
|
26
|
+
answer?: string;
|
|
27
|
+
/** One representative image for the row. */
|
|
28
|
+
figure?: {
|
|
29
|
+
src: string;
|
|
30
|
+
alt?: string;
|
|
31
|
+
};
|
|
32
|
+
/** Audio and video the element plays, by reference. */
|
|
33
|
+
media?: {
|
|
34
|
+
kind: 'audio' | 'video';
|
|
35
|
+
src?: string;
|
|
36
|
+
title?: string;
|
|
37
|
+
}[];
|
|
38
|
+
/** A person scores this element. */
|
|
39
|
+
manualScoring?: boolean;
|
|
40
|
+
}
|
|
41
|
+
export interface SummaryPart {
|
|
42
|
+
id?: string;
|
|
43
|
+
/** HTML. */
|
|
44
|
+
prompt?: string;
|
|
45
|
+
options?: SummaryOption[];
|
|
46
|
+
/** HTML, instructor only. */
|
|
47
|
+
answer?: string;
|
|
48
|
+
}
|
|
49
|
+
export interface SummaryOption {
|
|
50
|
+
id: string;
|
|
51
|
+
/** HTML. */
|
|
52
|
+
label: string;
|
|
53
|
+
/** Instructor only. */
|
|
54
|
+
correct?: boolean;
|
|
55
|
+
/** The blank, row or category the option belongs to. */
|
|
56
|
+
group?: string;
|
|
57
|
+
}
|
package/dist/summary.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The element summary contract: an element's item content described as data, which a player
|
|
3
|
+
* renders as a list row without loading the element. An element publishes it as a `./summary`
|
|
4
|
+
* entry exporting `summarize`, and its browser build as `./browser/summary`. The vocabulary
|
|
5
|
+
* follows QTI interaction terms. pie-players' item summary and list PRD owns the design:
|
|
6
|
+
* https://github.com/pie-framework/pie-players/blob/develop/docs/prds/item-summary-and-list.md
|
|
7
|
+
*/
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=summary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"summary.js","sourceRoot":"","sources":["../src/summary.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG","sourcesContent":["/**\n * The element summary contract: an element's item content described as data, which a player\n * renders as a list row without loading the element. An element publishes it as a `./summary`\n * entry exporting `summarize`, and its browser build as `./browser/summary`. The vocabulary\n * follows QTI interaction terms. pie-players' item summary and list PRD owns the design:\n * https://github.com/pie-framework/pie-players/blob/develop/docs/prds/item-summary-and-list.md\n */\n\nexport interface SummaryOptions {\n /** Gates `answer` and `correct`; `student` withholds both. */\n role: 'student' | 'instructor';\n}\n\n/**\n * Describes `model`, an element model as authored. Pure and deterministic: no I/O, no clock or\n * random source, and options keep authored order whatever the model's shuffle setting. Strings are\n * HTML, unsanitized, with TeX as authored; the renderer sanitizes them.\n */\nexport type SummarizeFn = (model: unknown, options: SummaryOptions) => ElementSummary;\n\nexport interface ElementSummary {\n /** HTML. */\n prompt?: string;\n /** Sub-prompts in document order: blanks, rows, a multi-part element's parts. */\n parts?: SummaryPart[];\n /** Choices, dropdown entries, draggable tokens, in authored order. */\n options?: SummaryOption[];\n /** HTML, instructor only: the correct response stated as content. */\n answer?: string;\n /** One representative image for the row. */\n figure?: { src: string; alt?: string };\n /** Audio and video the element plays, by reference. */\n media?: { kind: 'audio' | 'video'; src?: string; title?: string }[];\n /** A person scores this element. */\n manualScoring?: boolean;\n}\n\nexport interface SummaryPart {\n id?: string;\n /** HTML. */\n prompt?: string;\n options?: SummaryOption[];\n /** HTML, instructor only. */\n answer?: string;\n}\n\nexport interface SummaryOption {\n id: string;\n /** HTML. */\n label: string;\n /** Instructor only. */\n correct?: boolean;\n /** The blank, row or category the option belongs to. */\n group?: string;\n}\n"]}
|