@citolab/qti-components 6.9.1-15 → 6.9.1-16

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.
@@ -96,6 +96,82 @@
96
96
  }
97
97
  ]
98
98
  },
99
+ {
100
+ "kind": "javascript-module",
101
+ "path": "src/lib/qti-transformers/index.ts",
102
+ "declarations": [],
103
+ "exports": [
104
+ {
105
+ "kind": "js",
106
+ "name": "*",
107
+ "declaration": {
108
+ "name": "*",
109
+ "package": "./qti-transformers"
110
+ }
111
+ }
112
+ ]
113
+ },
114
+ {
115
+ "kind": "javascript-module",
116
+ "path": "src/lib/qti-transformers/qti-transformers.ts",
117
+ "declarations": [
118
+ {
119
+ "kind": "function",
120
+ "name": "qtiTransformItem",
121
+ "return": {
122
+ "type": {
123
+ "text": ""
124
+ }
125
+ },
126
+ "description": "Browser based QTI-XML to HTML transformer.\nReturns an object with methods to load, parse, transform and serialize QTI XML items."
127
+ },
128
+ {
129
+ "kind": "function",
130
+ "name": "qtiTransformManifest",
131
+ "return": {
132
+ "type": {
133
+ "text": "{\n load: (uri: string) => Promise<typeof api>;\n assessmentTest: () => { href: string; identifier: string };\n}"
134
+ }
135
+ }
136
+ },
137
+ {
138
+ "kind": "function",
139
+ "name": "qtiTransformTest",
140
+ "return": {
141
+ "type": {
142
+ "text": ""
143
+ }
144
+ },
145
+ "description": "Returns an object with methods to load, parse and transform QTI tests."
146
+ }
147
+ ],
148
+ "exports": [
149
+ {
150
+ "kind": "js",
151
+ "name": "qtiTransformItem",
152
+ "declaration": {
153
+ "name": "qtiTransformItem",
154
+ "module": "src/lib/qti-transformers/qti-transformers.ts"
155
+ }
156
+ },
157
+ {
158
+ "kind": "js",
159
+ "name": "qtiTransformManifest",
160
+ "declaration": {
161
+ "name": "qtiTransformManifest",
162
+ "module": "src/lib/qti-transformers/qti-transformers.ts"
163
+ }
164
+ },
165
+ {
166
+ "kind": "js",
167
+ "name": "qtiTransformTest",
168
+ "declaration": {
169
+ "name": "qtiTransformTest",
170
+ "module": "src/lib/qti-transformers/qti-transformers.ts"
171
+ }
172
+ }
173
+ ]
174
+ },
99
175
  {
100
176
  "kind": "javascript-module",
101
177
  "path": "src/lib/qti-components/index.ts",
@@ -527,82 +603,6 @@
527
603
  }
528
604
  ]
529
605
  },
530
- {
531
- "kind": "javascript-module",
532
- "path": "src/lib/qti-transformers/index.ts",
533
- "declarations": [],
534
- "exports": [
535
- {
536
- "kind": "js",
537
- "name": "*",
538
- "declaration": {
539
- "name": "*",
540
- "package": "./qti-transformers"
541
- }
542
- }
543
- ]
544
- },
545
- {
546
- "kind": "javascript-module",
547
- "path": "src/lib/qti-transformers/qti-transformers.ts",
548
- "declarations": [
549
- {
550
- "kind": "function",
551
- "name": "qtiTransformItem",
552
- "return": {
553
- "type": {
554
- "text": ""
555
- }
556
- },
557
- "description": "Browser based QTI-XML to HTML transformer.\nReturns an object with methods to load, parse, transform and serialize QTI XML items."
558
- },
559
- {
560
- "kind": "function",
561
- "name": "qtiTransformManifest",
562
- "return": {
563
- "type": {
564
- "text": "{\n load: (uri: string) => Promise<typeof api>;\n assessmentTest: () => { href: string; identifier: string };\n}"
565
- }
566
- }
567
- },
568
- {
569
- "kind": "function",
570
- "name": "qtiTransformTest",
571
- "return": {
572
- "type": {
573
- "text": ""
574
- }
575
- },
576
- "description": "Returns an object with methods to load, parse and transform QTI tests."
577
- }
578
- ],
579
- "exports": [
580
- {
581
- "kind": "js",
582
- "name": "qtiTransformItem",
583
- "declaration": {
584
- "name": "qtiTransformItem",
585
- "module": "src/lib/qti-transformers/qti-transformers.ts"
586
- }
587
- },
588
- {
589
- "kind": "js",
590
- "name": "qtiTransformManifest",
591
- "declaration": {
592
- "name": "qtiTransformManifest",
593
- "module": "src/lib/qti-transformers/qti-transformers.ts"
594
- }
595
- },
596
- {
597
- "kind": "js",
598
- "name": "qtiTransformTest",
599
- "declaration": {
600
- "name": "qtiTransformTest",
601
- "module": "src/lib/qti-transformers/qti-transformers.ts"
602
- }
603
- }
604
- ]
605
- },
606
606
  {
607
607
  "kind": "javascript-module",
608
608
  "path": "src/lib/qti-components/internal/event-types.ts",
@@ -1033,6 +1033,12 @@
1033
1033
  "type": {
1034
1034
  "text": "CustomEvent"
1035
1035
  }
1036
+ },
1037
+ {
1038
+ "name": "qti-interaction-response",
1039
+ "type": {
1040
+ "text": "CustomEvent"
1041
+ }
1036
1042
  }
