@pie-players/pie-tool-answer-eliminator 0.3.73 → 0.3.74
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/README.md +13 -6
- package/dist/adapters/ebsr-adapter.js +4 -9
- package/dist/index.d.ts +7 -4
- package/dist/tool-answer-eliminator.js +1488 -6565
- package/package.json +11 -10
- package/dist/answer-eliminator-core.d.ts +0 -151
- package/dist/rolldown-runtime--eTHp1Qs.js +0 -20
- package/dist/sre-kwoc_SMV.js +0 -17637
- package/dist/strategies/elimination-strategy.d.ts +0 -40
- package/dist/strategies/mask-strategy.d.ts +0 -32
- package/dist/strategies/strikethrough-strategy.d.ts +0 -106
- package/dist/tool-answer-eliminator.svelte.d.ts +0 -1
package/README.md
CHANGED
|
@@ -28,20 +28,23 @@ The answer eliminator is automatically integrated when using the PIE Section Pla
|
|
|
28
28
|
<script type="module">
|
|
29
29
|
import '@pie-players/pie-section-player';
|
|
30
30
|
import { ToolkitCoordinator } from '@pie-players/pie-assessment-toolkit';
|
|
31
|
+
import { createPackagedToolRegistry } from '@pie-players/pie-default-tool-loaders';
|
|
31
32
|
|
|
33
|
+
const toolRegistry = createPackagedToolRegistry();
|
|
32
34
|
const coordinator = new ToolkitCoordinator({
|
|
33
35
|
assessmentId: 'my-assessment',
|
|
36
|
+
toolRegistry,
|
|
34
37
|
tools: {
|
|
35
|
-
|
|
38
|
+
placement: { item: ['answerEliminator'] }
|
|
36
39
|
}
|
|
37
40
|
});
|
|
38
41
|
|
|
39
42
|
const player = document.getElementById('player');
|
|
40
|
-
player.
|
|
43
|
+
player.runtime = { ...(player.runtime ?? {}), coordinator };
|
|
41
44
|
player.section = mySection;
|
|
42
45
|
</script>
|
|
43
46
|
|
|
44
|
-
<pie-section-player id="player"></pie-section-player>
|
|
47
|
+
<pie-section-player-splitpane id="player"></pie-section-player-splitpane>
|
|
45
48
|
```
|
|
46
49
|
|
|
47
50
|
The section player automatically:
|
|
@@ -83,7 +86,7 @@ The web component accepts the following properties (set via JavaScript, not HTML
|
|
|
83
86
|
| Property | Type | Required | Description |
|
|
84
87
|
|----------|------|----------|-------------|
|
|
85
88
|
| `globalElementId` | `string` | Yes | Composite key: `assessmentId:sectionId:itemId:elementId` |
|
|
86
|
-
| `elementToolStateStore` | `
|
|
89
|
+
| `elementToolStateStore` | `ElementToolStateStoreApi` | Yes | Store for element-level tool state |
|
|
87
90
|
| `scopeElement` | `HTMLElement` | No | DOM element to scope choice detection (defaults to document) |
|
|
88
91
|
|
|
89
92
|
## Global Element ID Format
|
|
@@ -157,9 +160,13 @@ The answer eliminator stores state in **ElementToolStateStore** (ephemeral, clie
|
|
|
157
160
|
To persist tool state across page refreshes:
|
|
158
161
|
|
|
159
162
|
```typescript
|
|
163
|
+
import { createPackagedToolRegistry } from '@pie-players/pie-default-tool-loaders';
|
|
164
|
+
|
|
165
|
+
const toolRegistry = createPackagedToolRegistry();
|
|
160
166
|
const coordinator = new ToolkitCoordinator({
|
|
161
167
|
assessmentId: 'my-assessment',
|
|
162
|
-
|
|
168
|
+
toolRegistry,
|
|
169
|
+
tools: { placement: { item: ['answerEliminator'] } }
|
|
163
170
|
});
|
|
164
171
|
|
|
165
172
|
// Save to localStorage on change
|
|
@@ -259,7 +266,7 @@ store.clearAll();
|
|
|
259
266
|
Full TypeScript definitions included:
|
|
260
267
|
|
|
261
268
|
```typescript
|
|
262
|
-
import type {
|
|
269
|
+
import type { ElementToolStateStoreApi } from '@pie-players/pie-assessment-toolkit';
|
|
263
270
|
|
|
264
271
|
interface AnswerEliminatorState {
|
|
265
272
|
eliminatedChoices: string[];
|
|
@@ -1,14 +1,9 @@
|
|
|
1
|
+
import { parseVersionedTagName } from "@pie-players/pie-players-shared/pie/tag-names";
|
|
1
2
|
import { MultipleChoiceAdapter } from "./multiple-choice-adapter.js";
|
|
2
3
|
const EBSR_MULTIPLE_CHOICE_TAG = "ebsr-multiple-choice";
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
return false;
|
|
7
|
-
}
|
|
8
|
-
const tagName = element.tagName.toLowerCase();
|
|
9
|
-
return (tagName === EBSR_MULTIPLE_CHOICE_TAG ||
|
|
10
|
-
tagName.startsWith(EBSR_MULTIPLE_CHOICE_VERSIONED_PREFIX));
|
|
11
|
-
};
|
|
4
|
+
const isEbsrMultipleChoiceElement = (element) => element instanceof HTMLElement &&
|
|
5
|
+
parseVersionedTagName(element.tagName.toLowerCase()).baseName ===
|
|
6
|
+
EBSR_MULTIPLE_CHOICE_TAG;
|
|
12
7
|
const findEbsrMultipleChoicePart = (root, id) => Array.from(root.querySelectorAll(`[id="${id}"]`)).find(isEbsrMultipleChoiceElement) ?? null;
|
|
13
8
|
const findClosestEbsrMultipleChoicePart = (choice) => {
|
|
14
9
|
let element = choice.parentElement;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/**
|
|
2
|
+
* pie-tool-answer-eliminator - PIE Assessment Tool
|
|
3
|
+
*
|
|
4
|
+
* Importing this package registers `<pie-tool-answer-eliminator>`. The build
|
|
5
|
+
* entry is the component, so this file is the type entry alone.
|
|
6
|
+
*/
|
|
7
|
+
export type {};
|