@pie-players/pie-tool-answer-eliminator 0.3.73 → 0.3.75

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-players/pie-tool-answer-eliminator",
3
- "version": "0.3.73",
3
+ "version": "0.3.75",
4
4
  "type": "module",
5
5
  "description": "Answer eliminator tool for PIE assessment player - supports process-of-elimination test-taking strategy",
6
6
  "repository": {
@@ -39,26 +39,27 @@
39
39
  "unpkg": "./dist/tool-answer-eliminator.js",
40
40
  "jsdelivr": "./dist/tool-answer-eliminator.js",
41
41
  "dependencies": {
42
- "@pie-players/pie-assessment-toolkit": "0.3.73",
43
- "@pie-players/pie-context": "0.3.73",
44
- "@pie-players/pie-players-shared": "0.3.73"
42
+ "@pie-players/pie-assessment-toolkit": "0.3.75",
43
+ "@pie-players/pie-players-shared": "0.3.75"
45
44
  },
46
45
  "types": "./dist/index.d.ts",
47
46
  "scripts": {
48
47
  "build": "vite build && tsc -p tsconfig.adapters.json",
49
48
  "dev": "vite build --watch",
49
+ "test": "bun test tests",
50
50
  "typecheck": "tsc --noEmit",
51
51
  "check": "svelte-check --tsconfig ./tsconfig.json --compiler-warnings options_missing_custom_element:ignore",
52
- "lint": "biome check ."
52
+ "lint": "biome lint ."
53
53
  },
54
54
  "devDependencies": {
55
- "@biomejs/biome": "^2.5.13",
56
- "@sveltejs/vite-plugin-svelte": "^7.3.0",
57
- "svelte": "^5.57.0",
55
+ "@biomejs/biome": "^2.5.15",
56
+ "@happy-dom/global-registrator": "^20.14.5",
57
+ "@sveltejs/vite-plugin-svelte": "^7.3.1",
58
+ "svelte": "^5.57.1",
58
59
  "svelte-check": "^4.7.6",
59
60
  "typescript": "^5.9.3",
60
- "vite": "^8.2.2",
61
- "vite-plugin-dts": "^5.0.3"
61
+ "vite": "^8.3.2",
62
+ "vite-plugin-dts": "^5.1.2"
62
63
  },
63
64
  "homepage": "https://github.com/pie-framework/pie-players/tree/master/packages/tool-answer-eliminator#readme",
64
65
  "bugs": {
@@ -1,151 +0,0 @@
1
- import { ChoiceAdapter } from './adapters/choice-adapter.js';
2
- /**
3
- * Core engine for answer eliminator tool
4
- * Coordinates adapters, strategies, and state management
5
- */
6
- export declare class AnswerEliminatorCore {
7
- private static readonly TOGGLE_CLASS;
8
- private static readonly TOGGLE_ACTIVE_CLASS;
9
- private registry;
10
- private strategy;
11
- private eliminatedChoices;
12
- private choiceElements;
13
- private choiceButtons;
14
- private choiceAdapters;
15
- private buttonAlignment;
16
- private shouldRestoreState;
17
- private active;
18
- private questionRoot;
19
- private selectionChangeHandler;
20
- private selectionObserver;
21
- private selectionRefreshFrame;
22
- private storeIntegration;
23
- constructor(strategyType?: "strikethrough" | "mask" | "gray", buttonAlignment?: "left" | "right" | "inline");
24
- private createStrategy;
25
- /**
26
- * Initialize eliminator for a question
27
- */
28
- initializeForQuestion(questionRoot: HTMLElement): void;
29
- /**
30
- * Initialize a single choice
31
- */
32
- private initializeChoice;
33
- /**
34
- * Create elimination toggle button
35
- */
36
- private createToggleButton;
37
- /**
38
- * Toggle elimination for a choice
39
- */
40
- toggleElimination(choice: HTMLElement, adapter: ChoiceAdapter): void;
41
- /**
42
- * Eliminate a choice
43
- */
44
- private eliminateChoice;
45
- /**
46
- * Restore a choice
47
- */
48
- private restoreChoice;
49
- /**
50
- * Reset all eliminations for current element
51
- */
52
- resetAll(): void;
53
- /**
54
- * Get count of eliminated choices for current element
55
- */
56
- getEliminatedCount(): number;
57
- /**
58
- * Set store integration for element-level state
59
- * @param store ElementToolStateStore instance
60
- * @param globalElementId Composite key: "assessmentId:sectionId:itemId:elementId"
61
- */
62
- setStoreIntegration(store: any, globalElementId: string): void;
63
- /**
64
- * Save state to ElementToolStateStore
65
- */
66
- private saveState;
67
- /**
68
- * Restore state from ElementToolStateStore
69
- */
70
- private restoreState;
71
- /**
72
- * Re-enable selection for every currently-tracked struck choice.
73
- * Must run before the element/adapter maps are cleared, otherwise the
74
- * inputs would be left disabled after the tool is turned off.
75
- */
76
- private restoreAllSelectable;
77
- /**
78
- * Show or hide a choice's strikethrough button, preserving the visible
79
- * `display` value chosen by the alignment configuration.
80
- */
81
- private setButtonHidden;
82
- /**
83
- * The single rule for whether a choice's eliminate button should be hidden:
84
- * - A struck-through choice always keeps its button (so it can be undone),
85
- * even when the feature is toggled off.
86
- * - When the feature is off, a non-struck choice hides its button.
87
- * - When the feature is on, a non-struck choice hides its button only while
88
- * it is selected (a selected answer must not be eliminable).
89
- */
90
- private shouldHideButton;
91
- /**
92
- * Re-apply the visibility rule to a single choice's button.
93
- */
94
- private updateButtonVisibility;
95
- /**
96
- * Re-evaluate button visibility for every tracked choice. Driven by live
97
- * selection changes and by toggling the feature on/off.
98
- */
99
- private refreshSelectionState;
100
- /**
101
- * Schedule a selection refresh on the next frame. Deliberately does NOT
102
- * cancel-and-reschedule: a burst of mutations coalesces into one pending
103
- * refresh, and mutations in later frames each get their own refresh, so a
104
- * multi-render commit settles instead of being starved by continuous
105
- * churn (e.g. ripple animations).
106
- */
107
- private scheduleSelectionRefresh;
108
- /**
109
- * Track live selection changes on the question root so button visibility
110
- * follows the selection even when no full re-render occurs.
111
- *
112
- * Controlled widgets (PIE multiple-choice) update the input's `checked`
113
- * *property* on their own render — invisible to a MutationObserver and
114
- * later than the native `change` event — so we observe every DOM change
115
- * the widget makes (childList + attributes) and re-read on the next frame,
116
- * by which point the property has settled. Mutations caused by our own
117
- * buttons are ignored so the refresh can't loop.
118
- */
119
- private attachSelectionListener;
120
- private detachSelectionListener;
121
- /**
122
- * Cleanup buttons from previous element
123
- */
124
- private cleanupButtons;
125
- /**
126
- * Apply button positioning based on alignment configuration
127
- */
128
- private applyButtonAlignment;
129
- /**
130
- * Enable state restoration from localStorage
131
- */
132
- enableStateRestoration(): void;
133
- /**
134
- * Disable state restoration from localStorage
135
- */
136
- disableStateRestoration(): void;
137
- /**
138
- * Turn the feature off at the question level.
139
- *
140
- * Struck-through choices stay struck: their strikethrough, their disabled
141
- * (non-selectable) input, and a visible/usable eliminate button all remain
142
- * so the student can still undo them. Only the eliminate buttons for
143
- * choices that are NOT struck through are hidden. Nothing is destroyed, so
144
- * toggling the feature back on simply re-reveals the hidden buttons.
145
- */
146
- cleanup(): void;
147
- /**
148
- * Destroy and cleanup
149
- */
150
- destroy(): void;
151
- }
@@ -1,20 +0,0 @@
1
- var s = Object.create, i = Object.defineProperty, f = Object.getOwnPropertyDescriptor, c = Object.getOwnPropertyNames, O = Object.getPrototypeOf, p = Object.prototype.hasOwnProperty, P = (e, r) => () => (r || (e((r = { exports: {} }).exports, r), e = null), r.exports), v = (e, r, t, o) => {
2
- if (r && typeof r == "object" || typeof r == "function")
3
- for (var u = c(r), a = 0, l = u.length, n; a < l; a++)
4
- n = u[a], !p.call(e, n) && n !== t && i(e, n, {
5
- get: ((_) => r[_]).bind(null, n),
6
- enumerable: !(o = f(r, n)) || o.enumerable
7
- });
8
- return e;
9
- }, b = (e, r, t) => (t = e != null ? s(O(e)) : {}, v(r || !e || !e.__esModule || !p.call(e, "default") ? i(t, "default", {
10
- value: e,
11
- enumerable: !0
12
- }) : t, e)), d = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (r, t) => (typeof require < "u" ? require : r)[t] }) : e)(function(e) {
13
- if (typeof require < "u") return require.apply(this, arguments);
14
- throw Error('Calling `require` for "' + e + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
15
- });
16
- export {
17
- d as n,
18
- b as r,
19
- P as t
20
- };