@pie-players/pie-tool-answer-eliminator 0.2.8 → 0.2.10
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/adapters/multiple-choice-adapter.ts +62 -14
- package/answer-eliminator-core.ts +12 -85
- package/dist/adapters/multiple-choice-adapter.d.ts +8 -0
- package/dist/adapters/multiple-choice-adapter.d.ts.map +1 -1
- package/dist/answer-eliminator-core.d.ts +3 -8
- package/dist/answer-eliminator-core.d.ts.map +1 -1
- package/dist/strategies/mask-strategy.d.ts +7 -2
- package/dist/strategies/mask-strategy.d.ts.map +1 -1
- package/dist/strategies/strikethrough-strategy.d.ts +10 -2
- package/dist/strategies/strikethrough-strategy.d.ts.map +1 -1
- package/dist/tool-answer-eliminator.js +2647 -1443
- package/dist/vite.config.d.ts.map +1 -1
- package/package.json +15 -6
- package/strategies/mask-strategy.ts +33 -42
- package/strategies/strikethrough-strategy.ts +53 -69
- package/tool-answer-eliminator.svelte +77 -104
- package/dist/tool-answer-eliminator.js.map +0 -1
|
@@ -9,6 +9,14 @@ import type { ChoiceAdapter } from "./choice-adapter.js";
|
|
|
9
9
|
export class MultipleChoiceAdapter implements ChoiceAdapter {
|
|
10
10
|
readonly elementType = "multiple-choice";
|
|
11
11
|
readonly priority = 100;
|
|
12
|
+
private static readonly CHOICE_HOOK_ATTR =
|
|
13
|
+
"data-pie-answer-eliminator-choice";
|
|
14
|
+
private static readonly LABEL_HOOK_ATTR = "data-pie-answer-eliminator-label";
|
|
15
|
+
private static readonly ROOT_HOOK_ATTR = "data-pie-answer-eliminator-root";
|
|
16
|
+
private static readonly FEEDBACK_HOOK_ATTR =
|
|
17
|
+
"data-pie-answer-eliminator-feedback-tick";
|
|
18
|
+
private static readonly CHOICE_SELECTOR =
|
|
19
|
+
`[${MultipleChoiceAdapter.CHOICE_HOOK_ATTR}="true"], .corespring-checkbox, .corespring-radio-button`;
|
|
12
20
|
|
|
13
21
|
canHandle(element: HTMLElement): boolean {
|
|
14
22
|
return (
|
|
@@ -18,22 +26,21 @@ export class MultipleChoiceAdapter implements ChoiceAdapter {
|
|
|
18
26
|
}
|
|
19
27
|
|
|
20
28
|
findChoices(root: HTMLElement): HTMLElement[] {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
root.querySelectorAll<HTMLElement>(
|
|
24
|
-
".corespring-checkbox, .corespring-radio-button",
|
|
25
|
-
),
|
|
29
|
+
root.setAttribute(MultipleChoiceAdapter.ROOT_HOOK_ATTR, "true");
|
|
30
|
+
const choices = Array.from(
|
|
31
|
+
root.querySelectorAll<HTMLElement>(MultipleChoiceAdapter.CHOICE_SELECTOR),
|
|
26
32
|
);
|
|
33
|
+
for (const choice of choices) {
|
|
34
|
+
this.annotateChoice(choice);
|
|
35
|
+
}
|
|
36
|
+
this.annotateFeedbackTicks(root);
|
|
37
|
+
return choices;
|
|
27
38
|
}
|
|
28
39
|
|
|
29
40
|
createChoiceRange(choice: HTMLElement): Range | null {
|
|
30
41
|
// Create range covering the label content
|
|
31
42
|
// Try multiple possible selectors for the label
|
|
32
|
-
const labelElement =
|
|
33
|
-
choice.querySelector(".label") ||
|
|
34
|
-
choice.querySelector("label") ||
|
|
35
|
-
choice.querySelector('[class*="label"]') ||
|
|
36
|
-
choice.querySelector("span");
|
|
43
|
+
const labelElement = this.resolveLabelElement(choice);
|
|
37
44
|
|
|
38
45
|
if (!labelElement) {
|
|
39
46
|
return null;
|
|
@@ -57,7 +64,7 @@ export class MultipleChoiceAdapter implements ChoiceAdapter {
|
|
|
57
64
|
}
|
|
58
65
|
|
|
59
66
|
getChoiceLabel(choice: HTMLElement): string {
|
|
60
|
-
const label =
|
|
67
|
+
const label = this.resolveLabelElement(choice);
|
|
61
68
|
return label?.textContent?.trim() || "Unlabeled choice";
|
|
62
69
|
}
|
|
63
70
|
|
|
@@ -75,7 +82,14 @@ export class MultipleChoiceAdapter implements ChoiceAdapter {
|
|
|
75
82
|
if ((input as HTMLInputElement).disabled) return false;
|
|
76
83
|
|
|
77
84
|
// 3. In evaluate/view mode (has feedback tick)
|
|
78
|
-
|
|
85
|
+
const root =
|
|
86
|
+
choice.closest(`[${MultipleChoiceAdapter.ROOT_HOOK_ATTR}="true"]`) ||
|
|
87
|
+
choice.closest("multiple-choice");
|
|
88
|
+
if (
|
|
89
|
+
root?.querySelector(
|
|
90
|
+
`[${MultipleChoiceAdapter.FEEDBACK_HOOK_ATTR}="true"]`,
|
|
91
|
+
)
|
|
92
|
+
)
|
|
79
93
|
return false;
|
|
80
94
|
|
|
81
95
|
return true;
|
|
@@ -88,9 +102,43 @@ export class MultipleChoiceAdapter implements ChoiceAdapter {
|
|
|
88
102
|
|
|
89
103
|
private generateFallbackId(choice: HTMLElement): string {
|
|
90
104
|
// Generate stable ID based on choice position
|
|
91
|
-
const parent =
|
|
92
|
-
|
|
105
|
+
const parent =
|
|
106
|
+
choice.closest(`[${MultipleChoiceAdapter.ROOT_HOOK_ATTR}="true"]`) ||
|
|
107
|
+
choice.closest("multiple-choice");
|
|
108
|
+
const choices =
|
|
109
|
+
parent?.querySelectorAll(
|
|
110
|
+
`[${MultipleChoiceAdapter.CHOICE_HOOK_ATTR}="true"]`,
|
|
111
|
+
) || [];
|
|
93
112
|
const index = Array.from(choices).indexOf(choice);
|
|
94
113
|
return `choice-${index}`;
|
|
95
114
|
}
|
|
115
|
+
|
|
116
|
+
private annotateChoice(choice: HTMLElement): void {
|
|
117
|
+
choice.setAttribute(MultipleChoiceAdapter.CHOICE_HOOK_ATTR, "true");
|
|
118
|
+
const label = this.resolveLabelElement(choice);
|
|
119
|
+
if (label) {
|
|
120
|
+
label.setAttribute(MultipleChoiceAdapter.LABEL_HOOK_ATTR, "true");
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
private resolveLabelElement(choice: HTMLElement): HTMLElement | null {
|
|
125
|
+
return (
|
|
126
|
+
choice.querySelector<HTMLElement>(
|
|
127
|
+
`[${MultipleChoiceAdapter.LABEL_HOOK_ATTR}="true"]`,
|
|
128
|
+
) ||
|
|
129
|
+
choice.querySelector<HTMLElement>("label") ||
|
|
130
|
+
choice.querySelector<HTMLElement>("span")
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
private annotateFeedbackTicks(root: HTMLElement): void {
|
|
135
|
+
for (const feedbackTick of root.querySelectorAll<HTMLElement>(
|
|
136
|
+
".feedback-tick",
|
|
137
|
+
)) {
|
|
138
|
+
feedbackTick.setAttribute(
|
|
139
|
+
MultipleChoiceAdapter.FEEDBACK_HOOK_ATTR,
|
|
140
|
+
"true",
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
96
144
|
}
|
|
@@ -9,11 +9,15 @@ import { StrikethroughStrategy } from "./strategies/strikethrough-strategy.js";
|
|
|
9
9
|
* Coordinates adapters, strategies, and state management
|
|
10
10
|
*/
|
|
11
11
|
export class AnswerEliminatorCore {
|
|
12
|
+
private static readonly TOGGLE_CLASS = "pie-answer-eliminator-toggle";
|
|
13
|
+
private static readonly TOGGLE_ACTIVE_CLASS =
|
|
14
|
+
"pie-answer-eliminator-toggle--active";
|
|
12
15
|
private registry: AdapterRegistry;
|
|
13
16
|
private strategy: EliminationStrategy;
|
|
14
17
|
private eliminatedChoices = new Set<string>(); // Set<choiceId> for current element
|
|
15
18
|
private choiceElements = new Map<string, HTMLElement>(); // choiceId -> element
|
|
16
19
|
private choiceButtons = new Map<string, HTMLButtonElement>(); // choiceId -> button
|
|
20
|
+
private choiceAdapters = new Map<string, ChoiceAdapter>(); // choiceId -> adapter
|
|
17
21
|
private buttonAlignment: "left" | "right" | "inline" = "right";
|
|
18
22
|
private shouldRestoreState: boolean = true; // Whether to restore eliminations from state storage
|
|
19
23
|
|
|
@@ -73,6 +77,7 @@ export class AnswerEliminatorCore {
|
|
|
73
77
|
|
|
74
78
|
// Track element
|
|
75
79
|
this.choiceElements.set(choiceId, choice);
|
|
80
|
+
this.choiceAdapters.set(choiceId, adapter);
|
|
76
81
|
|
|
77
82
|
// Create elimination toggle button
|
|
78
83
|
const button = this.createToggleButton(choice, adapter);
|
|
@@ -101,7 +106,7 @@ export class AnswerEliminatorCore {
|
|
|
101
106
|
|
|
102
107
|
const button = document.createElement("button");
|
|
103
108
|
button.type = "button";
|
|
104
|
-
button.className =
|
|
109
|
+
button.className = AnswerEliminatorCore.TOGGLE_CLASS;
|
|
105
110
|
button.setAttribute("aria-label", `Toggle elimination for ${choiceLabel}`);
|
|
106
111
|
button.setAttribute("data-choice-id", choiceId);
|
|
107
112
|
button.textContent = "⊗"; // Cross mark (use textContent instead of innerHTML for better security)
|
|
@@ -109,40 +114,6 @@ export class AnswerEliminatorCore {
|
|
|
109
114
|
// Apply positioning based on alignment configuration
|
|
110
115
|
this.applyButtonAlignment(button);
|
|
111
116
|
|
|
112
|
-
// Common button styling
|
|
113
|
-
Object.assign(button.style, {
|
|
114
|
-
width: "28px",
|
|
115
|
-
height: "28px",
|
|
116
|
-
padding: "0",
|
|
117
|
-
border: "1px solid #ccc",
|
|
118
|
-
borderRadius: "4px",
|
|
119
|
-
background: "white",
|
|
120
|
-
cursor: "pointer",
|
|
121
|
-
fontSize: "18px",
|
|
122
|
-
lineHeight: "1",
|
|
123
|
-
display: "flex",
|
|
124
|
-
alignItems: "center",
|
|
125
|
-
justifyContent: "center",
|
|
126
|
-
color: "#666",
|
|
127
|
-
transition: "all 0.2s ease",
|
|
128
|
-
zIndex: "10",
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
// Add hover effect
|
|
132
|
-
button.addEventListener("mouseenter", () => {
|
|
133
|
-
button.style.background = "#f0f0f0";
|
|
134
|
-
button.style.borderColor = "#999";
|
|
135
|
-
button.style.color = "#333";
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
button.addEventListener("mouseleave", () => {
|
|
139
|
-
if (!this.strategy.isEliminated(choiceId)) {
|
|
140
|
-
button.style.background = "white";
|
|
141
|
-
button.style.borderColor = "#ccc";
|
|
142
|
-
button.style.color = "#666";
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
|
|
146
117
|
button.addEventListener("click", (e) => {
|
|
147
118
|
e.preventDefault();
|
|
148
119
|
e.stopPropagation();
|
|
@@ -178,9 +149,6 @@ export class AnswerEliminatorCore {
|
|
|
178
149
|
|
|
179
150
|
// Save state
|
|
180
151
|
this.saveState();
|
|
181
|
-
|
|
182
|
-
// Emit state change event
|
|
183
|
-
this.emitStateChange();
|
|
184
152
|
}
|
|
185
153
|
|
|
186
154
|
/**
|
|
@@ -205,12 +173,8 @@ export class AnswerEliminatorCore {
|
|
|
205
173
|
// Update button appearance to show eliminated state
|
|
206
174
|
const button = this.choiceButtons.get(choiceId);
|
|
207
175
|
if (button) {
|
|
208
|
-
button.classList.add(
|
|
176
|
+
button.classList.add(AnswerEliminatorCore.TOGGLE_ACTIVE_CLASS);
|
|
209
177
|
button.setAttribute("aria-pressed", "true");
|
|
210
|
-
// Visual feedback: filled/highlighted when eliminated
|
|
211
|
-
button.style.background = "#ff9800";
|
|
212
|
-
button.style.borderColor = "#ff9800";
|
|
213
|
-
button.style.color = "white";
|
|
214
178
|
}
|
|
215
179
|
|
|
216
180
|
// Save to store
|
|
@@ -230,12 +194,8 @@ export class AnswerEliminatorCore {
|
|
|
230
194
|
// Reset button appearance to default state
|
|
231
195
|
const button = this.choiceButtons.get(choiceId);
|
|
232
196
|
if (button) {
|
|
233
|
-
button.classList.remove(
|
|
197
|
+
button.classList.remove(AnswerEliminatorCore.TOGGLE_ACTIVE_CLASS);
|
|
234
198
|
button.setAttribute("aria-pressed", "false");
|
|
235
|
-
// Reset to default styling
|
|
236
|
-
button.style.background = "white";
|
|
237
|
-
button.style.borderColor = "#ccc";
|
|
238
|
-
button.style.color = "#666";
|
|
239
199
|
}
|
|
240
200
|
|
|
241
201
|
// Save to store
|
|
@@ -256,7 +216,6 @@ export class AnswerEliminatorCore {
|
|
|
256
216
|
// Clear state
|
|
257
217
|
this.eliminatedChoices.clear();
|
|
258
218
|
this.saveState();
|
|
259
|
-
this.emitStateChange();
|
|
260
219
|
}
|
|
261
220
|
|
|
262
221
|
/**
|
|
@@ -315,8 +274,8 @@ export class AnswerEliminatorCore {
|
|
|
315
274
|
const choice = this.choiceElements.get(choiceId);
|
|
316
275
|
if (!choice) continue;
|
|
317
276
|
|
|
318
|
-
//
|
|
319
|
-
const adapter = this.
|
|
277
|
+
// Use the adapter captured during initialization
|
|
278
|
+
const adapter = this.choiceAdapters.get(choiceId);
|
|
320
279
|
if (!adapter) continue;
|
|
321
280
|
|
|
322
281
|
// Re-eliminate without saving (already in state)
|
|
@@ -330,12 +289,8 @@ export class AnswerEliminatorCore {
|
|
|
330
289
|
// Update button appearance to show eliminated state
|
|
331
290
|
const button = this.choiceButtons.get(choiceId);
|
|
332
291
|
if (button) {
|
|
333
|
-
button.classList.add(
|
|
292
|
+
button.classList.add(AnswerEliminatorCore.TOGGLE_ACTIVE_CLASS);
|
|
334
293
|
button.setAttribute("aria-pressed", "true");
|
|
335
|
-
// Apply eliminated styling
|
|
336
|
-
button.style.background = "#ff9800";
|
|
337
|
-
button.style.borderColor = "#ff9800";
|
|
338
|
-
button.style.color = "white";
|
|
339
294
|
}
|
|
340
295
|
}
|
|
341
296
|
}
|
|
@@ -344,22 +299,6 @@ export class AnswerEliminatorCore {
|
|
|
344
299
|
}
|
|
345
300
|
}
|
|
346
301
|
|
|
347
|
-
/**
|
|
348
|
-
* Find adapter for a choice element
|
|
349
|
-
*/
|
|
350
|
-
private findAdapterForChoice(choice: HTMLElement): ChoiceAdapter | null {
|
|
351
|
-
// Walk up to find PIE element root
|
|
352
|
-
let element: HTMLElement | null = choice;
|
|
353
|
-
|
|
354
|
-
while (element && element !== document.body) {
|
|
355
|
-
const adapter = this.registry.findAdapter(element);
|
|
356
|
-
if (adapter) return adapter;
|
|
357
|
-
element = element.parentElement;
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
return null;
|
|
361
|
-
}
|
|
362
|
-
|
|
363
302
|
/**
|
|
364
303
|
* Cleanup buttons from previous element
|
|
365
304
|
*/
|
|
@@ -370,6 +309,7 @@ export class AnswerEliminatorCore {
|
|
|
370
309
|
|
|
371
310
|
this.choiceButtons.clear();
|
|
372
311
|
this.choiceElements.clear();
|
|
312
|
+
this.choiceAdapters.clear();
|
|
373
313
|
}
|
|
374
314
|
|
|
375
315
|
/**
|
|
@@ -441,19 +381,6 @@ export class AnswerEliminatorCore {
|
|
|
441
381
|
this.strategy.clearAll();
|
|
442
382
|
}
|
|
443
383
|
|
|
444
|
-
/**
|
|
445
|
-
* Emit state change event for UI updates
|
|
446
|
-
*/
|
|
447
|
-
private emitStateChange(): void {
|
|
448
|
-
const event = new CustomEvent("answer-eliminator-state-change", {
|
|
449
|
-
detail: {
|
|
450
|
-
eliminatedCount: this.getEliminatedCount(),
|
|
451
|
-
},
|
|
452
|
-
bubbles: true,
|
|
453
|
-
});
|
|
454
|
-
document.dispatchEvent(event);
|
|
455
|
-
}
|
|
456
|
-
|
|
457
384
|
/**
|
|
458
385
|
* Destroy and cleanup
|
|
459
386
|
*/
|
|
@@ -8,6 +8,11 @@ import { ChoiceAdapter } from './choice-adapter.js';
|
|
|
8
8
|
export declare class MultipleChoiceAdapter implements ChoiceAdapter {
|
|
9
9
|
readonly elementType = "multiple-choice";
|
|
10
10
|
readonly priority = 100;
|
|
11
|
+
private static readonly CHOICE_HOOK_ATTR;
|
|
12
|
+
private static readonly LABEL_HOOK_ATTR;
|
|
13
|
+
private static readonly ROOT_HOOK_ATTR;
|
|
14
|
+
private static readonly FEEDBACK_HOOK_ATTR;
|
|
15
|
+
private static readonly CHOICE_SELECTOR;
|
|
11
16
|
canHandle(element: HTMLElement): boolean;
|
|
12
17
|
findChoices(root: HTMLElement): HTMLElement[];
|
|
13
18
|
createChoiceRange(choice: HTMLElement): Range | null;
|
|
@@ -16,5 +21,8 @@ export declare class MultipleChoiceAdapter implements ChoiceAdapter {
|
|
|
16
21
|
canEliminate(choice: HTMLElement): boolean;
|
|
17
22
|
getButtonContainer(choice: HTMLElement): HTMLElement | null;
|
|
18
23
|
private generateFallbackId;
|
|
24
|
+
private annotateChoice;
|
|
25
|
+
private resolveLabelElement;
|
|
26
|
+
private annotateFeedbackTicks;
|
|
19
27
|
}
|
|
20
28
|
//# sourceMappingURL=multiple-choice-adapter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multiple-choice-adapter.d.ts","sourceRoot":"","sources":["../../adapters/multiple-choice-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD;;;;;GAKG;AACH,qBAAa,qBAAsB,YAAW,aAAa;IAC1D,QAAQ,CAAC,WAAW,qBAAqB;IACzC,QAAQ,CAAC,QAAQ,OAAO;
|
|
1
|
+
{"version":3,"file":"multiple-choice-adapter.d.ts","sourceRoot":"","sources":["../../adapters/multiple-choice-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD;;;;;GAKG;AACH,qBAAa,qBAAsB,YAAW,aAAa;IAC1D,QAAQ,CAAC,WAAW,qBAAqB;IACzC,QAAQ,CAAC,QAAQ,OAAO;IACxB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CACH;IACrC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAsC;IAC7E,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAqC;IAC3E,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CACE;IAC5C,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,CAC+D;IAEtG,SAAS,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO;IAOxC,WAAW,CAAC,IAAI,EAAE,WAAW,GAAG,WAAW,EAAE;IAY7C,iBAAiB,CAAC,MAAM,EAAE,WAAW,GAAG,KAAK,GAAG,IAAI;IAcpD,WAAW,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM;IAYxC,cAAc,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM;IAK3C,YAAY,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO;IA2B1C,kBAAkB,CAAC,MAAM,EAAE,WAAW,GAAG,WAAW,GAAG,IAAI;IAK3D,OAAO,CAAC,kBAAkB;IAa1B,OAAO,CAAC,cAAc;IAQtB,OAAO,CAAC,mBAAmB;IAU3B,OAAO,CAAC,qBAAqB;CAU7B"}
|
|
@@ -4,11 +4,14 @@ import { ChoiceAdapter } from './adapters/choice-adapter.js';
|
|
|
4
4
|
* Coordinates adapters, strategies, and state management
|
|
5
5
|
*/
|
|
6
6
|
export declare class AnswerEliminatorCore {
|
|
7
|
+
private static readonly TOGGLE_CLASS;
|
|
8
|
+
private static readonly TOGGLE_ACTIVE_CLASS;
|
|
7
9
|
private registry;
|
|
8
10
|
private strategy;
|
|
9
11
|
private eliminatedChoices;
|
|
10
12
|
private choiceElements;
|
|
11
13
|
private choiceButtons;
|
|
14
|
+
private choiceAdapters;
|
|
12
15
|
private buttonAlignment;
|
|
13
16
|
private shouldRestoreState;
|
|
14
17
|
private storeIntegration;
|
|
@@ -60,10 +63,6 @@ export declare class AnswerEliminatorCore {
|
|
|
60
63
|
* Restore state from ElementToolStateStore
|
|
61
64
|
*/
|
|
62
65
|
private restoreState;
|
|
63
|
-
/**
|
|
64
|
-
* Find adapter for a choice element
|
|
65
|
-
*/
|
|
66
|
-
private findAdapterForChoice;
|
|
67
66
|
/**
|
|
68
67
|
* Cleanup buttons from previous element
|
|
69
68
|
*/
|
|
@@ -86,10 +85,6 @@ export declare class AnswerEliminatorCore {
|
|
|
86
85
|
* Note: State is preserved in localStorage for when tool is turned back on
|
|
87
86
|
*/
|
|
88
87
|
cleanup(): void;
|
|
89
|
-
/**
|
|
90
|
-
* Emit state change event for UI updates
|
|
91
|
-
*/
|
|
92
|
-
private emitStateChange;
|
|
93
88
|
/**
|
|
94
89
|
* Destroy and cleanup
|
|
95
90
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"answer-eliminator-core.d.ts","sourceRoot":"","sources":["../answer-eliminator-core.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAKlE;;;GAGG;AACH,qBAAa,oBAAoB;IAChC,OAAO,CAAC,QAAQ,CAAkB;IAClC,OAAO,CAAC,QAAQ,CAAsB;IACtC,OAAO,CAAC,iBAAiB,CAAqB;IAC9C,OAAO,CAAC,cAAc,CAAkC;IACxD,OAAO,CAAC,aAAa,CAAwC;IAC7D,OAAO,CAAC,eAAe,CAAwC;IAC/D,OAAO,CAAC,kBAAkB,CAAiB;IAG3C,OAAO,CAAC,gBAAgB,CAGR;gBAGf,YAAY,GAAE,eAAe,GAAG,MAAM,GAAG,MAAwB,EACjE,eAAe,GAAE,MAAM,GAAG,OAAO,GAAG,QAAkB;IAQvD,OAAO,CAAC,cAAc;IAUtB;;OAEG;IACH,qBAAqB,CAAC,YAAY,EAAE,WAAW,GAAG,IAAI;IAmBtD;;OAEG;IACH,OAAO,CAAC,gBAAgB;
|
|
1
|
+
{"version":3,"file":"answer-eliminator-core.d.ts","sourceRoot":"","sources":["../answer-eliminator-core.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAKlE;;;GAGG;AACH,qBAAa,oBAAoB;IAChC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAkC;IACtE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,mBAAmB,CACH;IACxC,OAAO,CAAC,QAAQ,CAAkB;IAClC,OAAO,CAAC,QAAQ,CAAsB;IACtC,OAAO,CAAC,iBAAiB,CAAqB;IAC9C,OAAO,CAAC,cAAc,CAAkC;IACxD,OAAO,CAAC,aAAa,CAAwC;IAC7D,OAAO,CAAC,cAAc,CAAoC;IAC1D,OAAO,CAAC,eAAe,CAAwC;IAC/D,OAAO,CAAC,kBAAkB,CAAiB;IAG3C,OAAO,CAAC,gBAAgB,CAGR;gBAGf,YAAY,GAAE,eAAe,GAAG,MAAM,GAAG,MAAwB,EACjE,eAAe,GAAE,MAAM,GAAG,OAAO,GAAG,QAAkB;IAQvD,OAAO,CAAC,cAAc;IAUtB;;OAEG;IACH,qBAAqB,CAAC,YAAY,EAAE,WAAW,GAAG,IAAI;IAmBtD;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAsBxB;;OAEG;IACH,OAAO,CAAC,kBAAkB;IA0B1B;;OAEG;IACH,iBAAiB,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,aAAa,GAAG,IAAI;IAyBpE;;OAEG;IACH,OAAO,CAAC,eAAe;IA2BvB;;OAEG;IACH,OAAO,CAAC,aAAa;IAkBrB;;OAEG;IACH,QAAQ,IAAI,IAAI;IAahB;;OAEG;IACH,kBAAkB,IAAI,MAAM;IAI5B;;;;OAIG;IACH,mBAAmB,CAAC,KAAK,EAAE,GAAG,EAAE,eAAe,EAAE,MAAM,GAAG,IAAI;IAI9D;;OAEG;IACH,OAAO,CAAC,SAAS;IAcjB;;OAEG;IACH,OAAO,CAAC,YAAY;IA6CpB;;OAEG;IACH,OAAO,CAAC,cAAc;IAUtB;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAmC5B;;OAEG;IACH,sBAAsB,IAAI,IAAI;IAI9B;;OAEG;IACH,uBAAuB,IAAI,IAAI;IAI/B;;;;OAIG;IACH,OAAO,IAAI,IAAI;IAYf;;OAEG;IACH,OAAO,IAAI,IAAI;CAIf"}
|
|
@@ -4,9 +4,16 @@ import { EliminationStrategy } from './elimination-strategy.js';
|
|
|
4
4
|
* Partially hides/grays eliminated choices
|
|
5
5
|
*/
|
|
6
6
|
export declare class MaskStrategy implements EliminationStrategy {
|
|
7
|
+
private static readonly HIGHLIGHT_STYLE_PREFIX;
|
|
8
|
+
private static readonly HIGHLIGHT_NAME_PREFIX;
|
|
9
|
+
private static readonly FALLBACK_CLASS;
|
|
10
|
+
private static readonly CHOICE_HOOK_ATTR;
|
|
11
|
+
private static readonly ELIMINATED_ATTR;
|
|
12
|
+
private static readonly ELIMINATED_ID_ATTR;
|
|
7
13
|
readonly name = "mask";
|
|
8
14
|
private highlights;
|
|
9
15
|
private ranges;
|
|
16
|
+
private fallbackContainers;
|
|
10
17
|
initialize(): void;
|
|
11
18
|
destroy(): void;
|
|
12
19
|
apply(choiceId: string, range: Range): void;
|
|
@@ -15,10 +22,8 @@ export declare class MaskStrategy implements EliminationStrategy {
|
|
|
15
22
|
clearAll(): void;
|
|
16
23
|
getEliminatedIds(): string[];
|
|
17
24
|
private isSupported;
|
|
18
|
-
private injectCSS;
|
|
19
25
|
private injectHighlightCSS;
|
|
20
26
|
private removeHighlightCSS;
|
|
21
|
-
private removeCSS;
|
|
22
27
|
private addAriaAttributes;
|
|
23
28
|
private removeAriaAttributes;
|
|
24
29
|
private findChoiceContainer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mask-strategy.d.ts","sourceRoot":"","sources":["../../strategies/mask-strategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAErE;;;GAGG;AACH,qBAAa,YAAa,YAAW,mBAAmB;IACvD,QAAQ,CAAC,IAAI,UAAU;IAEvB,OAAO,CAAC,UAAU,CAAgC;IAClD,OAAO,CAAC,MAAM,CAA4B;
|
|
1
|
+
{"version":3,"file":"mask-strategy.d.ts","sourceRoot":"","sources":["../../strategies/mask-strategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAErE;;;GAGG;AACH,qBAAa,YAAa,YAAW,mBAAmB;IACvD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,sBAAsB,CACL;IACzC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,qBAAqB,CAAwB;IACrE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAgC;IACtE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CACH;IACrC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAgC;IACvE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAAmC;IAE7E,QAAQ,CAAC,IAAI,UAAU;IAEvB,OAAO,CAAC,UAAU,CAAgC;IAClD,OAAO,CAAC,MAAM,CAA4B;IAC1C,OAAO,CAAC,kBAAkB,CAAkC;IAE5D,UAAU,IAAI,IAAI;IAIlB,OAAO,IAAI,IAAI;IAIf,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI;IAqB3C,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAqB9B,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAIvC,QAAQ,IAAI,IAAI;IAOhB,gBAAgB,IAAI,MAAM,EAAE;IAI5B,OAAO,CAAC,WAAW;IAInB,OAAO,CAAC,kBAAkB;IAe1B,OAAO,CAAC,kBAAkB;IAM1B,OAAO,CAAC,iBAAiB;IAQzB,OAAO,CAAC,oBAAoB;IAQ5B,OAAO,CAAC,mBAAmB;IAkB3B,OAAO,CAAC,aAAa;IAWrB,OAAO,CAAC,cAAc;CAatB"}
|
|
@@ -7,9 +7,18 @@ import { EliminationStrategy } from './elimination-strategy.js';
|
|
|
7
7
|
* WCAG Compliance: Maintains info structure (1.3.1), no layout shift (2.4.3)
|
|
8
8
|
*/
|
|
9
9
|
export declare class StrikethroughStrategy implements EliminationStrategy {
|
|
10
|
+
private static readonly HIGHLIGHT_STYLE_PREFIX;
|
|
11
|
+
private static readonly HIGHLIGHT_NAME_PREFIX;
|
|
12
|
+
private static readonly FALLBACK_CLASS;
|
|
13
|
+
private static readonly SR_CLASS;
|
|
14
|
+
private static readonly CHOICE_HOOK_ATTR;
|
|
15
|
+
private static readonly LABEL_HOOK_ATTR;
|
|
16
|
+
private static readonly ELIMINATED_ATTR;
|
|
17
|
+
private static readonly ELIMINATED_ID_ATTR;
|
|
10
18
|
readonly name = "strikethrough";
|
|
11
19
|
private highlights;
|
|
12
20
|
private ranges;
|
|
21
|
+
private fallbackContainers;
|
|
13
22
|
initialize(): void;
|
|
14
23
|
destroy(): void;
|
|
15
24
|
apply(choiceId: string, range: Range): void;
|
|
@@ -18,14 +27,13 @@ export declare class StrikethroughStrategy implements EliminationStrategy {
|
|
|
18
27
|
clearAll(): void;
|
|
19
28
|
getEliminatedIds(): string[];
|
|
20
29
|
private isSupported;
|
|
21
|
-
private injectCSS;
|
|
22
30
|
private injectHighlightCSS;
|
|
23
31
|
private removeHighlightCSS;
|
|
24
|
-
private removeCSS;
|
|
25
32
|
private addAriaAttributes;
|
|
26
33
|
private removeAriaAttributes;
|
|
27
34
|
private findChoiceContainer;
|
|
28
35
|
private applyFallback;
|
|
29
36
|
private removeFallback;
|
|
37
|
+
private resolveLabelElement;
|
|
30
38
|
}
|
|
31
39
|
//# sourceMappingURL=strikethrough-strategy.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"strikethrough-strategy.d.ts","sourceRoot":"","sources":["../../strategies/strikethrough-strategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAErE;;;;;;GAMG;AACH,qBAAa,qBAAsB,YAAW,mBAAmB;IAChE,QAAQ,CAAC,IAAI,mBAAmB;IAEhC,OAAO,CAAC,UAAU,CAAgC;IAClD,OAAO,CAAC,MAAM,CAA4B;
|
|
1
|
+
{"version":3,"file":"strikethrough-strategy.d.ts","sourceRoot":"","sources":["../../strategies/strikethrough-strategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAErE;;;;;;GAMG;AACH,qBAAa,qBAAsB,YAAW,mBAAmB;IAChE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,sBAAsB,CACV;IACpC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,qBAAqB,CAA4B;IACzE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CACO;IAC7C,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAA2C;IAC3E,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CACH;IACrC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAsC;IAC7E,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAgC;IACvE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAAmC;IAE7E,QAAQ,CAAC,IAAI,mBAAmB;IAEhC,OAAO,CAAC,UAAU,CAAgC;IAClD,OAAO,CAAC,MAAM,CAA4B;IAC1C,OAAO,CAAC,kBAAkB,CAAkC;IAE5D,UAAU,IAAI,IAAI;IAOlB,OAAO,IAAI,IAAI;IAIf,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI;IA0B3C,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAyB9B,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAIvC,QAAQ,IAAI,IAAI;IAQhB,gBAAgB,IAAI,MAAM,EAAE;IAI5B,OAAO,CAAC,WAAW;IAInB,OAAO,CAAC,kBAAkB;IAiB1B,OAAO,CAAC,kBAAkB;IAQ1B,OAAO,CAAC,iBAAiB;IAkBzB,OAAO,CAAC,oBAAoB;IAc5B,OAAO,CAAC,mBAAmB;IAsB3B,OAAO,CAAC,aAAa;IAWrB,OAAO,CAAC,cAAc;IAetB,OAAO,CAAC,mBAAmB;CAO3B"}
|