@citolab/qti-components 10.0.0-next.15 → 10.0.0-next.17
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/cdn/index.global.js +1 -1
- package/cdn/index.js +1503 -2931
- package/dist/base.d.ts +37 -11
- package/dist/base.js +8 -1
- package/dist/{chunk-G2EIC7H2.js → chunk-7MYZHZWV.js} +955 -364
- package/dist/chunk-7MYZHZWV.js.map +1 -0
- package/dist/chunk-DJ7PB252.js +7 -0
- package/dist/chunk-DJ7PB252.js.map +1 -0
- package/dist/{chunk-F553IZPL.js → chunk-J3F3JSCW.js} +2 -2
- package/dist/chunk-J6VX4N7M.js +197 -0
- package/dist/chunk-J6VX4N7M.js.map +1 -0
- package/dist/{chunk-32PI7KWX.js → chunk-L3LBSAGZ.js} +2 -2
- package/dist/{chunk-WIUPAUJV.js → chunk-L7J2ZOJL.js} +2 -2
- package/dist/{chunk-IM5AKPIJ.js → chunk-NZ7ZC4SP.js} +96 -4
- package/dist/chunk-NZ7ZC4SP.js.map +1 -0
- package/dist/{chunk-XY5DHYIH.js → chunk-OG5HIRHE.js} +3 -3
- package/dist/chunk-PZ5AY32C.js +10 -0
- package/dist/chunk-PZ5AY32C.js.map +1 -0
- package/dist/{chunk-HT3LSWXL.js → chunk-QLGUI5VG.js} +2 -2
- package/dist/chunk-UCXLDQYA.js +56 -0
- package/dist/chunk-UCXLDQYA.js.map +1 -0
- package/dist/{chunk-5AJZGRWI.js → chunk-UDJ7MHLF.js} +4 -4
- package/dist/chunk-UDJ7MHLF.js.map +1 -0
- package/dist/{chunk-MIQZBDTB.js → chunk-UURHLJVM.js} +107 -1809
- package/dist/chunk-UURHLJVM.js.map +1 -0
- package/dist/{chunk-IWNRQVNW.js → chunk-V5GL7PTC.js} +2 -2
- package/dist/{chunk-QT7WQXCS.js → chunk-WGUQCB2Z.js} +28 -82
- package/dist/chunk-WGUQCB2Z.js.map +1 -0
- package/dist/chunk-WWY2H2YO.js +7 -0
- package/dist/chunk-WWY2H2YO.js.map +1 -0
- package/dist/{chunk-URYYGVTA.js → chunk-ZAHZVBV7.js} +60 -75
- package/dist/chunk-ZAHZVBV7.js.map +1 -0
- package/dist/{computed.types.d-IXACuBr7.d.ts → computed.types.d-D4wskgi0.d.ts} +2 -2
- package/dist/corrections.d.ts +123 -20
- package/dist/corrections.js +11 -11
- package/dist/corrections.js.map +1 -1
- package/dist/elements.d.ts +35 -112
- package/dist/elements.js +8 -5
- package/dist/index.d.ts +18 -14
- package/dist/index.js +29 -63
- package/dist/interactions.d.ts +84 -17
- package/dist/interactions.js +4 -3
- package/dist/item.css +1057 -2383
- package/dist/item.d.ts +6 -4
- package/dist/item.js +5 -4
- package/dist/item.types.d-Zc6ZQDhu.d.ts +25 -0
- package/dist/loader.d.ts +4 -2
- package/dist/loader.js +1 -0
- package/dist/processing.d.ts +4 -3
- package/dist/processing.js +4 -3
- package/dist/public-events.d-3dGip9pd.d.ts +105 -0
- package/dist/qti-components-jsx.d.ts +4058 -4421
- package/dist/{qti-condition-expression.d-B-T1NNl0.d.ts → qti-condition-expression.d-7Kd4LBxn.d.ts} +1 -1
- package/dist/{qti-expression.d-B-Cfbqlb.d.ts → qti-expression.d-iH3w6mqf.d.ts} +2 -1
- package/dist/{qti-feedback.d-GAqMqAt6.d.ts → qti-feedback.d-CT0W-8Gm.d.ts} +2 -2
- package/dist/{qti-item.d-pFcNk0th.d.ts → qti-item.d-CLChmRvB.d.ts} +2 -1
- package/dist/qti-test-state-BAf5AmJ2.d.ts +68 -0
- package/dist/qti-test-state.d-D8Q89RzZ.d.ts +57 -0
- package/dist/{qti-test.d-BjhVQnQy.d.ts → qti-test.d-COzv7YZG.d.ts} +14 -548
- package/dist/{qti-text-entry-interaction.d-DECzpIzi.d.ts → qti-text-entry-interaction.d-DsUyecBC.d.ts} +144 -43
- package/dist/{record.d-CljDLwRz.d.ts → record.d-BfZhFr0L.d.ts} +34 -3
- package/dist/{session.context.d-DW09Lrie.d.ts → session.context.d-9gRdGK4T.d.ts} +2 -2
- package/dist/test-plugin-api.d.ts +134 -0
- package/dist/test-plugin-api.js +19 -0
- package/dist/test-plugin-api.js.map +1 -0
- package/dist/test.d.ts +16 -158
- package/dist/test.js +13 -52
- package/dist/transformers.js +1 -0
- package/dist/{item.types.d-DuVR0ZVK.d.ts → variables.d-DWHlTszN.d.ts} +1 -23
- package/package.json +13 -9
- package/dist/chunk-5AJZGRWI.js.map +0 -1
- package/dist/chunk-G2EIC7H2.js.map +0 -1
- package/dist/chunk-IM5AKPIJ.js.map +0 -1
- package/dist/chunk-MIQZBDTB.js.map +0 -1
- package/dist/chunk-QT7WQXCS.js.map +0 -1
- package/dist/chunk-RNLSNH4N.js +0 -7
- package/dist/chunk-RNLSNH4N.js.map +0 -1
- package/dist/chunk-URYYGVTA.js.map +0 -1
- /package/dist/{chunk-F553IZPL.js.map → chunk-J3F3JSCW.js.map} +0 -0
- /package/dist/{chunk-32PI7KWX.js.map → chunk-L3LBSAGZ.js.map} +0 -0
- /package/dist/{chunk-WIUPAUJV.js.map → chunk-L7J2ZOJL.js.map} +0 -0
- /package/dist/{chunk-XY5DHYIH.js.map → chunk-OG5HIRHE.js.map} +0 -0
- /package/dist/{chunk-HT3LSWXL.js.map → chunk-QLGUI5VG.js.map} +0 -0
- /package/dist/{chunk-IWNRQVNW.js.map → chunk-V5GL7PTC.js.map} +0 -0
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import * as lit from 'lit';
|
|
2
|
-
import { LitElement, PropertyValues
|
|
2
|
+
import { LitElement, PropertyValues } from 'lit';
|
|
3
3
|
import { b as transformTestApi, t as transformItemApi } from './qti-transform-test.d-Bb9vnLzP.js';
|
|
4
|
-
import { C as ComputedContext, a as ComputedItem } from './computed.types.d-
|
|
4
|
+
import { C as ComputedContext, a as ComputedItem } from './computed.types.d-D4wskgi0.js';
|
|
5
|
+
import './public-events.d-3dGip9pd.js';
|
|
5
6
|
import { QtiAssessmentItem, QtiModalFeedback } from './elements.js';
|
|
6
7
|
import { Q as QtiContext } from './qti.context.d-CejJMlfZ.js';
|
|
7
|
-
import { T as TestContext, Q as QtiExpression, a as QtiExpressionBase } from './qti-expression.d-
|
|
8
|
+
import { T as TestContext, Q as QtiExpression, a as QtiExpressionBase } from './qti-expression.d-iH3w6mqf.js';
|
|
8
9
|
import { TemplateFunction } from '@heximal/templates';
|
|
9
|
-
import {
|
|
10
|
-
import { S as SessionContext, V as View } from './session.context.d-
|
|
10
|
+
import { g as VariableValue, b as OutcomeVariable, V as VariableDeclaration } from './variables.d-DWHlTszN.js';
|
|
11
|
+
import { S as SessionContext, V as View } from './session.context.d-9gRdGK4T.js';
|
|
11
12
|
import { C as ConfigContext } from './config.context.d-CCqlJXpE.js';
|
|
13
|
+
import { I as ItemContext } from './item.types.d-Zc6ZQDhu.js';
|
|
14
|
+
import { Q as QtiTestState } from './qti-test-state.d-D8Q89RzZ.js';
|
|
12
15
|
import { b as QtiRuleBase } from './qti-rule-base.d-CeKP0Ooi.js';
|
|
13
16
|
|
|
14
17
|
declare class QtiAssessmentTest extends LitElement {
|
|
@@ -27,7 +30,7 @@ declare global {
|
|
|
27
30
|
}
|
|
28
31
|
declare module '../../public-events' {
|
|
29
32
|
interface PublicEventMap {
|
|
30
|
-
'
|
|
33
|
+
'qc-test-loaded': CustomEvent<QtiAssessmentTest>;
|
|
31
34
|
}
|
|
32
35
|
}
|
|
33
36
|
|
|
@@ -379,67 +382,6 @@ interface ITestNavigationMixin {
|
|
|
379
382
|
};
|
|
380
383
|
}
|
|
381
384
|
|
|
382
|
-
/**
|
|
383
|
-
* Everything a host needs to persist to resume a candidate's test session, and nothing else.
|
|
384
|
-
*
|
|
385
|
-
* Read it from `qtiTest.state` or the `qti-state-changed` event, store it wherever you like —
|
|
386
|
-
* a database, `localStorage`, `sessionStorage` — and assign it back to `qtiTest.state` to resume.
|
|
387
|
-
*
|
|
388
|
-
* Deliberately not here:
|
|
389
|
-
* - declaration metadata (`baseType`, `cardinality`, `correctResponse`, `mapping`, …): it comes
|
|
390
|
-
* from the item XML on every load, and persisting the answer key with the candidate's data is
|
|
391
|
-
* both bloat and a leak;
|
|
392
|
-
* - `configContext` and `qtiContext`: inputs the host supplies on every load, not session state.
|
|
393
|
-
* The shuffle `seed` in particular must be passed in again, or the restored order changes;
|
|
394
|
-
* - `view`: a role the host decides, not something the candidate produced;
|
|
395
|
-
* - anything computed — scores per section, `done`, `active` — which is rederived from this.
|
|
396
|
-
*/
|
|
397
|
-
interface QtiTestState {
|
|
398
|
-
/** Bumped on any incompatible change to this shape. A state with another version is ignored. */
|
|
399
|
-
version: 1;
|
|
400
|
-
test: {
|
|
401
|
-
items: QtiTestStateItem[];
|
|
402
|
-
/** Test-level outcome values. Only outcomes the test declares are restored. */
|
|
403
|
-
outcomes: QtiTestStateValue[];
|
|
404
|
-
};
|
|
405
|
-
session: QtiTestStateSession;
|
|
406
|
-
}
|
|
407
|
-
interface QtiTestStateItem {
|
|
408
|
-
/** The `qti-assessment-item-ref` identifier. */
|
|
409
|
-
identifier: string;
|
|
410
|
-
variables: (QtiTestStateValue & {
|
|
411
|
-
type?: 'response' | 'outcome' | 'template' | 'context';
|
|
412
|
-
})[];
|
|
413
|
-
/** Opaque per-interaction state keyed by response identifier, e.g. a PCI's `getState()`. */
|
|
414
|
-
state?: Record<string, string | null>;
|
|
415
|
-
}
|
|
416
|
-
interface QtiTestStateValue {
|
|
417
|
-
identifier: string;
|
|
418
|
-
value: string | string[] | null;
|
|
419
|
-
}
|
|
420
|
-
/**
|
|
421
|
-
* What each plugin keeps in the state, by plugin name. Empty here: a plugin adds its own entry by
|
|
422
|
-
* augmenting this interface (`declare module` on the module that declares it, with
|
|
423
|
-
* `interface QtiTestPluginState { bookmarks: string[] }`), and reads it with
|
|
424
|
-
* `pluginState(computedContext, 'bookmarks')`. The test never reads an entry; it
|
|
425
|
-
* stores and restores it, so a value must survive `JSON.stringify`.
|
|
426
|
-
*/
|
|
427
|
-
interface QtiTestPluginState {
|
|
428
|
-
}
|
|
429
|
-
/** Where the candidate is, and what plugins keep. */
|
|
430
|
-
interface QtiTestStateSession {
|
|
431
|
-
/** Plugin entries by plugin name. Entries of plugins that are not loaded are kept as they are. */
|
|
432
|
-
plugins?: Partial<QtiTestPluginState> & Record<string, unknown>;
|
|
433
|
-
navPartId?: string | null;
|
|
434
|
-
navSectionId?: string | null;
|
|
435
|
-
navItemRefId?: string | null;
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
declare global {
|
|
439
|
-
interface GlobalEventHandlersEventMap {
|
|
440
|
-
'qti-state-changed': CustomEvent<QtiTestState>;
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
385
|
interface ITestStateMixin {
|
|
444
386
|
/**
|
|
445
387
|
* The candidate's persistable state: what they answered and where they are.
|
|
@@ -561,22 +503,9 @@ declare global {
|
|
|
561
503
|
}
|
|
562
504
|
}
|
|
563
505
|
|
|
564
|
-
declare class TestItemLink extends LitElement {
|
|
565
|
-
static styles: lit.CSSResult;
|
|
566
|
-
private itemId;
|
|
567
|
-
constructor();
|
|
568
|
-
protected _requestItem(identifier: string): void;
|
|
569
|
-
render(): lit.TemplateResult<1>;
|
|
570
|
-
}
|
|
571
|
-
declare global {
|
|
572
|
-
interface HTMLElementTagNameMap {
|
|
573
|
-
'test-item-link': TestItemLink;
|
|
574
|
-
}
|
|
575
|
-
}
|
|
576
|
-
|
|
577
506
|
/**
|
|
578
507
|
* A button that ends the attempt of an item: its response is processed, `numAttempts` goes up and
|
|
579
|
-
* feedback is shown as the item's session control allows. It dispatches `
|
|
508
|
+
* feedback is shown as the item's session control allows. It dispatches `qc-test-end-attempt`,
|
|
580
509
|
* which `<test-navigation>` handles.
|
|
581
510
|
*
|
|
582
511
|
* Put it inside `<test-navigation>`, either in the toolbar, where it ends the attempt of the item on
|
|
@@ -654,190 +583,9 @@ declare global {
|
|
|
654
583
|
}
|
|
655
584
|
}
|
|
656
585
|
|
|
657
|
-
declare class TestSectionLink extends LitElement {
|
|
658
|
-
#private;
|
|
659
|
-
static styles: lit.CSSResult;
|
|
660
|
-
private sectionId;
|
|
661
|
-
constructor();
|
|
662
|
-
render(): lit.TemplateResult<1>;
|
|
663
|
-
}
|
|
664
|
-
declare global {
|
|
665
|
-
interface HTMLElementTagNameMap {
|
|
666
|
-
'test-section-link': TestSectionLink;
|
|
667
|
-
}
|
|
668
|
-
}
|
|
669
|
-
|
|
670
|
-
declare module '../../types/qti-test-state' {
|
|
671
|
-
interface QtiTestPluginState {
|
|
672
|
-
/** Item-ref identifiers the candidate marked to come back to, in the order they were marked. */
|
|
673
|
-
bookmarks: string[];
|
|
674
|
-
}
|
|
675
|
-
}
|
|
676
|
-
/** The item-ref identifiers bookmarked so far. For a host's own navigation: mark these. */
|
|
677
|
-
declare const bookmarkedItems: (context: Pick<ComputedContext, "plugins"> | undefined) => string[];
|
|
678
|
-
/**
|
|
679
|
-
* A toggle that marks the item on screen to come back to. The marks live in the test's state under
|
|
680
|
-
* `bookmarks` (`session.plugins.bookmarks`), so a host that stores `state` stores them, and a
|
|
681
|
-
* reloaded test shows them again.
|
|
682
|
-
*
|
|
683
|
-
* Put it inside `<test-navigation>`, either in the toolbar, where it marks the item on screen, or in
|
|
684
|
-
* the `<template item-ref>`, where each item gets its own and it marks that item. It is a button
|
|
685
|
-
* (`role="button"`, `aria-pressed`) and reflects `bookmarked` on the host for styling; its content is
|
|
686
|
-
* the label. In the toolbar it is `disabled` while no item is on screen. A host's own navigation reads
|
|
687
|
-
* the marks with `bookmarkedItems(computedContext)`.
|
|
688
|
-
*
|
|
689
|
-
* Give it an `item` (an item-ref identifier) to mark that item instead, wherever the button sits: in a
|
|
690
|
-
* stamp template that lists the items of a section, `<test-bookmark item="{{ item.identifier }}">`
|
|
691
|
-
* puts a button next to each one.
|
|
692
|
-
*
|
|
693
|
-
* @slot - The label.
|
|
694
|
-
* @attr item - The item-ref identifier this button marks; without it, the item it is stamped into, or else the one on screen.
|
|
695
|
-
* @attr bookmarked - Reflected: the item on screen is bookmarked.
|
|
696
|
-
* @attr disabled - Reflected: there is no item on screen.
|
|
697
|
-
*/
|
|
698
|
-
declare class TestBookmark extends LitElement {
|
|
699
|
-
#private;
|
|
700
|
-
protected computedContext?: ComputedContext;
|
|
701
|
-
item?: string;
|
|
702
|
-
bookmarked: boolean;
|
|
703
|
-
disabled: boolean;
|
|
704
|
-
static styles: lit.CSSResult[];
|
|
705
|
-
constructor();
|
|
706
|
-
connectedCallback(): void;
|
|
707
|
-
protected willUpdate(): void;
|
|
708
|
-
protected updated(): void;
|
|
709
|
-
render(): lit.TemplateResult<1>;
|
|
710
|
-
}
|
|
711
|
-
declare global {
|
|
712
|
-
interface HTMLElementTagNameMap {
|
|
713
|
-
'test-bookmark': TestBookmark;
|
|
714
|
-
}
|
|
715
|
-
}
|
|
716
|
-
|
|
717
|
-
/**
|
|
718
|
-
* Ends the attempt on the current item and switches the test to `view` (default `scorer`), which
|
|
719
|
-
* reveals the `[view]` content for that view, such as a scorer's rubric. The view stays until
|
|
720
|
-
* something switches it back (`test-view-toggle`).
|
|
721
|
-
*
|
|
722
|
-
* @attr view - The view to switch to after the attempt ended.
|
|
723
|
-
*/
|
|
724
|
-
declare class TestCheckItem extends LitElement {
|
|
725
|
-
view: View;
|
|
726
|
-
static styles: lit.CSSResult;
|
|
727
|
-
constructor();
|
|
728
|
-
render(): lit.TemplateResult<1>;
|
|
729
|
-
}
|
|
730
|
-
declare global {
|
|
731
|
-
interface HTMLElementTagNameMap {
|
|
732
|
-
'test-check-item': TestCheckItem;
|
|
733
|
-
}
|
|
734
|
-
}
|
|
735
|
-
|
|
736
|
-
declare class TestPrintContext extends LitElement {
|
|
737
|
-
computedContext?: ComputedContext;
|
|
738
|
-
render(): lit.TemplateResult<1>;
|
|
739
|
-
}
|
|
740
|
-
declare global {
|
|
741
|
-
interface HTMLElementTagNameMap {
|
|
742
|
-
'test-print-context': TestPrintContext;
|
|
743
|
-
}
|
|
744
|
-
}
|
|
745
|
-
|
|
746
|
-
declare class TestPrintVariables extends LitElement {
|
|
747
|
-
computedContext?: ComputedContext;
|
|
748
|
-
static styles: lit.CSSResult;
|
|
749
|
-
render(): lit.TemplateResult<1>;
|
|
750
|
-
}
|
|
751
|
-
declare global {
|
|
752
|
-
interface HTMLElementTagNameMap {
|
|
753
|
-
'test-print-item-variables': TestPrintVariables;
|
|
754
|
-
}
|
|
755
|
-
}
|
|
756
|
-
|
|
757
|
-
/**
|
|
758
|
-
* Shows the test's state (`qtiTest.state`) as a tree you can fold open and shut, and keeps it current
|
|
759
|
-
* on every `cito-test-state-changed`. A debug helper: drop it anywhere inside `<qti-test>`.
|
|
760
|
-
*
|
|
761
|
-
* The first two levels start open. A list entry with an `identifier` (an item, a variable) is labelled
|
|
762
|
-
* by it. The element only lays out the tree; give it a font, colour and height from the page.
|
|
763
|
-
*
|
|
764
|
-
* @customElement test-print-state
|
|
765
|
-
* @csspart key - the name of a field, or the label of a list entry
|
|
766
|
-
* @csspart value - a value that is not an object or a list
|
|
767
|
-
* @csspart count - the number of entries of a folded object or list
|
|
768
|
-
*/
|
|
769
|
-
declare class TestPrintState extends LitElement {
|
|
770
|
-
#private;
|
|
771
|
-
private testState?;
|
|
772
|
-
static styles: lit.CSSResult;
|
|
773
|
-
connectedCallback(): void;
|
|
774
|
-
disconnectedCallback(): void;
|
|
775
|
-
render(): TemplateResult<1> | typeof nothing;
|
|
776
|
-
}
|
|
777
|
-
declare global {
|
|
778
|
-
interface HTMLElementTagNameMap {
|
|
779
|
-
'test-print-state': TestPrintState;
|
|
780
|
-
}
|
|
781
|
-
}
|
|
782
|
-
|
|
783
|
-
declare class TestScoringButtons extends LitElement {
|
|
784
|
-
#private;
|
|
785
|
-
view: string;
|
|
786
|
-
disabled: boolean;
|
|
787
|
-
myTemplate: TemplateFunction | null;
|
|
788
|
-
protected createRenderRoot(): HTMLElement | DocumentFragment;
|
|
789
|
-
connectedCallback(): void;
|
|
790
|
-
protected computedContext?: ComputedContext;
|
|
791
|
-
render(): lit.TemplateResult<1> | typeof nothing;
|
|
792
|
-
constructor();
|
|
793
|
-
}
|
|
794
|
-
declare global {
|
|
795
|
-
interface HTMLElementTagNameMap {
|
|
796
|
-
'test-scoring-buttons': TestScoringButtons;
|
|
797
|
-
}
|
|
798
|
-
}
|
|
799
|
-
|
|
800
|
-
declare class TestScoringFeedback extends LitElement {
|
|
801
|
-
protected computedContext?: ComputedContext;
|
|
802
|
-
view: View;
|
|
803
|
-
render(): lit.TemplateResult<1>;
|
|
804
|
-
}
|
|
805
|
-
declare global {
|
|
806
|
-
interface HTMLElementTagNameMap {
|
|
807
|
-
'test-scoring-feedback': TestScoringFeedback;
|
|
808
|
-
}
|
|
809
|
-
}
|
|
810
|
-
|
|
811
|
-
/**
|
|
812
|
-
* The stamp plugin: renders its `<template>` child with the state of the test (`test`,
|
|
813
|
-
* `activeTestpart`, `activeSection`, `activeItem`, `view`), again on every change, so a player
|
|
814
|
-
* can show progress or numbered navigation without writing a component.
|
|
815
|
-
* @customElement
|
|
816
|
-
* @extends {LitElement}
|
|
817
|
-
*/
|
|
818
|
-
declare class TestStamp extends LitElement {
|
|
819
|
-
/**
|
|
820
|
-
* Indicates whether the component is in debug mode.
|
|
821
|
-
* When set to `true`, the available objects and properties (i.e.: stampContext) is displayed.
|
|
822
|
-
*/
|
|
823
|
-
debug: boolean;
|
|
824
|
-
private computedContext;
|
|
825
|
-
private stampContext;
|
|
826
|
-
myTemplate: TemplateFunction;
|
|
827
|
-
protected createRenderRoot(): HTMLElement | DocumentFragment;
|
|
828
|
-
connectedCallback(): void;
|
|
829
|
-
protected willUpdate(_changedProperties: PropertyValues): void;
|
|
830
|
-
render(): lit.TemplateResult<1>;
|
|
831
|
-
}
|
|
832
|
-
declare global {
|
|
833
|
-
interface HTMLElementTagNameMap {
|
|
834
|
-
'test-stamp': TestStamp;
|
|
835
|
-
}
|
|
836
|
-
}
|
|
837
|
-
|
|
838
586
|
/**
|
|
839
587
|
* Scores the test: on click the test resets its outcomes to their declared defaults, runs its
|
|
840
|
-
* outcome processing and dispatches `
|
|
588
|
+
* outcome processing and dispatches `qc-test-submitted`, after which the host reads the outcomes.
|
|
841
589
|
* The host decides where it sits, for example on the last item or in a review view.
|
|
842
590
|
*/
|
|
843
591
|
declare class TestSubmit extends LitElement {
|
|
@@ -851,288 +599,6 @@ declare global {
|
|
|
851
599
|
}
|
|
852
600
|
}
|
|
853
601
|
|
|
854
|
-
declare class TestView extends LitElement {
|
|
855
|
-
#private;
|
|
856
|
-
static DEFAULT_VIEW_OPTIONS: string[];
|
|
857
|
-
private sessionContext;
|
|
858
|
-
/** label accompanying the select view dropdown */
|
|
859
|
-
label: string;
|
|
860
|
-
/** The options to display in the dropdown, default: ['author', 'candidate', 'proctor', 'scorer', 'testConstructor', 'tutor'] */
|
|
861
|
-
viewOptions: string;
|
|
862
|
-
protected _handleViewOptionsChange: () => void;
|
|
863
|
-
connectedCallback(): void;
|
|
864
|
-
private _viewOptions;
|
|
865
|
-
protected _switchView(view: string): void;
|
|
866
|
-
render(): lit.TemplateResult<1>;
|
|
867
|
-
}
|
|
868
|
-
declare global {
|
|
869
|
-
interface HTMLElementTagNameMap {
|
|
870
|
-
'test-view': TestView;
|
|
871
|
-
}
|
|
872
|
-
}
|
|
873
|
-
|
|
874
|
-
declare class TestViewToggle extends LitElement {
|
|
875
|
-
myTemplate: any;
|
|
876
|
-
protected createRenderRoot(): HTMLElement | DocumentFragment;
|
|
877
|
-
private sessionContext;
|
|
878
|
-
connectedCallback(): void;
|
|
879
|
-
_switchView(view: string): void;
|
|
880
|
-
protected firstUpdated(_changedProperties: PropertyValues): void;
|
|
881
|
-
render(): lit.TemplateResult<1>;
|
|
882
|
-
}
|
|
883
|
-
declare global {
|
|
884
|
-
interface HTMLElementTagNameMap {
|
|
885
|
-
'test-view-toggle': TestViewToggle;
|
|
886
|
-
}
|
|
887
|
-
}
|
|
888
|
-
|
|
889
|
-
type SpeechState = 'idle' | 'playing' | 'paused';
|
|
890
|
-
interface TtsContext {
|
|
891
|
-
state: SpeechState;
|
|
892
|
-
/** True while every reading element is highlighted and a click on one starts reading there. */
|
|
893
|
-
picking: boolean;
|
|
894
|
-
/** Index of the currently highlighted reading element (0-based). */
|
|
895
|
-
currentElementIndex: number;
|
|
896
|
-
/** Total number of navigable reading elements in the current item. */
|
|
897
|
-
elementCount: number;
|
|
898
|
-
play(): void;
|
|
899
|
-
pause(): void;
|
|
900
|
-
resume(): void;
|
|
901
|
-
stop(): void;
|
|
902
|
-
prevElement(): void;
|
|
903
|
-
nextElement(): void;
|
|
904
|
-
/** Toggle pick mode: highlight all reading elements, then read from the one that is clicked. */
|
|
905
|
-
togglePick(): void;
|
|
906
|
-
}
|
|
907
|
-
|
|
908
|
-
/**
|
|
909
|
-
* Base class shared by all TTS control elements. Consumes `ttsContext` and
|
|
910
|
-
* mirrors the current speech state onto CSS custom states so each child can
|
|
911
|
-
* be styled with `:state(playing)`, `:state(paused)`, `:state(idle)`.
|
|
912
|
-
*/
|
|
913
|
-
declare abstract class TtsButtonBase extends LitElement {
|
|
914
|
-
#private;
|
|
915
|
-
static styles: lit.CSSResult;
|
|
916
|
-
/**
|
|
917
|
-
* Accessible name of the button. Without it the default icon carries an English name, and
|
|
918
|
-
* slotted content names the button by its text; set it when you slot an icon of your own,
|
|
919
|
-
* which has no text to be named by.
|
|
920
|
-
*/
|
|
921
|
-
label?: string;
|
|
922
|
-
protected _tts?: TtsContext;
|
|
923
|
-
updated(_changed: PropertyValues): void;
|
|
924
|
-
}
|
|
925
|
-
/**
|
|
926
|
-
* `<test-item-to-speech>` is the controller and context provider. It manages
|
|
927
|
-
* speech synthesis, word highlighting, and item element lookup. Compose your
|
|
928
|
-
* own player by placing control elements as children.
|
|
929
|
-
*
|
|
930
|
-
* @example
|
|
931
|
-
* ```html
|
|
932
|
-
* <test-item-to-speech language="nl-NL">
|
|
933
|
-
* <test-tts-play></test-tts-play>
|
|
934
|
-
* <test-tts-prev></test-tts-prev>
|
|
935
|
-
* <test-tts-next></test-tts-next>
|
|
936
|
-
* <test-tts-stop></test-tts-stop>
|
|
937
|
-
* </test-item-to-speech>
|
|
938
|
-
* ```
|
|
939
|
-
*
|
|
940
|
-
* The controller lays its controls out as a wrapping row; each control draws an icon button,
|
|
941
|
-
* and slotted content replaces the icon — a slotted `<svg>` is sized like the default one. Give a
|
|
942
|
-
* control with a slotted icon a `label`, since an icon has no text to name the button by. Buttons read the qti-theme tokens (with the theme's
|
|
943
|
-
* defaults as fallbacks) and can be sized with `--test-button-size` and `--test-tts-icon-size`.
|
|
944
|
-
*
|
|
945
|
-
* ### Language resolution
|
|
946
|
-
*
|
|
947
|
-
* Each reading element is spoken in the language of the nearest `lang` attribute:
|
|
948
|
-
*
|
|
949
|
-
* 1. `lang` (or `xml:lang`) on the element itself
|
|
950
|
-
* 2. `lang` on the closest ancestor — including `<qti-assessment-item xml:lang>` and, across
|
|
951
|
-
* shadow roots, anything wrapping the test
|
|
952
|
-
* 3. `lang` on the document's `<html>` element
|
|
953
|
-
* 4. the `language` attribute on `<test-item-to-speech>`
|
|
954
|
-
*
|
|
955
|
-
* The transformer copies `xml:lang` over as a plain `lang` attribute, so QTI authored with
|
|
956
|
-
* `xml:lang="en-GB"` on a `<p>` or on the item root is honoured without further work.
|
|
957
|
-
*
|
|
958
|
-
* ### What is read
|
|
959
|
-
*
|
|
960
|
-
* Decided once per connect, by where the player is placed. The first rule that matches wins:
|
|
961
|
-
*
|
|
962
|
-
* 1. **Next to a stimulus placeholder** — the player shares its parent with a
|
|
963
|
-
* `[data-stimulus-idref]` element, e.g. in a reading-text panel beside the questions: the
|
|
964
|
-
* player reads that stimulus (its `qti-stimulus-body`), and only that. Not inside the
|
|
965
|
-
* placeholder: loading a stimulus replaces the placeholder's content. Items and navigation
|
|
966
|
-
* are ignored; when the stimulus is (re)loaded or the placeholder swapped, the player starts
|
|
967
|
-
* over on the new content.
|
|
968
|
-
* 2. **Next to `[data-tts-content]`** — the player shares its parent with an element marked
|
|
969
|
-
* `data-tts-content`: any HTML, not QTI, e.g. a start screen rendered by React. The marker goes
|
|
970
|
-
* on one container; the player reads the readable elements inside it. Navigation is ignored.
|
|
971
|
-
* The reading list is rebuilt when the player starts from the top, and when an element in it
|
|
972
|
-
* has left the page — so a re-render of the content never interrupts speech.
|
|
973
|
-
* 3. **Inside a `qti-assessment-item-ref`** — e.g. in a `<template item-ref>` on `<qti-test>`,
|
|
974
|
-
* so every item gets a player of its own: the player reads that item, and only that item.
|
|
975
|
-
* The navigation cursor is ignored; speech stops when the player leaves the page with its item.
|
|
976
|
-
* 4. **Anywhere else inside `<test-navigation>`** — e.g. a toolbar: the player follows the
|
|
977
|
-
* navigation cursor and reads the active item of the computed context. Navigating stops
|
|
978
|
-
* speech and starts the next item from the top.
|
|
979
|
-
*
|
|
980
|
-
* ```html
|
|
981
|
-
* <!-- 1. a player for the shared reading text -->
|
|
982
|
-
* <aside>
|
|
983
|
-
* <test-item-to-speech>…</test-item-to-speech>
|
|
984
|
-
* <div data-stimulus-idref="Stimulus1"></div>
|
|
985
|
-
* </aside>
|
|
986
|
-
*
|
|
987
|
-
* <!-- 2. a player for any other HTML -->
|
|
988
|
-
* <div>
|
|
989
|
-
* <test-item-to-speech>…</test-item-to-speech>
|
|
990
|
-
* <section data-tts-content lang="nl-NL">…</section>
|
|
991
|
-
* </div>
|
|
992
|
-
*
|
|
993
|
-
* <!-- 3. one player per item -->
|
|
994
|
-
* <qti-test>
|
|
995
|
-
* <template item-ref>
|
|
996
|
-
* <test-item-to-speech>…</test-item-to-speech>
|
|
997
|
-
* {{ xmlDoc }}
|
|
998
|
-
* </template>
|
|
999
|
-
* …
|
|
1000
|
-
* </qti-test>
|
|
1001
|
-
*
|
|
1002
|
-
* <!-- 4. one player in the toolbar, following navigation -->
|
|
1003
|
-
* <test-navigation>
|
|
1004
|
-
* <header><test-item-to-speech>…</test-item-to-speech></header>
|
|
1005
|
-
* <test-container test-url="…"></test-container>
|
|
1006
|
-
* </test-navigation>
|
|
1007
|
-
* ```
|
|
1008
|
-
*
|
|
1009
|
-
* In modes 3 and 4 the item re-rendering (navigating to the item already shown) restarts the
|
|
1010
|
-
* player on the fresh content. An item player reads the item body as rendered: a stimulus
|
|
1011
|
-
* placed inside the item is read with it, one placed outside (mode 1) is not. Only one player
|
|
1012
|
-
* can speak at a time; starting one stops any other.
|
|
1013
|
-
*
|
|
1014
|
-
* Read are `p`, `h1`–`h6`, `li`, `dt`, `dd`, `th`, `td`, `caption`, `blockquote`, `figcaption`,
|
|
1015
|
-
* `qti-prompt` and `qti-simple-choice` — the innermost match only — unless hidden (`display: none`)
|
|
1016
|
-
* or inside `aria-hidden="true"`.
|
|
1017
|
-
*
|
|
1018
|
-
* ### Starting somewhere in the middle
|
|
1019
|
-
*
|
|
1020
|
-
* `<test-tts-pick>` switches the player into pick mode: every reading element gets the blue
|
|
1021
|
-
* cursor highlight, and the first click on one of them leaves pick mode and starts reading
|
|
1022
|
-
* from that element. Pressing the button again leaves pick mode without reading.
|
|
1023
|
-
*
|
|
1024
|
-
* @cssstate idle - No speech active
|
|
1025
|
-
* @cssstate picking - Pick mode: all reading elements highlighted, waiting for a click
|
|
1026
|
-
* @cssstate playing - Speech is playing
|
|
1027
|
-
* @cssstate paused - Speech is paused
|
|
1028
|
-
*/
|
|
1029
|
-
declare class TestItemToSpeech extends LitElement {
|
|
1030
|
-
#private;
|
|
1031
|
-
static styles: lit.CSSResult;
|
|
1032
|
-
/** Fallback language when neither the item content nor the document declares one. */
|
|
1033
|
-
language: string;
|
|
1034
|
-
/**
|
|
1035
|
-
* The test as `test-navigation` computes it: which item is active, and where it is rendered
|
|
1036
|
-
* (`itemElement`). Updated on navigation and whenever an item is rendered.
|
|
1037
|
-
*/
|
|
1038
|
-
protected _computedContext?: ComputedContext;
|
|
1039
|
-
_ttsContext: TtsContext;
|
|
1040
|
-
constructor();
|
|
1041
|
-
willUpdate(changed: PropertyValues): void;
|
|
1042
|
-
connectedCallback(): void;
|
|
1043
|
-
disconnectedCallback(): void;
|
|
1044
|
-
render(): lit.TemplateResult<1>;
|
|
1045
|
-
}
|
|
1046
|
-
/**
|
|
1047
|
-
* Play/pause/resume toggle button — always enabled, cycles through states.
|
|
1048
|
-
* Use named slots `play` and `pause` to customise the icons/labels independently; `label` and
|
|
1049
|
-
* `pause-label` name the button in each state (set them when the slotted content is an icon).
|
|
1050
|
-
*
|
|
1051
|
-
* @example
|
|
1052
|
-
* ```html
|
|
1053
|
-
* <test-tts-play>
|
|
1054
|
-
* <span slot="play">Voorlezen</span>
|
|
1055
|
-
* <span slot="pause">Pauzeren</span>
|
|
1056
|
-
* </test-tts-play>
|
|
1057
|
-
* ```
|
|
1058
|
-
*
|
|
1059
|
-
* @cssstate idle / playing / paused
|
|
1060
|
-
* @csspart button
|
|
1061
|
-
*/
|
|
1062
|
-
declare class TestTtsPlay extends TtsButtonBase {
|
|
1063
|
-
#private;
|
|
1064
|
-
/** Accessible name of the button while speech is playing; see `label`. */
|
|
1065
|
-
pauseLabel?: string;
|
|
1066
|
-
render(): lit.TemplateResult<1>;
|
|
1067
|
-
}
|
|
1068
|
-
/**
|
|
1069
|
-
* Pause button — enabled only when playing.
|
|
1070
|
-
* @cssstate idle / playing / paused
|
|
1071
|
-
* @csspart button
|
|
1072
|
-
*/
|
|
1073
|
-
declare class TestTtsPause extends TtsButtonBase {
|
|
1074
|
-
render(): lit.TemplateResult<1>;
|
|
1075
|
-
}
|
|
1076
|
-
/**
|
|
1077
|
-
* Resume button — enabled only when paused.
|
|
1078
|
-
* @cssstate idle / playing / paused
|
|
1079
|
-
* @csspart button
|
|
1080
|
-
*/
|
|
1081
|
-
declare class TestTtsResume extends TtsButtonBase {
|
|
1082
|
-
render(): lit.TemplateResult<1>;
|
|
1083
|
-
}
|
|
1084
|
-
/**
|
|
1085
|
-
* Stop button — enabled when playing, paused, or in pick mode (where it leaves pick mode).
|
|
1086
|
-
* @cssstate idle / playing / paused
|
|
1087
|
-
* @csspart button
|
|
1088
|
-
*/
|
|
1089
|
-
declare class TestTtsStop extends TtsButtonBase {
|
|
1090
|
-
render(): lit.TemplateResult<1>;
|
|
1091
|
-
}
|
|
1092
|
-
/**
|
|
1093
|
-
* Prev-element button — moves cursor to the previous reading element and pauses.
|
|
1094
|
-
* Disabled at the first element. Reading elements are collected lazily, so an element count
|
|
1095
|
-
* of 0 means "not looked yet" rather than "nothing to read": the button stays enabled and the
|
|
1096
|
-
* first click collects them.
|
|
1097
|
-
* @cssstate idle / playing / paused
|
|
1098
|
-
* @csspart button
|
|
1099
|
-
*/
|
|
1100
|
-
declare class TestTtsPrev extends TtsButtonBase {
|
|
1101
|
-
render(): lit.TemplateResult<1>;
|
|
1102
|
-
}
|
|
1103
|
-
/**
|
|
1104
|
-
* Next-element button — moves cursor to the next reading element and pauses.
|
|
1105
|
-
* Disabled at the last element; enabled while the elements have not been collected yet
|
|
1106
|
-
* (see `TestTtsPrev`).
|
|
1107
|
-
* @cssstate idle / playing / paused
|
|
1108
|
-
* @csspart button
|
|
1109
|
-
*/
|
|
1110
|
-
declare class TestTtsNext extends TtsButtonBase {
|
|
1111
|
-
render(): lit.TemplateResult<1>;
|
|
1112
|
-
}
|
|
1113
|
-
/**
|
|
1114
|
-
* Pick button — toggles pick mode on the controller: every reading element is highlighted and
|
|
1115
|
-
* a click on one of them starts reading from there. Reflects the mode as `:state(picking)`.
|
|
1116
|
-
* @cssstate idle / playing / paused
|
|
1117
|
-
* @cssstate picking
|
|
1118
|
-
* @csspart button
|
|
1119
|
-
*/
|
|
1120
|
-
declare class TestTtsPick extends TtsButtonBase {
|
|
1121
|
-
render(): lit.TemplateResult<1>;
|
|
1122
|
-
}
|
|
1123
|
-
declare global {
|
|
1124
|
-
interface HTMLElementTagNameMap {
|
|
1125
|
-
'test-item-to-speech': TestItemToSpeech;
|
|
1126
|
-
'test-tts-play': TestTtsPlay;
|
|
1127
|
-
'test-tts-pause': TestTtsPause;
|
|
1128
|
-
'test-tts-resume': TestTtsResume;
|
|
1129
|
-
'test-tts-stop': TestTtsStop;
|
|
1130
|
-
'test-tts-prev': TestTtsPrev;
|
|
1131
|
-
'test-tts-next': TestTtsNext;
|
|
1132
|
-
'test-tts-pick': TestTtsPick;
|
|
1133
|
-
}
|
|
1134
|
-
}
|
|
1135
|
-
|
|
1136
602
|
declare const QtiTest_base: (abstract new (...args: any[]) => ITestNavigationMixin) & (abstract new (...args: any[]) => {
|
|
1137
603
|
updateAssessmentItemView(assessmentItem: QtiAssessmentItem, view: View): void;
|
|
1138
604
|
}) & (abstract new (...args: any[]) => {
|
|
@@ -1190,8 +656,8 @@ declare const QtiTest_base: (abstract new (...args: any[]) => ITestNavigationMix
|
|
|
1190
656
|
* You can use normal class names to style the elements.
|
|
1191
657
|
* And you can use the `test-prev` and `test-next` elements to navigate through the test.
|
|
1192
658
|
*
|
|
1193
|
-
* @event
|
|
1194
|
-
* @event qti-test-context-updated - Deprecated: listen to `
|
|
659
|
+
* @event qc-test-state-changed - The candidate's persistable state changed. `detail` is a `QtiTestState`; assign it back to `state` to resume.
|
|
660
|
+
* @event qti-test-context-updated - Deprecated: listen to `qc-test-state-changed` to persist a session. `detail` is the full test context, including declaration metadata and the answer key. Removed in the next major.
|
|
1195
661
|
*/
|
|
1196
662
|
declare class QtiTest extends QtiTest_base {
|
|
1197
663
|
constructor();
|
|
@@ -1220,4 +686,4 @@ declare global {
|
|
|
1220
686
|
}
|
|
1221
687
|
}
|
|
1222
688
|
|
|
1223
|
-
export {
|
|
689
|
+
export { type ITestNavigationMixin as I, QtiAssessmentItemRef as Q, TestContainer as T, type ITestStateMixin as a, type ItemRefTemplateModel as b, QtiAssessmentSection as c, QtiAssessmentTest as d, QtiBranchRule as e, QtiItemSessionControl as f, QtiNumberPresented as g, QtiNumberSelected as h, QtiOutcomeProcessing as i, QtiOutcomeProcessingProcessor as j, QtiPreCondition as k, QtiTest as l, QtiTestFeedback as m, QtiTestPart as n, QtiTestVariables as o, QtiTestVariablesExpression as p, TestEndAttempt as q, TestNavigation as r, TestNext as s, TestPrev as t, TestSubmit as u, type ItemVariableValue as v };
|