@pie-element/graphing 10.1.2-next.2 → 10.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 (86) hide show
  1. package/CHANGELOG.json +652 -0
  2. package/CHANGELOG.md +2049 -0
  3. package/LICENSE.md +5 -0
  4. package/README.md +1 -0
  5. package/configure/CHANGELOG.json +382 -0
  6. package/configure/CHANGELOG.md +1840 -0
  7. package/configure/lib/configure.js +328 -0
  8. package/configure/lib/configure.js.map +1 -0
  9. package/configure/lib/correct-response.js +484 -0
  10. package/configure/lib/correct-response.js.map +1 -0
  11. package/configure/lib/defaults.js +448 -0
  12. package/configure/lib/defaults.js.map +1 -0
  13. package/configure/lib/graphing-config.js +388 -0
  14. package/configure/lib/graphing-config.js.map +1 -0
  15. package/configure/lib/index.js +173 -0
  16. package/configure/lib/index.js.map +1 -0
  17. package/configure/lib/utils.js +122 -0
  18. package/configure/lib/utils.js.map +1 -0
  19. package/configure/package.json +30 -0
  20. package/controller/CHANGELOG.json +412 -0
  21. package/controller/CHANGELOG.md +1267 -0
  22. package/controller/lib/defaults.js +64 -0
  23. package/controller/lib/defaults.js.map +1 -0
  24. package/controller/lib/index.js +459 -0
  25. package/controller/lib/index.js.map +1 -0
  26. package/controller/lib/utils.js +451 -0
  27. package/controller/lib/utils.js.map +1 -0
  28. package/controller/package.json +24 -0
  29. package/docs/config-schema.json +3164 -0
  30. package/docs/config-schema.json.md +2293 -0
  31. package/docs/demo/config.js +8 -0
  32. package/docs/demo/generate.js +200 -0
  33. package/docs/demo/index.html +1 -0
  34. package/docs/demo/session.js +20 -0
  35. package/docs/pie-schema.json +3495 -0
  36. package/docs/pie-schema.json.md +1345 -0
  37. package/lib/index.js +69 -0
  38. package/lib/index.js.map +1 -0
  39. package/lib/main.js +161 -0
  40. package/lib/main.js.map +1 -0
  41. package/lib/utils.js +24 -0
  42. package/lib/utils.js.map +1 -0
  43. package/package.json +21 -87
  44. package/configure.js +0 -2
  45. package/controller.js +0 -1
  46. package/dist/author/configure.d.ts +0 -26
  47. package/dist/author/configure.js +0 -208
  48. package/dist/author/correct-response.d.ts +0 -54
  49. package/dist/author/correct-response.js +0 -303
  50. package/dist/author/defaults.d.ts +0 -294
  51. package/dist/author/defaults.js +0 -415
  52. package/dist/author/graphing-config.d.ts +0 -34
  53. package/dist/author/graphing-config.js +0 -244
  54. package/dist/author/index.d.ts +0 -59
  55. package/dist/author/index.js +0 -96
  56. package/dist/author/utils.d.ts +0 -43
  57. package/dist/author/utils.js +0 -260
  58. package/dist/browser/author/index.js +0 -4480
  59. package/dist/browser/author/index.js.map +0 -1
  60. package/dist/browser/container-DwOO2mgz.js +0 -57973
  61. package/dist/browser/container-DwOO2mgz.js.map +0 -1
  62. package/dist/browser/controller/index.js +0 -353
  63. package/dist/browser/controller/index.js.map +0 -1
  64. package/dist/browser/delivery/index.js +0 -683
  65. package/dist/browser/delivery/index.js.map +0 -1
  66. package/dist/browser/dist-BrN2xZtM.js +0 -547
  67. package/dist/browser/dist-BrN2xZtM.js.map +0 -1
  68. package/dist/browser/graphing.css +0 -2
  69. package/dist/controller/defaults.d.ts +0 -59
  70. package/dist/controller/defaults.js +0 -61
  71. package/dist/controller/index.d.ts +0 -34
  72. package/dist/controller/index.js +0 -179
  73. package/dist/controller/utils.d.ts +0 -37
  74. package/dist/controller/utils.js +0 -111
  75. package/dist/delivery/index.d.ts +0 -21
  76. package/dist/delivery/index.js +0 -43
  77. package/dist/delivery/main.d.ts +0 -23
  78. package/dist/delivery/main.js +0 -107
  79. package/dist/delivery/utils.d.ts +0 -22
  80. package/dist/graphing.css +0 -2
  81. package/dist/index.d.ts +0 -1
  82. package/dist/index.iife.d.ts +0 -8
  83. package/dist/index.iife.js +0 -406
  84. package/dist/index.js +0 -2
  85. package/dist/runtime-support.d.ts +0 -12
  86. package/dist/runtime-support.js +0 -12
