@qti-components/elements 1.3.0

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 (71) hide show
  1. package/LICENSE.md +674 -0
  2. package/dist/components/qti-assessment-item/qti-assessment-item.d.ts +91 -0
  3. package/dist/components/qti-assessment-item/qti-assessment-item.js +427 -0
  4. package/dist/components/qti-assessment-item/qti-assessment-item.js.map +1 -0
  5. package/dist/components/qti-assessment-stimulus-ref/qti-assessment-stimulus-ref.d.ts +31 -0
  6. package/dist/components/qti-assessment-stimulus-ref/qti-assessment-stimulus-ref.js +70 -0
  7. package/dist/components/qti-assessment-stimulus-ref/qti-assessment-stimulus-ref.js.map +1 -0
  8. package/dist/components/qti-companion-materials-info/qti-companion-materials-info.d.ts +8 -0
  9. package/dist/components/qti-companion-materials-info/qti-companion-materials-info.js +15 -0
  10. package/dist/components/qti-companion-materials-info/qti-companion-materials-info.js.map +1 -0
  11. package/dist/components/qti-content-body/qti-content-body.d.ts +9 -0
  12. package/dist/components/qti-content-body/qti-content-body.js +18 -0
  13. package/dist/components/qti-content-body/qti-content-body.js.map +1 -0
  14. package/dist/components/qti-context-declaration/qti-context-declaration.d.ts +16 -0
  15. package/dist/components/qti-context-declaration/qti-context-declaration.js +40 -0
  16. package/dist/components/qti-context-declaration/qti-context-declaration.js.map +1 -0
  17. package/dist/components/qti-custom-operator/qti-custom-operator.d.ts +25 -0
  18. package/dist/components/qti-custom-operator/qti-custom-operator.js +78 -0
  19. package/dist/components/qti-custom-operator/qti-custom-operator.js.map +1 -0
  20. package/dist/components/qti-feedback-block/qti-feedback-block.d.ts +11 -0
  21. package/dist/components/qti-feedback-block/qti-feedback-block.js +34 -0
  22. package/dist/components/qti-feedback-block/qti-feedback-block.js.map +1 -0
  23. package/dist/components/qti-feedback-inline/qti-feedback-inline.d.ts +11 -0
  24. package/dist/components/qti-feedback-inline/qti-feedback-inline.js +33 -0
  25. package/dist/components/qti-feedback-inline/qti-feedback-inline.js.map +1 -0
  26. package/dist/components/qti-item-body/qti-item-body.d.ts +21 -0
  27. package/dist/components/qti-item-body/qti-item-body.js +30 -0
  28. package/dist/components/qti-item-body/qti-item-body.js.map +1 -0
  29. package/dist/components/qti-item-body/qti-item-body.styles.d.ts +2 -0
  30. package/dist/components/qti-item-body/qti-item-body.styles.js +7 -0
  31. package/dist/components/qti-item-body/qti-item-body.styles.js.map +1 -0
  32. package/dist/components/qti-modal-feedback/qti-modal-feedback.d.ts +14 -0
  33. package/dist/components/qti-modal-feedback/qti-modal-feedback.js +95 -0
  34. package/dist/components/qti-modal-feedback/qti-modal-feedback.js.map +1 -0
  35. package/dist/components/qti-outcome-declaration/qti-outcome-declaration.d.ts +19 -0
  36. package/dist/components/qti-outcome-declaration/qti-outcome-declaration.js +95 -0
  37. package/dist/components/qti-outcome-declaration/qti-outcome-declaration.js.map +1 -0
  38. package/dist/components/qti-response-declaration/qti-response-declaration.d.ts +18 -0
  39. package/dist/components/qti-response-declaration/qti-response-declaration.js +117 -0
  40. package/dist/components/qti-response-declaration/qti-response-declaration.js.map +1 -0
  41. package/dist/components/qti-response-processing/qti-response-processing.d.ts +14 -0
  42. package/dist/components/qti-response-processing/qti-response-processing.js +58 -0
  43. package/dist/components/qti-response-processing/qti-response-processing.js.map +1 -0
  44. package/dist/components/qti-rubric-block/qti-rubric-block.d.ts +15 -0
  45. package/dist/components/qti-rubric-block/qti-rubric-block.js +65 -0
  46. package/dist/components/qti-rubric-block/qti-rubric-block.js.map +1 -0
  47. package/dist/components/qti-stylesheet/qti-stylesheet.d.ts +12 -0
  48. package/dist/components/qti-stylesheet/qti-stylesheet.js +77 -0
  49. package/dist/components/qti-stylesheet/qti-stylesheet.js.map +1 -0
  50. package/dist/components/qti-template-constraint/qti-template-constraint.d.ts +33 -0
  51. package/dist/components/qti-template-constraint/qti-template-constraint.js +63 -0
  52. package/dist/components/qti-template-constraint/qti-template-constraint.js.map +1 -0
  53. package/dist/components/qti-template-declaration/qti-template-declaration.d.ts +27 -0
  54. package/dist/components/qti-template-declaration/qti-template-declaration.js +129 -0
  55. package/dist/components/qti-template-declaration/qti-template-declaration.js.map +1 -0
  56. package/dist/components/qti-template-processing/qti-template-processing.d.ts +21 -0
  57. package/dist/components/qti-template-processing/qti-template-processing.js +84 -0
  58. package/dist/components/qti-template-processing/qti-template-processing.js.map +1 -0
  59. package/dist/index.d.ts +16 -0
  60. package/dist/index.js +17 -0
  61. package/dist/index.js.map +1 -0
  62. package/dist/internal/event-types.d.ts +9 -0
  63. package/dist/internal/event-types.js +2 -0
  64. package/dist/internal/event-types.js.map +1 -0
  65. package/dist/internal/events/qti-register-variable.d.ts +10 -0
  66. package/dist/internal/events/qti-register-variable.js +2 -0
  67. package/dist/internal/events/qti-register-variable.js.map +1 -0
  68. package/dist/internal/template-strings.d.ts +3 -0
  69. package/dist/internal/template-strings.js +53 -0
  70. package/dist/internal/template-strings.js.map +1 -0
  71. package/package.json +45 -0
