@pie-element/math-inline 13.0.4-next.20261011174919 → 13.0.4
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/author/configure.d.ts +23 -13
- package/dist/author/configure.js +37 -47
- package/dist/author/defaults.d.ts +60 -58
- package/dist/author/index.d.ts +15 -43
- package/dist/author/index.js +12 -4
- package/dist/author/utils.d.ts +35 -4
- package/dist/browser/author/index.js +19 -23
- package/dist/browser/author/index.js.map +1 -1
- package/dist/browser/controller/index.js +13 -13
- package/dist/browser/controller/index.js.map +1 -1
- package/dist/browser/editor-runtime/author/index.js +19 -23
- package/dist/browser/editor-runtime/author/index.js.map +1 -1
- package/dist/browser/editor-runtime/controller/index.js +13 -13
- package/dist/browser/editor-runtime/controller/index.js.map +1 -1
- package/dist/controller/defaults.d.ts +19 -18
- package/dist/controller/index.d.ts +102 -7
- package/dist/controller/index.js +13 -13
- package/dist/controller/utils.d.ts +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/schemas/configuration.schema.json +385 -0
- package/dist/schemas/model.schema.json +719 -0
- package/dist/schemas/session.schema.json +44 -0
- package/dist/types.d.ts +236 -0
- package/package.json +21 -17
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "https://cdn.jsdelivr.net/npm/@pie-element/math-inline@13.0.4/dist/schemas/session.schema.json",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"id": {
|
|
7
|
+
"type": "string",
|
|
8
|
+
"description": "Identifier of the session"
|
|
9
|
+
},
|
|
10
|
+
"element": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"description": "The element the session belongs to"
|
|
13
|
+
},
|
|
14
|
+
"answers": {
|
|
15
|
+
"type": "object",
|
|
16
|
+
"additionalProperties": {
|
|
17
|
+
"$ref": "#/definitions/MathInlineAnswer"
|
|
18
|
+
},
|
|
19
|
+
"description": "Answers per response area of `expression`, keyed `r1`, `r2`, ... (advanced mode)"
|
|
20
|
+
},
|
|
21
|
+
"completeAnswer": {
|
|
22
|
+
"type": "string",
|
|
23
|
+
"description": "The whole expression with the learner's answers filled in, as LaTeX (advanced mode)"
|
|
24
|
+
},
|
|
25
|
+
"response": {
|
|
26
|
+
"type": "string",
|
|
27
|
+
"description": "The learner's answer, as LaTeX (simple mode)"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"definitions": {
|
|
31
|
+
"MathInlineAnswer": {
|
|
32
|
+
"type": "object",
|
|
33
|
+
"properties": {
|
|
34
|
+
"value": {
|
|
35
|
+
"type": "string"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"required": [
|
|
39
|
+
"value"
|
|
40
|
+
],
|
|
41
|
+
"description": "The learner's answer to one response area"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import type { ConfigureLanguageOptions, ConfigureMathMLProp, ConfigureMaxImageDimensionsProp, ConfigureProp, ConfigurePropWithEnabled, ContentDimensions, EditableHtmlConfigureProp, EditableHtmlPluginConfigureRequired, ExtraCSSRules, PieModel } from '@pie-element/shared-types';
|
|
2
|
+
/** Indicates the mode of the question: `Advanced Multi` fills response areas in `expression`, `Simple` takes one answer */
|
|
3
|
+
export type MathInlineResponseType = 'Advanced Multi' | 'Simple';
|
|
4
|
+
/**
|
|
5
|
+
* Keypad of an equation editor: a grade band, as a number or a numeric string
|
|
6
|
+
* (1 for Grade 1 - 2, 3 for Grade 3 - 5, 6 for Grade 6 - 7, 8 for Grade 8 - HS),
|
|
7
|
+
* or a named keypad
|
|
8
|
+
*/
|
|
9
|
+
export type EquationEditor = 1 | 3 | 6 | 8 | '1' | '3' | '6' | '8' | 'non-negative-integers' | 'integers' | 'decimals' | 'fractions' | 'geometry' | 'advanced-algebra' | 'statistics' | 'item-authoring';
|
|
10
|
+
/** Feedback for one level of correctness */
|
|
11
|
+
export interface FeedbackLevel {
|
|
12
|
+
/** Indicates the feedback type */
|
|
13
|
+
type: 'default' | 'custom' | 'none';
|
|
14
|
+
/** Indicates the feedback value */
|
|
15
|
+
default?: string;
|
|
16
|
+
/** Indicates the feedback custom value */
|
|
17
|
+
custom?: string;
|
|
18
|
+
}
|
|
19
|
+
/** Feedback per level of correctness */
|
|
20
|
+
export interface ComplexFeedback {
|
|
21
|
+
/** Indicates the configuration for feedback when answer is correct */
|
|
22
|
+
correct: FeedbackLevel;
|
|
23
|
+
/** Indicates the configuration for feedback when answer is incorrect */
|
|
24
|
+
incorrect: FeedbackLevel;
|
|
25
|
+
/** Indicates the configuration for feedback when answer is partially correct */
|
|
26
|
+
partial?: FeedbackLevel;
|
|
27
|
+
}
|
|
28
|
+
export interface MathInlineResponse {
|
|
29
|
+
/** The id of the response */
|
|
30
|
+
id: number | string;
|
|
31
|
+
/**
|
|
32
|
+
* Indicates what type of validation should be applied on the response; the model's
|
|
33
|
+
* `validationDefault` applies when it is not set
|
|
34
|
+
*/
|
|
35
|
+
validation?: 'literal' | 'symbolic';
|
|
36
|
+
/**
|
|
37
|
+
* Indicates if the order of expression elements in literal validation can be ignore - whilst the expression is still mathematically correct;
|
|
38
|
+
* the model's `ignoreOrderDefault` applies when it is not set
|
|
39
|
+
*/
|
|
40
|
+
ignoreOrder?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Indicates the allowance of trailing zeros in expressions - whilst the expression is still mathematically correct;
|
|
43
|
+
* the model's `allowTrailingZerosDefault` applies when it is not set
|
|
44
|
+
*/
|
|
45
|
+
allowTrailingZeros?: boolean;
|
|
46
|
+
/** The answer for the question */
|
|
47
|
+
answer: string;
|
|
48
|
+
/** Alternative correct answers, keyed by alternate id */
|
|
49
|
+
alternates?: Record<string, string>;
|
|
50
|
+
}
|
|
51
|
+
/** A settings-panel toggle the author writes into the model */
|
|
52
|
+
export interface MathInlineToggle {
|
|
53
|
+
enabled?: boolean;
|
|
54
|
+
}
|
|
55
|
+
/** The authored settings of a math-inline model: every model key besides `id`, `element` and `config` */
|
|
56
|
+
export interface MathInlineModelSettings {
|
|
57
|
+
/**
|
|
58
|
+
* Indicates the mode of the question
|
|
59
|
+
* @default "Advanced Multi"
|
|
60
|
+
*/
|
|
61
|
+
responseType?: MathInlineResponseType;
|
|
62
|
+
/** The item stem for the question */
|
|
63
|
+
prompt?: string;
|
|
64
|
+
/** Determines if prompt should show */
|
|
65
|
+
promptEnabled?: boolean;
|
|
66
|
+
/** Indicates the expression for advanced mode; each `{{response}}` is a response area */
|
|
67
|
+
expression?: string;
|
|
68
|
+
/**
|
|
69
|
+
* Indicates what type of editor should be displayed for all the possible responses
|
|
70
|
+
* @default "8"
|
|
71
|
+
*/
|
|
72
|
+
equationEditor?: EquationEditor;
|
|
73
|
+
/**
|
|
74
|
+
* Indicates the editor the author uses for the response template in advanced mode
|
|
75
|
+
* @default "8"
|
|
76
|
+
*/
|
|
77
|
+
promptEquationEditor?: EquationEditor;
|
|
78
|
+
/** Feedback configuration for the responses */
|
|
79
|
+
feedback?: ComplexFeedback;
|
|
80
|
+
/** Array of all correct responses; if responseType is Simple, only first element in array is used */
|
|
81
|
+
responses?: MathInlineResponse[];
|
|
82
|
+
/** Not read by the element: the first of `responses` is the default correct response */
|
|
83
|
+
defaultResponse?: MathInlineResponse;
|
|
84
|
+
/** Not read by the element */
|
|
85
|
+
partialScoring?: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Indicates the default value for validation, in case that it's not set on a response
|
|
88
|
+
* @default "literal"
|
|
89
|
+
*/
|
|
90
|
+
validationDefault?: 'literal' | 'symbolic';
|
|
91
|
+
/**
|
|
92
|
+
* Indicates the default value for ignoreOrder, in case that it's not set
|
|
93
|
+
* @default false
|
|
94
|
+
*/
|
|
95
|
+
ignoreOrderDefault?: boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Indicates the default value for allowTrailingZeros, in case that it's not set
|
|
98
|
+
* @default false
|
|
99
|
+
*/
|
|
100
|
+
allowTrailingZerosDefault?: boolean;
|
|
101
|
+
/** Indicates the value for rationale */
|
|
102
|
+
rationale?: string;
|
|
103
|
+
/** Indicates scoring type */
|
|
104
|
+
scoringType?: 'auto' | 'rubric';
|
|
105
|
+
/** Not read by the element */
|
|
106
|
+
studentInstructions?: string;
|
|
107
|
+
/** Indicates teacher instructions */
|
|
108
|
+
teacherInstructions?: string;
|
|
109
|
+
/** Extra buttons defined by user */
|
|
110
|
+
customKeys?: string[];
|
|
111
|
+
/** Indicates if Feedback is enabled */
|
|
112
|
+
feedbackEnabled?: boolean;
|
|
113
|
+
/** Indicates if Rationale are enabled */
|
|
114
|
+
rationaleEnabled?: boolean;
|
|
115
|
+
/** Indicates if spellcheck is enabled for the author. Default value is true */
|
|
116
|
+
spellCheckEnabled?: boolean;
|
|
117
|
+
/** Indicates if Student Instructions are enabled */
|
|
118
|
+
studentInstructionsEnabled?: boolean;
|
|
119
|
+
/** Indicates if Teacher Instructions are enabled */
|
|
120
|
+
teacherInstructionsEnabled?: boolean;
|
|
121
|
+
/** Indicates the note for the answer; a translated default note applies when it is not set */
|
|
122
|
+
note?: string;
|
|
123
|
+
/**
|
|
124
|
+
* Indicates the editor's toolbar position which can be 'bottom' or 'top'
|
|
125
|
+
* @default "bottom"
|
|
126
|
+
*/
|
|
127
|
+
toolbarEditorPosition?: 'bottom' | 'top';
|
|
128
|
+
/** Indicates if Rubric is enabled */
|
|
129
|
+
rubricEnabled?: boolean;
|
|
130
|
+
/**
|
|
131
|
+
* Indicates the language of the component
|
|
132
|
+
* Supported options: en, es, en_US, en-US, es_ES, es-ES, es_MX, es-MX
|
|
133
|
+
*/
|
|
134
|
+
language?: string;
|
|
135
|
+
/** Host-supplied CSS scoped to the element */
|
|
136
|
+
extraCSSRules?: ExtraCSSRules;
|
|
137
|
+
/**
|
|
138
|
+
* Not read by the element: the settings panel's Ignore Order toggle writes it, and the
|
|
139
|
+
* response editor reads `configuration.ignoreOrder.enabled` instead
|
|
140
|
+
*/
|
|
141
|
+
ignoreOrder?: MathInlineToggle;
|
|
142
|
+
/**
|
|
143
|
+
* Not read by the element: the settings panel's Allow Trailing Zeros toggle writes it, and the
|
|
144
|
+
* response editor reads `configuration.allowTrailingZeros.enabled` instead
|
|
145
|
+
*/
|
|
146
|
+
allowTrailingZeros?: MathInlineToggle;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Model for the `@pie-element/math-inline`
|
|
150
|
+
*
|
|
151
|
+
* NOTE: teacherInstructions, studentInstructions, rationale & scoringType
|
|
152
|
+
* functionalities are not defined yet - the value for those can belong to
|
|
153
|
+
* model or to configure (to be moved when the functionality is defined)
|
|
154
|
+
*/
|
|
155
|
+
export interface MathInlineModel extends PieModel, MathInlineModelSettings {
|
|
156
|
+
/**
|
|
157
|
+
* Not read by the element: the controller's `createDefaultModel()` nests the default model
|
|
158
|
+
* under `config`, as legacy does
|
|
159
|
+
*/
|
|
160
|
+
config?: MathInlineModelSettings;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Config Object for `@pie-element/math-inline`
|
|
164
|
+
*/
|
|
165
|
+
export interface MathInlineConfiguration {
|
|
166
|
+
/**
|
|
167
|
+
* Base editable html input configuration regarding plugins that are enabled/disabled
|
|
168
|
+
* E.g. audio, video, image
|
|
169
|
+
*/
|
|
170
|
+
baseInputConfiguration?: EditableHtmlConfigureProp;
|
|
171
|
+
/** Configuration for prompt */
|
|
172
|
+
prompt?: EditableHtmlPluginConfigureRequired;
|
|
173
|
+
/** Settings Panel control for feedback */
|
|
174
|
+
feedback?: ConfigureProp;
|
|
175
|
+
/** Configuration for response type */
|
|
176
|
+
responseType?: ConfigureProp;
|
|
177
|
+
/** Not read by this element */
|
|
178
|
+
partialScoring?: ConfigureProp;
|
|
179
|
+
/** Rationale configuration */
|
|
180
|
+
rationale?: EditableHtmlPluginConfigureRequired;
|
|
181
|
+
/** Indicates if the settings panel is not available */
|
|
182
|
+
settingsPanelDisabled?: boolean;
|
|
183
|
+
/** Configuration for the author's spellcheck; `enabled` is not read */
|
|
184
|
+
spellCheck?: ConfigurePropWithEnabled;
|
|
185
|
+
/** Scoring Type configuration */
|
|
186
|
+
scoringType?: ConfigureProp;
|
|
187
|
+
/** Student Instructions configuration */
|
|
188
|
+
studentInstructions?: ConfigureProp;
|
|
189
|
+
/** Teacher Instructions configuration */
|
|
190
|
+
teacherInstructions?: EditableHtmlPluginConfigureRequired;
|
|
191
|
+
/** Ignore Order configuration; `enabled` shows the control on each response */
|
|
192
|
+
ignoreOrder?: ConfigurePropWithEnabled;
|
|
193
|
+
/** Allow Trailing Zeros configuration; `enabled` shows the control on each response */
|
|
194
|
+
allowTrailingZeros?: ConfigurePropWithEnabled;
|
|
195
|
+
/** Maximum number of response areas */
|
|
196
|
+
maxResponseAreas?: number;
|
|
197
|
+
/** Maximum image width for input fields */
|
|
198
|
+
maxImageWidth?: ConfigureMaxImageDimensionsProp;
|
|
199
|
+
/** Maximum image height for input fields */
|
|
200
|
+
maxImageHeight?: ConfigureMaxImageDimensionsProp;
|
|
201
|
+
/** Rubric configuration - only relevant in environments that use pie-player-components */
|
|
202
|
+
withRubric?: ConfigureProp;
|
|
203
|
+
/** Configuration for editable-html */
|
|
204
|
+
mathMlOptions?: ConfigureMathMLProp;
|
|
205
|
+
/** Language configuration */
|
|
206
|
+
language?: ConfigurePropWithEnabled;
|
|
207
|
+
/**
|
|
208
|
+
* Language choices configuration
|
|
209
|
+
* Only available if language is enabled
|
|
210
|
+
*/
|
|
211
|
+
languageChoices?: ConfigureLanguageOptions;
|
|
212
|
+
/** Dimensions of the authoring container */
|
|
213
|
+
contentDimensions?: ContentDimensions;
|
|
214
|
+
/** Not read by this element: the model's `promptEnabled` shows the prompt */
|
|
215
|
+
showPrompt?: boolean;
|
|
216
|
+
/** Not read by this element: `prompt.label` labels the prompt */
|
|
217
|
+
promptLabel?: string;
|
|
218
|
+
/** Not read by this element */
|
|
219
|
+
settingsPartialScoring?: boolean;
|
|
220
|
+
}
|
|
221
|
+
/** The learner's answer to one response area */
|
|
222
|
+
export interface MathInlineAnswer {
|
|
223
|
+
value: string;
|
|
224
|
+
}
|
|
225
|
+
export interface MathInlineSession {
|
|
226
|
+
/** Identifier of the session */
|
|
227
|
+
id?: string;
|
|
228
|
+
/** The element the session belongs to */
|
|
229
|
+
element?: string;
|
|
230
|
+
/** Answers per response area of `expression`, keyed `r1`, `r2`, ... (advanced mode) */
|
|
231
|
+
answers?: Record<string, MathInlineAnswer>;
|
|
232
|
+
/** The whole expression with the learner's answers filled in, as LaTeX (advanced mode) */
|
|
233
|
+
completeAnswer?: string;
|
|
234
|
+
/** The learner's answer, as LaTeX (simple mode) */
|
|
235
|
+
response?: string;
|
|
236
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/math-inline",
|
|
3
|
-
"version": "13.0.4
|
|
3
|
+
"version": "13.0.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -11,25 +11,26 @@
|
|
|
11
11
|
"@emotion/react": "^11.14.0",
|
|
12
12
|
"@mui/icons-material": "^7.3.4",
|
|
13
13
|
"@mui/material": "^7.3.4",
|
|
14
|
-
"@pie-element/shared-utils": "0.1.4
|
|
15
|
-
"@pie-lib/correct-answer-toggle": "5.0.4
|
|
16
|
-
"@pie-lib/math-input": "9.0.4
|
|
17
|
-
"@pie-lib/math-toolbar": "4.0.4
|
|
18
|
-
"@pie-lib/render-ui": "8.0.4
|
|
19
|
-
"@pie-lib/translator": "5.0.
|
|
14
|
+
"@pie-element/shared-utils": "0.1.4",
|
|
15
|
+
"@pie-lib/correct-answer-toggle": "5.0.4",
|
|
16
|
+
"@pie-lib/math-input": "9.0.4",
|
|
17
|
+
"@pie-lib/math-toolbar": "4.0.4",
|
|
18
|
+
"@pie-lib/render-ui": "8.0.4",
|
|
19
|
+
"@pie-lib/translator": "5.0.1",
|
|
20
20
|
"debug": "^4.1.1",
|
|
21
21
|
"prop-types": "^15.8.1",
|
|
22
|
-
"@pie-lib/config-ui": "14.0.4
|
|
23
|
-
"@pie-lib/editable-html-tip-tap": "3.0.4
|
|
22
|
+
"@pie-lib/config-ui": "14.0.4",
|
|
23
|
+
"@pie-lib/editable-html-tip-tap": "3.0.4",
|
|
24
24
|
"clsx": "^2.1.1",
|
|
25
|
-
"@pie-element/shared-lodash": "0.1.
|
|
26
|
-
"@pie-element/shared-configure-events": "0.1.
|
|
27
|
-
"@pie-element/shared-feedback": "0.1.
|
|
25
|
+
"@pie-element/shared-lodash": "0.1.2",
|
|
26
|
+
"@pie-element/shared-configure-events": "0.1.1",
|
|
27
|
+
"@pie-element/shared-feedback": "0.1.2",
|
|
28
28
|
"@pie-framework/math-validation": "^1.0.0",
|
|
29
|
-
"@pie-element/shared-player-events": "0.1.
|
|
30
|
-
"@pie-element/shared-math-rendering-mathjax": "0.1.5
|
|
29
|
+
"@pie-element/shared-player-events": "0.1.1",
|
|
30
|
+
"@pie-element/shared-math-rendering-mathjax": "0.1.5",
|
|
31
31
|
"react": "^18.2.0",
|
|
32
|
-
"react-dom": "^18.2.0"
|
|
32
|
+
"react-dom": "^18.2.0",
|
|
33
|
+
"@pie-element/shared-types": "0.2.1"
|
|
33
34
|
},
|
|
34
35
|
"exports": {
|
|
35
36
|
".": {
|
|
@@ -84,6 +85,9 @@
|
|
|
84
85
|
"types": "./dist/runtime-support.d.ts",
|
|
85
86
|
"default": "./dist/runtime-support.js"
|
|
86
87
|
},
|
|
88
|
+
"./schemas/model.schema.json": "./dist/schemas/model.schema.json",
|
|
89
|
+
"./schemas/configuration.schema.json": "./dist/schemas/configuration.schema.json",
|
|
90
|
+
"./schemas/session.schema.json": "./dist/schemas/session.schema.json",
|
|
87
91
|
"./package.json": "./package.json"
|
|
88
92
|
},
|
|
89
93
|
"type": "module",
|
|
@@ -99,7 +103,7 @@
|
|
|
99
103
|
],
|
|
100
104
|
"sideEffects": false,
|
|
101
105
|
"scripts": {
|
|
102
|
-
"build": "bun x vite build && bun x vite build --config ../../../tools/vite/element-browser.config.ts && bun x vite build --config ../../../tools/vite/element-browser-editor-runtime.config.ts && bun x vite build --config ../../../tools/vite/element-legacy-print.config.ts && bun x vite build --config vite.config.iife.ts && bun x tsc --emitDeclarationOnly",
|
|
106
|
+
"build": "bun x vite build && bun x vite build --config ../../../tools/vite/element-browser.config.ts && bun x vite build --config ../../../tools/vite/element-browser-editor-runtime.config.ts && bun x vite build --config ../../../tools/vite/element-legacy-print.config.ts && bun x vite build --config vite.config.iife.ts && bun x tsc --emitDeclarationOnly && bun ../../../tools/schemas/build.ts",
|
|
103
107
|
"dev": "bun x vite",
|
|
104
108
|
"demo": "bun x vite --mode demo",
|
|
105
109
|
"test": "bun x vitest run"
|
|
@@ -113,7 +117,7 @@
|
|
|
113
117
|
},
|
|
114
118
|
"browserEditorRuntime": {
|
|
115
119
|
"name": "@pie-element/shared-editor-runtime",
|
|
116
|
-
"version": "0.1.
|
|
120
|
+
"version": "0.1.2",
|
|
117
121
|
"views": {
|
|
118
122
|
"delivery": "editor-runtime/delivery",
|
|
119
123
|
"author": "editor-runtime/author",
|