@pie-element/hotspot 4.10.10 → 4.10.11-beta.1445
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/CHANGELOG.md +349 -0
- package/configure/CHANGELOG.md +311 -0
- package/configure/lib/button.js.map +1 -1
- package/configure/lib/defaults.js +23 -2
- package/configure/lib/defaults.js.map +1 -1
- package/configure/lib/hotspot-container.js +28 -19
- package/configure/lib/hotspot-container.js.map +1 -1
- package/configure/lib/hotspot-drawable.js +3 -3
- package/configure/lib/hotspot-drawable.js.map +1 -1
- package/configure/lib/hotspot-palette.js.map +1 -1
- package/configure/lib/hotspot-polygon.js.map +1 -1
- package/configure/lib/hotspot-rectangle.js.map +1 -1
- package/configure/lib/index.js +16 -2
- package/configure/lib/index.js.map +1 -1
- package/configure/lib/root.js +129 -38
- package/configure/lib/root.js.map +1 -1
- package/configure/lib/upload-control.js.map +1 -1
- package/configure/lib/utils.js +15 -3
- package/configure/lib/utils.js.map +1 -1
- package/configure/package.json +4 -4
- package/configure/src/__tests__/__snapshots__/hotspot-container.test.js.snap +1 -1
- package/configure/src/__tests__/__snapshots__/root.test.js.snap +56 -4
- package/configure/src/__tests__/hotspot-container.test.js +98 -71
- package/configure/src/__tests__/hotspot-drawable.test.js +48 -49
- package/configure/src/__tests__/index.test.js +28 -51
- package/configure/src/__tests__/root.test.js +162 -82
- package/configure/src/__tests__/utils.test.js +112 -98
- package/configure/src/button.jsx +4 -4
- package/configure/src/defaults.js +35 -18
- package/configure/src/hotspot-container.jsx +99 -98
- package/configure/src/hotspot-drawable.jsx +56 -56
- package/configure/src/hotspot-palette.jsx +12 -25
- package/configure/src/hotspot-polygon.jsx +20 -22
- package/configure/src/hotspot-rectangle.jsx +5 -15
- package/configure/src/index.js +32 -18
- package/configure/src/root.jsx +116 -60
- package/configure/src/upload-control.jsx +9 -20
- package/configure/src/utils.js +51 -22
- package/controller/CHANGELOG.md +23 -0
- package/controller/lib/defaults.js +2 -2
- package/controller/lib/defaults.js.map +1 -1
- package/controller/lib/index.js +39 -3
- package/controller/lib/index.js.map +1 -1
- package/controller/lib/utils.js.map +1 -1
- package/controller/package.json +2 -2
- package/controller/src/__tests__/index.test.js +29 -50
- package/controller/src/defaults.js +5 -9
- package/controller/src/index.js +47 -33
- package/controller/src/utils.js +9 -6
- package/docs/config-schema.json +217 -0
- package/docs/config-schema.json.md +169 -0
- package/docs/demo/config.js +2 -2
- package/docs/demo/generate.js +53 -35
- package/docs/demo/session.js +2 -2
- package/docs/pie-schema.json +49 -0
- package/docs/pie-schema.json.md +36 -0
- package/lib/hotspot/container.js +24 -6
- package/lib/hotspot/container.js.map +1 -1
- package/lib/hotspot/icons.js.map +1 -1
- package/lib/hotspot/image.js.map +1 -1
- package/lib/hotspot/index.js +65 -5
- package/lib/hotspot/index.js.map +1 -1
- package/lib/hotspot/polygon.js +45 -19
- package/lib/hotspot/polygon.js.map +1 -1
- package/lib/hotspot/rectangle.js +45 -19
- package/lib/hotspot/rectangle.js.map +1 -1
- package/lib/index.js +3 -0
- package/lib/index.js.map +1 -1
- package/lib/session-updater.js.map +1 -1
- package/package.json +7 -4
- package/src/__tests__/__snapshots__/{container-test.jsx.snap → container.test.jsx.snap} +8 -0
- package/src/__tests__/__snapshots__/image.test.jsx.snap +43 -0
- package/src/__tests__/__snapshots__/{polygon-test.jsx.snap → polygon.test.jsx.snap} +11 -0
- package/src/__tests__/__snapshots__/{rectangle-test.jsx.snap → rectangle.test.jsx.snap} +11 -0
- package/src/__tests__/container.test.jsx +214 -0
- package/src/__tests__/{image-test.jsx → image.test.jsx} +2 -2
- package/src/__tests__/polygon.test.jsx +235 -0
- package/src/__tests__/rectangle.test.jsx +237 -0
- package/src/__tests__/{session-updater-test.jsx → session-updater.test.jsx} +22 -31
- package/src/hotspot/container.jsx +40 -23
- package/src/hotspot/icons.js +4 -2
- package/src/hotspot/image.jsx +4 -8
- package/src/hotspot/index.jsx +73 -33
- package/src/hotspot/polygon.jsx +48 -30
- package/src/hotspot/rectangle.jsx +48 -30
- package/src/index.js +10 -18
- package/src/session-updater.js +1 -1
- package/src/__tests__/__snapshots__/image-test.jsx.snap +0 -21
- package/src/__tests__/container-test.jsx +0 -143
- package/src/__tests__/polygon-test.jsx +0 -77
- package/src/__tests__/rectangle-test.jsx +0 -78
package/controller/src/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import defaults from './defaults';
|
|
|
8
8
|
|
|
9
9
|
const log = debug('pie-elements:hotspot:controller');
|
|
10
10
|
|
|
11
|
-
export const normalize = question => ({
|
|
11
|
+
export const normalize = (question) => ({
|
|
12
12
|
promptEnabled: true,
|
|
13
13
|
rationaleEnabled: true,
|
|
14
14
|
teacherInstructionsEnabled: true,
|
|
@@ -19,19 +19,11 @@ export const normalize = question => ({
|
|
|
19
19
|
|
|
20
20
|
export function model(question, session, env) {
|
|
21
21
|
const normalizedQuestion = normalize(question);
|
|
22
|
-
const {
|
|
23
|
-
|
|
24
|
-
dimensions,
|
|
25
|
-
hotspotColor,
|
|
26
|
-
multipleCorrect,
|
|
27
|
-
outlineColor,
|
|
28
|
-
partialScoring,
|
|
29
|
-
prompt,
|
|
30
|
-
shapes
|
|
31
|
-
} = normalizedQuestion;
|
|
22
|
+
const { imageUrl, dimensions, hotspotColor, multipleCorrect, outlineColor, partialScoring, prompt, shapes } =
|
|
23
|
+
normalizedQuestion;
|
|
32
24
|
const { rectangles, polygons } = shapes || {};
|
|
33
25
|
|
|
34
|
-
return new Promise(resolve => {
|
|
26
|
+
return new Promise((resolve) => {
|
|
35
27
|
const out = {
|
|
36
28
|
disabled: env.mode !== 'gather',
|
|
37
29
|
mode: env.mode,
|
|
@@ -46,17 +38,16 @@ export function model(question, session, env) {
|
|
|
46
38
|
// eslint-disable-next-line no-unused-vars
|
|
47
39
|
rectangles: (rectangles || []).map(({ index, ...rectProps }) => ({ ...rectProps })),
|
|
48
40
|
// eslint-disable-next-line no-unused-vars
|
|
49
|
-
polygons: (polygons || []).map(({ index, ...polyProps }) => ({ ...polyProps }))
|
|
41
|
+
polygons: (polygons || []).map(({ index, ...polyProps }) => ({ ...polyProps })),
|
|
50
42
|
},
|
|
51
|
-
responseCorrect:
|
|
52
|
-
env.mode === 'evaluate'
|
|
53
|
-
? isResponseCorrect(normalizedQuestion, session)
|
|
54
|
-
: undefined
|
|
43
|
+
responseCorrect: env.mode === 'evaluate' ? isResponseCorrect(normalizedQuestion, session) : undefined,
|
|
55
44
|
};
|
|
56
45
|
|
|
57
46
|
if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {
|
|
58
47
|
out.rationale = normalizedQuestion.rationaleEnabled ? normalizedQuestion.rationale : null;
|
|
59
|
-
out.teacherInstructions = normalizedQuestion.teacherInstructionsEnabled
|
|
48
|
+
out.teacherInstructions = normalizedQuestion.teacherInstructionsEnabled
|
|
49
|
+
? normalizedQuestion.teacherInstructions
|
|
50
|
+
: null;
|
|
60
51
|
} else {
|
|
61
52
|
out.rationale = null;
|
|
62
53
|
out.teacherInstructions = null;
|
|
@@ -71,7 +62,7 @@ export function model(question, session, env) {
|
|
|
71
62
|
}
|
|
72
63
|
|
|
73
64
|
export const createDefaultModel = (model = {}) =>
|
|
74
|
-
new Promise(resolve => {
|
|
65
|
+
new Promise((resolve) => {
|
|
75
66
|
resolve({
|
|
76
67
|
...defaults,
|
|
77
68
|
...model,
|
|
@@ -97,14 +88,14 @@ const getScore = (config, session, env = {}) => {
|
|
|
97
88
|
|
|
98
89
|
const choices = [...rectangles, ...polygons];
|
|
99
90
|
|
|
100
|
-
const correctChoices = choices.filter(choice => choice.correct);
|
|
91
|
+
const correctChoices = choices.filter((choice) => choice.correct);
|
|
101
92
|
|
|
102
|
-
choices.forEach(shape => {
|
|
103
|
-
const selected = answers && answers.filter(answer => answer.id === shape.id)[0];
|
|
93
|
+
choices.forEach((shape) => {
|
|
94
|
+
const selected = answers && answers.filter((answer) => answer.id === shape.id)[0];
|
|
104
95
|
const correctlySelected = shape.correct && selected;
|
|
105
96
|
|
|
106
|
-
if(selected) {
|
|
107
|
-
selectedChoices +=1;
|
|
97
|
+
if (selected) {
|
|
98
|
+
selectedChoices += 1;
|
|
108
99
|
}
|
|
109
100
|
|
|
110
101
|
if (correctlySelected) {
|
|
@@ -121,7 +112,7 @@ const getScore = (config, session, env = {}) => {
|
|
|
121
112
|
};
|
|
122
113
|
|
|
123
114
|
export function outcome(config, session, env = {}) {
|
|
124
|
-
return new Promise(resolve => {
|
|
115
|
+
return new Promise((resolve) => {
|
|
125
116
|
log('outcome...');
|
|
126
117
|
|
|
127
118
|
if (!session || isEmpty(session)) {
|
|
@@ -132,7 +123,7 @@ export function outcome(config, session, env = {}) {
|
|
|
132
123
|
const score = getScore(config, session, env);
|
|
133
124
|
resolve({ score });
|
|
134
125
|
} else {
|
|
135
|
-
resolve({score: 0, empty: true})
|
|
126
|
+
resolve({ score: 0, empty: true });
|
|
136
127
|
}
|
|
137
128
|
});
|
|
138
129
|
}
|
|
@@ -140,7 +131,7 @@ export function outcome(config, session, env = {}) {
|
|
|
140
131
|
const returnShapesCorrect = (shapes) => {
|
|
141
132
|
let answers = [];
|
|
142
133
|
|
|
143
|
-
shapes.forEach(i => {
|
|
134
|
+
shapes.forEach((i) => {
|
|
144
135
|
const { correct, id } = i;
|
|
145
136
|
if (correct) {
|
|
146
137
|
answers.push({ id });
|
|
@@ -150,7 +141,7 @@ const returnShapesCorrect = (shapes) => {
|
|
|
150
141
|
};
|
|
151
142
|
|
|
152
143
|
export const createCorrectResponseSession = (question, env) => {
|
|
153
|
-
return new Promise(resolve => {
|
|
144
|
+
return new Promise((resolve) => {
|
|
154
145
|
if (env.mode !== 'evaluate' && env.role === 'instructor') {
|
|
155
146
|
const { shapes: { rectangles = [], polygons = {} } = {} } = question;
|
|
156
147
|
|
|
@@ -158,14 +149,37 @@ export const createCorrectResponseSession = (question, env) => {
|
|
|
158
149
|
const polygonsCorrect = returnShapesCorrect(polygons);
|
|
159
150
|
|
|
160
151
|
resolve({
|
|
161
|
-
answers: [
|
|
162
|
-
|
|
163
|
-
...polygonsCorrect
|
|
164
|
-
],
|
|
165
|
-
id: '1'
|
|
152
|
+
answers: [...rectangleCorrect, ...polygonsCorrect],
|
|
153
|
+
id: '1',
|
|
166
154
|
});
|
|
167
155
|
} else {
|
|
168
156
|
resolve(null);
|
|
169
157
|
}
|
|
170
158
|
});
|
|
171
159
|
};
|
|
160
|
+
|
|
161
|
+
export const validate = (model = {}, config = {}) => {
|
|
162
|
+
const { shapes } = model;
|
|
163
|
+
const { minShapes = 2, maxShapes, maxSelections } = config;
|
|
164
|
+
const errors = {};
|
|
165
|
+
|
|
166
|
+
const allShapes = Object.values(shapes || {}).reduce((acc, shape) => [...acc, ...shape], []);
|
|
167
|
+
|
|
168
|
+
const nbOfSelections = (allShapes || []).reduce((acc, shape) => (shape.correct ? acc + 1 : acc), 0);
|
|
169
|
+
|
|
170
|
+
const nbOfShapes = (allShapes || []).length;
|
|
171
|
+
|
|
172
|
+
if (nbOfShapes < minShapes) {
|
|
173
|
+
errors.shapesError = `There should be at least ${minShapes} shapes defined.`;
|
|
174
|
+
} else if (nbOfShapes > maxShapes) {
|
|
175
|
+
errors.shapesError = `No more than ${maxShapes} shapes should be defined.`;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
if (nbOfSelections < 1) {
|
|
179
|
+
errors.selectionsError = 'There should be at least 1 shape selected.';
|
|
180
|
+
} else if (nbOfSelections > maxSelections) {
|
|
181
|
+
errors.selectionsError = `No more than ${maxSelections} shapes should be selected.`;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
return errors;
|
|
185
|
+
};
|
package/controller/src/utils.js
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import isEqual from 'lodash/isEqual';
|
|
2
2
|
import isEmpty from 'lodash/isEmpty';
|
|
3
3
|
|
|
4
|
-
export const getCorrectResponse = (choices) =>
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
export const getCorrectResponse = (choices) =>
|
|
5
|
+
choices
|
|
6
|
+
.filter((c) => c.correct)
|
|
7
|
+
.map((c) => c.id)
|
|
8
|
+
.sort();
|
|
8
9
|
|
|
9
10
|
export const isResponseCorrect = (question, session) => {
|
|
10
|
-
const {
|
|
11
|
+
const {
|
|
12
|
+
shapes: { rectangles, polygons },
|
|
13
|
+
} = question;
|
|
11
14
|
const choices = [...rectangles, ...polygons];
|
|
12
15
|
let correctResponseIds = getCorrectResponse(choices);
|
|
13
16
|
|
|
@@ -16,7 +19,7 @@ export const isResponseCorrect = (question, session) => {
|
|
|
16
19
|
}
|
|
17
20
|
|
|
18
21
|
if (session.answers && session.answers.length) {
|
|
19
|
-
let answerIds = (session.answers || []).map(a => a.id);
|
|
22
|
+
let answerIds = (session.answers || []).map((a) => a.id);
|
|
20
23
|
|
|
21
24
|
return isEqual(answerIds.sort(), correctResponseIds);
|
|
22
25
|
} else if (!(correctResponseIds && correctResponseIds.length)) {
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "Config Object for @pie-elements/hotspot",
|
|
3
|
+
"additionalProperties": false,
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"multipleCorrect": {
|
|
7
|
+
"title": "ConfigureProp",
|
|
8
|
+
"type": "object",
|
|
9
|
+
"properties": {
|
|
10
|
+
"settings": {
|
|
11
|
+
"description": "Indicates if the item has to be displayed in the Settings Panel",
|
|
12
|
+
"type": "boolean",
|
|
13
|
+
"title": "settings"
|
|
14
|
+
},
|
|
15
|
+
"label": {
|
|
16
|
+
"description": "Indicates the label for the item that has to be displayed in the Settings Panel",
|
|
17
|
+
"type": "string",
|
|
18
|
+
"title": "label"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"partialScoring": {
|
|
23
|
+
"title": "ConfigureProp",
|
|
24
|
+
"type": "object",
|
|
25
|
+
"properties": {
|
|
26
|
+
"settings": {
|
|
27
|
+
"description": "Indicates if the item has to be displayed in the Settings Panel",
|
|
28
|
+
"type": "boolean",
|
|
29
|
+
"title": "settings"
|
|
30
|
+
},
|
|
31
|
+
"label": {
|
|
32
|
+
"description": "Indicates the label for the item that has to be displayed in the Settings Panel",
|
|
33
|
+
"type": "string",
|
|
34
|
+
"title": "label"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"rationale": {
|
|
39
|
+
"title": "ConfigureProp",
|
|
40
|
+
"type": "object",
|
|
41
|
+
"properties": {
|
|
42
|
+
"settings": {
|
|
43
|
+
"description": "Indicates if the item has to be displayed in the Settings Panel",
|
|
44
|
+
"type": "boolean",
|
|
45
|
+
"title": "settings"
|
|
46
|
+
},
|
|
47
|
+
"label": {
|
|
48
|
+
"description": "Indicates the label for the item that has to be displayed in the Settings Panel",
|
|
49
|
+
"type": "string",
|
|
50
|
+
"title": "label"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"settingsPanelDisabled": {
|
|
55
|
+
"description": "Indicates if the settings panel is not available",
|
|
56
|
+
"type": "boolean",
|
|
57
|
+
"title": "settingsPanelDisabled"
|
|
58
|
+
},
|
|
59
|
+
"spellCheck": {
|
|
60
|
+
"title": "ConfigureProp",
|
|
61
|
+
"type": "object",
|
|
62
|
+
"properties": {
|
|
63
|
+
"settings": {
|
|
64
|
+
"description": "Indicates if the item has to be displayed in the Settings Panel",
|
|
65
|
+
"type": "boolean",
|
|
66
|
+
"title": "settings"
|
|
67
|
+
},
|
|
68
|
+
"label": {
|
|
69
|
+
"description": "Indicates the label for the item that has to be displayed in the Settings Panel",
|
|
70
|
+
"type": "string",
|
|
71
|
+
"title": "label"
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
"preserveAspectRatio": {
|
|
76
|
+
"title": "ConfigureProp",
|
|
77
|
+
"type": "object",
|
|
78
|
+
"properties": {
|
|
79
|
+
"settings": {
|
|
80
|
+
"description": "Indicates if the item has to be displayed in the Settings Panel",
|
|
81
|
+
"type": "boolean",
|
|
82
|
+
"title": "settings"
|
|
83
|
+
},
|
|
84
|
+
"label": {
|
|
85
|
+
"description": "Indicates the label for the item that has to be displayed in the Settings Panel",
|
|
86
|
+
"type": "string",
|
|
87
|
+
"title": "label"
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
"minShapes": {
|
|
92
|
+
"description": "Minimum number of shapes",
|
|
93
|
+
"type": "number",
|
|
94
|
+
"title": "minShapes"
|
|
95
|
+
},
|
|
96
|
+
"maxShapes": {
|
|
97
|
+
"description": "Maximum number of shapes",
|
|
98
|
+
"type": "number",
|
|
99
|
+
"title": "maxShapes"
|
|
100
|
+
},
|
|
101
|
+
"maxSelections": {
|
|
102
|
+
"description": "Maximum number of selected shapes in correct answer",
|
|
103
|
+
"type": "number",
|
|
104
|
+
"title": "maxSelections"
|
|
105
|
+
},
|
|
106
|
+
"maxImageWidth": {
|
|
107
|
+
"title": "ConfigureMaxImageDimensionsProp",
|
|
108
|
+
"type": "object",
|
|
109
|
+
"properties": {
|
|
110
|
+
"teacherInstructions": {
|
|
111
|
+
"description": "Indicates the max dimension for images in teacher instructions",
|
|
112
|
+
"type": "number",
|
|
113
|
+
"title": "teacherInstructions"
|
|
114
|
+
},
|
|
115
|
+
"prompt": {
|
|
116
|
+
"description": "Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified",
|
|
117
|
+
"type": "number",
|
|
118
|
+
"title": "prompt"
|
|
119
|
+
},
|
|
120
|
+
"rationale": {
|
|
121
|
+
"description": "Indicates the max dimension for images in rationale",
|
|
122
|
+
"type": "number",
|
|
123
|
+
"title": "rationale"
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
"maxImageHeight": {
|
|
128
|
+
"title": "ConfigureMaxImageDimensionsProp",
|
|
129
|
+
"type": "object",
|
|
130
|
+
"properties": {
|
|
131
|
+
"teacherInstructions": {
|
|
132
|
+
"description": "Indicates the max dimension for images in teacher instructions",
|
|
133
|
+
"type": "number",
|
|
134
|
+
"title": "teacherInstructions"
|
|
135
|
+
},
|
|
136
|
+
"prompt": {
|
|
137
|
+
"description": "Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified",
|
|
138
|
+
"type": "number",
|
|
139
|
+
"title": "prompt"
|
|
140
|
+
},
|
|
141
|
+
"rationale": {
|
|
142
|
+
"description": "Indicates the max dimension for images in rationale",
|
|
143
|
+
"type": "number",
|
|
144
|
+
"title": "rationale"
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
"withRubric": {
|
|
149
|
+
"title": "ConfigureProp",
|
|
150
|
+
"type": "object",
|
|
151
|
+
"properties": {
|
|
152
|
+
"settings": {
|
|
153
|
+
"description": "Indicates if the item has to be displayed in the Settings Panel",
|
|
154
|
+
"type": "boolean",
|
|
155
|
+
"title": "settings"
|
|
156
|
+
},
|
|
157
|
+
"label": {
|
|
158
|
+
"description": "Indicates the label for the item that has to be displayed in the Settings Panel",
|
|
159
|
+
"type": "string",
|
|
160
|
+
"title": "label"
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
"showPrompt": {
|
|
165
|
+
"description": "Determines whether prompt field will be displayed or not",
|
|
166
|
+
"default": true,
|
|
167
|
+
"type": "boolean",
|
|
168
|
+
"title": "showPrompt"
|
|
169
|
+
},
|
|
170
|
+
"promptLabel": {
|
|
171
|
+
"description": "The label for the item stem/prompt field",
|
|
172
|
+
"default": "Item Stemm",
|
|
173
|
+
"type": "string",
|
|
174
|
+
"title": "promptLabel"
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
"definitions": {
|
|
178
|
+
"ConfigureProp": {
|
|
179
|
+
"title": "ConfigureProp",
|
|
180
|
+
"type": "object",
|
|
181
|
+
"properties": {
|
|
182
|
+
"settings": {
|
|
183
|
+
"description": "Indicates if the item has to be displayed in the Settings Panel",
|
|
184
|
+
"type": "boolean",
|
|
185
|
+
"title": "settings"
|
|
186
|
+
},
|
|
187
|
+
"label": {
|
|
188
|
+
"description": "Indicates the label for the item that has to be displayed in the Settings Panel",
|
|
189
|
+
"type": "string",
|
|
190
|
+
"title": "label"
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
"ConfigureMaxImageDimensionsProp": {
|
|
195
|
+
"title": "ConfigureMaxImageDimensionsProp",
|
|
196
|
+
"type": "object",
|
|
197
|
+
"properties": {
|
|
198
|
+
"teacherInstructions": {
|
|
199
|
+
"description": "Indicates the max dimension for images in teacher instructions",
|
|
200
|
+
"type": "number",
|
|
201
|
+
"title": "teacherInstructions"
|
|
202
|
+
},
|
|
203
|
+
"prompt": {
|
|
204
|
+
"description": "Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified",
|
|
205
|
+
"type": "number",
|
|
206
|
+
"title": "prompt"
|
|
207
|
+
},
|
|
208
|
+
"rationale": {
|
|
209
|
+
"description": "Indicates the max dimension for images in rationale",
|
|
210
|
+
"type": "number",
|
|
211
|
+
"title": "rationale"
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
"$schema": "http://json-schema.org/draft-07/schema#"
|
|
217
|
+
}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
Config Object for @pie-elements/hotspot
|
|
2
|
+
|
|
3
|
+
The schema defines the following properties:
|
|
4
|
+
|
|
5
|
+
# `multipleCorrect` (object)
|
|
6
|
+
|
|
7
|
+
Properties of the `multipleCorrect` object:
|
|
8
|
+
|
|
9
|
+
## `settings` (boolean)
|
|
10
|
+
|
|
11
|
+
Indicates if the item has to be displayed in the Settings Panel
|
|
12
|
+
|
|
13
|
+
## `label` (string)
|
|
14
|
+
|
|
15
|
+
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
16
|
+
|
|
17
|
+
# `partialScoring` (object)
|
|
18
|
+
|
|
19
|
+
Properties of the `partialScoring` object:
|
|
20
|
+
|
|
21
|
+
## `settings` (boolean)
|
|
22
|
+
|
|
23
|
+
Indicates if the item has to be displayed in the Settings Panel
|
|
24
|
+
|
|
25
|
+
## `label` (string)
|
|
26
|
+
|
|
27
|
+
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
28
|
+
|
|
29
|
+
# `rationale` (object)
|
|
30
|
+
|
|
31
|
+
Properties of the `rationale` object:
|
|
32
|
+
|
|
33
|
+
## `settings` (boolean)
|
|
34
|
+
|
|
35
|
+
Indicates if the item has to be displayed in the Settings Panel
|
|
36
|
+
|
|
37
|
+
## `label` (string)
|
|
38
|
+
|
|
39
|
+
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
40
|
+
|
|
41
|
+
# `settingsPanelDisabled` (boolean)
|
|
42
|
+
|
|
43
|
+
Indicates if the settings panel is not available
|
|
44
|
+
|
|
45
|
+
# `spellCheck` (object)
|
|
46
|
+
|
|
47
|
+
Properties of the `spellCheck` object:
|
|
48
|
+
|
|
49
|
+
## `settings` (boolean)
|
|
50
|
+
|
|
51
|
+
Indicates if the item has to be displayed in the Settings Panel
|
|
52
|
+
|
|
53
|
+
## `label` (string)
|
|
54
|
+
|
|
55
|
+
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
56
|
+
|
|
57
|
+
# `preserveAspectRatio` (object)
|
|
58
|
+
|
|
59
|
+
Properties of the `preserveAspectRatio` object:
|
|
60
|
+
|
|
61
|
+
## `settings` (boolean)
|
|
62
|
+
|
|
63
|
+
Indicates if the item has to be displayed in the Settings Panel
|
|
64
|
+
|
|
65
|
+
## `label` (string)
|
|
66
|
+
|
|
67
|
+
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
68
|
+
|
|
69
|
+
# `minShapes` (number)
|
|
70
|
+
|
|
71
|
+
Minimum number of shapes
|
|
72
|
+
|
|
73
|
+
# `maxShapes` (number)
|
|
74
|
+
|
|
75
|
+
Maximum number of shapes
|
|
76
|
+
|
|
77
|
+
# `maxSelections` (number)
|
|
78
|
+
|
|
79
|
+
Maximum number of selected shapes in correct answer
|
|
80
|
+
|
|
81
|
+
# `maxImageWidth` (object)
|
|
82
|
+
|
|
83
|
+
Properties of the `maxImageWidth` object:
|
|
84
|
+
|
|
85
|
+
## `teacherInstructions` (number)
|
|
86
|
+
|
|
87
|
+
Indicates the max dimension for images in teacher instructions
|
|
88
|
+
|
|
89
|
+
## `prompt` (number)
|
|
90
|
+
|
|
91
|
+
Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
|
|
92
|
+
|
|
93
|
+
## `rationale` (number)
|
|
94
|
+
|
|
95
|
+
Indicates the max dimension for images in rationale
|
|
96
|
+
|
|
97
|
+
# `maxImageHeight` (object)
|
|
98
|
+
|
|
99
|
+
Properties of the `maxImageHeight` object:
|
|
100
|
+
|
|
101
|
+
## `teacherInstructions` (number)
|
|
102
|
+
|
|
103
|
+
Indicates the max dimension for images in teacher instructions
|
|
104
|
+
|
|
105
|
+
## `prompt` (number)
|
|
106
|
+
|
|
107
|
+
Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
|
|
108
|
+
|
|
109
|
+
## `rationale` (number)
|
|
110
|
+
|
|
111
|
+
Indicates the max dimension for images in rationale
|
|
112
|
+
|
|
113
|
+
# `withRubric` (object)
|
|
114
|
+
|
|
115
|
+
Properties of the `withRubric` object:
|
|
116
|
+
|
|
117
|
+
## `settings` (boolean)
|
|
118
|
+
|
|
119
|
+
Indicates if the item has to be displayed in the Settings Panel
|
|
120
|
+
|
|
121
|
+
## `label` (string)
|
|
122
|
+
|
|
123
|
+
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
124
|
+
|
|
125
|
+
# `showPrompt` (boolean)
|
|
126
|
+
|
|
127
|
+
Determines whether prompt field will be displayed or not
|
|
128
|
+
|
|
129
|
+
Default: `true`
|
|
130
|
+
|
|
131
|
+
# `promptLabel` (string)
|
|
132
|
+
|
|
133
|
+
The label for the item stem/prompt field
|
|
134
|
+
|
|
135
|
+
Default: `"Item Stemm"`
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
# Sub Schemas
|
|
140
|
+
|
|
141
|
+
The schema defines the following additional types:
|
|
142
|
+
|
|
143
|
+
## `ConfigureProp` (object)
|
|
144
|
+
|
|
145
|
+
Properties of the `ConfigureProp` object:
|
|
146
|
+
|
|
147
|
+
### `settings` (boolean)
|
|
148
|
+
|
|
149
|
+
Indicates if the item has to be displayed in the Settings Panel
|
|
150
|
+
|
|
151
|
+
### `label` (string)
|
|
152
|
+
|
|
153
|
+
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
154
|
+
|
|
155
|
+
## `ConfigureMaxImageDimensionsProp` (object)
|
|
156
|
+
|
|
157
|
+
Properties of the `ConfigureMaxImageDimensionsProp` object:
|
|
158
|
+
|
|
159
|
+
### `teacherInstructions` (number)
|
|
160
|
+
|
|
161
|
+
Indicates the max dimension for images in teacher instructions
|
|
162
|
+
|
|
163
|
+
### `prompt` (number)
|
|
164
|
+
|
|
165
|
+
Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
|
|
166
|
+
|
|
167
|
+
### `rationale` (number)
|
|
168
|
+
|
|
169
|
+
Indicates the max dimension for images in rationale
|
package/docs/demo/config.js
CHANGED
package/docs/demo/generate.js
CHANGED
|
@@ -4,12 +4,14 @@ exports.model = (id, element) => ({
|
|
|
4
4
|
disabled: false,
|
|
5
5
|
mode: 'gather',
|
|
6
6
|
dimensions: { height: 291, width: 410 },
|
|
7
|
-
imageUrl:
|
|
8
|
-
|
|
7
|
+
imageUrl:
|
|
8
|
+
'https://store-images.s-microsoft.com/image/apps.2544.13768621950225582.167ba0c8-6eb8-47bb-96fe-278c89bf0dc9.ea440c13-fd1d-4705-b62c-9bfd9054b8b3?w=672&h=378&q=80&mode=letterbox&background=%23FFE4E4E4&format=jpg',
|
|
9
|
+
hotspotColor: 'rgba(137, 183, 244, 0.25)',
|
|
9
10
|
hotspotList: [
|
|
10
|
-
'rgba(137, 183, 244, 0.
|
|
11
|
-
'rgba(217, 30, 24, 0.
|
|
12
|
-
'rgba(254, 241, 96, 0.
|
|
11
|
+
'rgba(137, 183, 244, 0.25)',
|
|
12
|
+
'rgba(217, 30, 24, 0.25)',
|
|
13
|
+
'rgba(254, 241, 96, 0.25)',
|
|
14
|
+
'rgba(0, 0, 0, 0.1)',
|
|
13
15
|
],
|
|
14
16
|
outlineColor: 'blue',
|
|
15
17
|
outlineList: ['blue', 'red', 'yellow'],
|
|
@@ -22,47 +24,63 @@ exports.model = (id, element) => ({
|
|
|
22
24
|
width: 130,
|
|
23
25
|
x: 1,
|
|
24
26
|
y: 1,
|
|
25
|
-
correct: true
|
|
26
|
-
},
|
|
27
|
+
correct: true,
|
|
28
|
+
},
|
|
29
|
+
{
|
|
27
30
|
id: 'd41',
|
|
28
31
|
height: 140,
|
|
29
32
|
width: 130,
|
|
30
33
|
x: 140,
|
|
31
|
-
y: 1
|
|
32
|
-
},
|
|
34
|
+
y: 1,
|
|
35
|
+
},
|
|
36
|
+
{
|
|
33
37
|
id: 'aaaa42',
|
|
34
38
|
height: 140,
|
|
35
39
|
width: 130,
|
|
36
40
|
x: 280,
|
|
37
|
-
y: 1
|
|
38
|
-
}
|
|
41
|
+
y: 1,
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
polygons: [
|
|
45
|
+
{
|
|
46
|
+
// triangle
|
|
47
|
+
id: '3',
|
|
48
|
+
points: [
|
|
49
|
+
{ x: 65, y: 148 },
|
|
50
|
+
{ x: 1, y: 288 },
|
|
51
|
+
{ y: 288, x: 129 },
|
|
52
|
+
],
|
|
53
|
+
correct: true,
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
// triangle
|
|
57
|
+
id: 'g74',
|
|
58
|
+
points: [
|
|
59
|
+
{ y: 151, x: 141 },
|
|
60
|
+
{ y: 289, x: 205 },
|
|
61
|
+
{ x: 269, y: 151 },
|
|
62
|
+
],
|
|
63
|
+
correct: false,
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
// hexagon
|
|
67
|
+
id: 'j35',
|
|
68
|
+
points: [
|
|
69
|
+
{ x: 300, y: 150 },
|
|
70
|
+
{ x: 279, y: 220 },
|
|
71
|
+
{ x: 300, y: 289 },
|
|
72
|
+
{ x: 386, y: 289 },
|
|
73
|
+
{ x: 407, y: 220 },
|
|
74
|
+
{ x: 386, y: 150 },
|
|
75
|
+
],
|
|
76
|
+
correct: false,
|
|
77
|
+
},
|
|
39
78
|
],
|
|
40
|
-
polygons: [{
|
|
41
|
-
// triangle
|
|
42
|
-
id: '3',
|
|
43
|
-
points: [{ x: 65, y: 148 }, { x: 1, y: 288 }, { y: 288, x: 129 }],
|
|
44
|
-
correct: true
|
|
45
|
-
}, {
|
|
46
|
-
// triangle
|
|
47
|
-
id: 'g74',
|
|
48
|
-
points: [{ y: 151, x: 141 }, { y: 289, x: 205 }, { x: 269, y: 151 }],
|
|
49
|
-
correct: false
|
|
50
|
-
}, {
|
|
51
|
-
// hexagon
|
|
52
|
-
id: 'j35',
|
|
53
|
-
points: [
|
|
54
|
-
{ x: 300, y: 150 },
|
|
55
|
-
{ x: 279, y: 220 },
|
|
56
|
-
{ x: 300, y: 289 },
|
|
57
|
-
{ x: 386, y: 289 },
|
|
58
|
-
{ x: 407, y: 220 },
|
|
59
|
-
{ x: 386, y: 150 }
|
|
60
|
-
],
|
|
61
|
-
correct: false
|
|
62
|
-
}]
|
|
63
79
|
},
|
|
64
80
|
rationale: null,
|
|
65
81
|
teacherInstructions: null,
|
|
66
82
|
toolbarEditorPosition: 'bottom',
|
|
67
|
-
prompt:
|
|
83
|
+
prompt:
|
|
84
|
+
'<div><audio controls="controls" src="https://storage.googleapis.com/pie-prod-221718-assets/audio/77f3f61e-5f2d-425f-80a5-fb814dfa5e4c"></audio><br><br>Choose ALL of the words with the long /o/ sound.</div>',
|
|
85
|
+
rubricEnabled: false,
|
|
68
86
|
});
|