@pie-element/shared-controller-utils 0.1.1-next.1 → 0.1.1-next.3
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/dist/index.js +2 -2
- package/dist/persistence.d.ts +2 -4
- package/package.json +3 -9
package/dist/index.js
CHANGED
|
@@ -21,7 +21,7 @@ function r(e) {
|
|
|
21
21
|
return t;
|
|
22
22
|
}
|
|
23
23
|
function i(e) {
|
|
24
|
-
return e == null ? !0 : Array.isArray(e) ? e.length === 0 : typeof e == "object"
|
|
24
|
+
return e == null ? !0 : Array.isArray(e) ? e.length === 0 : typeof e == "object" && Object.keys(e).length === 0;
|
|
25
25
|
}
|
|
26
26
|
async function a(e, t, a, o = "value") {
|
|
27
27
|
let s = n(t?.data?.shuffledValues ?? t?.shuffledValues ?? []);
|
|
@@ -47,7 +47,7 @@ function o(e, t, n) {
|
|
|
47
47
|
//#region src/partial-scoring.ts
|
|
48
48
|
var s = /* @__PURE__ */ t({ enabled: () => c });
|
|
49
49
|
function c(e, t, n) {
|
|
50
|
-
return e?.partialScoring === !1 || t?.partialScoring === !1 ? !1 : typeof n
|
|
50
|
+
return e?.partialScoring === !1 || t?.partialScoring === !1 ? !1 : typeof n != "boolean" || n;
|
|
51
51
|
}
|
|
52
52
|
//#endregion
|
|
53
53
|
export { a as getShuffledChoices, o as lockChoices, s as partialScoring };
|
package/dist/persistence.d.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Functions for managing shuffled choice order and session persistence.
|
|
5
5
|
*/
|
|
6
|
+
import type { PieUpdateSession } from '@pie-element/shared-types';
|
|
6
7
|
interface Session {
|
|
7
8
|
id?: string;
|
|
8
9
|
element?: string;
|
|
@@ -23,9 +24,6 @@ interface Environment {
|
|
|
23
24
|
};
|
|
24
25
|
role?: 'student' | 'instructor';
|
|
25
26
|
}
|
|
26
|
-
type UpdateSessionFunction = (sessionId: string, element: string, data: {
|
|
27
|
-
shuffledValues: string[];
|
|
28
|
-
}) => Promise<void>;
|
|
29
27
|
/**
|
|
30
28
|
* Get shuffled choices, either from session storage or by creating a new shuffle.
|
|
31
29
|
*
|
|
@@ -40,7 +38,7 @@ type UpdateSessionFunction = (sessionId: string, element: string, data: {
|
|
|
40
38
|
* @param choiceKey - Property name to use as the unique identifier (e.g., 'value', 'id')
|
|
41
39
|
* @returns Promise resolving to shuffled choices array
|
|
42
40
|
*/
|
|
43
|
-
export declare function getShuffledChoices<T extends Choice>(choices: T[], session: Session | undefined, updateSession?:
|
|
41
|
+
export declare function getShuffledChoices<T extends Choice>(choices: T[], session: Session | undefined, updateSession?: PieUpdateSession, choiceKey?: string): Promise<T[] | undefined>;
|
|
44
42
|
/**
|
|
45
43
|
* Determine whether choice order should be locked (ordinal) or shuffled.
|
|
46
44
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/shared-controller-utils",
|
|
3
|
-
"version": "0.1.1-next.
|
|
3
|
+
"version": "0.1.1-next.3",
|
|
4
4
|
"description": "Controller utility functions for PIE elements",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -21,13 +21,7 @@
|
|
|
21
21
|
"clean": "rm -rf dist"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@pie-element/shared-types": "0.
|
|
25
|
-
},
|
|
26
|
-
"devDependencies": {
|
|
27
|
-
"@types/bun": "latest",
|
|
28
|
-
"typescript": "^5.9.3",
|
|
29
|
-
"vite": "^8.0.1",
|
|
30
|
-
"vitest": "^4.1.0"
|
|
24
|
+
"@pie-element/shared-types": "0.2.0-next.1"
|
|
31
25
|
},
|
|
32
26
|
"publishConfig": {
|
|
33
27
|
"access": "public"
|
|
@@ -35,7 +29,7 @@
|
|
|
35
29
|
"license": "MIT",
|
|
36
30
|
"repository": {
|
|
37
31
|
"type": "git",
|
|
38
|
-
"url": "https://github.com/pie-framework/pie-elements-ng.git",
|
|
32
|
+
"url": "git+https://github.com/pie-framework/pie-elements-ng.git",
|
|
39
33
|
"directory": "packages/shared/controller-utils"
|
|
40
34
|
},
|
|
41
35
|
"homepage": "https://github.com/pie-framework/pie-elements-ng#readme",
|