@qti-components/test 2.0.0-next.12 → 2.0.0-next.14
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/components/qti-assessment-item-ref/qti-assessment-item-ref.js +1 -1
- package/dist/components/qti-assessment-item-ref/qti-assessment-item-ref.js.map +1 -1
- package/dist/components/qti-assessment-test/qti-assessment-test.d.ts +1 -1
- package/dist/components/qti-assessment-test/qti-assessment-test.js +1 -1
- package/dist/components/qti-assessment-test/qti-assessment-test.js.map +1 -1
- package/dist/components/qti-number-presented/qti-number-presented.js +1 -1
- package/dist/components/qti-number-presented/qti-number-presented.js.map +1 -1
- package/dist/components/qti-number-selected/qti-number-selected.js +2 -2
- package/dist/components/qti-number-selected/qti-number-selected.js.map +1 -1
- package/dist/components/qti-test/qti-test.d.ts +2 -2
- package/dist/components/qti-test/qti-test.js +2 -2
- package/dist/components/qti-test/qti-test.js.map +1 -1
- package/dist/components/qti-test-variables/qti-test-variables.js +2 -2
- package/dist/components/qti-test-variables/qti-test-variables.js.map +1 -1
- package/dist/components/styles.js +64 -34
- package/dist/components/styles.js.map +1 -1
- package/dist/components/test-bookmark/test-bookmark.js +1 -1
- package/dist/components/test-bookmark/test-bookmark.js.map +1 -1
- package/dist/components/test-check-item/test-check-item.js +2 -2
- package/dist/components/test-check-item/test-check-item.js.map +1 -1
- package/dist/components/test-container/test-container.js +1 -1
- package/dist/components/test-container/test-container.js.map +1 -1
- package/dist/components/test-end-attempt/test-end-attempt.d.ts +1 -1
- package/dist/components/test-end-attempt/test-end-attempt.js +2 -2
- package/dist/components/test-end-attempt/test-end-attempt.js.map +1 -1
- package/dist/components/test-item-link/test-item-link.js +1 -1
- package/dist/components/test-item-link/test-item-link.js.map +1 -1
- package/dist/components/test-navigation/test-navigation.js +4 -4
- package/dist/components/test-navigation/test-navigation.js.map +1 -1
- package/dist/components/test-next/test-next.js +1 -1
- package/dist/components/test-next/test-next.js.map +1 -1
- package/dist/components/test-prev/test-prev.js +1 -1
- package/dist/components/test-prev/test-prev.js.map +1 -1
- package/dist/components/test-print-state/test-print-state.d.ts +1 -1
- package/dist/components/test-print-state/test-print-state.js +3 -3
- package/dist/components/test-print-state/test-print-state.js.map +1 -1
- package/dist/components/test-scoring-buttons/test-scoring-buttons.js +1 -1
- package/dist/components/test-scoring-buttons/test-scoring-buttons.js.map +1 -1
- package/dist/components/test-section-link/test-section-link.js +1 -1
- package/dist/components/test-section-link/test-section-link.js.map +1 -1
- package/dist/components/test-submit/test-submit.d.ts +1 -1
- package/dist/components/test-submit/test-submit.js +2 -2
- package/dist/components/test-submit/test-submit.js.map +1 -1
- package/dist/components/test-view-toggle/test-view-toggle.js +1 -1
- package/dist/components/test-view-toggle/test-view-toggle.js.map +1 -1
- package/dist/components/test-view-toggle/test-view.js +1 -1
- package/dist/components/test-view-toggle/test-view.js.map +1 -1
- package/dist/mixins/test-base.js +3 -3
- package/dist/mixins/test-base.js.map +1 -1
- package/dist/mixins/test-navigation.mixin.js +13 -13
- package/dist/mixins/test-navigation.mixin.js.map +1 -1
- package/dist/mixins/test-processing.mixin.js +3 -3
- package/dist/mixins/test-processing.mixin.js.map +1 -1
- package/dist/mixins/test-state.mixin.d.ts +2 -7
- package/dist/mixins/test-state.mixin.js +6 -6
- package/dist/mixins/test-state.mixin.js.map +1 -1
- package/dist/mixins/test-view.mixin.js +2 -2
- package/dist/mixins/test-view.mixin.js.map +1 -1
- package/dist/plugin-state.d.ts +1 -1
- package/dist/plugin-state.js +1 -1
- package/dist/plugin-state.js.map +1 -1
- package/dist/public-events.d.ts +22 -20
- package/dist/public-events.js +16 -20
- package/dist/public-events.js.map +1 -1
- package/dist/tts/test-item-to-speech.d.ts +10 -2
- package/dist/tts/test-item-to-speech.js +38 -12
- package/dist/tts/test-item-to-speech.js.map +1 -1
- package/dist/types/qti-test-state.d.ts +1 -1
- package/dist/types/qti-test-state.js.map +1 -1
- package/package.json +7 -7
package/dist/public-events.js
CHANGED
|
@@ -1,25 +1,21 @@
|
|
|
1
1
|
import { dispatchDeclared, listenDeclared } from '@qti-components/elements/public-events';
|
|
2
2
|
export const PUBLIC_EVENTS = {
|
|
3
|
-
'
|
|
4
|
-
'
|
|
5
|
-
'
|
|
6
|
-
'
|
|
7
|
-
'
|
|
8
|
-
'
|
|
9
|
-
'
|
|
10
|
-
'
|
|
11
|
-
'
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
},
|
|
16
|
-
'
|
|
17
|
-
'
|
|
18
|
-
'
|
|
19
|
-
'cito-test-state-changed': { kind: 'notification', scope: 'test', deprecated: 'qti-state-changed' },
|
|
20
|
-
'cito-test-items-skipped': { kind: 'notification', scope: 'test' },
|
|
21
|
-
'cito-test-end-reached': { kind: 'notification', scope: 'test' },
|
|
22
|
-
'cito-item-ref-connected': { kind: 'notification', scope: 'item', deprecated: 'qti-assessment-item-ref-connected' }
|
|
3
|
+
'qc-test-navigate': { kind: 'request', scope: 'test', deprecated: 'cito-test-navigate' },
|
|
4
|
+
'qc-test-end-attempt': { kind: 'request', scope: 'test', deprecated: 'cito-test-end-attempt' },
|
|
5
|
+
'qc-test-submit': { kind: 'request', scope: 'test', deprecated: 'cito-test-submit' },
|
|
6
|
+
'qc-test-update-outcome': { kind: 'request', scope: 'test', deprecated: 'cito-test-update-outcome' },
|
|
7
|
+
'qc-test-update-plugin-state': { kind: 'request', scope: 'test', deprecated: 'cito-test-update-plugin-state' },
|
|
8
|
+
'qc-test-switch-view': { kind: 'request', scope: 'test', deprecated: 'cito-test-switch-view' },
|
|
9
|
+
'qc-test-submitted': { kind: 'notification', scope: 'test', deprecated: 'cito-test-submitted' },
|
|
10
|
+
'qc-test-navigated': { kind: 'notification', scope: 'test', deprecated: 'cito-test-navigated' },
|
|
11
|
+
'qc-test-navigation-started': { kind: 'notification', scope: 'test', deprecated: 'cito-test-navigation-started' },
|
|
12
|
+
'qc-test-navigation-failed': { kind: 'notification', scope: 'test', deprecated: 'cito-test-navigation-failed' },
|
|
13
|
+
'qc-test-rendered': { kind: 'notification', scope: 'test', deprecated: 'cito-test-rendered' },
|
|
14
|
+
'qc-test-loaded': { kind: 'notification', scope: 'test', deprecated: 'cito-test-loaded' },
|
|
15
|
+
'qc-test-state-changed': { kind: 'notification', scope: 'test', deprecated: 'cito-test-state-changed' },
|
|
16
|
+
'qc-test-items-skipped': { kind: 'notification', scope: 'test', deprecated: 'cito-test-items-skipped' },
|
|
17
|
+
'qc-test-end-reached': { kind: 'notification', scope: 'test', deprecated: 'cito-test-end-reached' },
|
|
18
|
+
'qc-item-ref-connected': { kind: 'notification', scope: 'item', deprecated: 'cito-item-ref-connected' }
|
|
23
19
|
};
|
|
24
20
|
/**
|
|
25
21
|
* Dispatch a public event, and its deprecated name with the same `detail` object. The detail is
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public-events.js","sourceRoot":"","sources":["../src/public-events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;
|
|
1
|
+
{"version":3,"file":"public-events.js","sourceRoot":"","sources":["../src/public-events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AA+D1F,MAAM,CAAC,MAAM,aAAa,GAAoD;IAC5E,kBAAkB,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,oBAAoB,EAAE;IACxF,qBAAqB,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,uBAAuB,EAAE;IAC9F,gBAAgB,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,kBAAkB,EAAE;IACpF,wBAAwB,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,0BAA0B,EAAE;IACpG,6BAA6B,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,+BAA+B,EAAE;IAC9G,qBAAqB,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,uBAAuB,EAAE;IAC9F,mBAAmB,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,qBAAqB,EAAE;IAC/F,mBAAmB,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,qBAAqB,EAAE;IAC/F,4BAA4B,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,8BAA8B,EAAE;IACjH,2BAA2B,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,6BAA6B,EAAE;IAC/G,kBAAkB,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,oBAAoB,EAAE;IAC7F,gBAAgB,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,kBAAkB,EAAE;IACzF,uBAAuB,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,yBAAyB,EAAE;IACvG,uBAAuB,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,yBAAyB,EAAE;IACvG,qBAAqB,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,uBAAuB,EAAE;IACnG,uBAAuB,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,yBAAyB,EAAE;CACxG,CAAC;AAMF;;;GAGG;AACH,MAAM,UAAU,cAAc,CAC5B,MAAmB,EACnB,IAAO,EACP,MAAkE;IAElE,gBAAgB,CAAC,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AACxD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY,CAC1B,MAAmB,EACnB,IAAO,EACP,OAAuC;IAEvC,cAAc,CAAC,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,OAA6B,CAAC,CAAC;AAC7E,CAAC","sourcesContent":["import { dispatchDeclared, listenDeclared } from '@qti-components/elements/public-events';\n\nimport type { View } from '@qti-components/base';\nimport type { PublicEventDeclaration } from '@qti-components/elements/public-events';\nimport type { QtiTestState } from './types/qti-test-state';\n\n/**\n * The public events of the test. The name tells you it is public: everything here starts with\n * `qc-`; every other event is internal plumbing and may change in any release.\n *\n * Requests are verbs (a host or plugin dispatches them at the test), notifications are past tense\n * (the test dispatches them). All bubble and are composed.\n *\n * `deprecated` is the `cito-` name this event had in 9.x. One helper (`dispatchPublic`,\n * `listenPublic`) sends or handles both names until the next major, then the field goes. The 7.x\n * names (`qti-request-navigation`, `test-end-attempt`, `on-test-switch-view`, …) are no longer sent\n * or handled.\n */\nexport interface NavigationTarget {\n type: 'item' | 'section';\n id: string;\n}\n\nexport interface NavigationFailure {\n message: string;\n details?: unknown;\n itemId?: string;\n sectionId?: string;\n}\n\nexport interface PublicEventMap {\n 'qc-test-navigate': CustomEvent<NavigationTarget>;\n /**\n * Ends an attempt: processes the response of the item-ref `itemId`, or, without it, of the item on\n * screen. `<test-end-attempt>` sends the `itemId` of the item it is stamped into or names.\n */\n 'qc-test-end-attempt': CustomEvent<{ itemId?: string }>;\n /** Scores the test: resets its outcomes to their defaults, runs outcome processing, then `qc-test-submitted`. */\n 'qc-test-submit': CustomEvent<Record<string, never>>;\n 'qc-test-update-outcome': CustomEvent<{\n assessmentItemRefId: string;\n outcomeVariableId: string;\n value: number | string;\n }>;\n 'qc-test-switch-view': CustomEvent<View>;\n /** `value` is JSON; `null` or `undefined` removes the plugin's entry. */\n 'qc-test-update-plugin-state': CustomEvent<{ plugin: string; value: unknown }>;\n /** Outcome processing ran after a submit: read the test outcomes now. */\n 'qc-test-submitted': CustomEvent<Record<string, never>>;\n 'qc-test-navigated': CustomEvent<NavigationTarget>;\n 'qc-test-navigation-started': CustomEvent<NavigationTarget>;\n 'qc-test-navigation-failed': CustomEvent<NavigationFailure>;\n 'qc-test-rendered': CustomEvent<{ identifier: string; element: Element }[]>;\n // `qc-test-loaded` (detail: the `QtiAssessmentTest`) is added by qti-assessment-test.ts, so this\n // module imports no element: that import would be a cycle.\n 'qc-test-state-changed': CustomEvent<QtiTestState>;\n 'qc-test-items-skipped': CustomEvent<{ ids: string[] }>;\n 'qc-test-end-reached': CustomEvent<Record<string, never>>;\n 'qc-item-ref-connected': CustomEvent<{ identifier: string; href: string; category: string }>;\n}\n\nexport type PublicEventName = keyof PublicEventMap;\n\nexport const PUBLIC_EVENTS: Record<PublicEventName, PublicEventDeclaration> = {\n 'qc-test-navigate': { kind: 'request', scope: 'test', deprecated: 'cito-test-navigate' },\n 'qc-test-end-attempt': { kind: 'request', scope: 'test', deprecated: 'cito-test-end-attempt' },\n 'qc-test-submit': { kind: 'request', scope: 'test', deprecated: 'cito-test-submit' },\n 'qc-test-update-outcome': { kind: 'request', scope: 'test', deprecated: 'cito-test-update-outcome' },\n 'qc-test-update-plugin-state': { kind: 'request', scope: 'test', deprecated: 'cito-test-update-plugin-state' },\n 'qc-test-switch-view': { kind: 'request', scope: 'test', deprecated: 'cito-test-switch-view' },\n 'qc-test-submitted': { kind: 'notification', scope: 'test', deprecated: 'cito-test-submitted' },\n 'qc-test-navigated': { kind: 'notification', scope: 'test', deprecated: 'cito-test-navigated' },\n 'qc-test-navigation-started': { kind: 'notification', scope: 'test', deprecated: 'cito-test-navigation-started' },\n 'qc-test-navigation-failed': { kind: 'notification', scope: 'test', deprecated: 'cito-test-navigation-failed' },\n 'qc-test-rendered': { kind: 'notification', scope: 'test', deprecated: 'cito-test-rendered' },\n 'qc-test-loaded': { kind: 'notification', scope: 'test', deprecated: 'cito-test-loaded' },\n 'qc-test-state-changed': { kind: 'notification', scope: 'test', deprecated: 'cito-test-state-changed' },\n 'qc-test-items-skipped': { kind: 'notification', scope: 'test', deprecated: 'cito-test-items-skipped' },\n 'qc-test-end-reached': { kind: 'notification', scope: 'test', deprecated: 'cito-test-end-reached' },\n 'qc-item-ref-connected': { kind: 'notification', scope: 'item', deprecated: 'cito-item-ref-connected' }\n};\n\ndeclare global {\n interface HTMLElementEventMap extends PublicEventMap {}\n}\n\n/**\n * Dispatch a public event, and its deprecated name with the same `detail` object. The detail is\n * always an object so `listenPublic` can tell the two apart from one dispatch.\n */\nexport function dispatchPublic<K extends PublicEventName>(\n target: EventTarget,\n name: K,\n detail: PublicEventMap[K] extends CustomEvent<infer D> ? D : never\n): void {\n dispatchDeclared(target, PUBLIC_EVENTS, name, detail);\n}\n\n/**\n * Listen for a public event and its deprecated name; the handler runs once for a sender that\n * dispatched both. See `listenDeclared`.\n */\nexport function listenPublic<K extends PublicEventName>(\n target: EventTarget,\n name: K,\n handler: (e: PublicEventMap[K]) => void\n): void {\n listenDeclared(target, PUBLIC_EVENTS, name, handler as (e: Event) => void);\n}\n"]}
|
|
@@ -38,6 +38,8 @@ declare abstract class TtsButtonBase extends LitElement {
|
|
|
38
38
|
*/
|
|
39
39
|
label?: string;
|
|
40
40
|
protected _tts?: TtsContext;
|
|
41
|
+
/** Whether this control is a toggle that is on; mirrored as `:state(selected)`. A plain button never is. */
|
|
42
|
+
protected get selected(): boolean;
|
|
41
43
|
updated(_changed: PropertyValues): void;
|
|
42
44
|
}
|
|
43
45
|
/**
|
|
@@ -58,7 +60,9 @@ declare abstract class TtsButtonBase extends LitElement {
|
|
|
58
60
|
* The controller lays its controls out as a wrapping row; each control draws an icon button,
|
|
59
61
|
* and slotted content replaces the icon — a slotted `<svg>` is sized like the default one. Give a
|
|
60
62
|
* 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
|
|
61
|
-
* defaults as fallbacks)
|
|
63
|
+
* defaults as fallbacks), are painted through the `--button-*` slots every button in the theme shares
|
|
64
|
+
* (`--test-button-*` still works as an alias), and can be sized with `--button-size` and
|
|
65
|
+
* `--test-tts-icon-size`.
|
|
62
66
|
*
|
|
63
67
|
* ### Language resolution
|
|
64
68
|
*
|
|
@@ -230,12 +234,16 @@ export declare class TestTtsNext extends TtsButtonBase {
|
|
|
230
234
|
}
|
|
231
235
|
/**
|
|
232
236
|
* Pick button — toggles pick mode on the controller: every reading element is highlighted and
|
|
233
|
-
* a click on one of them starts reading from there. Reflects the mode as `:state(picking)
|
|
237
|
+
* a click on one of them starts reading from there. Reflects the mode as `:state(picking)`, and,
|
|
238
|
+
* being the toggle that switched it on, as `:state(selected)`, painted through
|
|
239
|
+
* `--button-selected-background-color` / `--button-selected-color`.
|
|
234
240
|
* @cssstate idle / playing / paused
|
|
235
241
|
* @cssstate picking
|
|
242
|
+
* @cssstate selected - This toggle is on: pick mode is active
|
|
236
243
|
* @csspart button
|
|
237
244
|
*/
|
|
238
245
|
export declare class TestTtsPick extends TtsButtonBase {
|
|
246
|
+
protected get selected(): boolean;
|
|
239
247
|
render(): import("lit").TemplateResult<1>;
|
|
240
248
|
}
|
|
241
249
|
declare global {
|
|
@@ -24,11 +24,11 @@ function getHighlightSheet() {
|
|
|
24
24
|
highlightSheet = new CSSStyleSheet();
|
|
25
25
|
highlightSheet.replaceSync(`
|
|
26
26
|
::highlight(${HIGHLIGHT_ELEMENT}) {
|
|
27
|
-
background-color: var(--test-tts-element-highlight, color-mix(in oklab, var(--qti-color-info, var(--cito-color-info, Highlight)) 15%, transparent));
|
|
27
|
+
background-color: var(--test-tts-element-highlight, color-mix(in oklab, var(--qti-color-info, var(--qc-color-info, var(--cito-color-info, Highlight))) 15%, transparent));
|
|
28
28
|
color: inherit;
|
|
29
29
|
}
|
|
30
30
|
::highlight(${HIGHLIGHT_WORD}) {
|
|
31
|
-
background-color: var(--test-tts-word-highlight, color-mix(in oklab, var(--qti-color-warning, var(--cito-color-warning, Mark)) 55%, transparent));
|
|
31
|
+
background-color: var(--test-tts-word-highlight, color-mix(in oklab, var(--qti-color-warning, var(--qc-color-warning, var(--cito-color-warning, Mark))) 55%, transparent));
|
|
32
32
|
color: inherit;
|
|
33
33
|
}
|
|
34
34
|
`);
|
|
@@ -68,7 +68,7 @@ class TtsButtonBase extends LitElement {
|
|
|
68
68
|
}
|
|
69
69
|
button {
|
|
70
70
|
${styles.btn};
|
|
71
|
-
min-inline-size: var(--test-button-size, 2.25rem);
|
|
71
|
+
min-inline-size: var(--button-size, var(--test-button-size, 2.25rem));
|
|
72
72
|
padding-inline: 0.5rem;
|
|
73
73
|
/* Containing block for the visually hidden .label. Without it the label is placed against
|
|
74
74
|
the nearest positioned ancestor, which can sit outside a scroll container and make the
|
|
@@ -89,10 +89,16 @@ class TtsButtonBase extends LitElement {
|
|
|
89
89
|
button:disabled {
|
|
90
90
|
${styles.dis};
|
|
91
91
|
}
|
|
92
|
+
/* A toggle that is on (the pick button in pick mode). The host carries :state(selected) for a
|
|
93
|
+
page's own rules; in here the inner button's aria-pressed says the same thing and matches in
|
|
94
|
+
a browser without :state(), so the look keys on that. */
|
|
92
95
|
button[aria-pressed='true'],
|
|
93
96
|
button[aria-pressed='true']:hover {
|
|
94
|
-
background-color: var(
|
|
95
|
-
|
|
97
|
+
background-color: var(
|
|
98
|
+
--button-selected-background-color,
|
|
99
|
+
var(--test-button-selected-background-color, var(--qti-selected-bg, Highlight))
|
|
100
|
+
);
|
|
101
|
+
color: var(--button-selected-color, var(--test-button-selected-color, var(--qti-selected-color, HighlightText)));
|
|
96
102
|
}
|
|
97
103
|
svg,
|
|
98
104
|
::slotted(svg) {
|
|
@@ -116,20 +122,29 @@ class TtsButtonBase extends LitElement {
|
|
|
116
122
|
#internals = this.attachInternals();
|
|
117
123
|
#mirroredState;
|
|
118
124
|
#mirroredPicking = false;
|
|
125
|
+
#mirroredSelected = false;
|
|
126
|
+
/** Whether this control is a toggle that is on; mirrored as `:state(selected)`. A plain button never is. */
|
|
127
|
+
get selected() {
|
|
128
|
+
return false;
|
|
129
|
+
}
|
|
119
130
|
updated(_changed) {
|
|
120
131
|
// `_tts` is a context field, not a reactive property, so it never shows up in `changed`:
|
|
121
132
|
// compare against what was last mirrored instead.
|
|
122
133
|
const state = this._tts?.state;
|
|
123
134
|
const picking = this._tts?.picking ?? false;
|
|
124
|
-
|
|
135
|
+
const selected = this.selected;
|
|
136
|
+
if (state === this.#mirroredState && picking === this.#mirroredPicking && selected === this.#mirroredSelected)
|
|
125
137
|
return;
|
|
126
138
|
this.#mirroredState = state;
|
|
127
139
|
this.#mirroredPicking = picking;
|
|
140
|
+
this.#mirroredSelected = selected;
|
|
128
141
|
this.#internals.states.clear();
|
|
129
142
|
if (state)
|
|
130
143
|
this.#internals.states.add(state);
|
|
131
144
|
if (picking)
|
|
132
145
|
this.#internals.states.add('picking');
|
|
146
|
+
if (selected)
|
|
147
|
+
this.#internals.states.add('selected');
|
|
133
148
|
}
|
|
134
149
|
}
|
|
135
150
|
__decorate([
|
|
@@ -157,7 +172,9 @@ __decorate([
|
|
|
157
172
|
* The controller lays its controls out as a wrapping row; each control draws an icon button,
|
|
158
173
|
* and slotted content replaces the icon — a slotted `<svg>` is sized like the default one. Give a
|
|
159
174
|
* 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
|
|
160
|
-
* defaults as fallbacks)
|
|
175
|
+
* defaults as fallbacks), are painted through the `--button-*` slots every button in the theme shares
|
|
176
|
+
* (`--test-button-*` still works as an alias), and can be sized with `--button-size` and
|
|
177
|
+
* `--test-tts-icon-size`.
|
|
161
178
|
*
|
|
162
179
|
* ### Language resolution
|
|
163
180
|
*
|
|
@@ -409,11 +426,14 @@ export class TestItemToSpeech extends LitElement {
|
|
|
409
426
|
this.#eventHost.addEventListener('qti-assessment-item-connected', this.#boundHandleItemConnected);
|
|
410
427
|
}
|
|
411
428
|
else {
|
|
412
|
-
// Cursor mode:
|
|
429
|
+
// Cursor mode: qc-test-navigate fires synchronously on prev/next — stop right away
|
|
413
430
|
// instead of waiting for the new position to arrive through the computed context.
|
|
431
|
+
// Listened to directly, under both names, because `listenPublic` has no unsubscribe and
|
|
432
|
+
// this player must let go of the host on disconnect. `#stop()` is idempotent, so the alias
|
|
433
|
+
// copy of a dual dispatch is harmless.
|
|
414
434
|
this.#eventHost = this.closest('test-navigation') ?? this.getRootNode();
|
|
415
|
-
this.#eventHost.addEventListener('
|
|
416
|
-
this.#eventHost.addEventListener('
|
|
435
|
+
this.#eventHost.addEventListener('qc-test-navigate', this.#boundHandleNavigation);
|
|
436
|
+
this.#eventHost.addEventListener('cito-test-navigate', this.#boundHandleNavigation); // old name, one major
|
|
417
437
|
}
|
|
418
438
|
}
|
|
419
439
|
disconnectedCallback() {
|
|
@@ -426,8 +446,8 @@ export class TestItemToSpeech extends LitElement {
|
|
|
426
446
|
this.#stopPicking();
|
|
427
447
|
this.#clearAllHighlights();
|
|
428
448
|
this.#eventHost?.removeEventListener('qti-assessment-item-connected', this.#boundHandleItemConnected);
|
|
449
|
+
this.#eventHost?.removeEventListener('qc-test-navigate', this.#boundHandleNavigation);
|
|
429
450
|
this.#eventHost?.removeEventListener('cito-test-navigate', this.#boundHandleNavigation);
|
|
430
|
-
this.#eventHost?.removeEventListener('qti-request-navigation', this.#boundHandleNavigation);
|
|
431
451
|
this.#eventHost = null;
|
|
432
452
|
this.#itemRef = null;
|
|
433
453
|
this.#stimulusObserver?.disconnect();
|
|
@@ -1031,12 +1051,18 @@ export class TestTtsNext extends TtsButtonBase {
|
|
|
1031
1051
|
}
|
|
1032
1052
|
/**
|
|
1033
1053
|
* Pick button — toggles pick mode on the controller: every reading element is highlighted and
|
|
1034
|
-
* a click on one of them starts reading from there. Reflects the mode as `:state(picking)
|
|
1054
|
+
* a click on one of them starts reading from there. Reflects the mode as `:state(picking)`, and,
|
|
1055
|
+
* being the toggle that switched it on, as `:state(selected)`, painted through
|
|
1056
|
+
* `--button-selected-background-color` / `--button-selected-color`.
|
|
1035
1057
|
* @cssstate idle / playing / paused
|
|
1036
1058
|
* @cssstate picking
|
|
1059
|
+
* @cssstate selected - This toggle is on: pick mode is active
|
|
1037
1060
|
* @csspart button
|
|
1038
1061
|
*/
|
|
1039
1062
|
export class TestTtsPick extends TtsButtonBase {
|
|
1063
|
+
get selected() {
|
|
1064
|
+
return this._tts?.picking ?? false;
|
|
1065
|
+
}
|
|
1040
1066
|
render() {
|
|
1041
1067
|
return html `
|
|
1042
1068
|
<button
|