@pie-element/charting 12.4.0-beta.7 → 13.0.0-next.20261002094057

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 (91) hide show
  1. package/author.js +2 -0
  2. package/configure.js +2 -0
  3. package/controller.js +1 -0
  4. package/dist/author/charting-config.d.ts +30 -0
  5. package/dist/author/charting-config.js +126 -0
  6. package/dist/author/configure.d.ts +29 -0
  7. package/dist/author/configure.js +205 -0
  8. package/dist/author/correct-response.d.ts +27 -0
  9. package/dist/author/correct-response.js +115 -0
  10. package/dist/author/defaults.d.ts +229 -0
  11. package/dist/author/defaults.js +186 -0
  12. package/dist/author/index.d.ts +52 -0
  13. package/dist/author/index.js +77 -0
  14. package/dist/author/utils.d.ts +42 -0
  15. package/dist/author/utils.js +244 -0
  16. package/dist/browser/assets/Symbola-4c507403.woff2 +0 -0
  17. package/dist/browser/author/index.js +3186 -0
  18. package/dist/browser/author/index.js.map +1 -0
  19. package/dist/browser/chart-BCxOiFqK.js +53118 -0
  20. package/dist/browser/chart-BCxOiFqK.js.map +1 -0
  21. package/dist/browser/controller/index.js +194 -0
  22. package/dist/browser/controller/index.js.map +1 -0
  23. package/dist/browser/delivery/index.js +535 -0
  24. package/dist/browser/delivery/index.js.map +1 -0
  25. package/dist/browser/dist-D6aoYeoC.js +334 -0
  26. package/dist/browser/dist-D6aoYeoC.js.map +1 -0
  27. package/dist/browser/editor-runtime/assets/Symbola-4c507403.woff2 +0 -0
  28. package/dist/browser/editor-runtime/author/index.js +3186 -0
  29. package/dist/browser/editor-runtime/author/index.js.map +1 -0
  30. package/dist/browser/editor-runtime/chart-DWIYhZ_P.js +36709 -0
  31. package/dist/browser/editor-runtime/chart-DWIYhZ_P.js.map +1 -0
  32. package/dist/browser/editor-runtime/controller/index.js +194 -0
  33. package/dist/browser/editor-runtime/controller/index.js.map +1 -0
  34. package/dist/browser/editor-runtime/delivery/index.js +535 -0
  35. package/dist/browser/editor-runtime/delivery/index.js.map +1 -0
  36. package/dist/browser/editor-runtime/dist-4_gVzyUN.js +334 -0
  37. package/dist/browser/editor-runtime/dist-4_gVzyUN.js.map +1 -0
  38. package/dist/charting.css +2 -0
  39. package/dist/controller/defaults.d.ts +44 -0
  40. package/dist/controller/defaults.js +33 -0
  41. package/dist/controller/index.d.ts +28 -0
  42. package/dist/controller/index.js +153 -0
  43. package/dist/delivery/index.d.ts +24 -0
  44. package/dist/delivery/index.js +64 -0
  45. package/dist/delivery/main.d.ts +23 -0
  46. package/dist/delivery/main.js +128 -0
  47. package/dist/index.d.ts +1 -0
  48. package/dist/index.iife.d.ts +8 -0
  49. package/dist/index.iife.js +359 -0
  50. package/dist/index.js +2 -0
  51. package/dist/runtime-support.d.ts +12 -0
  52. package/dist/runtime-support.js +12 -0
  53. package/package.json +94 -21
  54. package/CHANGELOG.json +0 -487
  55. package/CHANGELOG.md +0 -2045
  56. package/LICENSE.md +0 -5
  57. package/README.md +0 -1
  58. package/configure/CHANGELOG.json +0 -292
  59. package/configure/CHANGELOG.md +0 -1811
  60. package/configure/lib/charting-config.js +0 -192
  61. package/configure/lib/charting-config.js.map +0 -1
  62. package/configure/lib/configure.js +0 -312
  63. package/configure/lib/configure.js.map +0 -1
  64. package/configure/lib/correct-response.js +0 -244
  65. package/configure/lib/correct-response.js.map +0 -1
  66. package/configure/lib/defaults.js +0 -233
  67. package/configure/lib/defaults.js.map +0 -1
  68. package/configure/lib/index.js +0 -124
  69. package/configure/lib/index.js.map +0 -1
  70. package/configure/lib/utils.js +0 -80
  71. package/configure/lib/utils.js.map +0 -1
  72. package/configure/package.json +0 -29
  73. package/controller/CHANGELOG.json +0 -262
  74. package/controller/CHANGELOG.md +0 -1254
  75. package/controller/lib/defaults.js +0 -42
  76. package/controller/lib/defaults.js.map +0 -1
  77. package/controller/lib/index.js +0 -434
  78. package/controller/lib/index.js.map +0 -1
  79. package/controller/package.json +0 -24
  80. package/docs/config-schema.json +0 -2440
  81. package/docs/config-schema.json.md +0 -1802
  82. package/docs/demo/config.js +0 -8
  83. package/docs/demo/generate.js +0 -66
  84. package/docs/demo/index.html +0 -1
  85. package/docs/demo/session.js +0 -26
  86. package/docs/pie-schema.json +0 -1731
  87. package/docs/pie-schema.json.md +0 -945
  88. package/lib/index.js +0 -118
  89. package/lib/index.js.map +0 -1
  90. package/lib/main.js +0 -167
  91. package/lib/main.js.map +0 -1
