@pie-lib/graphing 4.0.5-next.3 → 4.0.5-next.30
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.18.1/node_modules/lodash/_Hash.js +21 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_ListCache.js +21 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_Map.js +10 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_MapCache.js +21 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_Symbol.js +9 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_assocIndexOf.js +14 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_baseGetTag.js +15 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_baseIsNative.js +16 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_coreJsData.js +9 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_freeGlobal.js +8 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_getMapData.js +14 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_getNative.js +15 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_getRawTag.js +19 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_getValue.js +11 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_hashClear.js +13 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_hashDelete.js +12 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_hashGet.js +18 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_hashHas.js +14 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_hashSet.js +14 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_isKeyable.js +12 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_isMasked.js +16 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_listCacheClear.js +11 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_listCacheDelete.js +14 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_listCacheGet.js +14 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_listCacheHas.js +13 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_listCacheSet.js +14 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_mapCacheClear.js +19 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_mapCacheDelete.js +14 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_mapCacheGet.js +13 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_mapCacheHas.js +13 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_mapCacheSet.js +14 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_nativeCreate.js +9 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_objectToString.js +12 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_root.js +10 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_toSource.js +20 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/eq.js +11 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/isFunction.js +16 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/isObject.js +12 -0
- package/dist/node_modules/.bun/lodash@4.18.1/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,146 +0,0 @@
|
|
|
1
|
-
import { render, screen } from '@pie-lib/test-utils';
|
|
2
|
-
import userEvent from '@testing-library/user-event';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
|
|
5
|
-
import { ToggleBar } from '../toggle-bar';
|
|
6
|
-
|
|
7
|
-
jest.mock('@pie-lib/drag', () => ({
|
|
8
|
-
DragProvider: ({ children }) => <div data-testid="drag-provider">{children}</div>,
|
|
9
|
-
}));
|
|
10
|
-
|
|
11
|
-
jest.mock('@dnd-kit/core', () => ({
|
|
12
|
-
useDraggable: jest.fn(() => ({
|
|
13
|
-
attributes: {
|
|
14
|
-
role: 'button',
|
|
15
|
-
tabIndex: 0,
|
|
16
|
-
},
|
|
17
|
-
listeners: {
|
|
18
|
-
onPointerDown: jest.fn(),
|
|
19
|
-
},
|
|
20
|
-
setNodeRef: jest.fn(),
|
|
21
|
-
transform: null,
|
|
22
|
-
transition: null,
|
|
23
|
-
isDragging: false,
|
|
24
|
-
})),
|
|
25
|
-
useDroppable: jest.fn(() => ({
|
|
26
|
-
setNodeRef: jest.fn(),
|
|
27
|
-
isOver: false,
|
|
28
|
-
active: null,
|
|
29
|
-
})),
|
|
30
|
-
}));
|
|
31
|
-
|
|
32
|
-
jest.mock('@dnd-kit/utilities', () => ({
|
|
33
|
-
CSS: {
|
|
34
|
-
Transform: {
|
|
35
|
-
toString: jest.fn((transform) => (transform ? 'translate3d(0, 0, 0)' : '')),
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
}));
|
|
39
|
-
|
|
40
|
-
jest.mock('@dnd-kit/sortable', () => ({
|
|
41
|
-
arrayMove: jest.fn((array, from, to) => {
|
|
42
|
-
const newArray = [...array];
|
|
43
|
-
const [removed] = newArray.splice(from, 1);
|
|
44
|
-
newArray.splice(to, 0, removed);
|
|
45
|
-
return newArray;
|
|
46
|
-
}),
|
|
47
|
-
}));
|
|
48
|
-
|
|
49
|
-
jest.mock('@pie-lib/translator', () => ({
|
|
50
|
-
translator: {
|
|
51
|
-
t: (key) => {
|
|
52
|
-
const parts = key.split('.');
|
|
53
|
-
return parts[parts.length - 1];
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
}));
|
|
57
|
-
|
|
58
|
-
describe('ToggleBar', () => {
|
|
59
|
-
let onChange = jest.fn();
|
|
60
|
-
let onChangeToolsOrder = jest.fn();
|
|
61
|
-
|
|
62
|
-
beforeEach(() => {
|
|
63
|
-
onChange.mockClear();
|
|
64
|
-
onChangeToolsOrder.mockClear();
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
const renderComponent = (extras) => {
|
|
68
|
-
const defaults = {
|
|
69
|
-
className: 'className',
|
|
70
|
-
onChange,
|
|
71
|
-
onChangeToolsOrder,
|
|
72
|
-
options: ['point', 'line'],
|
|
73
|
-
language: 'en',
|
|
74
|
-
};
|
|
75
|
-
const props = { ...defaults, ...extras };
|
|
76
|
-
return render(<ToggleBar {...props} />);
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
describe('rendering', () => {
|
|
80
|
-
it('renders without crashing', () => {
|
|
81
|
-
const { container } = renderComponent();
|
|
82
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
it('renders tool buttons for valid tools', () => {
|
|
86
|
-
renderComponent({ options: ['point', 'line', 'circle'] });
|
|
87
|
-
expect(screen.getByText(/point/i)).toBeInTheDocument();
|
|
88
|
-
expect(screen.getByText(/line/i)).toBeInTheDocument();
|
|
89
|
-
expect(screen.getByText(/circle/i)).toBeInTheDocument();
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
it('does not render invalid tool options', () => {
|
|
93
|
-
renderComponent({ options: ['point', 'invalid-tool', 'line'] });
|
|
94
|
-
expect(screen.getByText(/point/i)).toBeInTheDocument();
|
|
95
|
-
expect(screen.getByText(/line/i)).toBeInTheDocument();
|
|
96
|
-
expect(screen.queryByText(/invalid-tool/i)).not.toBeInTheDocument();
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
it('highlights selected tool', () => {
|
|
100
|
-
const { container } = renderComponent({ selectedToolType: 'line' });
|
|
101
|
-
const selectedButton = screen.getByText(/line/i).closest('button');
|
|
102
|
-
expect(selectedButton).toHaveAttribute('value', 'line');
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
describe('interactions', () => {
|
|
107
|
-
it('calls onChange when tool button is clicked', async () => {
|
|
108
|
-
const user = userEvent.setup();
|
|
109
|
-
renderComponent({ options: ['point', 'line'] });
|
|
110
|
-
|
|
111
|
-
const pointButton = screen.getByText(/point/i).closest('button');
|
|
112
|
-
await user.click(pointButton);
|
|
113
|
-
|
|
114
|
-
expect(onChange).toHaveBeenCalledWith('point');
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
it('calls onChange with selected tool type', async () => {
|
|
118
|
-
const user = userEvent.setup();
|
|
119
|
-
renderComponent({ options: ['point', 'line'], selectedToolType: 'point' });
|
|
120
|
-
|
|
121
|
-
const lineButton = screen.getByText(/line/i).closest('button');
|
|
122
|
-
await user.click(lineButton);
|
|
123
|
-
|
|
124
|
-
expect(onChange).toHaveBeenCalledWith('line');
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
it('disables buttons when disabled prop is true', () => {
|
|
128
|
-
renderComponent({ disabled: true, options: ['point', 'line'] });
|
|
129
|
-
|
|
130
|
-
const pointButton = screen.getByText(/point/i).closest('button');
|
|
131
|
-
const lineButton = screen.getByText(/line/i).closest('button');
|
|
132
|
-
|
|
133
|
-
expect(pointButton).toBeDisabled();
|
|
134
|
-
expect(lineButton).toBeDisabled();
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
it('does not call onChange when disabled', () => {
|
|
138
|
-
renderComponent({ disabled: true, options: ['point'] });
|
|
139
|
-
|
|
140
|
-
const pointButton = screen.getByText(/point/i).closest('button');
|
|
141
|
-
expect(pointButton).toBeDisabled();
|
|
142
|
-
// Note: Cannot test click on disabled button with pointer-events: none
|
|
143
|
-
// The disabled state is verified above
|
|
144
|
-
});
|
|
145
|
-
});
|
|
146
|
-
});
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import { render, screen } from '@pie-lib/test-utils';
|
|
2
|
-
import userEvent from '@testing-library/user-event';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
|
|
5
|
-
import ToolMenu from '../tool-menu';
|
|
6
|
-
|
|
7
|
-
jest.mock('@pie-lib/drag', () => ({
|
|
8
|
-
DragProvider: ({ children }) => <div data-testid="drag-provider">{children}</div>,
|
|
9
|
-
}));
|
|
10
|
-
|
|
11
|
-
jest.mock('@dnd-kit/core', () => ({
|
|
12
|
-
useDraggable: jest.fn(() => ({
|
|
13
|
-
attributes: {
|
|
14
|
-
role: 'button',
|
|
15
|
-
tabIndex: 0,
|
|
16
|
-
},
|
|
17
|
-
listeners: {
|
|
18
|
-
onPointerDown: jest.fn(),
|
|
19
|
-
},
|
|
20
|
-
setNodeRef: jest.fn(),
|
|
21
|
-
transform: null,
|
|
22
|
-
transition: null,
|
|
23
|
-
isDragging: false,
|
|
24
|
-
})),
|
|
25
|
-
useDroppable: jest.fn(() => ({
|
|
26
|
-
setNodeRef: jest.fn(),
|
|
27
|
-
isOver: false,
|
|
28
|
-
active: null,
|
|
29
|
-
})),
|
|
30
|
-
}));
|
|
31
|
-
|
|
32
|
-
jest.mock('@dnd-kit/utilities', () => ({
|
|
33
|
-
CSS: {
|
|
34
|
-
Transform: {
|
|
35
|
-
toString: jest.fn((transform) => (transform ? 'translate3d(0, 0, 0)' : '')),
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
}));
|
|
39
|
-
|
|
40
|
-
jest.mock('@dnd-kit/sortable', () => ({
|
|
41
|
-
arrayMove: jest.fn((array, from, to) => {
|
|
42
|
-
const newArray = [...array];
|
|
43
|
-
const [removed] = newArray.splice(from, 1);
|
|
44
|
-
newArray.splice(to, 0, removed);
|
|
45
|
-
return newArray;
|
|
46
|
-
}),
|
|
47
|
-
}));
|
|
48
|
-
|
|
49
|
-
describe('ToolMenu', () => {
|
|
50
|
-
let onChange = jest.fn();
|
|
51
|
-
let onChangeTools = jest.fn();
|
|
52
|
-
|
|
53
|
-
beforeEach(() => {
|
|
54
|
-
onChange.mockClear();
|
|
55
|
-
onChangeTools.mockClear();
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
const renderComponent = (extras) => {
|
|
59
|
-
const defaults = {
|
|
60
|
-
className: 'className',
|
|
61
|
-
onChange,
|
|
62
|
-
onChangeTools,
|
|
63
|
-
currentToolType: 'point',
|
|
64
|
-
toolbarTools: ['point', 'line'],
|
|
65
|
-
language: 'en',
|
|
66
|
-
};
|
|
67
|
-
const props = { ...defaults, ...extras };
|
|
68
|
-
return render(<ToolMenu {...props} />);
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
describe('rendering', () => {
|
|
72
|
-
it('renders without crashing', () => {
|
|
73
|
-
const { container } = renderComponent();
|
|
74
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
it('renders ToggleBar with correct props', () => {
|
|
78
|
-
renderComponent({ toolbarTools: ['point', 'line', 'circle'] });
|
|
79
|
-
expect(screen.getByText(/point/i)).toBeInTheDocument();
|
|
80
|
-
expect(screen.getByText(/line/i)).toBeInTheDocument();
|
|
81
|
-
expect(screen.getByText(/circle/i)).toBeInTheDocument();
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
it('passes currentToolType to ToggleBar', () => {
|
|
85
|
-
renderComponent({ currentToolType: 'line' });
|
|
86
|
-
const selectedButton = screen.getByText(/line/i).closest('button');
|
|
87
|
-
expect(selectedButton).toBeInTheDocument();
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
describe('interactions', () => {
|
|
92
|
-
it('calls onChange when tool is selected', async () => {
|
|
93
|
-
const user = userEvent.setup();
|
|
94
|
-
renderComponent();
|
|
95
|
-
|
|
96
|
-
const lineButton = screen.getByText(/line/i).closest('button');
|
|
97
|
-
await user.click(lineButton);
|
|
98
|
-
|
|
99
|
-
expect(onChange).toHaveBeenCalledWith('line');
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
it('calls onChangeTools when tools order changes', () => {
|
|
103
|
-
renderComponent({ draggableTools: true });
|
|
104
|
-
// Note: Drag-and-drop testing requires more complex setup with @dnd-kit/test-utils
|
|
105
|
-
// For now, we verify the component renders with draggableTools enabled
|
|
106
|
-
expect(screen.getByText(/point/i)).toBeInTheDocument();
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
it('disables tools when disabled prop is true', () => {
|
|
110
|
-
renderComponent({ disabled: true });
|
|
111
|
-
const pointButton = screen.getByText(/point/i).closest('button');
|
|
112
|
-
expect(pointButton).toBeDisabled();
|
|
113
|
-
});
|
|
114
|
-
});
|
|
115
|
-
});
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { render } from '@pie-lib/test-utils';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import UndoRedo from '../undo-redo';
|
|
4
|
-
|
|
5
|
-
describe('UndoRedo', () => {
|
|
6
|
-
let onUndo = jest.fn();
|
|
7
|
-
let onRedo = jest.fn();
|
|
8
|
-
let onReset = jest.fn();
|
|
9
|
-
const renderComponent = (extras) => {
|
|
10
|
-
const defaults = {
|
|
11
|
-
onUndo,
|
|
12
|
-
onRedo,
|
|
13
|
-
onReset,
|
|
14
|
-
};
|
|
15
|
-
const props = { ...defaults, ...extras };
|
|
16
|
-
return render(<UndoRedo {...props} />);
|
|
17
|
-
};
|
|
18
|
-
describe('rendering', () => {
|
|
19
|
-
it('renders without crashing', () => {
|
|
20
|
-
const { container } = renderComponent();
|
|
21
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
});
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
2
|
-
import { useDebounce } from '../use-debounce';
|
|
3
|
-
|
|
4
|
-
jest.useFakeTimers();
|
|
5
|
-
|
|
6
|
-
jest.mock('react', () => ({
|
|
7
|
-
useState: jest.fn(),
|
|
8
|
-
useEffect: jest.fn((fn, deps) => fn()),
|
|
9
|
-
}));
|
|
10
|
-
|
|
11
|
-
describe('useDebounce', () => {
|
|
12
|
-
it('..', () => {
|
|
13
|
-
const debouncedValue = null;
|
|
14
|
-
const setDebouncedValue = jest.fn();
|
|
15
|
-
|
|
16
|
-
useState.mockReturnValue([debouncedValue, setDebouncedValue]);
|
|
17
|
-
useDebounce('foo', 1000);
|
|
18
|
-
jest.runAllTimers();
|
|
19
|
-
expect(setDebouncedValue).toHaveBeenCalledWith('foo');
|
|
20
|
-
});
|
|
21
|
-
});
|
package/src/__tests__/utils.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
export const scaleMock = () => {
|
|
2
|
-
const fn = jest.fn((n) => n);
|
|
3
|
-
fn.invert = jest.fn((n) => n);
|
|
4
|
-
fn.domain = jest.fn(() => fn);
|
|
5
|
-
fn.range = jest.fn(() => fn);
|
|
6
|
-
fn.copy = jest.fn(() => scaleMock());
|
|
7
|
-
return fn;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export const graphProps = (dmin = 0, dmax = 1, rmin = 0, rmax = 1) => ({
|
|
11
|
-
scale: {
|
|
12
|
-
x: scaleMock(),
|
|
13
|
-
y: scaleMock(),
|
|
14
|
-
},
|
|
15
|
-
snap: {
|
|
16
|
-
x: jest.fn((n) => n),
|
|
17
|
-
y: jest.fn((n) => n),
|
|
18
|
-
},
|
|
19
|
-
domain: {
|
|
20
|
-
min: dmin,
|
|
21
|
-
max: dmax,
|
|
22
|
-
step: 1,
|
|
23
|
-
},
|
|
24
|
-
range: {
|
|
25
|
-
min: rmin,
|
|
26
|
-
max: rmax,
|
|
27
|
-
step: 1,
|
|
28
|
-
},
|
|
29
|
-
size: {
|
|
30
|
-
width: 400,
|
|
31
|
-
height: 400,
|
|
32
|
-
},
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
export const xy = (x, y, index) => {
|
|
36
|
-
const out = { x, y, index };
|
|
37
|
-
if (!Number.isFinite(index)) {
|
|
38
|
-
delete out.index;
|
|
39
|
-
}
|
|
40
|
-
return out;
|
|
41
|
-
};
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import * as utils from '../utils';
|
|
2
|
-
|
|
3
|
-
const xy = (x, y) => ({ x, y });
|
|
4
|
-
|
|
5
|
-
const tick = (isMajor, v) => ({
|
|
6
|
-
major: isMajor,
|
|
7
|
-
value: v,
|
|
8
|
-
x: v,
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
const major = tick.bind(null, true);
|
|
12
|
-
const minor = tick.bind(null, false);
|
|
13
|
-
|
|
14
|
-
describe('utils', () => {
|
|
15
|
-
describe('polygonToArea', () => {
|
|
16
|
-
const assertPolygon = (points, area) => {
|
|
17
|
-
it(`converts ${points} -> ${area}`, () => {
|
|
18
|
-
const result = utils.polygonToArea(points);
|
|
19
|
-
expect(result).toEqual(area);
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
assertPolygon([xy(0, 0), xy(1, 1), xy(1, -1)], {
|
|
23
|
-
left: 0,
|
|
24
|
-
top: 1,
|
|
25
|
-
bottom: -1,
|
|
26
|
-
right: 1,
|
|
27
|
-
});
|
|
28
|
-
assertPolygon([xy(0, 0), xy(3, 0), xy(2, -1), xy(4, -3), xy(1, -4), xy(2, -2)], {
|
|
29
|
-
left: 0,
|
|
30
|
-
top: 0,
|
|
31
|
-
bottom: -4,
|
|
32
|
-
right: 4,
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
describe('lineToArea', () => {
|
|
37
|
-
const assertLine = (from, to, expected) => {
|
|
38
|
-
it(`${from},${to} => ${expected}`, () => {
|
|
39
|
-
const result = utils.lineToArea(from, to);
|
|
40
|
-
expect(result).toEqual(expected);
|
|
41
|
-
});
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
assertLine(xy(1, 1), xy(2, 2), { left: 1, top: 2, bottom: 1, right: 2 });
|
|
45
|
-
assertLine(xy(-1, 4), xy(4, -3), {
|
|
46
|
-
left: -1,
|
|
47
|
-
top: 4,
|
|
48
|
-
bottom: -3,
|
|
49
|
-
right: 4,
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
describe('getTickValues', () => {
|
|
54
|
-
const assertGetTickValues = (props, expected) => {
|
|
55
|
-
it(` => ${expected}`, () => {
|
|
56
|
-
const result = utils.getTickValues(props);
|
|
57
|
-
expect(result).toEqual(expected);
|
|
58
|
-
});
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
assertGetTickValues({ min: 0, max: 10, step: 1 }, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
|
|
62
|
-
assertGetTickValues({ min: 0, max: 3, step: 0.5 }, [0, 0.5, 1, 1.5, 2, 2.5, 3]);
|
|
63
|
-
assertGetTickValues({ min: -0.2, max: 2, step: 0.6 }, [0, 0.6, 1.2, 1.8]);
|
|
64
|
-
assertGetTickValues({ min: -3.4, max: 6.2, step: 1.2 }, [0, -1.2, -2.4, 1.2, 2.4, 3.6, 4.8, 6]);
|
|
65
|
-
|
|
66
|
-
assertGetTickValues(
|
|
67
|
-
{ min: 0.6, max: 4.8, step: 0.3 },
|
|
68
|
-
[0.6, 0.9, 1.2, 1.5, 1.8, 2.1, 2.4, 2.7, 3.0, 3.3, 3.6, 3.9, 4.2, 4.5, 4.8],
|
|
69
|
-
);
|
|
70
|
-
assertGetTickValues(
|
|
71
|
-
{ min: 0.5, max: 4.9, step: 0.3 },
|
|
72
|
-
[0.6, 0.9, 1.2, 1.5, 1.8, 2.1, 2.4, 2.7, 3.0, 3.3, 3.6, 3.9, 4.2, 4.5, 4.8],
|
|
73
|
-
);
|
|
74
|
-
assertGetTickValues(
|
|
75
|
-
{ min: 0, max: 3, step: 0.125 },
|
|
76
|
-
[
|
|
77
|
-
0, 0.125, 0.25, 0.375, 0.5, 0.625, 0.75, 0.875, 1, 1.125, 1.25, 1.375, 1.5, 1.625, 1.75, 1.875, 2, 2.125, 2.25,
|
|
78
|
-
2.375, 2.5, 2.625, 2.75, 2.875, 3,
|
|
79
|
-
],
|
|
80
|
-
);
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
describe('countWords', () => {
|
|
84
|
-
it('should return 1 if label is undefined', () => {
|
|
85
|
-
const label = undefined;
|
|
86
|
-
const result = utils.countWords(label);
|
|
87
|
-
|
|
88
|
-
expect(result).toEqual(1);
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
it('should return 1 if label is null', () => {
|
|
92
|
-
const label = null;
|
|
93
|
-
const result = utils.countWords(label);
|
|
94
|
-
|
|
95
|
-
expect(result).toEqual(1);
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
it('should return 3 if label has 3 words', () => {
|
|
99
|
-
const label = 'Number of months';
|
|
100
|
-
const result = utils.countWords(label);
|
|
101
|
-
|
|
102
|
-
expect(result).toEqual(3);
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
});
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { render } from '@pie-lib/test-utils';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { Arrow } from '../arrow';
|
|
4
|
-
|
|
5
|
-
describe('Arrow', () => {
|
|
6
|
-
let onChange = jest.fn();
|
|
7
|
-
const renderComponent = (extras) => {
|
|
8
|
-
const defaults = {
|
|
9
|
-
classes: {},
|
|
10
|
-
className: 'className',
|
|
11
|
-
onChange,
|
|
12
|
-
scale: {
|
|
13
|
-
x: jest.fn((n) => n),
|
|
14
|
-
y: jest.fn((n) => n),
|
|
15
|
-
},
|
|
16
|
-
};
|
|
17
|
-
const props = { ...defaults, ...extras };
|
|
18
|
-
return render(<Arrow {...props} />);
|
|
19
|
-
};
|
|
20
|
-
describe('rendering', () => {
|
|
21
|
-
it('renders with direction up', () => {
|
|
22
|
-
const { container } = renderComponent({ direction: 'up' });
|
|
23
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
24
|
-
});
|
|
25
|
-
it('renders with direction down', () => {
|
|
26
|
-
const { container } = renderComponent({ direction: 'down' });
|
|
27
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
28
|
-
});
|
|
29
|
-
it('renders with direction left', () => {
|
|
30
|
-
const { container } = renderComponent({ direction: 'left' });
|
|
31
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
32
|
-
});
|
|
33
|
-
it('renders with direction right', () => {
|
|
34
|
-
const { container } = renderComponent({ direction: 'right' });
|
|
35
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
});
|
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
import { render } from '@pie-lib/test-utils';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { graphProps } from '../../__tests__/utils';
|
|
4
|
-
|
|
5
|
-
import Axes, { firstNegativeValue, RawXAxis, RawYAxis, sharedValues } from '../axes';
|
|
6
|
-
|
|
7
|
-
describe('RawXAxis', () => {
|
|
8
|
-
let onChange = jest.fn();
|
|
9
|
-
const renderComponent = (extras) => {
|
|
10
|
-
const defaults = {
|
|
11
|
-
classes: {},
|
|
12
|
-
className: 'className',
|
|
13
|
-
onChange,
|
|
14
|
-
graphProps: graphProps(),
|
|
15
|
-
includeArrows: {
|
|
16
|
-
left: true,
|
|
17
|
-
right: true,
|
|
18
|
-
up: true,
|
|
19
|
-
down: true,
|
|
20
|
-
},
|
|
21
|
-
columnTicksValues: [-1, 0, 1],
|
|
22
|
-
skipValues: [],
|
|
23
|
-
distanceFromOriginToFirstNegativeY: 0,
|
|
24
|
-
dy: 0,
|
|
25
|
-
};
|
|
26
|
-
const props = { ...defaults, ...extras };
|
|
27
|
-
return render(<RawXAxis {...props} />);
|
|
28
|
-
};
|
|
29
|
-
describe('rendering', () => {
|
|
30
|
-
it('renders without crashing', () => {
|
|
31
|
-
const { container } = renderComponent();
|
|
32
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
describe('RawYAxis', () => {
|
|
38
|
-
let onChange = jest.fn();
|
|
39
|
-
const renderComponent = (extras) => {
|
|
40
|
-
const defaults = {
|
|
41
|
-
classes: {},
|
|
42
|
-
className: 'className',
|
|
43
|
-
onChange,
|
|
44
|
-
graphProps: graphProps(),
|
|
45
|
-
includeArrows: {
|
|
46
|
-
left: true,
|
|
47
|
-
right: true,
|
|
48
|
-
up: true,
|
|
49
|
-
down: true,
|
|
50
|
-
},
|
|
51
|
-
rowTickValues: [-1, 0, 1],
|
|
52
|
-
skipValues: [],
|
|
53
|
-
};
|
|
54
|
-
const props = { ...defaults, ...extras };
|
|
55
|
-
return render(<RawYAxis {...props} />);
|
|
56
|
-
};
|
|
57
|
-
describe('rendering', () => {
|
|
58
|
-
it('renders without crashing', () => {
|
|
59
|
-
const { container } = renderComponent();
|
|
60
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
const customScaleMock = (distance) => {
|
|
66
|
-
const fn = jest.fn((n) => n * distance);
|
|
67
|
-
fn.invert = jest.fn((n) => n * distance);
|
|
68
|
-
fn.domain = jest.fn(() => fn);
|
|
69
|
-
fn.range = jest.fn(() => fn);
|
|
70
|
-
fn.copy = jest.fn(() => customScaleMock(distance));
|
|
71
|
-
return fn;
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
describe('Axes', () => {
|
|
75
|
-
let onChange = jest.fn();
|
|
76
|
-
|
|
77
|
-
const customGraphProps = {
|
|
78
|
-
...graphProps(),
|
|
79
|
-
domain: {
|
|
80
|
-
min: -2,
|
|
81
|
-
max: 2,
|
|
82
|
-
labelStep: 1,
|
|
83
|
-
step: 1,
|
|
84
|
-
},
|
|
85
|
-
range: {
|
|
86
|
-
min: -2,
|
|
87
|
-
max: 2,
|
|
88
|
-
step: 1,
|
|
89
|
-
labelStep: 1,
|
|
90
|
-
},
|
|
91
|
-
scale: {
|
|
92
|
-
x: customScaleMock(200),
|
|
93
|
-
y: customScaleMock(150),
|
|
94
|
-
},
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
const renderComponent = (extras) => {
|
|
98
|
-
const defaults = {
|
|
99
|
-
classes: {},
|
|
100
|
-
className: 'className',
|
|
101
|
-
onChange,
|
|
102
|
-
graphProps: customGraphProps,
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
const props = { ...defaults, ...extras };
|
|
106
|
-
return render(<Axes {...props} />);
|
|
107
|
-
};
|
|
108
|
-
describe('rendering', () => {
|
|
109
|
-
it('renders without crashing', () => {
|
|
110
|
-
const { container } = renderComponent();
|
|
111
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
112
|
-
});
|
|
113
|
-
});
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
describe('firstNegativeValue', () => {
|
|
117
|
-
it('should return undefined for undefined interval', () => {
|
|
118
|
-
const interval = undefined;
|
|
119
|
-
const result = firstNegativeValue(interval);
|
|
120
|
-
expect(result).toEqual(undefined);
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
it('should return undefined for empty interval', () => {
|
|
124
|
-
const interval = [];
|
|
125
|
-
const result = firstNegativeValue(interval);
|
|
126
|
-
expect(result).toEqual(undefined);
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
it('should return undefined if there is no negative in interval array', () => {
|
|
130
|
-
const interval = [1, 5, 7, 4, 5];
|
|
131
|
-
const result = firstNegativeValue(interval);
|
|
132
|
-
expect(result).toEqual(undefined);
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
it('should return first negative number from interval', () => {
|
|
136
|
-
const interval = [1, 5, 7, -2, 4, 5, -1];
|
|
137
|
-
const result = firstNegativeValue(interval);
|
|
138
|
-
expect(result).toEqual(-2);
|
|
139
|
-
});
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
describe('sharedValues', () => {
|
|
143
|
-
it('should be empty array if firstNegativeValue for one of the axes is undefined', () => {
|
|
144
|
-
// x
|
|
145
|
-
const intervalX = [1, 2, 3, 4, 5, 6];
|
|
146
|
-
const firstNegativeX = firstNegativeValue(intervalX);
|
|
147
|
-
const distanceFromOriginToFirstNegativeX = -22;
|
|
148
|
-
|
|
149
|
-
// y
|
|
150
|
-
const intervalY = [-1, -2, 1, 2, 3, 4, 5, 6];
|
|
151
|
-
const firstNegativeY = firstNegativeValue(intervalY);
|
|
152
|
-
const distanceFromOriginToFirstNegativeY = -22;
|
|
153
|
-
|
|
154
|
-
const deltaAllowance = 5;
|
|
155
|
-
|
|
156
|
-
const result = sharedValues(
|
|
157
|
-
firstNegativeX,
|
|
158
|
-
firstNegativeY,
|
|
159
|
-
distanceFromOriginToFirstNegativeX,
|
|
160
|
-
distanceFromOriginToFirstNegativeY,
|
|
161
|
-
deltaAllowance,
|
|
162
|
-
);
|
|
163
|
-
|
|
164
|
-
expect(result).toEqual([]);
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
it('should be empty array if firstNegativeX and firstNegativeY are equal but they do not overlap', () => {
|
|
168
|
-
// x
|
|
169
|
-
const intervalX = [-1, -2, 1, 2, 3, 4, 5, 6];
|
|
170
|
-
const firstNegativeX = firstNegativeValue(intervalX);
|
|
171
|
-
const distanceFromOriginToFirstNegativeX = -7;
|
|
172
|
-
|
|
173
|
-
// y
|
|
174
|
-
const intervalY = [-1, -2, 1, 2, 3, 4, 5, 6];
|
|
175
|
-
const firstNegativeY = firstNegativeValue(intervalY);
|
|
176
|
-
const distanceFromOriginToFirstNegativeY = -22;
|
|
177
|
-
|
|
178
|
-
const deltaAllowance = 5;
|
|
179
|
-
|
|
180
|
-
const result = sharedValues(
|
|
181
|
-
firstNegativeX,
|
|
182
|
-
firstNegativeY,
|
|
183
|
-
distanceFromOriginToFirstNegativeX,
|
|
184
|
-
distanceFromOriginToFirstNegativeY,
|
|
185
|
-
deltaAllowance,
|
|
186
|
-
);
|
|
187
|
-
|
|
188
|
-
expect(result).toEqual([]);
|
|
189
|
-
});
|
|
190
|
-
|
|
191
|
-
it('should be -1 if firstNegativeX and firstNegativeY are equal and they overlap', () => {
|
|
192
|
-
// x
|
|
193
|
-
const intervalX = [-1, -2, 1, 2, 3, 4, 5, 6];
|
|
194
|
-
const firstNegativeX = firstNegativeValue(intervalX);
|
|
195
|
-
const distanceFromOriginToFirstNegativeX = -20;
|
|
196
|
-
|
|
197
|
-
// y
|
|
198
|
-
const intervalY = [-1, -2, 1, 2, 3, 4, 5, 6];
|
|
199
|
-
const firstNegativeY = firstNegativeValue(intervalY);
|
|
200
|
-
const distanceFromOriginToFirstNegativeY = -22;
|
|
201
|
-
|
|
202
|
-
const deltaAllowance = 5;
|
|
203
|
-
const dy = -20; // dy needs to be within the range for the condition to pass
|
|
204
|
-
|
|
205
|
-
const result = sharedValues(
|
|
206
|
-
firstNegativeX,
|
|
207
|
-
firstNegativeY,
|
|
208
|
-
distanceFromOriginToFirstNegativeX,
|
|
209
|
-
distanceFromOriginToFirstNegativeY,
|
|
210
|
-
deltaAllowance,
|
|
211
|
-
dy,
|
|
212
|
-
);
|
|
213
|
-
|
|
214
|
-
expect(result).toEqual([-1]);
|
|
215
|
-
});
|
|
216
|
-
});
|