1037
1043
  ],
1038
1044
  "superclass": {
package/dist/index.js CHANGED
@@ -496,7 +496,7 @@ var Hr=Object.defineProperty,Ms=Object.defineProperties,ks=Object.getOwnProperty
496
496
  ${this.csLive.getPropertyValue("--show-value")=="true"?u`<div id="value" part="value">${this.value}</div>`:C}
497
497
  </div>
498
498
  </div>
499
- </div>`}connectedCallback(){super.connectedCallback(),this.step=1,this.setAttribute("tabindex","0"),this.setAttribute("role","slider")}_onTouchMove(e){let r=l=>{let{x:c}=this.getPositionFromEvent(l),d=c-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(d),l.stopPropagation()},s=()=>{document.removeEventListener("touchmove",r),document.removeEventListener("touchend",s),this.saveResponse(this.value.toString())};document.addEventListener("touchmove",r),document.addEventListener("touchend",s);let{x:n}=this.getPositionFromEvent(e),o=n-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(o),e.stopPropagation()}_onMouseDown(e){let r=o=>{let l=o.pageX-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(l),o.preventDefault(),o.stopPropagation()},s=()=>{document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",s),this.saveResponse(this.value.toString())};document.addEventListener("mousemove",r),document.addEventListener("mouseup",s);let n=e.pageX-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(n),e.preventDefault(),e.stopPropagation()}calculateValue(e){let r=this.min+(this.max-this.min)*e/this._rail.getBoundingClientRect().width,s=this.min+Math.round((r-this.min)/this._step)*this._step;this.value=s}getPositionFromEvent(e){let r;if(e.type=="touchstart"||e.type=="touchmove"||e.type=="touchend"||e.type=="touchcancel"){let s=typeof e.originalEvent=="undefined"?e:e.originalEvent,n=s.touches[0]||s.changedTouches[0];r={x:n.pageX,y:n.pageY}}else(e.type=="mousedown"||e.type=="mouseup"||e.type=="mousemove"||e.type=="mouseover"||e.type=="mouseout"||e.type=="mouseenter"||e.type=="mouseleave")&&(r={x:e.clientX,y:e.clientY});return r}};M.styles=[b``],a([Fe("#knob")],M.prototype,"_knob",2),a([Fe("#rail")],M.prototype,"_rail",2),a([p({type:Number})],M.prototype,"value",2),a([p({type:Boolean,attribute:"step-label"})],M.prototype,"stepLabel",2),a([p({type:Boolean})],M.prototype,"reverse",2),a([p({type:Number,attribute:"lower-bound"})],M.prototype,"min",1),a([p({type:Number,attribute:"upper-bound"})],M.prototype,"max",1),a([p({type:Number,attribute:"step"})],M.prototype,"step",1),a([T("disabled",{waitUntilFirstUpdate:!0})],M.prototype,"_handleDisabledChange",2),a([T("readonly",{waitUntilFirstUpdate:!0})],M.prototype,"_handleReadonlyChange",2),M=a([m("qti-slider-interaction")],M);var nt=class extends g{render(){return u`<slot @slotchange=${this.handleSlotChange}></slot>`}handleSlotChange(t){var r,s,n;let e=Array.from((s=(r=this.firstElementChild)==null?void 0:r.childNodes)!=null?s:[]).find(o=>o.nodeType===Node.COMMENT_NODE);try{this.operatorFunction=new Function("context","fn","item",(n=e.textContent)!=null?n:"")}catch(o){console.error("custom-operator contains invalid javascript code",o)}}calculate(){let t={variable:r=>{var s,n,o;return(o=(n=(s=this._context)==null?void 0:s.variables.find(l=>l.identifier===r))==null?void 0:n.value)!=null?o:""},correct:r=>{var s,n,o;return(o=(n=(s=this._context)==null?void 0:s.variables.find(l=>l.identifier===r))==null?void 0:n.correctResponse)!=null?o:""}},e={getVariable:r=>{var s;return(s=this._context)==null?void 0:s.variables.find(n=>n.identifier===r)},updateOutcomeVariable:(r,s)=>{this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:r,value:s}}))}};return this.operatorFunction(this._context,t,e)}};a([J({context:U,subscribe:!0}),E()],nt.prototype,"_context",2),nt=a([m("qti-custom-operator")],nt);var at=class extends g{connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-hotspot",{bubbles:!0,cancelable:!1,composed:!0}))}render(){return u` <slot name="qti-gap-img"></slot> `}};at.styles=b`
499
+ </div>`}connectedCallback(){super.connectedCallback(),this.step=1,this.setAttribute("tabindex","0"),this.setAttribute("role","slider")}_onTouchMove(e){let r=l=>{let{x:c}=this.getPositionFromEvent(l),d=c-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(d),l.stopPropagation()},s=()=>{document.removeEventListener("touchmove",r),document.removeEventListener("touchend",s),this.saveResponse(this.value.toString())};document.addEventListener("touchmove",r),document.addEventListener("touchend",s);let{x:n}=this.getPositionFromEvent(e),o=n-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(o),e.stopPropagation()}_onMouseDown(e){let r=o=>{let l=o.pageX-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(l),o.preventDefault(),o.stopPropagation()},s=()=>{document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",s),this.saveResponse(this.value.toString())};document.addEventListener("mousemove",r),document.addEventListener("mouseup",s);let n=e.pageX-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(n),e.preventDefault(),e.stopPropagation()}calculateValue(e){let r=this.min+(this.max-this.min)*e/this._rail.getBoundingClientRect().width,s=this.min+Math.round((r-this.min)/this._step)*this._step;this.value=s}getPositionFromEvent(e){let r;if(e.type=="touchstart"||e.type=="touchmove"||e.type=="touchend"||e.type=="touchcancel"){let s=typeof e.originalEvent=="undefined"?e:e.originalEvent,n=s.touches[0]||s.changedTouches[0];r={x:n.pageX,y:n.pageY}}else(e.type=="mousedown"||e.type=="mouseup"||e.type=="mousemove"||e.type=="mouseover"||e.type=="mouseout"||e.type=="mouseenter"||e.type=="mouseleave")&&(r={x:e.clientX,y:e.clientY});return r}};M.styles=[b``],a([Fe("#knob")],M.prototype,"_knob",2),a([Fe("#rail")],M.prototype,"_rail",2),a([p({type:Number})],M.prototype,"value",2),a([p({type:Boolean,attribute:"step-label"})],M.prototype,"stepLabel",2),a([p({type:Boolean})],M.prototype,"reverse",2),a([p({type:Number,attribute:"lower-bound"})],M.prototype,"min",1),a([p({type:Number,attribute:"upper-bound"})],M.prototype,"max",1),a([p({type:Number,attribute:"step"})],M.prototype,"step",1),a([T("disabled",{waitUntilFirstUpdate:!0})],M.prototype,"_handleDisabledChange",2),a([T("readonly",{waitUntilFirstUpdate:!0})],M.prototype,"_handleReadonlyChange",2),M=a([m("qti-slider-interaction")],M);var nt=class extends g{render(){return u`<slot @slotchange=${this.handleSlotChange}></slot>`}handleSlotChange(t){var r,s,n;let e=Array.from((s=(r=this.firstElementChild)==null?void 0:r.childNodes)!=null?s:[]).find(o=>o.nodeType===Node.COMMENT_NODE);try{this.operatorFunction=new Function("context","fn","item",(n=e.textContent)!=null?n:"")}catch(o){console.error("custom-operator contains invalid javascript code",o)}}calculate(){let t={variable:r=>{var s,n,o;return(o=(n=(s=this._context)==null?void 0:s.variables.find(l=>l.identifier===r))==null?void 0:n.value)!=null?o:""},correct:r=>{var s,n,o;return(o=(n=(s=this._context)==null?void 0:s.variables.find(l=>l.identifier===r))==null?void 0:n.correctResponse)!=null?o:""}},e={getVariable:r=>{var s;return(s=this._context)==null?void 0:s.variables.find(n=>n.identifier===r)},updateOutcomeVariable:(r,s)=>{this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:r,value:s}}))},updateResponseVariable:(r,s)=>{this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:r,response:s}}))}};return this.operatorFunction(this._context,t,e)}};a([J({context:U,subscribe:!0}),E()],nt.prototype,"_context",2),nt=a([m("qti-custom-operator")],nt);var at=class extends g{connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-hotspot",{bubbles:!0,cancelable:!1,composed:!0}))}render(){return u` <slot name="qti-gap-img"></slot> `}};at.styles=b`
500
500
  :host {
501
501
  position: absolute;
502
502
  }