@citolab/qti-components 6.0.3-9 → 6.0.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/LICENSE +674 -21
- package/dist/ExpressionResult-b1ac7b27.d.ts +23 -0
- package/dist/chunk-7KH3TY23.js +18 -0
- package/dist/chunk-7LF4QM4D.js +17 -0
- package/dist/chunk-M3YT56HW.js +1437 -0
- package/dist/{chunk-XN7FAHIO.js → chunk-MYPYIYN5.js} +28 -344
- package/dist/custom-elements.json +2083 -1292
- package/dist/index.css +1 -0
- package/dist/index.js +191 -2360
- package/dist/{qti-assessment-item-a65f152b.d.ts → qti-assessment-item-219cef9e.d.ts} +2 -19
- package/dist/qti-components/index.d.ts +156 -72
- package/dist/qti-components/index.js +77 -142
- package/dist/qti-components.js +13502 -0
- package/dist/qti-item/index.css +1 -0
- package/dist/qti-item/index.d.ts +9 -10
- package/dist/qti-item/index.js +1 -1
- package/dist/qti-item-react/index.css +1 -0
- package/dist/qti-item-react/index.d.ts +4 -6
- package/dist/qti-item-react/index.js +1 -1
- package/dist/{qti-simple-choice-4df32b16.d.ts → qti-rule-5fe4f91e.d.ts} +25 -74
- package/dist/{qti-simple-choice-24c4c8e9.d.ts → qti-rule-e2aee685.d.ts} +31 -31
- package/dist/qti-transform/index.d.ts +2 -1
- package/dist/qti-transform/index.js +87 -2
- package/dist/themes/qti.css +261 -737
- package/dist/vite.svg +1 -0
- package/package.json +10 -4
- package/readme.md +88 -66
- package/dist/chunk-CTF6QUBO.js +0 -2211
- package/dist/chunk-N4ENDK7Q.js +0 -2211
- package/dist/chunk-NG425SE2.js +0 -2178
- package/dist/qti-assessment-item-f1fcf393.d.ts +0 -120
- package/dist/qti-simple-choice-988808a2.d.ts +0 -352
- package/dist/vscode.html-custom-data.json +0 -775
|
@@ -1,4 +1,89 @@
|
|
|
1
|
-
import"../chunk-NMCIOGD2.js";import*as
|
|
1
|
+
import"../chunk-NMCIOGD2.js";import*as p from"cheerio";var u=(x="type")=>`<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<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">
|
|
3
|
+
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
|
|
4
|
+
<xsl:param name="separator" select="' '" />
|
|
5
|
+
<xsl:param name="prefix" select="'type:'" />
|
|
6
|
+
<xsl:variable name="prefixElements"></xsl:variable>
|
|
7
|
+
<xsl:variable name="suffixElements"></xsl:variable>
|
|
8
|
+
<!-- passthrough -->
|
|
9
|
+
<xsl:template match="*">
|
|
10
|
+
<xsl:copy>
|
|
11
|
+
<xsl:apply-templates select="* | @* | text()" />
|
|
12
|
+
</xsl:copy>
|
|
13
|
+
</xsl:template>
|
|
14
|
+
<xsl:template match="@* | text()">
|
|
15
|
+
<xsl:copy-of select="." />
|
|
16
|
+
</xsl:template>
|
|
17
|
+
|
|
18
|
+
<xsl:template match="*">
|
|
19
|
+
<xsl:variable name="elementName">
|
|
20
|
+
<xsl:call-template name="getTypedElementName">
|
|
21
|
+
<xsl:with-param name="input" select="." />
|
|
22
|
+
</xsl:call-template>
|
|
23
|
+
</xsl:variable>
|
|
24
|
+
<xsl:element name="{$elementName}">
|
|
25
|
+
<xsl:apply-templates select="* | @* | text()" />
|
|
26
|
+
</xsl:element>
|
|
27
|
+
</xsl:template>
|
|
28
|
+
|
|
29
|
+
<!-- custom names -->
|
|
30
|
+
<xsl:template name="getType">
|
|
31
|
+
<xsl:param name="input" />
|
|
32
|
+
<xsl:param name="separator" select="$separator" />
|
|
33
|
+
<xsl:param name="prefix" select="$prefix" />
|
|
34
|
+
<xsl:variable name="output">
|
|
35
|
+
<xsl:choose>
|
|
36
|
+
<xsl:when test="contains($input, $separator)">
|
|
37
|
+
<xsl:value-of select="substring-before($input, $separator)" />
|
|
38
|
+
</xsl:when>
|
|
39
|
+
<xsl:otherwise>
|
|
40
|
+
<xsl:value-of select="$input" />
|
|
41
|
+
</xsl:otherwise>
|
|
42
|
+
</xsl:choose>
|
|
43
|
+
</xsl:variable>
|
|
44
|
+
<xsl:choose>
|
|
45
|
+
<xsl:when test="starts-with($output, $prefix) and $output != $prefix">
|
|
46
|
+
<xsl:value-of select="substring-after($output, $prefix)" />
|
|
47
|
+
</xsl:when>
|
|
48
|
+
<xsl:otherwise>
|
|
49
|
+
<xsl:variable name="after" select="substring-after($input, $separator)" />
|
|
50
|
+
<xsl:if test="$after">
|
|
51
|
+
<xsl:call-template name="getType">
|
|
52
|
+
<xsl:with-param name="input" select="$after" />
|
|
53
|
+
<xsl:with-param name="separator" select="$separator" />
|
|
54
|
+
<xsl:with-param name="prefix" select="$prefix" />
|
|
55
|
+
</xsl:call-template>
|
|
56
|
+
</xsl:if>
|
|
57
|
+
</xsl:otherwise>
|
|
58
|
+
</xsl:choose>
|
|
59
|
+
</xsl:template>
|
|
60
|
+
|
|
61
|
+
<xsl:template name="getTypedElementName">
|
|
62
|
+
<xsl:param name="input" />
|
|
63
|
+
<xsl:variable name="prefixElements" select="document('')//xsl:variable[@name = 'prefixElements']/element" />
|
|
64
|
+
<xsl:variable name="suffixElements" select="document('')//xsl:variable[@name = 'suffixElements']/element" />
|
|
65
|
+
<xsl:variable name="originalName" select="name($input)" />
|
|
66
|
+
<xsl:variable name="type">
|
|
67
|
+
<xsl:call-template name="getType">
|
|
68
|
+
<xsl:with-param name="input" select="$input/@class" />
|
|
69
|
+
</xsl:call-template>
|
|
70
|
+
</xsl:variable>
|
|
71
|
+
<xsl:value-of select="$originalName" />
|
|
72
|
+
<!-- Add prefix elements -->
|
|
73
|
+
<xsl:if test="$prefixElements[text() = $originalName]">
|
|
74
|
+
<xsl:text>-</xsl:text>
|
|
75
|
+
</xsl:if>
|
|
76
|
+
<!-- Add suffix to typed elements -->
|
|
77
|
+
<xsl:if test="string-length($type)">
|
|
78
|
+
<xsl:text>-</xsl:text>
|
|
79
|
+
<xsl:value-of select="$type" />
|
|
80
|
+
</xsl:if>
|
|
81
|
+
<!-- Add suffix to elements -->
|
|
82
|
+
<xsl:if test="$suffixElements[text() = $originalName]">
|
|
83
|
+
<xsl:text>-</xsl:text>
|
|
84
|
+
</xsl:if>
|
|
85
|
+
</xsl:template>
|
|
86
|
+
</xsl:stylesheet>`,f=`
|
|
2
87
|
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
|
3
88
|
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
|
|
4
89
|
<xsl:template match="*">
|
|
@@ -14,4 +99,4 @@ import"../chunk-NMCIOGD2.js";import*as u from"cheerio";var g=`
|
|
|
14
99
|
<xsl:apply-templates/>
|
|
15
100
|
</xsl:element>
|
|
16
101
|
</xsl:template>
|
|
17
|
-
</xsl:stylesheet>`,
|
|
102
|
+
</xsl:stylesheet>`,b=x=>{let e=x,i=t=>{let l=new DOMParser().parseFromString(e,"text/xml"),a=new XSLTProcessor,n=new DOMParser().parseFromString(t,"text/xml");a.importStylesheet(n);let r=a.transformToFragment(l,document);e=new XMLSerializer().serializeToString(r)},s={mathml(){let t=p.load(e,{xmlMode:!0,xml:!0});return t("math").each((l,a)=>{a.tagName="math-ml"}).find("*").each((l,a)=>{a.tagName=`math-${a.tagName.substring(1)}`}),e=t.xml(),s},removeNamesSpaces(){return i(f),s},pciHooks(t){let l=["hook","module"],a=t.substring(0,t.lastIndexOf("/")),n=new DOMParser().parseFromString(e,"text/xml");for(let r of l)n.querySelectorAll("["+r+"]").forEach(o=>{let m=o.getAttribute(r);!m.startsWith("data:")&&!m.startsWith("http")&&(o.setAttribute("base-url",t),o.setAttribute("module",a+"/"+encodeURIComponent(m+(m.endsWith(".js")?"":".js"))))});return e=new XMLSerializer().serializeToString(n),s},assetsLocation(t,l=["src","href","data"]){let a=t.substring(0,t.lastIndexOf("/")),n=new DOMParser().parseFromString(e,"text/xml");for(let r of l)n.querySelectorAll("["+r+"]").forEach(o=>{let m=o.getAttribute(r);!m.startsWith("data:")&&!m.startsWith("http")&&o.setAttribute(r,a+"/"+encodeURIComponent(m))});return e=new XMLSerializer().serializeToString(n),s},customTypes(){return i(u()),s},suffix(t,l){let a=p.load(e,{xml:!0,xmlMode:!0});return a("*").each((n,r)=>{t.includes(r.name)&&(r.name=`${r.name}-${l}`)}),e=a.xml(),s},fn(t){return e=t(e),s},fnCh(t){let l=p.load(e,{xml:!0,xmlMode:!0});return t(l),e=l.xml(),s},elementNameAttributes(t){return t.forEach(l=>{e=g(e,l,l+` data-element="${l}" `)}),s},print(){return console.log(e),s},xml(){return e=h(e),e}};return s},h=x=>{let e=x.split("/>"),i="";for(let s=0;s<e.length-1;s++){let t=e[s].split("<");i+=e[s]+"></"+t[t.length-1].split(" ")[0]+">"}return i+e[e.length-1]};function g(x,e,i){return x.replace(new RegExp(e,"g"),i)}export{h as fixSelfClosingTags,b as qtiTransform};
|