@pie-element/charting 12.1.1 → 12.1.2-next.1

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.
Files changed (79) hide show
  1. package/configure.js +2 -0
  2. package/controller.js +1 -0
  3. package/dist/author/charting-config.d.ts +30 -0
  4. package/dist/author/charting-config.js +126 -0
  5. package/dist/author/configure.d.ts +29 -0
  6. package/dist/author/configure.js +205 -0
  7. package/dist/author/correct-response.d.ts +27 -0
  8. package/dist/author/correct-response.js +115 -0
  9. package/dist/author/defaults.d.ts +229 -0
  10. package/dist/author/defaults.js +186 -0
  11. package/dist/author/index.d.ts +51 -0
  12. package/dist/author/index.js +74 -0
  13. package/dist/author/utils.d.ts +42 -0
  14. package/dist/author/utils.js +244 -0
  15. package/dist/browser/author/index.js +1242 -0
  16. package/dist/browser/author/index.js.map +1 -0
  17. package/dist/browser/chart-AvFvbpGV.js +58913 -0
  18. package/dist/browser/chart-AvFvbpGV.js.map +1 -0
  19. package/dist/browser/charting.css +2 -0
  20. package/dist/browser/controller/index.js +194 -0
  21. package/dist/browser/controller/index.js.map +1 -0
  22. package/dist/browser/delivery/index.js +517 -0
  23. package/dist/browser/delivery/index.js.map +1 -0
  24. package/dist/browser/dist-CA-Ok7CW.js +330 -0
  25. package/dist/browser/dist-CA-Ok7CW.js.map +1 -0
  26. package/dist/charting.css +2 -0
  27. package/dist/controller/defaults.d.ts +44 -0
  28. package/dist/controller/defaults.js +33 -0
  29. package/dist/controller/index.d.ts +28 -0
  30. package/dist/controller/index.js +153 -0
  31. package/dist/delivery/index.d.ts +21 -0
  32. package/dist/delivery/index.js +46 -0
  33. package/dist/delivery/main.d.ts +23 -0
  34. package/dist/delivery/main.js +128 -0
  35. package/dist/index.d.ts +1 -0
  36. package/dist/index.iife.d.ts +8 -0
  37. package/dist/index.iife.js +395 -0
  38. package/dist/index.js +2 -0
  39. package/dist/runtime-support.d.ts +12 -0
  40. package/dist/runtime-support.js +12 -0
  41. package/package.json +86 -21
  42. package/CHANGELOG.json +0 -487
  43. package/CHANGELOG.md +0 -1995
  44. package/LICENSE.md +0 -5
  45. package/README.md +0 -1
  46. package/configure/CHANGELOG.json +0 -292
  47. package/configure/CHANGELOG.md +0 -1762
  48. package/configure/lib/charting-config.js +0 -192
  49. package/configure/lib/charting-config.js.map +0 -1
  50. package/configure/lib/configure.js +0 -312
  51. package/configure/lib/configure.js.map +0 -1
  52. package/configure/lib/correct-response.js +0 -244
  53. package/configure/lib/correct-response.js.map +0 -1
  54. package/configure/lib/defaults.js +0 -233
  55. package/configure/lib/defaults.js.map +0 -1
  56. package/configure/lib/index.js +0 -120
  57. package/configure/lib/index.js.map +0 -1
  58. package/configure/lib/utils.js +0 -80
  59. package/configure/lib/utils.js.map +0 -1
  60. package/configure/package.json +0 -29
  61. package/controller/CHANGELOG.json +0 -262
  62. package/controller/CHANGELOG.md +0 -1212
  63. package/controller/lib/defaults.js +0 -42
  64. package/controller/lib/defaults.js.map +0 -1
  65. package/controller/lib/index.js +0 -434
  66. package/controller/lib/index.js.map +0 -1
  67. package/controller/package.json +0 -24
  68. package/docs/config-schema.json +0 -2440
  69. package/docs/config-schema.json.md +0 -1802
  70. package/docs/demo/config.js +0 -8
  71. package/docs/demo/generate.js +0 -63
  72. package/docs/demo/index.html +0 -1
  73. package/docs/demo/session.js +0 -26
  74. package/docs/pie-schema.json +0 -1731
  75. package/docs/pie-schema.json.md +0 -945
  76. package/lib/index.js +0 -78
  77. package/lib/index.js.map +0 -1
  78. package/lib/main.js +0 -167
  79. package/lib/main.js.map +0 -1
