@pie-lib/graphing-solution-set 4.1.0-beta.7 → 5.0.0-next.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/_rolldown/runtime.js +20 -0
- package/dist/autosize-input.d.ts +10 -0
- package/dist/autosize-input.js +66 -0
- package/dist/axis/arrow.d.ts +13 -0
- package/dist/axis/arrow.js +34 -0
- package/dist/axis/axes.d.ts +132 -0
- package/dist/axis/axes.js +214 -0
- package/dist/axis/index.d.ts +10 -0
- package/dist/bg.d.ts +51 -0
- package/dist/bg.js +44 -0
- package/dist/container/actions.d.ts +15 -0
- package/dist/container/actions.js +7 -0
- package/dist/container/index.d.ts +58 -0
- package/dist/container/index.js +48 -0
- package/dist/container/marks.d.ts +10 -0
- package/dist/container/marks.js +11 -0
- package/dist/container/middleware.d.ts +10 -0
- package/dist/container/middleware.js +4 -0
- package/dist/container/reducer.d.ts +14 -0
- package/dist/container/reducer.js +7 -0
- package/dist/coordinates-label.d.ts +50 -0
- package/dist/coordinates-label.js +46 -0
- package/dist/graph-with-controls.d.ts +85 -0
- package/dist/graph-with-controls.js +155 -0
- package/dist/graph.d.ts +119 -0
- package/dist/graph.js +221 -0
- package/dist/grid-setup.d.ts +27 -0
- package/dist/grid-setup.js +307 -0
- package/dist/grid.d.ts +43 -0
- package/dist/grid.js +59 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +6 -0
- package/dist/labels.d.ts +73 -0
- package/dist/labels.js +134 -0
- package/dist/mark-label.d.ts +50 -0
- package/dist/mark-label.js +84 -0
- package/dist/node_modules/.bun/@visx_axis@4.0.0_d84c32d47042070f/node_modules/@visx/axis/esm/axis/Axis.js +67 -0
- package/dist/node_modules/.bun/@visx_axis@4.0.0_d84c32d47042070f/node_modules/@visx/axis/esm/axis/AxisRenderer.js +66 -0
- package/dist/node_modules/.bun/@visx_axis@4.0.0_d84c32d47042070f/node_modules/@visx/axis/esm/axis/Ticks.js +39 -0
- package/dist/node_modules/.bun/@visx_axis@4.0.0_d84c32d47042070f/node_modules/@visx/axis/esm/constants/orientation.js +9 -0
- package/dist/node_modules/.bun/@visx_axis@4.0.0_d84c32d47042070f/node_modules/@visx/axis/esm/utils/createPoint.js +14 -0
- package/dist/node_modules/.bun/@visx_axis@4.0.0_d84c32d47042070f/node_modules/@visx/axis/esm/utils/getAxisRangePaddingConfig.js +13 -0
- package/dist/node_modules/.bun/@visx_axis@4.0.0_d84c32d47042070f/node_modules/@visx/axis/esm/utils/getLabelTransform.js +16 -0
- package/dist/node_modules/.bun/@visx_axis@4.0.0_d84c32d47042070f/node_modules/@visx/axis/esm/utils/getTickFormatter.js +8 -0
- package/dist/node_modules/.bun/@visx_axis@4.0.0_d84c32d47042070f/node_modules/@visx/axis/esm/utils/getTickPosition.js +14 -0
- package/dist/node_modules/.bun/@visx_grid@4.0.0_d84c32d47042070f/node_modules/@visx/grid/esm/grids/Grid.js +43 -0
- package/dist/node_modules/.bun/@visx_grid@4.0.0_d84c32d47042070f/node_modules/@visx/grid/esm/grids/GridColumns.js +46 -0
- package/dist/node_modules/.bun/@visx_grid@4.0.0_d84c32d47042070f/node_modules/@visx/grid/esm/grids/GridRows.js +46 -0
- package/dist/node_modules/.bun/@visx_grid@4.0.0_d84c32d47042070f/node_modules/@visx/grid/esm/utils/getScaleBandwidth.js +6 -0
- package/dist/node_modules/.bun/@visx_group@4.0.0_d84c32d47042070f/node_modules/@visx/group/esm/Group.js +17 -0
- package/dist/node_modules/.bun/@visx_point@4.0.0/node_modules/@visx/point/esm/Point.js +20 -0
- package/dist/node_modules/.bun/@visx_scale@4.0.0/node_modules/@visx/scale/esm/utils/coerceNumber.js +10 -0
- package/dist/node_modules/.bun/@visx_scale@4.0.0/node_modules/@visx/scale/esm/utils/getTicks.js +7 -0
- package/dist/node_modules/.bun/@visx_scale@4.0.0/node_modules/@visx/scale/esm/utils/toString.js +6 -0
- package/dist/node_modules/.bun/@visx_shape@4.0.0_d84c32d47042070f/node_modules/@visx/shape/esm/shapes/Line.js +27 -0
- package/dist/node_modules/.bun/@visx_text@4.0.0_d84c32d47042070f/node_modules/@visx/text/esm/Text.js +27 -0
- package/dist/node_modules/.bun/@visx_text@4.0.0_d84c32d47042070f/node_modules/@visx/text/esm/hooks/useText.js +68 -0
- package/dist/node_modules/.bun/@visx_text@4.0.0_d84c32d47042070f/node_modules/@visx/text/esm/util/getStringWidth.js +19 -0
- package/dist/node_modules/.bun/@visx_text@4.0.0_d84c32d47042070f/node_modules/@visx/text/esm/util/memoize.js +13 -0
- package/dist/node_modules/.bun/balanced-match@0.4.2/node_modules/balanced-match/index.js +32 -0
- package/dist/node_modules/.bun/balanced-match@1.0.2/node_modules/balanced-match/index.js +33 -0
- package/dist/node_modules/.bun/classnames@2.5.1/node_modules/classnames/index.js +32 -0
- package/dist/node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.js +16 -0
- package/dist/node_modules/.bun/invariant@2.2.4/node_modules/invariant/browser.js +28 -0
- package/dist/node_modules/.bun/math-expression-evaluator@1.4.0/node_modules/math-expression-evaluator/src/formula_evaluator.js +37 -0
- package/dist/node_modules/.bun/math-expression-evaluator@1.4.0/node_modules/math-expression-evaluator/src/lexer.js +509 -0
- package/dist/node_modules/.bun/math-expression-evaluator@1.4.0/node_modules/math-expression-evaluator/src/math_function.js +108 -0
- package/dist/node_modules/.bun/math-expression-evaluator@1.4.0/node_modules/math-expression-evaluator/src/postfix.js +31 -0
- package/dist/node_modules/.bun/math-expression-evaluator@1.4.0/node_modules/math-expression-evaluator/src/postfix_evaluator.js +45 -0
- package/dist/node_modules/.bun/reduce-css-calc@1.3.0/node_modules/reduce-css-calc/index.js +49 -0
- package/dist/node_modules/.bun/reduce-function-call@1.0.3/node_modules/reduce-function-call/index.js +34 -0
- package/dist/node_modules/.bun/redux-undo@1.1.0/node_modules/redux-undo/dist/redux-undo.js +185 -0
- package/dist/node_modules/.bun/redux@5.0.1/node_modules/redux/dist/redux.js +198 -0
- package/dist/toggle-bar.d.ts +40 -0
- package/dist/tool-menu.d.ts +21 -0
- package/dist/tool-menu.js +188 -0
- package/dist/tools/index.d.ts +17 -0
- package/dist/tools/index.js +12 -0
- package/dist/tools/line/component.d.ts +113 -0
- package/dist/tools/line/component.js +58 -0
- package/dist/tools/line/index.d.ts +13 -0
- package/dist/tools/line/index.js +6 -0
- package/dist/tools/polygon/component.d.ts +117 -0
- package/dist/tools/polygon/component.js +194 -0
- package/dist/tools/polygon/index.d.ts +19 -0
- package/dist/tools/polygon/index.js +55 -0
- package/dist/tools/polygon/line.d.ts +125 -0
- package/dist/tools/polygon/polygon.d.ts +122 -0
- package/dist/tools/polygon/polygon.js +62 -0
- package/dist/tools/shared/arrow-head.d.ts +43 -0
- package/dist/tools/shared/arrow-head.js +37 -0
- package/dist/tools/shared/line/index.d.ts +240 -0
- package/dist/tools/shared/line/index.js +320 -0
- package/dist/tools/shared/line/line-path.d.ts +57 -0
- package/dist/tools/shared/line/with-root-edge.d.ts +143 -0
- package/dist/tools/shared/point/arrow-point.d.ts +57 -0
- package/dist/tools/shared/point/arrow-point.js +47 -0
- package/dist/tools/shared/point/arrow.d.ts +46 -0
- package/dist/tools/shared/point/arrow.js +36 -0
- package/dist/tools/shared/point/base-point.d.ts +50 -0
- package/dist/tools/shared/point/base-point.js +88 -0
- package/dist/tools/shared/point/index.d.ts +217 -0
- package/dist/tools/shared/point/index.js +51 -0
- package/dist/tools/shared/styles.d.ts +24 -0
- package/dist/tools/shared/styles.js +17 -0
- package/dist/tools/shared/types.d.ts +15 -0
- package/dist/tools/shared/types.js +10 -0
- package/dist/undo-redo.d.ts +20 -0
- package/dist/undo-redo.js +33 -0
- package/dist/use-debounce.d.ts +9 -0
- package/dist/use-debounce.js +13 -0
- package/dist/utils.d.ts +58 -0
- package/dist/utils.js +72 -0
- package/package.json +52 -42
- package/CHANGELOG.json +0 -1
- package/CHANGELOG.md +0 -449
- package/lib/__tests__/bg.test.js +0 -282
- package/lib/__tests__/bg.test.js.map +0 -1
- package/lib/__tests__/coordinates-label.test.js +0 -276
- package/lib/__tests__/coordinates-label.test.js.map +0 -1
- package/lib/__tests__/graph-with-controls.test.js +0 -256
- package/lib/__tests__/graph-with-controls.test.js.map +0 -1
- package/lib/__tests__/graph.test.js +0 -113
- package/lib/__tests__/graph.test.js.map +0 -1
- package/lib/__tests__/grid-setup.test.js +0 -729
- package/lib/__tests__/grid-setup.test.js.map +0 -1
- package/lib/__tests__/grid.test.js +0 -29
- package/lib/__tests__/grid.test.js.map +0 -1
- package/lib/__tests__/labels.test.js +0 -45
- package/lib/__tests__/labels.test.js.map +0 -1
- package/lib/__tests__/mark-label.test.js +0 -133
- package/lib/__tests__/mark-label.test.js.map +0 -1
- package/lib/__tests__/toggle-bar.test.js +0 -146
- package/lib/__tests__/toggle-bar.test.js.map +0 -1
- package/lib/__tests__/tool-menu.test.js +0 -540
- package/lib/__tests__/tool-menu.test.js.map +0 -1
- package/lib/__tests__/undo-redo.test.js +0 -31
- package/lib/__tests__/undo-redo.test.js.map +0 -1
- package/lib/__tests__/use-debounce.test.js +0 -24
- package/lib/__tests__/use-debounce.test.js.map +0 -1
- package/lib/__tests__/utils.js +0 -70
- package/lib/__tests__/utils.js.map +0 -1
- package/lib/__tests__/utils.test.js +0 -123
- package/lib/__tests__/utils.test.js.map +0 -1
- package/lib/axis/__tests__/arrow.test.js +0 -60
- package/lib/axis/__tests__/arrow.test.js.map +0 -1
- package/lib/axis/__tests__/axes.test.js +0 -160
- package/lib/axis/__tests__/axes.test.js.map +0 -1
- package/lib/axis/arrow.js +0 -79
- package/lib/axis/arrow.js.map +0 -1
- package/lib/axis/axes.js +0 -327
- package/lib/axis/axes.js.map +0 -1
- package/lib/axis/index.js +0 -21
- package/lib/axis/index.js.map +0 -1
- package/lib/bg.js +0 -114
- package/lib/bg.js.map +0 -1
- package/lib/container/__tests__/actions.test.js +0 -108
- package/lib/container/__tests__/actions.test.js.map +0 -1
- package/lib/container/__tests__/index.test.js +0 -346
- package/lib/container/__tests__/index.test.js.map +0 -1
- package/lib/container/__tests__/marks.test.js +0 -259
- package/lib/container/__tests__/marks.test.js.map +0 -1
- package/lib/container/__tests__/middleware.test.js +0 -244
- package/lib/container/__tests__/middleware.test.js.map +0 -1
- package/lib/container/__tests__/reducer.test.js +0 -450
- package/lib/container/__tests__/reducer.test.js.map +0 -1
- package/lib/container/actions.js +0 -18
- package/lib/container/actions.js.map +0 -1
- package/lib/container/index.js +0 -129
- package/lib/container/index.js.map +0 -1
- package/lib/container/marks.js +0 -22
- package/lib/container/marks.js.map +0 -1
- package/lib/container/middleware.js +0 -19
- package/lib/container/middleware.js.map +0 -1
- package/lib/container/reducer.js +0 -18
- package/lib/container/reducer.js.map +0 -1
- package/lib/coordinates-label.js +0 -77
- package/lib/coordinates-label.js.map +0 -1
- package/lib/graph-with-controls.js +0 -297
- package/lib/graph-with-controls.js.map +0 -1
- package/lib/graph.js +0 -353
- package/lib/graph.js.map +0 -1
- package/lib/grid-setup.js +0 -414
- package/lib/grid-setup.js.map +0 -1
- package/lib/grid.js +0 -131
- package/lib/grid.js.map +0 -1
- package/lib/index.js +0 -40
- package/lib/index.js.map +0 -1
- package/lib/labels.js +0 -199
- package/lib/labels.js.map +0 -1
- package/lib/mark-label.js +0 -159
- package/lib/mark-label.js.map +0 -1
- package/lib/toggle-bar.js +0 -248
- package/lib/toggle-bar.js.map +0 -1
- package/lib/tool-menu.js +0 -218
- package/lib/tool-menu.js.map +0 -1
- package/lib/tools/index.js +0 -24
- package/lib/tools/index.js.map +0 -1
- package/lib/tools/line/__tests__/component.test.js +0 -45
- package/lib/tools/line/__tests__/component.test.js.map +0 -1
- package/lib/tools/line/component.js +0 -92
- package/lib/tools/line/component.js.map +0 -1
- package/lib/tools/line/index.js +0 -11
- package/lib/tools/line/index.js.map +0 -1
- package/lib/tools/polygon/__tests__/component.test.js +0 -501
- package/lib/tools/polygon/__tests__/component.test.js.map +0 -1
- package/lib/tools/polygon/__tests__/index.test.js +0 -92
- package/lib/tools/polygon/__tests__/index.test.js.map +0 -1
- package/lib/tools/polygon/__tests__/line.test.js +0 -30
- package/lib/tools/polygon/__tests__/line.test.js.map +0 -1
- package/lib/tools/polygon/__tests__/polygon.test.js +0 -61
- package/lib/tools/polygon/__tests__/polygon.test.js.map +0 -1
- package/lib/tools/polygon/component.js +0 -358
- package/lib/tools/polygon/component.js.map +0 -1
- package/lib/tools/polygon/index.js +0 -89
- package/lib/tools/polygon/index.js.map +0 -1
- package/lib/tools/polygon/line.js +0 -114
- package/lib/tools/polygon/line.js.map +0 -1
- package/lib/tools/polygon/polygon.js +0 -128
- package/lib/tools/polygon/polygon.js.map +0 -1
- package/lib/tools/shared/__tests__/arrow-head.test.js +0 -45
- package/lib/tools/shared/__tests__/arrow-head.test.js.map +0 -1
- package/lib/tools/shared/arrow-head.js +0 -62
- package/lib/tools/shared/arrow-head.js.map +0 -1
- package/lib/tools/shared/line/__tests__/index.test.js +0 -725
- package/lib/tools/shared/line/__tests__/index.test.js.map +0 -1
- package/lib/tools/shared/line/__tests__/line-path.test.js +0 -64
- package/lib/tools/shared/line/__tests__/line-path.test.js.map +0 -1
- package/lib/tools/shared/line/__tests__/with-root-edge.test.js +0 -618
- package/lib/tools/shared/line/__tests__/with-root-edge.test.js.map +0 -1
- package/lib/tools/shared/line/index.js +0 -539
- package/lib/tools/shared/line/index.js.map +0 -1
- package/lib/tools/shared/line/line-path.js +0 -121
- package/lib/tools/shared/line/line-path.js.map +0 -1
- package/lib/tools/shared/line/with-root-edge.js +0 -121
- package/lib/tools/shared/line/with-root-edge.js.map +0 -1
- package/lib/tools/shared/point/__tests__/arrow-point.test.js +0 -127
- package/lib/tools/shared/point/__tests__/arrow-point.test.js.map +0 -1
- package/lib/tools/shared/point/__tests__/arrow.test.js +0 -619
- package/lib/tools/shared/point/__tests__/arrow.test.js.map +0 -1
- package/lib/tools/shared/point/__tests__/base-point.test.js +0 -122
- package/lib/tools/shared/point/__tests__/base-point.test.js.map +0 -1
- package/lib/tools/shared/point/arrow-point.js +0 -86
- package/lib/tools/shared/point/arrow-point.js.map +0 -1
- package/lib/tools/shared/point/arrow.js +0 -70
- package/lib/tools/shared/point/arrow.js.map +0 -1
- package/lib/tools/shared/point/base-point.js +0 -137
- package/lib/tools/shared/point/base-point.js.map +0 -1
- package/lib/tools/shared/point/index.js +0 -80
- package/lib/tools/shared/point/index.js.map +0 -1
- package/lib/tools/shared/styles.js +0 -26
- package/lib/tools/shared/styles.js.map +0 -1
- package/lib/tools/shared/types.js +0 -15
- package/lib/tools/shared/types.js.map +0 -1
- package/lib/undo-redo.js +0 -67
- package/lib/undo-redo.js.map +0 -1
- package/lib/use-debounce.js +0 -25
- package/lib/use-debounce.js.map +0 -1
- package/lib/utils.js +0 -235
- package/lib/utils.js.map +0 -1
- package/src/__tests__/bg.test.jsx +0 -250
- package/src/__tests__/coordinates-label.test.jsx +0 -243
- package/src/__tests__/graph-with-controls.test.jsx +0 -184
- package/src/__tests__/graph.test.jsx +0 -93
- package/src/__tests__/grid-setup.test.jsx +0 -645
- package/src/__tests__/grid.test.jsx +0 -23
- package/src/__tests__/labels.test.jsx +0 -41
- package/src/__tests__/mark-label.test.jsx +0 -66
- package/src/__tests__/toggle-bar.test.jsx +0 -106
- package/src/__tests__/tool-menu.test.jsx +0 -453
- package/src/__tests__/undo-redo.test.jsx +0 -26
- package/src/__tests__/use-debounce.test.js +0 -21
- package/src/__tests__/utils.js +0 -41
- package/src/__tests__/utils.test.js +0 -105
- package/src/axis/__tests__/arrow.test.jsx +0 -43
- package/src/axis/__tests__/axes.test.jsx +0 -182
- package/src/axis/arrow.jsx +0 -57
- package/src/axis/axes.jsx +0 -284
- package/src/axis/index.js +0 -3
- package/src/bg.jsx +0 -96
- package/src/container/__tests__/actions.test.js +0 -105
- package/src/container/__tests__/index.test.jsx +0 -227
- package/src/container/__tests__/marks.test.js +0 -172
- package/src/container/__tests__/middleware.test.js +0 -235
- package/src/container/__tests__/reducer.test.js +0 -324
- package/src/container/actions.js +0 -8
- package/src/container/index.jsx +0 -93
- package/src/container/marks.js +0 -14
- package/src/container/middleware.js +0 -7
- package/src/container/reducer.js +0 -5
- package/src/coordinates-label.jsx +0 -62
- package/src/graph-with-controls.jsx +0 -242
- package/src/graph.jsx +0 -333
- package/src/grid-setup.jsx +0 -432
- package/src/grid.jsx +0 -133
- package/src/index.js +0 -7
- package/src/labels.jsx +0 -173
- package/src/mark-label.jsx +0 -125
- package/src/toggle-bar.jsx +0 -221
- package/src/tool-menu.jsx +0 -235
- package/src/tools/index.js +0 -8
- package/src/tools/line/__tests__/component.test.jsx +0 -37
- package/src/tools/line/component.jsx +0 -77
- package/src/tools/line/index.js +0 -4
- package/src/tools/polygon/__tests__/component.test.jsx +0 -487
- package/src/tools/polygon/__tests__/index.test.js +0 -65
- package/src/tools/polygon/__tests__/line.test.jsx +0 -23
- package/src/tools/polygon/__tests__/polygon.test.jsx +0 -44
- package/src/tools/polygon/component.jsx +0 -324
- package/src/tools/polygon/index.js +0 -52
- package/src/tools/polygon/line.jsx +0 -80
- package/src/tools/polygon/polygon.jsx +0 -93
- package/src/tools/shared/__tests__/arrow-head.test.jsx +0 -33
- package/src/tools/shared/arrow-head.jsx +0 -46
- package/src/tools/shared/line/__tests__/index.test.jsx +0 -553
- package/src/tools/shared/line/__tests__/line-path.test.jsx +0 -56
- package/src/tools/shared/line/__tests__/with-root-edge.test.jsx +0 -488
- package/src/tools/shared/line/index.jsx +0 -471
- package/src/tools/shared/line/line-path.jsx +0 -85
- package/src/tools/shared/line/with-root-edge.jsx +0 -97
- package/src/tools/shared/point/__tests__/arrow-point.test.jsx +0 -91
- package/src/tools/shared/point/__tests__/arrow.test.jsx +0 -469
- package/src/tools/shared/point/__tests__/base-point.test.jsx +0 -87
- package/src/tools/shared/point/arrow-point.jsx +0 -60
- package/src/tools/shared/point/arrow.jsx +0 -40
- package/src/tools/shared/point/base-point.jsx +0 -113
- package/src/tools/shared/point/index.jsx +0 -58
- package/src/tools/shared/styles.js +0 -20
- package/src/tools/shared/types.js +0 -8
- package/src/undo-redo.jsx +0 -37
- package/src/use-debounce.js +0 -13
- package/src/utils.js +0 -230
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports["default"] = exports.ArrowedLine = void 0;
|
|
8
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
|
-
var _line = require("../shared/line");
|
|
13
|
-
var _react = _interopRequireDefault(require("react"));
|
|
14
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
|
-
var _plot = require("@pie-lib/plot");
|
|
16
|
-
var _styles = require("@mui/material/styles");
|
|
17
|
-
var _arrowHead = require("../shared/arrow-head");
|
|
18
|
-
var _utils = require("../../utils");
|
|
19
|
-
var _excluded = ["className", "correctness", "disabled", "graphProps", "fill", "from", "to"];
|
|
20
|
-
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; }
|
|
21
|
-
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; }
|
|
22
|
-
var StyledLine = (0, _styles.styled)('line', {
|
|
23
|
-
shouldForwardProp: function shouldForwardProp(prop) {
|
|
24
|
-
return !['fill', 'disabled', 'correctness'].includes(prop);
|
|
25
|
-
}
|
|
26
|
-
})(function (_ref) {
|
|
27
|
-
var theme = _ref.theme,
|
|
28
|
-
fill = _ref.fill,
|
|
29
|
-
disabled = _ref.disabled,
|
|
30
|
-
correctness = _ref.correctness;
|
|
31
|
-
return _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, fill === 'Solid' ? _line.styles.line(theme) : _line.styles.dashedLine(theme)), disabled && _line.styles.disabled(theme)), correctness === 'correct' && _line.styles.correct(theme, 'stroke')), correctness === 'incorrect' && _line.styles.incorrect(theme, 'stroke')), correctness === 'missing' && _line.styles.missing(theme, 'stroke'));
|
|
32
|
-
});
|
|
33
|
-
var StyledArrowMarker = (0, _styles.styled)(_arrowHead.ArrowMarker, {
|
|
34
|
-
shouldForwardProp: function shouldForwardProp(prop) {
|
|
35
|
-
return !['suffix'].includes(prop);
|
|
36
|
-
}
|
|
37
|
-
})(function (_ref2) {
|
|
38
|
-
var theme = _ref2.theme,
|
|
39
|
-
suffix = _ref2.suffix;
|
|
40
|
-
return _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, suffix === 'enabled' && _line.styles.arrow(theme)), suffix === 'disabled' && _line.styles.disabledArrow(theme)), suffix === 'correct' && _line.styles.correct(theme)), suffix === 'incorrect' && _line.styles.incorrect(theme)), suffix === 'missing' && _line.styles.missing(theme));
|
|
41
|
-
});
|
|
42
|
-
var ArrowedLine = exports.ArrowedLine = function ArrowedLine(props) {
|
|
43
|
-
var markerId = (0, _arrowHead.genUid)();
|
|
44
|
-
var className = props.className,
|
|
45
|
-
correctness = props.correctness,
|
|
46
|
-
disabled = props.disabled,
|
|
47
|
-
graphProps = props.graphProps,
|
|
48
|
-
_props$fill = props.fill,
|
|
49
|
-
fill = _props$fill === void 0 ? 'Solid' : _props$fill,
|
|
50
|
-
from = props.from,
|
|
51
|
-
to = props.to,
|
|
52
|
-
rest = (0, _objectWithoutProperties2["default"])(props, _excluded);
|
|
53
|
-
var scale = graphProps.scale;
|
|
54
|
-
var _getAdjustedGraphLimi = (0, _utils.getAdjustedGraphLimits)(graphProps),
|
|
55
|
-
domain = _getAdjustedGraphLimi.domain,
|
|
56
|
-
range = _getAdjustedGraphLimi.range;
|
|
57
|
-
var _trig$edges = _plot.trig.edges(domain, range)(from, to),
|
|
58
|
-
_trig$edges2 = (0, _slicedToArray2["default"])(_trig$edges, 2),
|
|
59
|
-
eFrom = _trig$edges2[0],
|
|
60
|
-
eTo = _trig$edges2[1];
|
|
61
|
-
var suffix = correctness || disabled && 'disabled' || 'enabled';
|
|
62
|
-
return /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("defs", null, /*#__PURE__*/_react["default"].createElement(StyledArrowMarker, {
|
|
63
|
-
size: (0, _utils.thinnerShapesNeeded)(graphProps) ? 4 : 5,
|
|
64
|
-
id: "".concat(props.markerId || markerId, "-").concat(suffix),
|
|
65
|
-
suffix: suffix
|
|
66
|
-
})), /*#__PURE__*/_react["default"].createElement(StyledLine, (0, _extends2["default"])({
|
|
67
|
-
x1: scale.x(eFrom.x),
|
|
68
|
-
y1: scale.y(eFrom.y),
|
|
69
|
-
x2: scale.x(eTo.x),
|
|
70
|
-
y2: scale.y(eTo.y),
|
|
71
|
-
fill: fill,
|
|
72
|
-
disabled: disabled,
|
|
73
|
-
correctness: correctness,
|
|
74
|
-
className: className,
|
|
75
|
-
markerEnd: "url(#".concat(props.markerId || markerId, "-").concat(suffix, ")"),
|
|
76
|
-
markerStart: "url(#".concat(props.markerId || markerId, "-").concat(suffix, ")")
|
|
77
|
-
}, rest)));
|
|
78
|
-
};
|
|
79
|
-
ArrowedLine.propTypes = {
|
|
80
|
-
className: _propTypes["default"].string,
|
|
81
|
-
fill: _propTypes["default"].string,
|
|
82
|
-
correctness: _propTypes["default"].string,
|
|
83
|
-
disabled: _propTypes["default"].bool,
|
|
84
|
-
graphProps: _plot.types.GraphPropsType,
|
|
85
|
-
from: _plot.types.PointType,
|
|
86
|
-
to: _plot.types.PointType,
|
|
87
|
-
markerId: _propTypes["default"].string
|
|
88
|
-
};
|
|
89
|
-
var Line = (0, _line.lineBase)(ArrowedLine);
|
|
90
|
-
var Component = (0, _line.lineToolComponent)(Line);
|
|
91
|
-
var _default = exports["default"] = Component;
|
|
92
|
-
//# sourceMappingURL=component.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","names":["_line","require","_react","_interopRequireDefault","_propTypes","_plot","_styles","_arrowHead","_utils","_excluded","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","StyledLine","styled","shouldForwardProp","prop","includes","_ref","theme","fill","disabled","correctness","styles","line","dashedLine","correct","incorrect","missing","StyledArrowMarker","ArrowMarker","_ref2","suffix","arrow","disabledArrow","ArrowedLine","exports","props","markerId","genUid","className","graphProps","_props$fill","from","to","rest","_objectWithoutProperties2","scale","_getAdjustedGraphLimi","getAdjustedGraphLimits","domain","range","_trig$edges","trig","edges","_trig$edges2","_slicedToArray2","eFrom","eTo","createElement","size","thinnerShapesNeeded","id","concat","_extends2","x1","x","y1","y","x2","y2","markerEnd","markerStart","propTypes","PropTypes","string","bool","types","GraphPropsType","PointType","Line","lineBase","Component","lineToolComponent","_default"],"sources":["../../../src/tools/line/component.jsx"],"sourcesContent":["import { lineBase, lineToolComponent, styles } from '../shared/line';\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport { trig, types } from '@pie-lib/plot';\nimport { styled } from '@mui/material/styles';\nimport { ArrowMarker, genUid } from '../shared/arrow-head';\nimport { getAdjustedGraphLimits, thinnerShapesNeeded } from '../../utils';\n\nconst StyledLine = styled('line', {\n shouldForwardProp: (prop) => !['fill', 'disabled', 'correctness'].includes(prop),\n})(({ theme, fill, disabled, correctness }) => ({\n ...(fill === 'Solid' ? styles.line(theme) : styles.dashedLine(theme)),\n ...(disabled && styles.disabled(theme)),\n ...(correctness === 'correct' && styles.correct(theme, 'stroke')),\n ...(correctness === 'incorrect' && styles.incorrect(theme, 'stroke')),\n ...(correctness === 'missing' && styles.missing(theme, 'stroke')),\n}));\n\nconst StyledArrowMarker = styled(ArrowMarker, {\n shouldForwardProp: (prop) => !['suffix'].includes(prop),\n})(({ theme, suffix }) => ({\n ...(suffix === 'enabled' && styles.arrow(theme)),\n ...(suffix === 'disabled' && styles.disabledArrow(theme)),\n ...(suffix === 'correct' && styles.correct(theme)),\n ...(suffix === 'incorrect' && styles.incorrect(theme)),\n ...(suffix === 'missing' && styles.missing(theme)),\n}));\n\nexport const ArrowedLine = (props) => {\n const markerId = genUid();\n const { className, correctness, disabled, graphProps, fill = 'Solid', 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 <StyledArrowMarker\n size={thinnerShapesNeeded(graphProps) ? 4 : 5}\n id={`${props.markerId || markerId}-${suffix}`}\n suffix={suffix}\n />\n </defs>\n <StyledLine\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 fill={fill}\n disabled={disabled}\n correctness={correctness}\n className={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 fill: PropTypes.string,\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 Line = lineBase(ArrowedLine);\nconst Component = lineToolComponent(Line);\n\nexport default Component;\n"],"mappings":"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","ignoreList":[]}
|
package/lib/tools/line/index.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.tool = void 0;
|
|
8
|
-
var _component = _interopRequireDefault(require("./component"));
|
|
9
|
-
var _line = require("../shared/line");
|
|
10
|
-
var tool = exports.tool = (0, _line.lineTool)('line', _component["default"]);
|
|
11
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_component","_interopRequireDefault","require","_line","tool","exports","lineTool","Line"],"sources":["../../../src/tools/line/index.js"],"sourcesContent":["import Line from './component';\nimport { lineTool } from '../shared/line';\n\nexport const tool = lineTool('line', Line);\n"],"mappings":";;;;;;;AAAA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAEO,IAAME,IAAI,GAAAC,OAAA,CAAAD,IAAA,GAAG,IAAAE,cAAQ,EAAC,MAAM,EAAEC,qBAAI,CAAC","ignoreList":[]}
|
|
@@ -1,501 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
5
|
-
var _testUtils = require("@pie-lib/test-utils");
|
|
6
|
-
var _react = _interopRequireDefault(require("react"));
|
|
7
|
-
var _utils = require("../../../__tests__/utils");
|
|
8
|
-
var _component = require("../component");
|
|
9
|
-
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; }
|
|
10
|
-
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; }
|
|
11
|
-
var xyLabel = function xyLabel(x, y, index, label) {
|
|
12
|
-
return _objectSpread(_objectSpread({}, (0, _utils.xy)(x, y, index)), {}, {
|
|
13
|
-
label: label
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
// Pure function tests - keep as-is
|
|
18
|
-
describe('buildLines', function () {
|
|
19
|
-
var defaultPoints = [(0, _utils.xy)(0, 0), (0, _utils.xy)(1, 1), (0, _utils.xy)(1, 0)];
|
|
20
|
-
var assertBuildLines = function assertBuildLines(points, closed, expected) {
|
|
21
|
-
it("builds points and lines for ".concat(points, " = ").concat(expected), function () {
|
|
22
|
-
var result = (0, _component.buildLines)(points);
|
|
23
|
-
expect(result).toMatchObject([{
|
|
24
|
-
from: (0, _utils.xy)(0, 0, 0),
|
|
25
|
-
to: (0, _utils.xy)(1, 1, 1)
|
|
26
|
-
}, {
|
|
27
|
-
from: (0, _utils.xy)(1, 1, 1),
|
|
28
|
-
to: (0, _utils.xy)(1, 0, 2)
|
|
29
|
-
}]);
|
|
30
|
-
});
|
|
31
|
-
};
|
|
32
|
-
assertBuildLines(defaultPoints, true, []);
|
|
33
|
-
});
|
|
34
|
-
describe('swap', function () {
|
|
35
|
-
it('swaps pairs', function () {
|
|
36
|
-
var result = (0, _component.swap)([(0, _utils.xy)(0, 0, 0), (0, _utils.xy)(1, 1, 1), (0, _utils.xy)(2, 2, 2)], (0, _utils.xy)(0, 0, 0), (0, _utils.xy)(3, 3, 0));
|
|
37
|
-
expect(result).toEqual([(0, _utils.xy)(3, 3, 0), (0, _utils.xy)(1, 1, 1), (0, _utils.xy)(2, 2, 2)]);
|
|
38
|
-
});
|
|
39
|
-
it('swaps first element', function () {
|
|
40
|
-
var result = (0, _component.swap)([(0, _utils.xy)(0, 0, 0), (0, _utils.xy)(1, 1, 1)], (0, _utils.xy)(0, 0, 0), (0, _utils.xy)(5, 5, 0));
|
|
41
|
-
expect(result).toEqual([(0, _utils.xy)(5, 5, 0), (0, _utils.xy)(1, 1, 1)]);
|
|
42
|
-
});
|
|
43
|
-
it('swaps last element', function () {
|
|
44
|
-
var result = (0, _component.swap)([(0, _utils.xy)(0, 0, 0), (0, _utils.xy)(1, 1, 1), (0, _utils.xy)(2, 2, 2)], (0, _utils.xy)(2, 2, 2), (0, _utils.xy)(3, 3, 2));
|
|
45
|
-
expect(result).toEqual([(0, _utils.xy)(0, 0, 0), (0, _utils.xy)(1, 1, 1), (0, _utils.xy)(3, 3, 2)]);
|
|
46
|
-
});
|
|
47
|
-
it('swaps middle element', function () {
|
|
48
|
-
var result = (0, _component.swap)([(0, _utils.xy)(0, 0, 0), (0, _utils.xy)(1, 1, 1), (0, _utils.xy)(2, 2, 2)], (0, _utils.xy)(1, 1, 1), (0, _utils.xy)(3, 3, 1));
|
|
49
|
-
expect(result).toEqual([(0, _utils.xy)(0, 0, 0), (0, _utils.xy)(3, 3, 1), (0, _utils.xy)(2, 2, 2)]);
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
// Note: Instance method tests have been removed. Component behavior should be tested
|
|
54
|
-
// through user interactions and integration tests.
|
|
55
|
-
describe('RawBaseComponent', function () {
|
|
56
|
-
var onChange;
|
|
57
|
-
var onChangeProps;
|
|
58
|
-
var onClosePolygon;
|
|
59
|
-
beforeEach(function () {
|
|
60
|
-
onChange = jest.fn();
|
|
61
|
-
onChangeProps = jest.fn();
|
|
62
|
-
onClosePolygon = jest.fn();
|
|
63
|
-
});
|
|
64
|
-
var renderComponent = function renderComponent(extras) {
|
|
65
|
-
var defaults = {
|
|
66
|
-
className: 'className',
|
|
67
|
-
onChange: onChange,
|
|
68
|
-
onChangeProps: onChangeProps,
|
|
69
|
-
onClosePolygon: onClosePolygon,
|
|
70
|
-
graphProps: (0, _utils.graphProps)(),
|
|
71
|
-
points: []
|
|
72
|
-
};
|
|
73
|
-
var props = _objectSpread(_objectSpread({}, defaults), extras);
|
|
74
|
-
return (0, _testUtils.render)(/*#__PURE__*/_react["default"].createElement(_component.RawBaseComponent, props));
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
// used to test items that have labels attached to points
|
|
78
|
-
var labelNode = document.createElement('foreignObject');
|
|
79
|
-
var points = [xyLabel(0, 0, 0, 'A'), xyLabel(2, 2, 1, 'B'), xyLabel(0, 2, 2, 'C')];
|
|
80
|
-
var renderWithLabels = function renderWithLabels(extras) {
|
|
81
|
-
return renderComponent(_objectSpread({
|
|
82
|
-
labelNode: labelNode,
|
|
83
|
-
points: points
|
|
84
|
-
}, extras));
|
|
85
|
-
};
|
|
86
|
-
describe('rendering', function () {
|
|
87
|
-
it('renders without crashing', function () {
|
|
88
|
-
var _renderComponent = renderComponent(),
|
|
89
|
-
container = _renderComponent.container;
|
|
90
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
91
|
-
});
|
|
92
|
-
it('renders with labels', function () {
|
|
93
|
-
var _renderWithLabels = renderWithLabels(),
|
|
94
|
-
container = _renderWithLabels.container;
|
|
95
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
96
|
-
});
|
|
97
|
-
it('renders with multiple points', function () {
|
|
98
|
-
var _renderComponent2 = renderComponent({
|
|
99
|
-
points: [(0, _utils.xy)(0, 0, 0), (0, _utils.xy)(1, 1, 1), (0, _utils.xy)(2, 0, 2)]
|
|
100
|
-
}),
|
|
101
|
-
container = _renderComponent2.container;
|
|
102
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
103
|
-
});
|
|
104
|
-
it('renders with closed polygon', function () {
|
|
105
|
-
var _renderComponent3 = renderComponent({
|
|
106
|
-
points: [(0, _utils.xy)(0, 0, 0), (0, _utils.xy)(1, 1, 1), (0, _utils.xy)(2, 0, 2)],
|
|
107
|
-
closed: true
|
|
108
|
-
}),
|
|
109
|
-
container = _renderComponent3.container;
|
|
110
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
111
|
-
});
|
|
112
|
-
it('renders with single point', function () {
|
|
113
|
-
var _renderComponent4 = renderComponent({
|
|
114
|
-
points: [(0, _utils.xy)(0, 0, 0)]
|
|
115
|
-
}),
|
|
116
|
-
container = _renderComponent4.container;
|
|
117
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
118
|
-
});
|
|
119
|
-
it('renders with two points', function () {
|
|
120
|
-
var _renderComponent5 = renderComponent({
|
|
121
|
-
points: [(0, _utils.xy)(0, 0, 0), (0, _utils.xy)(1, 1, 1)]
|
|
122
|
-
}),
|
|
123
|
-
container = _renderComponent5.container;
|
|
124
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
125
|
-
});
|
|
126
|
-
it('renders empty polygon', function () {
|
|
127
|
-
var _renderComponent6 = renderComponent({
|
|
128
|
-
points: []
|
|
129
|
-
}),
|
|
130
|
-
container = _renderComponent6.container;
|
|
131
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
132
|
-
});
|
|
133
|
-
it('renders with negative coordinates', function () {
|
|
134
|
-
var _renderComponent7 = renderComponent({
|
|
135
|
-
points: [(0, _utils.xy)(-5, -5, 0), (0, _utils.xy)(-1, -1, 1), (0, _utils.xy)(-3, -2, 2)]
|
|
136
|
-
}),
|
|
137
|
-
container = _renderComponent7.container;
|
|
138
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
139
|
-
});
|
|
140
|
-
it('renders with decimal coordinates', function () {
|
|
141
|
-
var _renderComponent8 = renderComponent({
|
|
142
|
-
points: [(0, _utils.xy)(0.5, 0.5, 0), (0, _utils.xy)(1.5, 1.5, 1), (0, _utils.xy)(2.5, 0.5, 2)]
|
|
143
|
-
}),
|
|
144
|
-
container = _renderComponent8.container;
|
|
145
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
146
|
-
});
|
|
147
|
-
it('renders with large coordinate values', function () {
|
|
148
|
-
var _renderComponent9 = renderComponent({
|
|
149
|
-
points: [(0, _utils.xy)(100, 100, 0), (0, _utils.xy)(200, 200, 1), (0, _utils.xy)(150, 250, 2)]
|
|
150
|
-
}),
|
|
151
|
-
container = _renderComponent9.container;
|
|
152
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
153
|
-
});
|
|
154
|
-
});
|
|
155
|
-
describe('states', function () {
|
|
156
|
-
it('renders in disabled state', function () {
|
|
157
|
-
var _renderComponent0 = renderComponent({
|
|
158
|
-
points: [(0, _utils.xy)(0, 0, 0), (0, _utils.xy)(1, 1, 1), (0, _utils.xy)(2, 0, 2)],
|
|
159
|
-
disabled: true
|
|
160
|
-
}),
|
|
161
|
-
container = _renderComponent0.container;
|
|
162
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
163
|
-
});
|
|
164
|
-
it('renders in enabled state', function () {
|
|
165
|
-
var _renderComponent1 = renderComponent({
|
|
166
|
-
points: [(0, _utils.xy)(0, 0, 0), (0, _utils.xy)(1, 1, 1), (0, _utils.xy)(2, 0, 2)],
|
|
167
|
-
disabled: false
|
|
168
|
-
}),
|
|
169
|
-
container = _renderComponent1.container;
|
|
170
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
171
|
-
});
|
|
172
|
-
it('renders with correctness correct', function () {
|
|
173
|
-
var _renderComponent10 = renderComponent({
|
|
174
|
-
points: [(0, _utils.xy)(0, 0, 0), (0, _utils.xy)(1, 1, 1), (0, _utils.xy)(2, 0, 2)],
|
|
175
|
-
correctness: 'correct'
|
|
176
|
-
}),
|
|
177
|
-
container = _renderComponent10.container;
|
|
178
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
179
|
-
});
|
|
180
|
-
it('renders with correctness incorrect', function () {
|
|
181
|
-
var _renderComponent11 = renderComponent({
|
|
182
|
-
points: [(0, _utils.xy)(0, 0, 0), (0, _utils.xy)(1, 1, 1), (0, _utils.xy)(2, 0, 2)],
|
|
183
|
-
correctness: 'incorrect'
|
|
184
|
-
}),
|
|
185
|
-
container = _renderComponent11.container;
|
|
186
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
187
|
-
});
|
|
188
|
-
it('renders with building state', function () {
|
|
189
|
-
var _renderComponent12 = renderComponent({
|
|
190
|
-
points: [(0, _utils.xy)(0, 0, 0), (0, _utils.xy)(1, 1, 1)],
|
|
191
|
-
building: true
|
|
192
|
-
}),
|
|
193
|
-
container = _renderComponent12.container;
|
|
194
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
195
|
-
});
|
|
196
|
-
it('renders with fill property', function () {
|
|
197
|
-
var _renderComponent13 = renderComponent({
|
|
198
|
-
points: [(0, _utils.xy)(0, 0, 0), (0, _utils.xy)(1, 1, 1), (0, _utils.xy)(2, 0, 2)],
|
|
199
|
-
fill: '#ff0000'
|
|
200
|
-
}),
|
|
201
|
-
container = _renderComponent13.container;
|
|
202
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
203
|
-
});
|
|
204
|
-
});
|
|
205
|
-
describe('labels', function () {
|
|
206
|
-
it('renders with all points labeled', function () {
|
|
207
|
-
var _renderWithLabels2 = renderWithLabels(),
|
|
208
|
-
container = _renderWithLabels2.container;
|
|
209
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
210
|
-
});
|
|
211
|
-
it('renders with partial labels', function () {
|
|
212
|
-
var partialLabels = [xyLabel(0, 0, 0, 'A'), (0, _utils.xy)(2, 2, 1), xyLabel(0, 2, 2, 'C')];
|
|
213
|
-
var _renderComponent14 = renderComponent({
|
|
214
|
-
labelNode: labelNode,
|
|
215
|
-
points: partialLabels
|
|
216
|
-
}),
|
|
217
|
-
container = _renderComponent14.container;
|
|
218
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
219
|
-
});
|
|
220
|
-
it('renders with empty string labels', function () {
|
|
221
|
-
var emptyLabels = [xyLabel(0, 0, 0, ''), xyLabel(2, 2, 1, ''), xyLabel(0, 2, 2, '')];
|
|
222
|
-
var _renderComponent15 = renderComponent({
|
|
223
|
-
labelNode: labelNode,
|
|
224
|
-
points: emptyLabels
|
|
225
|
-
}),
|
|
226
|
-
container = _renderComponent15.container;
|
|
227
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
228
|
-
});
|
|
229
|
-
it('renders without labelNode', function () {
|
|
230
|
-
var _renderComponent16 = renderComponent({
|
|
231
|
-
points: [xyLabel(0, 0, 0, 'A'), xyLabel(2, 2, 1, 'B')]
|
|
232
|
-
}),
|
|
233
|
-
container = _renderComponent16.container;
|
|
234
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
235
|
-
});
|
|
236
|
-
it('renders with labelModeEnabled', function () {
|
|
237
|
-
var _renderWithLabels3 = renderWithLabels({
|
|
238
|
-
labelModeEnabled: true
|
|
239
|
-
}),
|
|
240
|
-
container = _renderWithLabels3.container;
|
|
241
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
242
|
-
});
|
|
243
|
-
it('renders with labelModeEnabled disabled', function () {
|
|
244
|
-
var _renderWithLabels4 = renderWithLabels({
|
|
245
|
-
labelModeEnabled: false
|
|
246
|
-
}),
|
|
247
|
-
container = _renderWithLabels4.container;
|
|
248
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
249
|
-
});
|
|
250
|
-
it('renders with long labels', function () {
|
|
251
|
-
var longLabels = [xyLabel(0, 0, 0, 'Very Long Label Text'), xyLabel(2, 2, 1, 'Another Long Label'), xyLabel(0, 2, 2, 'Yet Another Long Label')];
|
|
252
|
-
var _renderComponent17 = renderComponent({
|
|
253
|
-
labelNode: labelNode,
|
|
254
|
-
points: longLabels
|
|
255
|
-
}),
|
|
256
|
-
container = _renderComponent17.container;
|
|
257
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
258
|
-
});
|
|
259
|
-
});
|
|
260
|
-
describe('polygon shapes', function () {
|
|
261
|
-
it('renders triangle', function () {
|
|
262
|
-
var _renderComponent18 = renderComponent({
|
|
263
|
-
points: [(0, _utils.xy)(0, 0, 0), (0, _utils.xy)(2, 0, 1), (0, _utils.xy)(1, 2, 2)],
|
|
264
|
-
closed: true
|
|
265
|
-
}),
|
|
266
|
-
container = _renderComponent18.container;
|
|
267
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
268
|
-
});
|
|
269
|
-
it('renders square', function () {
|
|
270
|
-
var _renderComponent19 = renderComponent({
|
|
271
|
-
points: [(0, _utils.xy)(0, 0, 0), (0, _utils.xy)(2, 0, 1), (0, _utils.xy)(2, 2, 2), (0, _utils.xy)(0, 2, 3)],
|
|
272
|
-
closed: true
|
|
273
|
-
}),
|
|
274
|
-
container = _renderComponent19.container;
|
|
275
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
276
|
-
});
|
|
277
|
-
it('renders pentagon', function () {
|
|
278
|
-
var _renderComponent20 = renderComponent({
|
|
279
|
-
points: [(0, _utils.xy)(1, 0, 0), (0, _utils.xy)(2, 1, 1), (0, _utils.xy)(1.5, 2.5, 2), (0, _utils.xy)(0.5, 2.5, 3), (0, _utils.xy)(0, 1, 4)],
|
|
280
|
-
closed: true
|
|
281
|
-
}),
|
|
282
|
-
container = _renderComponent20.container;
|
|
283
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
284
|
-
});
|
|
285
|
-
it('renders irregular polygon', function () {
|
|
286
|
-
var _renderComponent21 = renderComponent({
|
|
287
|
-
points: [(0, _utils.xy)(0, 0, 0), (0, _utils.xy)(3, 1, 1), (0, _utils.xy)(2, 4, 2), (0, _utils.xy)(-1, 3, 3)],
|
|
288
|
-
closed: true
|
|
289
|
-
}),
|
|
290
|
-
container = _renderComponent21.container;
|
|
291
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
292
|
-
});
|
|
293
|
-
});
|
|
294
|
-
describe('props', function () {
|
|
295
|
-
it('passes onChange callback', function () {
|
|
296
|
-
var customOnChange = jest.fn();
|
|
297
|
-
var _renderComponent22 = renderComponent({
|
|
298
|
-
onChange: customOnChange,
|
|
299
|
-
points: [(0, _utils.xy)(0, 0, 0), (0, _utils.xy)(1, 1, 1)]
|
|
300
|
-
}),
|
|
301
|
-
container = _renderComponent22.container;
|
|
302
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
303
|
-
});
|
|
304
|
-
it('passes onChangeProps callback', function () {
|
|
305
|
-
var customOnChangeProps = jest.fn();
|
|
306
|
-
var _renderComponent23 = renderComponent({
|
|
307
|
-
onChangeProps: customOnChangeProps,
|
|
308
|
-
points: [(0, _utils.xy)(0, 0, 0), (0, _utils.xy)(1, 1, 1)]
|
|
309
|
-
}),
|
|
310
|
-
container = _renderComponent23.container;
|
|
311
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
312
|
-
});
|
|
313
|
-
it('passes onClick callback', function () {
|
|
314
|
-
var onClick = jest.fn();
|
|
315
|
-
var _renderComponent24 = renderComponent({
|
|
316
|
-
onClick: onClick,
|
|
317
|
-
points: [(0, _utils.xy)(0, 0, 0), (0, _utils.xy)(1, 1, 1)]
|
|
318
|
-
}),
|
|
319
|
-
container = _renderComponent24.container;
|
|
320
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
321
|
-
});
|
|
322
|
-
it('passes onClosePolygon callback', function () {
|
|
323
|
-
var customOnClosePolygon = jest.fn();
|
|
324
|
-
var _renderComponent25 = renderComponent({
|
|
325
|
-
onClosePolygon: customOnClosePolygon,
|
|
326
|
-
points: [(0, _utils.xy)(0, 0, 0), (0, _utils.xy)(1, 1, 1), (0, _utils.xy)(2, 0, 2)]
|
|
327
|
-
}),
|
|
328
|
-
container = _renderComponent25.container;
|
|
329
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
330
|
-
});
|
|
331
|
-
it('passes onDragStart callback', function () {
|
|
332
|
-
var onDragStart = jest.fn();
|
|
333
|
-
var _renderComponent26 = renderComponent({
|
|
334
|
-
onDragStart: onDragStart,
|
|
335
|
-
points: [(0, _utils.xy)(0, 0, 0), (0, _utils.xy)(1, 1, 1)]
|
|
336
|
-
}),
|
|
337
|
-
container = _renderComponent26.container;
|
|
338
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
339
|
-
});
|
|
340
|
-
it('passes onDragStop callback', function () {
|
|
341
|
-
var onDragStop = jest.fn();
|
|
342
|
-
var _renderComponent27 = renderComponent({
|
|
343
|
-
onDragStop: onDragStop,
|
|
344
|
-
points: [(0, _utils.xy)(0, 0, 0), (0, _utils.xy)(1, 1, 1)]
|
|
345
|
-
}),
|
|
346
|
-
container = _renderComponent27.container;
|
|
347
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
348
|
-
});
|
|
349
|
-
it('passes coordinatesOnHover', function () {
|
|
350
|
-
var _renderComponent28 = renderComponent({
|
|
351
|
-
coordinatesOnHover: true,
|
|
352
|
-
points: [(0, _utils.xy)(0, 0, 0), (0, _utils.xy)(1, 1, 1)]
|
|
353
|
-
}),
|
|
354
|
-
container = _renderComponent28.container;
|
|
355
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
356
|
-
});
|
|
357
|
-
it('passes graphProps', function () {
|
|
358
|
-
var customGraphProps = (0, _utils.graphProps)(0, 10, 0, 10);
|
|
359
|
-
var _renderComponent29 = renderComponent({
|
|
360
|
-
graphProps: customGraphProps,
|
|
361
|
-
points: [(0, _utils.xy)(5, 5, 0), (0, _utils.xy)(7, 7, 1)]
|
|
362
|
-
}),
|
|
363
|
-
container = _renderComponent29.container;
|
|
364
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
365
|
-
});
|
|
366
|
-
it('passes gssLineData', function () {
|
|
367
|
-
var gssLineData = {
|
|
368
|
-
selectedTool: 'solutionSet'
|
|
369
|
-
};
|
|
370
|
-
var _renderComponent30 = renderComponent({
|
|
371
|
-
gssLineData: gssLineData,
|
|
372
|
-
points: [(0, _utils.xy)(0, 0, 0), (0, _utils.xy)(1, 1, 1), (0, _utils.xy)(2, 0, 2)]
|
|
373
|
-
}),
|
|
374
|
-
container = _renderComponent30.container;
|
|
375
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
376
|
-
});
|
|
377
|
-
});
|
|
378
|
-
describe('edge cases', function () {
|
|
379
|
-
it('handles points with same coordinates', function () {
|
|
380
|
-
var _renderComponent31 = renderComponent({
|
|
381
|
-
points: [(0, _utils.xy)(1, 1, 0), (0, _utils.xy)(1, 1, 1), (0, _utils.xy)(1, 1, 2)]
|
|
382
|
-
}),
|
|
383
|
-
container = _renderComponent31.container;
|
|
384
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
385
|
-
});
|
|
386
|
-
it('handles collinear points', function () {
|
|
387
|
-
var _renderComponent32 = renderComponent({
|
|
388
|
-
points: [(0, _utils.xy)(0, 0, 0), (0, _utils.xy)(1, 1, 1), (0, _utils.xy)(2, 2, 2)]
|
|
389
|
-
}),
|
|
390
|
-
container = _renderComponent32.container;
|
|
391
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
392
|
-
});
|
|
393
|
-
it('handles very close points', function () {
|
|
394
|
-
var _renderComponent33 = renderComponent({
|
|
395
|
-
points: [(0, _utils.xy)(1, 1, 0), (0, _utils.xy)(1.001, 1.001, 1), (0, _utils.xy)(1.002, 1.002, 2)]
|
|
396
|
-
}),
|
|
397
|
-
container = _renderComponent33.container;
|
|
398
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
399
|
-
});
|
|
400
|
-
it('handles mixed positive and negative coordinates', function () {
|
|
401
|
-
var _renderComponent34 = renderComponent({
|
|
402
|
-
points: [(0, _utils.xy)(-5, 5, 0), (0, _utils.xy)(5, 5, 1), (0, _utils.xy)(5, -5, 2), (0, _utils.xy)(-5, -5, 3)],
|
|
403
|
-
closed: true
|
|
404
|
-
}),
|
|
405
|
-
container = _renderComponent34.container;
|
|
406
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
407
|
-
});
|
|
408
|
-
it('handles points without explicit index', function () {
|
|
409
|
-
var _renderComponent35 = renderComponent({
|
|
410
|
-
points: [{
|
|
411
|
-
x: 0,
|
|
412
|
-
y: 0
|
|
413
|
-
}, {
|
|
414
|
-
x: 1,
|
|
415
|
-
y: 1
|
|
416
|
-
}, {
|
|
417
|
-
x: 2,
|
|
418
|
-
y: 0
|
|
419
|
-
}]
|
|
420
|
-
}),
|
|
421
|
-
container = _renderComponent35.container;
|
|
422
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
423
|
-
});
|
|
424
|
-
it('handles undefined properties', function () {
|
|
425
|
-
var _renderComponent36 = renderComponent({
|
|
426
|
-
points: [(0, _utils.xy)(0, 0, 0), (0, _utils.xy)(1, 1, 1)],
|
|
427
|
-
disabled: undefined,
|
|
428
|
-
correctness: undefined,
|
|
429
|
-
building: undefined,
|
|
430
|
-
fill: undefined
|
|
431
|
-
}),
|
|
432
|
-
container = _renderComponent36.container;
|
|
433
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
434
|
-
});
|
|
435
|
-
});
|
|
436
|
-
describe('integration', function () {
|
|
437
|
-
it('renders complete closed polygon with all features', function () {
|
|
438
|
-
var _renderComponent37 = renderComponent({
|
|
439
|
-
points: points,
|
|
440
|
-
closed: true,
|
|
441
|
-
labelNode: labelNode,
|
|
442
|
-
labelModeEnabled: true,
|
|
443
|
-
coordinatesOnHover: true,
|
|
444
|
-
correctness: 'correct',
|
|
445
|
-
disabled: false,
|
|
446
|
-
fill: '#00ff00',
|
|
447
|
-
gssLineData: {
|
|
448
|
-
selectedTool: 'solutionSet'
|
|
449
|
-
},
|
|
450
|
-
onChange: jest.fn(),
|
|
451
|
-
onChangeProps: jest.fn(),
|
|
452
|
-
onClosePolygon: jest.fn(),
|
|
453
|
-
onClick: jest.fn(),
|
|
454
|
-
onDragStart: jest.fn(),
|
|
455
|
-
onDragStop: jest.fn()
|
|
456
|
-
}),
|
|
457
|
-
container = _renderComponent37.container;
|
|
458
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
459
|
-
});
|
|
460
|
-
it('renders building polygon', function () {
|
|
461
|
-
var _renderComponent38 = renderComponent({
|
|
462
|
-
points: [(0, _utils.xy)(0, 0, 0), (0, _utils.xy)(1, 1, 1)],
|
|
463
|
-
building: true,
|
|
464
|
-
closed: false
|
|
465
|
-
}),
|
|
466
|
-
container = _renderComponent38.container;
|
|
467
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
468
|
-
});
|
|
469
|
-
it('renders disabled polygon with labels', function () {
|
|
470
|
-
var _renderComponent39 = renderComponent({
|
|
471
|
-
points: points,
|
|
472
|
-
labelNode: labelNode,
|
|
473
|
-
disabled: true,
|
|
474
|
-
closed: true
|
|
475
|
-
}),
|
|
476
|
-
container = _renderComponent39.container;
|
|
477
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
478
|
-
});
|
|
479
|
-
it('renders polygon in solution set mode', function () {
|
|
480
|
-
var _renderComponent40 = renderComponent({
|
|
481
|
-
points: points,
|
|
482
|
-
closed: true,
|
|
483
|
-
gssLineData: {
|
|
484
|
-
selectedTool: 'solutionSet'
|
|
485
|
-
}
|
|
486
|
-
}),
|
|
487
|
-
container = _renderComponent40.container;
|
|
488
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
489
|
-
});
|
|
490
|
-
it('renders polygon with incorrect correctness', function () {
|
|
491
|
-
var _renderComponent41 = renderComponent({
|
|
492
|
-
points: points,
|
|
493
|
-
closed: true,
|
|
494
|
-
correctness: 'incorrect'
|
|
495
|
-
}),
|
|
496
|
-
container = _renderComponent41.container;
|
|
497
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
498
|
-
});
|
|
499
|
-
});
|
|
500
|
-
});
|
|
501
|
-
//# sourceMappingURL=component.test.js.map
|