@citolab/qti-components 6.0.19 → 6.0.22

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.
Files changed (46) hide show
  1. package/dist/audience-context-444478f4.d.ts +8 -0
  2. package/dist/chunk-3O4URV5U.cjs +1 -0
  3. package/dist/chunk-5GG2XAUT.js +1 -0
  4. package/dist/chunk-6RJ7J4AE.cjs +1 -0
  5. package/dist/{chunk-UD6XWG6V.js → chunk-GEVRCVN2.cjs} +7 -14
  6. package/dist/chunk-GGEPFBR7.cjs +1 -0
  7. package/dist/chunk-HOQW4KDA.cjs +1 -0
  8. package/dist/chunk-M7QOVOG6.js +1 -0
  9. package/dist/{chunk-FIJLDR56.js → chunk-YDFMBQT4.js} +6 -12
  10. package/dist/context/index.cjs +1 -0
  11. package/dist/context/index.d.cts +1 -0
  12. package/dist/context/index.d.ts +1 -1
  13. package/dist/context/index.js +1 -1
  14. package/dist/decorators/index.cjs +1 -0
  15. package/dist/decorators/index.d.cts +37 -0
  16. package/dist/decorators/index.js +1 -1
  17. package/dist/index.cjs +2889 -0
  18. package/dist/index.d.cts +1063 -0
  19. package/dist/index.d.ts +27 -16
  20. package/dist/index.js +79 -80
  21. package/dist/{qti-assessment-item-68bcc951.d.ts → qti-assessment-item-c1eb7de3.d.ts} +5 -5
  22. package/dist/qti-components/index.cjs +419 -0
  23. package/dist/qti-components/index.d.cts +560 -0
  24. package/dist/qti-components/index.d.ts +21 -12
  25. package/dist/qti-components/index.js +74 -68
  26. package/dist/qti-item/index.cjs +1 -0
  27. package/dist/qti-item/index.d.cts +4 -0
  28. package/dist/qti-item/index.d.ts +2 -2
  29. package/dist/qti-item/index.js +1 -1
  30. package/dist/{qti-item-8c26fa9e.d.ts → qti-item-e2edd87f.d.ts} +1 -1
  31. package/dist/qti-item-react/index.cjs +1 -0
  32. package/dist/qti-item-react/index.d.cts +30 -0
  33. package/dist/qti-item-react/index.d.ts +3 -3
  34. package/dist/qti-item-react/index.js +1 -1
  35. package/dist/{qti-simple-choice-ca9b86db.d.ts → qti-simple-choice-e28cfb34.d.ts} +6 -3
  36. package/dist/qti-transform/index.cjs +17 -0
  37. package/dist/qti-transform/index.d.cts +17 -0
  38. package/package.json +25 -15
  39. package/dist/chunk-HQKT4SJF.js +0 -1
  40. package/dist/chunk-RPGALUIV.js +0 -1
  41. package/dist/context-a957e50e.d.ts +0 -9
  42. package/dist/custom-elements.json +0 -6766
  43. package/dist/index.css +0 -2200
  44. package/dist/qti-assessment-item-f1fcf393.d.ts +0 -120
  45. package/dist/qti-item-e1fc6a70.d.ts +0 -30
  46. package/dist/qti-simple-choice-d1392d78.d.ts +0 -352
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkGEVRCVN2cjs = require('../chunk-GEVRCVN2.cjs');require('../chunk-GGEPFBR7.cjs');require('../chunk-3O4URV5U.cjs');require('../chunk-HOQW4KDA.cjs');exports.QtiItem = _chunkGEVRCVN2cjs.a;
@@ -0,0 +1,4 @@
1
+ export { Q as QtiItem } from '../qti-item-e2edd87f.js';
2
+ import 'lit-html';
3
+ import 'lit';
4
+ import '../qti-assessment-item-c1eb7de3.js';
@@ -1,4 +1,4 @@
1
- export { Q as QtiItem } from '../qti-item-e1fc6a70.js';
1
+ export { Q as QtiItem } from '../qti-item-e2edd87f.js';
2
2
  import 'lit-html';
3
3
  import 'lit';
4
- import '../qti-assessment-item-68bcc951.js';
4
+ import '../qti-assessment-item-c1eb7de3.js';
@@ -1 +1 @@
1
- import{a as o}from"../chunk-UD6XWG6V.js";import"../chunk-HQKT4SJF.js";import"../chunk-WFLR5TH7.js";import"../chunk-NMCIOGD2.js";export{o as QtiItem};
1
+ import{a as o}from"../chunk-YDFMBQT4.js";import"../chunk-5GG2XAUT.js";import"../chunk-WFLR5TH7.js";import"../chunk-NMCIOGD2.js";export{o as QtiItem};
@@ -1,7 +1,7 @@
1
1
  import * as lit_html from 'lit-html';
