@qti-components/test 2.0.0-next.10 → 2.0.0-next.12

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.
Files changed (40) hide show
  1. package/dist/components/qti-test/getting-started.fixtures.d.ts +4 -3
  2. package/dist/components/qti-test/getting-started.fixtures.js +4 -3
  3. package/dist/components/qti-test/getting-started.fixtures.js.map +1 -1
  4. package/dist/components/styles.d.ts +11 -0
  5. package/dist/components/styles.js +65 -2
  6. package/dist/components/styles.js.map +1 -1
  7. package/dist/components/test-bookmark/test-bookmark.d.ts +1 -1
  8. package/dist/components/test-bookmark/test-bookmark.js +22 -39
  9. package/dist/components/test-bookmark/test-bookmark.js.map +1 -1
  10. package/dist/components/test-check-item/test-check-item.js +3 -21
  11. package/dist/components/test-check-item/test-check-item.js.map +1 -1
  12. package/dist/components/test-end-attempt/test-end-attempt.d.ts +25 -0
  13. package/dist/components/test-end-attempt/test-end-attempt.js +57 -28
  14. package/dist/components/test-end-attempt/test-end-attempt.js.map +1 -1
  15. package/dist/components/test-item-link/test-item-link.js +3 -21
  16. package/dist/components/test-item-link/test-item-link.js.map +1 -1
  17. package/dist/components/test-navigation/test-navigation.d.ts +1 -0
  18. package/dist/components/test-navigation/test-navigation.js +61 -8
  19. package/dist/components/test-navigation/test-navigation.js.map +1 -1
  20. package/dist/components/test-next/test-next.d.ts +1 -1
  21. package/dist/components/test-next/test-next.js +3 -22
  22. package/dist/components/test-next/test-next.js.map +1 -1
  23. package/dist/components/test-prev/test-prev.js +3 -21
  24. package/dist/components/test-prev/test-prev.js.map +1 -1
  25. package/dist/components/test-print-state/test-print-state.d.ts +27 -0
  26. package/dist/components/test-print-state/test-print-state.js +87 -0
  27. package/dist/components/test-print-state/test-print-state.js.map +1 -0
  28. package/dist/components/test-scoring-feedback/test-scoring-feedback.js +2 -2
  29. package/dist/components/test-scoring-feedback/test-scoring-feedback.js.map +1 -1
  30. package/dist/components/test-section-link/test-section-link.js +3 -21
  31. package/dist/components/test-section-link/test-section-link.js.map +1 -1
  32. package/dist/components/test-submit/test-submit.js +3 -21
  33. package/dist/components/test-submit/test-submit.js.map +1 -1
  34. package/dist/elements.d.ts +3 -0
  35. package/dist/plugins/elements.d.ts +5 -1
  36. package/dist/plugins/elements.js +3 -1
  37. package/dist/plugins/elements.js.map +1 -1
  38. package/dist/public-events.d.ts +7 -1
  39. package/dist/public-events.js.map +1 -1
  40. package/package.json +6 -6
