@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.
@@ -1,40 +0,0 @@
1
- /**
2
- * Strategy interface for visual elimination styles
3
- * Uses CSS Custom Highlight API for zero DOM mutation
4
- */
5
- export interface EliminationStrategy {
6
- /** Strategy name */
7
- readonly name: string;
8
- /**
9
- * Apply elimination visual to a choice
10
- * @param choiceId - Unique identifier for this choice
11
- * @param range - DOM Range covering the choice content
12
- */
13
- apply(choiceId: string, range: Range): void;
14
- /**
15
- * Remove elimination visual from a choice
16
- * @param choiceId - Unique identifier for this choice
17
- */
18
- remove(choiceId: string): void;
19
- /**
20
- * Check if a choice is currently eliminated
21
- * @param choiceId - Unique identifier for this choice
22
- */
23
- isEliminated(choiceId: string): boolean;
24
- /**
25
- * Clear all eliminations
26
- */
27
- clearAll(): void;
28
- /**
29
- * Get all eliminated choice IDs
30
- */
31
- getEliminatedIds(): string[];
32
- /**
33
- * Initialize strategy (inject CSS, etc.)
34
- */
35
- initialize(): void;
36
- /**
37
- * Cleanup strategy (remove CSS, etc.)
38
- */
39
- destroy(): void;
40
- }
@@ -1,32 +0,0 @@
1
- import { EliminationStrategy } from './elimination-strategy.js';
2
- /**
3
- * Mask strategy using CSS Custom Highlight API
4
- * Partially hides/grays eliminated choices
5
- */
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;
13
- readonly name = "mask";
14
- private highlights;
15
- private ranges;
16
- private fallbackContainers;
17
- initialize(): void;
18
- destroy(): void;
19
- apply(choiceId: string, range: Range): void;
20
- remove(choiceId: string): void;
21
- isEliminated(choiceId: string): boolean;
22
- clearAll(): void;
23
- getEliminatedIds(): string[];
24
- private isSupported;
25
- private injectHighlightCSS;
26
- private removeHighlightCSS;
27
- private addAriaAttributes;
28
- private removeAriaAttributes;
29
- private findChoiceContainer;
30
- private applyFallback;
31
- private removeFallback;
32
- }
@@ -1,106 +0,0 @@
1
- import { EliminationStrategy } from './elimination-strategy.js';
2
- /**
3
- * Strikethrough strategy using CSS Custom Highlight API
4
- *
5
- * Modern approach: Zero DOM mutation, uses browser-native highlighting
6
- * Accessibility: Best for screen readers (text remains in DOM unchanged)
7
- * WCAG Compliance: Maintains info structure (1.3.1), no layout shift (2.4.3)
8
- */
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;
18
- private static readonly IMAGE_WRAPPER_CLASS;
19
- private static readonly IMAGE_WRAPPER_ATTR;
20
- private static readonly IMAGE_OVERLAY_CLASS;
21
- private static readonly IMAGE_LINE_CLASS;
22
- private static readonly IMAGE_CASING_CLASS;
23
- private static readonly MATH_STRIKE_CLASS;
24
- private static readonly MATH_STRIKE_LINE_CLASS;
25
- private static readonly MATH_STRIKE_CROSS_CLASS;
26
- private static readonly MATH_STRIKE_ATTR;
27
- private static readonly MATH_STACKED_SELECTOR;
28
- private static readonly MATH_BOX_SELECTOR;
29
- private static readonly MATH_SELECTOR;
30
- private static readonly SVG_NS;
31
- private static readonly BLOCK_DISPLAYS;
32
- readonly name = "strikethrough";
33
- private highlights;
34
- private ranges;
35
- private fallbackContainers;
36
- private imageWrappers;
37
- private mathTargets;
38
- initialize(): void;
39
- destroy(): void;
40
- apply(choiceId: string, range: Range): void;
41
- remove(choiceId: string): void;
42
- isEliminated(choiceId: string): boolean;
43
- clearAll(): void;
44
- getEliminatedIds(): string[];
45
- private isSupported;
46
- private injectHighlightCSS;
47
- private removeHighlightCSS;
48
- private addAriaAttributes;
49
- private removeAriaAttributes;
50
- private findChoiceContainer;
51
- private applyFallback;
52
- private removeFallback;
53
- /**
54
- * Overlay every image in the eliminated choice with a diagonal X, drawn in
55
- * the same strike colour as the text line-through.
56
- *
57
- * Images are replaced elements: `line-through` (and `::highlight()`) never
58
- * paints on them, and they cannot carry a pseudo-element, so each image is
59
- * wrapped in a positioned span that hosts an absolutely-positioned overlay.
60
- * Wrapping keeps the overlay glued to the image through any later reflow —
61
- * responsive resizing, late image `load`, zoom — with no observers.
62
- */
63
- private strikeImages;
64
- private unstrikeImages;
65
- /**
66
- * Give MathJax-rendered math the same line-through the choice's text gets.
67
- *
68
- * `::highlight()` cannot reach it: MathJax's CHTML output draws every visible
69
- * glyph as an `mjx-c` element with empty `textContent`, the character coming
70
- * from `::before` generated content — which is part of no Range. (Its only
71
- * real text is the `mjx-assistive-mml` copy of the source MathML, clipped to
72
- * 1px for assistive tech, so the highlight paints it invisibly.) Its SVG
73
- * output has no text at all. A math-only choice therefore looked identical to
74
- * an un-eliminated one.
75
- *
76
- * Unlike an image, the rendered math box is a normal element that can carry a
77
- * pseudo-element, so this only adds a class and lets CSS paint it — no
78
- * wrapper, nothing restructured, and MathJax's own layout left alone.
79
- *
80
- * A single row of symbols gets the line-through the prose gets. An expression
81
- * that draws horizontal rules of its own gets diagonals instead: a line
82
- * centred on a fraction lands on the math axis, which is exactly where the
83
- * fraction bar already sits, so it reads as a recoloured bar rather than as an
84
- * elimination.
85
- */
86
- private strikeMath;
87
- private unstrikeMath;
88
- /**
89
- * The element whose images belong to this elimination. Adapters build the
90
- * range over the choice's own content (label or choice node), so its common
91
- * ancestor is the right scope; the choice container is the fallback.
92
- */
93
- private resolveImageScope;
94
- private wrapImage;
95
- private fillsParentWidth;
96
- private unwrapImage;
97
- /**
98
- * Corner-to-corner X sized to the wrapper. `preserveAspectRatio="none"`
99
- * stretches the 100x100 viewBox onto any aspect ratio, and
100
- * `vector-effect="non-scaling-stroke"` keeps both lines an even screen-space
101
- * thickness under that non-uniform scale. The wider casing line under each
102
- * red line keeps the X visible over dark or red imagery (WCAG 1.4.11).
103
- */
104
- private createImageStrikeOverlay;
105
- private resolveLabelElement;
106
- }
@@ -1 +0,0 @@
1
- export { SvelteComponent as default } from 'svelte';