@pie-element/multiple-choice 14.0.4-next.20261011174919 → 14.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/defaults.d.ts +60 -58
- package/dist/author/index.d.ts +19 -11
- package/dist/author/index.js +6 -1
- package/dist/author/main.d.ts +30 -19
- package/dist/author/main.js +121 -133
- package/dist/author/utils.d.ts +2 -1
- package/dist/browser/author/index.js +15 -23
- package/dist/browser/author/index.js.map +1 -1
- package/dist/browser/controller/index.js +9 -8
- package/dist/browser/controller/index.js.map +1 -1
- package/dist/browser/editor-runtime/author/index.js +15 -23
- package/dist/browser/editor-runtime/author/index.js.map +1 -1
- package/dist/browser/editor-runtime/controller/index.js +9 -8
- package/dist/browser/editor-runtime/controller/index.js.map +1 -1
- package/dist/controller/defaults.d.ts +13 -13
- package/dist/controller/index.d.ts +103 -32
- package/dist/controller/index.js +9 -8
- package/dist/controller/utils.d.ts +3 -2
- package/dist/index.d.ts +1 -0
- package/dist/schemas/configuration.schema.json +447 -0
- package/dist/schemas/model.schema.json +567 -0
- package/dist/schemas/session.schema.json +30 -0
- package/dist/types.d.ts +243 -0
- package/package.json +18 -14
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import type { ConfigureLanguageOptions, ConfigureMathMLProp, ConfigureMaxImageDimensionsProp, ConfigureProp, ConfigurePropWithEnabled, ContentDimensions, CustomAudioButton, EditableHtmlConfigureProp, EditableHtmlPluginConfigure, EditableHtmlPluginConfigureRequired, ExtraCSSRules, PieModel } from '@pie-element/shared-types';
|
|
2
|
+
/**
|
|
3
|
+
* The type of feedback to use:
|
|
4
|
+
* `default` = a standard feedback message
|
|
5
|
+
* `custom` = a customized feedback message
|
|
6
|
+
*/
|
|
7
|
+
export interface Feedback {
|
|
8
|
+
/** @default "default" */
|
|
9
|
+
type: 'custom' | 'default' | 'none';
|
|
10
|
+
/** Value for feedback */
|
|
11
|
+
value?: string;
|
|
12
|
+
/** Custom value for feedback */
|
|
13
|
+
custom?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface Choice {
|
|
16
|
+
/** Indicates if the choice is correct */
|
|
17
|
+
correct?: boolean;
|
|
18
|
+
/** the value that will be stored if this choice is selected */
|
|
19
|
+
value: string;
|
|
20
|
+
/** the text label that will be presented to the user for this choice */
|
|
21
|
+
label: string;
|
|
22
|
+
/** Feedback shown for this choice in evaluate mode, when `feedbackEnabled` is set */
|
|
23
|
+
feedback?: Feedback;
|
|
24
|
+
/** Rationale for the Choice */
|
|
25
|
+
rationale?: string;
|
|
26
|
+
}
|
|
27
|
+
/** Model for the Choice Interaction */
|
|
28
|
+
export interface MultipleChoiceModel extends PieModel {
|
|
29
|
+
/** Indicates the choices are single or multiple selection */
|
|
30
|
+
choiceMode?: 'checkbox' | 'radio';
|
|
31
|
+
/**
|
|
32
|
+
* What key should be displayed before choices: `none` displays no key.
|
|
33
|
+
* @default "letters"
|
|
34
|
+
*/
|
|
35
|
+
choicePrefix?: 'letters' | 'numbers' | 'none';
|
|
36
|
+
/** The choice options for the question */
|
|
37
|
+
choices: Choice[];
|
|
38
|
+
/** The question prompt or item stem */
|
|
39
|
+
prompt?: string;
|
|
40
|
+
/** Determines if prompt should show */
|
|
41
|
+
promptEnabled?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Indicates the layout of choices for player
|
|
44
|
+
* @default "vertical"
|
|
45
|
+
*/
|
|
46
|
+
choicesLayout?: 'grid' | 'horizontal' | 'vertical';
|
|
47
|
+
/**
|
|
48
|
+
* Indicates the number of columns for the grid layout
|
|
49
|
+
* @default 2
|
|
50
|
+
*/
|
|
51
|
+
gridColumns?: number;
|
|
52
|
+
/**
|
|
53
|
+
* Indicates the editor's toolbar position which can be 'bottom' or 'top'
|
|
54
|
+
* @default "bottom"
|
|
55
|
+
*/
|
|
56
|
+
toolbarEditorPosition?: 'bottom' | 'top';
|
|
57
|
+
/**
|
|
58
|
+
* Indicates the background color for selected choices
|
|
59
|
+
* @default "initial"
|
|
60
|
+
*/
|
|
61
|
+
selectedAnswerBackgroundColor?: string;
|
|
62
|
+
/**
|
|
63
|
+
* Indicates the border color for selected choices
|
|
64
|
+
* @default "initial"
|
|
65
|
+
*/
|
|
66
|
+
selectedAnswerStrokeColor?: string;
|
|
67
|
+
/**
|
|
68
|
+
* Indicates the border width for selected choices if selectedAnswerBackgroundColor is set
|
|
69
|
+
* @default "initial"
|
|
70
|
+
*/
|
|
71
|
+
selectedAnswerStrokeWidth?: string;
|
|
72
|
+
/**
|
|
73
|
+
* Indicates the background color for choices on hover
|
|
74
|
+
* @default "initial"
|
|
75
|
+
*/
|
|
76
|
+
hoverAnswerBackgroundColor?: string;
|
|
77
|
+
/**
|
|
78
|
+
* Indicates the border color for choices on hover
|
|
79
|
+
* @default "initial"
|
|
80
|
+
*/
|
|
81
|
+
hoverAnswerStrokeColor?: string;
|
|
82
|
+
/**
|
|
83
|
+
* Indicates the border width for choices on hover if hoverAnswerBackgroundColor is set
|
|
84
|
+
* @default "initial"
|
|
85
|
+
*/
|
|
86
|
+
hoverAnswerStrokeWidth?: string;
|
|
87
|
+
/**
|
|
88
|
+
* Indicates the order of choices presented to user
|
|
89
|
+
* if true, answer choices will be presented in the order they are defined in the model
|
|
90
|
+
* If false, answer choices may be presented in a random order (depending upon the value of the lockChoiceOrder environment variable)
|
|
91
|
+
*/
|
|
92
|
+
lockChoiceOrder?: boolean;
|
|
93
|
+
/** Indicates that minimum selections that should be made (only for choice mode 'checkbox') */
|
|
94
|
+
minSelections?: number;
|
|
95
|
+
/** Indicates that maximum selections that should be made (only for choice mode 'checkbox') */
|
|
96
|
+
maxSelections?: number;
|
|
97
|
+
/** Indicates that the item should use partial scoring */
|
|
98
|
+
partialScoring?: boolean;
|
|
99
|
+
/** Indicates scoring type */
|
|
100
|
+
scoringType?: 'auto' | 'rubric';
|
|
101
|
+
/** Indicates student instructions */
|
|
102
|
+
studentInstructions?: string;
|
|
103
|
+
/** Indicates teacher instructions */
|
|
104
|
+
teacherInstructions?: string;
|
|
105
|
+
/** Indicates if feedback is enabled */
|
|
106
|
+
feedbackEnabled?: boolean;
|
|
107
|
+
/** Messages for choices whose feedback type is `default` */
|
|
108
|
+
defaultFeedback?: {
|
|
109
|
+
/** @default "Correct" */
|
|
110
|
+
correct?: string;
|
|
111
|
+
/** @default "Incorrect" */
|
|
112
|
+
incorrect?: string;
|
|
113
|
+
};
|
|
114
|
+
/** Indicates if Rationale are enabled */
|
|
115
|
+
rationaleEnabled?: boolean;
|
|
116
|
+
/** Not read by the element: each choice carries its own `rationale`. Default models include it. */
|
|
117
|
+
rationale?: string;
|
|
118
|
+
/** Indicates if spellcheck is enabled for the author. Default value is true */
|
|
119
|
+
spellCheckEnabled?: boolean;
|
|
120
|
+
/** Indicates if Student Instructions are enabled */
|
|
121
|
+
studentInstructionsEnabled?: boolean;
|
|
122
|
+
/** Indicates if Teacher Instructions are enabled */
|
|
123
|
+
teacherInstructionsEnabled?: boolean;
|
|
124
|
+
/** Indicates if Accessibility Labels are enabled */
|
|
125
|
+
accessibilityLabelsEnabled?: boolean;
|
|
126
|
+
/** Indicates if Rubric is enabled */
|
|
127
|
+
rubricEnabled?: boolean;
|
|
128
|
+
/**
|
|
129
|
+
* Indicates the language of the component
|
|
130
|
+
* Supported options: en, es, en_US, en-US, es_ES, es-ES, es_MX, es-MX
|
|
131
|
+
*/
|
|
132
|
+
language?: string;
|
|
133
|
+
/** Indicates if the selection button and choice prefix should be positioned below the corresponding answer choice */
|
|
134
|
+
isSelectionButtonBelow?: boolean;
|
|
135
|
+
/** Indicates font size adjustment factor */
|
|
136
|
+
fontSizeFactor?: number;
|
|
137
|
+
/** Indicates if the audio for the prompt should autoplay */
|
|
138
|
+
autoplayAudioEnabled?: boolean;
|
|
139
|
+
/** Indicates if the audio should reach the end before the item can be marked as 'complete' */
|
|
140
|
+
completeAudioEnabled?: boolean;
|
|
141
|
+
/** Indicates if the audio should be replaced with a custom audio button */
|
|
142
|
+
customAudioButton?: CustomAudioButton;
|
|
143
|
+
/** Lets learners select a choice in gather mode by pressing its number or letter key */
|
|
144
|
+
keyboardEventsEnabled?: boolean;
|
|
145
|
+
/** Host-supplied CSS scoped to the element */
|
|
146
|
+
extraCSSRules?: ExtraCSSRules;
|
|
147
|
+
/** @deprecated Use `choicesLayout`; `false` reads as `horizontal`. */
|
|
148
|
+
verticalMode?: boolean;
|
|
149
|
+
/** @deprecated Caps the author at 9 choices; use the configuration's `maxAnswerChoices`. */
|
|
150
|
+
limitChoicesNumber?: boolean;
|
|
151
|
+
}
|
|
152
|
+
export interface MaxImageDimensions extends ConfigureMaxImageDimensionsProp {
|
|
153
|
+
/** Indicates the max dimension for images in choices */
|
|
154
|
+
choices?: number;
|
|
155
|
+
}
|
|
156
|
+
/** Config Object for `@pie-element/multiple-choice` */
|
|
157
|
+
export interface MultipleChoiceConfiguration {
|
|
158
|
+
/**
|
|
159
|
+
* The number of empty choices to show in config view if no choice model is provided
|
|
160
|
+
* @minimum 0
|
|
161
|
+
* @default 0
|
|
162
|
+
*/
|
|
163
|
+
answerChoiceCount?: number;
|
|
164
|
+
/** Configuration for the button that adds a choice */
|
|
165
|
+
addChoiceButton?: ConfigureProp;
|
|
166
|
+
/** Toolbar plugins every editable field starts from; a field's own `inputConfiguration` overrides it */
|
|
167
|
+
baseInputConfiguration?: EditableHtmlConfigureProp;
|
|
168
|
+
/** Configuration for the choice editors */
|
|
169
|
+
choices?: EditableHtmlPluginConfigure;
|
|
170
|
+
/** Settings Panel control for the choice mode (radio / checkboxes) */
|
|
171
|
+
choiceMode?: ConfigureProp;
|
|
172
|
+
/** Settings Panel control for the choice prefix */
|
|
173
|
+
choicePrefix?: ConfigureProp;
|
|
174
|
+
/** Whether the author can delete choices */
|
|
175
|
+
deleteChoice?: ConfigureProp;
|
|
176
|
+
/** Settings Panel control for feedback */
|
|
177
|
+
feedback?: ConfigureProp;
|
|
178
|
+
/** Configuration for the prompt */
|
|
179
|
+
prompt?: EditableHtmlPluginConfigureRequired;
|
|
180
|
+
/** Settings Panel control for spellcheck; `enabled` is the default for new items */
|
|
181
|
+
spellCheck?: ConfigurePropWithEnabled;
|
|
182
|
+
/** Settings Panel control for the choices layout */
|
|
183
|
+
choicesLayout?: ConfigureProp;
|
|
184
|
+
/** Settings Panel control for the number of grid columns */
|
|
185
|
+
gridColumns?: ConfigureProp;
|
|
186
|
+
/** Settings Panel control for locking the choice order */
|
|
187
|
+
lockChoiceOrder?: ConfigureProp;
|
|
188
|
+
/** Settings Panel control for partial scoring */
|
|
189
|
+
partialScoring?: ConfigureProp;
|
|
190
|
+
/** Configuration for the choice rationales */
|
|
191
|
+
rationale?: EditableHtmlPluginConfigureRequired;
|
|
192
|
+
/** Settings Panel control for the scoring type */
|
|
193
|
+
scoringType?: ConfigureProp;
|
|
194
|
+
/** Indicates if the settings panel is not available */
|
|
195
|
+
settingsPanelDisabled?: boolean;
|
|
196
|
+
/** Settings Panel control for student instructions */
|
|
197
|
+
studentInstructions?: ConfigureProp;
|
|
198
|
+
/** Configuration for the teacher instructions */
|
|
199
|
+
teacherInstructions?: EditableHtmlPluginConfigureRequired;
|
|
200
|
+
/** Not read by the authoring surface; the model's `toolbarEditorPosition` sets the position */
|
|
201
|
+
toolbarEditorPosition?: ConfigureProp;
|
|
202
|
+
/** Settings Panel control that toggles sequential choice labels */
|
|
203
|
+
sequentialChoiceLabels?: ConfigurePropWithEnabled;
|
|
204
|
+
/** Not read by this element */
|
|
205
|
+
accessibility?: EditableHtmlPluginConfigure;
|
|
206
|
+
/** Minimum number of answer choices */
|
|
207
|
+
minAnswerChoices?: number;
|
|
208
|
+
/** Maximum number of answer choices */
|
|
209
|
+
maxAnswerChoices?: number;
|
|
210
|
+
/** Maximum image width per field */
|
|
211
|
+
maxImageWidth?: MaxImageDimensions;
|
|
212
|
+
/** Maximum image height per field */
|
|
213
|
+
maxImageHeight?: MaxImageDimensions;
|
|
214
|
+
/** Settings Panel control for the rubric */
|
|
215
|
+
withRubric?: ConfigureProp;
|
|
216
|
+
/** MathML output and editing */
|
|
217
|
+
mathMlOptions?: ConfigureMathMLProp;
|
|
218
|
+
/** Settings Panel control for the language; `enabled` shows the language choices */
|
|
219
|
+
language?: ConfigurePropWithEnabled;
|
|
220
|
+
/**
|
|
221
|
+
* Language choices configuration
|
|
222
|
+
* Only available if language is enabled
|
|
223
|
+
*/
|
|
224
|
+
languageChoices?: ConfigureLanguageOptions;
|
|
225
|
+
/** Not read by this element: the model's `promptEnabled` shows the prompt */
|
|
226
|
+
showPrompt?: boolean;
|
|
227
|
+
/** Not read by this element: `prompt.label` labels the prompt */
|
|
228
|
+
promptLabel?: string;
|
|
229
|
+
/** Dimensions of the authoring container */
|
|
230
|
+
contentDimensions?: ContentDimensions;
|
|
231
|
+
/** Not read by this element: `partialScoring.settings` shows the partial scoring control */
|
|
232
|
+
settingsPartialScoring?: boolean;
|
|
233
|
+
}
|
|
234
|
+
export interface MultipleChoiceSession {
|
|
235
|
+
/** Identifier of the session */
|
|
236
|
+
id?: string;
|
|
237
|
+
/** The element the session belongs to */
|
|
238
|
+
element?: string;
|
|
239
|
+
/** Values of the selected choices */
|
|
240
|
+
value?: string[];
|
|
241
|
+
/** Choice values in the order they were shuffled for this learner, when choice order is not locked */
|
|
242
|
+
shuffledValues?: string[];
|
|
243
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/multiple-choice",
|
|
3
|
-
"version": "14.0.4
|
|
3
|
+
"version": "14.0.4",
|
|
4
4
|
"description": "React implementation of multiple-choice element",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -11,22 +11,23 @@
|
|
|
11
11
|
"@emotion/react": "^11.14.0",
|
|
12
12
|
"@mui/icons-material": "^7.3.4",
|
|
13
13
|
"@mui/material": "^7.3.4",
|
|
14
|
-
"@pie-lib/correct-answer-toggle": "5.0.4
|
|
15
|
-
"@pie-lib/render-ui": "8.0.4
|
|
16
|
-
"@pie-lib/translator": "5.0.
|
|
14
|
+
"@pie-lib/correct-answer-toggle": "5.0.4",
|
|
15
|
+
"@pie-lib/render-ui": "8.0.4",
|
|
16
|
+
"@pie-lib/translator": "5.0.1",
|
|
17
17
|
"debug": "^4.1.1",
|
|
18
18
|
"prop-types": "^15.8.1",
|
|
19
19
|
"react-transition-group": "^4.4.5",
|
|
20
|
-
"@pie-element/shared-configure-events": "0.1.
|
|
21
|
-
"@pie-lib/config-ui": "14.0.4
|
|
22
|
-
"@pie-element/shared-lodash": "0.1.
|
|
23
|
-
"@pie-lib/editable-html-tip-tap": "3.0.4
|
|
24
|
-
"@pie-element/shared-controller-utils": "0.1.2
|
|
20
|
+
"@pie-element/shared-configure-events": "0.1.1",
|
|
21
|
+
"@pie-lib/config-ui": "14.0.4",
|
|
22
|
+
"@pie-element/shared-lodash": "0.1.2",
|
|
23
|
+
"@pie-lib/editable-html-tip-tap": "3.0.4",
|
|
24
|
+
"@pie-element/shared-controller-utils": "0.1.2",
|
|
25
25
|
"clsx": "^2.1.1",
|
|
26
|
-
"@pie-element/shared-player-events": "0.1.
|
|
27
|
-
"@pie-element/shared-math-rendering-mathjax": "0.1.5
|
|
26
|
+
"@pie-element/shared-player-events": "0.1.1",
|
|
27
|
+
"@pie-element/shared-math-rendering-mathjax": "0.1.5",
|
|
28
28
|
"react": "^18.2.0",
|
|
29
|
-
"react-dom": "^18.2.0"
|
|
29
|
+
"react-dom": "^18.2.0",
|
|
30
|
+
"@pie-element/shared-types": "0.2.1"
|
|
30
31
|
},
|
|
31
32
|
"exports": {
|
|
32
33
|
".": {
|
|
@@ -81,6 +82,9 @@
|
|
|
81
82
|
"types": "./dist/runtime-support.d.ts",
|
|
82
83
|
"default": "./dist/runtime-support.js"
|
|
83
84
|
},
|
|
85
|
+
"./schemas/model.schema.json": "./dist/schemas/model.schema.json",
|
|
86
|
+
"./schemas/configuration.schema.json": "./dist/schemas/configuration.schema.json",
|
|
87
|
+
"./schemas/session.schema.json": "./dist/schemas/session.schema.json",
|
|
84
88
|
"./package.json": "./package.json"
|
|
85
89
|
},
|
|
86
90
|
"type": "module",
|
|
@@ -96,7 +100,7 @@
|
|
|
96
100
|
],
|
|
97
101
|
"sideEffects": false,
|
|
98
102
|
"scripts": {
|
|
99
|
-
"build": "bun x vite build && bun x vite build --config ../../../tools/vite/element-browser.config.ts && bun x vite build --config ../../../tools/vite/element-browser-editor-runtime.config.ts && bun x vite build --config ../../../tools/vite/element-legacy-print.config.ts && bun x vite build --config vite.config.iife.ts && bun x tsc --emitDeclarationOnly",
|
|
103
|
+
"build": "bun x vite build && bun x vite build --config ../../../tools/vite/element-browser.config.ts && bun x vite build --config ../../../tools/vite/element-browser-editor-runtime.config.ts && bun x vite build --config ../../../tools/vite/element-legacy-print.config.ts && bun x vite build --config vite.config.iife.ts && bun x tsc --emitDeclarationOnly && bun ../../../tools/schemas/build.ts",
|
|
100
104
|
"dev": "bun x vite",
|
|
101
105
|
"demo": "bun x vite --mode demo",
|
|
102
106
|
"test": "bun x vitest run"
|
|
@@ -110,7 +114,7 @@
|
|
|
110
114
|
},
|
|
111
115
|
"browserEditorRuntime": {
|
|
112
116
|
"name": "@pie-element/shared-editor-runtime",
|
|
113
|
-
"version": "0.1.
|
|
117
|
+
"version": "0.1.2",
|
|
114
118
|
"views": {
|
|
115
119
|
"delivery": "editor-runtime/delivery",
|
|
116
120
|
"author": "editor-runtime/author",
|