@citolab/qti-components 6.9.1-beta.0 → 6.9.1-beta.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.
@@ -748,6 +748,62 @@
748
748
  "declarations": [],
749
749
  "exports": []
750
750
  },
751
+ {
752
+ "kind": "javascript-module",
753
+ "path": "src/lib/qti-components/qti-assessment-stimulus-ref/qti-assessment-stimulus-ref.ts",
754
+ "declarations": [
755
+ {
756
+ "kind": "class",
757
+ "description": "Represents a custom element for referencing an assessment stimulus.",
758
+ "name": "QtiAssessmentStimulusRef",
759
+ "members": [],
760
+ "attributes": [
761
+ {
762
+ "name": "identifier",
763
+ "type": {
764
+ "text": "string"
765
+ },
766
+ "default": "''",
767
+ "description": "The identifier of the stimulus.",
768
+ "fieldName": "identifier"
769
+ },
770
+ {
771
+ "name": "href",
772
+ "type": {
773
+ "text": "string"
774
+ },
775
+ "default": "''",
776
+ "description": "The href of the stimulus.",
777
+ "fieldName": "href"
778
+ }
779
+ ],
780
+ "superclass": {
781
+ "name": "LitElement",
782
+ "package": "lit"
783
+ },
784
+ "tagName": "qti-assessment-stimulus-ref",
785
+ "customElement": true
786
+ }
787
+ ],
788
+ "exports": [
789
+ {
790
+ "kind": "js",
791
+ "name": "QtiAssessmentStimulusRef",
792
+ "declaration": {
793
+ "name": "QtiAssessmentStimulusRef",
794
+ "module": "src/lib/qti-components/qti-assessment-stimulus-ref/qti-assessment-stimulus-ref.ts"
795
+ }
796
+ },
797
+ {
798
+ "kind": "custom-element-definition",
799
+ "name": "qti-assessment-stimulus-ref",
800
+ "declaration": {
801
+ "name": "QtiAssessmentStimulusRef",
802
+ "module": "src/lib/qti-components/qti-assessment-stimulus-ref/qti-assessment-stimulus-ref.ts"
803
+ }
804
+ }
805
+ ]
806
+ },
751
807
  {
752
808
  "kind": "javascript-module",
753
809
  "path": "src/lib/qti-components/qti-assessment-item/item-print-variables.ts",
@@ -927,62 +983,6 @@
927
983
  }
928
984
  ]
929
985
  },
