@pie-element/hotspot 9.1.0 → 9.2.0-mui-update.0
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 +66 -0
- package/configure/CHANGELOG.md +66 -0
- package/configure/lib/DeleteWidget.js +31 -44
- package/configure/lib/DeleteWidget.js.map +1 -1
- package/configure/lib/__tests__/DeleteWidget.test.js +60 -0
- package/configure/lib/__tests__/hotspot-container.test.js +377 -0
- package/configure/lib/__tests__/hotspot-drawable.test.js +233 -0
- package/configure/lib/__tests__/index.test.js +211 -0
- package/configure/lib/__tests__/root.test.js +440 -0
- package/configure/lib/__tests__/utils.test.js +287 -0
- package/configure/lib/button.js +27 -46
- package/configure/lib/button.js.map +1 -1
- package/configure/lib/buttons/circle.js +21 -28
- package/configure/lib/buttons/circle.js.map +1 -1
- package/configure/lib/buttons/polygon.js +27 -34
- package/configure/lib/buttons/polygon.js.map +1 -1
- package/configure/lib/buttons/rectangle.js +27 -34
- package/configure/lib/buttons/rectangle.js.map +1 -1
- package/configure/lib/defaults.js +3 -4
- package/configure/lib/defaults.js.map +1 -1
- package/configure/lib/hotspot-circle.js +133 -199
- package/configure/lib/hotspot-circle.js.map +1 -1
- package/configure/lib/hotspot-container.js +251 -356
- package/configure/lib/hotspot-container.js.map +1 -1
- package/configure/lib/hotspot-drawable.js +361 -473
- package/configure/lib/hotspot-drawable.js.map +1 -1
- package/configure/lib/hotspot-palette.js +93 -140
- package/configure/lib/hotspot-palette.js.map +1 -1
- package/configure/lib/hotspot-polygon.js +213 -318
- package/configure/lib/hotspot-polygon.js.map +1 -1
- package/configure/lib/hotspot-rectangle.js +129 -193
- package/configure/lib/hotspot-rectangle.js.map +1 -1
- package/configure/lib/icons.js +1 -1
- package/configure/lib/icons.js.map +1 -1
- package/configure/lib/image-konva.js +47 -87
- package/configure/lib/image-konva.js.map +1 -1
- package/configure/lib/index.js +163 -223
- package/configure/lib/index.js.map +1 -1
- package/configure/lib/root.js +302 -394
- package/configure/lib/root.js.map +1 -1
- package/configure/lib/shapes/circle.js +70 -102
- package/configure/lib/shapes/circle.js.map +1 -1
- package/configure/lib/shapes/index.js +5 -13
- package/configure/lib/shapes/index.js.map +1 -1
- package/configure/lib/shapes/polygon.js +65 -97
- package/configure/lib/shapes/polygon.js.map +1 -1
- package/configure/lib/shapes/rectagle.js +70 -102
- package/configure/lib/shapes/rectagle.js.map +1 -1
- package/configure/lib/shapes/utils.js +3 -9
- package/configure/lib/shapes/utils.js.map +1 -1
- package/configure/lib/upload-control.js +26 -53
- package/configure/lib/upload-control.js.map +1 -1
- package/configure/lib/utils.js +85 -138
- package/configure/lib/utils.js.map +1 -1
- package/configure/package.json +11 -10
- package/configure/src/__tests__/index.test.js +11 -5
- package/configure/src/button.jsx +12 -20
- package/configure/src/hotspot-circle.jsx +5 -18
- package/configure/src/hotspot-container.jsx +82 -98
- package/configure/src/hotspot-drawable.jsx +43 -45
- package/configure/src/hotspot-palette.jsx +45 -37
- package/configure/src/hotspot-polygon.jsx +4 -20
- package/configure/src/hotspot-rectangle.jsx +4 -17
- package/configure/src/index.js +12 -2
- package/configure/src/root.jsx +85 -79
- package/configure/src/upload-control.jsx +6 -16
- package/controller/CHANGELOG.md +52 -0
- package/controller/lib/__tests__/index.test.js +586 -0
- package/controller/lib/__tests__/utils.test.js +8 -0
- package/controller/lib/defaults.js +3 -4
- package/controller/lib/defaults.js.map +1 -1
- package/controller/lib/index.js +152 -206
- package/controller/lib/index.js.map +1 -1
- package/controller/lib/utils.js +15 -35
- package/controller/lib/utils.js.map +1 -1
- package/controller/package.json +2 -2
- package/docs/demo/pie.manifest.json +11 -0
- package/lib/__tests__/container.test.js +221 -0
- package/lib/__tests__/index.test.js +113 -0
- package/lib/__tests__/polygon.test.js +245 -0
- package/lib/__tests__/rectangle.test.js +236 -0
- package/lib/__tests__/session-updater.test.js +69 -0
- package/lib/hotspot/circle.js +111 -170
- package/lib/hotspot/circle.js.map +1 -1
- package/lib/hotspot/container.js +175 -261
- package/lib/hotspot/container.js.map +1 -1
- package/lib/hotspot/icons.js +1 -1
- package/lib/hotspot/icons.js.map +1 -1
- package/lib/hotspot/image-konva-tooltip.js +66 -113
- package/lib/hotspot/image-konva-tooltip.js.map +1 -1
- package/lib/hotspot/index.js +136 -199
- package/lib/hotspot/index.js.map +1 -1
- package/lib/hotspot/polygon.js +151 -215
- package/lib/hotspot/polygon.js.map +1 -1
- package/lib/hotspot/rectangle.js +130 -186
- package/lib/hotspot/rectangle.js.map +1 -1
- package/lib/index.js +188 -257
- package/lib/index.js.map +1 -1
- package/lib/session-updater.js +13 -19
- package/lib/session-updater.js.map +1 -1
- package/package.json +14 -11
- package/src/hotspot/circle.jsx +2 -13
- package/src/hotspot/container.jsx +35 -50
- package/src/hotspot/index.jsx +16 -28
- package/src/hotspot/polygon.jsx +4 -13
- package/src/hotspot/rectangle.jsx +4 -13
- package/src/index.js +21 -12
- package/LICENSE.md +0 -5
- package/configure/node_modules/debug/CHANGELOG.md +0 -395
- package/configure/node_modules/debug/LICENSE +0 -19
- package/configure/node_modules/debug/README.md +0 -437
- package/configure/node_modules/debug/node.js +0 -1
- package/configure/node_modules/debug/package.json +0 -51
- package/configure/node_modules/debug/src/browser.js +0 -180
- package/configure/node_modules/debug/src/common.js +0 -249
- package/configure/node_modules/debug/src/index.js +0 -12
- package/configure/node_modules/debug/src/node.js +0 -177
package/configure/src/root.jsx
CHANGED
|
@@ -2,16 +2,56 @@ import React from 'react';
|
|
|
2
2
|
import { settings, layout, InputContainer, NumberTextField } from '@pie-lib/config-ui';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import EditableHtml from '@pie-lib/editable-html';
|
|
5
|
-
import {
|
|
6
|
-
import Typography from '@material
|
|
7
|
-
import Info from '@
|
|
8
|
-
import Tooltip from '@material
|
|
5
|
+
import { styled } from '@mui/material/styles';
|
|
6
|
+
import Typography from '@mui/material/Typography';
|
|
7
|
+
import Info from '@mui/icons-material/Info';
|
|
8
|
+
import Tooltip from '@mui/material/Tooltip';
|
|
9
9
|
import HotspotPalette from './hotspot-palette';
|
|
10
10
|
import HotspotContainer from './hotspot-container';
|
|
11
11
|
import { updateImageDimensions, generateValidationMessage, getUpdatedShapes, getAllShapes, groupShapes } from './utils';
|
|
12
12
|
|
|
13
13
|
const { Panel, toggle, dropdown } = settings;
|
|
14
14
|
|
|
15
|
+
const DimensionsContainer = styled('div')(({ theme }) => ({
|
|
16
|
+
display: 'flex',
|
|
17
|
+
marginBottom: theme.spacing(1.5),
|
|
18
|
+
}));
|
|
19
|
+
|
|
20
|
+
const FieldContainer = styled('div')({
|
|
21
|
+
flex: 1,
|
|
22
|
+
width: '90%',
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const PromptContainer = styled(InputContainer)(({ theme }) => ({
|
|
26
|
+
paddingTop: theme.spacing(1),
|
|
27
|
+
marginTop: theme.spacing(2),
|
|
28
|
+
marginBottom: theme.spacing(2),
|
|
29
|
+
width: '100%',
|
|
30
|
+
}));
|
|
31
|
+
|
|
32
|
+
const SubHeading = styled(Typography)(({ theme }) => ({
|
|
33
|
+
marginRight: theme.spacing(1),
|
|
34
|
+
}));
|
|
35
|
+
|
|
36
|
+
const FlexContainer = styled('div')({
|
|
37
|
+
display: 'flex',
|
|
38
|
+
alignItems: 'center',
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
const StyledTooltip = styled(Tooltip)(({ theme }) => ({
|
|
42
|
+
'& .MuiTooltip-tooltip': {
|
|
43
|
+
fontSize: theme.typography.fontSize - 2,
|
|
44
|
+
whiteSpace: 'pre',
|
|
45
|
+
maxWidth: '500px',
|
|
46
|
+
},
|
|
47
|
+
}));
|
|
48
|
+
|
|
49
|
+
const ErrorText = styled('div')(({ theme }) => ({
|
|
50
|
+
fontSize: theme.typography.fontSize - 2,
|
|
51
|
+
color: theme.palette.error.main,
|
|
52
|
+
paddingTop: theme.spacing(1),
|
|
53
|
+
}));
|
|
54
|
+
|
|
15
55
|
export class Root extends React.Component {
|
|
16
56
|
handleColorChange = (fieldType, color) => {
|
|
17
57
|
const { onColorChanged } = this.props;
|
|
@@ -49,7 +89,6 @@ export class Root extends React.Component {
|
|
|
49
89
|
|
|
50
90
|
render() {
|
|
51
91
|
const {
|
|
52
|
-
classes,
|
|
53
92
|
configuration,
|
|
54
93
|
model,
|
|
55
94
|
imageSupport,
|
|
@@ -144,7 +183,7 @@ export class Root extends React.Component {
|
|
|
144
183
|
}
|
|
145
184
|
>
|
|
146
185
|
{teacherInstructionsEnabled && (
|
|
147
|
-
<
|
|
186
|
+
<PromptContainer label={teacherInstructions.label}>
|
|
148
187
|
<EditableHtml
|
|
149
188
|
markup={model.teacherInstructions || ''}
|
|
150
189
|
onChange={onTeacherInstructionsChanged}
|
|
@@ -160,12 +199,12 @@ export class Root extends React.Component {
|
|
|
160
199
|
languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}
|
|
161
200
|
mathMlOptions={mathMlOptions}
|
|
162
201
|
/>
|
|
163
|
-
{teacherInstructionsError && <
|
|
164
|
-
</
|
|
202
|
+
{teacherInstructionsError && <ErrorText>{teacherInstructionsError}</ErrorText>}
|
|
203
|
+
</PromptContainer>
|
|
165
204
|
)}
|
|
166
205
|
|
|
167
206
|
{promptEnabled && (
|
|
168
|
-
<
|
|
207
|
+
<PromptContainer label={prompt.label}>
|
|
169
208
|
<EditableHtml
|
|
170
209
|
markup={model.prompt || ''}
|
|
171
210
|
onChange={onPromptChanged}
|
|
@@ -181,24 +220,23 @@ export class Root extends React.Component {
|
|
|
181
220
|
languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}
|
|
182
221
|
mathMlOptions={mathMlOptions}
|
|
183
222
|
/>
|
|
184
|
-
{promptError && <
|
|
185
|
-
</
|
|
223
|
+
{promptError && <ErrorText>{promptError}</ErrorText>}
|
|
224
|
+
</PromptContainer>
|
|
186
225
|
)}
|
|
187
226
|
|
|
188
|
-
<
|
|
189
|
-
<
|
|
227
|
+
<FlexContainer>
|
|
228
|
+
<SubHeading variant="h6">
|
|
190
229
|
Define Hotspot
|
|
191
|
-
</
|
|
192
|
-
<
|
|
193
|
-
classes={{ tooltip: classes.tooltip }}
|
|
230
|
+
</SubHeading>
|
|
231
|
+
<StyledTooltip
|
|
194
232
|
disableFocusListener
|
|
195
233
|
disableTouchListener
|
|
196
234
|
placement={'left'}
|
|
197
235
|
title={validationMessage}
|
|
198
236
|
>
|
|
199
237
|
<Info fontSize={'small'} color={'primary'} style={{ float: 'right' }} />
|
|
200
|
-
</
|
|
201
|
-
</
|
|
238
|
+
</StyledTooltip>
|
|
239
|
+
</FlexContainer>
|
|
202
240
|
|
|
203
241
|
<HotspotPalette
|
|
204
242
|
hotspotColor={model.hotspotColor}
|
|
@@ -226,39 +264,41 @@ export class Root extends React.Component {
|
|
|
226
264
|
preserveAspectRatioEnabled={preserveAspectRatio.enabled}
|
|
227
265
|
insertImage={imageSupport && imageSupport.add}
|
|
228
266
|
/>
|
|
229
|
-
{shapesError && <
|
|
230
|
-
{selectionsError && <
|
|
267
|
+
{shapesError && <ErrorText>{shapesError}</ErrorText>}
|
|
268
|
+
{selectionsError && <ErrorText>{selectionsError}</ErrorText>}
|
|
231
269
|
|
|
232
270
|
{model.imageUrl && (
|
|
233
271
|
<React.Fragment>
|
|
234
|
-
<Typography variant="
|
|
272
|
+
<Typography variant="h6">Image Dimensions</Typography>
|
|
235
273
|
|
|
236
|
-
<
|
|
237
|
-
<
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
274
|
+
<DimensionsContainer>
|
|
275
|
+
<FieldContainer>
|
|
276
|
+
<NumberTextField
|
|
277
|
+
key="hotspot-manual-width"
|
|
278
|
+
label="Width"
|
|
279
|
+
value={model.dimensions.width}
|
|
280
|
+
min={0}
|
|
281
|
+
onChange={(e, value) => this.handleOnUpdateImageDimensions(value, 'width')}
|
|
282
|
+
showErrorWhenOutsideRange
|
|
283
|
+
/>
|
|
284
|
+
</FieldContainer>
|
|
246
285
|
|
|
247
|
-
<
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
286
|
+
<FieldContainer>
|
|
287
|
+
<NumberTextField
|
|
288
|
+
key="hotspot-manual-height"
|
|
289
|
+
label="Height"
|
|
290
|
+
value={model.dimensions.height}
|
|
291
|
+
min={0}
|
|
292
|
+
onChange={(e, value) => this.handleOnUpdateImageDimensions(value, 'height')}
|
|
293
|
+
showErrorWhenOutsideRange
|
|
294
|
+
/>
|
|
295
|
+
</FieldContainer>
|
|
296
|
+
</DimensionsContainer>
|
|
257
297
|
</React.Fragment>
|
|
258
298
|
)}
|
|
259
299
|
|
|
260
300
|
{rationaleEnabled && (
|
|
261
|
-
<
|
|
301
|
+
<PromptContainer label={rationale.label}>
|
|
262
302
|
<EditableHtml
|
|
263
303
|
markup={model.rationale || ''}
|
|
264
304
|
onChange={onRationaleChanged}
|
|
@@ -273,49 +313,15 @@ export class Root extends React.Component {
|
|
|
273
313
|
languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}
|
|
274
314
|
mathMlOptions={mathMlOptions}
|
|
275
315
|
/>
|
|
276
|
-
{rationaleError && <
|
|
277
|
-
</
|
|
316
|
+
{rationaleError && <ErrorText>{rationaleError}</ErrorText>}
|
|
317
|
+
</PromptContainer>
|
|
278
318
|
)}
|
|
279
319
|
</layout.ConfigLayout>
|
|
280
320
|
);
|
|
281
321
|
}
|
|
282
322
|
}
|
|
283
323
|
|
|
284
|
-
const styles = (theme) => ({
|
|
285
|
-
dimensions: {
|
|
286
|
-
display: 'flex',
|
|
287
|
-
marginBottom: theme.spacing.unit * 1.5,
|
|
288
|
-
},
|
|
289
|
-
field: {
|
|
290
|
-
flex: 1,
|
|
291
|
-
width: '90%',
|
|
292
|
-
},
|
|
293
|
-
promptContainer: {
|
|
294
|
-
paddingTop: theme.spacing.unit * 2,
|
|
295
|
-
marginBottom: theme.spacing.unit * 2,
|
|
296
|
-
width: '100%',
|
|
297
|
-
},
|
|
298
|
-
subheading: {
|
|
299
|
-
marginRight: theme.spacing.unit,
|
|
300
|
-
},
|
|
301
|
-
flexContainer: {
|
|
302
|
-
display: 'flex',
|
|
303
|
-
alignItems: 'center',
|
|
304
|
-
},
|
|
305
|
-
tooltip: {
|
|
306
|
-
fontSize: theme.typography.fontSize - 2,
|
|
307
|
-
whiteSpace: 'pre',
|
|
308
|
-
maxWidth: '500px',
|
|
309
|
-
},
|
|
310
|
-
errorText: {
|
|
311
|
-
fontSize: theme.typography.fontSize - 2,
|
|
312
|
-
color: theme.palette.error.main,
|
|
313
|
-
paddingTop: theme.spacing.unit,
|
|
314
|
-
},
|
|
315
|
-
});
|
|
316
|
-
|
|
317
324
|
Root.propTypes = {
|
|
318
|
-
classes: PropTypes.object.isRequired,
|
|
319
325
|
configuration: PropTypes.object,
|
|
320
326
|
model: PropTypes.object.isRequired,
|
|
321
327
|
imageSupport: PropTypes.shape({
|
|
@@ -337,4 +343,4 @@ Root.propTypes = {
|
|
|
337
343
|
onTeacherInstructionsChanged: PropTypes.func.isRequired,
|
|
338
344
|
};
|
|
339
345
|
|
|
340
|
-
export default
|
|
346
|
+
export default Root;
|
|
@@ -1,34 +1,24 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { withStyles } from '@material-ui/core/styles/index';
|
|
4
3
|
|
|
5
4
|
import Button from './button';
|
|
6
5
|
|
|
7
|
-
const UploadControl = ({
|
|
8
|
-
|
|
9
|
-
<Button
|
|
6
|
+
const UploadControl = ({ label, onInputClick, onUploadImage, setRef }) => (
|
|
7
|
+
<>
|
|
8
|
+
<Button label={label} onClick={onInputClick} />
|
|
10
9
|
<input
|
|
11
10
|
accept="image/*"
|
|
12
|
-
|
|
11
|
+
style={{ display: 'none' }}
|
|
13
12
|
onChange={onUploadImage}
|
|
14
13
|
ref={(ref) => {
|
|
15
14
|
setRef(ref);
|
|
16
15
|
}}
|
|
17
16
|
type="file"
|
|
18
17
|
/>
|
|
19
|
-
|
|
18
|
+
</>
|
|
20
19
|
);
|
|
21
20
|
|
|
22
|
-
const styles = () => ({
|
|
23
|
-
input: {
|
|
24
|
-
display: 'none',
|
|
25
|
-
},
|
|
26
|
-
});
|
|
27
|
-
|
|
28
21
|
UploadControl.propTypes = {
|
|
29
|
-
classes: PropTypes.object.isRequired,
|
|
30
|
-
classNameButton: PropTypes.string,
|
|
31
|
-
classNameSection: PropTypes.string,
|
|
32
22
|
label: PropTypes.string.isRequired,
|
|
33
23
|
onInputClick: PropTypes.func.isRequired,
|
|
34
24
|
onUploadImage: PropTypes.func.isRequired,
|
|
@@ -40,4 +30,4 @@ UploadControl.defaultProps = {
|
|
|
40
30
|
classNameSection: '',
|
|
41
31
|
};
|
|
42
32
|
|
|
43
|
-
export default
|
|
33
|
+
export default UploadControl;
|
package/controller/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,58 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [6.3.3](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot-controller@6.3.2...@pie-element/hotspot-controller@6.3.3) (2025-11-27)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* bump libs PD-5274, PD-5211, PD-5248 ([7610b25](https://github.com/pie-framework/pie-elements/commit/7610b25423956b6492f33322513b3430051fca77))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [6.3.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot-controller@6.3.1...@pie-element/hotspot-controller@6.3.2) (2025-10-22)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* bump libs PD-5265 ([184a978](https://github.com/pie-framework/pie-elements/commit/184a978f57a2a84dc6ba87c1eba0b92d5cdd9eae))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
## [6.3.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot-controller@6.2.0...@pie-element/hotspot-controller@6.3.1) (2025-10-16)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### Bug Fixes
|
|
32
|
+
|
|
33
|
+
* bump pie-lib versions and pslb module versions ([393d39f](https://github.com/pie-framework/pie-elements/commit/393d39fb850ad055568f4d20464213e9043f208f))
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
# [6.3.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot-controller@6.2.0...@pie-element/hotspot-controller@6.3.0) (2025-10-15)
|
|
40
|
+
|
|
41
|
+
**Note:** Version bump only for package @pie-element/hotspot-controller
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
# [6.2.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot-controller@6.0.1...@pie-element/hotspot-controller@6.2.0) (2025-10-10)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
### Features
|
|
51
|
+
|
|
52
|
+
* update libs PD-5208, PD-5211, PD-5199, PD-5218, PD-5217 ([da327fa](https://github.com/pie-framework/pie-elements/commit/da327fa501f6e9eff1c0b30b5ef092426a91f78b))
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
6
58
|
# [6.1.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot-controller@6.0.0...@pie-element/hotspot-controller@6.1.0) (2025-10-07)
|
|
7
59
|
|
|
8
60
|
**Note:** Version bump only for package @pie-element/hotspot-controller
|