@pie-element/categorize 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 +67 -65
- package/dist/author/index.d.ts +57 -30
- package/dist/author/index.js +14 -5
- package/dist/author/main.d.ts +20 -11
- package/dist/author/main.js +6 -16
- package/dist/author/utils.d.ts +7 -6
- package/dist/browser/author/index.js +20 -23
- package/dist/browser/author/index.js.map +1 -1
- package/dist/browser/controller/index.js +14 -14
- package/dist/browser/controller/index.js.map +1 -1
- package/dist/browser/editor-runtime/author/index.js +20 -23
- package/dist/browser/editor-runtime/author/index.js.map +1 -1
- package/dist/browser/editor-runtime/controller/index.js +14 -14
- package/dist/browser/editor-runtime/controller/index.js.map +1 -1
- package/dist/controller/defaults.d.ts +14 -13
- package/dist/controller/index.d.ts +109 -33
- package/dist/controller/index.js +14 -14
- package/dist/controller/utils.d.ts +9 -8
- package/dist/index.d.ts +1 -0
- package/dist/schemas/configuration.schema.json +463 -0
- package/dist/schemas/model.schema.json +610 -0
- package/dist/schemas/session.schema.json +71 -0
- package/dist/types.d.ts +266 -0
- package/package.json +22 -18
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
import type { ConfigureLanguageOptions, ConfigureMathMLProp, ConfigureMaxImageDimensionsProp, ConfigureProp, ConfigurePropWithEnabled, ContentDimensions, CustomAudioButton, EditableHtmlConfigureProp, EditableHtmlPluginConfigure, EditableHtmlPluginConfigureRequired, ExtraCSSRules, PieModel } from '@pie-element/shared-types';
|
|
2
|
+
export interface CategoryChoice {
|
|
3
|
+
/** Identifier for the choice */
|
|
4
|
+
id: string;
|
|
5
|
+
/** The xhtml content for the choice */
|
|
6
|
+
content: string;
|
|
7
|
+
/**
|
|
8
|
+
* How many categories the choice may be placed in: 0 places it in any number of categories, 1 in one.
|
|
9
|
+
* Read when `allowMultiplePlacementsEnabled` is `Set Per Choice`; otherwise the element derives it from that key.
|
|
10
|
+
*/
|
|
11
|
+
categoryCount?: number;
|
|
12
|
+
/** How often the choice appears in the correct response; the authoring view recomputes it on every render, so a stored value is not read */
|
|
13
|
+
correctResponseCount?: number;
|
|
14
|
+
}
|
|
15
|
+
export interface Category {
|
|
16
|
+
/** Identifier for the category */
|
|
17
|
+
id: string;
|
|
18
|
+
/** The label to display with the category. */
|
|
19
|
+
label: string;
|
|
20
|
+
/** Not read by the element: the choices placed in a category come from the session's `answers` */
|
|
21
|
+
choices?: CategoryChoice[];
|
|
22
|
+
}
|
|
23
|
+
export interface CategoryCorrectResponse {
|
|
24
|
+
/** The identifier for the category */
|
|
25
|
+
category: string;
|
|
26
|
+
/** Array of identifiers for the choices that belong in this category */
|
|
27
|
+
choices: string[];
|
|
28
|
+
/** Array of alternatives correct choices */
|
|
29
|
+
alternateResponses?: string[][];
|
|
30
|
+
}
|
|
31
|
+
/** Feedback configuration for one correctness level */
|
|
32
|
+
export interface FeedbackLevel {
|
|
33
|
+
/** Indicates the feedback type */
|
|
34
|
+
type: 'default' | 'custom' | 'none';
|
|
35
|
+
/** Indicates the feedback value */
|
|
36
|
+
default?: string;
|
|
37
|
+
/** Indicates the feedback custom value */
|
|
38
|
+
custom?: string;
|
|
39
|
+
}
|
|
40
|
+
export interface CategorizeFeedback {
|
|
41
|
+
/** Indicates the configuration for feedback when answer is correct */
|
|
42
|
+
correct?: FeedbackLevel;
|
|
43
|
+
/** Indicates the configuration for feedback when answer is incorrect */
|
|
44
|
+
incorrect?: FeedbackLevel;
|
|
45
|
+
/** Indicates the configuration for feedback when answer is partially correct */
|
|
46
|
+
partial?: FeedbackLevel;
|
|
47
|
+
}
|
|
48
|
+
/** Whether a choice may be placed in more than one category: for every choice, for none, or per choice */
|
|
49
|
+
export type MultiplePlacements = 'Yes' | 'No' | 'Set Per Choice';
|
|
50
|
+
/** Pie Model Object for `@pie-element/categorize` */
|
|
51
|
+
export interface CategorizeModel extends PieModel {
|
|
52
|
+
/** Indicates if alternate correct answers are allowed */
|
|
53
|
+
allowAlternateEnabled?: boolean;
|
|
54
|
+
/** Indicates if author has the possibility to set maxChoicesPerCategory */
|
|
55
|
+
allowMaxChoicesPerCategory?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Whether choices may be placed in more than one category; `Set Per Choice` reads each choice's `categoryCount`.
|
|
58
|
+
* When unset, the element allows it exactly when a choice appears in more than one category of the correct response.
|
|
59
|
+
*/
|
|
60
|
+
allowMultiplePlacementsEnabled?: MultiplePlacements;
|
|
61
|
+
/** Not read by the element: alternate responses live in `correctResponse[].alternateResponses`. Default models include it. */
|
|
62
|
+
alternates?: unknown[];
|
|
63
|
+
/** The available choices */
|
|
64
|
+
choices: CategoryChoice[];
|
|
65
|
+
/**
|
|
66
|
+
* The number of columns in which to present the categories
|
|
67
|
+
* @default 2
|
|
68
|
+
*/
|
|
69
|
+
categoriesPerRow?: number;
|
|
70
|
+
/** Indicates where the choices should be presented in relation to the categories. */
|
|
71
|
+
choicesPosition?: 'above' | 'below' | 'left' | 'right';
|
|
72
|
+
/** Label to be displayed for the choices */
|
|
73
|
+
choicesLabel?: string;
|
|
74
|
+
/** Should the choices be shuffled or not */
|
|
75
|
+
lockChoiceOrder?: boolean;
|
|
76
|
+
/** The question prompt or item stem */
|
|
77
|
+
prompt?: string;
|
|
78
|
+
/** Indicates if the prompt is enabled */
|
|
79
|
+
promptEnabled?: boolean;
|
|
80
|
+
/** The categories in which choices may be placed */
|
|
81
|
+
categories: Category[];
|
|
82
|
+
/** The defintion of the correct response to the question */
|
|
83
|
+
correctResponse?: CategoryCorrectResponse[];
|
|
84
|
+
/** Feedback configuration */
|
|
85
|
+
feedback?: CategorizeFeedback;
|
|
86
|
+
/** Indicates the maximum number of choices from a category */
|
|
87
|
+
maxChoicesPerCategory?: number;
|
|
88
|
+
/** Indicates the value for rationale */
|
|
89
|
+
rationale?: string;
|
|
90
|
+
/** Indicates if partial scoring is enabled */
|
|
91
|
+
partialScoring?: boolean;
|
|
92
|
+
/** Indicates if Feedback is enabled */
|
|
93
|
+
feedbackEnabled?: boolean;
|
|
94
|
+
/** Indicates if Rationale are enabled */
|
|
95
|
+
rationaleEnabled?: boolean;
|
|
96
|
+
/** Indicates if spellcheck is enabled for the author. Default value is true */
|
|
97
|
+
spellCheckEnabled?: boolean;
|
|
98
|
+
/** Indicates if Student Instructions are enabled */
|
|
99
|
+
studentInstructionsEnabled?: boolean;
|
|
100
|
+
/** Indicates teacher instructions */
|
|
101
|
+
teacherInstructions?: string;
|
|
102
|
+
/** Indicates if Teacher Instructions are enabled */
|
|
103
|
+
teacherInstructionsEnabled?: boolean;
|
|
104
|
+
/** Indicates the note for the answer */
|
|
105
|
+
note?: string;
|
|
106
|
+
/**
|
|
107
|
+
* Indicates the editor's toolbar position which can be 'bottom' or 'top'
|
|
108
|
+
* @default "bottom"
|
|
109
|
+
*/
|
|
110
|
+
toolbarEditorPosition?: 'bottom' | 'top';
|
|
111
|
+
/** Indicates if Rubric is enabled */
|
|
112
|
+
rubricEnabled?: boolean;
|
|
113
|
+
/** Indicates scoring type */
|
|
114
|
+
scoringType?: 'auto' | 'rubric';
|
|
115
|
+
/**
|
|
116
|
+
* Indicates the language of the component
|
|
117
|
+
* Supported options: en, es, en_US, en-US, es_ES, es-ES, es_MX, es-MX
|
|
118
|
+
*/
|
|
119
|
+
language?: string;
|
|
120
|
+
/** Maximum number of choices */
|
|
121
|
+
maxAnswerChoices?: number;
|
|
122
|
+
/** Labels shown beside each row of categories, one per row */
|
|
123
|
+
rowLabels?: string[];
|
|
124
|
+
/** Minimum height of a category row, as a CSS length */
|
|
125
|
+
minRowHeight?: string;
|
|
126
|
+
/** Indicates font size adjustment factor */
|
|
127
|
+
fontSizeFactor?: number;
|
|
128
|
+
/** Indicates if the audio for the prompt should autoplay */
|
|
129
|
+
autoplayAudioEnabled?: boolean;
|
|
130
|
+
/** Indicates if the audio should reach the end before the item can be marked as 'complete' */
|
|
131
|
+
completeAudioEnabled?: boolean;
|
|
132
|
+
/** Indicates if the audio should be replaced with a custom audio button */
|
|
133
|
+
customAudioButton?: CustomAudioButton;
|
|
134
|
+
/** Host-supplied CSS scoped to the element */
|
|
135
|
+
extraCSSRules?: ExtraCSSRules;
|
|
136
|
+
}
|
|
137
|
+
export interface MaxImageDimensions extends ConfigureMaxImageDimensionsProp {
|
|
138
|
+
/** Indicates the max dimension for images in choices */
|
|
139
|
+
choices?: number;
|
|
140
|
+
/** Indicates the max dimension for images in row labels */
|
|
141
|
+
rowLabel?: number;
|
|
142
|
+
/** Indicates the max dimension for images in category labels */
|
|
143
|
+
categoryLabel?: number;
|
|
144
|
+
}
|
|
145
|
+
/** Config Object for `@pie-element/categorize` */
|
|
146
|
+
export interface CategorizeConfiguration {
|
|
147
|
+
/**
|
|
148
|
+
* Base editable html input configuration regarding plugins that are enabled/disabled
|
|
149
|
+
* E.g. audio, video, image
|
|
150
|
+
*/
|
|
151
|
+
baseInputConfiguration?: EditableHtmlConfigureProp;
|
|
152
|
+
/** Partial Scoring configuration */
|
|
153
|
+
partialScoring?: ConfigureProp;
|
|
154
|
+
/** Rationale configuration */
|
|
155
|
+
rationale?: EditableHtmlPluginConfigureRequired;
|
|
156
|
+
/** Configuration for the author's spellcheck; `enabled` is not read, the model's `spellCheckEnabled` turns it on */
|
|
157
|
+
spellCheck?: ConfigurePropWithEnabled;
|
|
158
|
+
/** Settings Panel control for feedback; `enabled` is not read */
|
|
159
|
+
feedback?: ConfigurePropWithEnabled;
|
|
160
|
+
/** Settings Panel control for locking the choice order */
|
|
161
|
+
lockChoiceOrder?: ConfigureProp;
|
|
162
|
+
/** Settings Panel control for multiple placements of a choice */
|
|
163
|
+
allowMultiplePlacements?: ConfigureProp;
|
|
164
|
+
/** Settings Panel control for the maximum number of choices per category */
|
|
165
|
+
maxPlacements?: ConfigureProp;
|
|
166
|
+
/** Settings Panel control for alternate correct answers */
|
|
167
|
+
allowAlternate?: ConfigureProp;
|
|
168
|
+
/** Settings Panel control for the number of categories per row */
|
|
169
|
+
categoriesPerRow?: ConfigureProp;
|
|
170
|
+
/** Scoring Type configuration */
|
|
171
|
+
scoringType?: ConfigureProp;
|
|
172
|
+
/** Indicates if the settings panel is not available */
|
|
173
|
+
settingsPanelDisabled?: boolean;
|
|
174
|
+
/** Student Instructions configuration */
|
|
175
|
+
studentInstructions?: ConfigureProp;
|
|
176
|
+
/** Teacher Instructions configuration */
|
|
177
|
+
teacherInstructions?: EditableHtmlPluginConfigureRequired;
|
|
178
|
+
/** Configuration for the prompt */
|
|
179
|
+
prompt?: EditableHtmlPluginConfigureRequired;
|
|
180
|
+
/** Configuration for the headers */
|
|
181
|
+
headers?: EditableHtmlPluginConfigure;
|
|
182
|
+
/** Configuration for the row labels */
|
|
183
|
+
rowLabels?: EditableHtmlPluginConfigure;
|
|
184
|
+
/** Not read by the authoring surface; the model's `toolbarEditorPosition` sets the position */
|
|
185
|
+
toolbarEditorPosition?: ConfigureProp;
|
|
186
|
+
/**
|
|
187
|
+
* Minimum number of choices
|
|
188
|
+
* @default 1
|
|
189
|
+
*/
|
|
190
|
+
minChoices?: number;
|
|
191
|
+
/** Maximum number of choices, shown in the authoring validation message; `validate()` checks the model's `maxAnswerChoices` */
|
|
192
|
+
maxChoices?: number;
|
|
193
|
+
/**
|
|
194
|
+
* Minimum number of categories
|
|
195
|
+
* @default 1
|
|
196
|
+
*/
|
|
197
|
+
minCategories?: number;
|
|
198
|
+
/**
|
|
199
|
+
* Maximum number of categories
|
|
200
|
+
* @default 12
|
|
201
|
+
*/
|
|
202
|
+
maxCategories?: number;
|
|
203
|
+
/**
|
|
204
|
+
* Maximum length of a choice's text, in characters
|
|
205
|
+
* @default 300
|
|
206
|
+
*/
|
|
207
|
+
maxLengthPerChoice?: number;
|
|
208
|
+
/**
|
|
209
|
+
* Maximum length of a category label's text, in characters
|
|
210
|
+
* @default 150
|
|
211
|
+
*/
|
|
212
|
+
maxLengthPerCategory?: number;
|
|
213
|
+
/** Position of the choices */
|
|
214
|
+
choicesPosition?: ConfigureProp;
|
|
215
|
+
/** Configuration for editable-html */
|
|
216
|
+
mathMlOptions?: ConfigureMathMLProp;
|
|
217
|
+
/**
|
|
218
|
+
* Minimum value of categories per row
|
|
219
|
+
* @default 1
|
|
220
|
+
*/
|
|
221
|
+
minCategoriesPerRow?: number;
|
|
222
|
+
/** Maximum image width for input fields */
|
|
223
|
+
maxImageWidth?: MaxImageDimensions;
|
|
224
|
+
/** Maximum image height for input fields */
|
|
225
|
+
maxImageHeight?: MaxImageDimensions;
|
|
226
|
+
/** Rubric configuration - only relevant in environments that use pie-player-components */
|
|
227
|
+
withRubric?: ConfigureProp;
|
|
228
|
+
/** Language configuration */
|
|
229
|
+
language?: ConfigurePropWithEnabled;
|
|
230
|
+
/**
|
|
231
|
+
* Language choices configuration
|
|
232
|
+
* Only available if language is enabled
|
|
233
|
+
*/
|
|
234
|
+
languageChoices?: ConfigureLanguageOptions;
|
|
235
|
+
/** Configuration for maximum number of choices */
|
|
236
|
+
allowMaxAnswerChoices?: ConfigureProp;
|
|
237
|
+
/** Dimensions of the authoring container */
|
|
238
|
+
contentDimensions?: ContentDimensions;
|
|
239
|
+
/** Not read by this element: `partialScoring.settings` shows the partial scoring control */
|
|
240
|
+
settingsPartialScoring?: boolean;
|
|
241
|
+
}
|
|
242
|
+
/** The choices the learner placed in one category */
|
|
243
|
+
export interface CategorizeAnswer {
|
|
244
|
+
/** The identifier for the category */
|
|
245
|
+
category: string;
|
|
246
|
+
/** Identifiers of the choices placed in the category */
|
|
247
|
+
choices: string[];
|
|
248
|
+
}
|
|
249
|
+
export interface CategorizeSession {
|
|
250
|
+
/** Identifier of the session; the correct-response session carries the number 1 */
|
|
251
|
+
id?: string | number;
|
|
252
|
+
/** The element the session belongs to */
|
|
253
|
+
element?: string;
|
|
254
|
+
/** The choices placed in each category */
|
|
255
|
+
answers?: CategorizeAnswer[];
|
|
256
|
+
/** The input that made the last change; the delivery writes `Mouse` */
|
|
257
|
+
selector?: string;
|
|
258
|
+
/** When auto-played prompt audio started, in epoch milliseconds */
|
|
259
|
+
audioStartTime?: number;
|
|
260
|
+
/** When auto-played prompt audio ended, in epoch milliseconds */
|
|
261
|
+
audioEndTime?: number;
|
|
262
|
+
/** Milliseconds the learner waited for auto-played prompt audio to finish */
|
|
263
|
+
waitTime?: number;
|
|
264
|
+
/** Choice ids in the order they were shuffled for this learner, when choice order is not locked */
|
|
265
|
+
shuffledValues?: string[];
|
|
266
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/categorize",
|
|
3
|
-
"version": "14.0.4
|
|
3
|
+
"version": "14.0.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -13,24 +13,25 @@
|
|
|
13
13
|
"@emotion/react": "^11.14.0",
|
|
14
14
|
"@mui/icons-material": "^7.3.4",
|
|
15
15
|
"@mui/material": "^7.3.4",
|
|
16
|
-
"@pie-element/shared-utils": "0.1.4
|
|
17
|
-
"@pie-lib/categorize": "3.0.
|
|
18
|
-
"@pie-lib/config-ui": "14.0.4
|
|
19
|
-
"@pie-lib/correct-answer-toggle": "5.0.4
|
|
20
|
-
"@pie-lib/drag": "5.0.4
|
|
21
|
-
"@pie-lib/render-ui": "8.0.4
|
|
22
|
-
"@pie-lib/translator": "5.0.
|
|
16
|
+
"@pie-element/shared-utils": "0.1.4",
|
|
17
|
+
"@pie-lib/categorize": "3.0.1",
|
|
18
|
+
"@pie-lib/config-ui": "14.0.4",
|
|
19
|
+
"@pie-lib/correct-answer-toggle": "5.0.4",
|
|
20
|
+
"@pie-lib/drag": "5.0.4",
|
|
21
|
+
"@pie-lib/render-ui": "8.0.4",
|
|
22
|
+
"@pie-lib/translator": "5.0.1",
|
|
23
23
|
"debug": "^4.1.1",
|
|
24
24
|
"prop-types": "^15.8.1",
|
|
25
|
-
"@pie-element/shared-lodash": "0.1.
|
|
26
|
-
"@pie-lib/editable-html-tip-tap": "3.0.4
|
|
27
|
-
"@pie-element/shared-math-rendering-mathjax": "0.1.5
|
|
28
|
-
"@pie-element/shared-configure-events": "0.1.
|
|
29
|
-
"@pie-element/shared-feedback": "0.1.
|
|
30
|
-
"@pie-element/shared-controller-utils": "0.1.2
|
|
31
|
-
"@pie-element/shared-player-events": "0.1.
|
|
25
|
+
"@pie-element/shared-lodash": "0.1.2",
|
|
26
|
+
"@pie-lib/editable-html-tip-tap": "3.0.4",
|
|
27
|
+
"@pie-element/shared-math-rendering-mathjax": "0.1.5",
|
|
28
|
+
"@pie-element/shared-configure-events": "0.1.1",
|
|
29
|
+
"@pie-element/shared-feedback": "0.1.2",
|
|
30
|
+
"@pie-element/shared-controller-utils": "0.1.2",
|
|
31
|
+
"@pie-element/shared-player-events": "0.1.1",
|
|
32
32
|
"react": "^18.2.0",
|
|
33
|
-
"react-dom": "^18.2.0"
|
|
33
|
+
"react-dom": "^18.2.0",
|
|
34
|
+
"@pie-element/shared-types": "0.2.1"
|
|
34
35
|
},
|
|
35
36
|
"exports": {
|
|
36
37
|
".": {
|
|
@@ -73,6 +74,9 @@
|
|
|
73
74
|
"types": "./dist/runtime-support.d.ts",
|
|
74
75
|
"default": "./dist/runtime-support.js"
|
|
75
76
|
},
|
|
77
|
+
"./schemas/model.schema.json": "./dist/schemas/model.schema.json",
|
|
78
|
+
"./schemas/configuration.schema.json": "./dist/schemas/configuration.schema.json",
|
|
79
|
+
"./schemas/session.schema.json": "./dist/schemas/session.schema.json",
|
|
76
80
|
"./package.json": "./package.json"
|
|
77
81
|
},
|
|
78
82
|
"type": "module",
|
|
@@ -86,7 +90,7 @@
|
|
|
86
90
|
],
|
|
87
91
|
"sideEffects": false,
|
|
88
92
|
"scripts": {
|
|
89
|
-
"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 vite.config.iife.ts && bun x tsc --emitDeclarationOnly",
|
|
93
|
+
"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 vite.config.iife.ts && bun x tsc --emitDeclarationOnly && bun ../../../tools/schemas/build.ts",
|
|
90
94
|
"dev": "bun x vite",
|
|
91
95
|
"demo": "bun x vite --mode demo",
|
|
92
96
|
"test": "bun x vitest run"
|
|
@@ -100,7 +104,7 @@
|
|
|
100
104
|
},
|
|
101
105
|
"browserEditorRuntime": {
|
|
102
106
|
"name": "@pie-element/shared-editor-runtime",
|
|
103
|
-
"version": "0.1.
|
|
107
|
+
"version": "0.1.2",
|
|
104
108
|
"views": {
|
|
105
109
|
"delivery": "editor-runtime/delivery",
|
|
106
110
|
"author": "editor-runtime/author",
|