@@ -0,0 +1,44 @@
1
+ /**
2
+ * @synced-from pie-elements/packages/charting/controller/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
+ addCategoryEnabled: boolean;
16
+ changeAddCategoryEnabled: boolean;
17
+ changeEditableEnabled: boolean;
18
+ changeInteractiveEnabled: boolean;
19
+ chartType: string;
20
+ correctAnswer: {};
21
+ data: never[];
22
+ domain: {};
23
+ graph: {
24
+ width: number;
25
+ height: number;
26
+ };
27
+ prompt: string;
28
+ promptEnabled: boolean;
29
+ range: {
30
+ label: string;
31
+ max: number;
32
+ min: number;
33
+ labelStep: number;
34
+ };
35
+ rationale: string;
36
+ rationaleEnabled: boolean;
37
+ scoringType: string;
38
+ studentInstructionsEnabled: boolean;
39
+ studentNewCategoryDefaultLabel: string;
40
+ teacherInstructions: string;
41
+ teacherInstructionsEnabled: boolean;
42
+ title: string;
43
+ };
44
+ export default _default;
@@ -0,0 +1,33 @@
1
+ //#region src/controller/defaults.ts
2
+ var e = {
3
+ addCategoryEnabled: !0,
4
+ changeAddCategoryEnabled: !1,
5
+ changeEditableEnabled: !1,
6
+ changeInteractiveEnabled: !1,
7
+ chartType: "lineCross",
8
+ correctAnswer: {},
9
+ data: [],
10
+ domain: {},
11
+ graph: {
12
+ width: 480,
13
+ height: 480
14
+ },
15
+ prompt: "",
16
+ promptEnabled: !0,
17
+ range: {
18
+ label: "",
19
+ max: 1,
20
+ min: 0,
21
+ labelStep: 1
22
+ },
23
+ rationale: "",
24
+ rationaleEnabled: !0,
25
+ scoringType: "all or nothing",
26
+ studentInstructionsEnabled: !0,
27
+ studentNewCategoryDefaultLabel: "New Category",
28
+ teacherInstructions: "",
29
+ teacherInstructionsEnabled: !0,
30
+ title: ""
31
+ };
32
+ //#endregion
33
+ export { e as default };
@@ -0,0 +1,28 @@
1
+ /**
2
+ * @synced-from pie-elements/packages/charting/controller/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 declare const checkLabelsEquality: (givenAnswerLabel: any, correctAnswerLabel: any) => boolean;
10
+ export declare const setCorrectness: (answers: any, partialScoring: any) => any;
11
+ export declare const normalize: (question: any) => any;
12
+ export declare const getScore: (question: any, session: any, env?: {}) => {
13
+ score: number;
14
+ answers: any;
15
+ };
16
+ /**
17
+ * Generates detailed trace log for scoring evaluation
18
+ * @param {Object} model - the question model
19
+ * @param {Object} session - the student session
20
+ * @param {Object} env - the environment
21
+ * @returns {Array} traceLog - array of trace messages
22
+ */
23
+ export declare const getLogTrace: (model: any, session: any, env: any) => string[];
24
+ export declare const filterCategories: (categories: any) => any;
25
+ export declare function model(question: any, session: any, env: any): Promise<unknown>;
26
+ export declare function outcome(model: any, session: any, env: any): Promise<unknown>;
27
+ export declare const createCorrectResponseSession: (question: any, env: any) => Promise<unknown>;
28
+ export declare const validate: (model?: {}, config?: {}) => {};
@@ -0,0 +1,153 @@
1
+ import e from "./defaults.js";
2
+ import { isEmpty as t, isEqual as n, pick as r } from "@pie-element/shared-lodash";
3
+ import i from "debug";
4
+ import { partialScoring as a } from "@pie-element/shared-controller-utils";
5
+ //#region src/controller/index.ts
6
+ var o = i("@pie-element:graphing:controller"), s = (e) => (e || "").toLowerCase(), c = (e, t) => s(e) === s(t), l = (e, t) => e ? e.map((e) => ({
7
+ ...e,
8
+ correctness: {
9
+ value: t ? "incorrect" : "correct",
10
+ label: t ? "incorrect" : "correct"
11
+ }
12
+ })) : [], u = (t) => ({
13
+ ...e,
14
+ ...t
15
+ }), d = (e, t, n = {}) => {
16
+ let { correctAnswer: r, data: i = [], scoringType: o } = e, u = [], d = a.enabled({ partialScoring: o === void 0 ? o : o === "partial scoring" }, n), { data: f = [] } = r || {}, m = p(i), h = l(t && t.answer || m, d), g = 0;
17
+ if (d) {
18
+ let e = 0, t = 0, n = (n, r) => {
19
+ let { value: i, label: a, index: o } = n, s = i === r.value, l = c(a, r.label);
20
+ e += 2, s && (t += 1, n.correctness.value = "correct"), l && (t += 1, n.correctness.label = "correct"), s && l && u.push({
21
+ label: a,
22
+ index: o
23
+ });
24
+ };
25
+ f.forEach((r, i) => {
26
+ let a = m[i], o = h[i];
27
+ o ? a ? !a.editable && o.interactive ? (e += 1, o.value === r.value && (t += 1, o.correctness.value = "correct", u.push({
28
+ label: o.label,
29
+ index: i
30
+ })), o.correctness.label = "correct") : a.editable && o.interactive ? n(o, r) : o.interactive || (o.correctness.value = "correct", o.correctness.label = "correct", u.push({
31
+ label: o.label,
32
+ index: i
33
+ })) : n(o, r) : e += 2;
34
+ }), g = e ? t / e : 0;
35
+ } else g = +(f.length === h.length), h = h.map((e, t) => {
36
+ let n = f[t], r = n ? e.value === n.value : !1, i = n ? s(e.label) === s(n.label) : !1;
37
+ return (!r || !i) && (g = 0), r && i && u.push({
38
+ label: e.label,
39
+ index: t
40
+ }), {
41
+ ...e,
42
+ correctness: {
43
+ value: r ? "correct" : "incorrect",
44
+ label: i ? "correct" : "incorrect"
45
+ }
46
+ };
47
+ });
48
+ let _ = {
49
+ score: parseFloat(g.toFixed(2)),
50
+ answers: h
51
+ };
52
+ return n.extraProps && n.extraProps.correctResponseEnabled && (_.correctResponses = u), _;
53
+ }, f = (e, t, n) => {
54
+ let r = [], { correctAnswer: i, data: o = [], scoringType: s } = e || {}, { data: l = [] } = i || {}, u = t && t.answer || [], f = a.enabled({ partialScoring: s === void 0 ? s : s === "partial scoring" }, n), m = p(o), h = u.length > 0 ? p(u) : m;
55
+ if (u.length || r.push("Student did not modify the chart. Initial chart is scored."), l.forEach((e, t) => {
56
+ let n = m[t], i = h[t];
57
+ if (!i) {
58
+ r.push(`Category ${t + 1}: missing (expected value '${e.value}', label '${e.label}').`);
59
+ return;
60
+ }
61
+ let a = i.value === e.value, o = c(i.label, e.label);
62
+ if (!i.interactive) {
63
+ r.push(`Category ${t + 1}: non-interactive category treated as correct.`);
64
+ return;
65
+ }
66
+ if (u.length > 0) {
67
+ let e = !n || i.value !== n.value, s = !n || !c(i.label, n.label);
68
+ if (!e && !s) {
69
+ a && o ? r.push(`Category ${t + 1}: unchanged from initial value and correct.`) : r.push(`Category ${t + 1}: unchanged from initial value but incorrect.`);
70
+ return;
71
+ }
72
+ let l = [];
73
+ e && l.push(`value ${a ? "correct" : "incorrect"}`), s && l.push(`label ${o ? "correct" : "incorrect"}`), r.push(`Category ${t + 1}: modified - ${l.join(", ")}.`);
74
+ } else a && o ? r.push(`Category ${t + 1}: initial values are correct.`) : a ? r.push(`Category ${t + 1}: initial value correct, label incorrect.`) : o ? r.push(`Category ${t + 1}: initial value incorrect, label correct.`) : r.push(`Category ${t + 1}: initial value and label incorrect.`);
75
+ }), h.length > l.length) {
76
+ let e = h.length - l.length;
77
+ r.push(`${e} extra category(ies) provided beyond expected number.`);
78
+ }
79
+ f ? (r.push("Score calculated using partial scoring."), r.push("Student receives credit for each correct value and label independently.")) : (r.push("Score calculated using all-or-nothing scoring."), r.push("Student must match all category values and labels exactly for full credit."));
80
+ let g = d(e, t, n);
81
+ return r.push(`Score: ${g.score}.`), r;
82
+ }, p = (e) => e ? e.map(({ deletable: e, ...t }) => t) : [];
83
+ function m(e, t, n) {
84
+ return new Promise((r) => {
85
+ let i = u(e), { addCategoryEnabled: a, chartType: s, data: c, domain: l, graph: f, prompt: m, promptEnabled: h, range: g, rationale: _, title: v, rationaleEnabled: y, teacherInstructions: b, teacherInstructionsEnabled: x, correctAnswer: S, scoringType: C, studentNewCategoryDefaultLabel: w, language: T, extraCSSRules: E } = i, D = {
86
+ addCategoryEnabled: a,
87
+ chartType: s,
88
+ data: p(c),
89
+ domain: l,
90
+ graph: f,
91
+ prompt: h ? m : null,
92
+ range: g,
93
+ rationale: _,
94
+ title: v,
95
+ size: f,
96
+ showToggle: !1,
97
+ correctness: {
98
+ correctness: "incorrect",
99
+ score: "0%"
100
+ },
101
+ disabled: n.mode !== "gather",
102
+ scoringType: C,
103
+ studentNewCategoryDefaultLabel: w,
104
+ language: T,
105
+ env: n,
106
+ extraCSSRules: E
107
+ }, O = d(i, t, n), k = p(O.answers);
108
+ n.mode === "view" && (D.correctedAnswer = k.map(({ correctness: e, ...t }) => ({
109
+ ...t,
110
+ interactive: !1
111
+ })), D.addCategoryEnabled = !1), n.mode === "evaluate" && (D.correctedAnswer = k, D.correctAnswer = S, D.showToggle = !!S?.data?.length && O.score !== 1, D.addCategoryEnabled = !1, D.showKeyLegend = !0), n.role === "instructor" && (n.mode === "view" || n.mode === "evaluate") ? (D.rationale = y ? _ : null, D.teacherInstructions = x ? b : null) : (D.rationale = null, D.teacherInstructions = null), o("base: ", D), r(D);
112
+ });
113
+ }
114
+ function h(e, n, r) {
115
+ return new Promise((i) => {
116
+ let a = f(e, n, r), o = d(e, n, r), s = {
117
+ score: o.score,
118
+ empty: !n || t(n),
119
+ traceLog: a
120
+ };
121
+ r.extraProps && r.extraProps.correctResponseEnabled && (s.extraProps = { correctResponse: o.correctResponses }), i(s);
122
+ });
123
+ }
124
+ var g = (e, t) => new Promise((n) => {
125
+ if (t.mode !== "evaluate" && t.role === "instructor") {
126
+ let { correctAnswer: r } = e, i = r && r.data;
127
+ if (t.mode === "gather") {
128
+ let { data: t } = e;
129
+ i = (r && r.data || []).map((e, n) => ({
130
+ ...t[n],
131
+ ...e
132
+ }));
133
+ }
134
+ n({
135
+ answer: i,
136
+ id: "1"
137
+ });
138
+ } else return n(null);
139
+ }), _ = (e) => (e || "").replaceAll(/<[^>]*>/g, ""), v = (e) => (e || "").replace(/(<(?!img|iframe|source)([^>]+)>)/gi, ""), y = (e = {}, i = {}) => {
140
+ let { correctAnswer: a, data: o } = e || {}, { data: s } = a || {}, c = s || [], l = {}, u = {}, d = {};
141
+ return [
142
+ "teacherInstructions",
143
+ "prompt",
144
+ "rationale"
145
+ ].forEach((t) => {
146
+ i[t]?.required && !v(e[t]) && (l[t] = "This field is required.");
147
+ }), c.forEach((e, t) => {
148
+ let { label: n } = e;
149
+ _(n) ? c.some((e, r) => e.label === n && t !== r) && (d[t] = "Category names should be unique. ") : d[t] = "Content should not be empty. ";
150
+ }), c.length < 1 || c.length > 20 ? u.categoriesError = "The correct answer should include between 1 and 20 categories." : n(o.map((e) => r(e, "value", "label")), s.map((e) => r(e, "value", "label"))) && (u.identicalError = "Correct answer should not be identical to the chart’s initial state"), t(d) || (l.categoryErrors = d), t(u) || (l.correctAnswerErrors = u), l;
151
+ };
152
+ //#endregion
153
+ export { c as checkLabelsEquality, g as createCorrectResponseSession, p as filterCategories, f as getLogTrace, d as getScore, m as model, u as normalize, h as outcome, l as setCorrectness, y as validate };
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @synced-from pie-elements/packages/charting/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
+ import Main from './main.js';
10
+ export { Main as Component };
11
+ export default class Graphing extends HTMLElement {
12
+ constructor();
13
+ _scheduleMathRender: any;
14
+ _initMathObserver(): void;
15
+ _disconnectMathObserver(): void;
16
+ set model(m: any);
17
+ set session(s: any);
18
+ get session(): any;
19
+ connectedCallback(): void;
20
+ isComplete: (answer: any) => boolean;
21
+ changeAnswers: any;
22
+ _render(): void;
23
+ disconnectedCallback(): void;
24
+ }
@@ -0,0 +1,64 @@
1
+ import { Main as e } from "./main.js";
2
+ import t from "react";
3
+ import { createRoot as n } from "react-dom/client";
4
+ import { ModelSetEvent as r, SessionChangedEvent as i } from "@pie-element/shared-player-events";
5
+ import { renderMath as a } from "@pie-element/shared-math-rendering-mathjax";
6
+ //#region src/delivery/index.ts
7
+ var o = class extends HTMLElement {
8
+ constructor() {
9
+ super(), this._root = null, this._mathObserver = null, this._mathRenderPending = !1;
10
+ }
11
+ _scheduleMathRender = () => {
12
+ this._mathRenderPending || (this._mathRenderPending = !0, requestAnimationFrame(() => {
13
+ this._mathObserver && this._mathObserver.disconnect(), a(this), this._mathRenderPending = !1, setTimeout(() => {
14
+ this._mathObserver && this._mathObserver.observe(this, {
15
+ childList: !0,
16
+ subtree: !0
17
+ });
18
+ }, 50);
19
+ }));
20
+ };
21
+ _initMathObserver() {
22
+ this._mathObserver || (this._mathObserver = new MutationObserver(this._scheduleMathRender), this._mathObserver.observe(this, {
23
+ childList: !0,
24
+ subtree: !0
25
+ }));
26
+ }
27
+ _disconnectMathObserver() {
28
+ this._mathObserver &&= (this._mathObserver.disconnect(), null);
29
+ }
30
+ set model(e) {
31
+ this._model = e, this._session && this.isComplete(this._session.answer) ? this.dispatchEvent(new r(this.tagName.toLowerCase(), !0, !!this._model)) : this.dispatchEvent(new r(this.tagName.toLowerCase(), !1, !!this._model)), this._render();
32
+ }
33
+ set session(e) {
34
+ this._session = e, this._render();
35
+ }
36
+ get session() {
37
+ return this._session;
38
+ }
39
+ connectedCallback() {
40
+ this._initMathObserver(), this._render();
41
+ }
42
+ isComplete = (e) => Array.isArray(e) && e.length > 0;
43
+ changeAnswers = (e) => {
44
+ this._session.answer = e, this.dispatchEvent(new i(this.tagName.toLowerCase(), this.isComplete(this._session.answer))), this._render();
45
+ };
46
+ _render() {
47
+ if (!this._model || !this._session) return;
48
+ this._initMathObserver();
49
+ let r = {
50
+ ...this._model,
51
+ data: this._model.data ? [...this._model.data] : this._model.data
52
+ }, i = t.createElement(e, {
53
+ model: r,
54
+ categories: this._session.answer,
55
+ onAnswersChange: this.changeAnswers
56
+ });
57
+ this._root ||= n(this), this._root.render(i);
58
+ }
59
+ disconnectedCallback() {
60
+ this._disconnectMathObserver(), this._root &&= (this._root.unmount(), null);
61
+ }
62
+ };
63
+ //#endregion
64
+ export { e as Component, o as default };
@@ -0,0 +1,23 @@
1
+ /**
2
+ * @synced-from pie-elements/packages/charting/src/main.jsx
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
+ import React from 'react';
10
+ import PropTypes from 'prop-types';
11
+ export declare class Main extends React.Component {
12
+ static propTypes: {
13
+ model: PropTypes.Validator<object>;
14
+ onAnswersChange: PropTypes.Requireable<(...args: any[]) => any>;
15
+ categories: PropTypes.Requireable<any[]>;
16
+ };
17
+ constructor(props: any);
18
+ componentDidUpdate(prevProps: any): void;
19
+ changeData: (data: any) => void;
20
+ toggleCorrect: (showingCorrect: any) => void;
21
+ render(): React.JSX.Element;
22
+ }
23
+ export default Main;
@@ -0,0 +1,128 @@
1
+ import e from "react";
2
+ import t from "prop-types";
3
+ import { styled as n } from "@mui/material/styles";
4
+ import * as r from "@pie-lib/render-ui";
5
+ import { Collapsible as i, PreviewPrompt as a, UiLayout as o, color as s, hasMedia as c, hasText as l } from "@pie-lib/render-ui";
6
+ import { jsx as u, jsxs as d } from "react/jsx-runtime";
7
+ import { Chart as f, KeyLegend as p, chartTypes as m } from "@pie-lib/charting";
8
+ import { isEqual as h } from "@pie-element/shared-lodash";
9
+ import g from "@pie-lib/correct-answer-toggle";
10
+ //#region src/delivery/main.tsx
11
+ function _(e) {
12
+ return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
13
+ }
14
+ function v(e, t) {
15
+ return !e || _(e) ? e : _(e.default) ? e.default : t && _(e[t]) ? e[t] : t && _(e[t]?.default) ? e[t].default : e;
16
+ }
17
+ var y = v(o, "UiLayout") || v(w.UiLayout, "UiLayout"), b = v(a, "PreviewPrompt") || v(w.PreviewPrompt, "PreviewPrompt"), x = v(i, "Collapsible") || v(w.Collapsible, "Collapsible"), S = r, C = S.default, w = C && typeof C == "object" ? C : S, T = n(y)({
18
+ color: s.text(),
19
+ backgroundColor: s.background(),
20
+ overflowX: "scroll",
21
+ overflowY: "hidden"
22
+ }), E = n(f)(({ theme: e }) => ({
23
+ marginTop: e.spacing(2),
24
+ marginBottom: e.spacing(2)
25
+ })), D = n(x)(({ theme: e }) => ({ marginBottom: e.spacing(2) })), O = class extends e.Component {
26
+ static propTypes = {
27
+ model: t.object.isRequired,
28
+ onAnswersChange: t.func,
29
+ categories: t.array
30
+ };
31
+ constructor(e) {
32
+ super(e), this.state = {
33
+ categories: e.categories || e.model.data,
34
+ showingCorrect: !1
35
+ };
36
+ }
37
+ componentDidUpdate(e) {
38
+ h(e.categories, this.props.categories) ? h(e.model.data, this.props.model.data) || this.setState({ categories: this.props.model.data }) : this.setState({ categories: this.props.categories });
39
+ }
40
+ changeData = (e) => this.setState({ categories: e }, () => this.props.onAnswersChange(e));
41
+ toggleCorrect = (e) => this.setState({ showingCorrect: e });
42
+ render() {
43
+ let { categories: e, showingCorrect: t } = this.state, { model: n } = this.props, { teacherInstructions: r, prompt: i, chartType: a, size: o, domain: s, range: f, title: h, addCategoryEnabled: _, studentNewCategoryDefaultLabel: v, showToggle: y, rationale: S, correctAnswer: C, language: w, env: O, showKeyLegend: k } = n, { correctedAnswer: A, extraCSSRules: j } = n, M = (C?.data || []).map((e) => ({
44
+ ...e,
45
+ interactive: !1,
46
+ editable: !1
47
+ })), { mode: N } = O || {};
48
+ N === "view" && (A = (A || []).map((e) => ({
49
+ ...e,
50
+ editable: !1
51
+ })));
52
+ let P = n.rationale && (l(n.rationale) || c(n.rationale));
53
+ return /* @__PURE__ */ d(T, {
54
+ extraCSSRules: j,
55
+ children: [
56
+ n.teacherInstructions && (l(n.teacherInstructions) || c(n.teacherInstructions)) && /* @__PURE__ */ u(D, {
57
+ labels: {
58
+ hidden: "Show Teacher Instructions",
59
+ visible: "Hide Teacher Instructions"
60
+ },
61
+ children: /* @__PURE__ */ u(b, { prompt: r })
62
+ }),
63
+ i && /* @__PURE__ */ u(b, {
64
+ className: "prompt",
65
+ prompt: i
66
+ }),
67
+ /* @__PURE__ */ u(g, {
68
+ show: y,
69
+ toggled: t,
70
+ onToggle: this.toggleCorrect,
71
+ language: w
72
+ }),
73
+ t && y ? /* @__PURE__ */ u(E, {
74
+ chartType: a,
75
+ size: o,
76
+ domain: s,
77
+ range: f,
78
+ charts: [
79
+ m.Bar(),
80
+ m.Histogram(),
81
+ m.LineDot(),
82
+ m.LineCross(),
83
+ m.DotPlot(),
84
+ m.LinePlot()
85
+ ],
86
+ data: M || e,
87
+ title: h,
88
+ onDataChange: this.changeData,
89
+ addCategoryEnabled: !1,
90
+ categoryDefaultLabel: v,
91
+ language: w,
92
+ labelsPlaceholders: {}
93
+ }) : /* @__PURE__ */ u(E, {
94
+ chartType: a,
95
+ size: o,
96
+ domain: s,
97
+ range: f,
98
+ charts: [
99
+ m.Bar(),
100
+ m.Histogram(),
101
+ m.LineDot(),
102
+ m.LineCross(),
103
+ m.DotPlot(),
104
+ m.LinePlot()
105
+ ],
106
+ data: A || e,
107
+ title: h,
108
+ onDataChange: this.changeData,
109
+ addCategoryEnabled: _,
110
+ categoryDefaultLabel: v,
111
+ language: w,
112
+ labelsPlaceholders: {},
113
+ correctData: y ? M : void 0
114
+ }),
115
+ !t && k && /* @__PURE__ */ u(p, { language: w }),
116
+ P && /* @__PURE__ */ u(x, {
117
+ labels: {
118
+ hidden: "Show Rationale",
119
+ visible: "Hide Rationale"
120
+ },
121
+ children: /* @__PURE__ */ u(b, { prompt: S })
122
+ })
123
+ ]
124
+ });
125
+ }
126
+ };
127
+ //#endregion
128
+ export { O as Main, O as default };
@@ -0,0 +1 @@
1
+ export { default } from './delivery/index.js';
@@ -0,0 +1,8 @@
1
+ /**
2
+ * IIFE entry point for charting element
3
+ * This file is only used for IIFE builds and includes auto-registration
4
+ *
5
+ * @sync-generated - Auto-generated during sync from pie-elements
6
+ */
7
+ import Element from './index.js';
8
+ export default Element;