@@ -0,0 +1,229 @@
1
+ /**
2
+ * @synced-from pie-elements/packages/charting/configure/src/defaults.js
3
+ * @auto-generated
4
+ *
5
+ * This file is automatically synced from pie-elements and converted to TypeScript.
6
+ * Manual edits will be overwritten on next sync.
7
+ * To make changes, edit the upstream JavaScript file and run sync again.
8
+ */
9
+ /**
10
+ * NOTE: There's no functionality described for graphTitle,
11
+ * rationale, scoringType, studentInstructions, teacherInstructions
12
+ * so there's no implementation (they are only added in model)
13
+ */
14
+ declare const _default: {
15
+ model: {
16
+ addCategoryEnabled: boolean;
17
+ changeAddCategoryEnabled: boolean;
18
+ changeEditableEnabled: boolean;
19
+ changeInteractiveEnabled: boolean;
20
+ chartType: string;
21
+ correctAnswer: {};
22
+ data: never[];
23
+ domain: {};
24
+ graph: {
25
+ width: number;
26
+ height: number;
27
+ };
28
+ prompt: string;
29
+ promptEnabled: boolean;
30
+ range: {
31
+ label: string;
32
+ max: number;
33
+ min: number;
34
+ labelStep: number;
35
+ };
36
+ rationale: string;
37
+ rationaleEnabled: boolean;
38
+ scoringType: string;
39
+ studentInstructionsEnabled: boolean;
40
+ studentNewCategoryDefaultLabel: string;
41
+ teacherInstructions: string;
42
+ teacherInstructionsEnabled: boolean;
43
+ title: string;
44
+ };
45
+ configuration: {
46
+ baseInputConfiguration: {
47
+ h3: {
48
+ disabled: boolean;
49
+ };
50
+ audio: {
51
+ disabled: boolean;
52
+ };
53
+ video: {
54
+ disabled: boolean;
55
+ };
56
+ image: {
57
+ disabled: boolean;
58
+ };
59
+ textAlign: {
60
+ disabled: boolean;
61
+ };
62
+ showParagraphs: {
63
+ disabled: boolean;
64
+ };
65
+ separateParagraphs: {
66
+ disabled: boolean;
67
+ };
68
+ };
69
+ spellCheck: {
70
+ label: string;
71
+ settings: boolean;
72
+ enabled: boolean;
73
+ };
74
+ chartDimensions: {
75
+ settings: boolean;
76
+ label: string;
77
+ showInConfigPanel: boolean;
78
+ width: {
79
+ min: number;
80
+ max: number;
81
+ step: number;
82
+ };
83
+ height: {
84
+ min: number;
85
+ max: number;
86
+ step: number;
87
+ };
88
+ };
89
+ authorNewCategoryDefaults: {
90
+ settings: boolean;
91
+ label: string;
92
+ interactive: boolean;
93
+ editable: boolean;
94
+ };
95
+ availableChartTypes: {
96
+ bar: string;
97
+ histogram: string;
98
+ lineDot: string;
99
+ lineCross: string;
100
+ dotPlot: string;
101
+ linePlot: string;
102
+ };
103
+ chartTypeLabel: string;
104
+ studentNewCategoryDefaultLabel: {
105
+ settings: boolean;
106
+ label: string;
107
+ };
108
+ prompt: {
109
+ settings: boolean;
110
+ label: string;
111
+ required: boolean;
112
+ inputConfiguration: {
113
+ audio: {
114
+ disabled: boolean;
115
+ };
116
+ video: {
117
+ disabled: boolean;
118
+ };
119
+ image: {
120
+ disabled: boolean;
121
+ };
122
+ };
123
+ };
124
+ rationale: {
125
+ settings: boolean;
126
+ label: string;
127
+ required: boolean;
128
+ inputConfiguration: {
129
+ audio: {
130
+ disabled: boolean;
131
+ };
132
+ video: {
133
+ disabled: boolean;
134
+ };
135
+ image: {
136
+ disabled: boolean;
137
+ };
138
+ };
139
+ };
140
+ scoringType: {
141
+ settings: boolean;
142
+ label: string;
143
+ };
144
+ settingsPanelDisabled: boolean;
145
+ studentInstructions: {
146
+ settings: boolean;
147
+ label: string;
148
+ };
149
+ teacherInstructions: {
150
+ settings: boolean;
151
+ label: string;
152
+ required: boolean;
153
+ inputConfiguration: {
154
+ audio: {
155
+ disabled: boolean;
156
+ };
157
+ video: {
158
+ disabled: boolean;
159
+ };
160
+ image: {
161
+ disabled: boolean;
162
+ };
163
+ };
164
+ };
165
+ title: {
166
+ settings: boolean;
167
+ label: string;
168
+ };
169
+ instruction: {
170
+ settings: boolean;
171
+ label: string;
172
+ };
173
+ titlePlaceholder: {
174
+ settings: boolean;
175
+ label: string;
176
+ };
177
+ labelsPlaceholders: {
178
+ left: string;
179
+ right: string;
180
+ top: string;
181
+ bottom: string;
182
+ };
183
+ maxImageWidth: {
184
+ teacherInstructions: number;
185
+ prompt: number;
186
+ rationale: number;
187
+ };
188
+ maxImageHeight: {
189
+ teacherInstructions: number;
190
+ prompt: number;
191
+ rationale: number;
192
+ };
193
+ withRubric: {
194
+ settings: boolean;
195
+ label: string;
196
+ };
197
+ language: {
198
+ settings: boolean;
199
+ label: string;
200
+ enabled: boolean;
201
+ };
202
+ languageChoices: {
203
+ label: string;
204
+ options: never[];
205
+ };
206
+ chartingOptions: {
207
+ changeInteractive: {
208
+ settings: boolean;
209
+ authoringLabel: string;
210
+ settingsLabel: string;
211
+ };
212
+ changeEditable: {
213
+ settings: boolean;
214
+ authoringLabel: string;
215
+ settingsLabel: string;
216
+ };
217
+ addCategory: {
218
+ settings: boolean;
219
+ authoringLabel: string;
220
+ settingsLabel: string;
221
+ };
222
+ mathMlOptions: {
223
+ mmlOutput: boolean;
224
+ mmlEditing: boolean;
225
+ };
226
+ };
227
+ };
228
+ };
229
+ export default _default;
@@ -0,0 +1,186 @@
1
+ //#region src/author/defaults.ts
2
+ var e = {
3
+ model: {
4
+ addCategoryEnabled: !0,
5
+ changeAddCategoryEnabled: !1,
6
+ changeEditableEnabled: !1,
7
+ changeInteractiveEnabled: !1,
8
+ chartType: "lineCross",
9
+ correctAnswer: {},
10
+ data: [],
11
+ domain: {},
12
+ graph: {
13
+ width: 480,
14
+ height: 480
15
+ },
16
+ prompt: "",
17
+ promptEnabled: !0,
18
+ range: {
19
+ label: "",
20
+ max: 1,
21
+ min: 0,
22
+ labelStep: 1
23
+ },
24
+ rationale: "",
25
+ rationaleEnabled: !0,
26
+ scoringType: "all or nothing",
27
+ studentInstructionsEnabled: !0,
28
+ studentNewCategoryDefaultLabel: "New Category",
29
+ teacherInstructions: "",
30
+ teacherInstructionsEnabled: !0,
31
+ title: ""
32
+ },
33
+ configuration: {
34
+ baseInputConfiguration: {
35
+ h3: { disabled: !0 },
36
+ audio: { disabled: !1 },
37
+ video: { disabled: !1 },
38
+ image: { disabled: !1 },
39
+ textAlign: { disabled: !0 },
40
+ showParagraphs: { disabled: !1 },
41
+ separateParagraphs: { disabled: !0 }
42
+ },
43
+ spellCheck: {
44
+ label: "Spellcheck",
45
+ settings: !1,
46
+ enabled: !0
47
+ },
48
+ chartDimensions: {
49
+ settings: !1,
50
+ label: "Chart Dimensions",
51
+ showInConfigPanel: !0,
52
+ width: {
53
+ min: 50,
54
+ max: 700,
55
+ step: 20
56
+ },
57
+ height: {
58
+ min: 400,
59
+ max: 700,
60
+ step: 20
61
+ }
62
+ },
63
+ authorNewCategoryDefaults: {
64
+ settings: !1,
65
+ label: "Category",
66
+ interactive: !0,
67
+ editable: !1
68
+ },
69
+ availableChartTypes: {
70
+ bar: "Bar Chart",
71
+ histogram: "Histogram",
72
+ lineDot: "Line Chart ●",
73
+ lineCross: "Line Chart x",
74
+ dotPlot: "Dot/Line Plot ⬤",
75
+ linePlot: "Dot/Line Plot X"
76
+ },
77
+ chartTypeLabel: "ChartType",
78
+ studentNewCategoryDefaultLabel: {
79
+ settings: !1,
80
+ label: "Category"
81
+ },
82
+ prompt: {
83
+ settings: !0,
84
+ label: "Item Stem",
85
+ required: !1,
86
+ inputConfiguration: {
87
+ audio: { disabled: !1 },
88
+ video: { disabled: !1 },
89
+ image: { disabled: !1 }
90
+ }
91
+ },
92
+ rationale: {
93
+ settings: !0,
94
+ label: "Rationale",
95
+ required: !1,
96
+ inputConfiguration: {
97
+ audio: { disabled: !1 },
98
+ video: { disabled: !1 },
99
+ image: { disabled: !1 }
100
+ }
101
+ },
102
+ scoringType: {
103
+ settings: !1,
104
+ label: "Scoring Type"
105
+ },
106
+ settingsPanelDisabled: !1,
107
+ studentInstructions: {
108
+ settings: !1,
109
+ label: "Student Instructions"
110
+ },
111
+ teacherInstructions: {
112
+ settings: !0,
113
+ label: "Teacher Instructions",
114
+ required: !1,
115
+ inputConfiguration: {
116
+ audio: { disabled: !1 },
117
+ video: { disabled: !1 },
118
+ image: { disabled: !1 }
119
+ }
120
+ },
121
+ title: {
122
+ settings: !1,
123
+ label: "Chart Title"
124
+ },
125
+ instruction: {
126
+ settings: !1,
127
+ label: "This item type provides various types of interactive charts. Depending upon how an item is configured,\n students can change the heights of bars (or other similar chart elements) created by the author; relabel bars\n created by the author; and/or add new bars, label them, and set their heights."
128
+ },
129
+ titlePlaceholder: {
130
+ settings: !1,
131
+ label: "Click here to add a title"
132
+ },
133
+ labelsPlaceholders: {
134
+ left: "Click here to add a label for this axis",
135
+ right: "",
136
+ top: "",
137
+ bottom: "Click here to add a label for this axis"
138
+ },
139
+ maxImageWidth: {
140
+ teacherInstructions: 300,
141
+ prompt: 300,
142
+ rationale: 300
143
+ },
144
+ maxImageHeight: {
145
+ teacherInstructions: 300,
146
+ prompt: 300,
147
+ rationale: 300
148
+ },
149
+ withRubric: {
150
+ settings: !1,
151
+ label: "Add Rubric"
152
+ },
153
+ language: {
154
+ settings: !1,
155
+ label: "Specify Language",
156
+ enabled: !1
157
+ },
158
+ languageChoices: {
159
+ label: "Language Choices",
160
+ options: []
161
+ },
162
+ chartingOptions: {
163
+ changeInteractive: {
164
+ settings: !1,
165
+ authoringLabel: "Student can set value",
166
+ settingsLabel: "Allow non-interactive categories"
167
+ },
168
+ changeEditable: {
169
+ settings: !1,
170
+ authoringLabel: "Student can edit name",
171
+ settingsLabel: "Allow editable category names"
172
+ },
173
+ addCategory: {
174
+ settings: !1,
175
+ authoringLabel: "Student can add categories",
176
+ settingsLabel: "Allow changes to whether students can add categories"
177
+ },
178
+ mathMlOptions: {
179
+ mmlOutput: !1,
180
+ mmlEditing: !1
181
+ }
182
+ }
183
+ }
184
+ };
185
+ //#endregion
186
+ export { e as default };
@@ -0,0 +1,51 @@
1
+ /**
2
+ * @synced-from pie-elements/packages/charting/configure/src/index.js
3
+ * @auto-generated
4
+ *
5
+ * This file is automatically synced from pie-elements and converted to TypeScript.
6
+ * Manual edits will be overwritten on next sync.
7
+ * To make changes, edit the upstream JavaScript file and run sync again.
8
+ */
9
+ export default class GraphLinesConfigure extends HTMLElement {
10
+ static createDefaultModel: (model?: {}) => {
11
+ addCategoryEnabled: boolean;
12
+ changeAddCategoryEnabled: boolean;
13
+ changeEditableEnabled: boolean;
14
+ changeInteractiveEnabled: boolean;
15
+ chartType: string;
16
+ correctAnswer: {};
17
+ data: never[];
18
+ domain: {};
19
+ graph: {
20
+ width: number;
21
+ height: number;
22
+ };
23
+ prompt: string;
24
+ promptEnabled: boolean;
25
+ range: {
26
+ label: string;
27
+ max: number;
28
+ min: number;
29
+ labelStep: number;
30
+ };
31
+ rationale: string;
32
+ rationaleEnabled: boolean;
33
+ scoringType: string;
34
+ studentInstructionsEnabled: boolean;
35
+ studentNewCategoryDefaultLabel: string;
36
+ teacherInstructions: string;
37
+ teacherInstructionsEnabled: boolean;
38
+ title: string;
39
+ };
40
+ constructor();
41
+ set model(m: any);
42
+ set configuration(c: any);
43
+ onModelChanged(model: any): void;
44
+ onConfigurationChanged(config: any): void;
45
+ insertImage(handler: any): void;
46
+ onDeleteImage(src: any, done: any): void;
47
+ insertSound(handler: any): void;
48
+ onDeleteSound(src: any, done: any): void;
49
+ _render(): void;
50
+ disconnectedCallback(): void;
51
+ }
@@ -0,0 +1,74 @@
1
+ import e from "./configure.js";
2
+ import t from "./defaults.js";
3
+ import n from "react";
4
+ import { createRoot as r } from "react-dom/client";
5
+ import { renderMath as i } from "@pie-element/shared-math-rendering-mathjax";
6
+ import a from "debug";
7
+ import { DeleteImageEvent as o, DeleteSoundEvent as s, InsertImageEvent as c, InsertSoundEvent as l, ModelUpdatedEvent as u } from "@pie-element/shared-configure-events";
8
+ //#region src/author/index.ts
9
+ var d = a("pie-elements:graphing:configure"), f = class a extends HTMLElement {
10
+ static createDefaultModel = (e = {}) => ({
11
+ ...t.model,
12
+ ...e
13
+ });
14
+ constructor() {
15
+ super(), this._root = null, this._model = a.createDefaultModel(), this._configuration = t.configuration;
16
+ }
17
+ set model(e) {
18
+ this._model = a.createDefaultModel(e), this._render();
19
+ }
20
+ set configuration(e) {
21
+ let n = {
22
+ ...t.configuration,
23
+ ...e
24
+ };
25
+ this._configuration = n, n?.language?.enabled ? n?.languageChoices?.options?.length && (this._model.language = n?.languageChoices.options[0].value) : n.language.settings && this._model.language ? (this._configuration.language.enabled = !0, (!this._configuration.languageChoices.options || !this._configuration.languageChoices.options.length) && (this._configuration.languageChoices.options = []), this._configuration.languageChoices.options.find((e) => e.value === this._model.language) || this._configuration.languageChoices.options.push({
26
+ value: this._model.language,
27
+ label: this._model.language
28
+ })) : delete this._model.language, this._render();
29
+ }
30
+ onModelChanged(e) {
31
+ this._model = e, this._render(), d("[onModelChanged]: ", this._model), this.dispatchEvent(new u(this._model));
32
+ }
33
+ onConfigurationChanged(e) {
34
+ this._configuration = e, this._render();
35
+ }
36
+ insertImage(e) {
37
+ this.dispatchEvent(new c(e));
38
+ }
39
+ onDeleteImage(e, t) {
40
+ this.dispatchEvent(new o(e, t));
41
+ }
42
+ insertSound(e) {
43
+ this.dispatchEvent(new l(e));
44
+ }
45
+ onDeleteSound(e, t) {
46
+ this.dispatchEvent(new s(e, t));
47
+ }
48
+ _render() {
49
+ if (this._model) {
50
+ let t = n.createElement(e, {
51
+ onModelChanged: this.onModelChanged.bind(this),
52
+ onConfigurationChanged: this.onConfigurationChanged.bind(this),
53
+ model: this._model,
54
+ configuration: this._configuration,
55
+ imageSupport: {
56
+ add: this.insertImage.bind(this),
57
+ delete: this.onDeleteImage.bind(this)
58
+ },
59
+ uploadSoundSupport: {
60
+ add: this.insertSound.bind(this),
61
+ delete: this.onDeleteSound.bind(this)
62
+ }
63
+ });
64
+ this._root ||= r(this), this._root.render(t), queueMicrotask(() => {
65
+ i(this);
66
+ });
67
+ }
68
+ }
69
+ disconnectedCallback() {
70
+ this._root && this._root.unmount();
71
+ }
72
+ };
73
+ //#endregion
74
+ export { f as default };
@@ -0,0 +1,42 @@
1
+ /**
2
+ * @synced-from pie-elements/packages/charting/configure/src/utils.js
3
+ * @auto-generated
4
+ *
5
+ * This file is automatically synced from pie-elements and converted to TypeScript.
6
+ * Manual edits will be overwritten on next sync.
7
+ * To make changes, edit the upstream JavaScript file and run sync again.
8
+ */
9
+ export declare const VALID_LABEL_VALUES: {
10
+ 0.01: number[];
11
+ 0.02: number[];
12
+ 0.04: number[];
13
+ 0.05: number[];
14
+ 0.0625: number[];
15
+ 0.1: number[];
16
+ 0.125: number[];
17
+ 0.2: number[];
18
+ 0.25: number[];
19
+ 0.5: number[];
20
+ 1: number[];
21
+ 2: number[];
22
+ 3: number[];
23
+ 4: number[];
24
+ 5: number[];
25
+ 8: number[];
26
+ 10: number[];
27
+ 12: number[];
28
+ 15: number[];
29
+ 20: number[];
30
+ 40: number[];
31
+ 50: number[];
32
+ 64: number[];
33
+ 100: number[];
34
+ 500: number[];
35
+ 1000: number[];
36
+ };
37
+ export declare const getGridValues: (axis: any, size: any, prefferedValues?: boolean) => number[];
38
+ export declare const getLabelValues: (value: any) => any;
39
+ export declare const applyConstraints: (axis: any, size: any, oldGridValues: any, oldLabelValues: any) => {
40
+ gridValues: number[];
41
+ labelValues: any;
42
+ };