2
2
  import * as lit from 'lit';
3
3
  import { LitElement } from 'lit';
4
- import { a as ResponseInteraction, Q as QtiAssessmentItem } from './qti-assessment-item-f1fcf393.js';
4
+ import { a as ResponseInteraction, Q as QtiAssessmentItem } from './qti-assessment-item-c1eb7de3.js';
5
5
 
6
6
  declare class QtiItem extends LitElement {
7
7
  disabled: boolean;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkGEVRCVN2cjs = require('../chunk-GEVRCVN2.cjs');require('../chunk-GGEPFBR7.cjs');require('../chunk-3O4URV5U.cjs');require('../chunk-HOQW4KDA.cjs');var _react = require('react'); var _react2 = _interopRequireDefault(_react);var _react3 = require('@lit-labs/react');var c=_react3.createComponent.call(void 0, {tagName:"qti-item",react:_react2.default,elementClass:_chunkGEVRCVN2cjs.a,events:{qtioutcomechanged:"qti-outcome-changed",qtiinteractionchanged:"qti-interaction-changed",qtiitemconnected:"qti-item-connected"}});exports.QtiItem = c;
@@ -0,0 +1,30 @@
1
+ import React, { Ref } from 'react';
2
+ import { Q as QtiItem$1 } from '../qti-item-e2edd87f.js';
3
+ import { a as ResponseInteraction } from '../qti-assessment-item-c1eb7de3.js';
4
+ import { O as OutcomeChangedDetails, b as InteractionChangedDetails } from '../qti-simple-choice-e28cfb34.js';
5
+ import 'lit-html';
6
+ import 'lit';
7
+ import 'lit-html/directives/ref';
8
+
9
+ interface QtiItemProps {
10
+ ref?: Ref<QtiItem$1>;
11
+ className?: string;
12
+ responses?: ResponseInteraction[];
13
+ xml: string;
14
+ disabled?: boolean;
15
+ qtiContext?: {
16
+ view: 'author' | 'candidate' | 'proctor' | 'scorer' | 'testConstructor' | 'tutor';
17
+ };
18
+ processResponse?: () => void;
19
+ showCorrectResponse?: () => void;
20
+ validateResponses?: () => boolean;
21
+ resetInteractions?: () => void;
22
+ qtioutcomechanged?: (e: CustomEvent<OutcomeChangedDetails>) => void;
23
+ qtiinteractionchanged?: (e: CustomEvent<InteractionChangedDetails>) => void;
24
+ qtiitemconnected?: (e: CustomEvent<{
25
+ identifier: string;
26
+ }>) => void;
27
+ }
28
+ declare const QtiItem: React.ForwardRefExoticComponent<QtiItemProps>;
29
+
30
+ export { QtiItem };
@@ -1,7 +1,7 @@
1
1
  import React, { Ref } from 'react';
2
- import { Q as QtiItem$1 } from '../qti-item-e1fc6a70.js';
3
- import { a as ResponseInteraction } from '../qti-assessment-item-68bcc951.js';
4
- import { O as OutcomeChangedDetails, b as InteractionChangedDetails } from '../qti-simple-choice-d1392d78.js';
2
+ import { Q as QtiItem$1 } from '../qti-item-e2edd87f.js';
3
+ import { a as ResponseInteraction } from '../qti-assessment-item-c1eb7de3.js';
4
+ import { O as OutcomeChangedDetails, b as InteractionChangedDetails } from '../qti-simple-choice-e28cfb34.js';
5
5
  import 'lit-html';
6
6
  import 'lit';
7
7
  import 'lit-html/directives/ref';
@@ -1 +1 @@
1
- import{a as e}from"../chunk-UD6XWG6V.js";import"../chunk-HQKT4SJF.js";import"../chunk-WFLR5TH7.js";import"../chunk-NMCIOGD2.js";import t from"react";import{createComponent as o}from"@lit-labs/react";var c=o({tagName:"qti-item",react:t,elementClass:e,events:{qtioutcomechanged:"qti-outcome-changed",qtiinteractionchanged:"qti-interaction-changed",qtiitemconnected:"qti-item-connected"}});export{c as QtiItem};
1
+ import{a as e}from"../chunk-YDFMBQT4.js";import"../chunk-5GG2XAUT.js";import"../chunk-WFLR5TH7.js";import"../chunk-NMCIOGD2.js";import t from"react";import{createComponent as o}from"@lit-labs/react";var c=o({tagName:"qti-item",react:t,elementClass:e,events:{qtioutcomechanged:"qti-outcome-changed",qtiinteractionchanged:"qti-interaction-changed",qtiitemconnected:"qti-item-connected"}});export{c as QtiItem};
@@ -1,4 +1,4 @@
1
- import { a as ResponseInteraction, V as VariableDeclaration } from './qti-assessment-item-f1fcf393.js';
1
+ import { a as ResponseInteraction, V as VariableDeclaration } from './qti-assessment-item-c1eb7de3.js';
2
2
  import * as lit_html from 'lit-html';
3
3
  import * as lit from 'lit';
4
4
  import { LitElement, CSSResultGroup } from 'lit';
@@ -7,7 +7,7 @@ import * as lit_html_directives_ref from 'lit-html/directives/ref';
7
7
  interface OutcomeChangedDetails {
8
8
  item: string;
9
9
  outcomeIdentifier: string;
10
- value: number;
10
+ value: number | string | string[];
11
11
  }
12
12
  type InteractionChangedDetails = ResponseInteraction & {
13
13
  item: string;
@@ -211,7 +211,10 @@ declare class QtiTextEntryInteraction extends Interaction {
211
211
  patternMask: string;
212
212
  placeholderText: string;
213
213
  private _value;
214
+ private _size;
215
+ inputRef: lit_html_directives_ref.Ref<HTMLInputElement>;
214
216
  classNames: any;
217
+ handleclassNamesChange(old: any, classes: string): void;
215
218
  set response(value: string | undefined);
216
219
  validate(): boolean;
217
220
  static get styles(): lit.CSSResult[];
@@ -349,4 +352,4 @@ declare global {
349
352
  }
350
353
  }
351
354
 
352
- export { Choices as C, Interaction as I, OutcomeChangedDetails as O, QtiRule as Q, QtiChoice as a, InteractionChangedDetails as b, qtiInteractionChanged as c, qtiRegisterVariable as d, qtiRegisterInteraction as e, qtiRegisterChoice as f, qtiRegisterHotspot as g, qtiLooseChoice as h, qtiInteractionResponse as i, qtiChoiceElementSelected as j, QtiTextEntryInteraction as k, QtiExtendedTextInteraction as l, QtiResponseProcessing as m, QtiHottext as n, qtiOutcomeChanged as q };
355
+ export { Choices as C, Interaction as I, OutcomeChangedDetails as O, QtiRule as Q, QtiChoice as a, InteractionChangedDetails as b, qtiInteractionChanged as c, qtiRegisterVariable as d, qtiRegisterInteraction as e, qtiRegisterChoice as f, qtiRegisterHotspot as g, qtiLooseChoice as h, qtiInteractionResponse as i, qtiChoiceElementSelected as j, QtiTextEntryInteraction as k, QtiExtendedTextInteraction as l, QtiChoiceInteraction as m, QtiResponseProcessing as n, QtiHottext as o, QtiSimpleChoice as p, qtiOutcomeChanged as q };
@@ -0,0 +1,17 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }require('../chunk-HOQW4KDA.cjs');var _cheerio = require('cheerio'); var u = _interopRequireWildcard(_cheerio);var g=`
2
+ <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
3
+ <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
4
+ <xsl:template match="*">
5
+ <!-- remove element prefix -->
6
+ <xsl:element name="{local-name()}">
7
+ <!-- process attributes -->
8
+ <xsl:for-each select="@*">
9
+ <!-- remove attribute prefix -->
10
+ <xsl:attribute name="{local-name()}">
11
+ <xsl:value-of select="."/>
12
+ </xsl:attribute>
13
+ </xsl:for-each>
14
+ <xsl:apply-templates/>
15
+ </xsl:element>
16
+ </xsl:template>
17
+ </xsl:stylesheet>`,f= exports.qtiTransform =c=>{let e=c,a=t=>{let s=new DOMParser().parseFromString(e,"text/xml"),r=new XSLTProcessor,l=new DOMParser().parseFromString(t,"text/xml");r.importStylesheet(l);let o=r.transformToFragment(s,document);e=new XMLSerializer().serializeToString(o)},n={mathml(){let t=u.load(e,{xmlMode:!0,xml:!0});return t("math").each((s,r)=>{r.tagName="math-ml"}).find("*").each((s,r)=>{r.tagName=`math-${r.tagName.substring(1)}`}),e=t.xml(),n},removeNamesSpaces(){return a(g),n},pciHooks(t){let s=["hook","module"],r=t.substring(0,t.lastIndexOf("/")),l=new DOMParser().parseFromString(e,"text/xml");for(let o of s)l.querySelectorAll("["+o+"]").forEach(m=>{let i=m.getAttribute(o);!i.startsWith("data:")&&!i.startsWith("http")&&(m.setAttribute("base-url",t),m.setAttribute("module",r+"/"+encodeURIComponent(i+(i.endsWith(".js")?"":".js"))))});return e=new XMLSerializer().serializeToString(l),n},assetsLocation(t,s=["src","href","data"]){let r=t.substring(0,t.lastIndexOf("/")),l=new DOMParser().parseFromString(e,"text/xml");for(let o of s)l.querySelectorAll("["+o+"]").forEach(m=>{let i=m.getAttribute(o);!i.startsWith("data:")&&!i.startsWith("http")&&m.setAttribute(o,r+"/"+encodeURIComponent(i))});return e=new XMLSerializer().serializeToString(l),n},customTypes(){let t=u.load(e,{xml:!0,xmlMode:!0});return t("*").each((s,r)=>{var o;let l=(o=t(r).attr("class"))==null?void 0:o.split(" ");l&&l.forEach(x=>{x.startsWith("type:")&&(r.name=`${r.name}-${x.slice(5)}`)})}),e=t.xml(),n},suffix(t,s){let r=u.load(e,{xml:!0,xmlMode:!0});return r("*").each((l,o)=>{t.includes(o.name)&&(o.name=`${o.name}-${s}`)}),e=r.xml(),n},fn(t){return e=t(e),n},fnCh(t){let s=u.load(e,{xml:!0,xmlMode:!0});return t(s),e=s.xml(),n},elementNameAttributes(t){return t.forEach(s=>{e=p(e,s,s+` data-element="${s}" `)}),n},print(){return console.log(e),n},xml(){return e=h(e),e}};return n},h=c=>{let e=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],a=c.split("/>"),n="";for(let t=0;t<a.length-1;t++){let s=a[t].split("<"),r=s[s.length-1].split(" ")[0];e.includes(r)?n+=a[t]+"/>":n+=a[t]+"></"+r+">"}return n+a[a.length-1]};function p(c,e,a){return c.replace(new RegExp(e,"g"),a)}exports.qtiTransform = f;
@@ -0,0 +1,17 @@
1
+ import * as cheerio from 'cheerio';
2
+
3
+ declare const qtiTransform: (xmlValue: string) => {
4
+ mathml(): any;
5
+ removeNamesSpaces(): any;
6
+ pciHooks(uri: string): any;
7
+ assetsLocation(uri: string, attributes?: string[]): any;
8
+ customTypes(): any;
9
+ suffix(elements: string[], suffix: string): any;
10
+ fn(fn: (xmlString: string) => string): any;
11
+ fnCh(fn: (xmlString: cheerio.CheerioAPI) => void): any;
12
+ elementNameAttributes(elements: string[]): any;
13
+ print(): any;
14
+ xml(): string;
15
+ };
16
+
17
+ export { qtiTransform };
package/package.json CHANGED
@@ -12,30 +12,36 @@
12
12
  "engines": {
13
13
  "node": ">=16.0.0"
14
14
  },
