@pie-lib/graphing-solution-set 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/_rolldown/runtime.js +23 -0
- package/dist/axis/arrow.d.ts +14 -0
- package/dist/axis/arrow.d.ts.map +1 -0
- package/dist/axis/arrow.js +34 -0
- package/dist/axis/axes.d.ts +133 -0
- package/dist/axis/axes.d.ts.map +1 -0
- package/dist/axis/axes.js +214 -0
- package/dist/axis/index.d.ts +11 -0
- package/dist/axis/index.d.ts.map +1 -0
- package/dist/bg.d.ts +52 -0
- package/dist/bg.d.ts.map +1 -0
- package/dist/bg.js +44 -0
- package/dist/container/actions.d.ts +16 -0
- package/dist/container/actions.d.ts.map +1 -0
- package/dist/container/actions.js +7 -0
- package/dist/container/index.d.ts +27 -0
- package/dist/container/index.d.ts.map +1 -0
- package/dist/container/index.js +48 -0
- package/dist/container/marks.d.ts +11 -0
- package/dist/container/marks.d.ts.map +1 -0
- package/dist/container/marks.js +11 -0
- package/dist/container/middleware.d.ts +11 -0
- package/dist/container/middleware.d.ts.map +1 -0
- package/dist/container/middleware.js +4 -0
- package/dist/container/reducer.d.ts +13 -0
- package/dist/container/reducer.d.ts.map +1 -0
- package/dist/container/reducer.js +7 -0
- package/dist/coordinates-label.d.ts +50 -0
- package/dist/coordinates-label.d.ts.map +1 -0
- package/dist/coordinates-label.js +46 -0
- package/dist/graph-with-controls.d.ts +86 -0
- package/dist/graph-with-controls.d.ts.map +1 -0
- package/dist/graph-with-controls.js +155 -0
- package/dist/graph.d.ts +120 -0
- package/dist/graph.d.ts.map +1 -0
- package/dist/graph.js +221 -0
- package/dist/grid-setup.d.ts +27 -0
- package/dist/grid-setup.d.ts.map +1 -0
- package/dist/grid-setup.js +307 -0
- package/dist/grid.d.ts +44 -0
- package/dist/grid.d.ts.map +1 -0
- package/dist/grid.js +59 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/labels.d.ts +74 -0
- package/dist/labels.d.ts.map +1 -0
- package/dist/labels.js +134 -0
- package/dist/mark-label.d.ts +50 -0
- package/dist/mark-label.d.ts.map +1 -0
- package/dist/mark-label.js +84 -0
- package/dist/node_modules/.bun/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js +7 -0
- package/dist/node_modules/.bun/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/defineProperty.js +12 -0
- package/dist/node_modules/.bun/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/extends.js +12 -0
- package/dist/node_modules/.bun/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js +7 -0
- package/dist/node_modules/.bun/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/objectSpread2.js +25 -0
- package/dist/node_modules/.bun/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js +12 -0
- package/dist/node_modules/.bun/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js +8 -0
- package/dist/node_modules/.bun/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/toPrimitive.js +14 -0
- package/dist/node_modules/.bun/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js +9 -0
- package/dist/node_modules/.bun/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/typeof.js +11 -0
- package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/axis/Axis.js +100 -0
- package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/axis/AxisRenderer.js +61 -0
- package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/axis/Ticks.js +42 -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_grid@3.12.0_f4eacebf2041cd4f/node_modules/@visx/grid/esm/grids/Grid.js +78 -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 +49 -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 +46 -0
- package/dist/node_modules/.bun/@visx_shape@3.12.0_f4eacebf2041cd4f/node_modules/@visx/shape/lib/shapes/Line.js +52 -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/hoist-non-react-statics@3.3.2/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js +68 -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-input-autosize@2.2.2_f4eacebf2041cd4f/node_modules/react-input-autosize/lib/AutosizeInput.js +216 -0
- package/dist/node_modules/.bun/react-is@16.13.1/node_modules/react-is/cjs/react-is.development.js +82 -0
- package/dist/node_modules/.bun/react-is@16.13.1/node_modules/react-is/cjs/react-is.production.min.js +62 -0
- package/dist/node_modules/.bun/react-is@16.13.1/node_modules/react-is/index.js +10 -0
- package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/components/Context.js +5 -0
- package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/components/Provider.js +47 -0
- package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/components/connectAdvanced.js +95 -0
- package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/connect/connect.js +52 -0
- package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/connect/mapDispatchToProps.js +23 -0
- package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/connect/mapStateToProps.js +13 -0
- package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/connect/mergeProps.js +26 -0
- package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/connect/selectorFactory.js +41 -0
- package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/connect/verifySubselectors.js +11 -0
- package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/connect/wrapMapToProps.js +28 -0
- package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/index.js +4 -0
- package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/utils/isPlainObject.js +10 -0
- package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/utils/shallowEqual.js +15 -0
- package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/utils/verifyPlainObject.js +8 -0
- package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/utils/warning.js +9 -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@4.2.1/node_modules/redux/es/redux.js +225 -0
- package/dist/toggle-bar.d.ts +41 -0
- package/dist/toggle-bar.d.ts.map +1 -0
- package/dist/tool-menu.d.ts +22 -0
- package/dist/tool-menu.d.ts.map +1 -0
- package/dist/tool-menu.js +188 -0
- package/dist/tools/index.d.ts +18 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +12 -0
- package/dist/tools/line/component.d.ts +92 -0
- package/dist/tools/line/component.d.ts.map +1 -0
- package/dist/tools/line/component.js +58 -0
- package/dist/tools/line/index.d.ts +14 -0
- package/dist/tools/line/index.d.ts.map +1 -0
- package/dist/tools/line/index.js +6 -0
- package/dist/tools/polygon/component.d.ts +115 -0
- package/dist/tools/polygon/component.d.ts.map +1 -0
- package/dist/tools/polygon/component.js +194 -0
- package/dist/tools/polygon/index.d.ts +20 -0
- package/dist/tools/polygon/index.d.ts.map +1 -0
- package/dist/tools/polygon/index.js +55 -0
- package/dist/tools/polygon/line.d.ts +105 -0
- package/dist/tools/polygon/line.d.ts.map +1 -0
- package/dist/tools/polygon/polygon.d.ts +102 -0
- package/dist/tools/polygon/polygon.d.ts.map +1 -0
- package/dist/tools/polygon/polygon.js +62 -0
- package/dist/tools/shared/arrow-head.d.ts +43 -0
- package/dist/tools/shared/arrow-head.d.ts.map +1 -0
- package/dist/tools/shared/arrow-head.js +37 -0
- package/dist/tools/shared/line/index.d.ts +165 -0
- package/dist/tools/shared/line/index.d.ts.map +1 -0
- package/dist/tools/shared/line/index.js +320 -0
- package/dist/tools/shared/line/line-path.d.ts +58 -0
- package/dist/tools/shared/line/line-path.d.ts.map +1 -0
- package/dist/tools/shared/line/with-root-edge.d.ts +89 -0
- package/dist/tools/shared/line/with-root-edge.d.ts.map +1 -0
- package/dist/tools/shared/point/arrow-point.d.ts +58 -0
- package/dist/tools/shared/point/arrow-point.d.ts.map +1 -0
- package/dist/tools/shared/point/arrow-point.js +47 -0
- package/dist/tools/shared/point/arrow.d.ts +47 -0
- package/dist/tools/shared/point/arrow.d.ts.map +1 -0
- package/dist/tools/shared/point/arrow.js +36 -0
- package/dist/tools/shared/point/base-point.d.ts +51 -0
- package/dist/tools/shared/point/base-point.d.ts.map +1 -0
- package/dist/tools/shared/point/base-point.js +88 -0
- package/dist/tools/shared/point/index.d.ts +154 -0
- package/dist/tools/shared/point/index.d.ts.map +1 -0
- package/dist/tools/shared/point/index.js +51 -0
- package/dist/tools/shared/styles.d.ts +25 -0
- package/dist/tools/shared/styles.d.ts.map +1 -0
- package/dist/tools/shared/styles.js +17 -0
- package/dist/tools/shared/types.d.ts +16 -0
- package/dist/tools/shared/types.d.ts.map +1 -0
- package/dist/tools/shared/types.js +10 -0
- package/dist/undo-redo.d.ts +21 -0
- package/dist/undo-redo.d.ts.map +1 -0
- package/dist/undo-redo.js +33 -0
- package/dist/use-debounce.d.ts +10 -0
- package/dist/use-debounce.d.ts.map +1 -0
- package/dist/use-debounce.js +13 -0
- package/dist/utils.d.ts +59 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +72 -0
- package/package.json +64 -0
- package/src/axis/arrow.tsx +67 -0
- package/src/axis/axes.tsx +321 -0
- package/src/axis/index.ts +13 -0
- package/src/bg.tsx +106 -0
- package/src/container/actions.ts +18 -0
- package/src/container/index.tsx +95 -0
- package/src/container/marks.ts +24 -0
- package/src/container/middleware.ts +17 -0
- package/src/container/reducer.ts +15 -0
- package/src/coordinates-label.tsx +72 -0
- package/src/graph-with-controls.tsx +252 -0
- package/src/graph.tsx +343 -0
- package/src/grid-setup.tsx +470 -0
- package/src/grid.tsx +143 -0
- package/src/index.ts +17 -0
- package/src/labels.tsx +211 -0
- package/src/mark-label.tsx +135 -0
- package/src/toggle-bar.tsx +231 -0
- package/src/tool-menu.tsx +245 -0
- package/src/tools/index.ts +18 -0
- package/src/tools/line/component.tsx +87 -0
- package/src/tools/line/index.ts +14 -0
- package/src/tools/polygon/component.tsx +334 -0
- package/src/tools/polygon/index.ts +62 -0
- package/src/tools/polygon/line.tsx +90 -0
- package/src/tools/polygon/polygon.tsx +103 -0
- package/src/tools/shared/arrow-head.tsx +56 -0
- package/src/tools/shared/line/index.tsx +481 -0
- package/src/tools/shared/line/line-path.tsx +95 -0
- package/src/tools/shared/line/with-root-edge.tsx +107 -0
- package/src/tools/shared/point/arrow-point.tsx +70 -0
- package/src/tools/shared/point/arrow.tsx +50 -0
- package/src/tools/shared/point/base-point.tsx +123 -0
- package/src/tools/shared/point/index.tsx +68 -0
- package/src/tools/shared/styles.ts +30 -0
- package/src/tools/shared/types.ts +18 -0
- package/src/undo-redo.tsx +47 -0
- package/src/use-debounce.ts +23 -0
- package/src/utils.ts +240 -0
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { __toESM as e } from "../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { require_browser as t } from "../../node_modules/.bun/invariant@2.2.4/node_modules/invariant/browser.js";
|
|
3
|
+
import { equalPoints as n, getMiddleOfTwoPoints as r, getRightestPoints as i } from "../../utils.js";
|
|
4
|
+
import { ToolPropTypeFields as a } from "../shared/types.js";
|
|
5
|
+
import o from "./polygon.js";
|
|
6
|
+
import s from "../../mark-label.js";
|
|
7
|
+
import c from "react";
|
|
8
|
+
import l from "prop-types";
|
|
9
|
+
import { chunk as u, isEmpty as d } from "lodash-es";
|
|
10
|
+
import { types as f } from "@pie-lib/plot";
|
|
11
|
+
import p from "debug";
|
|
12
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
13
|
+
import h from "react-dom";
|
|
14
|
+
//#region src/tools/polygon/component.tsx
|
|
15
|
+
var g = /* @__PURE__ */ e(t(), 1), _ = p("pie-lib:graphing-solution-set:polygon"), v = (e, ...t) => u(t, 2).reduce((e, t) => {
|
|
16
|
+
if (t.length === 2) {
|
|
17
|
+
let [n, r] = t;
|
|
18
|
+
(0, g.default)(Number.isFinite(n.index), "Index must be defined");
|
|
19
|
+
let i = n.index;
|
|
20
|
+
return i >= 0 && e.splice(i, 1, r), e;
|
|
21
|
+
} else return e;
|
|
22
|
+
}, [...e]), y = class extends c.Component {
|
|
23
|
+
static propTypes = {
|
|
24
|
+
className: l.string,
|
|
25
|
+
disabled: l.bool,
|
|
26
|
+
correctness: l.string,
|
|
27
|
+
points: l.arrayOf(f.PointType),
|
|
28
|
+
closed: l.bool,
|
|
29
|
+
isSolution: l.bool,
|
|
30
|
+
coordinatesOnHover: l.bool,
|
|
31
|
+
onChange: l.func.isRequired,
|
|
32
|
+
onClosePolygon: l.func.isRequired,
|
|
33
|
+
onDragStart: l.func,
|
|
34
|
+
onDragStop: l.func,
|
|
35
|
+
onClick: l.func,
|
|
36
|
+
graphProps: f.GraphPropsType.isRequired,
|
|
37
|
+
isToolActive: l.bool,
|
|
38
|
+
middle: l.object,
|
|
39
|
+
labelNode: l.object,
|
|
40
|
+
labelModeEnabled: l.bool,
|
|
41
|
+
onChangeLabelProps: l.func,
|
|
42
|
+
onChangeProps: l.func
|
|
43
|
+
};
|
|
44
|
+
static defaultProps = { points: [] };
|
|
45
|
+
dragPoint = (e, t, r) => {
|
|
46
|
+
_("[dragPoint] from, to:", t, r);
|
|
47
|
+
let { onChange: i, points: a } = this.props, o = [...a], s = !!(a || []).find((e) => n(e, r));
|
|
48
|
+
n(t, r) || s || (a[e].label && (r.label = a[e].label), o.splice(e, 1, r), i(o));
|
|
49
|
+
};
|
|
50
|
+
dragLine = (e, t) => {
|
|
51
|
+
_("[dragLine]: ", e, t);
|
|
52
|
+
let { onChange: n } = this.props;
|
|
53
|
+
e.from.label && (t.from.label = e.from.label), e.to.label && (t.to.label = e.to.label), n(v(this.props.points, e.from, t.from, e.to, t.to));
|
|
54
|
+
};
|
|
55
|
+
dragPoly = (e, t) => {
|
|
56
|
+
_("[dragPoly] ", e, t);
|
|
57
|
+
let { onChange: n } = this.props;
|
|
58
|
+
t.forEach((n, r) => {
|
|
59
|
+
e[r].label && (t[r].label = e[r].label);
|
|
60
|
+
}), n(t);
|
|
61
|
+
};
|
|
62
|
+
close = () => {
|
|
63
|
+
let { points: e, onClosePolygon: t } = this.props;
|
|
64
|
+
_("[close] ..."), e.length >= 3 ? t() : _("[close] - nope");
|
|
65
|
+
};
|
|
66
|
+
labelChange = (e, t) => {
|
|
67
|
+
let { points: n, onChangeProps: r } = this.props, i = { ...e };
|
|
68
|
+
(!e.label || d(e.label)) && delete i.label;
|
|
69
|
+
let a = [...n];
|
|
70
|
+
a.splice(t, 1, i), r(a);
|
|
71
|
+
};
|
|
72
|
+
clickPoint = (e, t, n) => {
|
|
73
|
+
let { closed: a, disabled: o, onClick: s, isToolActive: c, labelModeEnabled: l, onChangeProps: u, onChangeLabelProps: d, points: f } = this.props;
|
|
74
|
+
if (l) {
|
|
75
|
+
if (o) return;
|
|
76
|
+
if (f && t === f.length) {
|
|
77
|
+
let { a: t, b: n } = i(f);
|
|
78
|
+
d({
|
|
79
|
+
label: "",
|
|
80
|
+
...e,
|
|
81
|
+
...r(t, n)
|
|
82
|
+
});
|
|
83
|
+
} else {
|
|
84
|
+
let n = [...f];
|
|
85
|
+
n.splice(t, 1, {
|
|
86
|
+
label: "",
|
|
87
|
+
...e
|
|
88
|
+
}), u(n);
|
|
89
|
+
}
|
|
90
|
+
this.input[t] && this.input[t].focus();
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
if (c && !a && t === 0) {
|
|
94
|
+
this.close();
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
s(e || n);
|
|
98
|
+
};
|
|
99
|
+
input = {};
|
|
100
|
+
render() {
|
|
101
|
+
let { closed: e, graphProps: t, onChangeLabelProps: n, points: r, middle: i, labelNode: a, labelModeEnabled: l, isSolution: u = !1 } = this.props, d = r && r.length || 0;
|
|
102
|
+
return a && i && Object.prototype.hasOwnProperty.call(i, "label") && h.createPortal(/* @__PURE__ */ m(s, {
|
|
103
|
+
inputRef: (e) => this.input[d] = e,
|
|
104
|
+
disabled: !l,
|
|
105
|
+
mark: i,
|
|
106
|
+
graphProps: t,
|
|
107
|
+
onChange: (e) => n({
|
|
108
|
+
...i,
|
|
109
|
+
label: e
|
|
110
|
+
})
|
|
111
|
+
}), a), /* @__PURE__ */ m("g", { children: /* @__PURE__ */ m(c.Fragment, { children: /* @__PURE__ */ m(o, {
|
|
112
|
+
points: r,
|
|
113
|
+
closed: e,
|
|
114
|
+
isSolution: u,
|
|
115
|
+
graphProps: t,
|
|
116
|
+
onClick: this.clickPoint.bind(this, i, d)
|
|
117
|
+
}) }) });
|
|
118
|
+
}
|
|
119
|
+
}, b = class extends c.Component {
|
|
120
|
+
static propTypes = {
|
|
121
|
+
...a,
|
|
122
|
+
graphProps: f.GraphPropsType.isRequired
|
|
123
|
+
};
|
|
124
|
+
static defaultProps = {};
|
|
125
|
+
constructor(e) {
|
|
126
|
+
super(e), this.state = {};
|
|
127
|
+
}
|
|
128
|
+
change = (e) => {
|
|
129
|
+
let { mark: { middle: t } } = this.props, n = {
|
|
130
|
+
...this.state.mark,
|
|
131
|
+
points: e
|
|
132
|
+
};
|
|
133
|
+
if (t) {
|
|
134
|
+
let { a, b: o } = i(e);
|
|
135
|
+
n.middle = {
|
|
136
|
+
...t,
|
|
137
|
+
...r(a, o)
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
this.setState({ mark: n });
|
|
141
|
+
};
|
|
142
|
+
changeProps = (e) => {
|
|
143
|
+
let t = {
|
|
144
|
+
...this.props.mark,
|
|
145
|
+
points: e
|
|
146
|
+
};
|
|
147
|
+
this.props.onChange(this.props.mark, t);
|
|
148
|
+
};
|
|
149
|
+
changeLabelProps = (e) => {
|
|
150
|
+
let { mark: t, onChange: n } = this.props, r = {
|
|
151
|
+
...t.middle,
|
|
152
|
+
...e
|
|
153
|
+
};
|
|
154
|
+
n(t, {
|
|
155
|
+
...t,
|
|
156
|
+
middle: r
|
|
157
|
+
});
|
|
158
|
+
};
|
|
159
|
+
closePolygon = () => {
|
|
160
|
+
_("[closePolygon] ...");
|
|
161
|
+
let { onComplete: e, mark: t } = this.props;
|
|
162
|
+
e(t, {
|
|
163
|
+
...t,
|
|
164
|
+
closed: !0
|
|
165
|
+
});
|
|
166
|
+
};
|
|
167
|
+
dragStart = () => this.setState({ mark: this.props.mark });
|
|
168
|
+
dragStop = () => {
|
|
169
|
+
let { onChange: e } = this.props, t = { ...this.state.mark };
|
|
170
|
+
this.setState({ mark: void 0 }, () => {
|
|
171
|
+
e(this.props.mark, t);
|
|
172
|
+
});
|
|
173
|
+
};
|
|
174
|
+
render() {
|
|
175
|
+
let { coordinatesOnHover: e, mark: t, graphProps: n, onClick: r, isToolActive: i, labelNode: a, labelModeEnabled: o } = this.props, { mark: s } = this.state;
|
|
176
|
+
return /* @__PURE__ */ m(y, {
|
|
177
|
+
...s || t,
|
|
178
|
+
coordinatesOnHover: e,
|
|
179
|
+
onChange: this.change,
|
|
180
|
+
onChangeLabelProps: this.changeLabelProps,
|
|
181
|
+
onChangeProps: this.changeProps,
|
|
182
|
+
onClosePolygon: this.closePolygon,
|
|
183
|
+
onDragStart: this.dragStart,
|
|
184
|
+
onDragStop: this.dragStop,
|
|
185
|
+
onClick: r,
|
|
186
|
+
graphProps: n,
|
|
187
|
+
isToolActive: i,
|
|
188
|
+
labelNode: a,
|
|
189
|
+
labelModeEnabled: o
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
//#endregion
|
|
194
|
+
export { b as default };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/graphing-solution-set/src/tools/polygon/index.js
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*
|
|
5
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
+
* Manual edits will be overwritten on next sync.
|
|
7
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
+
*/
|
|
9
|
+
import Polygon from './component.js';
|
|
10
|
+
export declare const addPointToArray: (point: any, arr: any) => {
|
|
11
|
+
points: any;
|
|
12
|
+
closed: any;
|
|
13
|
+
} | undefined;
|
|
14
|
+
export declare const tool: () => {
|
|
15
|
+
type: string;
|
|
16
|
+
Component: typeof Polygon;
|
|
17
|
+
complete: (data: any, mark: any) => any;
|
|
18
|
+
addPoint: (point: any, mark: any) => any;
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/polygon/index.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,OAAO,MAAM,gBAAgB,CAAC;AAGrC,eAAO,MAAM,eAAe,GAAI,UAAK,EAAE,QAAG;;;aA0BzC,CAAC;AAEF,eAAO,MAAM,IAAI;;;;;CAoBf,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { equalPoints as e } from "../../utils.js";
|
|
2
|
+
import t from "./component.js";
|
|
3
|
+
//#region src/tools/polygon/index.ts
|
|
4
|
+
var n = (t, n) => {
|
|
5
|
+
if (n ||= [], n.length === 0) return {
|
|
6
|
+
points: [t],
|
|
7
|
+
closed: !1
|
|
8
|
+
};
|
|
9
|
+
if (n.length === 1) return e(t, n[0]) ? {
|
|
10
|
+
points: n,
|
|
11
|
+
closed: !1
|
|
12
|
+
} : {
|
|
13
|
+
points: [...n, t],
|
|
14
|
+
closed: !1
|
|
15
|
+
};
|
|
16
|
+
if (n.length >= 2) {
|
|
17
|
+
let r = e(t, n[0]);
|
|
18
|
+
return r ? {
|
|
19
|
+
points: n,
|
|
20
|
+
closed: r
|
|
21
|
+
} : n.find((n) => e(n, t)) ? {
|
|
22
|
+
points: n,
|
|
23
|
+
closed: !1
|
|
24
|
+
} : {
|
|
25
|
+
points: [...n, t],
|
|
26
|
+
closed: !1
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
}, r = () => ({
|
|
30
|
+
type: "polygon",
|
|
31
|
+
Component: t,
|
|
32
|
+
complete: (e, t) => ({
|
|
33
|
+
...t,
|
|
34
|
+
building: !1,
|
|
35
|
+
closed: !0
|
|
36
|
+
}),
|
|
37
|
+
addPoint: (e, t) => {
|
|
38
|
+
if (t) {
|
|
39
|
+
let { closed: r, points: i } = n(e, t.points);
|
|
40
|
+
return {
|
|
41
|
+
...t,
|
|
42
|
+
closed: r,
|
|
43
|
+
points: i,
|
|
44
|
+
building: !r
|
|
45
|
+
};
|
|
46
|
+
} else return {
|
|
47
|
+
type: "polygon",
|
|
48
|
+
points: [e],
|
|
49
|
+
closed: !1,
|
|
50
|
+
building: !0
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
//#endregion
|
|
55
|
+
export { r as tool };
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/graphing-solution-set/src/tools/polygon/line.jsx
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*
|
|
5
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
+
* Manual edits will be overwritten on next sync.
|
|
7
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import PropTypes from 'prop-types';
|
|
11
|
+
declare class RawLine extends React.Component {
|
|
12
|
+
static propTypes: {
|
|
13
|
+
className: PropTypes.Requireable<string>;
|
|
14
|
+
from: PropTypes.Requireable<PropTypes.InferProps<{
|
|
15
|
+
x: PropTypes.Validator<number>;
|
|
16
|
+
y: PropTypes.Validator<number>;
|
|
17
|
+
}>>;
|
|
18
|
+
to: PropTypes.Requireable<PropTypes.InferProps<{
|
|
19
|
+
x: PropTypes.Validator<number>;
|
|
20
|
+
y: PropTypes.Validator<number>;
|
|
21
|
+
}>>;
|
|
22
|
+
graphProps: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
23
|
+
scale: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
24
|
+
x: PropTypes.Validator<(...args: any[]) => any>;
|
|
25
|
+
y: PropTypes.Validator<(...args: any[]) => any>;
|
|
26
|
+
}>>>;
|
|
27
|
+
snap: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
28
|
+
x: PropTypes.Validator<(...args: any[]) => any>;
|
|
29
|
+
y: PropTypes.Validator<(...args: any[]) => any>;
|
|
30
|
+
}>>>;
|
|
31
|
+
domain: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
32
|
+
min: PropTypes.Validator<number>;
|
|
33
|
+
max: PropTypes.Validator<number>;
|
|
34
|
+
step: PropTypes.Requireable<number>;
|
|
35
|
+
}>>>;
|
|
36
|
+
range: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
37
|
+
min: PropTypes.Validator<number>;
|
|
38
|
+
max: PropTypes.Validator<number>;
|
|
39
|
+
step: PropTypes.Requireable<number>;
|
|
40
|
+
}>>>;
|
|
41
|
+
size: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
42
|
+
width: PropTypes.Validator<number>;
|
|
43
|
+
height: PropTypes.Validator<number>;
|
|
44
|
+
}>>>;
|
|
45
|
+
}>>>;
|
|
46
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
47
|
+
correctness: PropTypes.Requireable<string>;
|
|
48
|
+
};
|
|
49
|
+
static defaultProps: {
|
|
50
|
+
from: {};
|
|
51
|
+
to: {};
|
|
52
|
+
};
|
|
53
|
+
render(): JSX.Element;
|
|
54
|
+
}
|
|
55
|
+
export declare const Line: typeof RawLine;
|
|
56
|
+
declare const _default: {
|
|
57
|
+
new (props: any): {
|
|
58
|
+
grid: any;
|
|
59
|
+
onStart: any;
|
|
60
|
+
position: any;
|
|
61
|
+
tiny: any;
|
|
62
|
+
getScaledBounds: any;
|
|
63
|
+
getClientPoint: any;
|
|
64
|
+
skipDragOutsideOfBounds: any;
|
|
65
|
+
onDrag: any;
|
|
66
|
+
getDelta: any;
|
|
67
|
+
applyDelta: any;
|
|
68
|
+
onStop: any;
|
|
69
|
+
render(): JSX.Element;
|
|
70
|
+
};
|
|
71
|
+
propTypes: {
|
|
72
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
73
|
+
onDragStart: PropTypes.Requireable<(...args: any[]) => any>;
|
|
74
|
+
onDrag: PropTypes.Requireable<(...args: any[]) => any>;
|
|
75
|
+
onDragStop: PropTypes.Requireable<(...args: any[]) => any>;
|
|
76
|
+
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
77
|
+
onMove: PropTypes.Requireable<(...args: any[]) => any>;
|
|
78
|
+
graphProps: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
79
|
+
scale: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
80
|
+
x: PropTypes.Validator<(...args: any[]) => any>;
|
|
81
|
+
y: PropTypes.Validator<(...args: any[]) => any>;
|
|
82
|
+
}>>>;
|
|
83
|
+
snap: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
84
|
+
x: PropTypes.Validator<(...args: any[]) => any>;
|
|
85
|
+
y: PropTypes.Validator<(...args: any[]) => any>;
|
|
86
|
+
}>>>;
|
|
87
|
+
domain: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
88
|
+
min: PropTypes.Validator<number>;
|
|
89
|
+
max: PropTypes.Validator<number>;
|
|
90
|
+
step: PropTypes.Requireable<number>;
|
|
91
|
+
}>>>;
|
|
92
|
+
range: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
93
|
+
min: PropTypes.Validator<number>;
|
|
94
|
+
max: PropTypes.Validator<number>;
|
|
95
|
+
step: PropTypes.Requireable<number>;
|
|
96
|
+
}>>>;
|
|
97
|
+
size: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
98
|
+
width: PropTypes.Validator<number>;
|
|
99
|
+
height: PropTypes.Validator<number>;
|
|
100
|
+
}>>>;
|
|
101
|
+
}>>>;
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
export default _default;
|
|
105
|
+
//# sourceMappingURL=line.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"line.d.ts","sourceRoot":"","sources":["../../../src/tools/polygon/line.tsx"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,SAAS,MAAM,YAAY,CAAC;AA0BnC,cAAM,OAAQ,SAAQ,KAAK,CAAC,SAAS;IACnC,MAAM,CAAC,SAAS;;;;;;;;;;;;wCAsBC,GAAG;wCAED,GAAG;;;wCAUN,GAAG;wCAEjB,GAAC;;;;;;;;;;;;;;;;;;;MA7BD;IAEF,MAAM,CAAC,YAAY;;;MAGjB;IAEF,MAAM;CAgBP;AAED,eAAO,MAAM,IAAI,gBAAU,CAAC;;;;;;;;;;;;;;;;;;4CA3BD,GAC3B;uCAGoB,GAAG;2CAMN,GAAG;wCAA8D,GAAG;uCAG9E,GAAG;;;wCAQF,GAAN;wCAMqB,GAAG;;;wCAMtB,GAAF;wCAEW,GAAG;;;;;;;;;;;;;;;;;;;AANhB,wBAiBS"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/graphing-solution-set/src/tools/polygon/polygon.jsx
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*
|
|
5
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
+
* Manual edits will be overwritten on next sync.
|
|
7
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import PropTypes from 'prop-types';
|
|
11
|
+
export declare const getPointString: (points: any, scale: any) => any;
|
|
12
|
+
export declare class RawPolygon extends React.Component {
|
|
13
|
+
static propTypes: {
|
|
14
|
+
className: PropTypes.Requireable<string>;
|
|
15
|
+
isSolution: PropTypes.Requireable<boolean>;
|
|
16
|
+
points: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
17
|
+
x: PropTypes.Validator<number>;
|
|
18
|
+
y: PropTypes.Validator<number>;
|
|
19
|
+
}> | null | undefined)[]>;
|
|
20
|
+
graphProps: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
21
|
+
scale: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
22
|
+
x: PropTypes.Validator<(...args: any[]) => any>;
|
|
23
|
+
y: PropTypes.Validator<(...args: any[]) => any>;
|
|
24
|
+
}>>>;
|
|
25
|
+
snap: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
26
|
+
x: PropTypes.Validator<(...args: any[]) => any>;
|
|
27
|
+
y: PropTypes.Validator<(...args: any[]) => any>;
|
|
28
|
+
}>>>;
|
|
29
|
+
domain: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
30
|
+
min: PropTypes.Validator<number>;
|
|
31
|
+
max: PropTypes.Validator<number>;
|
|
32
|
+
step: PropTypes.Requireable<number>;
|
|
33
|
+
}>>>;
|
|
34
|
+
range: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
35
|
+
min: PropTypes.Validator<number>;
|
|
36
|
+
max: PropTypes.Validator<number>;
|
|
37
|
+
step: PropTypes.Requireable<number>;
|
|
38
|
+
}>>>;
|
|
39
|
+
size: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
40
|
+
width: PropTypes.Validator<number>;
|
|
41
|
+
height: PropTypes.Validator<number>;
|
|
42
|
+
}>>>;
|
|
43
|
+
}>>>;
|
|
44
|
+
closed: PropTypes.Validator<boolean>;
|
|
45
|
+
correctness: PropTypes.Requireable<string>;
|
|
46
|
+
};
|
|
47
|
+
static defaultProps: {
|
|
48
|
+
points: never[];
|
|
49
|
+
};
|
|
50
|
+
render(): JSX.Element;
|
|
51
|
+
}
|
|
52
|
+
export declare const Polygon: typeof RawPolygon;
|
|
53
|
+
declare const _default: {
|
|
54
|
+
new (props: any): {
|
|
55
|
+
grid: any;
|
|
56
|
+
onStart: any;
|
|
57
|
+
position: any;
|
|
58
|
+
tiny: any;
|
|
59
|
+
getScaledBounds: any;
|
|
60
|
+
getClientPoint: any;
|
|
61
|
+
skipDragOutsideOfBounds: any;
|
|
62
|
+
onDrag: any;
|
|
63
|
+
getDelta: any;
|
|
64
|
+
applyDelta: any;
|
|
65
|
+
onStop: any;
|
|
66
|
+
render(): JSX.Element;
|
|
67
|
+
};
|
|
68
|
+
propTypes: {
|
|
69
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
70
|
+
onDragStart: PropTypes.Requireable<(...args: any[]) => any>;
|
|
71
|
+
onDrag: PropTypes.Requireable<(...args: any[]) => any>;
|
|
72
|
+
onDragStop: PropTypes.Requireable<(...args: any[]) => any>;
|
|
73
|
+
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
74
|
+
onMove: PropTypes.Requireable<(...args: any[]) => any>;
|
|
75
|
+
graphProps: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
76
|
+
scale: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
77
|
+
x: PropTypes.Validator<(...args: any[]) => any>;
|
|
78
|
+
y: PropTypes.Validator<(...args: any[]) => any>;
|
|
79
|
+
}>>>;
|
|
80
|
+
snap: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
81
|
+
x: PropTypes.Validator<(...args: any[]) => any>;
|
|
82
|
+
y: PropTypes.Validator<(...args: any[]) => any>;
|
|
83
|
+
}>>>;
|
|
84
|
+
domain: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
85
|
+
min: PropTypes.Validator<number>;
|
|
86
|
+
max: PropTypes.Validator<number>;
|
|
87
|
+
step: PropTypes.Requireable<number>;
|
|
88
|
+
}>>>;
|
|
89
|
+
range: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
90
|
+
min: PropTypes.Validator<number>;
|
|
91
|
+
max: PropTypes.Validator<number>;
|
|
92
|
+
step: PropTypes.Requireable<number>;
|
|
93
|
+
}>>>;
|
|
94
|
+
size: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
95
|
+
width: PropTypes.Validator<number>;
|
|
96
|
+
height: PropTypes.Validator<number>;
|
|
97
|
+
}>>>;
|
|
98
|
+
}>>>;
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
export default _default;
|
|
102
|
+
//# sourceMappingURL=polygon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"polygon.d.ts","sourceRoot":"","sources":["../../../src/tools/polygon/polygon.tsx"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,SAAS,MAAM,YAAY,CAAC;AA8BnC,eAAO,MAAM,cAAc,GAAI,WAAM,EAAE,UAAK,QAU3C,CAAC;AAEF,qBAAa,UAAW,SAAQ,KAAK,CAAC,SAAS;IAC7C,MAAM,CAAC,SAAS;;;;;;;;;wCACG,GAAG;wCAEX,GAAG;;;wCAGP,GAAG;wCAIR,GAAF;;;;;;;;;;;;;;;;;;;MAHE;IAEF,MAAM,CAAC,YAAY;;MAEjB;IAEF,MAAM;CAgBP;AAED,eAAO,MAAM,OAAO,mBAAa,CAAC;;;;;;;;;;;;;;;;;;4CA/CM,GAAG;uCAGJ,GAAG;2CAG5B,GAAG;wCAGX,GAAF;uCAGA,GAAF;;;wCAQK,GAAG;wCACa,GAAG;;;wCASY,GAAG;wCACrC,GAAE;;;;;;;;;;;;;;;;;;;AAkBN,wBAeY"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { bounds as e, point as t, polygonToArea as n } from "../../utils.js";
|
|
2
|
+
import { correct as r, incorrect as i } from "../shared/styles.js";
|
|
3
|
+
import a from "react";
|
|
4
|
+
import o from "prop-types";
|
|
5
|
+
import { gridDraggable as s, types as c } from "@pie-lib/plot";
|
|
6
|
+
import { styled as l } from "@mui/material/styles";
|
|
7
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
8
|
+
//#region src/tools/polygon/polygon.tsx
|
|
9
|
+
var d = l("polygon", { shouldForwardProp: (e) => !["isSolution", "correctness"].includes(e) })(({ isSolution: e, correctness: t }) => ({
|
|
10
|
+
fill: e ? "rgb(60, 73, 150, 0.6)" : "transparent",
|
|
11
|
+
strokeWidth: 2,
|
|
12
|
+
"&:hover": { fill: e ? "rgb(60, 73, 150, 0.6)" : "rgb(0, 0, 0, 0.25)" },
|
|
13
|
+
...t === "correct" && r("stroke"),
|
|
14
|
+
...t === "incorrect" && i("stroke")
|
|
15
|
+
})), f = l("polyline", { shouldForwardProp: (e) => !["isSolution", "correctness"].includes(e) })(({ isSolution: e, correctness: t }) => ({
|
|
16
|
+
fill: e ? "rgb(60, 73, 150, 0.6)" : "transparent",
|
|
17
|
+
strokeWidth: 2,
|
|
18
|
+
"&:hover": { fill: e ? "rgb(60, 73, 150, 0.6)" : "rgb(0, 0, 0, 0.25)" },
|
|
19
|
+
...t === "correct" && r("stroke"),
|
|
20
|
+
...t === "incorrect" && i("stroke")
|
|
21
|
+
})), p = (e, t) => (e || []).map((e) => {
|
|
22
|
+
let n = {
|
|
23
|
+
x: t.x(e.x),
|
|
24
|
+
y: t.y(e.y)
|
|
25
|
+
};
|
|
26
|
+
return `${n.x},${n.y}`;
|
|
27
|
+
}).join(" "), m = class extends a.Component {
|
|
28
|
+
static propTypes = {
|
|
29
|
+
className: o.string,
|
|
30
|
+
isSolution: o.bool,
|
|
31
|
+
points: o.arrayOf(c.PointType),
|
|
32
|
+
graphProps: c.GraphPropsType.isRequired,
|
|
33
|
+
closed: o.bool.isRequired,
|
|
34
|
+
correctness: o.string
|
|
35
|
+
};
|
|
36
|
+
static defaultProps = { points: [] };
|
|
37
|
+
render() {
|
|
38
|
+
let { points: e, className: t, correctness: n, graphProps: r, closed: i, isSolution: a, ...o } = this.props, { scale: s } = r, c = p(e, s);
|
|
39
|
+
return /* @__PURE__ */ u(i ? d : f, {
|
|
40
|
+
points: c,
|
|
41
|
+
isSolution: a,
|
|
42
|
+
correctness: n,
|
|
43
|
+
className: t,
|
|
44
|
+
...o
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}, h = s({
|
|
48
|
+
bounds: (t, { domain: r, range: i }) => {
|
|
49
|
+
let { points: a } = t;
|
|
50
|
+
return e(n(a), r, i);
|
|
51
|
+
},
|
|
52
|
+
anchorPoint: (e) => {
|
|
53
|
+
let { points: t } = e;
|
|
54
|
+
return t[0];
|
|
55
|
+
},
|
|
56
|
+
fromDelta: (e, n) => {
|
|
57
|
+
let { points: r } = e;
|
|
58
|
+
return r.map((e) => t(e).add(t(n)));
|
|
59
|
+
}
|
|
60
|
+
})(m);
|
|
61
|
+
//#endregion
|
|
62
|
+
export { h as default };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/graphing-solution-set/src/tools/shared/arrow-head.jsx
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*
|
|
5
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
+
* Manual edits will be overwritten on next sync.
|
|
7
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
+
*/
|
|
9
|
+
import PropTypes from 'prop-types';
|
|
10
|
+
export declare const ArrowHead: {
|
|
11
|
+
({ size, transform, points }: {
|
|
12
|
+
size: any;
|
|
13
|
+
transform: any;
|
|
14
|
+
points: any;
|
|
15
|
+
}): JSX.Element;
|
|
16
|
+
propTypes: {
|
|
17
|
+
points: PropTypes.Requireable<string>;
|
|
18
|
+
size: PropTypes.Requireable<number>;
|
|
19
|
+
transform: PropTypes.Requireable<string>;
|
|
20
|
+
};
|
|
21
|
+
defaultProps: {
|
|
22
|
+
points: string;
|
|
23
|
+
size: number;
|
|
24
|
+
transform: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export declare const genUid: () => string;
|
|
28
|
+
export declare const ArrowMarker: {
|
|
29
|
+
({ id, size, className }: {
|
|
30
|
+
id: any;
|
|
31
|
+
size: any;
|
|
32
|
+
className: any;
|
|
33
|
+
}): JSX.Element;
|
|
34
|
+
propTypes: {
|
|
35
|
+
id: PropTypes.Requireable<string>;
|
|
36
|
+
size: PropTypes.Requireable<number>;
|
|
37
|
+
className: PropTypes.Requireable<string>;
|
|
38
|
+
};
|
|
39
|
+
defaultProps: {
|
|
40
|
+
size: number;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=arrow-head.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arrow-head.d.ts","sourceRoot":"","sources":["../../../src/tools/shared/arrow-head.tsx"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAGH,OAAO,SAAS,MAAM,YAAY,CAAC;AAGnC,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;CAErB,CAAC;AAWF,eAAO,MAAM,MAAM,cAGlB,CAAC;AACF,eAAO,MAAM,WAAW;;;;;;;;;;;;;;CAgBvB,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import "react";
|
|
2
|
+
import e from "prop-types";
|
|
3
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
4
|
+
import { color as n } from "@pie-lib/render-ui";
|
|
5
|
+
//#region src/tools/shared/arrow-head.tsx
|
|
6
|
+
var r = ({ size: e, transform: n, points: r }) => /* @__PURE__ */ t("polygon", {
|
|
7
|
+
points: r || `0,0 ${e},${e / 2} 0,${e}`,
|
|
8
|
+
transform: n
|
|
9
|
+
});
|
|
10
|
+
r.propTypes = {
|
|
11
|
+
points: e.string,
|
|
12
|
+
size: e.number,
|
|
13
|
+
transform: e.string
|
|
14
|
+
}, r.defaultProps = {
|
|
15
|
+
points: "",
|
|
16
|
+
size: 10,
|
|
17
|
+
transform: ""
|
|
18
|
+
};
|
|
19
|
+
var i = () => `arrow-${(Math.random() * 1e3).toFixed(0)}`, a = ({ id: e, size: i, className: a }) => /* @__PURE__ */ t("marker", {
|
|
20
|
+
id: e,
|
|
21
|
+
viewBox: `0 0 ${i} ${i}`,
|
|
22
|
+
refX: i / 2,
|
|
23
|
+
refY: i / 2,
|
|
24
|
+
markerWidth: i,
|
|
25
|
+
markerHeight: i,
|
|
26
|
+
orient: "auto-start-reverse",
|
|
27
|
+
className: a,
|
|
28
|
+
style: { fill: n.defaults.BLACK },
|
|
29
|
+
children: /* @__PURE__ */ t(r, { size: i })
|
|
30
|
+
});
|
|
31
|
+
a.propTypes = {
|
|
32
|
+
id: e.string,
|
|
33
|
+
size: e.number,
|
|
34
|
+
className: e.string
|
|
35
|
+
}, a.defaultProps = { size: 5 };
|
|
36
|
+
//#endregion
|
|
37
|
+
export { r as ArrowHead, a as ArrowMarker, i as genUid };
|