@pie-element/graphing 11.0.4-next.20261011174919 → 11.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.
@@ -0,0 +1,127 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://cdn.jsdelivr.net/npm/@pie-element/graphing@11.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
+ "answer": {
15
+ "type": "array",
16
+ "items": {
17
+ "$ref": "#/definitions/Mark"
18
+ },
19
+ "description": "The marks the student drew"
20
+ }
21
+ },
22
+ "description": "A student response",
23
+ "definitions": {
24
+ "Mark": {
25
+ "type": "object",
26
+ "properties": {
27
+ "type": {
28
+ "$ref": "#/definitions/MarkType",
29
+ "description": "Indicates type of mark"
30
+ },
31
+ "building": {
32
+ "type": "boolean",
33
+ "description": "Indicates if mark is in build process"
34
+ },
35
+ "x": {
36
+ "type": "number",
37
+ "description": "Indicates x coordinate if type is point"
38
+ },
39
+ "y": {
40
+ "type": "number",
41
+ "description": "Indicates y coordinate if type is point"
42
+ },
43
+ "label": {
44
+ "type": "string",
45
+ "description": "Indicates label value for mark"
46
+ },
47
+ "showLabel": {
48
+ "type": "boolean",
49
+ "description": "Not read by this element or `@pie-lib/graphing`."
50
+ },
51
+ "from": {
52
+ "$ref": "#/definitions/MarkPoint",
53
+ "description": "Indicates where starts the mark if type is line, segment, ray, vector"
54
+ },
55
+ "to": {
56
+ "$ref": "#/definitions/MarkPoint",
57
+ "description": "Indicates where ends the mark if type is line, segment, ray, vector"
58
+ },
59
+ "middle": {
60
+ "$ref": "#/definitions/MarkPoint",
61
+ "description": "Labelled midpoint of a line, ray, segment, vector, circle or polygon mark"
62
+ },
63
+ "root": {
64
+ "$ref": "#/definitions/MarkPoint",
65
+ "description": "Indicated the root of mark if type is sine, parabola, absolute, exponential or circle"
66
+ },
67
+ "edge": {
68
+ "$ref": "#/definitions/MarkPoint",
69
+ "description": "Indicated the edge of mark if type is sine, parabola, absolute, exponential or circle"
70
+ },
71
+ "closed": {
72
+ "type": "boolean",
73
+ "description": "Indicates if mark is closed if type is polygon, sine"
74
+ },
75
+ "points": {
76
+ "type": "array",
77
+ "items": {
78
+ "$ref": "#/definitions/MarkPoint"
79
+ },
80
+ "description": "Indicates all mark's points if type is polygon"
81
+ }
82
+ },
83
+ "required": [
84
+ "type"
85
+ ]
86
+ },
87
+ "MarkType": {
88
+ "type": "string",
89
+ "enum": [
90
+ "point",
91
+ "segment",
92
+ "line",
93
+ "vector",
94
+ "circle",
95
+ "sine",
96
+ "polygon",
97
+ "ray",
98
+ "parabola",
99
+ "absolute",
100
+ "exponential"
101
+ ],
102
+ "description": "Kind of mark a graphing tool draws."
103
+ },
104
+ "MarkPoint": {
105
+ "type": "object",
106
+ "properties": {
107
+ "x": {
108
+ "type": "number",
109
+ "description": "Indicates x coordinate"
110
+ },
111
+ "y": {
112
+ "type": "number",
113
+ "description": "Indicates y coordinate"
114
+ },
115
+ "label": {
116
+ "type": "string",
117
+ "description": "Label shown next to the point"
118
+ }
119
+ },
120
+ "required": [
121
+ "x",
122
+ "y"
123
+ ],
124
+ "description": "A point of a mark, labelled with the label tool."
125
+ }
126
+ }
127
+ }
@@ -0,0 +1,346 @@
1
+ import type { ConfigureLanguageOptions, ConfigureMathMLProp, ConfigureMaxImageDimensionsProp, ConfigureProp, ConfigurePropWithEnabled, ContentDimensions, EditableHtmlConfigureProp, EditableHtmlPluginConfigureRequired, ExtraCSSRules, PieModel } from '@pie-element/shared-types';
2
+ /** Kind of mark a graphing tool draws. */
3
+ export type MarkType = 'point' | 'segment' | 'line' | 'vector' | 'circle' | 'sine' | 'polygon' | 'ray' | 'parabola' | 'absolute' | 'exponential';
4
+ /** A toolbar tool: a mark type, or `label`, which labels existing points instead of drawing a mark. */
5
+ export type GraphingTool = MarkType | 'label';
6
+ export interface Point {
7
+ /** Indicates x coordinate */
8
+ x: number;
9
+ /** Indicates y coordinate */
10
+ y: number;
11
+ }
12
+ /** A point of a mark, labelled with the label tool. */
13
+ export interface MarkPoint extends Point {
14
+ /** Label shown next to the point */
15
+ label?: string;
16
+ }
17
+ export interface Mark {
18
+ /** Indicates type of mark */
19
+ type: MarkType;
20
+ /** Indicates if mark is in build process */
21
+ building?: boolean;
22
+ /** Indicates x coordinate if type is point */
23
+ x?: number;
24
+ /** Indicates y coordinate if type is point */
25
+ y?: number;
26
+ /** Indicates label value for mark */
27
+ label?: string;
28
+ /** Not read by this element or `@pie-lib/graphing`. */
29
+ showLabel?: boolean;
30
+ /** Indicates where starts the mark if type is line, segment, ray, vector */
31
+ from?: MarkPoint;
32
+ /** Indicates where ends the mark if type is line, segment, ray, vector */
33
+ to?: MarkPoint;
34
+ /** Labelled midpoint of a line, ray, segment, vector, circle or polygon mark */
35
+ middle?: MarkPoint;
36
+ /** Indicated the root of mark if type is sine, parabola, absolute, exponential or circle */
37
+ root?: MarkPoint;
38
+ /** Indicated the edge of mark if type is sine, parabola, absolute, exponential or circle */
39
+ edge?: MarkPoint;
40
+ /** Indicates if mark is closed if type is polygon, sine */
41
+ closed?: boolean;
42
+ /** Indicates all mark's points if type is polygon */
43
+ points?: MarkPoint[];
44
+ }
45
+ export interface Answer {
46
+ /** Indicates name of answer */
47
+ name: string;
48
+ /** Indicates marks for the answer */
49
+ marks: Mark[];
50
+ }
51
+ /** The correct answer, plus alternates keyed `alternate<N>`, e.g. `alternate1`. */
52
+ export interface GraphingAnswers {
53
+ /** The correct answer */
54
+ correctAnswer: Answer;
55
+ [alternate: string]: Answer;
56
+ }
57
+ export interface Arrows {
58
+ /** Indicates if left arrow is enabled */
59
+ left: boolean;
60
+ /** Indicates if right arrow is enabled */
61
+ right: boolean;
62
+ /** Indicates if up arrow is enabled */
63
+ up: boolean;
64
+ /** Indicates if down arrow is enabled */
65
+ down: boolean;
66
+ }
67
+ export interface GraphSettings {
68
+ /** Min value */
69
+ min: number;
70
+ /** Max value */
71
+ max: number;
72
+ /** Padding value */
73
+ padding?: number;
74
+ /** Step value */
75
+ step: number;
76
+ /** Label step value */
77
+ labelStep: number;
78
+ /** Axis Label */
79
+ axisLabel: string;
80
+ }
81
+ export interface Graph {
82
+ /** Width for graph representation */
83
+ width: number;
84
+ /** Height for graph representation */
85
+ height: number;
86
+ }
87
+ export interface Labels {
88
+ /** Label for top side of the graph */
89
+ top?: string;
90
+ /** Label for bottom side of the graph */
91
+ bottom?: string;
92
+ /** Label for left side of the graph */
93
+ left?: string;
94
+ /** Label for right side of the graph */
95
+ right?: string;
96
+ }
97
+ /** Model for the Graphing Interaction */
98
+ export interface GraphingModel extends PieModel {
99
+ /** Indicates marks that are set as answers; alternates are keyed `alternate<N>` */
100
+ answers: GraphingAnswers;
101
+ /** Indicates if arrows are enabled; a boolean sets all four arrows (older models) */
102
+ arrows?: Arrows | boolean;
103
+ /** Indicates marks that have to be displayed in background */
104
+ backgroundMarks?: Mark[];
105
+ /**
106
+ * Indicates if coordinates of a point are displayed on hover
107
+ * @default false
108
+ */
109
+ coordinatesOnHover?: boolean;
110
+ /**
111
+ * Indicates the default grid configuration: an index into the configuration's `gridConfigurations`
112
+ * @default 0
113
+ * @minimum 0
114
+ */
115
+ defaultGridConfiguration?: number;
116
+ /** Indicates the default selected tool for the graph; empty means the first toolbar tool */
117
+ defaultTool?: MarkType | '';
118
+ /** Indicates if the graph dimensions are displayed */
119
+ dimensionsEnabled?: boolean;
120
+ /** Indicates domain settings for the graph */
121
+ domain?: GraphSettings;
122
+ /** Host-supplied CSS scoped to the element */
123
+ extraCSSRules?: ExtraCSSRules;
124
+ /** Indicates the graph line model */
125
+ graph?: Graph;
126
+ /**
127
+ * Indicates if the graph axes and labels are enabled
128
+ * @default true
129
+ */
130
+ includeAxes?: boolean;
131
+ /** Not read: the author copies it from the selected grid configuration. */
132
+ label?: string;
133
+ /** Indicates labels */
134
+ labels?: Labels;
135
+ /**
136
+ * Indicates if the graph labels are displayed
137
+ * @default true
138
+ */
139
+ labelsEnabled?: boolean;
140
+ /**
141
+ * Indicates the language of the component
142
+ * Supported options: en, es, en_US, en-US, es_ES, es-ES, es_MX, es-MX
143
+ */
144
+ language?: string;
145
+ /** Not read by this element; the author's padding toggle writes it. */
146
+ padding?: boolean;
147
+ /** Indicates prompt value */
148
+ prompt?: string;
149
+ /**
150
+ * Indicates if the prompt is enabled
151
+ * @default true
152
+ */
153
+ promptEnabled?: boolean;
154
+ /** Indicates range settings for the graph */
155
+ range?: GraphSettings;
156
+ /** Indicates rationale for the answer */
157
+ rationale?: string;
158
+ /**
159
+ * Indicates if Rationale are enabled
160
+ * @default true
161
+ */
162
+ rationaleEnabled?: boolean;
163
+ /** Indicates if Rubric is enabled */
164
+ rubricEnabled?: boolean;
165
+ /** Indicates scoring type */
166
+ scoringType?: 'dichotomous' | 'partial scoring';
167
+ /** Indicates if spellcheck is enabled for the author. Default value is true */
168
+ spellCheckEnabled?: boolean;
169
+ /**
170
+ * Indicates if some domain values will be synched to the range values
171
+ * @default false
172
+ */
173
+ standardGrid?: boolean;
174
+ /** Not read by this element. */
175
+ studentInstructions?: string;
176
+ /**
177
+ * Indicates if Student Instructions are enabled
178
+ * @default true
179
+ */
180
+ studentInstructionsEnabled?: boolean;
181
+ /** Indicates teacher instructions */
182
+ teacherInstructions?: string;
183
+ /**
184
+ * Indicates if Teacher Instructions are enabled
185
+ * @default true
186
+ */
187
+ teacherInstructionsEnabled?: boolean;
188
+ /** Indicates graph title */
189
+ title?: string;
190
+ /**
191
+ * Indicates if the graph title is displayed
192
+ * @default true
193
+ */
194
+ titleEnabled?: boolean;
195
+ /** Indicates the tools that have to be displayed in toolbar */
196
+ toolbarTools?: GraphingTool[];
197
+ }
198
+ /** A student response */
199
+ export interface GraphingSession {
200
+ /** Identifier of the session */
201
+ id?: string;
202
+ /** The element the session belongs to */
203
+ element?: string;
204
+ /** The marks the student drew */
205
+ answer?: Mark[];
206
+ }
207
+ export interface ArrowsConfigProp extends ConfigureProp {
208
+ /** Configuration for the left arrow checkbox */
209
+ left?: ConfigureProp;
210
+ /** Configuration for the right arrow checkbox */
211
+ right?: ConfigureProp;
212
+ /** Configuration for the up arrow checkbox */
213
+ up?: ConfigureProp;
214
+ /** Configuration for the down arrow checkbox */
215
+ down?: ConfigureProp;
216
+ }
217
+ export interface DimensionsConfigProp extends ConfigurePropWithEnabled {
218
+ /** Minimum graph dimension, in pixels */
219
+ min?: number;
220
+ /** Maximum graph dimension, in pixels */
221
+ max?: number;
222
+ /** Step between graph dimensions, in pixels */
223
+ step?: number;
224
+ }
225
+ export interface GridPanelConfigProp {
226
+ /** Label for the field in the Grid Setup Panel */
227
+ label?: string;
228
+ /** Indicates if the field is displayed in the Grid Setup Panel */
229
+ enabled?: boolean;
230
+ }
231
+ export interface AuthoringConfigProp extends ConfigurePropWithEnabled {
232
+ /** Indicates if the "Include axes and labels?" toggle is displayed in the Grid Setup Panel */
233
+ includeAxesEnabled?: boolean;
234
+ /** Indicates if the "Constrain to standard coordinate grid?" toggle is displayed in the Grid Setup Panel */
235
+ standardGridEnabled?: boolean;
236
+ /** Min value configuration */
237
+ min?: GridPanelConfigProp;
238
+ /** Max value configuration */
239
+ max?: GridPanelConfigProp;
240
+ /** Axis label configuration */
241
+ axisLabel?: GridPanelConfigProp;
242
+ /** Step value configuration */
243
+ step?: GridPanelConfigProp;
244
+ /** Label step value configuration */
245
+ labelStep?: GridPanelConfigProp;
246
+ }
247
+ /** A preset grid an author picks from; selecting it copies these values into the model. */
248
+ export interface GridConfiguration {
249
+ /** Name shown in the grid configuration picker */
250
+ label?: string;
251
+ /** Arrows for the grid */
252
+ arrows?: Arrows;
253
+ /** Domain settings for the grid */
254
+ domain?: GraphSettings;
255
+ /** Graph dimensions for the grid */
256
+ graph?: Graph;
257
+ /** Indicates if the graph axes and labels are enabled */
258
+ includeAxes?: boolean;
259
+ /** Labels for the grid */
260
+ labels?: Labels;
261
+ /** Indicates if padding is enabled */
262
+ padding?: boolean;
263
+ /** Range settings for the grid */
264
+ range?: GraphSettings;
265
+ /** Indicates if domain values are synched to the range values */
266
+ standardGrid?: boolean;
267
+ /** Graph title */
268
+ title?: string;
269
+ }
270
+ export interface LabelsConfigProp extends ConfigurePropWithEnabled {
271
+ /** Placeholder for the top label */
272
+ top?: string;
273
+ /** Placeholder for the right label */
274
+ right?: string;
275
+ /** Placeholder for the bottom label */
276
+ bottom?: string;
277
+ /** Placeholder for the left label */
278
+ left?: string;
279
+ }
280
+ export interface TitleConfigProp extends ConfigurePropWithEnabled {
281
+ /** Placeholder for the graph title */
282
+ placeholder?: string;
283
+ }
284
+ export interface GraphingConfiguration {
285
+ /** Base editable html input configuration regarding plugins that are enabled/disabled E.g. audio, video, image */
286
+ baseInputConfiguration?: EditableHtmlConfigureProp;
287
+ /** Grid Setup Panel configuration */
288
+ authoring?: AuthoringConfigProp;
289
+ /** Arrows configuration */
290
+ arrows?: ArrowsConfigProp;
291
+ /** Graph toolbar tools configuration */
292
+ availableTools?: GraphingTool[];
293
+ /** Coordinates configuration */
294
+ coordinatesOnHover?: ConfigureProp;
295
+ /** Minimum and maximum dimensions of the authoring view */
296
+ contentDimensions?: ContentDimensions;
297
+ /** Graph dimensions configuration */
298
+ graphDimensions?: DimensionsConfigProp;
299
+ /** Grid default configurations */
300
+ gridConfigurations?: GridConfiguration[];
301
+ /** Instructions shown at the top of the authoring view */
302
+ instruction?: ConfigureProp;
303
+ /** Padding configuration */
304
+ padding?: ConfigureProp;
305
+ /** Labels configuration */
306
+ labels?: LabelsConfigProp;
307
+ /** Language configuration */
308
+ language?: ConfigurePropWithEnabled;
309
+ /** Language choices configuration Only available if language is enabled */
310
+ languageChoices?: ConfigureLanguageOptions;
311
+ /** Configuration for the prompt */
312
+ prompt?: EditableHtmlPluginConfigureRequired;
313
+ /** Configuration for the rationale */
314
+ rationale?: EditableHtmlPluginConfigureRequired;
315
+ /** Indicates if the settings panel is not available */
316
+ settingsPanelDisabled?: boolean;
317
+ /** Configuration for the author's spellcheck */
318
+ spellCheck?: ConfigurePropWithEnabled;
319
+ /** Scoring Type configuration */
320
+ scoringType?: ConfigureProp;
321
+ /** Student Instructions configuration */
322
+ studentInstructions?: ConfigureProp;
323
+ /** Teacher Instructions configuration */
324
+ teacherInstructions?: EditableHtmlPluginConfigureRequired;
325
+ /** Graph title configuration */
326
+ title?: TitleConfigProp;
327
+ /** Maximum image width for input fields */
328
+ maxImageWidth?: ConfigureMaxImageDimensionsProp;
329
+ /** Maximum image height for input fields */
330
+ maxImageHeight?: ConfigureMaxImageDimensionsProp;
331
+ /** Rubric configuration - only relevant in environments that use pie-player-components */
332
+ withRubric?: ConfigureProp;
333
+ /** Configuration for editable-html */
334
+ mathMlOptions?: ConfigureMathMLProp;
335
+ /**
336
+ * Ability to remove incomplete tool added after switching current tool.
337
+ * @default false
338
+ */
339
+ removeIncompleteTool?: boolean;
340
+ /** Not read by this element. */
341
+ showPrompt?: boolean;
342
+ /** Not read by this element. */
343
+ promptLabel?: string;
344
+ /** Not read by this element. */
345
+ settingsPartialScoring?: boolean;
346
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-element/graphing",
3
- "version": "11.0.4-next.20261011174919",
3
+ "version": "11.0.4",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",
@@ -11,23 +11,24 @@
11
11
  "@emotion/react": "^11.14.0",
12
12
  "@mui/icons-material": "^7.3.4",
13
13
  "@mui/material": "^7.3.4",
14
- "@pie-lib/correct-answer-toggle": "5.0.4-next.20261011174919",
15
- "@pie-lib/graphing": "5.0.4-next.20261011174919",
16
- "@pie-lib/render-ui": "8.0.4-next.20261009061152",
17
- "@pie-lib/translator": "5.0.2-next.20261006160832",
14
+ "@pie-lib/correct-answer-toggle": "5.0.4",
15
+ "@pie-lib/graphing": "5.0.4",
16
+ "@pie-lib/render-ui": "8.0.4",
17
+ "@pie-lib/translator": "5.0.1",
18
18
  "debug": "^4.1.1",
19
19
  "prop-types": "^15.8.1",
20
- "@pie-element/shared-lodash": "0.1.3-next.20261006160832",
21
- "@pie-lib/config-ui": "14.0.4-next.20261011174919",
22
- "@pie-lib/editable-html-tip-tap": "3.0.4-next.20261009061152",
23
- "@pie-element/shared-math-rendering-mathjax": "0.1.5-next.20261009061152",
24
- "@pie-element/shared-configure-events": "0.1.2-next.20261002215153",
25
- "@pie-element/shared-controller-utils": "0.1.2-next.20261002215153",
26
- "@pie-lib/graphing-utils": "4.0.2-next.20261006160832",
27
- "@pie-element/shared-player-events": "0.1.2-next.20261002215153",
20
+ "@pie-element/shared-lodash": "0.1.2",
21
+ "@pie-lib/config-ui": "14.0.4",
22
+ "@pie-lib/editable-html-tip-tap": "3.0.4",
23
+ "@pie-element/shared-math-rendering-mathjax": "0.1.5",
24
+ "@pie-element/shared-configure-events": "0.1.1",
25
+ "@pie-element/shared-controller-utils": "0.1.2",
26
+ "@pie-lib/graphing-utils": "4.0.1",
27
+ "@pie-element/shared-player-events": "0.1.1",
28
28
  "clsx": "^2.1.1",
29
29
  "react": "^18.2.0",
30
- "react-dom": "^18.2.0"
30
+ "react-dom": "^18.2.0",
31
+ "@pie-element/shared-types": "0.2.1"
31
32
  },
