@pie-element/rubric 7.0.0-next.42 → 7.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.
Files changed (2) hide show
  1. package/module/print.js +1 -0
  2. package/package.json +6 -2
@@ -0,0 +1 @@
1
+ import{_dll_react_dom as e,_dll_react as t,_dll_mui__material_styles as i,_dll_mui__material as n,_dll_mui__material_collapse as r,_dll_pie_lib__render_ui as o,_dll_prop_types as s,_dll_lodash as l,_dll_debug as a}from"../../../@pie-lib/shared-module@^3.0.5/module/index.js";import{_dll_pie_lib__math_rendering as c}from"../../../@pie-lib/math-rendering-module@^4.0.5/module/index.js";var d,p=e;d=p.createRoot,p.hydrateRoot;const h=t,{styled:m}=i,{ListItem:u}=n,{List:g}=n,x=r,{color:b}=o,{UiLayout:_}=o,f=s,y=m(_)({color:b.text(),backgroundColor:b.background(),"&:not(.MathJax) table":{borderCollapse:"collapse"},"&:not(.MathJax) table td, &:not(.MathJax) table th":{padding:"8px 12px",textAlign:"left"},"& ul p, & ol p":{marginBottom:0,marginTop:0,lineHeight:"normal"}}),k=m(u)({display:"flex",flexDirection:"column",alignItems:"flex-start",padding:"12px 0px"}),S=m("div")({color:b.text()}),E=m("h3")({color:b.text(),fontSize:"16px",fontWeight:"700",margin:0,paddingBottom:"6px"}),v=m("h4")({color:b.text(),fontSize:"16px",fontWeight:"normal",margin:0,paddingBottom:"6px"}),w=m("h2")(({theme:e})=>({display:"flex",alignItems:"center",cursor:"pointer",userSelect:"none",fontSize:e.typography.fontSize,fontWeight:"500",color:b.tertiary(),margin:0})),R=m("span")({display:"inline-flex",transition:"transform 0.2s",marginLeft:2,alignSelf:"center"}),L=m("h2")({position:"absolute",width:"1px",height:"1px",padding:0,margin:"-1px",overflow:"hidden",clip:"rect(0,0,0,0)",border:0,whiteSpace:"nowrap"}),C=f.shape({excludeZero:f.bool,points:f.arrayOf(f.string),sampleAnswers:f.arrayOf(f.string),animationsDisabled:f.bool});class O extends h.Component{__init(){this.dudUrl="javascript:;"}constructor(e){super(e),O.prototype.__init.call(this),O.prototype.__init2.call(this),this.state={rubricOpen:!1,linkPrefix:"Show"},this.toggleRubric=this.toggleRubric.bind(this)}static __initStatic(){this.propTypes={model:f.object.isRequired,animationsDisabled:f.bool,value:C}}toggleRubric(){this.setState({rubricOpen:!this.state.rubricOpen}),this.setState({linkPrefix:this.state.rubricOpen?"Show":"Hide"})}__init2(){this.shouldRenderPoint=(e,t)=>!t.excludeZero||0!==e}render(){const{model:e,value:t}=this.props;let{animationsDisabled:i}=this.props;if(i=i||t.animationsDisabled,t&&t.points){const{extraCSSRules:n}=e||{},{points:r,sampleAnswers:o}=t,s=h.createElement(g,{component:"nav"},r.slice(0).reverse().map((e,i)=>{i=r.length-i-1;const n=t.excludeZero?i+1:i;return h.createElement(h.Fragment,{key:i},h.createElement(k,{key:`P${i}`},h.createElement(E,null,1===n?`${n} PT`:`${n} PTS`),h.createElement(S,{dangerouslySetInnerHTML:{__html:e}})),o&&o[i]&&h.createElement(k,{key:`S${i}`},h.createElement(v,null,"Sample Answer"),h.createElement(S,{dangerouslySetInnerHTML:{__html:o[i]}})))}));return h.createElement(y,{extraCSSRules:n},h.createElement(L,null,"Rubric"),i?s:h.createElement(h.Fragment,null,h.createElement(w,{id:"rubric-toggle",tabIndex:0,role:"button","aria-expanded":this.state.rubricOpen,onClick:this.toggleRubric,onKeyPress:e=>{"Enter"!==e.key&&" "!==e.key||this.toggleRubric()}},this.state.linkPrefix," Rubric",h.createElement(R,{"aria-hidden":"true"},this.state.rubricOpen?h.createElement("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},h.createElement("polyline",{points:"18 15 12 9 6 15"})):h.createElement("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},h.createElement("polyline",{points:"6 9 12 15 18 9"})))),h.createElement(x,{in:this.state.rubricOpen,timeout:{enter:225,exit:195}},s)))}return null}}O.__initStatic();const M=t,{debounce:P}=l,T=a,{renderMath:j}=c,D=T("pie-element:rubric:print");class I extends HTMLElement{constructor(){super(),this._options=null,this._model=null,this._session=[],this._root=null,this._rerender=P(()=>{if(this._model&&this._session){const t=(e=this._model,"instructor"===this._options.role?(e.value={...e},e.mode="evaluate",e.animationsDisabled=!0,e):{}),i=this._options&&M.createElement(O,{...t});this._root||(this._root=d(this)),this._root.render(i),queueMicrotask(()=>{D("render complete - render math"),j(this)})}else D("skip");var e},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{I as default};
package/package.json CHANGED
@@ -1,8 +1,12 @@
1
1
  {
2
2
  "name": "@pie-element/rubric",
3
- "version": "7.0.0-next.42+bb1f3eb4e",
3
+ "version": "7.0.0-next.43+4249fa78f",
4
4
  "main": "lib/index.js",
5
5
  "module": "src/index.js",
6
+ "exports": {
7
+ ".": "./src/index.js",
8
+ "./print": "./src/print.js"
9
+ },
6
10
  "description": "Rubric Scoring Interaction",
7
11
  "repository": "pie-framework/pie-elements",
8
12
  "publishConfig": {
@@ -19,7 +23,7 @@
19
23
  },
20
24
  "author": "pie framework developers",
21
25
  "license": "ISC",
22
- "gitHead": "bb1f3eb4e3b5b1cb15024d459ffd6e94bf419712",
26
+ "gitHead": "4249fa78fc423ef0a8c89002b8f937c42b3478ea",
23
27
  "scripts": {
24
28
  "postpublish": "../../scripts/postpublish"
25
29
  }