@pie-players/pie-tool-answer-eliminator 1.0.0-beta.5 → 1.0.0-beta.7
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 +3 -1
- package/custom-elements.json +5 -3
- package/dist/element-props.d.ts +13 -0
- package/dist/index.d.ts +9 -7
- package/dist/tool-answer-eliminator.js +885 -843
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -89,7 +89,7 @@ For a custom layout inside the toolkit. The tool detects choices under the item
|
|
|
89
89
|
| `visible` | `visible` | `boolean` | `false` | Shows the elimination buttons; the toolbar toggle sets it |
|
|
90
90
|
| `alwaysOn` | `always-on` | `boolean` | `false` | Shows the buttons regardless of `visible`, for a profile-based accommodation |
|
|
91
91
|
| `strategy` | `strategy` | `'strikethrough' \| 'mask'` | `'strikethrough'` | Elimination styling; any other value uses `strikethrough` |
|
|
92
|
-
| `buttonAlignment` | `button-alignment` | `'
|
|
92
|
+
| `buttonAlignment` | `button-alignment` | `'start' \| 'end' \| 'inline'` | `'inline'` | Toggle placement: `inline` in the flow after the choice, or `start`/`end` beside it, resolved against the choice's own direction so they mirror under right-to-left content. `left` and `right` are aliases of `start` and `end`; any other value is `inline` |
|
|
93
93
|
| `elementStateKeys` | | `Record<string, string>` | `{}` | Composite key `assessmentId:sectionId:attemptId:itemId:elementId` per PIE element, by model id, into the runtime context's element tool state store. A choice is tracked under its nearest ancestor with a listed id and persists under that key; choices outside a listed element are kept in memory only |
|
|
94
94
|
|
|
95
95
|
## Global Element ID Format
|
|
@@ -263,6 +263,8 @@ For browsers without the Highlight API, each strategy falls back to a class on t
|
|
|
263
263
|
|
|
264
264
|
Each choice gets its own elimination toggle button (class `pie-answer-eliminator-toggle`, rendered as `⊗`) appended to its `container`. Clicking the button toggles that choice through the active strategy and calls `setEliminated`. Eliminating is blocked while `isEliminable()` returns false. An active button is marked with `pie-answer-eliminator-toggle--active` and `aria-pressed="true"`; clicking again restores the choice.
|
|
265
265
|
|
|
266
|
+
The toggle's accessible name ("Toggle elimination for {choice}", with "Unlabeled choice" standing in for a choice without text) and the "(eliminated)" announcement come from the players' catalog under `tools.answerEliminator`, in the interface locale of the runtime context. Both carry that locale's `lang` and `dir` while the choice content keeps its own, and a locale change relabels them in place without dropping eliminations.
|
|
267
|
+
|
|
266
268
|
## Cleanup
|
|
267
269
|
|
|
268
270
|
The ElementToolStateStore provides cleanup methods:
|
package/custom-elements.json
CHANGED
|
@@ -43,9 +43,10 @@
|
|
|
43
43
|
"kind": "field",
|
|
44
44
|
"name": "buttonAlignment",
|
|
45
45
|
"type": {
|
|
46
|
-
"text": "'
|
|
46
|
+
"text": "'start' | 'end' | 'inline' | 'left' | 'right'"
|
|
47
47
|
},
|
|
48
|
-
"default": "'
|
|
48
|
+
"default": "'inline'",
|
|
49
|
+
"description": "Toggle placement: `inline` in the flow after the choice, or `start`/`end` beside it, mirrored under right-to-left content; `left` and `right` alias `start` and `end`.",
|
|
49
50
|
"attribute": "button-alignment"
|
|
50
51
|
},
|
|
51
52
|
{
|
|
@@ -89,7 +90,8 @@
|
|
|
89
90
|
"type": {
|
|
90
91
|
"text": "string"
|
|
91
92
|
},
|
|
92
|
-
"default": "'
|
|
93
|
+
"default": "'inline'",
|
|
94
|
+
"description": "Toggle placement: `inline` in the flow after the choice, or `start`/`end` beside it, mirrored under right-to-left content; `left` and `right` alias `start` and `end`.",
|
|
93
95
|
"fieldName": "buttonAlignment"
|
|
94
96
|
},
|
|
95
97
|
{
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Store key per PIE element, by the element's model id (which is also its DOM
|
|
3
|
+
* id). A choice persists under the key of the nearest ancestor listed here.
|
|
4
|
+
*/
|
|
5
|
+
export type ElementStateKeys = Readonly<Record<string, string>>;
|
|
6
|
+
/** Inputs shared by the component and its native element declaration. */
|
|
7
|
+
export interface AnswerEliminatorProps {
|
|
8
|
+
visible?: boolean;
|
|
9
|
+
strategy?: 'strikethrough' | 'mask';
|
|
10
|
+
alwaysOn?: boolean;
|
|
11
|
+
buttonAlignment?: 'start' | 'end' | 'inline' | 'left' | 'right';
|
|
12
|
+
elementStateKeys?: ElementStateKeys;
|
|
13
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { AnswerEliminatorProps } from './element-props.js';
|
|
2
|
+
/** Native host interface for `<pie-tool-answer-eliminator>`. Properties may be unset until it mounts. */
|
|
3
|
+
export interface PieToolAnswerEliminatorElement extends HTMLElement, AnswerEliminatorProps {
|
|
4
|
+
}
|
|
5
|
+
declare global {
|
|
6
|
+
interface HTMLElementTagNameMap {
|
|
7
|
+
"pie-tool-answer-eliminator": PieToolAnswerEliminatorElement;
|
|
8
|
+
}
|
|
9
|
+
}
|