@intellectif/lk-react 2.1.0 → 4.0.0
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/README.md +3 -1
- package/dist/WrittenResponse-Dkg7FUt-.d.ts +87 -0
- package/dist/WrittenResponse-DqQ0NjPK.d.cts +87 -0
- package/dist/{chunk-3X7MYAFT.js → chunk-3DNJDP73.js} +11 -9
- package/dist/chunk-3DNJDP73.js.map +1 -0
- package/dist/chunk-4HZ7LQIH.cjs +40 -0
- package/dist/chunk-4HZ7LQIH.cjs.map +1 -0
- package/dist/chunk-525EWDUT.cjs +249 -0
- package/dist/chunk-525EWDUT.cjs.map +1 -0
- package/dist/{chunk-ZVFWJTT4.js → chunk-5SYL5CJ2.js} +10 -28
- package/dist/chunk-5SYL5CJ2.js.map +1 -0
- package/dist/{chunk-UXO6KYSZ.cjs → chunk-67RIIDZX.cjs} +17 -15
- package/dist/chunk-67RIIDZX.cjs.map +1 -0
- package/dist/chunk-6F4X2NKL.js +54 -0
- package/dist/chunk-6F4X2NKL.js.map +1 -0
- package/dist/chunk-GB5URWM4.js +38 -0
- package/dist/chunk-GB5URWM4.js.map +1 -0
- package/dist/chunk-GMU77L52.js +247 -0
- package/dist/chunk-GMU77L52.js.map +1 -0
- package/dist/chunk-NEWGUDA5.cjs +49 -0
- package/dist/chunk-NEWGUDA5.cjs.map +1 -0
- package/dist/{chunk-QHOV2A6M.cjs → chunk-PGEG7UZJ.cjs} +2 -34
- package/dist/chunk-PGEG7UZJ.cjs.map +1 -0
- package/dist/{chunk-XTJ22JAP.js → chunk-SWZRB3VY.js} +48 -14
- package/dist/chunk-SWZRB3VY.js.map +1 -0
- package/dist/chunk-UQ3BBEIT.js +47 -0
- package/dist/chunk-UQ3BBEIT.js.map +1 -0
- package/dist/{chunk-W6BH2YMZ.cjs → chunk-WCVD5LVG.cjs} +16 -34
- package/dist/chunk-WCVD5LVG.cjs.map +1 -0
- package/dist/{chunk-7BT6OXAR.cjs → chunk-XQJFLAMD.cjs} +53 -19
- package/dist/chunk-XQJFLAMD.cjs.map +1 -0
- package/dist/components/ActivitySequence.cjs +8 -5
- package/dist/components/ActivitySequence.d.cts +134 -8
- package/dist/components/ActivitySequence.d.ts +134 -8
- package/dist/components/ActivitySequence.js +7 -4
- package/dist/components/FillInTheBlanks.cjs +4 -3
- package/dist/components/FillInTheBlanks.d.cts +1 -1
- package/dist/components/FillInTheBlanks.d.ts +1 -1
- package/dist/components/FillInTheBlanks.js +3 -2
- package/dist/components/MultipleChoice.cjs +4 -3
- package/dist/components/MultipleChoice.d.cts +1 -1
- package/dist/components/MultipleChoice.d.ts +1 -1
- package/dist/components/MultipleChoice.js +3 -2
- package/dist/components/StimulusPanel.cjs +13 -0
- package/dist/components/StimulusPanel.cjs.map +1 -0
- package/dist/components/StimulusPanel.d.cts +30 -0
- package/dist/components/StimulusPanel.d.ts +30 -0
- package/dist/components/StimulusPanel.js +4 -0
- package/dist/components/StimulusPanel.js.map +1 -0
- package/dist/components/WrittenResponse.cjs +4 -3
- package/dist/components/WrittenResponse.d.cts +5 -86
- package/dist/components/WrittenResponse.d.ts +5 -86
- package/dist/components/WrittenResponse.js +3 -2
- package/dist/index.cjs +36 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -4
- package/dist/index.d.ts +6 -4
- package/dist/index.js +12 -7
- package/dist/index.js.map +1 -1
- package/dist/theme/skin.css +124 -0
- package/dist/{types-CNmjqD6M.d.cts → types-CrURyd9-.d.cts} +51 -3
- package/dist/{types-CNmjqD6M.d.ts → types-CrURyd9-.d.ts} +51 -3
- package/package.json +81 -28
- package/dist/chunk-3X7MYAFT.js.map +0 -1
- package/dist/chunk-7BT6OXAR.cjs.map +0 -1
- package/dist/chunk-QHOV2A6M.cjs.map +0 -1
- package/dist/chunk-STLRKR2I.cjs +0 -111
- package/dist/chunk-STLRKR2I.cjs.map +0 -1
- package/dist/chunk-UASXUWHH.js +0 -109
- package/dist/chunk-UASXUWHH.js.map +0 -1
- package/dist/chunk-UIGIYYGY.js +0 -85
- package/dist/chunk-UIGIYYGY.js.map +0 -1
- package/dist/chunk-UXO6KYSZ.cjs.map +0 -1
- package/dist/chunk-W6BH2YMZ.cjs.map +0 -1
- package/dist/chunk-XTJ22JAP.js.map +0 -1
- package/dist/chunk-ZVFWJTT4.js.map +0 -1
|
@@ -1,14 +1,135 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SequenceEntry, ActivityResult, LearnerResponse, InteractionEvent, ThemeTokens } from '@intellectif/lk-core';
|
|
2
|
+
import { ComponentType } from 'react';
|
|
3
|
+
import { A as ActivityProps, b as RenderableActivity, R as RenderMode, H as HtmlSanitizer } from '../types-CrURyd9-.js';
|
|
4
|
+
import { a as WrittenResponseSubmission } from '../WrittenResponse-Dkg7FUt-.js';
|
|
2
5
|
|
|
6
|
+
/**
|
|
7
|
+
* What one finished slot in a sequence produced. Two kinds, because two kinds
|
|
8
|
+
* of activity exist: those the SDK scores at submit time, and those a grader
|
|
9
|
+
* scores later. Collapsing them would mean inventing a score for ungraded
|
|
10
|
+
* work — the exact defect the deferred outcome exists to prevent.
|
|
11
|
+
*/
|
|
12
|
+
type SequenceItemOutcome = {
|
|
13
|
+
kind: 'scored';
|
|
14
|
+
/** Presented position. */
|
|
15
|
+
index: number;
|
|
16
|
+
/** Slot identity from `flattenSequence` — stable under shuffling; the `slotId` to score with. */
|
|
17
|
+
slotId: string;
|
|
18
|
+
activityId: string;
|
|
19
|
+
result: ActivityResult;
|
|
20
|
+
} | {
|
|
21
|
+
kind: 'submitted';
|
|
22
|
+
index: number;
|
|
23
|
+
slotId: string;
|
|
24
|
+
activityId: string;
|
|
25
|
+
/** Ungraded submission; the grade arrives asynchronously. */
|
|
26
|
+
submission: WrittenResponseSubmission;
|
|
27
|
+
} | {
|
|
28
|
+
kind: 'responded';
|
|
29
|
+
index: number;
|
|
30
|
+
slotId: string;
|
|
31
|
+
activityId: string;
|
|
32
|
+
/**
|
|
33
|
+
* The raw answer, with no grade of any kind. This is what an `exam` slot
|
|
34
|
+
* produces: the client is forbidden to score, so a response is all there
|
|
35
|
+
* is until the server grades it.
|
|
36
|
+
*/
|
|
37
|
+
response: LearnerResponse;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* A component that can render one activity inside a sequence. Register one per
|
|
41
|
+
* activity `type` to put a consumer-defined type on screen — the React half of
|
|
42
|
+
* the activity-type registry, matching `registerActivityType` in lk-core.
|
|
43
|
+
*/
|
|
44
|
+
type ActivityRenderer = ComponentType<ActivityProps>;
|
|
3
45
|
interface ActivitySequenceProps {
|
|
4
|
-
/**
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
46
|
+
/**
|
|
47
|
+
* The ordered set of entries to present, one question at a time: loose
|
|
48
|
+
* activities, and item groups — a shared passage, recording or image with
|
|
49
|
+
* the questions that refer to it. A group's stimulus stays on screen
|
|
50
|
+
* alongside each of its questions.
|
|
51
|
+
*
|
|
52
|
+
* Accepts `redact()` projections. For data straight off a server, pass it
|
|
53
|
+
* through `asRenderableSequence()` — see that helper for why a cast is
|
|
54
|
+
* unavoidable there — and set `renderMode="exam"`.
|
|
55
|
+
*/
|
|
56
|
+
activities: readonly SequenceEntry<RenderableActivity>[];
|
|
57
|
+
/**
|
|
58
|
+
* Renderers for activity types beyond the built-ins, keyed by `data.type`.
|
|
59
|
+
* A key matching a built-in overrides it, so a consumer can replace the
|
|
60
|
+
* bundled renderer without forking the sequencer.
|
|
61
|
+
*/
|
|
62
|
+
renderers?: Readonly<Record<string, ActivityRenderer>>;
|
|
63
|
+
/**
|
|
64
|
+
* Called whenever an individual activity is scored at submit time — the
|
|
65
|
+
* incremental persist hook.
|
|
66
|
+
*
|
|
67
|
+
* `slotId` is the identity to store the result against, NOT `index`.
|
|
68
|
+
* `index` is where the question was PRESENTED, which is not stable: it moves
|
|
69
|
+
* under shuffling, and it already differs from the slot identity whenever a
|
|
70
|
+
* group is present (the second entry of a sequence is presented at index 1
|
|
71
|
+
* but is slot `"1.0"` if it is a group's first question). `composeAssessmentScore`
|
|
72
|
+
* scores by `slotId`, so persisting `index` cannot be reconciled with it.
|
|
73
|
+
*/
|
|
74
|
+
onActivityComplete?: (result: ActivityResult, index: number, slotId: string) => void;
|
|
75
|
+
/**
|
|
76
|
+
* Called on every submit with the learner's raw response and the identity of
|
|
77
|
+
* the slot that produced it — before any grading, in every render mode.
|
|
78
|
+
*
|
|
79
|
+
* **This is the only response channel an `exam` sequence has.** In `exam`
|
|
80
|
+
* mode the components never grade, so `onActivityComplete` cannot fire and
|
|
81
|
+
* `onComplete` never will; without this prop nothing a learner submitted
|
|
82
|
+
* would reach the consumer at all. Persist `response` against `slotId`.
|
|
83
|
+
*/
|
|
84
|
+
onSubmit?: (response: LearnerResponse, slot: {
|
|
85
|
+
slotId: string;
|
|
86
|
+
index: number;
|
|
87
|
+
activityId: string;
|
|
88
|
+
}) => void;
|
|
89
|
+
/**
|
|
90
|
+
* Called once every activity has been completed, with the scored results.
|
|
91
|
+
*
|
|
92
|
+
* Fires only when EVERY item produced a score. A set containing a
|
|
93
|
+
* deferred-graded activity (a written response) can never satisfy that, so
|
|
94
|
+
* use `onFinished` for mixed sets — it is the general completion signal and
|
|
95
|
+
* reports both kinds of outcome. It also carries `slotId` per item, which
|
|
96
|
+
* this callback's bare array cannot.
|
|
97
|
+
*/
|
|
9
98
|
onComplete?: (results: ActivityResult[]) => void;
|
|
99
|
+
/**
|
|
100
|
+
* Called once every activity has been completed, whether it was scored at
|
|
101
|
+
* submit time or submitted for later grading. Use this for any set that
|
|
102
|
+
* mixes graded and deferred-graded activities.
|
|
103
|
+
*/
|
|
104
|
+
onFinished?: (items: SequenceItemOutcome[]) => void;
|
|
10
105
|
/** Forwarded to each activity. */
|
|
11
106
|
onInteraction?: (event: InteractionEvent) => void;
|
|
107
|
+
/** Forwarded to each activity. `exam` and `review` disable local scoring. */
|
|
108
|
+
renderMode?: RenderMode;
|
|
109
|
+
/**
|
|
110
|
+
* `entries` shuffles the top-level entries; a group moves as one block, and
|
|
111
|
+
* the order INSIDE a group follows the group's own `shuffle` setting.
|
|
112
|
+
* Default `none`: authored order.
|
|
113
|
+
*/
|
|
114
|
+
shuffle?: 'none' | 'entries';
|
|
115
|
+
/**
|
|
116
|
+
* Seed for every shuffle in this sequence (`shuffle: 'entries'` and any
|
|
117
|
+
* group with `shuffle: 'within-group'`). Supply the attempt id, so the
|
|
118
|
+
* server's `flattenSequence(entries, { seed })` derives the same order this
|
|
119
|
+
* pager shows.
|
|
120
|
+
*
|
|
121
|
+
* **Required in `exam` and `review` mode** — omitting it throws. An order
|
|
122
|
+
* nobody can reproduce cannot be reconciled with a recorded attempt, and
|
|
123
|
+
* failing at render is the only way that mistake surfaces before a learner
|
|
124
|
+
* sits the paper. In `practice` mode it stays optional: a random per-mount
|
|
125
|
+
* seed is used, which is stable within the mount and deliberately not
|
|
126
|
+
* reproducible. That fallback is also not SSR-safe (server and client would
|
|
127
|
+
* invent different orders and hydration would mismatch), so supply a seed
|
|
128
|
+
* for any server-rendered sequence regardless of mode.
|
|
129
|
+
*/
|
|
130
|
+
shuffleSeed?: string;
|
|
131
|
+
/** Renders author-supplied rich text; forwarded to the stimulus panel and every activity. */
|
|
132
|
+
sanitizeHtml?: HtmlSanitizer;
|
|
12
133
|
theme?: Partial<ThemeTokens>;
|
|
13
134
|
locale?: string;
|
|
14
135
|
disabled?: boolean;
|
|
@@ -19,7 +140,12 @@ interface ActivitySequenceProps {
|
|
|
19
140
|
* the learner may move back and forth; activities keep their own submit and
|
|
20
141
|
* scoring. On navigation, focus moves to the question region and the position
|
|
21
142
|
* is announced via an aria-live region.
|
|
143
|
+
*
|
|
144
|
+
* Item groups are flattened into consecutive questions; the group's stimulus
|
|
145
|
+
* is mounted ONCE, beside the question region rather than inside it, and shown
|
|
146
|
+
* alongside every question in the group — so a passage stays put, and a
|
|
147
|
+
* recording keeps its position, as the learner moves between its questions.
|
|
22
148
|
*/
|
|
23
|
-
declare function ActivitySequence({ activities, onActivityComplete, onComplete, onInteraction, theme, locale, disabled, }: ActivitySequenceProps): React.JSX.Element;
|
|
149
|
+
declare function ActivitySequence({ activities, renderers, onActivityComplete, onComplete, onFinished, onSubmit, onInteraction, renderMode, shuffle, shuffleSeed, sanitizeHtml, theme, locale, disabled, }: ActivitySequenceProps): React.JSX.Element;
|
|
24
150
|
|
|
25
|
-
export { ActivitySequence, type ActivitySequenceProps };
|
|
151
|
+
export { type ActivityRenderer, ActivitySequence, type ActivitySequenceProps, type SequenceItemOutcome };
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
export { ActivitySequence } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
3
|
-
import '../chunk-
|
|
4
|
-
import '../chunk-
|
|
1
|
+
export { ActivitySequence } from '../chunk-GMU77L52.js';
|
|
2
|
+
import '../chunk-5SYL5CJ2.js';
|
|
3
|
+
import '../chunk-3DNJDP73.js';
|
|
4
|
+
import '../chunk-SWZRB3VY.js';
|
|
5
|
+
import '../chunk-6F4X2NKL.js';
|
|
6
|
+
import '../chunk-UQ3BBEIT.js';
|
|
7
|
+
import '../chunk-GB5URWM4.js';
|
|
5
8
|
import '../chunk-5HVUKXF3.js';
|
|
6
9
|
//# sourceMappingURL=ActivitySequence.js.map
|
|
7
10
|
//# sourceMappingURL=ActivitySequence.js.map
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
3
|
+
var chunk67RIIDZX_cjs = require('../chunk-67RIIDZX.cjs');
|
|
4
|
+
require('../chunk-PGEG7UZJ.cjs');
|
|
5
|
+
require('../chunk-4HZ7LQIH.cjs');
|
|
5
6
|
require('../chunk-HD2AIQRD.cjs');
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
Object.defineProperty(exports, "FillInTheBlanks", {
|
|
10
11
|
enumerable: true,
|
|
11
|
-
get: function () { return
|
|
12
|
+
get: function () { return chunk67RIIDZX_cjs.FillInTheBlanks; }
|
|
12
13
|
});
|
|
13
14
|
//# sourceMappingURL=FillInTheBlanks.cjs.map
|
|
14
15
|
//# sourceMappingURL=FillInTheBlanks.cjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { FillInTheBlanksData } from '@intellectif/lk-core';
|
|
3
|
-
import { A as ActivityProps } from '../types-
|
|
3
|
+
import { A as ActivityProps } from '../types-CrURyd9-.cjs';
|
|
4
4
|
|
|
5
5
|
interface FillInTheBlanksProps extends ActivityProps<FillInTheBlanksData> {
|
|
6
6
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { FillInTheBlanksData } from '@intellectif/lk-core';
|
|
3
|
-
import { A as ActivityProps } from '../types-
|
|
3
|
+
import { A as ActivityProps } from '../types-CrURyd9-.js';
|
|
4
4
|
|
|
5
5
|
interface FillInTheBlanksProps extends ActivityProps<FillInTheBlanksData> {
|
|
6
6
|
/**
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export { FillInTheBlanks } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
1
|
+
export { FillInTheBlanks } from '../chunk-3DNJDP73.js';
|
|
2
|
+
import '../chunk-6F4X2NKL.js';
|
|
3
|
+
import '../chunk-GB5URWM4.js';
|
|
3
4
|
import '../chunk-5HVUKXF3.js';
|
|
4
5
|
//# sourceMappingURL=FillInTheBlanks.js.map
|
|
5
6
|
//# sourceMappingURL=FillInTheBlanks.js.map
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
3
|
+
var chunkWCVD5LVG_cjs = require('../chunk-WCVD5LVG.cjs');
|
|
4
|
+
require('../chunk-PGEG7UZJ.cjs');
|
|
5
|
+
require('../chunk-4HZ7LQIH.cjs');
|
|
5
6
|
require('../chunk-HD2AIQRD.cjs');
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
Object.defineProperty(exports, "MultipleChoice", {
|
|
10
11
|
enumerable: true,
|
|
11
|
-
get: function () { return
|
|
12
|
+
get: function () { return chunkWCVD5LVG_cjs.MultipleChoice; }
|
|
12
13
|
});
|
|
13
14
|
//# sourceMappingURL=MultipleChoice.cjs.map
|
|
14
15
|
//# sourceMappingURL=MultipleChoice.cjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { MultipleChoiceData } from '@intellectif/lk-core';
|
|
3
|
-
import { A as ActivityProps } from '../types-
|
|
3
|
+
import { A as ActivityProps } from '../types-CrURyd9-.cjs';
|
|
4
4
|
|
|
5
5
|
interface MultipleChoiceProps extends ActivityProps<MultipleChoiceData> {
|
|
6
6
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { MultipleChoiceData } from '@intellectif/lk-core';
|
|
3
|
-
import { A as ActivityProps } from '../types-
|
|
3
|
+
import { A as ActivityProps } from '../types-CrURyd9-.js';
|
|
4
4
|
|
|
5
5
|
interface MultipleChoiceProps extends ActivityProps<MultipleChoiceData> {
|
|
6
6
|
/**
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export { MultipleChoice } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
1
|
+
export { MultipleChoice } from '../chunk-5SYL5CJ2.js';
|
|
2
|
+
import '../chunk-6F4X2NKL.js';
|
|
3
|
+
import '../chunk-GB5URWM4.js';
|
|
3
4
|
import '../chunk-5HVUKXF3.js';
|
|
4
5
|
//# sourceMappingURL=MultipleChoice.js.map
|
|
5
6
|
//# sourceMappingURL=MultipleChoice.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkNEWGUDA5_cjs = require('../chunk-NEWGUDA5.cjs');
|
|
4
|
+
require('../chunk-4HZ7LQIH.cjs');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
Object.defineProperty(exports, "StimulusPanel", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function () { return chunkNEWGUDA5_cjs.StimulusPanel; }
|
|
11
|
+
});
|
|
12
|
+
//# sourceMappingURL=StimulusPanel.cjs.map
|
|
13
|
+
//# sourceMappingURL=StimulusPanel.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"StimulusPanel.cjs"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Stimulus } from '@intellectif/lk-core';
|
|
2
|
+
import { H as HtmlSanitizer } from '../types-CrURyd9-.cjs';
|
|
3
|
+
|
|
4
|
+
interface StimulusPanelProps {
|
|
5
|
+
stimulus: Stimulus;
|
|
6
|
+
/**
|
|
7
|
+
* 1-based presented positions of the first and last question this material
|
|
8
|
+
* serves, rendered as "Questions 3–8" so a learner knows how far the
|
|
9
|
+
* passage carries.
|
|
10
|
+
*/
|
|
11
|
+
range?: {
|
|
12
|
+
first: number;
|
|
13
|
+
last: number;
|
|
14
|
+
};
|
|
15
|
+
/** Renders `stimulus.bodyHtml` when provided. See `HtmlSanitizer`. */
|
|
16
|
+
sanitizeHtml?: HtmlSanitizer;
|
|
17
|
+
locale?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Presents a shared stimulus — the passage, recording or image an item group's
|
|
21
|
+
* questions refer to. A landmark region named by its title (or by its kind),
|
|
22
|
+
* so a screen-reader user can jump back to the material from any question.
|
|
23
|
+
*
|
|
24
|
+
* Rich text follows the SDK-wide rule: `bodyHtml` is rendered only through a
|
|
25
|
+
* caller-supplied sanitiser, and the plain `body` is the fallback — which the
|
|
26
|
+
* schema guarantees exists whenever `bodyHtml` does.
|
|
27
|
+
*/
|
|
28
|
+
declare function StimulusPanel({ stimulus, range, sanitizeHtml, locale, }: StimulusPanelProps): React.JSX.Element;
|
|
29
|
+
|
|
30
|
+
export { StimulusPanel, type StimulusPanelProps };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Stimulus } from '@intellectif/lk-core';
|
|
2
|
+
import { H as HtmlSanitizer } from '../types-CrURyd9-.js';
|
|
3
|
+
|
|
4
|
+
interface StimulusPanelProps {
|
|
5
|
+
stimulus: Stimulus;
|
|
6
|
+
/**
|
|
7
|
+
* 1-based presented positions of the first and last question this material
|
|
8
|
+
* serves, rendered as "Questions 3–8" so a learner knows how far the
|
|
9
|
+
* passage carries.
|
|
10
|
+
*/
|
|
11
|
+
range?: {
|
|
12
|
+
first: number;
|
|
13
|
+
last: number;
|
|
14
|
+
};
|
|
15
|
+
/** Renders `stimulus.bodyHtml` when provided. See `HtmlSanitizer`. */
|
|
16
|
+
sanitizeHtml?: HtmlSanitizer;
|
|
17
|
+
locale?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Presents a shared stimulus — the passage, recording or image an item group's
|
|
21
|
+
* questions refer to. A landmark region named by its title (or by its kind),
|
|
22
|
+
* so a screen-reader user can jump back to the material from any question.
|
|
23
|
+
*
|
|
24
|
+
* Rich text follows the SDK-wide rule: `bodyHtml` is rendered only through a
|
|
25
|
+
* caller-supplied sanitiser, and the plain `body` is the fallback — which the
|
|
26
|
+
* schema guarantees exists whenever `bodyHtml` does.
|
|
27
|
+
*/
|
|
28
|
+
declare function StimulusPanel({ stimulus, range, sanitizeHtml, locale, }: StimulusPanelProps): React.JSX.Element;
|
|
29
|
+
|
|
30
|
+
export { StimulusPanel, type StimulusPanelProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"StimulusPanel.js"}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
3
|
+
var chunkXQJFLAMD_cjs = require('../chunk-XQJFLAMD.cjs');
|
|
4
|
+
require('../chunk-PGEG7UZJ.cjs');
|
|
5
|
+
require('../chunk-4HZ7LQIH.cjs');
|
|
5
6
|
require('../chunk-HD2AIQRD.cjs');
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
Object.defineProperty(exports, "WrittenResponse", {
|
|
10
11
|
enumerable: true,
|
|
11
|
-
get: function () { return
|
|
12
|
+
get: function () { return chunkXQJFLAMD_cjs.WrittenResponse; }
|
|
12
13
|
});
|
|
13
14
|
//# sourceMappingURL=WrittenResponse.cjs.map
|
|
14
15
|
//# sourceMappingURL=WrittenResponse.cjs.map
|
|
@@ -1,89 +1,8 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
* Payload delivered when the learner submits a written response. Grading is
|
|
7
|
-
* DEFERRED (asynchronous AI/human grading), so there is no score here — and
|
|
8
|
-
* deliberately no fake one: an ungraded submission must never be shown or
|
|
9
|
-
* stored as a 0. The consumer persists `text` and grades it out-of-band.
|
|
10
|
-
*/
|
|
11
|
-
interface WrittenResponseSubmission {
|
|
12
|
-
/** The submitted text, verbatim. */
|
|
13
|
-
text: string;
|
|
14
|
-
/** Word count of `text`, recomputed with the canonical `countWords()`. */
|
|
15
|
-
wordCount: number;
|
|
16
|
-
/** Whether `wordCount` falls within the activity's `[minWords, maxWords]`. */
|
|
17
|
-
withinWordBounds: boolean;
|
|
18
|
-
/** Time in milliseconds from first interaction to submission. */
|
|
19
|
-
timeSpent: number;
|
|
20
|
-
/** The SUBMITTED-verb xAPI statement built for this submission (no score fields). */
|
|
21
|
-
xapiStatement: XAPIStatement;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Props for {@link WrittenResponse}. Mirrors `ActivityProps` except for the
|
|
25
|
-
* completion callback: a deferred-grading activity completes with a
|
|
26
|
-
* {@link WrittenResponseSubmission} (`onSubmitted`), not a scored
|
|
27
|
-
* `ActivityResult` (`onComplete`) — deviation from Req 22.8 recorded in the
|
|
28
|
-
* roadmap (§3.1): fabricating a score of 0 for ungraded work is the exact
|
|
29
|
-
* bug this type exists to fix. Everything else — controlled value, render
|
|
30
|
-
* mode, server outcome, rich text — follows the shared `ActivityProps`
|
|
31
|
-
* contract verbatim.
|
|
32
|
-
*/
|
|
33
|
-
interface WrittenResponseProps {
|
|
34
|
-
/** Activity content. Accepts a `redact()` projection in `exam` mode. */
|
|
35
|
-
data: Renderable<WrittenResponseData>;
|
|
36
|
-
/**
|
|
37
|
-
* Called on submit with the ungraded submission (text, recomputed word
|
|
38
|
-
* count, bounds flag, timing, xAPI statement). Fires in `practice` and
|
|
39
|
-
* `exam` mode, after `onSubmit`; never in `review`.
|
|
40
|
-
*
|
|
41
|
-
* Optional since v0.4 so a `review`-mode render (which has no submit
|
|
42
|
-
* control) and an exam runner that only wants the raw response through
|
|
43
|
-
* `onSubmit` do not have to pass a no-op. Supply it in `practice`/`exam`
|
|
44
|
-
* unless `onSubmit` already captures everything you persist.
|
|
45
|
-
*/
|
|
46
|
-
onSubmitted?: (submission: WrittenResponseSubmission) => void;
|
|
47
|
-
/**
|
|
48
|
-
* Called on submit with the raw learner response and no grade, BEFORE
|
|
49
|
-
* `onSubmitted`. This is the only submit callback an exam runner needs:
|
|
50
|
-
* the server grades the text and returns an {@link ItemOutcome} later.
|
|
51
|
-
*/
|
|
52
|
-
onSubmit?: (response: LearnerResponse) => void;
|
|
53
|
-
/**
|
|
54
|
-
* Controlled value: the learner's current response. When present the
|
|
55
|
-
* textarea renders from it (never from internal state) and every keystroke
|
|
56
|
-
* goes out through `onChange` — restore an in-progress attempt, autosave a
|
|
57
|
-
* delta, or drive a review render with it.
|
|
58
|
-
*/
|
|
59
|
-
value?: LearnerResponse;
|
|
60
|
-
/** Initial response for an uncontrolled component (ignored when `value` is set). */
|
|
61
|
-
defaultValue?: LearnerResponse;
|
|
62
|
-
/** Fires on every change to the learner's response. Required for a controlled component. */
|
|
63
|
-
onChange?: (response: LearnerResponse) => void;
|
|
64
|
-
/**
|
|
65
|
-
* Presentation mode, default `practice`. `practice` and `exam` are nearly
|
|
66
|
-
* identical here — a written response is never graded client-side, so
|
|
67
|
-
* there is no local score to withhold; `exam` additionally never calls
|
|
68
|
-
* `evaluate()` and renders happily from a `redact()` projection.
|
|
69
|
-
* `review` is read-only and shows the server's `outcome`.
|
|
70
|
-
*/
|
|
71
|
-
renderMode?: RenderMode;
|
|
72
|
-
/**
|
|
73
|
-
* Server-computed outcome, rendered by `review` mode: `deferred` shows a
|
|
74
|
-
* "not graded yet" affordance, `scored` shows the returned grade and
|
|
75
|
-
* feedback. Ignored in other modes — this component never manufactures an
|
|
76
|
-
* outcome of its own.
|
|
77
|
-
*/
|
|
78
|
-
outcome?: ItemOutcome;
|
|
79
|
-
/** Renders `data.promptHtml` when provided. See `HtmlSanitizer`. */
|
|
80
|
-
sanitizeHtml?: HtmlSanitizer;
|
|
81
|
-
onInteraction?: (event: InteractionEvent) => void;
|
|
82
|
-
/** Per-instance token overrides, applied as inline CSS vars on the root. */
|
|
83
|
-
theme?: Partial<ThemeTokens>;
|
|
84
|
-
locale?: string;
|
|
85
|
-
disabled?: boolean;
|
|
86
|
-
}
|
|
2
|
+
import { W as WrittenResponseProps } from '../WrittenResponse-DqQ0NjPK.cjs';
|
|
3
|
+
export { a as WrittenResponseSubmission } from '../WrittenResponse-DqQ0NjPK.cjs';
|
|
4
|
+
export { H as HtmlSanitizer, R as RenderMode, a as Renderable } from '../types-CrURyd9-.cjs';
|
|
5
|
+
import '@intellectif/lk-core';
|
|
87
6
|
|
|
88
7
|
/**
|
|
89
8
|
* Public Written Response activity: a labelled textarea with a live word
|
|
@@ -93,4 +12,4 @@ interface WrittenResponseProps {
|
|
|
93
12
|
*/
|
|
94
13
|
declare function WrittenResponse(props: WrittenResponseProps): react_jsx_runtime.JSX.Element;
|
|
95
14
|
|
|
96
|
-
export {
|
|
15
|
+
export { WrittenResponse, WrittenResponseProps };
|
|
@@ -1,89 +1,8 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
* Payload delivered when the learner submits a written response. Grading is
|
|
7
|
-
* DEFERRED (asynchronous AI/human grading), so there is no score here — and
|
|
8
|
-
* deliberately no fake one: an ungraded submission must never be shown or
|
|
9
|
-
* stored as a 0. The consumer persists `text` and grades it out-of-band.
|
|
10
|
-
*/
|
|
11
|
-
interface WrittenResponseSubmission {
|
|
12
|
-
/** The submitted text, verbatim. */
|
|
13
|
-
text: string;
|
|
14
|
-
/** Word count of `text`, recomputed with the canonical `countWords()`. */
|
|
15
|
-
wordCount: number;
|
|
16
|
-
/** Whether `wordCount` falls within the activity's `[minWords, maxWords]`. */
|
|
17
|
-
withinWordBounds: boolean;
|
|
18
|
-
/** Time in milliseconds from first interaction to submission. */
|
|
19
|
-
timeSpent: number;
|
|
20
|
-
/** The SUBMITTED-verb xAPI statement built for this submission (no score fields). */
|
|
21
|
-
xapiStatement: XAPIStatement;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Props for {@link WrittenResponse}. Mirrors `ActivityProps` except for the
|
|
25
|
-
* completion callback: a deferred-grading activity completes with a
|
|
26
|
-
* {@link WrittenResponseSubmission} (`onSubmitted`), not a scored
|
|
27
|
-
* `ActivityResult` (`onComplete`) — deviation from Req 22.8 recorded in the
|
|
28
|
-
* roadmap (§3.1): fabricating a score of 0 for ungraded work is the exact
|
|
29
|
-
* bug this type exists to fix. Everything else — controlled value, render
|
|
30
|
-
* mode, server outcome, rich text — follows the shared `ActivityProps`
|
|
31
|
-
* contract verbatim.
|
|
32
|
-
*/
|
|
33
|
-
interface WrittenResponseProps {
|
|
34
|
-
/** Activity content. Accepts a `redact()` projection in `exam` mode. */
|
|
35
|
-
data: Renderable<WrittenResponseData>;
|
|
36
|
-
/**
|
|
37
|
-
* Called on submit with the ungraded submission (text, recomputed word
|
|
38
|
-
* count, bounds flag, timing, xAPI statement). Fires in `practice` and
|
|
39
|
-
* `exam` mode, after `onSubmit`; never in `review`.
|
|
40
|
-
*
|
|
41
|
-
* Optional since v0.4 so a `review`-mode render (which has no submit
|
|
42
|
-
* control) and an exam runner that only wants the raw response through
|
|
43
|
-
* `onSubmit` do not have to pass a no-op. Supply it in `practice`/`exam`
|
|
44
|
-
* unless `onSubmit` already captures everything you persist.
|
|
45
|
-
*/
|
|
46
|
-
onSubmitted?: (submission: WrittenResponseSubmission) => void;
|
|
47
|
-
/**
|
|
48
|
-
* Called on submit with the raw learner response and no grade, BEFORE
|
|
49
|
-
* `onSubmitted`. This is the only submit callback an exam runner needs:
|
|
50
|
-
* the server grades the text and returns an {@link ItemOutcome} later.
|
|
51
|
-
*/
|
|
52
|
-
onSubmit?: (response: LearnerResponse) => void;
|
|
53
|
-
/**
|
|
54
|
-
* Controlled value: the learner's current response. When present the
|
|
55
|
-
* textarea renders from it (never from internal state) and every keystroke
|
|
56
|
-
* goes out through `onChange` — restore an in-progress attempt, autosave a
|
|
57
|
-
* delta, or drive a review render with it.
|
|
58
|
-
*/
|
|
59
|
-
value?: LearnerResponse;
|
|
60
|
-
/** Initial response for an uncontrolled component (ignored when `value` is set). */
|
|
61
|
-
defaultValue?: LearnerResponse;
|
|
62
|
-
/** Fires on every change to the learner's response. Required for a controlled component. */
|
|
63
|
-
onChange?: (response: LearnerResponse) => void;
|
|
64
|
-
/**
|
|
65
|
-
* Presentation mode, default `practice`. `practice` and `exam` are nearly
|
|
66
|
-
* identical here — a written response is never graded client-side, so
|
|
67
|
-
* there is no local score to withhold; `exam` additionally never calls
|
|
68
|
-
* `evaluate()` and renders happily from a `redact()` projection.
|
|
69
|
-
* `review` is read-only and shows the server's `outcome`.
|
|
70
|
-
*/
|
|
71
|
-
renderMode?: RenderMode;
|
|
72
|
-
/**
|
|
73
|
-
* Server-computed outcome, rendered by `review` mode: `deferred` shows a
|
|
74
|
-
* "not graded yet" affordance, `scored` shows the returned grade and
|
|
75
|
-
* feedback. Ignored in other modes — this component never manufactures an
|
|
76
|
-
* outcome of its own.
|
|
77
|
-
*/
|
|
78
|
-
outcome?: ItemOutcome;
|
|
79
|
-
/** Renders `data.promptHtml` when provided. See `HtmlSanitizer`. */
|
|
80
|
-
sanitizeHtml?: HtmlSanitizer;
|
|
81
|
-
onInteraction?: (event: InteractionEvent) => void;
|
|
82
|
-
/** Per-instance token overrides, applied as inline CSS vars on the root. */
|
|
83
|
-
theme?: Partial<ThemeTokens>;
|
|
84
|
-
locale?: string;
|
|
85
|
-
disabled?: boolean;
|
|
86
|
-
}
|
|
2
|
+
import { W as WrittenResponseProps } from '../WrittenResponse-Dkg7FUt-.js';
|
|
3
|
+
export { a as WrittenResponseSubmission } from '../WrittenResponse-Dkg7FUt-.js';
|
|
4
|
+
export { H as HtmlSanitizer, R as RenderMode, a as Renderable } from '../types-CrURyd9-.js';
|
|
5
|
+
import '@intellectif/lk-core';
|
|
87
6
|
|
|
88
7
|
/**
|
|
89
8
|
* Public Written Response activity: a labelled textarea with a live word
|
|
@@ -93,4 +12,4 @@ interface WrittenResponseProps {
|
|
|
93
12
|
*/
|
|
94
13
|
declare function WrittenResponse(props: WrittenResponseProps): react_jsx_runtime.JSX.Element;
|
|
95
14
|
|
|
96
|
-
export {
|
|
15
|
+
export { WrittenResponse, WrittenResponseProps };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export { WrittenResponse } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
1
|
+
export { WrittenResponse } from '../chunk-SWZRB3VY.js';
|
|
2
|
+
import '../chunk-6F4X2NKL.js';
|
|
3
|
+
import '../chunk-GB5URWM4.js';
|
|
3
4
|
import '../chunk-5HVUKXF3.js';
|
|
4
5
|
//# sourceMappingURL=WrittenResponse.js.map
|
|
5
6
|
//# sourceMappingURL=WrittenResponse.js.map
|