@pie-lib/graphing-solution-set 5.0.1-next.20261004005223 → 5.0.1-next.20261004011201

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.
@@ -0,0 +1 @@
1
+ export {};
package/dist/graph.js CHANGED
@@ -6,11 +6,12 @@ import o from "./bg.js";
6
6
  import s from "react";
7
7
  import c from "prop-types";
8
8
  import { cloneDeep as l, isEqual as u } from "@pie-element/shared-lodash";
9
- import { Root as d, createGraphProps as f, types as p } from "@pie-lib/plot";
10
- import m from "debug";
11
- import { jsx as h, jsxs as g } from "react/jsx-runtime";
9
+ import { Root as d, createGraphProps as f, types as p, utils as m } from "@pie-lib/plot";
10
+ import h from "@pie-lib/translator";
11
+ import g from "debug";
12
+ import { jsx as _, jsxs as v } from "react/jsx-runtime";
12
13
  //#region src/graph.tsx
13
- var _ = m("pie-lib:graphing-solution-set:graph"), v = {
14
+ var { translator: y } = h, b = g("pie-lib:graphing-solution-set:graph"), x = {
14
15
  axesSettings: c.shape(r),
15
16
  backgroundMarks: c.array,
16
17
  className: c.string,
@@ -37,24 +38,42 @@ var _ = m("pie-lib:graphing-solution-set:graph"), v = {
37
38
  title: c.string,
38
39
  tools: c.array,
39
40
  language: c.string
40
- }, y = (e) => ({
41
+ }, S = (e) => ({
41
42
  x: -23,
42
43
  y: -23,
43
44
  width: e.width + 46,
44
45
  height: e.height + 46
45
- }), b = ({ marks: e, currentTool: t }) => {
46
+ }), C = (e) => e ? m.extractTextFromHTML(e).trim() : "", w = ({ title: e, domain: t, range: n, marks: r, language: i }) => {
47
+ let a = {
48
+ lng: i,
49
+ interpolation: { escapeValue: !1 }
50
+ }, o = ({ axisLabel: e, min: t, max: n }, r) => y.t("graphing.axisRange", {
51
+ ...a,
52
+ axis: C(e) || r,
53
+ min: t,
54
+ max: n
55
+ }), s = r.filter((e) => !e.building && (e.type !== "polygon" || e.isSolution)), c = y.t("graphing.plotted", {
56
+ ...a,
57
+ count: s.length,
58
+ marks: s.map((e) => y.t(e.type === "polygon" ? "graphing.shadedRegion" : `graphing.${e.type}`, a).trim()).join(", ")
59
+ });
60
+ return {
61
+ ariaLabel: C(e) || y.t("graphing.graph", a),
62
+ ariaDescription: `${o(t, "x")} ${o(n, "y")} ${c}`
63
+ };
64
+ }, T = ({ marks: e, currentTool: t }) => {
46
65
  let n = e.filter((e) => e.building)[0], r = l(e);
47
66
  if (n && t && n.type !== t.type) {
48
67
  let e = r.findIndex((e) => u(e, n));
49
68
  e >= 0 && r.splice(e, 1);
50
69
  }
51
70
  return r;
52
- }, x = class extends s.Component {
71
+ }, E = class extends s.Component {
53
72
  constructor(e) {
54
73
  super(e), this.maskUid = this.generateMaskId();
55
74
  }
56
75
  static propTypes = {
57
- ...v,
76
+ ...x,
58
77
  currentTool: c.object
59
78
  };
60
79
  static defaultProps = {
@@ -100,7 +119,7 @@ var _ = m("pie-lib:graphing-solution-set:graph"), v = {
100
119
  if (o.numberOfLines === 1 && o.selectedTool === "lineA" && a.length === 1 && !a[0].building || o.numberOfLines === 2 && o.selectedTool === "lineA" && a.length === 2 || o.numberOfLines === 2 && o.selectedTool === "lineA" && a.length === 1 && !a[0].building || o.numberOfLines === 2 && o.selectedTool === "lineB" && a.length === 2 && !a[1].building) return;
101
120
  }
102
121
  if (r || !i || [null, void 0].includes(t) || [null, void 0].includes(n)) return;
103
- _("[onBgClick] x,y: ", t, n);
122
+ b("[onBgClick] x,y: ", t, n);
104
123
  let c = a.filter((e) => e.building)[0], l;
105
124
  l = c && i && c.type === i.type ? i.addPoint({
106
125
  x: t,
@@ -111,19 +130,19 @@ var _ = m("pie-lib:graphing-solution-set:graph"), v = {
111
130
  }, void 0), this.updateMarks(c, l, !0);
112
131
  };
113
132
  render() {
114
- let { axesSettings: t, currentTool: r, coordinatesOnHover: a, size: s, disabledLabels: c, disabledTitle: l, domain: u, backgroundMarks: p, range: m, title: _, labels: v, labelModeEnabled: x, labelsPlaceholders: S, showLabels: C, showPixelGuides: w, showTitle: T, titlePlaceholder: E, onChangeLabels: D, onChangeTitle: O, mathMlOptions: k = {}, gssLineData: A, disabled: j, language: M } = this.props, { marks: N } = this.props, P = f(u, m, s, () => this.rootNode), F = y(s), I = {
115
- graphProps: P,
116
- labelModeEnabled: x,
117
- gssLineData: A,
118
- language: M
133
+ let { axesSettings: t, currentTool: r, coordinatesOnHover: a, size: s, disabledLabels: c, disabledTitle: l, domain: u, backgroundMarks: p, range: m, title: h, labels: g, labelModeEnabled: y, labelsPlaceholders: b, showLabels: x, showPixelGuides: C, showTitle: E, titlePlaceholder: D, onChangeLabels: O, onChangeTitle: k, mathMlOptions: A = {}, gssLineData: j, disabled: M, language: N } = this.props, { marks: P } = this.props, F = f(u, m, s, () => this.rootNode), I = S(s), L = {
134
+ graphProps: F,
135
+ labelModeEnabled: y,
136
+ gssLineData: j,
137
+ language: N
119
138
  };
120
- N = b({
121
- marks: N || [],
139
+ P = T({
140
+ marks: P || [],
122
141
  currentTool: r
123
142
  });
124
- let L = N.filter((e) => e.type === "polygon");
125
- A && A.selectedTool === "solutionSet" && A.sections.forEach((t) => {
126
- if (L.length === 0 || !e(t, L[0].points)) {
143
+ let R = P.filter((e) => e.type === "polygon");
144
+ j && j.selectedTool === "solutionSet" && j.sections.forEach((t) => {
145
+ if (R.length === 0 || !e(t, R[0].points)) {
127
146
  let e = {
128
147
  type: "polygon",
129
148
  building: !1,
@@ -131,52 +150,62 @@ var _ = m("pie-lib:graphing-solution-set:graph"), v = {
131
150
  points: t,
132
151
  isSolution: !1
133
152
  };
134
- j || N.push(e);
153
+ M || P.push(e);
135
154
  }
136
155
  });
137
- let R = [];
138
- return R.push(...N.filter((e) => e.type === "polygon")), R.push(...N.filter((e) => e.type === "line")), /* @__PURE__ */ h(d, {
156
+ let z = [];
157
+ z.push(...P.filter((e) => e.type === "polygon")), z.push(...P.filter((e) => e.type === "line"));
158
+ let { ariaLabel: B, ariaDescription: V } = w({
159
+ title: h,
160
+ domain: u,
161
+ range: m,
162
+ marks: [...p || [], ...z],
163
+ language: N
164
+ });
165
+ return /* @__PURE__ */ _(d, {
139
166
  rootRef: (e) => this.rootNode = e,
140
167
  disabledTitle: l,
141
168
  disabledLabels: c,
142
- labels: v,
143
- labelsPlaceholders: S || {},
144
- showPixelGuides: w,
145
- showLabels: C,
146
- showTitle: T,
147
- title: _,
148
- titlePlaceholder: E,
149
- onChangeTitle: O,
150
- onChangeLabels: D,
151
- mathMlOptions: k,
152
- ...I,
153
- children: /* @__PURE__ */ g("g", {
169
+ labels: g,
170
+ labelsPlaceholders: b || {},
171
+ showPixelGuides: C,
172
+ showLabels: x,
173
+ showTitle: E,
174
+ title: h,
175
+ titlePlaceholder: D,
176
+ onChangeTitle: k,
177
+ onChangeLabels: O,
178
+ mathMlOptions: A,
179
+ ariaLabel: B,
180
+ ariaDescription: V,
181
+ ...L,
182
+ children: /* @__PURE__ */ v("g", {
154
183
  transform: u && u.padding && u.range ? `translate(${u.padding}, ${m.padding})` : void 0,
155
184
  children: [
156
- /* @__PURE__ */ h(i, { ...I }),
157
- /* @__PURE__ */ h(n, {
185
+ /* @__PURE__ */ _(i, { ...L }),
186
+ /* @__PURE__ */ _(n, {
158
187
  ...t,
159
- ...I
188
+ ...L
160
189
  }),
161
- /* @__PURE__ */ h(o, {
190
+ /* @__PURE__ */ _(o, {
162
191
  ...s,
163
192
  onClick: this.onBgClick,
164
- ...I
193
+ ...L
165
194
  }),
166
- /* @__PURE__ */ g("mask", {
195
+ /* @__PURE__ */ v("mask", {
167
196
  id: `${this.maskUid}`,
168
- children: [/* @__PURE__ */ h("rect", {
169
- ...F,
197
+ children: [/* @__PURE__ */ _("rect", {
198
+ ...I,
170
199
  fill: "white"
171
200
  }), " "]
172
201
  }),
173
- /* @__PURE__ */ g("g", {
202
+ /* @__PURE__ */ v("g", {
174
203
  id: "marks",
175
204
  mask: `url('#${this.maskUid}')`,
176
205
  children: [
177
206
  (p || []).map((e, t) => {
178
207
  let n = this.getComponent(e), r = e.type;
179
- return /* @__PURE__ */ h(n, {
208
+ return /* @__PURE__ */ _(n, {
180
209
  mark: {
181
210
  ...e,
182
211
  disabled: !0,
@@ -184,12 +213,12 @@ var _ = m("pie-lib:graphing-solution-set:graph"), v = {
184
213
  },
185
214
  labelNode: this.state.labelNode,
186
215
  onClick: this.onBgClick,
187
- ...I
216
+ ...L
188
217
  }, `${r}-${t}-bg`);
189
218
  }),
190
- R.map((e, t) => {
219
+ z.map((e, t) => {
191
220
  let n = this.getComponent(e), i = e.type;
192
- return /* @__PURE__ */ h(n, {
221
+ return /* @__PURE__ */ _(n, {
193
222
  mark: e,
194
223
  coordinatesOnHover: a,
195
224
  onChange: this.changeMark,
@@ -199,10 +228,10 @@ var _ = m("pie-lib:graphing-solution-set:graph"), v = {
199
228
  onDragStop: this.stopDrag,
200
229
  labelNode: this.state.labelNode,
201
230
  isToolActive: r && i === r.type,
202
- ...I
231
+ ...L
203
232
  }, `${i}-${t}`);
204
233
  }),
205
- /* @__PURE__ */ h("foreignObject", {
234
+ /* @__PURE__ */ _("foreignObject", {
206
235
  ref: (e) => this.labelNode = e,
207
236
  x: "0",
208
237
  y: "0",
@@ -220,4 +249,4 @@ var _ = m("pie-lib:graphing-solution-set:graph"), v = {
220
249
  }
221
250
  };
222
251
  //#endregion
223
- export { x as Graph, x as default, v as graphPropTypes, b as removeBuildingToolIfCurrentToolDiffers };
252
+ export { E as Graph, E as default, x as graphPropTypes, T as removeBuildingToolIfCurrentToolDiffers };
@@ -4,19 +4,19 @@ import { useDebounce as n } from "./use-debounce.js";
4
4
  import { useCallback as r, useEffect as i, useState as a } from "react";
5
5
  import o from "prop-types";
6
6
  import { types as s } from "@pie-lib/plot";
7
- import { jsx as c } from "react/jsx-runtime";
8
- import { styled as l } from "@mui/material/styles";
9
- import { color as u } from "@pie-lib/render-ui";
10
- import d from "@pie-lib/translator";
7
+ import c from "@pie-lib/translator";
8
+ import { jsx as l } from "react/jsx-runtime";
9
+ import { styled as u } from "@mui/material/styles";
10
+ import { color as d } from "@pie-lib/render-ui";
11
11
  //#region src/mark-label.tsx
12
- var { translator: f } = d, p = l(t, { shouldForwardProp: (e) => !["disabled", "markDisabled"].includes(e) })(({ theme: e, disabled: t, markDisabled: n }) => ({ "& input": {
12
+ var { translator: f } = c, p = u(t, { shouldForwardProp: (e) => !["disabled", "markDisabled"].includes(e) })(({ theme: e, disabled: t, markDisabled: n }) => ({ "& input": {
13
13
  float: "right",
14
14
  padding: e.spacing(.5),
15
15
  fontFamily: e.typography.fontFamily,
16
16
  fontSize: e.typography.fontSize,
17
- border: `solid 1px ${t ? u.defaults.PRIMARY_DARK : n ? u.disabled() : u.defaults.SECONDARY}`,
17
+ border: `solid 1px ${t ? d.defaults.PRIMARY_DARK : n ? d.disabled() : d.defaults.SECONDARY}`,
18
18
  borderRadius: "3px",
19
- color: n ? u.disabled() : u.defaults.PRIMARY_DARK,
19
+ color: n ? d.disabled() : d.defaults.PRIMARY_DARK,
20
20
  background: t || n ? e.palette.background.paper : "transparent"
21
21
  } })), m = (e, t, n) => {
22
22
  n ||= {
@@ -49,7 +49,7 @@ var { translator: f } = d, p = l(t, { shouldForwardProp: (e) => !["disabled", "m
49
49
  };
50
50
  }
51
51
  }, g = (t) => {
52
- let [o, s] = a(null), l = r((e) => s(e)), { mark: u, graphProps: d, disabled: g, inputRef: _, language: v } = t, [y, b] = a(u.label), x = (e) => b(e.target.value), S = n(y, 200);
52
+ let [o, s] = a(null), c = r((e) => s(e)), { mark: u, graphProps: d, disabled: g, inputRef: _, language: v } = t, [y, b] = a(u.label), x = (e) => b(e.target.value), S = n(y, 200);
53
53
  i(() => {
54
54
  b(u.label);
55
55
  }, [u.label]), i(() => {
@@ -63,9 +63,9 @@ var { translator: f } = d, p = l(t, { shouldForwardProp: (e) => !["disabled", "m
63
63
  pointerEvents: "auto",
64
64
  ...h(d, u, C, m(d, u, C))
65
65
  }, T = g || u.disabled;
66
- return /* @__PURE__ */ c(p, {
66
+ return /* @__PURE__ */ l(p, {
67
67
  inputRef: (e) => {
68
- l(e), _(e);
68
+ c(e), _(e);
69
69
  },
70
70
  "aria-label": Number.isFinite(u.x) && Number.isFinite(u.y) ? f.t("graphing.markLabel", {
71
71
  lng: v,
package/dist/undo-redo.js CHANGED
@@ -1,13 +1,13 @@
1
1
  import e from "react";
2
2
  import t from "prop-types";
3
- import { jsx as n } from "react/jsx-runtime";
4
- import { styled as r } from "@mui/material/styles";
5
- import { color as i } from "@pie-lib/render-ui";
6
- import a from "@mui/material/Button";
7
- import o from "@pie-lib/translator";
3
+ import n from "@pie-lib/translator";
4
+ import { jsx as r } from "react/jsx-runtime";
5
+ import { styled as i } from "@mui/material/styles";
6
+ import { color as a } from "@pie-lib/render-ui";
7
+ import o from "@mui/material/Button";
8
8
  //#region src/undo-redo.tsx
9
- var { translator: s } = o, c = r(a)(({ theme: e }) => ({
10
- color: i.text(),
9
+ var { translator: s } = n, c = i(o)(({ theme: e }) => ({
10
+ color: a.text(),
11
11
  fontWeight: "bold",
12
12
  marginBottom: e.spacing(.5),
13
13
  "&:not(:last-of-type)": { marginRight: e.spacing(.5) }
@@ -19,12 +19,12 @@ var { translator: s } = o, c = r(a)(({ theme: e }) => ({
19
19
  };
20
20
  static defaultProps = {};
21
21
  render() {
22
- let { className: e, onReset: t = !1, language: r } = this.props;
23
- return /* @__PURE__ */ n("div", {
22
+ let { className: e, onReset: t = !1, language: n } = this.props;
23
+ return /* @__PURE__ */ r("div", {
24
24
  className: e,
25
- children: /* @__PURE__ */ n(c, {
25
+ children: /* @__PURE__ */ r(c, {
26
26
  onClick: () => t(),
27
- children: s.t("graphing.reset", { lng: r })
27
+ children: s.t("graphing.reset", { lng: n })
28
28
  })
29
29
  });
30
30
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-lib/graphing-solution-set",
3
- "version": "5.0.1-next.20261004005223",
3
+ "version": "5.0.1-next.20261004011201",
4
4
  "description": "Graphing components",
5
5
  "repository": {
6
6
  "type": "git",
@@ -15,12 +15,12 @@
15
15
  "@mui/icons-material": "^7.3.4",
16
16
  "@mui/material": "^7.3.4",
17
17
  "@pie-lib/drag": "5.0.1-next.20261004003105",
18
- "@pie-lib/editable-html-tip-tap": "3.0.1-next.20261004003105",
18
+ "@pie-lib/editable-html-tip-tap": "3.0.1-next.20261004011201",
19
19
  "@pie-lib/graphing-utils": "4.0.1-next.20261002233132",
20
- "@pie-lib/plot": "5.0.1-next.20261004003105",
20
+ "@pie-lib/plot": "5.0.1-next.20261004011201",
21
21
  "@pie-lib/render-ui": "8.0.1-next.20261003161149",
22
22
  "@pie-lib/tools": "3.0.1-next.20261002233132",
23
- "@pie-lib/translator": "5.0.1-next.20261004005223",
23
+ "@pie-lib/translator": "5.0.1-next.20261004011201",
24
24
  "@visx/axis": "^4.0.0",
25
25
  "@visx/clip-path": "^4.0.0",
26
26
  "@visx/curve": "^4.0.0",
@@ -40,7 +40,7 @@
40
40
  "redux-undo": "^1.1.0",
41
41
  "@pie-element/shared-lodash": "0.1.2-next.20261002215153",
42
42
  "clsx": "^2.1.1",
43
- "@pie-lib/config-ui": "14.0.1-next.20261004003105",
43
+ "@pie-lib/config-ui": "14.0.1-next.20261004011201",
44
44
  "@dnd-kit/core": "^6.3.1",
45
45
  "@dnd-kit/utilities": "^3.2.2",
46
46
  "d3-shape": "^3.2.0"