@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.
@@ -1,6 +1,48 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React from 'react';
3
- declare class ChoiceEditor extends React.Component {
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: boolean;
9
- choices: never[];
10
- correctResponse: never[];
11
- feedbackEnabled: boolean;
12
- numberedGuides: boolean;
13
- orientation: string;
14
- partialScoring: boolean;
15
- placementArea: boolean;
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: boolean;
19
+ promptEnabled: true;
18
20
  rationale: string;
19
- rationaleEnabled: boolean;
20
- removeTilesAfterPlacing: boolean;
21
- scoringType: string;
22
- studentInstructionsEnabled: boolean;
21
+ rationaleEnabled: true;
22
+ removeTilesAfterPlacing: true;
23
+ scoringType: "auto";
24
+ studentInstructionsEnabled: true;
23
25
  targetLabel: string;
24
26
  teacherInstructions: string;
25
- teacherInstructionsEnabled: boolean;
26
- toolbarEditorPosition: string;
27
+ teacherInstructionsEnabled: true;
28
+ toolbarEditorPosition: "bottom";
27
29
  };
28
30
  configuration: {
29
31
  baseInputConfiguration: {
30
32
  h3: {
31
- disabled: boolean;
33
+ disabled: true;
32
34
  };
33
35
  audio: {
34
- disabled: boolean;
36
+ disabled: false;
35
37
  };
36
38
  video: {
37
- disabled: boolean;
39
+ disabled: false;
38
40
  };
39
41
  image: {
40
- disabled: boolean;
42
+ disabled: false;
41
43
  };
42
44
  textAlign: {
43
- disabled: boolean;
45
+ disabled: true;
44
46
  };
45
47
  showParagraphs: {
46
- disabled: boolean;
48
+ disabled: false;
47
49
  };
48
50
  separateParagraphs: {
49
- disabled: boolean;
51
+ disabled: true;
50
52
  };
51
53
  };
52
54
  choiceLabel: {
53
- settings: boolean;
55
+ settings: true;
54
56
  label: string;
55
57
  inputConfiguration: {
56
58
  audio: {
57
- disabled: boolean;
59
+ disabled: false;
58
60
  };
59
61
  video: {
60
- disabled: boolean;
62
+ disabled: false;
61
63
  };
62
64
  image: {
63
- disabled: boolean;
65
+ disabled: false;
64
66
  };
65
67
  };
66
68
  };
67
69
  choices: {
68
- settings: boolean;
70
+ settings: true;
69
71
  label: string;
70
72
  inputConfiguration: {
71
73
  audio: {
72
- disabled: boolean;
74
+ disabled: true;
73
75
  };
74
76
  video: {
75
- disabled: boolean;
77
+ disabled: true;
76
78
  };
77
79
  image: {
78
- disabled: boolean;
80
+ disabled: true;
79
81
  };
80
82
  };
81
83
  };
82
84
  feedback: {
83
- settings: boolean;
85
+ settings: true;
84
86
  label: string;
85
- enabled: boolean;
87
+ enabled: true;
86
88
  };
87
89
  prompt: {
88
- settings: boolean;
90
+ settings: true;
89
91
  label: string;
90
- required: boolean;
92
+ required: false;
91
93
  inputConfiguration: {
92
94
  audio: {
93
- disabled: boolean;
95
+ disabled: false;
94
96
  };
95
97
  video: {
96
- disabled: boolean;
98
+ disabled: false;
97
99
  };
98
100
  image: {
99
- disabled: boolean;
101
+ disabled: false;
100
102
  };
101
103
  };
102
104
  };
103
105
  numberedGuides: {
104
- settings: boolean;
106
+ settings: true;
105
107
  label: string;
106
108
  };
107
109
  orientation: {
108
- settings: boolean;
110
+ settings: true;
109
111
  label: string;
110
112
  };
111
113
  partialScoring: {
112
- settings: boolean;
114
+ settings: false;
113
115
  label: string;
114
116
  };
115
117
  placementArea: {
116
- settings: boolean;
118
+ settings: true;
117
119
  label: string;
118
120
  };
119
121
  rationale: {
120
- settings: boolean;
122
+ settings: true;
121
123
  label: string;
122
- required: boolean;
124
+ required: false;
123
125
  inputConfiguration: {
124
126
  audio: {
125
- disabled: boolean;
127
+ disabled: false;
126
128
  };
127
129
  video: {
128
- disabled: boolean;
130
+ disabled: false;
129
131
  };
130
132
  image: {
131
- disabled: boolean;
133
+ disabled: false;
132
134
  };
133
135
  };
134
136
  };
135
137
  removeTilesAfterPlacing: {
136
- settings: boolean;
138
+ settings: false;
137
139
  label: string;
138
140
  };
139
- settingsPanelDisabled: boolean;
141
+ settingsPanelDisabled: false;
140
142
  scoringType: {
141
- settings: boolean;
143
+ settings: false;
142
144
  label: string;
143
145
  };
144
146
  studentInstructions: {
145
- settings: boolean;
147
+ settings: false;
146
148
  label: string;
147
149
  };
148
150
  targetLabel: {
149
- settings: boolean;
151
+ settings: true;
150
152
  label: string;
151
153
  };
152
154
  spellCheck: {
153
155
  label: string;
154
- settings: boolean;
155
- enabled: boolean;
156
+ settings: false;
157
+ enabled: true;
156
158
  };
157
159
  teacherInstructions: {
158
- settings: boolean;
160
+ settings: true;
159
161
  label: string;
160
- required: boolean;
162
+ required: false;
161
163
  inputConfiguration: {
162
164
  audio: {
163
- disabled: boolean;
165
+ disabled: false;
164
166
  };
165
167
  video: {
166
- disabled: boolean;
168
+ disabled: false;
167
169
  };
168
170
  image: {
169
- disabled: boolean;
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: boolean;
189
+ settings: false;
188
190
  label: string;
189
191
  };
190
192
  mathMlOptions: {
191
- mmlOutput: boolean;
192
- mmlEditing: boolean;
193
+ mmlOutput: false;
194
+ mmlEditing: false;
193
195
  };
194
196
  language: {
195
- settings: boolean;
197
+ settings: false;
196
198
  label: string;
197
- enabled: boolean;
199
+ enabled: false;
198
200
  };
199
201
  languageChoices: {
200
202
  label: string;
201
- options: never[];
203
+ options: ConfigureLanguageOptionsProp[];
202
204
  };
203
205
  };
204
206
  };
@@ -1,13 +1,43 @@
1
1
  import React from 'react';
2
- import PropTypes from 'prop-types';
3
- export declare class Design extends React.Component {
4
- static propTypes: {
5
- uploadSoundSupport: PropTypes.Requireable<object>;
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
- static defaultProps: {};
8
- constructor(props: any);
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: any;
40
+ onDragEnd: (event: DragEndEvent, ordering: AuthorOrdering) => void;
11
41
  render(): React.JSX.Element;
12
42
  }
13
43
  export default Design;