@pie-element/extended-text-entry 14.0.0-next.42 → 14.0.0-next.43

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/module/element.js CHANGED
@@ -1 +1 @@
1
- import{_dll_prop_types as e,_dll_mui__material as t,_dll_mui__material_styles as n,_dll_lodash as o,_dll_debug as r,_dll_pie_lib__render_ui as i,_dll_react_dom as s}from"../../../@pie-lib/shared-module@^3.0.5/module/index.js";import{_dll_pie_lib__math_rendering as a}from"../../../@pie-lib/math-rendering-module@^4.0.5/module/index.js";import{_dll_pie_lib__editable_html_tip_tap as l}from"../../../@pie-lib/editable-html-module@^6.0.5/module/index.js";import{_dll_pie_lib__config_ui as c}from"../../../@pie-lib/config-module@^3.0.0/module/index.js";var d={exports:{}},p={},u=Symbol.for("react.element"),h=Symbol.for("react.portal"),f=Symbol.for("react.fragment"),m=Symbol.for("react.strict_mode"),g=Symbol.for("react.profiler"),y=Symbol.for("react.provider"),b=Symbol.for("react.context"),v=Symbol.for("react.forward_ref"),C=Symbol.for("react.suspense"),_=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),E=Symbol.iterator;var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,k={};function R(e,t,n){this.props=e,this.context=t,this.refs=k,this.updater=n||S}function A(){}function T(e,t,n){this.props=e,this.context=t,this.refs=k,this.updater=n||S}R.prototype.isReactComponent={},R.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},R.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},A.prototype=R.prototype;var P=T.prototype=new A;P.constructor=T,w(P,R.prototype),P.isPureReactComponent=!0;var L=Array.isArray,M=Object.prototype.hasOwnProperty,I={current:null},$={key:!0,ref:!0,__self:!0,__source:!0};function N(e,t,n){var o,r={},i=null,s=null;if(null!=t)for(o in void 0!==t.ref&&(s=t.ref),void 0!==t.key&&(i=""+t.key),t)M.call(t,o)&&!$.hasOwnProperty(o)&&(r[o]=t[o]);var a=arguments.length-2;if(1===a)r.children=n;else if(1<a){for(var l=Array(a),c=0;c<a;c++)l[c]=arguments[c+2];r.children=l}if(e&&e.defaultProps)for(o in a=e.defaultProps)void 0===r[o]&&(r[o]=a[o]);return{$$typeof:u,type:e,key:i,ref:s,props:r,_owner:I.current}}function D(e){return"object"==typeof e&&null!==e&&e.$$typeof===u}var O=/\/+/g;function j(e,t){return"object"==typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(e){return t[e]})}(""+e.key):t.toString(36)}function H(e,t,n,o,r){var i=typeof e;"undefined"!==i&&"boolean"!==i||(e=null);var s=!1;if(null===e)s=!0;else switch(i){case"string":case"number":s=!0;break;case"object":switch(e.$$typeof){case u:case h:s=!0}}if(s)return r=r(s=e),e=""===o?"."+j(s,0):o,L(r)?(n="",null!=e&&(n=e.replace(O,"$&/")+"/"),H(r,t,n,"",function(e){return e})):null!=r&&(D(r)&&(r=function(e,t){return{$$typeof:u,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(r,n+(!r.key||s&&s.key===r.key?"":(""+r.key).replace(O,"$&/")+"/")+e)),t.push(r)),1;if(s=0,o=""===o?".":o+":",L(e))for(var a=0;a<e.length;a++){var l=o+j(i=e[a],a);s+=H(i,t,n,l,r)}else if(l=function(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=E&&e[E]||e["@@iterator"])?e:null}(e),"function"==typeof l)for(e=l.call(e),a=0;!(i=e.next()).done;)s+=H(i=i.value,t,n,l=o+j(i,a++),r);else if("object"===i)throw t=String(e),Error("Objects are not valid as a React child (found: "+("[object Object]"===t?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return s}function W(e,t,n){if(null==e)return e;var o=[],r=0;return H(e,o,"","",function(e){return t.call(n,e,r++)}),o}function z(e){if(-1===e._status){var t=e._result;(t=t()).then(function(t){0!==e._status&&-1!==e._status||(e._status=1,e._result=t)},function(t){0!==e._status&&-1!==e._status||(e._status=2,e._result=t)}),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var q={current:null},V={transition:null},U={ReactCurrentDispatcher:q,ReactCurrentBatchConfig:V,ReactCurrentOwner:I};function F(){throw Error("act(...) is not supported in production builds of React.")}p.Children={map:W,forEach:function(e,t,n){W(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return W(e,function(){t++}),t},toArray:function(e){return W(e,function(e){return e})||[]},only:function(e){if(!D(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},p.Component=R,p.Fragment=f,p.Profiler=g,p.PureComponent=T,p.StrictMode=m,p.Suspense=C,p.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=U,p.act=F,p.cloneElement=function(e,t,n){if(null==e)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var o=w({},e.props),r=e.key,i=e.ref,s=e._owner;if(null!=t){if(void 0!==t.ref&&(i=t.ref,s=I.current),void 0!==t.key&&(r=""+t.key),e.type&&e.type.defaultProps)var a=e.type.defaultProps;for(l in t)M.call(t,l)&&!$.hasOwnProperty(l)&&(o[l]=void 0===t[l]&&void 0!==a?a[l]:t[l])}var l=arguments.length-2;if(1===l)o.children=n;else if(1<l){a=Array(l);for(var c=0;c<l;c++)a[c]=arguments[c+2];o.children=a}return{$$typeof:u,type:e.type,key:r,ref:i,props:o,_owner:s}},p.createContext=function(e){return(e={$$typeof:b,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null}).Provider={$$typeof:y,_context:e},e.Consumer=e},p.createElement=N,p.createFactory=function(e){var t=N.bind(null,e);return t.type=e,t},p.createRef=function(){return{current:null}},p.forwardRef=function(e){return{$$typeof:v,render:e}},p.isValidElement=D,p.lazy=function(e){return{$$typeof:x,_payload:{_status:-1,_result:e},_init:z}},p.memo=function(e,t){return{$$typeof:_,type:e,compare:void 0===t?null:t}},p.startTransition=function(e){var t=V.transition;V.transition={};try{e()}finally{V.transition=t}},p.unstable_act=F,p.useCallback=function(e,t){return q.current.useCallback(e,t)},p.useContext=function(e){return q.current.useContext(e)},p.useDebugValue=function(){},p.useDeferredValue=function(e){return q.current.useDeferredValue(e)},p.useEffect=function(e,t){return q.current.useEffect(e,t)},p.useId=function(){return q.current.useId()},p.useImperativeHandle=function(e,t,n){return q.current.useImperativeHandle(e,t,n)},p.useInsertionEffect=function(e,t){return q.current.useInsertionEffect(e,t)},p.useLayoutEffect=function(e,t){return q.current.useLayoutEffect(e,t)},p.useMemo=function(e,t){return q.current.useMemo(e,t)},p.useReducer=function(e,t,n){return q.current.useReducer(e,t,n)},p.useRef=function(e){return q.current.useRef(e)},p.useState=function(e){return q.current.useState(e)},p.useSyncExternalStore=function(e,t,n){return q.current.useSyncExternalStore(e,t,n)},p.useTransition=function(){return q.current.useTransition()},p.version="18.3.1",d.exports=p;var B=d.exports;const K=(e,t,n)=>{const o=n||[],r=o.reduce((e,t)=>e+t.textContent.length,0);let i=!0;if(r>t)return!1;for(e&&(3===e.nodeType&&e.parentNode&&!e.parentNode.hasAttribute("data-ann-id")&&o.push(e),e=e.firstChild);e&&i;)i=K(e,t,o),e=e.nextSibling;return o},Y=e=>{const{commonAncestorContainer:t,startContainer:n,endContainer:o,startOffset:r,endOffset:i}=e,s=[];let a=!1,l=!1,c="";const d=e=>{const{nodeValue:t,childNodes:p}=e;e===n&&e===o?(t&&(c+=t.substring(r,i)),a=l=!0):e===n?(t&&(c+=t.substring(r)),a=!0):e===o?(t&&(c+=t.substring(0,i)),l=!0):e&&3===e.nodeType&&e.parentNode&&!e.parentNode.hasAttribute("data-ann-id")&&t&&a&&!l&&(c+=t,s.push(e)),p.forEach(e=>{l||d(e)})};return d(t),[s,c]},G=e=>{const t=document.createElement("SPAN");return e.surroundContents(t),t},X=e=>{if(e.startContainer===e.endContainer)return[G(e)];const[t]=Y(e),n=document.createRange();n.selectNodeContents(e.startContainer),n.setStart(e.startContainer,e.startOffset);const o=G(n),r=document.createRange();r.selectNode(e.endContainer),r.setEnd(e.endContainer,e.endOffset);const i=G(r);return[o,...t.map(e=>{const t=document.createElement("SPAN");return e.parentNode.insertBefore(t,e),t.appendChild(e),t}),i]},Q=(e,t)=>{(e||[]).forEach(e=>{const t=e.parentNode,n=e.childNodes,o=n.length;if(o>0)for(let r=0;r<o;r++)t.insertBefore(n[0],e);else t.insertBefore(document.createTextNode(e.textContent),e);t.removeChild(e)}),t.normalize()},J=()=>{document.getSelection?(document.getSelection().removeAllRanges(),document.getSelection().addRange(document.createRange())):window.getSelection?window.getSelection().removeAllRanges?(window.getSelection().removeAllRanges(),window.getSelection().addRange(document.createRange())):window.getSelection().empty&&window.getSelection().empty():document.selection&&document.selection.empty()},Z=e=>e.length>=20||-1!==e.search(/\n|\r|\r\n/),ee=e=>Array.from(document.querySelectorAll(`[data-id='${e}']`)),te=e=>document.querySelector(`[data-ann-id='${e}']`),ne=e,{Popover:oe}=t,{TextField:re}=t,{styled:ie}=n,se=ie(oe)(({theme:e,annotationType:t})=>({"& .MuiPaper-root":{overflowX:"unset",overflowY:"unset",marginLeft:"16px","&::before":{position:"absolute",right:"100%",top:"13px",border:"solid transparent",content:'""',height:0,width:0,pointerEvents:"none",borderWidth:"7px",borderRightColor:e.palette.grey[100]},..."negative"===t&&{"&::before":{borderRightColor:"rgb(255, 204, 238) !important"}},..."positive"===t&&{"&::before":{borderRightColor:"rgb(153, 255, 153) !important"}}}})),ae=ie("div")(({theme:e,annotationType:t})=>({width:"200px",overflow:"hidden",borderRadius:"4px",backgroundColor:"#ffffff",border:`4px solid ${e.palette.grey[100]}`,..."negative"===t&&{borderColor:"rgb(255, 204, 238) !important"},..."positive"===t&&{borderColor:"rgb(153, 255, 153) !important"}})),le=ie("div")(({theme:e})=>({display:"flex",flexWrap:"wrap",borderTop:`2px solid ${e.palette.grey[100]}`})),ce=ie("div")(({theme:e,variant:t,annotationType:n})=>({flexGrow:1,width:"28%",textAlign:"center",padding:"4px",cursor:"pointer","&:not(:nth-child(3n))":{borderRight:`1px solid ${e.palette.grey[100]}`},"&:hover":{backgroundColor:e.palette.grey[100]},..."positive"===t&&{backgroundColor:"rgb(153, 255, 153) !important","&:hover":{filter:"brightness(85%)"}},..."negative"===t&&{backgroundColor:"rgb(255, 204, 238) !important","&:hover":{filter:"brightness(85%)"}},..."typeChange"===t&&"negative"===n&&{"&:hover":{backgroundColor:"rgb(153, 255, 153) !important"}},..."typeChange"===t&&"positive"===n&&{"&:hover":{backgroundColor:"rgb(255, 204, 238) !important"}}}));class de extends B.Component{static __initStatic(){this.propTypes={anchorEl:ne.object,open:ne.bool,offset:ne.number,value:ne.string,type:ne.string,onClose:ne.func,onDelete:ne.func,onSave:ne.func,onTypeChange:ne.func}}constructor(e){super(e),de.prototype.__init.call(this),de.prototype.__init2.call(this),de.prototype.__init3.call(this),this.state={value:e.value}}UNSAFE_componentWillReceiveProps(e){const{value:t}=e,{value:n}=this.props;t!==n&&this.setState({value:t})}__init(){this.onValueChange=e=>this.setState({value:e.target.value})}__init2(){this.handleSave=()=>{const{value:e,onSave:t,onClose:n,onDelete:o}=this.props,{value:r}=this.state;""===r&&o(),e!==r&&t(e,r),this.setState({value:""}),n()}}__init3(){this.handleTypeChange=()=>{const{onTypeChange:e,onDelete:t}=this.props,{value:n}=this.state;""===n?t():e(n),this.setState({value:""})}}render(){const{anchorEl:e,offset:t,onDelete:n,open:o,type:r}=this.props,{value:i}=this.state;return B.createElement(se,{anchorEl:e,elevation:2,open:o,onClose:this.handleSave,annotationType:r,style:{marginTop:`${t}px`,transition:"margin-top 2s ease-out"},transitionDuration:{enter:225,exit:195},anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"left"}},B.createElement(ae,{annotationType:r},B.createElement(re,{id:"annotation-editor",style:{padding:"2px 5px",width:"95%"},autoFocus:!0,multiline:!0,rows:1,maxRows:4,value:i,onChange:this.onValueChange,InputProps:{disableUnderline:!0}}),B.createElement(le,null,B.createElement(ce,{onClick:n},"Delete"),B.createElement(ce,{variant:"typeChange",annotationType:r,onClick:this.handleTypeChange},"negative"===r?"Green":"Pink"),B.createElement(ce,{onClick:this.handleSave},"Save"))))}}de.__initStatic();const pe=e,{styled:ue}=n,{Popover:he}=t,fe=ue(he)({"& .MuiPaper-root":{overflowX:"unset",overflowY:"unset",marginTop:"-16px","&::after":{position:"absolute",left:"calc(50% - 7px)",border:"solid transparent",content:'""',height:0,width:0,pointerEvents:"none",borderWidth:"7px",borderTopColor:"black"}}}),me=ue("div")(({theme:e})=>({width:"300px",overflow:"hidden",borderRadius:"4px",backgroundColor:e.palette.common.white,border:`2px solid ${e.palette.grey[100]}`})),ge=ue("div")({display:"flex",flexWrap:"wrap"}),ye=ue("div")(({theme:e})=>({display:"flex",flexWrap:"wrap",borderTop:`2px solid ${e.palette.grey[100]}`})),be=ue("div")(({theme:e,variant:t})=>({width:"22%",textAlign:"center",padding:"4px",cursor:"pointer",borderBottom:`1px solid ${e.palette.grey[100]}`,"&:not(:nth-child(4n))":{borderRight:`1px solid ${e.palette.grey[100]}`},"&:nth-child(4n)":{flexGrow:1},"&:hover":{backgroundColor:e.palette.grey[100]},..."positive"===t&&{backgroundColor:"rgb(153, 255, 153) !important","&:hover":{filter:"brightness(85%)"}},..."negative"===t&&{backgroundColor:"rgb(255, 204, 238) !important","&:hover":{filter:"brightness(85%)"}}}));class ve extends B.Component{static __initStatic(){this.propTypes={anchorEl:pe.object,open:pe.bool,annotations:pe.array,isNewAnnotation:pe.bool,onClose:pe.func,onDelete:pe.func,onEdit:pe.func,onWrite:pe.func,onAnnotate:pe.func}}render(){const{anchorEl:e,annotations:t,isNewAnnotation:n,onAnnotate:o,onClose:r,onEdit:i,onDelete:s,onWrite:a,open:l}=this.props;return B.createElement(fe,{anchorEl:e,open:l,onClose:r,elevation:5,transitionDuration:{enter:225,exit:195},anchorOrigin:{vertical:"top",horizontal:"center"},transformOrigin:{vertical:"bottom",horizontal:"center"}},B.createElement(me,null,B.createElement(ge,null,t.map((e,t)=>B.createElement(be,{key:`annotation-${t}`,variant:e.type,onClick:()=>o(e)},e.label))),B.createElement(ye,null,B.createElement(be,{onClick:r},"Cancel"),B.createElement(be,{style:{pointerEvents:"none"}}),n?B.createElement(B.Fragment,null,B.createElement(be,{variant:"positive",onClick:()=>a("positive")},"Write"),B.createElement(be,{variant:"negative",onClick:()=>a("negative")},"Write")):B.createElement(B.Fragment,null,B.createElement(be,{onClick:s},"Delete"),B.createElement(be,{onClick:i},"Edit")))))}}ve.__initStatic();const{styled:Ce}=n,_e=e,xe=l,{InputContainer:Ee}=c,Se=Ce("div")({padding:"10px 120px 10px 16px",backgroundColor:"rgba(0, 0, 0, 0.06)",border:"1px solid #ccc",borderRadius:"4px",overflowY:"scroll",lineHeight:"36px",whiteSpace:"pre-wrap",overflowWrap:"break-word","& p":{margin:0},"& span[data-latex]":{userSelect:"none","-webkit-user-select":"none","-moz-user-select":"none","-ms-user-select":"none"}}),we=Ce("div")({width:"230px"}),ke=Ce("div")({position:"relative",overflowX:"hidden",display:"flex"}),Re=Ce(Ee)(({theme:e})=>({paddingTop:e.spacing(2),marginBottom:e.spacing(2),marginTop:e.spacing(2),width:"100%"}));if(!document.getElementById("annotation-editor-styles")){const e=document.createElement("style");e.id="annotation-editor-styles",e.textContent='\n .sideAnnotation:before {\n position: absolute;\n right: var(--before-right, 100%);\n top: var(--before-top, 5px);\n border: solid transparent;\n content: "";\n height: 0;\n width: 0;\n pointer-events: none;\n border-width: var(--before-border-width, 7px);\n border-right-color: var(--before-border-color, rgb(153, 255, 153));\n }\n',document.head.appendChild(e)}class Ae extends B.Component{static __initStatic(){this.propTypes={text:_e.string,comment:_e.string,annotations:_e.array,predefinedAnnotations:_e.array,onChange:_e.func.isRequired,onCommentChange:_e.func.isRequired,width:_e.number,height:_e.number,maxHeight:_e.string,disabled:_e.bool,disabledMath:_e.bool,customKeys:_e.array,keypadMode:_e.string}}constructor(e){super(e),Ae.prototype.__init.call(this),Ae.prototype.__init2.call(this),Ae.prototype.__init3.call(this),Ae.prototype.__init4.call(this),Ae.prototype.__init5.call(this),Ae.prototype.__init6.call(this),Ae.prototype.__init7.call(this),Ae.prototype.__init8.call(this),Ae.prototype.__init9.call(this),Ae.prototype.__init10.call(this),Ae.prototype.__init11.call(this),Ae.prototype.__init12.call(this),Ae.prototype.__init13.call(this),Ae.prototype.__init14.call(this),Ae.prototype.__init15.call(this),this.state={anchorEl:null,openedMenu:!1,openedEditor:!1,selectedElems:[],labelElem:null,selectionDetails:null,annotation:null,annotationIndex:null}}componentDidMount(){const{annotations:e,text:t}=this.props;t&&e.forEach(e=>{const[t,n]=((e,t,n)=>{const o=K(n,t),r=[];let i=0;return o.forEach(n=>{const o=i+n.textContent.length;[e,t].forEach(e=>{i<=e&&e<o&&r.push({node:n,offset:e-i})}),i=o}),r})(e.start,e.end,this.textRef);if(t&&n){const o=document.createRange();o.setStart(t.node,t.offset),o.setEnd(n.node,n.offset);const r=X(o);this.createDOMAnnotation(r,e)}}),this.textRef&&(this.adjustAnnotationsPosition(),this.textRef.addEventListener("scroll",this.adjustAnnotationsPosition))}__init(){this.adjustAnnotationsPosition=()=>{if(this.textRef&&this.labelsRef){const e=this.textRef.offsetLeft+this.textRef.offsetWidth+8;Array.from(this.labelsRef.children).forEach(t=>{const n=ee(t.dataset.annId),o=(n[0].offsetTop?n[0].offsetTop:n[0].offsetParent.offsetTop)-this.textRef.scrollTop-6;t.style.top=`${o}px`,t.style.left=`${e}px`})}}}__init2(){this.handleClick=e=>{const{annotations:t}=this.props,{selectionDetails:n}=this.state;if(n)return;const{id:o,annId:r}=e.target.dataset,i=o||r,s=ee(i),a=te(i),l=t.findIndex(e=>e.id===i),c=a.hasAttribute("data-freeform");c&&(a.style.zIndex="10"),this.setState({anchorEl:s[0],openedMenu:!!o||!!r&&!c,openedEditor:!!r&&c,selectedElems:s,labelElem:a,annotationIndex:l,annotation:t[l],selectionDetails:null})}}__init3(){this.handleHover=e=>{const{id:t,annId:n}=e.target.dataset,o=t||n,r=ee(o),i=te(o),s=i.hasAttribute("data-freeform");r.forEach(e=>{e.style.zIndex="20",e.classList.contains("positive")?e.style.backgroundColor="rgb(51, 255, 51, 0.7)":e.classList.contains("negative")&&(e.style.backgroundColor="rgba(255, 102, 204, 0.55)")}),s?(i.style.zIndex="20",i.classList.contains("positive")?(i.style.backgroundColor="rgb(128, 255, 128)",i.style.setProperty("--before-border-color","rgb(153, 255, 153)")):i.classList.contains("negative")&&(i.style.backgroundColor="rgb(255, 179, 230)",i.style.setProperty("--before-border-color","rgb(255, 179, 230)"))):(i.style.zIndex="20",i.classList.contains("positive")?i.style.color="rgb(0, 77, 0)":i.classList.contains("negative")&&(i.style.color="rgb(153, 0, 102)"))}}__init4(){this.handleCancelHover=e=>{const{id:t,annId:n}=e.target.dataset,o=t||n,r=ee(o),i=te(o),s=i.hasAttribute("data-freeform");r.forEach(e=>{e.style.zIndex="",e.classList.contains("positive")?e.style.backgroundColor="rgb(51, 255, 51, 0.5)":e.classList.contains("negative")&&(e.style.backgroundColor="rgba(255, 102, 204, 0.4)")}),s?(i.style.zIndex="",i.classList.contains("positive")?(i.style.backgroundColor="rgb(153, 255, 153)",i.style.removeProperty("--before-border-color")):i.classList.contains("negative")&&(i.style.backgroundColor="rgb(255, 204, 238)",i.style.removeProperty("--before-border-color"))):(i.style.zIndex="",i.classList.contains("positive")?i.style.color="rgb(0, 128, 0)":i.classList.contains("negative")&&(i.style.color="rgb(204, 0, 136)"))}}__init5(){this.handleClose=e=>{const{selectedElems:t,labelElem:n}=this.state;t.length&&!t[0].hasAttribute("data-id")&&Q(t,this.textRef),n&&(n.style.zIndex=""),this.setState({anchorEl:null,openedMenu:!1,openedEditor:!1,selectedElems:[],labelElem:null,selectionDetails:null,annotationIndex:null,annotation:null}),J()}}__init6(){this.handleSelection=e=>{const t=window.getSelection();if(e.detail>2)J();else if(t&&t.rangeCount>0){const e=t.getRangeAt(0),n=e.toString(),o=this.textRef.contains(e.commonAncestorContainer);if(!t.isCollapsed&&""!==n&&o){const t=((e,t)=>{const n=document.createRange();n.setStart(t,0),n.setEnd(e.startContainer,e.startOffset);const[,o]=Y(n),[,r]=Y(e),i=o.length;return{quote:r,start:i,end:i+r.length}})(e,this.textRef),n=X(e);this.setState({anchorEl:n[0],openedMenu:!0,selectedElems:n,selectionDetails:t})}}}}__init7(){this.deleteAnnotation=()=>{const{annotations:e,onChange:t}=this.props,{selectedElems:n,labelElem:o,annotationIndex:r,annotation:i}=this.state;(Z(i.label)?this.labelsRef:n[0]).removeChild(o),Q(n,this.textRef),e.splice(r,1),t(e),this.handleClose()}}__init8(){this.createDOMAnnotation=(e,t)=>{const{disabled:n}=this.props,{id:o,label:r,type:i}=t;(e||[]).forEach(e=>{e.dataset.id=o,e.className=`annotation ${i}`,e.style.position="relative",e.style.cursor="pointer","positive"===i?e.style.backgroundColor="rgb(51, 255, 51, 0.5)":"negative"===i&&(e.style.backgroundColor="rgba(255, 102, 204, 0.4)"),e.onclick=!n&&this.handleClick,e.onmouseover=this.handleHover,e.onmouseout=this.handleCancelHover});const s=e&&e[0]||{},a=document.createElement("SPAN");if(a.dataset.annId=o,a.innerHTML=r,a.onclick=!n&&this.handleClick,a.onmouseover=this.handleHover,a.onmouseout=this.handleCancelHover,Z(r)){const e=(s.offsetTop?s.offsetTop:s.offsetParent.offsetTop)-this.textRef.scrollTop,t=this.textRef.offsetLeft+this.textRef.offsetWidth+8;a.dataset.freeform=!0,a.className=`sideAnnotation ${i}`,a.style.position="absolute",a.style.padding="4px",a.style.borderRadius="4px",a.style.marginLeft="8px",a.style.width="180px",a.style.whiteSpace="pre-wrap",a.style.wordBreak="break-word",a.style.border="2px solid #ffffff",a.style.fontSize="14px",a.style.fontStyle="normal",a.style.fontWeight="normal",a.style.top=`${e}px`,a.style.left=`${t}px`,"negative"===i?a.style.backgroundColor="rgb(255, 204, 238)":"positive"===i&&(a.style.backgroundColor="rgb(153, 255, 153)"),a.style.setProperty("--before-border-width","7px"),a.style.setProperty("--before-top","5px"),a.style.setProperty("--before-right","100%"),"negative"===i?a.style.setProperty("--before-border-color","rgb(255, 204, 238)"):"positive"===i&&a.style.setProperty("--before-border-color","rgb(153, 255, 153)"),this.labelsRef.appendChild(a)}else a.className=`annotationLabel ${i}`,a.style.backgroundColor="rgb(242, 242, 242)",a.style.padding="2px",a.style.position="absolute",a.style.userSelect="none",a.style.whiteSpace="nowrap",a.style.top="-10px",a.style.left="-2px",a.style.fontSize="12px",a.style.fontStyle="normal",a.style.fontWeight="normal",a.style.lineHeight="6px",a.style.webkitUserSelect="none",a.style.mozUserSelect="none",a.style.msUserSelect="none","positive"===i?a.style.color="rgb(0, 128, 0)":"negative"===i&&(a.style.color="rgb(204, 0, 136)"),s.appendChild(a)}}__init9(){this.createNewAnnotation=(e,t)=>{const{selectedElems:n,selectionDetails:o}=this.state,r={id:[o.start,o.end,(new Date).getTime()].join("-"),label:e,type:t,...o};return this.createDOMAnnotation(n,r),r}}__init10(){this.handleMenuClick=e=>{const{annotations:t,onChange:n}=this.props,{annotation:o,annotationIndex:r}=this.state,{type:i,text:s}=e;if(o){const e={...o,label:s,type:i},{type:n,label:a}=o;this.updateLabel(a,e,i!==n&&n),t.splice(r,1,e)}else{const e=this.createNewAnnotation(s,i);t.push(e)}n(t),this.handleClose()}}__init11(){this.editAnnotation=()=>{this.setState({openedMenu:!1,openedEditor:!0})}}__init12(){this.addAnnotation=e=>{const{annotations:t,onChange:n}=this.props,o=this.createNewAnnotation("",e),r=te(o.id);t.push(o),this.setState({openedMenu:!1,openedEditor:!0,annotationIndex:t.length-1,annotation:o,labelElem:r}),n(t)}}__init13(){this.updateLabel=(e,t,n)=>{const{selectedElems:o,labelElem:r}=this.state,{label:i,type:s}=t;Z(i)&&Z(e)||!Z(i)&&!Z(e)?(r.innerHTML=i,n&&(r.classList.remove(n),r.classList.add(s),o.forEach(e=>{e.classList.remove(n),e.classList.add(s)}))):Z(i)&&!Z(e)?(o[0].removeChild(r),this.createDOMAnnotation(o,t)):!Z(i)&&Z(e)&&(this.labelsRef.removeChild(r),this.createDOMAnnotation(o,t))}}__init14(){this.changeAnnotationType=e=>{const{annotations:t,onChange:n}=this.props,{annotationIndex:o,selectedElems:r}=this.state,{type:i,label:s}=t[o],a="positive"===i?"negative":"positive",l={...t[o],type:a,label:e};r.forEach(e=>{e.classList.remove(i),e.classList.add(a)}),this.updateLabel(s,l,i),t.splice(o,1,l),n(t),this.handleClose()}}__init15(){this.updateAnnotation=(e,t)=>{const{annotations:n,onChange:o}=this.props,{annotationIndex:r}=this.state,i={...n[r],label:t};this.updateLabel(e,i),n.splice(r,1,i),o(n)}}componentWillUnmount(){this.textRef.removeEventListener("scroll",this.adjustAnnotationsPosition)}render(){const{comment:e,customKeys:t,disabled:n,disabledMath:o,keypadMode:r,height:i,width:s,maxHeight:a,onCommentChange:l,predefinedAnnotations:c,text:d}=this.props,{anchorEl:p,annotation:u,openedMenu:h,openedEditor:f,selectionDetails:m}=this.state,g=p&&(p.offsetTop?p.offsetTop:p.offsetParent.offsetTop),y=this.textRef&&g?g-this.textRef.scrollTop-8:0;return B.createElement("div",null,B.createElement(ke,null,B.createElement(Se,{style:{width:s-34,minHeight:i,maxHeight:a},ref:e=>this.textRef=e,onMouseDown:n?()=>{}:J,onMouseUp:n?()=>{}:this.handleSelection,dangerouslySetInnerHTML:{__html:d}}),B.createElement(we,{ref:e=>this.labelsRef=e})),B.createElement(Re,{label:"Comment"},B.createElement(xe,{className:"prompt",markup:e||"",onChange:l,width:s&&(s+104).toString(),disabled:n,pluginProps:{math:{disabled:o,customKeys:t,keypadMode:r,controlledKeypadMode:!1},video:{disabled:!0},audio:{disabled:!0},textAlign:{disabled:!0}}})),B.createElement(ve,{anchorEl:p,open:h&&!n,annotations:c,isNewAnnotation:!!m,onClose:this.handleClose,onDelete:this.deleteAnnotation,onEdit:this.editAnnotation,onWrite:this.addAnnotation,onAnnotate:this.handleMenuClick}),B.createElement(de,{anchorEl:this.textRef,open:f&&!n,offset:y,value:u&&u.label||"",type:u&&u.type,onClose:this.handleClose,onDelete:this.deleteAnnotation,onSave:this.updateAnnotation,onTypeChange:this.changeAnnotationType}))}}Ae.__initStatic();const Te=e,{debounce:Pe}=o,Le=r,{Typography:Me}=t,{styled:Ie}=n,{color:$e}=i,{Feedback:Ne}=i,{Collapsible:De}=i,{PreviewPrompt:Oe}=i,{UiLayout:je}=i,He=l,We=Le("@pie-ui:extended-text-entry"),ze=Ie(je)({backgroundColor:$e.background(),color:$e.text()}),qe=Ie(Me)(({theme:e})=>({width:"100%",color:$e.text(),marginBottom:e.spacing(2),fontSize:"inherit"})),Ve=Ie("div")(({theme:e})=>({marginBottom:e.spacing(2)})),Ue=Ie(He)(({theme:e})=>({marginBottom:e.spacing(2),borderRadius:"4px"})),Fe=Ie("h2")({position:"absolute",left:"-10000px",top:"auto",width:"1px",height:"1px",overflow:"hidden"});class Be extends B.Component{constructor(...e){super(...e),Be.prototype.__init.call(this),Be.prototype.__init2.call(this)}static __initStatic(){this.propTypes={onValueChange:Te.func.isRequired,onAnnotationsChange:Te.func.isRequired,onCommentChange:Te.func.isRequired,model:Te.object,session:Te.shape({value:Te.string,annotations:Te.array,comment:Te.string}).isRequired}}__init(){this.changeSessionValue=Pe(this.props.onValueChange,1500)}__init2(){this.changeSessionComment=Pe(this.props.onCommentChange,1500)}render(){const{model:e,session:t,onAnnotationsChange:n}=this.props,{animationsDisabled:o,annotatorMode:r,customKeys:i,dimensions:s,disabled:a,disabledAnnotator:l,equationEditor:c,extraCSSRules:d,feedback:p,mathInput:u,playersToolbarPosition:h,predefinedAnnotations:f,prompt:m,spanishInput:g,specialInput:y,spellCheckEnabled:b,teacherInstructions:v}=e,{annotations:C,comment:_,value:x}=t,{width:E,height:S}=s||{},w="40vh",k={position:"top"===h?"top":"bottom"};We("[render] disabled? ",a);const R=B.createElement(Oe,{defaultClassName:"teacher-instructions",prompt:v}),A=[];return g&&A.push({language:"spanish"}),y&&A.push({language:"special"}),B.createElement(ze,{extraCSSRules:d,ref:e=>{this.containerRef=e}},B.createElement(Fe,null,"Constructed Response Question"),v&&B.createElement(Ve,null,o?R:B.createElement(De,{labels:{hidden:"Show Teacher Instructions",visible:"Hide Teacher Instructions"}},R)),m&&B.createElement(qe,{component:"span"},B.createElement(Oe,{defaultClassName:"prompt",prompt:e.prompt})),r?B.createElement(Ae,{text:x||"",annotations:C||[],comment:_||"",predefinedAnnotations:f||[],onChange:n,onCommentChange:this.changeSessionComment,width:E,height:S,maxHeight:w,disabled:l,disabledMath:!u,customKeys:i,keypadMode:c}):B.createElement(Ue,{className:"response-area-editor",onChange:this.changeSessionValue,markup:x||"",maxWidth:E&&E.toString(),minWidth:"100px",minHeight:S&&S.toString(),maxHeight:w,disabled:a,highlightShape:!0,toolbarOpts:k,spellCheck:b,charactersLimit:5e4,autoWidthToolbar:!0,pluginProps:{math:{disabled:!u,customKeys:this.props.model.customKeys,keypadMode:this.props.model.equationEditor,controlledKeypadMode:!1},video:{disabled:!0},audio:{disabled:!0},table:{disabled:!0},textAlign:{disabled:!0},separateParagraphs:{disabled:!1},ul_list:{disabled:!0},ol_list:{disabled:!0}},languageCharactersProps:A}),p&&B.createElement(Ne,{correctness:"correct",feedback:p}))}}Be.__initStatic();var Ke,Ye=s;Ke=Ye.createRoot,Ye.hydrateRoot;var Ge={};Object.defineProperty(Ge,"__esModule",{value:!0});class Xe extends CustomEvent{constructor(e,t,n){super(Xe.TYPE,{bubbles:!0,composed:!0,detail:{complete:t,component:e,hasModel:n}}),this.component=e,this.complete=t}}Xe.TYPE="model-set";var Qe=Ge.ModelSetEvent=Xe;class Je extends CustomEvent{constructor(e,t){super(Je.TYPE,{bubbles:!0,composed:!0,detail:{complete:t,component:e}}),this.component=e,this.complete=t}}Je.TYPE="session-changed";var Ze=Ge.SessionChangedEvent=Je;const et=r,{renderMath:tt}=a,nt=et("@pie-elements:extended-text-entry"),ot=void 0!==typeof window?new DOMParser:{parseFromString:e=>e};function rt(e){if("string"==typeof e)try{const t=ot.parseFromString(e,"text/html");return t.body.textContent}catch(t){return nt("tried to parse as dom and failed",e),e}}function it(e){const t=rt(e);return void 0!==t&&t.length>0}class st extends HTMLElement{constructor(){super(),this._model=null,this._session=null,this._root=null}setLangAttribute(){const e=this._model&&(this._model.language,1)?this._model.language:"",t=e?e.slice(0,2):"en";this.setAttribute("lang",t)}set model(e){this._model=e,this.dispatchEvent(new Qe(this.tagName.toLowerCase(),!1,!!this._model)),this.render()}set session(e){this._session=e,this.render()}get session(){return this._session}valueChange(e){this._session.value=e,this.dispatchEvent(new Ze(this.tagName.toLowerCase(),it(e))),this.render()}annotationsChange(e){this._session.annotations=e,this.dispatchEvent(new Ze(this.tagName.toLowerCase(),!0)),this.render()}commentChange(e){this._session.comment=e,this.dispatchEvent(new Ze(this.tagName.toLowerCase(),it(e))),this.render()}connectedCallback(){this.setAttribute("aria-label","Written Response Question"),this.setAttribute("role","region"),this.render()}render(){if(this._model&&this._session){let e=B.createElement(Be,{model:this._model,session:this._session,onValueChange:this.valueChange.bind(this),onAnnotationsChange:this.annotationsChange.bind(this),onCommentChange:this.commentChange.bind(this)});this.setLangAttribute(),this._root||(this._root=Ke(this)),this._root.render(e),queueMicrotask(()=>{tt(this)})}}disconnectedCallback(){this._root&&this._root.unmount()}}export{st as default,it as isComplete,rt as textContent};
1
+ import{_dll_react as e,_dll_prop_types as t,_dll_mui__material as n,_dll_mui__material_styles as o,_dll_lodash as i,_dll_debug as s,_dll_pie_lib__render_ui as a,_dll_react_dom as r}from"../../../@pie-lib/shared-module@^3.0.5/module/index.js";import{_dll_pie_lib__math_rendering as l}from"../../../@pie-lib/math-rendering-module@^4.0.5/module/index.js";import{_dll_pie_lib__editable_html_tip_tap as d}from"../../../@pie-lib/editable-html-module@^6.0.5/module/index.js";import{_dll_pie_lib__config_ui as c}from"../../../@pie-lib/config-module@^3.0.0/module/index.js";const h=(e,t,n)=>{const o=n||[],i=o.reduce((e,t)=>e+t.textContent.length,0);let s=!0;if(i>t)return!1;for(e&&(3===e.nodeType&&e.parentNode&&!e.parentNode.hasAttribute("data-ann-id")&&o.push(e),e=e.firstChild);e&&s;)s=h(e,t,o),e=e.nextSibling;return o},p=e=>{const{commonAncestorContainer:t,startContainer:n,endContainer:o,startOffset:i,endOffset:s}=e,a=[];let r=!1,l=!1,d="";const c=e=>{const{nodeValue:t,childNodes:h}=e;e===n&&e===o?(t&&(d+=t.substring(i,s)),r=l=!0):e===n?(t&&(d+=t.substring(i)),r=!0):e===o?(t&&(d+=t.substring(0,s)),l=!0):e&&3===e.nodeType&&e.parentNode&&!e.parentNode.hasAttribute("data-ann-id")&&t&&r&&!l&&(d+=t,a.push(e)),h.forEach(e=>{l||c(e)})};return c(t),[a,d]},m=e=>{const t=document.createElement("SPAN");return e.surroundContents(t),t},u=e=>{if(e.startContainer===e.endContainer)return[m(e)];const[t]=p(e),n=document.createRange();n.selectNodeContents(e.startContainer),n.setStart(e.startContainer,e.startOffset);const o=m(n),i=document.createRange();i.selectNode(e.endContainer),i.setEnd(e.endContainer,e.endOffset);const s=m(i);return[o,...t.map(e=>{const t=document.createElement("SPAN");return e.parentNode.insertBefore(t,e),t.appendChild(e),t}),s]},g=(e,t)=>{(e||[]).forEach(e=>{const t=e.parentNode,n=e.childNodes,o=n.length;if(o>0)for(let i=0;i<o;i++)t.insertBefore(n[0],e);else t.insertBefore(document.createTextNode(e.textContent),e);t.removeChild(e)}),t.normalize()},b=()=>{document.getSelection?(document.getSelection().removeAllRanges(),document.getSelection().addRange(document.createRange())):window.getSelection?window.getSelection().removeAllRanges?(window.getSelection().removeAllRanges(),window.getSelection().addRange(document.createRange())):window.getSelection().empty&&window.getSelection().empty():document.selection&&document.selection.empty()},f=e=>e.length>=20||-1!==e.search(/\n|\r|\r\n/),y=e=>Array.from(document.querySelectorAll(`[data-id='${e}']`)),v=e=>document.querySelector(`[data-ann-id='${e}']`),C=e,x=t,{Popover:_}=n,{TextField:E}=n,{styled:w}=o,S=w(_)(({theme:e,annotationType:t})=>({"& .MuiPaper-root":{overflowX:"unset",overflowY:"unset",marginLeft:"16px","&::before":{position:"absolute",right:"100%",top:"13px",border:"solid transparent",content:'""',height:0,width:0,pointerEvents:"none",borderWidth:"7px",borderRightColor:e.palette.grey[100]},..."negative"===t&&{"&::before":{borderRightColor:"rgb(255, 204, 238) !important"}},..."positive"===t&&{"&::before":{borderRightColor:"rgb(153, 255, 153) !important"}}}})),A=w("div")(({theme:e,annotationType:t})=>({width:"200px",overflow:"hidden",borderRadius:"4px",backgroundColor:"#ffffff",border:`4px solid ${e.palette.grey[100]}`,..."negative"===t&&{borderColor:"rgb(255, 204, 238) !important"},..."positive"===t&&{borderColor:"rgb(153, 255, 153) !important"}})),k=w("div")(({theme:e})=>({display:"flex",flexWrap:"wrap",borderTop:`2px solid ${e.palette.grey[100]}`})),R=w("div")(({theme:e,variant:t,annotationType:n})=>({flexGrow:1,width:"28%",textAlign:"center",padding:"4px",cursor:"pointer","&:not(:nth-child(3n))":{borderRight:`1px solid ${e.palette.grey[100]}`},"&:hover":{backgroundColor:e.palette.grey[100]},..."positive"===t&&{backgroundColor:"rgb(153, 255, 153) !important","&:hover":{filter:"brightness(85%)"}},..."negative"===t&&{backgroundColor:"rgb(255, 204, 238) !important","&:hover":{filter:"brightness(85%)"}},..."typeChange"===t&&"negative"===n&&{"&:hover":{backgroundColor:"rgb(153, 255, 153) !important"}},..."typeChange"===t&&"positive"===n&&{"&:hover":{backgroundColor:"rgb(255, 204, 238) !important"}}}));class T extends C.Component{static __initStatic(){this.propTypes={anchorEl:x.object,open:x.bool,offset:x.number,value:x.string,type:x.string,onClose:x.func,onDelete:x.func,onSave:x.func,onTypeChange:x.func}}constructor(e){super(e),T.prototype.__init.call(this),T.prototype.__init2.call(this),T.prototype.__init3.call(this),this.state={value:e.value}}UNSAFE_componentWillReceiveProps(e){const{value:t}=e,{value:n}=this.props;t!==n&&this.setState({value:t})}__init(){this.onValueChange=e=>this.setState({value:e.target.value})}__init2(){this.handleSave=()=>{const{value:e,onSave:t,onClose:n,onDelete:o}=this.props,{value:i}=this.state;""===i&&o(),e!==i&&t(e,i),this.setState({value:""}),n()}}__init3(){this.handleTypeChange=()=>{const{onTypeChange:e,onDelete:t}=this.props,{value:n}=this.state;""===n?t():e(n),this.setState({value:""})}}render(){const{anchorEl:e,offset:t,onDelete:n,open:o,type:i}=this.props,{value:s}=this.state;return C.createElement(S,{anchorEl:e,elevation:2,open:o,onClose:this.handleSave,annotationType:i,style:{marginTop:`${t}px`,transition:"margin-top 2s ease-out"},transitionDuration:{enter:225,exit:195},anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"left"}},C.createElement(A,{annotationType:i},C.createElement(E,{id:"annotation-editor",style:{padding:"2px 5px",width:"95%"},autoFocus:!0,multiline:!0,rows:1,maxRows:4,value:s,onChange:this.onValueChange,InputProps:{disableUnderline:!0}}),C.createElement(k,null,C.createElement(R,{onClick:n},"Delete"),C.createElement(R,{variant:"typeChange",annotationType:i,onClick:this.handleTypeChange},"negative"===i?"Green":"Pink"),C.createElement(R,{onClick:this.handleSave},"Save"))))}}T.__initStatic();const L=e,M=t,{styled:P}=o,{Popover:I}=n,N=P(I)({"& .MuiPaper-root":{overflowX:"unset",overflowY:"unset",marginTop:"-16px","&::after":{position:"absolute",left:"calc(50% - 7px)",border:"solid transparent",content:'""',height:0,width:0,pointerEvents:"none",borderWidth:"7px",borderTopColor:"black"}}}),D=P("div")(({theme:e})=>({width:"300px",overflow:"hidden",borderRadius:"4px",backgroundColor:e.palette.common.white,border:`2px solid ${e.palette.grey[100]}`})),W=P("div")({display:"flex",flexWrap:"wrap"}),H=P("div")(({theme:e})=>({display:"flex",flexWrap:"wrap",borderTop:`2px solid ${e.palette.grey[100]}`})),z=P("div")(({theme:e,variant:t})=>({width:"22%",textAlign:"center",padding:"4px",cursor:"pointer",borderBottom:`1px solid ${e.palette.grey[100]}`,"&:not(:nth-child(4n))":{borderRight:`1px solid ${e.palette.grey[100]}`},"&:nth-child(4n)":{flexGrow:1},"&:hover":{backgroundColor:e.palette.grey[100]},..."positive"===t&&{backgroundColor:"rgb(153, 255, 153) !important","&:hover":{filter:"brightness(85%)"}},..."negative"===t&&{backgroundColor:"rgb(255, 204, 238) !important","&:hover":{filter:"brightness(85%)"}}}));class $ extends L.Component{static __initStatic(){this.propTypes={anchorEl:M.object,open:M.bool,annotations:M.array,isNewAnnotation:M.bool,onClose:M.func,onDelete:M.func,onEdit:M.func,onWrite:M.func,onAnnotate:M.func}}render(){const{anchorEl:e,annotations:t,isNewAnnotation:n,onAnnotate:o,onClose:i,onEdit:s,onDelete:a,onWrite:r,open:l}=this.props;return L.createElement(N,{anchorEl:e,open:l,onClose:i,elevation:5,transitionDuration:{enter:225,exit:195},anchorOrigin:{vertical:"top",horizontal:"center"},transformOrigin:{vertical:"bottom",horizontal:"center"}},L.createElement(D,null,L.createElement(W,null,t.map((e,t)=>L.createElement(z,{key:`annotation-${t}`,variant:e.type,onClick:()=>o(e)},e.label))),L.createElement(H,null,L.createElement(z,{onClick:i},"Cancel"),L.createElement(z,{style:{pointerEvents:"none"}}),n?L.createElement(L.Fragment,null,L.createElement(z,{variant:"positive",onClick:()=>r("positive")},"Write"),L.createElement(z,{variant:"negative",onClick:()=>r("negative")},"Write")):L.createElement(L.Fragment,null,L.createElement(z,{onClick:a},"Delete"),L.createElement(z,{onClick:s},"Edit")))))}}$.__initStatic();const O=e,{styled:j}=o,q=t,B=d,{InputContainer:K}=c,F=j("div")({padding:"10px 120px 10px 16px",backgroundColor:"rgba(0, 0, 0, 0.06)",border:"1px solid #ccc",borderRadius:"4px",overflowY:"scroll",lineHeight:"36px",whiteSpace:"pre-wrap",overflowWrap:"break-word","& p":{margin:0},"& span[data-latex]":{userSelect:"none","-webkit-user-select":"none","-moz-user-select":"none","-ms-user-select":"none"}}),U=j("div")({width:"230px"}),V=j("div")({position:"relative",overflowX:"hidden",display:"flex"}),Y=j(K)(({theme:e})=>({paddingTop:e.spacing(2),marginBottom:e.spacing(2),marginTop:e.spacing(2),width:"100%"}));if(!document.getElementById("annotation-editor-styles")){const e=document.createElement("style");e.id="annotation-editor-styles",e.textContent='\n .sideAnnotation:before {\n position: absolute;\n right: var(--before-right, 100%);\n top: var(--before-top, 5px);\n border: solid transparent;\n content: "";\n height: 0;\n width: 0;\n pointer-events: none;\n border-width: var(--before-border-width, 7px);\n border-right-color: var(--before-border-color, rgb(153, 255, 153));\n }\n',document.head.appendChild(e)}class G extends O.Component{static __initStatic(){this.propTypes={text:q.string,comment:q.string,annotations:q.array,predefinedAnnotations:q.array,onChange:q.func.isRequired,onCommentChange:q.func.isRequired,width:q.number,height:q.number,maxHeight:q.string,disabled:q.bool,disabledMath:q.bool,customKeys:q.array,keypadMode:q.string}}constructor(e){super(e),G.prototype.__init.call(this),G.prototype.__init2.call(this),G.prototype.__init3.call(this),G.prototype.__init4.call(this),G.prototype.__init5.call(this),G.prototype.__init6.call(this),G.prototype.__init7.call(this),G.prototype.__init8.call(this),G.prototype.__init9.call(this),G.prototype.__init10.call(this),G.prototype.__init11.call(this),G.prototype.__init12.call(this),G.prototype.__init13.call(this),G.prototype.__init14.call(this),G.prototype.__init15.call(this),this.state={anchorEl:null,openedMenu:!1,openedEditor:!1,selectedElems:[],labelElem:null,selectionDetails:null,annotation:null,annotationIndex:null}}componentDidMount(){const{annotations:e,text:t}=this.props;t&&e.forEach(e=>{const[t,n]=((e,t,n)=>{const o=h(n,t),i=[];let s=0;return o.forEach(n=>{const o=s+n.textContent.length;[e,t].forEach(e=>{s<=e&&e<o&&i.push({node:n,offset:e-s})}),s=o}),i})(e.start,e.end,this.textRef);if(t&&n){const o=document.createRange();o.setStart(t.node,t.offset),o.setEnd(n.node,n.offset);const i=u(o);this.createDOMAnnotation(i,e)}}),this.textRef&&(this.adjustAnnotationsPosition(),this.textRef.addEventListener("scroll",this.adjustAnnotationsPosition))}__init(){this.adjustAnnotationsPosition=()=>{if(this.textRef&&this.labelsRef){const e=this.textRef.offsetLeft+this.textRef.offsetWidth+8;Array.from(this.labelsRef.children).forEach(t=>{const n=y(t.dataset.annId),o=(n[0].offsetTop?n[0].offsetTop:n[0].offsetParent.offsetTop)-this.textRef.scrollTop-6;t.style.top=`${o}px`,t.style.left=`${e}px`})}}}__init2(){this.handleClick=e=>{const{annotations:t}=this.props,{selectionDetails:n}=this.state;if(n)return;const{id:o,annId:i}=e.target.dataset,s=o||i,a=y(s),r=v(s),l=t.findIndex(e=>e.id===s),d=r.hasAttribute("data-freeform");d&&(r.style.zIndex="10"),this.setState({anchorEl:a[0],openedMenu:!!o||!!i&&!d,openedEditor:!!i&&d,selectedElems:a,labelElem:r,annotationIndex:l,annotation:t[l],selectionDetails:null})}}__init3(){this.handleHover=e=>{const{id:t,annId:n}=e.target.dataset,o=t||n,i=y(o),s=v(o),a=s.hasAttribute("data-freeform");i.forEach(e=>{e.style.zIndex="20",e.classList.contains("positive")?e.style.backgroundColor="rgb(51, 255, 51, 0.7)":e.classList.contains("negative")&&(e.style.backgroundColor="rgba(255, 102, 204, 0.55)")}),a?(s.style.zIndex="20",s.classList.contains("positive")?(s.style.backgroundColor="rgb(128, 255, 128)",s.style.setProperty("--before-border-color","rgb(153, 255, 153)")):s.classList.contains("negative")&&(s.style.backgroundColor="rgb(255, 179, 230)",s.style.setProperty("--before-border-color","rgb(255, 179, 230)"))):(s.style.zIndex="20",s.classList.contains("positive")?s.style.color="rgb(0, 77, 0)":s.classList.contains("negative")&&(s.style.color="rgb(153, 0, 102)"))}}__init4(){this.handleCancelHover=e=>{const{id:t,annId:n}=e.target.dataset,o=t||n,i=y(o),s=v(o),a=s.hasAttribute("data-freeform");i.forEach(e=>{e.style.zIndex="",e.classList.contains("positive")?e.style.backgroundColor="rgb(51, 255, 51, 0.5)":e.classList.contains("negative")&&(e.style.backgroundColor="rgba(255, 102, 204, 0.4)")}),a?(s.style.zIndex="",s.classList.contains("positive")?(s.style.backgroundColor="rgb(153, 255, 153)",s.style.removeProperty("--before-border-color")):s.classList.contains("negative")&&(s.style.backgroundColor="rgb(255, 204, 238)",s.style.removeProperty("--before-border-color"))):(s.style.zIndex="",s.classList.contains("positive")?s.style.color="rgb(0, 128, 0)":s.classList.contains("negative")&&(s.style.color="rgb(204, 0, 136)"))}}__init5(){this.handleClose=e=>{const{selectedElems:t,labelElem:n}=this.state;t.length&&!t[0].hasAttribute("data-id")&&g(t,this.textRef),n&&(n.style.zIndex=""),this.setState({anchorEl:null,openedMenu:!1,openedEditor:!1,selectedElems:[],labelElem:null,selectionDetails:null,annotationIndex:null,annotation:null}),b()}}__init6(){this.handleSelection=e=>{const t=window.getSelection();if(e.detail>2)b();else if(t&&t.rangeCount>0){const e=t.getRangeAt(0),n=e.toString(),o=this.textRef.contains(e.commonAncestorContainer);if(!t.isCollapsed&&""!==n&&o){const t=((e,t)=>{const n=document.createRange();n.setStart(t,0),n.setEnd(e.startContainer,e.startOffset);const[,o]=p(n),[,i]=p(e),s=o.length;return{quote:i,start:s,end:s+i.length}})(e,this.textRef),n=u(e);this.setState({anchorEl:n[0],openedMenu:!0,selectedElems:n,selectionDetails:t})}}}}__init7(){this.deleteAnnotation=()=>{const{annotations:e,onChange:t}=this.props,{selectedElems:n,labelElem:o,annotationIndex:i,annotation:s}=this.state;(f(s.label)?this.labelsRef:n[0]).removeChild(o),g(n,this.textRef),e.splice(i,1),t(e),this.handleClose()}}__init8(){this.createDOMAnnotation=(e,t)=>{const{disabled:n}=this.props,{id:o,label:i,type:s}=t;(e||[]).forEach(e=>{e.dataset.id=o,e.className=`annotation ${s}`,e.style.position="relative",e.style.cursor="pointer","positive"===s?e.style.backgroundColor="rgb(51, 255, 51, 0.5)":"negative"===s&&(e.style.backgroundColor="rgba(255, 102, 204, 0.4)"),e.onclick=!n&&this.handleClick,e.onmouseover=this.handleHover,e.onmouseout=this.handleCancelHover});const a=e&&e[0]||{},r=document.createElement("SPAN");if(r.dataset.annId=o,r.innerHTML=i,r.onclick=!n&&this.handleClick,r.onmouseover=this.handleHover,r.onmouseout=this.handleCancelHover,f(i)){const e=(a.offsetTop?a.offsetTop:a.offsetParent.offsetTop)-this.textRef.scrollTop,t=this.textRef.offsetLeft+this.textRef.offsetWidth+8;r.dataset.freeform=!0,r.className=`sideAnnotation ${s}`,r.style.position="absolute",r.style.padding="4px",r.style.borderRadius="4px",r.style.marginLeft="8px",r.style.width="180px",r.style.whiteSpace="pre-wrap",r.style.wordBreak="break-word",r.style.border="2px solid #ffffff",r.style.fontSize="14px",r.style.fontStyle="normal",r.style.fontWeight="normal",r.style.top=`${e}px`,r.style.left=`${t}px`,"negative"===s?r.style.backgroundColor="rgb(255, 204, 238)":"positive"===s&&(r.style.backgroundColor="rgb(153, 255, 153)"),r.style.setProperty("--before-border-width","7px"),r.style.setProperty("--before-top","5px"),r.style.setProperty("--before-right","100%"),"negative"===s?r.style.setProperty("--before-border-color","rgb(255, 204, 238)"):"positive"===s&&r.style.setProperty("--before-border-color","rgb(153, 255, 153)"),this.labelsRef.appendChild(r)}else r.className=`annotationLabel ${s}`,r.style.backgroundColor="rgb(242, 242, 242)",r.style.padding="2px",r.style.position="absolute",r.style.userSelect="none",r.style.whiteSpace="nowrap",r.style.top="-10px",r.style.left="-2px",r.style.fontSize="12px",r.style.fontStyle="normal",r.style.fontWeight="normal",r.style.lineHeight="6px",r.style.webkitUserSelect="none",r.style.mozUserSelect="none",r.style.msUserSelect="none","positive"===s?r.style.color="rgb(0, 128, 0)":"negative"===s&&(r.style.color="rgb(204, 0, 136)"),a.appendChild(r)}}__init9(){this.createNewAnnotation=(e,t)=>{const{selectedElems:n,selectionDetails:o}=this.state,i={id:[o.start,o.end,(new Date).getTime()].join("-"),label:e,type:t,...o};return this.createDOMAnnotation(n,i),i}}__init10(){this.handleMenuClick=e=>{const{annotations:t,onChange:n}=this.props,{annotation:o,annotationIndex:i}=this.state,{type:s,text:a}=e;if(o){const e={...o,label:a,type:s},{type:n,label:r}=o;this.updateLabel(r,e,s!==n&&n),t.splice(i,1,e)}else{const e=this.createNewAnnotation(a,s);t.push(e)}n(t),this.handleClose()}}__init11(){this.editAnnotation=()=>{this.setState({openedMenu:!1,openedEditor:!0})}}__init12(){this.addAnnotation=e=>{const{annotations:t,onChange:n}=this.props,o=this.createNewAnnotation("",e),i=v(o.id);t.push(o),this.setState({openedMenu:!1,openedEditor:!0,annotationIndex:t.length-1,annotation:o,labelElem:i}),n(t)}}__init13(){this.updateLabel=(e,t,n)=>{const{selectedElems:o,labelElem:i}=this.state,{label:s,type:a}=t;f(s)&&f(e)||!f(s)&&!f(e)?(i.innerHTML=s,n&&(i.classList.remove(n),i.classList.add(a),o.forEach(e=>{e.classList.remove(n),e.classList.add(a)}))):f(s)&&!f(e)?(o[0].removeChild(i),this.createDOMAnnotation(o,t)):!f(s)&&f(e)&&(this.labelsRef.removeChild(i),this.createDOMAnnotation(o,t))}}__init14(){this.changeAnnotationType=e=>{const{annotations:t,onChange:n}=this.props,{annotationIndex:o,selectedElems:i}=this.state,{type:s,label:a}=t[o],r="positive"===s?"negative":"positive",l={...t[o],type:r,label:e};i.forEach(e=>{e.classList.remove(s),e.classList.add(r)}),this.updateLabel(a,l,s),t.splice(o,1,l),n(t),this.handleClose()}}__init15(){this.updateAnnotation=(e,t)=>{const{annotations:n,onChange:o}=this.props,{annotationIndex:i}=this.state,s={...n[i],label:t};this.updateLabel(e,s),n.splice(i,1,s),o(n)}}componentWillUnmount(){this.textRef.removeEventListener("scroll",this.adjustAnnotationsPosition)}render(){const{comment:e,customKeys:t,disabled:n,disabledMath:o,keypadMode:i,height:s,width:a,maxHeight:r,onCommentChange:l,predefinedAnnotations:d,text:c}=this.props,{anchorEl:h,annotation:p,openedMenu:m,openedEditor:u,selectionDetails:g}=this.state,f=h&&(h.offsetTop?h.offsetTop:h.offsetParent.offsetTop),y=this.textRef&&f?f-this.textRef.scrollTop-8:0;return O.createElement("div",null,O.createElement(V,null,O.createElement(F,{style:{width:a-34,minHeight:s,maxHeight:r},ref:e=>this.textRef=e,onMouseDown:n?()=>{}:b,onMouseUp:n?()=>{}:this.handleSelection,dangerouslySetInnerHTML:{__html:c}}),O.createElement(U,{ref:e=>this.labelsRef=e})),O.createElement(Y,{label:"Comment"},O.createElement(B,{className:"prompt",markup:e||"",onChange:l,width:a&&(a+104).toString(),disabled:n,pluginProps:{math:{disabled:o,customKeys:t,keypadMode:i,controlledKeypadMode:!1},video:{disabled:!0},audio:{disabled:!0},textAlign:{disabled:!0}}})),O.createElement($,{anchorEl:h,open:m&&!n,annotations:d,isNewAnnotation:!!g,onClose:this.handleClose,onDelete:this.deleteAnnotation,onEdit:this.editAnnotation,onWrite:this.addAnnotation,onAnnotate:this.handleMenuClick}),O.createElement(T,{anchorEl:this.textRef,open:u&&!n,offset:y,value:p&&p.label||"",type:p&&p.type,onClose:this.handleClose,onDelete:this.deleteAnnotation,onSave:this.updateAnnotation,onTypeChange:this.changeAnnotationType}))}}G.__initStatic();const X=e,Q=t,{debounce:J}=i,Z=s,{Typography:ee}=n,{styled:te}=o,{color:ne}=a,{Feedback:oe}=a,{Collapsible:ie}=a,{PreviewPrompt:se}=a,{UiLayout:ae}=a,re=d,le=Z("@pie-ui:extended-text-entry"),de=te(ae)({backgroundColor:ne.background(),color:ne.text()}),ce=te(ee)(({theme:e})=>({width:"100%",color:ne.text(),marginBottom:e.spacing(2),fontSize:"inherit"})),he=te("div")(({theme:e})=>({marginBottom:e.spacing(2)})),pe=te(re)(({theme:e})=>({marginBottom:e.spacing(2),borderRadius:"4px"})),me=te("h2")({position:"absolute",left:"-10000px",top:"auto",width:"1px",height:"1px",overflow:"hidden"});class ue extends X.Component{constructor(...e){super(...e),ue.prototype.__init.call(this),ue.prototype.__init2.call(this)}static __initStatic(){this.propTypes={onValueChange:Q.func.isRequired,onAnnotationsChange:Q.func.isRequired,onCommentChange:Q.func.isRequired,model:Q.object,session:Q.shape({value:Q.string,annotations:Q.array,comment:Q.string}).isRequired}}__init(){this.changeSessionValue=J(this.props.onValueChange,1500)}__init2(){this.changeSessionComment=J(this.props.onCommentChange,1500)}render(){const{model:e,session:t,onAnnotationsChange:n}=this.props,{animationsDisabled:o,annotatorMode:i,customKeys:s,dimensions:a,disabled:r,disabledAnnotator:l,equationEditor:d,extraCSSRules:c,feedback:h,mathInput:p,playersToolbarPosition:m,predefinedAnnotations:u,prompt:g,spanishInput:b,specialInput:f,spellCheckEnabled:y,teacherInstructions:v}=e,{annotations:C,comment:x,value:_}=t,{width:E,height:w}=a||{},S="40vh",A={position:"top"===m?"top":"bottom"};le("[render] disabled? ",r);const k=X.createElement(se,{defaultClassName:"teacher-instructions",prompt:v}),R=[];return b&&R.push({language:"spanish"}),f&&R.push({language:"special"}),X.createElement(de,{extraCSSRules:c,ref:e=>{this.containerRef=e}},X.createElement(me,null,"Constructed Response Question"),v&&X.createElement(he,null,o?k:X.createElement(ie,{labels:{hidden:"Show Teacher Instructions",visible:"Hide Teacher Instructions"}},k)),g&&X.createElement(ce,{component:"span"},X.createElement(se,{defaultClassName:"prompt",prompt:e.prompt})),i?X.createElement(G,{text:_||"",annotations:C||[],comment:x||"",predefinedAnnotations:u||[],onChange:n,onCommentChange:this.changeSessionComment,width:E,height:w,maxHeight:S,disabled:l,disabledMath:!p,customKeys:s,keypadMode:d}):X.createElement(pe,{className:"response-area-editor",onChange:this.changeSessionValue,markup:_||"",maxWidth:E&&E.toString(),minWidth:"100px",minHeight:w&&w.toString(),maxHeight:S,disabled:r,highlightShape:!0,toolbarOpts:A,spellCheck:y,charactersLimit:5e4,autoWidthToolbar:!0,pluginProps:{math:{disabled:!p,customKeys:this.props.model.customKeys,keypadMode:this.props.model.equationEditor,controlledKeypadMode:!1},video:{disabled:!0},audio:{disabled:!0},table:{disabled:!0},textAlign:{disabled:!0},separateParagraphs:{disabled:!1},ul_list:{disabled:!0},ol_list:{disabled:!0}},languageCharactersProps:R}),h&&X.createElement(oe,{correctness:"correct",feedback:h}))}}ue.__initStatic();var ge,be=r;ge=be.createRoot,be.hydrateRoot;var fe={};Object.defineProperty(fe,"__esModule",{value:!0});class ye extends CustomEvent{constructor(e,t,n){super(ye.TYPE,{bubbles:!0,composed:!0,detail:{complete:t,component:e,hasModel:n}}),this.component=e,this.complete=t}}ye.TYPE="model-set";var ve=fe.ModelSetEvent=ye;class Ce extends CustomEvent{constructor(e,t){super(Ce.TYPE,{bubbles:!0,composed:!0,detail:{complete:t,component:e}}),this.component=e,this.complete=t}}Ce.TYPE="session-changed";var xe=fe.SessionChangedEvent=Ce;const _e=e,Ee=s,{renderMath:we}=l,Se=Ee("@pie-elements:extended-text-entry"),Ae=void 0!==typeof window?new DOMParser:{parseFromString:e=>e};function ke(e){if("string"==typeof e)try{const t=Ae.parseFromString(e,"text/html");return t.body.textContent}catch(t){return Se("tried to parse as dom and failed",e),e}}function Re(e){const t=ke(e);return void 0!==t&&t.length>0}class Te extends HTMLElement{constructor(){super(),this._model=null,this._session=null,this._root=null}setLangAttribute(){const e=this._model&&(this._model.language,1)?this._model.language:"",t=e?e.slice(0,2):"en";this.setAttribute("lang",t)}set model(e){this._model=e,this.dispatchEvent(new ve(this.tagName.toLowerCase(),!1,!!this._model)),this.render()}set session(e){this._session=e,this.render()}get session(){return this._session}valueChange(e){this._session.value=e,this.dispatchEvent(new xe(this.tagName.toLowerCase(),Re(e))),this.render()}annotationsChange(e){this._session.annotations=e,this.dispatchEvent(new xe(this.tagName.toLowerCase(),!0)),this.render()}commentChange(e){this._session.comment=e,this.dispatchEvent(new xe(this.tagName.toLowerCase(),Re(e))),this.render()}connectedCallback(){this.setAttribute("aria-label","Written Response Question"),this.setAttribute("role","region"),this.render()}render(){if(this._model&&this._session){let e=_e.createElement(ue,{model:this._model,session:this._session,onValueChange:this.valueChange.bind(this),onAnnotationsChange:this.annotationsChange.bind(this),onCommentChange:this.commentChange.bind(this)});this.setLangAttribute(),this._root||(this._root=ge(this)),this._root.render(e),queueMicrotask(()=>{we(this)})}}disconnectedCallback(){this._root&&this._root.unmount()}}export{Te as default,Re as isComplete,ke as textContent};
@@ -0,0 +1 @@
1
+ import{_dll_react_dom as e,_dll_react as t,_dll_prop_types as n,_dll_mui__material as o,_dll_mui__material_styles as i,_dll_lodash as s,_dll_debug as a,_dll_pie_lib__render_ui as r}from"../../../@pie-lib/shared-module@^3.0.5/module/index.js";import{_dll_pie_lib__math_rendering as l}from"../../../@pie-lib/math-rendering-module@^4.0.5/module/index.js";import{_dll_pie_lib__editable_html_tip_tap as d}from"../../../@pie-lib/editable-html-module@^6.0.5/module/index.js";import{_dll_pie_lib__config_ui as c}from"../../../@pie-lib/config-module@^3.0.0/module/index.js";var p,h=e;p=h.createRoot,h.hydrateRoot;const m=(e,t,n)=>{const o=n||[],i=o.reduce((e,t)=>e+t.textContent.length,0);let s=!0;if(i>t)return!1;for(e&&(3===e.nodeType&&e.parentNode&&!e.parentNode.hasAttribute("data-ann-id")&&o.push(e),e=e.firstChild);e&&s;)s=m(e,t,o),e=e.nextSibling;return o},u=e=>{const{commonAncestorContainer:t,startContainer:n,endContainer:o,startOffset:i,endOffset:s}=e,a=[];let r=!1,l=!1,d="";const c=e=>{const{nodeValue:t,childNodes:p}=e;e===n&&e===o?(t&&(d+=t.substring(i,s)),r=l=!0):e===n?(t&&(d+=t.substring(i)),r=!0):e===o?(t&&(d+=t.substring(0,s)),l=!0):e&&3===e.nodeType&&e.parentNode&&!e.parentNode.hasAttribute("data-ann-id")&&t&&r&&!l&&(d+=t,a.push(e)),p.forEach(e=>{l||c(e)})};return c(t),[a,d]},g=e=>{const t=document.createElement("SPAN");return e.surroundContents(t),t},b=e=>{if(e.startContainer===e.endContainer)return[g(e)];const[t]=u(e),n=document.createRange();n.selectNodeContents(e.startContainer),n.setStart(e.startContainer,e.startOffset);const o=g(n),i=document.createRange();i.selectNode(e.endContainer),i.setEnd(e.endContainer,e.endOffset);const s=g(i);return[o,...t.map(e=>{const t=document.createElement("SPAN");return e.parentNode.insertBefore(t,e),t.appendChild(e),t}),s]},f=(e,t)=>{(e||[]).forEach(e=>{const t=e.parentNode,n=e.childNodes,o=n.length;if(o>0)for(let i=0;i<o;i++)t.insertBefore(n[0],e);else t.insertBefore(document.createTextNode(e.textContent),e);t.removeChild(e)}),t.normalize()},y=()=>{document.getSelection?(document.getSelection().removeAllRanges(),document.getSelection().addRange(document.createRange())):window.getSelection?window.getSelection().removeAllRanges?(window.getSelection().removeAllRanges(),window.getSelection().addRange(document.createRange())):window.getSelection().empty&&window.getSelection().empty():document.selection&&document.selection.empty()},v=e=>e.length>=20||-1!==e.search(/\n|\r|\r\n/),C=e=>Array.from(document.querySelectorAll(`[data-id='${e}']`)),x=e=>document.querySelector(`[data-ann-id='${e}']`),_=t,E=n,{Popover:w}=o,{TextField:S}=o,{styled:k}=i,A=k(w)(({theme:e,annotationType:t})=>({"& .MuiPaper-root":{overflowX:"unset",overflowY:"unset",marginLeft:"16px","&::before":{position:"absolute",right:"100%",top:"13px",border:"solid transparent",content:'""',height:0,width:0,pointerEvents:"none",borderWidth:"7px",borderRightColor:e.palette.grey[100]},..."negative"===t&&{"&::before":{borderRightColor:"rgb(255, 204, 238) !important"}},..."positive"===t&&{"&::before":{borderRightColor:"rgb(153, 255, 153) !important"}}}})),R=k("div")(({theme:e,annotationType:t})=>({width:"200px",overflow:"hidden",borderRadius:"4px",backgroundColor:"#ffffff",border:`4px solid ${e.palette.grey[100]}`,..."negative"===t&&{borderColor:"rgb(255, 204, 238) !important"},..."positive"===t&&{borderColor:"rgb(153, 255, 153) !important"}})),T=k("div")(({theme:e})=>({display:"flex",flexWrap:"wrap",borderTop:`2px solid ${e.palette.grey[100]}`})),I=k("div")(({theme:e,variant:t,annotationType:n})=>({flexGrow:1,width:"28%",textAlign:"center",padding:"4px",cursor:"pointer","&:not(:nth-child(3n))":{borderRight:`1px solid ${e.palette.grey[100]}`},"&:hover":{backgroundColor:e.palette.grey[100]},..."positive"===t&&{backgroundColor:"rgb(153, 255, 153) !important","&:hover":{filter:"brightness(85%)"}},..."negative"===t&&{backgroundColor:"rgb(255, 204, 238) !important","&:hover":{filter:"brightness(85%)"}},..."typeChange"===t&&"negative"===n&&{"&:hover":{backgroundColor:"rgb(153, 255, 153) !important"}},..."typeChange"===t&&"positive"===n&&{"&:hover":{backgroundColor:"rgb(255, 204, 238) !important"}}}));class M extends _.Component{static __initStatic(){this.propTypes={anchorEl:E.object,open:E.bool,offset:E.number,value:E.string,type:E.string,onClose:E.func,onDelete:E.func,onSave:E.func,onTypeChange:E.func}}constructor(e){super(e),M.prototype.__init.call(this),M.prototype.__init2.call(this),M.prototype.__init3.call(this),this.state={value:e.value}}UNSAFE_componentWillReceiveProps(e){const{value:t}=e,{value:n}=this.props;t!==n&&this.setState({value:t})}__init(){this.onValueChange=e=>this.setState({value:e.target.value})}__init2(){this.handleSave=()=>{const{value:e,onSave:t,onClose:n,onDelete:o}=this.props,{value:i}=this.state;""===i&&o(),e!==i&&t(e,i),this.setState({value:""}),n()}}__init3(){this.handleTypeChange=()=>{const{onTypeChange:e,onDelete:t}=this.props,{value:n}=this.state;""===n?t():e(n),this.setState({value:""})}}render(){const{anchorEl:e,offset:t,onDelete:n,open:o,type:i}=this.props,{value:s}=this.state;return _.createElement(A,{anchorEl:e,elevation:2,open:o,onClose:this.handleSave,annotationType:i,style:{marginTop:`${t}px`,transition:"margin-top 2s ease-out"},transitionDuration:{enter:225,exit:195},anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"left"}},_.createElement(R,{annotationType:i},_.createElement(S,{id:"annotation-editor",style:{padding:"2px 5px",width:"95%"},autoFocus:!0,multiline:!0,rows:1,maxRows:4,value:s,onChange:this.onValueChange,InputProps:{disableUnderline:!0}}),_.createElement(T,null,_.createElement(I,{onClick:n},"Delete"),_.createElement(I,{variant:"typeChange",annotationType:i,onClick:this.handleTypeChange},"negative"===i?"Green":"Pink"),_.createElement(I,{onClick:this.handleSave},"Save"))))}}M.__initStatic();const L=t,P=n,{styled:D}=i,{Popover:N}=o,H=D(N)({"& .MuiPaper-root":{overflowX:"unset",overflowY:"unset",marginTop:"-16px","&::after":{position:"absolute",left:"calc(50% - 7px)",border:"solid transparent",content:'""',height:0,width:0,pointerEvents:"none",borderWidth:"7px",borderTopColor:"black"}}}),W=D("div")(({theme:e})=>({width:"300px",overflow:"hidden",borderRadius:"4px",backgroundColor:e.palette.common.white,border:`2px solid ${e.palette.grey[100]}`})),z=D("div")({display:"flex",flexWrap:"wrap"}),$=D("div")(({theme:e})=>({display:"flex",flexWrap:"wrap",borderTop:`2px solid ${e.palette.grey[100]}`})),O=D("div")(({theme:e,variant:t})=>({width:"22%",textAlign:"center",padding:"4px",cursor:"pointer",borderBottom:`1px solid ${e.palette.grey[100]}`,"&:not(:nth-child(4n))":{borderRight:`1px solid ${e.palette.grey[100]}`},"&:nth-child(4n)":{flexGrow:1},"&:hover":{backgroundColor:e.palette.grey[100]},..."positive"===t&&{backgroundColor:"rgb(153, 255, 153) !important","&:hover":{filter:"brightness(85%)"}},..."negative"===t&&{backgroundColor:"rgb(255, 204, 238) !important","&:hover":{filter:"brightness(85%)"}}}));class j extends L.Component{static __initStatic(){this.propTypes={anchorEl:P.object,open:P.bool,annotations:P.array,isNewAnnotation:P.bool,onClose:P.func,onDelete:P.func,onEdit:P.func,onWrite:P.func,onAnnotate:P.func}}render(){const{anchorEl:e,annotations:t,isNewAnnotation:n,onAnnotate:o,onClose:i,onEdit:s,onDelete:a,onWrite:r,open:l}=this.props;return L.createElement(H,{anchorEl:e,open:l,onClose:i,elevation:5,transitionDuration:{enter:225,exit:195},anchorOrigin:{vertical:"top",horizontal:"center"},transformOrigin:{vertical:"bottom",horizontal:"center"}},L.createElement(W,null,L.createElement(z,null,t.map((e,t)=>L.createElement(O,{key:`annotation-${t}`,variant:e.type,onClick:()=>o(e)},e.label))),L.createElement($,null,L.createElement(O,{onClick:i},"Cancel"),L.createElement(O,{style:{pointerEvents:"none"}}),n?L.createElement(L.Fragment,null,L.createElement(O,{variant:"positive",onClick:()=>r("positive")},"Write"),L.createElement(O,{variant:"negative",onClick:()=>r("negative")},"Write")):L.createElement(L.Fragment,null,L.createElement(O,{onClick:a},"Delete"),L.createElement(O,{onClick:s},"Edit")))))}}j.__initStatic();const q=t,{styled:B}=i,K=n,U=d,{InputContainer:V}=c,F=B("div")({padding:"10px 120px 10px 16px",backgroundColor:"rgba(0, 0, 0, 0.06)",border:"1px solid #ccc",borderRadius:"4px",overflowY:"scroll",lineHeight:"36px",whiteSpace:"pre-wrap",overflowWrap:"break-word","& p":{margin:0},"& span[data-latex]":{userSelect:"none","-webkit-user-select":"none","-moz-user-select":"none","-ms-user-select":"none"}}),G=B("div")({width:"230px"}),X=B("div")({position:"relative",overflowX:"hidden",display:"flex"}),Y=B(V)(({theme:e})=>({paddingTop:e.spacing(2),marginBottom:e.spacing(2),marginTop:e.spacing(2),width:"100%"}));if(!document.getElementById("annotation-editor-styles")){const e=document.createElement("style");e.id="annotation-editor-styles",e.textContent='\n .sideAnnotation:before {\n position: absolute;\n right: var(--before-right, 100%);\n top: var(--before-top, 5px);\n border: solid transparent;\n content: "";\n height: 0;\n width: 0;\n pointer-events: none;\n border-width: var(--before-border-width, 7px);\n border-right-color: var(--before-border-color, rgb(153, 255, 153));\n }\n',document.head.appendChild(e)}class Q extends q.Component{static __initStatic(){this.propTypes={text:K.string,comment:K.string,annotations:K.array,predefinedAnnotations:K.array,onChange:K.func.isRequired,onCommentChange:K.func.isRequired,width:K.number,height:K.number,maxHeight:K.string,disabled:K.bool,disabledMath:K.bool,customKeys:K.array,keypadMode:K.string}}constructor(e){super(e),Q.prototype.__init.call(this),Q.prototype.__init2.call(this),Q.prototype.__init3.call(this),Q.prototype.__init4.call(this),Q.prototype.__init5.call(this),Q.prototype.__init6.call(this),Q.prototype.__init7.call(this),Q.prototype.__init8.call(this),Q.prototype.__init9.call(this),Q.prototype.__init10.call(this),Q.prototype.__init11.call(this),Q.prototype.__init12.call(this),Q.prototype.__init13.call(this),Q.prototype.__init14.call(this),Q.prototype.__init15.call(this),this.state={anchorEl:null,openedMenu:!1,openedEditor:!1,selectedElems:[],labelElem:null,selectionDetails:null,annotation:null,annotationIndex:null}}componentDidMount(){const{annotations:e,text:t}=this.props;t&&e.forEach(e=>{const[t,n]=((e,t,n)=>{const o=m(n,t),i=[];let s=0;return o.forEach(n=>{const o=s+n.textContent.length;[e,t].forEach(e=>{s<=e&&e<o&&i.push({node:n,offset:e-s})}),s=o}),i})(e.start,e.end,this.textRef);if(t&&n){const o=document.createRange();o.setStart(t.node,t.offset),o.setEnd(n.node,n.offset);const i=b(o);this.createDOMAnnotation(i,e)}}),this.textRef&&(this.adjustAnnotationsPosition(),this.textRef.addEventListener("scroll",this.adjustAnnotationsPosition))}__init(){this.adjustAnnotationsPosition=()=>{if(this.textRef&&this.labelsRef){const e=this.textRef.offsetLeft+this.textRef.offsetWidth+8;Array.from(this.labelsRef.children).forEach(t=>{const n=C(t.dataset.annId),o=(n[0].offsetTop?n[0].offsetTop:n[0].offsetParent.offsetTop)-this.textRef.scrollTop-6;t.style.top=`${o}px`,t.style.left=`${e}px`})}}}__init2(){this.handleClick=e=>{const{annotations:t}=this.props,{selectionDetails:n}=this.state;if(n)return;const{id:o,annId:i}=e.target.dataset,s=o||i,a=C(s),r=x(s),l=t.findIndex(e=>e.id===s),d=r.hasAttribute("data-freeform");d&&(r.style.zIndex="10"),this.setState({anchorEl:a[0],openedMenu:!!o||!!i&&!d,openedEditor:!!i&&d,selectedElems:a,labelElem:r,annotationIndex:l,annotation:t[l],selectionDetails:null})}}__init3(){this.handleHover=e=>{const{id:t,annId:n}=e.target.dataset,o=t||n,i=C(o),s=x(o),a=s.hasAttribute("data-freeform");i.forEach(e=>{e.style.zIndex="20",e.classList.contains("positive")?e.style.backgroundColor="rgb(51, 255, 51, 0.7)":e.classList.contains("negative")&&(e.style.backgroundColor="rgba(255, 102, 204, 0.55)")}),a?(s.style.zIndex="20",s.classList.contains("positive")?(s.style.backgroundColor="rgb(128, 255, 128)",s.style.setProperty("--before-border-color","rgb(153, 255, 153)")):s.classList.contains("negative")&&(s.style.backgroundColor="rgb(255, 179, 230)",s.style.setProperty("--before-border-color","rgb(255, 179, 230)"))):(s.style.zIndex="20",s.classList.contains("positive")?s.style.color="rgb(0, 77, 0)":s.classList.contains("negative")&&(s.style.color="rgb(153, 0, 102)"))}}__init4(){this.handleCancelHover=e=>{const{id:t,annId:n}=e.target.dataset,o=t||n,i=C(o),s=x(o),a=s.hasAttribute("data-freeform");i.forEach(e=>{e.style.zIndex="",e.classList.contains("positive")?e.style.backgroundColor="rgb(51, 255, 51, 0.5)":e.classList.contains("negative")&&(e.style.backgroundColor="rgba(255, 102, 204, 0.4)")}),a?(s.style.zIndex="",s.classList.contains("positive")?(s.style.backgroundColor="rgb(153, 255, 153)",s.style.removeProperty("--before-border-color")):s.classList.contains("negative")&&(s.style.backgroundColor="rgb(255, 204, 238)",s.style.removeProperty("--before-border-color"))):(s.style.zIndex="",s.classList.contains("positive")?s.style.color="rgb(0, 128, 0)":s.classList.contains("negative")&&(s.style.color="rgb(204, 0, 136)"))}}__init5(){this.handleClose=e=>{const{selectedElems:t,labelElem:n}=this.state;t.length&&!t[0].hasAttribute("data-id")&&f(t,this.textRef),n&&(n.style.zIndex=""),this.setState({anchorEl:null,openedMenu:!1,openedEditor:!1,selectedElems:[],labelElem:null,selectionDetails:null,annotationIndex:null,annotation:null}),y()}}__init6(){this.handleSelection=e=>{const t=window.getSelection();if(e.detail>2)y();else if(t&&t.rangeCount>0){const e=t.getRangeAt(0),n=e.toString(),o=this.textRef.contains(e.commonAncestorContainer);if(!t.isCollapsed&&""!==n&&o){const t=((e,t)=>{const n=document.createRange();n.setStart(t,0),n.setEnd(e.startContainer,e.startOffset);const[,o]=u(n),[,i]=u(e),s=o.length;return{quote:i,start:s,end:s+i.length}})(e,this.textRef),n=b(e);this.setState({anchorEl:n[0],openedMenu:!0,selectedElems:n,selectionDetails:t})}}}}__init7(){this.deleteAnnotation=()=>{const{annotations:e,onChange:t}=this.props,{selectedElems:n,labelElem:o,annotationIndex:i,annotation:s}=this.state;(v(s.label)?this.labelsRef:n[0]).removeChild(o),f(n,this.textRef),e.splice(i,1),t(e),this.handleClose()}}__init8(){this.createDOMAnnotation=(e,t)=>{const{disabled:n}=this.props,{id:o,label:i,type:s}=t;(e||[]).forEach(e=>{e.dataset.id=o,e.className=`annotation ${s}`,e.style.position="relative",e.style.cursor="pointer","positive"===s?e.style.backgroundColor="rgb(51, 255, 51, 0.5)":"negative"===s&&(e.style.backgroundColor="rgba(255, 102, 204, 0.4)"),e.onclick=!n&&this.handleClick,e.onmouseover=this.handleHover,e.onmouseout=this.handleCancelHover});const a=e&&e[0]||{},r=document.createElement("SPAN");if(r.dataset.annId=o,r.innerHTML=i,r.onclick=!n&&this.handleClick,r.onmouseover=this.handleHover,r.onmouseout=this.handleCancelHover,v(i)){const e=(a.offsetTop?a.offsetTop:a.offsetParent.offsetTop)-this.textRef.scrollTop,t=this.textRef.offsetLeft+this.textRef.offsetWidth+8;r.dataset.freeform=!0,r.className=`sideAnnotation ${s}`,r.style.position="absolute",r.style.padding="4px",r.style.borderRadius="4px",r.style.marginLeft="8px",r.style.width="180px",r.style.whiteSpace="pre-wrap",r.style.wordBreak="break-word",r.style.border="2px solid #ffffff",r.style.fontSize="14px",r.style.fontStyle="normal",r.style.fontWeight="normal",r.style.top=`${e}px`,r.style.left=`${t}px`,"negative"===s?r.style.backgroundColor="rgb(255, 204, 238)":"positive"===s&&(r.style.backgroundColor="rgb(153, 255, 153)"),r.style.setProperty("--before-border-width","7px"),r.style.setProperty("--before-top","5px"),r.style.setProperty("--before-right","100%"),"negative"===s?r.style.setProperty("--before-border-color","rgb(255, 204, 238)"):"positive"===s&&r.style.setProperty("--before-border-color","rgb(153, 255, 153)"),this.labelsRef.appendChild(r)}else r.className=`annotationLabel ${s}`,r.style.backgroundColor="rgb(242, 242, 242)",r.style.padding="2px",r.style.position="absolute",r.style.userSelect="none",r.style.whiteSpace="nowrap",r.style.top="-10px",r.style.left="-2px",r.style.fontSize="12px",r.style.fontStyle="normal",r.style.fontWeight="normal",r.style.lineHeight="6px",r.style.webkitUserSelect="none",r.style.mozUserSelect="none",r.style.msUserSelect="none","positive"===s?r.style.color="rgb(0, 128, 0)":"negative"===s&&(r.style.color="rgb(204, 0, 136)"),a.appendChild(r)}}__init9(){this.createNewAnnotation=(e,t)=>{const{selectedElems:n,selectionDetails:o}=this.state,i={id:[o.start,o.end,(new Date).getTime()].join("-"),label:e,type:t,...o};return this.createDOMAnnotation(n,i),i}}__init10(){this.handleMenuClick=e=>{const{annotations:t,onChange:n}=this.props,{annotation:o,annotationIndex:i}=this.state,{type:s,text:a}=e;if(o){const e={...o,label:a,type:s},{type:n,label:r}=o;this.updateLabel(r,e,s!==n&&n),t.splice(i,1,e)}else{const e=this.createNewAnnotation(a,s);t.push(e)}n(t),this.handleClose()}}__init11(){this.editAnnotation=()=>{this.setState({openedMenu:!1,openedEditor:!0})}}__init12(){this.addAnnotation=e=>{const{annotations:t,onChange:n}=this.props,o=this.createNewAnnotation("",e),i=x(o.id);t.push(o),this.setState({openedMenu:!1,openedEditor:!0,annotationIndex:t.length-1,annotation:o,labelElem:i}),n(t)}}__init13(){this.updateLabel=(e,t,n)=>{const{selectedElems:o,labelElem:i}=this.state,{label:s,type:a}=t;v(s)&&v(e)||!v(s)&&!v(e)?(i.innerHTML=s,n&&(i.classList.remove(n),i.classList.add(a),o.forEach(e=>{e.classList.remove(n),e.classList.add(a)}))):v(s)&&!v(e)?(o[0].removeChild(i),this.createDOMAnnotation(o,t)):!v(s)&&v(e)&&(this.labelsRef.removeChild(i),this.createDOMAnnotation(o,t))}}__init14(){this.changeAnnotationType=e=>{const{annotations:t,onChange:n}=this.props,{annotationIndex:o,selectedElems:i}=this.state,{type:s,label:a}=t[o],r="positive"===s?"negative":"positive",l={...t[o],type:r,label:e};i.forEach(e=>{e.classList.remove(s),e.classList.add(r)}),this.updateLabel(a,l,s),t.splice(o,1,l),n(t),this.handleClose()}}__init15(){this.updateAnnotation=(e,t)=>{const{annotations:n,onChange:o}=this.props,{annotationIndex:i}=this.state,s={...n[i],label:t};this.updateLabel(e,s),n.splice(i,1,s),o(n)}}componentWillUnmount(){this.textRef.removeEventListener("scroll",this.adjustAnnotationsPosition)}render(){const{comment:e,customKeys:t,disabled:n,disabledMath:o,keypadMode:i,height:s,width:a,maxHeight:r,onCommentChange:l,predefinedAnnotations:d,text:c}=this.props,{anchorEl:p,annotation:h,openedMenu:m,openedEditor:u,selectionDetails:g}=this.state,b=p&&(p.offsetTop?p.offsetTop:p.offsetParent.offsetTop),f=this.textRef&&b?b-this.textRef.scrollTop-8:0;return q.createElement("div",null,q.createElement(X,null,q.createElement(F,{style:{width:a-34,minHeight:s,maxHeight:r},ref:e=>this.textRef=e,onMouseDown:n?()=>{}:y,onMouseUp:n?()=>{}:this.handleSelection,dangerouslySetInnerHTML:{__html:c}}),q.createElement(G,{ref:e=>this.labelsRef=e})),q.createElement(Y,{label:"Comment"},q.createElement(U,{className:"prompt",markup:e||"",onChange:l,width:a&&(a+104).toString(),disabled:n,pluginProps:{math:{disabled:o,customKeys:t,keypadMode:i,controlledKeypadMode:!1},video:{disabled:!0},audio:{disabled:!0},textAlign:{disabled:!0}}})),q.createElement(j,{anchorEl:p,open:m&&!n,annotations:d,isNewAnnotation:!!g,onClose:this.handleClose,onDelete:this.deleteAnnotation,onEdit:this.editAnnotation,onWrite:this.addAnnotation,onAnnotate:this.handleMenuClick}),q.createElement(M,{anchorEl:this.textRef,open:u&&!n,offset:f,value:h&&h.label||"",type:h&&h.type,onClose:this.handleClose,onDelete:this.deleteAnnotation,onSave:this.updateAnnotation,onTypeChange:this.changeAnnotationType}))}}Q.__initStatic();const J=t,Z=n,{debounce:ee}=s,te=a,{Typography:ne}=o,{styled:oe}=i,{color:ie}=r,{Feedback:se}=r,{Collapsible:ae}=r,{PreviewPrompt:re}=r,{UiLayout:le}=r,de=d,ce=te("@pie-ui:extended-text-entry"),pe=oe(le)({backgroundColor:ie.background(),color:ie.text()}),he=oe(ne)(({theme:e})=>({width:"100%",color:ie.text(),marginBottom:e.spacing(2),fontSize:"inherit"})),me=oe("div")(({theme:e})=>({marginBottom:e.spacing(2)})),ue=oe(de)(({theme:e})=>({marginBottom:e.spacing(2),borderRadius:"4px"})),ge=oe("h2")({position:"absolute",left:"-10000px",top:"auto",width:"1px",height:"1px",overflow:"hidden"});class be extends J.Component{constructor(...e){super(...e),be.prototype.__init.call(this),be.prototype.__init2.call(this)}static __initStatic(){this.propTypes={onValueChange:Z.func.isRequired,onAnnotationsChange:Z.func.isRequired,onCommentChange:Z.func.isRequired,model:Z.object,session:Z.shape({value:Z.string,annotations:Z.array,comment:Z.string}).isRequired}}__init(){this.changeSessionValue=ee(this.props.onValueChange,1500)}__init2(){this.changeSessionComment=ee(this.props.onCommentChange,1500)}render(){const{model:e,session:t,onAnnotationsChange:n}=this.props,{animationsDisabled:o,annotatorMode:i,customKeys:s,dimensions:a,disabled:r,disabledAnnotator:l,equationEditor:d,extraCSSRules:c,feedback:p,mathInput:h,playersToolbarPosition:m,predefinedAnnotations:u,prompt:g,spanishInput:b,specialInput:f,spellCheckEnabled:y,teacherInstructions:v}=e,{annotations:C,comment:x,value:_}=t,{width:E,height:w}=a||{},S="40vh",k={position:"top"===m?"top":"bottom"};ce("[render] disabled? ",r);const A=J.createElement(re,{defaultClassName:"teacher-instructions",prompt:v}),R=[];return b&&R.push({language:"spanish"}),f&&R.push({language:"special"}),J.createElement(pe,{extraCSSRules:c,ref:e=>{this.containerRef=e}},J.createElement(ge,null,"Constructed Response Question"),v&&J.createElement(me,null,o?A:J.createElement(ae,{labels:{hidden:"Show Teacher Instructions",visible:"Hide Teacher Instructions"}},A)),g&&J.createElement(he,{component:"span"},J.createElement(re,{defaultClassName:"prompt",prompt:e.prompt})),i?J.createElement(Q,{text:_||"",annotations:C||[],comment:x||"",predefinedAnnotations:u||[],onChange:n,onCommentChange:this.changeSessionComment,width:E,height:w,maxHeight:S,disabled:l,disabledMath:!h,customKeys:s,keypadMode:d}):J.createElement(ue,{className:"response-area-editor",onChange:this.changeSessionValue,markup:_||"",maxWidth:E&&E.toString(),minWidth:"100px",minHeight:w&&w.toString(),maxHeight:S,disabled:r,highlightShape:!0,toolbarOpts:k,spellCheck:y,charactersLimit:5e4,autoWidthToolbar:!0,pluginProps:{math:{disabled:!h,customKeys:this.props.model.customKeys,keypadMode:this.props.model.equationEditor,controlledKeypadMode:!1},video:{disabled:!0},audio:{disabled:!0},table:{disabled:!0},textAlign:{disabled:!0},separateParagraphs:{disabled:!1},ul_list:{disabled:!0},ol_list:{disabled:!0}},languageCharactersProps:R}),p&&J.createElement(se,{correctness:"correct",feedback:p}))}}be.__initStatic();const fe=t,{debounce:ye}=s,ve=a,{renderMath:Ce}=l,xe=ve("pie-element:extended-text-entry:print");class _e extends HTMLElement{constructor(){super(),this._options=null,this._model=null,this._session=[],this._root=null,this._rerender=ye(()=>{if(this._model&&this._session){const e=((e,t)=>{const n="instructor"===t.role;return e.prompt=!1!==e.promptEnabled?e.prompt:void 0,e.teacherInstructions=n&&!1!==e.teacherInstructionsEnabled?e.teacherInstructions:void 0,e.showTeacherInstructions=n,e.mode=n?"evaluate":e.mode,e.dimensions={height:100,width:500,...e.dimensions},e.disabled=!0,e.feedback=void 0,e.animationsDisabled=!0,e})(this._model,this._options),t=this._options&&fe.createElement(be,{model:e,session:{},onChange:()=>{},onValueChange:()=>{},onAnnotationsChange:()=>{},onCommentChange:()=>{}});this._root||(this._root=p(this)),this._root.render(t),queueMicrotask(()=>{xe("render complete - render math"),Ce(this)})}else xe("skip")},50,{leading:!1,trailing:!0})}set options(e){this._options=e}set model(e){this._model=e,this._rerender()}connectedCallback(){}disconnectedCallback(){this._root&&this._root.unmount()}}export{_e as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-element/extended-text-entry",
3
- "version": "14.0.0-next.42+bb1f3eb4e",
3
+ "version": "14.0.0-next.43+4249fa78f",
4
4
  "description": "",
5
5
  "repository": "pie-framework/pie-elements",
6
6
  "publishConfig": {
@@ -22,13 +22,17 @@
22
22
  "debug": "^4.1.1",
23
23
  "lodash.throttle": "^4.1.1",
24
24
  "prop-types": "^15.6.1",
25
- "react": "18.2.0",
26
- "react-dom": "18.2.0"
25
+ "react": "18.3.1",
26
+ "react-dom": "18.3.1"
27
27
  },
28
- "gitHead": "bb1f3eb4e3b5b1cb15024d459ffd6e94bf419712",
28
+ "gitHead": "4249fa78fc423ef0a8c89002b8f937c42b3478ea",
29
29
  "scripts": {
30
30
  "postpublish": "../../scripts/postpublish"
31
31
  },
32
32
  "main": "lib/index.js",
33
- "module": "src/index.js"
33
+ "module": "src/index.js",
34
+ "exports": {
35
+ ".": "./src/index.js",
36
+ "./print": "./src/print.js"
37
+ }
34
38
  }