32
33
  "exports": {
33
34
  ".": {
@@ -70,6 +71,9 @@
70
71
  "types": "./dist/runtime-support.d.ts",
71
72
  "default": "./dist/runtime-support.js"
72
73
  },
74
+ "./schemas/model.schema.json": "./dist/schemas/model.schema.json",
75
+ "./schemas/configuration.schema.json": "./dist/schemas/configuration.schema.json",
76
+ "./schemas/session.schema.json": "./dist/schemas/session.schema.json",
73
77
  "./package.json": "./package.json"
74
78
  },
75
79
  "type": "module",
@@ -83,7 +87,7 @@
83
87
  ],
84
88
  "sideEffects": false,
85
89
  "scripts": {
86
- "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 vite.config.iife.ts && bun x tsc --emitDeclarationOnly",
90
+ "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 vite.config.iife.ts && bun x tsc --emitDeclarationOnly && bun ../../../tools/schemas/build.ts",
87
91
  "dev": "bun x vite",
88
92
  "demo": "bun x vite --mode demo",
89
93
  "test": "bun x vitest run"
@@ -97,7 +101,7 @@
97
101
  },
98
102
  "browserEditorRuntime": {
99
103
  "name": "@pie-element/shared-editor-runtime",
100
- "version": "0.1.3-next.20261006160832",
104
+ "version": "0.1.2",
101
105
  "views": {
102
106
  "delivery": "editor-runtime/delivery",
103
107
  "author": "editor-runtime/author",