@pie-lib/graphing 2.17.0 → 2.18.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 +13 -65
- package/package.json +9 -8
- package/src/axis/axes.jsx +1 -1
- package/src/coordinates-label.jsx +1 -1
- package/src/graph-with-controls.jsx +1 -1
- package/src/grid-setup.jsx +1 -1
- package/src/key-legend.jsx +1 -1
- package/src/labels.jsx +1 -1
- package/src/mark-label.jsx +1 -1
- package/src/toggle-bar.jsx +1 -1
- package/src/tools/circle/bg-circle.jsx +1 -1
- package/src/tools/circle/component.jsx +1 -1
- package/src/tools/polygon/line.jsx +1 -1
- package/src/tools/polygon/polygon.jsx +1 -1
- package/src/tools/shared/line/index.jsx +1 -1
- package/src/tools/shared/line/line-path.jsx +1 -1
- package/src/tools/shared/point/index.jsx +1 -1
- package/src/tools/shared/styles.js +1 -1
- package/src/tools/sine/__tests__/component.test.jsx +1 -1
- package/src/undo-redo.jsx +1 -1
- package/lib/axis/arrow.js +0 -115
- package/lib/axis/arrow.js.map +0 -1
- package/lib/axis/axes.js +0 -415
- package/lib/axis/axes.js.map +0 -1
- package/lib/axis/index.js +0 -26
- package/lib/axis/index.js.map +0 -1
- package/lib/bg.js +0 -139
- package/lib/bg.js.map +0 -1
- package/lib/container/actions.js +0 -24
- package/lib/container/actions.js.map +0 -1
- package/lib/container/index.js +0 -163
- package/lib/container/index.js.map +0 -1
- package/lib/container/marks.js +0 -27
- package/lib/container/marks.js.map +0 -1
- package/lib/container/middleware.js +0 -25
- package/lib/container/middleware.js.map +0 -1
- package/lib/container/reducer.js +0 -25
- package/lib/container/reducer.js.map +0 -1
- package/lib/coordinates-label.js +0 -109
- package/lib/coordinates-label.js.map +0 -1
- package/lib/graph-with-controls.js +0 -359
- package/lib/graph-with-controls.js.map +0 -1
- package/lib/graph.js +0 -371
- package/lib/graph.js.map +0 -1
- package/lib/grid-setup.js +0 -462
- package/lib/grid-setup.js.map +0 -1
- package/lib/grid.js +0 -176
- package/lib/grid.js.map +0 -1
- package/lib/index.js +0 -59
- package/lib/index.js.map +0 -1
- package/lib/key-legend.js +0 -246
- package/lib/key-legend.js.map +0 -1
- package/lib/label-svg-icon.js +0 -56
- package/lib/label-svg-icon.js.map +0 -1
- package/lib/labels.js +0 -299
- package/lib/labels.js.map +0 -1
- package/lib/mark-label.js +0 -321
- package/lib/mark-label.js.map +0 -1
- package/lib/shared/index.js +0 -136
- package/lib/toggle-bar.js +0 -336
- package/lib/toggle-bar.js.map +0 -1
- package/lib/tool-menu.js +0 -112
- package/lib/tool-menu.js.map +0 -1
- package/lib/tools/absolute/component.js +0 -35
- package/lib/tools/absolute/component.js.map +0 -1
- package/lib/tools/absolute/index.js +0 -63
- package/lib/tools/absolute/index.js.map +0 -1
- package/lib/tools/circle/bg-circle.js +0 -173
- package/lib/tools/circle/bg-circle.js.map +0 -1
- package/lib/tools/circle/component.js +0 -406
- package/lib/tools/circle/component.js.map +0 -1
- package/lib/tools/circle/index.js +0 -51
- package/lib/tools/circle/index.js.map +0 -1
- package/lib/tools/exponential/component.js +0 -34
- package/lib/tools/exponential/component.js.map +0 -1
- package/lib/tools/exponential/index.js +0 -71
- package/lib/tools/exponential/index.js.map +0 -1
- package/lib/tools/index.js +0 -99
- package/lib/tools/index.js.map +0 -1
- package/lib/tools/line/component.js +0 -103
- package/lib/tools/line/component.js.map +0 -1
- package/lib/tools/line/index.js +0 -16
- package/lib/tools/line/index.js.map +0 -1
- package/lib/tools/parabola/component.js +0 -34
- package/lib/tools/parabola/component.js.map +0 -1
- package/lib/tools/parabola/index.js +0 -63
- package/lib/tools/parabola/index.js.map +0 -1
- package/lib/tools/point/component.js +0 -186
- package/lib/tools/point/component.js.map +0 -1
- package/lib/tools/point/index.js +0 -32
- package/lib/tools/point/index.js.map +0 -1
- package/lib/tools/polygon/component.js +0 -518
- package/lib/tools/polygon/component.js.map +0 -1
- package/lib/tools/polygon/index.js +0 -106
- package/lib/tools/polygon/index.js.map +0 -1
- package/lib/tools/polygon/line.js +0 -157
- package/lib/tools/polygon/line.js.map +0 -1
- package/lib/tools/polygon/polygon.js +0 -165
- package/lib/tools/polygon/polygon.js.map +0 -1
- package/lib/tools/ray/component.js +0 -102
- package/lib/tools/ray/component.js.map +0 -1
- package/lib/tools/ray/index.js +0 -16
- package/lib/tools/ray/index.js.map +0 -1
- package/lib/tools/segment/component.js +0 -75
- package/lib/tools/segment/component.js.map +0 -1
- package/lib/tools/segment/index.js +0 -16
- package/lib/tools/segment/index.js.map +0 -1
- package/lib/tools/shared/arrow-head.js +0 -70
- package/lib/tools/shared/arrow-head.js.map +0 -1
- package/lib/tools/shared/icons/CorrectSVG.js +0 -36
- package/lib/tools/shared/icons/CorrectSVG.js.map +0 -1
- package/lib/tools/shared/icons/IncorrectSVG.js +0 -36
- package/lib/tools/shared/icons/IncorrectSVG.js.map +0 -1
- package/lib/tools/shared/icons/MissingSVG.js +0 -35
- package/lib/tools/shared/icons/MissingSVG.js.map +0 -1
- package/lib/tools/shared/line/index.js +0 -599
- package/lib/tools/shared/line/index.js.map +0 -1
- package/lib/tools/shared/line/line-path.js +0 -151
- package/lib/tools/shared/line/line-path.js.map +0 -1
- package/lib/tools/shared/line/with-root-edge.js +0 -155
- package/lib/tools/shared/line/with-root-edge.js.map +0 -1
- package/lib/tools/shared/point/arrow-point.js +0 -113
- package/lib/tools/shared/point/arrow-point.js.map +0 -1
- package/lib/tools/shared/point/arrow.js +0 -96
- package/lib/tools/shared/point/arrow.js.map +0 -1
- package/lib/tools/shared/point/base-point.js +0 -175
- package/lib/tools/shared/point/base-point.js.map +0 -1
- package/lib/tools/shared/point/index.js +0 -97
- package/lib/tools/shared/point/index.js.map +0 -1
- package/lib/tools/shared/styles.js +0 -58
- package/lib/tools/shared/styles.js.map +0 -1
- package/lib/tools/shared/types.js +0 -23
- package/lib/tools/shared/types.js.map +0 -1
- package/lib/tools/sine/component.js +0 -51
- package/lib/tools/sine/component.js.map +0 -1
- package/lib/tools/sine/index.js +0 -63
- package/lib/tools/sine/index.js.map +0 -1
- package/lib/tools/vector/component.js +0 -88
- package/lib/tools/vector/component.js.map +0 -1
- package/lib/tools/vector/index.js +0 -16
- package/lib/tools/vector/index.js.map +0 -1
- package/lib/undo-redo.js +0 -123
- package/lib/undo-redo.js.map +0 -1
- package/lib/use-debounce.js +0 -32
- package/lib/use-debounce.js.map +0 -1
- package/lib/utils.js +0 -307
- package/lib/utils.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/container/actions.js"],"names":["addMark","type","changeMarks","marks"],"mappings":";;;;;;;AAAO,IAAMA,OAAO,GAAG,SAAVA,OAAU;AAAA,SAAO;AAC5BC,IAAAA,IAAI,EAAE;AADsB,GAAP;AAAA,CAAhB;;;;AAIA,IAAMC,WAAW,GAAG,SAAdA,WAAc,CAACC,KAAD;AAAA,SAAY;AACrCF,IAAAA,IAAI,EAAE,cAD+B;AAErCE,IAAAA,KAAK,EAALA;AAFqC,GAAZ;AAAA,CAApB","sourcesContent":["export const addMark = () => ({\n type: 'ADD_MARK',\n});\n\nexport const changeMarks = (marks) => ({\n type: 'CHANGE_MARKS',\n marks,\n});\n"],"file":"actions.js"}
|
package/lib/container/index.js
DELETED
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports["default"] = exports.GraphContainer = void 0;
|
|
9
|
-
|
|
10
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
-
|
|
12
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
13
|
-
|
|
14
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
15
|
-
|
|
16
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
17
|
-
|
|
18
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
19
|
-
|
|
20
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
21
|
-
|
|
22
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
23
|
-
|
|
24
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
25
|
-
|
|
26
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
27
|
-
|
|
28
|
-
var _reactRedux = require("react-redux");
|
|
29
|
-
|
|
30
|
-
var _react = _interopRequireDefault(require("react"));
|
|
31
|
-
|
|
32
|
-
var _redux = require("redux");
|
|
33
|
-
|
|
34
|
-
var _reducer = _interopRequireDefault(require("./reducer"));
|
|
35
|
-
|
|
36
|
-
var _actions = require("./actions");
|
|
37
|
-
|
|
38
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
39
|
-
|
|
40
|
-
var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
|
41
|
-
|
|
42
|
-
var _reduxUndo = require("redux-undo");
|
|
43
|
-
|
|
44
|
-
var _graphWithControls = _interopRequireDefault(require("../graph-with-controls"));
|
|
45
|
-
|
|
46
|
-
var _middleware = require("./middleware");
|
|
47
|
-
|
|
48
|
-
var _excluded = ["onChangeMarks", "marks"];
|
|
49
|
-
|
|
50
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
51
|
-
|
|
52
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
53
|
-
|
|
54
|
-
var mapStateToProps = function mapStateToProps(s) {
|
|
55
|
-
return {
|
|
56
|
-
marks: s.marks.present
|
|
57
|
-
};
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
var mapDispatchToProps = function mapDispatchToProps(dispatch) {
|
|
61
|
-
return {
|
|
62
|
-
onChangeMarks: function onChangeMarks(m) {
|
|
63
|
-
return dispatch((0, _actions.changeMarks)(m));
|
|
64
|
-
},
|
|
65
|
-
onUndo: function onUndo() {
|
|
66
|
-
return dispatch(_reduxUndo.ActionCreators.undo());
|
|
67
|
-
},
|
|
68
|
-
onRedo: function onRedo() {
|
|
69
|
-
return dispatch(_reduxUndo.ActionCreators.redo());
|
|
70
|
-
},
|
|
71
|
-
onReset: function onReset() {
|
|
72
|
-
return dispatch((0, _actions.changeMarks)([]));
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
var GraphContainer = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(_graphWithControls["default"]);
|
|
78
|
-
/**
|
|
79
|
-
* The graph component entry point with undo/redo
|
|
80
|
-
* Redux is an implementation detail, hide it in the react component.
|
|
81
|
-
*/
|
|
82
|
-
|
|
83
|
-
exports.GraphContainer = GraphContainer;
|
|
84
|
-
|
|
85
|
-
var Root = /*#__PURE__*/function (_React$Component) {
|
|
86
|
-
(0, _inherits2["default"])(Root, _React$Component);
|
|
87
|
-
|
|
88
|
-
var _super = _createSuper(Root);
|
|
89
|
-
|
|
90
|
-
function Root(props) {
|
|
91
|
-
var _this;
|
|
92
|
-
|
|
93
|
-
(0, _classCallCheck2["default"])(this, Root);
|
|
94
|
-
_this = _super.call(this, props);
|
|
95
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onStoreChange", function () {
|
|
96
|
-
var _this$props = _this.props,
|
|
97
|
-
marks = _this$props.marks,
|
|
98
|
-
onChangeMarks = _this$props.onChangeMarks;
|
|
99
|
-
|
|
100
|
-
var storeState = _this.store.getState();
|
|
101
|
-
|
|
102
|
-
if (!(0, _isEqual["default"])(storeState.marks.present, marks)) {
|
|
103
|
-
onChangeMarks(storeState.marks.present);
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
var r = (0, _reducer["default"])();
|
|
107
|
-
_this.store = (0, _redux.createStore)(r, {
|
|
108
|
-
marks: props.marks
|
|
109
|
-
}, (0, _redux.applyMiddleware)(_middleware.lastActionMiddleware));
|
|
110
|
-
|
|
111
|
-
_this.store.subscribe(_this.onStoreChange);
|
|
112
|
-
|
|
113
|
-
return _this;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
(0, _createClass2["default"])(Root, [{
|
|
117
|
-
key: "componentDidUpdate",
|
|
118
|
-
value: function componentDidUpdate(prevProps) {
|
|
119
|
-
var marks = this.props.marks;
|
|
120
|
-
var storeState = this.store.getState();
|
|
121
|
-
|
|
122
|
-
if ((0, _isEqual["default"])(storeState.marks.present, marks)) {
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
if (!(0, _isEqual["default"])(prevProps.marks, marks)) {
|
|
127
|
-
this.store.dispatch((0, _actions.changeMarks)(marks));
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}, {
|
|
131
|
-
key: "render",
|
|
132
|
-
value: function render() {
|
|
133
|
-
// eslint-disable-next-line no-unused-vars
|
|
134
|
-
var _this$props2 = this.props,
|
|
135
|
-
onChangeMarks = _this$props2.onChangeMarks,
|
|
136
|
-
marks = _this$props2.marks,
|
|
137
|
-
rest = (0, _objectWithoutProperties2["default"])(_this$props2, _excluded);
|
|
138
|
-
var correctnessSet = marks && marks.find(function (m) {
|
|
139
|
-
return m.correctness;
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
if (correctnessSet) {
|
|
143
|
-
return /*#__PURE__*/_react["default"].createElement(_graphWithControls["default"], (0, _extends2["default"])({}, rest, {
|
|
144
|
-
marks: marks,
|
|
145
|
-
disabled: correctnessSet
|
|
146
|
-
}));
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
return /*#__PURE__*/_react["default"].createElement(_reactRedux.Provider, {
|
|
150
|
-
store: this.store
|
|
151
|
-
}, /*#__PURE__*/_react["default"].createElement(GraphContainer, rest));
|
|
152
|
-
}
|
|
153
|
-
}]);
|
|
154
|
-
return Root;
|
|
155
|
-
}(_react["default"].Component);
|
|
156
|
-
|
|
157
|
-
(0, _defineProperty2["default"])(Root, "propTypes", {
|
|
158
|
-
onChangeMarks: _propTypes["default"].func,
|
|
159
|
-
marks: _propTypes["default"].array
|
|
160
|
-
});
|
|
161
|
-
var _default = Root;
|
|
162
|
-
exports["default"] = _default;
|
|
163
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/container/index.jsx"],"names":["mapStateToProps","s","marks","present","mapDispatchToProps","dispatch","onChangeMarks","m","onUndo","ActionCreators","undo","onRedo","redo","onReset","GraphContainer","GraphWithControls","Root","props","storeState","store","getState","r","lastActionMiddleware","subscribe","onStoreChange","prevProps","rest","correctnessSet","find","correctness","React","Component","PropTypes","func","array"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;AAEA,IAAMA,eAAe,GAAG,SAAlBA,eAAkB,CAACC,CAAD;AAAA,SAAQ;AAC9BC,IAAAA,KAAK,EAAED,CAAC,CAACC,KAAF,CAAQC;AADe,GAAR;AAAA,CAAxB;;AAIA,IAAMC,kBAAkB,GAAG,SAAr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AmBC,SAAnB,EAA8B;AAC5B,UAAQvB,KAAR,GAAkB,KAAKe,KAAvB,CAAQf,KAAR;AACA,UAAMgB,UAAU,GAAG,KAAKC,KAAL,CAAWC,QAAX,EAAnB;;AAEA,UAAI,yBAAQF,UAAU,CAAChB,KAAX,CAAiBC,OAAzB,EAAkCD,KAAlC,CAAJ,EAA8C;AAC5C;AACD;;AAED,UAAI,CAAC,yBAAQuB,SAAS,CAACvB,KAAlB,EAAyBA,KAAzB,CAAL,EAAsC;AACpC,aAAKiB,KAAL,CAAWd,QAAX,CAAoB,0BAAYH,KAAZ,CAApB;AACD;AACF;;;WAWD,kBAAS;AACP;AACA,yBAA0C,KAAKe,KAA/C;AAAA,UAAQX,aAAR,gBAAQA,aAAR;AAAA,UAAuBJ,KAAvB,gBAAuBA,KAAvB;AAAA,UAAiCwB,IAAjC;AACA,UAAMC,cAAc,GAAGzB,KAAK,IAAIA,KAAK,CAAC0B,IAAN,CAAW,UAACrB,CAAD;AAAA,eAAOA,CAAC,CAACsB,WAAT;AAAA,OAAX,CAAhC;;AAEA,UAAIF,cAAJ,EAAoB;AAClB,4BAAO,gCAAC,6BAAD,gCAAuBD,IAAvB;AAA6B,UAAA,KAAK,EAAExB,KAApC;AAA2C,UAAA,QAAQ,EAAEyB;AAArD,WAAP;AACD;;AAED,0BACE,gCAAC,oBAAD;AAAU,QAAA,KAAK,EAAE,KAAKR;AAAtB,sBACE,gCAAC,cAAD,EAAoBO,IAApB,CADF,CADF;AAKD;;;EAnDgBI,kBAAMC,S;;iCAAnBf,I,eACe;AACjBV,EAAAA,aAAa,EAAE0B,sBAAUC,IADR;AAEjB/B,EAAAA,KAAK,EAAE8B,sBAAUE;AAFA,C;eAqDNlB,I","sourcesContent":["import { connect } from 'react-redux';\nimport React from 'react';\nimport { Provider } from 'react-redux';\nimport { applyMiddleware, createStore } from 'redux';\nimport reducer from './reducer';\nimport { changeMarks } from './actions';\nimport PropTypes from 'prop-types';\nimport isEqual from 'lodash/isEqual';\nimport { ActionCreators } from 'redux-undo';\nimport GraphWithControls from '../graph-with-controls';\nimport { lastActionMiddleware } from './middleware';\n\nconst mapStateToProps = (s) => ({\n marks: s.marks.present,\n});\n\nconst mapDispatchToProps = (dispatch) => ({\n onChangeMarks: (m) => dispatch(changeMarks(m)),\n onUndo: () => dispatch(ActionCreators.undo()),\n onRedo: () => dispatch(ActionCreators.redo()),\n onReset: () => dispatch(changeMarks([])),\n});\n\nexport const GraphContainer = connect(mapStateToProps, mapDispatchToProps)(GraphWithControls);\n\n/**\n * The graph component entry point with undo/redo\n * Redux is an implementation detail, hide it in the react component.\n */\nclass Root extends React.Component {\n static propTypes = {\n onChangeMarks: PropTypes.func,\n marks: PropTypes.array,\n };\n\n constructor(props) {\n super(props);\n\n const r = reducer();\n this.store = createStore(r, { marks: props.marks }, applyMiddleware(lastActionMiddleware));\n\n this.store.subscribe(this.onStoreChange);\n }\n\n componentDidUpdate(prevProps) {\n const { marks } = this.props;\n const storeState = this.store.getState();\n\n if (isEqual(storeState.marks.present, marks)) {\n return;\n }\n\n if (!isEqual(prevProps.marks, marks)) {\n this.store.dispatch(changeMarks(marks));\n }\n }\n\n onStoreChange = () => {\n const { marks, onChangeMarks } = this.props;\n const storeState = this.store.getState();\n\n if (!isEqual(storeState.marks.present, marks)) {\n onChangeMarks(storeState.marks.present);\n }\n };\n\n render() {\n // eslint-disable-next-line no-unused-vars\n const { onChangeMarks, marks, ...rest } = this.props;\n const correctnessSet = marks && marks.find((m) => m.correctness);\n\n if (correctnessSet) {\n return <GraphWithControls {...rest} marks={marks} disabled={correctnessSet} />;\n }\n\n return (\n <Provider store={this.store}>\n <GraphContainer {...rest} />\n </Provider>\n );\n }\n}\n\nexport default Root;\n"],"file":"index.js"}
|
package/lib/container/marks.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
|
|
8
|
-
var marks = function marks() {
|
|
9
|
-
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
10
|
-
var action = arguments.length > 1 ? arguments[1] : undefined;
|
|
11
|
-
|
|
12
|
-
switch (action.type) {
|
|
13
|
-
case 'CHANGE_MARKS':
|
|
14
|
-
if (Array.isArray(action.marks)) {
|
|
15
|
-
return action.marks;
|
|
16
|
-
} else {
|
|
17
|
-
throw new Error('marks must be an array');
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
default:
|
|
21
|
-
return state;
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
var _default = marks;
|
|
26
|
-
exports["default"] = _default;
|
|
27
|
-
//# sourceMappingURL=marks.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/container/marks.js"],"names":["marks","state","action","type","Array","isArray","Error"],"mappings":";;;;;;;AAAA,IAAMA,KAAK,GAAG,SAARA,KAAQ,GAAwB;AAAA,MAAvBC,KAAuB,uEAAf,EAAe;AAAA,MAAXC,MAAW;;AACpC,UAAQA,MAAM,CAACC,IAAf;AACE,SAAK,cAAL;AACE,UAAIC,KAAK,CAACC,OAAN,CAAcH,MAAM,CAACF,KAArB,CAAJ,EAAiC;AAC/B,eAAOE,MAAM,CAACF,KAAd;AACD,OAFD,MAEO;AACL,cAAM,IAAIM,KAAJ,CAAU,wBAAV,CAAN;AACD;;AACH;AACE,aAAOL,KAAP;AARJ;AAUD,CAXD;;eAaeD,K","sourcesContent":["const marks = (state = [], action) => {\n switch (action.type) {\n case 'CHANGE_MARKS':\n if (Array.isArray(action.marks)) {\n return action.marks;\n } else {\n throw new Error('marks must be an array');\n }\n default:\n return state;\n }\n};\n\nexport default marks;\n"],"file":"marks.js"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.lastActionMiddleware = exports.getLastAction = void 0;
|
|
7
|
-
var lastAction = null;
|
|
8
|
-
|
|
9
|
-
var getLastAction = function getLastAction() {
|
|
10
|
-
return lastAction;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
exports.getLastAction = getLastAction;
|
|
14
|
-
|
|
15
|
-
var lastActionMiddleware = function lastActionMiddleware() {
|
|
16
|
-
return function (next) {
|
|
17
|
-
return function (action) {
|
|
18
|
-
lastAction = action;
|
|
19
|
-
return next(action);
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
exports.lastActionMiddleware = lastActionMiddleware;
|
|
25
|
-
//# sourceMappingURL=middleware.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/container/middleware.js"],"names":["lastAction","getLastAction","lastActionMiddleware","next","action"],"mappings":";;;;;;AAAA,IAAIA,UAAU,GAAG,IAAjB;;AACO,IAAMC,aAAa,GAAG,SAAhBA,aAAgB;AAAA,SAAMD,UAAN;AAAA,CAAtB;;;;AAEA,IAAME,oBAAoB,GAAG,SAAvBA,oBAAuB;AAAA,SAAM,UAACC,IAAD;AAAA,WAAU,UAACC,MAAD,EAAY;AAC9DJ,MAAAA,UAAU,GAAGI,MAAb;AACA,aAAOD,IAAI,CAACC,MAAD,CAAX;AACD,KAHyC;AAAA,GAAN;AAAA,CAA7B","sourcesContent":["let lastAction = null;\nexport const getLastAction = () => lastAction;\n\nexport const lastActionMiddleware = () => (next) => (action) => {\n lastAction = action;\n return next(action);\n};\n"],"file":"middleware.js"}
|
package/lib/container/reducer.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports["default"] = void 0;
|
|
9
|
-
|
|
10
|
-
var _redux = require("redux");
|
|
11
|
-
|
|
12
|
-
var _marks = _interopRequireDefault(require("./marks"));
|
|
13
|
-
|
|
14
|
-
var _reduxUndo = _interopRequireDefault(require("redux-undo"));
|
|
15
|
-
|
|
16
|
-
var _default = function _default() {
|
|
17
|
-
return (0, _redux.combineReducers)({
|
|
18
|
-
marks: (0, _reduxUndo["default"])(_marks["default"], {
|
|
19
|
-
debug: false
|
|
20
|
-
})
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
exports["default"] = _default;
|
|
25
|
-
//# sourceMappingURL=reducer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/container/reducer.js"],"names":["marks","debug"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;eAEe;AAAA,SAAM,4BAAgB;AAAEA,IAAAA,KAAK,EAAE,2BAASA,iBAAT,EAAgB;AAAEC,MAAAA,KAAK,EAAE;AAAT,KAAhB;AAAT,GAAhB,CAAN;AAAA,C","sourcesContent":["import { combineReducers } from 'redux';\nimport marks from './marks';\nimport undoable from 'redux-undo';\n\nexport default () => combineReducers({ marks: undoable(marks, { debug: false }) });\n"],"file":"reducer.js"}
|
package/lib/coordinates-label.js
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.getLabelPosition = exports["default"] = exports.CoordinatesLabel = void 0;
|
|
9
|
-
|
|
10
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
-
|
|
12
|
-
var _react = _interopRequireDefault(require("react"));
|
|
13
|
-
|
|
14
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
|
-
|
|
16
|
-
var _plot = require("@pie-lib/plot");
|
|
17
|
-
|
|
18
|
-
var _index = require("./shared/index");
|
|
19
|
-
|
|
20
|
-
var _styles = require("@material-ui/core/styles");
|
|
21
|
-
|
|
22
|
-
var _InputBase = _interopRequireDefault(require("@material-ui/core/InputBase"));
|
|
23
|
-
|
|
24
|
-
var _utils = require("./utils");
|
|
25
|
-
|
|
26
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
27
|
-
|
|
28
|
-
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; }
|
|
29
|
-
|
|
30
|
-
var styles = function styles(theme) {
|
|
31
|
-
return {
|
|
32
|
-
input: {
|
|
33
|
-
fontFamily: theme.typography.fontFamily,
|
|
34
|
-
fontSize: theme.typography.fontSize,
|
|
35
|
-
borderRadius: '8px',
|
|
36
|
-
background: theme.palette.common.white,
|
|
37
|
-
color: _index.color.defaults.PRIMARY_DARK
|
|
38
|
-
},
|
|
39
|
-
inputLabel: {
|
|
40
|
-
padding: 0
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
var getLabelPosition = function getLabelPosition(graphProps, x, y, labelLength) {
|
|
46
|
-
var scale = graphProps.scale,
|
|
47
|
-
domain = graphProps.domain,
|
|
48
|
-
range = graphProps.range; // treat corner cases for maximum and minimum
|
|
49
|
-
|
|
50
|
-
var topShift = y === range.min ? 16 : y === range.max ? 0 : 8;
|
|
51
|
-
var leftShift = 10;
|
|
52
|
-
var rightEdge = scale.x(x) + labelLength + leftShift;
|
|
53
|
-
|
|
54
|
-
if (rightEdge >= scale.x(domain.max)) {
|
|
55
|
-
return {
|
|
56
|
-
left: scale.x(x) - leftShift - labelLength,
|
|
57
|
-
top: scale.y(y) - topShift
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return {
|
|
62
|
-
left: scale.x(x) + leftShift,
|
|
63
|
-
top: scale.y(y) - topShift
|
|
64
|
-
};
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
exports.getLabelPosition = getLabelPosition;
|
|
68
|
-
|
|
69
|
-
var CoordinatesLabel = function CoordinatesLabel(_ref) {
|
|
70
|
-
var x = _ref.x,
|
|
71
|
-
y = _ref.y,
|
|
72
|
-
graphProps = _ref.graphProps,
|
|
73
|
-
classes = _ref.classes;
|
|
74
|
-
var label = "(".concat((0, _utils.roundNumber)(x), ", ").concat((0, _utils.roundNumber)(y), ")");
|
|
75
|
-
var labelLength = (label.length || 0) * 6;
|
|
76
|
-
var labelPosition = getLabelPosition(graphProps, x, y, labelLength);
|
|
77
|
-
|
|
78
|
-
var style = _objectSpread({
|
|
79
|
-
position: 'absolute',
|
|
80
|
-
pointerEvents: 'auto',
|
|
81
|
-
width: labelLength,
|
|
82
|
-
padding: 0
|
|
83
|
-
}, labelPosition);
|
|
84
|
-
|
|
85
|
-
return /*#__PURE__*/_react["default"].createElement(_InputBase["default"], {
|
|
86
|
-
style: style,
|
|
87
|
-
classes: {
|
|
88
|
-
input: classes.inputLabel
|
|
89
|
-
},
|
|
90
|
-
className: classes.input,
|
|
91
|
-
value: label,
|
|
92
|
-
inputProps: {
|
|
93
|
-
ariaLabel: 'naked'
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
exports.CoordinatesLabel = CoordinatesLabel;
|
|
99
|
-
CoordinatesLabel.propTypes = {
|
|
100
|
-
graphProps: _plot.types.GraphPropsType,
|
|
101
|
-
classes: _propTypes["default"].object,
|
|
102
|
-
x: _propTypes["default"].number,
|
|
103
|
-
y: _propTypes["default"].number
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
var _default = (0, _styles.withStyles)(styles)(CoordinatesLabel);
|
|
107
|
-
|
|
108
|
-
exports["default"] = _default;
|
|
109
|
-
//# sourceMappingURL=coordinates-label.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/coordinates-label.jsx"],"names":["styles","theme","input","fontFamily","typography","fontSize","borderRadius","background","palette","common","white","color","defaults","PRIMARY_DARK","inputLabel","padding","getLabelPosition","graphProps","x","y","labelLength","scale","domain","range","topShift","min","max","leftShift","rightEdge","left","top","CoordinatesLabel","classes","label","length","labelPosition","style","position","pointerEvents","width","ariaLabel","propTypes","types","GraphPropsType","PropTypes","object","number"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAEA,IAAMA,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD;AAAA,SAAY;AACzBC,IAAAA,KAAK,EAAE;AACLC,MAAAA,UAAU,EAAEF,KAAK,CAACG,UAAN,CAAiBD,UADxB;AAELE,MAAAA,QAAQ,EAAEJ,KAAK,CAACG,UAAN,CAAiBC,QAFtB;AAGLC,MAAAA,YAAY,EAAE,KAHT;AAILC,MAAAA,UAAU,EAAEN,KAAK,CAACO,OAAN,CAAcC,MAAd,CAAqBC,KAJ5B;AAKLC,MAAAA,KAAK,EAAEA,aAAMC,QAAN,CAAeC;AALjB,KADkB;AAQzBC,IAAAA,UAAU,EAAE;AACVC,MAAAA,OAAO,EAAE;AADC;AARa,GAAZ;AAAA,CAAf;;AAaO,IAAMC,gBAAgB,GAAG,SAAnBA,gBAAmB,CAACC,UAAD,EAAaC,CAAb,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,CAAjB,IAAsB,CAA1C;AACA,MAAMC,aAAa,GAAGnB,gBAAgB,CAACC,UAAD,EAAaC,CAAb,EAAgBC,CAAhB,EAAmBC,WAAnB,CAAtC;;AAEA,MAAMgB,KAAK;AACTC,IAAAA,QAAQ,EAAE,UADD;AAETC,IAAAA,aAAa,EAAE,MAFN;AAGTC,IAAAA,KAAK,EAAEnB,WAHE;AAITL,IAAAA,OAAO,EAAE;AAJA,KAKNoB,aALM,CAAX;;AAQA,sBACE,gCAAC,qBAAD;AACE,IAAA,KAAK,EAAEC,KADT;AAEE,IAAA,OAAO,EAAE;AAAElC,MAAAA,KAAK,EAAE8B,OAAO,CAAClB;AAAjB,KAFX;AAGE,IAAA,SAAS,EAAEkB,OAAO,CAAC9B,KAHrB;AAIE,IAAA,KAAK,EAAE+B,KAJT;AAKE,IAAA,UAAU,EAAE;AAAEO,MAAAA,SAAS,EAAE;AAAb;AALd,IADF;AASD,CAtBM;;;AAwBPT,gBAAgB,CAACU,SAAjB,GAA6B;AAC3BxB,EAAAA,UAAU,EAAEyB,YAAMC,cADS;AAE3BX,EAAAA,OAAO,EAAEY,sBAAUC,MAFQ;AAG3B3B,EAAAA,CAAC,EAAE0B,sBAAUE,MAHc;AAI3B3B,EAAAA,CAAC,EAAEyB,sBAAUE;AAJc,CAA7B;;eAOe,wBAAW9C,MAAX,EAAmB+B,gBAAnB,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { types } from '@pie-lib/plot';\nimport { color } from '../../render-ui/src/index';\nimport { withStyles } from '@material-ui/core/styles';\nimport InputBase from '@material-ui/core/InputBase';\nimport { roundNumber } from './utils';\n\nconst styles = (theme) => ({\n input: {\n fontFamily: theme.typography.fontFamily,\n fontSize: theme.typography.fontSize,\n borderRadius: '8px',\n background: theme.palette.common.white,\n color: color.defaults.PRIMARY_DARK,\n },\n inputLabel: {\n padding: 0,\n },\n});\n\nexport const getLabelPosition = (graphProps, x, y, labelLength) => {\n const { scale, domain, range } = graphProps;\n // treat corner cases for maximum and minimum\n const topShift = y === range.min ? 16 : y === range.max ? 0 : 8;\n const leftShift = 10;\n const rightEdge = scale.x(x) + labelLength + leftShift;\n\n if (rightEdge >= scale.x(domain.max)) {\n return {\n left: scale.x(x) - leftShift - labelLength,\n top: scale.y(y) - topShift,\n };\n }\n\n return {\n left: scale.x(x) + leftShift,\n top: scale.y(y) - topShift,\n };\n};\n\nexport const CoordinatesLabel = ({ x, y, graphProps, classes }) => {\n const label = `(${roundNumber(x)}, ${roundNumber(y)})`;\n const labelLength = (label.length || 0) * 6;\n const labelPosition = getLabelPosition(graphProps, x, y, labelLength);\n\n const style = {\n position: 'absolute',\n pointerEvents: 'auto',\n width: labelLength,\n padding: 0,\n ...labelPosition,\n };\n\n return (\n <InputBase\n style={style}\n classes={{ input: classes.inputLabel }}\n className={classes.input}\n value={label}\n inputProps={{ ariaLabel: 'naked' }}\n />\n );\n};\n\nCoordinatesLabel.propTypes = {\n graphProps: types.GraphPropsType,\n classes: PropTypes.object,\n x: PropTypes.number,\n y: PropTypes.number,\n};\n\nexport default withStyles(styles)(CoordinatesLabel);\n"],"file":"coordinates-label.js"}
|