@pie-element/charting 12.1.2-next.2 → 12.1.2

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/CHANGELOG.json +487 -0
  2. package/CHANGELOG.md +2001 -0
  3. package/LICENSE.md +5 -0
  4. package/README.md +1 -0
  5. package/configure/CHANGELOG.json +292 -0
  6. package/configure/CHANGELOG.md +1768 -0
  7. package/configure/lib/charting-config.js +192 -0
  8. package/configure/lib/charting-config.js.map +1 -0
  9. package/configure/lib/configure.js +312 -0
  10. package/configure/lib/configure.js.map +1 -0
  11. package/configure/lib/correct-response.js +244 -0
  12. package/configure/lib/correct-response.js.map +1 -0
  13. package/configure/lib/defaults.js +233 -0
  14. package/configure/lib/defaults.js.map +1 -0
  15. package/configure/lib/index.js +120 -0
  16. package/configure/lib/index.js.map +1 -0
  17. package/configure/lib/utils.js +80 -0
  18. package/configure/lib/utils.js.map +1 -0
  19. package/configure/package.json +29 -0
  20. package/controller/CHANGELOG.json +262 -0
  21. package/controller/CHANGELOG.md +1212 -0
  22. package/controller/lib/defaults.js +42 -0
  23. package/controller/lib/defaults.js.map +1 -0
  24. package/controller/lib/index.js +434 -0
  25. package/controller/lib/index.js.map +1 -0
  26. package/controller/package.json +24 -0
  27. package/docs/config-schema.json +2440 -0
  28. package/docs/config-schema.json.md +1802 -0
  29. package/docs/demo/config.js +8 -0
  30. package/docs/demo/generate.js +63 -0
  31. package/docs/demo/index.html +1 -0
  32. package/docs/demo/session.js +26 -0
  33. package/docs/pie-schema.json +1731 -0
  34. package/docs/pie-schema.json.md +945 -0
  35. package/lib/index.js +78 -0
  36. package/lib/index.js.map +1 -0
  37. package/lib/main.js +167 -0
  38. package/lib/main.js.map +1 -0
  39. package/package.json +21 -85
  40. package/configure.js +0 -2
  41. package/controller.js +0 -1
  42. package/dist/author/charting-config.d.ts +0 -30
  43. package/dist/author/charting-config.js +0 -126
  44. package/dist/author/configure.d.ts +0 -29
  45. package/dist/author/configure.js +0 -205
  46. package/dist/author/correct-response.d.ts +0 -27
  47. package/dist/author/correct-response.js +0 -115
  48. package/dist/author/defaults.d.ts +0 -229
  49. package/dist/author/defaults.js +0 -186
  50. package/dist/author/index.d.ts +0 -51
  51. package/dist/author/index.js +0 -74
  52. package/dist/author/utils.d.ts +0 -42
  53. package/dist/author/utils.js +0 -244
  54. package/dist/browser/author/index.js +0 -1242
  55. package/dist/browser/author/index.js.map +0 -1
  56. package/dist/browser/chart-C1GUG3cz.js +0 -58920
  57. package/dist/browser/chart-C1GUG3cz.js.map +0 -1
  58. package/dist/browser/charting.css +0 -2
  59. package/dist/browser/controller/index.js +0 -194
  60. package/dist/browser/controller/index.js.map +0 -1
  61. package/dist/browser/delivery/index.js +0 -517
  62. package/dist/browser/delivery/index.js.map +0 -1
  63. package/dist/browser/dist-CA-Ok7CW.js +0 -330
  64. package/dist/browser/dist-CA-Ok7CW.js.map +0 -1
  65. package/dist/charting.css +0 -2
  66. package/dist/controller/defaults.d.ts +0 -44
  67. package/dist/controller/defaults.js +0 -33
  68. package/dist/controller/index.d.ts +0 -28
  69. package/dist/controller/index.js +0 -153
  70. package/dist/delivery/index.d.ts +0 -21
  71. package/dist/delivery/index.js +0 -46
  72. package/dist/delivery/main.d.ts +0 -23
  73. package/dist/delivery/main.js +0 -128
  74. package/dist/index.d.ts +0 -1
  75. package/dist/index.iife.d.ts +0 -8
  76. package/dist/index.iife.js +0 -395
  77. package/dist/index.js +0 -2
  78. package/dist/runtime-support.d.ts +0 -12
  79. package/dist/runtime-support.js +0 -12
