@pie-lib/mask-markup 3.0.11 → 3.0.13
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 +13 -0
- package/lib/choices/choice.js +3 -0
- package/lib/choices/choice.js.map +1 -1
- package/lib/components/blank.js +23 -8
- package/lib/components/blank.js.map +1 -1
- package/package.json +3 -3
- package/src/choices/__tests__/index.test.js +34 -0
- package/src/choices/choice.jsx +5 -2
- package/src/components/__tests__/blank.test.js +35 -2
- package/src/components/blank.jsx +29 -7
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,19 @@
|
|
|
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
|
+
## [3.0.13](https://github.com/pie-framework/pie-lib/compare/@pie-lib/mask-markup@3.0.12...@pie-lib/mask-markup@3.0.13) (2026-07-31)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- made sure the numbers near the fraction have the same font size as the fraction [PIE-755] ([1c6d035](https://github.com/pie-framework/pie-lib/commit/1c6d03581470303e750cb14e5edcd08ba2eaf617))
|
|
11
|
+
- **mask-markup:** handle measurment of choices with text and images PIE-679 ([48d9d69](https://github.com/pie-framework/pie-lib/commit/48d9d693ca2fceed6a6213106dbc541e4f29d01d))
|
|
12
|
+
|
|
13
|
+
## [3.0.12](https://github.com/pie-framework/pie-lib/compare/@pie-lib/mask-markup@3.0.11...@pie-lib/mask-markup@3.0.12) (2026-07-08)
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
- **mask-markup:** update width and height calculations to include padding and border adjustments PIE-679 ([7142a76](https://github.com/pie-framework/pie-lib/commit/7142a7629da6db7fea621809a38d2cb280bc063f))
|
|
18
|
+
|
|
6
19
|
## [3.0.11](https://github.com/pie-framework/pie-lib/compare/@pie-lib/mask-markup@3.0.10...@pie-lib/mask-markup@3.0.11) (2026-07-01)
|
|
7
20
|
|
|
8
21
|
**Note:** Version bump only for package @pie-lib/mask-markup
|
package/lib/choices/choice.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"choice.js","names":["_react","_interopRequireWildcard","require","_propTypes","_interopRequireDefault","_core","_styles","_Chip","_mathRendering","_renderUi","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","_typeof","has","get","set","_t","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ownKeys","keys","getOwnPropertySymbols","filter","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","DRAG_TYPE","exports","StyledChoice","styled","_ref","theme","disabled","border","concat","palette","primary","main","borderRadius","spacing","margin","transform","display","StyledChip","Chip","backgroundColor","color","white","text","alignItems","height","minHeight","fontSize","whiteSpace","maxWidth","pointerEvents","paddingTop","paddingBottom","opacity","StyledChipLabel","padding","Choice","_ref2","_rootRef$current","_rootRef$current2","choice","instanceId","rootRef","useRef","_useDraggable","useDraggable","id","data","fromChoice","type","attributes","listeners","setNodeRef","isDragging","useEffect","renderMath","current","value","createElement","_extends2","ref","style","width","offsetWidth","offsetHeight","clickable","label","dangerouslySetInnerHTML","__html","propTypes","PropTypes","object","isRequired","bool","oneOfType","string","number"],"sources":["../../src/choices/choice.jsx"],"sourcesContent":["import React, { useEffect, useRef } from 'react';\nimport PropTypes from 'prop-types';\nimport { useDraggable } from '@dnd-kit/core';\nimport { styled } from '@mui/material/styles';\nimport Chip from '@mui/material/Chip';\nimport { renderMath } from '@pie-lib/math-rendering';\nimport { color } from '@pie-lib/render-ui';\n\nexport const DRAG_TYPE = 'MaskBlank';\n\nconst StyledChoice = styled('span')(({ theme, disabled }) => ({\n border: `solid 0px ${theme.palette.primary.main}`,\n borderRadius: theme.spacing(2),\n margin: theme.spacing(0.5),\n transform: 'translate(0, 0)',\n display: 'inline-flex',\n ...(disabled && {}),\n}));\n\nconst StyledChip = styled(Chip)(() => ({\n backgroundColor: color.white(),\n border: `1px solid ${color.text()}`,\n color: color.text(),\n alignItems: 'center',\n display: 'inline-flex',\n height: 'initial',\n minHeight: '32px',\n fontSize: 'inherit',\n whiteSpace: 'pre-wrap',\n maxWidth: '374px',\n // Added for touch devices, for image content.\n // This will prevent the context menu from appearing and not allowing other interactions with the image.\n // If interactions with the image in the token will be requested we should handle only the context Menu.\n pointerEvents: 'none',\n borderRadius: '3px',\n paddingTop: '12px',\n paddingBottom: '12px',\n\n '&.Mui-disabled': {\n opacity: 1,\n },\n}));\n\nconst StyledChipLabel = styled('span')(() => ({\n whiteSpace: 'normal',\n '& img': {\n display: 'block',\n padding: '2px 0',\n },\n '& mjx-frac': {\n fontSize: '120% !important',\n },\n}));\n\nexport default function Choice({ choice, disabled, instanceId }) {\n const rootRef = useRef(null);\n\n const { attributes, listeners, setNodeRef, isDragging } = useDraggable({\n id: `choice-${choice.id}`,\n data: { choice, instanceId, fromChoice: true, type: DRAG_TYPE },\n disabled,\n });\n\n useEffect(() => {\n renderMath(rootRef.current);\n }, [choice.value]);\n\n return (\n <StyledChoice\n ref={setNodeRef}\n style={\n isDragging\n ? {\n
|
|
1
|
+
{"version":3,"file":"choice.js","names":["_react","_interopRequireWildcard","require","_propTypes","_interopRequireDefault","_core","_styles","_Chip","_mathRendering","_renderUi","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","_typeof","has","get","set","_t","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ownKeys","keys","getOwnPropertySymbols","filter","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","DRAG_TYPE","exports","StyledChoice","styled","_ref","theme","disabled","border","concat","palette","primary","main","borderRadius","spacing","margin","transform","display","StyledChip","Chip","backgroundColor","color","white","text","alignItems","height","minHeight","fontSize","whiteSpace","maxWidth","pointerEvents","paddingTop","paddingBottom","opacity","StyledChipLabel","padding","Choice","_ref2","_rootRef$current","_rootRef$current2","choice","instanceId","rootRef","useRef","_useDraggable","useDraggable","id","data","fromChoice","type","attributes","listeners","setNodeRef","isDragging","useEffect","renderMath","current","value","createElement","_extends2","ref","style","width","offsetWidth","offsetHeight","clickable","label","dangerouslySetInnerHTML","__html","propTypes","PropTypes","object","isRequired","bool","oneOfType","string","number"],"sources":["../../src/choices/choice.jsx"],"sourcesContent":["import React, { useEffect, useRef } from 'react';\nimport PropTypes from 'prop-types';\nimport { useDraggable } from '@dnd-kit/core';\nimport { styled } from '@mui/material/styles';\nimport Chip from '@mui/material/Chip';\nimport { renderMath } from '@pie-lib/math-rendering';\nimport { color } from '@pie-lib/render-ui';\n\nexport const DRAG_TYPE = 'MaskBlank';\n\nconst StyledChoice = styled('span')(({ theme, disabled }) => ({\n border: `solid 0px ${theme.palette.primary.main}`,\n borderRadius: theme.spacing(2),\n margin: theme.spacing(0.5),\n transform: 'translate(0, 0)',\n display: 'inline-flex',\n ...(disabled && {}),\n}));\n\nconst StyledChip = styled(Chip)(() => ({\n backgroundColor: color.white(),\n border: `1px solid ${color.text()}`,\n color: color.text(),\n alignItems: 'center',\n display: 'inline-flex',\n height: 'initial',\n minHeight: '32px',\n fontSize: 'inherit',\n whiteSpace: 'pre-wrap',\n maxWidth: '374px',\n // Added for touch devices, for image content.\n // This will prevent the context menu from appearing and not allowing other interactions with the image.\n // If interactions with the image in the token will be requested we should handle only the context Menu.\n pointerEvents: 'none',\n borderRadius: '3px',\n paddingTop: '12px',\n paddingBottom: '12px',\n\n '&.Mui-disabled': {\n opacity: 1,\n },\n}));\n\nconst StyledChipLabel = styled('span')(() => ({\n whiteSpace: 'normal',\n '& img': {\n display: 'block',\n padding: '2px 0',\n },\n '& mjx-frac': {\n fontSize: '120% !important',\n },\n '& mjx-mn:has(~ mjx-mfrac), mjx-mfrac ~ mjx-mn': {\n fontSize: '120% !important',\n },\n}));\n\nexport default function Choice({ choice, disabled, instanceId }) {\n const rootRef = useRef(null);\n\n const { attributes, listeners, setNodeRef, isDragging } = useDraggable({\n id: `choice-${choice.id}`,\n data: { choice, instanceId, fromChoice: true, type: DRAG_TYPE },\n disabled,\n });\n\n useEffect(() => {\n renderMath(rootRef.current);\n }, [choice.value]);\n\n return (\n <StyledChoice\n ref={setNodeRef}\n style={\n isDragging\n ? {\n width: rootRef.current?.offsetWidth || 90, // min-width of chip is 90px, so if we don't have the width, we can use 90px as a fallback\n height: rootRef.current?.offsetHeight || 32, // min-height of chip is 32px, so if we don't have the height, we can use 32px as a fallback\n }\n : {}\n }\n disabled={disabled}\n {...listeners}\n {...attributes}\n >\n <StyledChip\n clickable={false}\n disabled={disabled}\n ref={rootRef}\n label={<StyledChipLabel dangerouslySetInnerHTML={{ __html: choice.value }} />}\n />\n </StyledChoice>\n );\n}\n\nChoice.propTypes = {\n choice: PropTypes.object.isRequired,\n disabled: PropTypes.bool,\n instanceId: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n};\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,cAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AAA2C,SAAAD,wBAAAS,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAX,uBAAA,YAAAA,wBAAAS,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,mBAAAT,CAAA,iBAAAA,CAAA,gBAAAU,OAAA,CAAAV,CAAA,0BAAAA,CAAA,SAAAQ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[]}
|
package/lib/components/blank.js
CHANGED
|
@@ -91,6 +91,9 @@ var StyledChipLabel = (0, _styles.styled)('span')(function () {
|
|
|
91
91
|
'& mjx-frac': {
|
|
92
92
|
fontSize: '120% !important'
|
|
93
93
|
},
|
|
94
|
+
'& mjx-mn:has(~ mjx-mfrac), mjx-mfrac ~ mjx-mn': {
|
|
95
|
+
fontSize: '120% !important'
|
|
96
|
+
},
|
|
94
97
|
'&.over': {
|
|
95
98
|
whiteSpace: 'nowrap',
|
|
96
99
|
overflow: 'hidden'
|
|
@@ -144,11 +147,19 @@ function BlankContent(_ref2) {
|
|
|
144
147
|
}
|
|
145
148
|
};
|
|
146
149
|
var getMeasureNode = function getMeasureNode() {
|
|
147
|
-
if (!spanRef.current)
|
|
150
|
+
if (!spanRef.current) {
|
|
151
|
+
return null;
|
|
152
|
+
}
|
|
148
153
|
var mjx = spanRef.current.querySelector('mjx-container');
|
|
149
|
-
if (mjx && spanRef.current.parentElement)
|
|
154
|
+
if (mjx && spanRef.current.parentElement) {
|
|
155
|
+
return spanRef.current.parentElement;
|
|
156
|
+
}
|
|
150
157
|
var img = spanRef.current.querySelector('img');
|
|
151
|
-
if (img)
|
|
158
|
+
if (img) {
|
|
159
|
+
// If there's text alongside the image, measure the full span to capture both dimensions
|
|
160
|
+
var hasTextContent = spanRef.current.textContent.trim().length > 0;
|
|
161
|
+
return hasTextContent ? spanRef.current : img;
|
|
162
|
+
}
|
|
152
163
|
return spanRef.current;
|
|
153
164
|
};
|
|
154
165
|
var updateDimensions = function updateDimensions() {
|
|
@@ -161,11 +172,15 @@ function BlankContent(_ref2) {
|
|
|
161
172
|
var measureNode = getMeasureNode();
|
|
162
173
|
var node = measureNode || spanRef.current;
|
|
163
174
|
var rect = node.getBoundingClientRect();
|
|
164
|
-
var width =
|
|
165
|
-
var height = Math.max(
|
|
166
|
-
var
|
|
167
|
-
var
|
|
168
|
-
|
|
175
|
+
var width = node.offsetWidth || rect.width || 0;
|
|
176
|
+
var height = Math.max(node.offsetHeight || 0, rect.height || 0, node.scrollHeight || 0, spanRef.current.scrollHeight || 0);
|
|
177
|
+
var PADDING = 12;
|
|
178
|
+
var BORDER_WIDTH = 2;
|
|
179
|
+
var ADDITIONAL_SPACE = 1;
|
|
180
|
+
// padding and border on each side
|
|
181
|
+
var widthWithPadding = width + 2 * PADDING + 2 * BORDER_WIDTH + ADDITIONAL_SPACE;
|
|
182
|
+
// padding and border on top and bottom
|
|
183
|
+
var heightWithPadding = height + 2 * PADDING + 2 * BORDER_WIDTH + ADDITIONAL_SPACE;
|
|
169
184
|
var responseAreaWidth = parseFloat(emptyResponseAreaWidth) || 0;
|
|
170
185
|
var responseAreaHeight = parseFloat(emptyResponseAreaHeight) || 0;
|
|
171
186
|
var adjustedWidth = widthWithPadding <= responseAreaWidth ? responseAreaWidth : widthWithPadding;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blank.js","names":["_react","_interopRequireWildcard","require","_propTypes","_interopRequireDefault","_mathRendering","_debug","_core","_utilities","_styles","_Chip","_classnames","_renderUi","_colors","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","_typeof","has","get","set","_t","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ownKeys","keys","getOwnPropertySymbols","filter","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","log","debug","StyledContent","styled","_ref","dragged","over","border","concat","color","primary","minWidth","touchAction","overflow","whiteSpace","opacity","StyledChip","Chip","backgroundColor","background","text","fontSize","maxWidth","position","borderRadius","grey","correct","incorrect","StyledChipLabel","pointerEvents","display","padding","marginTop","marginBottom","left","top","transform","BlankContent","_ref2","_dragItem$choice","_frozenRef$current","_frozenRef$current2","disabled","choice","isOver","isDragging","dragItem","emptyResponseAreaWidth","emptyResponseAreaHeight","rootRef","useRef","spanRef","frozenRef","measuringRef","_useState","useState","height","width","_useState2","_slicedToArray2","dimensions","setDimensions","handleImageLoad","updateDimensions","handleElements","_spanRef$current","imageElement","current","querySelector","onload","setTimeout","getMeasureNode","mjx","parentElement","img","style","offsetHeight","measureNode","node","rect","getBoundingClientRect","offsetWidth","Math","max","scrollHeight","widthWithPadding","heightWithPadding","responseAreaWidth","parseFloat","responseAreaHeight","adjustedWidth","adjustedHeight","prevState","nextWidth","nextHeight","getRootDimensions","isNaN","rootStyle","minHeight","useEffect","IntersectionObserver","undefined","io","entries","some","isIntersecting","threshold","observe","disconnect","renderMath","value","draggedLabel","label","createElement","clickable","ref","component","Fragment","draggable","className","classnames","hidden","dangerouslySetInnerHTML","__html","parentOver","variant","defaultProps","propTypes","id","PropTypes","oneOfType","string","number","bool","duplicates","object","onChange","func","instanceId","DragDropBlank","_ref3","_dragItem$data","_useDraggable","useDraggable","data","fromChoice","type","dragAttributes","attributes","dragListeners","listeners","setDragNodeRef","setNodeRef","_useDroppable","useDroppable","accepts","setDropNodeRef","active","CSS","Translate","toString","_extends2","_default","exports"],"sources":["../../src/components/blank.jsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from 'react';\nimport PropTypes from 'prop-types';\nimport { renderMath } from '@pie-lib/math-rendering';\nimport debug from 'debug';\nimport { useDraggable, useDroppable } from '@dnd-kit/core';\nimport { CSS } from '@dnd-kit/utilities';\nimport { styled } from '@mui/material/styles';\nimport Chip from '@mui/material/Chip';\nimport classnames from 'classnames';\nimport { color } from '@pie-lib/render-ui';\nimport { grey } from '@mui/material/colors';\n\nconst log = debug('pie-lib:mask-markup:blank');\n\nconst StyledContent = styled('span')(({ dragged, over }) => ({\n border: `solid 0px ${color.primary()}`,\n minWidth: '200px',\n touchAction: 'none',\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n opacity: 1,\n ...(over && {\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n }),\n ...(dragged && {\n opacity: 0.5,\n }),\n}));\n\nconst StyledChip = styled(Chip)(() => ({\n backgroundColor: color.background(),\n border: `2px dashed ${color.text()}`,\n touchAction: 'none',\n color: color.text(),\n fontSize: 'inherit',\n maxWidth: '374px',\n position: 'relative',\n borderRadius: '3px',\n '&.over': {\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n },\n '&.parentOver': {\n border: `1px solid ${grey[500]}`,\n backgroundColor: `${grey[300]}`,\n },\n '&.correct': {\n border: `solid 1px ${color.correct()}`,\n },\n '&.incorrect': {\n border: `solid 1px ${color.incorrect()}`,\n },\n '&.Mui-disabled': {\n opacity: 1,\n },\n}));\n\nconst StyledChipLabel = styled('span')(() => ({\n whiteSpace: 'normal',\n // Added for touch devices, for image content.\n // This will prevent the context menu from appearing and not allowing other interactions with the image.\n // If interactions with the image in the token will be requested we should handle only the context Menu.\n pointerEvents: 'none',\n '& img': {\n display: 'block',\n padding: '2px 0',\n },\n // Remove default <p> margins to ensure consistent spacing across all wrapped content (p, span, div, math)\n // Padding for top and bottom will instead be controlled by the container for consistent layout\n // Ensures consistent behavior with pie-api-browser, where marginTop is already removed by a Bootstrap stylesheet\n '& p': {\n marginTop: '0',\n marginBottom: '0',\n },\n '& mjx-frac': {\n fontSize: '120% !important',\n },\n '&.over': {\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n },\n '&.hidden': {\n color: 'transparent',\n opacity: 0,\n },\n '&.dragged': {\n position: 'absolute',\n left: 16,\n maxWidth: '60px',\n top: '50%',\n transform: 'translateY(-50%)',\n },\n}));\n\nfunction BlankContent({\n disabled,\n choice,\n isOver,\n isDragging,\n dragItem,\n correct,\n emptyResponseAreaWidth,\n emptyResponseAreaHeight,\n}) {\n const rootRef = useRef(null);\n const spanRef = useRef(null);\n const frozenRef = useRef(null); // to use during dragging to prevent flickering\n const measuringRef = useRef(false); // guard against ResizeObserver feedback loops\n const [dimensions, setDimensions] = useState({ height: 0, width: 0 });\n\n const handleImageLoad = () => {\n updateDimensions();\n };\n\n const handleElements = () => {\n const imageElement = spanRef.current?.querySelector('img');\n if (imageElement) {\n imageElement.onload = handleImageLoad;\n } else {\n setTimeout(() => {\n updateDimensions();\n }, 300);\n }\n };\n\n const getMeasureNode = () => {\n if (!spanRef.current) return null;\n const mjx = spanRef.current.querySelector('mjx-container');\n if (mjx && spanRef.current.parentElement) return spanRef.current.parentElement;\n const img = spanRef.current.querySelector('img');\n if (img) return img;\n return spanRef.current;\n };\n\n const updateDimensions = () => {\n if (spanRef.current && rootRef.current && !measuringRef.current) {\n measuringRef.current = true;\n // Temporarily set rootRef width to 'auto' for natural measurement\n rootRef.current.style.width = 'auto';\n rootRef.current.style.height = 'auto';\n rootRef.current.offsetHeight;\n\n const measureNode = getMeasureNode();\n const node = measureNode || spanRef.current;\n const rect = node.getBoundingClientRect();\n const width = rect.width || node.offsetWidth || 0;\n const height = Math.max(\n rect.height || 0,\n node.offsetHeight || 0,\n node.scrollHeight || 0,\n spanRef.current.scrollHeight || 0,\n );\n\n const widthWithPadding = width + 24; // 12px padding on each side\n const heightWithPadding = height + 24; // 12px padding on top and bottom\n\n const responseAreaWidth = parseFloat(emptyResponseAreaWidth) || 0;\n const responseAreaHeight = parseFloat(emptyResponseAreaHeight) || 0;\n\n const adjustedWidth = widthWithPadding <= responseAreaWidth ? responseAreaWidth : widthWithPadding;\n const adjustedHeight = heightWithPadding <= responseAreaHeight ? responseAreaHeight : heightWithPadding;\n\n setDimensions((prevState) => ({\n width: adjustedWidth > responseAreaWidth ? adjustedWidth : prevState.width,\n height: adjustedHeight > responseAreaHeight ? adjustedHeight : prevState.height,\n }));\n\n const nextWidth = `${adjustedWidth}px`;\n const nextHeight = `${adjustedHeight}px`;\n if (rootRef.current.style.width !== nextWidth) {\n rootRef.current.style.width = nextWidth;\n }\n if (rootRef.current.style.height !== nextHeight) {\n rootRef.current.style.height = nextHeight;\n }\n measuringRef.current = false;\n }\n };\n\n const getRootDimensions = () => {\n // Handle potential non-numeric values\n const responseAreaWidth = !isNaN(parseFloat(emptyResponseAreaWidth)) ? parseFloat(emptyResponseAreaWidth) : 0;\n const responseAreaHeight = !isNaN(parseFloat(emptyResponseAreaHeight)) ? parseFloat(emptyResponseAreaHeight) : 0;\n\n const rootStyle = {\n height: dimensions.height || responseAreaHeight,\n width: dimensions.width || responseAreaWidth,\n };\n\n // add minWidth, minHeight if width and height are not defined\n return {\n ...rootStyle,\n ...(responseAreaWidth ? {} : { minWidth: 90 }),\n ...(responseAreaHeight ? {} : { minHeight: 32 }),\n };\n };\n\n useEffect(() => {\n handleElements();\n }, []);\n\n // Re-measure when the element first becomes visible — covers the tabbed-view case\n // where the initial measurement happened while the tab was hidden (size 0).\n useEffect(() => {\n if (typeof IntersectionObserver === 'undefined' || !rootRef.current) return undefined;\n const io = new IntersectionObserver(\n (entries) => {\n if (entries.some((e) => e.isIntersecting)) updateDimensions();\n },\n { threshold: 0 },\n );\n io.observe(rootRef.current);\n return () => io.disconnect();\n }, []);\n\n // Render math for the placeholder/preview when dragging over\n useEffect(() => {\n if (rootRef.current) {\n renderMath(rootRef.current);\n }\n }, [correct, isOver, dragItem?.choice?.value]);\n\n useEffect(() => {\n if (!choice) {\n setDimensions({ height: 0, width: 0 });\n return;\n }\n handleElements();\n }, [choice?.value]);\n\n useEffect(() => {\n if (!isOver && !isDragging) {\n frozenRef.current = {\n width: rootRef.current.offsetWidth,\n height: rootRef.current.offsetHeight,\n };\n }\n }, [choice, isOver, isDragging]);\n\n const draggedLabel = dragItem && isOver && dragItem.choice && dragItem.choice.value;\n const label = choice && choice.value;\n const style =\n isOver || isDragging\n ? {\n width: frozenRef.current?.width,\n height: frozenRef.current?.height,\n }\n : getRootDimensions();\n\n return (\n <StyledChip\n clickable={false}\n disabled={disabled}\n ref={rootRef}\n component=\"span\"\n label={\n <React.Fragment>\n <StyledChipLabel\n ref={spanRef}\n draggable={true}\n className={classnames({\n over: isOver,\n hidden: draggedLabel,\n })}\n dangerouslySetInnerHTML={{ __html: label || '' }}\n />\n {draggedLabel && (\n <StyledChipLabel\n draggable={true}\n className={classnames({\n over: isOver,\n dragged: true,\n })}\n dangerouslySetInnerHTML={{ __html: draggedLabel || '' }}\n />\n )}\n </React.Fragment>\n }\n className={classnames({\n over: isOver,\n parentOver: isOver,\n correct: correct !== undefined && correct,\n incorrect: correct !== undefined && !correct,\n })}\n variant={disabled ? 'outlined' : undefined}\n style={style}\n />\n );\n}\n\nBlankContent.defaultProps = {\n emptyResponseAreaWidth: 0,\n emptyResponseAreaHeight: 0,\n};\n\nBlankContent.propTypes = {\n id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n disabled: PropTypes.bool,\n duplicates: PropTypes.bool,\n choice: PropTypes.object,\n isOver: PropTypes.bool,\n dragItem: PropTypes.object,\n correct: PropTypes.bool,\n onChange: PropTypes.func,\n emptyResponseAreaWidth: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n emptyResponseAreaHeight: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n instanceId: PropTypes.string,\n};\n\n// New functional component using @dnd-kit hooks\nfunction DragDropBlank({\n id,\n disabled,\n duplicates,\n choice,\n correct,\n onChange,\n emptyResponseAreaWidth,\n emptyResponseAreaHeight,\n instanceId,\n}) {\n // Setup draggable functionality\n const {\n attributes: dragAttributes,\n listeners: dragListeners,\n setNodeRef: setDragNodeRef,\n transform,\n isDragging,\n } = useDraggable({\n id: `mask-blank-drag-${id}`,\n disabled: disabled || !choice,\n data: {\n id: id,\n choice: choice,\n instanceId: instanceId,\n fromChoice: false, // This is from a blank, not from choices\n type: 'MaskBlank',\n },\n });\n\n // Setup droppable functionality\n const {\n setNodeRef: setDropNodeRef,\n isOver,\n active: dragItem,\n } = useDroppable({\n id: `mask-blank-drop-${id}`,\n data: {\n id: id,\n accepts: ['MaskBlank'],\n instanceId: instanceId,\n },\n });\n\n // Combine refs for both drag and drop\n const setNodeRef = (node) => {\n setDragNodeRef(node);\n setDropNodeRef(node);\n };\n\n const style = {\n transform: CSS.Translate.toString(transform),\n };\n\n return (\n <StyledContent\n ref={setNodeRef}\n style={style}\n dragged={isDragging}\n over={isOver}\n {...dragAttributes}\n {...dragListeners}\n >\n <BlankContent\n id={id}\n disabled={disabled}\n duplicates={duplicates}\n choice={choice}\n isOver={isOver}\n dragItem={dragItem?.data?.current}\n correct={correct}\n onChange={onChange}\n emptyResponseAreaWidth={emptyResponseAreaWidth}\n emptyResponseAreaHeight={emptyResponseAreaHeight}\n instanceId={instanceId}\n />\n </StyledContent>\n );\n}\n\nDragDropBlank.defaultProps = {\n emptyResponseAreaWidth: 0,\n emptyResponseAreaHeight: 0,\n};\n\nDragDropBlank.propTypes = {\n id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n disabled: PropTypes.bool,\n duplicates: PropTypes.bool,\n choice: PropTypes.object,\n correct: PropTypes.bool,\n onChange: PropTypes.func,\n emptyResponseAreaWidth: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n emptyResponseAreaHeight: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n instanceId: PropTypes.string,\n};\n\nexport default DragDropBlank;\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,UAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AACA,IAAAQ,KAAA,GAAAN,sBAAA,CAAAF,OAAA;AACA,IAAAS,WAAA,GAAAP,sBAAA,CAAAF,OAAA;AACA,IAAAU,SAAA,GAAAV,OAAA;AACA,IAAAW,OAAA,GAAAX,OAAA;AAA4C,SAAAD,wBAAAa,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAf,uBAAA,YAAAA,wBAAAa,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,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7D1F,QAAQ,EAAEuF,qBAAS,CAACI,IAAI;EACxBC,UAAU,EAAEL,qBAAS,CAACI,IAAI;EAC1B1F,MAAM,EAAEsF,qBAAS,CAACM,MAAM;EACxB7G,OAAO,EAAEuG,qBAAS,CAACI,IAAI;EACvBG,QAAQ,EAAEP,qBAAS,CAACQ,IAAI;EACxB1F,sBAAsB,EAAEkF,qBAAS,CAACC,SAAS,CAAC,CAACD,qBAAS,CAACE,MAAM,EAAEF,qBAAS,CAACG,MAAM,CAAC,CAAC;EACjFpF,uBAAuB,EAAEiF,qBAAS,CAACC,SAAS,CAAC,CAACD,qBAAS,CAACE,MAAM,EAAEF,qBAAS,CAACG,MAAM,CAAC,CAAC;EAClFM,UAAU,EAAET,qBAAS,CAACE;AACxB,CAAC;AAAC,IAAA+B,QAAA,GAAAC,OAAA,cAEaxB,aAAa","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"blank.js","names":["_react","_interopRequireWildcard","require","_propTypes","_interopRequireDefault","_mathRendering","_debug","_core","_utilities","_styles","_Chip","_classnames","_renderUi","_colors","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","_typeof","has","get","set","_t","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ownKeys","keys","getOwnPropertySymbols","filter","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","log","debug","StyledContent","styled","_ref","dragged","over","border","concat","color","primary","minWidth","touchAction","overflow","whiteSpace","opacity","StyledChip","Chip","backgroundColor","background","text","fontSize","maxWidth","position","borderRadius","grey","correct","incorrect","StyledChipLabel","pointerEvents","display","padding","marginTop","marginBottom","left","top","transform","BlankContent","_ref2","_dragItem$choice","_frozenRef$current","_frozenRef$current2","disabled","choice","isOver","isDragging","dragItem","emptyResponseAreaWidth","emptyResponseAreaHeight","rootRef","useRef","spanRef","frozenRef","measuringRef","_useState","useState","height","width","_useState2","_slicedToArray2","dimensions","setDimensions","handleImageLoad","updateDimensions","handleElements","_spanRef$current","imageElement","current","querySelector","onload","setTimeout","getMeasureNode","mjx","parentElement","img","hasTextContent","textContent","trim","style","offsetHeight","measureNode","node","rect","getBoundingClientRect","offsetWidth","Math","max","scrollHeight","PADDING","BORDER_WIDTH","ADDITIONAL_SPACE","widthWithPadding","heightWithPadding","responseAreaWidth","parseFloat","responseAreaHeight","adjustedWidth","adjustedHeight","prevState","nextWidth","nextHeight","getRootDimensions","isNaN","rootStyle","minHeight","useEffect","IntersectionObserver","undefined","io","entries","some","isIntersecting","threshold","observe","disconnect","renderMath","value","draggedLabel","label","createElement","clickable","ref","component","Fragment","draggable","className","classnames","hidden","dangerouslySetInnerHTML","__html","parentOver","variant","defaultProps","propTypes","id","PropTypes","oneOfType","string","number","bool","duplicates","object","onChange","func","instanceId","DragDropBlank","_ref3","_dragItem$data","_useDraggable","useDraggable","data","fromChoice","type","dragAttributes","attributes","dragListeners","listeners","setDragNodeRef","setNodeRef","_useDroppable","useDroppable","accepts","setDropNodeRef","active","CSS","Translate","toString","_extends2","_default","exports"],"sources":["../../src/components/blank.jsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from 'react';\nimport PropTypes from 'prop-types';\nimport { renderMath } from '@pie-lib/math-rendering';\nimport debug from 'debug';\nimport { useDraggable, useDroppable } from '@dnd-kit/core';\nimport { CSS } from '@dnd-kit/utilities';\nimport { styled } from '@mui/material/styles';\nimport Chip from '@mui/material/Chip';\nimport classnames from 'classnames';\nimport { color } from '@pie-lib/render-ui';\nimport { grey } from '@mui/material/colors';\n\nconst log = debug('pie-lib:mask-markup:blank');\n\nconst StyledContent = styled('span')(({ dragged, over }) => ({\n border: `solid 0px ${color.primary()}`,\n minWidth: '200px',\n touchAction: 'none',\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n opacity: 1,\n ...(over && {\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n }),\n ...(dragged && {\n opacity: 0.5,\n }),\n}));\n\nconst StyledChip = styled(Chip)(() => ({\n backgroundColor: color.background(),\n border: `2px dashed ${color.text()}`,\n touchAction: 'none',\n color: color.text(),\n fontSize: 'inherit',\n maxWidth: '374px',\n position: 'relative',\n borderRadius: '3px',\n '&.over': {\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n },\n '&.parentOver': {\n border: `1px solid ${grey[500]}`,\n backgroundColor: `${grey[300]}`,\n },\n '&.correct': {\n border: `solid 1px ${color.correct()}`,\n },\n '&.incorrect': {\n border: `solid 1px ${color.incorrect()}`,\n },\n '&.Mui-disabled': {\n opacity: 1,\n },\n}));\n\nconst StyledChipLabel = styled('span')(() => ({\n whiteSpace: 'normal',\n // Added for touch devices, for image content.\n // This will prevent the context menu from appearing and not allowing other interactions with the image.\n // If interactions with the image in the token will be requested we should handle only the context Menu.\n pointerEvents: 'none',\n '& img': {\n display: 'block',\n padding: '2px 0',\n },\n // Remove default <p> margins to ensure consistent spacing across all wrapped content (p, span, div, math)\n // Padding for top and bottom will instead be controlled by the container for consistent layout\n // Ensures consistent behavior with pie-api-browser, where marginTop is already removed by a Bootstrap stylesheet\n '& p': {\n marginTop: '0',\n marginBottom: '0',\n },\n '& mjx-frac': {\n fontSize: '120% !important',\n },\n '& mjx-mn:has(~ mjx-mfrac), mjx-mfrac ~ mjx-mn': {\n fontSize: '120% !important',\n },\n '&.over': {\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n },\n '&.hidden': {\n color: 'transparent',\n opacity: 0,\n },\n '&.dragged': {\n position: 'absolute',\n left: 16,\n maxWidth: '60px',\n top: '50%',\n transform: 'translateY(-50%)',\n },\n}));\n\nfunction BlankContent({\n disabled,\n choice,\n isOver,\n isDragging,\n dragItem,\n correct,\n emptyResponseAreaWidth,\n emptyResponseAreaHeight,\n}) {\n const rootRef = useRef(null);\n const spanRef = useRef(null);\n const frozenRef = useRef(null); // to use during dragging to prevent flickering\n const measuringRef = useRef(false); // guard against ResizeObserver feedback loops\n const [dimensions, setDimensions] = useState({ height: 0, width: 0 });\n\n const handleImageLoad = () => {\n updateDimensions();\n };\n\n const handleElements = () => {\n const imageElement = spanRef.current?.querySelector('img');\n if (imageElement) {\n imageElement.onload = handleImageLoad;\n } else {\n setTimeout(() => {\n updateDimensions();\n }, 300);\n }\n };\n\n const getMeasureNode = () => {\n if (!spanRef.current) {\n return null;\n }\n\n const mjx = spanRef.current.querySelector('mjx-container');\n\n if (mjx && spanRef.current.parentElement) {\n return spanRef.current.parentElement;\n }\n\n const img = spanRef.current.querySelector('img');\n\n if (img) {\n // If there's text alongside the image, measure the full span to capture both dimensions\n const hasTextContent = spanRef.current.textContent.trim().length > 0;\n\n return hasTextContent ? spanRef.current : img;\n }\n\n return spanRef.current;\n };\n\n const updateDimensions = () => {\n if (spanRef.current && rootRef.current && !measuringRef.current) {\n measuringRef.current = true;\n // Temporarily set rootRef width to 'auto' for natural measurement\n rootRef.current.style.width = 'auto';\n rootRef.current.style.height = 'auto';\n rootRef.current.offsetHeight;\n\n const measureNode = getMeasureNode();\n const node = measureNode || spanRef.current;\n const rect = node.getBoundingClientRect();\n const width = node.offsetWidth || rect.width || 0;\n const height = Math.max(\n node.offsetHeight || 0,\n rect.height || 0,\n node.scrollHeight || 0,\n spanRef.current.scrollHeight || 0,\n );\n\n const PADDING = 12;\n const BORDER_WIDTH = 2;\n const ADDITIONAL_SPACE = 1;\n // padding and border on each side\n const widthWithPadding = width + 2 * PADDING + 2 * BORDER_WIDTH + ADDITIONAL_SPACE;\n // padding and border on top and bottom\n const heightWithPadding = height + 2 * PADDING + 2 * BORDER_WIDTH + ADDITIONAL_SPACE;\n\n const responseAreaWidth = parseFloat(emptyResponseAreaWidth) || 0;\n const responseAreaHeight = parseFloat(emptyResponseAreaHeight) || 0;\n\n const adjustedWidth = widthWithPadding <= responseAreaWidth ? responseAreaWidth : widthWithPadding;\n const adjustedHeight = heightWithPadding <= responseAreaHeight ? responseAreaHeight : heightWithPadding;\n\n setDimensions((prevState) => ({\n width: adjustedWidth > responseAreaWidth ? adjustedWidth : prevState.width,\n height: adjustedHeight > responseAreaHeight ? adjustedHeight : prevState.height,\n }));\n\n const nextWidth = `${adjustedWidth}px`;\n const nextHeight = `${adjustedHeight}px`;\n if (rootRef.current.style.width !== nextWidth) {\n rootRef.current.style.width = nextWidth;\n }\n if (rootRef.current.style.height !== nextHeight) {\n rootRef.current.style.height = nextHeight;\n }\n measuringRef.current = false;\n }\n };\n\n const getRootDimensions = () => {\n // Handle potential non-numeric values\n const responseAreaWidth = !isNaN(parseFloat(emptyResponseAreaWidth)) ? parseFloat(emptyResponseAreaWidth) : 0;\n const responseAreaHeight = !isNaN(parseFloat(emptyResponseAreaHeight)) ? parseFloat(emptyResponseAreaHeight) : 0;\n\n const rootStyle = {\n height: dimensions.height || responseAreaHeight,\n width: dimensions.width || responseAreaWidth,\n };\n\n // add minWidth, minHeight if width and height are not defined\n return {\n ...rootStyle,\n ...(responseAreaWidth ? {} : { minWidth: 90 }),\n ...(responseAreaHeight ? {} : { minHeight: 32 }),\n };\n };\n\n useEffect(() => {\n handleElements();\n }, []);\n\n // Re-measure when the element first becomes visible — covers the tabbed-view case\n // where the initial measurement happened while the tab was hidden (size 0).\n useEffect(() => {\n if (typeof IntersectionObserver === 'undefined' || !rootRef.current) return undefined;\n const io = new IntersectionObserver(\n (entries) => {\n if (entries.some((e) => e.isIntersecting)) updateDimensions();\n },\n { threshold: 0 },\n );\n io.observe(rootRef.current);\n return () => io.disconnect();\n }, []);\n\n // Render math for the placeholder/preview when dragging over\n useEffect(() => {\n if (rootRef.current) {\n renderMath(rootRef.current);\n }\n }, [correct, isOver, dragItem?.choice?.value]);\n\n useEffect(() => {\n if (!choice) {\n setDimensions({ height: 0, width: 0 });\n return;\n }\n handleElements();\n }, [choice?.value]);\n\n useEffect(() => {\n if (!isOver && !isDragging) {\n frozenRef.current = {\n width: rootRef.current.offsetWidth,\n height: rootRef.current.offsetHeight,\n };\n }\n }, [choice, isOver, isDragging]);\n\n const draggedLabel = dragItem && isOver && dragItem.choice && dragItem.choice.value;\n const label = choice && choice.value;\n const style =\n isOver || isDragging\n ? {\n width: frozenRef.current?.width,\n height: frozenRef.current?.height,\n }\n : getRootDimensions();\n\n return (\n <StyledChip\n clickable={false}\n disabled={disabled}\n ref={rootRef}\n component=\"span\"\n label={\n <React.Fragment>\n <StyledChipLabel\n ref={spanRef}\n draggable={true}\n className={classnames({\n over: isOver,\n hidden: draggedLabel,\n })}\n dangerouslySetInnerHTML={{ __html: label || '' }}\n />\n {draggedLabel && (\n <StyledChipLabel\n draggable={true}\n className={classnames({\n over: isOver,\n dragged: true,\n })}\n dangerouslySetInnerHTML={{ __html: draggedLabel || '' }}\n />\n )}\n </React.Fragment>\n }\n className={classnames({\n over: isOver,\n parentOver: isOver,\n correct: correct !== undefined && correct,\n incorrect: correct !== undefined && !correct,\n })}\n variant={disabled ? 'outlined' : undefined}\n style={style}\n />\n );\n}\n\nBlankContent.defaultProps = {\n emptyResponseAreaWidth: 0,\n emptyResponseAreaHeight: 0,\n};\n\nBlankContent.propTypes = {\n id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n disabled: PropTypes.bool,\n duplicates: PropTypes.bool,\n choice: PropTypes.object,\n isOver: PropTypes.bool,\n dragItem: PropTypes.object,\n correct: PropTypes.bool,\n onChange: PropTypes.func,\n emptyResponseAreaWidth: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n emptyResponseAreaHeight: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n instanceId: PropTypes.string,\n};\n\n// New functional component using @dnd-kit hooks\nfunction DragDropBlank({\n id,\n disabled,\n duplicates,\n choice,\n correct,\n onChange,\n emptyResponseAreaWidth,\n emptyResponseAreaHeight,\n instanceId,\n}) {\n // Setup draggable functionality\n const {\n attributes: dragAttributes,\n listeners: dragListeners,\n setNodeRef: setDragNodeRef,\n transform,\n isDragging,\n } = useDraggable({\n id: `mask-blank-drag-${id}`,\n disabled: disabled || !choice,\n data: {\n id: id,\n choice: choice,\n instanceId: instanceId,\n fromChoice: false, // This is from a blank, not from choices\n type: 'MaskBlank',\n },\n });\n\n // Setup droppable functionality\n const {\n setNodeRef: setDropNodeRef,\n isOver,\n active: dragItem,\n } = useDroppable({\n id: `mask-blank-drop-${id}`,\n data: {\n id: id,\n accepts: ['MaskBlank'],\n instanceId: instanceId,\n },\n });\n\n // Combine refs for both drag and drop\n const setNodeRef = (node) => {\n setDragNodeRef(node);\n setDropNodeRef(node);\n };\n\n const style = {\n transform: CSS.Translate.toString(transform),\n };\n\n return (\n <StyledContent\n ref={setNodeRef}\n style={style}\n dragged={isDragging}\n over={isOver}\n {...dragAttributes}\n {...dragListeners}\n >\n <BlankContent\n id={id}\n disabled={disabled}\n duplicates={duplicates}\n choice={choice}\n isOver={isOver}\n dragItem={dragItem?.data?.current}\n correct={correct}\n onChange={onChange}\n emptyResponseAreaWidth={emptyResponseAreaWidth}\n emptyResponseAreaHeight={emptyResponseAreaHeight}\n instanceId={instanceId}\n />\n </StyledContent>\n );\n}\n\nDragDropBlank.defaultProps = {\n emptyResponseAreaWidth: 0,\n emptyResponseAreaHeight: 0,\n};\n\nDragDropBlank.propTypes = {\n id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n disabled: PropTypes.bool,\n duplicates: PropTypes.bool,\n choice: PropTypes.object,\n correct: PropTypes.bool,\n onChange: PropTypes.func,\n emptyResponseAreaWidth: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n emptyResponseAreaHeight: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n instanceId: PropTypes.string,\n};\n\nexport default DragDropBlank;\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,UAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA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ACG,MAAM,CAAC,CAAC;EAClFM,UAAU,EAAET,qBAAS,CAACE;AACxB,CAAC;AAAC,IAAA+B,QAAA,GAAAC,OAAA,cAEaxB,aAAa","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-lib/mask-markup",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.13",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "src/index.js",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"@mui/icons-material": "^7.3.4",
|
|
15
15
|
"@mui/material": "^7.3.4",
|
|
16
16
|
"@pie-lib/drag": "^4.0.6",
|
|
17
|
-
"@pie-lib/editable-html-tip-tap": "^2.1.
|
|
17
|
+
"@pie-lib/editable-html-tip-tap": "^2.1.11",
|
|
18
18
|
"@pie-lib/math-rendering": "^5.1.0",
|
|
19
19
|
"@pie-lib/render-ui": "^6.1.3",
|
|
20
20
|
"classnames": "^2.2.6",
|
|
@@ -28,5 +28,5 @@
|
|
|
28
28
|
"keywords": [],
|
|
29
29
|
"author": "",
|
|
30
30
|
"license": "ISC",
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "674bec751a99ddb5a3525f08ff48fdc52c68cb02"
|
|
32
32
|
}
|
|
@@ -4,6 +4,21 @@ import Choice from '../choice';
|
|
|
4
4
|
import { choice } from '../../__tests__/utils';
|
|
5
5
|
import Choices from '../index';
|
|
6
6
|
|
|
7
|
+
// Collect the CSS rules emotion/MUI injected into the document (jsdom uses insertRule).
|
|
8
|
+
const collectEmotionRules = () => {
|
|
9
|
+
const rules = [];
|
|
10
|
+
for (const sheet of Array.from(document.styleSheets)) {
|
|
11
|
+
try {
|
|
12
|
+
for (const rule of Array.from(sheet.cssRules)) {
|
|
13
|
+
rules.push(rule.cssText);
|
|
14
|
+
}
|
|
15
|
+
} catch (e) {
|
|
16
|
+
/* inaccessible stylesheet */
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return rules;
|
|
20
|
+
};
|
|
21
|
+
|
|
7
22
|
// Mock @dnd-kit hooks to avoid DndContext requirement
|
|
8
23
|
jest.mock('@dnd-kit/core', () => ({
|
|
9
24
|
useDraggable: jest.fn(() => ({
|
|
@@ -71,5 +86,24 @@ describe('index', () => {
|
|
|
71
86
|
expect(container.firstChild).toBeInTheDocument();
|
|
72
87
|
});
|
|
73
88
|
});
|
|
89
|
+
|
|
90
|
+
describe('fraction math styling', () => {
|
|
91
|
+
it('enlarges numerator/denominator digits adjacent to a fraction to 120%', () => {
|
|
92
|
+
render(<Choice {...defaultProps} />);
|
|
93
|
+
// The new rule targets mjx-mn digits that sit next to an mjx-mfrac.
|
|
94
|
+
const rule = collectEmotionRules().find((r) => r.includes('mjx-mn') && r.includes('mjx-mfrac'));
|
|
95
|
+
expect(rule).toBeDefined();
|
|
96
|
+
expect(rule).toMatch(/mjx-mn:has\(~\s*mjx-mfrac\)/);
|
|
97
|
+
expect(rule).toMatch(/mjx-mfrac\s*~\s*mjx-mn/);
|
|
98
|
+
expect(rule).toMatch(/font-size:\s*120%\s*!important/i);
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
it('keeps the existing mjx-frac 120% rule', () => {
|
|
102
|
+
render(<Choice {...defaultProps} />);
|
|
103
|
+
const rule = collectEmotionRules().find((r) => /(^|[^-])mjx-frac/.test(r) && !r.includes('mjx-mfrac'));
|
|
104
|
+
expect(rule).toBeDefined();
|
|
105
|
+
expect(rule).toMatch(/font-size:\s*120%\s*!important/i);
|
|
106
|
+
});
|
|
107
|
+
});
|
|
74
108
|
});
|
|
75
109
|
});
|
package/src/choices/choice.jsx
CHANGED
|
@@ -50,6 +50,9 @@ const StyledChipLabel = styled('span')(() => ({
|
|
|
50
50
|
'& mjx-frac': {
|
|
51
51
|
fontSize: '120% !important',
|
|
52
52
|
},
|
|
53
|
+
'& mjx-mn:has(~ mjx-mfrac), mjx-mfrac ~ mjx-mn': {
|
|
54
|
+
fontSize: '120% !important',
|
|
55
|
+
},
|
|
53
56
|
}));
|
|
54
57
|
|
|
55
58
|
export default function Choice({ choice, disabled, instanceId }) {
|
|
@@ -71,8 +74,8 @@ export default function Choice({ choice, disabled, instanceId }) {
|
|
|
71
74
|
style={
|
|
72
75
|
isDragging
|
|
73
76
|
? {
|
|
74
|
-
|
|
75
|
-
|
|
77
|
+
width: rootRef.current?.offsetWidth || 90, // min-width of chip is 90px, so if we don't have the width, we can use 90px as a fallback
|
|
78
|
+
height: rootRef.current?.offsetHeight || 32, // min-height of chip is 32px, so if we don't have the height, we can use 32px as a fallback
|
|
76
79
|
}
|
|
77
80
|
: {}
|
|
78
81
|
}
|
|
@@ -30,6 +30,21 @@ jest.mock('@pie-lib/math-rendering', () => ({
|
|
|
30
30
|
renderMath: jest.fn(),
|
|
31
31
|
}));
|
|
32
32
|
|
|
33
|
+
// Collect the CSS rules emotion/MUI injected into the document (jsdom uses insertRule).
|
|
34
|
+
const collectEmotionRules = () => {
|
|
35
|
+
const rules = [];
|
|
36
|
+
for (const sheet of Array.from(document.styleSheets)) {
|
|
37
|
+
try {
|
|
38
|
+
for (const rule of Array.from(sheet.cssRules)) {
|
|
39
|
+
rules.push(rule.cssText);
|
|
40
|
+
}
|
|
41
|
+
} catch (e) {
|
|
42
|
+
/* inaccessible stylesheet */
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return rules;
|
|
46
|
+
};
|
|
47
|
+
|
|
33
48
|
describe('Blank', () => {
|
|
34
49
|
const { renderMath } = require('@pie-lib/math-rendering');
|
|
35
50
|
const onChange = jest.fn();
|
|
@@ -152,8 +167,8 @@ describe('Blank', () => {
|
|
|
152
167
|
const chip = wrapper && wrapper.firstChild; // StyledChip (rootRef)
|
|
153
168
|
|
|
154
169
|
// Width and height should include padding (24px) around measured content
|
|
155
|
-
expect(chip.style.width).toBe('
|
|
156
|
-
expect(chip.style.height).toBe('
|
|
170
|
+
expect(chip.style.width).toBe('129px');
|
|
171
|
+
expect(chip.style.height).toBe('49px');
|
|
157
172
|
|
|
158
173
|
rectSpy.mockRestore();
|
|
159
174
|
jest.useRealTimers();
|
|
@@ -184,6 +199,24 @@ describe('Blank', () => {
|
|
|
184
199
|
});
|
|
185
200
|
});
|
|
186
201
|
|
|
202
|
+
describe('fraction math styling', () => {
|
|
203
|
+
it('enlarges numerator/denominator digits adjacent to a fraction to 120%', () => {
|
|
204
|
+
render(<Blank {...defaultProps} />);
|
|
205
|
+
const rule = collectEmotionRules().find((r) => r.includes('mjx-mn') && r.includes('mjx-mfrac'));
|
|
206
|
+
expect(rule).toBeDefined();
|
|
207
|
+
expect(rule).toMatch(/mjx-mn:has\(~\s*mjx-mfrac\)/);
|
|
208
|
+
expect(rule).toMatch(/mjx-mfrac\s*~\s*mjx-mn/);
|
|
209
|
+
expect(rule).toMatch(/font-size:\s*120%\s*!important/i);
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
it('keeps the existing mjx-frac 120% rule', () => {
|
|
213
|
+
render(<Blank {...defaultProps} />);
|
|
214
|
+
const rule = collectEmotionRules().find((r) => /(^|[^-])mjx-frac/.test(r) && !r.includes('mjx-mfrac'));
|
|
215
|
+
expect(rule).toBeDefined();
|
|
216
|
+
expect(rule).toMatch(/font-size:\s*120%\s*!important/i);
|
|
217
|
+
});
|
|
218
|
+
});
|
|
219
|
+
|
|
187
220
|
describe('drag and drop', () => {
|
|
188
221
|
it('accepts drag item when not disabled', () => {
|
|
189
222
|
render(<Blank {...defaultProps} isOver={true} dragItem={{ choice: { value: 'Dog' } }} />);
|
package/src/components/blank.jsx
CHANGED
|
@@ -76,6 +76,9 @@ const StyledChipLabel = styled('span')(() => ({
|
|
|
76
76
|
'& mjx-frac': {
|
|
77
77
|
fontSize: '120% !important',
|
|
78
78
|
},
|
|
79
|
+
'& mjx-mn:has(~ mjx-mfrac), mjx-mfrac ~ mjx-mn': {
|
|
80
|
+
fontSize: '120% !important',
|
|
81
|
+
},
|
|
79
82
|
'&.over': {
|
|
80
83
|
whiteSpace: 'nowrap',
|
|
81
84
|
overflow: 'hidden',
|
|
@@ -125,11 +128,25 @@ function BlankContent({
|
|
|
125
128
|
};
|
|
126
129
|
|
|
127
130
|
const getMeasureNode = () => {
|
|
128
|
-
if (!spanRef.current)
|
|
131
|
+
if (!spanRef.current) {
|
|
132
|
+
return null;
|
|
133
|
+
}
|
|
134
|
+
|
|
129
135
|
const mjx = spanRef.current.querySelector('mjx-container');
|
|
130
|
-
|
|
136
|
+
|
|
137
|
+
if (mjx && spanRef.current.parentElement) {
|
|
138
|
+
return spanRef.current.parentElement;
|
|
139
|
+
}
|
|
140
|
+
|
|
131
141
|
const img = spanRef.current.querySelector('img');
|
|
132
|
-
|
|
142
|
+
|
|
143
|
+
if (img) {
|
|
144
|
+
// If there's text alongside the image, measure the full span to capture both dimensions
|
|
145
|
+
const hasTextContent = spanRef.current.textContent.trim().length > 0;
|
|
146
|
+
|
|
147
|
+
return hasTextContent ? spanRef.current : img;
|
|
148
|
+
}
|
|
149
|
+
|
|
133
150
|
return spanRef.current;
|
|
134
151
|
};
|
|
135
152
|
|
|
@@ -144,16 +161,21 @@ function BlankContent({
|
|
|
144
161
|
const measureNode = getMeasureNode();
|
|
145
162
|
const node = measureNode || spanRef.current;
|
|
146
163
|
const rect = node.getBoundingClientRect();
|
|
147
|
-
const width =
|
|
164
|
+
const width = node.offsetWidth || rect.width || 0;
|
|
148
165
|
const height = Math.max(
|
|
149
|
-
rect.height || 0,
|
|
150
166
|
node.offsetHeight || 0,
|
|
167
|
+
rect.height || 0,
|
|
151
168
|
node.scrollHeight || 0,
|
|
152
169
|
spanRef.current.scrollHeight || 0,
|
|
153
170
|
);
|
|
154
171
|
|
|
155
|
-
const
|
|
156
|
-
const
|
|
172
|
+
const PADDING = 12;
|
|
173
|
+
const BORDER_WIDTH = 2;
|
|
174
|
+
const ADDITIONAL_SPACE = 1;
|
|
175
|
+
// padding and border on each side
|
|
176
|
+
const widthWithPadding = width + 2 * PADDING + 2 * BORDER_WIDTH + ADDITIONAL_SPACE;
|
|
177
|
+
// padding and border on top and bottom
|
|
178
|
+
const heightWithPadding = height + 2 * PADDING + 2 * BORDER_WIDTH + ADDITIONAL_SPACE;
|
|
157
179
|
|
|
158
180
|
const responseAreaWidth = parseFloat(emptyResponseAreaWidth) || 0;
|
|
159
181
|
const responseAreaHeight = parseFloat(emptyResponseAreaHeight) || 0;
|