15
- "version": "6.0.19",
15
+ "version": "6.0.22",
16
16
  "type": "module",
17
- "main": "dist/qti-components/index.js",
17
+ "main": "dist/index.js",
18
18
  "exports": {
19
19
  ".": {
20
- "import": "./dist/qti-components/index.js"
20
+ "import": "./dist/index.js"
21
21
  },
22
22
  "./context": {
23
- "import": "./dist/context/index.js"
23
+ "import": "./dist/context/index.js",
24
+ "require": "./dist/context/index.cjs"
24
25
  },
25
26
  "./decorators": {
26
- "import": "./dist/decorators/index.js"
27
+ "import": "./dist/decorators/index.js",
28
+ "require": "./dist/decorators/index.cjs"
27
29
  },
28
30
  "./qti-components": {
29
- "import": "./dist/qti-components/index.js"
31
+ "import": "./dist/qti-components/index.js",
32
+ "require": "./dist/qti-components/index.cjs"
30
33
  },
31
34
  "./qti-item": {
32
- "import": "./dist/qti-item/index.js"
35
+ "import": "./dist/qti-item/index.js",
36
+ "require": "./dist/qti-item/index.cjs"
33
37
  },
34
38
  "./react/qti-item": {
35
- "import": "./dist/qti-item-react/index.js"
39
+ "import": "./dist/qti-item-react/index.js",
40
+ "require": "./dist/qti-item-react/index.cjs"
36
41
  },
37
42
  "./qti-transform": {
38
- "import": "./dist/qti-transform/index.js"
43
+ "import": "./dist/qti-transform/index.js",
44
+ "require": "./dist/qti-transform/index.cjs"
39
45
  },
40
46
  "./index.css": {
41
47
  "import": "./dist/index.css"
@@ -79,18 +85,21 @@
79
85
  "dev": "vite",
80
86
  "build-app": "tsc && vite build",
81
87
  "build-lib": "ts-node --esm --project tsconfig.node.json scripts/build.ts",
82
- "build-watch": "nodemon --watch \"src/**\" --ext \"ts,json,css\" --ignore \"src/**/*.spec.ts\" --exec \"ts-node --esm --project tsconfig.node.json scripts/build.ts\"",
88
+ "build-lib-watch": "nodemon --watch \"src/**\" --ext \"ts,json,css\" --ignore \"src/**/*.spec.ts\" --exec \"ts-node --esm --project tsconfig.node.json scripts/build.ts\"",
83
89
  "storybook": "storybook dev -p 6006",
84
90
  "deploy": "firebase deploy --only hosting:qti-components",
85
91
  "build-storybook": "storybook build",
86
- "prepublishOnly": "echo 'calling prepublishOnly as npm lifecycle hook to build-lib!' && npm run build-lib",
87
- "npm": "np --any-branch",
92
+ "npm": "np",
88
93
  "test-storybook": "test-storybook",
89
94
  "cem": "cem analyze --watch",
90
95
  "lint": "eslint src/lib/**",
91
96
  "kill 6006": "sudo lsof -i :6006 | grep LISTEN | awk '{print $2}' | xargs kill",
92
97
  "list-outdated-dependencies": "npx npm-check-updates --format repo --peer",
93
- "update-dependencies": "npx npm-check-updates --peer -u && npm install"
98
+ "update-dependencies": "npx npm-check-updates --peer -u && npm install",
99
+ "arethetypeswrong": "attw --pack",
100
+ "----hooks----": "",
101
+ "prepublishOnly": "echo 'calling prepublishOnly as npm lifecycle hook to build-lib!' && npm run build-lib",
102
+ "postpublish": "npm run deploy"
94
103
  },
95
104
  "dependencies": {
96
105
  "@lit-labs/context": "^0.3.3",
@@ -139,6 +148,7 @@
139
148
  "html-to-image": "^1.11.11",
140
149
  "jest-environment-jsdom": "^29.5.0",
141
150
  "nodemon": "^2.0.22",
151
+ "np": "^8.0.4",
142
152
  "postcss": "^8.4.24",
143
153
  "postcss-import": "^15.1.0",
144
154
  "postcss-nesting": "^11.3.0",
@@ -152,10 +162,10 @@
152
162
  "tailwindcss": "^3.3.2",
153
163
  "ts-jest": "^29.1.0",
154
164
  "ts-node": "^10.9.1",
155
- "tsup": "^7.0.0",
165
+ "tsup": "^7.1.0",
156
166
  "typescript": "^5.1.3",
157
167
  "vite": "^4.3.9",
158
- "np": "^8.0.4"
168
+ "@arethetypeswrong/cli": "^0.4.2"
159
169
  },
160
170
  "customElements": "custom-elements.json"
161
171
  }
@@ -1 +0,0 @@
1
- import{createContext as e}from"@lit-labs/context";var g=e("logger");export{g as a};
@@ -1 +0,0 @@
1
- import{a as l}from"./chunk-NMCIOGD2.js";function b(d,r){let n,h=l({},r);return(t,o)=>{let{connectedCallback:c,disconnectedCallback:u}=t;t.connectedCallback=function(){var i;c.call(this);let m=p=>{let y=Array.from(this.querySelectorAll(d));for(let s of p){let a=Array.from(s.addedNodes).map(e=>e),v=Array.from(s.addedNodes).map(e=>e);s.type==="childList"&&a.find(e=>y.includes(e))&&this[o](a,v)}};n=new MutationObserver(m),n.observe(this,{childList:!0,subtree:!0});let f=(i=this.querySelectorAll(d))!=null?i:[];this[o](Array.from(f),[])},t.disconnectedCallback=function(){u.call(this),n.disconnect()}}}export{b as a};
@@ -1,9 +0,0 @@
1
- interface Logger {
2
- view: string;
3
- log: (msg: string) => void;
4
- }
5
- declare const loggerContext: {
6
- __context__: Logger;
7
- };
8
-
9
- export { Logger as L, loggerContext as l };