@@ -0,0 +1,63 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { LitElement, html } from 'lit';
8
+ import { customElement } from 'lit/decorators.js';
9
+ /**
10
+ * @summary The qti-template-constraint element is a processing rule available only in Template Processing.
11
+ * @documentation https://www.imsglobal.org/spec/qti/v3p0/impl#h.template-constraint
12
+ *
13
+ * It terminates Template Processing and re-runs it from the beginning if the condition
14
+ * specified in the template constraint is not satisfied. This can be used to iterate
15
+ * the Template Processing with different randomly-generated values until a predetermined
16
+ * condition is satisfied.
17
+ */
18
+ let QtiTemplateConstraint = class QtiTemplateConstraint extends LitElement {
19
+ render() {
20
+ return html `<slot></slot>`;
21
+ }
22
+ /**
23
+ * Evaluates the constraint condition
24
+ * @returns true if constraint is satisfied, false if template processing should restart
25
+ */
26
+ calculate() {
27
+ const expressions = [...this.children];
28
+ if (expressions.length !== 1) {
29
+ console.error('qti-template-constraint must have exactly one child expression');
30
+ return true; // Don't restart on error
31
+ }
32
+ try {
33
+ const result = expressions[0].calculate();
34
+ return Boolean(result);
35
+ }
36
+ catch (error) {
37
+ console.error('Error evaluating template constraint:', error);
38
+ return true; // Don't restart on error
39
+ }
40
+ }
41
+ /**
42
+ * Template constraints don't have sub-rules like conditions
43
+ */
44
+ getSubRules() {
45
+ return [];
46
+ }
47
+ /**
48
+ * Process the template constraint
49
+ * @returns true if constraint is satisfied, false if template processing should restart
50
+ */
51
+ process() {
52
+ const constraintSatisfied = this.calculate();
53
+ if (!constraintSatisfied) {
54
+ console.debug('Template constraint not satisfied, restarting template processing');
55
+ }
56
+ return constraintSatisfied;
57
+ }
58
+ };
59
+ QtiTemplateConstraint = __decorate([
60
+ customElement('qti-template-constraint')
61
+ ], QtiTemplateConstraint);
62
+ export { QtiTemplateConstraint };
63
+ //# sourceMappingURL=qti-template-constraint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qti-template-constraint.js","sourceRoot":"","sources":["../../../src/components/qti-template-constraint/qti-template-constraint.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAKlD;;;;;;;;GAQG;AAEI,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,UAAU;IAC1C,MAAM;QACb,OAAO,IAAI,CAAA,eAAe,CAAC;IAC7B,CAAC;IAED;;;OAGG;IACI,SAAS;QACd,MAAM,WAAW,GAAG,CAAC,GAAG,IAAI,CAAC,QAAQ,CAA6B,CAAC;QAEnE,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC7B,OAAO,CAAC,KAAK,CAAC,gEAAgE,CAAC,CAAC;YAChF,OAAO,IAAI,CAAC,CAAC,yBAAyB;QACxC,CAAC;QAED,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;YAC1C,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC;QACzB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,uCAAuC,EAAE,KAAK,CAAC,CAAC;YAC9D,OAAO,IAAI,CAAC,CAAC,yBAAyB;QACxC,CAAC;IACH,CAAC;IAED;;OAEG;IACI,WAAW;QAChB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED;;;OAGG;IACI,OAAO;QACZ,MAAM,mBAAmB,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;QAE7C,IAAI,CAAC,mBAAmB,EAAE,CAAC;YACzB,OAAO,CAAC,KAAK,CAAC,mEAAmE,CAAC,CAAC;QACrF,CAAC;QAED,OAAO,mBAAmB,CAAC;IAC7B,CAAC;CACF,CAAA;AA9CY,qBAAqB;IADjC,aAAa,CAAC,yBAAyB,CAAC;GAC5B,qBAAqB,CA8CjC","sourcesContent":["import { LitElement, html } from 'lit';\nimport { customElement } from 'lit/decorators.js';\n\nimport type { QtiExpression } from '@qti-components/base';\nimport type { QtiRuleBase } from '@qti-components/base';\n\n/**\n * @summary The qti-template-constraint element is a processing rule available only in Template Processing.\n * @documentation https://www.imsglobal.org/spec/qti/v3p0/impl#h.template-constraint\n *\n * It terminates Template Processing and re-runs it from the beginning if the condition\n * specified in the template constraint is not satisfied. This can be used to iterate\n * the Template Processing with different randomly-generated values until a predetermined\n * condition is satisfied.\n */\n@customElement('qti-template-constraint')\nexport class QtiTemplateConstraint extends LitElement implements QtiRuleBase {\n override render() {\n return html`<slot></slot>`;\n }\n\n /**\n * Evaluates the constraint condition\n * @returns true if constraint is satisfied, false if template processing should restart\n */\n public calculate(): boolean {\n const expressions = [...this.children] as QtiExpression<boolean>[];\n\n if (expressions.length !== 1) {\n console.error('qti-template-constraint must have exactly one child expression');\n return true; // Don't restart on error\n }\n\n try {\n const result = expressions[0].calculate();\n return Boolean(result);\n } catch (error) {\n console.error('Error evaluating template constraint:', error);\n return true; // Don't restart on error\n }\n }\n\n /**\n * Template constraints don't have sub-rules like conditions\n */\n public getSubRules(): QtiRuleBase[] {\n return [];\n }\n\n /**\n * Process the template constraint\n * @returns true if constraint is satisfied, false if template processing should restart\n */\n public process(): boolean {\n const constraintSatisfied = this.calculate();\n\n if (!constraintSatisfied) {\n console.debug('Template constraint not satisfied, restarting template processing');\n }\n\n return constraintSatisfied;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'qti-template-constraint': QtiTemplateConstraint;\n }\n}\n"]}
@@ -0,0 +1,27 @@
1
+ import { LitElement } from 'lit';
2
+ import type { TemplateVariable } from '@qti-components/base';
3
+ import type { BaseType } from '@qti-components/base';
4
+ /**
5
+ * @summary The qti-template-declaration element declares template variables for item cloning.
6
+ * @documentation https://www.imsglobal.org/spec/qti/v3p0/impl#h.template-declaration
7
+ */
8
+ export declare class QtiTemplateDeclaration extends LitElement {
9
+ #private;
10
+ identifier: string;
11
+ cardinality: 'single' | 'multiple' | 'ordered' | 'record';
12
+ baseType: BaseType;
13
+ mathVariable: boolean;
14
+ paramVariable: boolean;
15
+ static styles: import("lit").CSSResult[];
16
+ render(): import("lit").TemplateResult<1>;
17
+ connectedCallback(): void;
18
+ /**
19
+ * Get the template variable definition
20
+ */
21
+ getTemplateVariable(): TemplateVariable;
22
+ }
23
+ declare global {
24
+ interface HTMLElementTagNameMap {
25
+ 'qti-template-declaration': QtiTemplateDeclaration;
26
+ }
27
+ }
@@ -0,0 +1,129 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { css, LitElement, html } from 'lit';
8
+ import { customElement, property } from 'lit/decorators.js';
9
+ /**
10
+ * @summary The qti-template-declaration element declares template variables for item cloning.
11
+ * @documentation https://www.imsglobal.org/spec/qti/v3p0/impl#h.template-declaration
12
+ */
13
+ let QtiTemplateDeclaration = class QtiTemplateDeclaration extends LitElement {
14
+ constructor() {
15
+ super(...arguments);
16
+ this.identifier = '';
17
+ this.cardinality = 'single';
18
+ this.baseType = 'string';
19
+ this.mathVariable = false;
20
+ this.paramVariable = false;
21
+ this.#defaultValue = null;
22
+ }
23
+ #defaultValue;
24
+ static { this.styles = [
25
+ css `
26
+ :host {
27
+ display: none;
28
+ }
29
+ `
30
+ ]; }
31
+ render() {
32
+ return html `<slot></slot>`;
33
+ }
34
+ connectedCallback() {
35
+ super.connectedCallback();
36
+ this.updateComplete.then(() => {
37
+ this.#processDefaultValue();
38
+ this.#registerTemplateVariable();
39
+ });
40
+ }
41
+ /**
42
+ * Process qti-default-value to extract the default value
43
+ */
44
+ #processDefaultValue() {
45
+ const defaultValueElement = this.querySelector('qti-default-value');
46
+ if (!defaultValueElement) {
47
+ return;
48
+ }
49
+ // For now, just get the text content - this could be enhanced to handle expressions
50
+ const textContent = defaultValueElement.textContent?.trim() || '';
51
+ this.#defaultValue = this.#convertValue(textContent);
52
+ }
53
+ /**
54
+ * Convert string value based on base-type
55
+ */
56
+ #convertValue(value) {
57
+ if (!value)
58
+ return null;
59
+ switch (this.baseType) {
60
+ case 'integer':
61
+ return parseInt(value, 10);
62
+ case 'float':
63
+ case 'duration':
64
+ return parseFloat(value);
65
+ case 'boolean':
66
+ return value.toLowerCase() === 'true';
67
+ case 'string':
68
+ default:
69
+ return value;
70
+ }
71
+ }
72
+ /**
73
+ * Register this template variable with the assessment item
74
+ */
75
+ #registerTemplateVariable() {
76
+ const templateVariable = {
77
+ identifier: this.identifier,
78
+ cardinality: this.cardinality,
79
+ baseType: this.baseType,
80
+ defaultValue: this.#defaultValue,
81
+ value: this.#defaultValue,
82
+ type: 'template',
83
+ mathVariable: this.mathVariable,
84
+ paramVariable: this.paramVariable
85
+ };
86
+ // Dispatch event to register the variable
87
+ // value must string or string[]
88
+ const variable = { ...templateVariable, value: this.#defaultValue?.toString() || '' };
89
+ this.dispatchEvent(new CustomEvent('qti-register-variable', {
90
+ bubbles: true,
91
+ composed: true,
92
+ detail: { variable }
93
+ }));
94
+ }
95
+ /**
96
+ * Get the template variable definition
97
+ */
98
+ getTemplateVariable() {
99
+ return {
100
+ identifier: this.identifier,
101
+ cardinality: this.cardinality,
102
+ baseType: this.baseType,
103
+ value: this.#defaultValue,
104
+ type: 'template',
105
+ mathVariable: this.mathVariable,
106
+ paramVariable: this.paramVariable
107
+ };
108
+ }
109
+ };
110
+ __decorate([
111
+ property({ type: String })
112
+ ], QtiTemplateDeclaration.prototype, "identifier", void 0);
113
+ __decorate([
114
+ property({ type: String })
115
+ ], QtiTemplateDeclaration.prototype, "cardinality", void 0);
116
+ __decorate([
117
+ property({ type: String, attribute: 'base-type' })
118
+ ], QtiTemplateDeclaration.prototype, "baseType", void 0);
119
+ __decorate([
120
+ property({ type: Boolean, attribute: 'math-variable' })
121
+ ], QtiTemplateDeclaration.prototype, "mathVariable", void 0);
122
+ __decorate([
123
+ property({ type: Boolean, attribute: 'param-variable' })
124
+ ], QtiTemplateDeclaration.prototype, "paramVariable", void 0);
125
+ QtiTemplateDeclaration = __decorate([
126
+ customElement('qti-template-declaration')
127
+ ], QtiTemplateDeclaration);
128
+ export { QtiTemplateDeclaration };
129
+ //# sourceMappingURL=qti-template-declaration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qti-template-declaration.js","sourceRoot":"","sources":["../../../src/components/qti-template-declaration/qti-template-declaration.ts"],"names":[],"mappings":"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","sourcesContent":["import { css, LitElement, html } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\n\nimport type { TemplateVariable } from '@qti-components/base';\nimport type { BaseType } from '@qti-components/base';\n\n/**\n * @summary The qti-template-declaration element declares template variables for item cloning.\n * @documentation https://www.imsglobal.org/spec/qti/v3p0/impl#h.template-declaration\n */\n@customElement('qti-template-declaration')\nexport class QtiTemplateDeclaration extends LitElement {\n @property({ type: String }) identifier: string = '';\n @property({ type: String }) cardinality: 'single' | 'multiple' | 'ordered' | 'record' = 'single';\n @property({ type: String, attribute: 'base-type' }) baseType: BaseType = 'string';\n @property({ type: Boolean, attribute: 'math-variable' }) mathVariable: boolean = false;\n @property({ type: Boolean, attribute: 'param-variable' }) paramVariable: boolean = false;\n\n #defaultValue: any = null;\n\n static override styles = [\n css`\n :host {\n display: none;\n }\n `\n ];\n\n override render() {\n return html`<slot></slot>`;\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.updateComplete.then(() => {\n this.#processDefaultValue();\n this.#registerTemplateVariable();\n });\n }\n\n /**\n * Process qti-default-value to extract the default value\n */\n #processDefaultValue(): void {\n const defaultValueElement = this.querySelector('qti-default-value');\n if (!defaultValueElement) {\n return;\n }\n\n // For now, just get the text content - this could be enhanced to handle expressions\n const textContent = defaultValueElement.textContent?.trim() || '';\n this.#defaultValue = this.#convertValue(textContent);\n }\n\n /**\n * Convert string value based on base-type\n */\n #convertValue(value: string): any {\n if (!value) return null;\n\n switch (this.baseType) {\n case 'integer':\n return parseInt(value, 10);\n case 'float':\n case 'duration':\n return parseFloat(value);\n case 'boolean':\n return value.toLowerCase() === 'true';\n case 'string':\n default:\n return value;\n }\n }\n\n /**\n * Register this template variable with the assessment item\n */\n #registerTemplateVariable(): void {\n const templateVariable: TemplateVariable = {\n identifier: this.identifier,\n cardinality: this.cardinality,\n baseType: this.baseType,\n defaultValue: this.#defaultValue,\n value: this.#defaultValue,\n type: 'template',\n mathVariable: this.mathVariable,\n paramVariable: this.paramVariable\n };\n\n // Dispatch event to register the variable\n\n // value must string or string[]\n const variable = { ...templateVariable, value: this.#defaultValue?.toString() || '' };\n this.dispatchEvent(\n new CustomEvent('qti-register-variable', {\n bubbles: true,\n composed: true,\n detail: { variable }\n })\n );\n }\n\n /**\n * Get the template variable definition\n */\n public getTemplateVariable(): TemplateVariable {\n return {\n identifier: this.identifier,\n cardinality: this.cardinality,\n baseType: this.baseType,\n value: this.#defaultValue,\n type: 'template',\n mathVariable: this.mathVariable,\n paramVariable: this.paramVariable\n };\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'qti-template-declaration': QtiTemplateDeclaration;\n }\n}\n"]}
@@ -0,0 +1,21 @@
1
+ import { LitElement } from 'lit';
2
+ import type { PropertyValueMap } from 'lit';
3
+ /**
4
+ * @summary The qti-template-processing element contains template processing rules.
5
+ * @documentation https://www.imsglobal.org/spec/qti/v3p0/impl#h.template-processing
6
+ */
7
+ export declare class QtiTemplateProcessing extends LitElement {
8
+ #private;
9
+ static styles: import("lit").CSSResult[];
10
+ render(): import("lit").TemplateResult<1>;
11
+ /**
12
+ * Process template rules to set template variable values
13
+ */
14
+ process(): void;
15
+ firstUpdated(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void;
16
+ }
17
+ declare global {
18
+ interface HTMLElementTagNameMap {
19
+ 'qti-template-processing': QtiTemplateProcessing;
20
+ }
21
+ }
@@ -0,0 +1,84 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { css, html, LitElement } from 'lit';
8
+ import { customElement } from 'lit/decorators.js';
9
+ /**
10
+ * @summary The qti-template-processing element contains template processing rules.
11
+ * @documentation https://www.imsglobal.org/spec/qti/v3p0/impl#h.template-processing
12
+ */
13
+ let QtiTemplateProcessing = class QtiTemplateProcessing extends LitElement {
14
+ static { this.styles = [
15
+ css `
16
+ :host {
17
+ display: none;
18
+ }
19
+ `
20
+ ]; }
21
+ #maxIterations = 100; // Prevent infinite loops in template constraints
22
+ render() {
23
+ return html `<slot></slot>`;
24
+ }
25
+ /**
26
+ * Process template rules to set template variable values
27
+ */
28
+ process() {
29
+ const assessmentItem = this.closest('qti-assessment-item');
30
+ if (!assessmentItem) {
31
+ console.warn('qti-template-processing must be inside qti-assessment-item');
32
+ return;
33
+ }
34
+ let iterations = 0;
35
+ let shouldReprocess = false;
36
+ do {
37
+ shouldReprocess = false;
38
+ iterations++;
39
+ if (iterations > this.#maxIterations) {
40
+ console.error('Template processing exceeded maximum iterations. Possible infinite loop.');
41
+ break;
42
+ }
43
+ try {
44
+ const rules = [...this.children];
45
+ for (const rule of rules) {
46
+ // Check if this is a template constraint that failed
47
+ if (rule.tagName.toLowerCase() === 'qti-template-constraint') {
48
+ const constraintResult = rule.calculate();
49
+ if (constraintResult === false) {
50
+ // Template constraint failed, restart processing
51
+ shouldReprocess = true;
52
+ break;
53
+ }
54
+ }
55
+ else {
56
+ rule.process();
57
+ }
58
+ }
59
+ }
60
+ catch (error) {
61
+ console.error('Error during template processing:', error);
62
+ break;
63
+ }
64
+ } while (shouldReprocess);
65
+ // Dispatch event that template processing is complete
66
+ this.dispatchEvent(new CustomEvent('qti-template-processing-complete', {
67
+ bubbles: true,
68
+ composed: true,
69
+ detail: { iterations }
70
+ }));
71
+ }
72
+ firstUpdated(_changedProperties) {
73
+ // Template processing doesn't typically use external templates like response processing
74
+ // But we could add support for common template processing patterns here if needed
75
+ if (this.getAttribute('template')) {
76
+ console.info('Template processing with external template not yet implemented');
77
+ }
78
+ }
79
+ };
80
+ QtiTemplateProcessing = __decorate([
81
+ customElement('qti-template-processing')
82
+ ], QtiTemplateProcessing);
83
+ export { QtiTemplateProcessing };
84
+ //# sourceMappingURL=qti-template-processing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qti-template-processing.js","sourceRoot":"","sources":["../../../src/components/qti-template-processing/qti-template-processing.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAMlD;;;GAGG;AAEI,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,UAAU;aACnC,WAAM,GAAG;QACvB,GAAG,CAAA;;;;KAIF;KACF,AANqB,CAMpB;IAEF,cAAc,GAAG,GAAG,CAAC,CAAC,iDAAiD;IAE9D,MAAM;QACb,OAAO,IAAI,CAAA,eAAe,CAAC;IAC7B,CAAC;IAED;;OAEG;IACI,OAAO;QACZ,MAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC;QAC3D,IAAI,CAAC,cAAc,EAAE,CAAC;YACpB,OAAO,CAAC,IAAI,CAAC,4DAA4D,CAAC,CAAC;YAC3E,OAAO;QACT,CAAC;QAED,IAAI,UAAU,GAAG,CAAC,CAAC;QACnB,IAAI,eAAe,GAAG,KAAK,CAAC;QAE5B,GAAG,CAAC;YACF,eAAe,GAAG,KAAK,CAAC;YACxB,UAAU,EAAE,CAAC;YAEb,IAAI,UAAU,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;gBACrC,OAAO,CAAC,KAAK,CAAC,0EAA0E,CAAC,CAAC;gBAC1F,MAAM;YACR,CAAC;YAED,IAAI,CAAC;gBACH,MAAM,KAAK,GAAG,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAyC,CAAC;gBACzE,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;oBACzB,qDAAqD;oBACrD,IAAI,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,KAAK,yBAAyB,EAAE,CAAC;wBAC7D,MAAM,gBAAgB,GAAI,IAA8B,CAAC,SAAS,EAAE,CAAC;wBACrE,IAAI,gBAAgB,KAAK,KAAK,EAAE,CAAC;4BAC/B,iDAAiD;4BACjD,eAAe,GAAG,IAAI,CAAC;4BACvB,MAAM;wBACR,CAAC;oBACH,CAAC;yBAAM,CAAC;wBACN,IAAI,CAAC,OAAO,EAAE,CAAC;oBACjB,CAAC;gBACH,CAAC;YACH,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,KAAK,CAAC,mCAAmC,EAAE,KAAK,CAAC,CAAC;gBAC1D,MAAM;YACR,CAAC;QACH,CAAC,QAAQ,eAAe,EAAE;QAE1B,sDAAsD;QACtD,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,kCAAkC,EAAE;YAClD,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,EAAE,UAAU,EAAE;SACvB,CAAC,CACH,CAAC;IACJ,CAAC;IAEe,YAAY,CAAC,kBAAqE;QAChG,wFAAwF;QACxF,kFAAkF;QAClF,IAAI,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,EAAE,CAAC;YAClC,OAAO,CAAC,IAAI,CAAC,gEAAgE,CAAC,CAAC;QACjF,CAAC;IACH,CAAC;;AA1EU,qBAAqB;IADjC,aAAa,CAAC,yBAAyB,CAAC;GAC5B,qBAAqB,CA2EjC","sourcesContent":["import { css, html, LitElement } from 'lit';\nimport { customElement } from 'lit/decorators.js';\n\nimport type { QtiRuleBase } from '@qti-components/base';\nimport type { QtiTemplateConstraint } from '../qti-template-constraint/qti-template-constraint';\nimport type { PropertyValueMap } from 'lit';\n\n/**\n * @summary The qti-template-processing element contains template processing rules.\n * @documentation https://www.imsglobal.org/spec/qti/v3p0/impl#h.template-processing\n */\n@customElement('qti-template-processing')\nexport class QtiTemplateProcessing extends LitElement {\n static override styles = [\n css`\n :host {\n display: none;\n }\n `\n ];\n\n #maxIterations = 100; // Prevent infinite loops in template constraints\n\n override render() {\n return html`<slot></slot>`;\n }\n\n /**\n * Process template rules to set template variable values\n */\n public process(): void {\n const assessmentItem = this.closest('qti-assessment-item');\n if (!assessmentItem) {\n console.warn('qti-template-processing must be inside qti-assessment-item');\n return;\n }\n\n let iterations = 0;\n let shouldReprocess = false;\n\n do {\n shouldReprocess = false;\n iterations++;\n\n if (iterations > this.#maxIterations) {\n console.error('Template processing exceeded maximum iterations. Possible infinite loop.');\n break;\n }\n\n try {\n const rules = [...this.children] as unknown as (Element & QtiRuleBase)[];\n for (const rule of rules) {\n // Check if this is a template constraint that failed\n if (rule.tagName.toLowerCase() === 'qti-template-constraint') {\n const constraintResult = (rule as QtiTemplateConstraint).calculate();\n if (constraintResult === false) {\n // Template constraint failed, restart processing\n shouldReprocess = true;\n break;\n }\n } else {\n rule.process();\n }\n }\n } catch (error) {\n console.error('Error during template processing:', error);\n break;\n }\n } while (shouldReprocess);\n\n // Dispatch event that template processing is complete\n this.dispatchEvent(\n new CustomEvent('qti-template-processing-complete', {\n bubbles: true,\n composed: true,\n detail: { iterations }\n })\n );\n }\n\n public override firstUpdated(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void {\n // Template processing doesn't typically use external templates like response processing\n // But we could add support for common template processing patterns here if needed\n if (this.getAttribute('template')) {\n console.info('Template processing with external template not yet implemented');\n }\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'qti-template-processing': QtiTemplateProcessing;\n }\n}\n"]}
@@ -0,0 +1,16 @@
1
+ export * from './components/qti-assessment-item/qti-assessment-item';
2
+ export * from './components/qti-assessment-stimulus-ref/qti-assessment-stimulus-ref';
3
+ export * from './components/qti-companion-materials-info/qti-companion-materials-info';
4
+ export * from './components/qti-custom-operator/qti-custom-operator';
5
+ export * from './components/qti-feedback-block/qti-feedback-block';
6
+ export * from './components/qti-feedback-inline/qti-feedback-inline';
7
+ export * from './components/qti-modal-feedback/qti-modal-feedback';
8
+ export * from './components/qti-item-body/qti-item-body';
9
+ export * from './components/qti-content-body/qti-content-body';
10
+ export * from './components/qti-rubric-block/qti-rubric-block';
11
+ export * from './components/qti-stylesheet/qti-stylesheet';
12
+ export * from './components/qti-response-declaration/qti-response-declaration';
13
+ export * from './components/qti-outcome-declaration/qti-outcome-declaration';
14
+ export * from './components/qti-response-processing/qti-response-processing';
15
+ export * from './components/qti-template-declaration/qti-template-declaration';
16
+ export * from './components/qti-context-declaration/qti-context-declaration';
package/dist/index.js ADDED
@@ -0,0 +1,17 @@
1
+ export * from './components/qti-assessment-item/qti-assessment-item';
2
+ export * from './components/qti-assessment-stimulus-ref/qti-assessment-stimulus-ref';
3
+ export * from './components/qti-companion-materials-info/qti-companion-materials-info';
4
+ export * from './components/qti-custom-operator/qti-custom-operator';
5
+ export * from './components/qti-feedback-block/qti-feedback-block';
6
+ export * from './components/qti-feedback-inline/qti-feedback-inline';
7
+ export * from './components/qti-modal-feedback/qti-modal-feedback';
8
+ export * from './components/qti-item-body/qti-item-body';
9
+ export * from './components/qti-content-body/qti-content-body';
10
+ export * from './components/qti-rubric-block/qti-rubric-block';
11
+ export * from './components/qti-stylesheet/qti-stylesheet';
12
+ export * from './components/qti-response-declaration/qti-response-declaration';
13
+ export * from './components/qti-outcome-declaration/qti-outcome-declaration';
14
+ export * from './components/qti-response-processing/qti-response-processing';
15
+ export * from './components/qti-template-declaration/qti-template-declaration';
16
+ export * from './components/qti-context-declaration/qti-context-declaration';
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,sDAAsD,CAAC;AACrE,cAAc,sEAAsE,CAAC;AACrF,cAAc,wEAAwE,CAAC;AACvF,cAAc,sDAAsD,CAAC;AACrE,cAAc,oDAAoD,CAAC;AACnE,cAAc,sDAAsD,CAAC;AACrE,cAAc,oDAAoD,CAAC;AACnE,cAAc,0CAA0C,CAAC;AACzD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,gDAAgD,CAAC;AAC/D,cAAc,4CAA4C,CAAC;AAC3D,cAAc,gEAAgE,CAAC;AAC/E,cAAc,8DAA8D,CAAC;AAC7E,cAAc,8DAA8D,CAAC;AAC7E,cAAc,gEAAgE,CAAC;AAC/E,cAAc,8DAA8D,CAAC","sourcesContent":["export * from './components/qti-assessment-item/qti-assessment-item';\nexport * from './components/qti-assessment-stimulus-ref/qti-assessment-stimulus-ref';\nexport * from './components/qti-companion-materials-info/qti-companion-materials-info';\nexport * from './components/qti-custom-operator/qti-custom-operator';\nexport * from './components/qti-feedback-block/qti-feedback-block';\nexport * from './components/qti-feedback-inline/qti-feedback-inline';\nexport * from './components/qti-modal-feedback/qti-modal-feedback';\nexport * from './components/qti-item-body/qti-item-body';\nexport * from './components/qti-content-body/qti-content-body';\nexport * from './components/qti-rubric-block/qti-rubric-block';\nexport * from './components/qti-stylesheet/qti-stylesheet';\nexport * from './components/qti-response-declaration/qti-response-declaration';\nexport * from './components/qti-outcome-declaration/qti-outcome-declaration';\nexport * from './components/qti-response-processing/qti-response-processing';\nexport * from './components/qti-template-declaration/qti-template-declaration';\nexport * from './components/qti-context-declaration/qti-context-declaration';\n"]}
@@ -0,0 +1,9 @@
1
+ import type { ResponseInteraction } from '@qti-components/base';
2
+ export interface OutcomeChangedDetails {
3
+ item: string;
4
+ outcomeIdentifier: string;
5
+ value: Readonly<string | string[]>;
6
+ }
7
+ export type InteractionChangedDetails = ResponseInteraction & {
8
+ item: string;
9
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=event-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-types.js","sourceRoot":"","sources":["../../src/internal/event-types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ResponseInteraction } from '@qti-components/base';\n\nexport interface OutcomeChangedDetails {\n item: string;\n outcomeIdentifier: string;\n value: Readonly<string | string[]>;\n}\nexport type InteractionChangedDetails = ResponseInteraction & { item: string };\n"]}
@@ -0,0 +1,10 @@
1
+ import type { VariableDeclaration } from '@qti-components/base';
2
+ type QtiRegisterVariable = CustomEvent<{
3
+ variable: VariableDeclaration<string | string[]>;
4
+ }>;
5
+ declare global {
6
+ interface GlobalEventHandlersEventMap {
7
+ 'qti-register-variable': QtiRegisterVariable;
8
+ }
9
+ }
10
+ export default QtiRegisterVariable;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=qti-register-variable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qti-register-variable.js","sourceRoot":"","sources":["../../../src/internal/events/qti-register-variable.ts"],"names":[],"mappings":"","sourcesContent":["import type { VariableDeclaration } from '@qti-components/base';\n\ntype QtiRegisterVariable = CustomEvent<{\n variable: VariableDeclaration<string | string[]>;\n}>;\n\ndeclare global {\n interface GlobalEventHandlersEventMap {\n 'qti-register-variable': QtiRegisterVariable;\n }\n}\n\nexport default QtiRegisterVariable;\n"]}
@@ -0,0 +1,3 @@
1
+ export declare const matchCorrect = "<qti-response-processing>\n <qti-response-condition>\n <qti-response-if>\n <qti-match>\n <qti-variable identifier=\"RESPONSE\"></qti-variable>\n <qti-correct identifier=\"RESPONSE\"></qti-correct>\n </qti-match>\n <qti-set-outcome-value identifier=\"SCORE\">\n <qti-base-value base-type=\"float\">1</qti-base-value>\n </qti-set-outcome-value>\n </qti-response-if>\n <qti-response-else>\n <qti-set-outcome-value identifier=\"SCORE\">\n <qti-base-value base-type=\"float\">0</qti-base-value>\n </qti-set-outcome-value>\n </qti-response-else>\n </qti-response-condition>\n</qti-response-processing>";
2
+ export declare const mapResponse = "<qti-response-processing>\n <qti-response-condition>\n <qti-response-if>\n <qti-is-null>\n <qti-variable identifier=\"RESPONSE\"></qti-variable>\n </qti-is-null>\n <qti-set-outcome-value identifier=\"SCORE\">\n <qti-base-value base-type=\"float\">0.0</qti-base-value>\n </qti-set-outcome-value>\n </qti-response-if>\n <qti-response-else>\n <qti-set-outcome-value identifier=\"SCORE\">\n <qti-map-response identifier=\"RESPONSE\"> </qti-map-response>\n </qti-set-outcome-value>\n </qti-response-else>\n </qti-response-condition>\n</qti-response-processing>";
3
+ export declare const mapResponsePoint = "<qti-response-processing>\n <qti-response-condition>\n <qti-response-if>\n <qti-is-null>\n <qti-variable identifier=\"RESPONSE\"></qti-variable>\n </qti-is-null>\n <qti-set-outcome-value identifier=\"SCORE\">\n <qti-base-value base-type=\"float\">0</qti-base-value>\n </qti-set-outcome-value>\n </qti-response-if>\n <qti-response-else>\n <qti-set-outcome-value identifier=\"SCORE\">\n <qti-map-response-point identifier=\"RESPONSE\"></qti-map-response-point>\n </qti-set-outcome-value>\n </qti-response-else>\n </qti-response-condition>\n</qti-response-processing>";
@@ -0,0 +1,53 @@
1
+ export const matchCorrect = `<qti-response-processing>
2
+ <qti-response-condition>
3
+ <qti-response-if>
4
+ <qti-match>
5
+ <qti-variable identifier="RESPONSE"></qti-variable>
6
+ <qti-correct identifier="RESPONSE"></qti-correct>
7
+ </qti-match>
8
+ <qti-set-outcome-value identifier="SCORE">
9
+ <qti-base-value base-type="float">1</qti-base-value>
10
+ </qti-set-outcome-value>
11
+ </qti-response-if>
12
+ <qti-response-else>
13
+ <qti-set-outcome-value identifier="SCORE">
14
+ <qti-base-value base-type="float">0</qti-base-value>
15
+ </qti-set-outcome-value>
16
+ </qti-response-else>
17
+ </qti-response-condition>
18
+ </qti-response-processing>`;
19
+ export const mapResponse = `<qti-response-processing>
20
+ <qti-response-condition>
21
+ <qti-response-if>
22
+ <qti-is-null>
23
+ <qti-variable identifier="RESPONSE"></qti-variable>
24
+ </qti-is-null>
25
+ <qti-set-outcome-value identifier="SCORE">
26
+ <qti-base-value base-type="float">0.0</qti-base-value>
27
+ </qti-set-outcome-value>
28
+ </qti-response-if>
29
+ <qti-response-else>
30
+ <qti-set-outcome-value identifier="SCORE">
31
+ <qti-map-response identifier="RESPONSE"> </qti-map-response>
32
+ </qti-set-outcome-value>
33
+ </qti-response-else>
34
+ </qti-response-condition>
35
+ </qti-response-processing>`;
36
+ export const mapResponsePoint = `<qti-response-processing>
37
+ <qti-response-condition>
38
+ <qti-response-if>
39
+ <qti-is-null>
40
+ <qti-variable identifier="RESPONSE"></qti-variable>
41
+ </qti-is-null>
42
+ <qti-set-outcome-value identifier="SCORE">
43
+ <qti-base-value base-type="float">0</qti-base-value>
44
+ </qti-set-outcome-value>
45
+ </qti-response-if>
46
+ <qti-response-else>
47
+ <qti-set-outcome-value identifier="SCORE">
48
+ <qti-map-response-point identifier="RESPONSE"></qti-map-response-point>
49
+ </qti-set-outcome-value>
50
+ </qti-response-else>
51
+ </qti-response-condition>
52
+ </qti-response-processing>`;
53
+ //# sourceMappingURL=template-strings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template-strings.js","sourceRoot":"","sources":["../../src/internal/template-strings.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;2BAiBD,CAAC;AAE5B,MAAM,CAAC,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;2BAgBA,CAAC;AAE5B,MAAM,CAAC,MAAM,gBAAgB,GAAG;;;;;;;;;;;;;;;;2BAgBL,CAAC","sourcesContent":["export const matchCorrect = `<qti-response-processing>\n <qti-response-condition>\n <qti-response-if>\n <qti-match>\n <qti-variable identifier=\"RESPONSE\"></qti-variable>\n <qti-correct identifier=\"RESPONSE\"></qti-correct>\n </qti-match>\n <qti-set-outcome-value identifier=\"SCORE\">\n <qti-base-value base-type=\"float\">1</qti-base-value>\n </qti-set-outcome-value>\n </qti-response-if>\n <qti-response-else>\n <qti-set-outcome-value identifier=\"SCORE\">\n <qti-base-value base-type=\"float\">0</qti-base-value>\n </qti-set-outcome-value>\n </qti-response-else>\n </qti-response-condition>\n</qti-response-processing>`;\n\nexport const mapResponse = `<qti-response-processing>\n <qti-response-condition>\n <qti-response-if>\n <qti-is-null>\n <qti-variable identifier=\"RESPONSE\"></qti-variable>\n </qti-is-null>\n <qti-set-outcome-value identifier=\"SCORE\">\n <qti-base-value base-type=\"float\">0.0</qti-base-value>\n </qti-set-outcome-value>\n </qti-response-if>\n <qti-response-else>\n <qti-set-outcome-value identifier=\"SCORE\">\n <qti-map-response identifier=\"RESPONSE\"> </qti-map-response>\n </qti-set-outcome-value>\n </qti-response-else>\n </qti-response-condition>\n</qti-response-processing>`;\n\nexport const mapResponsePoint = `<qti-response-processing>\n <qti-response-condition>\n <qti-response-if>\n <qti-is-null>\n <qti-variable identifier=\"RESPONSE\"></qti-variable>\n </qti-is-null>\n <qti-set-outcome-value identifier=\"SCORE\">\n <qti-base-value base-type=\"float\">0</qti-base-value>\n </qti-set-outcome-value>\n </qti-response-if>\n <qti-response-else>\n <qti-set-outcome-value identifier=\"SCORE\">\n <qti-map-response-point identifier=\"RESPONSE\"></qti-map-response-point>\n </qti-set-outcome-value>\n </qti-response-else>\n </qti-response-condition>\n</qti-response-processing>`;\n"]}
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "@qti-components/elements",
3
+ "description": "QTI elements utilities",
4
+ "version": "1.3.0",
5
+ "author": "",
6
+ "dependencies": {
7
+ "@qti-components/base": "^1.2.0",
8
+ "@qti-components/utilities": "^1.1.0",
9
+ "@qti-components/transformers": "^1.4.0"
10
+ },
11
+ "devDependencies": {
12
+ "@lit/context": "^1.1.6",
13
+ "lit": "^3.3.1"
14
+ },
15
+ "keywords": [
16
+ "elements",
17
+ "qti"
18
+ ],
19
+ "license": "GPL-3.0-only",
20
+ "main": "dist/index.js",
21
+ "peerDependencies": {
22
+ "@lit/context": "^1.1.6",
23
+ "lit": "^3.3.1"
24
+ },
25
+ "sideEffects": true,
26
+ "type": "module",
27
+ "types": "dist/index.d.ts",
28
+ "publishConfig": {
29
+ "access": "public",
30
+ "provenance": true
31
+ },
32
+ "files": [
33
+ "dist"
34
+ ],
35
+ "repository": {
36
+ "type": "git",
37
+ "url": "git+https://github.com/Citolab/qti-components.git",
38
+ "directory": "packages/qti-elements"
39
+ },
40
+ "scripts": {
41
+ "attw": "attw --profile esm-only --pack",
42
+ "build": "tsc --paths null",
43
+ "clean": "rm -rf dist"
44
+ }
45
+ }