@@ -1,186 +0,0 @@
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 };
@@ -1,51 +0,0 @@
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
- }
@@ -1,74 +0,0 @@
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 };
@@ -1,42 +0,0 @@
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
- };
@@ -1,244 +0,0 @@
1
- import { isEqual as e } from "@pie-element/shared-lodash";
2
- //#region src/author/utils.ts
3
- var t = [
4
- .01,
5
- .02,
6
- .04,
7
- .05,
8
- .0625,
9
- .1,
10
- .125,
11
- .2,
12
- .25,
13
- .5,
14
- 1,
15
- 2,
16
- 3,
17
- 4,
18
- 5,
19
- 8,
20
- 10,
21
- 12,
22
- 15,
23
- 20,
24
- 40,
25
- 50,
26
- 64,
27
- 100,
28
- 500,
29
- 1e3
30
- ], n = [
31
- .01,
32
- .02,
33
- .05,
34
- .1,
35
- .2,
36
- .25,
37
- .5,
38
- 1,
39
- 2,
40
- 5,
41
- 10,
42
- 20,
43
- 50,
44
- 100,
45
- 500,
46
- 1e3
47
- ], r = {
48
- .01: [
49
- 0,
50
- .01,
51
- .02,
52
- .04,
53
- .05,
54
- .1
55
- ],
56
- .02: [
57
- 0,
58
- .02,
59
- .04,
60
- .1
61
- ],
62
- .04: [
63
- 0,
64
- .04,
65
- .08,
66
- .16,
67
- .2
68
- ],
69
- .05: [
70
- 0,
71
- .05,
72
- .1,
73
- .2,
74
- .25
75
- ],
76
- .0625: [
77
- 0,
78
- .0625,
79
- .125,
80
- .25,
81
- .5
82
- ],
83
- .1: [
84
- 0,
85
- .1,
86
- .2,
87
- .4,
88
- .5,
89
- 1
90
- ],
91
- .125: [
92
- 0,
93
- .125,
94
- .25,
95
- .5,
96
- 1
97
- ],
98
- .2: [
99
- 0,
100
- .2,
101
- .5,
102
- .1
103
- ],
104
- .25: [
105
- 0,
106
- .25,
107
- .5,
108
- 1,
109
- 2
110
- ],
111
- .5: [
112
- 0,
113
- .5,
114
- 1,
115
- 2
116
- ],
117
- 1: [
118
- 0,
119
- 1,
120
- 2,
121
- 4,
122
- 5,
123
- 10
124
- ],
125
- 2: [
126
- 0,
127
- 2,
128
- 4,
129
- 8,
130
- 10
131
- ],
132
- 3: [
133
- 0,
134
- 3,
135
- 6,
136
- 12,
137
- 15
138
- ],
139
- 4: [
140
- 0,
141
- 4,
142
- 8,
143
- 16,
144
- 20
145
- ],
146
- 5: [
147
- 0,
148
- 5,
149
- 10,
150
- 20,
151
- 25
152
- ],
153
- 8: [
154
- 0,
155
- 8,
156
- 16,
157
- 32,
158
- 40,
159
- 64
160
- ],
161
- 10: [
162
- 0,
163
- 10,
164
- 20,
165
- 40,
166
- 50,
167
- 100
168
- ],
169
- 12: [
170
- 0,
171
- 12,
172
- 24
173
- ],
174
- 15: [
175
- 0,
176
- 15,
177
- 30,
178
- 60
179
- ],
180
- 20: [
181
- 0,
182
- 20,
183
- 40,
184
- 80,
185
- 100
186
- ],
187
- 40: [
188
- 0,
189
- 40,
190
- 80,
191
- 160,
192
- 200
193
- ],
194
- 50: [
195
- 0,
196
- 50,
197
- 100,
198
- 200,
199
- 250
200
- ],
201
- 64: [
202
- 0,
203
- 64,
204
- 128
205
- ],
206
- 100: [
207
- 0,
208
- 100,
209
- 200,
210
- 400,
211
- 500
212
- ],
213
- 500: [
214
- 0,
215
- 500,
216
- 1e3,
217
- 2500
218
- ],
219
- 1e3: [
220
- 0,
221
- 1e3,
222
- 2e3,
223
- 4e3,
224
- 5e3
225
- ]
226
- }, i = (e, r, i = !1) => {
227
- let a = 10 * (e.max - e.min) / r, o = a * 10, s = i && !n.includes(e.step) && t.includes(e.step);
228
- return (!i || s ? t : n).filter((e) => e >= a && e <= o);
229
- }, a = (e) => r[e] || [], o = (t, n, r, o) => {
230
- let s = i(t, n), c = a(t.step || 1);
231
- if (!e(r, s) && !s.includes(t.step)) {
232
- let e = i(t, n, !0)[0] || 1;
233
- return t.step = e, c = a(e), c.includes(t.labelStep) || (t.labelStep = e), {
234
- gridValues: s,
235
- labelValues: c
236
- };
237
- }
238
- return !e(o, c) && !c.includes(t.labelStep) && (t.labelStep = t.step), {
239
- gridValues: s,
240
- labelValues: c
241
- };
242
- };
243
- //#endregion
244
- export { o as applyConstraints, i as getGridValues, a as getLabelValues };