@pie-element/hotspot 11.1.6 → 11.2.0-beta.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 CHANGED
@@ -3,41 +3,25 @@
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
- ## [11.1.6](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot@11.1.5...@pie-element/hotspot@11.1.6) (2026-07-02)
7
-
8
- ### Bug Fixes
9
-
10
- - bump shared modules and libs PIE-695, PIE-697, PIE-699, PIE-680, PIE-714, PIE-665, PIE-656 ([4b76ae7](https://github.com/pie-framework/pie-elements/commit/4b76ae75d1c5ea6d55f7c6fb53f299dfcbda2b1f))
11
- - sync libs versions ([48b5be9](https://github.com/pie-framework/pie-elements/commit/48b5be9559eb5b5235ca05f51c5f0161032a7041))
12
-
13
- ## [11.1.5](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot@11.1.4...@pie-element/hotspot@11.1.5) (2026-06-22)
14
-
15
- ### Bug Fixes
16
-
17
- - bump shared modules and libs PIE-674, PIE-662, PIE-705, PIE-674, PIE-963 ([78a3f64](https://github.com/pie-framework/pie-elements/commit/78a3f64652c9581c61bd4159f3210fc1e32d8bcf))
18
- - handle webcomponent lifecycle on every element that misses it PIE-703 ([9d5923f](https://github.com/pie-framework/pie-elements/commit/9d5923f973f0471e1e8f69ad4309cfc63d980d93))
19
-
20
- ## [11.1.4](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot@11.1.3...@pie-element/hotspot@11.1.4) (2026-06-17)
6
+ # [11.2.0-beta.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot@11.1.0...@pie-element/hotspot@11.2.0-beta.0) (2026-08-07)
21
7
 
22
8
  ### Bug Fixes
23
9
 
10
+ - bump libs & shared modules PIE-706, PIE-702, PIE-679, PIE-698 ([5b1a8c4](https://github.com/pie-framework/pie-elements/commit/5b1a8c4c3eba2126fc43d78fd0187e7cd11d5424))
11
+ - bump shared modules and libs PIE-600, PIE-602 ([ce99f6a](https://github.com/pie-framework/pie-elements/commit/ce99f6af50cb855b666a6df9340f9f5445fde4c4))
24
12
  - bump shared modules and libs PIE-661 PIE-664 PIE-683 PIE-666 PIE-656 PIE-657 PIE-658 PIE-659 PIE-670 ([ebd6be4](https://github.com/pie-framework/pie-elements/commit/ebd6be4fd48fca41ad4c4908f606b25334731aed))
25
-
26
- ## [11.1.3](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot@11.1.2...@pie-element/hotspot@11.1.3) (2026-06-12)
27
-
28
- ### Bug Fixes
29
-
13
+ - bump shared modules and libs PIE-674, PIE-662, PIE-705, PIE-674, PIE-963 ([78a3f64](https://github.com/pie-framework/pie-elements/commit/78a3f64652c9581c61bd4159f3210fc1e32d8bcf))
14
+ - bump shared modules and libs PIE-695, PIE-697, PIE-699, PIE-680, PIE-714, PIE-665, PIE-656 ([4b76ae7](https://github.com/pie-framework/pie-elements/commit/4b76ae75d1c5ea6d55f7c6fb53f299dfcbda2b1f))
30
15
  - bump shared modules and libsPIE-603, PIE-604, PIE-663, PIE-662, PIE-678 ([e61c7a7](https://github.com/pie-framework/pie-elements/commit/e61c7a7d23744586337dfbb17a18ebfc656c202f))
16
+ - handle webcomponent lifecycle on every element that misses it PIE-703 ([9d5923f](https://github.com/pie-framework/pie-elements/commit/9d5923f973f0471e1e8f69ad4309cfc63d980d93))
17
+ - **hotspot:** improve hover effect handling PIE-783 ([b27c51f](https://github.com/pie-framework/pie-elements/commit/b27c51f77eb41f6a3aee1e87c85ea7c8769b542f))
18
+ - made sure math is rendered on mount and on updates in hotspot and text-select [PIE-718 ([fc55638](https://github.com/pie-framework/pie-elements/commit/fc55638a3b2cd7692c5f7212952d1d7baf36ff98))
19
+ - sync libs versions ([48b5be9](https://github.com/pie-framework/pie-elements/commit/48b5be9559eb5b5235ca05f51c5f0161032a7041))
31
20
 
32
- ## [11.1.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot@11.1.1...@pie-element/hotspot@11.1.2) (2026-06-04)
33
-
34
- ### Bug Fixes
35
-
36
- - bump shared modules and libs PIE-600, PIE-602 ([ce99f6a](https://github.com/pie-framework/pie-elements/commit/ce99f6af50cb855b666a6df9340f9f5445fde4c4))
37
-
38
- ## [11.1.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot@11.1.0...@pie-element/hotspot@11.1.1) (2026-05-21)
21
+ ### Features
39
22
 
40
- **Note:** Version bump only for package @pie-element/hotspot
23
+ - **hotspot:** add ariaLabel to shapes for improved accessibility PIE-639 ([8791de3](https://github.com/pie-framework/pie-elements/commit/8791de36640adc85a8cf43d095a092bce6d7e7a1))
24
+ - **hotspot:** enhance focus handling and default hover outline color PIE-637 PIE-640 ([249d6e9](https://github.com/pie-framework/pie-elements/commit/249d6e9ae2da47a008ea0b5d73f34b64fd451795))
41
25
 
42
26
  # [11.1.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot@11.1.0-next.1...@pie-element/hotspot@11.1.0) (2026-05-21)
43
27
 
@@ -3,41 +3,22 @@
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
- ## [10.1.6](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot-configure@10.1.5...@pie-element/hotspot-configure@10.1.6) (2026-07-02)
7
-
8
- ### Bug Fixes
9
-
10
- - bump shared modules and libs PIE-695, PIE-697, PIE-699, PIE-680, PIE-714, PIE-665, PIE-656 ([4b76ae7](https://github.com/pie-framework/pie-elements/commit/4b76ae75d1c5ea6d55f7c6fb53f299dfcbda2b1f))
11
- - sync libs versions ([48b5be9](https://github.com/pie-framework/pie-elements/commit/48b5be9559eb5b5235ca05f51c5f0161032a7041))
12
-
13
- ## [10.1.5](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot-configure@10.1.4...@pie-element/hotspot-configure@10.1.5) (2026-06-22)
14
-
15
- ### Bug Fixes
16
-
17
- - bump shared modules and libs PIE-674, PIE-662, PIE-705, PIE-674, PIE-963 ([78a3f64](https://github.com/pie-framework/pie-elements/commit/78a3f64652c9581c61bd4159f3210fc1e32d8bcf))
18
- - handle webcomponent lifecycle on every element that misses it PIE-703 ([9d5923f](https://github.com/pie-framework/pie-elements/commit/9d5923f973f0471e1e8f69ad4309cfc63d980d93))
19
-
20
- ## [10.1.4](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot-configure@10.1.3...@pie-element/hotspot-configure@10.1.4) (2026-06-17)
6
+ # [10.2.0-beta.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot-configure@10.1.0...@pie-element/hotspot-configure@10.2.0-beta.0) (2026-08-07)
21
7
 
22
8
  ### Bug Fixes
23
9
 
10
+ - bump libs & shared modules PIE-706, PIE-702, PIE-679, PIE-698 ([5b1a8c4](https://github.com/pie-framework/pie-elements/commit/5b1a8c4c3eba2126fc43d78fd0187e7cd11d5424))
11
+ - bump shared modules and libs PIE-600, PIE-602 ([ce99f6a](https://github.com/pie-framework/pie-elements/commit/ce99f6af50cb855b666a6df9340f9f5445fde4c4))
24
12
  - bump shared modules and libs PIE-661 PIE-664 PIE-683 PIE-666 PIE-656 PIE-657 PIE-658 PIE-659 PIE-670 ([ebd6be4](https://github.com/pie-framework/pie-elements/commit/ebd6be4fd48fca41ad4c4908f606b25334731aed))
25
-
26
- ## [10.1.3](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot-configure@10.1.2...@pie-element/hotspot-configure@10.1.3) (2026-06-12)
27
-
28
- ### Bug Fixes
29
-
13
+ - bump shared modules and libs PIE-674, PIE-662, PIE-705, PIE-674, PIE-963 ([78a3f64](https://github.com/pie-framework/pie-elements/commit/78a3f64652c9581c61bd4159f3210fc1e32d8bcf))
14
+ - bump shared modules and libs PIE-695, PIE-697, PIE-699, PIE-680, PIE-714, PIE-665, PIE-656 ([4b76ae7](https://github.com/pie-framework/pie-elements/commit/4b76ae75d1c5ea6d55f7c6fb53f299dfcbda2b1f))
30
15
  - bump shared modules and libsPIE-603, PIE-604, PIE-663, PIE-662, PIE-678 ([e61c7a7](https://github.com/pie-framework/pie-elements/commit/e61c7a7d23744586337dfbb17a18ebfc656c202f))
16
+ - handle webcomponent lifecycle on every element that misses it PIE-703 ([9d5923f](https://github.com/pie-framework/pie-elements/commit/9d5923f973f0471e1e8f69ad4309cfc63d980d93))
17
+ - sync libs versions ([48b5be9](https://github.com/pie-framework/pie-elements/commit/48b5be9559eb5b5235ca05f51c5f0161032a7041))
31
18
 
32
- ## [10.1.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot-configure@10.1.1...@pie-element/hotspot-configure@10.1.2) (2026-06-04)
33
-
34
- ### Bug Fixes
35
-
36
- - bump shared modules and libs PIE-600, PIE-602 ([ce99f6a](https://github.com/pie-framework/pie-elements/commit/ce99f6af50cb855b666a6df9340f9f5445fde4c4))
37
-
38
- ## [10.1.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot-configure@10.1.0...@pie-element/hotspot-configure@10.1.1) (2026-05-21)
19
+ ### Features
39
20
 
40
- **Note:** Version bump only for package @pie-element/hotspot-configure
21
+ - **hotspot:** enhance focus handling and default hover outline color PIE-637 PIE-640 ([249d6e9](https://github.com/pie-framework/pie-elements/commit/249d6e9ae2da47a008ea0b5d73f34b64fd451795))
41
22
 
42
23
  # [10.1.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot-configure@10.1.0-next.1...@pie-element/hotspot-configure@10.1.0) (2026-05-21)
43
24
 
@@ -22,6 +22,7 @@ const {
22
22
  toggle,
23
23
  dropdown
24
24
  } = _configUi.settings;
25
+ const checkNullish = value => value !== null && value !== undefined;
25
26
  const DimensionsContainer = (0, _styles.styled)('div')(({
26
27
  theme
27
28
  }) => ({
@@ -258,7 +259,7 @@ class Root extends _react.default.Component {
258
259
  hotspotColor: model.hotspotColor,
259
260
  outlineColor: model.outlineColor,
260
261
  selectedHotspotColor: model.selectedHotspotColor,
261
- hoverOutlineColor: model.hoverOutlineColor,
262
+ hoverOutlineColor: checkNullish(model.hoverOutlineColor) ? model.hoverOutlineColor : 'black',
262
263
  onUpdateImageDimension: onUpdateImageDimension,
263
264
  onUpdateShapes: onUpdateShapes,
264
265
  onImageUpload: onImageUpload,
@@ -1 +1 @@
1
- {"version":3,"file":"root.js","names":["_react","_interopRequireDefault","require","_configUi","_propTypes","_editableHtmlTipTap","_styles","_Typography","_Info","_Tooltip","_hotspotPalette","_hotspotContainer","_utils","Panel","toggle","dropdown","settings","DimensionsContainer","styled","theme","display","marginBottom","spacing","FieldContainer","flex","width","PromptContainer","InputContainer","paddingTop","marginTop","SubHeading","Typography","marginRight","FlexContainer","alignItems","StyledTooltip","Tooltip","fontSize","typography","whiteSpace","maxWidth","ErrorText","color","palette","error","main","Root","React","Component","constructor","args","_defineProperty2","default","fieldType","onColorChanged","props","cType","value","resizeType","model","dimensions","shapes","configuration","preserveAspectRatio","onUpdateImageDimension","onUpdateShapes","nextImageDimensions","updatedDimensions","updateImageDimensions","enabled","shapesArray","getAllShapes","updatedShapes","getUpdatedShapes","groupShapes","render","imageSupport","uploadSoundSupport","onConfigurationChanged","onImageUpload","onModelChangedByConfig","onPromptChanged","onRationaleChanged","onTeacherInstructionsChanged","baseInputConfiguration","contentDimensions","maxImageWidth","maxImageHeight","multipleCorrect","partialScoring","prompt","rationale","settingsPanelDisabled","spellCheck","teacherInstructions","withRubric","mathMlOptions","language","languageChoices","errors","extraCSSRules","promptEnabled","rationaleEnabled","spellCheckEnabled","teacherInstructionsEnabled","toolbarEditorPosition","promptError","rationaleError","shapesError","selections","selectionsError","teacherInstructionsError","validationMessage","generateValidationMessage","defaultImageMaxWidth","defaultImageMaxHeight","toolbarOpts","position","panelSettings","label","options","panelProperties","rubricEnabled","getPluginProps","createElement","layout","ConfigLayout","hideSettings","onChangeModel","onChangeConfiguration","groups","Settings","Properties","markup","onChange","nonEmpty","pluginProps","inputConfiguration","languageCharactersProps","variant","disableFocusListener","disableTouchListener","placement","title","style","float","hotspotColor","hotspotList","outlineColor","outlineList","onHotspotColorChange","handleColorChange","onOutlineColorChange","imageUrl","hasErrors","selectedHotspotColor","hoverOutlineColor","strokeWidth","preserveAspectRatioEnabled","insertImage","add","Fragment","NumberTextField","key","min","e","handleOnUpdateImageDimensions","showErrorWhenOutsideRange","height","exports","propTypes","PropTypes","object","isRequired","shape","func","delete","_default"],"sources":["../src/root.jsx"],"sourcesContent":["import React from 'react';\nimport { settings, layout, InputContainer, NumberTextField } from '@pie-lib/config-ui';\nimport PropTypes from 'prop-types';\nimport EditableHtml from '@pie-lib/editable-html-tip-tap';\nimport { styled } from '@mui/material/styles';\nimport Typography from '@mui/material/Typography';\nimport Info from '@mui/icons-material/Info';\nimport Tooltip from '@mui/material/Tooltip';\nimport HotspotPalette from './hotspot-palette';\nimport HotspotContainer from './hotspot-container';\nimport { updateImageDimensions, generateValidationMessage, getUpdatedShapes, getAllShapes, groupShapes } from './utils';\n\nconst { Panel, toggle, dropdown } = settings;\n\nconst DimensionsContainer = styled('div')(({ theme }) => ({\n display: 'flex',\n marginBottom: theme.spacing(1.5),\n}));\n\nconst FieldContainer = styled('div')({\n flex: 1,\n width: '90%',\n});\n\nconst PromptContainer = styled(InputContainer)(({ theme }) => ({\n paddingTop: theme.spacing(1),\n marginTop: theme.spacing(2),\n marginBottom: theme.spacing(2),\n width: '100%',\n}));\n\nconst SubHeading = styled(Typography)(({ theme }) => ({\n marginRight: theme.spacing(1),\n}));\n\nconst FlexContainer = styled('div')({\n display: 'flex',\n alignItems: 'center',\n});\n\nconst StyledTooltip = styled(Tooltip)(({ theme }) => ({\n '& .MuiTooltip-tooltip': {\n fontSize: theme.typography.fontSize - 2,\n whiteSpace: 'pre',\n maxWidth: '500px',\n },\n}));\n\nconst ErrorText = styled('div')(({ theme }) => ({\n fontSize: theme.typography.fontSize - 2,\n color: theme.palette.error.main,\n paddingTop: theme.spacing(1),\n}));\n\nexport class Root extends React.Component {\n handleColorChange = (fieldType, color) => {\n const { onColorChanged } = this.props;\n const cType = `${fieldType}Color`;\n\n onColorChanged(cType, color);\n };\n\n handleOnUpdateImageDimensions = (value, resizeType) => {\n const {\n model: { dimensions, shapes },\n configuration: { preserveAspectRatio = {} },\n onUpdateImageDimension,\n onUpdateShapes,\n } = this.props;\n\n const nextImageDimensions = { ...dimensions, [resizeType]: value };\n\n // if preserveAspectRatio.enabled, updateImageDimensions function makes sure aspect ratio is kept\n const updatedDimensions = updateImageDimensions(\n dimensions,\n nextImageDimensions,\n preserveAspectRatio.enabled,\n resizeType,\n );\n // transform shapes map into shapes array\n const shapesArray = getAllShapes(shapes);\n // transform all the shapes to fit the re-sized image\n const updatedShapes = getUpdatedShapes(dimensions, updatedDimensions, shapesArray);\n // transform shapes array back into shapes map\n\n onUpdateShapes(groupShapes(updatedShapes));\n onUpdateImageDimension(updatedDimensions);\n };\n\n render() {\n const {\n configuration,\n model,\n imageSupport,\n uploadSoundSupport,\n onConfigurationChanged,\n onImageUpload,\n onModelChangedByConfig,\n onPromptChanged,\n onRationaleChanged,\n onUpdateImageDimension,\n onTeacherInstructionsChanged,\n onUpdateShapes,\n } = this.props;\n const {\n baseInputConfiguration = {},\n contentDimensions = {},\n maxImageWidth = {},\n maxImageHeight = {},\n multipleCorrect = {},\n partialScoring = {},\n preserveAspectRatio = {},\n prompt = {},\n rationale = {},\n settingsPanelDisabled,\n spellCheck = {},\n teacherInstructions = {},\n withRubric = {},\n mathMlOptions = {},\n language = {},\n languageChoices = {},\n } = configuration || {};\n const {\n errors,\n extraCSSRules,\n promptEnabled,\n rationaleEnabled,\n spellCheckEnabled,\n teacherInstructionsEnabled,\n toolbarEditorPosition,\n } = model || {};\n const {\n prompt: promptError,\n rationale: rationaleError,\n shapes: shapesError,\n selections: selectionsError,\n teacherInstructions: teacherInstructionsError,\n } = errors || {};\n const validationMessage = generateValidationMessage(configuration);\n\n const defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;\n const defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;\n\n const toolbarOpts = {\n position: toolbarEditorPosition === 'top' ? 'top' : 'bottom',\n };\n\n const panelSettings = {\n multipleCorrect: multipleCorrect.settings && toggle(multipleCorrect.label),\n partialScoring: partialScoring.settings && toggle(partialScoring.label),\n promptEnabled: prompt.settings && toggle(prompt.label),\n 'language.enabled': language.settings && toggle(language.label, true),\n language: language.settings && language.enabled && dropdown(languageChoices.label, languageChoices.options),\n };\n const panelProperties = {\n teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),\n rationaleEnabled: rationale.settings && toggle(rationale.label),\n spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),\n rubricEnabled: withRubric?.settings && toggle(withRubric?.label),\n };\n\n const getPluginProps = (props = {}) => ({\n ...baseInputConfiguration,\n ...props,\n });\n\n return (\n <layout.ConfigLayout\n extraCSSRules={extraCSSRules}\n dimensions={contentDimensions}\n hideSettings={settingsPanelDisabled}\n settings={\n <Panel\n model={model}\n onChangeModel={onModelChangedByConfig}\n configuration={configuration}\n onChangeConfiguration={onConfigurationChanged}\n groups={{\n Settings: panelSettings,\n Properties: panelProperties,\n }}\n />\n }\n >\n {teacherInstructionsEnabled && (\n <PromptContainer label={teacherInstructions.label}>\n <EditableHtml\n markup={model.teacherInstructions || ''}\n onChange={onTeacherInstructionsChanged}\n imageSupport={imageSupport}\n nonEmpty={false}\n error={teacherInstructionsError}\n toolbarOpts={toolbarOpts}\n pluginProps={getPluginProps(teacherInstructions?.inputConfiguration)}\n spellCheck={spellCheckEnabled}\n maxImageWidth={(maxImageWidth && maxImageWidth.teacherInstructions) || defaultImageMaxWidth}\n maxImageHeight={(maxImageHeight && maxImageHeight.teacherInstructions) || defaultImageMaxHeight}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n mathMlOptions={mathMlOptions}\n />\n {teacherInstructionsError && <ErrorText>{teacherInstructionsError}</ErrorText>}\n </PromptContainer>\n )}\n\n {promptEnabled && (\n <PromptContainer label={prompt.label}>\n <EditableHtml\n markup={model.prompt || ''}\n onChange={onPromptChanged}\n imageSupport={imageSupport}\n nonEmpty={false}\n error={promptError}\n toolbarOpts={toolbarOpts}\n pluginProps={getPluginProps(prompt?.inputConfiguration)}\n spellCheck={spellCheckEnabled}\n maxImageWidth={defaultImageMaxWidth}\n maxImageHeight={defaultImageMaxHeight}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n mathMlOptions={mathMlOptions}\n />\n {promptError && <ErrorText>{promptError}</ErrorText>}\n </PromptContainer>\n )}\n\n <FlexContainer>\n <SubHeading variant=\"h6\">\n Define Hotspot\n </SubHeading>\n <StyledTooltip\n disableFocusListener\n disableTouchListener\n placement={'left'}\n title={validationMessage}\n >\n <Info fontSize={'small'} color={'primary'} style={{ float: 'right' }} />\n </StyledTooltip>\n </FlexContainer>\n\n <HotspotPalette\n hotspotColor={model.hotspotColor}\n hotspotList={model.hotspotList}\n outlineColor={model.outlineColor}\n outlineList={model.outlineList}\n onHotspotColorChange={(color) => this.handleColorChange('hotspot', color)}\n onOutlineColorChange={(color) => this.handleColorChange('outline', color)}\n />\n\n <HotspotContainer\n dimensions={model.dimensions}\n imageUrl={model.imageUrl}\n multipleCorrect={model.multipleCorrect}\n hasErrors={!!shapesError || !!selectionsError}\n hotspotColor={model.hotspotColor}\n outlineColor={model.outlineColor}\n selectedHotspotColor={model.selectedHotspotColor}\n hoverOutlineColor={model.hoverOutlineColor}\n onUpdateImageDimension={onUpdateImageDimension}\n onUpdateShapes={onUpdateShapes}\n onImageUpload={onImageUpload}\n shapes={model.shapes}\n strokeWidth={model.strokeWidth}\n preserveAspectRatioEnabled={preserveAspectRatio.enabled}\n insertImage={imageSupport && imageSupport.add}\n />\n {shapesError && <ErrorText>{shapesError}</ErrorText>}\n {selectionsError && <ErrorText>{selectionsError}</ErrorText>}\n\n {model.imageUrl && (\n <React.Fragment>\n <Typography variant=\"h6\">Image Dimensions</Typography>\n\n <DimensionsContainer>\n <FieldContainer>\n <NumberTextField\n key=\"hotspot-manual-width\"\n label=\"Width\"\n value={model.dimensions.width}\n min={0}\n onChange={(e, value) => this.handleOnUpdateImageDimensions(value, 'width')}\n showErrorWhenOutsideRange\n />\n </FieldContainer>\n\n <FieldContainer>\n <NumberTextField\n key=\"hotspot-manual-height\"\n label=\"Height\"\n value={model.dimensions.height}\n min={0}\n onChange={(e, value) => this.handleOnUpdateImageDimensions(value, 'height')}\n showErrorWhenOutsideRange\n />\n </FieldContainer>\n </DimensionsContainer>\n </React.Fragment>\n )}\n\n {rationaleEnabled && (\n <PromptContainer label={rationale.label}>\n <EditableHtml\n markup={model.rationale || ''}\n onChange={onRationaleChanged}\n imageSupport={imageSupport}\n error={rationaleError}\n toolbarOpts={toolbarOpts}\n pluginProps={getPluginProps(rationale?.inputConfiguration)}\n spellCheck={spellCheckEnabled}\n maxImageWidth={(maxImageWidth && maxImageWidth.rationale) || defaultImageMaxWidth}\n maxImageHeight={(maxImageHeight && maxImageHeight.rationale) || defaultImageMaxHeight}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n mathMlOptions={mathMlOptions}\n />\n {rationaleError && <ErrorText>{rationaleError}</ErrorText>}\n </PromptContainer>\n )}\n </layout.ConfigLayout>\n );\n }\n}\n\nRoot.propTypes = {\n configuration: PropTypes.object,\n model: PropTypes.object.isRequired,\n imageSupport: PropTypes.shape({\n add: PropTypes.func,\n delete: PropTypes.func,\n }),\n uploadSoundSupport: PropTypes.shape({\n add: PropTypes.func,\n delete: PropTypes.func,\n }),\n onImageUpload: PropTypes.func.isRequired,\n onColorChanged: PropTypes.func.isRequired,\n onPromptChanged: PropTypes.func.isRequired,\n onUpdateImageDimension: PropTypes.func.isRequired,\n onUpdateShapes: PropTypes.func.isRequired,\n onModelChangedByConfig: PropTypes.func.isRequired,\n onRationaleChanged: PropTypes.func.isRequired,\n onConfigurationChanged: PropTypes.func.isRequired,\n onTeacherInstructionsChanged: PropTypes.func.isRequired,\n};\n\nexport default Root;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,mBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,KAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,QAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,eAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,iBAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AAEA,MAAM;EAAEW,KAAK;EAAEC,MAAM;EAAEC;AAAS,CAAC,GAAGC,kBAAQ;AAE5C,MAAMC,mBAAmB,GAAG,IAAAC,cAAM,EAAC,KAAK,CAAC,CAAC,CAAC;EAAEC;AAAM,CAAC,MAAM;EACxDC,OAAO,EAAE,MAAM;EACfC,YAAY,EAAEF,KAAK,CAACG,OAAO,CAAC,GAAG;AACjC,CAAC,CAAC,CAAC;AAEH,MAAMC,cAAc,GAAG,IAAAL,cAAM,EAAC,KAAK,CAAC,CAAC;EACnCM,IAAI,EAAE,CAAC;EACPC,KAAK,EAAE;AACT,CAAC,CAAC;AAEF,MAAMC,eAAe,GAAG,IAAAR,cAAM,EAACS,wBAAc,CAAC,CAAC,CAAC;EAAER;AAAM,CAAC,MAAM;EAC7DS,UAAU,EAAET,KAAK,CAACG,OAAO,CAAC,CAAC,CAAC;EAC5BO,SAAS,EAAEV,KAAK,CAACG,OAAO,CAAC,CAAC,CAAC;EAC3BD,YAAY,EAAEF,KAA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F,UAAU;EACxCvH,cAAc,EAAEqH,kBAAS,CAACI,IAAI,CAACF,UAAU;EACzC5F,eAAe,EAAE0F,kBAAS,CAACI,IAAI,CAACF,UAAU;EAC1C7G,sBAAsB,EAAE2G,kBAAS,CAACI,IAAI,CAACF,UAAU;EACjD5G,cAAc,EAAE0G,kBAAS,CAACI,IAAI,CAACF,UAAU;EACzC7F,sBAAsB,EAAE2F,kBAAS,CAACI,IAAI,CAACF,UAAU;EACjD3F,kBAAkB,EAAEyF,kBAAS,CAACI,IAAI,CAACF,UAAU;EAC7C/F,sBAAsB,EAAE6F,kBAAS,CAACI,IAAI,CAACF,UAAU;EACjD1F,4BAA4B,EAAEwF,kBAAS,CAACI,IAAI,CAACF;AAC/C,CAAC;AAAC,IAAAI,QAAA,GAAAR,OAAA,CAAArH,OAAA,GAEaN,IAAI","ignoreList":[]}
1
+ {"version":3,"file":"root.js","names":["_react","_interopRequireDefault","require","_configUi","_propTypes","_editableHtmlTipTap","_styles","_Typography","_Info","_Tooltip","_hotspotPalette","_hotspotContainer","_utils","Panel","toggle","dropdown","settings","checkNullish","value","undefined","DimensionsContainer","styled","theme","display","marginBottom","spacing","FieldContainer","flex","width","PromptContainer","InputContainer","paddingTop","marginTop","SubHeading","Typography","marginRight","FlexContainer","alignItems","StyledTooltip","Tooltip","fontSize","typography","whiteSpace","maxWidth","ErrorText","color","palette","error","main","Root","React","Component","constructor","args","_defineProperty2","default","fieldType","onColorChanged","props","cType","resizeType","model","dimensions","shapes","configuration","preserveAspectRatio","onUpdateImageDimension","onUpdateShapes","nextImageDimensions","updatedDimensions","updateImageDimensions","enabled","shapesArray","getAllShapes","updatedShapes","getUpdatedShapes","groupShapes","render","imageSupport","uploadSoundSupport","onConfigurationChanged","onImageUpload","onModelChangedByConfig","onPromptChanged","onRationaleChanged","onTeacherInstructionsChanged","baseInputConfiguration","contentDimensions","maxImageWidth","maxImageHeight","multipleCorrect","partialScoring","prompt","rationale","settingsPanelDisabled","spellCheck","teacherInstructions","withRubric","mathMlOptions","language","languageChoices","errors","extraCSSRules","promptEnabled","rationaleEnabled","spellCheckEnabled","teacherInstructionsEnabled","toolbarEditorPosition","promptError","rationaleError","shapesError","selections","selectionsError","teacherInstructionsError","validationMessage","generateValidationMessage","defaultImageMaxWidth","defaultImageMaxHeight","toolbarOpts","position","panelSettings","label","options","panelProperties","rubricEnabled","getPluginProps","createElement","layout","ConfigLayout","hideSettings","onChangeModel","onChangeConfiguration","groups","Settings","Properties","markup","onChange","nonEmpty","pluginProps","inputConfiguration","languageCharactersProps","variant","disableFocusListener","disableTouchListener","placement","title","style","float","hotspotColor","hotspotList","outlineColor","outlineList","onHotspotColorChange","handleColorChange","onOutlineColorChange","imageUrl","hasErrors","selectedHotspotColor","hoverOutlineColor","strokeWidth","preserveAspectRatioEnabled","insertImage","add","Fragment","NumberTextField","key","min","e","handleOnUpdateImageDimensions","showErrorWhenOutsideRange","height","exports","propTypes","PropTypes","object","isRequired","shape","func","delete","_default"],"sources":["../src/root.jsx"],"sourcesContent":["import React from 'react';\nimport { settings, layout, InputContainer, NumberTextField } from '@pie-lib/config-ui';\nimport PropTypes from 'prop-types';\nimport EditableHtml from '@pie-lib/editable-html-tip-tap';\nimport { styled } from '@mui/material/styles';\nimport Typography from '@mui/material/Typography';\nimport Info from '@mui/icons-material/Info';\nimport Tooltip from '@mui/material/Tooltip';\nimport HotspotPalette from './hotspot-palette';\nimport HotspotContainer from './hotspot-container';\nimport { updateImageDimensions, generateValidationMessage, getUpdatedShapes, getAllShapes, groupShapes } from './utils';\n\nconst { Panel, toggle, dropdown } = settings;\n\nconst checkNullish = (value) => value !== null && value !== undefined;\n\nconst DimensionsContainer = styled('div')(({ theme }) => ({\n display: 'flex',\n marginBottom: theme.spacing(1.5),\n}));\n\nconst FieldContainer = styled('div')({\n flex: 1,\n width: '90%',\n});\n\nconst PromptContainer = styled(InputContainer)(({ theme }) => ({\n paddingTop: theme.spacing(1),\n marginTop: theme.spacing(2),\n marginBottom: theme.spacing(2),\n width: '100%',\n}));\n\nconst SubHeading = styled(Typography)(({ theme }) => ({\n marginRight: theme.spacing(1),\n}));\n\nconst FlexContainer = styled('div')({\n display: 'flex',\n alignItems: 'center',\n});\n\nconst StyledTooltip = styled(Tooltip)(({ theme }) => ({\n '& .MuiTooltip-tooltip': {\n fontSize: theme.typography.fontSize - 2,\n whiteSpace: 'pre',\n maxWidth: '500px',\n },\n}));\n\nconst ErrorText = styled('div')(({ theme }) => ({\n fontSize: theme.typography.fontSize - 2,\n color: theme.palette.error.main,\n paddingTop: theme.spacing(1),\n}));\n\nexport class Root extends React.Component {\n handleColorChange = (fieldType, color) => {\n const { onColorChanged } = this.props;\n const cType = `${fieldType}Color`;\n\n onColorChanged(cType, color);\n };\n\n handleOnUpdateImageDimensions = (value, resizeType) => {\n const {\n model: { dimensions, shapes },\n configuration: { preserveAspectRatio = {} },\n onUpdateImageDimension,\n onUpdateShapes,\n } = this.props;\n\n const nextImageDimensions = { ...dimensions, [resizeType]: value };\n\n // if preserveAspectRatio.enabled, updateImageDimensions function makes sure aspect ratio is kept\n const updatedDimensions = updateImageDimensions(\n dimensions,\n nextImageDimensions,\n preserveAspectRatio.enabled,\n resizeType,\n );\n // transform shapes map into shapes array\n const shapesArray = getAllShapes(shapes);\n // transform all the shapes to fit the re-sized image\n const updatedShapes = getUpdatedShapes(dimensions, updatedDimensions, shapesArray);\n // transform shapes array back into shapes map\n\n onUpdateShapes(groupShapes(updatedShapes));\n onUpdateImageDimension(updatedDimensions);\n };\n\n render() {\n const {\n configuration,\n model,\n imageSupport,\n uploadSoundSupport,\n onConfigurationChanged,\n onImageUpload,\n onModelChangedByConfig,\n onPromptChanged,\n onRationaleChanged,\n onUpdateImageDimension,\n onTeacherInstructionsChanged,\n onUpdateShapes,\n } = this.props;\n const {\n baseInputConfiguration = {},\n contentDimensions = {},\n maxImageWidth = {},\n maxImageHeight = {},\n multipleCorrect = {},\n partialScoring = {},\n preserveAspectRatio = {},\n prompt = {},\n rationale = {},\n settingsPanelDisabled,\n spellCheck = {},\n teacherInstructions = {},\n withRubric = {},\n mathMlOptions = {},\n language = {},\n languageChoices = {},\n } = configuration || {};\n const {\n errors,\n extraCSSRules,\n promptEnabled,\n rationaleEnabled,\n spellCheckEnabled,\n teacherInstructionsEnabled,\n toolbarEditorPosition,\n } = model || {};\n const {\n prompt: promptError,\n rationale: rationaleError,\n shapes: shapesError,\n selections: selectionsError,\n teacherInstructions: teacherInstructionsError,\n } = errors || {};\n const validationMessage = generateValidationMessage(configuration);\n\n const defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;\n const defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;\n\n const toolbarOpts = {\n position: toolbarEditorPosition === 'top' ? 'top' : 'bottom',\n };\n\n const panelSettings = {\n multipleCorrect: multipleCorrect.settings && toggle(multipleCorrect.label),\n partialScoring: partialScoring.settings && toggle(partialScoring.label),\n promptEnabled: prompt.settings && toggle(prompt.label),\n 'language.enabled': language.settings && toggle(language.label, true),\n language: language.settings && language.enabled && dropdown(languageChoices.label, languageChoices.options),\n };\n const panelProperties = {\n teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),\n rationaleEnabled: rationale.settings && toggle(rationale.label),\n spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),\n rubricEnabled: withRubric?.settings && toggle(withRubric?.label),\n };\n\n const getPluginProps = (props = {}) => ({\n ...baseInputConfiguration,\n ...props,\n });\n\n\n return (\n <layout.ConfigLayout\n extraCSSRules={extraCSSRules}\n dimensions={contentDimensions}\n hideSettings={settingsPanelDisabled}\n settings={\n <Panel\n model={model}\n onChangeModel={onModelChangedByConfig}\n configuration={configuration}\n onChangeConfiguration={onConfigurationChanged}\n groups={{\n Settings: panelSettings,\n Properties: panelProperties,\n }}\n />\n }\n >\n {teacherInstructionsEnabled && (\n <PromptContainer label={teacherInstructions.label}>\n <EditableHtml\n markup={model.teacherInstructions || ''}\n onChange={onTeacherInstructionsChanged}\n imageSupport={imageSupport}\n nonEmpty={false}\n error={teacherInstructionsError}\n toolbarOpts={toolbarOpts}\n pluginProps={getPluginProps(teacherInstructions?.inputConfiguration)}\n spellCheck={spellCheckEnabled}\n maxImageWidth={(maxImageWidth && maxImageWidth.teacherInstructions) || defaultImageMaxWidth}\n maxImageHeight={(maxImageHeight && maxImageHeight.teacherInstructions) || defaultImageMaxHeight}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n mathMlOptions={mathMlOptions}\n />\n {teacherInstructionsError && <ErrorText>{teacherInstructionsError}</ErrorText>}\n </PromptContainer>\n )}\n\n {promptEnabled && (\n <PromptContainer label={prompt.label}>\n <EditableHtml\n markup={model.prompt || ''}\n onChange={onPromptChanged}\n imageSupport={imageSupport}\n nonEmpty={false}\n error={promptError}\n toolbarOpts={toolbarOpts}\n pluginProps={getPluginProps(prompt?.inputConfiguration)}\n spellCheck={spellCheckEnabled}\n maxImageWidth={defaultImageMaxWidth}\n maxImageHeight={defaultImageMaxHeight}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n mathMlOptions={mathMlOptions}\n />\n {promptError && <ErrorText>{promptError}</ErrorText>}\n </PromptContainer>\n )}\n\n <FlexContainer>\n <SubHeading variant=\"h6\">Define Hotspot</SubHeading>\n <StyledTooltip disableFocusListener disableTouchListener placement={'left'} title={validationMessage}>\n <Info fontSize={'small'} color={'primary'} style={{ float: 'right' }} />\n </StyledTooltip>\n </FlexContainer>\n\n <HotspotPalette\n hotspotColor={model.hotspotColor}\n hotspotList={model.hotspotList}\n outlineColor={model.outlineColor}\n outlineList={model.outlineList}\n onHotspotColorChange={(color) => this.handleColorChange('hotspot', color)}\n onOutlineColorChange={(color) => this.handleColorChange('outline', color)}\n />\n\n <HotspotContainer\n dimensions={model.dimensions}\n imageUrl={model.imageUrl}\n multipleCorrect={model.multipleCorrect}\n hasErrors={!!shapesError || !!selectionsError}\n hotspotColor={model.hotspotColor}\n outlineColor={model.outlineColor}\n selectedHotspotColor={model.selectedHotspotColor}\n hoverOutlineColor={checkNullish(model.hoverOutlineColor) ? model.hoverOutlineColor : 'black'}\n onUpdateImageDimension={onUpdateImageDimension}\n onUpdateShapes={onUpdateShapes}\n onImageUpload={onImageUpload}\n shapes={model.shapes}\n strokeWidth={model.strokeWidth}\n preserveAspectRatioEnabled={preserveAspectRatio.enabled}\n insertImage={imageSupport && imageSupport.add}\n />\n {shapesError && <ErrorText>{shapesError}</ErrorText>}\n {selectionsError && <ErrorText>{selectionsError}</ErrorText>}\n\n {model.imageUrl && (\n <React.Fragment>\n <Typography variant=\"h6\">Image Dimensions</Typography>\n\n <DimensionsContainer>\n <FieldContainer>\n <NumberTextField\n key=\"hotspot-manual-width\"\n label=\"Width\"\n value={model.dimensions.width}\n min={0}\n onChange={(e, value) => this.handleOnUpdateImageDimensions(value, 'width')}\n showErrorWhenOutsideRange\n />\n </FieldContainer>\n\n <FieldContainer>\n <NumberTextField\n key=\"hotspot-manual-height\"\n label=\"Height\"\n value={model.dimensions.height}\n min={0}\n onChange={(e, value) => this.handleOnUpdateImageDimensions(value, 'height')}\n showErrorWhenOutsideRange\n />\n </FieldContainer>\n </DimensionsContainer>\n </React.Fragment>\n )}\n\n {rationaleEnabled && (\n <PromptContainer label={rationale.label}>\n <EditableHtml\n markup={model.rationale || ''}\n onChange={onRationaleChanged}\n imageSupport={imageSupport}\n error={rationaleError}\n toolbarOpts={toolbarOpts}\n pluginProps={getPluginProps(rationale?.inputConfiguration)}\n spellCheck={spellCheckEnabled}\n maxImageWidth={(maxImageWidth && maxImageWidth.rationale) || defaultImageMaxWidth}\n maxImageHeight={(maxImageHeight && maxImageHeight.rationale) || defaultImageMaxHeight}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n mathMlOptions={mathMlOptions}\n />\n {rationaleError && <ErrorText>{rationaleError}</ErrorText>}\n </PromptContainer>\n )}\n </layout.ConfigLayout>\n );\n }\n}\n\nRoot.propTypes = {\n configuration: PropTypes.object,\n model: PropTypes.object.isRequired,\n imageSupport: PropTypes.shape({\n add: PropTypes.func,\n delete: PropTypes.func,\n }),\n uploadSoundSupport: PropTypes.shape({\n add: PropTypes.func,\n delete: PropTypes.func,\n }),\n onImageUpload: PropTypes.func.isRequired,\n onColorChanged: PropTypes.func.isRequired,\n onPromptChanged: PropTypes.func.isRequired,\n onUpdateImageDimension: PropTypes.func.isRequired,\n onUpdateShapes: PropTypes.func.isRequired,\n onModelChangedByConfig: PropTypes.func.isRequired,\n onRationaleChanged: PropTypes.func.isRequired,\n onConfigurationChanged: PropTypes.func.isRequired,\n onTeacherInstructionsChanged: PropTypes.func.isRequired,\n};\n\nexport default Root;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,mBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,KAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,QAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,eAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,iBAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AAEA,MAAM;EAAEW,KAAK;EAAEC,MAAM;EAAEC;AAAS,CAAC,GAAGC,kBAAQ;AAE5C,MAAMC,YAAY,GAAIC,KAAK,IAAKA,KAAK,KAAK,IAAI,IAAIA,KAAK,KAAKC,SAAS;AAErE,MAAMC,mBAAmB,GAAG,IAAAC,cAAM,EAAC,KAAK,CAAC,CAAC,CAAC;EAAEC;AAAM,CAAC,MAAM;EACxDC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A,CAAC;EAE1B;AACF;AAAC8D,OAAA,CAAA1H,IAAA,GAAAA,IAAA;AAEDA,IAAI,CAAC2H,SAAS,GAAG;EACf5G,aAAa,EAAE6G,kBAAS,CAACC,MAAM;EAC/BjH,KAAK,EAAEgH,kBAAS,CAACC,MAAM,CAACC,UAAU;EAClCjG,YAAY,EAAE+F,kBAAS,CAACG,KAAK,CAAC;IAC5Bd,GAAG,EAAEW,kBAAS,CAACI,IAAI;IACnBC,MAAM,EAAEL,kBAAS,CAACI;EACpB,CAAC,CAAC;EACFlG,kBAAkB,EAAE8F,kBAAS,CAACG,KAAK,CAAC;IAClCd,GAAG,EAAEW,kBAAS,CAACI,IAAI;IACnBC,MAAM,EAAEL,kBAAS,CAACI;EACpB,CAAC,CAAC;EACFhG,aAAa,EAAE4F,kBAAS,CAACI,IAAI,CAACF,UAAU;EACxCtH,cAAc,EAAEoH,kBAAS,CAACI,IAAI,CAACF,UAAU;EACzC5F,eAAe,EAAE0F,kBAAS,CAACI,IAAI,CAACF,UAAU;EAC1C7G,sBAAsB,EAAE2G,kBAAS,CAACI,IAAI,CAACF,UAAU;EACjD5G,cAAc,EAAE0G,kBAAS,CAACI,IAAI,CAACF,UAAU;EACzC7F,sBAAsB,EAAE2F,kBAAS,CAACI,IAAI,CAACF,UAAU;EACjD3F,kBAAkB,EAAEyF,kBAAS,CAACI,IAAI,CAACF,UAAU;EAC7C/F,sBAAsB,EAAE6F,kBAAS,CAACI,IAAI,CAACF,UAAU;EACjD1F,4BAA4B,EAAEwF,kBAAS,CAACI,IAAI,CAACF;AAC/C,CAAC;AAAC,IAAAI,QAAA,GAAAR,OAAA,CAAApH,OAAA,GAEaN,IAAI","ignoreList":[]}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pie-element/hotspot-configure",
3
3
  "private": true,
4
- "version": "10.1.6",
4
+ "version": "10.2.0-beta.0",
5
5
  "description": "",
6
6
  "main": "lib/index.js",
7
7
  "module": "src/index.js",
@@ -12,8 +12,8 @@
12
12
  "@mui/icons-material": "^7.3.4",
13
13
  "@mui/material": "^7.3.4",
14
14
  "@pie-framework/pie-configure-events": "^1.3.0",
15
- "@pie-lib/config-ui": "13.0.11",
16
- "@pie-lib/editable-html-tip-tap": "2.1.9",
15
+ "@pie-lib/config-ui": "13.1.0-beta",
16
+ "@pie-lib/editable-html-tip-tap": "2.2.0-beta",
17
17
  "debug": "^4.1.1",
18
18
  "konva": "8.3.0",
19
19
  "lodash-es": "^4.17.23",
@@ -12,6 +12,8 @@ import { updateImageDimensions, generateValidationMessage, getUpdatedShapes, get
12
12
 
13
13
  const { Panel, toggle, dropdown } = settings;
14
14
 
15
+ const checkNullish = (value) => value !== null && value !== undefined;
16
+
15
17
  const DimensionsContainer = styled('div')(({ theme }) => ({
16
18
  display: 'flex',
17
19
  marginBottom: theme.spacing(1.5),
@@ -164,6 +166,7 @@ export class Root extends React.Component {
164
166
  ...props,
165
167
  });
166
168
 
169
+
167
170
  return (
168
171
  <layout.ConfigLayout
169
172
  extraCSSRules={extraCSSRules}
@@ -225,15 +228,8 @@ export class Root extends React.Component {
225
228
  )}
226
229
 
227
230
  <FlexContainer>
228
- <SubHeading variant="h6">
229
- Define Hotspot
230
- </SubHeading>
231
- <StyledTooltip
232
- disableFocusListener
233
- disableTouchListener
234
- placement={'left'}
235
- title={validationMessage}
236
- >
231
+ <SubHeading variant="h6">Define Hotspot</SubHeading>
232
+ <StyledTooltip disableFocusListener disableTouchListener placement={'left'} title={validationMessage}>
237
233
  <Info fontSize={'small'} color={'primary'} style={{ float: 'right' }} />
238
234
  </StyledTooltip>
239
235
  </FlexContainer>
@@ -255,7 +251,7 @@ export class Root extends React.Component {
255
251
  hotspotColor={model.hotspotColor}
256
252
  outlineColor={model.outlineColor}
257
253
  selectedHotspotColor={model.selectedHotspotColor}
258
- hoverOutlineColor={model.hoverOutlineColor}
254
+ hoverOutlineColor={checkNullish(model.hoverOutlineColor) ? model.hoverOutlineColor : 'black'}
259
255
  onUpdateImageDimension={onUpdateImageDimension}
260
256
  onUpdateShapes={onUpdateShapes}
261
257
  onImageUpload={onImageUpload}
@@ -3,15 +3,15 @@
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
- ## [8.1.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot-controller@8.1.1...@pie-element/hotspot-controller@8.1.2) (2026-07-02)
6
+ # [8.2.0-beta.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot-controller@8.1.0...@pie-element/hotspot-controller@8.2.0-beta.0) (2026-08-07)
7
7
 
8
8
  ### Bug Fixes
9
9
 
10
10
  - bump shared modules and libs PIE-695, PIE-697, PIE-699, PIE-680, PIE-714, PIE-665, PIE-656 ([4b76ae7](https://github.com/pie-framework/pie-elements/commit/4b76ae75d1c5ea6d55f7c6fb53f299dfcbda2b1f))
11
11
 
12
- ## [8.1.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot-controller@8.1.0...@pie-element/hotspot-controller@8.1.1) (2026-05-21)
12
+ ### Features
13
13
 
14
- **Note:** Version bump only for package @pie-element/hotspot-controller
14
+ - **hotspot:** enhance focus handling and default hover outline color PIE-637 PIE-640 ([249d6e9](https://github.com/pie-framework/pie-elements/commit/249d6e9ae2da47a008ea0b5d73f34b64fd451795))
15
15
 
16
16
  # [8.1.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot-controller@8.1.0-next.1...@pie-element/hotspot-controller@8.1.0) (2026-05-21)
17
17
 
@@ -15,6 +15,7 @@ var _controllerUtils = require("@pie-lib/controller-utils");
15
15
  var _utils = require("./utils");
16
16
  var _defaults = _interopRequireDefault(require("./defaults"));
17
17
  const log = (0, _debug.default)('pie-elements:hotspot:controller');
18
+ const checkNullish = value => value !== null && value !== undefined;
18
19
  const normalize = question => ({
19
20
  ..._defaults.default,
20
21
  ...question
@@ -53,7 +54,7 @@ function model(question, session, env) {
53
54
  imageUrl,
54
55
  outlineColor,
55
56
  hotspotColor,
56
- hoverOutlineColor,
57
+ hoverOutlineColor: checkNullish(hoverOutlineColor) ? hoverOutlineColor : 'black',
57
58
  selectedHotspotColor,
58
59
  multipleCorrect,
59
60
  partialScoring,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_debug","_interopRequireDefault","require","_lodashEs","_controllerUtils","_utils","_defaults","log","debug","normalize","question","defaults","exports","model","session","env","normalizedQuestion","imageUrl","dimensions","hotspotColor","hoverOutlineColor","selectedHotspotColor","multipleCorrect","outlineColor","partialScoring","prompt","shapes","language","fontSizeFactor","autoplayAudioEnabled","completeAudioEnabled","customAudioButton","rectangles","polygons","circles","shouldIncludeCorrectResponse","mode","role","Promise","resolve","out","disabled","map","index","correct","rectProps","polyProps","circleProps","responseCorrect","isResponseCorrect","undefined","extraCSSRules","rationale","rationaleEnabled","teacherInstructions","teacherInstructionsEnabled","promptEnabled","strokeWidth","createDefaultModel","getScore","config","answers","partialScoringEnabled","enabled","correctAnswers","selectedChoices","choices","correctChoices","filter","choice","forEach","shape","selected","answer","id","correctlySelected","extraAnswers","length","total","str","toFixed","parseFloat","getLogTrace","traceLog","allShapes","push","correctShapes","totalShapes","correctSelections","incorrectSelections","find","s","missedCorrect","correctShape","some","totalCorrectAvailable","extraSelections","score","outcome","isEmpty","empty","returnShapesCorrect","i","createCorrectResponseSession","rectangleCorrect","polygonsCorrect","circlesCorrect","getInnerText","html","replaceAll","getContent","replace","validate","minShapes","maxShapes","maxSelections","errors","field","required","Object","values","reduce","acc","nbOfSelections","nbOfShapes","selections"],"sources":["../src/index.js"],"sourcesContent":["import debug from 'debug';\nimport { isEmpty } from 'lodash-es';\nimport { partialScoring } from '@pie-lib/controller-utils';\n\nimport { isResponseCorrect } from './utils';\n\nimport defaults from './defaults';\n\nconst log = debug('pie-elements:hotspot:controller');\n\nexport const normalize = (question) => ({\n ...defaults,\n ...question,\n});\n\nexport function model(question, session, env) {\n const normalizedQuestion = normalize(question);\n const {\n imageUrl,\n dimensions,\n hotspotColor,\n hoverOutlineColor,\n selectedHotspotColor,\n multipleCorrect,\n outlineColor,\n partialScoring,\n prompt,\n shapes,\n language,\n fontSizeFactor,\n autoplayAudioEnabled,\n completeAudioEnabled,\n customAudioButton,\n } = normalizedQuestion;\n const { rectangles, polygons, circles } = shapes || {};\n\n const shouldIncludeCorrectResponse = env.mode === 'evaluate' || (env.role === 'instructor' && env.mode === 'view');\n\n return new Promise((resolve) => {\n const out = {\n disabled: env.mode !== 'gather',\n mode: env.mode,\n dimensions,\n imageUrl,\n outlineColor,\n hotspotColor,\n hoverOutlineColor,\n selectedHotspotColor,\n multipleCorrect,\n partialScoring,\n language,\n fontSizeFactor,\n autoplayAudioEnabled,\n completeAudioEnabled,\n customAudioButton,\n shapes: {\n ...shapes,\n // eslint-disable-next-line no-unused-vars\n rectangles: (rectangles || []).map(({ index, correct, ...rectProps }) =>\n shouldIncludeCorrectResponse ? { correct, ...rectProps } : { ...rectProps },\n ),\n // eslint-disable-next-line no-unused-vars\n polygons: (polygons || []).map(({ index, correct, ...polyProps }) =>\n shouldIncludeCorrectResponse ? { correct, ...polyProps } : { ...polyProps },\n ),\n // eslint-disable-next-line no-unused-vars\n circles: (circles || []).map(({ index, correct, ...circleProps }) =>\n shouldIncludeCorrectResponse ? { correct, ...circleProps } : { ...circleProps },\n ),\n },\n responseCorrect: env.mode === 'evaluate' ? isResponseCorrect(normalizedQuestion, session) : undefined,\n extraCSSRules: normalizedQuestion.extraCSSRules,\n };\n\n if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {\n out.rationale = normalizedQuestion.rationaleEnabled ? normalizedQuestion.rationale : null;\n out.teacherInstructions = normalizedQuestion.teacherInstructionsEnabled\n ? normalizedQuestion.teacherInstructions\n : null;\n } else {\n out.rationale = null;\n out.teacherInstructions = null;\n }\n\n out.prompt = normalizedQuestion.promptEnabled ? prompt : null;\n out.strokeWidth = normalizedQuestion.strokeWidth;\n\n resolve(out);\n });\n}\n\nexport const createDefaultModel = (model = {}) =>\n new Promise((resolve) => {\n resolve({\n ...defaults,\n ...model,\n });\n });\n\nconst getScore = (config, session, env = {}) => {\n const { answers } = session || {};\n\n if (!config.shapes || (!config.shapes.rectangles && !config.shapes.polygons && !config.shapes.circles)) {\n return 0;\n }\n\n const { shapes: { rectangles = [], polygons = [], circles = [] } = {} } = config;\n const partialScoringEnabled = partialScoring.enabled(config, env);\n\n if (!partialScoringEnabled) {\n return isResponseCorrect(config, session) ? 1 : 0;\n }\n\n let correctAnswers = 0;\n let selectedChoices = 0;\n\n const choices = [...rectangles, ...polygons, ...circles];\n\n const correctChoices = choices.filter((choice) => choice.correct);\n\n choices.forEach((shape) => {\n const selected = answers && answers.filter((answer) => answer.id === shape.id)[0];\n const correctlySelected = shape.correct && selected;\n\n if (selected) {\n selectedChoices += 1;\n }\n\n if (correctlySelected) {\n correctAnswers += 1;\n }\n });\n\n const extraAnswers = selectedChoices > correctChoices.length ? selectedChoices - correctChoices.length : 0;\n\n const total = correctChoices.length === 0 ? 1 : correctChoices.length;\n const str = ((correctAnswers - extraAnswers) / total).toFixed(2);\n\n return str < 0 ? 0 : parseFloat(str);\n};\n\n /**\n * Generates detailed trace log for scoring evaluation\n * @param {Object} model - the question model\n * @param {Object} session - the student session\n * @param {Object} env - the environment\n * @returns {Array} traceLog - array of trace messages\n */\nexport const getLogTrace = (model, session, env) => {\n const traceLog = [];\n const { answers } = session || {};\n const { shapes } = model || {};\n \n const allShapes = [];\n if (shapes) {\n if (shapes.rectangles) allShapes.push(...shapes.rectangles);\n if (shapes.polygons) allShapes.push(...shapes.polygons);\n if (shapes.circles) allShapes.push(...shapes.circles);\n }\n \n const correctShapes = allShapes.filter(shape => shape.correct);\n const totalShapes = allShapes.length;\n \n traceLog.push(`Total of ${totalShapes} hotspot(s) defined, ${correctShapes.length} correct.`);\n \n if (answers && answers.length > 0) {\n traceLog.push(`Student selected ${answers.length} hotspot(s).`);\n \n let correctSelections = 0;\n let incorrectSelections = 0;\n \n answers.forEach(answer => {\n const shape = allShapes.find(s => s.id === answer.id);\n if (shape && shape.correct) {\n correctSelections++;\n } else {\n incorrectSelections++;\n }\n });\n \n const missedCorrect = correctShapes.filter(correctShape => \n !answers.some(answer => answer.id === correctShape.id)\n ).length;\n \n if (correctSelections > 0) {\n traceLog.push(`${correctSelections} correct hotspot(s) selected.`);\n }\n if (incorrectSelections > 0) {\n traceLog.push(`${incorrectSelections} incorrect hotspot(s) selected.`);\n }\n if (missedCorrect > 0) {\n traceLog.push(`${missedCorrect} correct hotspot(s) missed.`);\n }\n } else {\n traceLog.push('No hotspots selected.');\n }\n\n const partialScoringEnabled = partialScoring.enabled(model, env);\n \n if (partialScoringEnabled) {\n traceLog.push(`Score calculated using partial scoring.`);\n \n if (answers && answers.length > 0) {\n let correctSelections = 0;\n let incorrectSelections = 0;\n \n answers.forEach(answer => {\n const shape = allShapes.find(s => s.id === answer.id);\n if (shape && shape.correct) {\n correctSelections++;\n } else {\n incorrectSelections++;\n }\n });\n \n const totalCorrectAvailable = correctShapes.length;\n traceLog.push(`Partial scoring calculation: ${correctSelections} correct selections out of ${totalCorrectAvailable} available.`);\n \n if (incorrectSelections > totalCorrectAvailable) {\n const extraSelections = incorrectSelections - (totalCorrectAvailable - correctSelections);\n traceLog.push(`${extraSelections} extra incorrect selection(s) beyond required amount are deducted from score.`);\n }\n }\n } else {\n traceLog.push(`Score calculated using all-or-nothing scoring.`);\n }\n\n const score = getScore(model, session, env);\n traceLog.push(`Score: ${score}.`);\n\n return traceLog;\n}\n\nexport function outcome(config, session, env = {}) {\n return new Promise((resolve) => {\n log('outcome...');\n\n if (!session || isEmpty(session)) {\n resolve({ \n score: 0, \n empty: true, \n traceLog: ['No hotspots selected. Score: 0.'] \n });\n } \n\n if (session.answers) {\n const traceLog = getLogTrace(config, session, env);\n const score = getScore(config, session, env);\n\n resolve({ score, empty: false, traceLog });\n } else {\n resolve({ \n score: 0, \n empty: true, \n traceLog: ['No hotspots selected. Score: 0.'] \n });\n }\n });\n}\n\nconst returnShapesCorrect = (shapes) => {\n let answers = [];\n\n shapes.forEach((i) => {\n const { correct, id } = i;\n if (correct) {\n answers.push({ id });\n }\n });\n return answers;\n};\n\nexport const createCorrectResponseSession = (question, env) => {\n return new Promise((resolve) => {\n if (env.mode !== 'evaluate' && env.role === 'instructor') {\n const { shapes: { rectangles = [], circles = [], polygons = {} } = {} } = question;\n\n const rectangleCorrect = returnShapesCorrect(rectangles);\n const polygonsCorrect = returnShapesCorrect(polygons);\n const circlesCorrect = returnShapesCorrect(circles);\n\n resolve({\n answers: [...rectangleCorrect, ...polygonsCorrect, ...circlesCorrect],\n id: '1',\n });\n } else {\n resolve(null);\n }\n });\n};\n\n// remove all html tags\nconst getInnerText = (html) => (html || '').replaceAll(/<[^>]*>/g, '');\n\n// remove all html tags except img, iframe and source tag for audio\nconst getContent = (html) => (html || '').replace(/(<(?!img|iframe|source)([^>]+)>)/gi, '');\n\nexport const validate = (model = {}, config = {}) => {\n const { shapes } = model;\n const { minShapes = 2, maxShapes, maxSelections } = config;\n const errors = {};\n\n ['teacherInstructions', 'prompt', 'rationale'].forEach((field) => {\n if (config[field]?.required && !getContent(model[field])) {\n errors[field] = 'This field is required.';\n }\n });\n\n const allShapes = Object.values(shapes || {}).reduce((acc, shape) => [...acc, ...shape], []);\n\n const nbOfSelections = (allShapes || []).reduce((acc, shape) => (shape.correct ? acc + 1 : acc), 0);\n\n const nbOfShapes = (allShapes || []).length;\n\n if (nbOfShapes < minShapes) {\n errors.shapes = `There should be at least ${minShapes} shapes defined.`;\n } else if (nbOfShapes > maxShapes) {\n errors.shapes = `No more than ${maxShapes} shapes should be defined.`;\n }\n\n if (nbOfSelections < 1) {\n errors.selections = 'There should be at least 1 shape selected.';\n } else if (nbOfSelections > maxSelections) {\n errors.selections = `No more than ${maxSelections} shapes should be selected.`;\n }\n\n return errors;\n};\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA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C,IAAI+C,UAAU,GAAGX,SAAS,EAAE;IAC1BG,MAAM,CAAC1F,MAAM,GAAG,4BAA4BuF,SAAS,kBAAkB;EACzE,CAAC,MAAM,IAAIW,UAAU,GAAGV,SAAS,EAAE;IACjCE,MAAM,CAAC1F,MAAM,GAAG,gBAAgBwF,SAAS,4BAA4B;EACvE;EAEA,IAAIS,cAAc,GAAG,CAAC,EAAE;IACtBP,MAAM,CAACS,UAAU,GAAG,4CAA4C;EAClE,CAAC,MAAM,IAAIF,cAAc,GAAGR,aAAa,EAAE;IACzCC,MAAM,CAACS,UAAU,GAAG,gBAAgBV,aAAa,6BAA6B;EAChF;EAEA,OAAOC,MAAM;AACf,CAAC;AAACxG,OAAA,CAAAoG,QAAA,GAAAA,QAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_debug","_interopRequireDefault","require","_lodashEs","_controllerUtils","_utils","_defaults","log","debug","checkNullish","value","undefined","normalize","question","defaults","exports","model","session","env","normalizedQuestion","imageUrl","dimensions","hotspotColor","hoverOutlineColor","selectedHotspotColor","multipleCorrect","outlineColor","partialScoring","prompt","shapes","language","fontSizeFactor","autoplayAudioEnabled","completeAudioEnabled","customAudioButton","rectangles","polygons","circles","shouldIncludeCorrectResponse","mode","role","Promise","resolve","out","disabled","map","index","correct","rectProps","polyProps","circleProps","responseCorrect","isResponseCorrect","extraCSSRules","rationale","rationaleEnabled","teacherInstructions","teacherInstructionsEnabled","promptEnabled","strokeWidth","createDefaultModel","getScore","config","answers","partialScoringEnabled","enabled","correctAnswers","selectedChoices","choices","correctChoices","filter","choice","forEach","shape","selected","answer","id","correctlySelected","extraAnswers","length","total","str","toFixed","parseFloat","getLogTrace","traceLog","allShapes","push","correctShapes","totalShapes","correctSelections","incorrectSelections","find","s","missedCorrect","correctShape","some","totalCorrectAvailable","extraSelections","score","outcome","isEmpty","empty","returnShapesCorrect","i","createCorrectResponseSession","rectangleCorrect","polygonsCorrect","circlesCorrect","getInnerText","html","replaceAll","getContent","replace","validate","minShapes","maxShapes","maxSelections","errors","field","required","Object","values","reduce","acc","nbOfSelections","nbOfShapes","selections"],"sources":["../src/index.js"],"sourcesContent":["import debug from 'debug';\nimport { isEmpty } from 'lodash-es';\nimport { partialScoring } from '@pie-lib/controller-utils';\n\nimport { isResponseCorrect } from './utils';\n\nimport defaults from './defaults';\n\nconst log = debug('pie-elements:hotspot:controller');\n\nconst checkNullish = (value) => value !== null && value !== undefined;\n\nexport const normalize = (question) => ({\n ...defaults,\n ...question,\n});\n\nexport function model(question, session, env) {\n const normalizedQuestion = normalize(question);\n const {\n imageUrl,\n dimensions,\n hotspotColor,\n hoverOutlineColor,\n selectedHotspotColor,\n multipleCorrect,\n outlineColor,\n partialScoring,\n prompt,\n shapes,\n language,\n fontSizeFactor,\n autoplayAudioEnabled,\n completeAudioEnabled,\n customAudioButton,\n } = normalizedQuestion;\n const { rectangles, polygons, circles } = shapes || {};\n\n const shouldIncludeCorrectResponse = env.mode === 'evaluate' || (env.role === 'instructor' && env.mode === 'view');\n\n return new Promise((resolve) => {\n const out = {\n disabled: env.mode !== 'gather',\n mode: env.mode,\n dimensions,\n imageUrl,\n outlineColor,\n hotspotColor,\n hoverOutlineColor: checkNullish(hoverOutlineColor) ? hoverOutlineColor : 'black',\n selectedHotspotColor,\n multipleCorrect,\n partialScoring,\n language,\n fontSizeFactor,\n autoplayAudioEnabled,\n completeAudioEnabled,\n customAudioButton,\n shapes: {\n ...shapes,\n // eslint-disable-next-line no-unused-vars\n rectangles: (rectangles || []).map(({ index, correct, ...rectProps }) =>\n shouldIncludeCorrectResponse ? { correct, ...rectProps } : { ...rectProps },\n ),\n // eslint-disable-next-line no-unused-vars\n polygons: (polygons || []).map(({ index, correct, ...polyProps }) =>\n shouldIncludeCorrectResponse ? { correct, ...polyProps } : { ...polyProps },\n ),\n // eslint-disable-next-line no-unused-vars\n circles: (circles || []).map(({ index, correct, ...circleProps }) =>\n shouldIncludeCorrectResponse ? { correct, ...circleProps } : { ...circleProps },\n ),\n },\n responseCorrect: env.mode === 'evaluate' ? isResponseCorrect(normalizedQuestion, session) : undefined,\n extraCSSRules: normalizedQuestion.extraCSSRules,\n };\n\n if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {\n out.rationale = normalizedQuestion.rationaleEnabled ? normalizedQuestion.rationale : null;\n out.teacherInstructions = normalizedQuestion.teacherInstructionsEnabled\n ? normalizedQuestion.teacherInstructions\n : null;\n } else {\n out.rationale = null;\n out.teacherInstructions = null;\n }\n\n out.prompt = normalizedQuestion.promptEnabled ? prompt : null;\n out.strokeWidth = normalizedQuestion.strokeWidth;\n\n resolve(out);\n });\n}\n\nexport const createDefaultModel = (model = {}) =>\n new Promise((resolve) => {\n resolve({\n ...defaults,\n ...model,\n });\n });\n\nconst getScore = (config, session, env = {}) => {\n const { answers } = session || {};\n\n if (!config.shapes || (!config.shapes.rectangles && !config.shapes.polygons && !config.shapes.circles)) {\n return 0;\n }\n\n const { shapes: { rectangles = [], polygons = [], circles = [] } = {} } = config;\n const partialScoringEnabled = partialScoring.enabled(config, env);\n\n if (!partialScoringEnabled) {\n return isResponseCorrect(config, session) ? 1 : 0;\n }\n\n let correctAnswers = 0;\n let selectedChoices = 0;\n\n const choices = [...rectangles, ...polygons, ...circles];\n\n const correctChoices = choices.filter((choice) => choice.correct);\n\n choices.forEach((shape) => {\n const selected = answers && answers.filter((answer) => answer.id === shape.id)[0];\n const correctlySelected = shape.correct && selected;\n\n if (selected) {\n selectedChoices += 1;\n }\n\n if (correctlySelected) {\n correctAnswers += 1;\n }\n });\n\n const extraAnswers = selectedChoices > correctChoices.length ? selectedChoices - correctChoices.length : 0;\n\n const total = correctChoices.length === 0 ? 1 : correctChoices.length;\n const str = ((correctAnswers - extraAnswers) / total).toFixed(2);\n\n return str < 0 ? 0 : parseFloat(str);\n};\n\n /**\n * Generates detailed trace log for scoring evaluation\n * @param {Object} model - the question model\n * @param {Object} session - the student session\n * @param {Object} env - the environment\n * @returns {Array} traceLog - array of trace messages\n */\nexport const getLogTrace = (model, session, env) => {\n const traceLog = [];\n const { answers } = session || {};\n const { shapes } = model || {};\n\n const allShapes = [];\n if (shapes) {\n if (shapes.rectangles) allShapes.push(...shapes.rectangles);\n if (shapes.polygons) allShapes.push(...shapes.polygons);\n if (shapes.circles) allShapes.push(...shapes.circles);\n }\n\n const correctShapes = allShapes.filter(shape => shape.correct);\n const totalShapes = allShapes.length;\n\n traceLog.push(`Total of ${totalShapes} hotspot(s) defined, ${correctShapes.length} correct.`);\n\n if (answers && answers.length > 0) {\n traceLog.push(`Student selected ${answers.length} hotspot(s).`);\n\n let correctSelections = 0;\n let incorrectSelections = 0;\n\n answers.forEach(answer => {\n const shape = allShapes.find(s => s.id === answer.id);\n if (shape && shape.correct) {\n correctSelections++;\n } else {\n incorrectSelections++;\n }\n });\n\n const missedCorrect = correctShapes.filter(correctShape =>\n !answers.some(answer => answer.id === correctShape.id)\n ).length;\n\n if (correctSelections > 0) {\n traceLog.push(`${correctSelections} correct hotspot(s) selected.`);\n }\n if (incorrectSelections > 0) {\n traceLog.push(`${incorrectSelections} incorrect hotspot(s) selected.`);\n }\n if (missedCorrect > 0) {\n traceLog.push(`${missedCorrect} correct hotspot(s) missed.`);\n }\n } else {\n traceLog.push('No hotspots selected.');\n }\n\n const partialScoringEnabled = partialScoring.enabled(model, env);\n\n if (partialScoringEnabled) {\n traceLog.push(`Score calculated using partial scoring.`);\n\n if (answers && answers.length > 0) {\n let correctSelections = 0;\n let incorrectSelections = 0;\n\n answers.forEach(answer => {\n const shape = allShapes.find(s => s.id === answer.id);\n if (shape && shape.correct) {\n correctSelections++;\n } else {\n incorrectSelections++;\n }\n });\n\n const totalCorrectAvailable = correctShapes.length;\n traceLog.push(`Partial scoring calculation: ${correctSelections} correct selections out of ${totalCorrectAvailable} available.`);\n\n if (incorrectSelections > totalCorrectAvailable) {\n const extraSelections = incorrectSelections - (totalCorrectAvailable - correctSelections);\n traceLog.push(`${extraSelections} extra incorrect selection(s) beyond required amount are deducted from score.`);\n }\n }\n } else {\n traceLog.push(`Score calculated using all-or-nothing scoring.`);\n }\n\n const score = getScore(model, session, env);\n traceLog.push(`Score: ${score}.`);\n\n return traceLog;\n}\n\nexport function outcome(config, session, env = {}) {\n return new Promise((resolve) => {\n log('outcome...');\n\n if (!session || isEmpty(session)) {\n resolve({\n score: 0,\n empty: true,\n traceLog: ['No hotspots selected. Score: 0.']\n });\n }\n\n if (session.answers) {\n const traceLog = getLogTrace(config, session, env);\n const score = getScore(config, session, env);\n\n resolve({ score, empty: false, traceLog });\n } else {\n resolve({\n score: 0,\n empty: true,\n traceLog: ['No hotspots selected. Score: 0.']\n });\n }\n });\n}\n\nconst returnShapesCorrect = (shapes) => {\n let answers = [];\n\n shapes.forEach((i) => {\n const { correct, id } = i;\n if (correct) {\n answers.push({ id });\n }\n });\n return answers;\n};\n\nexport const createCorrectResponseSession = (question, env) => {\n return new Promise((resolve) => {\n if (env.mode !== 'evaluate' && env.role === 'instructor') {\n const { shapes: { rectangles = [], circles = [], polygons = {} } = {} } = question;\n\n const rectangleCorrect = returnShapesCorrect(rectangles);\n const polygonsCorrect = returnShapesCorrect(polygons);\n const circlesCorrect = returnShapesCorrect(circles);\n\n resolve({\n answers: [...rectangleCorrect, ...polygonsCorrect, ...circlesCorrect],\n id: '1',\n });\n } else {\n resolve(null);\n }\n });\n};\n\n// remove all html tags\nconst getInnerText = (html) => (html || '').replaceAll(/<[^>]*>/g, '');\n\n// remove all html tags except img, iframe and source tag for audio\nconst getContent = (html) => (html || '').replace(/(<(?!img|iframe|source)([^>]+)>)/gi, '');\n\nexport const validate = (model = {}, config = {}) => {\n const { shapes } = model;\n const { minShapes = 2, maxShapes, maxSelections } = config;\n const errors = {};\n\n ['teacherInstructions', 'prompt', 'rationale'].forEach((field) => {\n if (config[field]?.required && !getContent(model[field])) {\n errors[field] = 'This field is required.';\n }\n });\n\n const allShapes = Object.values(shapes || {}).reduce((acc, shape) => [...acc, ...shape], []);\n\n const nbOfSelections = (allShapes || []).reduce((acc, shape) => (shape.correct ? acc + 1 : acc), 0);\n\n const nbOfShapes = (allShapes || []).length;\n\n if (nbOfShapes < minShapes) {\n errors.shapes = `There should be at least ${minShapes} shapes defined.`;\n } else if (nbOfShapes > maxShapes) {\n errors.shapes = `No more than ${maxShapes} shapes should be defined.`;\n }\n\n if (nbOfSelections < 1) {\n errors.selections = 'There should be at least 1 shape selected.';\n } else if (nbOfSelections > maxSelections) {\n errors.selections = `No more than ${maxSelections} shapes should be selected.`;\n }\n\n return errors;\n};\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,gBAAA,GAAAF,OAAA;AAEA,IAAAG,MAAA,GAAAH,OAAA;AAEA,IAAAI,SAAA,GAAAL,sBAAA,CAAAC,OAAA;AAEA,MAAMK,GAAG,GAAG,IAAAC,cAAK,EAAC,iCAAiC,CAAC;AAEpD,MAAMC,YAAY,GAAIC,KAAK,IAAKA,KAAK,KAAK,IAAI,IAAIA,KAAK,KAAKC,SAAS;AAE9D,MAAMC,SAAS,GAAIC,QAAQ,KAAM;EACtC,GAAGC,iBAAQ;EACX,GAAGD;AACL,CAAC,CAAC;AAACE,OAAA,CAAAH,SAAA,GAAAA,SAAA;AAEI,SAASI,KAAKA,CAACH,QAAQ,EAAEI,OAAO,EAAEC,GAAG,EAAE;EAC5C,MAAMC,kBAAkB,GAAGP,SAAS,CAACC,QAAQ,CAAC;EAC9C,MAAM;IACJO,QAAQ;IACRC,UAAU;IACVC,YAAY;IACZC,iBAAiB;IACjBC,oBAAoB;IACpBC,eAAe;IACfC,YAAY;IACZC,cAAc;IACdC,MAAM;IACNC,MAAM;IACNC,QAAQ;IACRC,cAAc;IACdC,oBAAoB;IACpBC,oBAAoB;IACpBC;EACF,CAAC,GAAGf,kBAAkB;EACtB,MAAM;IAAEgB,UAAU;IAAEC,QAAQ;IAAEC;EAAQ,CAA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G,KAAK,CAAC,CAAC,EAAE;MACxDD,MAAM,CAACC,KAAK,CAAC,GAAG,yBAAyB;IAC3C;EACF,CAAC,CAAC;EAEF,MAAMjC,SAAS,GAAGmC,MAAM,CAACC,MAAM,CAAC7F,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC8F,MAAM,CAAC,CAACC,GAAG,EAAEnD,KAAK,KAAK,CAAC,GAAGmD,GAAG,EAAE,GAAGnD,KAAK,CAAC,EAAE,EAAE,CAAC;EAE5F,MAAMoD,cAAc,GAAG,CAACvC,SAAS,IAAI,EAAE,EAAEqC,MAAM,CAAC,CAACC,GAAG,EAAEnD,KAAK,KAAMA,KAAK,CAAC1B,OAAO,GAAG6E,GAAG,GAAG,CAAC,GAAGA,GAAI,EAAE,CAAC,CAAC;EAEnG,MAAME,UAAU,GAAG,CAACxC,SAAS,IAAI,EAAE,EAAEP,MAAM;EAE3C,IAAI+C,UAAU,GAAGX,SAAS,EAAE;IAC1BG,MAAM,CAACzF,MAAM,GAAG,4BAA4BsF,SAAS,kBAAkB;EACzE,CAAC,MAAM,IAAIW,UAAU,GAAGV,SAAS,EAAE;IACjCE,MAAM,CAACzF,MAAM,GAAG,gBAAgBuF,SAAS,4BAA4B;EACvE;EAEA,IAAIS,cAAc,GAAG,CAAC,EAAE;IACtBP,MAAM,CAACS,UAAU,GAAG,4CAA4C;EAClE,CAAC,MAAM,IAAIF,cAAc,GAAGR,aAAa,EAAE;IACzCC,MAAM,CAACS,UAAU,GAAG,gBAAgBV,aAAa,6BAA6B;EAChF;EAEA,OAAOC,MAAM;AACf,CAAC;AAACvG,OAAA,CAAAmG,QAAA,GAAAA,QAAA","ignoreList":[]}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pie-element/hotspot-controller",
3
3
  "private": true,
4
- "version": "8.1.2",
4
+ "version": "8.2.0-beta.0",
5
5
  "description": "",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -8,6 +8,8 @@ import defaults from './defaults';
8
8
 
9
9
  const log = debug('pie-elements:hotspot:controller');
10
10
 
11
+ const checkNullish = (value) => value !== null && value !== undefined;
12
+
11
13
  export const normalize = (question) => ({
12
14
  ...defaults,
13
15
  ...question,
@@ -44,7 +46,7 @@ export function model(question, session, env) {
44
46
  imageUrl,
45
47
  outlineColor,
46
48
  hotspotColor,
47
- hoverOutlineColor,
49
+ hoverOutlineColor: checkNullish(hoverOutlineColor) ? hoverOutlineColor : 'black',
48
50
  selectedHotspotColor,
49
51
  multipleCorrect,
50
52
  partialScoring,
@@ -150,25 +152,25 @@ export const getLogTrace = (model, session, env) => {
150
152
  const traceLog = [];
151
153
  const { answers } = session || {};
152
154
  const { shapes } = model || {};
153
-
155
+
154
156
  const allShapes = [];
155
157
  if (shapes) {
156
158
  if (shapes.rectangles) allShapes.push(...shapes.rectangles);
157
159
  if (shapes.polygons) allShapes.push(...shapes.polygons);
158
160
  if (shapes.circles) allShapes.push(...shapes.circles);
159
161
  }
160
-
162
+
161
163
  const correctShapes = allShapes.filter(shape => shape.correct);
162
164
  const totalShapes = allShapes.length;
163
-
165
+
164
166
  traceLog.push(`Total of ${totalShapes} hotspot(s) defined, ${correctShapes.length} correct.`);
165
-
167
+
166
168
  if (answers && answers.length > 0) {
167
169
  traceLog.push(`Student selected ${answers.length} hotspot(s).`);
168
-
170
+
169
171
  let correctSelections = 0;
170
172
  let incorrectSelections = 0;
171
-
173
+
172
174
  answers.forEach(answer => {
173
175
  const shape = allShapes.find(s => s.id === answer.id);
174
176
  if (shape && shape.correct) {
@@ -177,11 +179,11 @@ export const getLogTrace = (model, session, env) => {
177
179
  incorrectSelections++;
178
180
  }
179
181
  });
180
-
181
- const missedCorrect = correctShapes.filter(correctShape =>
182
+
183
+ const missedCorrect = correctShapes.filter(correctShape =>
182
184
  !answers.some(answer => answer.id === correctShape.id)
183
185
  ).length;
184
-
186
+
185
187
  if (correctSelections > 0) {
186
188
  traceLog.push(`${correctSelections} correct hotspot(s) selected.`);
187
189
  }
@@ -196,14 +198,14 @@ export const getLogTrace = (model, session, env) => {
196
198
  }
197
199
 
198
200
  const partialScoringEnabled = partialScoring.enabled(model, env);
199
-
201
+
200
202
  if (partialScoringEnabled) {
201
203
  traceLog.push(`Score calculated using partial scoring.`);
202
-
204
+
203
205
  if (answers && answers.length > 0) {
204
206
  let correctSelections = 0;
205
207
  let incorrectSelections = 0;
206
-
208
+
207
209
  answers.forEach(answer => {
208
210
  const shape = allShapes.find(s => s.id === answer.id);
209
211
  if (shape && shape.correct) {
@@ -212,10 +214,10 @@ export const getLogTrace = (model, session, env) => {
212
214
  incorrectSelections++;
213
215
  }
214
216
  });
215
-
217
+
216
218
  const totalCorrectAvailable = correctShapes.length;
217
219
  traceLog.push(`Partial scoring calculation: ${correctSelections} correct selections out of ${totalCorrectAvailable} available.`);
218
-
220
+
219
221
  if (incorrectSelections > totalCorrectAvailable) {
220
222
  const extraSelections = incorrectSelections - (totalCorrectAvailable - correctSelections);
221
223
  traceLog.push(`${extraSelections} extra incorrect selection(s) beyond required amount are deducted from score.`);
@@ -236,12 +238,12 @@ export function outcome(config, session, env = {}) {
236
238
  log('outcome...');
237
239
 
238
240
  if (!session || isEmpty(session)) {
239
- resolve({
240
- score: 0,
241
- empty: true,
242
- traceLog: ['No hotspots selected. Score: 0.']
241
+ resolve({
242
+ score: 0,
243
+ empty: true,
244
+ traceLog: ['No hotspots selected. Score: 0.']
243
245
  });
244
- }
246
+ }
245
247
 
246
248
  if (session.answers) {
247
249
  const traceLog = getLogTrace(config, session, env);
@@ -249,10 +251,10 @@ export function outcome(config, session, env = {}) {
249
251
 
250
252
  resolve({ score, empty: false, traceLog });
251
253
  } else {
252
- resolve({
253
- score: 0,
254
- empty: true,
255
- traceLog: ['No hotspots selected. Score: 0.']
254
+ resolve({
255
+ score: 0,
256
+ empty: true,
257
+ traceLog: ['No hotspots selected. Score: 0.']
256
258
  });
257
259
  }
258
260
  });