@@ -1,59 +0,0 @@
1
- /**
2
- * @synced-from pie-elements/packages/graphing/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
- answers: any;
12
- defaultTool: any;
13
- range: {};
14
- graph: {};
15
- arrows: {
16
- left: boolean;
17
- right: boolean;
18
- up: boolean;
19
- down: boolean;
20
- };
21
- backgroundMarks: never[];
22
- coordinatesOnHover: boolean;
23
- defaultGridConfiguration: number;
24
- domain: {
25
- min: number;
26
- max: number;
27
- step: number;
28
- labelStep: number;
29
- axisLabel: string;
30
- };
31
- includeAxes: boolean;
32
- labels: {};
33
- labelsEnabled: boolean;
34
- padding: boolean;
35
- prompt: string;
36
- promptEnabled: boolean;
37
- rationale: string;
38
- rationaleEnabled: boolean;
39
- standardGrid: boolean;
40
- studentInstructionsEnabled: boolean;
41
- teacherInstructions: string;
42
- teacherInstructionsEnabled: boolean;
43
- title: string;
44
- titleEnabled: boolean;
45
- toolbarTools: string[];
46
- };
47
- constructor();
48
- set model(m: any);
49
- resetModelAfterConfigurationIsSet: any;
50
- set configuration(c: any);
51
- onModelChanged: any;
52
- onConfigurationChanged: any;
53
- insertImage: any;
54
- onDeleteImage: any;
55
- insertSound(handler: any): void;
56
- onDeleteSound(src: any, done: any): void;
57
- _render(): void;
58
- disconnectedCallback(): void;
59
- }
@@ -1,96 +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 { cloneDeep as o } from "@pie-element/shared-lodash";
8
- import { DeleteImageEvent as s, DeleteSoundEvent as c, InsertImageEvent as l, InsertSoundEvent as u, ModelUpdatedEvent as d } from "@pie-element/shared-configure-events";
9
- //#region src/author/index.ts
10
- var f = a("pie-elements:graphing:configure"), p = (e) => Object.keys(e || {}).sort().reduce((t, n) => (n !== "correctAnswer" && (t[n] = e[n]), t), {}), m = class a extends HTMLElement {
11
- static createDefaultModel = (e = {}) => {
12
- let n = {
13
- ...t.model,
14
- ...e
15
- }, { answers: r = {}, domain: i = {}, defaultTool: a, graph: o = {}, range: s = {}, standardGrid: c, toolbarTools: l } = n, u = (l || []).filter((e) => e !== "label"), d = a || u.length && u[0] || "";
16
- return {
17
- ...n,
18
- answers: r && r.correctAnswer && {
19
- correctAnswer: r.correctAnswer,
20
- ...p(r)
21
- } || r,
22
- defaultTool: d,
23
- range: c && {
24
- ...s,
25
- min: i.min,
26
- max: i.max,
27
- step: i.step,
28
- labelStep: i.labelStep
29
- } || s,
30
- graph: c && {
31
- ...o,
32
- height: o.width
33
- } || o
34
- };
35
- };
36
- constructor() {
37
- super(), this._root = null, this._model = a.createDefaultModel(), this._configuration = t.configuration;
38
- }
39
- set model(e) {
40
- this._model = a.createDefaultModel(e), this._modelCopy = o(this._model), this._render();
41
- }
42
- resetModelAfterConfigurationIsSet = () => {
43
- let e = document.querySelectorAll("pie-author");
44
- this.hasPlayerAsParent = Array.from(e).some((e) => e.contains(this)), this.hasPlayerAsParent && (this._modelCopy ? this._model = this._modelCopy : delete this._modelCopy);
45
- };
46
- set configuration(e) {
47
- this._configuration = {
48
- ...t.configuration,
49
- ...e
50
- }, this.resetModelAfterConfigurationIsSet(), e.language?.enabled ? e.languageChoices?.options?.length && (this._model.language = e.languageChoices.options[0].value) : e.language.settings ? this._model.language && (this._configuration.language.enabled = !0) : delete this._model.language, this._render();
51
- }
52
- onModelChanged = (e) => {
53
- this._model = e, this._render(), f("[onModelChanged]: ", this._model), this.dispatchEvent(new d(this._model));
54
- };
55
- onConfigurationChanged = (e) => {
56
- this._configuration = e, this._render();
57
- };
58
- insertImage = (e) => {
59
- this.dispatchEvent(new l(e));
60
- };
61
- onDeleteImage = (e, t) => {
62
- this.dispatchEvent(new s(e, t));
63
- };
64
- insertSound(e) {
65
- this.dispatchEvent(new u(e));
66
- }
67
- onDeleteSound(e, t) {
68
- this.dispatchEvent(new c(e, t));
69
- }
70
- _render() {
71
- if (this._model) {
72
- let t = n.createElement(e, {
73
- onModelChanged: this.onModelChanged,
74
- onConfigurationChanged: this.onConfigurationChanged,
75
- model: this._model,
76
- configuration: this._configuration,
77
- imageSupport: {
78
- add: this.insertImage,
79
- delete: this.onDeleteImage
80
- },
81
- uploadSoundSupport: {
82
- add: this.insertSound.bind(this),
83
- delete: this.onDeleteSound.bind(this)
84
- }
85
- });
86
- this._root ||= r(this), this._root.render(t), queueMicrotask(() => {
87
- i(this);
88
- });
89
- }
90
- }
91
- disconnectedCallback() {
92
- this._root && this._root.unmount();
93
- }
94
- };
95
- //#endregion
96
- export { m as default };
@@ -1,43 +0,0 @@
1
- /**
2
- * @synced-from pie-elements/packages/graphing/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
- };
43
- export declare const filterPlotableMarks: (domain: any, range: any, answers: any) => {};
@@ -1,260 +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);
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
- }, s = (e) => {
243
- let t = [], n = 0;
244
- for (; n >= e.min && t.indexOf(n) < 0;) t.push(n), n = Math.round((n - e.step) * 1e4) / 1e4;
245
- for (n = Math.round(e.step * 1e4) / 1e4; n <= e.max && t.indexOf(n) < 0;) t.push(n), n = Math.round((n + e.step) * 1e4) / 1e4;
246
- return t ? t.filter((t) => t >= e.min && t <= e.max) : [];
247
- }, c = (e, t, n) => {
248
- let r = s(e), i = s(t), a = (e, t) => r.includes(e) && i.includes(t);
249
- return Object.entries(n || {}).reduce((e, [t, n]) => (e[t] = {
250
- ...n,
251
- marks: (n.marks || []).filter((e) => {
252
- if (e.type === "point") return a(e.x, e.y);
253
- if (e.type === "polygon") return !e.points.find((e) => !a(e.x, e.y));
254
- let t = e.from || e.root, n = e.to || e.edge;
255
- return e.building ? a(t.x, t.y) : a(t.x, t.y) && a(n.x, n.y);
256
- })
257
- }, e), {});
258
- };
259
- //#endregion
260
- export { o as applyConstraints, c as filterPlotableMarks, i as getGridValues, a as getLabelValues };