@pie-element/rubric 7.0.0-next.43 → 7.1.1-next.1
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 +681 -1888
- package/configure/CHANGELOG.md +646 -1770
- package/configure/lib/defaults.js +3 -0
- package/configure/lib/defaults.js.map +1 -1
- package/configure/package.json +7 -7
- package/configure/src/defaults.js +1 -0
- package/controller/package.json +2 -2
- package/lib/print.js +2 -2
- package/lib/print.js.map +1 -1
- package/package.json +5 -5
- package/src/print.js +1 -1
- package/module/configure.js +0 -1
- package/module/controller.js +0 -73
- package/module/demo.js +0 -33
- package/module/element.js +0 -1
- package/module/index.html +0 -21
- package/module/manifest.json +0 -14
- package/module/print-demo.js +0 -71
- package/module/print.html +0 -18
- package/module/print.js +0 -1
package/module/print-demo.js
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import PrintElement from './print.js';
|
|
2
|
-
|
|
3
|
-
var generate = {};
|
|
4
|
-
|
|
5
|
-
generate.model = (id, element) => ({
|
|
6
|
-
id,
|
|
7
|
-
element,
|
|
8
|
-
points: ['nothing right', 'a teeny bit right', 'mostly right', 'bingo'],
|
|
9
|
-
sampleAnswers: [null, 'just right', 'not left', null],
|
|
10
|
-
maxPoints: 3,
|
|
11
|
-
excludeZero: false,
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
const { model } = generate;
|
|
15
|
-
|
|
16
|
-
var config = {
|
|
17
|
-
elements: {
|
|
18
|
-
'pie-rubric': '../..',
|
|
19
|
-
},
|
|
20
|
-
models: [model('1', 'pie-rubric')],
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
// new init - just shows off print!
|
|
24
|
-
|
|
25
|
-
const init = async () => {
|
|
26
|
-
console.log('define the element...');
|
|
27
|
-
await Promise.all(
|
|
28
|
-
config.models.map(async (m) => {
|
|
29
|
-
try {
|
|
30
|
-
const printTag = `${m.element}-print`;
|
|
31
|
-
if (customElements.get(printTag)) {
|
|
32
|
-
return true;
|
|
33
|
-
} else {
|
|
34
|
-
customElements.define(printTag, PrintElement);
|
|
35
|
-
await customElements.whenDefined(printTag);
|
|
36
|
-
return true;
|
|
37
|
-
}
|
|
38
|
-
} catch (e) {
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
41
|
-
})
|
|
42
|
-
);
|
|
43
|
-
|
|
44
|
-
console.log('now apply the model...');
|
|
45
|
-
config.models.forEach((m) => {
|
|
46
|
-
const printTag = `${m.element}-print`;
|
|
47
|
-
const h3s = document.createElement('h3');
|
|
48
|
-
h3s.textContent = 'student mode';
|
|
49
|
-
document.body.appendChild(h3s);
|
|
50
|
-
const de = document.createElement(printTag);
|
|
51
|
-
document.body.appendChild(de);
|
|
52
|
-
de.options = {};
|
|
53
|
-
de.model = m;
|
|
54
|
-
|
|
55
|
-
const h3 = document.createElement('h3');
|
|
56
|
-
h3.textContent = 'instructor mode';
|
|
57
|
-
document.body.appendChild(h3);
|
|
58
|
-
const instr = document.createElement(printTag);
|
|
59
|
-
document.body.appendChild(instr);
|
|
60
|
-
instr.options = { mode: 'instructor' };
|
|
61
|
-
instr.model = JSON.parse(JSON.stringify(m));
|
|
62
|
-
});
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
init()
|
|
66
|
-
.then(() => {
|
|
67
|
-
console.log('ready');
|
|
68
|
-
})
|
|
69
|
-
.catch((e) => {
|
|
70
|
-
console.error(e);
|
|
71
|
-
});
|
package/module/print.html
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
<!doctype html>
|
|
3
|
-
<html>
|
|
4
|
-
<head>
|
|
5
|
-
<title>@pie-element/rubric@7.0.0-beta.1</title>
|
|
6
|
-
<link
|
|
7
|
-
href="https://fonts.googleapis.com/css?family=Roboto&display=swap"
|
|
8
|
-
rel="stylesheet"
|
|
9
|
-
/>
|
|
10
|
-
<style>
|
|
11
|
-
html, body {
|
|
12
|
-
font-family: 'Roboto', sans-serif;
|
|
13
|
-
}
|
|
14
|
-
</style>
|
|
15
|
-
<script type="module" src="./print-demo.js"></script>
|
|
16
|
-
</head>
|
|
17
|
-
<body></body>
|
|
18
|
-
</html>
|
package/module/print.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
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};
|