@@ -0,0 +1,87 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { css, html, LitElement, nothing } from 'lit';
8
+ import { state } from 'lit/decorators.js';
9
+ /**
10
+ * Shows the test's state (`qtiTest.state`) as a tree you can fold open and shut, and keeps it current
11
+ * on every `cito-test-state-changed`. A debug helper: drop it anywhere inside `<qti-test>`.
12
+ *
13
+ * The first two levels start open. A list entry with an `identifier` (an item, a variable) is labelled
14
+ * by it. The element only lays out the tree; give it a font, colour and height from the page.
15
+ *
16
+ * @customElement test-print-state
17
+ * @csspart key - the name of a field, or the label of a list entry
18
+ * @csspart value - a value that is not an object or a list
19
+ * @csspart count - the number of entries of a folded object or list
20
+ */
21
+ export class TestPrintState extends LitElement {
22
+ #test = null;
23
+ static { this.styles = css `
24
+ :host {
25
+ display: block;
26
+ }
27
+ ul {
28
+ list-style: none;
29
+ margin: 0;
30
+ padding-inline-start: 1rem;
31
+ }
32
+ summary {
33
+ cursor: pointer;
34
+ }
35
+ [part~='count'] {
36
+ opacity: 0.7;
37
+ }
38
+ `; }
39
+ #onStateChanged = (event) => {
40
+ this.testState = event.detail;
41
+ };
42
+ connectedCallback() {
43
+ super.connectedCallback();
44
+ this.#test = this.closest('qti-test');
45
+ this.#test?.addEventListener('cito-test-state-changed', this.#onStateChanged);
46
+ this.testState = this.#test?.state;
47
+ }
48
+ disconnectedCallback() {
49
+ super.disconnectedCallback();
50
+ this.#test?.removeEventListener('cito-test-state-changed', this.#onStateChanged);
51
+ this.#test = null;
52
+ }
53
+ render() {
54
+ if (!this.testState)
55
+ return nothing;
56
+ return html `<ul>
57
+ ${this.#renderNode('state', this.testState, 0)}
58
+ </ul>`;
59
+ }
60
+ #renderNode(label, value, depth) {
61
+ if (value === null || typeof value !== 'object') {
62
+ return html `<li><span part="key">${label}</span>: <span part="value">${JSON.stringify(value)}</span></li>`;
63
+ }
64
+ const entries = Array.isArray(value)
65
+ ? value.map((entry, index) => [entryLabel(entry, index), entry])
66
+ : Object.entries(value);
67
+ const count = Array.isArray(value) ? `[${entries.length}]` : `{${entries.length}}`;
68
+ // `open` is bound once per depth, so Lit leaves a node the reader folded alone on the next update.
69
+ return html `<li>
70
+ <details ?open=${depth < 2}>
71
+ <summary><span part="key">${label}</span> <span part="count">${count}</span></summary>
72
+ <ul>
73
+ ${entries.map(([key, entry]) => this.#renderNode(key, entry, depth + 1))}
74
+ </ul>
75
+ </details>
76
+ </li>`;
77
+ }
78
+ }
79
+ __decorate([
80
+ state()
81
+ ], TestPrintState.prototype, "testState", void 0);
82
+ /** An item or a variable is easier to find by its identifier than by its index. */
83
+ const entryLabel = (entry, index) => {
84
+ const identifier = entry?.identifier;
85
+ return typeof identifier === 'string' ? `${index} · ${identifier}` : String(index);
86
+ };
87
+ //# sourceMappingURL=test-print-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-print-state.js","sourceRoot":"","sources":["../../../src/components/test-print-state/test-print-state.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,O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C,KAAK,CAAC,cAAc,CAAC;QAC7G,CAAC;QACD,MAAM,OAAO,GAAwB,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;YACvD,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,KAAK,CAAC,CAAC;YAChE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAC1B,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC;QACnF,mGAAmG;QACnG,OAAO,IAAI,CAAA;uBACQ,KAAK,GAAG,CAAC;oCACI,KAAK,8BAA8B,KAAK;;YAEhE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;;;UAGxE,CAAC;IACT,CAAC;;AA9DgB;IAAhB,KAAK,EAAE;iDAAkC;AAiE5C,mFAAmF;AACnF,MAAM,UAAU,GAAG,CAAC,KAAc,EAAE,KAAa,EAAU,EAAE;IAC3D,MAAM,UAAU,GAAI,KAAyC,EAAE,UAAU,CAAC;IAC1E,OAAO,OAAO,UAAU,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,KAAK,MAAM,UAAU,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACrF,CAAC,CAAC","sourcesContent":["import { css, html, LitElement, nothing } from 'lit';\nimport { state } from 'lit/decorators.js';\n\nimport type { TemplateResult } from 'lit';\nimport type { QtiTestState } from '../../types/qti-test-state';\n\ntype TestElement = HTMLElement & { state?: QtiTestState };\n\n/**\n * Shows the test's state (`qtiTest.state`) as a tree you can fold open and shut, and keeps it current\n * on every `cito-test-state-changed`. A debug helper: drop it anywhere inside `<qti-test>`.\n *\n * The first two levels start open. A list entry with an `identifier` (an item, a variable) is labelled\n * by it. The element only lays out the tree; give it a font, colour and height from the page.\n *\n * @customElement test-print-state\n * @csspart key - the name of a field, or the label of a list entry\n * @csspart value - a value that is not an object or a list\n * @csspart count - the number of entries of a folded object or list\n */\nexport class TestPrintState extends LitElement {\n @state() private testState?: QtiTestState;\n\n #test: TestElement | null = null;\n\n static override styles = css`\n :host {\n display: block;\n }\n ul {\n list-style: none;\n margin: 0;\n padding-inline-start: 1rem;\n }\n summary {\n cursor: pointer;\n }\n [part~='count'] {\n opacity: 0.7;\n }\n `;\n\n #onStateChanged = (event: Event) => {\n this.testState = (event as CustomEvent<QtiTestState>).detail;\n };\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.#test = this.closest<TestElement>('qti-test');\n this.#test?.addEventListener('cito-test-state-changed', this.#onStateChanged);\n this.testState = this.#test?.state;\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.#test?.removeEventListener('cito-test-state-changed', this.#onStateChanged);\n this.#test = null;\n }\n\n override render() {\n if (!this.testState) return nothing;\n return html`<ul>\n ${this.#renderNode('state', this.testState, 0)}\n </ul>`;\n }\n\n #renderNode(label: string, value: unknown, depth: number): TemplateResult {\n if (value === null || typeof value !== 'object') {\n return html`<li><span part=\"key\">${label}</span>: <span part=\"value\">${JSON.stringify(value)}</span></li>`;\n }\n const entries: [string, unknown][] = Array.isArray(value)\n ? value.map((entry, index) => [entryLabel(entry, index), entry])\n : Object.entries(value);\n const count = Array.isArray(value) ? `[${entries.length}]` : `{${entries.length}}`;\n // `open` is bound once per depth, so Lit leaves a node the reader folded alone on the next update.\n return html`<li>\n <details ?open=${depth < 2}>\n <summary><span part=\"key\">${label}</span> <span part=\"count\">${count}</span></summary>\n <ul>\n ${entries.map(([key, entry]) => this.#renderNode(key, entry, depth + 1))}\n </ul>\n </details>\n </li>`;\n }\n}\n\n/** An item or a variable is easier to find by its identifier than by its index. */\nconst entryLabel = (entry: unknown, index: number): string => {\n const identifier = (entry as { identifier?: unknown } | null)?.identifier;\n return typeof identifier === 'string' ? `${index} · ${identifier}` : String(index);\n};\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'test-print-state': TestPrintState;\n }\n}\n"]}
@@ -21,12 +21,12 @@ export class TestScoringFeedback extends LitElement {
21
21
  return html ``;
22
22
  if (activeItem['category'] === 'dep-informational')
23
23
  return html `<div>${this.dataset.informational}</div>`;
24
- const completionStatus = activeItem?.variables.find(v => v.identifier === 'completionStatus')?.value;
25
24
  const scoreOutcome = activeItem?.variables.find(vr => vr.identifier == 'SCORE');
26
25
  const score = parseFloat(scoreOutcome?.value);
27
26
  const externalScored = activeItem['externalScored'];
28
27
  const feedbackText = () => {
29
- if (completionStatus !== 'completed') {
28
+ // No (valid) answer: completionStatus is QTI's, set by response processing, not "answered".
29
+ if (activeItem.valid === false || activeItem.isDefaultResponse) {
30
30
  return this.dataset.textNoResponse;
31
31
  }
32
32
  if (!externalScored && score !== undefined && !Number.isNaN(score)) {
@@ -1 +1 @@
1
- {"version":3,"file":"test-scoring-feedback.js","sourceRoot":"","sources":["../../../src/components/test-scoring-feedback/test-scoring-feedback.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAMvD,MAAM,OAAO,mBAAoB,SAAQ,UAAU;IAAnD;;QAKS,SAAI,GAAS,IAAI,CAAC;IAyC3B,CAAC;IAvCU,MAAM;QACb,MAAM,UAAU,GAAG,IAAI,CAAC,eAAe,EAAE,SAAS;aAC/C,OAAO,CAAC,QA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AAE,CAAC;gBACzC,OAAO,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,KAAK,KAAK,SAAS;oBAC/C,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY;oBAC3B,CAAC,CAAC,yBAAyB,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,KAAK,SAAS,4EAA4E,CAAC;YACrL,CAAC;YAED,IAAI,cAAc,KAAK,OAAO,EAAE,CAAC;gBAC/B,OAAO,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,mCAAmC,CAAC;YACxE,CAAC;YAED,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC;QACjC,CAAC,CAAC;QAEF,OAAO,IAAI,CAAA,QAAQ,YAAY,EAAE,QAAQ,CAAC;IAC5C,CAAC;CACF;AA5CW;IADT,OAAO,CAAC,EAAE,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;4DACX;AAGrC;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC;iDACrB","sourcesContent":["import { consume } from '@lit/context';\nimport { html, LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\n\nimport { computedContext } from '@qti-components/base';\n\nimport type { View } from '@qti-components/base';\nimport type { OutcomeVariable } from '@qti-components/base';\nimport type { ComputedContext } from '@qti-components/base';\n\nexport class TestScoringFeedback extends LitElement {\n @consume({ context: computedContext, subscribe: true })\n protected computedContext?: ComputedContext;\n\n @property({ type: String, attribute: 'view' })\n public view: View = null;\n\n override render() {\n const activeItem = this.computedContext?.testParts\n .flatMap(testPart => testPart.sections.flatMap(section => section.items))\n .find(item => item.active);\n\n if (!activeItem || !activeItem.variables) return html``;\n\n if ((activeItem as any)['category'] === 'dep-informational') return html`<div>${this.dataset.informational}</div>`;\n\n const completionStatus = activeItem?.variables.find(v => v.identifier === 'completionStatus')?.value;\n const scoreOutcome = activeItem?.variables.find(vr => vr.identifier == 'SCORE') as OutcomeVariable;\n\n const score = parseFloat(scoreOutcome?.value as string);\n const externalScored = (activeItem as any)['externalScored'];\n\n const feedbackText = () => {\n if (completionStatus !== 'completed') {\n return this.dataset.textNoResponse;\n }\n\n if (!externalScored && score !== undefined && !Number.isNaN(score)) {\n return score > 0 ? this.dataset.textCorrect : this.dataset.textIncorrect;\n }\n\n if (externalScored === 'externalMachine') {\n return Number.isNaN(score) || score === undefined\n ? this.dataset.scoreUnknown\n : `We hebben je antwoord ${score === 0 ? 'geen punten' : score == 1 ? 'één punt' : `${score} punten`} gegeven. Je kunt je score zelf aanpassen als je denkt dat dat niet klopt.`;\n }\n\n if (externalScored === 'human') {\n return Number.isNaN(score) ? '' : 'Deze score heb je zelf toegekend.';\n }\n\n return this.dataset.inProgress;\n };\n\n return html`<div>${feedbackText()}</div>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'test-scoring-feedback': TestScoringFeedback;\n }\n}\n"]}
1
+ {"version":3,"file":"test-scoring-feedback.js","sourceRoot":"","sources":["../../../src/components/test-scoring-feedback/test-scoring-feedback.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAMvD,MAAM,OAAO,mBAAoB,SAAQ,UAAU;IAAnD;;QAKS,SAAI,GAAS,IAAI,CAAC;IAyC3B,CAAC;IAvCU,MAAM;QACb,MAAM,UAAU,GAAG,IAAI,CAAC,eAAe,EAAE,SAAS;aAC/C,OAAO,CAAC,QAAQ,CAA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CAAC,IAAI,CAAC,OAAO,CAAC,YAAY;oBAC3B,CAAC,CAAC,yBAAyB,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,KAAK,SAAS,4EAA4E,CAAC;YACrL,CAAC;YAED,IAAI,cAAc,KAAK,OAAO,EAAE,CAAC;gBAC/B,OAAO,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,mCAAmC,CAAC;YACxE,CAAC;YAED,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC;QACjC,CAAC,CAAC;QAEF,OAAO,IAAI,CAAA,QAAQ,YAAY,EAAE,QAAQ,CAAC;IAC5C,CAAC;CACF;AA5CW;IADT,OAAO,CAAC,EAAE,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;4DACX;AAGrC;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC;iDACrB","sourcesContent":["import { consume } from '@lit/context';\nimport { html, LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\n\nimport { computedContext } from '@qti-components/base';\n\nimport type { View } from '@qti-components/base';\nimport type { OutcomeVariable } from '@qti-components/base';\nimport type { ComputedContext } from '@qti-components/base';\n\nexport class TestScoringFeedback extends LitElement {\n @consume({ context: computedContext, subscribe: true })\n protected computedContext?: ComputedContext;\n\n @property({ type: String, attribute: 'view' })\n public view: View = null;\n\n override render() {\n const activeItem = this.computedContext?.testParts\n .flatMap(testPart => testPart.sections.flatMap(section => section.items))\n .find(item => item.active);\n\n if (!activeItem || !activeItem.variables) return html``;\n\n if ((activeItem as any)['category'] === 'dep-informational') return html`<div>${this.dataset.informational}</div>`;\n\n const scoreOutcome = activeItem?.variables.find(vr => vr.identifier == 'SCORE') as OutcomeVariable;\n\n const score = parseFloat(scoreOutcome?.value as string);\n const externalScored = (activeItem as any)['externalScored'];\n\n const feedbackText = () => {\n // No (valid) answer: completionStatus is QTI's, set by response processing, not \"answered\".\n if (activeItem.valid === false || activeItem.isDefaultResponse) {\n return this.dataset.textNoResponse;\n }\n\n if (!externalScored && score !== undefined && !Number.isNaN(score)) {\n return score > 0 ? this.dataset.textCorrect : this.dataset.textIncorrect;\n }\n\n if (externalScored === 'externalMachine') {\n return Number.isNaN(score) || score === undefined\n ? this.dataset.scoreUnknown\n : `We hebben je antwoord ${score === 0 ? 'geen punten' : score == 1 ? 'één punt' : `${score} punten`} gegeven. Je kunt je score zelf aanpassen als je denkt dat dat niet klopt.`;\n }\n\n if (externalScored === 'human') {\n return Number.isNaN(score) ? '' : 'Deze score heb je zelf toegekend.';\n }\n\n return this.dataset.inProgress;\n };\n\n return html`<div>${feedbackText()}</div>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'test-scoring-feedback': TestScoringFeedback;\n }\n}\n"]}
@@ -4,30 +4,12 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
4
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
- import { css, html, LitElement } from 'lit';
7
+ import { LitElement } from 'lit';
8
8
  import { property } from 'lit/decorators.js';
9
9
  import * as styles from '../styles';
10
10
  import { dispatchPublic } from '../../public-events';
11
11
  export class TestSectionLink extends LitElement {
12
- static { this.styles = css `
13
- :host {
14
- ${styles.btn};
15
- }
16
- @media (hover: hover) and (pointer: fine) {
17
- :host(:hover:not([disabled])) {
18
- ${styles.btnInteractive};
19
- }
20
- }
21
- :host(:active:not([disabled])) {
22
- ${styles.btnActive};
23
- }
24
- :host(:focus-visible) {
25
- ${styles.focusRing};
26
- }
27
- :host([disabled]) {
28
- ${styles.dis};
29
- }
30
- `; }
12
+ static { this.styles = styles.button; }
31
13
  #requestItem(identifier) {
32
14
  dispatchPublic(this, 'cito-test-navigate', { type: 'section', id: identifier });
33
15
  }
@@ -37,7 +19,7 @@ export class TestSectionLink extends LitElement {
37
19
  this.addEventListener('click', () => this.#requestItem(this.sectionId));
38
20
  }
39
21
  render() {
40
- return html ` <slot></slot> `;
22
+ return styles.control;
41
23
  }
42
24
  }
43
25
  __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"test-section-link.js","sourceRoot":"","sources":["../../../src/components/test-section-link/test-section-link.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,KAAK,MAAM,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,MAAM,OAAO,eAAgB,SAAQ,UAAU;aAC7B,WAAM,GAAG,GAAG,CAAA;;QAEtB,MAAM,CAAC,GAAG;;;;UAIR,MAAM,CAAC,cAAc;;;;QAIvB,MAAM,CAAC,SAAS;;;QAGhB,MAAM,CAAC,SAAS;;;QAGhB,MAAM,CAAC,GAAG;;GAEf,AAlBqB,CAkBpB;IAKF,YAAY,CAAC,UAAkB;QAC7B,cAAc,CAAC,IAAI,EAAE,oBAAoB,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC;IAClF,CAAC;IAED;QACE,KAAK,EAAE,CAAC;QAPF,cAAS,GAAW,IAAI,CAAC;QAQ/B,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IAC1E,CAAC;IAEQ,MAAM;QACb,OAAO,IAAI,CAAA,iBAAiB,CAAC;IAC/B,CAAC;;AAbO;IADP,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;kDACnB","sourcesContent":["import { css, html, LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\n\nimport * as styles from '../styles';\nimport { dispatchPublic } from '../../public-events';\n\nexport class TestSectionLink extends LitElement {\n static override styles = css`\n :host {\n ${styles.btn};\n }\n @media (hover: hover) and (pointer: fine) {\n :host(:hover:not([disabled])) {\n ${styles.btnInteractive};\n }\n }\n :host(:active:not([disabled])) {\n ${styles.btnActive};\n }\n :host(:focus-visible) {\n ${styles.focusRing};\n }\n :host([disabled]) {\n ${styles.dis};\n }\n `;\n\n @property({ type: String, attribute: 'section-id' })\n private sectionId: string = null;\n\n #requestItem(identifier: string) {\n dispatchPublic(this, 'cito-test-navigate', { type: 'section', id: identifier });\n }\n\n constructor() {\n super();\n this.addEventListener('click', () => this.#requestItem(this.sectionId));\n }\n\n override render() {\n return html` <slot></slot> `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'test-section-link': TestSectionLink;\n }\n}\n"]}
1
+ {"version":3,"file":"test-section-link.js","sourceRoot":"","sources":["../../../src/components/test-section-link/test-section-link.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,KAAK,MAAM,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,MAAM,OAAO,eAAgB,SAAQ,UAAU;aAC7B,WAAM,GAAG,MAAM,CAAC,MAAM,AAAhB,CAAiB;IAKvC,YAAY,CAAC,UAAkB;QAC7B,cAAc,CAAC,IAAI,EAAE,oBAAoB,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC;IAClF,CAAC;IAED;QACE,KAAK,EAAE,CAAC;QAPF,cAAS,GAAW,IAAI,CAAC;QAQ/B,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IAC1E,CAAC;IAEQ,MAAM;QACb,OAAO,MAAM,CAAC,OAAO,CAAC;IACxB,CAAC;;AAbO;IADP,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;kDACnB","sourcesContent":["import { LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\n\nimport * as styles from '../styles';\nimport { dispatchPublic } from '../../public-events';\n\nexport class TestSectionLink extends LitElement {\n static override styles = styles.button;\n\n @property({ type: String, attribute: 'section-id' })\n private sectionId: string = null;\n\n #requestItem(identifier: string) {\n dispatchPublic(this, 'cito-test-navigate', { type: 'section', id: identifier });\n }\n\n constructor() {\n super();\n this.addEventListener('click', () => this.#requestItem(this.sectionId));\n }\n\n override render() {\n return styles.control;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'test-section-link': TestSectionLink;\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { css, html, LitElement } from 'lit';
1
+ import { LitElement } from 'lit';
2
2
  import * as styles from '../styles';
3
3
  import { dispatchPublic } from '../../public-events';
4
4
  /**
@@ -7,31 +7,13 @@ import { dispatchPublic } from '../../public-events';
7
7
  * The host decides where it sits, for example on the last item or in a review view.
8
8
  */
9
9
  export class TestSubmit extends LitElement {
10
- static { this.styles = css `
11
- :host {
12
- ${styles.btn};
13
- }
14
- @media (hover: hover) and (pointer: fine) {
15
- :host(:hover:not([disabled])) {
16
- ${styles.btnInteractive};
17
- }
18
- }
19
- :host(:active:not([disabled])) {
20
- ${styles.btnActive};
21
- }
22
- :host(:focus-visible) {
23
- ${styles.focusRing};
24
- }
25
- :host([disabled]) {
26
- ${styles.dis};
27
- }
28
- `; }
10
+ static { this.styles = styles.button; }
29
11
  constructor() {
30
12
  super();
31
13
  this.addEventListener('click', () => dispatchPublic(this, 'cito-test-submit', {}));
32
14
  }
33
15
  render() {
34
- return html ` <slot></slot> `;
16
+ return styles.control;
35
17
  }
36
18
  }
37
19
  //# sourceMappingURL=test-submit.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"test-submit.js","sourceRoot":"","sources":["../../../src/components/test-submit/test-submit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAE5C,OAAO,KAAK,MAAM,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD;;;;GAIG;AACH,MAAM,OAAO,UAAW,SAAQ,UAAU;aACxB,WAAM,GAAG,GAAG,CAAA;;QAEtB,MAAM,CAAC,GAAG;;;;UAIR,MAAM,CAAC,cAAc;;;;QAIvB,MAAM,CAAC,SAAS;;;QAGhB,MAAM,CAAC,SAAS;;;QAGhB,MAAM,CAAC,GAAG;;GAEf,CAAC;IAEF;QACE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,IAAI,EAAE,kBAAkB,EAAE,EAAE,CAAC,CAAC,CAAC;IACrF,CAAC;IAEQ,MAAM;QACb,OAAO,IAAI,CAAA,iBAAiB,CAAC;IAC/B,CAAC","sourcesContent":["import { css, html, LitElement } from 'lit';\n\nimport * as styles from '../styles';\nimport { dispatchPublic } from '../../public-events';\n\n/**\n * Scores the test: on click the test resets its outcomes to their declared defaults, runs its\n * outcome processing and dispatches `cito-test-submitted`, after which the host reads the outcomes.\n * The host decides where it sits, for example on the last item or in a review view.\n */\nexport class TestSubmit extends LitElement {\n static override styles = css`\n :host {\n ${styles.btn};\n }\n @media (hover: hover) and (pointer: fine) {\n :host(:hover:not([disabled])) {\n ${styles.btnInteractive};\n }\n }\n :host(:active:not([disabled])) {\n ${styles.btnActive};\n }\n :host(:focus-visible) {\n ${styles.focusRing};\n }\n :host([disabled]) {\n ${styles.dis};\n }\n `;\n\n constructor() {\n super();\n this.addEventListener('click', () => dispatchPublic(this, 'cito-test-submit', {}));\n }\n\n override render() {\n return html` <slot></slot> `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'test-submit': TestSubmit;\n }\n}\n"]}
1
+ {"version":3,"file":"test-submit.js","sourceRoot":"","sources":["../../../src/components/test-submit/test-submit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAEjC,OAAO,KAAK,MAAM,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD;;;;GAIG;AACH,MAAM,OAAO,UAAW,SAAQ,UAAU;aACxB,WAAM,GAAG,MAAM,CAAC,MAAM,CAAC;IAEvC;QACE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,IAAI,EAAE,kBAAkB,EAAE,EAAE,CAAC,CAAC,CAAC;IACrF,CAAC;IAEQ,MAAM;QACb,OAAO,MAAM,CAAC,OAAO,CAAC;IACxB,CAAC","sourcesContent":["import { LitElement } from 'lit';\n\nimport * as styles from '../styles';\nimport { dispatchPublic } from '../../public-events';\n\n/**\n * Scores the test: on click the test resets its outcomes to their declared defaults, runs its\n * outcome processing and dispatches `cito-test-submitted`, after which the host reads the outcomes.\n * The host decides where it sits, for example on the last item or in a review view.\n */\nexport class TestSubmit extends LitElement {\n static override styles = styles.button;\n\n constructor() {\n super();\n this.addEventListener('click', () => dispatchPublic(this, 'cito-test-submit', {}));\n }\n\n override render() {\n return styles.control;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'test-submit': TestSubmit;\n }\n}\n"]}
@@ -92,6 +92,9 @@ export declare const qtiTestElements: readonly [{
92
92
  }, {
93
93
  readonly tag: "test-print-item-variables";
94
94
  readonly ctor: typeof import("./elements").TestPrintVariables;
95
+ }, {
96
+ readonly tag: "test-print-state";
97
+ readonly ctor: typeof import("./elements").TestPrintState;
95
98
  }, {
96
99
  readonly tag: "test-scoring-buttons";
97
100
  readonly ctor: typeof import("./elements").TestScoringButtons;
@@ -2,6 +2,7 @@ import { TestBookmark } from '../components/test-bookmark/test-bookmark';
2
2
  import { TestCheckItem } from '../components/test-check-item/test-check-item';
3
3
  import { TestPrintContext } from '../components/test-print-context/test-print-context';
4
4
  import { TestPrintVariables } from '../components/test-print-item-variables/test-print-item-variables';
5
+ import { TestPrintState } from '../components/test-print-state/test-print-state';
5
6
  import { TestScoringButtons } from '../components/test-scoring-buttons/test-scoring-buttons';
6
7
  import { TestScoringFeedback } from '../components/test-scoring-feedback/test-scoring-feedback';
7
8
  import { TestStamp } from '../components/test-stamp/test-stamp';
@@ -10,7 +11,7 @@ import { TestView } from '../components/test-view-toggle/test-view';
10
11
  import { TestViewToggle } from '../components/test-view-toggle/test-view-toggle';
11
12
  export * from '../tts/elements';
12
13
  export { bookmarkedItems } from '../components/test-bookmark/test-bookmark';
13
- export { TestCheckItem, TestBookmark, TestPrintContext, TestPrintVariables, TestScoringButtons, TestScoringFeedback, TestStamp, TestSubmit, TestView, TestViewToggle };
14
+ export { TestCheckItem, TestBookmark, TestPrintContext, TestPrintVariables, TestPrintState, TestScoringButtons, TestScoringFeedback, TestStamp, TestSubmit, TestView, TestViewToggle };
14
15
  /**
15
16
  * Every test plugin's elements in one list. `qti-test` registers them with the rest of its
16
17
  * elements, and a scoped registry can use the list directly. Defines nothing.
@@ -30,6 +31,9 @@ export declare const pluginElements: readonly [{
30
31
  }, {
31
32
  readonly tag: "test-print-item-variables";
32
33
  readonly ctor: typeof TestPrintVariables;
34
+ }, {
35
+ readonly tag: "test-print-state";
36
+ readonly ctor: typeof TestPrintState;
33
37
  }, {
34
38
  readonly tag: "test-scoring-buttons";
35
39
  readonly ctor: typeof TestScoringButtons;
@@ -2,6 +2,7 @@ import { TestBookmark } from '../components/test-bookmark/test-bookmark';
2
2
  import { TestCheckItem } from '../components/test-check-item/test-check-item';
3
3
  import { TestPrintContext } from '../components/test-print-context/test-print-context';
4
4
  import { TestPrintVariables } from '../components/test-print-item-variables/test-print-item-variables';
5
+ import { TestPrintState } from '../components/test-print-state/test-print-state';
5
6
  import { TestScoringButtons } from '../components/test-scoring-buttons/test-scoring-buttons';
6
7
  import { TestScoringFeedback } from '../components/test-scoring-feedback/test-scoring-feedback';
7
8
  import { TestStamp } from '../components/test-stamp/test-stamp';
@@ -11,7 +12,7 @@ import { TestViewToggle } from '../components/test-view-toggle/test-view-toggle'
11
12
  import { ttsElements } from '../tts/elements';
12
13
  export * from '../tts/elements';
13
14
  export { bookmarkedItems } from '../components/test-bookmark/test-bookmark';
14
- export { TestCheckItem, TestBookmark, TestPrintContext, TestPrintVariables, TestScoringButtons, TestScoringFeedback, TestStamp, TestSubmit, TestView, TestViewToggle };
15
+ export { TestCheckItem, TestBookmark, TestPrintContext, TestPrintVariables, TestPrintState, TestScoringButtons, TestScoringFeedback, TestStamp, TestSubmit, TestView, TestViewToggle };
15
16
  /**
16
17
  * Every test plugin's elements in one list. `qti-test` registers them with the rest of its
17
18
  * elements, and a scoped registry can use the list directly. Defines nothing.
@@ -24,6 +25,7 @@ export const pluginElements = [
24
25
  { tag: 'test-bookmark', ctor: TestBookmark },
25
26
  { tag: 'test-print-context', ctor: TestPrintContext },
26
27
  { tag: 'test-print-item-variables', ctor: TestPrintVariables },
28
+ { tag: 'test-print-state', ctor: TestPrintState },
27
29
  { tag: 'test-scoring-buttons', ctor: TestScoringButtons },
28
30
  { tag: 'test-scoring-feedback', ctor: TestScoringFeedback },
29
31
  { tag: 'test-stamp', ctor: TestStamp },
@@ -1 +1 @@
1
- {"version":3,"file":"elements.js","sourceRoot":"","sources":["../../src/plugins/elements.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA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E,IAAI,EAAE,SAAS,EAAE;IACtC,EAAE,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE,UAAU,EAAE;IACxC,EAAE,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE;IACpC,EAAE,GAAG,EAAE,kBAAkB,EAAE,IAAI,EAAE,cAAc,EAAE;IACjD,GAAG,WAAW;CACN,CAAC","sourcesContent":["import { TestBookmark } from '../components/test-bookmark/test-bookmark';\nimport { TestCheckItem } from '../components/test-check-item/test-check-item';\nimport { TestPrintContext } from '../components/test-print-context/test-print-context';\nimport { TestPrintVariables } from '../components/test-print-item-variables/test-print-item-variables';\nimport { TestScoringButtons } from '../components/test-scoring-buttons/test-scoring-buttons';\nimport { TestScoringFeedback } from '../components/test-scoring-feedback/test-scoring-feedback';\nimport { TestStamp } from '../components/test-stamp/test-stamp';\nimport { TestSubmit } from '../components/test-submit/test-submit';\nimport { TestView } from '../components/test-view-toggle/test-view';\nimport { TestViewToggle } from '../components/test-view-toggle/test-view-toggle';\nimport { ttsElements } from '../tts/elements';\n\nexport * from '../tts/elements';\n\nexport { bookmarkedItems } from '../components/test-bookmark/test-bookmark';\n\nexport {\n TestCheckItem,\n TestBookmark,\n TestPrintContext,\n TestPrintVariables,\n TestScoringButtons,\n TestScoringFeedback,\n TestStamp,\n TestSubmit,\n TestView,\n TestViewToggle\n};\n\n/**\n * Every test plugin's elements in one list. `qti-test` registers them with the rest of its\n * elements, and a scoped registry can use the list directly. Defines nothing.\n *\n * A plugin is the set of files listed for it in `plugin-boundary.spec.ts` (`PLUGINS`); this file is\n * the one place that names them all.\n */\nexport const pluginElements = [\n { tag: 'test-check-item', ctor: TestCheckItem },\n { tag: 'test-bookmark', ctor: TestBookmark },\n { tag: 'test-print-context', ctor: TestPrintContext },\n { tag: 'test-print-item-variables', ctor: TestPrintVariables },\n { tag: 'test-scoring-buttons', ctor: TestScoringButtons },\n { tag: 'test-scoring-feedback', ctor: TestScoringFeedback },\n { tag: 'test-stamp', ctor: TestStamp },\n { tag: 'test-submit', ctor: TestSubmit },\n { tag: 'test-view', ctor: TestView },\n { tag: 'test-view-toggle', ctor: TestViewToggle },\n ...ttsElements\n] as const;\n"]}
1
+ {"version":3,"file":"elements.js","sourceRoot":"","sources":["../../src/plugins/elements.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,+CAA+C,CAAC;AAC9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,qDAAqD,CAAC;AACvF,OAAO,EAAE,kBAAkB,EAAE,MAAM,mEAAmE,CAAC;AACvG,OAAO,EAAE,cAAc,EAAE,MAAM,iDAAiD,CAAC;AACjF,OAAO,EAAE,kBAAkB,EAAE,MAAM,yDAAyD,CAAC;AAC7F,OAAO,EAAE,mBAAmB,EAAE,MAAM,2DAA2D,CAAC;AAChG,OAAO,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,0CAA0C,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,iDAAiD,CAAC;AACjF,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,cAAc,iBAAiB,CAAC;AAEhC,OAAO,EAAE,eAAe,EAAE,MAAM,2CAA2C,CAAC;AAE5E,OAAO,EACL,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACnB,SAAS,EACT,UAAU,EACV,QAAQ,EACR,cAAc,EACf,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,EAAE,GAAG,EAAE,iBAAiB,EAAE,IAAI,EAAE,aAAa,EAAE;IAC/C,EAAE,GAAG,EAAE,eAAe,EAAE,IAAI,EAAE,YAAY,EAAE;IAC5C,EAAE,GAAG,EAAE,oBAAoB,EAAE,IAAI,EAAE,gBAAgB,EAAE;IACrD,EAAE,GAAG,EAAE,2BAA2B,EAAE,IAAI,EAAE,kBAAkB,EAAE;IAC9D,EAAE,GAAG,EAAE,kBAAkB,EAAE,IAAI,EAAE,cAAc,EAAE;IACjD,EAAE,GAAG,EAAE,sBAAsB,EAAE,IAAI,EAAE,kBAAkB,EAAE;IACzD,EAAE,GAAG,EAAE,uBAAuB,EAAE,IAAI,EAAE,mBAAmB,EAAE;IAC3D,EAAE,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,SAAS,EAAE;IACtC,EAAE,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE,UAAU,EAAE;IACxC,EAAE,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE;IACpC,EAAE,GAAG,EAAE,kBAAkB,EAAE,IAAI,EAAE,cAAc,EAAE;IACjD,GAAG,WAAW;CACN,CAAC","sourcesContent":["import { TestBookmark } from '../components/test-bookmark/test-bookmark';\nimport { TestCheckItem } from '../components/test-check-item/test-check-item';\nimport { TestPrintContext } from '../components/test-print-context/test-print-context';\nimport { TestPrintVariables } from '../components/test-print-item-variables/test-print-item-variables';\nimport { TestPrintState } from '../components/test-print-state/test-print-state';\nimport { TestScoringButtons } from '../components/test-scoring-buttons/test-scoring-buttons';\nimport { TestScoringFeedback } from '../components/test-scoring-feedback/test-scoring-feedback';\nimport { TestStamp } from '../components/test-stamp/test-stamp';\nimport { TestSubmit } from '../components/test-submit/test-submit';\nimport { TestView } from '../components/test-view-toggle/test-view';\nimport { TestViewToggle } from '../components/test-view-toggle/test-view-toggle';\nimport { ttsElements } from '../tts/elements';\n\nexport * from '../tts/elements';\n\nexport { bookmarkedItems } from '../components/test-bookmark/test-bookmark';\n\nexport {\n TestCheckItem,\n TestBookmark,\n TestPrintContext,\n TestPrintVariables,\n TestPrintState,\n TestScoringButtons,\n TestScoringFeedback,\n TestStamp,\n TestSubmit,\n TestView,\n TestViewToggle\n};\n\n/**\n * Every test plugin's elements in one list. `qti-test` registers them with the rest of its\n * elements, and a scoped registry can use the list directly. Defines nothing.\n *\n * A plugin is the set of files listed for it in `plugin-boundary.spec.ts` (`PLUGINS`); this file is\n * the one place that names them all.\n */\nexport const pluginElements = [\n { tag: 'test-check-item', ctor: TestCheckItem },\n { tag: 'test-bookmark', ctor: TestBookmark },\n { tag: 'test-print-context', ctor: TestPrintContext },\n { tag: 'test-print-item-variables', ctor: TestPrintVariables },\n { tag: 'test-print-state', ctor: TestPrintState },\n { tag: 'test-scoring-buttons', ctor: TestScoringButtons },\n { tag: 'test-scoring-feedback', ctor: TestScoringFeedback },\n { tag: 'test-stamp', ctor: TestStamp },\n { tag: 'test-submit', ctor: TestSubmit },\n { tag: 'test-view', ctor: TestView },\n { tag: 'test-view-toggle', ctor: TestViewToggle },\n ...ttsElements\n] as const;\n"]}
@@ -23,7 +23,13 @@ export interface NavigationFailure {
23
23
  }
24
24
  export interface PublicEventMap {
25
25
  'cito-test-navigate': CustomEvent<NavigationTarget>;
26
- 'cito-test-end-attempt': CustomEvent<unknown>;
26
+ /**
27
+ * Ends an attempt: processes the response of the item-ref `itemId`, or, without it, of the item on
28
+ * screen. `test-end-attempt` sends the `itemId` of the item it is stamped into or names.
29
+ */
30
+ 'cito-test-end-attempt': CustomEvent<{
31
+ itemId?: string;
32
+ }>;
27
33
  /** Scores the test: resets its outcomes to their defaults, runs outcome processing, then `cito-test-submitted`. */
28
34
  'cito-test-submit': CustomEvent<Record<string, never>>;
29
35
  'cito-test-update-outcome': CustomEvent<{
@@ -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;AAyD1F,MAAM,CAAC,MAAM,aAAa,GAAoD;IAC5E,oBAAoB,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAA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IAClE,uBAAuB,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,EAAE;IAChE,yBAAyB,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,mCAAmC,EAAE;CACpH,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 * `cito-`; 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 name this event had before it became public. One helper (`dispatchPublic`,\n * `listenPublic`) sends or handles both names until the next major, then the field goes.\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 'cito-test-navigate': CustomEvent<NavigationTarget>;\n 'cito-test-end-attempt': CustomEvent<unknown>;\n /** Scores the test: resets its outcomes to their defaults, runs outcome processing, then `cito-test-submitted`. */\n 'cito-test-submit': CustomEvent<Record<string, never>>;\n 'cito-test-update-outcome': CustomEvent<{\n assessmentItemRefId: string;\n outcomeVariableId: string;\n value: number | string;\n }>;\n 'cito-test-switch-view': CustomEvent<View>;\n /** `value` is JSON; `null` or `undefined` removes the plugin's entry. */\n 'cito-test-update-plugin-state': CustomEvent<{ plugin: string; value: unknown }>;\n /** Outcome processing ran after a submit: read the test outcomes now. */\n 'cito-test-submitted': CustomEvent<Record<string, never>>;\n 'cito-test-navigated': CustomEvent<NavigationTarget>;\n 'cito-test-navigation-started': CustomEvent<NavigationTarget>;\n 'cito-test-navigation-failed': CustomEvent<NavigationFailure>;\n 'cito-test-rendered': CustomEvent<{ identifier: string; element: Element }[]>;\n // `cito-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 'cito-test-state-changed': CustomEvent<QtiTestState>;\n 'cito-test-items-skipped': CustomEvent<{ ids: string[] }>;\n 'cito-test-end-reached': CustomEvent<Record<string, never>>;\n 'cito-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 'cito-test-navigate': { kind: 'request', scope: 'test', deprecated: 'qti-request-navigation' },\n 'cito-test-end-attempt': { kind: 'request', scope: 'test', deprecated: 'test-end-attempt' },\n 'cito-test-submit': { kind: 'request', scope: 'test' },\n 'cito-test-update-outcome': { kind: 'request', scope: 'test', deprecated: 'test-update-outcome-variable' },\n 'cito-test-update-plugin-state': { kind: 'request', scope: 'test' },\n 'cito-test-switch-view': { kind: 'request', scope: 'test', deprecated: 'on-test-switch-view' },\n 'cito-test-submitted': { kind: 'notification', scope: 'test' },\n 'cito-test-navigated': { kind: 'notification', scope: 'test' },\n 'cito-test-navigation-started': {\n kind: 'notification',\n scope: 'test',\n deprecated: 'qti-navigation-loading-started'\n },\n 'cito-test-navigation-failed': { kind: 'notification', scope: 'test', deprecated: 'qti-navigation-error' },\n 'cito-test-rendered': { kind: 'notification', scope: 'test', deprecated: 'qti-test-loaded' },\n 'cito-test-loaded': { kind: 'notification', scope: 'test', deprecated: 'qti-assessment-test-connected' },\n 'cito-test-state-changed': { kind: 'notification', scope: 'test', deprecated: 'qti-state-changed' },\n 'cito-test-items-skipped': { kind: 'notification', scope: 'test' },\n 'cito-test-end-reached': { kind: 'notification', scope: 'test' },\n 'cito-item-ref-connected': { kind: 'notification', scope: 'item', deprecated: 'qti-assessment-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"]}
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;AA6D1F,MAAM,CAAC,MAAM,aAAa,GAAoD;IAC5E,oBAAoB,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,wBAAwB,EAAE;IAC9F,uBAAuB,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,kBAAkB,EAAE;IAC3F,kBAAkB,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE;IACtD,0BAA0B,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,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E,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 * `cito-`; 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 name this event had before it became public. One helper (`dispatchPublic`,\n * `listenPublic`) sends or handles both names until the next major, then the field goes.\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 'cito-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 'cito-test-end-attempt': CustomEvent<{ itemId?: string }>;\n /** Scores the test: resets its outcomes to their defaults, runs outcome processing, then `cito-test-submitted`. */\n 'cito-test-submit': CustomEvent<Record<string, never>>;\n 'cito-test-update-outcome': CustomEvent<{\n assessmentItemRefId: string;\n outcomeVariableId: string;\n value: number | string;\n }>;\n 'cito-test-switch-view': CustomEvent<View>;\n /** `value` is JSON; `null` or `undefined` removes the plugin's entry. */\n 'cito-test-update-plugin-state': CustomEvent<{ plugin: string; value: unknown }>;\n /** Outcome processing ran after a submit: read the test outcomes now. */\n 'cito-test-submitted': CustomEvent<Record<string, never>>;\n 'cito-test-navigated': CustomEvent<NavigationTarget>;\n 'cito-test-navigation-started': CustomEvent<NavigationTarget>;\n 'cito-test-navigation-failed': CustomEvent<NavigationFailure>;\n 'cito-test-rendered': CustomEvent<{ identifier: string; element: Element }[]>;\n // `cito-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 'cito-test-state-changed': CustomEvent<QtiTestState>;\n 'cito-test-items-skipped': CustomEvent<{ ids: string[] }>;\n 'cito-test-end-reached': CustomEvent<Record<string, never>>;\n 'cito-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 'cito-test-navigate': { kind: 'request', scope: 'test', deprecated: 'qti-request-navigation' },\n 'cito-test-end-attempt': { kind: 'request', scope: 'test', deprecated: 'test-end-attempt' },\n 'cito-test-submit': { kind: 'request', scope: 'test' },\n 'cito-test-update-outcome': { kind: 'request', scope: 'test', deprecated: 'test-update-outcome-variable' },\n 'cito-test-update-plugin-state': { kind: 'request', scope: 'test' },\n 'cito-test-switch-view': { kind: 'request', scope: 'test', deprecated: 'on-test-switch-view' },\n 'cito-test-submitted': { kind: 'notification', scope: 'test' },\n 'cito-test-navigated': { kind: 'notification', scope: 'test' },\n 'cito-test-navigation-started': {\n kind: 'notification',\n scope: 'test',\n deprecated: 'qti-navigation-loading-started'\n },\n 'cito-test-navigation-failed': { kind: 'notification', scope: 'test', deprecated: 'qti-navigation-error' },\n 'cito-test-rendered': { kind: 'notification', scope: 'test', deprecated: 'qti-test-loaded' },\n 'cito-test-loaded': { kind: 'notification', scope: 'test', deprecated: 'qti-assessment-test-connected' },\n 'cito-test-state-changed': { kind: 'notification', scope: 'test', deprecated: 'qti-state-changed' },\n 'cito-test-items-skipped': { kind: 'notification', scope: 'test' },\n 'cito-test-end-reached': { kind: 'notification', scope: 'test' },\n 'cito-item-ref-connected': { kind: 'notification', scope: 'item', deprecated: 'qti-assessment-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"]}
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@qti-components/test",
3
3
  "description": "QTI test utilities",
4
- "version": "2.0.0-next.10",
4
+ "version": "2.0.0-next.12",
5
5
  "author": "",
6
6
  "dependencies": {
7
7
  "@heximal/templates": "^0.1.5",
8
- "@qti-components/base": "^2.5.0-next.2",
9
- "@qti-components/elements": "^1.10.0-next.3",
10
- "@qti-components/interactions": "^1.10.5-next.4",
11
- "@qti-components/processing": "^1.6.1-next.2",
12
- "@qti-components/theme": "^2.3.0-next.2",
8
+ "@qti-components/base": "^3.0.0-next.4",
9
+ "@qti-components/elements": "^2.0.0-next.5",
10
+ "@qti-components/interactions": "^1.10.5-next.6",
11
+ "@qti-components/processing": "^1.6.1-next.4",
12
+ "@qti-components/theme": "^2.3.0-next.4",
13
13
  "@qti-components/transformers": "^1.7.3",
14
14
  "@qti-components/utilities": "^1.3.3"
15
15
  },