@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,70 @@
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 } from 'lit';
8
+ import { customElement, property } from 'lit/decorators.js';
9
+ import { qtiTransformItem } from '@qti-components/transformers';
10
+ export class QtiAssessmentStimulusRefConnectedEvent extends Event {
11
+ static { this.eventName = 'qti-assessment-stimulus-ref-connected'; }
12
+ constructor(element, item) {
13
+ super(QtiAssessmentStimulusRefConnectedEvent.eventName, { bubbles: true, composed: true, cancelable: true });
14
+ this.element = element;
15
+ this.item = item;
16
+ }
17
+ }
18
+ /**
19
+ * Represents a custom element for referencing an assessment stimulus.
20
+ */
21
+ let QtiAssessmentStimulusRef = class QtiAssessmentStimulusRef extends LitElement {
22
+ constructor() {
23
+ super(...arguments);
24
+ this.identifier = '';
25
+ this.href = '';
26
+ }
27
+ /**
28
+ * Lifecycle method called when the element is connected to the DOM.
29
+ * First checks if there's a data-stimulus-idref element. If found, loads the stimulus directly.
30
+ * If not found, delegates to the delivery platform via an event.
31
+ */
32
+ async connectedCallback() {
33
+ super.connectedCallback();
34
+ // VERY important to wait for updateComplete to ensure that the stimulusRef is connected after item
35
+ // for the test-navigation to correctly process everything in order
36
+ await this.updateComplete;
37
+ const item = this.closest('qti-assessment-item');
38
+ const event = new QtiAssessmentStimulusRefConnectedEvent(this, item);
39
+ this.dispatchEvent(event);
40
+ const stimulusRef = item?.querySelector(`[data-stimulus-idref="${this.identifier}"]`);
41
+ if (!event.defaultPrevented && stimulusRef) {
42
+ await this.updateStimulusRef(stimulusRef);
43
+ }
44
+ }
45
+ /**
46
+ * Loads and appends the stimulus to the specified element.
47
+ * @param stimulusRef - The element to which the stimulus will be appended.
48
+ */
49
+ async updateStimulusRef(stimulusRef) {
50
+ const stimulus = await qtiTransformItem()
51
+ .load(this.href)
52
+ .then(api => api.htmlDoc());
53
+ if (stimulus) {
54
+ const elements = stimulus.querySelectorAll('qti-stimulus-body, qti-stylesheet');
55
+ stimulusRef.innerHTML = '';
56
+ stimulusRef.append(...elements);
57
+ }
58
+ }
59
+ };
60
+ __decorate([
61
+ property({ type: String })
62
+ ], QtiAssessmentStimulusRef.prototype, "identifier", void 0);
63
+ __decorate([
64
+ property({ type: String })
65
+ ], QtiAssessmentStimulusRef.prototype, "href", void 0);
66
+ QtiAssessmentStimulusRef = __decorate([
67
+ customElement('qti-assessment-stimulus-ref')
68
+ ], QtiAssessmentStimulusRef);
69
+ export { QtiAssessmentStimulusRef };
70
+ //# sourceMappingURL=qti-assessment-stimulus-ref.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qti-assessment-stimulus-ref.js","sourceRoot":"","sources":["../../../src/components/qti-assessment-stimulus-ref/qti-assessment-stimulus-ref.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAIhE,MAAM,OAAO,sCAAuC,SAAQ,KAAK;aACjD,cAAS,GAAG,uCAAuC,CAAC;IAClE,YACS,OAAiC,EACjC,IAAuB;QAE9B,KAAK,CAAC,sCAAsC,CAAC,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;QAHtG,YAAO,GAAP,OAAO,CAA0B;QACjC,SAAI,GAAJ,IAAI,CAAmB;IAGhC,CAAC;;AAGH;;GAEG;AAEI,IAAM,wBAAwB,GAA9B,MAAM,wBAAyB,SAAQ,UAAU;IAAjD;;QACuB,eAAU,GAAG,EAAE,CAAC;QAChB,SAAI,GAAG,EAAE,CAAC;IAsCxC,CAAC;IApCC;;;;OAIG;IACa,KAAK,CAAC,iBAAiB;QACrC,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,mGAAmG;QACnG,mEAAmE;QACnE,MAAM,IAAI,CAAC,cAAc,CAAC;QAE1B,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAoB,qBAAqB,CAAC,CAAC;QAEpE,MAAM,KAAK,GAAG,IAAI,sCAAsC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACrE,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAE1B,MAAM,WAAW,GAAG,IAAI,EAAE,aAAa,CAAC,yBAAyB,IAAI,CAAC,UAAU,IAAI,CAAC,CAAC;QACtF,IAAI,CAAC,KAAK,CAAC,gBAAgB,IAAI,WAAW,EAAE,CAAC;YAC3C,MAAM,IAAI,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC;QAC5C,CAAC;IACH,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,iBAAiB,CAAC,WAAoB;QACjD,MAAM,QAAQ,GAAG,MAAM,gBAAgB,EAAE;aACtC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;aACf,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;QAC9B,IAAI,QAAQ,EAAE,CAAC;YACb,MAAM,QAAQ,GAAG,QAAQ,CAAC,gBAAgB,CAAC,mCAAmC,CAAC,CAAC;YAChF,WAAW,CAAC,SAAS,GAAG,EAAE,CAAC;YAC3B,WAAW,CAAC,MAAM,CAAC,GAAG,QAAQ,CAAC,CAAC;QAClC,CAAC;IACH,CAAC;CACF,CAAA;AAvC6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4DAAiB;AAChB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sDAAW;AAF3B,wBAAwB;IADpC,aAAa,CAAC,6BAA6B,CAAC;GAChC,wBAAwB,CAwCpC","sourcesContent":["import { LitElement } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\n\nimport { qtiTransformItem } from '@qti-components/transformers';\n\nimport type { QtiAssessmentItem } from '../qti-assessment-item/qti-assessment-item';\n\nexport class QtiAssessmentStimulusRefConnectedEvent extends Event {\n public static eventName = 'qti-assessment-stimulus-ref-connected';\n constructor(\n public element: QtiAssessmentStimulusRef,\n public item: QtiAssessmentItem\n ) {\n super(QtiAssessmentStimulusRefConnectedEvent.eventName, { bubbles: true, composed: true, cancelable: true });\n }\n}\n\n/**\n * Represents a custom element for referencing an assessment stimulus.\n */\n@customElement('qti-assessment-stimulus-ref')\nexport class QtiAssessmentStimulusRef extends LitElement {\n @property({ type: String }) identifier = '';\n @property({ type: String }) href = '';\n\n /**\n * Lifecycle method called when the element is connected to the DOM.\n * First checks if there's a data-stimulus-idref element. If found, loads the stimulus directly.\n * If not found, delegates to the delivery platform via an event.\n */\n public override async connectedCallback(): Promise<void> {\n super.connectedCallback();\n // VERY important to wait for updateComplete to ensure that the stimulusRef is connected after item\n // for the test-navigation to correctly process everything in order\n await this.updateComplete;\n\n const item = this.closest<QtiAssessmentItem>('qti-assessment-item');\n\n const event = new QtiAssessmentStimulusRefConnectedEvent(this, item);\n this.dispatchEvent(event);\n\n const stimulusRef = item?.querySelector(`[data-stimulus-idref=\"${this.identifier}\"]`);\n if (!event.defaultPrevented && stimulusRef) {\n await this.updateStimulusRef(stimulusRef);\n }\n }\n\n /**\n * Loads and appends the stimulus to the specified element.\n * @param stimulusRef - The element to which the stimulus will be appended.\n */\n public async updateStimulusRef(stimulusRef: Element) {\n const stimulus = await qtiTransformItem()\n .load(this.href)\n .then(api => api.htmlDoc());\n if (stimulus) {\n const elements = stimulus.querySelectorAll('qti-stimulus-body, qti-stylesheet');\n stimulusRef.innerHTML = '';\n stimulusRef.append(...elements);\n }\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'qti-assessment-stimulus-ref': QtiAssessmentStimulusRef;\n }\n}\n"]}
@@ -0,0 +1,8 @@
1
+ import { LitElement } from 'lit';
2
+ export declare class QtiCompanionMaterialsInfo extends LitElement {
3
+ }
4
+ declare global {
5
+ interface HTMLElementTagNameMap {
6
+ 'qti-companion-materials-info': QtiCompanionMaterialsInfo;
7
+ }
8
+ }
@@ -0,0 +1,15 @@
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 } from 'lit';
8
+ import { customElement } from 'lit/decorators.js';
9
+ let QtiCompanionMaterialsInfo = class QtiCompanionMaterialsInfo extends LitElement {
10
+ };
11
+ QtiCompanionMaterialsInfo = __decorate([
12
+ customElement('qti-companion-materials-info')
13
+ ], QtiCompanionMaterialsInfo);
14
+ export { QtiCompanionMaterialsInfo };
15
+ //# sourceMappingURL=qti-companion-materials-info.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qti-companion-materials-info.js","sourceRoot":"","sources":["../../../src/components/qti-companion-materials-info/qti-companion-materials-info.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAG3C,IAAM,yBAAyB,GAA/B,MAAM,yBAA0B,SAAQ,UAAU;CASxD,CAAA;AATY,yBAAyB;IADrC,aAAa,CAAC,8BAA8B,CAAC;GACjC,yBAAyB,CASrC","sourcesContent":["import { LitElement } from 'lit';\nimport { customElement } from 'lit/decorators.js';\n\n@customElement('qti-companion-materials-info')\nexport class QtiCompanionMaterialsInfo extends LitElement {\n // static override styles = css`\n // slot {\n // display: hidden;\n // }\n // `;\n // override render() {\n // return html` <slot></slot> `;\n // }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'qti-companion-materials-info': QtiCompanionMaterialsInfo;\n }\n}\n"]}
@@ -0,0 +1,9 @@
1
+ import { LitElement } from 'lit';
2
+ export declare class QtiContentBody extends LitElement {
3
+ render(): import("lit").TemplateResult<1>;
4
+ }
5
+ declare global {
6
+ interface HTMLElementTagNameMap {
7
+ 'qti-content-body': QtiContentBody;
8
+ }
9
+ }
@@ -0,0 +1,18 @@
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
+ let QtiContentBody = class QtiContentBody extends LitElement {
10
+ render() {
11
+ return html `<slot></slot>`;
12
+ }
13
+ };
14
+ QtiContentBody = __decorate([
15
+ customElement('qti-content-body')
16
+ ], QtiContentBody);
17
+ export { QtiContentBody };
18
+ //# sourceMappingURL=qti-content-body.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qti-content-body.js","sourceRoot":"","sources":["../../../src/components/qti-content-body/qti-content-body.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAG3C,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,UAAU;IACnC,MAAM;QACb,OAAO,IAAI,CAAA,eAAe,CAAC;IAC7B,CAAC;CACF,CAAA;AAJY,cAAc;IAD1B,aAAa,CAAC,kBAAkB,CAAC;GACrB,cAAc,CAI1B","sourcesContent":["import { LitElement, html } from 'lit';\nimport { customElement } from 'lit/decorators.js';\n\n@customElement('qti-content-body')\nexport class QtiContentBody extends LitElement {\n override render() {\n return html`<slot></slot>`;\n }\n}\ndeclare global {\n interface HTMLElementTagNameMap {\n 'qti-content-body': QtiContentBody;\n }\n}\n"]}
@@ -0,0 +1,16 @@
1
+ import { LitElement } from 'lit';
2
+ /**
3
+ * @summary The qti-context-declaration element declares context variables for an item.
4
+ * @documentation https://www.imsglobal.org/spec/qti/v3p0/impl#h.qti-context-declaration
5
+ */
6
+ export declare class QtiContextDeclaration extends LitElement {
7
+ identifier: string;
8
+ cardinality: 'single' | 'multiple' | 'ordered' | 'record';
9
+ static styles: import("lit").CSSResult[];
10
+ render(): import("lit").TemplateResult<1>;
11
+ }
12
+ declare global {
13
+ interface HTMLElementTagNameMap {
14
+ 'qti-context-declaration': QtiContextDeclaration;
15
+ }
16
+ }
@@ -0,0 +1,40 @@
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-context-declaration element declares context variables for an item.
11
+ * @documentation https://www.imsglobal.org/spec/qti/v3p0/impl#h.qti-context-declaration
12
+ */
13
+ let QtiContextDeclaration = class QtiContextDeclaration extends LitElement {
14
+ constructor() {
15
+ super(...arguments);
16
+ this.identifier = '';
17
+ this.cardinality = 'record';
18
+ }
19
+ static { this.styles = [
20
+ css `
21
+ :host {
22
+ display: none;
23
+ }
24
+ `
25
+ ]; }
26
+ render() {
27
+ return html `<slot></slot>`;
28
+ }
29
+ };
30
+ __decorate([
31
+ property({ type: String })
32
+ ], QtiContextDeclaration.prototype, "identifier", void 0);
33
+ __decorate([
34
+ property({ type: String })
35
+ ], QtiContextDeclaration.prototype, "cardinality", void 0);
36
+ QtiContextDeclaration = __decorate([
37
+ customElement('qti-context-declaration')
38
+ ], QtiContextDeclaration);
39
+ export { QtiContextDeclaration };
40
+ //# sourceMappingURL=qti-context-declaration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qti-context-declaration.js","sourceRoot":"","sources":["../../../src/components/qti-context-declaration/qti-context-declaration.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE5D;;;GAGG;AAEI,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,UAAU;IAA9C;;QACuB,eAAU,GAAW,EAAE,CAAC;QACxB,gBAAW,GAAiD,QAAQ,CAAC;IAanG,CAAC;aAXiB,WAAM,GAAG;QACvB,GAAG,CAAA;;;;KAIF;KACF,AANqB,CAMpB;IAEO,MAAM;QACb,OAAO,IAAI,CAAA,eAAe,CAAC;IAC7B,CAAC;;AAb2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yDAAyB;AACxB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0DAAsE;AAFtF,qBAAqB;IADjC,aAAa,CAAC,yBAAyB,CAAC;GAC5B,qBAAqB,CAejC","sourcesContent":["import { css, LitElement, html } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\n\n/**\n * @summary The qti-context-declaration element declares context variables for an item.\n * @documentation https://www.imsglobal.org/spec/qti/v3p0/impl#h.qti-context-declaration\n */\n@customElement('qti-context-declaration')\nexport class QtiContextDeclaration extends LitElement {\n @property({ type: String }) identifier: string = '';\n @property({ type: String }) cardinality: 'single' | 'multiple' | 'ordered' | 'record' = 'record';\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\ndeclare global {\n interface HTMLElementTagNameMap {\n 'qti-context-declaration': QtiContextDeclaration;\n }\n}\n"]}
@@ -0,0 +1,25 @@
1
+ import { LitElement } from 'lit';
2
+ import type { Calculate } from '@qti-components/base';
3
+ /**
4
+ * https://www.imsglobal.org/spec/qti/v3p0/impl#h.fi29q8dubjgw
5
+ * <qti-custom-operator class="js.org">
6
+ <qti-base-value base-type="string"><![CDATA[
7
+ console.log(context.variables);
8
+ return 'B'
9
+ document.querySelector('qti-end-attempt-interaction').disabled = true;
10
+ ]]></qti-base-value>
11
+ </qti-custom-operator>
12
+ </qti-set-outcome-value>
13
+ */
14
+ export declare class QtiCustomOperator extends LitElement implements Calculate {
15
+ #private;
16
+ private _context?;
17
+ render(): import("lit").TemplateResult<1>;
18
+ handleSlotChange(): void;
19
+ calculate(): any;
20
+ }
21
+ declare global {
22
+ interface HTMLElementTagNameMap {
23
+ 'qti-custom-operator': QtiCustomOperator;
24
+ }
25
+ }
@@ -0,0 +1,78 @@
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 { consume } from '@lit/context';
8
+ import { LitElement, html } from 'lit';
9
+ import { customElement, state } from 'lit/decorators.js';
10
+ import { itemContext } from '@qti-components/base';
11
+ /**
12
+ * https://www.imsglobal.org/spec/qti/v3p0/impl#h.fi29q8dubjgw
13
+ * <qti-custom-operator class="js.org">
14
+ <qti-base-value base-type="string"><![CDATA[
15
+ console.log(context.variables);
16
+ return 'B'
17
+ document.querySelector('qti-end-attempt-interaction').disabled = true;
18
+ ]]></qti-base-value>
19
+ </qti-custom-operator>
20
+ </qti-set-outcome-value>
21
+ */
22
+ let QtiCustomOperator = class QtiCustomOperator extends LitElement {
23
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
24
+ #operatorFunction;
25
+ render() {
26
+ return html `<slot @slotchange=${this.handleSlotChange}></slot>`;
27
+ }
28
+ handleSlotChange() {
29
+ // expecting <[!CDATA[ ... ]]> is converted into <!-- ... --> with qti-transform: cDataToComment
30
+ const commentNode = Array.from(this.firstElementChild?.childNodes ?? []).find(node => node.nodeType === Node.COMMENT_NODE);
31
+ try {
32
+ this.#operatorFunction = new Function('context', 'fn', 'item', commentNode?.textContent ?? '');
33
+ }
34
+ catch (e) {
35
+ console.error('custom-operator contains invalid javascript code', e);
36
+ }
37
+ }
38
+ calculate() {
39
+ const fn = {
40
+ variable: (responseIdentifier) => this._context?.variables.find(v => v.identifier === responseIdentifier)?.value ?? '',
41
+ correct: (responseIdentifier) => this._context?.variables.find(v => v.identifier === responseIdentifier)
42
+ ?.correctResponse ?? ''
43
+ };
44
+ const item = {
45
+ getVariable: (variableIdentifier) => this._context?.variables.find(v => v.identifier === variableIdentifier),
46
+ updateOutcomeVariable: (outcomeIdentifier, value) => {
47
+ this.dispatchEvent(new CustomEvent('qti-set-outcome-value', {
48
+ bubbles: true,
49
+ composed: true,
50
+ detail: {
51
+ outcomeIdentifier,
52
+ value
53
+ }
54
+ }));
55
+ },
56
+ updateResponseVariable: (responseIdentifier, response) => {
57
+ this.dispatchEvent(new CustomEvent('qti-interaction-response', {
58
+ bubbles: true,
59
+ composed: true,
60
+ detail: {
61
+ responseIdentifier,
62
+ response
63
+ }
64
+ }));
65
+ }
66
+ };
67
+ return this.#operatorFunction(this._context, fn, item);
68
+ }
69
+ };
70
+ __decorate([
71
+ consume({ context: itemContext, subscribe: true }),
72
+ state()
73
+ ], QtiCustomOperator.prototype, "_context", void 0);
74
+ QtiCustomOperator = __decorate([
75
+ customElement('qti-custom-operator')
76
+ ], QtiCustomOperator);
77
+ export { QtiCustomOperator };
78
+ //# sourceMappingURL=qti-custom-operator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qti-custom-operator.js","sourceRoot":"","sources":["../../../src/components/qti-custom-operator/qti-custom-operator.ts"],"names":[],"mappings":"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","sourcesContent":["import { consume } from '@lit/context';\nimport { LitElement, html } from 'lit';\nimport { customElement, state } from 'lit/decorators.js';\n\nimport { itemContext } from '@qti-components/base';\n\nimport type { ResponseVariable } from '@qti-components/base';\nimport type { Calculate } from '@qti-components/base';\nimport type { ItemContext } from '@qti-components/base';\n\n/**\n * https://www.imsglobal.org/spec/qti/v3p0/impl#h.fi29q8dubjgw\n * <qti-custom-operator class=\"js.org\">\n <qti-base-value base-type=\"string\"><![CDATA[\n console.log(context.variables);\n return 'B'\n document.querySelector('qti-end-attempt-interaction').disabled = true;\n ]]></qti-base-value>\n </qti-custom-operator>\n </qti-set-outcome-value>\n */\n@customElement('qti-custom-operator')\nexport class QtiCustomOperator extends LitElement implements Calculate {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\n #operatorFunction: Function;\n\n @consume({ context: itemContext, subscribe: true })\n @state()\n private _context?: ItemContext;\n\n override render() {\n return html`<slot @slotchange=${this.handleSlotChange}></slot>`;\n }\n\n handleSlotChange() {\n // expecting <[!CDATA[ ... ]]> is converted into <!-- ... --> with qti-transform: cDataToComment\n const commentNode = Array.from(this.firstElementChild?.childNodes ?? []).find(\n node => node.nodeType === Node.COMMENT_NODE\n );\n try {\n this.#operatorFunction = new Function('context', 'fn', 'item', commentNode?.textContent ?? '');\n } catch (e) {\n console.error('custom-operator contains invalid javascript code', e);\n }\n }\n\n public calculate() {\n const fn = {\n variable: (responseIdentifier: string) =>\n this._context?.variables.find(v => v.identifier === responseIdentifier)?.value ?? '',\n correct: (responseIdentifier: string) =>\n (this._context?.variables.find(v => v.identifier === responseIdentifier) as ResponseVariable)\n ?.correctResponse ?? ''\n };\n const item = {\n getVariable: (variableIdentifier: string) =>\n this._context?.variables.find(v => v.identifier === variableIdentifier),\n updateOutcomeVariable: (outcomeIdentifier: string, value: string | string[]) => {\n this.dispatchEvent(\n new CustomEvent<{ outcomeIdentifier: string; value: string | string[] }>('qti-set-outcome-value', {\n bubbles: true,\n composed: true,\n detail: {\n outcomeIdentifier,\n value\n }\n })\n );\n },\n updateResponseVariable: (responseIdentifier: string, response: string | string[]) => {\n this.dispatchEvent(\n new CustomEvent<{ responseIdentifier: string; response: string | string[] }>('qti-interaction-response', {\n bubbles: true,\n composed: true,\n detail: {\n responseIdentifier,\n response\n }\n })\n );\n }\n };\n\n return this.#operatorFunction(this._context, fn, item);\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'qti-custom-operator': QtiCustomOperator;\n }\n}\n"]}
@@ -0,0 +1,11 @@
1
+ import { QtiFeedback } from '@qti-components/base';
2
+ export declare class QtiFeedbackBlock extends QtiFeedback {
3
+ static styles: import("lit").CSSResult;
4
+ render(): import("lit").TemplateResult<1>;
5
+ connectedCallback(): void;
6
+ }
7
+ declare global {
8
+ interface HTMLElementTagNameMap {
9
+ 'qti-feedback-block': QtiFeedbackBlock;
10
+ }
11
+ }
@@ -0,0 +1,34 @@
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 } from 'lit';
8
+ import { customElement } from 'lit/decorators.js';
9
+ import { QtiFeedback } from '@qti-components/base';
10
+ let QtiFeedbackBlock = class QtiFeedbackBlock extends QtiFeedback {
11
+ static { this.styles = css `
12
+ :host {
13
+ display: block;
14
+ }
15
+ .on {
16
+ display: block;
17
+ }
18
+ .off {
19
+ display: none;
20
+ }
21
+ `; }
22
+ render() {
23
+ return html ` <slot part="feedback" class="feedback ${this.showStatus}"></slot> `;
24
+ }
25
+ connectedCallback() {
26
+ super.connectedCallback();
27
+ this.checkShowFeedback(this.outcomeIdentifier);
28
+ }
29
+ };
30
+ QtiFeedbackBlock = __decorate([
31
+ customElement('qti-feedback-block')
32
+ ], QtiFeedbackBlock);
33
+ export { QtiFeedbackBlock };
34
+ //# sourceMappingURL=qti-feedback-block.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qti-feedback-block.js","sourceRoot":"","sources":["../../../src/components/qti-feedback-block/qti-feedback-block.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAG5C,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,WAAW;aAC/B,WAAM,GAAG,GAAG,CAAA;;;;;;;;;;GAU3B,AAVqB,CAUpB;IAEO,MAAM;QACb,OAAO,IAAI,CAAA,0CAA0C,IAAI,CAAC,UAAU,YAAY,CAAC;IACnF,CAAC;IAEe,iBAAiB;QAC/B,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IACjD,CAAC;;AApBU,gBAAgB;IAD5B,aAAa,CAAC,oBAAoB,CAAC;GACvB,gBAAgB,CAqB5B","sourcesContent":["import { css, html } from 'lit';\nimport { customElement } from 'lit/decorators.js';\n\nimport { QtiFeedback } from '@qti-components/base';\n\n@customElement('qti-feedback-block')\nexport class QtiFeedbackBlock extends QtiFeedback {\n static override styles = css`\n :host {\n display: block;\n }\n .on {\n display: block;\n }\n .off {\n display: none;\n }\n `;\n\n override render() {\n return html` <slot part=\"feedback\" class=\"feedback ${this.showStatus}\"></slot> `;\n }\n\n public override connectedCallback(): void {\n super.connectedCallback();\n this.checkShowFeedback(this.outcomeIdentifier);\n }\n}\ndeclare global {\n interface HTMLElementTagNameMap {\n 'qti-feedback-block': QtiFeedbackBlock;\n }\n}\n"]}
@@ -0,0 +1,11 @@
1
+ import { QtiFeedback } from '@qti-components/base';
2
+ export declare class QtiFeedbackInline extends QtiFeedback {
3
+ static styles: import("lit").CSSResult;
4
+ render: () => import("lit").TemplateResult<1>;
5
+ connectedCallback(): void;
6
+ }
7
+ declare global {
8
+ interface HTMLElementTagNameMap {
9
+ 'qti-feedback-inline': QtiFeedbackInline;
10
+ }
11
+ }
@@ -0,0 +1,33 @@
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 } from 'lit';
8
+ import { customElement } from 'lit/decorators.js';
9
+ import { ifDefined } from 'lit/directives/if-defined.js';
10
+ import { QtiFeedback } from '@qti-components/base';
11
+ let QtiFeedbackInline = class QtiFeedbackInline extends QtiFeedback {
12
+ constructor() {
13
+ super(...arguments);
14
+ this.render = () => html ` <slot part="feedback" class="${ifDefined(this.showStatus)}"></slot> `;
15
+ }
16
+ static { this.styles = css `
17
+ .on {
18
+ display: inline-block;
19
+ }
20
+ .off {
21
+ display: none;
22
+ }
23
+ `; }
24
+ connectedCallback() {
25
+ super.connectedCallback();
26
+ this.checkShowFeedback(this.outcomeIdentifier);
27
+ }
28
+ };
29
+ QtiFeedbackInline = __decorate([
30
+ customElement('qti-feedback-inline')
31
+ ], QtiFeedbackInline);
32
+ export { QtiFeedbackInline };
33
+ //# sourceMappingURL=qti-feedback-inline.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qti-feedback-inline.js","sourceRoot":"","sources":["../../../src/components/qti-feedback-inline/qti-feedback-inline.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEzD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAG5C,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,WAAW;IAA3C;;QAUI,WAAM,GAAG,GAAG,EAAE,CAAC,IAAI,CAAA,iCAAiC,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC;IAMtG,CAAC;aAfiB,WAAM,GAAG,GAAG,CAAA;;;;;;;GAO3B,AAPqB,CAOpB;IAIc,iBAAiB;QAC/B,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IACjD,CAAC;;AAfU,iBAAiB;IAD7B,aAAa,CAAC,qBAAqB,CAAC;GACxB,iBAAiB,CAgB7B","sourcesContent":["import { css, html } from 'lit';\nimport { customElement } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\n\nimport { QtiFeedback } from '@qti-components/base';\n\n@customElement('qti-feedback-inline')\nexport class QtiFeedbackInline extends QtiFeedback {\n static override styles = css`\n .on {\n display: inline-block;\n }\n .off {\n display: none;\n }\n `;\n\n override render = () => html` <slot part=\"feedback\" class=\"${ifDefined(this.showStatus)}\"></slot> `;\n\n public override connectedCallback(): void {\n super.connectedCallback();\n this.checkShowFeedback(this.outcomeIdentifier);\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'qti-feedback-inline': QtiFeedbackInline;\n }\n}\n"]}
@@ -0,0 +1,21 @@
1
+ import { LitElement } from 'lit';
2
+ import type { CSSResultGroup } from 'lit';
3
+ /**
4
+ * @summary The qti-item-body node contains the text, graphics, media objects and interactions that describe the item's content and information about how it is structured.
5
+ * @documentation https://www.imsglobal.org/spec/qti/v3p0/impl#h.sphpo6lu6zqi
6
+ * @status stable
7
+ * @since 4.0
8
+ *
9
+ * @slot - item body content.
10
+ * @slot qti-rubric-block - the qti rubric block is placed above the item
11
+ * @part qti-rubric-block - the qti rubric block part
12
+ */
13
+ export declare class QtiItemBody extends LitElement {
14
+ static styles: CSSResultGroup;
15
+ render(): import("lit").TemplateResult<1>;
16
+ }
17
+ declare global {
18
+ interface HTMLElementTagNameMap {
19
+ 'qti-item-body': QtiItemBody;
20
+ }
21
+ }
@@ -0,0 +1,30 @@
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 { customElement } from 'lit/decorators.js';
8
+ import { html, LitElement } from 'lit';
9
+ import styles from './qti-item-body.styles';
10
+ /**
11
+ * @summary The qti-item-body node contains the text, graphics, media objects and interactions that describe the item's content and information about how it is structured.
12
+ * @documentation https://www.imsglobal.org/spec/qti/v3p0/impl#h.sphpo6lu6zqi
13
+ * @status stable
14
+ * @since 4.0
15
+ *
16
+ * @slot - item body content.
17
+ * @slot qti-rubric-block - the qti rubric block is placed above the item
18
+ * @part qti-rubric-block - the qti rubric block part
19
+ */
20
+ let QtiItemBody = class QtiItemBody extends LitElement {
21
+ static { this.styles = styles; }
22
+ render() {
23
+ return html `<slot part="qti-rubric-blocks" name="qti-rubric-block"></slot><slot></slot>`;
24
+ }
25
+ };
26
+ QtiItemBody = __decorate([
27
+ customElement('qti-item-body')
28
+ ], QtiItemBody);
29
+ export { QtiItemBody };
30
+ //# sourceMappingURL=qti-item-body.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qti-item-body.js","sourceRoot":"","sources":["../../../src/components/qti-item-body/qti-item-body.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAEvC,OAAO,MAAM,MAAM,wBAAwB,CAAC;AAI5C;;;;;;;;;GASG;AAEI,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,UAAU;aACzB,WAAM,GAAmB,MAAM,AAAzB,CAA0B;IAEvC,MAAM;QACb,OAAO,IAAI,CAAA,6EAA6E,CAAC;IAC3F,CAAC;;AALU,WAAW;IADvB,aAAa,CAAC,eAAe,CAAC;GAClB,WAAW,CAMvB","sourcesContent":["import { customElement } from 'lit/decorators.js';\nimport { html, LitElement } from 'lit';\n\nimport styles from './qti-item-body.styles';\n\nimport type { CSSResultGroup } from 'lit';\n\n/**\n * @summary The qti-item-body node contains the text, graphics, media objects and interactions that describe the item's content and information about how it is structured.\n * @documentation https://www.imsglobal.org/spec/qti/v3p0/impl#h.sphpo6lu6zqi\n * @status stable\n * @since 4.0\n *\n * @slot - item body content.\n * @slot qti-rubric-block - the qti rubric block is placed above the item\n * @part qti-rubric-block - the qti rubric block part\n */\n@customElement('qti-item-body')\nexport class QtiItemBody extends LitElement {\n static override styles: CSSResultGroup = styles;\n\n override render() {\n return html`<slot part=\"qti-rubric-blocks\" name=\"qti-rubric-block\"></slot><slot></slot>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'qti-item-body': QtiItemBody;\n }\n}\n"]}
@@ -0,0 +1,2 @@
1
+ declare const _default: import("lit").CSSResult;
2
+ export default _default;
@@ -0,0 +1,7 @@
1
+ import { css } from 'lit';
2
+ export default css `
3
+ :host {
4
+ display: block;
5
+ }
6
+ `;
7
+ //# sourceMappingURL=qti-item-body.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qti-item-body.styles.js","sourceRoot":"","sources":["../../../src/components/qti-item-body/qti-item-body.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,eAAe,GAAG,CAAA;;;;CAIjB,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport default css`\n :host {\n display: block;\n }\n`;\n"]}
@@ -0,0 +1,14 @@
1
+ import { QtiFeedback } from '@qti-components/base';
2
+ export declare class QtiModalFeedback extends QtiFeedback {
3
+ static styles: import("lit").CSSResult;
4
+ render(): import("lit").TemplateResult<1>;
5
+ openFeedback(): void;
6
+ closeFeedback(): void;
7
+ connectedCallback(): void;
8
+ protected updated(changedProperties: Map<string | number | symbol, unknown>): void;
9
+ }
10
+ declare global {
11
+ interface HTMLElementTagNameMap {
12
+ 'qti-modal-feedback': QtiModalFeedback;
13
+ }
14
+ }
@@ -0,0 +1,95 @@
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 } from 'lit';
8
+ import { customElement } from 'lit/decorators.js';
9
+ import { QtiFeedback } from '@qti-components/base';
10
+ let QtiModalFeedback = class QtiModalFeedback extends QtiFeedback {
11
+ static { this.styles = css `
12
+ .qti-dialog {
13
+ background: var(--qti-bg);
14
+ border: var(--qti-border-thickness) var(--qti-border-style) var(--qti-border-color);
15
+ border-radius: var(--qti-border-radius);
16
+ padding: var(--qti-padding-vertical) var(--qti-padding-horizontal);
17
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
18
+ position: fixed;
19
+ top: 50%;
20
+ left: 50%;
21
+ transform: translate(-50%, -50%);
22
+ z-index: 1000;
23
+ width: auto;
24
+ max-width: 90%;
25
+ }
26
+
27
+ .button {
28
+ border-radius: var(--qti-border-radius);
29
+ padding: var(--qti-padding-vertical) var(--qti-padding-horizontal);
30
+ background-color: var(--qti-bg-active);
31
+ border: var(--qti-border-active);
32
+ cursor: pointer;
33
+ position: relative;
34
+ display: inline-block;
35
+ }
36
+
37
+ .button:hover {
38
+ background-color: var(--qti-hover-bg);
39
+ }
40
+
41
+ .button:disabled {
42
+ background-color: var(--qti-disabled-bg);
43
+ color: var(--qti-disabled-color);
44
+ cursor: not-allowed;
45
+ }
46
+
47
+ .button:focus {
48
+ outline: var(--qti-focus-border-width) solid var(--qti-focus-color);
49
+ }
50
+ `; }
51
+ render() {
52
+ return html `
53
+ <dialog class="qti-dialog" part="feedback" ?open="${this.showStatus === 'on'}">
54
+ <slot></slot>
55
+ <div style="margin-top: var(--qti-gap-size); text-align: center;">
56
+ <button class="button close-button" @click="${this.closeFeedback}">Close</button>
57
+ </div>
58
+ </dialog>
59
+ `;
60
+ }
61
+ openFeedback() {
62
+ const dialog = this.shadowRoot?.querySelector('dialog');
63
+ if (dialog && !dialog.open) {
64
+ dialog.showModal();
65
+ }
66
+ }
67
+ closeFeedback() {
68
+ const dialog = this.shadowRoot?.querySelector('dialog');
69
+ if (dialog && dialog.open) {
70
+ dialog.close();
71
+ this.showStatus = 'off';
72
+ }
73
+ }
74
+ connectedCallback() {
75
+ super.connectedCallback();
76
+ if (this.showStatus === 'on') {
77
+ this.openFeedback();
78
+ }
79
+ }
80
+ updated(changedProperties) {
81
+ if (changedProperties.has('showStatus')) {
82
+ if (this.showStatus === 'on') {
83
+ this.openFeedback();
84
+ }
85
+ else {
86
+ this.closeFeedback();
87
+ }
88
+ }
89
+ }
90
+ };
91
+ QtiModalFeedback = __decorate([
92
+ customElement('qti-modal-feedback')
93
+ ], QtiModalFeedback);
94
+ export { QtiModalFeedback };
95
+ //# sourceMappingURL=qti-modal-feedback.js.map