@pie-lib/graphing 4.0.5-next.3 → 4.0.5-next.31
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 +23 -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 +154 -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 +58 -0
- package/dist/mark-label.js +171 -0
- package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/axis/Axis.js +101 -0
- package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/axis/AxisRenderer.js +63 -0
- package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/axis/Ticks.js +44 -0
- package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/constants/orientation.js +9 -0
- package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/utils/createPoint.js +14 -0
- package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/utils/getAxisRangePaddingConfig.js +21 -0
- package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/utils/getLabelTransform.js +16 -0
- package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/utils/getTickFormatter.js +8 -0
- package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/utils/getTickPosition.js +15 -0
- package/dist/node_modules/.bun/@visx_curve@3.12.0/node_modules/@visx/curve/esm/index.js +2 -0
- package/dist/node_modules/.bun/@visx_grid@3.12.0_f4eacebf2041cd4f/node_modules/@visx/grid/esm/grids/Grid.js +79 -0
- package/dist/node_modules/.bun/@visx_grid@3.12.0_f4eacebf2041cd4f/node_modules/@visx/grid/esm/grids/GridColumns.js +79 -0
- package/dist/node_modules/.bun/@visx_grid@3.12.0_f4eacebf2041cd4f/node_modules/@visx/grid/esm/grids/GridRows.js +79 -0
- package/dist/node_modules/.bun/@visx_grid@3.12.0_f4eacebf2041cd4f/node_modules/@visx/grid/esm/utils/getScaleBandwidth.js +6 -0
- package/dist/node_modules/.bun/@visx_group@3.12.0_f4eacebf2041cd4f/node_modules/@visx/group/esm/Group.js +50 -0
- package/dist/node_modules/.bun/@visx_point@3.12.0/node_modules/@visx/point/esm/Point.js +18 -0
- package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/utils/coerceNumber.js +10 -0
- package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/utils/getTicks.js +9 -0
- package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/utils/toString.js +6 -0
- package/dist/node_modules/.bun/@visx_shape@3.12.0_f4eacebf2041cd4f/node_modules/@visx/shape/esm/shapes/Line.js +47 -0
- package/dist/node_modules/.bun/@visx_shape@3.12.0_f4eacebf2041cd4f/node_modules/@visx/shape/esm/shapes/LinePath.js +50 -0
- package/dist/node_modules/.bun/@visx_shape@3.12.0_f4eacebf2041cd4f/node_modules/@visx/shape/esm/util/D3ShapeFactories.js +9 -0
- package/dist/node_modules/.bun/@visx_shape@3.12.0_f4eacebf2041cd4f/node_modules/@visx/shape/esm/util/setNumberOrNumberAccessor.js +6 -0
- package/dist/node_modules/.bun/@visx_shape@3.12.0_f4eacebf2041cd4f/node_modules/@visx/shape/lib/shapes/Line.js +53 -0
- package/dist/node_modules/.bun/@visx_text@3.12.0_f4eacebf2041cd4f/node_modules/@visx/text/esm/Text.js +57 -0
- package/dist/node_modules/.bun/@visx_text@3.12.0_f4eacebf2041cd4f/node_modules/@visx/text/esm/hooks/useText.js +91 -0
- package/dist/node_modules/.bun/@visx_text@3.12.0_f4eacebf2041cd4f/node_modules/@visx/text/esm/util/getStringWidth.js +21 -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/lodash@4.17.21/node_modules/lodash/_Hash.js +21 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_ListCache.js +21 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_Map.js +10 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_MapCache.js +21 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_Symbol.js +9 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_assocIndexOf.js +14 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_baseGetTag.js +15 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_baseIsNative.js +16 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_coreJsData.js +9 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_freeGlobal.js +8 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_getMapData.js +14 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_getNative.js +15 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_getRawTag.js +19 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_getValue.js +11 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_hashClear.js +13 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_hashDelete.js +12 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_hashGet.js +18 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_hashHas.js +14 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_hashSet.js +14 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_isKeyable.js +12 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_isMasked.js +16 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_listCacheClear.js +11 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_listCacheDelete.js +14 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_listCacheGet.js +14 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_listCacheHas.js +13 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_listCacheSet.js +14 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_mapCacheClear.js +19 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_mapCacheDelete.js +14 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_mapCacheGet.js +13 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_mapCacheHas.js +13 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_mapCacheSet.js +14 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_nativeCreate.js +9 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_objectToString.js +12 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_root.js +10 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_toSource.js +20 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/eq.js +11 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/isFunction.js +16 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/isObject.js +12 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/memoize.js +20 -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/react-redux@9.3.0_9e2203c65d1d5fa1/node_modules/react-redux/dist/react-redux.js +471 -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/node_modules/.bun/use-sync-external-store@1.6.0_f4eacebf2041cd4f/node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.development.js +53 -0
- package/dist/node_modules/.bun/use-sync-external-store@1.6.0_f4eacebf2041cd4f/node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.production.js +51 -0
- package/dist/node_modules/.bun/use-sync-external-store@1.6.0_f4eacebf2041cd4f/node_modules/use-sync-external-store/with-selector.js +10 -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 +83 -0
- package/dist/tools/circle/component.js +195 -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 +50 -0
- package/dist/tools/point/component.js +85 -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 +120 -0
- package/dist/tools/polygon/component.js +262 -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 +245 -0
- package/dist/tools/shared/line/index.js +319 -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 +142 -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 +45 -33
- package/CHANGELOG.json +0 -1
- package/CHANGELOG.md +0 -1469
- package/LICENSE.md +0 -5
- 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/actions.js +0 -18
- package/lib/container/actions.js.map +0 -1
- package/lib/container/index.js +0 -118
- 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/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/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/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/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/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/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/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/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/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/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/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/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/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/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 -83
- 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,91 +0,0 @@
|
|
|
1
|
-
import { render } from '@pie-lib/test-utils';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { ArrowPoint } from '../index';
|
|
4
|
-
import { graphProps } from '../../../../__tests__/utils';
|
|
5
|
-
import { bounds } from '../../../../utils';
|
|
6
|
-
import { gridDraggable, utils } from '@pie-lib/plot';
|
|
7
|
-
|
|
8
|
-
const { xy } = utils;
|
|
9
|
-
jest.mock('../../../../utils', () => {
|
|
10
|
-
const { point, getAngleDeg, arrowDimensions } = jest.requireActual('../../../../utils');
|
|
11
|
-
return {
|
|
12
|
-
bounds: jest.fn(),
|
|
13
|
-
point,
|
|
14
|
-
getAngleDeg,
|
|
15
|
-
arrowDimensions,
|
|
16
|
-
};
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
jest.mock('@pie-lib/plot', () => {
|
|
20
|
-
const { types, utils } = jest.requireActual('@pie-lib/plot');
|
|
21
|
-
return {
|
|
22
|
-
gridDraggable: jest.fn((opts) => (Comp) => Comp),
|
|
23
|
-
types,
|
|
24
|
-
utils,
|
|
25
|
-
};
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
describe('ArrowPoint', () => {
|
|
29
|
-
let onChange = jest.fn();
|
|
30
|
-
const renderComponent = (extras) => {
|
|
31
|
-
const defaults = {
|
|
32
|
-
classes: {},
|
|
33
|
-
className: 'className',
|
|
34
|
-
onChange,
|
|
35
|
-
graphProps: graphProps(),
|
|
36
|
-
from: xy(0, 0),
|
|
37
|
-
to: xy(1, 1),
|
|
38
|
-
x: 0,
|
|
39
|
-
y: 0,
|
|
40
|
-
};
|
|
41
|
-
const props = { ...defaults, ...extras };
|
|
42
|
-
return render(<ArrowPoint {...props} />);
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
describe('rendering', () => {
|
|
46
|
-
it('renders without crashing', () => {
|
|
47
|
-
const { container } = renderComponent();
|
|
48
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
describe('gridDraggable options', () => {
|
|
53
|
-
let opts;
|
|
54
|
-
let domain;
|
|
55
|
-
let range;
|
|
56
|
-
beforeEach(() => {
|
|
57
|
-
domain = {
|
|
58
|
-
min: 0,
|
|
59
|
-
max: 1,
|
|
60
|
-
step: 1,
|
|
61
|
-
};
|
|
62
|
-
range = {
|
|
63
|
-
min: 0,
|
|
64
|
-
max: 1,
|
|
65
|
-
step: 1,
|
|
66
|
-
};
|
|
67
|
-
renderComponent();
|
|
68
|
-
opts = gridDraggable.mock.calls[gridDraggable.mock.calls.length - 1][0];
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
describe('bounds', () => {
|
|
72
|
-
it('calls utils.bounds with area', () => {
|
|
73
|
-
const result = opts.bounds({ x: 0, y: 0 }, { domain, range });
|
|
74
|
-
expect(bounds).toHaveBeenCalledWith({ left: 0, top: 0, bottom: 0, right: 0 }, domain, range);
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
describe('anchorPoint', () => {
|
|
78
|
-
it('returns x/y', () => {
|
|
79
|
-
const result = opts.anchorPoint({ x: 0, y: 0 });
|
|
80
|
-
expect(result).toEqual({ x: 0, y: 0 });
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
describe('fromDelta', () => {
|
|
85
|
-
it('returns a new point from the x/y + delta', () => {
|
|
86
|
-
const result = opts.fromDelta({ x: -1, y: 0 }, { x: 1, y: 3 });
|
|
87
|
-
expect(result).toEqual({ x: 0, y: 3 });
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
});
|
|
91
|
-
});
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { render } from '@pie-lib/test-utils';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { BasePoint } from '../index';
|
|
4
|
-
import { gridDraggable } from '@pie-lib/plot';
|
|
5
|
-
import { graphProps } from '../../../../__tests__/utils';
|
|
6
|
-
import { bounds } from '../../../../utils';
|
|
7
|
-
|
|
8
|
-
jest.mock('../../../../utils', () => {
|
|
9
|
-
const { point, thinnerShapesNeeded } = jest.requireActual('../../../../utils');
|
|
10
|
-
return {
|
|
11
|
-
bounds: jest.fn(),
|
|
12
|
-
point,
|
|
13
|
-
thinnerShapesNeeded,
|
|
14
|
-
};
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
jest.mock('@pie-lib/plot', () => {
|
|
18
|
-
const { types, utils } = jest.requireActual('@pie-lib/plot');
|
|
19
|
-
return {
|
|
20
|
-
gridDraggable: jest.fn((opts) => (Comp) => Comp),
|
|
21
|
-
types,
|
|
22
|
-
utils,
|
|
23
|
-
};
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
describe('BasePoint', () => {
|
|
27
|
-
let onChange = jest.fn();
|
|
28
|
-
const renderComponent = (extras) => {
|
|
29
|
-
const defaults = {
|
|
30
|
-
classes: {},
|
|
31
|
-
className: 'className',
|
|
32
|
-
onChange,
|
|
33
|
-
graphProps: graphProps(),
|
|
34
|
-
x: 0,
|
|
35
|
-
y: 0,
|
|
36
|
-
};
|
|
37
|
-
const props = { ...defaults, ...extras };
|
|
38
|
-
return render(<BasePoint {...props} />);
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
describe('rendering', () => {
|
|
42
|
-
it('renders without crashing', () => {
|
|
43
|
-
const { container } = renderComponent();
|
|
44
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
describe('gridDraggable options', () => {
|
|
49
|
-
let opts;
|
|
50
|
-
let domain;
|
|
51
|
-
let range;
|
|
52
|
-
beforeEach(() => {
|
|
53
|
-
domain = {
|
|
54
|
-
min: 0,
|
|
55
|
-
max: 1,
|
|
56
|
-
step: 1,
|
|
57
|
-
};
|
|
58
|
-
range = {
|
|
59
|
-
min: 0,
|
|
60
|
-
max: 1,
|
|
61
|
-
step: 1,
|
|
62
|
-
};
|
|
63
|
-
renderComponent();
|
|
64
|
-
opts = gridDraggable.mock.calls[gridDraggable.mock.calls.length - 1][0];
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
describe('bounds', () => {
|
|
68
|
-
it('calls utils.bounds with area', () => {
|
|
69
|
-
const result = opts.bounds({ x: 0, y: 0 }, { domain, range });
|
|
70
|
-
expect(bounds).toHaveBeenCalledWith({ left: 0, top: 0, bottom: 0, right: 0 }, domain, range);
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
describe('anchorPoint', () => {
|
|
74
|
-
it('returns x/y', () => {
|
|
75
|
-
const result = opts.anchorPoint({ x: 0, y: 0 });
|
|
76
|
-
expect(result).toEqual({ x: 0, y: 0 });
|
|
77
|
-
});
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
describe('fromDelta', () => {
|
|
81
|
-
it('returns a new point from the x/y + delta', () => {
|
|
82
|
-
const result = opts.fromDelta({ x: -1, y: 0 }, { x: 1, y: 3 });
|
|
83
|
-
expect(result).toEqual({ x: 0, y: 3 });
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
});
|
|
87
|
-
});
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { types } from '@pie-lib/plot';
|
|
4
|
-
import { arrowDimensions, getAngleDeg } from '../../../utils';
|
|
5
|
-
|
|
6
|
-
export class RawArrow extends React.Component {
|
|
7
|
-
static propTypes = {
|
|
8
|
-
className: PropTypes.string,
|
|
9
|
-
correctness: PropTypes.string,
|
|
10
|
-
disabled: PropTypes.bool,
|
|
11
|
-
x: PropTypes.number.isRequired,
|
|
12
|
-
y: PropTypes.number.isRequired,
|
|
13
|
-
from: PropTypes.shape({
|
|
14
|
-
x: PropTypes.number,
|
|
15
|
-
y: PropTypes.number,
|
|
16
|
-
}).isRequired,
|
|
17
|
-
to: PropTypes.shape({
|
|
18
|
-
x: PropTypes.number,
|
|
19
|
-
y: PropTypes.number,
|
|
20
|
-
}),
|
|
21
|
-
graphProps: types.GraphPropsType.isRequired,
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
static defaultProps = {
|
|
25
|
-
from: {},
|
|
26
|
-
to: {},
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
render() {
|
|
30
|
-
const { className, x, y, graphProps, from, to, ...rest } = this.props;
|
|
31
|
-
const { scale } = graphProps;
|
|
32
|
-
|
|
33
|
-
const angle = from && to ? getAngleDeg(from.x, from.y, to.x, to.y) : 0;
|
|
34
|
-
|
|
35
|
-
const points =
|
|
36
|
-
from && to && (from.x !== to.x || from.y !== to.y)
|
|
37
|
-
? `0,0 ${arrowDimensions.vector},${arrowDimensions.vector * 2} -${arrowDimensions.vector},${arrowDimensions.vector * 2}`
|
|
38
|
-
: '0,0 0,0 0,0';
|
|
39
|
-
|
|
40
|
-
return (
|
|
41
|
-
<g className={className} {...rest}>
|
|
42
|
-
<polygon points={points} transform={`translate(${scale.x(x)}, ${scale.y(y)}) rotate(${angle} 0 0)`} />
|
|
43
|
-
</g>
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { types } from '@pie-lib/plot';
|
|
4
|
-
import { ArrowHead } from '../arrow-head';
|
|
5
|
-
import { thinnerShapesNeeded } from '../../../utils';
|
|
6
|
-
|
|
7
|
-
export class BaseArrow extends React.Component {
|
|
8
|
-
static propTypes = {
|
|
9
|
-
className: PropTypes.string,
|
|
10
|
-
correctness: PropTypes.string,
|
|
11
|
-
disabled: PropTypes.bool,
|
|
12
|
-
x: PropTypes.number.isRequired,
|
|
13
|
-
y: PropTypes.number.isRequired,
|
|
14
|
-
angle: PropTypes.number.isRequired,
|
|
15
|
-
graphProps: types.GraphPropsType.isRequired,
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
render() {
|
|
19
|
-
const { className, angle, x, y, correctness, graphProps, ...rest } = this.props;
|
|
20
|
-
const size = thinnerShapesNeeded(graphProps) ? 12 : 14;
|
|
21
|
-
const { scale } = graphProps;
|
|
22
|
-
|
|
23
|
-
const scaledX = scale.x(x);
|
|
24
|
-
const scaledY = scale.y(y);
|
|
25
|
-
|
|
26
|
-
const transform = `rotate(${-angle}, ${scaledX},${scaledY})`;
|
|
27
|
-
const points = `${scaledX},${scaledY}
|
|
28
|
-
${scaledX - size},${scaledY - size / 2}
|
|
29
|
-
${scaledX - size},${scaledY + size / 2}`;
|
|
30
|
-
|
|
31
|
-
return (
|
|
32
|
-
<g className={className} {...rest}>
|
|
33
|
-
<ArrowHead size={size} transform={transform} points={points} correctness={correctness} />
|
|
34
|
-
</g>
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { types } from '@pie-lib/plot';
|
|
4
|
-
import ReactDOM from 'react-dom';
|
|
5
|
-
import { styled } from '@mui/material/styles';
|
|
6
|
-
|
|
7
|
-
import CoordinatesLabel from '../../../coordinates-label';
|
|
8
|
-
import { thinnerShapesNeeded } from '../../../utils';
|
|
9
|
-
import MissingSVG from '../icons/MissingSVG';
|
|
10
|
-
import CorrectSVG from '../icons/CorrectSVG';
|
|
11
|
-
import IncorrectSVG from '../icons/IncorrectSVG';
|
|
12
|
-
import * as styles from '../styles';
|
|
13
|
-
|
|
14
|
-
const StyledPointGroup = styled('g')(({ disabled, correctness }) => ({
|
|
15
|
-
cursor: 'pointer',
|
|
16
|
-
'& circle': {
|
|
17
|
-
fill: 'currentColor',
|
|
18
|
-
},
|
|
19
|
-
...(disabled && {
|
|
20
|
-
...styles.disabled('fill'),
|
|
21
|
-
...styles.disabled('color'),
|
|
22
|
-
}),
|
|
23
|
-
...(correctness === 'correct' && {
|
|
24
|
-
...styles.correct('fill'),
|
|
25
|
-
...styles.correct('color'),
|
|
26
|
-
}),
|
|
27
|
-
...(correctness === 'incorrect' && {
|
|
28
|
-
...styles.incorrect('fill'),
|
|
29
|
-
...styles.incorrect('color'),
|
|
30
|
-
}),
|
|
31
|
-
...(correctness === 'missing' && {
|
|
32
|
-
...styles.missing('fill'),
|
|
33
|
-
...styles.missing('color'),
|
|
34
|
-
}),
|
|
35
|
-
}));
|
|
36
|
-
|
|
37
|
-
export class RawBp extends React.Component {
|
|
38
|
-
static propTypes = {
|
|
39
|
-
className: PropTypes.string,
|
|
40
|
-
coordinatesOnHover: PropTypes.bool,
|
|
41
|
-
correctness: PropTypes.string,
|
|
42
|
-
disabled: PropTypes.bool,
|
|
43
|
-
labelNode: PropTypes.object,
|
|
44
|
-
x: PropTypes.number.isRequired,
|
|
45
|
-
y: PropTypes.number.isRequired,
|
|
46
|
-
graphProps: types.GraphPropsType.isRequired,
|
|
47
|
-
onClick: PropTypes.func,
|
|
48
|
-
onTouchStart: PropTypes.func,
|
|
49
|
-
onTouchEnd: PropTypes.func,
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
state = { showCoordinates: false };
|
|
53
|
-
|
|
54
|
-
render() {
|
|
55
|
-
const {
|
|
56
|
-
className,
|
|
57
|
-
coordinatesOnHover,
|
|
58
|
-
x,
|
|
59
|
-
y,
|
|
60
|
-
disabled,
|
|
61
|
-
correctness,
|
|
62
|
-
graphProps,
|
|
63
|
-
labelNode,
|
|
64
|
-
onClick,
|
|
65
|
-
onTouchStart,
|
|
66
|
-
onTouchEnd,
|
|
67
|
-
...rest
|
|
68
|
-
} = this.props;
|
|
69
|
-
|
|
70
|
-
const { showCoordinates } = this.state;
|
|
71
|
-
const { scale } = graphProps;
|
|
72
|
-
const r = thinnerShapesNeeded(graphProps) ? 5 : 7;
|
|
73
|
-
|
|
74
|
-
let SvgComponent;
|
|
75
|
-
switch (correctness) {
|
|
76
|
-
case 'missing':
|
|
77
|
-
SvgComponent = MissingSVG;
|
|
78
|
-
break;
|
|
79
|
-
case 'correct':
|
|
80
|
-
SvgComponent = CorrectSVG;
|
|
81
|
-
break;
|
|
82
|
-
case 'incorrect':
|
|
83
|
-
SvgComponent = IncorrectSVG;
|
|
84
|
-
break;
|
|
85
|
-
default:
|
|
86
|
-
SvgComponent = null;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
return (
|
|
90
|
-
<>
|
|
91
|
-
{/* Outer invisible circle for easier touch/click */}
|
|
92
|
-
<circle
|
|
93
|
-
style={{ fill: 'transparent', cursor: 'pointer', pointerEvents: 'all' }}
|
|
94
|
-
r={r * 3}
|
|
95
|
-
cx={scale.x(x)}
|
|
96
|
-
cy={scale.y(y)}
|
|
97
|
-
onMouseEnter={() => this.setState({ showCoordinates: true })}
|
|
98
|
-
onMouseLeave={() => this.setState({ showCoordinates: false })}
|
|
99
|
-
onTouchStart={onTouchStart}
|
|
100
|
-
onTouchEnd={onTouchEnd}
|
|
101
|
-
onClick={onClick}
|
|
102
|
-
/>
|
|
103
|
-
{/* Actual point */}
|
|
104
|
-
<StyledPointGroup
|
|
105
|
-
className={className}
|
|
106
|
-
disabled={disabled}
|
|
107
|
-
correctness={correctness}
|
|
108
|
-
onMouseEnter={() => this.setState({ showCoordinates: true })}
|
|
109
|
-
onMouseLeave={() => this.setState({ showCoordinates: false })}
|
|
110
|
-
>
|
|
111
|
-
<circle {...rest} r={r} cx={scale.x(x)} cy={scale.y(y)} />
|
|
112
|
-
{SvgComponent && <SvgComponent scale={scale} x={x} y={y} />}
|
|
113
|
-
{labelNode &&
|
|
114
|
-
coordinatesOnHover &&
|
|
115
|
-
showCoordinates &&
|
|
116
|
-
ReactDOM.createPortal(<CoordinatesLabel graphProps={graphProps} x={x} y={y} />, labelNode)}
|
|
117
|
-
</StyledPointGroup>
|
|
118
|
-
</>
|
|
119
|
-
);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { styled } from '@mui/material/styles';
|
|
3
|
-
import { gridDraggable } from '@pie-lib/plot';
|
|
4
|
-
import { color } from '@pie-lib/render-ui';
|
|
5
|
-
import * as utils from '../../../utils';
|
|
6
|
-
import { RawBp } from './base-point';
|
|
7
|
-
import { RawArrow } from './arrow-point';
|
|
8
|
-
import { BaseArrow } from './arrow';
|
|
9
|
-
|
|
10
|
-
// Drag & bounds options
|
|
11
|
-
const opts = {
|
|
12
|
-
bounds: (props, { domain, range }) => {
|
|
13
|
-
const { x, y } = props;
|
|
14
|
-
const area = { left: x, top: y, bottom: y, right: x };
|
|
15
|
-
return utils.bounds(area, domain, range);
|
|
16
|
-
},
|
|
17
|
-
anchorPoint: (props) => {
|
|
18
|
-
const { x, y } = props;
|
|
19
|
-
return { x, y };
|
|
20
|
-
},
|
|
21
|
-
fromDelta: (props, delta) => {
|
|
22
|
-
return utils.point(props).add(utils.point(delta));
|
|
23
|
-
},
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
// Common styled point
|
|
27
|
-
const PointStyle = styled('g')(() => ({
|
|
28
|
-
'& circle, & polygon': {
|
|
29
|
-
cursor: 'pointer',
|
|
30
|
-
},
|
|
31
|
-
'&[disabled]': {
|
|
32
|
-
'& circle, & polygon': {
|
|
33
|
-
fill: color.disabledSecondary(),
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
}));
|
|
37
|
-
|
|
38
|
-
export const BasePoint = gridDraggable(opts)((props) => (
|
|
39
|
-
<PointStyle {...props}>
|
|
40
|
-
<RawBp {...props} />
|
|
41
|
-
</PointStyle>
|
|
42
|
-
));
|
|
43
|
-
|
|
44
|
-
export const ArrowPoint = gridDraggable(opts)((props) => (
|
|
45
|
-
<PointStyle {...props}>
|
|
46
|
-
<RawArrow {...props} />
|
|
47
|
-
</PointStyle>
|
|
48
|
-
));
|
|
49
|
-
|
|
50
|
-
export const Arrow = gridDraggable(opts)((props) => (
|
|
51
|
-
<PointStyle {...props}>
|
|
52
|
-
<BaseArrow {...props} />
|
|
53
|
-
</PointStyle>
|
|
54
|
-
));
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { color } from '@pie-lib/render-ui';
|
|
2
|
-
|
|
3
|
-
export const graphingShapeFill = () => color.visualElementsColors.SHAPES_FILL_COLOR;
|
|
4
|
-
|
|
5
|
-
export const disabled = (key = 'fill') => ({
|
|
6
|
-
[key]: color.disabledSecondary(), // this is needed to match previous disabled color for backward compatibility
|
|
7
|
-
pointerEvents: 'none',
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
export const disabledSecondary = (key = 'fill') => ({
|
|
11
|
-
[key]: color.disabledSecondary(),
|
|
12
|
-
pointerEvents: 'none',
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
export const correct = (key = 'fill') => ({
|
|
16
|
-
[key]: color.correctWithIcon(),
|
|
17
|
-
pointerEvents: 'none',
|
|
18
|
-
});
|
|
19
|
-
export const incorrect = (key = 'fill') => ({
|
|
20
|
-
[key]: color.incorrectWithIcon(),
|
|
21
|
-
pointerEvents: 'none',
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
export const missing = (key = 'fill') => ({
|
|
25
|
-
[key]: color.missingWithIcon(),
|
|
26
|
-
pointerEvents: 'none',
|
|
27
|
-
});
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
|
|
3
|
-
export const ToolPropTypeFields = {
|
|
4
|
-
mark: PropTypes.any,
|
|
5
|
-
onChange: PropTypes.func,
|
|
6
|
-
onDragStart: PropTypes.func,
|
|
7
|
-
onDragStop: PropTypes.func,
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export const ToolPropType = PropTypes.shape(ToolPropTypeFields);
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { withRootEdge } from '../../shared/line/with-root-edge';
|
|
2
|
-
import { buildDataPoints, sinY } from '@pie-lib/graphing-utils';
|
|
3
|
-
import { utils } from '@pie-lib/plot';
|
|
4
|
-
|
|
5
|
-
import { graphProps as getGraphProps } from '../../../__tests__/utils';
|
|
6
|
-
|
|
7
|
-
const { xy } = utils;
|
|
8
|
-
jest.mock('@pie-lib/graphing-utils', () => ({
|
|
9
|
-
sinY: jest.fn().mockReturnValue(0),
|
|
10
|
-
buildDataPoints: jest.fn().mockReturnValue([]),
|
|
11
|
-
parabolaFromTwoPoints: jest.fn(() => jest.fn()),
|
|
12
|
-
getAmplitudeAndFreq: jest.fn().mockReturnValue({ freq: 4, amplitude: 1 }),
|
|
13
|
-
FREQ_DIVIDER: 16,
|
|
14
|
-
}));
|
|
15
|
-
|
|
16
|
-
jest.mock('../../shared/line/with-root-edge', () => ({
|
|
17
|
-
withRootEdge: jest.fn(),
|
|
18
|
-
rootEdgeComponent: jest.fn(),
|
|
19
|
-
}));
|
|
20
|
-
describe('Parabola', () => {
|
|
21
|
-
let fnBody;
|
|
22
|
-
let graphProps;
|
|
23
|
-
let root;
|
|
24
|
-
let edge;
|
|
25
|
-
let result;
|
|
26
|
-
beforeEach(() => {
|
|
27
|
-
require('../component');
|
|
28
|
-
fnBody = withRootEdge.mock.calls[0][0];
|
|
29
|
-
graphProps = getGraphProps();
|
|
30
|
-
root = xy(0, 0);
|
|
31
|
-
edge = xy(1, 1);
|
|
32
|
-
|
|
33
|
-
result = fnBody({ graphProps, root, edge });
|
|
34
|
-
});
|
|
35
|
-
it('fnBody is not null', () => {
|
|
36
|
-
expect(fnBody).toBeDefined();
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
it('calls buildDataPoints', () => {
|
|
40
|
-
const { domain, range } = graphProps;
|
|
41
|
-
expect(buildDataPoints).toHaveBeenCalledWith({ ...domain, step: 0.25 }, range, root, edge, expect.anything());
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it('calls sinY', () => {
|
|
45
|
-
expect(sinY).toHaveBeenCalledWith(1, 4, expect.anything());
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
it('returns dataPoints', () => {
|
|
49
|
-
expect(result).toEqual({ root, edge, dataPoints: [] });
|
|
50
|
-
});
|
|
51
|
-
});
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import debug from 'debug';
|
|
2
|
-
import { buildDataPoints, FREQ_DIVIDER, getAmplitudeAndFreq, sinY } from '@pie-lib/graphing-utils';
|
|
3
|
-
import { rootEdgeComponent, withRootEdge } from '../shared/line/with-root-edge';
|
|
4
|
-
|
|
5
|
-
const log = debug('pie-lib:graphing:sine');
|
|
6
|
-
|
|
7
|
-
const Sine = withRootEdge((props) => {
|
|
8
|
-
const { root, edge, graphProps } = props;
|
|
9
|
-
const { domain, range } = graphProps;
|
|
10
|
-
|
|
11
|
-
const { amplitude, freq } = getAmplitudeAndFreq(root, edge);
|
|
12
|
-
const interval = freq / FREQ_DIVIDER;
|
|
13
|
-
|
|
14
|
-
log('[getPoints] amplitude:', amplitude, 'freq:', freq);
|
|
15
|
-
|
|
16
|
-
const dataPoints =
|
|
17
|
-
edge && edge.x === root.x
|
|
18
|
-
? []
|
|
19
|
-
: buildDataPoints(
|
|
20
|
-
{ ...domain, step: interval },
|
|
21
|
-
range,
|
|
22
|
-
root,
|
|
23
|
-
edge,
|
|
24
|
-
sinY(amplitude, freq, { phase: root.x, vertical: root.y }),
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
return { root: props.root, edge: props.edge, dataPoints };
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
const Component = rootEdgeComponent(Sine);
|
|
31
|
-
|
|
32
|
-
export default Component;
|
package/src/tools/sine/index.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import Sine from './component';
|
|
2
|
-
import debug from 'debug';
|
|
3
|
-
import { equalPoints, sameAxes } from '../../utils';
|
|
4
|
-
|
|
5
|
-
const log = debug('pie-lib:graphing:sine');
|
|
6
|
-
|
|
7
|
-
export const tool = () => ({
|
|
8
|
-
type: 'sine',
|
|
9
|
-
Component: Sine,
|
|
10
|
-
complete: (data, mark) => {
|
|
11
|
-
return { ...mark, building: false, closed: true };
|
|
12
|
-
},
|
|
13
|
-
addPoint: (point, mark) => {
|
|
14
|
-
log('add point to sine model: ', point, 'mark: ', mark);
|
|
15
|
-
if (mark && (equalPoints(mark.root, point) || sameAxes(mark.root, point))) {
|
|
16
|
-
return mark;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
if (!mark) {
|
|
20
|
-
return {
|
|
21
|
-
type: 'sine',
|
|
22
|
-
root: point,
|
|
23
|
-
edge: undefined,
|
|
24
|
-
closed: false,
|
|
25
|
-
building: true,
|
|
26
|
-
};
|
|
27
|
-
} else if (mark && !mark.root) {
|
|
28
|
-
throw new Error('no root - should never happen');
|
|
29
|
-
} else {
|
|
30
|
-
return { ...mark, edge: point, closed: true, building: false };
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
});
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { render } from '@pie-lib/test-utils';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { Line } from '../component';
|
|
4
|
-
import { graphProps as getGraphProps } from '../../../__tests__/utils';
|
|
5
|
-
import { utils } from '@pie-lib/plot';
|
|
6
|
-
|
|
7
|
-
describe('Line', () => {
|
|
8
|
-
const renderComponent = (extras) => {
|
|
9
|
-
const defaults = {
|
|
10
|
-
classes: {},
|
|
11
|
-
className: 'className',
|
|
12
|
-
graphProps: getGraphProps(),
|
|
13
|
-
from: utils.xy(0, 0),
|
|
14
|
-
to: utils.xy(1, 1),
|
|
15
|
-
};
|
|
16
|
-
const props = { ...defaults, ...extras };
|
|
17
|
-
return render(<Line {...props} />);
|
|
18
|
-
};
|
|
19
|
-
describe('rendering', () => {
|
|
20
|
-
it('renders without crashing', () => {
|
|
21
|
-
const { container } = renderComponent();
|
|
22
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
});
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { lineBase, lineToolComponent, styles } from '../shared/line';
|
|
2
|
-
import { Arrow } from '../shared/point';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
5
|
-
import { types } from '@pie-lib/plot';
|
|
6
|
-
import { styled } from '@mui/material/styles';
|
|
7
|
-
import { getDistanceBetweenTwoPoints } from '../../utils';
|
|
8
|
-
|
|
9
|
-
const StyledLine = styled('line')(({ theme, disabled, correctness }) => ({
|
|
10
|
-
...styles.line(theme),
|
|
11
|
-
...(disabled && styles.disabledSecondary(theme)),
|
|
12
|
-
...(correctness && styles[correctness] && styles[correctness](theme, 'stroke')),
|
|
13
|
-
}));
|
|
14
|
-
|
|
15
|
-
export const Line = (props) => {
|
|
16
|
-
const {
|
|
17
|
-
className,
|
|
18
|
-
disabled,
|
|
19
|
-
correctness,
|
|
20
|
-
graphProps: { scale },
|
|
21
|
-
from,
|
|
22
|
-
to,
|
|
23
|
-
...rest
|
|
24
|
-
} = props;
|
|
25
|
-
const startPoint = { x: scale.x(from.x), y: scale.y(from.y) };
|
|
26
|
-
const endPoint = { x: scale.x(to.x), y: scale.y(to.y) };
|
|
27
|
-
const length = getDistanceBetweenTwoPoints(startPoint, endPoint);
|
|
28
|
-
|
|
29
|
-
return (
|
|
30
|
-
<StyledLine
|
|
31
|
-
className={className}
|
|
32
|
-
disabled={disabled}
|
|
33
|
-
correctness={correctness}
|
|
34
|
-
x1={startPoint.x}
|
|
35
|
-
y1={startPoint.y}
|
|
36
|
-
x2={endPoint.x}
|
|
37
|
-
y2={endPoint.y}
|
|
38
|
-
strokeDasharray={length - 7}
|
|
39
|
-
{...rest}
|
|
40
|
-
/>
|
|
41
|
-
);
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
Line.propTypes = {
|
|
45
|
-
className: PropTypes.string,
|
|
46
|
-
disabled: PropTypes.bool,
|
|
47
|
-
correctness: PropTypes.string,
|
|
48
|
-
graphProps: PropTypes.any,
|
|
49
|
-
from: types.PointType,
|
|
50
|
-
to: types.PointType,
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
const Vector = lineBase(Line, { to: Arrow });
|
|
54
|
-
const Component = lineToolComponent(Vector);
|
|
55
|
-
|
|
56
|
-
export default Component;
|