@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.
Files changed (257) hide show
  1. package/dist/_virtual/_rolldown/runtime.js +23 -0
  2. package/dist/axis/arrow.d.ts +14 -0
  3. package/dist/axis/arrow.d.ts.map +1 -0
  4. package/dist/axis/arrow.js +34 -0
  5. package/dist/axis/axes.d.ts +133 -0
  6. package/dist/axis/axes.d.ts.map +1 -0
  7. package/dist/axis/axes.js +214 -0
  8. package/dist/axis/index.d.ts +11 -0
  9. package/dist/axis/index.d.ts.map +1 -0
  10. package/dist/bg.d.ts +52 -0
  11. package/dist/bg.d.ts.map +1 -0
  12. package/dist/bg.js +44 -0
  13. package/dist/container/actions.d.ts +16 -0
  14. package/dist/container/actions.d.ts.map +1 -0
  15. package/dist/container/actions.js +7 -0
  16. package/dist/container/index.d.ts +27 -0
  17. package/dist/container/index.d.ts.map +1 -0
  18. package/dist/container/index.js +48 -0
  19. package/dist/container/marks.d.ts +11 -0
  20. package/dist/container/marks.d.ts.map +1 -0
  21. package/dist/container/marks.js +11 -0
  22. package/dist/container/middleware.d.ts +11 -0
  23. package/dist/container/middleware.d.ts.map +1 -0
  24. package/dist/container/middleware.js +4 -0
  25. package/dist/container/reducer.d.ts +13 -0
  26. package/dist/container/reducer.d.ts.map +1 -0
  27. package/dist/container/reducer.js +7 -0
  28. package/dist/coordinates-label.d.ts +50 -0
  29. package/dist/coordinates-label.d.ts.map +1 -0
  30. package/dist/coordinates-label.js +46 -0
  31. package/dist/graph-with-controls.d.ts +86 -0
  32. package/dist/graph-with-controls.d.ts.map +1 -0
  33. package/dist/graph-with-controls.js +155 -0
  34. package/dist/graph.d.ts +120 -0
  35. package/dist/graph.d.ts.map +1 -0
  36. package/dist/graph.js +221 -0
  37. package/dist/grid-setup.d.ts +27 -0
  38. package/dist/grid-setup.d.ts.map +1 -0
  39. package/dist/grid-setup.js +307 -0
  40. package/dist/grid.d.ts +44 -0
  41. package/dist/grid.d.ts.map +1 -0
  42. package/dist/grid.js +59 -0
  43. package/dist/index.d.ts +15 -0
  44. package/dist/index.d.ts.map +1 -0
  45. package/dist/index.js +6 -0
  46. package/dist/labels.d.ts +74 -0
  47. package/dist/labels.d.ts.map +1 -0
  48. package/dist/labels.js +134 -0
  49. package/dist/mark-label.d.ts +50 -0
  50. package/dist/mark-label.d.ts.map +1 -0
  51. package/dist/mark-label.js +84 -0
  52. package/dist/node_modules/.bun/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js +7 -0
  53. package/dist/node_modules/.bun/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/defineProperty.js +12 -0
  54. package/dist/node_modules/.bun/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/extends.js +12 -0
  55. package/dist/node_modules/.bun/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js +7 -0
  56. package/dist/node_modules/.bun/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/objectSpread2.js +25 -0
  57. package/dist/node_modules/.bun/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js +12 -0
  58. package/dist/node_modules/.bun/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js +8 -0
  59. package/dist/node_modules/.bun/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/toPrimitive.js +14 -0
  60. package/dist/node_modules/.bun/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js +9 -0
  61. package/dist/node_modules/.bun/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/typeof.js +11 -0
  62. package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/axis/Axis.js +100 -0
  63. package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/axis/AxisRenderer.js +61 -0
  64. package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/axis/Ticks.js +42 -0
  65. package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/constants/orientation.js +9 -0
  66. package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/utils/createPoint.js +14 -0
  67. package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/utils/getAxisRangePaddingConfig.js +21 -0
  68. package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/utils/getLabelTransform.js +16 -0
  69. package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/utils/getTickFormatter.js +8 -0
  70. package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/utils/getTickPosition.js +15 -0
  71. package/dist/node_modules/.bun/@visx_grid@3.12.0_f4eacebf2041cd4f/node_modules/@visx/grid/esm/grids/Grid.js +78 -0
  72. package/dist/node_modules/.bun/@visx_grid@3.12.0_f4eacebf2041cd4f/node_modules/@visx/grid/esm/grids/GridColumns.js +79 -0
  73. package/dist/node_modules/.bun/@visx_grid@3.12.0_f4eacebf2041cd4f/node_modules/@visx/grid/esm/grids/GridRows.js +79 -0
  74. package/dist/node_modules/.bun/@visx_grid@3.12.0_f4eacebf2041cd4f/node_modules/@visx/grid/esm/utils/getScaleBandwidth.js +6 -0
  75. package/dist/node_modules/.bun/@visx_group@3.12.0_f4eacebf2041cd4f/node_modules/@visx/group/esm/Group.js +49 -0
  76. package/dist/node_modules/.bun/@visx_point@3.12.0/node_modules/@visx/point/esm/Point.js +18 -0
  77. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/utils/coerceNumber.js +10 -0
  78. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/utils/getTicks.js +9 -0
  79. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/utils/toString.js +6 -0
  80. package/dist/node_modules/.bun/@visx_shape@3.12.0_f4eacebf2041cd4f/node_modules/@visx/shape/esm/shapes/Line.js +46 -0
  81. package/dist/node_modules/.bun/@visx_shape@3.12.0_f4eacebf2041cd4f/node_modules/@visx/shape/lib/shapes/Line.js +52 -0
  82. package/dist/node_modules/.bun/@visx_text@3.12.0_f4eacebf2041cd4f/node_modules/@visx/text/esm/Text.js +57 -0
  83. package/dist/node_modules/.bun/@visx_text@3.12.0_f4eacebf2041cd4f/node_modules/@visx/text/esm/hooks/useText.js +91 -0
  84. package/dist/node_modules/.bun/@visx_text@3.12.0_f4eacebf2041cd4f/node_modules/@visx/text/esm/util/getStringWidth.js +21 -0
  85. package/dist/node_modules/.bun/balanced-match@0.4.2/node_modules/balanced-match/index.js +32 -0
  86. package/dist/node_modules/.bun/balanced-match@1.0.2/node_modules/balanced-match/index.js +33 -0
  87. 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
  88. package/dist/node_modules/.bun/invariant@2.2.4/node_modules/invariant/browser.js +28 -0
  89. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_Hash.js +21 -0
  90. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_ListCache.js +21 -0
  91. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_Map.js +10 -0
  92. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_MapCache.js +21 -0
  93. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_Symbol.js +9 -0
  94. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_assocIndexOf.js +14 -0
  95. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_baseGetTag.js +15 -0
  96. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_baseIsNative.js +16 -0
  97. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_coreJsData.js +9 -0
  98. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_freeGlobal.js +8 -0
  99. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_getMapData.js +14 -0
  100. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_getNative.js +15 -0
  101. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_getRawTag.js +19 -0
  102. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_getValue.js +11 -0
  103. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_hashClear.js +13 -0
  104. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_hashDelete.js +12 -0
  105. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_hashGet.js +18 -0
  106. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_hashHas.js +14 -0
  107. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_hashSet.js +14 -0
  108. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_isKeyable.js +12 -0
  109. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_isMasked.js +16 -0
  110. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_listCacheClear.js +11 -0
  111. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_listCacheDelete.js +14 -0
  112. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_listCacheGet.js +14 -0
  113. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_listCacheHas.js +13 -0
  114. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_listCacheSet.js +14 -0
  115. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_mapCacheClear.js +19 -0
  116. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_mapCacheDelete.js +14 -0
  117. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_mapCacheGet.js +13 -0
  118. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_mapCacheHas.js +13 -0
  119. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_mapCacheSet.js +14 -0
  120. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_nativeCreate.js +9 -0
  121. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_objectToString.js +12 -0
  122. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_root.js +10 -0
  123. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_toSource.js +20 -0
  124. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/eq.js +11 -0
  125. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/isFunction.js +16 -0
  126. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/isObject.js +12 -0
  127. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/memoize.js +20 -0
  128. package/dist/node_modules/.bun/math-expression-evaluator@1.4.0/node_modules/math-expression-evaluator/src/formula_evaluator.js +37 -0
  129. package/dist/node_modules/.bun/math-expression-evaluator@1.4.0/node_modules/math-expression-evaluator/src/lexer.js +509 -0
  130. package/dist/node_modules/.bun/math-expression-evaluator@1.4.0/node_modules/math-expression-evaluator/src/math_function.js +108 -0
  131. package/dist/node_modules/.bun/math-expression-evaluator@1.4.0/node_modules/math-expression-evaluator/src/postfix.js +31 -0
  132. package/dist/node_modules/.bun/math-expression-evaluator@1.4.0/node_modules/math-expression-evaluator/src/postfix_evaluator.js +45 -0
  133. package/dist/node_modules/.bun/react-input-autosize@2.2.2_f4eacebf2041cd4f/node_modules/react-input-autosize/lib/AutosizeInput.js +216 -0
  134. package/dist/node_modules/.bun/react-is@16.13.1/node_modules/react-is/cjs/react-is.development.js +82 -0
  135. package/dist/node_modules/.bun/react-is@16.13.1/node_modules/react-is/cjs/react-is.production.min.js +62 -0
  136. package/dist/node_modules/.bun/react-is@16.13.1/node_modules/react-is/index.js +10 -0
  137. package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/components/Context.js +5 -0
  138. package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/components/Provider.js +47 -0
  139. package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/components/connectAdvanced.js +95 -0
  140. package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/connect/connect.js +52 -0
  141. package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/connect/mapDispatchToProps.js +23 -0
  142. package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/connect/mapStateToProps.js +13 -0
  143. package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/connect/mergeProps.js +26 -0
  144. package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/connect/selectorFactory.js +41 -0
  145. package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/connect/verifySubselectors.js +11 -0
  146. package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/connect/wrapMapToProps.js +28 -0
  147. package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/index.js +4 -0
  148. package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/utils/isPlainObject.js +10 -0
  149. package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/utils/shallowEqual.js +15 -0
  150. package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/utils/verifyPlainObject.js +8 -0
  151. package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/utils/warning.js +9 -0
  152. package/dist/node_modules/.bun/reduce-css-calc@1.3.0/node_modules/reduce-css-calc/index.js +49 -0
  153. package/dist/node_modules/.bun/reduce-function-call@1.0.3/node_modules/reduce-function-call/index.js +34 -0
  154. package/dist/node_modules/.bun/redux-undo@1.1.0/node_modules/redux-undo/dist/redux-undo.js +185 -0
  155. package/dist/node_modules/.bun/redux@4.2.1/node_modules/redux/es/redux.js +225 -0
  156. package/dist/toggle-bar.d.ts +41 -0
  157. package/dist/toggle-bar.d.ts.map +1 -0
  158. package/dist/tool-menu.d.ts +22 -0
  159. package/dist/tool-menu.d.ts.map +1 -0
  160. package/dist/tool-menu.js +188 -0
  161. package/dist/tools/index.d.ts +18 -0
  162. package/dist/tools/index.d.ts.map +1 -0
  163. package/dist/tools/index.js +12 -0
  164. package/dist/tools/line/component.d.ts +92 -0
  165. package/dist/tools/line/component.d.ts.map +1 -0
  166. package/dist/tools/line/component.js +58 -0
  167. package/dist/tools/line/index.d.ts +14 -0
  168. package/dist/tools/line/index.d.ts.map +1 -0
  169. package/dist/tools/line/index.js +6 -0
  170. package/dist/tools/polygon/component.d.ts +115 -0
  171. package/dist/tools/polygon/component.d.ts.map +1 -0
  172. package/dist/tools/polygon/component.js +194 -0
  173. package/dist/tools/polygon/index.d.ts +20 -0
  174. package/dist/tools/polygon/index.d.ts.map +1 -0
  175. package/dist/tools/polygon/index.js +55 -0
  176. package/dist/tools/polygon/line.d.ts +105 -0
  177. package/dist/tools/polygon/line.d.ts.map +1 -0
  178. package/dist/tools/polygon/polygon.d.ts +102 -0
  179. package/dist/tools/polygon/polygon.d.ts.map +1 -0
  180. package/dist/tools/polygon/polygon.js +62 -0
  181. package/dist/tools/shared/arrow-head.d.ts +43 -0
  182. package/dist/tools/shared/arrow-head.d.ts.map +1 -0
  183. package/dist/tools/shared/arrow-head.js +37 -0
  184. package/dist/tools/shared/line/index.d.ts +165 -0
  185. package/dist/tools/shared/line/index.d.ts.map +1 -0
  186. package/dist/tools/shared/line/index.js +320 -0
  187. package/dist/tools/shared/line/line-path.d.ts +58 -0
  188. package/dist/tools/shared/line/line-path.d.ts.map +1 -0
  189. package/dist/tools/shared/line/with-root-edge.d.ts +89 -0
  190. package/dist/tools/shared/line/with-root-edge.d.ts.map +1 -0
  191. package/dist/tools/shared/point/arrow-point.d.ts +58 -0
  192. package/dist/tools/shared/point/arrow-point.d.ts.map +1 -0
  193. package/dist/tools/shared/point/arrow-point.js +47 -0
  194. package/dist/tools/shared/point/arrow.d.ts +47 -0
  195. package/dist/tools/shared/point/arrow.d.ts.map +1 -0
  196. package/dist/tools/shared/point/arrow.js +36 -0
  197. package/dist/tools/shared/point/base-point.d.ts +51 -0
  198. package/dist/tools/shared/point/base-point.d.ts.map +1 -0
  199. package/dist/tools/shared/point/base-point.js +88 -0
  200. package/dist/tools/shared/point/index.d.ts +154 -0
  201. package/dist/tools/shared/point/index.d.ts.map +1 -0
  202. package/dist/tools/shared/point/index.js +51 -0
  203. package/dist/tools/shared/styles.d.ts +25 -0
  204. package/dist/tools/shared/styles.d.ts.map +1 -0
  205. package/dist/tools/shared/styles.js +17 -0
  206. package/dist/tools/shared/types.d.ts +16 -0
  207. package/dist/tools/shared/types.d.ts.map +1 -0
  208. package/dist/tools/shared/types.js +10 -0
  209. package/dist/undo-redo.d.ts +21 -0
  210. package/dist/undo-redo.d.ts.map +1 -0
  211. package/dist/undo-redo.js +33 -0
  212. package/dist/use-debounce.d.ts +10 -0
  213. package/dist/use-debounce.d.ts.map +1 -0
  214. package/dist/use-debounce.js +13 -0
  215. package/dist/utils.d.ts +59 -0
  216. package/dist/utils.d.ts.map +1 -0
  217. package/dist/utils.js +72 -0
  218. package/package.json +64 -0
  219. package/src/axis/arrow.tsx +67 -0
  220. package/src/axis/axes.tsx +321 -0
  221. package/src/axis/index.ts +13 -0
  222. package/src/bg.tsx +106 -0
  223. package/src/container/actions.ts +18 -0
  224. package/src/container/index.tsx +95 -0
  225. package/src/container/marks.ts +24 -0
  226. package/src/container/middleware.ts +17 -0
  227. package/src/container/reducer.ts +15 -0
  228. package/src/coordinates-label.tsx +72 -0
  229. package/src/graph-with-controls.tsx +252 -0
  230. package/src/graph.tsx +343 -0
  231. package/src/grid-setup.tsx +470 -0
  232. package/src/grid.tsx +143 -0
  233. package/src/index.ts +17 -0
  234. package/src/labels.tsx +211 -0
  235. package/src/mark-label.tsx +135 -0
  236. package/src/toggle-bar.tsx +231 -0
  237. package/src/tool-menu.tsx +245 -0
  238. package/src/tools/index.ts +18 -0
  239. package/src/tools/line/component.tsx +87 -0
  240. package/src/tools/line/index.ts +14 -0
  241. package/src/tools/polygon/component.tsx +334 -0
  242. package/src/tools/polygon/index.ts +62 -0
  243. package/src/tools/polygon/line.tsx +90 -0
  244. package/src/tools/polygon/polygon.tsx +103 -0
  245. package/src/tools/shared/arrow-head.tsx +56 -0
  246. package/src/tools/shared/line/index.tsx +481 -0
  247. package/src/tools/shared/line/line-path.tsx +95 -0
  248. package/src/tools/shared/line/with-root-edge.tsx +107 -0
  249. package/src/tools/shared/point/arrow-point.tsx +70 -0
  250. package/src/tools/shared/point/arrow.tsx +50 -0
  251. package/src/tools/shared/point/base-point.tsx +123 -0
  252. package/src/tools/shared/point/index.tsx +68 -0
  253. package/src/tools/shared/styles.ts +30 -0
  254. package/src/tools/shared/types.ts +18 -0
  255. package/src/undo-redo.tsx +47 -0
  256. package/src/use-debounce.ts +23 -0
  257. package/src/utils.ts +240 -0
