@pie-players/pie-tool-answer-eliminator 1.0.0-beta.7 → 1.0.0-beta.9

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 CHANGED
@@ -82,7 +82,7 @@ For a custom layout inside the toolkit. The tool detects choices under the item
82
82
 
83
83
  ## Props/Attributes
84
84
 
85
- `elementStateKeys` is a JS property only; the others also take the attribute shown.
85
+ `elementStateKeys` and `elementIds` are JS properties only; the others also take the attribute shown.
86
86
 
87
87
  | Property | Attribute | Type | Default | Description |
88
88
  |----------|-----------|------|---------|-------------|
@@ -91,6 +91,7 @@ For a custom layout inside the toolkit. The tool detects choices under the item
91
91
  | `strategy` | `strategy` | `'strikethrough' \| 'mask'` | `'strikethrough'` | Elimination styling; any other value uses `strikethrough` |
92
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
+ | `elementIds` | | `string[]` | unset | Model ids of the PIE elements whose choices take a toggle; unset, every element's do. A choice belongs to an element when that element or one of its ancestors up to the item has a listed id. The toolbar sets it from the host's element list |
94
95
 
95
96
  ## Global Element ID Format
96
97
 
@@ -223,6 +224,22 @@ The outermost declaring element under the item owns its subtree: an element comp
223
224
 
224
225
  Elements that declare nothing fall back to the multiple-choice and EBSR markup this package reads (`.corespring-checkbox` and `.corespring-radio-button` choices, and the `ebsr-multiple-choice` parts with ids `a` and `b`). That fallback serves legacy pie-elements and pie-elements-ng releases from before elements declared their supports, and never runs inside a declaring element.
225
226
 
227
+ ### Host element list
228
+
229
+ A host limits the eliminator to the elements whose support it has vetted, by package name, in the tool's provider entry:
230
+
231
+ ```typescript
232
+ new ToolkitCoordinator({
233
+ tools: {
234
+ providers: {
235
+ answerEliminator: { elements: ['multiple-choice', 'ebsr'] },
236
+ },
237
+ },
238
+ });
239
+ ```
240
+
241
+ A name is the `<name>` of `@pie-element/<name>`, matched against the package the item's `elements` map binds a model's tag to, or, for a tag the map does not bind, against the tag with its version suffix and `pie-`/`pie-element-` prefix removed. A tag bound to a package outside `@pie-element` matches no name. A listed element must still support answer masking. The toolbar withdraws the eliminator from an item with no listed element, even under a PNP grant, and in a mixed item gives toggles only to the listed elements' choices. Omitting `elements` keeps every supporting element; an empty list allows none. A value that is not a list of names fails config validation and, under `toolConfigStrictness: "warn"` or `"off"`, allows none.
242
+
226
243
  ### 2. State Storage
227
244
 
228
245
  Eliminated choices are stored by choice ID:
@@ -257,7 +274,7 @@ Only MathJax containers are marked: natively rendered MathML keeps real text in
257
274
 
258
275
  All three treatments — the text line-through, the diagonals over an image, the line over math — are drawn in one color, `--pie-answer-eliminator-strike-color` (a registered `component-public` token, defaulting to `--pie-incorrect`), so a choice mixing prose, pictures, and math reads as a single strike and can be restyled from one place.
259
276
 
260
- For browsers without the Highlight API, each strategy falls back to a class on the choice container. Either way the eliminated choice also receives ARIA hooks (`data-pie-answer-eliminated`, plus `aria-disabled`/`aria-hidden` and an offscreen "(eliminated)" announcement) for assistive technology.
277
+ For browsers without the Highlight API, each strategy falls back to a class on the choice container. Either way the eliminated choice also receives ARIA hooks (`data-pie-answer-eliminated`, `aria-disabled`, and an offscreen "(eliminated)" announcement in the interface language) for assistive technology. The choice container is never `aria-hidden` — it hosts the strategy's toggle, which must stay reachable for screen-reader and keyboard users (WCAG 4.1.2).
261
278
 
262
279
  ### 4. Toggle Behavior
263
280
 
@@ -7,7 +7,7 @@
7
7
  "declarations": [
8
8
  {
9
9
  "kind": "class",
10
- "description": "Process-of-elimination tool for the item in its enclosing `<pie-item-scope>`: it adds a toggle beside each choice an element supplies for `answer-masking` that strikes the choice through or masks it, per `strategy`. It renders nothing of its own and is active while `visible` or `always-on` is set. Eliminations persist in the runtime context's element tool state store, under the key `elementStateKeys` gives each PIE element.",
10
+ "description": "Process-of-elimination tool for the item in its enclosing `<pie-item-scope>`: it adds a toggle beside each choice an element supplies for `answer-masking` that strikes the choice through or masks it, per `strategy`. It renders nothing of its own and is active while `visible` or `always-on` is set; `elementIds` limits the toggles to those elements' choices. Eliminations persist in the runtime context's element tool state store, under the key `elementStateKeys` gives each PIE element.",
11
11
  "name": "ToolAnswerEliminator",
12
12
  "tagName": "pie-tool-answer-eliminator",
13
13
  "customElement": true,
@@ -58,6 +58,15 @@
58
58
  "default": "{}",
59
59
  "description": "Store key per PIE element, by model id (JS property only)",
60
60
  "attribute": "elementstatekeys"
61
+ },
62
+ {
63
+ "kind": "field",
64
+ "name": "elementIds",
65
+ "type": {
66
+ "text": "readonly string[]"
67
+ },
68
+ "description": "Model ids of the PIE elements whose choices take a toggle. Unset, every element's choices do.",
69
+ "attribute": "elementids"
61
70
  }
62
71
  ],
63
72
  "attributes": [
@@ -102,6 +111,14 @@
102
111
  "default": "{}",
103
112
  "description": "Store key per PIE element, by model id (JS property only)",
104
113
  "fieldName": "elementStateKeys"
114
+ },
115
+ {
116
+ "name": "elementids",
117
+ "type": {
118
+ "text": "readonly string[]"
119
+ },
120
+ "description": "Model ids of the PIE elements whose choices take a toggle. Unset, every element's choices do.",
121
+ "fieldName": "elementIds"
105
122
  }
106
123
  ],
107
124
  "cssProperties": [
@@ -10,4 +10,9 @@ export interface AnswerEliminatorProps {
10
10
  alwaysOn?: boolean;
11
11
  buttonAlignment?: 'start' | 'end' | 'inline' | 'left' | 'right';
12
12
  elementStateKeys?: ElementStateKeys;
13
+ /**
14
+ * Model ids of the PIE elements whose choices take a toggle. Unset, every
15
+ * element's choices do.
16
+ */
17
+ elementIds?: readonly string[];
13
18
  }