@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.
@@ -1,18 +1,28 @@
1
1
  import React from 'react';
2
- import PropTypes from 'prop-types';
3
- export declare class Configure extends React.Component {
4
- static propTypes: {
5
- onModelChanged: PropTypes.Requireable<(...args: any[]) => any>;
6
- onConfigurationChanged: PropTypes.Requireable<(...args: any[]) => any>;
7
- imageSupport: PropTypes.Requireable<object>;
8
- uploadSoundSupport: PropTypes.Requireable<object>;
9
- model: PropTypes.Validator<object>;
10
- configuration: PropTypes.Validator<object>;
11
- };
2
+ import type { DeleteDone, ImageHandler, SoundHandler } from '@pie-element/shared-configure-events';
3
+ import type { GraphingValidationErrors } from '../controller/index.js';
4
+ import type { GraphingConfiguration, GraphingModel } from '../types.js';
5
+ /** The model the author edits; the host sets `errors` from the controller's `validate()`. */
6
+ export type AuthorModel = Partial<GraphingModel> & {
7
+ errors?: GraphingValidationErrors;
8
+ };
9
+ type MediaSupport<Handler> = {
10
+ add: (handler: Handler) => void;
11
+ delete: (src: string, done: DeleteDone) => void;
12
+ };
13
+ export type ConfigureProps = {
14
+ model: AuthorModel;
15
+ configuration: GraphingConfiguration;
16
+ onModelChanged: (model: AuthorModel) => void;
17
+ onConfigurationChanged: (configuration: GraphingConfiguration) => void;
18
+ imageSupport?: MediaSupport<ImageHandler>;
19
+ uploadSoundSupport?: MediaSupport<SoundHandler>;
20
+ };
21
+ export declare class Configure extends React.Component<ConfigureProps> {
12
22
  componentDidMount(): void;
13
- onRationaleChange: any;
14
- onPromptChange: any;
15
- onTeacherInstructionsChange: any;
23
+ onRationaleChange: (rationale: string) => void;
24
+ onPromptChange: (prompt: string) => void;
25
+ onTeacherInstructionsChange: (teacherInstructions: string) => void;
16
26
  render(): React.JSX.Element;
17
27
  }
18
28
  export default Configure;
@@ -1,34 +1,25 @@
1
1
  import { GraphingConfig as e } from "./graphing-config.js";
2
2
  import { CorrectResponse as t } from "./correct-response.js";
3
3
  import n from "react";
4
- import r from "prop-types";
5
- import { styled as i } from "@mui/material/styles";
6
- import { jsx as a, jsxs as o } from "react/jsx-runtime";
7
- import s from "debug";
8
- import { intersection as c } from "@pie-element/shared-lodash";
9
- import l from "@mui/material/Typography";
10
- import { InputContainer as u, layout as d, settings as f } from "@pie-lib/config-ui";
11
- import p from "@pie-lib/editable-html-tip-tap";
4
+ import { styled as r } from "@mui/material/styles";
5
+ import { jsx as i, jsxs as a } from "react/jsx-runtime";
6
+ import o from "debug";
7
+ import { intersection as s } from "@pie-element/shared-lodash";
8
+ import c from "@mui/material/Typography";
9
+ import { InputContainer as l, layout as u, settings as d } from "@pie-lib/config-ui";
10
+ import f from "@pie-lib/editable-html-tip-tap";
12
11
  //#region src/author/configure.tsx
13
- var { Panel: ee, toggle: m, radio: h, checkboxes: te, textField: ne, dropdown: re } = f, ie = s("@pie-element:graphing:configure"), g = i(u)(({ theme: e }) => ({
12
+ var { Panel: p, toggle: m, radio: ee, checkboxes: te, textField: ne, dropdown: re } = d, ie = o("@pie-element:graphing:configure"), h = r(l)(({ theme: e }) => ({
14
13
  width: "100%",
15
14
  paddingTop: e.spacing(2),
16
15
  marginBottom: e.spacing(2)
17
- })), ae = i(l)(({ theme: e }) => ({ marginBottom: e.spacing(2.5) })), _ = i("div")(({ theme: e }) => ({
16
+ })), g = r(c)(({ theme: e }) => ({ marginBottom: e.spacing(2.5) })), _ = r("div")(({ theme: e }) => ({
18
17
  fontSize: e.typography.fontSize - 2,
19
18
  color: e.palette.error.main,
20
19
  paddingTop: e.spacing(1)
21
20
  })), v = class extends n.Component {
22
- static propTypes = {
23
- onModelChanged: r.func,
24
- onConfigurationChanged: r.func,
25
- imageSupport: r.object,
26
- uploadSoundSupport: r.object,
27
- model: r.object.isRequired,
28
- configuration: r.object.isRequired
29
- };
30
21
  componentDidMount() {
31
- let { configuration: e, onModelChanged: t, model: n } = this.props, { availableTools: r, title: i, graphDimensions: a } = e || {}, { arrows: o, titleEnabled: s, dimensionsEnabled: l } = n || {};
22
+ let { configuration: e, onModelChanged: t, model: n } = this.props, { availableTools: r, title: i, graphDimensions: a } = e || {}, { arrows: o, titleEnabled: c, dimensionsEnabled: l } = n || {};
32
23
  typeof o == "boolean" && (o = o ? {
33
24
  left: !0,
34
25
  right: !0,
@@ -40,7 +31,7 @@ var { Panel: ee, toggle: m, radio: h, checkboxes: te, textField: ne, dropdown: r
40
31
  up: !1,
41
32
  down: !1
42
33
  });
43
- let u = c(r || [], n.toolbarTools || []), d = s ?? i.enabled, f = l ?? a.enabled;
34
+ let u = s(r || [], n.toolbarTools || []), d = c ?? i.enabled, f = l ?? a.enabled;
44
35
  t && t({
45
36
  ...n,
46
37
  arrows: o,
@@ -71,134 +62,134 @@ var { Panel: ee, toggle: m, radio: h, checkboxes: te, textField: ne, dropdown: r
71
62
  });
72
63
  };
73
64
  render() {
74
- let { model: n, configuration: r, onConfigurationChanged: i, onModelChanged: s, imageSupport: c, uploadSoundSupport: l } = this.props, { arrows: u = {}, authoring: f = {}, availableTools: v = [], baseInputConfiguration: y = {}, coordinatesOnHover: b = {}, contentDimensions: x = {}, gridConfigurations: S = [], graphDimensions: C = {}, instruction: w = {}, labels: T = {}, padding: E = {}, prompt: D = {}, rationale: O = {}, scoringType: k = {}, settingsPanelDisabled: A, spellCheck: j = {}, studentInstructions: M = {}, teacherInstructions: N = {}, title: P = {}, maxImageWidth: F = {}, maxImageHeight: I = {}, withRubric: L = {}, language: R = {}, languageChoices: z = {}, mathMlOptions: B = {}, removeIncompleteTool: V = !1 } = r || {}, { errors: H = {}, extraCSSRules: U, labelsEnabled: W, dimensionsEnabled: G, promptEnabled: K, rationaleEnabled: oe, spellCheckEnabled: q, teacherInstructionsEnabled: se, titleEnabled: ce } = n || {}, { prompt: J, rationale: Y, teacherInstructions: X } = H || {};
65
+ let { model: n, configuration: r, onConfigurationChanged: o, onModelChanged: s, imageSupport: c, uploadSoundSupport: l } = this.props, { arrows: d = {}, authoring: v = {}, availableTools: y = [], baseInputConfiguration: b = {}, coordinatesOnHover: x = {}, contentDimensions: ae = {}, gridConfigurations: oe = [], graphDimensions: S = {}, instruction: C = {}, labels: w = {}, padding: T = {}, prompt: E = {}, rationale: D = {}, scoringType: O = {}, settingsPanelDisabled: k, spellCheck: A = {}, studentInstructions: j = {}, teacherInstructions: M = {}, title: N = {}, maxImageWidth: P = {}, maxImageHeight: F = {}, withRubric: I = {}, language: L = {}, languageChoices: R = {}, mathMlOptions: z = {}, removeIncompleteTool: B = !1 } = r || {}, { errors: V = {}, extraCSSRules: H, labelsEnabled: U, dimensionsEnabled: W, promptEnabled: G, rationaleEnabled: K, spellCheckEnabled: q, teacherInstructionsEnabled: se, titleEnabled: ce } = n || {}, { prompt: J, rationale: Y, teacherInstructions: X } = V || {};
75
66
  ie("[render] model", n);
76
- let Z = F && F.prompt, Q = I && I.prompt, le = {
77
- top: T.top,
78
- right: T.right,
79
- bottom: T.bottom,
80
- left: T.left
67
+ let Z = P && P.prompt, Q = F && F.prompt, le = {
68
+ top: w.top,
69
+ right: w.right,
70
+ bottom: w.bottom,
71
+ left: w.left
81
72
  }, ue = {
82
- arrows: u.settings && te(u.label, {
83
- left: u.left,
84
- right: u.right,
85
- up: u.up,
86
- down: u.down
73
+ arrows: d.settings && te(d.label, {
74
+ left: d.left,
75
+ right: d.right,
76
+ up: d.up,
77
+ down: d.down
87
78
  }),
88
- titleEnabled: P.settings && m(P.label),
89
- padding: E.settings && m(E.label),
90
- labelsEnabled: T.settings && m(T.label),
91
- "language.enabled": R.settings && m(R.label, !0),
92
- language: R.settings && R.enabled && re(z.label, z.options),
93
- dimensionsEnabled: C.settings && m(C.label),
94
- coordinatesOnHover: b.settings && m(b.label)
79
+ titleEnabled: N.settings && m(N.label),
80
+ padding: T.settings && m(T.label),
81
+ labelsEnabled: w.settings && m(w.label),
82
+ "language.enabled": L.settings && m(L.label, !0),
83
+ language: L.settings && L.enabled && re(R.label, R.options),
84
+ dimensionsEnabled: S.settings && m(S.label),
85
+ coordinatesOnHover: x.settings && m(x.label)
95
86
  }, de = {
96
- "authoring.enabled": f.settings && m(f.label, !0),
97
- teacherInstructionsEnabled: N.settings && m(N.label),
98
- studentInstructionsEnabled: M.settings && m(M.label),
99
- promptEnabled: D.settings && m(D.label),
100
- rationaleEnabled: O.settings && m(O.label),
101
- spellCheckEnabled: j.settings && m(j.label),
102
- scoringType: k.settings && h(k.label, ["dichotomous", "partial scoring"]),
103
- rubricEnabled: L?.settings && m(L?.label),
104
- instruction: w.settings && ne(w.label)
87
+ "authoring.enabled": v.settings && m(v.label, !0),
88
+ teacherInstructionsEnabled: M.settings && m(M.label),
89
+ studentInstructionsEnabled: j.settings && m(j.label),
90
+ promptEnabled: E.settings && m(E.label),
91
+ rationaleEnabled: D.settings && m(D.label),
92
+ spellCheckEnabled: A.settings && m(A.label),
93
+ scoringType: O.settings && ee(O.label, ["dichotomous", "partial scoring"]),
94
+ rubricEnabled: I?.settings && m(I?.label),
95
+ instruction: C.settings && ne(C.label)
105
96
  }, $ = (e = {}) => ({
106
- ...y,
97
+ ...b,
107
98
  ...e
108
99
  });
109
- return /* @__PURE__ */ o(d.ConfigLayout, {
110
- extraCSSRules: U,
111
- dimensions: x,
112
- hideSettings: A,
113
- settings: /* @__PURE__ */ a(ee, {
100
+ return /* @__PURE__ */ a(u.ConfigLayout, {
101
+ extraCSSRules: H,
102
+ dimensions: ae,
103
+ hideSettings: k,
104
+ settings: /* @__PURE__ */ i(p, {
114
105
  model: n,
115
106
  configuration: r,
116
107
  onChangeModel: s,
117
- onChangeConfiguration: i,
108
+ onChangeConfiguration: o,
118
109
  groups: {
119
110
  Settings: ue,
120
111
  Properties: de
121
112
  }
122
113
  }),
123
114
  children: [
124
- /* @__PURE__ */ a(ae, {
115
+ /* @__PURE__ */ i(g, {
125
116
  component: "div",
126
117
  variant: "body1",
127
- children: w?.label || ""
118
+ children: C?.label || ""
128
119
  }),
129
- se && /* @__PURE__ */ o(g, {
130
- label: N.label,
131
- children: [/* @__PURE__ */ a(p, {
120
+ se && /* @__PURE__ */ a(h, {
121
+ label: M.label,
122
+ children: [/* @__PURE__ */ i(f, {
132
123
  markup: n.teacherInstructions || "",
133
124
  onChange: this.onTeacherInstructionsChange,
134
125
  imageSupport: c,
135
126
  error: X,
136
127
  nonEmpty: !1,
137
- pluginProps: $(N?.inputConfiguration),
128
+ pluginProps: $(M?.inputConfiguration),
138
129
  spellCheck: q,
139
- maxImageWidth: F && F.teacherInstructions || Z,
140
- maxImageHeight: I && I.teacherInstructions || Q,
130
+ maxImageWidth: P && P.teacherInstructions || Z,
131
+ maxImageHeight: F && F.teacherInstructions || Q,
141
132
  uploadSoundSupport: l,
142
133
  languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
143
- mathMlOptions: B
144
- }), X && /* @__PURE__ */ a(_, { children: X })]
134
+ mathMlOptions: z
135
+ }), X && /* @__PURE__ */ i(_, { children: X })]
145
136
  }),
146
- K && /* @__PURE__ */ o(g, {
147
- label: D.label,
148
- children: [/* @__PURE__ */ a(p, {
137
+ G && /* @__PURE__ */ a(h, {
138
+ label: E.label,
139
+ children: [/* @__PURE__ */ i(f, {
149
140
  markup: n.prompt,
150
141
  onChange: this.onPromptChange,
151
142
  imageSupport: c,
152
143
  error: J,
153
144
  nonEmpty: !1,
154
145
  spellCheck: q,
155
- pluginProps: $(D?.inputConfiguration),
146
+ pluginProps: $(E?.inputConfiguration),
156
147
  disableUnderline: !0,
157
148
  maxImageWidth: Z,
158
149
  maxImageHeight: Q,
159
150
  uploadSoundSupport: l,
160
151
  languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
161
- mathMlOptions: B
162
- }), J && /* @__PURE__ */ a(_, { children: J })]
152
+ mathMlOptions: z
153
+ }), J && /* @__PURE__ */ i(_, { children: J })]
163
154
  }),
164
- /* @__PURE__ */ a(e, {
165
- authoring: f,
166
- availableTools: v,
167
- gridConfigurations: S,
168
- graphDimensions: C,
155
+ /* @__PURE__ */ i(e, {
156
+ authoring: v,
157
+ availableTools: y,
158
+ gridConfigurations: oe,
159
+ graphDimensions: S,
169
160
  labelsPlaceholders: le,
170
161
  model: n,
171
- showLabels: W,
172
- dimensionsEnabled: G,
162
+ showLabels: U,
163
+ dimensionsEnabled: W,
173
164
  showTitle: ce,
174
- titlePlaceholder: P.placeholder,
165
+ titlePlaceholder: N.placeholder,
175
166
  onChange: this.props.onModelChanged,
176
- mathMlOptions: B,
177
- removeIncompleteTool: V
167
+ mathMlOptions: z,
168
+ removeIncompleteTool: B
178
169
  }),
179
- /* @__PURE__ */ a(t, {
180
- availableTools: v,
181
- errors: H,
170
+ /* @__PURE__ */ i(t, {
171
+ availableTools: y,
172
+ errors: V,
182
173
  model: n,
183
174
  onChange: this.props.onModelChanged,
184
- mathMlOptions: B,
185
- removeIncompleteTool: V
175
+ mathMlOptions: z,
176
+ removeIncompleteTool: B
186
177
  }),
187
- oe && /* @__PURE__ */ o(g, {
188
- label: O.label || "Rationale",
189
- children: [/* @__PURE__ */ a(p, {
178
+ K && /* @__PURE__ */ a(h, {
179
+ label: D.label || "Rationale",
180
+ children: [/* @__PURE__ */ i(f, {
190
181
  markup: n.rationale || "",
191
182
  onChange: this.onRationaleChange,
192
183
  imageSupport: c,
193
184
  error: Y,
194
185
  spellCheck: q,
195
- pluginProps: $(O?.inputConfiguration),
196
- maxImageWidth: F && F.rationale || Z,
197
- maxImageHeight: I && I.rationale || Q,
186
+ pluginProps: $(D?.inputConfiguration),
187
+ maxImageWidth: P && P.rationale || Z,
188
+ maxImageHeight: F && F.rationale || Q,
198
189
  uploadSoundSupport: l,
199
190
  languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
200
- mathMlOptions: B
201
- }), Y && /* @__PURE__ */ a(_, { children: Y })]
191
+ mathMlOptions: z
192
+ }), Y && /* @__PURE__ */ i(_, { children: Y })]
202
193
  })
203
194
  ]
204
195
  });
@@ -22,8 +22,10 @@ export declare class CorrectResponse extends React.Component {
22
22
  static propTypes: {
23
23
  availableTools: PropTypes.Requireable<any[]>;
24
24
  errors: PropTypes.Requireable<object>;
25
+ mathMlOptions: PropTypes.Requireable<object>;
25
26
  model: PropTypes.Validator<object>;
26
27
  onChange: PropTypes.Validator<(...args: any[]) => any>;
28
+ removeIncompleteTool: PropTypes.Requireable<boolean>;
27
29
  toolbarTools: PropTypes.Requireable<unknown[]>;
28
30
  };
29
31
  state: {
@@ -104,8 +104,10 @@ var P = class extends e.Component {
104
104
  static propTypes = {
105
105
  availableTools: n.array,
106
106
  errors: n.object,
107
+ mathMlOptions: n.object,
107
108
  model: n.object.isRequired,
108
109
  onChange: n.func.isRequired,
110
+ removeIncompleteTool: n.bool,
109
111
  toolbarTools: n.arrayOf(n.String)
110
112
  };
111
113
  state = { dialog: { open: !1 } };