@@ -0,0 +1,62 @@
1
+ // @ts-nocheck
2
+ /**
3
+ * @synced-from pie-lib/packages/graphing-solution-set/src/tools/polygon/index.js
4
+ * @auto-generated
5
+ *
6
+ * This file is automatically synced from pie-elements and converted to TypeScript.
7
+ * Manual edits will be overwritten on next sync.
8
+ * To make changes, edit the upstream JavaScript file and run sync again.
9
+ */
10
+
11
+ import Polygon from './component.js';
12
+ import { equalPoints } from '../../utils.js';
13
+
14
+ export const addPointToArray = (point, arr) => {
15
+ arr = arr || [];
16
+
17
+ if (arr.length === 0) {
18
+ return { points: [point], closed: false };
19
+ } else if (arr.length === 1) {
20
+ if (equalPoints(point, arr[0])) {
21
+ return { points: arr, closed: false };
22
+ } else {
23
+ return { points: [...arr, point], closed: false };
24
+ }
25
+ } else if (arr.length >= 2) {
26
+ const closed = equalPoints(point, arr[0]);
27
+
28
+ if (closed) {
29
+ return { points: arr, closed };
30
+ } else {
31
+ const hasPoint = !!arr.find((p) => equalPoints(p, point));
32
+
33
+ if (hasPoint) {
34
+ return { points: arr, closed: false };
35
+ } else {
36
+ return { points: [...arr, point], closed: false };
37
+ }
38
+ }
39
+ }
40
+ };
41
+
42
+ export const tool = () => ({
43
+ type: 'polygon',
44
+ Component: Polygon,
45
+ complete: (data, mark) => {
46
+ return { ...mark, building: false, closed: true };
47
+ },
48
+ addPoint: (point, mark) => {
49
+ if (!mark) {
50
+ return {
51
+ type: 'polygon',
52
+ points: [point],
53
+ closed: false,
54
+ building: true,
55
+ };
56
+ } else {
57
+ const { closed, points } = addPointToArray(point, mark.points);
58
+
59
+ return { ...mark, closed, points, building: !closed };
60
+ }
61
+ },
62
+ });
@@ -0,0 +1,90 @@
1
+ // @ts-nocheck
2
+ /**
3
+ * @synced-from pie-lib/packages/graphing-solution-set/src/tools/polygon/line.jsx
4
+ * @auto-generated
5
+ *
6
+ * This file is automatically synced from pie-elements and converted to TypeScript.
7
+ * Manual edits will be overwritten on next sync.
8
+ * To make changes, edit the upstream JavaScript file and run sync again.
9
+ */
10
+
11
+ import React from 'react';
12
+ import PropTypes from 'prop-types';
13
+ import { styled } from '@mui/material/styles';
14
+ import { gridDraggable, types } from '@pie-lib/plot';
15
+ import { color } from '@pie-lib/render-ui';
16
+ import * as utils from '../../utils.js';
17
+ import { correct, disabled, incorrect, missing } from '../shared/styles.js';
18
+
19
+ const StyledLine: any = styled('line', {
20
+ shouldForwardProp: (prop) => !['disabled', 'correctness'].includes(prop),
21
+ })(({ disabled: isDisabled, correctness }) => ({
22
+ strokeWidth: 6,
23
+ transition: 'stroke-width 200ms ease-in, stroke 200ms ease-in',
24
+ stroke: 'transparent',
25
+ '&:hover': {
26
+ strokeWidth: 7,
27
+ stroke: color.defaults.SECONDARY,
28
+ },
29
+ ...(isDisabled && {
30
+ ...disabled('stroke'),
31
+ strokeWidth: 2,
32
+ }),
33
+ ...(correctness === 'correct' && correct('stroke')),
34
+ ...(correctness === 'incorrect' && incorrect('stroke')),
35
+ ...(correctness === 'missing' && missing('stroke')),
36
+ }));
37
+
38
+ class RawLine extends React.Component {
39
+ static propTypes = {
40
+ className: PropTypes.string,
41
+ from: types.PointType,
42
+ to: types.PointType,
43
+ graphProps: types.GraphPropsType.isRequired,
44
+ disabled: PropTypes.bool,
45
+ correctness: PropTypes.string,
46
+ };
47
+
48
+ static defaultProps = {
49
+ from: {},
50
+ to: {},
51
+ };
52
+
53
+ render() {
54
+ const { graphProps, from, to, className, disabled, correctness, ...rest } = this.props;
55
+ const { scale } = graphProps;
56
+ return (
57
+ <StyledLine
58
+ x1={scale.x(from.x)}
59
+ y1={scale.y(from.y)}
60
+ x2={scale.x(to.x)}
61
+ y2={scale.y(to.y)}
62
+ disabled={disabled}
63
+ correctness={correctness}
64
+ className={className}
65
+ {...rest}
66
+ />
67
+ );
68
+ }
69
+ }
70
+
71
+ export const Line = RawLine;
72
+
73
+ export default gridDraggable({
74
+ bounds: (props, { domain, range }) => {
75
+ const { from, to } = props;
76
+ const area = utils.lineToArea(from, to);
77
+ return utils.bounds(area, domain, range);
78
+ },
79
+ anchorPoint: (props) => {
80
+ const { from } = props;
81
+ return from;
82
+ },
83
+ fromDelta: (props, delta) => {
84
+ const { from, to } = props;
85
+ return {
86
+ from: utils.point(from).add(utils.point(delta)),
87
+ to: utils.point(to).add(utils.point(delta)),
88
+ };
89
+ },
90
+ })(Line);
@@ -0,0 +1,103 @@
1
+ // @ts-nocheck
2
+ /**
3
+ * @synced-from pie-lib/packages/graphing-solution-set/src/tools/polygon/polygon.jsx
4
+ * @auto-generated
5
+ *
6
+ * This file is automatically synced from pie-elements and converted to TypeScript.
7
+ * Manual edits will be overwritten on next sync.
8
+ * To make changes, edit the upstream JavaScript file and run sync again.
9
+ */
10
+
11
+ import React from 'react';
12
+ import PropTypes from 'prop-types';
13
+ import { styled } from '@mui/material/styles';
14
+ import { gridDraggable, types } from '@pie-lib/plot';
15
+ import * as utils from '../../utils.js';
16
+ import { correct, incorrect } from '../shared/styles.js';
17
+
18
+ const StyledPolygon: any = styled('polygon', {
19
+ shouldForwardProp: (prop) => !['isSolution', 'correctness'].includes(prop),
20
+ })(({ isSolution, correctness }) => ({
21
+ fill: isSolution ? 'rgb(60, 73, 150, 0.6)' : 'transparent',
22
+ strokeWidth: 2,
23
+ '&:hover': {
24
+ fill: isSolution ? 'rgb(60, 73, 150, 0.6)' : 'rgb(0, 0, 0, 0.25)',
25
+ },
26
+ ...(correctness === 'correct' && correct('stroke')),
27
+ ...(correctness === 'incorrect' && incorrect('stroke')),
28
+ }));
29
+
30
+ const StyledPolyline: any = styled('polyline', {
31
+ shouldForwardProp: (prop) => !['isSolution', 'correctness'].includes(prop),
32
+ })(({ isSolution, correctness }) => ({
33
+ fill: isSolution ? 'rgb(60, 73, 150, 0.6)' : 'transparent',
34
+ strokeWidth: 2,
35
+ '&:hover': {
36
+ fill: isSolution ? 'rgb(60, 73, 150, 0.6)' : 'rgb(0, 0, 0, 0.25)',
37
+ },
38
+ ...(correctness === 'correct' && correct('stroke')),
39
+ ...(correctness === 'incorrect' && incorrect('stroke')),
40
+ }));
41
+
42
+ export const getPointString = (points, scale) => {
43
+ return (points || [])
44
+ .map((p) => {
45
+ const scaledPoint = {
46
+ x: scale.x(p.x),
47
+ y: scale.y(p.y),
48
+ };
49
+ return `${scaledPoint.x},${scaledPoint.y}`;
50
+ })
51
+ .join(' ');
52
+ };
53
+
54
+ export class RawPolygon extends React.Component {
55
+ static propTypes = {
56
+ className: PropTypes.string,
57
+ isSolution: PropTypes.bool,
58
+ points: PropTypes.arrayOf(types.PointType),
59
+ graphProps: types.GraphPropsType.isRequired,
60
+ closed: PropTypes.bool.isRequired,
61
+ correctness: PropTypes.string,
62
+ };
63
+
64
+ static defaultProps = {
65
+ points: [],
66
+ };
67
+
68
+ render() {
69
+ const { points, className, correctness, graphProps, closed, isSolution, ...rest } = this.props;
70
+ const { scale } = graphProps;
71
+
72
+ const pointString = getPointString(points, scale);
73
+ const Component = closed ? StyledPolygon : StyledPolyline;
74
+ return (
75
+ <Component
76
+ points={pointString}
77
+ isSolution={isSolution}
78
+ correctness={correctness}
79
+ className={className}
80
+ {...rest}
81
+ />
82
+ );
83
+ }
84
+ }
85
+
86
+ export const Polygon = RawPolygon;
87
+
88
+ export default gridDraggable({
89
+ bounds: (props, { domain, range }) => {
90
+ const { points } = props;
91
+ const area = utils.polygonToArea(points);
92
+ return utils.bounds(area, domain, range);
93
+ },
94
+ anchorPoint: (props) => {
95
+ const { points } = props;
96
+ return points[0];
97
+ },
98
+ fromDelta: (props, delta) => {
99
+ const { points } = props;
100
+
101
+ return points.map((p) => utils.point(p).add(utils.point(delta)));
102
+ },
103
+ })(Polygon);
@@ -0,0 +1,56 @@
1
+ // @ts-nocheck
2
+ /**
3
+ * @synced-from pie-lib/packages/graphing-solution-set/src/tools/shared/arrow-head.jsx
4
+ * @auto-generated
5
+ *
6
+ * This file is automatically synced from pie-elements and converted to TypeScript.
7
+ * Manual edits will be overwritten on next sync.
8
+ * To make changes, edit the upstream JavaScript file and run sync again.
9
+ */
10
+
11
+ import React from 'react';
12
+ import PropTypes from 'prop-types';
13
+ import { color } from '@pie-lib/render-ui';
14
+
15
+ export const ArrowHead = ({ size, transform, points }) => (
16
+ <polygon points={points || `0,0 ${size},${size / 2} 0,${size}`} transform={transform} />
17
+ );
18
+ ArrowHead.propTypes = {
19
+ points: PropTypes.string,
20
+ size: PropTypes.number,
21
+ transform: PropTypes.string,
22
+ };
23
+ ArrowHead.defaultProps = {
24
+ points: '',
25
+ size: 10,
26
+ transform: '',
27
+ };
28
+ export const genUid = () => {
29
+ const v = (Math.random() * 1000).toFixed(0);
30
+ return `arrow-${v}`;
31
+ };
32
+ export const ArrowMarker = ({ id, size, className }) => {
33
+ return (
34
+ <marker
35
+ id={id}
36
+ viewBox={`0 0 ${size} ${size}`}
37
+ refX={size / 2}
38
+ refY={size / 2}
39
+ markerWidth={size}
40
+ markerHeight={size}
41
+ orient="auto-start-reverse"
42
+ className={className}
43
+ style={{ fill: color.defaults.BLACK }}
44
+ >
45
+ <ArrowHead size={size} />
46
+ </marker>
47
+ );
48
+ };
49
+ ArrowMarker.propTypes = {
50
+ id: PropTypes.string,
51
+ size: PropTypes.number,
52
+ className: PropTypes.string,
53
+ };
54
+ ArrowMarker.defaultProps = {
55
+ size: 5,
56
+ };