@citolab/qti-components 8.0.0 → 8.0.2
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 +690 -316
- package/dist/base.d.ts +135 -9
- package/dist/base.js +1 -1
- package/dist/chunk-4DB4SC5K.js +100 -0
- package/dist/chunk-4DB4SC5K.js.map +1 -0
- package/dist/{chunk-WVVMNF74.js → chunk-7AVWRQIS.js} +188 -160
- package/dist/{chunk-WVVMNF74.js.map → chunk-7AVWRQIS.js.map} +1 -1
- package/dist/{chunk-MGF5F3S2.js → chunk-BQFWCZFH.js} +2 -2
- package/dist/{chunk-5QYII4OZ.js → chunk-CK7AV2UJ.js} +147 -101
- package/dist/chunk-CK7AV2UJ.js.map +1 -0
- package/dist/chunk-G6GFQDVN.js +7 -0
- package/dist/chunk-G6GFQDVN.js.map +1 -0
- package/dist/{chunk-LZJHHZQ2.js → chunk-HBSWJC3B.js} +643 -553
- package/dist/chunk-HBSWJC3B.js.map +1 -0
- package/dist/chunk-HQESINXH.js +834 -0
- package/dist/chunk-HQESINXH.js.map +1 -0
- package/dist/{chunk-KYEZRYO6.js → chunk-J5SQLKNP.js} +145 -119
- package/dist/{chunk-KYEZRYO6.js.map → chunk-J5SQLKNP.js.map} +1 -1
- package/dist/{chunk-V5G7X53Y.js → chunk-NJQHUUTN.js} +2 -2
- package/dist/{chunk-W4QZPCNC.js → chunk-RSVRS5AK.js} +59 -58
- package/dist/chunk-RSVRS5AK.js.map +1 -0
- package/dist/{chunk-5SJS36BI.js → chunk-TWPXES3S.js} +642 -673
- package/dist/chunk-TWPXES3S.js.map +1 -0
- package/dist/{chunk-NA2N2WSG.js → chunk-VAE6HBKR.js} +176 -152
- package/dist/{chunk-NA2N2WSG.js.map → chunk-VAE6HBKR.js.map} +1 -1
- package/dist/{chunk-MJVPNN7W.js → chunk-ZII6M3SN.js} +2 -2
- package/dist/computed-item.types.d-BKZdSLLJ.d.ts +19 -0
- package/dist/computed.types.d-DpKIYO6e.d.ts +44 -0
- package/dist/config.context.d-BvU9r-Mg.d.ts +91 -0
- package/dist/corrections.d.ts +415 -1
- package/dist/corrections.js +8 -9
- package/dist/elements.d.ts +393 -1
- package/dist/elements.js +4 -5
- package/dist/index.d.ts +27 -9
- package/dist/index.js +21 -14
- package/dist/interaction.d-CJiMv8H7.d.ts +126 -0
- package/dist/interaction.interface.d-CvjHM2bi.d.ts +46 -0
- package/dist/interactions.d.ts +281 -1
- package/dist/interactions.js +4 -5
- package/dist/item.css +588 -214
- package/dist/item.d.ts +92 -1
- package/dist/item.js +5 -5
- package/dist/item.types.d-QU7LljEK.d.ts +82 -0
- package/dist/loader.d.ts +22 -1
- package/dist/processing.d.ts +730 -1
- package/dist/processing.js +2 -2
- package/dist/qti-components-jsx.d.ts +854 -844
- package/dist/qti-components-jsx.js +1 -0
- package/dist/qti-condition-expression.d-aMvBvpc6.d.ts +8 -0
- package/dist/qti-expression.d-BietT_8b.d.ts +31 -0
- package/dist/qti-feedback.d-DZbad0RN.d.ts +21 -0
- package/dist/qti-rule-base.d-ajOnfGXY.d.ts +16 -0
- package/dist/qti-test.d-_YAlhDbt.d.ts +702 -0
- package/dist/qti-text-entry-interaction.d-BGdfV9qG.d.ts +1567 -0
- package/dist/qti-transform-test.d-BL7GGFJj.d.ts +70 -0
- package/dist/qti.context.d-CejJMlfZ.d.ts +50 -0
- package/dist/response.d-_8y4kjGP.d.ts +106 -0
- package/dist/test.d.ts +32 -1
- package/dist/test.js +14 -7
- package/dist/transformers.d.ts +18 -1
- package/package.json +15 -11
- package/dist/chunk-5QYII4OZ.js.map +0 -1
- package/dist/chunk-5SJS36BI.js.map +0 -1
- package/dist/chunk-64XSIBGO.js +0 -241
- package/dist/chunk-64XSIBGO.js.map +0 -1
- package/dist/chunk-H3J7LFRO.js +0 -2243
- package/dist/chunk-H3J7LFRO.js.map +0 -1
- package/dist/chunk-LZJHHZQ2.js.map +0 -1
- package/dist/chunk-W4QZPCNC.js.map +0 -1
- package/dist/chunk-WCQ26LV7.js +0 -102
- package/dist/chunk-WCQ26LV7.js.map +0 -1
- package/dist/chunk-X3E5HXG2.js +0 -20
- package/dist/chunk-X3E5HXG2.js.map +0 -1
- /package/dist/{chunk-MGF5F3S2.js.map → chunk-BQFWCZFH.js.map} +0 -0
- /package/dist/{chunk-V5G7X53Y.js.map → chunk-NJQHUUTN.js.map} +0 -0
- /package/dist/{chunk-MJVPNN7W.js.map → chunk-ZII6M3SN.js.map} +0 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { LitElement, PropertyValues } from 'lit';
|
|
2
|
+
import { C as ConfigContext, V as ValidationDisplayMode } from './config.context.d-BvU9r-Mg.js';
|
|
3
|
+
import { V as ValidatableInteraction } from './interaction.interface.d-CvjHM2bi.js';
|
|
4
|
+
import { f as ResponseVariable } from './item.types.d-QU7LljEK.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* What a choice element should render and behave as. The same element — `qti-simple-choice`,
|
|
8
|
+
* `qti-hottext` — is a radio in one interaction and a checkbox in another. It cannot know this
|
|
9
|
+
* by itself.
|
|
10
|
+
*
|
|
11
|
+
* Note "drag" is deliberately *not* a choiceRole. In `qti-match-interaction` the same element
|
|
12
|
+
* type is a drag in one match-set and a drop target in the other, so draggability is positional,
|
|
13
|
+
* not a property of the interaction. It is derived from `draggablesSelector` instead. It is also
|
|
14
|
+
* not a valid ARIA role, so it may only ever be a custom state.
|
|
15
|
+
*/
|
|
16
|
+
type ChoiceRole = 'radio' | 'checkbox';
|
|
17
|
+
/**
|
|
18
|
+
* State an interaction publishes to the choice elements inside it.
|
|
19
|
+
*
|
|
20
|
+
* Provided by the `qti-*-interaction`, never by `qti-assessment-item`: interactions must work
|
|
21
|
+
* standalone — in a plain form, in a story, in a vendor's app — with no QTI ancestor. Consumers
|
|
22
|
+
* must therefore tolerate its absence and fall back to a sensible default:
|
|
23
|
+
*
|
|
24
|
+
* const role = this.interactionContext?.choiceRole ?? null;
|
|
25
|
+
*/
|
|
26
|
+
interface InteractionContext {
|
|
27
|
+
/** `null` when the interaction assigns no particular role to its choices. */
|
|
28
|
+
choiceRole: ChoiceRole | null;
|
|
29
|
+
/**
|
|
30
|
+
* The selector this interaction uses to recognise its draggable chips. An element tests
|
|
31
|
+
* itself with `this.matches(draggablesSelector)` and takes `:state(chip)` if it matches.
|
|
32
|
+
*
|
|
33
|
+
* Published rather than pushed because draggability can be positional: match-interaction's
|
|
34
|
+
* selector distinguishes the source match-set from the target one, so two elements of the
|
|
35
|
+
* same tag get different answers.
|
|
36
|
+
*/
|
|
37
|
+
draggablesSelector: string | null;
|
|
38
|
+
}
|
|
39
|
+
declare const interactionContext: {
|
|
40
|
+
__context__: Readonly<InteractionContext>;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Shared QTI interaction base. Formative correction behavior is supplied by the
|
|
45
|
+
* `@qti-components/corrections` package.
|
|
46
|
+
*/
|
|
47
|
+
declare abstract class Interaction extends LitElement implements ValidatableInteraction {
|
|
48
|
+
#private;
|
|
49
|
+
private _context;
|
|
50
|
+
/**
|
|
51
|
+
* Delivery configuration, from the nearest provider — `qti-test` or `qti-item`.
|
|
52
|
+
*
|
|
53
|
+
* **Public so it can be assigned directly, which is the development-time route.** An interaction
|
|
54
|
+
* has to work standalone, and in a story or a spec there is usually no provider above it — so
|
|
55
|
+
* setting the field is all that is needed:
|
|
56
|
+
*
|
|
57
|
+
* orderInteraction.configContext = { allowReorder: false, validationDisplayMode: 'none' };
|
|
58
|
+
*
|
|
59
|
+
* With no provider, nothing ever overwrites it. That is the whole contract, and its limit: where a
|
|
60
|
+
* provider DOES exist it re-emits on its next update and wins, because `@consume` writes this same
|
|
61
|
+
* field. There is no merging — set the value on the provider in that case.
|
|
62
|
+
*
|
|
63
|
+
* In a lit-html template, bind it as a property rather than assigning after the fact:
|
|
64
|
+
*
|
|
65
|
+
* html`<qti-order-interaction .configContext=${{ allowReorder: false }}>…`
|
|
66
|
+
*
|
|
67
|
+
* The binding is committed on the detached template clone, before the fragment is inserted, so it
|
|
68
|
+
* is in place by `connectedCallback` — which matters for anything that reads config on connect.
|
|
69
|
+
*
|
|
70
|
+
* It was `protected`, which fooled nobody: every caller reached it anyway through an
|
|
71
|
+
* `as any` / `as { configContext?: … }` cast. Public says what was already true and removes the
|
|
72
|
+
* casts, rather than pretending at an encapsulation the type system was the only thing enforcing.
|
|
73
|
+
*/
|
|
74
|
+
configContext: ConfigContext;
|
|
75
|
+
protected _interactionContext: Readonly<InteractionContext>;
|
|
76
|
+
static formAssociated: boolean;
|
|
77
|
+
protected _internals: ElementInternals;
|
|
78
|
+
get internals(): ElementInternals;
|
|
79
|
+
responseIdentifier: string;
|
|
80
|
+
disabled: boolean;
|
|
81
|
+
readonly: boolean;
|
|
82
|
+
name: any;
|
|
83
|
+
/** Extension point used by wrappers that should not register as candidate inputs. */
|
|
84
|
+
protected get registersWithItem(): boolean;
|
|
85
|
+
get isInline(): boolean;
|
|
86
|
+
get responseVariable(): ResponseVariable | undefined;
|
|
87
|
+
abstract validate(): boolean;
|
|
88
|
+
get value(): string | null;
|
|
89
|
+
set value(val: string | null);
|
|
90
|
+
abstract get response(): string | string[] | null;
|
|
91
|
+
abstract set response(val: string | string[] | null);
|
|
92
|
+
reportValidity(): boolean;
|
|
93
|
+
protected get validationDisplayMode(): ValidationDisplayMode;
|
|
94
|
+
protected resolveAllowReorder(options?: {
|
|
95
|
+
defaultWhenUnset?: boolean;
|
|
96
|
+
}): boolean;
|
|
97
|
+
protected resolveDisableAfterMaxReached(options?: {
|
|
98
|
+
defaultWhenUnset?: boolean;
|
|
99
|
+
}): boolean;
|
|
100
|
+
protected setInteractionValidity(isValid: boolean, validityMessage?: string, anchor?: HTMLElement | null, options?: {
|
|
101
|
+
suppressInline?: boolean;
|
|
102
|
+
}): void;
|
|
103
|
+
protected updateInlineValidationMessage(): void;
|
|
104
|
+
protected clearInlineValidationMessage(): void;
|
|
105
|
+
protected getValidationMessageElement(): HTMLElement | null;
|
|
106
|
+
reset(): void;
|
|
107
|
+
formResetCallback(): void;
|
|
108
|
+
connectedCallback(): void;
|
|
109
|
+
saveResponse(value: string | string[], state?: string | null): void;
|
|
110
|
+
constructor();
|
|
111
|
+
/**
|
|
112
|
+
* Optional lifecycle bridge for interaction subclasses that do not need changed-property data.
|
|
113
|
+
*
|
|
114
|
+
* The parameter is `PropertyValues`, matching LitElement, and NOT `PropertyValues<this>`.
|
|
115
|
+
* The polymorphic `this` narrowed the parameter per subclass, which made every interaction
|
|
116
|
+
* class structurally incompatible with `LitElement` — so `Constructor<LitElement>`, the
|
|
117
|
+
* standard constraint for a Lit mixin, rejected all of them and consumers could not wrap an
|
|
118
|
+
* interaction in a mixin without casting. `this` buys nothing in a parameter position and
|
|
119
|
+
* costs contravariant compatibility with the base class.
|
|
120
|
+
*
|
|
121
|
+
* Still optional, so subclasses that ignore the argument can override with `firstUpdated()`.
|
|
122
|
+
*/
|
|
123
|
+
protected firstUpdated(_changedProperties?: PropertyValues): void;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export { type ChoiceRole as C, Interaction as I, type InteractionContext as a, interactionContext as i };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Smallest shared contract for any form-associated custom element.
|
|
3
|
+
*
|
|
4
|
+
* Keep this intentionally tiny and platform-aligned. QTI-specific concerns
|
|
5
|
+
* such as response identifiers, readonly handling, and validation
|
|
6
|
+
* should be layered via separate capability interfaces below.
|
|
7
|
+
*/
|
|
8
|
+
interface FormAssociatedInteraction extends HTMLElement {
|
|
9
|
+
disabled: boolean;
|
|
10
|
+
readonly internals: ElementInternals;
|
|
11
|
+
formResetCallback(): void;
|
|
12
|
+
}
|
|
13
|
+
/** QTI response identity capability. */
|
|
14
|
+
interface ResponseIdentifiedInteraction {
|
|
15
|
+
responseIdentifier: string;
|
|
16
|
+
}
|
|
17
|
+
/** Optional readonly capability used by many QTI interactions. */
|
|
18
|
+
interface ReadonlyInteraction {
|
|
19
|
+
readonly: boolean;
|
|
20
|
+
}
|
|
21
|
+
/** Optional reset capability beyond the platform form reset callback. */
|
|
22
|
+
interface ResettableInteraction {
|
|
23
|
+
reset(): void;
|
|
24
|
+
}
|
|
25
|
+
/** Interaction that publishes and stores a response value. */
|
|
26
|
+
interface ResponseInteractionElement extends FormAssociatedInteraction {
|
|
27
|
+
responseIdentifier: string;
|
|
28
|
+
response: string | string[] | null;
|
|
29
|
+
saveResponse(value: string | string[], state?: string | null): void;
|
|
30
|
+
}
|
|
31
|
+
/** Interaction that participates in validity reporting. */
|
|
32
|
+
interface ValidatableInteraction extends FormAssociatedInteraction {
|
|
33
|
+
validate(): boolean;
|
|
34
|
+
reportValidity(): boolean;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Common contract expected by item containers when tracking registered interactions.
|
|
38
|
+
*/
|
|
39
|
+
interface RegisteredInteraction extends ResponseInteractionElement, ValidatableInteraction, ReadonlyInteraction, ResettableInteraction {
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* @deprecated Prefer `RegisteredInteraction` for new code.
|
|
43
|
+
*/
|
|
44
|
+
type IInteraction = RegisteredInteraction;
|
|
45
|
+
|
|
46
|
+
export type { FormAssociatedInteraction as F, IInteraction as I, ReadonlyInteraction as R, ValidatableInteraction as V, RegisteredInteraction as a, ResettableInteraction as b, ResponseIdentifiedInteraction as c, ResponseInteractionElement as d };
|
package/dist/interactions.d.ts
CHANGED
|
@@ -1 +1,281 @@
|
|
|
1
|
-
|
|
1
|
+
import * as lit from 'lit';
|
|
2
|
+
import { CSSResultGroup, LitElement, PropertyValueMap } from 'lit';
|
|
3
|
+
import { I as Interaction } from './interaction.d-CJiMv8H7.js';
|
|
4
|
+
import { Q as QtiAssociableHotspot, d as QtiGap, e as QtiGapImg, g as QtiGapText, k as QtiHotspotChoice, m as QtiHottext, o as QtiInlineChoice, t as QtiPrompt, v as QtiSimpleAssociableChoice, w as QtiSimpleChoice, a as QtiAssociateInteraction, b as QtiChoiceInteraction, c as QtiExtendedTextInteraction, f as QtiGapMatchInteraction, h as QtiGraphicAssociateInteraction, i as QtiGraphicGapMatchInteraction, j as QtiGraphicOrderInteraction, l as QtiHotspotInteraction, n as QtiHottextInteraction, p as QtiInlineChoiceInteraction, q as QtiMatchInteraction, r as QtiOrderInteraction, s as QtiPortableCustomInteraction, z as QtiPortableCustomInteractionTest, u as QtiSelectPointInteraction, x as QtiSliderInteraction, y as QtiTextEntryInteraction } from './qti-text-entry-interaction.d-BGdfV9qG.js';
|
|
5
|
+
export { O as Orientation } from './qti-text-entry-interaction.d-BGdfV9qG.js';
|
|
6
|
+
import './config.context.d-BvU9r-Mg.js';
|
|
7
|
+
import './interaction.interface.d-CvjHM2bi.js';
|
|
8
|
+
import './item.types.d-QU7LljEK.js';
|
|
9
|
+
import './qti.context.d-CejJMlfZ.js';
|
|
10
|
+
import 'lit/directives/ref.js';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Upload interaction: candidates attach a file as their response.
|
|
14
|
+
*
|
|
15
|
+
* @slot prompt - The prompt shown above the file input.
|
|
16
|
+
*/
|
|
17
|
+
declare class QtiUploadInteraction extends Interaction {
|
|
18
|
+
#private;
|
|
19
|
+
static styles: CSSResultGroup;
|
|
20
|
+
reset(): void;
|
|
21
|
+
validate(): boolean;
|
|
22
|
+
get response(): string | null;
|
|
23
|
+
set response(base64: string | null);
|
|
24
|
+
static get properties(): {
|
|
25
|
+
[key: string]: lit.PropertyDeclaration<unknown, unknown>;
|
|
26
|
+
};
|
|
27
|
+
render(): lit.TemplateResult<1>;
|
|
28
|
+
}
|
|
29
|
+
declare global {
|
|
30
|
+
interface HTMLElementTagNameMap {
|
|
31
|
+
'qti-upload-interaction': QtiUploadInteraction;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Position-object interaction: candidates place draggable objects onto a stage image.
|
|
37
|
+
*
|
|
38
|
+
* @slot - Default slot for the object choices and stage.
|
|
39
|
+
*/
|
|
40
|
+
declare class QtiPositionObjectInteraction extends LitElement {
|
|
41
|
+
static styles: CSSResultGroup;
|
|
42
|
+
render(): lit.TemplateResult<1>;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
declare class QtiPositionObjectStage extends LitElement {
|
|
46
|
+
static styles: CSSResultGroup;
|
|
47
|
+
choiceOrdering: boolean;
|
|
48
|
+
startX: any;
|
|
49
|
+
startY: any;
|
|
50
|
+
dragElement: any;
|
|
51
|
+
render(): lit.TemplateResult<1>;
|
|
52
|
+
constructor();
|
|
53
|
+
dragElementHandler(event: MouseEvent): void;
|
|
54
|
+
firstUpdated(a: PropertyValueMap<any>): void;
|
|
55
|
+
removeMoveListener(): void;
|
|
56
|
+
disconnectedCallback(): void;
|
|
57
|
+
}
|
|
58
|
+
declare global {
|
|
59
|
+
interface HTMLElementTagNameMap {
|
|
60
|
+
'qti-position-object-stage': QtiPositionObjectStage;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Media interaction: wraps an embedded media object (audio/video) and tracks play events.
|
|
66
|
+
*
|
|
67
|
+
* @slot prompt - The prompt shown above the media element.
|
|
68
|
+
* @slot - Default slot for the embedded media element.
|
|
69
|
+
*/
|
|
70
|
+
declare class QtiMediaInteraction extends Interaction {
|
|
71
|
+
#private;
|
|
72
|
+
static styles: CSSResultGroup;
|
|
73
|
+
reset(): void;
|
|
74
|
+
validate(): boolean;
|
|
75
|
+
get response(): string | null;
|
|
76
|
+
set response(val: string | null);
|
|
77
|
+
static get properties(): {
|
|
78
|
+
step: {
|
|
79
|
+
type: NumberConstructor;
|
|
80
|
+
attribute: string;
|
|
81
|
+
default: number;
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
render(): lit.TemplateResult<1>;
|
|
85
|
+
constructor();
|
|
86
|
+
connectedCallback(): void;
|
|
87
|
+
}
|
|
88
|
+
declare global {
|
|
89
|
+
interface HTMLElementTagNameMap {
|
|
90
|
+
'qti-media-interaction': QtiMediaInteraction;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* A button that ends the current attempt.
|
|
96
|
+
*
|
|
97
|
+
* @csspart button - The end-attempt button element.
|
|
98
|
+
*/
|
|
99
|
+
declare class QtiEndAttemptInteraction extends LitElement {
|
|
100
|
+
static styles: CSSResultGroup;
|
|
101
|
+
responseIdentifier: string;
|
|
102
|
+
disabled: boolean;
|
|
103
|
+
/** Defines the number of attempts that a user can make using the 'endAttemptInteraction' mechanism (this can be used to limit the number of hints, etc.). [More information](https://www.imsglobal.org/sites/default/files/spec/qti/v3/info/index.html#DataCharacteristic_EndAttemptInteraction.Attr_count-attempt) */
|
|
104
|
+
countAttempt: 'true' | 'false' | null;
|
|
105
|
+
title: string;
|
|
106
|
+
render(): lit.TemplateResult<1>;
|
|
107
|
+
endAttempt(_: Event): void;
|
|
108
|
+
}
|
|
109
|
+
declare global {
|
|
110
|
+
interface HTMLElementTagNameMap {
|
|
111
|
+
'qti-end-attempt-interaction': QtiEndAttemptInteraction;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* QTI Custom Interaction component for legacy CES-based interactions.
|
|
117
|
+
*
|
|
118
|
+
* This component implements support for custom interactions originally built for the CES
|
|
119
|
+
* (Custom Element Standard) player - the predecessor to FACET and the Trifork QTI Player.
|
|
120
|
+
*
|
|
121
|
+
* @remarks
|
|
122
|
+
* The interaction workflow:
|
|
123
|
+
* 1. Fetch the CI manifest (JSON file with script, style, media references)
|
|
124
|
+
* 2. Check if bootstrap.js uses the CES API
|
|
125
|
+
* 3. If CES is used:
|
|
126
|
+
* - Fetch index.html from main window (where service worker/fetch works)
|
|
127
|
+
* - Inject registerCES proxy script for postMessage-based communication
|
|
128
|
+
* - Create blob URL and pass it to ciBootstrap
|
|
129
|
+
* 4. Create pciContainer iframe with style and bootstrap script
|
|
130
|
+
* 5. Handle postMessage events for getMedia, getResponse, setResponse, getBlobUrl
|
|
131
|
+
*
|
|
132
|
+
* The postMessage bridge is necessary because:
|
|
133
|
+
* - Iframes created via document.write() have about:blank origin
|
|
134
|
+
* - They cannot access the parent's global CES object (cross-origin)
|
|
135
|
+
* - Service workers don't control about:blank documents
|
|
136
|
+
*
|
|
137
|
+
* Messages are sent to all parent windows to support embedding scenarios like Storybook
|
|
138
|
+
* where window.top might not be the actual host application.
|
|
139
|
+
*/
|
|
140
|
+
declare class QtiCustomInteraction extends Interaction {
|
|
141
|
+
#private;
|
|
142
|
+
static styles: CSSResultGroup;
|
|
143
|
+
constructor();
|
|
144
|
+
data: string;
|
|
145
|
+
baseItemUrl: string;
|
|
146
|
+
baseRefUrl: string;
|
|
147
|
+
id: string;
|
|
148
|
+
private _errorMessage;
|
|
149
|
+
manifest: {
|
|
150
|
+
script: string[];
|
|
151
|
+
style: string[];
|
|
152
|
+
media: string[];
|
|
153
|
+
};
|
|
154
|
+
connectedCallback(): void;
|
|
155
|
+
/**
|
|
156
|
+
* Sets up the CES custom interaction by creating the iframe structure and
|
|
157
|
+
* handling the CES API communication via postMessage.
|
|
158
|
+
*
|
|
159
|
+
* For interactions that use CES, this method:
|
|
160
|
+
* 1. Fetches the original bootstrap.js and checks if it uses CES
|
|
161
|
+
* 2. If CES is used, fetches index.html and injects the registerCES proxy
|
|
162
|
+
* 3. Creates a blob URL for the modified HTML (stored in _contentBlobUrl)
|
|
163
|
+
* 4. Replaces bootstrap.js with ciBootstrap that loads the blob URL
|
|
164
|
+
* 5. Sets up postMessage listeners for CES API calls
|
|
165
|
+
*/
|
|
166
|
+
setupCES(): Promise<void>;
|
|
167
|
+
handlePostMessage(event: MessageEvent): void;
|
|
168
|
+
validate(): boolean;
|
|
169
|
+
get response(): string | string[] | null;
|
|
170
|
+
set response(val: string | string[] | null);
|
|
171
|
+
disconnectedCallback(): void;
|
|
172
|
+
render(): lit.TemplateResult<1>;
|
|
173
|
+
}
|
|
174
|
+
declare global {
|
|
175
|
+
interface HTMLElementTagNameMap {
|
|
176
|
+
'qti-custom-interaction': QtiCustomInteraction;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
declare const qtiInteractionElements: readonly [{
|
|
181
|
+
readonly tag: "qti-associable-hotspot";
|
|
182
|
+
readonly ctor: typeof QtiAssociableHotspot;
|
|
183
|
+
}, {
|
|
184
|
+
readonly tag: "qti-gap";
|
|
185
|
+
readonly ctor: typeof QtiGap;
|
|
186
|
+
}, {
|
|
187
|
+
readonly tag: "qti-gap-img";
|
|
188
|
+
readonly ctor: typeof QtiGapImg;
|
|
189
|
+
}, {
|
|
190
|
+
readonly tag: "qti-gap-text";
|
|
191
|
+
readonly ctor: typeof QtiGapText;
|
|
192
|
+
}, {
|
|
193
|
+
readonly tag: "qti-hotspot-choice";
|
|
194
|
+
readonly ctor: typeof QtiHotspotChoice;
|
|
195
|
+
}, {
|
|
196
|
+
readonly tag: "qti-hottext";
|
|
197
|
+
readonly ctor: typeof QtiHottext;
|
|
198
|
+
}, {
|
|
199
|
+
readonly tag: "qti-inline-choice";
|
|
200
|
+
readonly ctor: typeof QtiInlineChoice;
|
|
201
|
+
}, {
|
|
202
|
+
readonly tag: "qti-prompt";
|
|
203
|
+
readonly ctor: typeof QtiPrompt;
|
|
204
|
+
}, {
|
|
205
|
+
readonly tag: "qti-simple-associable-choice";
|
|
206
|
+
readonly ctor: typeof QtiSimpleAssociableChoice;
|
|
207
|
+
}, {
|
|
208
|
+
readonly tag: "qti-simple-choice";
|
|
209
|
+
readonly ctor: typeof QtiSimpleChoice;
|
|
210
|
+
}, {
|
|
211
|
+
readonly tag: "qti-associate-interaction";
|
|
212
|
+
readonly ctor: typeof QtiAssociateInteraction;
|
|
213
|
+
}, {
|
|
214
|
+
readonly tag: "qti-choice-interaction";
|
|
215
|
+
readonly ctor: typeof QtiChoiceInteraction;
|
|
216
|
+
}, {
|
|
217
|
+
readonly tag: "qti-custom-interaction";
|
|
218
|
+
readonly ctor: typeof QtiCustomInteraction;
|
|
219
|
+
}, {
|
|
220
|
+
readonly tag: "qti-end-attempt-interaction";
|
|
221
|
+
readonly ctor: typeof QtiEndAttemptInteraction;
|
|
222
|
+
}, {
|
|
223
|
+
readonly tag: "qti-extended-text-interaction";
|
|
224
|
+
readonly ctor: typeof QtiExtendedTextInteraction;
|
|
225
|
+
}, {
|
|
226
|
+
readonly tag: "qti-gap-match-interaction";
|
|
227
|
+
readonly ctor: typeof QtiGapMatchInteraction;
|
|
228
|
+
}, {
|
|
229
|
+
readonly tag: "qti-graphic-associate-interaction";
|
|
230
|
+
readonly ctor: typeof QtiGraphicAssociateInteraction;
|
|
231
|
+
}, {
|
|
232
|
+
readonly tag: "qti-graphic-gap-match-interaction";
|
|
233
|
+
readonly ctor: typeof QtiGraphicGapMatchInteraction;
|
|
234
|
+
}, {
|
|
235
|
+
readonly tag: "qti-graphic-order-interaction";
|
|
236
|
+
readonly ctor: typeof QtiGraphicOrderInteraction;
|
|
237
|
+
}, {
|
|
238
|
+
readonly tag: "qti-hotspot-interaction";
|
|
239
|
+
readonly ctor: typeof QtiHotspotInteraction;
|
|
240
|
+
}, {
|
|
241
|
+
readonly tag: "qti-hottext-interaction";
|
|
242
|
+
readonly ctor: typeof QtiHottextInteraction;
|
|
243
|
+
}, {
|
|
244
|
+
readonly tag: "qti-inline-choice-interaction";
|
|
245
|
+
readonly ctor: typeof QtiInlineChoiceInteraction;
|
|
246
|
+
}, {
|
|
247
|
+
readonly tag: "qti-match-interaction";
|
|
248
|
+
readonly ctor: typeof QtiMatchInteraction;
|
|
249
|
+
}, {
|
|
250
|
+
readonly tag: "qti-media-interaction";
|
|
251
|
+
readonly ctor: typeof QtiMediaInteraction;
|
|
252
|
+
}, {
|
|
253
|
+
readonly tag: "qti-order-interaction";
|
|
254
|
+
readonly ctor: typeof QtiOrderInteraction;
|
|
255
|
+
}, {
|
|
256
|
+
readonly tag: "qti-portable-custom-interaction";
|
|
257
|
+
readonly ctor: typeof QtiPortableCustomInteraction;
|
|
258
|
+
}, {
|
|
259
|
+
readonly tag: "qti-portable-custom-interaction-test";
|
|
260
|
+
readonly ctor: typeof QtiPortableCustomInteractionTest;
|
|
261
|
+
}, {
|
|
262
|
+
readonly tag: "qti-position-object-interaction";
|
|
263
|
+
readonly ctor: typeof QtiPositionObjectInteraction;
|
|
264
|
+
}, {
|
|
265
|
+
readonly tag: "qti-position-object-stage";
|
|
266
|
+
readonly ctor: typeof QtiPositionObjectStage;
|
|
267
|
+
}, {
|
|
268
|
+
readonly tag: "qti-select-point-interaction";
|
|
269
|
+
readonly ctor: typeof QtiSelectPointInteraction;
|
|
270
|
+
}, {
|
|
271
|
+
readonly tag: "qti-slider-interaction";
|
|
272
|
+
readonly ctor: typeof QtiSliderInteraction;
|
|
273
|
+
}, {
|
|
274
|
+
readonly tag: "qti-text-entry-interaction";
|
|
275
|
+
readonly ctor: typeof QtiTextEntryInteraction;
|
|
276
|
+
}, {
|
|
277
|
+
readonly tag: "qti-upload-interaction";
|
|
278
|
+
readonly ctor: typeof QtiUploadInteraction;
|
|
279
|
+
}];
|
|
280
|
+
|
|
281
|
+
export { QtiAssociableHotspot, QtiAssociateInteraction, QtiChoiceInteraction, QtiCustomInteraction, QtiEndAttemptInteraction, QtiExtendedTextInteraction, QtiGap, QtiGapImg, QtiGapMatchInteraction, QtiGapText, QtiGraphicAssociateInteraction, QtiGraphicGapMatchInteraction, QtiGraphicOrderInteraction, QtiHotspotChoice, QtiHotspotInteraction, QtiHottext, QtiHottextInteraction, QtiInlineChoice, QtiInlineChoiceInteraction, QtiMatchInteraction, QtiMediaInteraction, QtiOrderInteraction, QtiPortableCustomInteraction, QtiPositionObjectInteraction, QtiPositionObjectStage, QtiPrompt, QtiSelectPointInteraction, QtiSimpleAssociableChoice, QtiSimpleChoice, QtiSliderInteraction, QtiTextEntryInteraction, QtiUploadInteraction, qtiInteractionElements };
|
package/dist/interactions.js
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
QtiPrompt,
|
|
12
12
|
QtiUploadInteraction,
|
|
13
13
|
qtiInteractionElements
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-CK7AV2UJ.js";
|
|
15
15
|
import {
|
|
16
16
|
QtiAssociateInteraction,
|
|
17
17
|
QtiChoiceInteraction,
|
|
@@ -34,10 +34,9 @@ import {
|
|
|
34
34
|
QtiSimpleChoice,
|
|
35
35
|
QtiSliderInteraction,
|
|
36
36
|
QtiTextEntryInteraction
|
|
37
|
-
} from "./chunk-
|
|
38
|
-
import "./chunk-
|
|
39
|
-
import "./chunk-
|
|
40
|
-
import "./chunk-H3J7LFRO.js";
|
|
37
|
+
} from "./chunk-TWPXES3S.js";
|
|
38
|
+
import "./chunk-4DB4SC5K.js";
|
|
39
|
+
import "./chunk-HQESINXH.js";
|
|
41
40
|
export {
|
|
42
41
|
QtiAssociableHotspot,
|
|
43
42
|
QtiAssociateInteraction,
|