@pie-lib/graphing-solution-set 5.0.1-next.20261004003105 → 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.
- package/dist/__tests__/mark-label-name.test.d.ts +1 -0
- package/dist/__tests__/text-alternative.test.d.ts +1 -0
- package/dist/__tests__/tool-menu.test.d.ts +1 -0
- package/dist/graph-with-controls.js +2 -1
- package/dist/graph.d.ts +2 -0
- package/dist/graph.js +81 -50
- package/dist/mark-label.d.ts +1 -0
- package/dist/mark-label.js +47 -39
- package/dist/tool-menu.d.ts +1 -0
- package/dist/tool-menu.js +36 -28
- package/dist/tools/line/component.d.ts +1 -0
- package/dist/tools/shared/line/index.d.ts +2 -0
- package/dist/tools/shared/line/index.js +37 -31
- package/dist/undo-redo.js +11 -11
- package/package.json +5 -5
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/graph.d.ts
CHANGED
|
@@ -42,6 +42,7 @@ export declare const graphPropTypes: {
|
|
|
42
42
|
showTitle: PropTypes.Requireable<boolean>;
|
|
43
43
|
title: PropTypes.Requireable<string>;
|
|
44
44
|
tools: PropTypes.Requireable<any[]>;
|
|
45
|
+
language: PropTypes.Requireable<string>;
|
|
45
46
|
};
|
|
46
47
|
export declare const removeBuildingToolIfCurrentToolDiffers: ({ marks, currentTool }: {
|
|
47
48
|
marks: any;
|
|
@@ -92,6 +93,7 @@ export declare class Graph extends React.Component {
|
|
|
92
93
|
showTitle: PropTypes.Requireable<boolean>;
|
|
93
94
|
title: PropTypes.Requireable<string>;
|
|
94
95
|
tools: PropTypes.Requireable<any[]>;
|
|
96
|
+
language: PropTypes.Requireable<string>;
|
|
95
97
|
};
|
|
96
98
|
static defaultProps: {
|
|
97
99
|
onChangeMarks: () => void;
|
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
|
|
11
|
-
import
|
|
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
|
|
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,
|
|
@@ -35,25 +36,44 @@ var _ = m("pie-lib:graphing-solution-set:graph"), v = {
|
|
|
35
36
|
showPixelGuides: c.bool,
|
|
36
37
|
showTitle: c.bool,
|
|
37
38
|
title: c.string,
|
|
38
|
-
tools: c.array
|
|
39
|
-
|
|
39
|
+
tools: c.array,
|
|
40
|
+
language: c.string
|
|
41
|
+
}, S = (e) => ({
|
|
40
42
|
x: -23,
|
|
41
43
|
y: -23,
|
|
42
44
|
width: e.width + 46,
|
|
43
45
|
height: e.height + 46
|
|
44
|
-
}),
|
|
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 }) => {
|
|
45
65
|
let n = e.filter((e) => e.building)[0], r = l(e);
|
|
46
66
|
if (n && t && n.type !== t.type) {
|
|
47
67
|
let e = r.findIndex((e) => u(e, n));
|
|
48
68
|
e >= 0 && r.splice(e, 1);
|
|
49
69
|
}
|
|
50
70
|
return r;
|
|
51
|
-
},
|
|
71
|
+
}, E = class extends s.Component {
|
|
52
72
|
constructor(e) {
|
|
53
73
|
super(e), this.maskUid = this.generateMaskId();
|
|
54
74
|
}
|
|
55
75
|
static propTypes = {
|
|
56
|
-
...
|
|
76
|
+
...x,
|
|
57
77
|
currentTool: c.object
|
|
58
78
|
};
|
|
59
79
|
static defaultProps = {
|
|
@@ -99,7 +119,7 @@ var _ = m("pie-lib:graphing-solution-set:graph"), v = {
|
|
|
99
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;
|
|
100
120
|
}
|
|
101
121
|
if (r || !i || [null, void 0].includes(t) || [null, void 0].includes(n)) return;
|
|
102
|
-
|
|
122
|
+
b("[onBgClick] x,y: ", t, n);
|
|
103
123
|
let c = a.filter((e) => e.building)[0], l;
|
|
104
124
|
l = c && i && c.type === i.type ? i.addPoint({
|
|
105
125
|
x: t,
|
|
@@ -110,18 +130,19 @@ var _ = m("pie-lib:graphing-solution-set:graph"), v = {
|
|
|
110
130
|
}, void 0), this.updateMarks(c, l, !0);
|
|
111
131
|
};
|
|
112
132
|
render() {
|
|
113
|
-
let { axesSettings: t, currentTool: r, coordinatesOnHover: a, size: s, disabledLabels: c, disabledTitle: l, domain: u, backgroundMarks: p, range: m, title:
|
|
114
|
-
graphProps:
|
|
115
|
-
labelModeEnabled:
|
|
116
|
-
gssLineData:
|
|
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
|
|
117
138
|
};
|
|
118
|
-
|
|
119
|
-
marks:
|
|
139
|
+
P = T({
|
|
140
|
+
marks: P || [],
|
|
120
141
|
currentTool: r
|
|
121
142
|
});
|
|
122
|
-
let
|
|
123
|
-
|
|
124
|
-
if (
|
|
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)) {
|
|
125
146
|
let e = {
|
|
126
147
|
type: "polygon",
|
|
127
148
|
building: !1,
|
|
@@ -129,52 +150,62 @@ var _ = m("pie-lib:graphing-solution-set:graph"), v = {
|
|
|
129
150
|
points: t,
|
|
130
151
|
isSolution: !1
|
|
131
152
|
};
|
|
132
|
-
|
|
153
|
+
M || P.push(e);
|
|
133
154
|
}
|
|
134
155
|
});
|
|
135
|
-
let
|
|
136
|
-
|
|
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, {
|
|
137
166
|
rootRef: (e) => this.rootNode = e,
|
|
138
167
|
disabledTitle: l,
|
|
139
168
|
disabledLabels: c,
|
|
140
|
-
labels:
|
|
141
|
-
labelsPlaceholders:
|
|
142
|
-
showPixelGuides:
|
|
143
|
-
showLabels:
|
|
144
|
-
showTitle:
|
|
145
|
-
title:
|
|
146
|
-
titlePlaceholder:
|
|
147
|
-
onChangeTitle:
|
|
148
|
-
onChangeLabels:
|
|
149
|
-
mathMlOptions:
|
|
150
|
-
|
|
151
|
-
|
|
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", {
|
|
152
183
|
transform: u && u.padding && u.range ? `translate(${u.padding}, ${m.padding})` : void 0,
|
|
153
184
|
children: [
|
|
154
|
-
/* @__PURE__ */
|
|
155
|
-
/* @__PURE__ */
|
|
185
|
+
/* @__PURE__ */ _(i, { ...L }),
|
|
186
|
+
/* @__PURE__ */ _(n, {
|
|
156
187
|
...t,
|
|
157
|
-
...
|
|
188
|
+
...L
|
|
158
189
|
}),
|
|
159
|
-
/* @__PURE__ */
|
|
190
|
+
/* @__PURE__ */ _(o, {
|
|
160
191
|
...s,
|
|
161
192
|
onClick: this.onBgClick,
|
|
162
|
-
...
|
|
193
|
+
...L
|
|
163
194
|
}),
|
|
164
|
-
/* @__PURE__ */
|
|
195
|
+
/* @__PURE__ */ v("mask", {
|
|
165
196
|
id: `${this.maskUid}`,
|
|
166
|
-
children: [/* @__PURE__ */
|
|
167
|
-
...
|
|
197
|
+
children: [/* @__PURE__ */ _("rect", {
|
|
198
|
+
...I,
|
|
168
199
|
fill: "white"
|
|
169
200
|
}), " "]
|
|
170
201
|
}),
|
|
171
|
-
/* @__PURE__ */
|
|
202
|
+
/* @__PURE__ */ v("g", {
|
|
172
203
|
id: "marks",
|
|
173
204
|
mask: `url('#${this.maskUid}')`,
|
|
174
205
|
children: [
|
|
175
206
|
(p || []).map((e, t) => {
|
|
176
207
|
let n = this.getComponent(e), r = e.type;
|
|
177
|
-
return /* @__PURE__ */
|
|
208
|
+
return /* @__PURE__ */ _(n, {
|
|
178
209
|
mark: {
|
|
179
210
|
...e,
|
|
180
211
|
disabled: !0,
|
|
@@ -182,12 +213,12 @@ var _ = m("pie-lib:graphing-solution-set:graph"), v = {
|
|
|
182
213
|
},
|
|
183
214
|
labelNode: this.state.labelNode,
|
|
184
215
|
onClick: this.onBgClick,
|
|
185
|
-
...
|
|
216
|
+
...L
|
|
186
217
|
}, `${r}-${t}-bg`);
|
|
187
218
|
}),
|
|
188
|
-
|
|
219
|
+
z.map((e, t) => {
|
|
189
220
|
let n = this.getComponent(e), i = e.type;
|
|
190
|
-
return /* @__PURE__ */
|
|
221
|
+
return /* @__PURE__ */ _(n, {
|
|
191
222
|
mark: e,
|
|
192
223
|
coordinatesOnHover: a,
|
|
193
224
|
onChange: this.changeMark,
|
|
@@ -197,10 +228,10 @@ var _ = m("pie-lib:graphing-solution-set:graph"), v = {
|
|
|
197
228
|
onDragStop: this.stopDrag,
|
|
198
229
|
labelNode: this.state.labelNode,
|
|
199
230
|
isToolActive: r && i === r.type,
|
|
200
|
-
...
|
|
231
|
+
...L
|
|
201
232
|
}, `${i}-${t}`);
|
|
202
233
|
}),
|
|
203
|
-
/* @__PURE__ */
|
|
234
|
+
/* @__PURE__ */ _("foreignObject", {
|
|
204
235
|
ref: (e) => this.labelNode = e,
|
|
205
236
|
x: "0",
|
|
206
237
|
y: "0",
|
|
@@ -218,4 +249,4 @@ var _ = m("pie-lib:graphing-solution-set:graph"), v = {
|
|
|
218
249
|
}
|
|
219
250
|
};
|
|
220
251
|
//#endregion
|
|
221
|
-
export {
|
|
252
|
+
export { E as Graph, E as default, x as graphPropTypes, T as removeBuildingToolIfCurrentToolDiffers };
|
package/dist/mark-label.d.ts
CHANGED
package/dist/mark-label.js
CHANGED
|
@@ -1,29 +1,31 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import a from "
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
1
|
+
import { roundNumber as e } from "./utils.js";
|
|
2
|
+
import { AutosizeInput as t } from "./autosize-input.js";
|
|
3
|
+
import { useDebounce as n } from "./use-debounce.js";
|
|
4
|
+
import { useCallback as r, useEffect as i, useState as a } from "react";
|
|
5
|
+
import o from "prop-types";
|
|
6
|
+
import { types as s } from "@pie-lib/plot";
|
|
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";
|
|
9
11
|
//#region src/mark-label.tsx
|
|
10
|
-
var
|
|
12
|
+
var { translator: f } = c, p = u(t, { shouldForwardProp: (e) => !["disabled", "markDisabled"].includes(e) })(({ theme: e, disabled: t, markDisabled: n }) => ({ "& input": {
|
|
11
13
|
float: "right",
|
|
12
14
|
padding: e.spacing(.5),
|
|
13
15
|
fontFamily: e.typography.fontFamily,
|
|
14
16
|
fontSize: e.typography.fontSize,
|
|
15
|
-
border: `solid 1px ${t ?
|
|
17
|
+
border: `solid 1px ${t ? d.defaults.PRIMARY_DARK : n ? d.disabled() : d.defaults.SECONDARY}`,
|
|
16
18
|
borderRadius: "3px",
|
|
17
|
-
color: n ?
|
|
19
|
+
color: n ? d.disabled() : d.defaults.PRIMARY_DARK,
|
|
18
20
|
background: t || n ? e.palette.background.paper : "transparent"
|
|
19
|
-
} })),
|
|
21
|
+
} })), m = (e, t, n) => {
|
|
20
22
|
n ||= {
|
|
21
23
|
width: 0,
|
|
22
24
|
height: 0
|
|
23
25
|
};
|
|
24
26
|
let { scale: r, domain: i, range: a } = e, o = r.x(t.x) + n.width + 10, s = r.y(t.y) + n.height + 10, c = o >= r.x(i.max) ? "left" : "right";
|
|
25
27
|
return `${s >= r.y(a.min) ? "top" : "bottom"}-${c}`;
|
|
26
|
-
},
|
|
28
|
+
}, h = (e, t, n, r) => {
|
|
27
29
|
let { scale: i } = e;
|
|
28
30
|
switch (n ||= {
|
|
29
31
|
width: 0,
|
|
@@ -46,39 +48,45 @@ var u = c(e, { shouldForwardProp: (e) => !["disabled", "markDisabled"].includes(
|
|
|
46
48
|
top: i.y(t.y) - 10 - n.height
|
|
47
49
|
};
|
|
48
50
|
}
|
|
49
|
-
},
|
|
50
|
-
let [
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}, [
|
|
54
|
-
typeof
|
|
55
|
-
}, [
|
|
56
|
-
let
|
|
51
|
+
}, g = (t) => {
|
|
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
|
+
i(() => {
|
|
54
|
+
b(u.label);
|
|
55
|
+
}, [u.label]), i(() => {
|
|
56
|
+
typeof S == "string" && S !== u.label && t.onChange(S);
|
|
57
|
+
}, [S]);
|
|
58
|
+
let C = o ? o.getBoundingClientRect() : {
|
|
57
59
|
width: 0,
|
|
58
60
|
height: 0
|
|
59
|
-
},
|
|
61
|
+
}, w = {
|
|
60
62
|
position: "fixed",
|
|
61
63
|
pointerEvents: "auto",
|
|
62
|
-
...
|
|
63
|
-
};
|
|
64
|
-
return /* @__PURE__ */
|
|
64
|
+
...h(d, u, C, m(d, u, C))
|
|
65
|
+
}, T = g || u.disabled;
|
|
66
|
+
return /* @__PURE__ */ l(p, {
|
|
65
67
|
inputRef: (e) => {
|
|
66
|
-
c(e),
|
|
68
|
+
c(e), _(e);
|
|
67
69
|
},
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
"aria-label": Number.isFinite(u.x) && Number.isFinite(u.y) ? f.t("graphing.markLabel", {
|
|
71
|
+
lng: v,
|
|
72
|
+
x: e(u.x),
|
|
73
|
+
y: e(u.y)
|
|
74
|
+
}) : f.t("graphing.label", { lng: v }),
|
|
75
|
+
disabled: T,
|
|
76
|
+
markDisabled: u.disabled,
|
|
77
|
+
value: y,
|
|
78
|
+
style: w,
|
|
79
|
+
onChange: x
|
|
73
80
|
});
|
|
74
81
|
};
|
|
75
|
-
|
|
76
|
-
disabled:
|
|
77
|
-
onChange:
|
|
78
|
-
graphProps:
|
|
79
|
-
inputRef:
|
|
80
|
-
|
|
81
|
-
|
|
82
|
+
g.propTypes = {
|
|
83
|
+
disabled: o.bool,
|
|
84
|
+
onChange: o.func,
|
|
85
|
+
graphProps: s.GraphPropsType,
|
|
86
|
+
inputRef: o.func,
|
|
87
|
+
language: o.string,
|
|
88
|
+
mark: o.object,
|
|
89
|
+
theme: o.object
|
|
82
90
|
};
|
|
83
91
|
//#endregion
|
|
84
|
-
export {
|
|
92
|
+
export { g as MarkLabel, g as default, h as coordinates, m as position };
|
package/dist/tool-menu.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export declare class ToolMenu extends React.Component {
|
|
|
6
6
|
disabled: PropTypes.Requireable<boolean>;
|
|
7
7
|
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
8
8
|
};
|
|
9
|
+
idPrefix: string;
|
|
9
10
|
onChangeRadioValue: any;
|
|
10
11
|
lineTypeChange: any;
|
|
11
12
|
render(): React.JSX.Element;
|
package/dist/tool-menu.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import e from "react";
|
|
2
2
|
import t from "prop-types";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { uniqueId as n } from "@pie-element/shared-lodash";
|
|
4
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
5
|
+
import { styled as a } from "@mui/material/styles";
|
|
6
|
+
import { Button as o, Radio as s, Typography as c } from "@mui/material";
|
|
6
7
|
//#region src/tool-menu.tsx
|
|
7
|
-
var
|
|
8
|
+
var l = class extends e.Component {
|
|
8
9
|
static propTypes = {
|
|
9
10
|
gssLineData: t.object,
|
|
10
11
|
disabled: t.bool,
|
|
11
12
|
onChange: t.func
|
|
12
13
|
};
|
|
14
|
+
idPrefix = n("gss-tool-menu-");
|
|
13
15
|
onChangeRadioValue = (e) => {
|
|
14
16
|
let { gssLineData: t, onChange: n } = this.props, r = t.selectedTool;
|
|
15
17
|
t.selectedTool = e.target.value, n(t, r);
|
|
@@ -20,27 +22,29 @@ var c = class extends e.Component {
|
|
|
20
22
|
};
|
|
21
23
|
render() {
|
|
22
24
|
let { gssLineData: e, disabled: t } = this.props;
|
|
23
|
-
return /* @__PURE__ */
|
|
25
|
+
return /* @__PURE__ */ r(u, { children: /* @__PURE__ */ i("div", {
|
|
24
26
|
className: "selectLineRadioGroup",
|
|
25
27
|
children: [
|
|
26
|
-
/* @__PURE__ */
|
|
28
|
+
/* @__PURE__ */ i("div", {
|
|
27
29
|
className: "radioFieldOuter",
|
|
28
|
-
children: [/* @__PURE__ */
|
|
30
|
+
children: [/* @__PURE__ */ i("div", {
|
|
29
31
|
className: "radioFieldInner",
|
|
30
|
-
children: [/* @__PURE__ */
|
|
32
|
+
children: [/* @__PURE__ */ r(s, {
|
|
31
33
|
name: "select-line-radio-buttons",
|
|
32
34
|
onChange: this.onChangeRadioValue,
|
|
33
35
|
value: "lineA",
|
|
34
36
|
disabled: !!t,
|
|
35
37
|
checked: e.selectedTool === "lineA",
|
|
36
|
-
className: "lineTypeRadio"
|
|
37
|
-
|
|
38
|
+
className: "lineTypeRadio",
|
|
39
|
+
inputProps: { "aria-labelledby": `${this.idPrefix}-lineA` }
|
|
40
|
+
}), /* @__PURE__ */ r(c, {
|
|
41
|
+
id: `${this.idPrefix}-lineA`,
|
|
38
42
|
className: "lineNameFont",
|
|
39
43
|
children: "Line A"
|
|
40
44
|
})]
|
|
41
|
-
}), /* @__PURE__ */
|
|
45
|
+
}), /* @__PURE__ */ i("div", {
|
|
42
46
|
className: "radioFieldButtons",
|
|
43
|
-
children: [/* @__PURE__ */
|
|
47
|
+
children: [/* @__PURE__ */ i(o, {
|
|
44
48
|
size: "small",
|
|
45
49
|
variant: "contained",
|
|
46
50
|
color: e.lineA.lineType === "Solid" ? "primary" : "inherit",
|
|
@@ -48,7 +52,7 @@ var c = class extends e.Component {
|
|
|
48
52
|
onClick: () => this.lineTypeChange("A", "Solid"),
|
|
49
53
|
className: e.lineA.lineType === "Solid" ? t ? "lineTypeButtonLeftSelectedDisabled" : "lineTypeButtonLeftSelected" : t ? "lineTypeButtonLeftUnSelectedDisabled" : "lineTypeButtonLeftUnSelected",
|
|
50
54
|
children: [e.lineA.lineType === "Solid" && "✔", " Solid"]
|
|
51
|
-
}), /* @__PURE__ */
|
|
55
|
+
}), /* @__PURE__ */ i(o, {
|
|
52
56
|
size: "small",
|
|
53
57
|
variant: "contained",
|
|
54
58
|
color: e.lineA.lineType === "Dashed" ? "primary" : "inherit",
|
|
@@ -59,24 +63,26 @@ var c = class extends e.Component {
|
|
|
59
63
|
})]
|
|
60
64
|
})]
|
|
61
65
|
}),
|
|
62
|
-
e.numberOfLines === 2 && /* @__PURE__ */
|
|
66
|
+
e.numberOfLines === 2 && /* @__PURE__ */ i("div", {
|
|
63
67
|
className: "radioFieldOuter",
|
|
64
|
-
children: [/* @__PURE__ */
|
|
68
|
+
children: [/* @__PURE__ */ i("div", {
|
|
65
69
|
className: "radioFieldInner",
|
|
66
|
-
children: [/* @__PURE__ */
|
|
70
|
+
children: [/* @__PURE__ */ r(s, {
|
|
67
71
|
name: "select-line-radio-buttons",
|
|
68
72
|
onChange: this.onChangeRadioValue,
|
|
69
73
|
value: "lineB",
|
|
70
74
|
disabled: !!t,
|
|
71
75
|
checked: e.selectedTool === "lineB",
|
|
72
|
-
className: "lineTypeRadio"
|
|
73
|
-
|
|
76
|
+
className: "lineTypeRadio",
|
|
77
|
+
inputProps: { "aria-labelledby": `${this.idPrefix}-lineB` }
|
|
78
|
+
}), /* @__PURE__ */ r(c, {
|
|
79
|
+
id: `${this.idPrefix}-lineB`,
|
|
74
80
|
className: "lineNameFont",
|
|
75
81
|
children: "Line B"
|
|
76
82
|
})]
|
|
77
|
-
}), /* @__PURE__ */
|
|
83
|
+
}), /* @__PURE__ */ i("div", {
|
|
78
84
|
className: "radioFieldButtons",
|
|
79
|
-
children: [/* @__PURE__ */
|
|
85
|
+
children: [/* @__PURE__ */ i(o, {
|
|
80
86
|
size: "small",
|
|
81
87
|
variant: "contained",
|
|
82
88
|
color: e.lineB.lineType === "Solid" ? "primary" : "inherit",
|
|
@@ -84,7 +90,7 @@ var c = class extends e.Component {
|
|
|
84
90
|
onClick: () => this.lineTypeChange("B", "Solid"),
|
|
85
91
|
className: e.lineB.lineType === "Solid" ? t ? "lineTypeButtonLeftSelectedDisabled" : "lineTypeButtonLeftSelected" : t ? "lineTypeButtonLeftUnSelectedDisabled" : "lineTypeButtonLeftUnSelected",
|
|
86
92
|
children: [e.lineB.lineType === "Solid" && "✔", " Solid"]
|
|
87
|
-
}), /* @__PURE__ */
|
|
93
|
+
}), /* @__PURE__ */ i(o, {
|
|
88
94
|
size: "small",
|
|
89
95
|
variant: "contained",
|
|
90
96
|
color: e.lineB.lineType === "Dashed" ? "primary" : "inherit",
|
|
@@ -95,18 +101,20 @@ var c = class extends e.Component {
|
|
|
95
101
|
})]
|
|
96
102
|
})]
|
|
97
103
|
}),
|
|
98
|
-
/* @__PURE__ */
|
|
104
|
+
/* @__PURE__ */ r("div", {
|
|
99
105
|
className: "radioFieldOuter",
|
|
100
|
-
children: /* @__PURE__ */
|
|
106
|
+
children: /* @__PURE__ */ i("div", {
|
|
101
107
|
className: "radioFieldInner",
|
|
102
|
-
children: [/* @__PURE__ */
|
|
108
|
+
children: [/* @__PURE__ */ r(s, {
|
|
103
109
|
name: "select-line-radio-buttons",
|
|
104
110
|
onChange: this.onChangeRadioValue,
|
|
105
111
|
value: "solutionSet",
|
|
106
112
|
disabled: !!t,
|
|
107
113
|
checked: e.selectedTool === "solutionSet",
|
|
108
|
-
className: "lineTypeRadio"
|
|
109
|
-
|
|
114
|
+
className: "lineTypeRadio",
|
|
115
|
+
inputProps: { "aria-labelledby": `${this.idPrefix}-solutionSet` }
|
|
116
|
+
}), /* @__PURE__ */ r(c, {
|
|
117
|
+
id: `${this.idPrefix}-solutionSet`,
|
|
110
118
|
className: "lineNameFont",
|
|
111
119
|
children: "Solution Set"
|
|
112
120
|
})]
|
|
@@ -115,7 +123,7 @@ var c = class extends e.Component {
|
|
|
115
123
|
]
|
|
116
124
|
}) });
|
|
117
125
|
}
|
|
118
|
-
},
|
|
126
|
+
}, u = a("div")(() => ({
|
|
119
127
|
"& .selectLineRadioGroup": {
|
|
120
128
|
display: "flex",
|
|
121
129
|
flexWrap: "wrap",
|
|
@@ -185,4 +193,4 @@ var c = class extends e.Component {
|
|
|
185
193
|
}
|
|
186
194
|
}));
|
|
187
195
|
//#endregion
|
|
188
|
-
export {
|
|
196
|
+
export { l as ToolMenu, l as default };
|
|
@@ -95,6 +95,7 @@ declare const Component: {
|
|
|
95
95
|
height: PropTypes.Validator<number>;
|
|
96
96
|
}>>>;
|
|
97
97
|
}>>>;
|
|
98
|
+
language: PropTypes.Requireable<string>;
|
|
98
99
|
mark: PropTypes.Requireable<object>;
|
|
99
100
|
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
100
101
|
onDelete: PropTypes.Requireable<(...args: any[]) => any>;
|
|
@@ -58,6 +58,7 @@ export declare const lineToolComponent: (Component: any) => {
|
|
|
58
58
|
height: PropTypes.Validator<number>;
|
|
59
59
|
}>>>;
|
|
60
60
|
}>>>;
|
|
61
|
+
language: PropTypes.Requireable<string>;
|
|
61
62
|
mark: PropTypes.Requireable<object>;
|
|
62
63
|
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
63
64
|
onDelete: PropTypes.Requireable<(...args: any[]) => any>;
|
|
@@ -181,6 +182,7 @@ export declare const lineBase: (Comp: any, opts: any) => {
|
|
|
181
182
|
labelNode: PropTypes.Requireable<object>;
|
|
182
183
|
labelModeEnabled: PropTypes.Requireable<boolean>;
|
|
183
184
|
changeMarkProps: PropTypes.Requireable<(...args: any[]) => any>;
|
|
185
|
+
language: PropTypes.Requireable<string>;
|
|
184
186
|
};
|
|
185
187
|
contextType?: React.Context<any> | undefined;
|
|
186
188
|
};
|
|
@@ -25,7 +25,8 @@ var S = (t, n) => () => ({
|
|
|
25
25
|
}), C = (e) => class extends l.Component {
|
|
26
26
|
static propTypes = {
|
|
27
27
|
...g.ToolPropTypeFields,
|
|
28
|
-
graphProps: g.GraphPropsType.isRequired
|
|
28
|
+
graphProps: g.GraphPropsType.isRequired,
|
|
29
|
+
language: u.string
|
|
29
30
|
};
|
|
30
31
|
constructor(e) {
|
|
31
32
|
super(e), this.state = {};
|
|
@@ -66,16 +67,16 @@ var S = (t, n) => () => ({
|
|
|
66
67
|
}), p(i, a) || r(i, a);
|
|
67
68
|
};
|
|
68
69
|
render() {
|
|
69
|
-
let { graphProps: t, onClick: n, labelNode: r, labelModeEnabled: i, coordinatesOnHover: a, gssLineData: o } = this.props,
|
|
70
|
-
return
|
|
71
|
-
disabled:
|
|
70
|
+
let { graphProps: t, onClick: n, labelNode: r, labelModeEnabled: i, coordinatesOnHover: a, gssLineData: o, language: s } = this.props, c = this.state.mark ? this.state.mark : this.props.mark, l = d(c.from), u = d(c.to), f = d(c.middle);
|
|
71
|
+
return l && c.isBackground && (l.disabled = !0), u && c.isBackground && (u.disabled = !0), f && c.isBackground && (f.disabled = !0), /* @__PURE__ */ v(e, {
|
|
72
|
+
disabled: c.disabled,
|
|
72
73
|
coordinatesOnHover: a,
|
|
73
|
-
correctness:
|
|
74
|
-
from:
|
|
75
|
-
to:
|
|
76
|
-
middle:
|
|
74
|
+
correctness: c.correctness,
|
|
75
|
+
from: l,
|
|
76
|
+
to: u,
|
|
77
|
+
middle: f,
|
|
77
78
|
graphProps: t,
|
|
78
|
-
fill:
|
|
79
|
+
fill: c && c.fill,
|
|
79
80
|
gssLineData: o,
|
|
80
81
|
onChange: this.changeMark,
|
|
81
82
|
changeMarkProps: this.changeMarkProps,
|
|
@@ -83,7 +84,8 @@ var S = (t, n) => () => ({
|
|
|
83
84
|
onDragStart: this.startDrag,
|
|
84
85
|
onDragStop: this.stopDrag,
|
|
85
86
|
labelNode: r,
|
|
86
|
-
labelModeEnabled: i
|
|
87
|
+
labelModeEnabled: i,
|
|
88
|
+
language: s
|
|
87
89
|
});
|
|
88
90
|
}
|
|
89
91
|
}, w = () => ({
|
|
@@ -121,7 +123,8 @@ var S = (t, n) => () => ({
|
|
|
121
123
|
disabled: u.bool,
|
|
122
124
|
labelNode: u.object,
|
|
123
125
|
labelModeEnabled: u.bool,
|
|
124
|
-
changeMarkProps: u.func
|
|
126
|
+
changeMarkProps: u.func,
|
|
127
|
+
language: u.string
|
|
125
128
|
};
|
|
126
129
|
onChangePoint = (n) => {
|
|
127
130
|
let { middle: r, onChange: i } = this.props, { from: a, to: o } = n;
|
|
@@ -180,7 +183,7 @@ var S = (t, n) => () => ({
|
|
|
180
183
|
};
|
|
181
184
|
input = {};
|
|
182
185
|
render() {
|
|
183
|
-
let { coordinatesOnHover: e, graphProps: t, fill: n, gssLineData: r, onDragStart: c, onDragStop: l, from: u, to: d, middle: f, disabled: p, correctness: m, onClick: g, labelNode: _, labelModeEnabled: b } = this.props,
|
|
186
|
+
let { coordinatesOnHover: e, graphProps: t, fill: n, gssLineData: r, onDragStart: c, onDragStop: l, from: u, to: d, middle: f, disabled: p, correctness: m, onClick: g, labelNode: _, labelModeEnabled: b, language: S } = this.props, C = {
|
|
184
187
|
graphProps: t,
|
|
185
188
|
fill: n,
|
|
186
189
|
onDragStart: c,
|
|
@@ -189,37 +192,40 @@ var S = (t, n) => () => ({
|
|
|
189
192
|
correctness: m,
|
|
190
193
|
onClick: g
|
|
191
194
|
};
|
|
192
|
-
r && r.selectedTool === "solutionSet" && (
|
|
195
|
+
r && r.selectedTool === "solutionSet" && (C = {
|
|
193
196
|
graphProps: t,
|
|
194
197
|
fill: n,
|
|
195
198
|
disabled: p,
|
|
196
199
|
correctness: m,
|
|
197
200
|
onClick: g
|
|
198
201
|
});
|
|
199
|
-
let
|
|
200
|
-
return _ && (u && Object.prototype.hasOwnProperty.call(u, "label") && (
|
|
202
|
+
let w = d ? h.toDegrees(h.angle(u, d)) : 0, T = null, E = null, D = null;
|
|
203
|
+
return _ && (u && Object.prototype.hasOwnProperty.call(u, "label") && (T = x.createPortal(/* @__PURE__ */ v(s, {
|
|
201
204
|
inputRef: (e) => this.input.from = e,
|
|
202
205
|
disabled: !b,
|
|
203
206
|
mark: u,
|
|
204
207
|
graphProps: t,
|
|
208
|
+
language: S,
|
|
205
209
|
onChange: (e) => this.labelChange({
|
|
206
210
|
...u,
|
|
207
211
|
label: e
|
|
208
212
|
}, "from")
|
|
209
|
-
}), _)), d && Object.prototype.hasOwnProperty.call(d, "label") && (
|
|
213
|
+
}), _)), d && Object.prototype.hasOwnProperty.call(d, "label") && (E = x.createPortal(/* @__PURE__ */ v(s, {
|
|
210
214
|
inputRef: (e) => this.input.to = e,
|
|
211
215
|
disabled: !b,
|
|
212
216
|
mark: d,
|
|
213
217
|
graphProps: t,
|
|
218
|
+
language: S,
|
|
214
219
|
onChange: (e) => this.labelChange({
|
|
215
220
|
...d,
|
|
216
221
|
label: e
|
|
217
222
|
}, "to")
|
|
218
|
-
}), _)), f && Object.prototype.hasOwnProperty.call(f, "label") && (
|
|
223
|
+
}), _)), f && Object.prototype.hasOwnProperty.call(f, "label") && (D = x.createPortal(/* @__PURE__ */ v(s, {
|
|
219
224
|
inputRef: (e) => this.input.middle = e,
|
|
220
225
|
disabled: !b,
|
|
221
226
|
mark: f,
|
|
222
227
|
graphProps: t,
|
|
228
|
+
language: S,
|
|
223
229
|
onChange: (e) => this.labelChange({
|
|
224
230
|
...f,
|
|
225
231
|
label: e
|
|
@@ -229,57 +235,57 @@ var S = (t, n) => () => ({
|
|
|
229
235
|
from: u,
|
|
230
236
|
to: d,
|
|
231
237
|
middle: f,
|
|
232
|
-
...
|
|
238
|
+
...C
|
|
233
239
|
}),
|
|
234
|
-
|
|
240
|
+
D,
|
|
235
241
|
/* @__PURE__ */ v(a, {
|
|
236
242
|
x: u.x,
|
|
237
243
|
y: u.y,
|
|
238
244
|
labelNode: _,
|
|
239
245
|
coordinatesOnHover: e,
|
|
240
|
-
...
|
|
246
|
+
...C
|
|
241
247
|
}),
|
|
242
|
-
|
|
248
|
+
T,
|
|
243
249
|
d && /* @__PURE__ */ v(o, {
|
|
244
250
|
x: d.x,
|
|
245
251
|
y: d.y,
|
|
246
|
-
angle:
|
|
252
|
+
angle: w,
|
|
247
253
|
labelNode: _,
|
|
248
254
|
coordinatesOnHover: e,
|
|
249
|
-
...
|
|
255
|
+
...C
|
|
250
256
|
}),
|
|
251
|
-
|
|
257
|
+
E
|
|
252
258
|
] }) : /* @__PURE__ */ y("g", { children: [
|
|
253
259
|
d && /* @__PURE__ */ v(i, {
|
|
254
260
|
from: u,
|
|
255
261
|
to: d,
|
|
256
262
|
middle: f,
|
|
257
263
|
onDrag: this.dragComp,
|
|
258
|
-
...
|
|
264
|
+
...C,
|
|
259
265
|
onClick: (e) => this.clickPoint(f, "middle", e)
|
|
260
266
|
}),
|
|
261
|
-
|
|
267
|
+
D,
|
|
262
268
|
/* @__PURE__ */ v(a, {
|
|
263
269
|
x: u.x,
|
|
264
270
|
y: u.y,
|
|
265
271
|
labelNode: _,
|
|
266
272
|
coordinatesOnHover: e,
|
|
267
273
|
onDrag: this.dragFrom,
|
|
268
|
-
...
|
|
274
|
+
...C,
|
|
269
275
|
onClick: (e) => this.clickPoint(u, "from", e)
|
|
270
276
|
}),
|
|
271
|
-
|
|
277
|
+
T,
|
|
272
278
|
d && /* @__PURE__ */ v(o, {
|
|
273
279
|
x: d.x,
|
|
274
280
|
y: d.y,
|
|
275
|
-
angle:
|
|
281
|
+
angle: w,
|
|
276
282
|
labelNode: _,
|
|
277
283
|
coordinatesOnHover: e,
|
|
278
284
|
onDrag: this.dragTo,
|
|
279
|
-
...
|
|
285
|
+
...C,
|
|
280
286
|
onClick: (e) => this.clickPoint(d, "to", e)
|
|
281
287
|
}),
|
|
282
|
-
|
|
288
|
+
E
|
|
283
289
|
] });
|
|
284
290
|
}
|
|
285
291
|
}
|
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
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import a from "@
|
|
7
|
-
import o from "@
|
|
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 } =
|
|
10
|
-
color:
|
|
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:
|
|
23
|
-
return /* @__PURE__ */
|
|
22
|
+
let { className: e, onReset: t = !1, language: n } = this.props;
|
|
23
|
+
return /* @__PURE__ */ r("div", {
|
|
24
24
|
className: e,
|
|
25
|
-
children: /* @__PURE__ */
|
|
25
|
+
children: /* @__PURE__ */ r(c, {
|
|
26
26
|
onClick: () => t(),
|
|
27
|
-
children: s.t("graphing.reset", { lng:
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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"
|