@citolab/qti-components 7.0.3 → 7.0.4

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.
@@ -83,6 +83,14 @@ export const rules = {
83
83
  tag: "qti-choice-interaction",
84
84
  attr: "readonly",
85
85
  },
86
+ {
87
+ tag: "qti-upload-interaction",
88
+ attr: "disabled",
89
+ },
90
+ {
91
+ tag: "qti-upload-interaction",
92
+ attr: "readonly",
93
+ },
86
94
  {
87
95
  tag: "qti-portable-custom-interaction",
88
96
  attr: "disabled",
@@ -207,22 +215,6 @@ export const rules = {
207
215
  tag: "qti-select-point-interaction",
208
216
  attr: "readonly",
209
217
  },
210
- {
211
- tag: "qti-slider-interaction",
212
- attr: "step-label",
213
- },
214
- {
215
- tag: "qti-slider-interaction",
216
- attr: "reverse",
217
- },
218
- {
219
- tag: "qti-slider-interaction",
220
- attr: "disabled",
221
- },
222
- {
223
- tag: "qti-slider-interaction",
224
- attr: "readonly",
225
- },
226
218
  {
227
219
  tag: "qti-gap-text",
228
220
  attr: "aria-disabled",
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import * as lit_html from 'lit-html';
2
2
  import * as lit from 'lit';
3
3
  import { LitElement } from 'lit';
4
- import { Q as QtiRule, a as QtiRuleBase, b as QtiExpressionBase, c as QtiExpression, B as BaseType, d as QtiConditionExpression, R as ResponseVariable, V as VariableDeclaration, I as ItemContext, e as QtiAssessmentItem } from './qti-simple-choice-UTrFa_RQ.js';
5
- export { s as ActiveElementMixin, A as ActiveElementMixinInterface, C as Calculate, n as Cardinality, r as ChoiceInterface, ai as Interaction, f as InteractionChangedDetails, M as Multiple, m as Ordered, N as Orientation, O as OutcomeChangedDetails, p as OutcomeVariable, X as QtiAnd, q as QtiAssessmentStimulusRef, aj as QtiAssociableHotspot, a1 as QtiAssociateInteraction, P as QtiChoiceInteraction, y as QtiCompanionMaterialsInfo, z as QtiContentBody, a2 as QtiCustomInteraction, ah as QtiCustomOperator, a3 as QtiEndAttemptInteraction, H as QtiExtendedTextInteraction, E as QtiFeedbackBlock, F as QtiFeedbackInline, ak as QtiGap, al as QtiGapImg, a4 as QtiGapMatchInteraction, am as QtiGapText, a5 as QtiGraphicAssociateInteraction, a6 as QtiGraphicGapMatchInteraction, a7 as QtiGraphicOrderInteraction, an as QtiHotspotChoice, a8 as QtiHotspotInteraction, ao as QtiHottext, K as QtiHottextInteraction, ap as QtiInlineChoice, L as QtiInlineChoiceInteraction, g as QtiInteractionChanged, t as QtiItemBody, W as QtiLookupOutcomeValue, Z as QtiMapping, a9 as QtiMatchInteraction, aa as QtiMediaInteraction, G as QtiModalFeedback, ab as QtiOrderInteraction, h as QtiOutcomeChanged, w as QtiOutcomeDeclaration, S as QtiOutcomeProcessing, T as QtiOutcomeProcessingProcessor, a0 as QtiPortableCustomInteraction, ac as QtiPositionObjectStage, u as QtiPrompt, x as QtiResponseDeclaration, U as QtiResponseProcessing, D as QtiRubricBlock, ad as QtiSelectPointInteraction, aq as QtiSimpleAssociableChoice, ar as QtiSimpleChoice, ae as QtiSliderInteraction, v as QtiStylesheet, _ as QtiSubtract, J as QtiTextEntryInteraction, j as ResponseInteraction, o as VariableValue, i as directedPair, k as float, l as integer, ag as itemContext, af as itemContextVariables, Y as qtiAndMixin, $ as qtiSubtractMixin } from './qti-simple-choice-UTrFa_RQ.js';
4
+ import { Q as QtiRule, a as QtiRuleBase, b as QtiExpressionBase, c as QtiExpression, B as BaseType, d as QtiConditionExpression, R as ResponseVariable, V as VariableDeclaration, I as ItemContext, e as QtiAssessmentItem } from './qti-simple-choice-D0GiMrqD.js';
5
+ export { s as ActiveElementMixin, A as ActiveElementMixinInterface, C as Calculate, n as Cardinality, r as ChoiceInterface, aj as Interaction, f as InteractionChangedDetails, M as Multiple, m as Ordered, N as Orientation, O as OutcomeChangedDetails, p as OutcomeVariable, Y as QtiAnd, q as QtiAssessmentStimulusRef, ak as QtiAssociableHotspot, a2 as QtiAssociateInteraction, P as QtiChoiceInteraction, y as QtiCompanionMaterialsInfo, z as QtiContentBody, a3 as QtiCustomInteraction, ai as QtiCustomOperator, a4 as QtiEndAttemptInteraction, H as QtiExtendedTextInteraction, E as QtiFeedbackBlock, F as QtiFeedbackInline, al as QtiGap, am as QtiGapImg, a5 as QtiGapMatchInteraction, an as QtiGapText, a6 as QtiGraphicAssociateInteraction, a7 as QtiGraphicGapMatchInteraction, a8 as QtiGraphicOrderInteraction, ao as QtiHotspotChoice, a9 as QtiHotspotInteraction, ap as QtiHottext, K as QtiHottextInteraction, aq as QtiInlineChoice, L as QtiInlineChoiceInteraction, g as QtiInteractionChanged, t as QtiItemBody, X as QtiLookupOutcomeValue, _ as QtiMapping, aa as QtiMatchInteraction, ab as QtiMediaInteraction, G as QtiModalFeedback, ac as QtiOrderInteraction, h as QtiOutcomeChanged, w as QtiOutcomeDeclaration, T as QtiOutcomeProcessing, U as QtiOutcomeProcessingProcessor, a1 as QtiPortableCustomInteraction, ad as QtiPositionObjectStage, u as QtiPrompt, x as QtiResponseDeclaration, W as QtiResponseProcessing, D as QtiRubricBlock, ae as QtiSelectPointInteraction, ar as QtiSimpleAssociableChoice, as as QtiSimpleChoice, af as QtiSliderInteraction, v as QtiStylesheet, $ as QtiSubtract, J as QtiTextEntryInteraction, S as QtiUploadInteraction, j as ResponseInteraction, o as VariableValue, i as directedPair, k as float, l as integer, ah as itemContext, ag as itemContextVariables, Z as qtiAndMixin, a0 as qtiSubtractMixin } from './qti-simple-choice-D0GiMrqD.js';
6
6
  import 'lit-html/directives/ref.js';
7
7
 
8
8
  declare class QtiResponseCondition extends QtiRule {
@@ -256,41 +256,46 @@ declare const QtiTest_base: (abstract new (...args: any[]) => {}) & (abstract ne
256
256
  *
257
257
  * ### Example Usage
258
258
  *
259
- * Minimal markup:
260
- * ```html
261
- * <qti-test test="./path/to/assessment.xml">
262
- * <test-container></test-container>
263
- * </qti-test>
264
- * ```
259
+ * Minimal example including navigation:
265
260
  *
266
- * With navigation buttons:
267
261
  * ```html
268
- * <qti-test >
262
+ * <qti-test>
269
263
  * <test-container test-url="./path/to/assessment.xml"></test-container>
270
- * <div class="flex">
264
+ * <nav class="flex">
271
265
  * <test-prev></test-prev>
272
266
  * <test-next></test-next>
273
- * </div>
267
+ * </nav>
274
268
  * </qti-test>
275
269
  * ```
276
270
  *
277
- * You can use normal class names to style the elements.
278
- * And you can use the `test-prev` and `test-next` elements to navigate through the test.
271
+ * Use the following file structure
272
+ * A qti-test loads a QTI3.0 assessmenttest.xml file from a package folder.
273
+ *
274
+ * ```plaintext
275
+ * Root/
276
+ * ├── index.html
277
+ * └── /assets/api/examples/
278
+ * ├── assessmenttest.xml
279
+ * └── imsmanifest.xml
279
280
  *
280
- * @attr {string} testURL - the relative location to the QTI assessment.xml file
281
+ * ```
281
282
  *
282
- * ### Features
283
+ * ### Test components
284
+ *
285
+ * Use test components inside the qti-test component for added functionality.
286
+ * ### Test next
287
+ * `<test-next> | TestNext`
288
+ *
289
+ * ### Test prev
290
+ *
291
+ * `<test-prev> | TestPrev`
292
+ * ### Test components
293
+ *
294
+ * You can use normal class names to style the elements.
295
+ * And you can use the `test-prev` and `test-next` elements to navigate through the test.
283
296
  *
284
- * - **Dynamic Template Loading**:
285
- * If a `<template>` element is included as a child of `<qti-test>`, its content is dynamically appended to the shadow DOM.
286
297
  */
287
298
  declare class QtiTest extends QtiTest_base {
288
- /**
289
- * Lifecycle callback invoked when the element is added to the DOM.
290
- * Automatically appends the content of a `<template>` element (if present)
291
- * to the shadow DOM.
292
- */
293
- connectedCallback(): void;
294
299
  /**
295
300
  * Renders the component's template.
296
301
  * Provides a default `<slot>` for content projection.
@@ -379,6 +384,7 @@ declare global {
379
384
  }
380
385
 
381
386
  declare class TestItemLink extends TestComponent {
387
+ static styles: lit.CSSResult;
382
388
  private itemId;
383
389
  constructor();
384
390
  render(): lit_html.TemplateResult<1>;
@@ -390,43 +396,33 @@ declare global {
390
396
  }
391
397
 
392
398
  /**
393
- * `<test-container>` is a custom element designed for hosting the qti-assessment-test.
399
+ * `<test-container>` is a custom element designed for hosting the qti-assessment-item.
394
400
  * The `qti-assessment-test` will be placed inside the shadow DOM of this element.
401
+ * The element loads the item from the provided URL and renders it inside the shadow DOM.
395
402
  *
396
- * ### Example Usage
397
- * The `test-container` element to hosts the visual representation of the items.
398
- * You can style the container by adding a class to the element.
403
+ * ### Styling
404
+ * Add a class to the element for styling.
399
405
  *
400
406
  * ```html
401
- * <qti-test testurl="./path/to/assessment.xml">
402
- * <test-container class="container bg-white m-2"></test-container>
407
+ * <qti-test>
408
+ * <test-container class="m-4 bg-white" test-url="./path/to/item.xml"></test-container>
403
409
  * </qti-test>
404
410
  * ```
405
- *
406
- * @tag test-container
407
411
  */
408
412
  declare class TestContainer extends LitElement {
409
- /**
410
- * Internal state for the dynamically loaded content.
411
- * This is a Promise resolving to the content that will be rendered.
412
- */
413
- private content;
413
+ /** URL of the item to load */
414
414
  testURL: string;
415
- /**
416
- * Preloaded content from a `<template>` child, if present.
417
- */
418
- private preContent;
419
- /**
420
- * Lifecycle callback invoked when the element is added to the DOM.
421
- * Handles template preloading and dispatches a `qti-load-test-request` event
422
- * if no template is found.
423
- */
415
+ /** A parsed HTML document */
416
+ testDoc: DocumentFragment;
417
+ /** The raw XML string */
418
+ testXML: string;
419
+ /** Template content if provided */
420
+ private templateContent;
421
+ protected handleTestURLChange(): Promise<void>;
422
+ protected handleTestXMLChange(): void;
424
423
  connectedCallback(): Promise<void>;
425
- /**
426
- * Renders the component content.
427
- * Preloaded template content is rendered first, followed by the default slot
428
- * and dynamically loaded content.
429
- */
424
+ private initializeTemplateContent;
425
+ private applyStyles;
430
426
  render(): lit_html.TemplateResult<1>;
431
427
  }
432
428
  declare global {
@@ -448,23 +444,61 @@ declare global {
448
444
  }
449
445
  }
450
446
 
451
- type Constructor<T = {}> = new (...args: any[]) => T;
452
- interface QtiItemInterface {
453
- identifier?: string;
454
- href?: string;
455
- xmlDoc: DocumentFragment;
456
- assessmentItem: QtiAssessmentItem | null;
447
+ /**
448
+ * `<qti-item>` is a custom element designed for rendering a single `qti-assessment-item`.
449
+ * It can also host some functionalities to interact with the item like scoring, showing feedback, etc.
450
+ * Placing a mandatory `<item-container>` inside '<qti-item>' will load or parse the item and render it.
451
+ * See `<item-container>` for more details.
452
+ *
453
+ * ```html
454
+ * <qti-item>
455
+ * <item-container class="m-4 bg-white" item-url="./path/to/item.xml"></item-container>
456
+ * </qti-item>
457
+ * ```
458
+ */
459
+ declare class QtiItem extends LitElement {
460
+ render(): lit_html.TemplateResult<1>;
461
+ }
462
+ declare global {
463
+ interface HTMLElementTagNameMap {
464
+ 'qti-item': QtiItem;
465
+ }
457
466
  }
458
- declare function QtiItemMixin<T extends Constructor<LitElement>>(Base: T): Constructor<QtiItemInterface> & T;
459
467
 
460
- declare const QtiItem_base: (new (...args: any[]) => QtiItemInterface) & typeof LitElement;
461
- declare class QtiItem extends QtiItem_base {
462
- connectedCallback(): void;
468
+ /**
469
+ * `<item-container>` is a custom element designed for hosting the qti-assessment-item.
470
+ * The `qti-assessment-item` will be placed inside the shadow DOM of this element.
471
+ * The element loads the item from the provided URL and renders it inside the shadow DOM.
472
+ *
473
+ * ### Styling
474
+ * Add a class to the element for styling.
475
+ *
476
+ * ```html
477
+ * <qti-item>
478
+ * <item-container class="m-4 bg-white" item-url="./path/to/item.xml"></item-container>
479
+ * </qti-item>
480
+ * ```
481
+ */
482
+ declare class ItemContainer extends LitElement {
483
+ /** URL of the item to load */
484
+ itemURL: string;
485
+ /** A parsed HTML document */
486
+ itemDoc: DocumentFragment;
487
+ /** The raw XML string */
488
+ itemXML: string;
489
+ /** Template content if provided */
490
+ private templateContent;
491
+ protected handleItemURLChange(): Promise<void>;
492
+ protected handleItemXMLChange(): void;
493
+ connectedCallback(): Promise<void>;
494
+ private initializeTemplateContent;
495
+ private applyStyles;
496
+ render(): lit_html.TemplateResult<1>;
463
497
  }
464
498
  declare global {
465
499
  interface HTMLElementTagNameMap {
466
- 'qti-item': QtiItem;
500
+ 'item-container': ItemContainer;
467
501
  }
468
502
  }
469
503
 
470
- export { BaseType, ItemContext, QtiAssessmentItem, QtiAssessmentItemRef, QtiAssessmentSection, QtiAssessmentTest, QtiBaseValue, QtiConditionExpression, QtiContains, QtiCorrect, QtiEqual, QtiEqualRounded, QtiExpression, QtiExpressionBase, QtiGt, QtiGte, QtiIsNull, QtiItem, type QtiItemInterface, QtiItemMixin, QtiLt, QtiLte, QtiMapResponse, QtiMatch, QtiMember, QtiMultiple, QtiNot, QtiOr, QtiOrdered, QtiPositionObjectInteraction, QtiPrintedVariable, QtiProduct, QtiResponseCondition, QtiResponseElse, QtiResponseElseIf, QtiResponseIf, QtiRule, QtiRuleBase, QtiSetOutcomeValue, QtiSetOutcomeValueRule, QtiStringMatch, QtiSum, QtiSumExpression, QtiTest, QtiTestPart, QtiVariable, ResponseVariable, TestContainer, type TestContext, type TestElement, TestItemLink, TestNext, TestPagingButtonsStamp, TestPrev, TestView, VariableDeclaration, testContext, testElement };
504
+ export { BaseType, ItemContainer, ItemContext, QtiAssessmentItem, QtiAssessmentItemRef, QtiAssessmentSection, QtiAssessmentTest, QtiBaseValue, QtiConditionExpression, QtiContains, QtiCorrect, QtiEqual, QtiEqualRounded, QtiExpression, QtiExpressionBase, QtiGt, QtiGte, QtiIsNull, QtiItem, QtiLt, QtiLte, QtiMapResponse, QtiMatch, QtiMember, QtiMultiple, QtiNot, QtiOr, QtiOrdered, QtiPositionObjectInteraction, QtiPrintedVariable, QtiProduct, QtiResponseCondition, QtiResponseElse, QtiResponseElseIf, QtiResponseIf, QtiRule, QtiRuleBase, QtiSetOutcomeValue, QtiSetOutcomeValueRule, QtiStringMatch, QtiSum, QtiSumExpression, QtiTest, QtiTestPart, QtiVariable, ResponseVariable, TestContainer, type TestContext, type TestElement, TestItemLink, TestNext, TestPagingButtonsStamp, TestPrev, TestView, VariableDeclaration, testContext, testElement };