@doenet/assignment-viewer 0.1.0-alpha-12 → 0.1.0-alpha-15
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.d.ts +103 -0
- package/dist/index.js +3 -1
- package/package.json +14 -11
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { JSX } from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
/** The source for creating an activity */
|
|
4
|
+
export declare type ActivitySource = SingleDocSource | SelectSource | SequenceSource;
|
|
5
|
+
|
|
6
|
+
export declare function ActivityViewer({ source, flags: specifiedFlags, activityId, userId, requestedVariantIndex, maxAttemptsAllowed, itemLevelAttempts, activityLevelAttempts, paginate, showFinishButton, forceDisable, forceShowCorrectness, forceShowSolution, forceUnsuppressCheckwork, addVirtualKeyboard, externalVirtualKeyboardProvided, doenetViewerUrl, fetchExternalDoenetML, darkMode, showAnswerResponseMenu, answerResponseCountsByItem, includeVariantSelector: _includeVariantSelector, showTitle, itemWord, }: {
|
|
7
|
+
source: ActivitySource;
|
|
8
|
+
flags?: DoenetMLFlagsSubset;
|
|
9
|
+
activityId?: string;
|
|
10
|
+
userId?: string | null;
|
|
11
|
+
requestedVariantIndex?: number;
|
|
12
|
+
maxAttemptsAllowed?: number;
|
|
13
|
+
itemLevelAttempts?: boolean;
|
|
14
|
+
activityLevelAttempts?: boolean;
|
|
15
|
+
paginate?: boolean;
|
|
16
|
+
showFinishButton?: boolean;
|
|
17
|
+
forceDisable?: boolean;
|
|
18
|
+
forceShowCorrectness?: boolean;
|
|
19
|
+
forceShowSolution?: boolean;
|
|
20
|
+
forceUnsuppressCheckwork?: boolean;
|
|
21
|
+
addVirtualKeyboard?: boolean;
|
|
22
|
+
externalVirtualKeyboardProvided?: boolean;
|
|
23
|
+
doenetViewerUrl?: string;
|
|
24
|
+
fetchExternalDoenetML?: (arg: string) => Promise<string>;
|
|
25
|
+
darkMode?: "dark" | "light";
|
|
26
|
+
showAnswerResponseMenu?: boolean;
|
|
27
|
+
answerResponseCountsByItem?: Record<string, number>[];
|
|
28
|
+
includeVariantSelector?: boolean;
|
|
29
|
+
showTitle?: boolean;
|
|
30
|
+
itemWord?: string;
|
|
31
|
+
}): JSX.Element | null;
|
|
32
|
+
|
|
33
|
+
declare type DoenetMLFlags = {
|
|
34
|
+
showCorrectness: boolean;
|
|
35
|
+
readOnly: boolean;
|
|
36
|
+
solutionDisplayMode: string;
|
|
37
|
+
showFeedback: boolean;
|
|
38
|
+
showHints: boolean;
|
|
39
|
+
allowLoadState: boolean;
|
|
40
|
+
allowSaveState: boolean;
|
|
41
|
+
allowLocalState: boolean;
|
|
42
|
+
allowSaveSubmissions: boolean;
|
|
43
|
+
allowSaveEvents: boolean;
|
|
44
|
+
autoSubmit: boolean;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
declare type DoenetMLFlagsSubset = Partial<DoenetMLFlags>;
|
|
48
|
+
|
|
49
|
+
export declare function isActivitySource(obj: unknown): obj is ActivitySource;
|
|
50
|
+
|
|
51
|
+
/** The source for creating a select activity */
|
|
52
|
+
declare type SelectSource = {
|
|
53
|
+
type: "select";
|
|
54
|
+
id: string;
|
|
55
|
+
title?: string;
|
|
56
|
+
/** The child activities to select from */
|
|
57
|
+
items: ActivitySource[];
|
|
58
|
+
/** The number of child activities to select (without replacement) for each attempt */
|
|
59
|
+
numToSelect: number;
|
|
60
|
+
/**
|
|
61
|
+
* Whether or not to consider each variant of each child a separate option to select from.
|
|
62
|
+
* If `selectByVariant` is `true`, the selection is from the total set of all variants,
|
|
63
|
+
* meaning selection probabilities is weighted by the number of variants each child has,
|
|
64
|
+
* and, if `numToSelect` > 1, a child could be selected multiple times for a given attempt.
|
|
65
|
+
*/
|
|
66
|
+
selectByVariant: boolean;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
/** The source for creating a sequence activity */
|
|
70
|
+
declare type SequenceSource = {
|
|
71
|
+
type: "sequence";
|
|
72
|
+
id: string;
|
|
73
|
+
title?: string;
|
|
74
|
+
/** The child activities that form the sequence. */
|
|
75
|
+
items: ActivitySource[];
|
|
76
|
+
/** If `true`, randomly permute the item order on each new attempt. */
|
|
77
|
+
shuffle: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Weights given to the credit achieved of each item
|
|
80
|
+
* when averaging them to determine the credit achieved of the sequence activity.
|
|
81
|
+
* Items missing a weight are given the weight 1.
|
|
82
|
+
*/
|
|
83
|
+
creditWeights?: number[];
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
/** The source for creating a single doc activity */
|
|
87
|
+
declare type SingleDocSource = {
|
|
88
|
+
type: "singleDoc";
|
|
89
|
+
id: string;
|
|
90
|
+
title?: string;
|
|
91
|
+
/**
|
|
92
|
+
* If `isDescription` is `true`, then this activity is not considered one of the scored items
|
|
93
|
+
* and its credit achieved is ignored.
|
|
94
|
+
*/
|
|
95
|
+
isDescription: boolean;
|
|
96
|
+
doenetML: string;
|
|
97
|
+
/** The version of DoenetML that should be used to render this activity. */
|
|
98
|
+
version: string;
|
|
99
|
+
/** The number of variants present in `doenetML` */
|
|
100
|
+
numVariants?: number;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
export { }
|
package/dist/index.js
CHANGED
|
@@ -3237,7 +3237,6 @@ function SingleDocActivity({
|
|
|
3237
3237
|
requestedVariantIndex,
|
|
3238
3238
|
flags,
|
|
3239
3239
|
activityId: baseId,
|
|
3240
|
-
prefixForIds: state.id,
|
|
3241
3240
|
docId: state.id,
|
|
3242
3241
|
forceDisable,
|
|
3243
3242
|
forceShowCorrectness,
|
|
@@ -3278,6 +3277,7 @@ function SingleDocActivity({
|
|
|
3278
3277
|
padding: "5px 20px",
|
|
3279
3278
|
cursor: attemptButtonDisabled ? "not-allowed" : "pointer"
|
|
3280
3279
|
},
|
|
3280
|
+
"data-test": "New Item Attempt",
|
|
3281
3281
|
children: [
|
|
3282
3282
|
"New ",
|
|
3283
3283
|
itemWord,
|
|
@@ -3954,6 +3954,7 @@ function Viewer({
|
|
|
3954
3954
|
borderRadius: "10px",
|
|
3955
3955
|
padding: "5px 20px"
|
|
3956
3956
|
},
|
|
3957
|
+
"data-test": "Cancel Create New Attempt",
|
|
3957
3958
|
children: "Cancel"
|
|
3958
3959
|
}
|
|
3959
3960
|
),
|
|
@@ -3974,6 +3975,7 @@ function Viewer({
|
|
|
3974
3975
|
borderRadius: "10px",
|
|
3975
3976
|
padding: "5px 20px"
|
|
3976
3977
|
},
|
|
3978
|
+
"data-test": "Confirm Create New Attempt",
|
|
3977
3979
|
children: "Create new attempt"
|
|
3978
3980
|
}
|
|
3979
3981
|
)
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@doenet/assignment-viewer",
|
|
3
3
|
"private": false,
|
|
4
4
|
"description": "View assignments from questions written in DoenetML",
|
|
5
|
-
"version": "0.1.0-alpha-
|
|
5
|
+
"version": "0.1.0-alpha-15",
|
|
6
6
|
"license": "AGPL-3.0-or-later",
|
|
7
7
|
"homepage": "https://github.com/Doenet/assignment-viewer#readme",
|
|
8
8
|
"type": "module",
|
|
@@ -13,19 +13,22 @@
|
|
|
13
13
|
"files": [
|
|
14
14
|
"/dist"
|
|
15
15
|
],
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
16
17
|
"exports": {
|
|
17
18
|
".": {
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
18
20
|
"import": "./dist/index.js",
|
|
19
21
|
"require": "./dist/index.js"
|
|
20
22
|
},
|
|
21
23
|
"./*": {
|
|
24
|
+
"types": "./dist/*.d.ts",
|
|
22
25
|
"import": "./dist/*",
|
|
23
26
|
"require": "./dist/*"
|
|
24
27
|
}
|
|
25
28
|
},
|
|
26
29
|
"scripts": {
|
|
27
30
|
"dev": "vite",
|
|
28
|
-
"build": "
|
|
31
|
+
"build": "vite build",
|
|
29
32
|
"test": "vitest",
|
|
30
33
|
"lint": "eslint .",
|
|
31
34
|
"preview": "vite preview",
|
|
@@ -33,9 +36,9 @@
|
|
|
33
36
|
"prettier:check": "prettier --check ."
|
|
34
37
|
},
|
|
35
38
|
"peerDependencies": {
|
|
36
|
-
"react": "^19.2.
|
|
37
|
-
"react-dom": "^19.2.
|
|
38
|
-
"@doenet/doenetml-iframe": "^0.7.
|
|
39
|
+
"react": "^19.2.3",
|
|
40
|
+
"react-dom": "^19.2.3",
|
|
41
|
+
"@doenet/doenetml-iframe": "^0.7.4"
|
|
39
42
|
},
|
|
40
43
|
"dependencies": {
|
|
41
44
|
"nanoid": "^5.1.6",
|
|
@@ -50,18 +53,18 @@
|
|
|
50
53
|
"@types/react-dom": "^19.2.3",
|
|
51
54
|
"@types/seedrandom": "^3.0.8",
|
|
52
55
|
"@vitejs/plugin-react-swc": "^4.2.2",
|
|
53
|
-
"eslint": "^9.39.
|
|
56
|
+
"eslint": "^9.39.2",
|
|
54
57
|
"eslint-plugin-react": "^7.37.5",
|
|
55
58
|
"eslint-plugin-react-hooks": "^7.0.1",
|
|
56
59
|
"eslint-plugin-react-refresh": "^0.4.24",
|
|
57
60
|
"globals": "^16.5.0",
|
|
58
|
-
"prettier": "^3.
|
|
59
|
-
"rollup-plugin-visualizer": "^6.0.
|
|
61
|
+
"prettier": "^3.7.4",
|
|
62
|
+
"rollup-plugin-visualizer": "^6.0.5",
|
|
60
63
|
"typescript": "^5.9.3",
|
|
61
|
-
"typescript-eslint": "^8.
|
|
62
|
-
"vite": "^7.2.
|
|
64
|
+
"typescript-eslint": "^8.49.0",
|
|
65
|
+
"vite": "^7.2.7",
|
|
63
66
|
"vite-plugin-dts": "^4.5.4",
|
|
64
|
-
"vitest": "^4.0.
|
|
67
|
+
"vitest": "^4.0.15"
|
|
65
68
|
},
|
|
66
69
|
"prettier": {
|
|
67
70
|
"tabWidth": 4
|