@pie-lib/graphing 4.1.0-beta.7 → 5.0.0-next.36
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 +88 -0
- package/dist/graph-with-controls.js +156 -0
- package/dist/graph.d.ts +126 -0
- package/dist/graph.js +209 -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 +15 -0
- package/dist/index.js +7 -0
- package/dist/key-legend.d.ts +21 -0
- package/dist/key-legend.js +231 -0
- package/dist/label-svg-icon.d.ts +18 -0
- package/dist/label-svg-icon.js +42 -0
- package/dist/labels.d.ts +37 -0
- package/dist/labels.js +152 -0
- package/dist/mark-label.d.ts +60 -0
- package/dist/mark-label.js +222 -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_shape@4.0.0_d84c32d47042070f/node_modules/@visx/shape/esm/shapes/LinePath.js +24 -0
- package/dist/node_modules/.bun/@visx_shape@4.0.0_d84c32d47042070f/node_modules/@visx/shape/esm/util/D3ShapeFactories.js +9 -0
- package/dist/node_modules/.bun/@visx_shape@4.0.0_d84c32d47042070f/node_modules/@visx/shape/esm/util/setNumberOrNumberAccessor.js +6 -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/@visx_vendor@4.0.0/node_modules/@visx/vendor/esm/d3-shape.js +8 -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/toggle-bar.js +155 -0
- package/dist/tool-menu.d.ts +29 -0
- package/dist/tool-menu.js +41 -0
- package/dist/tools/absolute/component.d.ts +16 -0
- package/dist/tools/absolute/component.js +15 -0
- package/dist/tools/absolute/index.d.ts +20 -0
- package/dist/tools/absolute/index.js +32 -0
- package/dist/tools/circle/bg-circle.d.ts +116 -0
- package/dist/tools/circle/bg-circle.js +72 -0
- package/dist/tools/circle/component.d.ts +88 -0
- package/dist/tools/circle/component.js +208 -0
- package/dist/tools/circle/index.d.ts +20 -0
- package/dist/tools/circle/index.js +22 -0
- package/dist/tools/exponential/component.d.ts +16 -0
- package/dist/tools/exponential/component.js +14 -0
- package/dist/tools/exponential/index.d.ts +20 -0
- package/dist/tools/exponential/index.js +32 -0
- package/dist/tools/index.d.ts +27 -0
- package/dist/tools/index.js +55 -0
- package/dist/tools/line/component.d.ts +124 -0
- package/dist/tools/line/component.js +72 -0
- package/dist/tools/line/index.d.ts +13 -0
- package/dist/tools/line/index.js +6 -0
- package/dist/tools/parabola/component.d.ts +16 -0
- package/dist/tools/parabola/component.js +14 -0
- package/dist/tools/parabola/index.d.ts +20 -0
- package/dist/tools/parabola/index.js +32 -0
- package/dist/tools/point/component.d.ts +52 -0
- package/dist/tools/point/component.js +91 -0
- package/dist/tools/point/index.d.ts +15 -0
- package/dist/tools/point/index.js +13 -0
- package/dist/tools/polygon/component.d.ts +125 -0
- package/dist/tools/polygon/component.js +271 -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/line.js +63 -0
- package/dist/tools/polygon/polygon.d.ts +122 -0
- package/dist/tools/polygon/polygon.js +74 -0
- package/dist/tools/ray/component.d.ts +101 -0
- package/dist/tools/ray/component.js +71 -0
- package/dist/tools/ray/index.d.ts +13 -0
- package/dist/tools/ray/index.js +6 -0
- package/dist/tools/segment/component.d.ts +100 -0
- package/dist/tools/segment/component.js +52 -0
- package/dist/tools/segment/index.d.ts +13 -0
- package/dist/tools/segment/index.js +6 -0
- package/dist/tools/shared/arrow-head.d.ts +51 -0
- package/dist/tools/shared/arrow-head.js +63 -0
- package/dist/tools/shared/icons/CorrectSVG.d.ts +26 -0
- package/dist/tools/shared/icons/CorrectSVG.js +29 -0
- package/dist/tools/shared/icons/IncorrectSVG.d.ts +26 -0
- package/dist/tools/shared/icons/IncorrectSVG.js +27 -0
- package/dist/tools/shared/icons/MissingSVG.d.ts +26 -0
- package/dist/tools/shared/icons/MissingSVG.js +28 -0
- package/dist/tools/shared/line/index.d.ts +251 -0
- package/dist/tools/shared/line/index.js +332 -0
- package/dist/tools/shared/line/line-path.d.ts +57 -0
- package/dist/tools/shared/line/line-path.js +71 -0
- package/dist/tools/shared/line/with-root-edge.d.ts +148 -0
- package/dist/tools/shared/line/with-root-edge.js +73 -0
- package/dist/tools/shared/point/arrow-point.d.ts +56 -0
- package/dist/tools/shared/point/arrow-point.js +41 -0
- package/dist/tools/shared/point/arrow.d.ts +45 -0
- package/dist/tools/shared/point/arrow.js +35 -0
- package/dist/tools/shared/point/base-point.d.ts +52 -0
- package/dist/tools/shared/point/base-point.js +103 -0
- package/dist/tools/shared/point/index.d.ts +216 -0
- package/dist/tools/shared/point/index.js +45 -0
- package/dist/tools/shared/styles.d.ts +29 -0
- package/dist/tools/shared/styles.js +20 -0
- package/dist/tools/shared/types.d.ts +21 -0
- package/dist/tools/shared/types.js +11 -0
- package/dist/tools/sine/component.d.ts +16 -0
- package/dist/tools/sine/component.js +22 -0
- package/dist/tools/sine/index.d.ts +20 -0
- package/dist/tools/sine/index.js +32 -0
- package/dist/tools/vector/component.d.ts +100 -0
- package/dist/tools/vector/component.js +44 -0
- package/dist/tools/vector/index.d.ts +13 -0
- package/dist/tools/vector/index.js +6 -0
- package/dist/undo-redo.d.ts +22 -0
- package/dist/undo-redo.js +47 -0
- package/dist/use-debounce.d.ts +9 -0
- package/dist/use-debounce.js +13 -0
- package/dist/utils.d.ts +61 -0
- package/dist/utils.js +75 -0
- package/package.json +51 -41
- package/CHANGELOG.json +0 -1
- package/CHANGELOG.md +0 -1469
- 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 -275
- package/lib/__tests__/graph-with-controls.test.js.map +0 -1
- package/lib/__tests__/graph.test.js +0 -927
- 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__/key-legend.test.js +0 -321
- package/lib/__tests__/key-legend.test.js.map +0 -1
- package/lib/__tests__/label-svg-icon.test.js +0 -373
- package/lib/__tests__/label-svg-icon.test.js.map +0 -1
- package/lib/__tests__/labels.test.js +0 -61
- 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 -197
- package/lib/__tests__/toggle-bar.test.js.map +0 -1
- package/lib/__tests__/tool-menu.test.js +0 -151
- 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 -195
- 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 -329
- 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 -503
- 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 -127
- 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 -79
- package/lib/coordinates-label.js.map +0 -1
- package/lib/graph-with-controls.js +0 -294
- package/lib/graph-with-controls.js.map +0 -1
- package/lib/graph.js +0 -327
- 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 -47
- package/lib/index.js.map +0 -1
- package/lib/key-legend.js +0 -201
- package/lib/key-legend.js.map +0 -1
- package/lib/label-svg-icon.js +0 -50
- package/lib/label-svg-icon.js.map +0 -1
- package/lib/labels.js +0 -243
- package/lib/labels.js.map +0 -1
- package/lib/mark-label.js +0 -285
- package/lib/mark-label.js.map +0 -1
- package/lib/toggle-bar.js +0 -252
- package/lib/toggle-bar.js.map +0 -1
- package/lib/tool-menu.js +0 -78
- package/lib/tool-menu.js.map +0 -1
- package/lib/tools/absolute/__tests__/component.test.js +0 -65
- package/lib/tools/absolute/__tests__/component.test.js.map +0 -1
- package/lib/tools/absolute/component.js +0 -29
- package/lib/tools/absolute/component.js.map +0 -1
- package/lib/tools/absolute/index.js +0 -50
- package/lib/tools/absolute/index.js.map +0 -1
- package/lib/tools/circle/__tests__/bg-circle.test.js +0 -33
- package/lib/tools/circle/__tests__/bg-circle.test.js.map +0 -1
- package/lib/tools/circle/__tests__/component.test.js +0 -615
- package/lib/tools/circle/__tests__/component.test.js.map +0 -1
- package/lib/tools/circle/__tests__/index.test.js +0 -576
- package/lib/tools/circle/__tests__/index.test.js.map +0 -1
- package/lib/tools/circle/bg-circle.js +0 -123
- package/lib/tools/circle/bg-circle.js.map +0 -1
- package/lib/tools/circle/component.js +0 -321
- package/lib/tools/circle/component.js.map +0 -1
- package/lib/tools/circle/index.js +0 -41
- package/lib/tools/circle/index.js.map +0 -1
- package/lib/tools/exponential/__tests__/component.test.js +0 -64
- package/lib/tools/exponential/__tests__/component.test.js.map +0 -1
- package/lib/tools/exponential/__tests__/index.test.js +0 -828
- package/lib/tools/exponential/__tests__/index.test.js.map +0 -1
- package/lib/tools/exponential/component.js +0 -28
- package/lib/tools/exponential/component.js.map +0 -1
- package/lib/tools/exponential/index.js +0 -56
- package/lib/tools/exponential/index.js.map +0 -1
- package/lib/tools/index.js +0 -86
- 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 -97
- 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/parabola/__tests__/component.test.js +0 -64
- package/lib/tools/parabola/__tests__/component.test.js.map +0 -1
- package/lib/tools/parabola/__tests__/index.test.js +0 -564
- package/lib/tools/parabola/__tests__/index.test.js.map +0 -1
- package/lib/tools/parabola/component.js +0 -28
- package/lib/tools/parabola/component.js.map +0 -1
- package/lib/tools/parabola/index.js +0 -50
- package/lib/tools/parabola/index.js.map +0 -1
- package/lib/tools/point/__tests__/component.test.js +0 -434
- package/lib/tools/point/__tests__/component.test.js.map +0 -1
- package/lib/tools/point/__tests__/index.test.js +0 -262
- package/lib/tools/point/__tests__/index.test.js.map +0 -1
- package/lib/tools/point/component.js +0 -148
- package/lib/tools/point/component.js.map +0 -1
- package/lib/tools/point/index.js +0 -24
- package/lib/tools/point/index.js.map +0 -1
- package/lib/tools/polygon/__tests__/component.test.js +0 -485
- package/lib/tools/polygon/__tests__/component.test.js.map +0 -1
- package/lib/tools/polygon/__tests__/index.test.js +0 -303
- package/lib/tools/polygon/__tests__/index.test.js.map +0 -1
- package/lib/tools/polygon/__tests__/line.test.js +0 -50
- package/lib/tools/polygon/__tests__/line.test.js.map +0 -1
- package/lib/tools/polygon/__tests__/polygon.test.js +0 -85
- package/lib/tools/polygon/__tests__/polygon.test.js.map +0 -1
- package/lib/tools/polygon/component.js +0 -437
- 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 -112
- package/lib/tools/polygon/line.js.map +0 -1
- package/lib/tools/polygon/polygon.js +0 -130
- package/lib/tools/polygon/polygon.js.map +0 -1
- package/lib/tools/ray/__tests__/component.test.js +0 -35
- package/lib/tools/ray/__tests__/component.test.js.map +0 -1
- package/lib/tools/ray/component.js +0 -95
- package/lib/tools/ray/component.js.map +0 -1
- package/lib/tools/ray/index.js +0 -11
- package/lib/tools/ray/index.js.map +0 -1
- package/lib/tools/segment/__tests__/component.test.js +0 -35
- package/lib/tools/segment/__tests__/component.test.js.map +0 -1
- package/lib/tools/segment/component.js +0 -71
- package/lib/tools/segment/component.js.map +0 -1
- package/lib/tools/segment/index.js +0 -11
- package/lib/tools/segment/index.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 -111
- package/lib/tools/shared/arrow-head.js.map +0 -1
- package/lib/tools/shared/icons/CorrectSVG.js +0 -40
- package/lib/tools/shared/icons/CorrectSVG.js.map +0 -1
- package/lib/tools/shared/icons/IncorrectSVG.js +0 -40
- package/lib/tools/shared/icons/IncorrectSVG.js.map +0 -1
- package/lib/tools/shared/icons/MissingSVG.js +0 -39
- package/lib/tools/shared/icons/MissingSVG.js.map +0 -1
- package/lib/tools/shared/line/__tests__/index.test.js +0 -124
- package/lib/tools/shared/line/__tests__/index.test.js.map +0 -1
- package/lib/tools/shared/line/__tests__/line-path.test.js +0 -62
- 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 -90
- package/lib/tools/shared/line/__tests__/with-root-edge.test.js.map +0 -1
- package/lib/tools/shared/line/index.js +0 -550
- package/lib/tools/shared/line/index.js.map +0 -1
- package/lib/tools/shared/line/line-path.js +0 -118
- 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__/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 -72
- package/lib/tools/shared/point/arrow-point.js.map +0 -1
- package/lib/tools/shared/point/arrow.js +0 -67
- package/lib/tools/shared/point/arrow.js.map +0 -1
- package/lib/tools/shared/point/base-point.js +0 -157
- package/lib/tools/shared/point/base-point.js.map +0 -1
- package/lib/tools/shared/point/index.js +0 -68
- package/lib/tools/shared/point/index.js.map +0 -1
- package/lib/tools/shared/styles.js +0 -33
- package/lib/tools/shared/styles.js.map +0 -1
- package/lib/tools/shared/types.js +0 -16
- package/lib/tools/shared/types.js.map +0 -1
- package/lib/tools/sine/__tests__/component.test.js +0 -72
- package/lib/tools/sine/__tests__/component.test.js.map +0 -1
- package/lib/tools/sine/component.js +0 -40
- package/lib/tools/sine/component.js.map +0 -1
- package/lib/tools/sine/index.js +0 -50
- package/lib/tools/sine/index.js.map +0 -1
- package/lib/tools/vector/__tests__/component.test.js +0 -32
- package/lib/tools/vector/__tests__/component.test.js.map +0 -1
- package/lib/tools/vector/component.js +0 -68
- package/lib/tools/vector/component.js.map +0 -1
- package/lib/tools/vector/index.js +0 -11
- package/lib/tools/vector/index.js.map +0 -1
- package/lib/undo-redo.js +0 -86
- 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 -229
- 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 -198
- package/src/__tests__/graph.test.jsx +0 -721
- package/src/__tests__/grid-setup.test.jsx +0 -645
- package/src/__tests__/grid.test.jsx +0 -22
- package/src/__tests__/key-legend.test.jsx +0 -260
- package/src/__tests__/label-svg-icon.test.jsx +0 -278
- package/src/__tests__/labels.test.jsx +0 -55
- package/src/__tests__/mark-label.test.jsx +0 -63
- package/src/__tests__/toggle-bar.test.jsx +0 -146
- package/src/__tests__/tool-menu.test.jsx +0 -115
- package/src/__tests__/undo-redo.test.jsx +0 -24
- 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 -38
- package/src/axis/__tests__/axes.test.jsx +0 -216
- package/src/axis/arrow.jsx +0 -57
- package/src/axis/axes.jsx +0 -285
- 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 -319
- 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 -91
- 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 -63
- package/src/graph-with-controls.jsx +0 -239
- package/src/graph.jsx +0 -303
- package/src/grid-setup.jsx +0 -432
- package/src/grid.jsx +0 -133
- package/src/index.js +0 -7
- package/src/key-legend.jsx +0 -142
- package/src/label-svg-icon.jsx +0 -39
- package/src/labels.jsx +0 -207
- package/src/mark-label.jsx +0 -244
- package/src/toggle-bar.jsx +0 -224
- package/src/tool-menu.jsx +0 -49
- package/src/tools/absolute/__tests__/component.test.jsx +0 -53
- package/src/tools/absolute/component.jsx +0 -23
- package/src/tools/absolute/index.js +0 -31
- package/src/tools/circle/__tests__/bg-circle.test.jsx +0 -26
- package/src/tools/circle/__tests__/component.test.jsx +0 -494
- package/src/tools/circle/__tests__/index.test.js +0 -480
- package/src/tools/circle/bg-circle.jsx +0 -81
- package/src/tools/circle/component.jsx +0 -264
- package/src/tools/circle/index.js +0 -25
- package/src/tools/exponential/__tests__/component.test.jsx +0 -53
- package/src/tools/exponential/__tests__/index.test.js +0 -729
- package/src/tools/exponential/component.jsx +0 -23
- package/src/tools/exponential/index.js +0 -39
- package/src/tools/index.js +0 -48
- package/src/tools/line/__tests__/component.test.jsx +0 -37
- package/src/tools/line/component.jsx +0 -93
- package/src/tools/line/index.js +0 -4
- package/src/tools/parabola/__tests__/component.test.jsx +0 -48
- package/src/tools/parabola/__tests__/index.test.js +0 -470
- package/src/tools/parabola/component.jsx +0 -23
- package/src/tools/parabola/index.js +0 -31
- package/src/tools/point/__tests__/component.test.jsx +0 -349
- package/src/tools/point/__tests__/index.test.js +0 -241
- package/src/tools/point/component.jsx +0 -126
- package/src/tools/point/index.js +0 -11
- package/src/tools/polygon/__tests__/component.test.jsx +0 -471
- package/src/tools/polygon/__tests__/index.test.js +0 -294
- package/src/tools/polygon/__tests__/line.test.jsx +0 -35
- package/src/tools/polygon/__tests__/polygon.test.jsx +0 -61
- package/src/tools/polygon/component.jsx +0 -409
- package/src/tools/polygon/index.js +0 -52
- package/src/tools/polygon/line.jsx +0 -74
- package/src/tools/polygon/polygon.jsx +0 -110
- package/src/tools/ray/__tests__/component.test.jsx +0 -29
- package/src/tools/ray/component.jsx +0 -92
- package/src/tools/ray/index.js +0 -4
- package/src/tools/segment/__tests__/component.test.jsx +0 -28
- package/src/tools/segment/component.jsx +0 -65
- package/src/tools/segment/index.js +0 -4
- package/src/tools/shared/__tests__/arrow-head.test.jsx +0 -31
- package/src/tools/shared/arrow-head.jsx +0 -102
- package/src/tools/shared/icons/CorrectSVG.jsx +0 -32
- package/src/tools/shared/icons/IncorrectSVG.jsx +0 -30
- package/src/tools/shared/icons/MissingSVG.jsx +0 -31
- package/src/tools/shared/line/__tests__/index.test.jsx +0 -109
- package/src/tools/shared/line/__tests__/line-path.test.jsx +0 -53
- package/src/tools/shared/line/__tests__/with-root-edge.test.jsx +0 -73
- package/src/tools/shared/line/index.jsx +0 -487
- package/src/tools/shared/line/line-path.jsx +0 -80
- 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__/base-point.test.jsx +0 -87
- package/src/tools/shared/point/arrow-point.jsx +0 -46
- package/src/tools/shared/point/arrow.jsx +0 -37
- package/src/tools/shared/point/base-point.jsx +0 -121
- package/src/tools/shared/point/index.jsx +0 -54
- package/src/tools/shared/styles.js +0 -27
- package/src/tools/shared/types.js +0 -10
- package/src/tools/sine/__tests__/component.test.jsx +0 -51
- package/src/tools/sine/component.jsx +0 -32
- package/src/tools/sine/index.js +0 -33
- package/src/tools/vector/__tests__/component.test.jsx +0 -25
- package/src/tools/vector/component.jsx +0 -56
- package/src/tools/vector/index.js +0 -4
- package/src/undo-redo.jsx +0 -45
- package/src/use-debounce.js +0 -13
- package/src/utils.js +0 -224
|
@@ -1,40 +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"] = void 0;
|
|
8
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
-
var _debug = _interopRequireDefault(require("debug"));
|
|
10
|
-
var _graphingUtils = require("@pie-lib/graphing-utils");
|
|
11
|
-
var _withRootEdge = require("../shared/line/with-root-edge");
|
|
12
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
14
|
-
var log = (0, _debug["default"])('pie-lib:graphing:sine');
|
|
15
|
-
var Sine = (0, _withRootEdge.withRootEdge)(function (props) {
|
|
16
|
-
var root = props.root,
|
|
17
|
-
edge = props.edge,
|
|
18
|
-
graphProps = props.graphProps;
|
|
19
|
-
var domain = graphProps.domain,
|
|
20
|
-
range = graphProps.range;
|
|
21
|
-
var _getAmplitudeAndFreq = (0, _graphingUtils.getAmplitudeAndFreq)(root, edge),
|
|
22
|
-
amplitude = _getAmplitudeAndFreq.amplitude,
|
|
23
|
-
freq = _getAmplitudeAndFreq.freq;
|
|
24
|
-
var interval = freq / _graphingUtils.FREQ_DIVIDER;
|
|
25
|
-
log('[getPoints] amplitude:', amplitude, 'freq:', freq);
|
|
26
|
-
var dataPoints = edge && edge.x === root.x ? [] : (0, _graphingUtils.buildDataPoints)(_objectSpread(_objectSpread({}, domain), {}, {
|
|
27
|
-
step: interval
|
|
28
|
-
}), range, root, edge, (0, _graphingUtils.sinY)(amplitude, freq, {
|
|
29
|
-
phase: root.x,
|
|
30
|
-
vertical: root.y
|
|
31
|
-
}));
|
|
32
|
-
return {
|
|
33
|
-
root: props.root,
|
|
34
|
-
edge: props.edge,
|
|
35
|
-
dataPoints: dataPoints
|
|
36
|
-
};
|
|
37
|
-
});
|
|
38
|
-
var Component = (0, _withRootEdge.rootEdgeComponent)(Sine);
|
|
39
|
-
var _default = exports["default"] = Component;
|
|
40
|
-
//# sourceMappingURL=component.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","names":["_debug","_interopRequireDefault","require","_graphingUtils","_withRootEdge","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","log","debug","Sine","withRootEdge","props","root","edge","graphProps","domain","range","_getAmplitudeAndFreq","getAmplitudeAndFreq","amplitude","freq","interval","FREQ_DIVIDER","dataPoints","x","buildDataPoints","step","sinY","phase","vertical","y","Component","rootEdgeComponent","_default","exports"],"sources":["../../../src/tools/sine/component.jsx"],"sourcesContent":["import debug from 'debug';\nimport { buildDataPoints, FREQ_DIVIDER, getAmplitudeAndFreq, sinY } from '@pie-lib/graphing-utils';\nimport { rootEdgeComponent, withRootEdge } from '../shared/line/with-root-edge';\n\nconst log = debug('pie-lib:graphing:sine');\n\nconst Sine = withRootEdge((props) => {\n const { root, edge, graphProps } = props;\n const { domain, range } = graphProps;\n\n const { amplitude, freq } = getAmplitudeAndFreq(root, edge);\n const interval = freq / FREQ_DIVIDER;\n\n log('[getPoints] amplitude:', amplitude, 'freq:', freq);\n\n const dataPoints =\n edge && edge.x === root.x\n ? []\n : buildDataPoints(\n { ...domain, step: interval },\n range,\n root,\n edge,\n sinY(amplitude, freq, { phase: root.x, vertical: root.y }),\n );\n\n return { root: props.root, edge: props.edge, dataPoints };\n});\n\nconst Component = rootEdgeComponent(Sine);\n\nexport default Component;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;AAAgF,SAAAG,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,GAAAC,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAN,CAAA,WAAAE,MAAA,CAAAK,wBAAA,CAAAR,CAAA,EAAAC,CAAA,EAAAQ,UAAA,OAAAP,CAAA,CAAAQ,I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G,CAAC,wBAAwB,EAAEY,SAAS,EAAE,OAAO,EAAEC,IAAI,CAAC;EAEvD,IAAMG,UAAU,GACdV,IAAI,IAAIA,IAAI,CAACW,CAAC,KAAKZ,IAAI,CAACY,CAAC,GACrB,EAAE,GACF,IAAAC,8BAAe,EAAA1B,aAAA,CAAAA,aAAA,KACRgB,MAAM;IAAEW,IAAI,EAAEL;EAAQ,IAC3BL,KAAK,EACLJ,IAAI,EACJC,IAAI,EACJ,IAAAc,mBAAI,EAACR,SAAS,EAAEC,IAAI,EAAE;IAAEQ,KAAK,EAAEhB,IAAI,CAACY,CAAC;IAAEK,QAAQ,EAAEjB,IAAI,CAACkB;EAAE,CAAC,CAC3D,CAAC;EAEP,OAAO;IAAElB,IAAI,EAAED,KAAK,CAACC,IAAI;IAAEC,IAAI,EAAEF,KAAK,CAACE,IAAI;IAAEU,UAAU,EAAVA;EAAW,CAAC;AAC3D,CAAC,CAAC;AAEF,IAAMQ,SAAS,GAAG,IAAAC,+BAAiB,EAACvB,IAAI,CAAC;AAAC,IAAAwB,QAAA,GAAAC,OAAA,cAE3BH,SAAS","ignoreList":[]}
|
package/lib/tools/sine/index.js
DELETED
|
@@ -1,50 +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 _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
-
var _component = _interopRequireDefault(require("./component"));
|
|
10
|
-
var _debug = _interopRequireDefault(require("debug"));
|
|
11
|
-
var _utils = require("../../utils");
|
|
12
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
14
|
-
var log = (0, _debug["default"])('pie-lib:graphing:sine');
|
|
15
|
-
var tool = exports.tool = function tool() {
|
|
16
|
-
return {
|
|
17
|
-
type: 'sine',
|
|
18
|
-
Component: _component["default"],
|
|
19
|
-
complete: function complete(data, mark) {
|
|
20
|
-
return _objectSpread(_objectSpread({}, mark), {}, {
|
|
21
|
-
building: false,
|
|
22
|
-
closed: true
|
|
23
|
-
});
|
|
24
|
-
},
|
|
25
|
-
addPoint: function addPoint(point, mark) {
|
|
26
|
-
log('add point to sine model: ', point, 'mark: ', mark);
|
|
27
|
-
if (mark && ((0, _utils.equalPoints)(mark.root, point) || (0, _utils.sameAxes)(mark.root, point))) {
|
|
28
|
-
return mark;
|
|
29
|
-
}
|
|
30
|
-
if (!mark) {
|
|
31
|
-
return {
|
|
32
|
-
type: 'sine',
|
|
33
|
-
root: point,
|
|
34
|
-
edge: undefined,
|
|
35
|
-
closed: false,
|
|
36
|
-
building: true
|
|
37
|
-
};
|
|
38
|
-
} else if (mark && !mark.root) {
|
|
39
|
-
throw new Error('no root - should never happen');
|
|
40
|
-
} else {
|
|
41
|
-
return _objectSpread(_objectSpread({}, mark), {}, {
|
|
42
|
-
edge: point,
|
|
43
|
-
closed: true,
|
|
44
|
-
building: false
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_component","_interopRequireDefault","require","_debug","_utils","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","log","debug","tool","exports","type","Component","Sine","complete","data","mark","building","closed","addPoint","point","equalPoints","root","sameAxes","edge","undefined","Error"],"sources":["../../../src/tools/sine/index.js"],"sourcesContent":["import Sine from './component';\nimport debug from 'debug';\nimport { equalPoints, sameAxes } from '../../utils';\n\nconst log = debug('pie-lib:graphing:sine');\n\nexport const tool = () => ({\n type: 'sine',\n Component: Sine,\n complete: (data, mark) => {\n return { ...mark, building: false, closed: true };\n },\n addPoint: (point, mark) => {\n log('add point to sine 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: 'sine',\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"],"mappings":";;;;;;;;AAAA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAAoD,SAAAG,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,GAAAC,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAN,CAAA,WAAAE,MAAA,CAAAK,wBAAA,CAAAR,CAAA,EAAAC,CAAA,EAAAQ,UAAA,OAAAP,CAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,CAAA,EAAAI,CAAA,YAAAJ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G,eAAQ,EAACP,IAAI,CAACM,IAAI,EAAEF,KAAK,CAAC,CAAC,EAAE;QACzE,OAAOJ,IAAI;MACb;MAEA,IAAI,CAACA,IAAI,EAAE;QACT,OAAO;UACLL,IAAI,EAAE,MAAM;UACZW,IAAI,EAAEF,KAAK;UACXI,IAAI,EAAEC,SAAS;UACfP,MAAM,EAAE,KAAK;UACbD,QAAQ,EAAE;QACZ,CAAC;MACH,CAAC,MAAM,IAAID,IAAI,IAAI,CAACA,IAAI,CAACM,IAAI,EAAE;QAC7B,MAAM,IAAII,KAAK,CAAC,+BAA+B,CAAC;MAClD,CAAC,MAAM;QACL,OAAA3B,aAAA,CAAAA,aAAA,KAAYiB,IAAI;UAAEQ,IAAI,EAAEJ,KAAK;UAAEF,MAAM,EAAE,IAAI;UAAED,QAAQ,EAAE;QAAK;MAC9D;IACF;EACF,CAAC;AAAA,CAAC","ignoreList":[]}
|
|
@@ -1,32 +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 _component = require("../component");
|
|
8
|
-
var _utils = require("../../../__tests__/utils");
|
|
9
|
-
var _plot = require("@pie-lib/plot");
|
|
10
|
-
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; }
|
|
11
|
-
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; }
|
|
12
|
-
describe('Line', function () {
|
|
13
|
-
var renderComponent = function renderComponent(extras) {
|
|
14
|
-
var defaults = {
|
|
15
|
-
classes: {},
|
|
16
|
-
className: 'className',
|
|
17
|
-
graphProps: (0, _utils.graphProps)(),
|
|
18
|
-
from: _plot.utils.xy(0, 0),
|
|
19
|
-
to: _plot.utils.xy(1, 1)
|
|
20
|
-
};
|
|
21
|
-
var props = _objectSpread(_objectSpread({}, defaults), extras);
|
|
22
|
-
return (0, _testUtils.render)(/*#__PURE__*/_react["default"].createElement(_component.Line, props));
|
|
23
|
-
};
|
|
24
|
-
describe('rendering', function () {
|
|
25
|
-
it('renders without crashing', function () {
|
|
26
|
-
var _renderComponent = renderComponent(),
|
|
27
|
-
container = _renderComponent.container;
|
|
28
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
//# sourceMappingURL=component.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"component.test.js","names":["_testUtils","require","_react","_interopRequireDefault","_component","_utils","_plot","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","describe","renderComponent","extras","defaults","classes","className","graphProps","getGraphProps","from","utils","xy","to","props","render","createElement","Line","it","_renderComponent","container","expect","firstChild","toBeInTheDocument"],"sources":["../../../../src/tools/vector/__tests__/component.test.jsx"],"sourcesContent":["import { render } from '@pie-lib/test-utils';\nimport React from 'react';\nimport { Line } from '../component';\nimport { graphProps as getGraphProps } from '../../../__tests__/utils';\nimport { utils } from '@pie-lib/plot';\n\ndescribe('Line', () => {\n const renderComponent = (extras) => {\n const defaults = {\n classes: {},\n className: 'className',\n graphProps: getGraphProps(),\n from: utils.xy(0, 0),\n to: utils.xy(1, 1),\n };\n const props = { ...defaults, ...extras };\n return render(<Line {...props} />);\n };\n describe('rendering', () => {\n it('renders without crashing', () => {\n const { container } = renderComponent();\n expect(container.firstChild).toBeInTheDocument();\n });\n });\n});\n"],"mappings":";;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AAAsC,SAAAM,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,GAAAC,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAN,CAAA,WAAAE,MAAA,CAAAK,wBAAA,CAAAR,CAAA,EAAAC,CAAA,EAAAQ,UAAA,OAAAP,CAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,CAAA,EAAAI,CAAA,YAAAJ,CAAA;AAAA,SAAAU,cAAAZ,CAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAY,SAAA,CAAAC,MAAA,EAAAb,CAAA,UAAAC,CAAA,WAAAW,SAAA,CAAAZ,CAAA,IAAAY,SAAA,CAAAZ,CAAA,QAAAA,CAAA,OAAAF,OAAA,CAAAI,MAAA,CAAAD,CAAA,OAAAa,OAAA,WAAAd,CAAA,QAAAe,gBAAA,aAAAhB,CAAA,EAAAC,CAAA,EAAAC,CAAA,CAAAD,CAAA,SAAAE,MAAA,CAAAc,yBAAA,GAAAd,MAAA,CAAAe,gBAAA,CAAAlB,CAAA,EAAAG,MAAA,CAAAc,yBAAA,CAAAf,CAAA,KAAAH,OAAA,CAAAI,MAAA,CAAAD,CAAA,GAAAa,OAAA,WAAAd,CAAA,IAAAE,MAAA,CAAAgB,cAAA,CAAAnB,CAAA,EAAAC,CAAA,EAAAE,MAAA,CAAAK,wBAAA,CAAAN,CAAA,EAAAD,CAAA,iBAAAD,CAAA;AAEtCoB,QAAQ,CAAC,MAAM,EAAE,YAAM;EACrB,IAAMC,eAAe,GAAG,SAAlBA,eAAeA,CAAIC,MAAM,EAAK;IAClC,IAAMC,QAAQ,GAAG;MACfC,OAAO,EAAE,CAAC,CAAC;MACXC,SAAS,EAAE,WAAW;MACtBC,UAAU,EAAE,IAAAC,iBAAa,EAAC,CAAC;MAC3BC,IAAI,EAAEC,WAAK,CAACC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;MACpBC,EAAE,EAAEF,WAAK,CAACC,EAAE,CAAC,CAAC,EAAE,CAAC;IACnB,CAAC;IACD,IAAME,KAAK,GAAApB,aAAA,CAAAA,aAAA,KAAQW,QAAQ,GAAKD,MAAM,CAAE;IACxC,OAAO,IAAAW,iBAAM,eAACvC,MAAA,YAAAwC,aAAA,CAACtC,UAAA,CAAAuC,IAAI,EAAKH,KAAQ,CAAC,CAAC;EACpC,CAAC;EACDZ,QAAQ,CAAC,WAAW,EAAE,YAAM;IAC1BgB,EAAE,CAAC,0BAA0B,EAAE,YAAM;MACnC,IAAAC,gBAAA,GAAsBhB,eAAe,CAAC,CAAC;QAA/BiB,SAAS,GAAAD,gBAAA,CAATC,SAAS;MACjBC,MAAM,CAACD,SAAS,CAACE,UAAU,CAAC,CAACC,iBAAiB,CAAC,CAAC;IAClD,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,68 +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.Line = void 0;
|
|
8
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
-
var _line = require("../shared/line");
|
|
12
|
-
var _point = require("../shared/point");
|
|
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 _utils = require("../../utils");
|
|
18
|
-
var _excluded = ["className", "disabled", "correctness", "graphProps", "from", "to"];
|
|
19
|
-
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; }
|
|
20
|
-
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; }
|
|
21
|
-
var StyledLine = (0, _styles.styled)('line')(function (_ref) {
|
|
22
|
-
var theme = _ref.theme,
|
|
23
|
-
disabled = _ref.disabled,
|
|
24
|
-
correctness = _ref.correctness;
|
|
25
|
-
return _objectSpread(_objectSpread(_objectSpread({}, _line.styles.line(theme)), disabled && _line.styles.disabledSecondary(theme)), correctness && _line.styles[correctness] && _line.styles[correctness](theme, 'stroke'));
|
|
26
|
-
});
|
|
27
|
-
var Line = exports.Line = function Line(props) {
|
|
28
|
-
var className = props.className,
|
|
29
|
-
disabled = props.disabled,
|
|
30
|
-
correctness = props.correctness,
|
|
31
|
-
scale = props.graphProps.scale,
|
|
32
|
-
from = props.from,
|
|
33
|
-
to = props.to,
|
|
34
|
-
rest = (0, _objectWithoutProperties2["default"])(props, _excluded);
|
|
35
|
-
var startPoint = {
|
|
36
|
-
x: scale.x(from.x),
|
|
37
|
-
y: scale.y(from.y)
|
|
38
|
-
};
|
|
39
|
-
var endPoint = {
|
|
40
|
-
x: scale.x(to.x),
|
|
41
|
-
y: scale.y(to.y)
|
|
42
|
-
};
|
|
43
|
-
var length = (0, _utils.getDistanceBetweenTwoPoints)(startPoint, endPoint);
|
|
44
|
-
return /*#__PURE__*/_react["default"].createElement(StyledLine, (0, _extends2["default"])({
|
|
45
|
-
className: className,
|
|
46
|
-
disabled: disabled,
|
|
47
|
-
correctness: correctness,
|
|
48
|
-
x1: startPoint.x,
|
|
49
|
-
y1: startPoint.y,
|
|
50
|
-
x2: endPoint.x,
|
|
51
|
-
y2: endPoint.y,
|
|
52
|
-
strokeDasharray: length - 7
|
|
53
|
-
}, rest));
|
|
54
|
-
};
|
|
55
|
-
Line.propTypes = {
|
|
56
|
-
className: _propTypes["default"].string,
|
|
57
|
-
disabled: _propTypes["default"].bool,
|
|
58
|
-
correctness: _propTypes["default"].string,
|
|
59
|
-
graphProps: _propTypes["default"].any,
|
|
60
|
-
from: _plot.types.PointType,
|
|
61
|
-
to: _plot.types.PointType
|
|
62
|
-
};
|
|
63
|
-
var Vector = (0, _line.lineBase)(Line, {
|
|
64
|
-
to: _point.Arrow
|
|
65
|
-
});
|
|
66
|
-
var Component = (0, _line.lineToolComponent)(Vector);
|
|
67
|
-
var _default = exports["default"] = Component;
|
|
68
|
-
//# sourceMappingURL=component.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","names":["_line","require","_point","_react","_interopRequireDefault","_propTypes","_plot","_styles","_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","_ref","theme","disabled","correctness","styles","line","disabledSecondary","Line","exports","props","className","scale","graphProps","from","to","rest","_objectWithoutProperties2","startPoint","x","y","endPoint","getDistanceBetweenTwoPoints","createElement","_extends2","x1","y1","x2","y2","strokeDasharray","propTypes","PropTypes","string","bool","any","types","PointType","Vector","lineBase","Arrow","Component","lineToolComponent","_default"],"sources":["../../../src/tools/vector/component.jsx"],"sourcesContent":["import { lineBase, lineToolComponent, styles } from '../shared/line';\nimport { Arrow } from '../shared/point';\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport { types } from '@pie-lib/plot';\nimport { styled } from '@mui/material/styles';\nimport { getDistanceBetweenTwoPoints } from '../../utils';\n\nconst StyledLine = styled('line')(({ theme, disabled, correctness }) => ({\n ...styles.line(theme),\n ...(disabled && styles.disabledSecondary(theme)),\n ...(correctness && styles[correctness] && styles[correctness](theme, 'stroke')),\n}));\n\nexport const Line = (props) => {\n const {\n className,\n disabled,\n correctness,\n graphProps: { scale },\n from,\n to,\n ...rest\n } = props;\n const startPoint = { x: scale.x(from.x), y: scale.y(from.y) };\n const endPoint = { x: scale.x(to.x), y: scale.y(to.y) };\n const length = getDistanceBetweenTwoPoints(startPoint, endPoint);\n\n return (\n <StyledLine\n className={className}\n disabled={disabled}\n correctness={correctness}\n x1={startPoint.x}\n y1={startPoint.y}\n x2={endPoint.x}\n y2={endPoint.y}\n strokeDasharray={length - 7}\n {...rest}\n />\n );\n};\n\nLine.propTypes = {\n className: PropTypes.string,\n disabled: PropTypes.bool,\n correctness: PropTypes.string,\n graphProps: PropTypes.any,\n from: types.PointType,\n to: types.PointType,\n};\n\nconst Vector = lineBase(Line, { to: Arrow });\nconst Component = lineToolComponent(Vector);\n\nexport default Component;\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,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C;EAAE,CAAC;EACvD,IAAM3B,MAAM,GAAG,IAAA6B,kCAA2B,EAACJ,UAAU,EAAEG,QAAQ,CAAC;EAEhE,oBACElD,MAAA,YAAAoD,aAAA,CAACxB,UAAU,MAAAyB,SAAA;IACTb,SAAS,EAAEA,SAAU;IACrBR,QAAQ,EAAEA,QAAS;IACnBC,WAAW,EAAEA,WAAY;IACzBqB,EAAE,EAAEP,UAAU,CAACC,CAAE;IACjBO,EAAE,EAAER,UAAU,CAACE,CAAE;IACjBO,EAAE,EAAEN,QAAQ,CAACF,CAAE;IACfS,EAAE,EAAEP,QAAQ,CAACD,CAAE;IACfS,eAAe,EAAEpC,MAAM,GAAG;EAAE,GACxBuB,IAAI,CACT,CAAC;AAEN,CAAC;AAEDR,IAAI,CAACsB,SAAS,GAAG;EACfnB,SAAS,EAAEoB,qBAAS,CAACC,MAAM;EAC3B7B,QAAQ,EAAE4B,qBAAS,CAACE,IAAI;EACxB7B,WAAW,EAAE2B,qBAAS,CAACC,MAAM;EAC7BnB,UAAU,EAAEkB,qBAAS,CAACG,GAAG;EACzBpB,IAAI,EAAEqB,WAAK,CAACC,SAAS;EACrBrB,EAAE,EAAEoB,WAAK,CAACC;AACZ,CAAC;AAED,IAAMC,MAAM,GAAG,IAAAC,cAAQ,EAAC9B,IAAI,EAAE;EAAEO,EAAE,EAAEwB;AAAM,CAAC,CAAC;AAC5C,IAAMC,SAAS,GAAG,IAAAC,uBAAiB,EAACJ,MAAM,CAAC;AAAC,IAAAK,QAAA,GAAAjC,OAAA,cAE7B+B,SAAS","ignoreList":[]}
|
|
@@ -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)('vector', _component["default"]);
|
|
11
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_component","_interopRequireDefault","require","_line","tool","exports","lineTool","Vector"],"sources":["../../../src/tools/vector/index.js"],"sourcesContent":["import Vector from './component';\nimport { lineTool } from '../shared/line';\n\nexport const tool = lineTool('vector', Vector);\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,QAAQ,EAAEC,qBAAM,CAAC","ignoreList":[]}
|
package/lib/undo-redo.js
DELETED
|
@@ -1,86 +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.UndoRedo = void 0;
|
|
8
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
11
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
12
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
13
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
14
|
-
var _react = _interopRequireDefault(require("react"));
|
|
15
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
16
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
17
|
-
var _Button = _interopRequireDefault(require("@mui/material/Button"));
|
|
18
|
-
var _styles = require("@mui/material/styles");
|
|
19
|
-
var _renderUi = require("@pie-lib/render-ui");
|
|
20
|
-
var _translator = _interopRequireDefault(require("@pie-lib/translator"));
|
|
21
|
-
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
|
|
22
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
23
|
-
var translator = _translator["default"].translator;
|
|
24
|
-
var StyledButton = (0, _styles.styled)(_Button["default"])(function (_ref) {
|
|
25
|
-
var theme = _ref.theme;
|
|
26
|
-
return {
|
|
27
|
-
color: _renderUi.color.text(),
|
|
28
|
-
fontWeight: 'bold',
|
|
29
|
-
marginBottom: theme.spacing(0.5),
|
|
30
|
-
'&:not(:last-of-type)': {
|
|
31
|
-
marginRight: theme.spacing(0.5)
|
|
32
|
-
},
|
|
33
|
-
'&:hover': {
|
|
34
|
-
backgroundColor: _renderUi.color.buttonHoverBg()
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
});
|
|
38
|
-
var UndoRedo = exports.UndoRedo = /*#__PURE__*/function (_React$Component) {
|
|
39
|
-
function UndoRedo() {
|
|
40
|
-
(0, _classCallCheck2["default"])(this, UndoRedo);
|
|
41
|
-
return _callSuper(this, UndoRedo, arguments);
|
|
42
|
-
}
|
|
43
|
-
(0, _inherits2["default"])(UndoRedo, _React$Component);
|
|
44
|
-
return (0, _createClass2["default"])(UndoRedo, [{
|
|
45
|
-
key: "render",
|
|
46
|
-
value: function render() {
|
|
47
|
-
var _this$props = this.props,
|
|
48
|
-
className = _this$props.className,
|
|
49
|
-
onUndo = _this$props.onUndo,
|
|
50
|
-
onRedo = _this$props.onRedo,
|
|
51
|
-
onReset = _this$props.onReset,
|
|
52
|
-
language = _this$props.language;
|
|
53
|
-
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
54
|
-
className: (0, _classnames["default"])(className)
|
|
55
|
-
}, /*#__PURE__*/_react["default"].createElement(StyledButton, {
|
|
56
|
-
onClick: function onClick() {
|
|
57
|
-
return onUndo(true);
|
|
58
|
-
}
|
|
59
|
-
}, translator.t('common:undo', {
|
|
60
|
-
lng: language
|
|
61
|
-
})), /*#__PURE__*/_react["default"].createElement(StyledButton, {
|
|
62
|
-
onClick: function onClick() {
|
|
63
|
-
return onRedo(true);
|
|
64
|
-
}
|
|
65
|
-
}, translator.t('graphing.redo', {
|
|
66
|
-
lng: language
|
|
67
|
-
})), /*#__PURE__*/_react["default"].createElement(StyledButton, {
|
|
68
|
-
onClick: function onClick() {
|
|
69
|
-
return onReset();
|
|
70
|
-
}
|
|
71
|
-
}, translator.t('graphing.reset', {
|
|
72
|
-
lng: language
|
|
73
|
-
})));
|
|
74
|
-
}
|
|
75
|
-
}]);
|
|
76
|
-
}(_react["default"].Component);
|
|
77
|
-
(0, _defineProperty2["default"])(UndoRedo, "propTypes", {
|
|
78
|
-
className: _propTypes["default"].string,
|
|
79
|
-
onUndo: _propTypes["default"].func.isRequired,
|
|
80
|
-
onRedo: _propTypes["default"].func.isRequired,
|
|
81
|
-
onReset: _propTypes["default"].func.isRequired,
|
|
82
|
-
language: _propTypes["default"].string
|
|
83
|
-
});
|
|
84
|
-
(0, _defineProperty2["default"])(UndoRedo, "defaultProps", {});
|
|
85
|
-
var _default = exports["default"] = UndoRedo;
|
|
86
|
-
//# sourceMappingURL=undo-redo.js.map
|
package/lib/undo-redo.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"undo-redo.js","names":["_react","_interopRequireDefault","require","_propTypes","_classnames","_Button","_styles","_renderUi","_translator","_callSuper","t","o","e","_getPrototypeOf2","_possibleConstructorReturn2","_isNativeReflectConstruct","Reflect","construct","constructor","apply","Boolean","prototype","valueOf","call","translator","Translator","StyledButton","styled","Button","_ref","theme","color","text","fontWeight","marginBottom","spacing","marginRight","backgroundColor","buttonHoverBg","UndoRedo","exports","_React$Component","_classCallCheck2","arguments","_inherits2","_createClass2","key","value","render","_this$props","props","className","onUndo","onRedo","onReset","language","createElement","classNames","onClick","lng","React","Component","_defineProperty2","PropTypes","string","func","isRequired","_default"],"sources":["../src/undo-redo.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport Button from '@mui/material/Button';\nimport { styled } from '@mui/material/styles';\nimport { color } from '@pie-lib/render-ui';\nimport Translator from '@pie-lib/translator';\n\nconst { translator } = Translator;\n\nconst StyledButton = styled(Button)(({ theme }) => ({\n color: color.text(),\n fontWeight: 'bold',\n marginBottom: theme.spacing(0.5),\n '&:not(:last-of-type)': {\n marginRight: theme.spacing(0.5),\n },\n '&:hover': {\n backgroundColor: color.buttonHoverBg(),\n },\n}));\n\nexport class UndoRedo extends React.Component {\n static propTypes = {\n className: PropTypes.string,\n onUndo: PropTypes.func.isRequired,\n onRedo: PropTypes.func.isRequired,\n onReset: PropTypes.func.isRequired,\n language: PropTypes.string,\n };\n static defaultProps = {};\n\n render() {\n const { className, onUndo, onRedo, onReset, language } = this.props;\n return (\n <div className={classNames(className)}>\n <StyledButton onClick={() => onUndo(true)}>{translator.t('common:undo', { lng: language })}</StyledButton>\n <StyledButton onClick={() => onRedo(true)}>{translator.t('graphing.redo', { lng: language })}</StyledButton>\n <StyledButton onClick={() => onReset()}>{translator.t('graphing.reset', { lng: language })}</StyledButton>\n </div>\n );\n }\n}\n\nexport default UndoRedo;\n"],"mappings":";;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,WA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AAC;IAEV;EAAC;AAAA,EAnB2BK,iBAAK,CAACC,SAAS;AAAA,IAAAC,gBAAA,aAAhCvB,QAAQ,eACA;EACjBY,SAAS,EAAEY,qBAAS,CAACC,MAAM;EAC3BZ,MAAM,EAAEW,qBAAS,CAACE,IAAI,CAACC,UAAU;EACjCb,MAAM,EAAEU,qBAAS,CAACE,IAAI,CAACC,UAAU;EACjCZ,OAAO,EAAES,qBAAS,CAACE,IAAI,CAACC,UAAU;EAClCX,QAAQ,EAAEQ,qBAAS,CAACC;AACtB,CAAC;AAAA,IAAAF,gBAAA,aAPUvB,QAAQ,kBAQG,CAAC,CAAC;AAAA,IAAA4B,QAAA,GAAA3B,OAAA,cAcXD,QAAQ","ignoreList":[]}
|
package/lib/use-debounce.js
DELETED
|
@@ -1,25 +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.useDebounce = void 0;
|
|
8
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
|
-
var _react = require("react");
|
|
10
|
-
var useDebounce = exports.useDebounce = function useDebounce(value, delay) {
|
|
11
|
-
var _useState = (0, _react.useState)(value),
|
|
12
|
-
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
13
|
-
debouncedValue = _useState2[0],
|
|
14
|
-
setDebouncedValue = _useState2[1];
|
|
15
|
-
(0, _react.useEffect)(function () {
|
|
16
|
-
var handler = setTimeout(function () {
|
|
17
|
-
setDebouncedValue(value);
|
|
18
|
-
}, delay);
|
|
19
|
-
return function () {
|
|
20
|
-
return clearTimeout(handler);
|
|
21
|
-
};
|
|
22
|
-
}, [value]);
|
|
23
|
-
return debouncedValue;
|
|
24
|
-
};
|
|
25
|
-
//# sourceMappingURL=use-debounce.js.map
|
package/lib/use-debounce.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-debounce.js","names":["_react","require","useDebounce","exports","value","delay","_useState","useState","_useState2","_slicedToArray2","debouncedValue","setDebouncedValue","useEffect","handler","setTimeout","clearTimeout"],"sources":["../src/use-debounce.js"],"sourcesContent":["import { useEffect, useState } from 'react';\n\nexport const useDebounce = (value, delay) => {\n const [debouncedValue, setDebouncedValue] = useState(value);\n\n useEffect(() => {\n const handler = setTimeout(() => {\n setDebouncedValue(value);\n }, delay);\n return () => clearTimeout(handler);\n }, [value]);\n return debouncedValue;\n};\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEO,IAAMC,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAG,SAAdA,WAAWA,CAAIE,KAAK,EAAEC,KAAK,EAAK;EAC3C,IAAAC,SAAA,GAA4C,IAAAC,eAAQ,EAACH,KAAK,CAAC;IAAAI,UAAA,OAAAC,eAAA,aAAAH,SAAA;IAApDI,cAAc,GAAAF,UAAA;IAAEG,iBAAiB,GAAAH,UAAA;EAExC,IAAAI,gBAAS,EAAC,YAAM;IACd,IAAMC,OAAO,GAAGC,UAAU,CAAC,YAAM;MAC/BH,iBAAiB,CAACP,KAAK,CAAC;IAC1B,CAAC,EAAEC,KAAK,CAAC;IACT,OAAO;MAAA,OAAMU,YAAY,CAACF,OAAO,CAAC;IAAA;EACpC,CAAC,EAAE,CAACT,KAAK,CAAC,CAAC;EACX,OAAOM,cAAc;AACvB,CAAC","ignoreList":[]}
|
package/lib/utils.js
DELETED
|
@@ -1,229 +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.tickCount = exports.thinnerShapesNeeded = exports.stripEmptyLabel = exports.sameAxes = exports.roundNumber = exports.polygonToArea = exports.pointsToArea = exports.point = exports.lineToArea = exports.isDuplicatedMark = exports.isDomainRangeEqual = exports.getTickValues = exports.getRightestPoints = exports.getMiddleOfTwoPoints = exports.getDistanceBetweenTwoPoints = exports.getAngleDeg = exports.getAdjustedGraphLimits = exports.findLongestWord = exports.equalPoints = exports.countWords = exports.bounds = exports.arrowDimensions = exports.amountToIncreaseWidth = void 0;
|
|
8
|
-
var _plot = require("@pie-lib/plot");
|
|
9
|
-
var _invariant = _interopRequireDefault(require("invariant"));
|
|
10
|
-
var _lodashEs = require("lodash-es");
|
|
11
|
-
var stripEmptyLabel = exports.stripEmptyLabel = function stripEmptyLabel(pt) {
|
|
12
|
-
return (pt === null || pt === void 0 ? void 0 : pt.label) === '' ? (0, _lodashEs.omit)(pt, 'label') : pt;
|
|
13
|
-
};
|
|
14
|
-
var tickCount = exports.tickCount = _plot.utils.tickCount;
|
|
15
|
-
var bounds = exports.bounds = _plot.utils.bounds;
|
|
16
|
-
var point = exports.point = _plot.utils.point;
|
|
17
|
-
|
|
18
|
-
//TODO: This can be removed?
|
|
19
|
-
var getAngleDeg = exports.getAngleDeg = function getAngleDeg() {
|
|
20
|
-
return 0;
|
|
21
|
-
};
|
|
22
|
-
//TODO: This can be removed?
|
|
23
|
-
var arrowDimensions = exports.arrowDimensions = function arrowDimensions() {
|
|
24
|
-
return 0;
|
|
25
|
-
};
|
|
26
|
-
var getTickValues = exports.getTickValues = function getTickValues(prop) {
|
|
27
|
-
var tickValues = [];
|
|
28
|
-
var tickVal = 0;
|
|
29
|
-
while (tickVal >= prop.min && tickValues.indexOf(tickVal) < 0) {
|
|
30
|
-
tickValues.push(tickVal);
|
|
31
|
-
tickVal = Math.round((tickVal - prop.step) * 10000) / 10000;
|
|
32
|
-
}
|
|
33
|
-
tickVal = Math.round(prop.step * 10000) / 10000;
|
|
34
|
-
while (tickVal <= prop.max && tickValues.indexOf(tickVal) < 0) {
|
|
35
|
-
tickValues.push(tickVal);
|
|
36
|
-
tickVal = Math.round((tickVal + prop.step) * 10000) / 10000;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// return only ticks that are inside the min-max interval
|
|
40
|
-
if (tickValues) {
|
|
41
|
-
return tickValues.filter(function (tV) {
|
|
42
|
-
return tV >= prop.min && tV <= prop.max;
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
return [];
|
|
46
|
-
};
|
|
47
|
-
var countWords = exports.countWords = function countWords(label) {
|
|
48
|
-
if (label == null || (0, _lodashEs.isEmpty)(label)) {
|
|
49
|
-
return 1;
|
|
50
|
-
}
|
|
51
|
-
var words = label.split(' ');
|
|
52
|
-
return words.length;
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
// findLongestWord is also used in plot
|
|
56
|
-
var findLongestWord = exports.findLongestWord = function findLongestWord(label) {
|
|
57
|
-
var longestWord = (label || '').replace(/<[^>]+>/g, '').split(' ').sort(function (a, b) {
|
|
58
|
-
return b.length - a.length;
|
|
59
|
-
});
|
|
60
|
-
return longestWord[0].length;
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
// amountToIncreaseWidth is also used in plot
|
|
64
|
-
var amountToIncreaseWidth = exports.amountToIncreaseWidth = function amountToIncreaseWidth(longestWord) {
|
|
65
|
-
if (!longestWord) {
|
|
66
|
-
return 0;
|
|
67
|
-
}
|
|
68
|
-
return longestWord * 10;
|
|
69
|
-
};
|
|
70
|
-
var polygonToArea = exports.polygonToArea = function polygonToArea(points) {
|
|
71
|
-
var h = (0, _lodashEs.head)(points);
|
|
72
|
-
var area = {
|
|
73
|
-
left: h.x,
|
|
74
|
-
top: h.y,
|
|
75
|
-
bottom: h.y,
|
|
76
|
-
right: h.x
|
|
77
|
-
};
|
|
78
|
-
return (0, _lodashEs.tail)(points).reduce(function (a, p) {
|
|
79
|
-
a.left = Math.min(a.left, p.x);
|
|
80
|
-
a.top = Math.max(a.top, p.y);
|
|
81
|
-
a.bottom = Math.min(a.bottom, p.y);
|
|
82
|
-
a.right = Math.max(a.right, p.x);
|
|
83
|
-
return a;
|
|
84
|
-
}, area);
|
|
85
|
-
};
|
|
86
|
-
var lineToArea = exports.lineToArea = function lineToArea(from, to) {
|
|
87
|
-
return pointsToArea(from, to);
|
|
88
|
-
};
|
|
89
|
-
var pointsToArea = exports.pointsToArea = function pointsToArea(a, b) {
|
|
90
|
-
(0, _invariant["default"])(!!a && !!b, 'a or b is undefined');
|
|
91
|
-
var left = Math.min(a.x, b.x);
|
|
92
|
-
var top = Math.max(a.y, b.y);
|
|
93
|
-
var bottom = Math.min(a.y, b.y);
|
|
94
|
-
var right = Math.max(a.x, b.x);
|
|
95
|
-
return {
|
|
96
|
-
left: left,
|
|
97
|
-
top: top,
|
|
98
|
-
bottom: bottom,
|
|
99
|
-
right: right
|
|
100
|
-
};
|
|
101
|
-
};
|
|
102
|
-
var isDomainRangeEqual = exports.isDomainRangeEqual = function isDomainRangeEqual(graphProps, nextGraphProps) {
|
|
103
|
-
return (0, _lodashEs.isEqual)(graphProps.domain, nextGraphProps.domain) && (0, _lodashEs.isEqual)(graphProps.range, nextGraphProps.range);
|
|
104
|
-
};
|
|
105
|
-
var getRightestPoints = exports.getRightestPoints = function getRightestPoints(points) {
|
|
106
|
-
var sortedPoints = (0, _lodashEs.cloneDeep)(points);
|
|
107
|
-
sortedPoints.sort(function (a, b) {
|
|
108
|
-
return b.x - a.x;
|
|
109
|
-
});
|
|
110
|
-
return {
|
|
111
|
-
a: sortedPoints[0],
|
|
112
|
-
b: sortedPoints[1]
|
|
113
|
-
};
|
|
114
|
-
};
|
|
115
|
-
var getMiddleOfTwoPoints = exports.getMiddleOfTwoPoints = function getMiddleOfTwoPoints(a, b) {
|
|
116
|
-
return {
|
|
117
|
-
x: (a.x + b.x) / 2,
|
|
118
|
-
y: (a.y + b.y) / 2
|
|
119
|
-
};
|
|
120
|
-
};
|
|
121
|
-
var roundNumber = exports.roundNumber = function roundNumber(number) {
|
|
122
|
-
return parseFloat(number.toFixed(4));
|
|
123
|
-
};
|
|
124
|
-
var sameAxes = exports.sameAxes = function sameAxes(p1, p2) {
|
|
125
|
-
return p1 && p2 && (roundNumber(p1.x) === roundNumber(p2.x) || roundNumber(p1.y) === roundNumber(p2.y));
|
|
126
|
-
};
|
|
127
|
-
var equalPoints = exports.equalPoints = function equalPoints(p1, p2) {
|
|
128
|
-
return p1 && p2 && (0, _lodashEs.isEqual)({
|
|
129
|
-
x: roundNumber(p1.x),
|
|
130
|
-
y: roundNumber(p1.y)
|
|
131
|
-
}, {
|
|
132
|
-
x: roundNumber(p2.x),
|
|
133
|
-
y: roundNumber(p2.y)
|
|
134
|
-
});
|
|
135
|
-
};
|
|
136
|
-
var getDistanceBetweenTicks = function getDistanceBetweenTicks(axis, size) {
|
|
137
|
-
var min = axis.min,
|
|
138
|
-
max = axis.max,
|
|
139
|
-
step = axis.step;
|
|
140
|
-
var nbOfTicks = (max - min) / step;
|
|
141
|
-
return size / nbOfTicks;
|
|
142
|
-
};
|
|
143
|
-
var thinnerShapesNeeded = exports.thinnerShapesNeeded = function thinnerShapesNeeded(graphProps) {
|
|
144
|
-
var domain = graphProps.domain,
|
|
145
|
-
range = graphProps.range,
|
|
146
|
-
_graphProps$size = graphProps.size,
|
|
147
|
-
width = _graphProps$size.width,
|
|
148
|
-
height = _graphProps$size.height;
|
|
149
|
-
|
|
150
|
-
// 14 is the default width of a point
|
|
151
|
-
return getDistanceBetweenTicks(domain, width) < 14 || getDistanceBetweenTicks(range, height) < 14;
|
|
152
|
-
};
|
|
153
|
-
var getAdjustedGraphLimits = exports.getAdjustedGraphLimits = function getAdjustedGraphLimits(graphProps) {
|
|
154
|
-
var domain = graphProps.domain,
|
|
155
|
-
range = graphProps.range,
|
|
156
|
-
_graphProps$size2 = graphProps.size,
|
|
157
|
-
width = _graphProps$size2.width,
|
|
158
|
-
height = _graphProps$size2.height;
|
|
159
|
-
var domainTicksDistance = getDistanceBetweenTicks(domain, width);
|
|
160
|
-
var rangeTicksDistance = getDistanceBetweenTicks(range, height);
|
|
161
|
-
|
|
162
|
-
// 15 is the distance required for the arrow to extend the graph
|
|
163
|
-
var domainPadding = domain.step / (domainTicksDistance / 15);
|
|
164
|
-
var rangePadding = range.step / (rangeTicksDistance / 15);
|
|
165
|
-
return {
|
|
166
|
-
domain: {
|
|
167
|
-
min: domain.min - domainPadding,
|
|
168
|
-
max: domain.max + domainPadding
|
|
169
|
-
},
|
|
170
|
-
range: {
|
|
171
|
-
min: range.min - rangePadding,
|
|
172
|
-
max: range.max + rangePadding
|
|
173
|
-
}
|
|
174
|
-
};
|
|
175
|
-
};
|
|
176
|
-
var getDistanceBetweenTwoPoints = exports.getDistanceBetweenTwoPoints = function getDistanceBetweenTwoPoints(a, b) {
|
|
177
|
-
return Math.sqrt((b.x - a.x) * (b.x - a.x) + (b.y - a.y) * (b.y - a.y));
|
|
178
|
-
};
|
|
179
|
-
var sortPoints = function sortPoints(array) {
|
|
180
|
-
return (array || []).sort(function (a, b) {
|
|
181
|
-
return a.x - b.x || a.y - b.y;
|
|
182
|
-
});
|
|
183
|
-
};
|
|
184
|
-
|
|
185
|
-
// check colliniarity of 3 points (source: https://www.geeksforgeeks.org/program-check-three-points-collinear/)
|
|
186
|
-
var checkCollinearity = function checkCollinearity(a, b, c) {
|
|
187
|
-
return (a.x - b.x) * (c.y - b.y) === (c.x - b.x) * (a.y - b.y);
|
|
188
|
-
};
|
|
189
|
-
|
|
190
|
-
// 2 lines are overlapping if all 4 points are collinear
|
|
191
|
-
var isSameLine = function isSameLine(markA, markB) {
|
|
192
|
-
return checkCollinearity(markA.from, markB.from, markB.to) && checkCollinearity(markA.to, markB.from, markB.to);
|
|
193
|
-
};
|
|
194
|
-
var isSameCircle = function isSameCircle(markA, markB) {
|
|
195
|
-
return equalPoints(markA.root, markB.root) && getDistanceBetweenTwoPoints(markB.root, markB.edge) === getDistanceBetweenTwoPoints(markA.root, markA.edge);
|
|
196
|
-
};
|
|
197
|
-
var isDuplicatedMark = exports.isDuplicatedMark = function isDuplicatedMark(mark, marks, oldMark) {
|
|
198
|
-
var type = mark.type,
|
|
199
|
-
building = mark.building;
|
|
200
|
-
if (building) {
|
|
201
|
-
return false;
|
|
202
|
-
}
|
|
203
|
-
var filteredMarks = (marks || []).filter(function (m) {
|
|
204
|
-
return m.type === type && !m.building;
|
|
205
|
-
});
|
|
206
|
-
var index = filteredMarks.findIndex(function (m) {
|
|
207
|
-
return (0, _lodashEs.isEqual)(m, oldMark);
|
|
208
|
-
});
|
|
209
|
-
if (index !== -1) {
|
|
210
|
-
filteredMarks.splice(index, 1);
|
|
211
|
-
}
|
|
212
|
-
var duplicated = filteredMarks.find(function (m) {
|
|
213
|
-
if (type === 'circle' || type === 'parabola' || type === 'sine' || type === 'absolute' || type === 'exponential') {
|
|
214
|
-
var root = mark.root,
|
|
215
|
-
edge = mark.edge;
|
|
216
|
-
return equalPoints(root, m.root) && equalPoints(edge, m.edge) || type === 'circle' && isSameCircle(m, mark);
|
|
217
|
-
} else if (type === 'line' || type === 'ray' || type === 'segment' || type === 'vector') {
|
|
218
|
-
var from = mark.from,
|
|
219
|
-
to = mark.to;
|
|
220
|
-
return equalPoints(from, m.from) && equalPoints(to, m.to) || equalPoints(from, m.to) && equalPoints(to, m.from) || type === 'line' && isSameLine(m, mark);
|
|
221
|
-
} else if (type === 'polygon') {
|
|
222
|
-
return (0, _lodashEs.isEqual)(sortPoints((0, _lodashEs.cloneDeep)(mark.points)), sortPoints((0, _lodashEs.cloneDeep)(m.points)));
|
|
223
|
-
} else if (type === 'point') {
|
|
224
|
-
return equalPoints(m, mark);
|
|
225
|
-
}
|
|
226
|
-
});
|
|
227
|
-
return !!duplicated;
|
|
228
|
-
};
|
|
229
|
-
//# sourceMappingURL=utils.js.map
|