@citolab/qti-components 7.0.2 → 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.
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-DG8ImdPz.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-DG8ImdPz.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 {
@@ -153,9 +153,15 @@ interface TestContext {
153
153
  })[];
154
154
  testOutcomeVariables: VariableDeclaration<string | string[]>[];
155
155
  }
156
+ declare const testContext: {
157
+ __context__: Readonly<TestContext>;
158
+ };
156
159
  type TestElement = {
157
160
  el: QtiAssessmentTest;
158
161
  };
162
+ declare const testElement: {
163
+ __context__: Readonly<TestElement>;
164
+ };
159
165
 
160
166
  declare class QtiAssessmentItemRef extends LitElement {
161
167
  category?: string;
@@ -250,43 +256,46 @@ declare const QtiTest_base: (abstract new (...args: any[]) => {}) & (abstract ne
250
256
  *
251
257
  * ### Example Usage
252
258
  *
253
- * Minimal markup:
254
- * ```html
255
- * <qti-test test="./path/to/assessment.xml">
256
- * <test-container></test-container>
257
- * </qti-test>
258
- * ```
259
+ * Minimal example including navigation:
259
260
  *
260
- * With navigation buttons:
261
261
  * ```html
262
- * <qti-test >
262
+ * <qti-test>
263
263
  * <test-container test-url="./path/to/assessment.xml"></test-container>
264
- * <div class="flex">
264
+ * <nav class="flex">
265
265
  * <test-prev></test-prev>
266
266
  * <test-next></test-next>
267
- * </div>
267
+ * </nav>
268
268
  * </qti-test>
269
269
  * ```
270
270
  *
271
- * You can use normal class names to style the elements.
272
- * 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
273
  *
274
- * @attr {string} testURL - the relative location to the QTI assessment.xml file
274
+ * ```plaintext
275
+ * Root/
276
+ * ├── index.html
277
+ * └── /assets/api/examples/
278
+ * ├── assessmenttest.xml
279
+ * └── imsmanifest.xml
275
280
  *
276
- * @tag qti-player
281
+ * ```
282
+ *
283
+ * ### Test components
284
+ *
285
+ * Use test components inside the qti-test component for added functionality.
286
+ * ### Test next
287
+ * `<test-next> | TestNext`
277
288
  *
278
- * ### Features
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.
279
296
  *
280
- * - **Dynamic Template Loading**:
281
- * If a `<template>` element is included as a child of `<qti-test>`, its content is dynamically appended to the shadow DOM.
282
297
  */
283
298
  declare class QtiTest extends QtiTest_base {
284
- /**
285
- * Lifecycle callback invoked when the element is added to the DOM.
286
- * Automatically appends the content of a `<template>` element (if present)
287
- * to the shadow DOM.
288
- */
289
- connectedCallback(): void;
290
299
  /**
291
300
  * Renders the component's template.
292
301
  * Provides a default `<slot>` for content projection.
@@ -375,6 +384,7 @@ declare global {
375
384
  }
376
385
 
377
386
  declare class TestItemLink extends TestComponent {
387
+ static styles: lit.CSSResult;
378
388
  private itemId;
379
389
  constructor();
380
390
  render(): lit_html.TemplateResult<1>;
@@ -386,43 +396,33 @@ declare global {
386
396
  }
387
397
 
388
398
  /**
389
- * `<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.
390
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.
391
402
  *
392
- * ### Example Usage
393
- * The `test-container` element to hosts the visual representation of the items.
394
- * You can style the container by adding a class to the element.
403
+ * ### Styling
404
+ * Add a class to the element for styling.
395
405
  *
396
406
  * ```html
397
- * <qti-test testurl="./path/to/assessment.xml">
398
- * <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>
399
409
  * </qti-test>
400
410
  * ```
401
- *
402
- * @tag test-container
403
411
  */
404
412
  declare class TestContainer extends LitElement {
405
- /**
406
- * Internal state for the dynamically loaded content.
407
- * This is a Promise resolving to the content that will be rendered.
408
- */
409
- private content;
413
+ /** URL of the item to load */
410
414
  testURL: string;
411
- /**
412
- * Preloaded content from a `<template>` child, if present.
413
- */
414
- private preContent;
415
- /**
416
- * Lifecycle callback invoked when the element is added to the DOM.
417
- * Handles template preloading and dispatches a `qti-load-test-request` event
418
- * if no template is found.
419
- */
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;
420
423
  connectedCallback(): Promise<void>;
421
- /**
422
- * Renders the component content.
423
- * Preloaded template content is rendered first, followed by the default slot
424
- * and dynamically loaded content.
425
- */
424
+ private initializeTemplateContent;
425
+ private applyStyles;
426
426
  render(): lit_html.TemplateResult<1>;
427
427
  }
428
428
  declare global {
@@ -444,22 +444,61 @@ declare global {
444
444
  }
445
445
  }
446
446
 
447
- type Constructor<T = {}> = new (...args: any[]) => T;
448
- interface QtiItemInterface {
449
- identifier?: string;
450
- href?: string;
451
- xmlDoc: DocumentFragment;
452
- 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
+ }
453
466
  }
454
- declare function QtiItemMixin<T extends Constructor<LitElement>>(Base: T): Constructor<QtiItemInterface> & T;
455
467
 
456
- declare const QtiItem_base: (new (...args: any[]) => QtiItemInterface) & typeof LitElement;
457
- declare class QtiItem extends QtiItem_base {
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>;
458
497
  }
459
498
  declare global {
460
499
  interface HTMLElementTagNameMap {
461
- 'qti-item': QtiItem;
500
+ 'item-container': ItemContainer;
462
501
  }
463
502
  }
464
503
 
465
- 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, TestItemLink, TestNext, TestPagingButtonsStamp, TestPrev, TestView, VariableDeclaration };
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 };