@pie-lib/graphing 2.17.0 → 2.19.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 +24 -52
- 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,51 +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.tool = void 0;
|
|
9
|
-
|
|
10
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
-
|
|
12
|
-
var _component = _interopRequireDefault(require("./component"));
|
|
13
|
-
|
|
14
|
-
var _utils = require("../../utils");
|
|
15
|
-
|
|
16
|
-
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; }
|
|
17
|
-
|
|
18
|
-
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; }
|
|
19
|
-
|
|
20
|
-
var tool = function tool() {
|
|
21
|
-
return {
|
|
22
|
-
type: 'circle',
|
|
23
|
-
Component: _component["default"],
|
|
24
|
-
hover: function hover(point, mark) {
|
|
25
|
-
return _objectSpread(_objectSpread({}, mark), {}, {
|
|
26
|
-
edge: point
|
|
27
|
-
});
|
|
28
|
-
},
|
|
29
|
-
addPoint: function addPoint(point, mark) {
|
|
30
|
-
if (mark && (0, _utils.equalPoints)(mark.root, point)) {
|
|
31
|
-
return mark;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
if (!mark) {
|
|
35
|
-
return {
|
|
36
|
-
type: 'circle',
|
|
37
|
-
root: point,
|
|
38
|
-
building: true
|
|
39
|
-
};
|
|
40
|
-
} else {
|
|
41
|
-
return _objectSpread(_objectSpread({}, mark), {}, {
|
|
42
|
-
edge: point,
|
|
43
|
-
building: false
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
exports.tool = tool;
|
|
51
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/tools/circle/index.js"],"names":["tool","type","Component","Circle","hover","point","mark","edge","addPoint","root","building"],"mappings":";;;;;;;;;;;AAAA;;AACA;;;;;;AAEO,IAAMA,IAAI,GAAG,SAAPA,IAAO;AAAA,SAAO;AACzBC,IAAAA,IAAI,EAAE,QADmB;AAEzBC,IAAAA,SAAS,EAAEC,qBAFc;AAGzBC,IAAAA,KAAK,EAAE,eAACC,KAAD,EAAQC,IAAR,EAAiB;AACtB,6CAAYA,IAAZ;AAAkBC,QAAAA,IAAI,EAAEF;AAAxB;AACD,KALwB;AAMzBG,IAAAA,QAAQ,EAAE,kBAACH,KAAD,EAAQC,IAAR,EAAiB;AACzB,UAAIA,IAAI,IAAI,wBAAYA,IAAI,CAACG,IAAjB,EAAuBJ,KAAvB,CAAZ,EAA2C;AACzC,eAAOC,IAAP;AACD;;AAED,UAAI,CAACA,IAAL,EAAW;AACT,eAAO;AACLL,UAAAA,IAAI,EAAE,QADD;AAELQ,UAAAA,IAAI,EAAEJ,KAFD;AAGLK,UAAAA,QAAQ,EAAE;AAHL,SAAP;AAKD,OAND,MAMO;AACL,+CAAYJ,IAAZ;AAAkBC,UAAAA,IAAI,EAAEF,KAAxB;AAA+BK,UAAAA,QAAQ,EAAE;AAAzC;AACD;AACF;AApBwB,GAAP;AAAA,CAAb","sourcesContent":["import Circle from './component';\nimport { equalPoints } from '../../utils';\n\nexport const tool = () => ({\n type: 'circle',\n Component: Circle,\n hover: (point, mark) => {\n return { ...mark, edge: point };\n },\n addPoint: (point, mark) => {\n if (mark && equalPoints(mark.root, point)) {\n return mark;\n }\n\n if (!mark) {\n return {\n type: 'circle',\n root: point,\n building: true,\n };\n } else {\n return { ...mark, edge: point, building: false };\n }\n },\n});\n"],"file":"index.js"}
|
|
@@ -1,34 +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 _debug = _interopRequireDefault(require("debug"));
|
|
11
|
-
|
|
12
|
-
var _graphingUtils = require("@pie-lib/graphing-utils");
|
|
13
|
-
|
|
14
|
-
var _withRootEdge = require("../shared/line/with-root-edge");
|
|
15
|
-
|
|
16
|
-
var log = (0, _debug["default"])('pie-lib:graphing:exponential');
|
|
17
|
-
var Exponential = (0, _withRootEdge.withRootEdge)(function (props) {
|
|
18
|
-
var root = props.root,
|
|
19
|
-
edge = props.edge,
|
|
20
|
-
graphProps = props.graphProps;
|
|
21
|
-
var domain = graphProps.domain,
|
|
22
|
-
range = graphProps.range;
|
|
23
|
-
var dataPoints = edge && edge.x === root.x ? [] : (0, _graphingUtils.buildDataPoints)(domain, range, root, edge, (0, _graphingUtils.exponentialFromTwoPoints)(root, edge), true);
|
|
24
|
-
log('dataPoints:', dataPoints);
|
|
25
|
-
return {
|
|
26
|
-
root: props.root,
|
|
27
|
-
edge: props.edge,
|
|
28
|
-
dataPoints: dataPoints
|
|
29
|
-
};
|
|
30
|
-
});
|
|
31
|
-
var Component = (0, _withRootEdge.rootEdgeComponent)(Exponential);
|
|
32
|
-
var _default = Component;
|
|
33
|
-
exports["default"] = _default;
|
|
34
|
-
//# sourceMappingURL=component.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/tools/exponential/component.jsx"],"names":["log","Exponential","props","root","edge","graphProps","domain","range","dataPoints","x","Component"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AAEA,IAAMA,GAAG,GAAG,uBAAM,8BAAN,CAAZ;AAEA,IAAMC,WAAW,GAAG,gCAAa,UAACC,KAAD,EAAW;AAC1C,MAAQC,IAAR,GAAmCD,KAAnC,CAAQC,IAAR;AAAA,MAAcC,IAAd,GAAmCF,KAAnC,CAAcE,IAAd;AAAA,MAAoBC,UAApB,GAAmCH,KAAnC,CAAoBG,UAApB;AACA,MAAQC,MAAR,GAA0BD,UAA1B,CAAQC,MAAR;AAAA,MAAgBC,KAAhB,GAA0BF,UAA1B,CAAgBE,KAAhB;AAEA,MAAMC,UAAU,GACdJ,IAAI,IAAIA,IAAI,CAACK,CAAL,KAAWN,IAAI,CAACM,CAAxB,GACI,EADJ,GAEI,oCAAgBH,MAAhB,EAAwBC,KAAxB,EAA+BJ,IAA/B,EAAqCC,IAArC,EAA2C,6CAAyBD,IAAzB,EAA+BC,IAA/B,CAA3C,EAAiF,IAAjF,CAHN;AAKAJ,EAAAA,GAAG,CAAC,aAAD,EAAgBQ,UAAhB,CAAH;AAEA,SAAO;AAAEL,IAAAA,IAAI,EAAED,KAAK,CAACC,IAAd;AAAoBC,IAAAA,IAAI,EAAEF,KAAK,CAACE,IAAhC;AAAsCI,IAAAA,UAAU,EAAVA;AAAtC,GAAP;AACD,CAZmB,CAApB;AAcA,IAAME,SAAS,GAAG,qCAAkBT,WAAlB,CAAlB;eAEeS,S","sourcesContent":["import debug from 'debug';\nimport { buildDataPoints, exponentialFromTwoPoints } from '@pie-lib/graphing-utils';\nimport { withRootEdge, rootEdgeComponent } from '../shared/line/with-root-edge';\n\nconst log = debug('pie-lib:graphing:exponential');\n\nconst Exponential = withRootEdge((props) => {\n const { root, edge, graphProps } = props;\n const { domain, range } = graphProps;\n\n const dataPoints =\n edge && edge.x === root.x\n ? []\n : buildDataPoints(domain, range, root, edge, exponentialFromTwoPoints(root, edge), true);\n\n log('dataPoints:', dataPoints);\n\n return { root: props.root, edge: props.edge, dataPoints };\n});\n\nconst Component = rootEdgeComponent(Exponential);\n\nexport default Component;\n"],"file":"component.js"}
|
|
@@ -1,71 +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.tool = void 0;
|
|
9
|
-
|
|
10
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
-
|
|
12
|
-
var _component = _interopRequireDefault(require("./component"));
|
|
13
|
-
|
|
14
|
-
var _debug = _interopRequireDefault(require("debug"));
|
|
15
|
-
|
|
16
|
-
var _utils = require("../../utils");
|
|
17
|
-
|
|
18
|
-
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; }
|
|
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 log = (0, _debug["default"])('pie-lib:graphing:exponential');
|
|
23
|
-
|
|
24
|
-
var tool = function tool() {
|
|
25
|
-
return {
|
|
26
|
-
type: 'exponential',
|
|
27
|
-
Component: _component["default"],
|
|
28
|
-
complete: function complete(data, mark) {
|
|
29
|
-
return _objectSpread(_objectSpread({}, mark), {}, {
|
|
30
|
-
building: false,
|
|
31
|
-
closed: true
|
|
32
|
-
});
|
|
33
|
-
},
|
|
34
|
-
addPoint: function addPoint(point, mark) {
|
|
35
|
-
log('add point to exponential model: ', point, 'mark: ', mark);
|
|
36
|
-
|
|
37
|
-
if (mark && ((0, _utils.equalPoints)(mark.root, point) || (0, _utils.sameAxes)(mark.root, point))) {
|
|
38
|
-
return mark;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
if (mark && mark.root.y * point.y < 0) {
|
|
42
|
-
return mark;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (point.y === 0) {
|
|
46
|
-
return mark;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
if (!mark) {
|
|
50
|
-
return {
|
|
51
|
-
type: 'exponential',
|
|
52
|
-
root: point,
|
|
53
|
-
edge: undefined,
|
|
54
|
-
closed: false,
|
|
55
|
-
building: true
|
|
56
|
-
};
|
|
57
|
-
} else if (mark && !mark.root) {
|
|
58
|
-
throw new Error('no root - should never happen');
|
|
59
|
-
} else {
|
|
60
|
-
return _objectSpread(_objectSpread({}, mark), {}, {
|
|
61
|
-
edge: point,
|
|
62
|
-
closed: true,
|
|
63
|
-
building: false
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
exports.tool = tool;
|
|
71
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/tools/exponential/index.js"],"names":["log","tool","type","Component","Exponential","complete","data","mark","building","closed","addPoint","point","root","y","edge","undefined","Error"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AACA;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,8BAAN,CAAZ;;AAEO,IAAMC,IAAI,GAAG,SAAPA,IAAO;AAAA,SAAO;AACzBC,IAAAA,IAAI,EAAE,aADmB;AAEzBC,IAAAA,SAAS,EAAEC,qBAFc;AAGzBC,IAAAA,QAAQ,EAAE,kBAACC,IAAD,EAAOC,IAAP;AAAA,6CAAsBA,IAAtB;AAA4BC,QAAAA,QAAQ,EAAE,KAAtC;AAA6CC,QAAAA,MAAM,EAAE;AAArD;AAAA,KAHe;AAIzBC,IAAAA,QAAQ,EAAE,kBAACC,KAAD,EAAQJ,IAAR,EAAiB;AACzBP,MAAAA,GAAG,CAAC,kCAAD,EAAqCW,KAArC,EAA4C,QAA5C,EAAsDJ,IAAtD,CAAH;;AACA,UAAIA,IAAI,KAAK,wBAAYA,IAAI,CAACK,IAAjB,EAAuBD,KAAvB,KAAiC,qBAASJ,IAAI,CAACK,IAAd,EAAoBD,KAApB,CAAtC,CAAR,EAA2E;AACzE,eAAOJ,IAAP;AACD;;AAED,UAAIA,IAAI,IAAIA,IAAI,CAACK,IAAL,CAAUC,CAAV,GAAcF,KAAK,CAACE,CAApB,GAAwB,CAApC,EAAuC;AACrC,eAAON,IAAP;AACD;;AAED,UAAII,KAAK,CAACE,CAAN,KAAY,CAAhB,EAAmB;AACjB,eAAON,IAAP;AACD;;AAED,UAAI,CAACA,IAAL,EAAW;AACT,eAAO;AACLL,UAAAA,IAAI,EAAE,aADD;AAELU,UAAAA,IAAI,EAAED,KAFD;AAGLG,UAAAA,IAAI,EAAEC,SAHD;AAILN,UAAAA,MAAM,EAAE,KAJH;AAKLD,UAAAA,QAAQ,EAAE;AALL,SAAP;AAOD,OARD,MAQO,IAAID,IAAI,IAAI,CAACA,IAAI,CAACK,IAAlB,EAAwB;AAC7B,cAAM,IAAII,KAAJ,CAAU,+BAAV,CAAN;AACD,OAFM,MAEA;AACL,+CAAYT,IAAZ;AAAkBO,UAAAA,IAAI,EAAEH,KAAxB;AAA+BF,UAAAA,MAAM,EAAE,IAAvC;AAA6CD,UAAAA,QAAQ,EAAE;AAAvD;AACD;AACF;AA/BwB,GAAP;AAAA,CAAb","sourcesContent":["import Exponential from './component';\nimport debug from 'debug';\nimport { equalPoints, sameAxes } from '../../utils';\n\nconst log = debug('pie-lib:graphing:exponential');\n\nexport const tool = () => ({\n type: 'exponential',\n Component: Exponential,\n complete: (data, mark) => ({ ...mark, building: false, closed: true }),\n addPoint: (point, mark) => {\n log('add point to exponential model: ', point, 'mark: ', mark);\n if (mark && (equalPoints(mark.root, point) || sameAxes(mark.root, point))) {\n return mark;\n }\n\n if (mark && mark.root.y * point.y < 0) {\n return mark;\n }\n\n if (point.y === 0) {\n return mark;\n }\n\n if (!mark) {\n return {\n type: 'exponential',\n root: point,\n edge: undefined,\n closed: false,\n building: true,\n };\n } else if (mark && !mark.root) {\n throw new Error('no root - should never happen');\n } else {\n return { ...mark, edge: point, closed: true, building: false };\n }\n },\n});\n"],"file":"index.js"}
|
package/lib/tools/index.js
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "absolute", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function get() {
|
|
9
|
-
return _absolute.tool;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
exports.allTools = void 0;
|
|
13
|
-
Object.defineProperty(exports, "circle", {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
get: function get() {
|
|
16
|
-
return _circle.tool;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
Object.defineProperty(exports, "exponential", {
|
|
20
|
-
enumerable: true,
|
|
21
|
-
get: function get() {
|
|
22
|
-
return _exponential.tool;
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
Object.defineProperty(exports, "line", {
|
|
26
|
-
enumerable: true,
|
|
27
|
-
get: function get() {
|
|
28
|
-
return _line.tool;
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
Object.defineProperty(exports, "parabola", {
|
|
32
|
-
enumerable: true,
|
|
33
|
-
get: function get() {
|
|
34
|
-
return _parabola.tool;
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
Object.defineProperty(exports, "point", {
|
|
38
|
-
enumerable: true,
|
|
39
|
-
get: function get() {
|
|
40
|
-
return _point.tool;
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
Object.defineProperty(exports, "polygon", {
|
|
44
|
-
enumerable: true,
|
|
45
|
-
get: function get() {
|
|
46
|
-
return _polygon.tool;
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
Object.defineProperty(exports, "ray", {
|
|
50
|
-
enumerable: true,
|
|
51
|
-
get: function get() {
|
|
52
|
-
return _ray.tool;
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
Object.defineProperty(exports, "sine", {
|
|
56
|
-
enumerable: true,
|
|
57
|
-
get: function get() {
|
|
58
|
-
return _sine.tool;
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
exports.toolsArr = void 0;
|
|
62
|
-
Object.defineProperty(exports, "vector", {
|
|
63
|
-
enumerable: true,
|
|
64
|
-
get: function get() {
|
|
65
|
-
return _vector.tool;
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
var _point = require("./point");
|
|
70
|
-
|
|
71
|
-
var _circle = require("./circle");
|
|
72
|
-
|
|
73
|
-
var _polygon = require("./polygon");
|
|
74
|
-
|
|
75
|
-
var _sine = require("./sine");
|
|
76
|
-
|
|
77
|
-
var _parabola = require("./parabola");
|
|
78
|
-
|
|
79
|
-
var _line = require("./line");
|
|
80
|
-
|
|
81
|
-
var _segment = require("./segment");
|
|
82
|
-
|
|
83
|
-
var _ray = require("./ray");
|
|
84
|
-
|
|
85
|
-
var _vector = require("./vector");
|
|
86
|
-
|
|
87
|
-
var _absolute = require("./absolute");
|
|
88
|
-
|
|
89
|
-
var _exponential = require("./exponential");
|
|
90
|
-
|
|
91
|
-
var allTools = ['circle', 'line', 'label', 'parabola', 'point', 'polygon', 'ray', 'segment', 'sine', 'vector', 'absolute', 'exponential']; // need this because now we should treat label as other tools PD-3736
|
|
92
|
-
|
|
93
|
-
exports.allTools = allTools;
|
|
94
|
-
var labelTool = {
|
|
95
|
-
type: 'label'
|
|
96
|
-
};
|
|
97
|
-
var toolsArr = [(0, _circle.tool)(), (0, _line.tool)(), (0, _parabola.tool)(), (0, _point.tool)(), (0, _polygon.tool)(), (0, _ray.tool)(), (0, _segment.tool)(), (0, _sine.tool)(), (0, _vector.tool)(), (0, _absolute.tool)(), (0, _exponential.tool)(), labelTool];
|
|
98
|
-
exports.toolsArr = toolsArr;
|
|
99
|
-
//# sourceMappingURL=index.js.map
|
package/lib/tools/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/tools/index.js"],"names":["allTools","labelTool","type","toolsArr"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA,IAAMA,QAAQ,GAAG,CACf,QADe,EAEf,MAFe,EAGf,OAHe,EAIf,UAJe,EAKf,OALe,EAMf,SANe,EAOf,KAPe,EAQf,SARe,EASf,MATe,EAUf,QAVe,EAWf,UAXe,EAYf,aAZe,CAAjB,C,CAeA;;;AACA,IAAMC,SAAS,GAAG;AAChBC,EAAAA,IAAI,EAAE;AADU,CAAlB;AAIA,IAAMC,QAAQ,GAAG,CACf,mBADe,EAEf,iBAFe,EAGf,qBAHe,EAIf,kBAJe,EAKf,oBALe,EAMf,gBANe,EAOf,oBAPe,EAQf,iBARe,EASf,mBATe,EAUf,qBAVe,EAWf,wBAXe,EAYfF,SAZe,CAAjB","sourcesContent":["import { tool as point } from './point';\nimport { tool as circle } from './circle';\nimport { tool as polygon } from './polygon';\nimport { tool as sine } from './sine';\nimport { tool as parabola } from './parabola';\nimport { tool as line } from './line';\nimport { tool as segment } from './segment';\nimport { tool as ray } from './ray';\nimport { tool as vector } from './vector';\nimport { tool as absolute } from './absolute';\nimport { tool as exponential } from './exponential';\n\nconst allTools = [\n 'circle',\n 'line',\n 'label',\n 'parabola',\n 'point',\n 'polygon',\n 'ray',\n 'segment',\n 'sine',\n 'vector',\n 'absolute',\n 'exponential',\n];\n\n// need this because now we should treat label as other tools PD-3736\nconst labelTool = {\n type: 'label',\n};\n\nconst toolsArr = [\n circle(),\n line(),\n parabola(),\n point(),\n polygon(),\n ray(),\n segment(),\n sine(),\n vector(),\n absolute(),\n exponential(),\n labelTool,\n];\n\nexport { allTools, toolsArr, circle, line, point, parabola, polygon, ray, sine, vector, absolute, exponential };\n"],"file":"index.js"}
|
|
@@ -1,103 +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.ArrowedLine = void 0;
|
|
9
|
-
|
|
10
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
-
|
|
12
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
|
-
|
|
14
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
15
|
-
|
|
16
|
-
var _line = require("../shared/line");
|
|
17
|
-
|
|
18
|
-
var _react = _interopRequireDefault(require("react"));
|
|
19
|
-
|
|
20
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
21
|
-
|
|
22
|
-
var _plot = require("@pie-lib/plot");
|
|
23
|
-
|
|
24
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
25
|
-
|
|
26
|
-
var _styles = require("@material-ui/core/styles");
|
|
27
|
-
|
|
28
|
-
var _arrowHead = require("../shared/arrow-head");
|
|
29
|
-
|
|
30
|
-
var _utils = require("../../utils");
|
|
31
|
-
|
|
32
|
-
var _excluded = ["className", "classes", "correctness", "disabled", "graphProps", "from", "to"];
|
|
33
|
-
|
|
34
|
-
var lineStyles = function lineStyles(theme) {
|
|
35
|
-
return {
|
|
36
|
-
line: _line.styles.line(theme),
|
|
37
|
-
enabledArrow: _line.styles.arrow(theme),
|
|
38
|
-
disabledArrow: _line.styles.disabledArrow(theme),
|
|
39
|
-
disabled: _line.styles.disabled(theme),
|
|
40
|
-
disabledSecondary: _line.styles.disabledSecondary(theme),
|
|
41
|
-
correct: _line.styles.correct(theme, 'stroke'),
|
|
42
|
-
correctArrow: _line.styles.correct(theme),
|
|
43
|
-
incorrect: _line.styles.incorrect(theme, 'stroke'),
|
|
44
|
-
incorrectArrow: _line.styles.incorrect(theme),
|
|
45
|
-
missing: _line.styles.missing(theme, 'stroke'),
|
|
46
|
-
missingArrow: _line.styles.missing(theme)
|
|
47
|
-
};
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
var ArrowedLine = function ArrowedLine(props) {
|
|
51
|
-
var markerId = (0, _arrowHead.genUid)();
|
|
52
|
-
var className = props.className,
|
|
53
|
-
classes = props.classes,
|
|
54
|
-
correctness = props.correctness,
|
|
55
|
-
disabled = props.disabled,
|
|
56
|
-
graphProps = props.graphProps,
|
|
57
|
-
from = props.from,
|
|
58
|
-
to = props.to,
|
|
59
|
-
rest = (0, _objectWithoutProperties2["default"])(props, _excluded);
|
|
60
|
-
var scale = graphProps.scale;
|
|
61
|
-
|
|
62
|
-
var _getAdjustedGraphLimi = (0, _utils.getAdjustedGraphLimits)(graphProps),
|
|
63
|
-
domain = _getAdjustedGraphLimi.domain,
|
|
64
|
-
range = _getAdjustedGraphLimi.range;
|
|
65
|
-
|
|
66
|
-
var _trig$edges = _plot.trig.edges(domain, range)(from, to),
|
|
67
|
-
_trig$edges2 = (0, _slicedToArray2["default"])(_trig$edges, 2),
|
|
68
|
-
eFrom = _trig$edges2[0],
|
|
69
|
-
eTo = _trig$edges2[1];
|
|
70
|
-
|
|
71
|
-
var suffix = correctness || disabled && 'disabled' || 'enabled';
|
|
72
|
-
return /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("defs", null, /*#__PURE__*/_react["default"].createElement(_arrowHead.ArrowMarker, {
|
|
73
|
-
size: (0, _utils.thinnerShapesNeeded)(graphProps) ? 4 : 5,
|
|
74
|
-
id: "".concat(props.markerId || markerId, "-").concat(suffix),
|
|
75
|
-
className: (0, _classnames["default"])(classes["".concat(suffix, "Arrow")])
|
|
76
|
-
})), /*#__PURE__*/_react["default"].createElement("line", (0, _extends2["default"])({
|
|
77
|
-
x1: scale.x(eFrom.x),
|
|
78
|
-
y1: scale.y(eFrom.y),
|
|
79
|
-
x2: scale.x(eTo.x),
|
|
80
|
-
y2: scale.y(eTo.y),
|
|
81
|
-
className: (0, _classnames["default"])(classes.line, disabled && classes.disabledSecondary, classes[correctness], className),
|
|
82
|
-
markerEnd: "url(#".concat(props.markerId || markerId, "-").concat(suffix, ")"),
|
|
83
|
-
markerStart: "url(#".concat(props.markerId || markerId, "-").concat(suffix, ")")
|
|
84
|
-
}, rest)));
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
exports.ArrowedLine = ArrowedLine;
|
|
88
|
-
ArrowedLine.propTypes = {
|
|
89
|
-
className: _propTypes["default"].string,
|
|
90
|
-
classes: _propTypes["default"].object,
|
|
91
|
-
correctness: _propTypes["default"].string,
|
|
92
|
-
disabled: _propTypes["default"].bool,
|
|
93
|
-
graphProps: _plot.types.GraphPropsType,
|
|
94
|
-
from: _plot.types.PointType,
|
|
95
|
-
to: _plot.types.PointType,
|
|
96
|
-
markerId: _propTypes["default"].string
|
|
97
|
-
};
|
|
98
|
-
var StyledArrowedLine = (0, _styles.withStyles)(lineStyles)(ArrowedLine);
|
|
99
|
-
var Line = (0, _line.lineBase)(StyledArrowedLine);
|
|
100
|
-
var Component = (0, _line.lineToolComponent)(Line);
|
|
101
|
-
var _default = Component;
|
|
102
|
-
exports["default"] = _default;
|
|
103
|
-
//# sourceMappingURL=component.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/tools/line/component.jsx"],"names":["lineStyles","theme","line","styles","enabledArrow","arrow","disabledArrow","disabled","disabledSecondary","correct","correctArrow","incorrect","incorrectArrow","missing","missingArrow","ArrowedLine","props","markerId","className","classes","correctness","graphProps","from","to","rest","scale","domain","range","trig","edges","eFrom","eTo","suffix","x","y","propTypes","PropTypes","string","object","bool","types","GraphPropsType","PointType","StyledArrowedLine","Line","Component"],"mappings":"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","sourcesContent":["import { lineToolComponent, lineBase, styles } from '../shared/line';\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport { trig, types } from '@pie-lib/plot';\nimport classNames from 'classnames';\nimport { withStyles } from '@material-ui/core/styles';\nimport { ArrowMarker, genUid } from '../shared/arrow-head';\nimport { thinnerShapesNeeded, getAdjustedGraphLimits } from '../../utils';\n\nconst lineStyles = (theme) => ({\n line: styles.line(theme),\n enabledArrow: styles.arrow(theme),\n disabledArrow: styles.disabledArrow(theme),\n disabled: styles.disabled(theme),\n disabledSecondary: styles.disabledSecondary(theme),\n correct: styles.correct(theme, 'stroke'),\n correctArrow: styles.correct(theme),\n incorrect: styles.incorrect(theme, 'stroke'),\n incorrectArrow: styles.incorrect(theme),\n missing: styles.missing(theme, 'stroke'),\n missingArrow: styles.missing(theme),\n});\n\nexport const ArrowedLine = (props) => {\n const markerId = genUid();\n const { className, classes, correctness, disabled, graphProps, from, to, ...rest } = props;\n const { scale } = graphProps;\n const { domain, range } = getAdjustedGraphLimits(graphProps);\n const [eFrom, eTo] = trig.edges(domain, range)(from, to);\n const suffix = correctness || (disabled && 'disabled') || 'enabled';\n\n return (\n <g>\n <defs>\n <ArrowMarker\n size={thinnerShapesNeeded(graphProps) ? 4 : 5}\n id={`${props.markerId || markerId}-${suffix}`}\n className={classNames(classes[`${suffix}Arrow`])}\n />\n </defs>\n <line\n x1={scale.x(eFrom.x)}\n y1={scale.y(eFrom.y)}\n x2={scale.x(eTo.x)}\n y2={scale.y(eTo.y)}\n className={classNames(classes.line, disabled && classes.disabledSecondary, classes[correctness], className)}\n markerEnd={`url(#${props.markerId || markerId}-${suffix})`}\n markerStart={`url(#${props.markerId || markerId}-${suffix})`}\n {...rest}\n />\n </g>\n );\n};\n\nArrowedLine.propTypes = {\n className: PropTypes.string,\n classes: PropTypes.object,\n correctness: PropTypes.string,\n disabled: PropTypes.bool,\n graphProps: types.GraphPropsType,\n from: types.PointType,\n to: types.PointType,\n markerId: PropTypes.string,\n};\n\nconst StyledArrowedLine = withStyles(lineStyles)(ArrowedLine);\n\nconst Line = lineBase(StyledArrowedLine);\nconst Component = lineToolComponent(Line);\n\nexport default Component;\n"],"file":"component.js"}
|
package/lib/tools/line/index.js
DELETED
|
@@ -1,16 +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.tool = void 0;
|
|
9
|
-
|
|
10
|
-
var _component = _interopRequireDefault(require("./component"));
|
|
11
|
-
|
|
12
|
-
var _line = require("../shared/line");
|
|
13
|
-
|
|
14
|
-
var tool = (0, _line.lineTool)('line', _component["default"]);
|
|
15
|
-
exports.tool = tool;
|
|
16
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/tools/line/index.js"],"names":["tool","Line"],"mappings":";;;;;;;;;AAAA;;AACA;;AAEO,IAAMA,IAAI,GAAG,oBAAS,MAAT,EAAiBC,qBAAjB,CAAb","sourcesContent":["import Line from './component';\nimport { lineTool } from '../shared/line';\n\nexport const tool = lineTool('line', Line);\n"],"file":"index.js"}
|
|
@@ -1,34 +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 _debug = _interopRequireDefault(require("debug"));
|
|
11
|
-
|
|
12
|
-
var _graphingUtils = require("@pie-lib/graphing-utils");
|
|
13
|
-
|
|
14
|
-
var _withRootEdge = require("../shared/line/with-root-edge");
|
|
15
|
-
|
|
16
|
-
var log = (0, _debug["default"])('pie-lib:graphing:parabola');
|
|
17
|
-
var Parabola = (0, _withRootEdge.withRootEdge)(function (props) {
|
|
18
|
-
var root = props.root,
|
|
19
|
-
edge = props.edge,
|
|
20
|
-
graphProps = props.graphProps;
|
|
21
|
-
var domain = graphProps.domain,
|
|
22
|
-
range = graphProps.range;
|
|
23
|
-
var dataPoints = edge && edge.x === root.x ? [] : (0, _graphingUtils.buildDataPoints)(domain, range, root, edge, (0, _graphingUtils.parabolaFromTwoPoints)(root, edge), true);
|
|
24
|
-
log('dataPoints:', dataPoints);
|
|
25
|
-
return {
|
|
26
|
-
root: props.root,
|
|
27
|
-
edge: props.edge,
|
|
28
|
-
dataPoints: dataPoints
|
|
29
|
-
};
|
|
30
|
-
});
|
|
31
|
-
var Component = (0, _withRootEdge.rootEdgeComponent)(Parabola);
|
|
32
|
-
var _default = Component;
|
|
33
|
-
exports["default"] = _default;
|
|
34
|
-
//# sourceMappingURL=component.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/tools/parabola/component.jsx"],"names":["log","Parabola","props","root","edge","graphProps","domain","range","dataPoints","x","Component"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AAEA,IAAMA,GAAG,GAAG,uBAAM,2BAAN,CAAZ;AAEA,IAAMC,QAAQ,GAAG,gCAAa,UAACC,KAAD,EAAW;AACvC,MAAQC,IAAR,GAAmCD,KAAnC,CAAQC,IAAR;AAAA,MAAcC,IAAd,GAAmCF,KAAnC,CAAcE,IAAd;AAAA,MAAoBC,UAApB,GAAmCH,KAAnC,CAAoBG,UAApB;AACA,MAAQC,MAAR,GAA0BD,UAA1B,CAAQC,MAAR;AAAA,MAAgBC,KAAhB,GAA0BF,UAA1B,CAAgBE,KAAhB;AAEA,MAAMC,UAAU,GACdJ,IAAI,IAAIA,IAAI,CAACK,CAAL,KAAWN,IAAI,CAACM,CAAxB,GACI,EADJ,GAEI,oCAAgBH,MAAhB,EAAwBC,KAAxB,EAA+BJ,IAA/B,EAAqCC,IAArC,EAA2C,0CAAsBD,IAAtB,EAA4BC,IAA5B,CAA3C,EAA8E,IAA9E,CAHN;AAKAJ,EAAAA,GAAG,CAAC,aAAD,EAAgBQ,UAAhB,CAAH;AAEA,SAAO;AAAEL,IAAAA,IAAI,EAAED,KAAK,CAACC,IAAd;AAAoBC,IAAAA,IAAI,EAAEF,KAAK,CAACE,IAAhC;AAAsCI,IAAAA,UAAU,EAAVA;AAAtC,GAAP;AACD,CAZgB,CAAjB;AAcA,IAAME,SAAS,GAAG,qCAAkBT,QAAlB,CAAlB;eAEeS,S","sourcesContent":["import debug from 'debug';\nimport { buildDataPoints, parabolaFromTwoPoints } from '@pie-lib/graphing-utils';\nimport { withRootEdge, rootEdgeComponent } from '../shared/line/with-root-edge';\n\nconst log = debug('pie-lib:graphing:parabola');\n\nconst Parabola = withRootEdge((props) => {\n const { root, edge, graphProps } = props;\n const { domain, range } = graphProps;\n\n const dataPoints =\n edge && edge.x === root.x\n ? []\n : buildDataPoints(domain, range, root, edge, parabolaFromTwoPoints(root, edge), true);\n\n log('dataPoints:', dataPoints);\n\n return { root: props.root, edge: props.edge, dataPoints };\n});\n\nconst Component = rootEdgeComponent(Parabola);\n\nexport default Component;\n"],"file":"component.js"}
|
|
@@ -1,63 +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.tool = void 0;
|
|
9
|
-
|
|
10
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
-
|
|
12
|
-
var _component = _interopRequireDefault(require("./component"));
|
|
13
|
-
|
|
14
|
-
var _debug = _interopRequireDefault(require("debug"));
|
|
15
|
-
|
|
16
|
-
var _utils = require("../../utils");
|
|
17
|
-
|
|
18
|
-
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; }
|
|
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 log = (0, _debug["default"])('pie-lib:graphing:parabola');
|
|
23
|
-
|
|
24
|
-
var tool = function tool() {
|
|
25
|
-
return {
|
|
26
|
-
type: 'parabola',
|
|
27
|
-
Component: _component["default"],
|
|
28
|
-
complete: function complete(data, mark) {
|
|
29
|
-
return _objectSpread(_objectSpread({}, mark), {}, {
|
|
30
|
-
building: false,
|
|
31
|
-
closed: true
|
|
32
|
-
});
|
|
33
|
-
},
|
|
34
|
-
addPoint: function addPoint(point, mark) {
|
|
35
|
-
log('add point to parabola model: ', point, 'mark: ', mark);
|
|
36
|
-
|
|
37
|
-
if (mark && ((0, _utils.equalPoints)(mark.root, point) || (0, _utils.sameAxes)(mark.root, point))) {
|
|
38
|
-
return mark;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
if (!mark) {
|
|
42
|
-
return {
|
|
43
|
-
type: 'parabola',
|
|
44
|
-
root: point,
|
|
45
|
-
edge: undefined,
|
|
46
|
-
closed: false,
|
|
47
|
-
building: true
|
|
48
|
-
};
|
|
49
|
-
} else if (mark && !mark.root) {
|
|
50
|
-
throw new Error('no root - should never happen');
|
|
51
|
-
} else {
|
|
52
|
-
return _objectSpread(_objectSpread({}, mark), {}, {
|
|
53
|
-
edge: point,
|
|
54
|
-
closed: true,
|
|
55
|
-
building: false
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
exports.tool = tool;
|
|
63
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/tools/parabola/index.js"],"names":["log","tool","type","Component","Parabola","complete","data","mark","building","closed","addPoint","point","root","edge","undefined","Error"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AACA;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,2BAAN,CAAZ;;AAEO,IAAMC,IAAI,GAAG,SAAPA,IAAO;AAAA,SAAO;AACzBC,IAAAA,IAAI,EAAE,UADmB;AAEzBC,IAAAA,SAAS,EAAEC,qBAFc;AAGzBC,IAAAA,QAAQ,EAAE,kBAACC,IAAD,EAAOC,IAAP;AAAA,6CAAsBA,IAAtB;AAA4BC,QAAAA,QAAQ,EAAE,KAAtC;AAA6CC,QAAAA,MAAM,EAAE;AAArD;AAAA,KAHe;AAIzBC,IAAAA,QAAQ,EAAE,kBAACC,KAAD,EAAQJ,IAAR,EAAiB;AACzBP,MAAAA,GAAG,CAAC,+BAAD,EAAkCW,KAAlC,EAAyC,QAAzC,EAAmDJ,IAAnD,CAAH;;AACA,UAAIA,IAAI,KAAK,wBAAYA,IAAI,CAACK,IAAjB,EAAuBD,KAAvB,KAAiC,qBAASJ,IAAI,CAACK,IAAd,EAAoBD,KAApB,CAAtC,CAAR,EAA2E;AACzE,eAAOJ,IAAP;AACD;;AAED,UAAI,CAACA,IAAL,EAAW;AACT,eAAO;AACLL,UAAAA,IAAI,EAAE,UADD;AAELU,UAAAA,IAAI,EAAED,KAFD;AAGLE,UAAAA,IAAI,EAAEC,SAHD;AAILL,UAAAA,MAAM,EAAE,KAJH;AAKLD,UAAAA,QAAQ,EAAE;AALL,SAAP;AAOD,OARD,MAQO,IAAID,IAAI,IAAI,CAACA,IAAI,CAACK,IAAlB,EAAwB;AAC7B,cAAM,IAAIG,KAAJ,CAAU,+BAAV,CAAN;AACD,OAFM,MAEA;AACL,+CAAYR,IAAZ;AAAkBM,UAAAA,IAAI,EAAEF,KAAxB;AAA+BF,UAAAA,MAAM,EAAE,IAAvC;AAA6CD,UAAAA,QAAQ,EAAE;AAAvD;AACD;AACF;AAvBwB,GAAP;AAAA,CAAb","sourcesContent":["import Parabola from './component';\nimport debug from 'debug';\nimport { equalPoints, sameAxes } from '../../utils';\n\nconst log = debug('pie-lib:graphing:parabola');\n\nexport const tool = () => ({\n type: 'parabola',\n Component: Parabola,\n complete: (data, mark) => ({ ...mark, building: false, closed: true }),\n addPoint: (point, mark) => {\n log('add point to parabola model: ', point, 'mark: ', mark);\n if (mark && (equalPoints(mark.root, point) || sameAxes(mark.root, point))) {\n return mark;\n }\n\n if (!mark) {\n return {\n type: 'parabola',\n root: point,\n edge: undefined,\n closed: false,\n building: true,\n };\n } else if (mark && !mark.root) {\n throw new Error('no root - should never happen');\n } else {\n return { ...mark, edge: point, closed: true, building: false };\n }\n },\n});\n"],"file":"index.js"}
|