@pie-element/placement-ordering 15.0.4-next.20261011174919 → 15.0.4
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/author/choice-editor.d.ts +43 -1
- package/dist/author/defaults.d.ts +66 -64
- package/dist/author/design.d.ts +37 -7
- package/dist/author/design.js +78 -79
- package/dist/author/index.d.ts +17 -28
- package/dist/author/index.js +13 -6
- package/dist/browser/author/index.js +33 -32
- package/dist/browser/author/index.js.map +1 -1
- package/dist/browser/controller/index.js +8 -10
- package/dist/browser/controller/index.js.map +1 -1
- package/dist/browser/editor-runtime/author/index.js +33 -32
- package/dist/browser/editor-runtime/author/index.js.map +1 -1
- package/dist/browser/editor-runtime/controller/index.js +8 -10
- package/dist/browser/editor-runtime/controller/index.js.map +1 -1
- package/dist/controller/defaults.d.ts +16 -15
- package/dist/controller/index.d.ts +52 -7
- package/dist/controller/index.js +12 -14
- package/dist/controller/scoring.d.ts +18 -5
- package/dist/controller/scoring.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/schemas/configuration.schema.json +430 -0
- package/dist/schemas/model.schema.json +538 -0
- package/dist/schemas/session.schema.json +26 -0
- package/dist/types.d.ts +199 -0
- package/package.json +21 -17
|
@@ -1,6 +1,48 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
|
|
3
|
+
import type { DeleteDone, ImageHandler } from '@pie-element/shared-configure-events';
|
|
4
|
+
import type { ConfigureMathMLProp, EditableHtmlConfigureProp } from '@pie-element/shared-types';
|
|
5
|
+
import type { PlacementOrderingValidationErrors } from '../controller/index.js';
|
|
6
|
+
import type { Choice, CorrectResponse } from '../types.js';
|
|
7
|
+
/** A tile the author drags: a choice, or a slot of the correct order. */
|
|
8
|
+
export type AuthorTile = Partial<Choice> & {
|
|
9
|
+
type: 'choice' | 'target';
|
|
10
|
+
draggable: boolean;
|
|
11
|
+
editable: boolean;
|
|
12
|
+
droppable?: boolean;
|
|
13
|
+
index?: number;
|
|
14
|
+
};
|
|
15
|
+
/** The choices, the correct order being edited, and the tiles built from both. */
|
|
16
|
+
export type AuthorOrdering = {
|
|
17
|
+
choices: Choice[];
|
|
18
|
+
/** Has empty slots while the author has not placed every choice */
|
|
19
|
+
response: Array<CorrectResponse | string | undefined>;
|
|
20
|
+
tiles: AuthorTile[];
|
|
21
|
+
};
|
|
22
|
+
type ChoiceEditorProps = {
|
|
23
|
+
correctResponse?: Array<CorrectResponse | string>;
|
|
24
|
+
choices: Choice[];
|
|
25
|
+
onChange: (choices: Choice[], correctResponse?: AuthorOrdering['response']) => void;
|
|
26
|
+
imageSupport?: {
|
|
27
|
+
add: (handler: ImageHandler) => void;
|
|
28
|
+
delete: (src: string, done: DeleteDone) => void;
|
|
29
|
+
};
|
|
30
|
+
toolbarOpts?: {
|
|
31
|
+
position: string;
|
|
32
|
+
};
|
|
33
|
+
pluginProps?: EditableHtmlConfigureProp;
|
|
34
|
+
choicesLabel?: string;
|
|
35
|
+
placementArea?: boolean;
|
|
36
|
+
singularChoiceLabel?: string;
|
|
37
|
+
pluralChoiceLabel?: string;
|
|
38
|
+
spellCheck?: boolean;
|
|
39
|
+
maxImageWidth?: number;
|
|
40
|
+
maxImageHeight?: number;
|
|
41
|
+
errors?: PlacementOrderingValidationErrors;
|
|
42
|
+
mathMlOptions?: ConfigureMathMLProp;
|
|
43
|
+
ordering: AuthorOrdering;
|
|
44
|
+
};
|
|
45
|
+
declare class ChoiceEditor extends React.Component<ChoiceEditorProps> {
|
|
4
46
|
static propTypes: {
|
|
5
47
|
correctResponse: PropTypes.Validator<any[]>;
|
|
6
48
|
choices: PropTypes.Validator<any[]>;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { ConfigureLanguageOptionsProp } from '@pie-element/shared-types';
|
|
2
|
+
import type { Choice, CorrectResponse } from '../types.js';
|
|
1
3
|
/** NOTE: teacherInstructions, studentInstructions, rationale & scoringType
|
|
2
4
|
* functionalities are not defined yet - the value for those can belong to
|
|
3
5
|
* model or to configuration
|
|
@@ -5,168 +7,168 @@
|
|
|
5
7
|
declare const _default: {
|
|
6
8
|
model: {
|
|
7
9
|
choiceLabel: string;
|
|
8
|
-
choiceLabelEnabled:
|
|
9
|
-
choices:
|
|
10
|
-
correctResponse:
|
|
11
|
-
feedbackEnabled:
|
|
12
|
-
numberedGuides:
|
|
13
|
-
orientation:
|
|
14
|
-
partialScoring:
|
|
15
|
-
placementArea:
|
|
10
|
+
choiceLabelEnabled: true;
|
|
11
|
+
choices: Choice[];
|
|
12
|
+
correctResponse: CorrectResponse[];
|
|
13
|
+
feedbackEnabled: false;
|
|
14
|
+
numberedGuides: false;
|
|
15
|
+
orientation: "vertical";
|
|
16
|
+
partialScoring: true;
|
|
17
|
+
placementArea: false;
|
|
16
18
|
prompt: string;
|
|
17
|
-
promptEnabled:
|
|
19
|
+
promptEnabled: true;
|
|
18
20
|
rationale: string;
|
|
19
|
-
rationaleEnabled:
|
|
20
|
-
removeTilesAfterPlacing:
|
|
21
|
-
scoringType:
|
|
22
|
-
studentInstructionsEnabled:
|
|
21
|
+
rationaleEnabled: true;
|
|
22
|
+
removeTilesAfterPlacing: true;
|
|
23
|
+
scoringType: "auto";
|
|
24
|
+
studentInstructionsEnabled: true;
|
|
23
25
|
targetLabel: string;
|
|
24
26
|
teacherInstructions: string;
|
|
25
|
-
teacherInstructionsEnabled:
|
|
26
|
-
toolbarEditorPosition:
|
|
27
|
+
teacherInstructionsEnabled: true;
|
|
28
|
+
toolbarEditorPosition: "bottom";
|
|
27
29
|
};
|
|
28
30
|
configuration: {
|
|
29
31
|
baseInputConfiguration: {
|
|
30
32
|
h3: {
|
|
31
|
-
disabled:
|
|
33
|
+
disabled: true;
|
|
32
34
|
};
|
|
33
35
|
audio: {
|
|
34
|
-
disabled:
|
|
36
|
+
disabled: false;
|
|
35
37
|
};
|
|
36
38
|
video: {
|
|
37
|
-
disabled:
|
|
39
|
+
disabled: false;
|
|
38
40
|
};
|
|
39
41
|
image: {
|
|
40
|
-
disabled:
|
|
42
|
+
disabled: false;
|
|
41
43
|
};
|
|
42
44
|
textAlign: {
|
|
43
|
-
disabled:
|
|
45
|
+
disabled: true;
|
|
44
46
|
};
|
|
45
47
|
showParagraphs: {
|
|
46
|
-
disabled:
|
|
48
|
+
disabled: false;
|
|
47
49
|
};
|
|
48
50
|
separateParagraphs: {
|
|
49
|
-
disabled:
|
|
51
|
+
disabled: true;
|
|
50
52
|
};
|
|
51
53
|
};
|
|
52
54
|
choiceLabel: {
|
|
53
|
-
settings:
|
|
55
|
+
settings: true;
|
|
54
56
|
label: string;
|
|
55
57
|
inputConfiguration: {
|
|
56
58
|
audio: {
|
|
57
|
-
disabled:
|
|
59
|
+
disabled: false;
|
|
58
60
|
};
|
|
59
61
|
video: {
|
|
60
|
-
disabled:
|
|
62
|
+
disabled: false;
|
|
61
63
|
};
|
|
62
64
|
image: {
|
|
63
|
-
disabled:
|
|
65
|
+
disabled: false;
|
|
64
66
|
};
|
|
65
67
|
};
|
|
66
68
|
};
|
|
67
69
|
choices: {
|
|
68
|
-
settings:
|
|
70
|
+
settings: true;
|
|
69
71
|
label: string;
|
|
70
72
|
inputConfiguration: {
|
|
71
73
|
audio: {
|
|
72
|
-
disabled:
|
|
74
|
+
disabled: true;
|
|
73
75
|
};
|
|
74
76
|
video: {
|
|
75
|
-
disabled:
|
|
77
|
+
disabled: true;
|
|
76
78
|
};
|
|
77
79
|
image: {
|
|
78
|
-
disabled:
|
|
80
|
+
disabled: true;
|
|
79
81
|
};
|
|
80
82
|
};
|
|
81
83
|
};
|
|
82
84
|
feedback: {
|
|
83
|
-
settings:
|
|
85
|
+
settings: true;
|
|
84
86
|
label: string;
|
|
85
|
-
enabled:
|
|
87
|
+
enabled: true;
|
|
86
88
|
};
|
|
87
89
|
prompt: {
|
|
88
|
-
settings:
|
|
90
|
+
settings: true;
|
|
89
91
|
label: string;
|
|
90
|
-
required:
|
|
92
|
+
required: false;
|
|
91
93
|
inputConfiguration: {
|
|
92
94
|
audio: {
|
|
93
|
-
disabled:
|
|
95
|
+
disabled: false;
|
|
94
96
|
};
|
|
95
97
|
video: {
|
|
96
|
-
disabled:
|
|
98
|
+
disabled: false;
|
|
97
99
|
};
|
|
98
100
|
image: {
|
|
99
|
-
disabled:
|
|
101
|
+
disabled: false;
|
|
100
102
|
};
|
|
101
103
|
};
|
|
102
104
|
};
|
|
103
105
|
numberedGuides: {
|
|
104
|
-
settings:
|
|
106
|
+
settings: true;
|
|
105
107
|
label: string;
|
|
106
108
|
};
|
|
107
109
|
orientation: {
|
|
108
|
-
settings:
|
|
110
|
+
settings: true;
|
|
109
111
|
label: string;
|
|
110
112
|
};
|
|
111
113
|
partialScoring: {
|
|
112
|
-
settings:
|
|
114
|
+
settings: false;
|
|
113
115
|
label: string;
|
|
114
116
|
};
|
|
115
117
|
placementArea: {
|
|
116
|
-
settings:
|
|
118
|
+
settings: true;
|
|
117
119
|
label: string;
|
|
118
120
|
};
|
|
119
121
|
rationale: {
|
|
120
|
-
settings:
|
|
122
|
+
settings: true;
|
|
121
123
|
label: string;
|
|
122
|
-
required:
|
|
124
|
+
required: false;
|
|
123
125
|
inputConfiguration: {
|
|
124
126
|
audio: {
|
|
125
|
-
disabled:
|
|
127
|
+
disabled: false;
|
|
126
128
|
};
|
|
127
129
|
video: {
|
|
128
|
-
disabled:
|
|
130
|
+
disabled: false;
|
|
129
131
|
};
|
|
130
132
|
image: {
|
|
131
|
-
disabled:
|
|
133
|
+
disabled: false;
|
|
132
134
|
};
|
|
133
135
|
};
|
|
134
136
|
};
|
|
135
137
|
removeTilesAfterPlacing: {
|
|
136
|
-
settings:
|
|
138
|
+
settings: false;
|
|
137
139
|
label: string;
|
|
138
140
|
};
|
|
139
|
-
settingsPanelDisabled:
|
|
141
|
+
settingsPanelDisabled: false;
|
|
140
142
|
scoringType: {
|
|
141
|
-
settings:
|
|
143
|
+
settings: false;
|
|
142
144
|
label: string;
|
|
143
145
|
};
|
|
144
146
|
studentInstructions: {
|
|
145
|
-
settings:
|
|
147
|
+
settings: false;
|
|
146
148
|
label: string;
|
|
147
149
|
};
|
|
148
150
|
targetLabel: {
|
|
149
|
-
settings:
|
|
151
|
+
settings: true;
|
|
150
152
|
label: string;
|
|
151
153
|
};
|
|
152
154
|
spellCheck: {
|
|
153
155
|
label: string;
|
|
154
|
-
settings:
|
|
155
|
-
enabled:
|
|
156
|
+
settings: false;
|
|
157
|
+
enabled: true;
|
|
156
158
|
};
|
|
157
159
|
teacherInstructions: {
|
|
158
|
-
settings:
|
|
160
|
+
settings: true;
|
|
159
161
|
label: string;
|
|
160
|
-
required:
|
|
162
|
+
required: false;
|
|
161
163
|
inputConfiguration: {
|
|
162
164
|
audio: {
|
|
163
|
-
disabled:
|
|
165
|
+
disabled: false;
|
|
164
166
|
};
|
|
165
167
|
video: {
|
|
166
|
-
disabled:
|
|
168
|
+
disabled: false;
|
|
167
169
|
};
|
|
168
170
|
image: {
|
|
169
|
-
disabled:
|
|
171
|
+
disabled: false;
|
|
170
172
|
};
|
|
171
173
|
};
|
|
172
174
|
};
|
|
@@ -184,21 +186,21 @@ declare const _default: {
|
|
|
184
186
|
choices: number;
|
|
185
187
|
};
|
|
186
188
|
withRubric: {
|
|
187
|
-
settings:
|
|
189
|
+
settings: false;
|
|
188
190
|
label: string;
|
|
189
191
|
};
|
|
190
192
|
mathMlOptions: {
|
|
191
|
-
mmlOutput:
|
|
192
|
-
mmlEditing:
|
|
193
|
+
mmlOutput: false;
|
|
194
|
+
mmlEditing: false;
|
|
193
195
|
};
|
|
194
196
|
language: {
|
|
195
|
-
settings:
|
|
197
|
+
settings: false;
|
|
196
198
|
label: string;
|
|
197
|
-
enabled:
|
|
199
|
+
enabled: false;
|
|
198
200
|
};
|
|
199
201
|
languageChoices: {
|
|
200
202
|
label: string;
|
|
201
|
-
options:
|
|
203
|
+
options: ConfigureLanguageOptionsProp[];
|
|
202
204
|
};
|
|
203
205
|
};
|
|
204
206
|
};
|
package/dist/author/design.d.ts
CHANGED
|
@@ -1,13 +1,43 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import type { DragEndEvent } from '@dnd-kit/core';
|
|
3
|
+
import { type AuthorOrdering } from './choice-editor.js';
|
|
4
|
+
import type { DeleteDone, ImageHandler, SoundHandler } from '@pie-element/shared-configure-events';
|
|
5
|
+
import type { PlacementOrderingValidationErrors } from '../controller/index.js';
|
|
6
|
+
import type { Choice, PlacementOrderingConfiguration, PlacementOrderingModel } from '../types.js';
|
|
7
|
+
/** The model the author edits; the host sets `errors` from the controller's `validate()`. */
|
|
8
|
+
export type AuthorModel = Partial<PlacementOrderingModel> & {
|
|
9
|
+
choices: Choice[];
|
|
10
|
+
errors?: PlacementOrderingValidationErrors;
|
|
11
|
+
};
|
|
12
|
+
type MediaSupport<Handler> = {
|
|
13
|
+
add: (handler: Handler) => void;
|
|
14
|
+
delete: (src: string, done: DeleteDone) => void;
|
|
15
|
+
};
|
|
16
|
+
export type DesignProps = {
|
|
17
|
+
model: AuthorModel;
|
|
18
|
+
configuration: PlacementOrderingConfiguration;
|
|
19
|
+
onModelChanged: (model: AuthorModel, resetSession?: boolean) => void;
|
|
20
|
+
onConfigurationChanged: (configuration: PlacementOrderingConfiguration, reset?: boolean) => void;
|
|
21
|
+
imageSupport?: MediaSupport<ImageHandler>;
|
|
22
|
+
uploadSoundSupport?: MediaSupport<SoundHandler>;
|
|
23
|
+
};
|
|
24
|
+
export declare class Design extends React.Component<DesignProps> {
|
|
25
|
+
static defaultProps: {
|
|
26
|
+
onModelChanged: () => void;
|
|
27
|
+
onConfigurationChanged: () => void;
|
|
6
28
|
};
|
|
7
|
-
|
|
8
|
-
|
|
29
|
+
applyUpdate: (modelFn: (model: AuthorModel) => AuthorModel) => void;
|
|
30
|
+
changeHandler: (modelPath: string, valuePath?: string) => (value: unknown) => void;
|
|
31
|
+
onPromptChange: (value: unknown) => void;
|
|
32
|
+
onTeacherInstructionsChange: (value: unknown) => void;
|
|
33
|
+
onRationaleChange: (value: unknown) => void;
|
|
34
|
+
onChoiceAreaLabelChange: (value: unknown) => void;
|
|
35
|
+
onAnswerAreaLabelChange: (value: unknown) => void;
|
|
36
|
+
onFeedbackChange: (value: unknown) => void;
|
|
37
|
+
onChoiceEditorChange: (choices: Choice[], correctResponse?: AuthorOrdering['response']) => void;
|
|
38
|
+
constructor(props: DesignProps);
|
|
9
39
|
componentDidMount(): void;
|
|
10
|
-
onDragEnd:
|
|
40
|
+
onDragEnd: (event: DragEndEvent, ordering: AuthorOrdering) => void;
|
|
11
41
|
render(): React.JSX.Element;
|
|
12
42
|
}
|
|
13
43
|
export default Design;
|