930
- {
931
- "kind": "javascript-module",
932
- "path": "src/lib/qti-components/qti-assessment-stimulus-ref/qti-assessment-stimulus-ref.ts",
933
- "declarations": [
934
- {
935
- "kind": "class",
936
- "description": "Represents a custom element for referencing an assessment stimulus.",
937
- "name": "QtiAssessmentStimulusRef",
938
- "members": [],
939
- "attributes": [
940
- {
941
- "name": "identifier",
942
- "type": {
943
- "text": "string"
944
- },
945
- "default": "''",
946
- "description": "The identifier of the stimulus.",
947
- "fieldName": "identifier"
948
- },
949
- {
950
- "name": "href",
951
- "type": {
952
- "text": "string"
953
- },
954
- "default": "''",
955
- "description": "The href of the stimulus.",
956
- "fieldName": "href"
957
- }
958
- ],
959
- "superclass": {
960
- "name": "LitElement",
961
- "package": "lit"
962
- },
963
- "tagName": "qti-assessment-stimulus-ref",
964
- "customElement": true
965
- }
966
- ],
967
- "exports": [
968
- {
969
- "kind": "js",
970
- "name": "QtiAssessmentStimulusRef",
971
- "declaration": {
972
- "name": "QtiAssessmentStimulusRef",
973
- "module": "src/lib/qti-components/qti-assessment-stimulus-ref/qti-assessment-stimulus-ref.ts"
974
- }
975
- },
976
- {
977
- "kind": "custom-element-definition",
978
- "name": "qti-assessment-stimulus-ref",
979
- "declaration": {
980
- "name": "QtiAssessmentStimulusRef",
981
- "module": "src/lib/qti-components/qti-assessment-stimulus-ref/qti-assessment-stimulus-ref.ts"
982
- }
983
- }
984
- ]
985
- },
986
986
  {
987
987
  "kind": "javascript-module",
988
988
  "path": "src/lib/qti-components/qti-companion-materials-info/qti-companion-materials-info.ts",
@@ -2933,6 +2933,16 @@
2933
2933
  "tagName": "qti-choice-interaction",
2934
2934
  "customElement": true,
2935
2935
  "events": [
2936
+ {
2937
+ "name": "qti-register-interaction",
2938
+ "type": {
2939
+ "text": "CustomEvent"
2940
+ },
2941
+ "inheritedFrom": {
2942
+ "name": "ChoicesMixin",
2943
+ "module": "src/lib/qti-components/qti-interaction/internal/choices/choices.ts"
2944
+ }
2945
+ },
2936
2946
  {
2937
2947
  "name": "qti-interaction-response",
2938
2948
  "type": {
@@ -3800,6 +3810,16 @@
3800
3810
  }
3801
3811
  ],
3802
3812
  "events": [
3813
+ {
3814
+ "name": "qti-register-interaction",
3815
+ "type": {
3816
+ "text": "CustomEvent"
3817
+ },
3818
+ "inheritedFrom": {
3819
+ "name": "ChoicesMixin",
3820
+ "module": "src/lib/qti-components/qti-interaction/internal/choices/choices.ts"
3821
+ }
3822
+ },
3803
3823
  {
3804
3824
  "name": "qti-interaction-response",
3805
3825
  "type": {
@@ -3899,6 +3919,16 @@
3899
3919
  }
3900
3920
  ],
3901
3921
  "events": [
3922
+ {
3923
+ "name": "qti-register-interaction",
3924
+ "type": {
3925
+ "text": "CustomEvent"
3926
+ },
3927
+ "inheritedFrom": {
3928
+ "name": "ChoicesMixin",
3929
+ "module": "src/lib/qti-components/qti-interaction/internal/choices/choices.ts"
3930
+ }
3931
+ },
3902
3932
  {
3903
3933
  "name": "qti-interaction-response",
3904
3934
  "type": {
@@ -3998,6 +4028,16 @@
3998
4028
  }
3999
4029
  ],
4000
4030
  "events": [
4031
+ {
4032
+ "name": "qti-register-interaction",
4033
+ "type": {
4034
+ "text": "CustomEvent"
4035
+ },
4036
+ "inheritedFrom": {
4037
+ "name": "ChoicesMixin",
4038
+ "module": "src/lib/qti-components/qti-interaction/internal/choices/choices.ts"
4039
+ }
4040
+ },
4001
4041
  {
4002
4042
  "name": "qti-interaction-response",
4003
4043
  "type": {
@@ -5890,6 +5930,12 @@
5890
5930
  "name": "ChoicesMixin",
5891
5931
  "members": [],
5892
5932
  "events": [
5933
+ {
5934
+ "name": "qti-register-interaction",
5935
+ "type": {
5936
+ "text": "CustomEvent"
5937
+ }
5938
+ },
5893
5939
  {
5894
5940
  "name": "qti-interaction-response",
5895
5941
  "type": {
package/dist/index.js CHANGED
@@ -112,7 +112,7 @@ var Nr=Object.defineProperty,Ms=Object.defineProperties,Ls=Object.getOwnProperty
112
112
  ?readonly="${this.readonly}"
113
113
  />
114
114
  <div part="correct">${this._correctValue}</div>
115
- `}textChanged(e){if(this.disabled||this.readonly)return;let r=e.target;this.setEmptyAttribute(r.value),this._value!==r.value&&(this._value=r.value,this.saveResponse(r.value))}reset(){this._value=""}setEmptyAttribute(e){this.setAttribute("empty",e===""?"true":"false")}};l([d({type:Number,attribute:"expected-length"})],N.prototype,"expectedLength",2),l([d({type:String,attribute:"pattern-mask"})],N.prototype,"patternMask",2),l([d({type:String,attribute:"placeholder-text"})],N.prototype,"placeholderText",2),l([E()],N.prototype,"_value",2),l([E()],N.prototype,"_correctValue",2),l([E()],N.prototype,"_size",2),l([d({type:String,attribute:"class"})],N.prototype,"classNames",2),l([S("classNames")],N.prototype,"handleclassNamesChange",1),N=l([m("qti-text-entry-interaction")],N);var ne=(i,t)=>{class e extends i{constructor(...o){super(...o);this._choiceElements=[];this.responseIdentifier="";this.minChoices=0;this.maxChoices=1;this._handleDisabledChange=(o,n)=>this._choiceElements.forEach(a=>a.disabled=n);this._handleReadonlyChange=(o,n)=>this._choiceElements.forEach(a=>a.readonly=n);this._handleMaxChoicesChange=()=>this._determineInputType();this.addEventListener("qti-register-choice",this._registerChoiceElement),this.addEventListener("qti-loose-choice",this._looseChoiceElement)}validate(){return this._choiceElements.reduce((n,a)=>n+(a.checked?1:0),0)>=this.minChoices}set response(o){let n=Array.isArray(o)?o:[o];this._choiceElements.forEach(a=>{a.checked=!!n.find(c=>c===a.identifier)})}set correctResponse(o){let n=Array.isArray(o)?o:[o];if(o==""){this._choiceElements.forEach(a=>{a.removeAttribute("data-correct-response")});return}this._choiceElements.forEach(a=>{a.setAttribute("data-correct-response",n.find(c=>c===a.identifier)?"true":"false")})}connectedCallback(){super.connectedCallback(),this.addEventListener("qti-register-choice",this._registerChoiceElement),this.addEventListener("qti-choice-element-selected",this._choiceElementSelectedHandler)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-choice-element-selected",this._choiceElementSelectedHandler),this.removeEventListener("qti-register-choice",this._registerChoiceElement)}_registerChoiceElement(o){o.stopPropagation();let n=o.target;this._choiceElements.push(n),this._setInputType(n)}_looseChoiceElement(o){o.stopPropagation();let n=o.target;this._choiceElements.push(n),this._choiceElements=this._choiceElements.filter(a=>a!==n)}_determineInputType(){this._choiceElements.forEach(o=>{this._setInputType(o)})}_setInputType(o){this.maxChoices===1?o.setAttribute("role","radio"):o.setAttribute("role","checkbox")}_choiceElementSelectedHandler(o){this.maxChoices===1&&this._choiceElements.filter(n=>n.identifier!==o.detail.identifier).forEach(n=>{n.checked=!1}),this._choiceElementSelected()}_choiceElementSelected(){let o=this._choiceElements.filter(a=>a.checked).map(a=>a.identifier);this.maxChoices>1&&(this.maxChoices===o.length?this._choiceElements.forEach(a=>a.disabled=!a.checked):this._choiceElements.forEach(a=>a.disabled=!1));let n;this.maxChoices===1?n=o.length>0?o[0]:void 0:n=o,this.saveResponse(n)}saveResponse(o){this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:o}}))}}return l([d({attribute:"response-identifier"})],e.prototype,"responseIdentifier",2),l([d({type:Number,attribute:"min-choices"})],e.prototype,"minChoices",2),l([d({type:Number,attribute:"max-choices"})],e.prototype,"maxChoices",2),l([S("disabled",{waitUntilFirstUpdate:!0})],e.prototype,"_handleDisabledChange",2),l([S("readonly",{waitUntilFirstUpdate:!0})],e.prototype,"_handleReadonlyChange",2),l([S("maxChoices",{waitUntilFirstUpdate:!0})],e.prototype,"_handleMaxChoicesChange",2),e};var Mt=class extends ne(f,"qti-hottext"){constructor(){super(...arguments);this.render=()=>u`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.setAttribute("qti-hottext-interaction","")}};Mt=l([m("qti-hottext-interaction")],Mt);var Je=class extends B{constructor(t){if(super(t),this.it=_,t.type!==oe.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===_||t==null)return this._t=void 0,this.it=t;if(t===M)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;let e=[t];return e.raw=e,this._t={_$litType$:this.constructor.resultType,strings:e,values:[]}}};Je.directiveName="unsafeHTML",Je.resultType=1;var ae=Q(Je);var le=class extends A{constructor(){super(...arguments);this.options=[];this.correctOption="";this.dataPrompt="select"}static get styles(){return[b`
115
+ `}textChanged(e){if(this.disabled||this.readonly)return;let r=e.target;this.setEmptyAttribute(r.value),this._value!==r.value&&(this._value=r.value,this.saveResponse(r.value))}reset(){this._value=""}setEmptyAttribute(e){this.setAttribute("empty",e===""?"true":"false")}};l([d({type:Number,attribute:"expected-length"})],N.prototype,"expectedLength",2),l([d({type:String,attribute:"pattern-mask"})],N.prototype,"patternMask",2),l([d({type:String,attribute:"placeholder-text"})],N.prototype,"placeholderText",2),l([E()],N.prototype,"_value",2),l([E()],N.prototype,"_correctValue",2),l([E()],N.prototype,"_size",2),l([d({type:String,attribute:"class"})],N.prototype,"classNames",2),l([S("classNames")],N.prototype,"handleclassNamesChange",1),N=l([m("qti-text-entry-interaction")],N);var ne=(i,t)=>{class e extends i{constructor(...o){super(...o);this._choiceElements=[];this.responseIdentifier="";this.minChoices=0;this.maxChoices=1;this._handleDisabledChange=(o,n)=>this._choiceElements.forEach(a=>a.disabled=n);this._handleReadonlyChange=(o,n)=>this._choiceElements.forEach(a=>a.readonly=n);this._handleMaxChoicesChange=()=>this._determineInputType();this.addEventListener("qti-register-choice",this._registerChoiceElement),this.addEventListener("qti-loose-choice",this._looseChoiceElement)}validate(){return this._choiceElements.reduce((n,a)=>n+(a.checked?1:0),0)>=this.minChoices}set response(o){let n=Array.isArray(o)?o:[o];this._choiceElements.forEach(a=>{a.checked=!!n.find(c=>c===a.identifier)})}set correctResponse(o){let n=Array.isArray(o)?o:[o];if(o==""){this._choiceElements.forEach(a=>{a.removeAttribute("data-correct-response")});return}this._choiceElements.forEach(a=>{a.setAttribute("data-correct-response",n.find(c=>c===a.identifier)?"true":"false")})}connectedCallback(){super.connectedCallback(),this.addEventListener("qti-register-choice",this._registerChoiceElement),this.addEventListener("qti-choice-element-selected",this._choiceElementSelectedHandler),this.dispatchEvent(new CustomEvent("qti-register-interaction",{bubbles:!0,cancelable:!1,composed:!0}))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-choice-element-selected",this._choiceElementSelectedHandler),this.removeEventListener("qti-register-choice",this._registerChoiceElement)}_registerChoiceElement(o){o.stopPropagation();let n=o.target;this._choiceElements.push(n),this._setInputType(n)}_looseChoiceElement(o){o.stopPropagation();let n=o.target;this._choiceElements.push(n),this._choiceElements=this._choiceElements.filter(a=>a!==n)}_determineInputType(){this._choiceElements.forEach(o=>{this._setInputType(o)})}_setInputType(o){this.maxChoices===1?o.setAttribute("role","radio"):o.setAttribute("role","checkbox")}_choiceElementSelectedHandler(o){this.maxChoices===1&&this._choiceElements.filter(n=>n.identifier!==o.detail.identifier).forEach(n=>{n.checked=!1}),this._choiceElementSelected()}_choiceElementSelected(){let o=this._choiceElements.filter(a=>a.checked).map(a=>a.identifier);this.maxChoices>1&&(this.maxChoices===o.length?this._choiceElements.forEach(a=>a.disabled=!a.checked):this._choiceElements.forEach(a=>a.disabled=!1));let n;this.maxChoices===1?n=o.length>0?o[0]:void 0:n=o,this.saveResponse(n)}saveResponse(o){this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:o}}))}}return l([d({attribute:"response-identifier"})],e.prototype,"responseIdentifier",2),l([d({type:Number,attribute:"min-choices"})],e.prototype,"minChoices",2),l([d({type:Number,attribute:"max-choices"})],e.prototype,"maxChoices",2),l([S("disabled",{waitUntilFirstUpdate:!0})],e.prototype,"_handleDisabledChange",2),l([S("readonly",{waitUntilFirstUpdate:!0})],e.prototype,"_handleReadonlyChange",2),l([S("maxChoices",{waitUntilFirstUpdate:!0})],e.prototype,"_handleMaxChoicesChange",2),e};var Mt=class extends ne(f,"qti-hottext"){constructor(){super(...arguments);this.render=()=>u`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.setAttribute("qti-hottext-interaction","")}};Mt=l([m("qti-hottext-interaction")],Mt);var Je=class extends B{constructor(t){if(super(t),this.it=_,t.type!==oe.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===_||t==null)return this._t=void 0,this.it=t;if(t===M)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;let e=[t];return e.raw=e,this._t={_$litType$:this.constructor.resultType,strings:e,values:[]}}};Je.directiveName="unsafeHTML",Je.resultType=1;var ae=Q(Je);var le=class extends A{constructor(){super(...arguments);this.options=[];this.correctOption="";this.dataPrompt="select"}static get styles(){return[b`
116
116
  :host {
117
117
  display: inline-block;
118
118
  }