@citolab/qti-components 3.0.47 → 3.0.48
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/index.js +2 -1
- package/index.umd.js +2 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -340,7 +340,8 @@ import{LitElement as e,html as t,css as s,render as i}from"lit";import{customEle
|
|
|
340
340
|
width: 1024px !important;
|
|
341
341
|
transform-origin: 0 0;
|
|
342
342
|
}
|
|
343
|
-
`,C([r({type:Boolean,reflect:!0}),O("design:type",Object)],ot.prototype,"disabled",void 0),C([R("disabled",{waitUntilFirstUpdate:!0}),O("design:type",Function),O("design:paramtypes",[Object,Boolean]),O("design:returntype",void 0)],ot.prototype,"handleDisabledChange",null),C([r({type:Boolean,reflect:!0}),O("design:type",Object)],ot.prototype,"readonly",void 0),C([R("readonly",{waitUntilFirstUpdate:!0}),O("design:type",Function),O("design:paramtypes",[Object,Boolean]),O("design:returntype",void 0)],ot.prototype,"handleReadonlyChange",null),C([r({type:Object,reflect:!0}),O("design:type",Object)],ot.prototype,"responses",void 0),C([R("responses",{waitUntilFirstUpdate:!0}),O("design:type",Function),O("design:paramtypes",[Object,Object]),O("design:returntype",void 0)],ot.prototype,"handleResponsesChange",null),C([a(),O("design:type",_)],ot.prototype,"_item",void 0),customElements.define("qti-item",ot);const at=e=>{let t=e;const s=e=>{const s=(new DOMParser).parseFromString(t,"text/xml"),i=new XSLTProcessor,n=(new DOMParser).parseFromString(e,"text/xml");i.importStylesheet(n);const r=i.transformToFragment(s,document);t=(new XMLSerializer).serializeToString(r)},i={mathml:()=>(s(""),i),removeNamesSpaces:()=>(s('\n <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\n <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>\n <xsl:template match="*">\n \x3c!-- remove element prefix --\x3e\n <xsl:element name="{local-name()}">\n \x3c!-- process attributes --\x3e\n <xsl:for-each select="@*">\n \x3c!-- remove attribute prefix --\x3e\n <xsl:attribute name="{local-name()}">\n <xsl:value-of select="."/>\n </xsl:attribute>\n </xsl:for-each>\n <xsl:apply-templates/>\n </xsl:element>\n </xsl:template>\n</xsl:stylesheet>'),i),pciHooks(e){const s=["hook","module"],n=e.substring(0,e.lastIndexOf("/")),r=(new DOMParser).parseFromString(t,"text/xml");for(const t of s){r.querySelectorAll("["+t+"]").forEach((s=>{const i=s.getAttribute(t);i.startsWith("data:")||i.startsWith("http")||(s.setAttribute("base-url",e),s.setAttribute("module",n+"/"+encodeURIComponent(i+(i.endsWith(".js")?"":".js"))))}))}return t=(new XMLSerializer).serializeToString(r),i},assetsLocation(e,s=["src","href","data"]){const n=e.substring(0,e.lastIndexOf("/")),r=(new DOMParser).parseFromString(t,"text/xml");for(const e of s){r.querySelectorAll("["+e+"]").forEach((t=>{const s=t.getAttribute(e);s.startsWith("data:")||s.startsWith("http")||t.setAttribute(e,n+"/"+encodeURIComponent(s))}))}return t=(new XMLSerializer).serializeToString(r),i},customTypes:()=>(s('<?xml version="1.0" encoding="utf-8"?>\n <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:qti="http://www.imsglobal.org/xsd/imsqti_v2p1" xmlns:m="http://www.w3.org/1998/Math/MathML">\n <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>\t \n <xsl:param name="separator" select="\' \'" />\n <xsl:param name="prefix" select="\'type:\'" />\n <xsl:variable name="prefixElements"></xsl:variable>\n <xsl:variable name="suffixElements"></xsl:variable>\n \x3c!-- passthrough --\x3e\n <xsl:template match="*">\n <xsl:copy>\n <xsl:apply-templates select="* | @* | text()" />\n </xsl:copy>\n </xsl:template>\n <xsl:template match="@* | text()">\n <xsl:copy-of select="." />\n </xsl:template>\n \n <xsl:template match="*">\n <xsl:variable name="elementName">\n <xsl:call-template name="getTypedElementName">\n <xsl:with-param name="input" select="." />\n </xsl:call-template>\n </xsl:variable>\n <xsl:element name="{$elementName}">\n <xsl:apply-templates select="* | @* | text()" />\n </xsl:element>\n </xsl:template>\n \n \x3c!-- custom names --\x3e\n <xsl:template name="getType">\n <xsl:param name="input" />\n <xsl:param name="separator" select="$separator" />\n <xsl:param name="prefix" select="$prefix" />\n <xsl:variable name="output">\n <xsl:choose>\n <xsl:when test="contains($input, $separator)">\n <xsl:value-of select="substring-before($input, $separator)" />\n </xsl:when>\n <xsl:otherwise>\n <xsl:value-of select="$input" />\n </xsl:otherwise>\n </xsl:choose>\n </xsl:variable>\n <xsl:choose>\n <xsl:when test="starts-with($output, $prefix) and $output != $prefix">\n <xsl:value-of select="substring-after($output, $prefix)" />\n </xsl:when>\n <xsl:otherwise>\n <xsl:variable name="after" select="substring-after($input, $separator)" />\n <xsl:if test="$after">\n <xsl:call-template name="getType">\n <xsl:with-param name="input" select="$after" />\n <xsl:with-param name="separator" select="$separator" />\n <xsl:with-param name="prefix" select="$prefix" />\n </xsl:call-template>\n </xsl:if>\n </xsl:otherwise>\n </xsl:choose>\n </xsl:template>\n \n <xsl:template name="getTypedElementName">\n <xsl:param name="input" />\n <xsl:variable name="prefixElements" select="document(\'\')//xsl:variable[@name = \'prefixElements\']/element" />\n <xsl:variable name="suffixElements" select="document(\'\')//xsl:variable[@name = \'suffixElements\']/element" />\n <xsl:variable name="originalName" select="name($input)" />\n <xsl:variable name="type">\n <xsl:call-template name="getType">\n <xsl:with-param name="input" select="$input/@class" />\n </xsl:call-template>\n </xsl:variable>\n <xsl:value-of select="$originalName" />\n \x3c!-- Add prefix elements --\x3e\n <xsl:if test="$prefixElements[text() = $originalName]">\n <xsl:text>-</xsl:text>\n </xsl:if>\n \x3c!-- Add suffix to typed elements --\x3e\n <xsl:if test="string-length($type)">\n <xsl:text>-</xsl:text>\n <xsl:value-of select="$type" />\n </xsl:if>\n \x3c!-- Add suffix to elements --\x3e\n <xsl:if test="$suffixElements[text() = $originalName]">\n <xsl:text>-</xsl:text>\n </xsl:if>\n </xsl:template>\n </xsl:stylesheet>'),i),suffix:(e,s)=>(e.forEach((e=>{t=t.replaceAll(e,e+"-"+s)})),i),prefix:(e,s)=>(e.forEach((e=>{t=t.replaceAll(e,s+"-"+e)})),i),fn:e=>(t=e(t),i),elementNameAttributes:e=>(e.forEach((e=>{t=t.replaceAll(e,e+` data-element="${e}" `)})),i),print:()=>(console.log(t),i),xml:()=>(t=lt(t),t)};return i},lt=e=>{const t=e.split("/>");let s="";for(let e=0;e<t.length-1;e++){const i=t[e].split("<");s+=t[e]+"></"+i[i.length-1].split(" ")[0]+">"}return s+t[t.length-1]};let ct=class extends x{constructor(){super(...arguments),this.logger=new d(this,M,(e=>this.style.display="scorer"===e.view?"block":"none"),!0)}textChanged(e){if(this.disabled||this.readonly)return;const t=e.target;this.value=t.value;this.
|
|
343
|
+
`,C([r({type:Boolean,reflect:!0}),O("design:type",Object)],ot.prototype,"disabled",void 0),C([R("disabled",{waitUntilFirstUpdate:!0}),O("design:type",Function),O("design:paramtypes",[Object,Boolean]),O("design:returntype",void 0)],ot.prototype,"handleDisabledChange",null),C([r({type:Boolean,reflect:!0}),O("design:type",Object)],ot.prototype,"readonly",void 0),C([R("readonly",{waitUntilFirstUpdate:!0}),O("design:type",Function),O("design:paramtypes",[Object,Boolean]),O("design:returntype",void 0)],ot.prototype,"handleReadonlyChange",null),C([r({type:Object,reflect:!0}),O("design:type",Object)],ot.prototype,"responses",void 0),C([R("responses",{waitUntilFirstUpdate:!0}),O("design:type",Function),O("design:paramtypes",[Object,Object]),O("design:returntype",void 0)],ot.prototype,"handleResponsesChange",null),C([a(),O("design:type",_)],ot.prototype,"_item",void 0),customElements.define("qti-item",ot);const at=e=>{let t=e;const s=e=>{const s=(new DOMParser).parseFromString(t,"text/xml"),i=new XSLTProcessor,n=(new DOMParser).parseFromString(e,"text/xml");i.importStylesheet(n);const r=i.transformToFragment(s,document);t=(new XMLSerializer).serializeToString(r)},i={mathml:()=>(s(""),i),removeNamesSpaces:()=>(s('\n <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\n <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>\n <xsl:template match="*">\n \x3c!-- remove element prefix --\x3e\n <xsl:element name="{local-name()}">\n \x3c!-- process attributes --\x3e\n <xsl:for-each select="@*">\n \x3c!-- remove attribute prefix --\x3e\n <xsl:attribute name="{local-name()}">\n <xsl:value-of select="."/>\n </xsl:attribute>\n </xsl:for-each>\n <xsl:apply-templates/>\n </xsl:element>\n </xsl:template>\n</xsl:stylesheet>'),i),pciHooks(e){const s=["hook","module"],n=e.substring(0,e.lastIndexOf("/")),r=(new DOMParser).parseFromString(t,"text/xml");for(const t of s){r.querySelectorAll("["+t+"]").forEach((s=>{const i=s.getAttribute(t);i.startsWith("data:")||i.startsWith("http")||(s.setAttribute("base-url",e),s.setAttribute("module",n+"/"+encodeURIComponent(i+(i.endsWith(".js")?"":".js"))))}))}return t=(new XMLSerializer).serializeToString(r),i},assetsLocation(e,s=["src","href","data"]){const n=e.substring(0,e.lastIndexOf("/")),r=(new DOMParser).parseFromString(t,"text/xml");for(const e of s){r.querySelectorAll("["+e+"]").forEach((t=>{const s=t.getAttribute(e);s.startsWith("data:")||s.startsWith("http")||t.setAttribute(e,n+"/"+encodeURIComponent(s))}))}return t=(new XMLSerializer).serializeToString(r),i},customTypes:()=>(s('<?xml version="1.0" encoding="utf-8"?>\n <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:qti="http://www.imsglobal.org/xsd/imsqti_v2p1" xmlns:m="http://www.w3.org/1998/Math/MathML">\n <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>\t \n <xsl:param name="separator" select="\' \'" />\n <xsl:param name="prefix" select="\'type:\'" />\n <xsl:variable name="prefixElements"></xsl:variable>\n <xsl:variable name="suffixElements"></xsl:variable>\n \x3c!-- passthrough --\x3e\n <xsl:template match="*">\n <xsl:copy>\n <xsl:apply-templates select="* | @* | text()" />\n </xsl:copy>\n </xsl:template>\n <xsl:template match="@* | text()">\n <xsl:copy-of select="." />\n </xsl:template>\n \n <xsl:template match="*">\n <xsl:variable name="elementName">\n <xsl:call-template name="getTypedElementName">\n <xsl:with-param name="input" select="." />\n </xsl:call-template>\n </xsl:variable>\n <xsl:element name="{$elementName}">\n <xsl:apply-templates select="* | @* | text()" />\n </xsl:element>\n </xsl:template>\n \n \x3c!-- custom names --\x3e\n <xsl:template name="getType">\n <xsl:param name="input" />\n <xsl:param name="separator" select="$separator" />\n <xsl:param name="prefix" select="$prefix" />\n <xsl:variable name="output">\n <xsl:choose>\n <xsl:when test="contains($input, $separator)">\n <xsl:value-of select="substring-before($input, $separator)" />\n </xsl:when>\n <xsl:otherwise>\n <xsl:value-of select="$input" />\n </xsl:otherwise>\n </xsl:choose>\n </xsl:variable>\n <xsl:choose>\n <xsl:when test="starts-with($output, $prefix) and $output != $prefix">\n <xsl:value-of select="substring-after($output, $prefix)" />\n </xsl:when>\n <xsl:otherwise>\n <xsl:variable name="after" select="substring-after($input, $separator)" />\n <xsl:if test="$after">\n <xsl:call-template name="getType">\n <xsl:with-param name="input" select="$after" />\n <xsl:with-param name="separator" select="$separator" />\n <xsl:with-param name="prefix" select="$prefix" />\n </xsl:call-template>\n </xsl:if>\n </xsl:otherwise>\n </xsl:choose>\n </xsl:template>\n \n <xsl:template name="getTypedElementName">\n <xsl:param name="input" />\n <xsl:variable name="prefixElements" select="document(\'\')//xsl:variable[@name = \'prefixElements\']/element" />\n <xsl:variable name="suffixElements" select="document(\'\')//xsl:variable[@name = \'suffixElements\']/element" />\n <xsl:variable name="originalName" select="name($input)" />\n <xsl:variable name="type">\n <xsl:call-template name="getType">\n <xsl:with-param name="input" select="$input/@class" />\n </xsl:call-template>\n </xsl:variable>\n <xsl:value-of select="$originalName" />\n \x3c!-- Add prefix elements --\x3e\n <xsl:if test="$prefixElements[text() = $originalName]">\n <xsl:text>-</xsl:text>\n </xsl:if>\n \x3c!-- Add suffix to typed elements --\x3e\n <xsl:if test="string-length($type)">\n <xsl:text>-</xsl:text>\n <xsl:value-of select="$type" />\n </xsl:if>\n \x3c!-- Add suffix to elements --\x3e\n <xsl:if test="$suffixElements[text() = $originalName]">\n <xsl:text>-</xsl:text>\n </xsl:if>\n </xsl:template>\n </xsl:stylesheet>'),i),suffix:(e,s)=>(e.forEach((e=>{t=t.replaceAll(e,e+"-"+s)})),i),prefix:(e,s)=>(e.forEach((e=>{t=t.replaceAll(e,s+"-"+e)})),i),fn:e=>(t=e(t),i),elementNameAttributes:e=>(e.forEach((e=>{t=t.replaceAll(e,e+` data-element="${e}" `)})),i),print:()=>(console.log(t),i),xml:()=>(t=lt(t),t)};return i},lt=e=>{const t=e.split("/>");let s="";for(let e=0;e<t.length-1;e++){const i=t[e].split("<");s+=t[e]+"></"+i[i.length-1].split(" ")[0]+">"}return s+t[t.length-1]};let ct=class extends x{constructor(){super(...arguments),this.logger=new d(this,M,(e=>this.style.display="scorer"===e.view?"block":"none"),!0)}textChanged(e){if(this.disabled||this.readonly)return;const t=e.target;this.value=t.value;this.closest("qti-test").querySelector("qti-assessment-item").setOutcomeValue("SCORE",this.value)}render(){return t`<input
|
|
344
|
+
part="input"
|
|
344
345
|
type="number"
|
|
345
346
|
spellcheck="false"
|
|
346
347
|
autocomplete="off"
|
package/index.umd.js
CHANGED
|
@@ -452,7 +452,8 @@ const Be=2;
|
|
|
452
452
|
width: 1024px !important;
|
|
453
453
|
transform-origin: 0 0;
|
|
454
454
|
}
|
|
455
|
-
`,he([ge({type:Boolean,reflect:!0}),pe("design:type",Object)],us.prototype,"disabled",void 0),he([Se("disabled",{waitUntilFirstUpdate:!0}),pe("design:type",Function),pe("design:paramtypes",[Object,Boolean]),pe("design:returntype",void 0)],us.prototype,"handleDisabledChange",null),he([ge({type:Boolean,reflect:!0}),pe("design:type",Object)],us.prototype,"readonly",void 0),he([Se("readonly",{waitUntilFirstUpdate:!0}),pe("design:type",Function),pe("design:paramtypes",[Object,Boolean]),pe("design:returntype",void 0)],us.prototype,"handleReadonlyChange",null),he([ge({type:Object,reflect:!0}),pe("design:type",Object)],us.prototype,"responses",void 0),he([Se("responses",{waitUntilFirstUpdate:!0}),pe("design:type",Function),pe("design:paramtypes",[Object,Object]),pe("design:returntype",void 0)],us.prototype,"handleResponsesChange",null),he([be(),pe("design:type",ce)],us.prototype,"_item",void 0),customElements.define("qti-item",us);const ms=e=>{const t=e.split("/>");let s="";for(let e=0;e<t.length-1;e++){const i=t[e].split("<");s+=t[e]+"></"+i[i.length-1].split(" ")[0]+">"}return s+t[t.length-1]};e.QtiManualScoring=class extends le{constructor(){super(...arguments),this.logger=new Re(this,Me,(e=>this.style.display="scorer"===e.view?"block":"none"),!0)}textChanged(e){if(this.disabled||this.readonly)return;const t=e.target;this.value=t.value;this.
|
|
455
|
+
`,he([ge({type:Boolean,reflect:!0}),pe("design:type",Object)],us.prototype,"disabled",void 0),he([Se("disabled",{waitUntilFirstUpdate:!0}),pe("design:type",Function),pe("design:paramtypes",[Object,Boolean]),pe("design:returntype",void 0)],us.prototype,"handleDisabledChange",null),he([ge({type:Boolean,reflect:!0}),pe("design:type",Object)],us.prototype,"readonly",void 0),he([Se("readonly",{waitUntilFirstUpdate:!0}),pe("design:type",Function),pe("design:paramtypes",[Object,Boolean]),pe("design:returntype",void 0)],us.prototype,"handleReadonlyChange",null),he([ge({type:Object,reflect:!0}),pe("design:type",Object)],us.prototype,"responses",void 0),he([Se("responses",{waitUntilFirstUpdate:!0}),pe("design:type",Function),pe("design:paramtypes",[Object,Object]),pe("design:returntype",void 0)],us.prototype,"handleResponsesChange",null),he([be(),pe("design:type",ce)],us.prototype,"_item",void 0),customElements.define("qti-item",us);const ms=e=>{const t=e.split("/>");let s="";for(let e=0;e<t.length-1;e++){const i=t[e].split("<");s+=t[e]+"></"+i[i.length-1].split(" ")[0]+">"}return s+t[t.length-1]};e.QtiManualScoring=class extends le{constructor(){super(...arguments),this.logger=new Re(this,Me,(e=>this.style.display="scorer"===e.view?"block":"none"),!0)}textChanged(e){if(this.disabled||this.readonly)return;const t=e.target;this.value=t.value;this.closest("qti-test").querySelector("qti-assessment-item").setOutcomeValue("SCORE",this.value)}render(){return U`<input
|
|
456
|
+
part="input"
|
|
456
457
|
type="number"
|
|
457
458
|
spellcheck="false"
|
|
458
459
|
autocomplete="off"
|