@pie-lib/graphing-solution-set 2.34.1 → 2.35.0-mui-update.0
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/CHANGELOG.md +10 -15
- package/lib/axis/arrow.js +19 -55
- package/lib/axis/arrow.js.map +1 -1
- package/lib/axis/axes.js +101 -184
- package/lib/axis/axes.js.map +1 -1
- package/lib/axis/index.js +1 -6
- package/lib/axis/index.js.map +1 -1
- package/lib/bg.js +21 -49
- package/lib/bg.js.map +1 -1
- package/lib/container/actions.js +2 -8
- package/lib/container/actions.js.map +1 -1
- package/lib/container/index.js +14 -60
- package/lib/container/index.js.map +1 -1
- package/lib/container/marks.js +1 -6
- package/lib/container/marks.js.map +1 -1
- package/lib/container/middleware.js +2 -8
- package/lib/container/middleware.js.map +1 -1
- package/lib/container/reducer.js +1 -8
- package/lib/container/reducer.js.map +1 -1
- package/lib/coordinates-label.js +23 -55
- package/lib/coordinates-label.js.map +1 -1
- package/lib/graph-with-controls.js +132 -203
- package/lib/graph-with-controls.js.map +1 -1
- package/lib/graph.js +61 -126
- package/lib/graph.js.map +1 -1
- package/lib/grid-setup.js +161 -223
- package/lib/grid-setup.js.map +1 -1
- package/lib/grid.js +28 -73
- package/lib/grid.js.map +1 -1
- package/lib/index.js +1 -12
- package/lib/index.js.map +1 -1
- package/lib/labels.js +84 -184
- package/lib/labels.js.map +1 -1
- package/lib/mark-label.js +40 -88
- package/lib/mark-label.js.map +1 -1
- package/lib/toggle-bar.js +158 -242
- package/lib/toggle-bar.js.map +1 -1
- package/lib/tool-menu.js +93 -200
- package/lib/tool-menu.js.map +1 -1
- package/lib/tools/index.js +2 -7
- package/lib/tools/index.js.map +1 -1
- package/lib/tools/line/component.js +48 -62
- package/lib/tools/line/component.js.map +1 -1
- package/lib/tools/line/index.js +1 -6
- package/lib/tools/line/index.js.map +1 -1
- package/lib/tools/polygon/component.js +75 -172
- package/lib/tools/polygon/component.js.map +1 -1
- package/lib/tools/polygon/index.js +6 -23
- package/lib/tools/polygon/index.js.map +1 -1
- package/lib/tools/polygon/line.js +48 -85
- package/lib/tools/polygon/line.js.map +1 -1
- package/lib/tools/polygon/polygon.js +64 -102
- package/lib/tools/polygon/polygon.js.map +1 -1
- package/lib/tools/shared/arrow-head.js +7 -20
- package/lib/tools/shared/arrow-head.js.map +1 -1
- package/lib/tools/shared/line/index.js +86 -182
- package/lib/tools/shared/line/index.js.map +1 -1
- package/lib/tools/shared/line/line-path.js +70 -94
- package/lib/tools/shared/line/line-path.js.map +1 -1
- package/lib/tools/shared/line/with-root-edge.js +21 -55
- package/lib/tools/shared/line/with-root-edge.js.map +1 -1
- package/lib/tools/shared/point/arrow-point.js +18 -45
- package/lib/tools/shared/point/arrow-point.js.map +1 -1
- package/lib/tools/shared/point/arrow.js +16 -42
- package/lib/tools/shared/point/arrow.js.map +1 -1
- package/lib/tools/shared/point/base-point.js +22 -52
- package/lib/tools/shared/point/base-point.js.map +1 -1
- package/lib/tools/shared/point/index.js +30 -52
- package/lib/tools/shared/point/index.js.map +1 -1
- package/lib/tools/shared/styles.js +8 -31
- package/lib/tools/shared/styles.js.map +1 -1
- package/lib/tools/shared/types.js +1 -5
- package/lib/tools/shared/types.js.map +1 -1
- package/lib/undo-redo.js +27 -67
- package/lib/undo-redo.js.map +1 -1
- package/lib/use-debounce.js +4 -11
- package/lib/use-debounce.js.map +1 -1
- package/lib/utils.js +56 -131
- package/lib/utils.js.map +1 -1
- package/package.json +16 -14
- package/src/axis/arrow.jsx +7 -12
- package/src/axis/axes.jsx +32 -37
- package/src/coordinates-label.jsx +13 -18
- package/src/graph-with-controls.jsx +90 -93
- package/src/grid-setup.jsx +204 -206
- package/src/grid.jsx +1 -3
- package/src/labels.jsx +83 -124
- package/src/mark-label.jsx +14 -25
- package/src/toggle-bar.jsx +155 -166
- package/src/tool-menu.jsx +136 -195
- package/src/tools/line/component.jsx +29 -29
- package/src/tools/polygon/component.jsx +1 -3
- package/src/tools/polygon/line.jsx +26 -24
- package/src/tools/polygon/polygon.jsx +34 -39
- package/src/tools/shared/line/line-path.jsx +50 -47
- package/src/tools/shared/point/index.jsx +22 -34
- package/src/undo-redo.jsx +16 -24
|
@@ -1,27 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.tool = exports.addPointToArray = void 0;
|
|
9
|
-
|
|
10
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
-
|
|
12
9
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
13
|
-
|
|
14
10
|
var _component = _interopRequireDefault(require("./component"));
|
|
15
|
-
|
|
16
11
|
var _utils = require("../../utils");
|
|
17
|
-
|
|
18
|
-
function
|
|
19
|
-
|
|
20
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
21
|
-
|
|
22
|
-
var addPointToArray = function addPointToArray(point, arr) {
|
|
12
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
14
|
+
var addPointToArray = exports.addPointToArray = function addPointToArray(point, arr) {
|
|
23
15
|
arr = arr || [];
|
|
24
|
-
|
|
25
16
|
if (arr.length === 0) {
|
|
26
17
|
return {
|
|
27
18
|
points: [point],
|
|
@@ -41,7 +32,6 @@ var addPointToArray = function addPointToArray(point, arr) {
|
|
|
41
32
|
}
|
|
42
33
|
} else if (arr.length >= 2) {
|
|
43
34
|
var closed = (0, _utils.equalPoints)(point, arr[0]);
|
|
44
|
-
|
|
45
35
|
if (closed) {
|
|
46
36
|
return {
|
|
47
37
|
points: arr,
|
|
@@ -51,7 +41,6 @@ var addPointToArray = function addPointToArray(point, arr) {
|
|
|
51
41
|
var hasPoint = !!arr.find(function (p) {
|
|
52
42
|
return (0, _utils.equalPoints)(p, point);
|
|
53
43
|
});
|
|
54
|
-
|
|
55
44
|
if (hasPoint) {
|
|
56
45
|
return {
|
|
57
46
|
points: arr,
|
|
@@ -66,10 +55,7 @@ var addPointToArray = function addPointToArray(point, arr) {
|
|
|
66
55
|
}
|
|
67
56
|
}
|
|
68
57
|
};
|
|
69
|
-
|
|
70
|
-
exports.addPointToArray = addPointToArray;
|
|
71
|
-
|
|
72
|
-
var tool = function tool() {
|
|
58
|
+
var tool = exports.tool = function tool() {
|
|
73
59
|
return {
|
|
74
60
|
type: 'polygon',
|
|
75
61
|
Component: _component["default"],
|
|
@@ -89,9 +75,8 @@ var tool = function tool() {
|
|
|
89
75
|
};
|
|
90
76
|
} else {
|
|
91
77
|
var _addPointToArray = addPointToArray(point, mark.points),
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
78
|
+
closed = _addPointToArray.closed,
|
|
79
|
+
points = _addPointToArray.points;
|
|
95
80
|
return _objectSpread(_objectSpread({}, mark), {}, {
|
|
96
81
|
closed: closed,
|
|
97
82
|
points: points,
|
|
@@ -101,6 +86,4 @@ var tool = function tool() {
|
|
|
101
86
|
}
|
|
102
87
|
};
|
|
103
88
|
};
|
|
104
|
-
|
|
105
|
-
exports.tool = tool;
|
|
106
89
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.js","names":["_component","_interopRequireDefault","require","_utils","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","addPointToArray","exports","point","arr","points","closed","equalPoints","concat","_toConsumableArray2","hasPoint","find","p","tool","type","Component","Polygon","complete","data","mark","building","addPoint","_addPointToArray"],"sources":["../../../src/tools/polygon/index.js"],"sourcesContent":["import Polygon from './component';\nimport { equalPoints } from '../../utils';\n\nexport const addPointToArray = (point, arr) => {\n arr = arr || [];\n\n if (arr.length === 0) {\n return { points: [point], closed: false };\n } else if (arr.length === 1) {\n if (equalPoints(point, arr[0])) {\n return { points: arr, closed: false };\n } else {\n return { points: [...arr, point], closed: false };\n }\n } else if (arr.length >= 2) {\n const closed = equalPoints(point, arr[0]);\n\n if (closed) {\n return { points: arr, closed };\n } else {\n const hasPoint = !!arr.find((p) => equalPoints(p, point));\n\n if (hasPoint) {\n return { points: arr, closed: false };\n } else {\n return { points: [...arr, point], closed: false };\n }\n }\n }\n};\n\nexport const tool = () => ({\n type: 'polygon',\n Component: Polygon,\n complete: (data, mark) => {\n return { ...mark, building: false, closed: true };\n },\n addPoint: (point, mark) => {\n if (!mark) {\n return {\n type: 'polygon',\n points: [point],\n closed: false,\n building: true,\n };\n } else {\n const { closed, points } = addPointToArray(point, mark.points);\n\n return { ...mark, closed, points, building: !closed };\n }\n },\n});\n"],"mappings":";;;;;;;;;AAAA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AAS;IACfC,SAAS,EAAEC,qBAAO;IAClBC,QAAQ,EAAE,SAAVA,QAAQA,CAAGC,IAAI,EAAEC,IAAI,EAAK;MACxB,OAAA1B,aAAA,CAAAA,aAAA,KAAY0B,IAAI;QAAEC,QAAQ,EAAE,KAAK;QAAEd,MAAM,EAAE;MAAI;IACjD,CAAC;IACDe,QAAQ,EAAE,SAAVA,QAAQA,CAAGlB,KAAK,EAAEgB,IAAI,EAAK;MACzB,IAAI,CAACA,IAAI,EAAE;QACT,OAAO;UACLL,IAAI,EAAE,SAAS;UACfT,MAAM,EAAE,CAACF,KAAK,CAAC;UACfG,MAAM,EAAE,KAAK;UACbc,QAAQ,EAAE;QACZ,CAAC;MACH,CAAC,MAAM;QACL,IAAAE,gBAAA,GAA2BrB,eAAe,CAACE,KAAK,EAAEgB,IAAI,CAACd,MAAM,CAAC;UAAtDC,MAAM,GAAAgB,gBAAA,CAANhB,MAAM;UAAED,MAAM,GAAAiB,gBAAA,CAANjB,MAAM;QAEtB,OAAAZ,aAAA,CAAAA,aAAA,KAAY0B,IAAI;UAAEb,MAAM,EAANA,MAAM;UAAED,MAAM,EAANA,MAAM;UAAEe,QAAQ,EAAE,CAACd;QAAM;MACrD;IACF;EACF,CAAC;AAAA,CAAC","ignoreList":[]}
|
|
@@ -1,98 +1,83 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports["default"] = exports.Line = void 0;
|
|
11
|
-
|
|
12
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
-
|
|
14
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
15
|
-
|
|
16
11
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
17
|
-
|
|
18
12
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
19
|
-
|
|
20
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
21
|
-
|
|
22
13
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
23
|
-
|
|
24
14
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
25
|
-
|
|
15
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
26
16
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
27
|
-
|
|
28
17
|
var _react = _interopRequireDefault(require("react"));
|
|
29
|
-
|
|
30
18
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
31
|
-
|
|
32
|
-
var _styles = require("@material-ui/core/styles");
|
|
33
|
-
|
|
19
|
+
var _styles = require("@mui/material/styles");
|
|
34
20
|
var _plot = require("@pie-lib/plot");
|
|
35
|
-
|
|
36
21
|
var _renderUi = require("@pie-lib/render-ui");
|
|
37
|
-
|
|
38
22
|
var utils = _interopRequireWildcard(require("../../utils"));
|
|
39
|
-
|
|
40
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
41
|
-
|
|
42
23
|
var _styles2 = require("../shared/styles");
|
|
43
|
-
|
|
44
|
-
var
|
|
45
|
-
|
|
46
|
-
function
|
|
47
|
-
|
|
48
|
-
function
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
24
|
+
var _excluded = ["graphProps", "from", "to", "className", "disabled", "correctness"];
|
|
25
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
26
|
+
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
|
|
27
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
28
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
29
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
30
|
+
var StyledLine = (0, _styles.styled)('line', {
|
|
31
|
+
shouldForwardProp: function shouldForwardProp(prop) {
|
|
32
|
+
return !['disabled', 'correctness'].includes(prop);
|
|
33
|
+
}
|
|
34
|
+
})(function (_ref) {
|
|
35
|
+
var isDisabled = _ref.disabled,
|
|
36
|
+
correctness = _ref.correctness;
|
|
37
|
+
return _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
38
|
+
strokeWidth: 6,
|
|
39
|
+
transition: 'stroke-width 200ms ease-in, stroke 200ms ease-in',
|
|
40
|
+
stroke: 'transparent',
|
|
41
|
+
'&:hover': {
|
|
42
|
+
strokeWidth: 7,
|
|
43
|
+
stroke: _renderUi.color.defaults.SECONDARY
|
|
44
|
+
}
|
|
45
|
+
}, isDisabled && _objectSpread(_objectSpread({}, (0, _styles2.disabled)('stroke')), {}, {
|
|
46
|
+
strokeWidth: 2
|
|
47
|
+
})), correctness === 'correct' && (0, _styles2.correct)('stroke')), correctness === 'incorrect' && (0, _styles2.incorrect)('stroke')), correctness === 'missing' && (0, _styles2.missing)('stroke'));
|
|
48
|
+
});
|
|
58
49
|
var RawLine = /*#__PURE__*/function (_React$Component) {
|
|
59
|
-
(0, _inherits2["default"])(RawLine, _React$Component);
|
|
60
|
-
|
|
61
|
-
var _super = _createSuper(RawLine);
|
|
62
|
-
|
|
63
50
|
function RawLine() {
|
|
64
51
|
(0, _classCallCheck2["default"])(this, RawLine);
|
|
65
|
-
return
|
|
52
|
+
return _callSuper(this, RawLine, arguments);
|
|
66
53
|
}
|
|
67
|
-
|
|
68
|
-
(0, _createClass2["default"])(RawLine, [{
|
|
54
|
+
(0, _inherits2["default"])(RawLine, _React$Component);
|
|
55
|
+
return (0, _createClass2["default"])(RawLine, [{
|
|
69
56
|
key: "render",
|
|
70
57
|
value: function render() {
|
|
71
58
|
var _this$props = this.props,
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
rest = (0, _objectWithoutProperties2["default"])(_this$props, _excluded);
|
|
59
|
+
graphProps = _this$props.graphProps,
|
|
60
|
+
from = _this$props.from,
|
|
61
|
+
to = _this$props.to,
|
|
62
|
+
className = _this$props.className,
|
|
63
|
+
disabled = _this$props.disabled,
|
|
64
|
+
correctness = _this$props.correctness,
|
|
65
|
+
rest = (0, _objectWithoutProperties2["default"])(_this$props, _excluded);
|
|
80
66
|
var scale = graphProps.scale;
|
|
81
|
-
return /*#__PURE__*/_react["default"].createElement(
|
|
67
|
+
return /*#__PURE__*/_react["default"].createElement(StyledLine, (0, _extends2["default"])({
|
|
82
68
|
x1: scale.x(from.x),
|
|
83
69
|
y1: scale.y(from.y),
|
|
84
70
|
x2: scale.x(to.x),
|
|
85
71
|
y2: scale.y(to.y),
|
|
86
|
-
|
|
72
|
+
disabled: disabled,
|
|
73
|
+
correctness: correctness,
|
|
74
|
+
className: className
|
|
87
75
|
}, rest));
|
|
88
76
|
}
|
|
89
77
|
}]);
|
|
90
|
-
return RawLine;
|
|
91
78
|
}(_react["default"].Component);
|
|
92
|
-
|
|
93
79
|
(0, _defineProperty2["default"])(RawLine, "propTypes", {
|
|
94
80
|
className: _propTypes["default"].string,
|
|
95
|
-
classes: _propTypes["default"].object,
|
|
96
81
|
from: _plot.types.PointType,
|
|
97
82
|
to: _plot.types.PointType,
|
|
98
83
|
graphProps: _plot.types.GraphPropsType.isRequired,
|
|
@@ -103,33 +88,13 @@ var RawLine = /*#__PURE__*/function (_React$Component) {
|
|
|
103
88
|
from: {},
|
|
104
89
|
to: {}
|
|
105
90
|
});
|
|
106
|
-
var Line =
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
stroke: 'transparent',
|
|
112
|
-
'&:hover': {
|
|
113
|
-
strokeWidth: 7,
|
|
114
|
-
stroke: _renderUi.color.defaults.SECONDARY
|
|
115
|
-
}
|
|
116
|
-
},
|
|
117
|
-
disabled: _objectSpread(_objectSpread({}, (0, _styles2.disabled)('stroke')), {}, {
|
|
118
|
-
strokeWidth: 2
|
|
119
|
-
}),
|
|
120
|
-
correct: (0, _styles2.correct)('stoke'),
|
|
121
|
-
incorrect: (0, _styles2.incorrect)('stroke'),
|
|
122
|
-
missing: (0, _styles2.missing)('stroke')
|
|
123
|
-
};
|
|
124
|
-
})(RawLine);
|
|
125
|
-
exports.Line = Line;
|
|
126
|
-
|
|
127
|
-
var _default = (0, _plot.gridDraggable)({
|
|
128
|
-
bounds: function bounds(props, _ref) {
|
|
129
|
-
var domain = _ref.domain,
|
|
130
|
-
range = _ref.range;
|
|
91
|
+
var Line = exports.Line = RawLine;
|
|
92
|
+
var _default = exports["default"] = (0, _plot.gridDraggable)({
|
|
93
|
+
bounds: function bounds(props, _ref2) {
|
|
94
|
+
var domain = _ref2.domain,
|
|
95
|
+
range = _ref2.range;
|
|
131
96
|
var from = props.from,
|
|
132
|
-
|
|
97
|
+
to = props.to;
|
|
133
98
|
var area = utils.lineToArea(from, to);
|
|
134
99
|
return utils.bounds(area, domain, range);
|
|
135
100
|
},
|
|
@@ -139,13 +104,11 @@ var _default = (0, _plot.gridDraggable)({
|
|
|
139
104
|
},
|
|
140
105
|
fromDelta: function fromDelta(props, delta) {
|
|
141
106
|
var from = props.from,
|
|
142
|
-
|
|
107
|
+
to = props.to;
|
|
143
108
|
return {
|
|
144
109
|
from: utils.point(from).add(utils.point(delta)),
|
|
145
110
|
to: utils.point(to).add(utils.point(delta))
|
|
146
111
|
};
|
|
147
112
|
}
|
|
148
113
|
})(Line);
|
|
149
|
-
|
|
150
|
-
exports["default"] = _default;
|
|
151
114
|
//# sourceMappingURL=line.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"line.js","names":["_react","_interopRequireDefault","require","_propTypes","_styles","_plot","_renderUi","utils","_interopRequireWildcard","_styles2","_excluded","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","_typeof","has","get","set","_t","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_callSuper","_getPrototypeOf2","_possibleConstructorReturn2","_isNativeReflectConstruct","Reflect","construct","constructor","apply","Boolean","prototype","valueOf","ownKeys","keys","getOwnPropertySymbols","filter","enumerable","push","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","StyledLine","styled","shouldForwardProp","prop","includes","_ref","isDisabled","disabled","correctness","strokeWidth","transition","stroke","color","defaults","SECONDARY","correct","incorrect","missing","RawLine","_React$Component","_classCallCheck2","_inherits2","_createClass2","key","value","render","_this$props","props","graphProps","from","to","className","rest","_objectWithoutProperties2","scale","createElement","_extends2","x1","x","y1","y","x2","y2","React","Component","PropTypes","string","types","PointType","GraphPropsType","isRequired","bool","Line","exports","_default","gridDraggable","bounds","_ref2","domain","range","area","lineToArea","anchorPoint","fromDelta","delta","point","add"],"sources":["../../../src/tools/polygon/line.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { styled } from '@mui/material/styles';\nimport { types, gridDraggable } from '@pie-lib/plot';\nimport { color } from '@pie-lib/render-ui';\nimport * as utils from '../../utils';\nimport { correct, disabled, incorrect, missing } from '../shared/styles';\n\nconst StyledLine = styled('line', {\n shouldForwardProp: (prop) => !['disabled', 'correctness'].includes(prop),\n})(({ disabled: isDisabled, correctness }) => ({\n strokeWidth: 6,\n transition: 'stroke-width 200ms ease-in, stroke 200ms ease-in',\n stroke: 'transparent',\n '&:hover': {\n strokeWidth: 7,\n stroke: color.defaults.SECONDARY,\n },\n ...(isDisabled && {\n ...disabled('stroke'),\n strokeWidth: 2,\n }),\n ...(correctness === 'correct' && correct('stroke')),\n ...(correctness === 'incorrect' && incorrect('stroke')),\n ...(correctness === 'missing' && missing('stroke')),\n}));\n\nclass RawLine extends React.Component {\n static propTypes = {\n className: PropTypes.string,\n from: types.PointType,\n to: types.PointType,\n graphProps: types.GraphPropsType.isRequired,\n disabled: PropTypes.bool,\n correctness: PropTypes.string,\n };\n\n static defaultProps = {\n from: {},\n to: {},\n };\n\n render() {\n const { graphProps, from, to, className, disabled, correctness, ...rest } = this.props;\n const { scale } = graphProps;\n return (\n <StyledLine\n x1={scale.x(from.x)}\n y1={scale.y(from.y)}\n x2={scale.x(to.x)}\n y2={scale.y(to.y)}\n disabled={disabled}\n correctness={correctness}\n className={className}\n {...rest}\n />\n );\n }\n}\n\nexport const Line = RawLine;\n\nexport default gridDraggable({\n bounds: (props, { domain, range }) => {\n const { from, to } = props;\n const area = utils.lineToArea(from, to);\n return utils.bounds(area, domain, range);\n },\n anchorPoint: (props) => {\n const { from } = props;\n return from;\n },\n fromDelta: (props, delta) => {\n const { from, to } = props;\n return {\n from: utils.point(from).add(utils.point(delta)),\n to: utils.point(to).add(utils.point(delta)),\n };\n },\n})(Line);\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAC,uBAAA,CAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AAAyE,IAAAQ,SAAA;AAAA,SAAAF,wBAAAG,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAL,uBAAA,YAAAA,wBAAAG,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,mBAAAT,CAAA,iBAAAA,CAAA,gBAAAU,OAAA,CAAAV,CAAA,0BAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,cAAAM,EAAA,IA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AAE,SAAbA,WAAWA,CAAGnC,KAAK,EAAK;IACtB,IAAQE,IAAI,GAAKF,KAAK,CAAdE,IAAI;IACZ,OAAOA,IAAI;EACb,CAAC;EACDkC,SAAS,EAAE,SAAXA,SAASA,CAAGpC,KAAK,EAAEqC,KAAK,EAAK;IAC3B,IAAQnC,IAAI,GAASF,KAAK,CAAlBE,IAAI;MAAEC,EAAE,GAAKH,KAAK,CAAZG,EAAE;IAChB,OAAO;MACLD,IAAI,EAAE7E,KAAK,CAACiH,KAAK,CAACpC,IAAI,CAAC,CAACqC,GAAG,CAAClH,KAAK,CAACiH,KAAK,CAACD,KAAK,CAAC,CAAC;MAC/ClC,EAAE,EAAE9E,KAAK,CAACiH,KAAK,CAACnC,EAAE,CAAC,CAACoC,GAAG,CAAClH,KAAK,CAACiH,KAAK,CAACD,KAAK,CAAC;IAC5C,CAAC;EACH;AACF,CAAC,CAAC,CAACZ,IAAI,CAAC","ignoreList":[]}
|
|
@@ -1,63 +1,67 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports.getPointString = exports["default"] = exports.RawPolygon = exports.Polygon = void 0;
|
|
11
|
-
|
|
12
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
-
|
|
14
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
15
|
-
|
|
16
11
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
17
|
-
|
|
18
12
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
19
|
-
|
|
20
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
21
|
-
|
|
22
13
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
23
|
-
|
|
24
14
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
25
|
-
|
|
15
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
26
16
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
27
|
-
|
|
28
17
|
var _react = _interopRequireDefault(require("react"));
|
|
29
|
-
|
|
30
18
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
31
|
-
|
|
32
|
-
var _styles = require("@material-ui/core/styles");
|
|
33
|
-
|
|
19
|
+
var _styles = require("@mui/material/styles");
|
|
34
20
|
var _plot = require("@pie-lib/plot");
|
|
35
|
-
|
|
36
21
|
var utils = _interopRequireWildcard(require("../../utils"));
|
|
37
|
-
|
|
38
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
39
|
-
|
|
40
22
|
var _renderUi = require("@pie-lib/render-ui");
|
|
41
|
-
|
|
42
|
-
var _colorManipulator = require("@material-ui/core/styles/colorManipulator");
|
|
43
|
-
|
|
44
23
|
var _styles2 = require("../shared/styles");
|
|
45
|
-
|
|
46
|
-
var
|
|
47
|
-
|
|
48
|
-
function
|
|
49
|
-
|
|
50
|
-
function
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
24
|
+
var _excluded = ["points", "className", "correctness", "graphProps", "closed", "isSolution"];
|
|
25
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
26
|
+
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
|
|
27
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
28
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
29
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
30
|
+
var StyledPolygon = (0, _styles.styled)('polygon', {
|
|
31
|
+
shouldForwardProp: function shouldForwardProp(prop) {
|
|
32
|
+
return !['isSolution', 'correctness'].includes(prop);
|
|
33
|
+
}
|
|
34
|
+
})(function (_ref) {
|
|
35
|
+
var theme = _ref.theme,
|
|
36
|
+
isSolution = _ref.isSolution,
|
|
37
|
+
correctness = _ref.correctness;
|
|
38
|
+
return _objectSpread(_objectSpread({
|
|
39
|
+
fill: isSolution ? 'rgb(60, 73, 150, 0.6)' : 'transparent',
|
|
40
|
+
strokeWidth: 2,
|
|
41
|
+
stroke: _renderUi.color.defaults.SECONDARY_LIGHT,
|
|
42
|
+
'&:hover': {
|
|
43
|
+
fill: isSolution ? 'rgb(60, 73, 150, 0.6)' : 'rgb(0, 0, 0, 0.25)'
|
|
44
|
+
}
|
|
45
|
+
}, correctness === 'correct' && (0, _styles2.correct)('stroke')), correctness === 'incorrect' && (0, _styles2.incorrect)('stroke'));
|
|
46
|
+
});
|
|
47
|
+
var StyledPolyline = (0, _styles.styled)('polyline', {
|
|
48
|
+
shouldForwardProp: function shouldForwardProp(prop) {
|
|
49
|
+
return !['isSolution', 'correctness'].includes(prop);
|
|
50
|
+
}
|
|
51
|
+
})(function (_ref2) {
|
|
52
|
+
var theme = _ref2.theme,
|
|
53
|
+
isSolution = _ref2.isSolution,
|
|
54
|
+
correctness = _ref2.correctness;
|
|
55
|
+
return _objectSpread(_objectSpread({
|
|
56
|
+
fill: isSolution ? 'rgb(60, 73, 150, 0.6)' : 'transparent',
|
|
57
|
+
strokeWidth: 2,
|
|
58
|
+
stroke: _renderUi.color.defaults.SECONDARY_LIGHT,
|
|
59
|
+
'&:hover': {
|
|
60
|
+
fill: isSolution ? 'rgb(60, 73, 150, 0.6)' : 'rgb(0, 0, 0, 0.25)'
|
|
61
|
+
}
|
|
62
|
+
}, correctness === 'correct' && (0, _styles2.correct)('stroke')), correctness === 'incorrect' && (0, _styles2.incorrect)('stroke'));
|
|
63
|
+
});
|
|
64
|
+
var getPointString = exports.getPointString = function getPointString(points, scale) {
|
|
61
65
|
return (points || []).map(function (p) {
|
|
62
66
|
var scaledPoint = {
|
|
63
67
|
x: scale.x(p.x),
|
|
@@ -66,46 +70,36 @@ var getPointString = function getPointString(points, scale) {
|
|
|
66
70
|
return "".concat(scaledPoint.x, ",").concat(scaledPoint.y);
|
|
67
71
|
}).join(' ');
|
|
68
72
|
};
|
|
69
|
-
|
|
70
|
-
exports.getPointString = getPointString;
|
|
71
|
-
|
|
72
|
-
var RawPolygon = /*#__PURE__*/function (_React$Component) {
|
|
73
|
-
(0, _inherits2["default"])(RawPolygon, _React$Component);
|
|
74
|
-
|
|
75
|
-
var _super = _createSuper(RawPolygon);
|
|
76
|
-
|
|
73
|
+
var RawPolygon = exports.RawPolygon = /*#__PURE__*/function (_React$Component) {
|
|
77
74
|
function RawPolygon() {
|
|
78
75
|
(0, _classCallCheck2["default"])(this, RawPolygon);
|
|
79
|
-
return
|
|
76
|
+
return _callSuper(this, RawPolygon, arguments);
|
|
80
77
|
}
|
|
81
|
-
|
|
82
|
-
(0, _createClass2["default"])(RawPolygon, [{
|
|
78
|
+
(0, _inherits2["default"])(RawPolygon, _React$Component);
|
|
79
|
+
return (0, _createClass2["default"])(RawPolygon, [{
|
|
83
80
|
key: "render",
|
|
84
81
|
value: function render() {
|
|
85
82
|
var _this$props = this.props,
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
rest = (0, _objectWithoutProperties2["default"])(_this$props, _excluded);
|
|
83
|
+
points = _this$props.points,
|
|
84
|
+
className = _this$props.className,
|
|
85
|
+
correctness = _this$props.correctness,
|
|
86
|
+
graphProps = _this$props.graphProps,
|
|
87
|
+
closed = _this$props.closed,
|
|
88
|
+
isSolution = _this$props.isSolution,
|
|
89
|
+
rest = (0, _objectWithoutProperties2["default"])(_this$props, _excluded);
|
|
94
90
|
var scale = graphProps.scale;
|
|
95
91
|
var pointString = getPointString(points, scale);
|
|
96
|
-
var
|
|
97
|
-
return /*#__PURE__*/_react["default"].createElement(
|
|
92
|
+
var Component = closed ? StyledPolygon : StyledPolyline;
|
|
93
|
+
return /*#__PURE__*/_react["default"].createElement(Component, (0, _extends2["default"])({
|
|
98
94
|
points: pointString,
|
|
99
|
-
|
|
95
|
+
isSolution: isSolution,
|
|
96
|
+
correctness: correctness,
|
|
97
|
+
className: className
|
|
100
98
|
}, rest));
|
|
101
99
|
}
|
|
102
100
|
}]);
|
|
103
|
-
return RawPolygon;
|
|
104
101
|
}(_react["default"].Component);
|
|
105
|
-
|
|
106
|
-
exports.RawPolygon = RawPolygon;
|
|
107
102
|
(0, _defineProperty2["default"])(RawPolygon, "propTypes", {
|
|
108
|
-
classes: _propTypes["default"].object,
|
|
109
103
|
className: _propTypes["default"].string,
|
|
110
104
|
isSolution: _propTypes["default"].bool,
|
|
111
105
|
points: _propTypes["default"].arrayOf(_plot.types.PointType),
|
|
@@ -116,41 +110,11 @@ exports.RawPolygon = RawPolygon;
|
|
|
116
110
|
(0, _defineProperty2["default"])(RawPolygon, "defaultProps", {
|
|
117
111
|
points: []
|
|
118
112
|
});
|
|
119
|
-
var Polygon =
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
strokeWidth: 2,
|
|
125
|
-
stroke: _renderUi.color.defaults.SECONDARY_LIGHT
|
|
126
|
-
},
|
|
127
|
-
open: {
|
|
128
|
-
fill: (0, _colorManipulator.fade)(theme.palette.primary.light, 0.0),
|
|
129
|
-
// TODO hardcoded color
|
|
130
|
-
strokeWidth: 2,
|
|
131
|
-
stroke: _renderUi.color.defaults.SECONDARY_LIGHT,
|
|
132
|
-
pointerEvents: 'none'
|
|
133
|
-
},
|
|
134
|
-
gssClosed: {
|
|
135
|
-
fill: 'transparent',
|
|
136
|
-
'&:hover': {
|
|
137
|
-
fill: 'rgb(0, 0, 0, 0.25)'
|
|
138
|
-
}
|
|
139
|
-
},
|
|
140
|
-
gssSolution: {
|
|
141
|
-
fill: 'rgb(60, 73, 150, 0.6)'
|
|
142
|
-
},
|
|
143
|
-
disabled: _objectSpread({}, (0, _styles2.disabled)('stroke')),
|
|
144
|
-
correct: _objectSpread({}, (0, _styles2.correct)('stroke')),
|
|
145
|
-
incorrect: _objectSpread({}, (0, _styles2.incorrect)('stroke'))
|
|
146
|
-
};
|
|
147
|
-
})(RawPolygon);
|
|
148
|
-
exports.Polygon = Polygon;
|
|
149
|
-
|
|
150
|
-
var _default = (0, _plot.gridDraggable)({
|
|
151
|
-
bounds: function bounds(props, _ref) {
|
|
152
|
-
var domain = _ref.domain,
|
|
153
|
-
range = _ref.range;
|
|
113
|
+
var Polygon = exports.Polygon = RawPolygon;
|
|
114
|
+
var _default = exports["default"] = (0, _plot.gridDraggable)({
|
|
115
|
+
bounds: function bounds(props, _ref3) {
|
|
116
|
+
var domain = _ref3.domain,
|
|
117
|
+
range = _ref3.range;
|
|
154
118
|
var points = props.points;
|
|
155
119
|
var area = utils.polygonToArea(points);
|
|
156
120
|
return utils.bounds(area, domain, range);
|
|
@@ -166,6 +130,4 @@ var _default = (0, _plot.gridDraggable)({
|
|
|
166
130
|
});
|
|
167
131
|
}
|
|
168
132
|
})(Polygon);
|
|
169
|
-
|
|
170
|
-
exports["default"] = _default;
|
|
171
133
|
//# sourceMappingURL=polygon.js.map
|