@citolab/qti-components 7.3.2 → 7.3.3
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/cdn/chunks/chunk-2FHBMRTL.js +10 -0
- package/cdn/chunks/chunk-2IPVI6JS.js +8 -0
- package/cdn/chunks/chunk-2MMQH3OR.js +8 -0
- package/cdn/chunks/chunk-3OIAVUFK.js +8 -0
- package/cdn/chunks/chunk-5DVOEPIP.js +8 -0
- package/cdn/chunks/chunk-7JO3EE5V.js +5 -0
- package/cdn/chunks/chunk-AMH674XL.js +1450 -0
- package/cdn/chunks/chunk-C55DPNSW.js +8 -0
- package/cdn/chunks/chunk-E7FZUPJ2.js +8 -0
- package/cdn/chunks/chunk-LGSTDI7O.js +8 -0
- package/cdn/chunks/chunk-N7K6VO7F.js +1 -0
- package/cdn/chunks/chunk-NPYS4GGN.js +5 -0
- package/cdn/chunks/chunk-OGZEE7T7.js +8 -0
- package/cdn/chunks/chunk-QA3FBQSF.js +5 -0
- package/cdn/chunks/chunk-QT25DBDO.js +8 -0
- package/cdn/chunks/chunk-SSBR2KEX.js +8 -0
- package/cdn/chunks/chunk-TB7NCJUL.js +8 -0
- package/cdn/chunks/chunk-V6LLE3H4.js +8 -0
- package/cdn/chunks/chunk-X5K7LBUM.js +8 -0
- package/cdn/chunks/chunk-Z6WP2K4O.js +1450 -0
- package/cdn/chunks/chunk-ZKETWB2E.js +8 -0
- package/cdn/index.global.js +1 -1
- package/cdn/index.js +1 -1
- package/cdn/qti-components/index.js +1 -1
- package/cdn/qti-test/components/index.js +1 -1
- package/cdn/qti-test/components/test-next.js +1 -1
- package/cdn/qti-test/components/test-prev.js +1 -1
- package/cdn/qti-test/components/test-scoring-feedback.js +1 -1
- package/cdn/qti-test/core/index.js +1 -1
- package/dist/chunks/chunk-4PL7XU3H.js +82 -0
- package/dist/chunks/chunk-4PL7XU3H.js.map +1 -0
- package/dist/chunks/chunk-4YWF7QTH.js +92 -0
- package/dist/chunks/chunk-4YWF7QTH.js.map +1 -0
- package/dist/chunks/chunk-7RFWGVJR.js +109 -0
- package/dist/chunks/chunk-7RFWGVJR.js.map +1 -0
- package/dist/chunks/chunk-BAG5H6N2.js +7970 -0
- package/dist/chunks/chunk-BAG5H6N2.js.map +1 -0
- package/dist/chunks/chunk-CWT66FG4.js +95 -0
- package/dist/chunks/chunk-CWT66FG4.js.map +1 -0
- package/dist/chunks/chunk-F2JDNMKV.js +100 -0
- package/dist/chunks/chunk-F2JDNMKV.js.map +1 -0
- package/dist/chunks/chunk-FZHYC3TU.js +92 -0
- package/dist/chunks/chunk-FZHYC3TU.js.map +1 -0
- package/dist/chunks/chunk-GDNPYP37.js +85 -0
- package/dist/chunks/chunk-GDNPYP37.js.map +1 -0
- package/dist/chunks/chunk-KXDEFGCK.js +887 -0
- package/dist/chunks/chunk-KXDEFGCK.js.map +1 -0
- package/dist/chunks/chunk-KZAEUKGI.js +100 -0
- package/dist/chunks/chunk-KZAEUKGI.js.map +1 -0
- package/dist/chunks/chunk-LJ4KYDFF.js +56 -0
- package/dist/chunks/chunk-LJ4KYDFF.js.map +1 -0
- package/dist/chunks/chunk-LMMYXE6U.js +85 -0
- package/dist/chunks/chunk-LMMYXE6U.js.map +1 -0
- package/dist/chunks/chunk-OD6DYLAO.js +7940 -0
- package/dist/chunks/chunk-OD6DYLAO.js.map +1 -0
- package/dist/chunks/chunk-OLZSWYQO.js +100 -0
- package/dist/chunks/chunk-OLZSWYQO.js.map +1 -0
- package/dist/chunks/chunk-PI2VZUCF.js +91 -0
- package/dist/chunks/chunk-PI2VZUCF.js.map +1 -0
- package/dist/chunks/chunk-RZK54XLD.js +100 -0
- package/dist/chunks/chunk-RZK54XLD.js.map +1 -0
- package/dist/chunks/chunk-SBY26ONA.js +99 -0
- package/dist/chunks/chunk-SBY26ONA.js.map +1 -0
- package/dist/chunks/chunk-WH6TRM5K.js +82 -0
- package/dist/chunks/chunk-WH6TRM5K.js.map +1 -0
- package/dist/chunks/chunk-WLDX63OS.js +92 -0
- package/dist/chunks/chunk-WLDX63OS.js.map +1 -0
- package/dist/chunks/chunk-X5L7SQQN.js +887 -0
- package/dist/chunks/chunk-X5L7SQQN.js.map +1 -0
- package/dist/chunks/chunk-X5RBTIXP.js +86 -0
- package/dist/chunks/chunk-X5RBTIXP.js.map +1 -0
- package/dist/exports/computed-item.context.d.ts +1 -1
- package/dist/exports/computed.context.d.ts +2 -2
- package/dist/exports/interaction.d.ts +1 -1
- package/dist/exports/item.context.d.ts +1 -1
- package/dist/exports/qti-assessment-item.context.d.ts +1 -1
- package/dist/exports/qti-condition-expression.d.ts +1 -1
- package/dist/exports/qti-expression.d.ts +1 -1
- package/dist/exports/session.context.d.ts +2 -2
- package/dist/exports/test.context.d.ts +1 -1
- package/dist/exports/variables.d.ts +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +5 -6
- package/dist/qti-components/index.d.ts +2 -2
- package/dist/qti-components/index.js +1 -2
- package/dist/qti-components-jsx.d.ts +73 -12
- package/dist/qti-item/components/item-show-correct-response.d.ts +1 -1
- package/dist/qti-item/components/print-item-variables.d.ts +1 -1
- package/dist/qti-item/core/index.d.ts +1 -1
- package/dist/qti-loader/index.d.ts +1 -1
- package/dist/qti-response-declaration-pCFZA_aW.d.ts +1356 -0
- package/dist/qti-test/components/index.d.ts +2 -2
- package/dist/qti-test/components/index.js +3 -4
- package/dist/qti-test/components/test-navigation.d.ts +2 -2
- package/dist/qti-test/components/test-next.d.ts +14 -16
- package/dist/qti-test/components/test-next.js +1 -1
- package/dist/qti-test/components/test-prev.d.ts +16 -18
- package/dist/qti-test/components/test-prev.js +1 -3
- package/dist/qti-test/components/test-print-context.d.ts +2 -2
- package/dist/qti-test/components/test-print-item-variables.d.ts +2 -2
- package/dist/qti-test/components/test-scoring-buttons.d.ts +2 -2
- package/dist/qti-test/components/test-scoring-feedback.d.ts +2 -2
- package/dist/qti-test/components/test-scoring-feedback.js +1 -1
- package/dist/qti-test/components/test-show-correct-response.d.ts +2 -2
- package/dist/qti-test/core/index.d.ts +3 -3
- package/dist/qti-test/core/index.js +2 -3
- package/dist/qti-test-feedback-2xjKezsY.d.ts +85 -0
- package/dist/vscode.html-custom-data.json +39 -15
- package/package.json +1 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import{a as c}from"./chunk-XUJ7TXHW.js";import{b as m}from"./chunk-CZDMOYYF.js";import{b as r}from"./chunk-7WJYJA45.js";import{a,b as n,c as l}from"./chunk-42P7F3FC.js";import{d as s,i as p}from"./chunk-65CZNGQC.js";import{a as i}from"./chunk-IAP2CEE7.js";var t=class extends p{constructor(){super(...arguments);this.label="view";this._handleViewOptionsChange=()=>{this.updateViewOptions()};this._viewOptions=t.DEFAULT_VIEW_OPTIONS}connectedCallback(){super.connectedCallback(),this.updateViewOptions()}updateViewOptions(){if(this.viewOptions){let e=this.viewOptions.split(",").map(o=>o.trim());this._viewOptions=e.filter(o=>t.DEFAULT_VIEW_OPTIONS.includes(o))}else this._viewOptions=t.DEFAULT_VIEW_OPTIONS}_switchView(e){this.dispatchEvent(new CustomEvent("on-test-switch-view",{composed:!0,bubbles:!0,detail:e}))}render(){return s`
|
|
2
|
+
<label part="label" for="viewSelect">${this.label}</label>
|
|
3
|
+
<select
|
|
4
|
+
part="select"
|
|
5
|
+
id="viewSelect"
|
|
6
|
+
@change=${e=>{let o=e.target;this._switchView(o.value)}}
|
|
7
|
+
>
|
|
8
|
+
${this._viewOptions.map(e=>s`<option value="${e}" ?selected=${e===this.sessionContext.view}>${e}</option>`)}
|
|
9
|
+
</select>
|
|
10
|
+
`}};t.DEFAULT_VIEW_OPTIONS=["author","candidate","proctor","scorer","testConstructor","tutor"],i([r({context:m,subscribe:!0})],t.prototype,"sessionContext",2),i([n({type:String})],t.prototype,"label",2),i([n({type:String,attribute:"view-options"})],t.prototype,"viewOptions",2),i([c("viewOptions",{waitUntilFirstUpdate:!0})],t.prototype,"_handleViewOptionsChange",2),i([l()],t.prototype,"_viewOptions",2),t=i([a("test-view")],t);export{t as a};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{b as u,c as h}from"./chunk-U5Y5T4ZS.js";import{a as p}from"./chunk-P6SSTAJ2.js";import{b as o}from"./chunk-7WJYJA45.js";import{a as m,b as d,c}from"./chunk-42P7F3FC.js";import{a as r,d as a,i as l}from"./chunk-65CZNGQC.js";import{a as i}from"./chunk-IAP2CEE7.js";var t=class extends l{constructor(){super();this.disabled=!0;this._internallyDisabled=!0;this._internals=this.attachInternals(),this._internals.role="button",this._internals.ariaLabel="Previous item",this.addEventListener("click",s=>{s.preventDefault(),this.effectiveDisabled||this._requestItem(this.sectionItems[this.itemIndex-1].identifier)})}get effectiveDisabled(){return this._internallyDisabled||this.disabled}updated(){this.effectiveDisabled?this.setAttribute("effective-disabled",""):this.removeAttribute("effective-disabled")}willUpdate(s){if(!this.computedContext)return;let n=this.computedContext?.testParts.find(e=>e.active);n&&(this.sectionItems=n.sections.flatMap(e=>e.items),this.itemIndex=this.sectionItems.findIndex(e=>e.active),this.checkDisabled())}checkDisabled(){console.log("checkDisabled",this.itemIndex,this.sectionItems),this._internallyDisabled=!this.computedContext||this.itemIndex<=0||this.itemIndex===-1}_requestItem(s){this.dispatchEvent(new CustomEvent("qti-request-navigation",{composed:!0,bubbles:!0,detail:{type:"item",id:s}}))}render(){return a`<slot></slot>`}};t.styles=r`
|
|
2
|
+
:host {
|
|
3
|
+
${u};
|
|
4
|
+
}
|
|
5
|
+
:host([effective-disabled]) {
|
|
6
|
+
${h};
|
|
7
|
+
}
|
|
8
|
+
`,i([d({type:Boolean,reflect:!0})],t.prototype,"disabled",2),i([c()],t.prototype,"_internallyDisabled",2),i([o({context:p,subscribe:!0})],t.prototype,"computedContext",2),t=i([m("test-prev")],t);export{t as a};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{b as u,c as h}from"./chunk-U5Y5T4ZS.js";import{a as p}from"./chunk-P6SSTAJ2.js";import{b as r}from"./chunk-7WJYJA45.js";import{a as d,b as m,c}from"./chunk-42P7F3FC.js";import{a as o,d as a,i as l}from"./chunk-65CZNGQC.js";import{a as s}from"./chunk-IAP2CEE7.js";var t=class extends l{constructor(){super();this.disabled=!1;this._internallyDisabled=!1;this._internals=this.attachInternals(),this._internals.role="button",this._internals.ariaLabel="Next item",this.addEventListener("click",e=>{e.preventDefault(),this.effectiveDisabled||this._requestItem(this.sectionItems[this.itemIndex+1].identifier)})}get effectiveDisabled(){return this._internallyDisabled||this.disabled}updated(){this.effectiveDisabled?this.setAttribute("effective-disabled",""):this.removeAttribute("effective-disabled")}willUpdate(e){if(!this.computedContext)return;let n=this.computedContext?.testParts.find(i=>i.active);n&&(this.sectionItems=n.sections.flatMap(i=>i.items),this.itemIndex=this.sectionItems.findIndex(i=>i.active),this.checkDisabled())}checkDisabled(){let e=!this.computedContext||this.itemIndex<0||this.itemIndex>=this.sectionItems?.length-1;this._internallyDisabled=e}_requestItem(e){this.dispatchEvent(new CustomEvent("qti-request-navigation",{composed:!0,bubbles:!0,detail:{type:"item",id:e}}))}render(){return a`<slot></slot>`}};t.styles=o`
|
|
2
|
+
:host {
|
|
3
|
+
${u};
|
|
4
|
+
}
|
|
5
|
+
:host([effective-disabled]) {
|
|
6
|
+
${h};
|
|
7
|
+
}
|
|
8
|
+
`,s([m({type:Boolean,reflect:!0})],t.prototype,"disabled",2),s([c()],t.prototype,"_internallyDisabled",2),s([r({context:p,subscribe:!0})],t.prototype,"computedContext",2),t=s([d("test-next")],t);export{t as a};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{b as p,c as u}from"./chunk-U5Y5T4ZS.js";import{a as c}from"./chunk-P6SSTAJ2.js";import{b as o}from"./chunk-7WJYJA45.js";import{a as m,b as a}from"./chunk-42P7F3FC.js";import{a as r,d,i as l}from"./chunk-65CZNGQC.js";import{a as i}from"./chunk-IAP2CEE7.js";var e=class extends l{constructor(){super();this.disabled=!1;this._internals=this.attachInternals(),this._internals.role="button",this._internals.ariaLabel="Next item",this.addEventListener("click",t=>{t.preventDefault(),this.disabled||this._requestItem(this.sectionItems[this.itemIndex+1].identifier)})}connectedCallback(){super.connectedCallback()}willUpdate(t){if(!this.computedContext)return;let n=this.computedContext?.testParts.find(s=>s.active);n&&(this.sectionItems=n.sections.flatMap(s=>s.items),this.itemIndex=this.sectionItems.findIndex(s=>s.active),this.checkDisabled())}checkDisabled(){let t=!this.computedContext||this.itemIndex<0||this.itemIndex>=this.sectionItems?.length-1;if(console.log(t),this.disabled){this.disabled=!0;return}this.disabled=t}_requestItem(t){this.dispatchEvent(new CustomEvent("qti-request-navigation",{composed:!0,bubbles:!0,detail:{type:"item",id:t}}))}render(){return d`<slot></slot>`}};e.styles=r`
|
|
2
|
+
:host {
|
|
3
|
+
${p};
|
|
4
|
+
}
|
|
5
|
+
:host([disabled]) {
|
|
6
|
+
${u};
|
|
7
|
+
}
|
|
8
|
+
`,i([a({type:Boolean,reflect:!0})],e.prototype,"disabled",2),i([o({context:c,subscribe:!0})],e.prototype,"computedContext",2),e=i([m("test-next")],e);export{e as a};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{b as p,c as u}from"./chunk-U5Y5T4ZS.js";import{a as c}from"./chunk-P6SSTAJ2.js";import{b as o}from"./chunk-7WJYJA45.js";import{a,b as m}from"./chunk-42P7F3FC.js";import{a as r,d,i as l}from"./chunk-65CZNGQC.js";import{a as i}from"./chunk-IAP2CEE7.js";var e=class extends l{constructor(){super();this.disabled=!1;this._internals=this.attachInternals(),this._internals.role="button",this._internals.ariaLabel="Next item",this.addEventListener("click",t=>{t.preventDefault(),this.disabled||this._requestItem(this.sectionItems[this.itemIndex+1].identifier)})}connectedCallback(){super.connectedCallback()}willUpdate(t){if(!this.computedContext)return;let n=this.computedContext?.testParts.find(s=>s.active);n&&(this.sectionItems=n.sections.flatMap(s=>s.items),this.itemIndex=this.sectionItems.findIndex(s=>s.active),this.checkDisabled())}checkDisabled(){let t=!this.computedContext||this.itemIndex<0||this.itemIndex>=this.sectionItems?.length-1;console.log(t),this.disabled&&(this.disabled=!0),this.disabled||(this.disabled=t)}_requestItem(t){this.dispatchEvent(new CustomEvent("qti-request-navigation",{composed:!0,bubbles:!0,detail:{type:"item",id:t}}))}render(){return d`<slot></slot>`}};e.styles=r`
|
|
2
|
+
:host {
|
|
3
|
+
${p};
|
|
4
|
+
}
|
|
5
|
+
:host([disabled]) {
|
|
6
|
+
${u};
|
|
7
|
+
}
|
|
8
|
+
`,i([m({type:Boolean,reflect:!0})],e.prototype,"disabled",2),i([o({context:c,subscribe:!0})],e.prototype,"computedContext",2),e=i([a("test-next")],e);export{e as a};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{g as V}from"./chunk-Z6WP2K4O.js";import{a as M}from"./chunk-D4A6UBNV.js";import{a as R,b as L}from"./chunk-CZDMOYYF.js";import{a as w,b as x}from"./chunk-QQR6POPY.js";import{a as S}from"./chunk-ULI6NOVG.js";import{a as I,b as _}from"./chunk-7WJYJA45.js";import{a as b,b as r}from"./chunk-42P7F3FC.js";import{a as N,d,i as p}from"./chunk-65CZNGQC.js";import{a as i}from"./chunk-IAP2CEE7.js";var A=(e=>(e.ITEM_NOT_FOUND="item-not-found",e.SECTION_NOT_FOUND="section-not-found",e.LOAD_ERROR="load-error",e.NETWORK_ERROR="network-error",e.TIMEOUT_ERROR="timeout-error",e))(A||{}),D=m=>{class u extends m{constructor(...t){super(...t);this.navigate=null;this.cacheTransform=!1;this.requestTimeout=3e4;this.showLoadingIndicators=!0;this._activeRequests=[];this._navigationInProgress=!1;this._lastError=null;this._lastNavigationRequestId=null;this._targetNavigation=null;this.addEventListener("qti-request-navigation",async({detail:e})=>{if(!e?.id)return;let s=`nav_${Date.now()}_${Math.random()}`;this._lastNavigationRequestId=s;try{if(this._navigationInProgress=!0,this._lastError=null,this._dispatchStatusEvent({loading:!0,type:e.type,id:e.id}),this._cancelActiveRequests(),this._targetNavigation={type:e.type,id:e.id},e.type==="item"?await this._navigateToItem(e.id):e.type==="section"&&await this._navigateToSection(e.id),this._lastNavigationRequestId!==s){console.log("Navigation was superseded by a newer request");return}}catch(c){if(this._lastNavigationRequestId===s){let o=this._normalizeError(c,e.type,e.id);this._lastError=o,this._dispatchErrorEvent(o),console.error(`Navigation error (${o.type}):`,o.message,o.details)}}finally{this._lastNavigationRequestId===s&&(this._navigationInProgress=!1,this._dispatchStatusEvent({loading:!1,type:e.type,id:e.id}))}}),this.addEventListener("qti-assessment-test-connected",e=>{this._testElement=e.detail,this._initializeNavigation()})}_initializeNavigation(){let t;this.navigate==="section"&&(t=this._testElement.querySelector("qti-assessment-section")?.identifier),this.navigate==="item"&&(t=this.sessionContext.navItemRefId??this._testElement.querySelector("qti-assessment-item-ref")?.identifier),t&&this.dispatchEvent(new CustomEvent("qti-request-navigation",{detail:{type:this.navigate==="section"?"section":"item",id:t},bubbles:!0,composed:!0}))}navigateTo(t,e){e||(t==="section"&&(e=this._testElement?.querySelector("qti-assessment-section")?.identifier),t==="item"&&(e=this._testElement?.querySelector("qti-assessment-item-ref")?.identifier)),this.dispatchEvent(new CustomEvent("qti-request-navigation",{detail:{type:t,id:e},bubbles:!0,composed:!0}))}async _navigateToItem(t){let e=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${t}"]`);if(!e)throw{type:"item-not-found",message:`Item with identifier "${t}" not found.`,itemId:t};let s=e.closest("qti-test-part")?.identifier,c=e.closest("qti-assessment-section")?.identifier;this.sessionContext={...this.sessionContext,navPartId:s,navSectionId:c,navItemRefId:t,navItemLoading:!0};try{await this._loadItems([t])}finally{this.sessionContext={...this.sessionContext,navItemLoading:!1}}}async _navigateToSection(t){let e=this._testElement?.querySelector(`qti-assessment-section[identifier="${t}"]`);if(!e)throw{type:"section-not-found",message:`Section with identifier "${t}" not found.`,sectionId:t};let s=e.closest("qti-test-part")?.identifier;this.sessionContext={...this.sessionContext,navPartId:s,navSectionId:t,navItemRefId:null,navItemLoading:!0};try{let c=this._getSectionItemIds(t);await this._loadItems(c)}finally{this.sessionContext={...this.sessionContext,navItemLoading:!1}}}_normalizeError(t,e,s){return t&&t.type&&Object.values(A).includes(t.type)?t:t instanceof DOMException&&t.name==="AbortError"?{type:"network-error",message:"Navigation was cancelled because a new navigation was requested.",details:t}:t.name==="TimeoutError"||t.message&&t.message.includes("timeout")?{type:"timeout-error",message:"Request timed out. Please check your network connection.",details:t}:t instanceof TypeError&&t.message.includes("network")?{type:"network-error",message:"A network error occurred. Please check your connection.",details:t}:{type:"load-error",message:`Failed to load ${e}: ${s}`,details:t,itemId:e==="item"?s:void 0,sectionId:e==="section"?s:void 0}}_dispatchErrorEvent(t){this.dispatchEvent(new CustomEvent("qti-navigation-error",{detail:t,bubbles:!0,composed:!0}))}_dispatchStatusEvent(t){this.showLoadingIndicators&&this.dispatchEvent(new CustomEvent("qti-navigation-status",{detail:t,bubbles:!0,composed:!0}))}_cancelActiveRequests(){this._activeRequests.length>0&&(console.info(`Cancelling ${this._activeRequests.length} pending requests`),this._activeRequests.forEach(t=>{t&&t.readyState!==4&&t.abort()}),this._activeRequests=[])}async _loadItems(t){if(!this._testElement||t.length===0)return;let e=t.map(o=>this._testElement.querySelector(`qti-assessment-item-ref[identifier="${o}"]`)),s=e.reduce((o,v,l)=>(v||o.push(t[l]),o),[]);if(s.length>0)throw{type:"item-not-found",message:`One or more items not found: ${s.join(", ")}`,details:{missingItems:s}};this._clearLoadedItems();let c=e.map(async o=>{if(!o)return null;let v=new Promise((l,E)=>{setTimeout(()=>{E({name:"TimeoutError",message:`Request for item ${o.identifier} timed out after ${this.requestTimeout}ms`})},this.requestTimeout)});try{let{promise:l,request:E}=S(this.cacheTransform).load(o.href);E instanceof XMLHttpRequest&&this._activeRequests.push(E);let B=await Promise.race([l,v]);return{itemRef:o,doc:B.htmlDoc(),request:E}}catch(l){if(l instanceof DOMException&&l.name==="AbortError"||l&&l.name==="TimeoutError")return console.log(`Request for item ${o.identifier} was ${l.name==="TimeoutError"?"timed out":"aborted"}`),null;throw l.itemId=o.identifier,l}});try{let v=(await Promise.all(c)).filter(l=>l!==null);if(v.forEach(({itemRef:l,doc:E})=>{l&&E&&(l.xmlDoc=E)}),this._activeRequests=[],requestAnimationFrame(()=>{this.dispatchEvent(new CustomEvent("qti-test-loaded",{detail:v.map(({itemRef:l})=>({identifier:l?.identifier,element:l})),bubbles:!0,composed:!0}))}),v.length===0&&t.length>0)throw{type:"load-error",message:"All item requests failed to load",details:{itemIds:t}};return v}catch(o){throw console.error("Error loading items:",o),o}}_getSectionItemIds(t){if(!this._testElement?.querySelector(`qti-assessment-section[identifier="${t}"]`))throw{type:"section-not-found",message:`Section with identifier "${t}" not found.`,sectionId:t};return Array.from(this._testElement.querySelectorAll(`qti-assessment-section[identifier="${t}"] > qti-assessment-item-ref`)).map(s=>s.identifier)}_clearLoadedItems(){let t=this._testElement?.querySelectorAll("qti-assessment-test qti-assessment-item-ref");Array.from(t||[]).forEach(e=>{e.xmlDoc=null})}retryNavigation(){if(this._lastError){let t=this._lastError.itemId?"item":"section",e=this._lastError.itemId||this._lastError.sectionId;e&&this.dispatchEvent(new CustomEvent("qti-request-navigation",{detail:{type:t,id:e},bubbles:!0,composed:!0}))}else this._targetNavigation&&this.dispatchEvent(new CustomEvent("qti-request-navigation",{detail:this._targetNavigation,bubbles:!0,composed:!0}))}}return i([r({type:String})],u.prototype,"navigate",2),i([r({type:Boolean,attribute:"cache-transform"})],u.prototype,"cacheTransform",2),i([r({type:Number})],u.prototype,"requestTimeout",2),i([r({type:Boolean})],u.prototype,"showLoadingIndicators",2),u};var P=m=>{class u extends m{constructor(...n){super(...n),this.sessionContext={...this.sessionContext,view:"candidate"},this.addEventListener("on-test-switch-view",t=>{this.sessionContext={...this.sessionContext,view:t.detail},this._updateElementView()}),this.addEventListener("qti-assessment-test-connected",()=>{this._updateElementView()}),this.addEventListener("qti-assessment-item-connected",t=>{this._updateElementView(),this._setCorrectResponseVisibility(t.detail)})}willUpdate(n){super.willUpdate(n),n.has("sessionContext")&&this._updateElementView()}_updateElementView(){if(this._testElement){Array.from(this._testElement.querySelectorAll("[view]")).forEach(s=>{s.classList.toggle("show",s.getAttribute("view")===this.sessionContext.view)});let e=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${this.sessionContext.navItemRefId}"]`)?.assessmentItem;e&&e.showCorrectResponse(this.sessionContext.view==="scorer")}}_setCorrectResponseVisibility(n){n.showCorrectResponse(this.sessionContext.view==="scorer")}}return u};var q=class extends p{constructor(){super();this.testContext=w;this.sessionContext=R;this._updateItemInTestContext=a=>{let n=a._context,t=n.identifier,e=n.variables,s=this.testContext.items.find(c=>c?.identifier===t);if(!s){console.warn(`Item IDs between assessment.xml and item.xml should match: ${t} is not found!`);return}s.variables?.length===1?this._updateItemVariablesInTestContext(t,e):a.variables=[...s.variables||[]]};this.addEventListener("qti-assessment-test-connected",a=>{if(this.testContext=w,this.sessionContext=R,this.testContext&&this.testContext.items.length>0)return;this._testElement=a.detail;let n=Array.from(this._testElement.querySelectorAll("qti-assessment-item-ref")).map(t=>({href:t.href,identifier:t.identifier,category:t.category,variables:[{identifier:"completionStatus",value:"not_attempted",type:"outcome"}]}));this.testContext={...this.testContext,items:n}}),this.addEventListener("qti-assessment-item-connected",a=>{let n=a.detail,t=n.closest("qti-assessment-item-ref")?.identifier;t&&(n.assessmentItemRefId=t),this._updateItemInTestContext(a.detail)}),this.addEventListener("qti-item-context-updated",a=>{this._updateItemVariablesInTestContext(a.detail.itemContext.identifier,a.detail.itemContext.variables)})}updateItemVariables(a,n){let t=this.testContext.items.find(s=>s.identifier===a);t&&(t.variables=t.variables.map(s=>{let c=n.find(o=>o.identifier===s.identifier);return c?{...s,...c}:s}));let e=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${a}"]`);e&&e.assessmentItem&&e.assessmentItem&&(e.assessmentItem.variables=n)}_updateItemVariablesInTestContext(a,n){this.testContext={...this.testContext,items:this.testContext.items.map(t=>t.identifier!==a?t:{...t,variables:n.map(e=>{let s=t.variables.find(c=>c.identifier===e.identifier);return s?{...s,...e}:e})})},this.dispatchEvent(new CustomEvent("qti-test-context-updated",{detail:this.testContext,bubbles:!1,composed:!1}))}};i([r({attribute:!1,type:Object}),I({context:x})],q.prototype,"testContext",2),i([r({attribute:!1,type:Object}),I({context:L})],q.prototype,"sessionContext",2);var $=m=>{class u extends m{constructor(...n){super(...n),this.addEventListener("qti-register-variable",t=>{this.testContext={...this.testContext,testOutcomeVariables:[...this.testContext.testOutcomeVariables||[],t.detail.variable]},t.stopPropagation()}),this.addEventListener("qti-set-outcome-value",t=>{let{outcomeIdentifier:e,value:s}=t.detail;this.updateOutcomeVariable(e,s),t.stopPropagation()})}outcomeProcessing(){let n=this.querySelector("qti-outcome-processing");return n?(n?.process(),!0):!1}updateOutcomeVariable(n,t){let e=this.getOutcome(n);if(!e){console.warn(`Can not set qti-outcome-identifier: ${n}, it is not available`);return}this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(s=>s.identifier!==n?s:{...s,value:e.cardinality==="single"?t:[...s.value,t]})}}getOutcome(n){return this.getVariable(n)}getVariable(n){return this.testContext.testOutcomeVariables?.find(t=>t.identifier===n)||null}}return u};var T=class extends D(P($(q))){async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-test-connected",{detail:this}))}render(){return d`<slot></slot>`}};T=i([b("qti-test")],T);var k={fromAttribute(m){return m==="true"},toAttribute(m){return m?"true":"false"}},g=class extends p{constructor(){super(...arguments);this.weigths=new Map}createRenderRoot(){return this}get assessmentItem(){return this.renderRoot?.querySelector("qti-assessment-item")}async connectedCallback(){super.connectedCallback();let a=this.getRootNode().host.closest("qti-test").querySelector("template[item-ref]");a&&(this.myTemplate=M(a)),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-assessment-item-ref-connected",{bubbles:!0,composed:!0,detail:{identifier:this.identifier,href:this.href,category:this.category}}))}render(){return this.myTemplate?this.myTemplate({xmlDoc:this.xmlDoc}):this.xmlDoc}};i([r({type:String})],g.prototype,"category",2),i([r({type:String})],g.prototype,"identifier",2),i([r({type:Boolean,converter:k})],g.prototype,"required",2),i([r({type:Boolean,converter:k})],g.prototype,"fixed",2),i([r({type:String})],g.prototype,"href",2),i([r({type:Object,attribute:!1})],g.prototype,"xmlDoc",2);customElements.get("qti-assessment-item-ref")||customElements.define("qti-assessment-item-ref",g);var O={fromAttribute(m){return m==="true"},toAttribute(m){return m?"true":"false"}},f=class extends p{async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-assessment-section-connected",{bubbles:!0,composed:!0}))}render(){return d`<slot name="qti-rubric-block"></slot><slot></slot>`}};i([r({type:String})],f.prototype,"identifier",2),i([r({type:String})],f.prototype,"required",2),i([r({type:Boolean,converter:O})],f.prototype,"fixed",2),i([r({type:String})],f.prototype,"title",2),i([r({type:Boolean,converter:O})],f.prototype,"visible",2),i([r({type:Boolean,converter:O,attribute:"keep-together"})],f.prototype,"keepTogether",2),i([_({context:x,subscribe:!0})],f.prototype,"_testContext",2);customElements.get("qti-assessment-section")||customElements.define("qti-assessment-section",f);var y=class extends p{async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-assessment-test-connected",{detail:this,bubbles:!0,composed:!0}))}render(){return d` <slot></slot>`}};i([r({type:String})],y.prototype,"identifier",2),i([r({type:String})],y.prototype,"title",2),i([_({context:x,subscribe:!0})],y.prototype,"_testContext",2),y=i([b("qti-assessment-test")],y);var h=class extends p{constructor(){super(...arguments);this.identifier="";this.title="";this.class="";this.navigationMode="nonlinear";this.submissionMode="individual"}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-test-part-connected",{bubbles:!0,composed:!0}))}render(){return d` <slot></slot>`}};i([r({type:String})],h.prototype,"identifier",2),i([r({type:String})],h.prototype,"title",2),i([r({type:String})],h.prototype,"class",2),i([r({type:String,attribute:"navigation-mode"})],h.prototype,"navigationMode",2),i([r({type:String,attribute:"submission-mode"})],h.prototype,"submissionMode",2),h=i([b("qti-test-part")],h);customElements.get("qti-test-part")||customElements.define("qti-test-part",h);var C=class extends V{render(){return d``}};C.styles=N`
|
|
2
|
+
:host {
|
|
3
|
+
color: gray;
|
|
4
|
+
}
|
|
5
|
+
`,C=i([b("qti-test-feedback")],C);export{T as a,g as b,f as c,y as d,h as e,C as f};
|