@pie-element/explicit-constructed-response 12.0.4-next.20261011174919 → 12.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 +56 -54
- package/dist/author/index.d.ts +18 -28
- package/dist/author/index.js +6 -1
- package/dist/author/main.d.ts +43 -25
- package/dist/author/main.js +98 -111
- package/dist/browser/author/index.js +19 -29
- package/dist/browser/author/index.js.map +1 -1
- package/dist/browser/controller/index.js +4 -4
- package/dist/browser/controller/index.js.map +1 -1
- package/dist/browser/editor-runtime/author/index.js +19 -29
- package/dist/browser/editor-runtime/author/index.js.map +1 -1
- package/dist/browser/editor-runtime/controller/index.js +4 -4
- package/dist/browser/editor-runtime/controller/index.js.map +1 -1
- package/dist/controller/defaults.d.ts +10 -9
- package/dist/controller/index.d.ts +83 -24
- package/dist/controller/index.js +4 -4
- package/dist/index.d.ts +1 -0
- package/dist/schemas/configuration.schema.json +426 -0
- package/dist/schemas/model.schema.json +605 -0
- package/dist/schemas/session.schema.json +23 -0
- package/dist/types.d.ts +186 -0
- package/package.json +20 -16
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import type { ConfigureLanguageOptions, ConfigureMathMLProp, ConfigureMaxImageDimensionsProp, ConfigureProp, ConfigurePropWithEnabled, ContentDimensions, EditableHtmlConfigureProp, EditableHtmlPluginConfigure, EditableHtmlPluginConfigureRequired, ExtraCSSRules, PieModel } from '@pie-element/shared-types';
|
|
2
|
+
/** Feedback for a choice, shown when the response is evaluated */
|
|
3
|
+
export interface ChoiceFeedback {
|
|
4
|
+
/** `default` shows the model's `defaultFeedback.correct`, `custom` shows `value`; absent means `none` */
|
|
5
|
+
type?: 'none' | 'default' | 'custom';
|
|
6
|
+
/** The custom feedback */
|
|
7
|
+
value?: string;
|
|
8
|
+
}
|
|
9
|
+
/** An accepted answer for a response area */
|
|
10
|
+
export interface Choice {
|
|
11
|
+
/** The value for the choice */
|
|
12
|
+
value: string;
|
|
13
|
+
/** The label of the choice: the answer the learner types */
|
|
14
|
+
label: string;
|
|
15
|
+
/** Feedback for the choice when the response is evaluated */
|
|
16
|
+
feedback?: ChoiceFeedback;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Object with all the available choices for each response area, keyed by the area's index in `markup`
|
|
20
|
+
* (0 to n - 1). The first choice is the correct answer; the others are its alternates.
|
|
21
|
+
*/
|
|
22
|
+
export type Choices = Record<string, Choice[]>;
|
|
23
|
+
/**
|
|
24
|
+
* Model for the `@pie-element/explicit-constructed-response`
|
|
25
|
+
*/
|
|
26
|
+
export interface ExplicitConstructedResponseModel extends PieModel {
|
|
27
|
+
/** Object with all the available choices for each response area */
|
|
28
|
+
choices: Choices;
|
|
29
|
+
/**
|
|
30
|
+
* The type of display the container of the pie-ui element will be used
|
|
31
|
+
* @default "block"
|
|
32
|
+
*/
|
|
33
|
+
displayType?: string;
|
|
34
|
+
/** The markup for the pie-ui element: response areas are `{{index}}` placeholders */
|
|
35
|
+
markup: string;
|
|
36
|
+
/** The authoring editor's markup, with response areas as elements; the author derives `markup` from it */
|
|
37
|
+
slateMarkup?: string;
|
|
38
|
+
/** The item stem for the question */
|
|
39
|
+
prompt?: string;
|
|
40
|
+
/** Indicates if the prompt is enabled */
|
|
41
|
+
promptEnabled?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Indicates if spellcheck is enabled for the author
|
|
44
|
+
* @default true
|
|
45
|
+
*/
|
|
46
|
+
spellCheckEnabled?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Indicates if spellcheck is enabled for the player
|
|
49
|
+
* @default false
|
|
50
|
+
*/
|
|
51
|
+
playerSpellCheckEnabled?: boolean;
|
|
52
|
+
/** Indicates correct answer rationale */
|
|
53
|
+
rationale?: string;
|
|
54
|
+
/** Not read by this element: `partialScoring` selects the scoring */
|
|
55
|
+
autoScoring?: 'allOrNothing' | 'partial';
|
|
56
|
+
/** Indicates that the item should use partial scoring */
|
|
57
|
+
partialScoring?: boolean;
|
|
58
|
+
/** Not read by this element */
|
|
59
|
+
studentInstructions?: string;
|
|
60
|
+
/** Indicates teacher instructions */
|
|
61
|
+
teacherInstructions?: string;
|
|
62
|
+
/** Not read by this element */
|
|
63
|
+
rubric?: string;
|
|
64
|
+
/** Indicates if Rationale are enabled */
|
|
65
|
+
rationaleEnabled?: boolean;
|
|
66
|
+
/** Not read by this element; default models include it */
|
|
67
|
+
studentInstructionsEnabled?: boolean;
|
|
68
|
+
/** Indicates if Teacher Instructions are enabled */
|
|
69
|
+
teacherInstructionsEnabled?: boolean;
|
|
70
|
+
/** Indicates the note for the answer; the element shows a translated default when it is absent */
|
|
71
|
+
note?: string;
|
|
72
|
+
/**
|
|
73
|
+
* Indicates the editor's toolbar position which can be 'bottom' or 'top'
|
|
74
|
+
* @default "bottom"
|
|
75
|
+
*/
|
|
76
|
+
toolbarEditorPosition?: 'bottom' | 'top';
|
|
77
|
+
/** Indicates the maximum length for each response area */
|
|
78
|
+
maxLengthPerChoice?: number[];
|
|
79
|
+
/**
|
|
80
|
+
* Indicates if each response area's input is limited to its `maxLengthPerChoice`
|
|
81
|
+
* @default true
|
|
82
|
+
*/
|
|
83
|
+
maxLengthPerChoiceEnabled?: boolean;
|
|
84
|
+
/** Indicates if Rubric is enabled */
|
|
85
|
+
rubricEnabled?: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Indicates the language of the component
|
|
88
|
+
* Supported options: en, es, en_US, en-US, es_ES, es-ES, es_MX, es-MX
|
|
89
|
+
*/
|
|
90
|
+
language?: string;
|
|
91
|
+
/** Not read by this element: `responseAreaInputConfiguration.characters` controls the Spanish characters */
|
|
92
|
+
spanishInputEnabled?: boolean;
|
|
93
|
+
/**
|
|
94
|
+
* Toolbar plugins of the response areas' inputs; the author copies them from the configuration's
|
|
95
|
+
* `responseAreaInputConfiguration.inputConfiguration`
|
|
96
|
+
*/
|
|
97
|
+
responseAreaInputConfiguration?: EditableHtmlConfigureProp;
|
|
98
|
+
/** Feedback texts that choices with `default` feedback show */
|
|
99
|
+
defaultFeedback?: {
|
|
100
|
+
correct?: string;
|
|
101
|
+
incorrect?: string;
|
|
102
|
+
};
|
|
103
|
+
/** Host-supplied CSS scoped to the element */
|
|
104
|
+
extraCSSRules?: ExtraCSSRules;
|
|
105
|
+
/** Not read: the controller sets `disabled` from the environment. Demo models include it. */
|
|
106
|
+
disabled?: boolean;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Config Object for `@pie-element/explicit-constructed-response`
|
|
110
|
+
*/
|
|
111
|
+
export interface ExplicitConstructedResponseConfiguration {
|
|
112
|
+
/**
|
|
113
|
+
* Base editable html input configuration regarding plugins that are enabled/disabled
|
|
114
|
+
* E.g. audio, video, image
|
|
115
|
+
*/
|
|
116
|
+
baseInputConfiguration?: EditableHtmlConfigureProp;
|
|
117
|
+
/** Not read by this element */
|
|
118
|
+
choices?: ConfigureProp;
|
|
119
|
+
/** Item Stem configuration */
|
|
120
|
+
prompt?: EditableHtmlPluginConfigureRequired;
|
|
121
|
+
/** Rationale configuration */
|
|
122
|
+
rationale?: EditableHtmlPluginConfigureRequired;
|
|
123
|
+
/** Indicates if the settings panel is not available */
|
|
124
|
+
settingsPanelDisabled?: boolean;
|
|
125
|
+
/** Configuration for the author's spellcheck; `enabled` is not read */
|
|
126
|
+
spellCheck?: ConfigurePropWithEnabled;
|
|
127
|
+
/** Configuration for the player's spellcheck; `enabled` is not read */
|
|
128
|
+
playerSpellCheck?: ConfigurePropWithEnabled;
|
|
129
|
+
/** Settings Panel control for editing the source; the control writes `enabled`, which is not read */
|
|
130
|
+
editSource?: ConfigurePropWithEnabled;
|
|
131
|
+
/** Settings Panel control for partial scoring */
|
|
132
|
+
partialScoring?: ConfigureProp;
|
|
133
|
+
/** Not read by this element: `partialScoring` shows the scoring control */
|
|
134
|
+
autoScoring?: ConfigureProp;
|
|
135
|
+
/** Not read by this element */
|
|
136
|
+
studentInstructions?: ConfigureProp;
|
|
137
|
+
/** Teacher Instructions configuration */
|
|
138
|
+
teacherInstructions?: EditableHtmlPluginConfigureRequired;
|
|
139
|
+
/** Template configuration */
|
|
140
|
+
template?: EditableHtmlPluginConfigure;
|
|
141
|
+
/** Not read by this element: `withRubric` shows the rubric control */
|
|
142
|
+
rubric?: ConfigureProp;
|
|
143
|
+
/** Not read by this element */
|
|
144
|
+
alternates?: ConfigureProp;
|
|
145
|
+
/** Maximum Length Per Choice Configuration: the settings panel control for `maxLengthPerChoiceEnabled` */
|
|
146
|
+
maxLengthPerChoice?: ConfigureProp;
|
|
147
|
+
/** Maximum number of response areas */
|
|
148
|
+
maxResponseAreas?: number;
|
|
149
|
+
/** Maximum image width for input fields */
|
|
150
|
+
maxImageWidth?: ConfigureMaxImageDimensionsProp;
|
|
151
|
+
/** Maximum image height for input fields */
|
|
152
|
+
maxImageHeight?: ConfigureMaxImageDimensionsProp;
|
|
153
|
+
/** Rubric configuration - only relevant in environments that use pie-player-components */
|
|
154
|
+
withRubric?: ConfigureProp;
|
|
155
|
+
/** Configuration for editable-html */
|
|
156
|
+
mathMlOptions?: ConfigureMathMLProp;
|
|
157
|
+
/** Language configuration */
|
|
158
|
+
language?: ConfigurePropWithEnabled;
|
|
159
|
+
/**
|
|
160
|
+
* Language choices configuration
|
|
161
|
+
* Only available if language is enabled
|
|
162
|
+
*/
|
|
163
|
+
languageChoices?: ConfigureLanguageOptions;
|
|
164
|
+
/** Not read by this element: `spanishButton` shows the Spanish characters control */
|
|
165
|
+
spanishInput?: ConfigureProp;
|
|
166
|
+
/** Settings Panel control that disables the Spanish characters in the response areas' inputs */
|
|
167
|
+
spanishButton?: ConfigureProp;
|
|
168
|
+
/** Toolbar plugins of the response areas' inputs, under `inputConfiguration` */
|
|
169
|
+
responseAreaInputConfiguration?: EditableHtmlPluginConfigure;
|
|
170
|
+
/** Dimensions of the authoring container */
|
|
171
|
+
contentDimensions?: ContentDimensions;
|
|
172
|
+
/** Not read by this element: the model's `promptEnabled` shows the prompt */
|
|
173
|
+
showPrompt?: boolean;
|
|
174
|
+
/** Not read by this element: `prompt.label` labels the prompt */
|
|
175
|
+
promptLabel?: string;
|
|
176
|
+
/** Not read by this element: `partialScoring.settings` shows the partial scoring control */
|
|
177
|
+
settingsPartialScoring?: boolean;
|
|
178
|
+
}
|
|
179
|
+
export interface ExplicitConstructedResponseSession {
|
|
180
|
+
/** Identifier of the session */
|
|
181
|
+
id?: string;
|
|
182
|
+
/** The element the session belongs to */
|
|
183
|
+
element?: string;
|
|
184
|
+
/** The learner's answer in each response area, keyed by the area's index */
|
|
185
|
+
value?: Record<string, string>;
|
|
186
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/explicit-constructed-response",
|
|
3
|
-
"version": "12.0.4
|
|
3
|
+
"version": "12.0.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -11,24 +11,25 @@
|
|
|
11
11
|
"@emotion/react": "^11.14.0",
|
|
12
12
|
"@mui/icons-material": "^7.3.4",
|
|
13
13
|
"@mui/material": "^7.3.4",
|
|
14
|
-
"@pie-element/shared-utils": "0.1.4
|
|
15
|
-
"@pie-lib/correct-answer-toggle": "5.0.4
|
|
16
|
-
"@pie-lib/mask-markup": "4.0.4
|
|
17
|
-
"@pie-lib/render-ui": "8.0.4
|
|
18
|
-
"@pie-lib/translator": "5.0.
|
|
14
|
+
"@pie-element/shared-utils": "0.1.4",
|
|
15
|
+
"@pie-lib/correct-answer-toggle": "5.0.4",
|
|
16
|
+
"@pie-lib/mask-markup": "4.0.4",
|
|
17
|
+
"@pie-lib/render-ui": "8.0.4",
|
|
18
|
+
"@pie-lib/translator": "5.0.1",
|
|
19
19
|
"he": "^1.2.0",
|
|
20
20
|
"prop-types": "^15.8.1",
|
|
21
|
-
"@pie-element/shared-lodash": "0.1.
|
|
22
|
-
"@pie-lib/editable-html-tip-tap": "3.0.4
|
|
21
|
+
"@pie-element/shared-lodash": "0.1.2",
|
|
22
|
+
"@pie-lib/editable-html-tip-tap": "3.0.4",
|
|
23
23
|
"debug": "^4.4.3",
|
|
24
|
-
"@pie-element/shared-configure-events": "0.1.
|
|
25
|
-
"@pie-lib/config-ui": "14.0.4
|
|
26
|
-
"@pie-element/shared-controller-utils": "0.1.2
|
|
27
|
-
"@pie-element/shared-player-events": "0.1.
|
|
28
|
-
"@pie-element/shared-math-rendering-mathjax": "0.1.5
|
|
24
|
+
"@pie-element/shared-configure-events": "0.1.1",
|
|
25
|
+
"@pie-lib/config-ui": "14.0.4",
|
|
26
|
+
"@pie-element/shared-controller-utils": "0.1.2",
|
|
27
|
+
"@pie-element/shared-player-events": "0.1.1",
|
|
28
|
+
"@pie-element/shared-math-rendering-mathjax": "0.1.5",
|
|
29
29
|
"clsx": "^2.1.1",
|
|
30
30
|
"react": "^18.2.0",
|
|
31
|
-
"react-dom": "^18.2.0"
|
|
31
|
+
"react-dom": "^18.2.0",
|
|
32
|
+
"@pie-element/shared-types": "0.2.1"
|
|
32
33
|
},
|
|
33
34
|
"exports": {
|
|
34
35
|
".": {
|
|
@@ -83,6 +84,9 @@
|
|
|
83
84
|
"types": "./dist/runtime-support.d.ts",
|
|
84
85
|
"default": "./dist/runtime-support.js"
|
|
85
86
|
},
|
|
87
|
+
"./schemas/model.schema.json": "./dist/schemas/model.schema.json",
|
|
88
|
+
"./schemas/configuration.schema.json": "./dist/schemas/configuration.schema.json",
|
|
89
|
+
"./schemas/session.schema.json": "./dist/schemas/session.schema.json",
|
|
86
90
|
"./package.json": "./package.json"
|
|
87
91
|
},
|
|
88
92
|
"type": "module",
|
|
@@ -98,7 +102,7 @@
|
|
|
98
102
|
],
|
|
99
103
|
"sideEffects": false,
|
|
100
104
|
"scripts": {
|
|
101
|
-
"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",
|
|
105
|
+
"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",
|
|
102
106
|
"dev": "bun x vite",
|
|
103
107
|
"demo": "bun x vite --mode demo",
|
|
104
108
|
"test": "bun x vitest run"
|
|
@@ -112,7 +116,7 @@
|
|
|
112
116
|
},
|
|
113
117
|
"browserEditorRuntime": {
|
|
114
118
|
"name": "@pie-element/shared-editor-runtime",
|
|
115
|
-
"version": "0.1.
|
|
119
|
+
"version": "0.1.2",
|
|
116
120
|
"views": {
|
|
117
121
|
"delivery": "editor-runtime/delivery",
|
|
118
122
|
"author": "editor-runtime/author",
|