@citolab/qti-components 6.4.2 → 6.4.5
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/dist/{chunk-O4MG75IZ.js → chunk-67E36LYB.js} +16 -10
- package/dist/{chunk-7FZSQALE.cjs → chunk-BD6FQ6G6.cjs} +16 -10
- package/dist/{chunk-JRSNRE2R.js → chunk-N4M5S3KO.js} +83 -50
- package/dist/{chunk-PBNEJ254.cjs → chunk-ULLHUYN2.cjs} +75 -42
- package/dist/custom-elements.json +195 -189
- package/dist/index.bundled.css +2002 -2
- package/dist/index.cjs +146 -107
- package/dist/index.css +16 -10
- package/dist/index.d.cts +11 -8
- package/dist/index.d.ts +11 -8
- package/dist/index.js +148 -109
- package/dist/qti-components/index.cjs +10 -10
- package/dist/qti-components/index.js +35 -35
- package/dist/qti-item/index.cjs +1 -1
- package/dist/qti-item/index.js +1 -1
- package/dist/qti-item-react/index.cjs +1 -1
- package/dist/qti-item-react/index.js +1 -1
- package/dist/qti-test/index.cjs +1 -1
- package/dist/qti-test/index.d.cts +11 -8
- package/dist/qti-test/index.d.ts +11 -8
- package/dist/qti-test/index.js +1 -1
- package/dist/qti-test-react/index.cjs +1 -1
- package/dist/qti-test-react/index.js +1 -1
- package/package.json +4 -3
|
@@ -1,15 +1,25 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }var _chunkBD6FQ6G6cjs = require('./chunk-BD6FQ6G6.cjs');var _chunkHYQC3D4Zcjs = require('./chunk-HYQC3D4Z.cjs');var _decoratorsjs = require('lit/decorators.js');var I=class extends _chunkBD6FQ6G6cjs.a{connectedCallback(){super.connectedCallback();let t=new CustomEvent("register-item-ref",{bubbles:!0,composed:!0,detail:{identifier:this.identifier,href:this.href}});this.dispatchEvent(t)}};_chunkHYQC3D4Zcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String})],I.prototype,"identifier",2),_chunkHYQC3D4Zcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String})],I.prototype,"href",2),I= exports.a =_chunkHYQC3D4Zcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "qti-assessment-item-ref")],I);var _lit = require('lit');var _context2 = require('@lit/context');var xt=class{},c= exports.c =_context2.createContext.call(void 0, "test");var _preactsignals = require('@lit-labs/preact-signals');var E=class extends _lit.LitElement{constructor(){super();this.itemIndex=0;this._initialValue={itemIndex:0,audienceContext:"candidate",items:[]};this.signalContext=_preactsignals.signal.call(void 0, this._initialValue);this.itemRefEls=new Map;this.restoreContext=t=>{var e;t||(t=this._initialValue),this.signalContext.value.itemIndex=t.itemIndex,(e=t.items)==null||e.forEach(r=>{let i=this.signalContext.value.items.find(a=>a.identifier===r.identifier);i?i.variables=r.variables:this.signalContext.value.items.push(r)})};this.itemConnected=t=>{let e=this.signalContext.value.items.find(r=>(r==null?void 0:r.identifier)===(t==null?void 0:t.identifier));e.variables.length===1?this.copyItemVariables(t.identifier):t.variables=[...e.variables]};this.addEventListener("register-item-ref",this.onItemRefRegistered),this.addEventListener("on-test-request-item",this.onTestRequestItem),this.addEventListener("qti-item-first-updated",t=>this.itemConnected(t.detail)),this.addEventListener("qti-interaction-changed",t=>this.copyItemVariables(t.detail.item)),this.addEventListener("qti-outcome-changed",t=>this.copyItemVariables(t.detail.item)),_preactsignals.effect.call(void 0, ()=>this._context=this.signalContext.value)}set context(t){console.log("set context",t),this.signalContext.value=t}updated(t){var e,r;if(t.has("_context")){let i=(e=t.get("_context"))==null?void 0:e.itemIndex;this.signalContext.value.items.length>0&&this.signalContext.value.itemIndex!==null&&i!==this.signalContext.value.itemIndex&&this._requestItem(this.signalContext.value.items[this.signalContext.value.itemIndex].identifier,(r=this.signalContext.value.items[i])==null?void 0:r.identifier)}t.has("audienceContext")&&(this._context=_chunkHYQC3D4Zcjs.b.call(void 0, _chunkHYQC3D4Zcjs.a.call(void 0, {},this._context),{audienceContext:this.audienceContext}),this.itemRefEls.forEach((i,a)=>i.audienceContext={view:this.audienceContext})),t.has("itemIndex")&&(this.signalContext.value=_chunkHYQC3D4Zcjs.b.call(void 0, _chunkHYQC3D4Zcjs.a.call(void 0, {},this.signalContext.value),{itemIndex:this.itemIndex}))}copyItemVariables(t){this.signalContext.value=_chunkHYQC3D4Zcjs.b.call(void 0, _chunkHYQC3D4Zcjs.a.call(void 0, {},this.signalContext.value),{items:this.signalContext.value.items.map(e=>e.identifier==t?_chunkHYQC3D4Zcjs.b.call(void 0, _chunkHYQC3D4Zcjs.a.call(void 0, {},e),{variables:this.getAssessmentItem(t).context.variables}):e)})}getAssessmentItem(t){return this.querySelector(`qti-assessment-item-ref[identifier="${t}"]`).assessmentItem}get currentAssessmentItem(){return this.querySelector(`qti-assessment-item-ref[identifier="${this.signalContext.value.items[this.signalContext.value.itemIndex].identifier}"]`).assessmentItem}onItemRefRegistered(t){this.itemRefEls.set(t.detail.identifier,t.target);let{href:e,identifier:r}=t.detail;this.signalContext.value.items=[...this.signalContext.value.items,{href:e,identifier:r,variables:[{identifier:"completionStatus",cardinality:"single",baseType:"string",value:"not_attempted",type:"outcome"}]}]}onTestRequestItem(t){t.stopImmediatePropagation(),t.detail!==this.signalContext.value.itemIndex&&(this.signalContext.value=_chunkHYQC3D4Zcjs.b.call(void 0, _chunkHYQC3D4Zcjs.a.call(void 0, {},this.signalContext.value),{itemIndex:t.detail}))}firstUpdated(t){if(super.firstUpdated(t),this.signalContext.value.items.length===0){console.warn("No items found in the test, please add at least one item");return}this._emit("qti-assessment-first-updated",this)}_requestItem(t,e){this.dispatchEvent(new CustomEvent("on-test-set-item",{bubbles:!0,composed:!0,detail:{old:e,new:t}}))}_emit(t,e=null){this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:e}))}render(){return _lit.html`<slot></slot>`}};_chunkHYQC3D4Zcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String,reflect:!0,attribute:"audience-context"})],E.prototype,"audienceContext",2),_chunkHYQC3D4Zcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Number,reflect:!0,attribute:"item-index"})],E.prototype,"itemIndex",2),_chunkHYQC3D4Zcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String})],E.prototype,"identifier",2),_chunkHYQC3D4Zcjs.c.call(void 0, [_context2.provide.call(void 0, {context:c}),_decoratorsjs.property.call(void 0, {attribute:!1})],E.prototype,"_context",2),E= exports.d =_chunkHYQC3D4Zcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "qti-assessment-test")],E);var $=class extends _lit.LitElement{constructor(){super(...arguments);this.loading=!1;this._navigationMode="linear"}render(){return _lit.html`
|
|
2
2
|
<slot name="qti-item"></slot>
|
|
3
3
|
<slot> </slot>
|
|
4
|
-
`}};_chunkHYQC3D4Zcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Boolean,reflect:!0})],$.prototype,"loading",2),_chunkHYQC3D4Zcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String,attribute:"navigation-mode"})],$.prototype,"_navigationMode",2),$= exports.e =_chunkHYQC3D4Zcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "qti-test-part")],$);var A,gt=0;function tt(o){A=o}function et(){A=null,gt=0}function wt(){return gt++}var G=Symbol("haunted.phase"),L=Symbol("haunted.hook"),st=Symbol("haunted.update"),rt=Symbol("haunted.commit"),g=Symbol("haunted.effects"),_=Symbol("haunted.layoutEffects"),R="haunted.context";var Yt,Zt,Tt,O=class{constructor(s,t){_chunkHYQC3D4Zcjs.d.call(void 0, this,"update");_chunkHYQC3D4Zcjs.d.call(void 0, this,"host");_chunkHYQC3D4Zcjs.d.call(void 0, this,"virtual");_chunkHYQC3D4Zcjs.d.call(void 0, this,Yt);_chunkHYQC3D4Zcjs.d.call(void 0, this,Zt);_chunkHYQC3D4Zcjs.d.call(void 0, this,Tt);this.update=s,this.host=t,this[L]=new Map,this[g]=[],this[_]=[]}run(s){tt(this);let t=s();return et(),t}_runEffects(s){let t=this[s];tt(this);for(let e of t)e.call(this);et()}runEffects(){this._runEffects(g)}runLayoutEffects(){this._runEffects(_)}teardown(){this[L].forEach(t=>{typeof t.teardown=="function"&&t.teardown()})}};Yt=L,Zt=g,Tt=_;var te=Promise.resolve().then.bind(Promise.resolve());function yt(){let o=[],s;function t(){s=null;let e=o;o=[];for(var r=0,i=e.length;r<i;r++)e[r]()}return function(e){o.push(e),s==null&&(s=te(t))}}var ee=yt(),vt=yt(),se,I=class{constructor(s,t){_chunkHYQC3D4Zcjs.d.call(void 0, this,"renderer");_chunkHYQC3D4Zcjs.d.call(void 0, this,"host");_chunkHYQC3D4Zcjs.d.call(void 0, this,"state");_chunkHYQC3D4Zcjs.d.call(void 0, this,se);_chunkHYQC3D4Zcjs.d.call(void 0, this,"_updateQueued");this.renderer=s,this.host=t,this.state=new O(this.update.bind(this),t),this[G]=null,this._updateQueued=!1}update(){this._updateQueued||(ee(()=>{let s=this.handlePhase(st);vt(()=>{this.handlePhase(rt,s),vt(()=>{this.handlePhase(g)})}),this._updateQueued=!1}),this._updateQueued=!0)}handlePhase(s,t){switch(this[G]=s,s){case rt:this.commit(t),this.runEffects(_);return;case st:return this.render();case g:return this.runEffects(g)}}render(){return this.state.run(()=>this.renderer.call(this.host,this.host))}runEffects(s){this.state._runEffects(s)}teardown(){this.state.teardown()}};se=G;var re=(o="")=>o.replace(/-+([a-z])?/g,(s,t)=>t?t.toUpperCase():"");function Ct(o){class s extends I{constructor(i,m,u){super(i,u||m);_chunkHYQC3D4Zcjs.d.call(void 0, this,"frag");this.frag=m}commit(i){o(i,this.frag)}}function t(e,r,i){let m=(i||r||{}).baseElement||HTMLElement,{observedAttributes:u=[],useShadowDOM:l=!0,shadowRootInit:k={}}=i||r||{};class M extends m{constructor(){super();_chunkHYQC3D4Zcjs.d.call(void 0, this,"_scheduler");l===!1?this._scheduler=new s(e,this):(this.attachShadow(_chunkHYQC3D4Zcjs.a.call(void 0, {mode:"open"},k)),this._scheduler=new s(e,this.shadowRoot,this))}static get observedAttributes(){return e.observedAttributes||u||[]}connectedCallback(){this._scheduler.update()}disconnectedCallback(){this._scheduler.teardown()}attributeChangedCallback(b,w,d){if(w===d)return;let Pt=d===""?!0:d;Reflect.set(this,re(b),Pt)}}function Dt(C){let f=C,b=!1;return Object.freeze({enumerable:!0,configurable:!0,get(){return f},set(w){b&&f===w||(b=!0,f=w,this._scheduler&&this._scheduler.update())}})}let Nt=new Proxy(m.prototype,{getPrototypeOf(C){return C},set(C,f,b,w){let d;return f in C?(d=Object.getOwnPropertyDescriptor(C,f),d&&d.set?(d.set.call(w,b),!0):(Reflect.set(C,f,b,w),!0)):(typeof f=="symbol"||f[0]==="_"?d={enumerable:!0,configurable:!0,writable:!0,value:b}:d=Dt(b),Object.defineProperty(w,f,d),d.set&&d.set.call(w,b),!0)}});return Object.setPrototypeOf(M.prototype,Nt),M}return t}var p=class{constructor(s,t){_chunkHYQC3D4Zcjs.d.call(void 0, this,"id");_chunkHYQC3D4Zcjs.d.call(void 0, this,"state");this.id=s,this.state=t}};function oe(o,...s){let t=wt(),e=A[L],r=e.get(t);return r||(r=new o(t,A,...s),e.set(t,r)),r.update(...s)}function x(o){return oe.bind(null,o)}function K(o){return x(class extends p{constructor(t,e,r,i){super(t,e);_chunkHYQC3D4Zcjs.d.call(void 0, this,"callback");_chunkHYQC3D4Zcjs.d.call(void 0, this,"lastValues");_chunkHYQC3D4Zcjs.d.call(void 0, this,"values");_chunkHYQC3D4Zcjs.d.call(void 0, this,"_teardown");o(e,this)}update(t,e){this.callback=t,this.values=e}call(){(!this.values||this.hasChanged())&&this.run(),this.lastValues=this.values}run(){this.teardown(),this._teardown=this.callback.call(this.state)}teardown(){typeof this._teardown=="function"&&this._teardown()}hasChanged(){return!this.lastValues||this.values.some((t,e)=>this.lastValues[e]!==t)}})}function ot(o,s){o[g].push(s)}var Y=K(ot);var it=x(class extends p{constructor(s,t,e){super(s,t);_chunkHYQC3D4Zcjs.d.call(void 0, this,"Context");_chunkHYQC3D4Zcjs.d.call(void 0, this,"value");_chunkHYQC3D4Zcjs.d.call(void 0, this,"_ranEffect");_chunkHYQC3D4Zcjs.d.call(void 0, this,"_unsubscribe");this._updater=this._updater.bind(this),this._ranEffect=!1,this._unsubscribe=null,ot(t,this)}update(s){if(this.state.virtual)throw new Error("can't be used with virtual components");return this.Context!==s&&(this._subscribe(s),this.Context=s),this.value}call(){this._ranEffect||(this._ranEffect=!0,this._unsubscribe&&this._unsubscribe(),this._subscribe(this.Context),this.state.update())}_updater(s){this.value=s,this.state.update()}_subscribe(s){let t={Context:s,callback:this._updater};this.state.host.dispatchEvent(new CustomEvent(R,{detail:t,bubbles:!0,cancelable:!0,composed:!0}));let{unsubscribe:e=null,value:r}=t;this.value=e?r:s.defaultValue,this._unsubscribe=e}teardown(){this._unsubscribe&&this._unsubscribe()}});function Et(o){return s=>{let t={Provider:class extends HTMLElement{constructor(){super();_chunkHYQC3D4Zcjs.d.call(void 0, this,"listeners");_chunkHYQC3D4Zcjs.d.call(void 0, this,"_value");this.listeners=new Set,this.addEventListener(R,this)}disconnectedCallback(){this.removeEventListener(R,this)}handleEvent(r){let{detail:i}=r;i.Context===t&&(i.value=this.value,i.unsubscribe=this.unsubscribe.bind(this,i.callback),this.listeners.add(i.callback),r.stopPropagation())}unsubscribe(r){this.listeners.delete(r)}set value(r){this._value=r;for(let i of this.listeners)i(r)}get value(){return this._value}},Consumer:o(function({render:e}){let r=it(t);return e(r)}),defaultValue:s};return t}}var nt=x(class extends p{constructor(s,t,e,r){super(s,t);_chunkHYQC3D4Zcjs.d.call(void 0, this,"value");_chunkHYQC3D4Zcjs.d.call(void 0, this,"values");this.value=e(),this.values=r}update(s,t){return this.hasChanged(t)&&(this.values=t,this.value=s()),this.value}hasChanged(s=[]){return s.some((t,e)=>this.values[e]!==t)}});function ie(o,s){o[_].push(s)}var _t=K(ie);var Z=x(class extends p{constructor(s,t,e){super(s,t);_chunkHYQC3D4Zcjs.d.call(void 0, this,"args");this.updater=this.updater.bind(this),typeof e=="function"&&(e=e()),this.makeArgs(e)}update(){return this.args}updater(s){if(typeof s=="function"){let t=s,[e]=this.args;s=t(e)}this.makeArgs(s),this.state.update()}makeArgs(s){this.args=Object.freeze([s,this.updater])}});var Gr=Promise.resolve();var ne=x(class extends p{constructor(s,t,e,r,i){super(s,t);_chunkHYQC3D4Zcjs.d.call(void 0, this,"reducer");_chunkHYQC3D4Zcjs.d.call(void 0, this,"currentState");this.dispatch=this.dispatch.bind(this),this.currentState=i!==void 0?i(r):r}update(s){return this.reducer=s,[this.currentState,this.dispatch]}dispatch(s){this.currentState=this.reducer(this.currentState,s),this.state.update()}});function at({render:o}){let s=Ct(o),t=Et(s);return{component:s,createContext:t}}var _directivejs = require('lit/directive.js');var _asyncdirectivejs = require('lit/async-directive.js');var kt=Array.prototype.includes,mt=new WeakMap,It=new WeakMap,ct=class extends I{constructor(t,e,r){super(t,e);_chunkHYQC3D4Zcjs.d.call(void 0, this,"args");_chunkHYQC3D4Zcjs.d.call(void 0, this,"setValue");this.state.virtual=!0,this.setValue=r}render(){return this.state.run(()=>this.renderer.apply(this.host,this.args))}commit(t){this.setValue(t)}teardown(){super.teardown();let t=It.get(this);mt.delete(t)}};function qt(){function o(s){class t extends _asyncdirectivejs.AsyncDirective{constructor(i){super(i);_chunkHYQC3D4Zcjs.d.call(void 0, this,"cont");this.cont=void 0}update(i,m){return this.cont=mt.get(i),(!this.cont||this.cont.renderer!==s)&&(this.cont=new ct(s,i,u=>{this.setValue(u)}),mt.set(i,this.cont),It.set(this.cont,i),ut(this.cont,i)),this.cont.args=m,this.cont.update(),this.render(m)}render(i){return _lit.noChange}}return _directivejs.directive.call(void 0, t)}return o}function ut(o,s,t=s.startNode){let e=t.parentNode,r=new MutationObserver(i=>{for(let m of i)if(kt.call(m.removedNodes,t)){r.disconnect(),t.parentNode instanceof ShadowRoot?ut(o,s):o.teardown();break}else if(kt.call(m.addedNodes,t.nextSibling)){r.disconnect(),ut(o,s,t.nextSibling||void 0);break}});r.observe(e,{childList:!0})}var{component:lt,createContext:le}=at({render:_lit.render}),dt=qt();var _ifdefinedjs = require('lit/directives/if-defined.js');var _refjs = require('lit/directives/ref.js');var _cheerio = require('cheerio'); var pt = _interopRequireWildcard(_cheerio);var de=async o=>{let t=await(await fetch(o)).text();return pt.load(t,{xmlMode:!0,xml:{xmlMode:!0}})('resource[type="imsqti_test_xmlv3p0"]').first()},pe=async o=>{let t=await(await fetch(o)).text(),e=pt.load(t,{xmlMode:!0,xml:{xmlMode:!0}}),r=[];return e("qti-assessment-item-ref").each((i,m)=>{let u=e(m).attr("identifier"),l=e(m).attr("href"),k=e(m).attr("category");r.push({identifier:u,href:l,category:k})}),r},Q=new AbortController;async function Lt(o){let s=async e=>{try{return await(await fetch(e,{signal:t})).text()}catch(r){r.name==="AbortError"?console.log("Fetch aborted"):console.error(r)}return""};Q==null||Q.abort(),Q=new AbortController;let t=Q.signal;return await s(o)}var St=async o=>{o.endsWith("/")||(o=o+"/");let s=await de(o+"/imsmanifest.xml"),t=await pe(o+s.attr("href"));return{itemLocation:`${o}/${s.attr("href").substring(0,s.attr("href").lastIndexOf("/"))}/`,items:t,testIdentifier:s.attr("identifier")}};var At=(o,s,t)=>{let e=_refjs.createRef.call(void 0, );return o?_lit.html`
|
|
4
|
+
`}};_chunkHYQC3D4Zcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Boolean,reflect:!0})],$.prototype,"loading",2),_chunkHYQC3D4Zcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String,attribute:"navigation-mode"})],$.prototype,"_navigationMode",2),$= exports.e =_chunkHYQC3D4Zcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "qti-test-part")],$);var A,gt=0;function tt(o){A=o}function et(){A=null,gt=0}function wt(){return gt++}var K=Symbol("haunted.phase"),S=Symbol("haunted.hook"),st=Symbol("haunted.update"),rt=Symbol("haunted.commit"),w=Symbol("haunted.effects"),_=Symbol("haunted.layoutEffects"),R="haunted.context";var Zt,Bt,te,O=class{constructor(s,t){_chunkHYQC3D4Zcjs.d.call(void 0, this,"update");_chunkHYQC3D4Zcjs.d.call(void 0, this,"host");_chunkHYQC3D4Zcjs.d.call(void 0, this,"virtual");_chunkHYQC3D4Zcjs.d.call(void 0, this,Zt);_chunkHYQC3D4Zcjs.d.call(void 0, this,Bt);_chunkHYQC3D4Zcjs.d.call(void 0, this,te);this.update=s,this.host=t,this[S]=new Map,this[w]=[],this[_]=[]}run(s){tt(this);let t=s();return et(),t}_runEffects(s){let t=this[s];tt(this);for(let e of t)e.call(this);et()}runEffects(){this._runEffects(w)}runLayoutEffects(){this._runEffects(_)}teardown(){this[S].forEach(t=>{typeof t.teardown=="function"&&t.teardown()})}};Zt=S,Bt=w,te=_;var ee=Promise.resolve().then.bind(Promise.resolve());function Ct(){let o=[],s;function t(){s=null;let e=o;o=[];for(var r=0,i=e.length;r<i;r++)e[r]()}return function(e){o.push(e),s==null&&(s=ee(t))}}var se=Ct(),vt=Ct(),re,k=class{constructor(s,t){_chunkHYQC3D4Zcjs.d.call(void 0, this,"renderer");_chunkHYQC3D4Zcjs.d.call(void 0, this,"host");_chunkHYQC3D4Zcjs.d.call(void 0, this,"state");_chunkHYQC3D4Zcjs.d.call(void 0, this,re);_chunkHYQC3D4Zcjs.d.call(void 0, this,"_updateQueued");this.renderer=s,this.host=t,this.state=new O(this.update.bind(this),t),this[K]=null,this._updateQueued=!1}update(){this._updateQueued||(se(()=>{let s=this.handlePhase(st);vt(()=>{this.handlePhase(rt,s),vt(()=>{this.handlePhase(w)})}),this._updateQueued=!1}),this._updateQueued=!0)}handlePhase(s,t){switch(this[K]=s,s){case rt:this.commit(t),this.runEffects(_);return;case st:return this.render();case w:return this.runEffects(w)}}render(){return this.state.run(()=>this.renderer.call(this.host,this.host))}runEffects(s){this.state._runEffects(s)}teardown(){this.state.teardown()}};re=K;var oe=(o="")=>o.replace(/-+([a-z])?/g,(s,t)=>t?t.toUpperCase():"");function yt(o){class s extends k{constructor(i,a,l){super(i,l||a);_chunkHYQC3D4Zcjs.d.call(void 0, this,"frag");this.frag=a}commit(i){o(i,this.frag)}}function t(e,r,i){let a=(i||r||{}).baseElement||HTMLElement,{observedAttributes:l=[],useShadowDOM:u=!0,shadowRootInit:f={}}=i||r||{};class q extends a{constructor(){super();_chunkHYQC3D4Zcjs.d.call(void 0, this,"_scheduler");u===!1?this._scheduler=new s(e,this):(this.attachShadow(_chunkHYQC3D4Zcjs.a.call(void 0, {mode:"open"},f)),this._scheduler=new s(e,this.shadowRoot,this))}static get observedAttributes(){return e.observedAttributes||l||[]}connectedCallback(){this._scheduler.update()}disconnectedCallback(){this._scheduler.teardown()}attributeChangedCallback(g,v,d){if(v===d)return;let Vt=d===""?!0:d;Reflect.set(this,oe(g),Vt)}}function Nt(y){let h=y,g=!1;return Object.freeze({enumerable:!0,configurable:!0,get(){return h},set(v){g&&h===v||(g=!0,h=v,this._scheduler&&this._scheduler.update())}})}let Pt=new Proxy(a.prototype,{getPrototypeOf(y){return y},set(y,h,g,v){let d;return h in y?(d=Object.getOwnPropertyDescriptor(y,h),d&&d.set?(d.set.call(v,g),!0):(Reflect.set(y,h,g,v),!0)):(typeof h=="symbol"||h[0]==="_"?d={enumerable:!0,configurable:!0,writable:!0,value:g}:d=Nt(g),Object.defineProperty(v,h,d),d.set&&d.set.call(v,g),!0)}});return Object.setPrototypeOf(q.prototype,Pt),q}return t}var p=class{constructor(s,t){_chunkHYQC3D4Zcjs.d.call(void 0, this,"id");_chunkHYQC3D4Zcjs.d.call(void 0, this,"state");this.id=s,this.state=t}};function ie(o,...s){let t=wt(),e=A[S],r=e.get(t);return r||(r=new o(t,A,...s),e.set(t,r)),r.update(...s)}function b(o){return ie.bind(null,o)}function T(o){return b(class extends p{constructor(t,e,r,i){super(t,e);_chunkHYQC3D4Zcjs.d.call(void 0, this,"callback");_chunkHYQC3D4Zcjs.d.call(void 0, this,"lastValues");_chunkHYQC3D4Zcjs.d.call(void 0, this,"values");_chunkHYQC3D4Zcjs.d.call(void 0, this,"_teardown");o(e,this)}update(t,e){this.callback=t,this.values=e}call(){(!this.values||this.hasChanged())&&this.run(),this.lastValues=this.values}run(){this.teardown(),this._teardown=this.callback.call(this.state)}teardown(){typeof this._teardown=="function"&&this._teardown()}hasChanged(){return!this.lastValues||this.values.some((t,e)=>this.lastValues[e]!==t)}})}function ot(o,s){o[w].push(s)}var Y=T(ot);var it=b(class extends p{constructor(s,t,e){super(s,t);_chunkHYQC3D4Zcjs.d.call(void 0, this,"Context");_chunkHYQC3D4Zcjs.d.call(void 0, this,"value");_chunkHYQC3D4Zcjs.d.call(void 0, this,"_ranEffect");_chunkHYQC3D4Zcjs.d.call(void 0, this,"_unsubscribe");this._updater=this._updater.bind(this),this._ranEffect=!1,this._unsubscribe=null,ot(t,this)}update(s){if(this.state.virtual)throw new Error("can't be used with virtual components");return this.Context!==s&&(this._subscribe(s),this.Context=s),this.value}call(){this._ranEffect||(this._ranEffect=!0,this._unsubscribe&&this._unsubscribe(),this._subscribe(this.Context),this.state.update())}_updater(s){this.value=s,this.state.update()}_subscribe(s){let t={Context:s,callback:this._updater};this.state.host.dispatchEvent(new CustomEvent(R,{detail:t,bubbles:!0,cancelable:!0,composed:!0}));let{unsubscribe:e=null,value:r}=t;this.value=e?r:s.defaultValue,this._unsubscribe=e}teardown(){this._unsubscribe&&this._unsubscribe()}});function Et(o){return s=>{let t={Provider:class extends HTMLElement{constructor(){super();_chunkHYQC3D4Zcjs.d.call(void 0, this,"listeners");_chunkHYQC3D4Zcjs.d.call(void 0, this,"_value");this.listeners=new Set,this.addEventListener(R,this)}disconnectedCallback(){this.removeEventListener(R,this)}handleEvent(r){let{detail:i}=r;i.Context===t&&(i.value=this.value,i.unsubscribe=this.unsubscribe.bind(this,i.callback),this.listeners.add(i.callback),r.stopPropagation())}unsubscribe(r){this.listeners.delete(r)}set value(r){this._value=r;for(let i of this.listeners)i(r)}get value(){return this._value}},Consumer:o(function({render:e}){let r=it(t);return e(r)}),defaultValue:s};return t}}var nt=b(class extends p{constructor(s,t,e,r){super(s,t);_chunkHYQC3D4Zcjs.d.call(void 0, this,"value");_chunkHYQC3D4Zcjs.d.call(void 0, this,"values");this.value=e(),this.values=r}update(s,t){return this.hasChanged(t)&&(this.values=t,this.value=s()),this.value}hasChanged(s=[]){return s.some((t,e)=>this.values[e]!==t)}});function ne(o,s){o[_].push(s)}var _t=T(ne);var Z=b(class extends p{constructor(s,t,e){super(s,t);_chunkHYQC3D4Zcjs.d.call(void 0, this,"args");this.updater=this.updater.bind(this),typeof e=="function"&&(e=e()),this.makeArgs(e)}update(){return this.args}updater(s){if(typeof s=="function"){let t=s,[e]=this.args;s=t(e)}this.makeArgs(s),this.state.update()}makeArgs(s){this.args=Object.freeze([s,this.updater])}});var oo=Promise.resolve();var ae=b(class extends p{constructor(s,t,e,r,i){super(s,t);_chunkHYQC3D4Zcjs.d.call(void 0, this,"reducer");_chunkHYQC3D4Zcjs.d.call(void 0, this,"currentState");this.dispatch=this.dispatch.bind(this),this.currentState=i!==void 0?i(r):r}update(s){return this.reducer=s,[this.currentState,this.dispatch]}dispatch(s){this.currentState=this.reducer(this.currentState,s),this.state.update()}});function at({render:o}){let s=yt(o),t=Et(s);return{component:s,createContext:t}}var _directivejs = require('lit/directive.js');var _asyncdirectivejs = require('lit/async-directive.js');var kt=Array.prototype.includes,mt=new WeakMap,qt=new WeakMap,ct=class extends k{constructor(t,e,r){super(t,e);_chunkHYQC3D4Zcjs.d.call(void 0, this,"args");_chunkHYQC3D4Zcjs.d.call(void 0, this,"setValue");this.state.virtual=!0,this.setValue=r}render(){return this.state.run(()=>this.renderer.apply(this.host,this.args))}commit(t){this.setValue(t)}teardown(){super.teardown();let t=qt.get(this);mt.delete(t)}};function It(){function o(s){class t extends _asyncdirectivejs.AsyncDirective{constructor(i){super(i);_chunkHYQC3D4Zcjs.d.call(void 0, this,"cont");this.cont=void 0}update(i,a){return this.cont=mt.get(i),(!this.cont||this.cont.renderer!==s)&&(this.cont=new ct(s,i,l=>{this.setValue(l)}),mt.set(i,this.cont),qt.set(this.cont,i),lt(this.cont,i)),this.cont.args=a,this.cont.update(),this.render(a)}render(i){return _lit.noChange}}return _directivejs.directive.call(void 0, t)}return o}function lt(o,s,t=s.startNode){let e=t.parentNode,r=new MutationObserver(i=>{for(let a of i)if(kt.call(a.removedNodes,t)){r.disconnect(),t.parentNode instanceof ShadowRoot?lt(o,s):o.teardown();break}else if(kt.call(a.addedNodes,t.nextSibling)){r.disconnect(),lt(o,s,t.nextSibling||void 0);break}});r.observe(e,{childList:!0})}var{component:ut,createContext:de}=at({render:_lit.render}),dt=It();var _ifdefinedjs = require('lit/directives/if-defined.js');var _refjs = require('lit/directives/ref.js');var _cheerio = require('cheerio'); var pt = _interopRequireWildcard(_cheerio);var pe=async o=>{let t=await(await fetch(o)).text();return pt.load(t,{xmlMode:!0,xml:{xmlMode:!0}})('resource[type="imsqti_test_xmlv3p0"]').first()},fe=async o=>{let t=await(await fetch(o)).text(),e=pt.load(t,{xmlMode:!0,xml:{xmlMode:!0}}),r=[];return e("qti-assessment-item-ref").each((i,a)=>{let l=e(a).attr("identifier"),u=e(a).attr("href"),f=e(a).attr("category");r.push({identifier:l,href:u,category:f})}),r},Q=new AbortController;async function St(o){let s=async e=>{try{return await(await fetch(e,{signal:t})).text()}catch(r){r.name==="AbortError"?console.log("Fetch aborted"):console.error(r)}return""};Q==null||Q.abort(),Q=new AbortController;let t=Q.signal;return await s(o)}var Mt=async o=>{o.endsWith("/")||(o=o+"/");let s=await pe(o+"/imsmanifest.xml"),t=await fe(o+s.attr("href"));return{itemLocation:`${o}/${s.attr("href").substring(0,s.attr("href").lastIndexOf("/"))}/`,items:t,testIdentifier:s.attr("identifier")}};var At=(o,s,t)=>{let e=_refjs.createRef.call(void 0, );return o?_lit.html`
|
|
5
5
|
<qti-assessment-test
|
|
6
6
|
${_refjs.ref.call(void 0, e)}
|
|
7
7
|
identifier="${o.testIdentifier}"
|
|
8
|
-
@on-test-set-item=${async({detail:r})=>{var
|
|
8
|
+
@on-test-set-item=${async({detail:r})=>{var l;let i=e.value.itemRefEls.get(r.new),a=await St(`${o.itemLocation}/${i.href}`);i.xml=a,(l=e.value)==null||l.itemRefEls.forEach((u,f)=>u.identifier!==i.identifier&&(u.xml=""))}}
|
|
9
9
|
@qti-assessment-first-updated=${r=>{t&&(e.value.context=t)}}
|
|
10
10
|
item-index=${s}
|
|
11
11
|
>
|
|
12
|
-
<
|
|
12
|
+
<div>
|
|
13
|
+
<test-show-index></test-show-index>:
|
|
14
|
+
<test-item-id></test-item-id>
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
<test-toggle-scoring></test-toggle-scoring>
|
|
18
|
+
|
|
19
|
+
<div>
|
|
20
|
+
<test-scoring-manual></test-scoring-manual>
|
|
21
|
+
<test-scoring-buttons></test-scoring-buttons>
|
|
22
|
+
</div>
|
|
13
23
|
|
|
14
24
|
<qti-test-part>
|
|
15
25
|
<qti-assessment-section>
|
|
@@ -19,6 +29,7 @@
|
|
|
19
29
|
href="${r.href}"
|
|
20
30
|
category="${_ifdefinedjs.ifDefined.call(void 0, r.category)}"
|
|
21
31
|
>
|
|
32
|
+
<item-print-variables></item-print-variables>
|
|
22
33
|
</qti-assessment-item-ref>`)}
|
|
23
34
|
</qti-assessment-section>
|
|
24
35
|
</qti-test-part>
|
|
@@ -31,9 +42,12 @@
|
|
|
31
42
|
|
|
32
43
|
<test-slider></test-slider>
|
|
33
44
|
|
|
34
|
-
<
|
|
35
|
-
|
|
36
|
-
|
|
45
|
+
<pre>
|
|
46
|
+
<test-script>
|
|
47
|
+
<!--
|
|
48
|
+
return JSON.stringify(itemContext, null, 2);
|
|
49
|
+
-->
|
|
50
|
+
</test-script></pre>
|
|
37
51
|
</qti-assessment-test>
|
|
38
52
|
`:""};var Rt=`*, ::before, ::after {
|
|
39
53
|
--tw-border-spacing-x: 0;
|
|
@@ -133,14 +147,24 @@
|
|
|
133
147
|
--tw-backdrop-saturate: ;
|
|
134
148
|
--tw-backdrop-sepia: ;
|
|
135
149
|
}
|
|
150
|
+
/* only applied in qti-test, if present */
|
|
151
|
+
/*
|
|
136
152
|
::host {
|
|
137
|
-
|
|
138
|
-
width: 100vw;
|
|
139
|
-
--tw-bg-opacity: 1;
|
|
140
|
-
background-color: rgb(248 250 252 / var(--tw-bg-opacity));
|
|
153
|
+
@apply h-screen w-screen bg-slate-50;
|
|
141
154
|
}
|
|
142
|
-
|
|
155
|
+
*/
|
|
156
|
+
/* qti-assessment-test {
|
|
157
|
+
@apply grid h-full w-full grid-cols-3;
|
|
158
|
+
qti-test-part {
|
|
159
|
+
@apply container col-span-3 mx-auto aspect-[4/3];
|
|
160
|
+
}
|
|
161
|
+
} */
|
|
162
|
+
qti-assessment-test qti-test-part qti-assessment-section {
|
|
143
163
|
display: block;
|
|
164
|
+
overflow-y: auto;
|
|
165
|
+
border-radius: 0.125rem;
|
|
166
|
+
--tw-bg-opacity: 1;
|
|
167
|
+
background-color: rgb(255 255 255 / var(--tw-bg-opacity));
|
|
144
168
|
padding: 2rem;
|
|
145
169
|
}
|
|
146
170
|
qti-assessment-test .nav {
|
|
@@ -290,16 +314,12 @@ qti-assessment-test test-paging-buttons > button[data-active-item='true']:focus-
|
|
|
290
314
|
outline-offset: 2px;
|
|
291
315
|
outline-color: #4f46e5;
|
|
292
316
|
}
|
|
293
|
-
qti-
|
|
294
|
-
|
|
295
|
-
width: 100%;
|
|
296
|
-
}
|
|
297
|
-
`;function we(o){let[s,t]=Z();return Y(()=>{var r;let e=new CSSStyleSheet;e.replaceSync(Rt),(r=o.shadowRoot)==null||r.adoptedStyleSheets.push(e)},[]),Y(()=>{(async r=>await St(r))(o.packageUri).then(r=>{t(r)})},[o.packageUri]),_lit.html`${s?dt(At)(s):""}`}var ve=lt(we,{observedAttributes:["package-uri"]});customElements.define("qti-test",ve);var z=class extends _lit.LitElement{_requestItem(t){this.dispatchEvent(new CustomEvent("on-test-request-item",{composed:!0,bubbles:!0,detail:t}))}render(){var i;let{items:t,itemIndex:e}=this._testContext,r=Math.min(e+1,t.length-1);return _lit.html`
|
|
298
|
-
<button part="button" @click=${m=>this._requestItem(r)} id="${(i=t[r])==null?void 0:i.identifier}">
|
|
317
|
+
`;function ve(o){let[s,t]=Z();return Y(()=>{var r;let e=new CSSStyleSheet;e.replaceSync(Rt),(r=o.shadowRoot)==null||r.adoptedStyleSheets.push(e)},[]),Y(()=>{(async r=>await Mt(r))(o.packageUri).then(r=>{t(r)})},[o.packageUri]),_lit.html`${s?dt(At)(s):""}`}var Ce=ut(ve,{observedAttributes:["package-uri"]});customElements.define("qti-test",Ce);var z=class extends _lit.LitElement{_requestItem(t){this.dispatchEvent(new CustomEvent("on-test-request-item",{composed:!0,bubbles:!0,detail:t}))}render(){var i;let{items:t,itemIndex:e}=this._testContext,r=Math.min(e+1,t.length-1);return _lit.html`
|
|
318
|
+
<button part="button" @click=${a=>this._requestItem(r)} id="${(i=t[r])==null?void 0:i.identifier}">
|
|
299
319
|
<slot></slot>
|
|
300
320
|
</button>
|
|
301
321
|
`}};_chunkHYQC3D4Zcjs.c.call(void 0, [_context2.consume.call(void 0, {context:c,subscribe:!0}),_decoratorsjs.state.call(void 0, )],z.prototype,"_testContext",2),z= exports.i =_chunkHYQC3D4Zcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "test-next")],z);var D=class extends _lit.LitElement{_requestItem(t){this.dispatchEvent(new CustomEvent("on-test-request-item",{composed:!0,bubbles:!0,detail:t}))}render(){var i;let{items:t,itemIndex:e}=this._testContext,r=Math.max(e-1,0);return _lit.html`
|
|
302
|
-
<button part="button" @click=${
|
|
322
|
+
<button part="button" @click=${a=>this._requestItem(r)} id="${(i=t[r])==null?void 0:i.identifier}">
|
|
303
323
|
<slot></slot>
|
|
304
324
|
</button>
|
|
305
325
|
`}};_chunkHYQC3D4Zcjs.c.call(void 0, [_context2.consume.call(void 0, {context:c,subscribe:!0}),_decoratorsjs.state.call(void 0, )],D.prototype,"_testContext",2),D= exports.j =_chunkHYQC3D4Zcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "test-prev")],D);var N=class extends _lit.LitElement{render(){let{items:t,itemIndex:e}=this._testProvider;return _lit.html`
|
|
@@ -315,55 +335,55 @@ qti-assessment-test qti-test-part qti-assessment-section {
|
|
|
315
335
|
max=${t.length-1}
|
|
316
336
|
@input=${r=>this._requestItem(+r.target.value)}
|
|
317
337
|
/>
|
|
318
|
-
`}};_chunkHYQC3D4Zcjs.c.call(void 0, [_context2.consume.call(void 0, {context:c,subscribe:!0}),_decoratorsjs.state.call(void 0, )],P.prototype,"_testProvider",2),P= exports.l =_chunkHYQC3D4Zcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "test-slider")],P);var
|
|
319
|
-
${t.map((r,i)=>{var
|
|
338
|
+
`}};_chunkHYQC3D4Zcjs.c.call(void 0, [_context2.consume.call(void 0, {context:c,subscribe:!0}),_decoratorsjs.state.call(void 0, )],P.prototype,"_testProvider",2),P= exports.l =_chunkHYQC3D4Zcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "test-slider")],P);var V=class extends _lit.LitElement{createRenderRoot(){return this}_requestItem(t){this.dispatchEvent(new CustomEvent("on-test-request-item",{composed:!0,bubbles:!0,detail:t}))}render(){let{items:t,itemIndex:e}=this._testProvider;return _lit.html`
|
|
339
|
+
${t.map((r,i)=>{var a;return _lit.html` <label>
|
|
320
340
|
<input
|
|
321
341
|
type="radio"
|
|
322
342
|
part="input"
|
|
323
343
|
name="item"
|
|
324
344
|
value="${i}"
|
|
325
345
|
?checked=${i===e}
|
|
326
|
-
@change=${
|
|
327
|
-
data-completion-status=${(
|
|
346
|
+
@change=${l=>this._requestItem(i)}
|
|
347
|
+
data-completion-status=${(a=r.variables.find(l=>l.identifier==="completionStatus"))==null?void 0:a.value}
|
|
328
348
|
id="${r.identifier}"
|
|
329
349
|
/>
|
|
330
350
|
${i+1}
|
|
331
351
|
</label>`})}
|
|
332
|
-
`}};_chunkHYQC3D4Zcjs.c.call(void 0, [_context2.consume.call(void 0, {context:c,subscribe:!0}),_decoratorsjs.state.call(void 0, )],
|
|
333
|
-
${
|
|
352
|
+
`}};_chunkHYQC3D4Zcjs.c.call(void 0, [_context2.consume.call(void 0, {context:c,subscribe:!0}),_decoratorsjs.state.call(void 0, )],V.prototype,"_testProvider",2),V= exports.m =_chunkHYQC3D4Zcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "test-paging-radio")],V);var M=class extends _lit.LitElement{constructor(){super(...arguments);this.maxDisplayedItems=5}createRenderRoot(){return this}_requestItem(t){this.dispatchEvent(new CustomEvent("on-test-request-item",{composed:!0,bubbles:!0,detail:t}))}render(){let{items:t,itemIndex:e}=this._testProvider,r=Math.max(0,e-this.maxDisplayedItems),i=Math.min(t.length-1,e+this.maxDisplayedItems),a=t.slice(r,i+1);return _lit.html`
|
|
353
|
+
${a.map((l,u)=>{var f;return _lit.html`<button
|
|
334
354
|
part="button"
|
|
335
|
-
data-completion-status=${(
|
|
336
|
-
data-active-item=${r+
|
|
337
|
-
@click=${
|
|
338
|
-
id="${
|
|
355
|
+
data-completion-status=${(f=l.variables.find(q=>q.identifier==="completionStatus"))==null?void 0:f.value}
|
|
356
|
+
data-active-item=${r+u===e}
|
|
357
|
+
@click=${q=>this._requestItem(r+u)}
|
|
358
|
+
id="${l.identifier}"
|
|
339
359
|
>
|
|
340
|
-
${r+
|
|
360
|
+
${r+u+1}
|
|
341
361
|
</button>`})}
|
|
342
|
-
`}};_chunkHYQC3D4Zcjs.c.call(void 0, [_context2.consume.call(void 0, {context:c,subscribe:!0}),_decoratorsjs.state.call(void 0, )],
|
|
343
|
-
<button part="button" @click=${
|
|
362
|
+
`}};_chunkHYQC3D4Zcjs.c.call(void 0, [_context2.consume.call(void 0, {context:c,subscribe:!0}),_decoratorsjs.state.call(void 0, )],M.prototype,"_testProvider",2),_chunkHYQC3D4Zcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Number})],M.prototype,"maxDisplayedItems",2),M= exports.n =_chunkHYQC3D4Zcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "test-paging-buttons")],M);var F=class extends _lit.LitElement{render(){var i,a,l;let{items:t,itemIndex:e}=this._testProvider;if(e==null)return _lit.html``;let r=(l=(a=this.closest("qti-assessment-test"))==null?void 0:a.itemRefEls.get((i=t[e])==null?void 0:i.identifier))==null?void 0:l.assessmentItem;return _lit.html`
|
|
363
|
+
<button part="button" @click=${u=>r.showCorrectResponse(!0)}>
|
|
344
364
|
<slot></slot>
|
|
345
365
|
</button>
|
|
346
|
-
`}};_chunkHYQC3D4Zcjs.c.call(void 0, [_context2.consume.call(void 0, {context:c,subscribe:!0}),_decoratorsjs.state.call(void 0, )],
|
|
366
|
+
`}};_chunkHYQC3D4Zcjs.c.call(void 0, [_context2.consume.call(void 0, {context:c,subscribe:!0}),_decoratorsjs.state.call(void 0, )],F.prototype,"_testProvider",2),F= exports.o =_chunkHYQC3D4Zcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "test-show-correct")],F);var H=class extends _lit.LitElement{constructor(){super(...arguments);this._printed=""}render(){return _lit.html`${this._printed}<slot @slotchange=${this.handleSlotChange}></slot>`}handleSlotChange(t){var r,i;let e=Array.from((r=this.childNodes)!=null?r:[]).find(a=>a.nodeType===Node.COMMENT_NODE);try{this.operatorFunction=new Function("testContext","itemContext",(i=e.textContent)!=null?i:"")}catch(a){console.error("custom-operator contains invalid javascript code",a)}this._context=new (0, _context2.ContextConsumer)(this,c,a=>{this._printed=this.operatorFunction(a,a.items[a.itemIndex])},!0)}};_chunkHYQC3D4Zcjs.c.call(void 0, [_decoratorsjs.state.call(void 0, )],H.prototype,"_printed",2),H= exports.p =_chunkHYQC3D4Zcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "test-script")],H);var U=class extends _lit.LitElement{_requestItem(t){this.dispatchEvent(new CustomEvent("on-test-request-item",{composed:!0,bubbles:!0,detail:t}))}render(){let{items:t,itemIndex:e}=this._testContext,r=t[e-1];return _lit.html` ${e+1}/${t.length} `}};_chunkHYQC3D4Zcjs.c.call(void 0, [_context2.consume.call(void 0, {context:c,subscribe:!0}),_decoratorsjs.state.call(void 0, )],U.prototype,"_testContext",2),U= exports.q =_chunkHYQC3D4Zcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "test-show-index")],U);var j=class extends _lit.LitElement{render(){return _lit.html`
|
|
347
367
|
<pre>
|
|
348
368
|
${JSON.stringify(_chunkHYQC3D4Zcjs.b.call(void 0, _chunkHYQC3D4Zcjs.a.call(void 0, {},this._testProvider),{items:this._testProvider.items.map(t=>_chunkHYQC3D4Zcjs.b.call(void 0, _chunkHYQC3D4Zcjs.a.call(void 0, {},t),{itemEl:null}))}),null,2)}</pre
|
|
349
369
|
>
|
|
350
|
-
`}};_chunkHYQC3D4Zcjs.c.call(void 0, [_context2.consume.call(void 0, {context:c,subscribe:!0}),_decoratorsjs.state.call(void 0, )],j.prototype,"_testProvider",2),j= exports.r =_chunkHYQC3D4Zcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "test-print-variables")],j);var X=class extends _lit.LitElement{_requestItem(t){this.dispatchEvent(new CustomEvent("on-test-request-item",{composed:!0,bubbles:!0,detail:t}))}render(){let{items:t}=this._testContext,e=t.reduce((i,
|
|
370
|
+
`}};_chunkHYQC3D4Zcjs.c.call(void 0, [_context2.consume.call(void 0, {context:c,subscribe:!0}),_decoratorsjs.state.call(void 0, )],j.prototype,"_testProvider",2),j= exports.r =_chunkHYQC3D4Zcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "test-print-variables")],j);var X=class extends _lit.LitElement{_requestItem(t){this.dispatchEvent(new CustomEvent("on-test-request-item",{composed:!0,bubbles:!0,detail:t}))}render(){let{items:t}=this._testContext,e=t.reduce((i,a)=>{let l=a.variables.find(u=>u.identifier==="SCORE");return i+(l?+l.value:0)},0),r=t.reduce((i,a)=>{let l=a.variables.find(u=>u.identifier==="MAXSCORE");return i+(l?+l.value:0)},0);return _lit.html` ${e}/${r}`}};_chunkHYQC3D4Zcjs.c.call(void 0, [_context2.consume.call(void 0, {context:c,subscribe:!0}),_decoratorsjs.state.call(void 0, )],X.prototype,"_testContext",2),X= exports.s =_chunkHYQC3D4Zcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "test-print-score")],X);var L=class extends _lit.LitElement{constructor(){super(...arguments);this.disabled=!1}_changeOutcomeScore(t){let e=this._testContext.items[this._testContext.itemIndex].identifier;this.closest("qti-assessment-test").itemRefEls.get(e).assessmentItem.updateOutcomeVariable("SCORE",t.toString())}render(){let{items:t,itemIndex:e}=this._testContext,r=Number(t[e].variables.find(a=>a.identifier=="MAXSCORE").value),i=Number(t[e].variables.find(a=>a.identifier=="SCORE").value);return _lit.html`
|
|
351
371
|
<input
|
|
352
372
|
part="input"
|
|
353
373
|
type="number"
|
|
354
374
|
spellcheck="false"
|
|
355
375
|
autocomplete="off"
|
|
356
|
-
@keyup=${this.
|
|
357
|
-
@change=${this.
|
|
376
|
+
@keyup=${a=>this._changeOutcomeScore(a.target.value)}
|
|
377
|
+
@change=${a=>this._changeOutcomeScore(a.target.value)}
|
|
358
378
|
placeholder="score"
|
|
359
|
-
min=${
|
|
360
|
-
max=${
|
|
361
|
-
.value=${
|
|
379
|
+
min=${0}
|
|
380
|
+
max=${r}
|
|
381
|
+
.value=${i.toString()}
|
|
362
382
|
size="10"
|
|
363
383
|
?disabled=${this.disabled}
|
|
364
|
-
|
|
384
|
+
id="test-scoring-input"
|
|
365
385
|
/>
|
|
366
|
-
`}};_chunkHYQC3D4Zcjs.c.call(void 0, [
|
|
386
|
+
`}};_chunkHYQC3D4Zcjs.c.call(void 0, [_context2.consume.call(void 0, {context:c,subscribe:!0}),_decoratorsjs.state.call(void 0, )],L.prototype,"_testContext",2),_chunkHYQC3D4Zcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Boolean})],L.prototype,"disabled",2),L= exports.t =_chunkHYQC3D4Zcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "test-scoring-input")],L);var B=class extends _lit.LitElement{render(){let s=this.closest("qti-assessment-test");return _lit.html`
|
|
367
387
|
<label>
|
|
368
388
|
<input
|
|
369
389
|
type="checkbox"
|
|
@@ -371,7 +391,20 @@ ${JSON.stringify(_chunkHYQC3D4Zcjs.b.call(void 0, _chunkHYQC3D4Zcjs.a.call(void
|
|
|
371
391
|
/>
|
|
372
392
|
Toggle audience context
|
|
373
393
|
</label>
|
|
374
|
-
`}};
|
|
394
|
+
`}};B= exports.u =_chunkHYQC3D4Zcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "test-toggle-scoring")],B);var W=class extends _lit.LitElement{render(){var r;let{items:t,itemIndex:e}=this._testContext;return _lit.html` ${(r=t[e])==null?void 0:r.identifier} `}};_chunkHYQC3D4Zcjs.c.call(void 0, [_context2.consume.call(void 0, {context:c,subscribe:!0}),_decoratorsjs.state.call(void 0, )],W.prototype,"_testContext",2),W= exports.v =_chunkHYQC3D4Zcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "test-item-id")],W);var J=class extends _lit.LitElement{_changeOutcomeScore(t){let e=this._testContext.items[this._testContext.itemIndex].identifier;this.closest("qti-assessment-test").itemRefEls.get(e).assessmentItem.updateOutcomeVariable("SCORE",t.toString())}render(){var a,l;let{items:t,itemIndex:e}=this._testContext,r=(a=t[e].variables.find(u=>u.identifier=="MAXSCORE"))==null?void 0:a.value,i=(l=t[e].variables.find(u=>u.identifier=="SCORE"))==null?void 0:l.value;return r&&i?_lit.html`
|
|
395
|
+
${[...Array(Number(r)+1).keys()].map((u,f)=>_lit.html` <label>
|
|
396
|
+
<input
|
|
397
|
+
type="radio"
|
|
398
|
+
part="input"
|
|
399
|
+
name="test-scoring-buttons"
|
|
400
|
+
value="${f}"
|
|
401
|
+
?checked=${f===Number(i)}
|
|
402
|
+
@change=${q=>this._changeOutcomeScore(f)}
|
|
403
|
+
id="test-scoring-buttons"
|
|
404
|
+
/>
|
|
405
|
+
${f}
|
|
406
|
+
</label>`)}
|
|
407
|
+
`:_lit.nothing}};_chunkHYQC3D4Zcjs.c.call(void 0, [_context2.consume.call(void 0, {context:c,subscribe:!0}),_decoratorsjs.state.call(void 0, )],J.prototype,"_testContext",2),J= exports.w =_chunkHYQC3D4Zcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "test-scoring-buttons")],J);exports.a = I; exports.b = xt; exports.c = c; exports.d = E; exports.e = $; exports.f = St; exports.g = Mt; exports.h = Ce; exports.i = z; exports.j = D; exports.k = N; exports.l = P; exports.m = V; exports.n = M; exports.o = F; exports.p = H; exports.q = U; exports.r = j; exports.s = X; exports.t = L; exports.u = B; exports.v = W; exports.w = J;
|
|
375
408
|
/*! Bundled license information:
|
|
376
409
|
|
|
377
410
|
haunted/lib/use-controller.js:
|